章政 пре 7 година
родитељ
комит
3d074f05c8
2 измењених фајлова са 19 додато и 11 уклоњено
  1. 1 1
      UAS_Web/Browser.cs
  2. 18 10
      UAS_Web/tool/RequestHandler.cs

+ 1 - 1
UAS_Web/Browser.cs

@@ -18,7 +18,7 @@ namespace UAS_Web
         {
             InitializeComponent();
             Text = "思拓微-供应商条码打印";
-            string path = "http://stwecig.vicp.io:8099/ERP/jsps/vendbarcode/login.jsp";
+            string path = "https://218.17.158.219:9443/uas_dev/jsps/vendbarcode/login.jsp";
             webBrowser = new ChromiumWebBrowser(path)
             {
                 Dock = DockStyle.Fill

+ 18 - 10
UAS_Web/tool/RequestHandler.cs

@@ -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;