|
|
@@ -919,19 +919,19 @@ namespace UAS_MES.PublicMethod
|
|
|
/// <param name="iMPKind"></param>
|
|
|
/// <param name="result"></param>
|
|
|
/// <param name="iUserCode"></param>
|
|
|
- public static void InsertMakeProcess(string iSnCode, string iMakeCode,string iSourceCode, string iMPKind, string result, string iUserCode)
|
|
|
+ public static void InsertMakeProcess(string iSnCode, string iMakeCode, string iSourceCode, string iMPKind, string result, string iUserCode)
|
|
|
{
|
|
|
string CurrentStep = "";
|
|
|
string LineCode = "";
|
|
|
string CurrentStepName = "";
|
|
|
- GetStepCodeAndNameAndLineBySource(iSourceCode,ref CurrentStep,ref CurrentStepName ,ref LineCode);
|
|
|
+ GetStepCodeAndNameAndLineBySource(iSourceCode, ref CurrentStep, ref CurrentStepName, ref LineCode);
|
|
|
sql.Clear();
|
|
|
sql.Append("insert into MakeProcess(mp_id,mp_makecode,mp_maid, mp_mscode,mp_sncode,mp_stepcode,mp_stepname,");
|
|
|
sql.Append("mp_craftcode,mp_craftname,mp_kind,mp_result,mp_indate,mp_inman,mp_wccode,mp_linecode,mp_sourcecode,mp_snstatus,mp_sncheckno,mp_snoutboxcode)");
|
|
|
sql.Append("select MakeProcess_seq.nextval, ma_code,ma_id,ms_code,ms_sncode,mcd_stepcode,mcd_stepname,");
|
|
|
- sql.Append("ma_craftcode,ma_craftname,'" + iMPKind + "','" + result + "',sysdate,'" + iUserCode + "',ma_wccode,'"+ LineCode + "','"+ iSourceCode + "',");
|
|
|
+ sql.Append("ma_craftcode,ma_craftname,'" + iMPKind + "','" + result + "',sysdate,'" + iUserCode + "',ma_wccode,'" + LineCode + "','" + iSourceCode + "',");
|
|
|
sql.Append("ms_status,ms_checkno,ms_outboxcode from make left join makecraftdetail on mcd_macode=ma_code left join makeserial on ms_makecode=ma_code ");
|
|
|
- sql.Append("where ms_sncode='" + iSnCode + "' and ma_code='" + iMakeCode + "' and mcd_stepcode='"+ CurrentStep + "'");
|
|
|
+ sql.Append("where ms_sncode='" + iSnCode + "' and ma_code='" + iMakeCode + "' and mcd_stepcode='" + CurrentStep + "'");
|
|
|
dh.ExecuteSql(sql.ToString(), "insert");
|
|
|
sql.Clear();
|
|
|
}
|
|
|
@@ -1239,7 +1239,7 @@ namespace UAS_MES.PublicMethod
|
|
|
/// <param name="iUserName"></param>
|
|
|
/// <param name="oErrorMessage"></param>
|
|
|
/// <returns></returns>
|
|
|
- public static bool SetMaterialDown(string iSnCode, string iBarCode,string iSourceCode, string iCurrentStep, string iUserName, out string oErrorMessage)
|
|
|
+ public static bool SetMaterialDown(string iSnCode, string iBarCode, string iSourceCode, string iCurrentStep, string iUserName, out string oErrorMessage)
|
|
|
{
|
|
|
//序列号不为空的时候
|
|
|
oErrorMessage = "";
|
|
|
@@ -1277,7 +1277,7 @@ namespace UAS_MES.PublicMethod
|
|
|
string cm_stepcode = dt.Rows[0]["cm_stepcode"].ToString();
|
|
|
string cm_mccode = dt.Rows[0]["cm_mccode"].ToString();
|
|
|
dh.ExecuteSql("delete from Craftmaterial where cm_id=" + cm_id, "delete");
|
|
|
- InsertMakeProcess(ms_macode, iSnCode, iSourceCode,"下料操作", "下料成功", iUserName);
|
|
|
+ InsertMakeProcess(ms_macode, iSnCode, iSourceCode, "下料操作", "下料成功", iUserName);
|
|
|
int count = dh.getRowCount("craftMaterial", "cm_mccode='" + cm_mccode + "' and cm_stepcode='" + cm_stepcode + "' and cm_sncode='" + iSnCode + "'");
|
|
|
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 + "'");
|
|
|
@@ -1288,6 +1288,65 @@ namespace UAS_MES.PublicMethod
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
+ public static bool UpdateOQCMessage(string iSnCode, string iMakeCode, string iMPKind, string iSourceCode, string iUserCode, string iResult, out string oErrorMessage)
|
|
|
+ {
|
|
|
+ oErrorMessage = "";
|
|
|
+ string StepCode = "";
|
|
|
+ string StepName = "";
|
|
|
+ string LineCode = "";
|
|
|
+ if (iResult == "" || iResult == null)
|
|
|
+ {
|
|
|
+ iResult = "测试合格";
|
|
|
+ }
|
|
|
+ GetStepCodeAndNameAndLineBySource(iSourceCode, ref StepCode, ref StepName, ref LineCode);
|
|
|
+ //查询批次和批数量
|
|
|
+ int batchqty = 0;
|
|
|
+ string checkno = "";
|
|
|
+ DataTable dt = (DataTable)dh.ExecuteSql("select count(ms_checkno) count,ms_checkno from makeserial where ms_checkno=(select ms_checkno from makeserial where ms_sncode='" + iSnCode + "') group by ms_checkno", "select");
|
|
|
+ if (dt.Rows.Count > 0)
|
|
|
+ {
|
|
|
+ batchqty = int.Parse(dt.Rows[0]["count"].ToString());
|
|
|
+ checkno = dt.Rows[0]["ms_checkno"].ToString();
|
|
|
+ }
|
|
|
+ object nextstepcode = dh.getFieldDataByCondition("makecraftdetail", "mcd_nextstepcode", "mcd_macode='" + iMakeCode + "' and mcd_stepcode='" + StepCode + "'");
|
|
|
+ if (iResult.Contains("批次通过") && dt.Rows.Count > 0)
|
|
|
+ {
|
|
|
+ //更新执行的数量
|
|
|
+ sqls.Add("update makecraftdetail set mcd_inqty=mcd_inqty+" + batchqty + ",mcd_outqty = mcd_outqty + " + batchqty + ",mcd_okqty = mcd_okqty + " + batchqty + " where mcd_macode='" + iMakeCode + "' and mcd_stepcode='" + StepCode + "' ");
|
|
|
+ //更新makeSerial 的下一工序
|
|
|
+ sqls.Add("update makeserial set ms_paststep = ms_paststep || '," + StepCode + "',ms_stepcode='" + StepCode + "',ms_nextstepcode='" + nextstepcode.ToString() + "' where ms_checkno='" + checkno + "'");
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ //更新执行的数量
|
|
|
+ sqls.Add("update makecraftdetail set mcd_inqty=mcd_inqty+1,mcd_outqty = mcd_outqty + 1,mcd_okqty = mcd_okqty + 1 where mcd_macode='" + iMakeCode + "' and mcd_stepcode='" + StepCode + "' ");
|
|
|
+ //更新makeSerial 的下一工序
|
|
|
+ sqls.Add("update makeserial set ms_paststep = ms_paststep || '," + StepCode + "',ms_stepcode='" + StepCode + "',ms_nextstepcode='" + nextstepcode.ToString() + "' where ms_sncode='" + iSnCode + "' and ms_makecode='" + iMakeCode + "'");
|
|
|
+ }
|
|
|
+ //更新序列号已经采集的工序 ms_paststep 已采集数据,更新下一工序
|
|
|
+ dh.ExecuteSQLTran(sqls.ToArray());
|
|
|
+ sqls.Clear();
|
|
|
+ //记录操作日志
|
|
|
+ InsertMakeProcess(iSnCode, iMakeCode, iSourceCode, iMPKind, iResult, iUserCode);
|
|
|
+ //检测下道工序是否存在,不存在 更新状态为已完成
|
|
|
+ if (nextstepcode == null || nextstepcode.ToString() == "")
|
|
|
+ {
|
|
|
+ if (iResult.Contains("批次通过"))
|
|
|
+ {
|
|
|
+ sqls.Add("update make set ma_madeqty=ma_madeqty+" + batchqty + " where ma_code='" + iMakeCode + "'");
|
|
|
+ sqls.Add("update makeserial set ms_status=2 where ms_checkno='" + checkno + "'");
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ sqls.Add("update make set ma_madeqty=ma_madeqty+1 where ma_code='" + iMakeCode + "'");
|
|
|
+ sqls.Add("update makeserial set ms_status=2 where ms_sncode='" + iSnCode + "'");
|
|
|
+ }
|
|
|
+ dh.ExecuteSQLTran(sqls.ToArray());
|
|
|
+ sqls.Clear();
|
|
|
+ }
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
/// <summary>
|
|
|
/// 设置良品采集结果,iResult含有“批次通过”按抽检批次通过
|
|
|
/// </summary>
|