|
|
@@ -520,7 +520,7 @@ namespace UAS_MES.PublicMethod
|
|
|
string totalcount = dh.getFieldDataByCondition("package", "nvl(pa_totalqty,0) pa_totalqty", "pa_outboxcode='" + iOutBoxCode + "'").ToString();
|
|
|
//更新过站数量
|
|
|
sql.Clear();
|
|
|
- sql.Append("update makecraftdetail set mcd_inqty=mcd_inqty+"+ totalcount + ",mcd_outqty = mcd_outqty + "+ totalcount + ", ");
|
|
|
+ sql.Append("update makecraftdetail set mcd_inqty=mcd_inqty+" + totalcount + ",mcd_outqty = mcd_outqty + " + totalcount + ", ");
|
|
|
sql.Append("mcd_okqty = mcd_okqty + " + totalcount + " where mcd_macode='" + iMakeCode + "' and mcd_stepcode='" + CurrentStep + "'");
|
|
|
ExeSQL.Add(sql.ToString());
|
|
|
dh.ExecuteSQLTran(ExeSQL.ToArray());
|
|
|
@@ -554,18 +554,18 @@ namespace UAS_MES.PublicMethod
|
|
|
{
|
|
|
sql.Clear();
|
|
|
sql.Append("update makeserial set ms_stepcode='" + CurrentStep + "',ms_stepname='" + CurrentStepName + "',ms_nextstepcode=");
|
|
|
- sql.Append("'" + nextstepcode + "',ms_sccode='"+iSourceCode+"',ms_paststep=ms_paststep|| case when "+ifpast+">0 then ','||'"+CurrentStep+"' end ");
|
|
|
+ sql.Append("'" + nextstepcode + "',ms_sccode='" + iSourceCode + "',ms_paststep=ms_paststep|| case when " + ifpast + ">0 then ','||'" + CurrentStep + "' end ");
|
|
|
sql.Append("where exists (select 1 from mes_package_view where ms_sncode=v_barcode and ");
|
|
|
sql.Append("ms_makecode=v_makecode and v_outboxcode='" + iOutBoxCode + "')");
|
|
|
- ExeSQL.Add(sql.ToString());
|
|
|
+ ExeSQL.Add(sql.ToString());
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
//更新下一执行步骤
|
|
|
sql.Clear();
|
|
|
- sql.Append("update makeserial set ms_stepcode='"+CurrentStep+"',ms_stepname='"+ CurrentStepName + "',ms_nextstepcode='',MS_STATUS=2,");
|
|
|
- sql.Append("ms_sccode='"+iSourceCode+"',ms_paststep=ms_paststep|| case when "+ifpast+">0 then ','||'"+CurrentStep+"' end ");
|
|
|
- sql.Append("where exists (select 1 from mes_package_view where ms_sncode=v_barcode and ms_makecode=v_makecode and v_outboxcode='"+iOutBoxCode+"')");
|
|
|
+ sql.Append("update makeserial set ms_stepcode='" + CurrentStep + "',ms_stepname='" + CurrentStepName + "',ms_nextstepcode='',MS_STATUS=2,");
|
|
|
+ sql.Append("ms_sccode='" + iSourceCode + "',ms_paststep=ms_paststep|| case when " + ifpast + ">0 then ','||'" + CurrentStep + "' end ");
|
|
|
+ sql.Append("where exists (select 1 from mes_package_view where ms_sncode=v_barcode and ms_makecode=v_makecode and v_outboxcode='" + iOutBoxCode + "')");
|
|
|
ExeSQL.Add(sql.ToString());
|
|
|
//更新完工数量
|
|
|
ExeSQL.Add("update make set ma_madeqty=nvl(ma_madeqty,0)+" + totalcount + " where ma_code='" + iMakeCode + "'");
|
|
|
@@ -574,16 +574,47 @@ namespace UAS_MES.PublicMethod
|
|
|
sql.Clear();
|
|
|
sql.Append("insert into STEPPASSED(SP_ID,SP_IFTURNIN,SP_IFTURNOUT,SP_IFREWORK,SP_IFBACKFLOW,SP_CHECKNO,SP_RESULT");
|
|
|
sql.Append(",SP_SCCODE,SP_STEPCODE,SP_LINECODE,SP_WCCODE,SP_MAKECODE,SP_SNCODE,SP_YMD,SP_HM,SP_IFNG,SP_PRODCODE");
|
|
|
- sql.Append(",SP_DATE,SP_CRAFTCODE,sp_inman) select STEPPASSED_SEq.NEXTVAL,'"+ cd_ifmidinput + "','"+cd_ifmidfinish+"',");
|
|
|
- sql.Append("ms_ifrework,case when ms_ifrework=-1 then 0 when ms_stepcode='"+CurrentStep+ "' then 0 when "+ ifpast + ">0 ");
|
|
|
- sql.Append("then -1 else 0 end,0,ms_checkno,'良品','"+iSourceCode+"','"+CurrentStep+"','"+ LineCode + "',ms_makecode,ms_sncode,");
|
|
|
- sql.Append("to_char(sysdate,'yyyymmdd'),to_char(sysdate,'hh24miss'),0,ms_prodcode,SYSDATE,ms_craftcode,'"+iUserCode+"' ");
|
|
|
- sql.Append("from mes_package_view left join makeserial on ms_sncode=v_barcode and ms_makecode=v_makecode where v_outboxcode='"+iOutBoxCode+"'");
|
|
|
+ sql.Append(",SP_DATE,SP_CRAFTCODE,sp_inman) select STEPPASSED_SEq.NEXTVAL,'" + cd_ifmidinput + "','" + cd_ifmidfinish + "',");
|
|
|
+ sql.Append("ms_ifrework,case when ms_ifrework=-1 then 0 when ms_stepcode='" + CurrentStep + "' then 0 when " + ifpast + ">0 ");
|
|
|
+ sql.Append("then -1 else 0 end,0,ms_checkno,'良品','" + iSourceCode + "','" + CurrentStep + "','" + LineCode + "',ms_makecode,ms_sncode,");
|
|
|
+ sql.Append("to_char(sysdate,'yyyymmdd'),to_char(sysdate,'hh24miss'),0,ms_prodcode,SYSDATE,ms_craftcode,'" + iUserCode + "' ");
|
|
|
+ sql.Append("from mes_package_view left join makeserial on ms_sncode=v_barcode and ms_makecode=v_makecode where v_outboxcode='" + iOutBoxCode + "'");
|
|
|
ExeSQL.Add(sql.ToString());
|
|
|
dh.ExecuteSQLTran(ExeSQL.ToArray());
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ /// <summary>
|
|
|
+ /// 大箱栈板解除装箱
|
|
|
+ /// </summary>
|
|
|
+ public static void OutBoxDrawStepPass(string iOutBoxCode, string iMakeCode, string iSourceCode)
|
|
|
+ {
|
|
|
+ string CurrentStep = "";
|
|
|
+ string LineCode = "";
|
|
|
+ string CurrentStepName = "";
|
|
|
+ List<string> ExeSQL = new List<string>();
|
|
|
+ GetStepCodeAndNameAndLineBySource(iSourceCode, ref CurrentStep, ref CurrentStepName, ref LineCode);
|
|
|
+ //更新工序会上一执行步骤
|
|
|
+ sql.Clear();
|
|
|
+ sql.Append("update makeserial set ms_nextstepcode=ms_stepcode,MS_STATUS=1,ms_sccode='" + iSourceCode + "' ");
|
|
|
+ sql.Append("where ms_sncode in (select v_barcode from mes_package_view where v_outboxcode='" + iOutBoxCode + "')");
|
|
|
+ ExeSQL.Add(sql.ToString());
|
|
|
+ //更新完工数量
|
|
|
+ ExeSQL.Add("update make set ma_madeqty=(select count(1) from makeserial where ms_makecode='" + iMakeCode + "' and ms_status=2) where ma_code='" + iMakeCode + "'");
|
|
|
+ //删除StepPassed数据
|
|
|
+ sql.Clear();
|
|
|
+ sql.Append("delete from steppassed where sp_sncode in (select v_barcode from mes_package_view where v_outboxcode='" + iOutBoxCode + "') ");
|
|
|
+ sql.Append("and sp_makecode='" + iMakeCode + "' and sp_stepcode='" + CurrentStep + "'");
|
|
|
+ ExeSQL.Add(sql.ToString());
|
|
|
+ //更新大箱或栈板的母箱编号为空
|
|
|
+ ExeSQL.Add("update package set pa_mothercode='' where pa_outboxcode in(select PD_INNERBOXCODE from package left join packagedetail on pa_id=pd_paid where pa_outboxcode='" + iOutBoxCode + "')");
|
|
|
+ //删除从表明细
|
|
|
+ ExeSQL.Add("delete from packagedetail where pd_paid=(select pa_id from package where pa_outboxcode='" + iOutBoxCode + "')");
|
|
|
+ //设置大箱或栈板的已装数量为0
|
|
|
+ ExeSQL.Add("update package set pa_totalqty=0,pa_currentqty=0,pa_packageqty=0 where pa_outboxcode='" + iOutBoxCode + "'");
|
|
|
+ dh.ExecuteSQLTran(ExeSQL.ToArray());
|
|
|
+ }
|
|
|
+
|
|
|
/// <summary>
|
|
|
/// 记录操作日志
|
|
|
/// </summary>
|