|
|
@@ -228,7 +228,7 @@ namespace UAS_MES.Make
|
|
|
{
|
|
|
if (LogicHandler.CheckStepSNAndMacode(ma_code.Text, User.UserSourceCode, code.Text, User.UserCode, out oMakeCode, out oMsid, out ErrorMessage))
|
|
|
{
|
|
|
- dt = (DataTable)dh.ExecuteSql("select nvl(cm_status,0)cm_status,cm_id,cm_stepcode,ms_makecode,cm_mccode,cm_materialtype from craftmaterial left join makeserial on cm_makecode=ms_makecode and cm_sncode=ms_sncode where ms_sncode='" + code.Text + "' and cm_makecode='" + ma_code.Text + "'", "select");
|
|
|
+ dt = (DataTable)dh.ExecuteSql("select cm_makecode,cm_craftcode,nvl(cm_status,0)cm_status,cm_id,cm_stepcode,ms_makecode,cm_mccode,cm_materialtype from craftmaterial left join makeserial on cm_makecode=ms_makecode and cm_sncode=ms_sncode where ms_sncode='" + code.Text + "' and cm_makecode='" + ma_code.Text + "'", "select");
|
|
|
if (dt.Rows.Count > 0)
|
|
|
{
|
|
|
string ms_macode = dt.Rows[0]["ms_makecode"].ToString();
|
|
|
@@ -236,6 +236,8 @@ namespace UAS_MES.Make
|
|
|
string cm_mccode = dt.Rows[0]["cm_mccode"].ToString();
|
|
|
string cm_materialtype = dt.Rows[0]["cm_materialtype"].ToString();
|
|
|
string cm_status = dt.Rows[0]["cm_status"].ToString();
|
|
|
+ string cm_makecode = dt.Rows[0]["cm_makecode"].ToString();
|
|
|
+ string cm_craftcode = dt.Rows[0]["cm_craftcode"].ToString();
|
|
|
if (cm_materialtype == "1" && cm_status == "0")
|
|
|
{
|
|
|
dh.ExecuteSql("delete from craftmaterial where cm_sncode='" + code.Text + "' and cm_makecode='" + ma_code.Text + "'", "delete");
|
|
|
@@ -243,6 +245,12 @@ namespace UAS_MES.Make
|
|
|
int count = dh.getRowCount("craftMaterial", "cm_mccode='" + cm_mccode + "' and cm_stepcode='" + cm_stepcode + "' and cm_sncode='" + code.Text + "'");
|
|
|
if (count == 0)
|
|
|
dh.UpdateByCondition("makecraftdetail ", "mcd_inqty=mcd_inqty-1,mcd_outqty=mcd_outqty-1,mcd_okqty = mcd_okqty - 1", "mcd_mccode='" + cm_mccode + "' and mcd_stepcode='" + cm_stepcode + "'");
|
|
|
+ //清除已被使用的序列号
|
|
|
+ sql.Clear();
|
|
|
+ sql.Append("update makeserial set ms_nextmacode='' where ms_sncode in(select cm_barcode from craftmaterial where ");
|
|
|
+ sql.Append("cm_makecode='" + cm_makecode + "' and cm_stepcode='" + cm_stepcode + "' and cm_craftcode='" + cm_craftcode + "' ");
|
|
|
+ sql.Append("and cm_materialtype=1 and nvl(cm_status,0) =0) and ms_nextmacode='" + ma_code.Text + "'");
|
|
|
+ dh.ExecuteSql(sql.GetString(), "update");
|
|
|
LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, ma_code.Text, User.UserLineCode, User.UserSourceCode, "上料采集", "下料成功", code.Text, "");
|
|
|
OperateResult.AppendText(">>序列号" + code.Text + "下料成功\n", Color.Green, code);
|
|
|
}
|