|
|
@@ -134,7 +134,7 @@ namespace UAS_MES.Make
|
|
|
return;
|
|
|
}
|
|
|
sql.Clear();
|
|
|
- sql.Append("select ms_status,ms_reworkstatus,nvl(ms_ifrework,0)ms_ifrework from makeserial left join make ");
|
|
|
+ sql.Append("select ms_status,ms_outboxcode,ms_reworkstatus,nvl(ms_ifrework,0)ms_ifrework from makeserial left join make ");
|
|
|
sql.Append("on ms_makecode=ma_code where ms_sncode = '" + GetSNCode.Text + "' order by ms_id desc");
|
|
|
dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
|
|
|
if (dt.Rows.Count > 0)
|
|
|
@@ -142,6 +142,13 @@ namespace UAS_MES.Make
|
|
|
string ms_status = dt.Rows[0]["ms_status"].ToString();
|
|
|
ifrework = dt.Rows[0]["ms_ifrework"].ToString();
|
|
|
reworkstatus = dt.Rows[0]["ms_reworkstatus"].ToString();
|
|
|
+ if (dt.Rows[0]["ms_outboxcode"].ToString() != "")
|
|
|
+ {
|
|
|
+ OperatResult.AppendText(">>序列号:" + GetSNCode.Text + "已装箱,请先进行拆箱\n", Color.Red);
|
|
|
+ BaseUtil.CleanForm(this);
|
|
|
+ BadCodeTree.Nodes.Clear();
|
|
|
+ return;
|
|
|
+ }
|
|
|
//如果不是返修序列号执行原来的步骤
|
|
|
if (ifrework == "0")
|
|
|
{
|
|
|
@@ -211,12 +218,26 @@ namespace UAS_MES.Make
|
|
|
sql.Append("select cm_craftcode,cm_stepcode,cm_soncode,min(cm_indate)cm_indate,sum(case when cm_status=-1 ");
|
|
|
sql.Append("then 0 else 1 end)qty from craftmaterial left join product on pr_code=cm_soncode where(cm_sncode ");
|
|
|
sql.Append("in (select sn from makesnrelation where firstsn='" + firstsn + "') or cm_sncode='" + firstsn + "') ");
|
|
|
- sql.Append("and cm_craftcode='" + cr_code.Text + "' group by cm_craftcode,cm_stepcode,cm_soncode having ");
|
|
|
+ sql.Append("and cm_craftcode='" + cr_code.Text + "'and nvl(cm_lastdeco,0)<>0 group by cm_craftcode,cm_stepcode,cm_soncode having ");
|
|
|
sql.Append("sum(case when cm_status=-1 then 0 else 1 end)=0 order by cm_indate");
|
|
|
dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
|
|
|
if (dt.Rows.Count > 0)
|
|
|
{
|
|
|
- cd_stepcode.Text = dt.Rows[0]["cm_stepcode"].ToString();
|
|
|
+ cd_stepcode.Text = LogicHandler.GetNextStep(dt.Rows[0]["cm_craftcode"].ToString(), dt.Rows[0]["cm_stepcode"].ToString(), ms_prodcode.Text);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ sql.Clear();
|
|
|
+ sql.Append("select cm_craftcode,cm_stepcode,cm_soncode,min(cm_indate)cm_indate,sum(case when cm_status=-1 ");
|
|
|
+ sql.Append("then 0 else 1 end)qty from craftmaterial left join product on pr_code=cm_soncode where(cm_sncode ");
|
|
|
+ sql.Append("in (select sn from makesnrelation where firstsn='" + firstsn + "') or cm_sncode='" + firstsn + "') ");
|
|
|
+ sql.Append("and cm_craftcode='" + cr_code.Text + "' group by cm_craftcode,cm_stepcode,cm_soncode having ");
|
|
|
+ sql.Append("sum(case when cm_status=-1 then 0 else 1 end)=0 order by cm_indate");
|
|
|
+ dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
|
|
|
+ if (dt.Rows.Count > 0)
|
|
|
+ {
|
|
|
+ cd_stepcode.Text = dt.Rows[0]["cm_stepcode"].ToString();
|
|
|
+ }
|
|
|
}
|
|
|
//如果ms_stepcode和扣料工序均没有查到返修的工序
|
|
|
if (cd_stepcode.Text == "")
|
|
|
@@ -447,6 +468,7 @@ namespace UAS_MES.Make
|
|
|
else
|
|
|
{
|
|
|
dt = dh.getFieldsDataByCondition("makeserial", new string[] { "nvl(ms_ifrework,0) ms_ifrework", "ms_paststep" }, "ms_sncode='" + ms_sncode.Text + "' and ms_makecode='" + macode + "'");
|
|
|
+ List<string> SQLS = new List<string>();
|
|
|
if (dt.Rows.Count > 0)
|
|
|
{
|
|
|
string ms_ifrework = dt.Rows[0]["ms_ifrework"].ToString();
|
|
|
@@ -458,11 +480,14 @@ namespace UAS_MES.Make
|
|
|
return;
|
|
|
}
|
|
|
if (ms_ifrework == "0")
|
|
|
- dh.UpdateByCondition("makeserial", "ms_paststep = ms_paststep || case when instr(','||ms_paststep||',','" + User.CurrentStepCode + "')=0 then ','||'" + User.CurrentStepCode + "' end , ms_nextstepcode ='" + cd_stepcode.Text + "',ms_craftcode='" + cr_code.Text + "',ms_stepcode='" + User.CurrentStepCode + "',ms_status=1", "ms_id='" + msid + "'");
|
|
|
+ SQLS.Add("update makeserial set ms_checkno='',ms_paststep = ms_paststep || case when instr(','||ms_paststep||',','" + User.CurrentStepCode + "')=0 then ','||'" + User.CurrentStepCode + "' end , ms_nextstepcode ='" + cd_stepcode.Text + "',ms_craftcode='" + cr_code.Text + "',ms_stepcode='" + User.CurrentStepCode + "',ms_status=1 where ms_id='" + msid + "'");
|
|
|
else
|
|
|
- dh.UpdateByCondition("makeserial", "ms_paststep = ms_paststep || case when instr(','||ms_paststep||',','" + User.CurrentStepCode + "')=0 then ','||'" + User.CurrentStepCode + "' end , ms_nextstepcode ='" + cd_stepcode.Text + "',ms_craftcode='" + cr_code.Text + "',ms_stepcode='" + User.CurrentStepCode + "',ms_reworkstatus=1", "ms_id='" + msid + "'");
|
|
|
+ SQLS.Add("update makeserial set ms_checkno='',ms_paststep = ms_paststep || case when instr(','||ms_paststep||',','" + User.CurrentStepCode + "')=0 then ','||'" + User.CurrentStepCode + "' end , ms_nextstepcode ='" + cd_stepcode.Text + "',ms_craftcode='" + cr_code.Text + "',ms_stepcode='" + User.CurrentStepCode + "',ms_reworkstatus=1 where ms_id='" + msid + "'");
|
|
|
}
|
|
|
- dh.UpdateByCondition("makebad", "mb_status=-1", "mb_sncode='" + ms_sncode.Text + "' and mb_makecode='" + ms_makecode.Text + "'");
|
|
|
+ SQLS.Add("update makebad set mb_status=-1 where mb_sncode='" + ms_sncode.Text + "' and mb_makecode='" + ms_makecode.Text + "'");
|
|
|
+ //取消最近拆解部件
|
|
|
+ SQLS.Add("update craftmaterial set cm_lastdeco=0 where cm_sncode='" + ms_sncode.Text + "' and cm_makecode='" + ms_makecode.Text + "' and nvl(cm_lastdeco,0)<>0");
|
|
|
+ dh.ExecuteSQLTran(SQLS.ToArray());
|
|
|
LogicHandler.InsertMakeProcess(ms_sncode.Text, ms_makecode.Text, User.UserSourceCode, "回流工序", "完成维修回流", User.UserCode);
|
|
|
LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, macode, User.UserLineCode, User.UserSourceCode, "回流工序", "完成维修回流", ms_sncode.Text, ms_checkno.Text);
|
|
|
OperatResult.AppendText(">>序列号" + ms_sncode.Text + "回流成功\n", Color.Green);
|