|
@@ -42,7 +42,7 @@ namespace UAS_MES.Special
|
|
|
sql.Append("select cd_stepcode from craft left join craftdetail on cr_id=cd_crid where ");
|
|
sql.Append("select cd_stepcode from craft left join craftdetail on cr_id=cd_crid where ");
|
|
|
sql.Append("cr_prodcode='" + pr_code + "' and cr_code='" + cr_code + "' order by cd_detno ");
|
|
sql.Append("cr_prodcode='" + pr_code + "' and cr_code='" + cr_code + "' order by cd_detno ");
|
|
|
dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
|
|
dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
|
|
|
- if (ms_stepcode == dt.Rows[0]["cd_stepcode"].ToString())
|
|
|
|
|
|
|
+ if (ms_stepcode == dt.Rows[0]["cd_stepcode"].ToString() || ms_stepcode == "")
|
|
|
{
|
|
{
|
|
|
List<string> sqls = new List<string>();
|
|
List<string> sqls = new List<string>();
|
|
|
//存在不良删除不良记录
|
|
//存在不良删除不良记录
|
|
@@ -64,23 +64,33 @@ namespace UAS_MES.Special
|
|
|
sqls.Add("update oqcbatch set ob_nowcheckqty=ob_nowcheckqty-1 where ob_checkno='" + ms_checkno + "'");
|
|
sqls.Add("update oqcbatch set ob_nowcheckqty=ob_nowcheckqty-1 where ob_checkno='" + ms_checkno + "'");
|
|
|
}
|
|
}
|
|
|
//清除上料数据
|
|
//清除上料数据
|
|
|
- dt = (DataTable)dh.ExecuteSql("select cm_barcode from craftmaterial where cm_sncode='" + sn_code.Text + "' and cm_makecode='" + ms_makecode + "'", "select");
|
|
|
|
|
|
|
+ dt = (DataTable)dh.ExecuteSql("select cm_barcode,cm_materialtype,cm_makecode,cm_stepcode from craftmaterial where cm_sncode='" + sn_code.Text + "' and cm_makecode='" + ms_makecode + "'", "select");
|
|
|
if (dt.Rows.Count > 0)
|
|
if (dt.Rows.Count > 0)
|
|
|
{
|
|
{
|
|
|
List<string> barcode = new List<string>();
|
|
List<string> barcode = new List<string>();
|
|
|
for (int i = 0; i < dt.Rows.Count; i++)
|
|
for (int i = 0; i < dt.Rows.Count; i++)
|
|
|
{
|
|
{
|
|
|
barcode.Add(dt.Rows[i]["cm_barcode"].ToString());
|
|
barcode.Add(dt.Rows[i]["cm_barcode"].ToString());
|
|
|
|
|
+ //存在批管控的物料
|
|
|
|
|
+ if (dt.Rows[i]["cm_materialtype"].ToString() == "2")
|
|
|
|
|
+ {
|
|
|
|
|
+ string mss_id = dh.getFieldDataByCondition("makesourcestock", "mss_id", "mss_makecode='" + dt.Rows[i]["cm_makecode"].ToString() + "' and mss_barcode='" + dt.Rows[i]["cm_barcode"].ToString() + "' and mss_stepcode='" + dt.Rows[i]["cm_stepcode"].ToString() + "' and mss_validtime is not null and mss_invalidtime is null").ToString();
|
|
|
|
|
+ dh.UpdateByCondition("makesourcestock", "mss_remain=mss_remain+mss_baseqty,mss_useqty=mss_useqty-mss_baseqty", "mss_id='" + mss_id + "'");
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
sql.Clear();
|
|
sql.Clear();
|
|
|
- sql.Append("update makeserial set ms_nextmacode='' where ms_sncode=:barcode and ms_id=(select max(ms_id) from makeserial where ms_sncode=:barcode1)");
|
|
|
|
|
- dh.BatchInsert(sql.GetString(), new string[] { "barcode", "barcode1" }, barcode.ToArray(), barcode.ToArray());
|
|
|
|
|
|
|
+ sql.Append("update makeserial set ms_nextmacode='' where ms_sncode=:barcode and ms_nextmacode='" + ms_makecode + "'");
|
|
|
|
|
+ dh.BatchInsert(sql.GetString(), new string[] { "barcode" }, barcode.ToArray());
|
|
|
sqls.Add("delete from craftmaterial where cm_sncode='" + sn_code.Text + "' and cm_makecode='" + ms_makecode + "'");
|
|
sqls.Add("delete from craftmaterial where cm_sncode='" + sn_code.Text + "' and cm_makecode='" + ms_makecode + "'");
|
|
|
}
|
|
}
|
|
|
|
|
+ //删除老化记录
|
|
|
|
|
+ sqls.Add("delete from AGINGRECORD where ar_sncode='" + sn_code.Text + "' and ar_macode='" + ms_makecode + "'");
|
|
|
|
|
+ //解除前一工单板的使用
|
|
|
|
|
+ sqls.Add("update makeserial set ms_nextmacode='' where ms_sncode='" + sn_code.Text + "' and ms_nextmacode='" + ms_makecode + "'");
|
|
|
//清除操作日志
|
|
//清除操作日志
|
|
|
- sqls.Add("delete from commandlog where cl_makecode='" + ms_makecode + "' and cl_sncode='" + sn_code.Text + "'");
|
|
|
|
|
|
|
+ //sqls.Add("delete from commandlog where cl_makecode='" + ms_makecode + "' and cl_sncode='" + sn_code.Text + "'");
|
|
|
//删除过站记录
|
|
//删除过站记录
|
|
|
- sqls.Add("delete from makeprocess where mp_sncode='" + sn_code.Text + "' and mp_makecode='" + ms_makecode + "'");
|
|
|
|
|
|
|
+ //sqls.Add("delete from makeprocess where mp_sncode='" + sn_code.Text + "' and mp_makecode='" + ms_makecode + "'");
|
|
|
//投入数-1
|
|
//投入数-1
|
|
|
sqls.Add("update make set ma_inqty=ma_inqty-1 where ma_code='" + ms_makecode + "'");
|
|
sqls.Add("update make set ma_inqty=ma_inqty-1 where ma_code='" + ms_makecode + "'");
|
|
|
//删除StepPass
|
|
//删除StepPass
|