|
|
@@ -141,7 +141,7 @@ namespace UAS_MES.Make
|
|
|
}
|
|
|
//工单信息
|
|
|
sql.Clear();
|
|
|
- sql.Append("select ma_salecode,ma_prodcode,ma_craftname,ma_inqty,ma_craftcode,ma_qty,nvl(ma_inqty,0) ma_inqty,");
|
|
|
+ sql.Append("select ma_salecode,nvl(ma_checksacode,0)ma_checksacode,ma_prodcode,ma_craftname,ma_inqty,ma_craftcode,ma_qty,nvl(ma_inqty,0) ma_inqty,");
|
|
|
sql.Append("nvl(ma_scrapqty,0)ma_scrapqty,ma_id,nvl(ma_unlimitin,0) ma_unlimitin,ma_wccode,NVL(re_autodecom,0)");
|
|
|
sql.Append("re_autodecom,re_code from make left join rework on ma_screcode=re_code where ");
|
|
|
sql.Append("ma_code='" + ma_code.Text + "'and ma_kind='返工' and ma_statuscode='STARTED'");
|
|
|
@@ -149,6 +149,7 @@ namespace UAS_MES.Make
|
|
|
string ma_prodcode = MaInf.Rows[0]["ma_prodcode"].ToString();
|
|
|
string ma_salecode = MaInf.Rows[0]["ma_salecode"].ToString();
|
|
|
string re_autodecom = MaInf.Rows[0]["re_autodecom"].ToString();
|
|
|
+ string ma_checksacode = MaInf.Rows[0]["ma_checksacode"].ToString();
|
|
|
string re_code = MaInf.Rows[0]["re_code"].ToString();
|
|
|
int ma_unlimitin = int.Parse(MaInf.Rows[0]["ma_unlimitin"].ToString());
|
|
|
int ma_inqty = int.Parse(MaInf.Rows[0]["ma_inqty"].ToString());
|
|
|
@@ -159,10 +160,13 @@ namespace UAS_MES.Make
|
|
|
OperateResult.AppendText(">>序列号所属产品" + ms_prodcode + "与返工工单产品不一致\n", Color.Red, sn_code);
|
|
|
return;
|
|
|
}
|
|
|
- if (ms_salecode != "" && ma_salecode != "" && ms_salecode != ma_salecode)
|
|
|
+ if (ma_checksacode != "0")
|
|
|
{
|
|
|
- OperateResult.AppendText(">>序列号所属合同" + ms_salecode + "与返工工单合同不一致\n", Color.Red, sn_code);
|
|
|
- return;
|
|
|
+ if (ms_salecode != "" && ma_salecode != "" && ms_salecode != ma_salecode)
|
|
|
+ {
|
|
|
+ OperateResult.AppendText(">>序列号所属合同" + ms_salecode + "与返工工单合同不一致\n", Color.Red, sn_code);
|
|
|
+ return;
|
|
|
+ }
|
|
|
}
|
|
|
if (ma_unlimitin == 0 && ma_inqty - ma_scrapqty + 1 > ma_qty)
|
|
|
{
|
|
|
@@ -229,6 +233,7 @@ namespace UAS_MES.Make
|
|
|
salecode = SnInf.Rows[0]["ms_salecode"].ToString();
|
|
|
SQLS.Add("update make set ma_salecode='" + salecode + "' where ma_id='" + ma_id.Text + "'");
|
|
|
}
|
|
|
+ //插入返工工单
|
|
|
sql.Clear();
|
|
|
sql.Append("insert into MakeSerial(ms_id,ms_code,ms_sncode,ms_prodcode,ms_indate,ms_wccode");
|
|
|
sql.Append(",ms_craftcode,ms_craftname,ms_nextstepcode,ms_status,ms_makecode,ms_linecode");
|
|
|
@@ -240,7 +245,9 @@ namespace UAS_MES.Make
|
|
|
sql.Append("'" + firstsn + "','" + salecode + "','" + mac + "','" + bt + "','" + othcode1 + "','" + othcode2 + "','" + othcode3 + "',");
|
|
|
sql.Append("'" + netcode + "','" + imei1 + "','" + imei2 + "','" + imei3 + "','" + imeid + "','" + othid1 + "','" + othid2 + "','" + othid3 + "')");
|
|
|
SQLS.Add(sql.GetString());
|
|
|
+ //更新工单数量+1
|
|
|
SQLS.Add("update make set ma_inqty=nvl(ma_inqty,0)+1 where ma_id='" + ma_id.Text + "'");
|
|
|
+ //更新该序列号的所属工单为返工工单
|
|
|
SQLS.Add("update makeserial set ms_nextmacode='" + ma_code.Text + "' where ms_id='" + Msid + "'");
|
|
|
if (ms_outboxcode != "")
|
|
|
{
|
|
|
@@ -254,11 +261,29 @@ namespace UAS_MES.Make
|
|
|
SQLS.Add(sql.GetString());
|
|
|
if (re_autodecom != "0")
|
|
|
{
|
|
|
+ sql.Clear();
|
|
|
+ sql.Append("select cm_makecode from craftmaterial left join makeserial where cm_makecode=");
|
|
|
+ sql.Append("cm_makecode and ms_sncode=cm_barcode and ms_prodcode=cm_soncode where ms_id='" + Msid + "'");
|
|
|
+ DataTable dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
|
|
|
+ string cm_makecode = "";
|
|
|
+ string cm_soncode = "";
|
|
|
+ string cm_barcode = "";
|
|
|
+ if (dt.Rows.Count > 0)
|
|
|
+ {
|
|
|
+ cm_makecode = dt.Rows[0]["cm_makecode"].ToString();
|
|
|
+ cm_soncode = dt.Rows[0]["cm_soncode"].ToString();
|
|
|
+ cm_barcode = dt.Rows[0]["cm_barcode"].ToString();
|
|
|
+ }
|
|
|
sql.Clear();
|
|
|
sql.Append("update craftmaterial set cm_status=-1,cm_dropcode='" + re_code + "',cm_dropman='" + User.UserCode + "',cm_dropdate=sysdate where ");
|
|
|
sql.Append("cm_firstsn='" + firstsn + "' and nvl(cm_status,0)=0 and exists (select 1 from makesndecompose ");
|
|
|
sql.Append("where msd_recode='" + re_code + "' and msd_fsoncode=cm_fsoncode and msd_stepcode=cm_stepcode)");
|
|
|
SQLS.Add(sql.GetString());
|
|
|
+ //TSN失效
|
|
|
+ sql.Clear();
|
|
|
+ sql.Append("update makeserial set ms_nextmacode='' where ms_nextmacode='" + cm_makecode + "'");
|
|
|
+ sql.Append(" and ms_sncode='" + cm_barcode + "' and ms_prodcode='" + cm_barcode + "' ");
|
|
|
+ SQLS.Add(sql.GetString());
|
|
|
}
|
|
|
dh.ExecuteSQLTran(SQLS.ToArray());
|
|
|
//if (ReWorkAsRelateTSN.Checked)
|