|
|
@@ -186,6 +186,9 @@ namespace UAS_AutoPass
|
|
|
string test_result = "";
|
|
|
string test_sn = "";
|
|
|
string imageurl = "";
|
|
|
+ string oMakeCode = "";
|
|
|
+ string oMSID = "";
|
|
|
+ string oErrMessage = "";
|
|
|
XmlReader myReader = XmlReader.Create(FolderPath.Text + @"\" + e.Name);
|
|
|
OperateResult.AppendText("读取文件" + e.Name + "\n");
|
|
|
//获取采集的项目名称
|
|
|
@@ -234,14 +237,18 @@ namespace UAS_AutoPass
|
|
|
makecode = dt.Rows[0]["ms_makecode"].ToString();
|
|
|
sncode = dt.Rows[0]["ms_sncode"].ToString();
|
|
|
}
|
|
|
+ //-2-NG2017/10/2514:46:29.xml取第二位版号
|
|
|
string combinecode = e.Name.Substring(1, 1);
|
|
|
- LogicHandler.AutoPassLog(sncode,isource,makecode,test_date,istepcode,ilinecode,"0");
|
|
|
- //sql.Clear();
|
|
|
- //sql.Append("insert into AUTOSCAN_REJUDGE(asr_id,asr_indate,asr_filename,asr_combinecode,asr_sourcecode,");
|
|
|
- //sql.Append("asr_linecode,asr_makecode,asr_sncode) values(AUTOSCAN_REJUDGE_seq.nextval,sysdate,'" + e.Name + "'");
|
|
|
- //sql.Append(",'" + combinecode + "','" + isource + "','" + ilinecode + "','" + makecode + "','" + sncode + "')");
|
|
|
- //dh.ExecuteSql(sql.ToString(), "insert");
|
|
|
- if (!LogicHandler.SetStepResult(makecode, isource, sncode, "自动过站采集", test_result, iusercode, out ErrMessage))
|
|
|
+ if (LogicHandler.CheckStepSNAndMacode(makecode, isource, sncode, iusercode, out oMakeCode, out oMSID, out oErrMessage))
|
|
|
+ {
|
|
|
+ LogicHandler.AutoPassLog(sncode, isource, makecode, test_date, istepcode, ilinecode, e.Name, "0");
|
|
|
+ if (!LogicHandler.SetStepResult(makecode, isource, sncode, "自动过站采集", test_result, iusercode, out ErrMessage))
|
|
|
+ {
|
|
|
+ OperateResult.AppendText(ErrMessage + "\n");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
{
|
|
|
OperateResult.AppendText(ErrMessage + "\n");
|
|
|
return;
|
|
|
@@ -250,63 +257,66 @@ namespace UAS_AutoPass
|
|
|
//没有条码并且不良进行记录
|
|
|
else if (sncode == "" && test_result == "NG")
|
|
|
{
|
|
|
- //-2-NG2017/10/2514:46:29.xml取第二位版号
|
|
|
- string combinecode = e.Name.Substring(1, 1);
|
|
|
- LogicHandler.AutoPassLog(sncode, isource, makecode, test_date, istepcode, ilinecode, "0");
|
|
|
- //sql.Clear();
|
|
|
- //sql.Append("insert into AUTOSCAN_REJUDGE(asr_id,asr_indate,asr_filename,asr_combinecode,asr_sourcecode,");
|
|
|
- //sql.Append("asr_linecode) values(AUTOSCAN_REJUDGE_seq.nextval,sysdate,'" + e.Name + "','" + combinecode + "','" + isource + "','" + ilinecode + "')");
|
|
|
- //dh.ExecuteSql(sql.ToString(), "insert");
|
|
|
+ LogicHandler.AutoPassLog(sncode, isource, makecode, test_date, istepcode, ilinecode, e.Name, "0");
|
|
|
}
|
|
|
else if (sncode != "")
|
|
|
{
|
|
|
- //获取序列号ID最大的工单
|
|
|
- string msid = "";
|
|
|
- dt = (DataTable)dh.ExecuteSql("select ms_makecode,ms_id from makeserial where ms_sncode='" + sncode + "' order by ms_id desc", "select");
|
|
|
- if (dt.Rows.Count > 0)
|
|
|
+ if (LogicHandler.CheckStepSNAndMacode(makecode, isource, sncode, iusercode, out oMakeCode, out oMSID, out oErrMessage))
|
|
|
{
|
|
|
- msid = dt.Rows[0]["ms_id"].ToString();
|
|
|
- makecode = dt.Rows[0]["ms_makecode"].ToString();
|
|
|
- switch (test_result)
|
|
|
+ //获取序列号ID最大的工单
|
|
|
+ string msid = "";
|
|
|
+ dt = (DataTable)dh.ExecuteSql("select ms_makecode,ms_id from makeserial where ms_sncode='" + sncode + "' order by ms_id desc", "select");
|
|
|
+ if (dt.Rows.Count > 0)
|
|
|
{
|
|
|
- case "OK":
|
|
|
- if (!LogicHandler.SetStepResult(makecode, isource, sncode, "自动过站采集", test_result, iusercode, out ErrMessage))
|
|
|
- {
|
|
|
- OperateResult.AppendText(ErrMessage + "\n");
|
|
|
- return;
|
|
|
- }
|
|
|
- break;
|
|
|
- case "NG":
|
|
|
- sql.Clear();
|
|
|
- sql.Append("insert into makebad(mb_id,mb_makecode,mb_mscode,mb_sncode,mb_inman,mb_indate,mb_stepcode");
|
|
|
- sql.Append(",mb_sourcecode,mb_badcode,mb_badtable,mb_soncode,mb_status) select makebad_seq.nextval");
|
|
|
- sql.Append(",ma_code,ms_code,ms_sncode,'" + iusercode + "',sysdate,'" + istepcode + "','" + isource + "',:bc_code,'',");
|
|
|
- sql.Append("sp_soncode,'0' from make left join makeSerial on ms_makecode=ma_code left join stepProduct on sp_mothercode");
|
|
|
- sql.Append("=ma_prodcode and sp_stepcode=ms_nextstepcode where ms_sncode='" + sncode + "' and ms_makecode='" + makecode + "'");
|
|
|
- dh.BatchInsert(sql.ToString(), new string[] { "bc_code" }, badcode.ToArray());
|
|
|
- //更新序列号不良状态
|
|
|
- dh.UpdateByCondition("makeserial", "ms_status=3", "ms_id='" + msid + "'");
|
|
|
- for (int i = 0; i < badcode.Count; i++)
|
|
|
- {
|
|
|
- //保存不良位置
|
|
|
- string[] location = badlocation[i].Split(',');
|
|
|
+ msid = dt.Rows[0]["ms_id"].ToString();
|
|
|
+ makecode = dt.Rows[0]["ms_makecode"].ToString();
|
|
|
+ switch (test_result)
|
|
|
+ {
|
|
|
+ case "OK":
|
|
|
+ if (!LogicHandler.SetStepResult(makecode, isource, sncode, "自动过站采集", test_result, iusercode, out ErrMessage))
|
|
|
+ {
|
|
|
+ OperateResult.AppendText(ErrMessage + "\n");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case "NG":
|
|
|
sql.Clear();
|
|
|
- sql.Append("insert into makebadrsloc(mbl_id,mbl_loc,mbl_badcode,mbl_sncode,mbl_makecode,");
|
|
|
- sql.Append("mbl_indate ,mbl_inman) select makebadrsloc_seq.nextval,");
|
|
|
- sql.Append(":location,'" + badcode[i] + "','" + sncode + "','" + makecode + "',");
|
|
|
- sql.Append("sysdate,'" + iusercode + "' from dual");
|
|
|
- dh.BatchInsert(sql.ToString(), new string[] { "location" }, location);
|
|
|
- }
|
|
|
- if (!LogicHandler.SetStepResult(makecode, isource, sncode, "自动过站采集", test_result, iusercode, out ErrMessage))
|
|
|
- {
|
|
|
- OperateResult.AppendText(ErrMessage + "\n");
|
|
|
- return;
|
|
|
- }
|
|
|
- break;
|
|
|
- default:
|
|
|
- break;
|
|
|
+ sql.Append("insert into makebad(mb_id,mb_makecode,mb_mscode,mb_sncode,mb_inman,mb_indate,mb_stepcode");
|
|
|
+ sql.Append(",mb_sourcecode,mb_badcode,mb_badtable,mb_soncode,mb_status) select makebad_seq.nextval");
|
|
|
+ sql.Append(",ma_code,ms_code,ms_sncode,'" + iusercode + "',sysdate,'" + istepcode + "','" + isource + "',:bc_code,'',");
|
|
|
+ sql.Append("sp_soncode,'0' from make left join makeSerial on ms_makecode=ma_code left join stepProduct on sp_mothercode");
|
|
|
+ sql.Append("=ma_prodcode and sp_stepcode=ms_nextstepcode where ms_sncode='" + sncode + "' and ms_makecode='" + makecode + "'");
|
|
|
+ dh.BatchInsert(sql.ToString(), new string[] { "bc_code" }, badcode.ToArray());
|
|
|
+ //更新序列号不良状态
|
|
|
+ dh.UpdateByCondition("makeserial", "ms_status=3", "ms_id='" + msid + "'");
|
|
|
+ for (int i = 0; i < badcode.Count; i++)
|
|
|
+ {
|
|
|
+ //保存不良位置
|
|
|
+ string[] location = badlocation[i].Split(',');
|
|
|
+ sql.Clear();
|
|
|
+ sql.Append("insert into makebadrsloc(mbl_id,mbl_loc,mbl_badcode,mbl_sncode,mbl_makecode,");
|
|
|
+ sql.Append("mbl_indate ,mbl_inman) select makebadrsloc_seq.nextval,");
|
|
|
+ sql.Append(":location,'" + badcode[i] + "','" + sncode + "','" + makecode + "',");
|
|
|
+ sql.Append("sysdate,'" + iusercode + "' from dual");
|
|
|
+ dh.BatchInsert(sql.ToString(), new string[] { "location" }, location);
|
|
|
+ }
|
|
|
+ if (!LogicHandler.SetStepResult(makecode, isource, sncode, "自动过站采集", test_result, iusercode, out ErrMessage))
|
|
|
+ {
|
|
|
+ OperateResult.AppendText(ErrMessage + "\n");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ LogicHandler.AutoPassLog(sncode, isource, makecode, test_date, istepcode, ilinecode,e.Name, "0");
|
|
|
}
|
|
|
}
|
|
|
+ else
|
|
|
+ {
|
|
|
+ OperateResult.AppendText(ErrMessage + "\n");
|
|
|
+ return;
|
|
|
+ }
|
|
|
}
|
|
|
FileInfo file = new FileInfo(FolderPath.Text + @"\" + e.Name);
|
|
|
if (file.Exists)
|