|
|
@@ -174,7 +174,10 @@ namespace UAS_MES.Make
|
|
|
string[] id = new string[RejectCount];
|
|
|
string ErrorMessage = "";
|
|
|
if (ChoosedRejectList.Items.Count == 0)
|
|
|
+ {
|
|
|
MessageBox.Show("不良品必须选择不良原因和不良代码!");
|
|
|
+ return;
|
|
|
+ }
|
|
|
else
|
|
|
{
|
|
|
//用户未填写不良代码一切按照正常逻辑,填写了从index=1开始执行
|
|
|
@@ -188,12 +191,12 @@ namespace UAS_MES.Make
|
|
|
}
|
|
|
}
|
|
|
sql.Clear();
|
|
|
- sql.Append("insert when (not exists(select 1 from makebad where mb_sncode='" + sncode + "' and mb_badcode=:bc_code)) then ");
|
|
|
- sql.Append("into makebad(mb_id,mb_makecode,mb_mscode,mb_sncode,mb_inman,");
|
|
|
+ sql.Append("insert when (not exists(select 1 from makebad where mb_sncode='" + sncode + "' and mb_makecode='"+macode+"' and ");
|
|
|
+ sql.Append("mb_status=0 and mb_badcode=:bc_code)) then into makebad(mb_id,mb_makecode,mb_mscode,mb_sncode,mb_inman,");
|
|
|
sql.Append("mb_indate,mb_stepcode,mb_sourcecode,mb_badcode,mb_bgcode,mb_badtable,mb_status)");
|
|
|
sql.Append("select DISTINCT :id,ma_code,ms_code,ms_sncode,'" + User.UserCode + "',sysdate,'" + User.CurrentStepCode + "',ms_sourcecode,:bc_code,:bg_code,'',");
|
|
|
sql.Append("'0' from make left join makeSerial on ms_makecode=ma_code left join stepProduct on ");
|
|
|
- sql.Append("sp_mothercode=ma_prodcode and sp_stepcode=ms_nextstepcode and ms_craftcode = sp_craftcode where ms_sncode='" + sncode + "' and ms_makecode = '"+macode+"'");
|
|
|
+ sql.Append("sp_mothercode=ma_prodcode and sp_stepcode=ms_nextstepcode and ms_craftcode = sp_craftcode where ms_sncode='" + sncode + "' and ms_makecode = '" + macode + "'");
|
|
|
dh.BatchInsert(sql.GetString(), new string[] { "bc_code", "id", "bc_code", "bg_code" }, bccode, id, bccode, bgcode);
|
|
|
MessageBox.Show("保存成功");
|
|
|
Close();
|