Explorar el Código

1、导入适配的新增项。
2、计时关键函数的耗时值。

sat23 hace 3 años
padre
commit
40a201fde8
Se han modificado 2 ficheros con 45 adiciones y 5 borrados
  1. 30 3
      SCBC Factory Tools/Views/Main.cs
  2. 15 2
      SCBC Factory Tools/Views/OperationPanel.cs

+ 30 - 3
SCBC Factory Tools/Views/Main.cs

@@ -683,15 +683,42 @@ namespace MOKA_Factory_Tools
                 functionSetting1.BarcodeKeyword = jObject["BarcodeKeyword"].Value<string>();
 
                 //串口延迟
-                functionSetting1.SerailDelay = jObject["SerailDelay"].Value<int>();
-                SerialCMD.SerialTimeout = jObject["SerialTimeout"].Value<int>();
+                //functionSetting1.SerailDelay = jObject["SerailDelay"].Value<int>();     // 名字不易理解,使用NextCommandWaitTime代替;
+                //SerialCMD.SerialTimeout = jObject["SerialTimeout"].Value<int>();        // 名字不易理解,目前不再使用;
 
                 // G客户防呆措施;
                 functionSetting1.UsingGFoolProofing = jObject["UsingGFoolProofing"] == null ? false : jObject["UsingGFoolProofing"].Value<bool>();
                 functionSetting1.GFoolProofingCount = jObject["GFoolProofingCount"] == null ? 2 : jObject["GFoolProofingCount"].Value<int>();
 
                 // 导出日规acas与sn;
-                functionSetting1.ExportSNACASID = jObject["ExportSNACASID"] == null ? false : jObject["ExportSNACASID"].Value<bool>();
+                if (jObject["ExportSNACASID"] == null)
+                {
+                    SaveJsonConfig("ExportSNACASID", functionSetting1.ExportSNACASID);
+                }
+                else
+                {
+                    functionSetting1.ExportSNACASID = jObject["ExportSNACASID"].Value<bool>();
+                }
+
+                // 获取ReadTimeout值;
+                if (jObject["ReadTimeout"] == null)
+                {
+                    SaveJsonConfig("ReadTimeout", SerialCMD.ReadTimeout);
+                }
+                else
+                {
+                    functionSetting1.ReadTimeout = SerialCMD.ReadTimeout = jObject["ReadTimeout"].Value<int>();
+                }
+
+                // 获取NextCommandWaitTime值;
+                if (jObject["NextCommandWaitTime"] == null)
+                {
+                    SaveJsonConfig("NextCommandWaitTime", SerialCMD.NextCommandWaitTime);
+                }
+                else
+                {
+                    functionSetting1.NextCommandWaitTime = SerialCMD.NextCommandWaitTime = jObject["NextCommandWaitTime"].Value<int>();
+                }
 
                 foreach (var ss in jObject["Channel"])  //遍历Channel
                 {

+ 15 - 2
SCBC Factory Tools/Views/OperationPanel.cs

@@ -16,6 +16,7 @@ using System.Net;
 using System.Net.Sockets;
 using System.Linq;
 using System.Text.RegularExpressions;
+using System.Diagnostics;
 
 namespace MOKA_Factory_Tools
 {
@@ -1457,7 +1458,8 @@ namespace MOKA_Factory_Tools
             ArrayList keypath = new ArrayList();
             ArrayList keyStream = new ArrayList();
             ArrayList keyReader = new ArrayList();
-            int SerailDelay = FunctionSettingNow.SerailDelay;
+            //int SerailDelay = FunctionSettingNow.SerailDelay;
+            int SerailDelay = FunctionSettingNow.NextCommandWaitTime;
 
             Log.WriteInfoLog(SN + "   start testing");
             bool TestResult = false;
@@ -1539,6 +1541,9 @@ namespace MOKA_Factory_Tools
             // 如果是G客户,要在抄写其他key前时行fsn+psn查重处理;
             if (WriteDSN.Checked)
             {
+                // 计算函数耗时;
+                Stopwatch watch = new Stopwatch();
+                watch.Start();
                 if (SN == null)
                 {
                     MessageBox.Show("Please scan to trigger testing");
@@ -1642,6 +1647,9 @@ namespace MOKA_Factory_Tools
                     MessageBox.Show(LResource.GetDeviceCodeError);
                     goto end;
                 }
+
+                watch.Stop();
+                Log.WriteInfoLog(string.Format("Write DSN Elapsed={0}", watch.Elapsed.TotalMilliseconds));
             }
 
             // 如果是要导出ACASID+SN,先判断ACASID是否等于20位长度;
@@ -2034,6 +2042,9 @@ namespace MOKA_Factory_Tools
             }
             else if (!preloadNow)
             {
+                // 计算获取全部key耗时;
+                Stopwatch watch = new Stopwatch();
+                watch.Start();
                 if (WriteDID.Checked)
                 {
                     if (CommonMethod.GetKeys(midListNow.host, "DeviceID", SN, "devicetype=tcl_unknown_model", errorDBNow, out string did, out error, orderNow, out string md5))
@@ -2313,6 +2324,8 @@ namespace MOKA_Factory_Tools
                         goto end;
                     }
                 }
+                watch.Stop();
+                Log.WriteInfoLog(string.Format("Get All Keys Elapsed={0}", watch.Elapsed.TotalMilliseconds));
             }
 
             // 如果是抄写EDID,则不获取白平衡数据;
@@ -5860,7 +5873,7 @@ namespace MOKA_Factory_Tools
                     {
                         timer1.Stop();
                     }
-                    while (WritekeyThread.ThreadState != ThreadState.Aborted)
+                    while (WritekeyThread.ThreadState != System.Threading.ThreadState.Aborted)
                     {
                         Thread.Sleep(100);
                     }