|
@@ -1549,132 +1549,6 @@ 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");
|
|
|
|
- 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);
|
|
|
|
- if (FunctionSettingNow.NTF)
|
|
|
|
- ntfBLL.SetDataBuringResult(FunctionSettingNow.Line, FunctionSettingNow.Station, SN, "", false, "Device code format error");
|
|
|
|
- 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(midListNow.host, orderNow, Encoding.ASCII.GetString(data), SN, psn, out string dsn, out error_psn, 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);
|
|
|
|
- if (FunctionSettingNow.NTF)
|
|
|
|
- ntfBLL.SetDataBuringResult(FunctionSettingNow.Line, FunctionSettingNow.Station, SN, keyInfo.DSN, false, "Contrast DSN fail");
|
|
|
|
- goto end;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- else
|
|
|
|
- {
|
|
|
|
- SetfailStatus(m_readDSN);
|
|
|
|
- Log.WriteErrorLog(SN + " read DSN fail");
|
|
|
|
- MessageBox.Show(LResource.ReadDSNError);
|
|
|
|
- if (FunctionSettingNow.NTF)
|
|
|
|
- ntfBLL.SetDataBuringResult(FunctionSettingNow.Line, FunctionSettingNow.Station, SN, keyInfo.DSN, false, "Read DSN fail");
|
|
|
|
- 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);
|
|
|
|
- if (FunctionSettingNow.NTF)
|
|
|
|
- ntfBLL.SetDataBuringResult(FunctionSettingNow.Line, FunctionSettingNow.Station, SN, keyInfo.DSN, false, "Write DSN fail");
|
|
|
|
- goto end;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- else
|
|
|
|
- {
|
|
|
|
- MessageBox.Show(error_psn);
|
|
|
|
- goto end;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- else
|
|
|
|
- {
|
|
|
|
- Log.WriteErrorLog("Failed to read PSN when requesting DSN !\r\n" + devicecode);
|
|
|
|
- MessageBox.Show(LResource.ReadPSNError);
|
|
|
|
- if (FunctionSettingNow.NTF)
|
|
|
|
- ntfBLL.SetDataBuringResult(FunctionSettingNow.Line, FunctionSettingNow.Station, SN, "", false, "read DSN error");
|
|
|
|
- goto end;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- else
|
|
|
|
- {
|
|
|
|
- MessageBox.Show(LResource.GetDeviceCodeError);
|
|
|
|
- if (FunctionSettingNow.NTF)
|
|
|
|
- ntfBLL.SetDataBuringResult(FunctionSettingNow.Line, FunctionSettingNow.Station, SN, "", false, "GetDeviceCodeError");
|
|
|
|
- goto end;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- watch.Stop();
|
|
|
|
- Log.WriteInfoLog(string.Format("Write DSN Elapsed={0}", watch.Elapsed.TotalMilliseconds));
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
// 如果是要导出ACASID+SN,先判断ACASID是否等于20位长度;
|
|
// 如果是要导出ACASID+SN,先判断ACASID是否等于20位长度;
|
|
if (FunctionSettingNow.ExportSNACASID)
|
|
if (FunctionSettingNow.ExportSNACASID)
|
|
{
|
|
{
|
|
@@ -4711,6 +4585,132 @@ namespace MOKA_Factory_Tools
|
|
SetcolorStatus(ProductMsg_Text, Color.FromArgb(128, 255, 128));
|
|
SetcolorStatus(ProductMsg_Text, Color.FromArgb(128, 255, 128));
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ // DSN抄写:如果是G客户,要在抄写其他key前时行fsn+psn查重处理;
|
|
|
|
+ if (WriteDSN.Checked)
|
|
|
|
+ {
|
|
|
|
+ // 计算函数耗时;
|
|
|
|
+ Stopwatch watch = new Stopwatch();
|
|
|
|
+ watch.Start();
|
|
|
|
+ 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);
|
|
|
|
+ if (FunctionSettingNow.NTF)
|
|
|
|
+ ntfBLL.SetDataBuringResult(FunctionSettingNow.Line, FunctionSettingNow.Station, SN, "", false, "Device code format error");
|
|
|
|
+ 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(midListNow.host, orderNow, Encoding.ASCII.GetString(data), SN, psn, out string dsn, out error_psn, 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);
|
|
|
|
+ if (FunctionSettingNow.NTF)
|
|
|
|
+ ntfBLL.SetDataBuringResult(FunctionSettingNow.Line, FunctionSettingNow.Station, SN, keyInfo.DSN, false, "Contrast DSN fail");
|
|
|
|
+ goto end;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ SetfailStatus(m_readDSN);
|
|
|
|
+ Log.WriteErrorLog(SN + " read DSN fail");
|
|
|
|
+ MessageBox.Show(LResource.ReadDSNError);
|
|
|
|
+ if (FunctionSettingNow.NTF)
|
|
|
|
+ ntfBLL.SetDataBuringResult(FunctionSettingNow.Line, FunctionSettingNow.Station, SN, keyInfo.DSN, false, "Read DSN fail");
|
|
|
|
+ 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);
|
|
|
|
+ if (FunctionSettingNow.NTF)
|
|
|
|
+ ntfBLL.SetDataBuringResult(FunctionSettingNow.Line, FunctionSettingNow.Station, SN, keyInfo.DSN, false, "Write DSN fail");
|
|
|
|
+ goto end;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ MessageBox.Show(error_psn);
|
|
|
|
+ goto end;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ Log.WriteErrorLog("Failed to read PSN when requesting DSN !\r\n" + devicecode);
|
|
|
|
+ MessageBox.Show(LResource.ReadPSNError);
|
|
|
|
+ if (FunctionSettingNow.NTF)
|
|
|
|
+ ntfBLL.SetDataBuringResult(FunctionSettingNow.Line, FunctionSettingNow.Station, SN, "", false, "read DSN error");
|
|
|
|
+ goto end;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ MessageBox.Show(LResource.GetDeviceCodeError);
|
|
|
|
+ if (FunctionSettingNow.NTF)
|
|
|
|
+ ntfBLL.SetDataBuringResult(FunctionSettingNow.Line, FunctionSettingNow.Station, SN, "", false, "GetDeviceCodeError");
|
|
|
|
+ goto end;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ watch.Stop();
|
|
|
|
+ Log.WriteInfoLog(string.Format("Write DSN Elapsed={0}", watch.Elapsed.TotalMilliseconds));
|
|
|
|
+ }
|
|
|
|
+
|
|
keycontent += "toolVersion=" + System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString() + "&";
|
|
keycontent += "toolVersion=" + System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString() + "&";
|
|
|
|
|
|
//自定义指令发送
|
|
//自定义指令发送
|