|
|
@@ -10,7 +10,7 @@ namespace UAS_Web.tool
|
|
|
class RequestHandler : IRequestHandler
|
|
|
{
|
|
|
public event Action<byte[]> NotifyMsg;
|
|
|
-
|
|
|
+
|
|
|
string PrinterName = "";
|
|
|
|
|
|
string PrintType = "";
|
|
|
@@ -74,24 +74,32 @@ namespace UAS_Web.tool
|
|
|
str = System.Text.Encoding.UTF8.GetString(filter.dataAll.ToArray());
|
|
|
data = ToDictionary(str);
|
|
|
//获取所有的打印格式数据
|
|
|
- string PrintCode = data["data"].ToString();
|
|
|
- List<string> PrintList = new List<string>();
|
|
|
- int PrintTime = Regex.Matches(PrintCode, "XA").Count;
|
|
|
- for (int i = 0; i < PrintTime; i++)
|
|
|
+ if (data.ContainsKey("data"))
|
|
|
{
|
|
|
- PrintList.Add(PrintCode.Substring(0, PrintCode.IndexOf("XZ") + 2));
|
|
|
- PrintCode = PrintCode.Substring(PrintCode.IndexOf("XZ") + 2);
|
|
|
+ string PrintCode = data["data"].ToString();
|
|
|
+ List<string> PrintList = new List<string>();
|
|
|
+ int PrintTime = Regex.Matches(PrintCode, "XA").Count;
|
|
|
+ for (int i = 0; i < PrintTime; i++)
|
|
|
+ {
|
|
|
+ PrintList.Add(PrintCode.Substring(0, PrintCode.IndexOf("XZ") + 2));
|
|
|
+ PrintCode = PrintCode.Substring(PrintCode.IndexOf("XZ") + 2);
|
|
|
+ }
|
|
|
+ for (int i = 0; i < PrintList.Count; i++)
|
|
|
+ {
|
|
|
+ PrintHelper.SendStringToPrinter(PrinterName, PrintList[i]);
|
|
|
+ }
|
|
|
}
|
|
|
- for (int i = 0; i < PrintList.Count; i++)
|
|
|
+ else if (data.ContainsKey("exceptionInfo"))
|
|
|
{
|
|
|
- PrintHelper.SendStringToPrinter(PrinterName, PrintList[i]);
|
|
|
+ string PrintCode = data["exceptionInfo"].ToString();
|
|
|
+ MessageBox.Show(PrintCode);
|
|
|
}
|
|
|
break;
|
|
|
case "getPrintType.action":
|
|
|
filter = FilterManager.GetFileter(request.Identifier.ToString()) as MessageFilter;
|
|
|
str = System.Text.Encoding.UTF8.GetString(filter.dataAll.ToArray());
|
|
|
data = ToDictionary(str);
|
|
|
- PrintType = data["data"].ToString().Replace("\"","");
|
|
|
+ PrintType = data["data"].ToString().Replace("\"", "");
|
|
|
break;
|
|
|
default:
|
|
|
break;
|