Преглед на файлове

【版本:3.0.6.8】1、NG显示不全问题处理 2、MES接口乱码问题处理。

sat23 преди 3 години
родител
ревизия
2c3c201e4f
променени са 3 файла, в които са добавени 22 реда и са изтрити 40 реда
  1. 5 24
      Business/CommonMethod.cs
  2. 12 11
      Views/OperationPanel.cs
  3. 5 5
      Views/Verify.Designer.cs

+ 5 - 24
Business/CommonMethod.cs

@@ -2133,7 +2133,7 @@ namespace MOKA_Factory_Tools
             HttpHelper http = new HttpHelper();
             HttpItem item = new HttpItem()
             {
-                Encoding = Encoding.Default,
+                Encoding = Encoding.UTF8,
                 Method = "post",
                 ContentType = "text/xml",
                 KeepAlive = false
@@ -2160,24 +2160,6 @@ namespace MOKA_Factory_Tools
             return true;
         }
 
-        /// <summary>
-        /// 将url utf8转gb2312;
-        /// </summary>
-        /// <param name="text"></param>
-        /// <returns></returns>
-        public static string utf8_gb2312(string text)
-        {
-            //声明字符集   
-            System.Text.Encoding utf8, gb2312;
-            //utf8   
-            utf8 = System.Text.Encoding.GetEncoding("utf-8");
-            //gb2312   
-            gb2312 = System.Text.Encoding.GetEncoding("gb2312");
-            byte[] data = System.Text.Encoding.Convert(utf8, gb2312, utf8.GetBytes(text));
-            //返回转换后的字符   
-            return utf8.GetString(data);
-        }
-
         /// <summary>
         /// 上报数据抄写结果到MES系统中;
         /// </summary>
@@ -2194,7 +2176,7 @@ namespace MOKA_Factory_Tools
             HttpHelper http = new HttpHelper();
             HttpItem item = new HttpItem()
             {
-                Encoding = Encoding.Default,
+                Encoding = Encoding.UTF8,
                 Method = "post",
                 ContentType = "application/json",
                 KeepAlive = false
@@ -2208,7 +2190,6 @@ namespace MOKA_Factory_Tools
             {
                 try
                 {
-                    hResult.Html = utf8_gb2312(hResult.Html);
                     using (JsonTextReader reader = new JsonTextReader(new StringReader(hResult.Html)))
                     {
                         JObject jObject = (JObject)JToken.ReadFrom(reader);
@@ -2229,13 +2210,13 @@ namespace MOKA_Factory_Tools
                 catch (Exception e)
                 {
                     msg = e.Message;
-                    Log.WriteErrorLog("ReportDataBurningResultToMES error:" + hResult.StatusDescription + "\r\n" + hResult.Html + "\r\nAddress: " + item.URL + "\r\nPostdata: " + item.Postdata);
+                    Log.WriteErrorLog("ReportDataBurningResultToMES Json-error:" + hResult.StatusDescription + "\r\n" + hResult.Html + "\r\nAddress: " + item.URL + "\r\nPostdata: " + item.Postdata);
                 }
             }
             else
             {
                 msg = hResult.StatusDescription;
-                Log.WriteInfoLog("ReportDataBurningResultToMES error:" + hResult.StatusDescription + "\r\n" + hResult.Html + "\r\nAddress: " + item.URL + "\r\nPostdata: " + item.Postdata);
+                Log.WriteInfoLog("ReportDataBurningResultToMES Http-error:" + hResult.StatusDescription + "\r\n" + hResult.Html + "\r\nAddress: " + item.URL + "\r\nPostdata: " + item.Postdata);
             }
             
             // 没有进行数据库查重:惹数据已添加过,同一次FSN抄写多次失败后导致多条记录。
@@ -2299,7 +2280,7 @@ namespace MOKA_Factory_Tools
 
             return false;
         }
-        #endregion
+#endregion
     }
 
     /// <summary>

+ 12 - 11
Views/OperationPanel.cs

@@ -5121,20 +5121,21 @@ namespace MOKA_Factory_Tools
                     }
                 }
 
-                // NG的情况,要弹出密码输入框;
-                //if ( CommonMethod.GetLoginAccout().Equals("Huizhou",StringComparison.OrdinalIgnoreCase) )
+                // 启动NG弹密码框功能;
+                ShowVerifyDelegate(ErrMsg);
+                Thread.Sleep(300);
+            }
+
+            // 只有惠州工厂才上报结果到MES中;
+            if (CommonMethod.GetLoginAccout().Equals("Huizhou", StringComparison.OrdinalIgnoreCase))
+            {    
+                // 上报抄写结果到MES系统中;
+                string strOutMsg;
+                if (!CommonMethod.ReportDataBurningResultToMES(SN, keyInfo.DSN, TestResult ? "Pass" : "Fail", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"), errorDBNow, out strOutMsg))
                 {
-                    // 启动NG弹密码框功能;
-                    ShowVerifyDelegate(ErrMsg);
-                    Thread.Sleep(300);
+                    MessageBox.Show("上报抄写结果到MES失败,请紧急处理:" + strOutMsg);
                 }
             }
-            // 上报抄写结果到MES系统中;
-            string strOutMsg;
-            if ( !CommonMethod.ReportDataBurningResultToMES(SN, keyInfo.DSN, TestResult ? "Pass" : "Fail", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"), errorDBNow, out strOutMsg) )
-            {
-                MessageBox.Show("上报抄写结果到MES失败,请紧急处理:" + strOutMsg);
-            }
             if (midListNow.host == "LocalPC" && !preloadNow)
             {
                 GetLocalKeysCount();

+ 5 - 5
Views/Verify.Designer.cs

@@ -39,9 +39,9 @@
             this.LB_MSG.BackColor = System.Drawing.Color.Transparent;
             this.LB_MSG.BorderColor = System.Drawing.Color.White;
             this.LB_MSG.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.LB_MSG.Location = new System.Drawing.Point(32, 47);
+            this.LB_MSG.Location = new System.Drawing.Point(6, 44);
             this.LB_MSG.Name = "LB_MSG";
-            this.LB_MSG.Size = new System.Drawing.Size(326, 72);
+            this.LB_MSG.Size = new System.Drawing.Size(492, 135);
             this.LB_MSG.TabIndex = 0;
             // 
             // BT_OK
@@ -52,8 +52,8 @@
             this.BT_OK.ControlState = CCWin.SkinClass.ControlState.Normal;
             this.BT_OK.DownBack = null;
             this.BT_OK.DownBaseColor = System.Drawing.Color.Yellow;
-            this.BT_OK.Location = new System.Drawing.Point(294, 126);
-            this.BT_OK.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
+            this.BT_OK.Location = new System.Drawing.Point(412, 186);
+            this.BT_OK.Margin = new System.Windows.Forms.Padding(2);
             this.BT_OK.MouseBack = null;
             this.BT_OK.Name = "BT_OK";
             this.BT_OK.NormlBack = null;
@@ -71,7 +71,7 @@
             this.CanResize = false;
             this.CaptionBackColorBottom = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(192)))));
             this.CaptionBackColorTop = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))));
-            this.ClientSize = new System.Drawing.Size(392, 168);
+            this.ClientSize = new System.Drawing.Size(505, 226);
             this.ControlBox = false;
             this.Controls.Add(this.BT_OK);
             this.Controls.Add(this.LB_MSG);