Kaynağa Gözat

将dsn的查重放到抄写其他Key前面.

Jeff 3 yıl önce
ebeveyn
işleme
d8b59fe951
1 değiştirilmiş dosya ile 108 ekleme ve 109 silme
  1. 108 109
      SCBC Factory Tools/Views/OperationPanel.cs

+ 108 - 109
SCBC Factory Tools/Views/OperationPanel.cs

@@ -1461,6 +1461,114 @@ namespace MOKA_Factory_Tools
                 }
             }
 
+            // 如果是G客户,要在抄写其他key前时行fsn+psn查重处理;
+            if (WriteDSN.Checked)
+            {
+                if (SN == null)
+                {
+                    MessageBox.Show("Please scan to trigger testing");
+                    goto end;
+                }
+                if (SN.Trim().Length == 0)
+                {
+                    MessageBox.Show("Please scan to trigger testing");
+                    goto end;
+                }
+                Log.WriteInfoLog("Read FireTV Device Code...\r\n");
+                if (SerialCMD.GetFireTVDevcieCode(TVPort, out result, out data, out error, SerailDelay))
+                {
+                    string devicecode = Encoding.ASCII.GetString(data);
+                    if (devicecode == "N/A")
+                    {
+                        Log.WriteErrorLog("Device code format error!\r\n" + devicecode);
+                        MessageBox.Show(LResource.DeviceCodeFormatError + "\r\n" + devicecode);
+                        goto end;
+                    }
+
+                    // 先读取psn的值;
+                    byte[] result_psn;
+                    byte[] data_psn;
+                    string error_psn;
+                    if (SerialCMD.ReadFireTVPSN(TVPort, out result_psn, out data_psn, out error_psn, SerailDelay))
+                    {
+                        string psn = Encoding.ASCII.GetString(data_psn);
+                        if (CommonMethod.GetFireTVDsn(orderNow, Encoding.ASCII.GetString(data), SN, psn, out string dsn, errorDBNow))
+                        {
+                            keyInfo.DSN = dsn;
+                            if (!CommonMethod.IsNumberAndWord(keyInfo.DSN))
+                            {
+                                Log.WriteErrorLog("DSN format error!\r\n" + keyInfo.DSN);
+                                MessageBox.Show(LResource.DSNFormatError + "\r\n" + keyInfo.DSN);
+                                goto end;
+                            }
+                            byte[] DSNData = System.Text.Encoding.ASCII.GetBytes(keyInfo.DSN);
+                            Log.WriteInfoLog("Write DSN...");
+                            if (SerialCMD.SetFireTVDSN(TVPort, DSNData, out result, out data, out error, SerailDelay))
+                            {
+                                SetsuccessStatus(m_writeDSN);
+                                Log.WriteInfoLog("Check DSN...");
+                                if (writeCheckNow.DSNCheckcheck ? SerialCMD.CheckFireTVDSN(TVPort, out result, out data, out error, SerailDelay) : true)
+                                {
+                                    SetsuccessStatus(m_checkDSN);
+                                    Log.WriteInfoLog("Read DSN...");
+                                    if (readCheckNow.DSNReadcheck ? SerialCMD.GetFireTVDSN(TVPort, out result, out data, out error, SerailDelay) : true)
+                                    {
+                                        if (SerialInit.BytesCompare_Base64(data, DSNData))
+                                        {
+                                            SetsuccessStatus(m_readDSN);
+                                            //DSN读取别对成功
+                                        }
+                                        else
+                                        {
+                                            Log.WriteErrorLog(SN + "   contrast DSN fail");
+                                            MessageBox.Show(LResource.ContrastDSNError);
+                                            goto end;
+                                        }
+                                    }
+                                    else
+                                    {
+                                        SetfailStatus(m_readDSN);
+                                        Log.WriteErrorLog(SN + "   read DSN fail");
+                                        MessageBox.Show(LResource.ReadDSNError);
+                                        goto end;
+                                    }
+                                }
+                                else
+                                {
+                                    SetfailStatus(m_checkDSN);
+                                    Log.WriteErrorLog(SN + "   check DSN fail");
+                                    MessageBox.Show(LResource.CheckDSNError);
+                                    goto end;
+                                }
+                            }
+                            else
+                            {
+                                SetfailStatus(m_writeDSN);
+                                Log.WriteErrorLog(SN + "   Write DSN fail");
+                                MessageBox.Show(LResource.SetDSNError);
+                                goto end;
+                            }
+                        }
+                        else
+                        {
+                            MessageBox.Show(LResource.GetDSNError);
+                            goto end;
+                        }
+                    }
+                    else
+                    {
+                        Log.WriteErrorLog("Failed to read PSN when requesting DSN !\r\n" + devicecode);
+                        MessageBox.Show(LResource.ReadPSNError);
+                        goto end;
+                    }
+                }
+                else
+                {
+                    MessageBox.Show(LResource.GetDeviceCodeError);
+                    goto end;
+                }
+            }
+
             //获取key                      
             if (midListNow.host == "LocalPC" && !preloadNow)
             {
@@ -3586,115 +3694,6 @@ namespace MOKA_Factory_Tools
                 
             }
 
-            //获取&抄写DSN
-            if (WriteDSN.Checked)
-            {
-                if (SN == null)
-                {
-                    MessageBox.Show("Please scan to trigger testing");
-                    goto end;
-                }
-                if (SN.Trim().Length == 0)
-                {
-                    MessageBox.Show("Please scan to trigger testing");
-                    goto end;
-                }
-                Log.WriteInfoLog("Read FireTV Device Code...\r\n");
-                if (SerialCMD.GetFireTVDevcieCode(TVPort, out result, out data, out error, SerailDelay))
-                {
-                    string devicecode = Encoding.ASCII.GetString(data);
-                    if (devicecode == "N/A")
-                    {
-                        Log.WriteErrorLog("Device code format error!\r\n" + devicecode);
-                        MessageBox.Show(LResource.DeviceCodeFormatError + "\r\n" + devicecode);
-                        goto end;
-                    }
-
-                    // 先读取psn的值;
-                    byte[] result_psn;
-                    byte[] data_psn;
-                    string error_psn;
-                    if (SerialCMD.ReadFireTVPSN(TVPort, out result_psn, out data_psn, out error_psn, SerailDelay))
-                    {
-                        string psn = Encoding.ASCII.GetString(data_psn);
-                        if (CommonMethod.GetFireTVDsn(orderNow, Encoding.ASCII.GetString(data), SN, psn, out string dsn, errorDBNow))
-                        {
-                            keyInfo.DSN = dsn;
-                            if (!CommonMethod.IsNumberAndWord(keyInfo.DSN))
-                            {
-                                Log.WriteErrorLog("DSN format error!\r\n" + keyInfo.DSN);
-                                MessageBox.Show(LResource.DSNFormatError + "\r\n" + keyInfo.DSN);
-                                goto end;
-                            }
-                            byte[] DSNData = System.Text.Encoding.ASCII.GetBytes(keyInfo.DSN);
-                            Log.WriteInfoLog("Write DSN...");
-                            if (SerialCMD.SetFireTVDSN(TVPort, DSNData, out result, out data, out error, SerailDelay))
-                            {
-                                SetsuccessStatus(m_writeDSN);
-                                Log.WriteInfoLog("Check DSN...");
-                                if (writeCheckNow.DSNCheckcheck ? SerialCMD.CheckFireTVDSN(TVPort, out result, out data, out error, SerailDelay) : true)
-                                {
-                                    SetsuccessStatus(m_checkDSN);
-                                    Log.WriteInfoLog("Read DSN...");
-                                    if (readCheckNow.DSNReadcheck ? SerialCMD.GetFireTVDSN(TVPort, out result, out data, out error, SerailDelay) : true)
-                                    {
-                                        if (SerialInit.BytesCompare_Base64(data, DSNData))
-                                        {
-                                            SetsuccessStatus(m_readDSN);
-                                            //DSN读取别对成功
-                                        }
-                                        else
-                                        {
-                                            Log.WriteErrorLog(SN + "   contrast DSN fail");
-                                            MessageBox.Show(LResource.ContrastDSNError);
-                                            goto end;
-                                        }
-
-                                    }
-                                    else
-                                    {
-                                        SetfailStatus(m_readDSN);
-                                        Log.WriteErrorLog(SN + "   read DSN fail");
-                                        MessageBox.Show(LResource.ReadDSNError);
-                                        goto end;
-                                    }
-                                }
-                                else
-                                {
-                                    SetfailStatus(m_checkDSN);
-                                    Log.WriteErrorLog(SN + "   check DSN fail");
-                                    MessageBox.Show(LResource.CheckDSNError);
-                                    goto end;
-                                }
-                            }
-                            else
-                            {
-                                SetfailStatus(m_writeDSN);
-                                Log.WriteErrorLog(SN + "   Write DSN fail");
-                                MessageBox.Show(LResource.SetDSNError);
-                                goto end;
-                            }
-                        }
-                        else
-                        {
-                            MessageBox.Show(LResource.GetDSNError);
-                            goto end;
-                        }
-                    }
-                    else
-                    {
-                        Log.WriteErrorLog("Failed to read PSN when requesting DSN !\r\n" + devicecode);
-                        MessageBox.Show(LResource.ReadPSNError);
-                        goto end;
-                    }
-                }
-                else
-                {
-                    MessageBox.Show(LResource.GetDeviceCodeError);
-                    goto end;
-                }
-            }
-
             //检查ClientType
             if (ClientTypeNote.Text != LResource.SkipChecking)
             {