From e416930892bbf70f125592b67dd0ee5a166b1d0c Mon Sep 17 00:00:00 2001 From: Ben Lin <maobin001@msn.com> Date: 星期五, 16 八月 2024 00:13:14 +0800 Subject: [PATCH] 测试节点保存不良增加WIP_ID --- Tiger.Business.MES/Transaction/TestNode.cs | 84 ++++++++++++++++++++++++++++++++++-------- 1 files changed, 68 insertions(+), 16 deletions(-) diff --git a/Tiger.Business.MES/Transaction/TestNode.cs b/Tiger.Business.MES/Transaction/TestNode.cs index 4178dce..0cf1bf4 100644 --- a/Tiger.Business.MES/Transaction/TestNode.cs +++ b/Tiger.Business.MES/Transaction/TestNode.cs @@ -182,6 +182,7 @@ var wipSN = new MES_WIP_DATA() { SN = input.SN, + FLOW_SN = input.SN, STATUS = MES_WIP_DATA.STATUSs.Init.GetValue(), ITEM_CODE = CurBatch.WO.ITEM_CODE, WORK_ORDER = CurBatch.Batch.ORDER_NO, @@ -212,6 +213,7 @@ CurBatch.WoSNs.Add(new() { WORK_ORDER = CurBatch.Batch.ORDER_NO, + WIP_ID = wipSN.ID, SN = wipSN.SN, TRAY_SN = wipSN.TRAY_SN, STATUS = BIZ_MES_WO_SN.STATUSs.NotInput.GetValue(), @@ -274,6 +276,43 @@ wipSN.DFT_FLAG = "Y"; wipSN.DFT_COUNT++; wipSN.DFT_CODE = input.DFT_CODE; + var dft = CurBatch.Defects.FirstOrDefault(q => q.DFT_CODE == wipSN.DFT_CODE); + var defect = new MES_WIP_DFT() + { + AUTH_ORG = wipSN.AUTH_ORG, + AUTH_PROD = wipSN.LINE_CODE, + SN = wipSN.SN, + STATUS = MES_WIP_DFT.STATUSs.WaitHandle.GetValue(), + ITEM_CODE = wipSN.ITEM_CODE, + WORK_ORDER = wipSN.WORK_ORDER, + BATCH_NO = wipSN.BATCH_NO, + ROT_CODE = wipSN.ROT_CODE, + NODE_ID = wipSN.NODE_ID, + NODE_NAME = wipSN.NODE_NAME, + FTY_CODE = wipSN.FTY_CODE, + WS_CODE = wipSN.WS_CODE, + LINE_CODE = wipSN.LINE_CODE, + POST_CODE = wipSN.POST_CODE, + OPER_CODE = wipSN.OPER_CODE, + SEGMENT = wipSN.SEGMENT, + DFT_CODE = dft.DFT_CODE, + DFT_NAME = dft.DFT_NAME, + DFT_LEVEL = dft.DFT_LEVEL, + FLOW_SN = wipSN.FLOW_SN, + TRAY_SN = wipSN.TRAY_SN, + INNER_SN = wipSN.INNER_SN, + CARTON_SN = wipSN.CARTON_SN, + PALLET_SN = wipSN.PALLET_SN, + INV_FLAG = wipSN.INV_FLAG, + OPERATION_TIME = DateTime.Now, + SFTS_CODE = wipSN.SFTS_CODE, + SFT_CODE = wipSN.SFT_CODE, + PRD_CODE = wipSN.PRD_CODE, + OBA_BATCH = wipSN.OBA_BATCH, + LOCK_BATCH = wipSN.LOCK_BATCH, + WIP_ID = wipSN.ID, + }; + CurDefects.Add(defect); } } @@ -288,6 +327,14 @@ CurWipSNHiss.Add(new MES_WIP_HIS(wipSN, $"宸ュ崟[{wipSN.WORK_ORDER}]鏉$爜[{wipSN.SN}]鍦ㄥ矖浣峓{wipSN.POST_CODE}]杩囩珯宸ュ簭[{wipSN.NODE_NAME}]鎴愬姛")); } + //鍒涘缓鍙橀噺鍏嬮殕瀵硅薄鐢ㄤ簬浼犲叆DBSubmitAction涓繚瀛樺綋鍓嶉渶瑕佹殏瀛樼殑鏁版嵁鍊� + var _woSns = woSNs.Clone(); + var _wipSns = wipSNs.Clone(); + var _wipHiss = CurWipSNHiss.Clone(); + var _defect = CurDefects.Clone(); + var _curNode = curNode.Clone(); + var _Batch = CurBatch.Batch.Clone(); + //鍒濆鍖栧伐姝ュ垪琛� Steps.Clear(); var curStep = new Biz.WorkStep(IWorkStep.Types.Node, this) @@ -296,21 +343,28 @@ Node = curNode, DBSubmitAction = () => { + //浣跨敤缁熶竴鐨勪簨鍔B瀵硅薄 var db = GetCommitDB(); - db.Storageable(woSNs, UserCode).ExecuteCommand(); - db.Storageable(wipSNs, UserCode).ExecuteCommand(); - db.Storageable(CurWipSNHiss, UserCode).ExecuteCommand(); - //濡傛灉鏄姇鍏ョ珯 - if (curNode.IS_INPUT == "Y") + //鏁版嵁淇濆瓨閫昏緫 + db.Storageable(_woSns, UserCode).ExecuteCommand(); + db.Storageable(_wipSns, UserCode).ExecuteCommand(); + db.Storageable(_wipHiss, UserCode).ExecuteCommand(); + //濡傛灉鏈変笉鑹垯淇濆瓨 + if (_defect.Any()) { - db.Updateable<BIZ_MES_WO>().SetColumns(q => q.INPUT_QTY == q.INPUT_QTY + wipSNs.Count).Where(q => q.ORDER_NO == CurBatch.WO.ORDER_NO).ExecuteCommand(); - db.Updateable<BIZ_MES_WO_BATCH>().SetColumns(q => q.INPUT_QTY == q.INPUT_QTY + wipSNs.Count).Where(q => q.BATCH_NO == CurBatch.Batch.BATCH_NO).ExecuteCommand(); + db.Storageable(_defect, UserCode).ExecuteCommand(); + } + //濡傛灉鏄姇鍏ョ珯 + if (_curNode.IS_INPUT == "Y") + { + db.Updateable<BIZ_MES_WO>().SetColumns(q => q.INPUT_QTY == q.INPUT_QTY + _woSns.Count).Where(q => q.ORDER_NO == _Batch.ORDER_NO).ExecuteCommand(); + db.Updateable<BIZ_MES_WO_BATCH>().SetColumns(q => q.INPUT_QTY == q.INPUT_QTY + _woSns.Count).Where(q => q.BATCH_NO == _Batch.BATCH_NO).ExecuteCommand(); } //濡傛灉鏄骇鍑虹珯 - if (curNode.IS_OUTPUT == "Y") + if (_curNode.IS_OUTPUT == "Y") { - db.Updateable<BIZ_MES_WO>().SetColumns(q => q.OUTPUT_QTY == q.OUTPUT_QTY + wipSNs.Count).Where(q => q.ORDER_NO == CurBatch.WO.ORDER_NO).ExecuteCommand(); - db.Updateable<BIZ_MES_WO_BATCH>().SetColumns(q => q.OUTPUT_QTY == q.OUTPUT_QTY + wipSNs.Count).Where(q => q.BATCH_NO == CurBatch.Batch.BATCH_NO).ExecuteCommand(); + db.Updateable<BIZ_MES_WO>().SetColumns(q => q.OUTPUT_QTY == q.OUTPUT_QTY + _woSns.Count).Where(q => q.ORDER_NO == _Batch.ORDER_NO).ExecuteCommand(); + db.Updateable<BIZ_MES_WO_BATCH>().SetColumns(q => q.OUTPUT_QTY == q.OUTPUT_QTY + _woSns.Count).Where(q => q.BATCH_NO == _Batch.BATCH_NO).ExecuteCommand(); } } }; @@ -346,7 +400,6 @@ //鏈畬鎴愭墍鏈夊伐姝� if (!IsFinishAllSteps) { - var result = new ApiAction<SubmitOutput>(new SubmitOutput()); //鏈畬鎴愭墍鏈夊伐搴忚妭鐐瑰伐姝� if (!IsFinishNodeSteps) { @@ -355,14 +408,14 @@ NextSteps.Clear(); NextSteps.Add(next); //鏍规嵁鍚庣画宸ユ杩斿洖ApiAction - result.Data.SetValue(CurBatch, CurStep, next.ID, IsFinishAllSteps); + action.Data.SetValue(CurBatch, CurStep, next.ID, IsFinishAllSteps); //鏍规嵁宸ュ簭鑺傜偣宸ユ鐨勫簭鍙疯繑鍥炵浉搴旂殑鎿嶄綔鎻愮ず switch (next.Sequence) { case 2: //action.LocaleMsg = new($"璇锋墽琛岀浜屾"); - result.LocaleMsg = new("MES.Transaction.TestNode.绗簩姝ユ搷浣滄彁绀�"); + action.LocaleMsg = new("MES.Transaction.TestNode.绗簩姝ユ搷浣滄彁绀�"); break; default: break; @@ -371,12 +424,11 @@ //宸插畬鎴愭墍鏈夊伐搴忚妭鐐瑰伐姝ワ紝寮�濮嬫墽琛岃涓哄伐姝� else { - result = BeginNextActionStep(input); + action = BeginNextActionStep(input); } - return result; } //宸插畬鎴愭墍鏈夊伐姝� - else + if (IsFinishAllSteps) { action.Data.SetValue(CurBatch, CurStep, "", IsFinishAllSteps); action = DoIfFinishAllSteps(action); -- Gitblit v1.9.3