From c598e4bf57de2b4703d6c0e4d0905c9159273d26 Mon Sep 17 00:00:00 2001 From: Rodney Chen <rodney.chen@hotmail.com> Date: 星期二, 06 八月 2024 10:16:18 +0800 Subject: [PATCH] 条码增加托盘批量过站逻辑和包装外箱过站逻辑 --- Tiger.Model.Net/Entitys/SYS/V_USER_WH.cs | 4 Tiger.Api/Language.db | 0 Tiger.Business.MES/Transaction/CollectNode.cs | 186 ++++--- Tiger.Business.MES/WorkAction/Assembly.cs | 153 ++++-- Tiger.Model.Net/Entitys/SYS/V_USER_MENU.cs | 4 Tiger.Model.Net/Entitys/SYS/V_USER_PROD.cs | 4 Tiger.Business.MES/Transaction/PackingNode.cs | 219 +++++---- Tiger.Business.MES/Transaction/Position.cs | 13 Tiger.Business/MES/Biz.WorkBatch.cs | 10 Tiger.Model.Net/Entitys/MES/BIZ_MES_WO_SN.cs | 90 ++- Tiger.Model.Net/Entitys/MES/ParameterEntity/PositionParameter.cs | 15 Tiger.Business.MES/Transaction/TestNode.cs | 186 ++++--- Tiger.Business.MES/WorkAction/IPQC.cs | 77 +- Tiger.Model.Net/Entitys/SYS/V_USER_ORG.cs | 4 Tiger.Business.MES/WorkAction/PackingAction.cs | 150 +++--- Tiger.Business.MES/WorkAction/PrintLabel.cs | 74 +- Tiger.IBusiness/MES/Transaction/IPosition.cs | 5 Tiger.Business.MES/WorkAction/WipExtInfo.cs | 96 ++- Tiger.Model.Net/Entitys/WMS/V_SRM_ITEM.cs | 1 19 files changed, 731 insertions(+), 560 deletions(-) diff --git a/Tiger.Api/Language.db b/Tiger.Api/Language.db index a2c30e8..64f8461 100644 --- a/Tiger.Api/Language.db +++ b/Tiger.Api/Language.db Binary files differ diff --git a/Tiger.Business.MES/Transaction/CollectNode.cs b/Tiger.Business.MES/Transaction/CollectNode.cs index 09d71f1..45b149d 100644 --- a/Tiger.Business.MES/Transaction/CollectNode.cs +++ b/Tiger.Business.MES/Transaction/CollectNode.cs @@ -52,25 +52,25 @@ //褰撳墠宀椾綅鍦ㄥ綋鍓嶅伐鍗曚笉鏄绔欙紝鍒欐煡鎵炬潯鐮佸凡缁戝畾鐨勫伐鍗曞綋浣滃綋鍓嶅伐鍗� else { - var wosn = Biz.Db.Queryable<BIZ_MES_WO_BATCH, BIZ_MES_WO_SN>((q, s) => new JoinQueryInfos(JoinType.Inner, q.ORDER_NO == s.WORK_ORDER)) - .ByAuth(input.AuthOption).Where((q, s) => s.SN == input.SN).Select((q, s) => new { Batch = q, SN = s }).First(); + var wosns = Biz.Db.Queryable<BIZ_MES_WO_BATCH, BIZ_MES_WO_SN>((q, s) => new JoinQueryInfos(JoinType.Inner, q.ORDER_NO == s.WORK_ORDER)) + .ByAuth(input.AuthOption).Where((q, s) => s.SN == input.SN || s.TRAY_SN == input.SN).Select((q, s) => new { Batch = q, SN = s }).ToList(); //鏌ユ壘鍒版潯鐮佸凡缁戝畾鐨勫伐鍗� - if (!wosn.IsNullOrEmpty()) + if (!wosns.IsNullOrEmpty()) { - if (wosn.Batch.ACT_LINE != CurLine.LINE_CODE) + if (wosns.First().Batch.ACT_LINE != CurLine.LINE_CODE) { action.IsSuccessed = false; //action.LocaleMsg = new($"鏉$爜[{0}]宸插湪浜х嚎[{1}]鎶曞叆鐢熶骇锛岃鍦ㄦ纭矖浣嶆壂鎻�"); - action.LocaleMsg = new("MES.Transaction.PackingNode.Submit.NotCorrectLine", input.SN, wosn.Batch.ACT_LINE); + action.LocaleMsg = new("MES.Transaction.PackingNode.Submit.NotCorrectLine", input.SN, wosns.First().Batch.ACT_LINE); return action; } else { - if (CurBatch?.Batch?.ORDER_NO != wosn.Batch.ORDER_NO) + if (CurBatch?.Batch?.ORDER_NO != wosns.First().Batch.ORDER_NO) { //鏉$爜宸茬粦瀹氱殑宸ュ崟涓嶇瓑浜庡綋鍓嶅伐鍗曞垯閲嶆柊閫夋嫨宸ュ崟 - var result = await SelectOrder(new() { AuthOption = input.AuthOption, OrderNo = wosn.Batch.ORDER_NO }); + var result = await SelectOrder(new() { AuthOption = input.AuthOption, OrderNo = wosns.First().Batch.ORDER_NO }); if (!result.IsSuccessed) { action.IsSuccessed = result.IsSuccessed; @@ -175,21 +175,26 @@ return woStatus; } //闈炴硶杩囩珯闃插憜锛氳繘鍏ュ伐搴忔椂瑕佸鍔犲垽鏂潯鐮佹槸鍚︽寜娴佺▼杩囩珯 - var wipSN = Biz.Db.Queryable<MES_WIP_DATA>().IncludesAllFirstLayer().First(q => q.SN == input.SN && q.WORK_ORDER == CurBatch.WO.ORDER_NO) ?? new MES_WIP_DATA() + var wipSNs = Biz.Db.Queryable<MES_WIP_DATA>().IncludesAllFirstLayer().Where(q => (q.SN == input.SN || q.TRAY_SN == input.SN) && q.WORK_ORDER == CurBatch.WO.ORDER_NO).ToList(); + if (wipSNs.IsNullOrEmpty()) { - SN = input.SN, - STATUS = MES_WIP_DATA.STATUSs.Init.GetValue(), - ITEM_CODE = CurBatch.WO.ITEM_CODE, - WORK_ORDER = CurBatch.Batch.ORDER_NO, - BATCH_NO = CurBatch.Batch.BATCH_NO, - HOLD_FLAG = "N", - REWORK_FLAG = CurBatch.WO.ORDER_TYPE == BIZ_MES_WO.ORDER_TYPEs.Rework.GetValue() ? "Y" : "N", - FINISHED_FLAG = "N", - INV_FLAG = "N", - DFT_FLAG = "N", - DFT_COUNT = 0, - }; - var canGotoNext = CurBatch.CanGotoNext(input, wipSN, curNode); + var wipSN = new MES_WIP_DATA() + { + SN = input.SN, + STATUS = MES_WIP_DATA.STATUSs.Init.GetValue(), + ITEM_CODE = CurBatch.WO.ITEM_CODE, + WORK_ORDER = CurBatch.Batch.ORDER_NO, + BATCH_NO = CurBatch.Batch.BATCH_NO, + HOLD_FLAG = "N", + REWORK_FLAG = CurBatch.WO.ORDER_TYPE == BIZ_MES_WO.ORDER_TYPEs.Rework.GetValue() ? "Y" : "N", + FINISHED_FLAG = "N", + INV_FLAG = "N", + DFT_FLAG = "N", + DFT_COUNT = 0, + }; + wipSNs.Add(wipSN); + } + var canGotoNext = CurBatch.CanGotoNext(input, wipSNs.First(), curNode); if (!canGotoNext.IsSuccessed) { return canGotoNext; @@ -199,67 +204,88 @@ if (Steps.IsNullOrEmpty()) { //缁戝畾鏉$爜鍒板伐鍗� - if (!CurBatch.WoSNs.Any(q => q.SN == input.SN)) + foreach (var wipSN in wipSNs) { - CurBatch.WoSNs.Add(new() + if (!CurBatch.WoSNs.Any(q => q.SN == wipSN.SN)) { - WORK_ORDER = CurBatch.Batch.ORDER_NO, - SN = input.SN, - STATUS = BIZ_MES_WO_SN.STATUSs.NotInput.GetValue(), - }); + CurBatch.WoSNs.Add(new() + { + WORK_ORDER = CurBatch.Batch.ORDER_NO, + SN = wipSN.SN, + TRAY_SN = wipSN.TRAY_SN, + STATUS = BIZ_MES_WO_SN.STATUSs.NotInput.GetValue(), + }); + } } - var woSN = CurBatch.WoSNs.First(q => q.SN == input.SN); - woSN.AUTH_ORG = CurBatch.WO.AUTH_ORG; - woSN.AUTH_PROD = CurLine.LINE_CODE; - woSN.BATCH_NO = CurBatch.Batch.BATCH_NO; + + //鏇存柊宸ュ崟鏉$爜鏄庣粏淇℃伅 + var woSNs = CurBatch.WoSNs.Where(q => wipSNs.Any(w => q.SN == w.SN)).ToList(); + foreach (var woSN in woSNs) + { + woSN.AUTH_ORG = CurBatch.WO.AUTH_ORG; + woSN.AUTH_PROD = CurLine.LINE_CODE; + woSN.BATCH_NO = CurBatch.Batch.BATCH_NO; + } //鏉$爜杩囩珯 - wipSN.AUTH_ORG = CurBatch.WO.AUTH_ORG; - wipSN.AUTH_PROD = CurLine.LINE_CODE; - wipSN.STATUS = MES_WIP_DATA.STATUSs.OK.GetValue();//wipSN.STATUS > 0 ? MES_WIP_DATA.STATUSs.OK.GetValue() : wipSN.STATUS; - wipSN.ROT_CODE = CurBatch.WO.ROUTE_CODE; - wipSN.NODE_ID = curNode.ID; - wipSN.NODE_NAME = curNode.NODE_NAME; - wipSN.FTY_CODE = CurFactory.FTY_CODE; - wipSN.WS_CODE = CurWorkshop.WS_CODE; - wipSN.LINE_CODE = CurLine.LINE_CODE; - wipSN.POST_CODE = CurPosition.POST_CODE; - wipSN.OPER_CODE = curNode.OPER_CODE; - wipSN.SEGMENT = curNode.SEGMENT; - wipSN.OPERATION_TIME = DateTime.Now; - var curShiftPeriod = GetShiftPeriodForNow(); - if (!curShiftPeriod.IsNullOrEmpty()) + foreach (var wipSN in wipSNs) { - wipSN.SFTS_CODE = curShiftPeriod.ShiftSys.SFTS_CODE; - wipSN.SFT_CODE = curShiftPeriod.Shift.SFT_CODE; - wipSN.PRD_CODE = curShiftPeriod.Period.PRD_CODE; + wipSN.AUTH_ORG = CurBatch.WO.AUTH_ORG; + wipSN.AUTH_PROD = CurLine.LINE_CODE; + wipSN.STATUS = MES_WIP_DATA.STATUSs.OK.GetValue();//wipSN.STATUS > 0 ? MES_WIP_DATA.STATUSs.OK.GetValue() : wipSN.STATUS; + wipSN.ROT_CODE = CurBatch.WO.ROUTE_CODE; + wipSN.NODE_ID = curNode.ID; + wipSN.NODE_NAME = curNode.NODE_NAME; + wipSN.FTY_CODE = CurFactory.FTY_CODE; + wipSN.WS_CODE = CurWorkshop.WS_CODE; + wipSN.LINE_CODE = CurLine.LINE_CODE; + wipSN.POST_CODE = CurPosition.POST_CODE; + wipSN.OPER_CODE = curNode.OPER_CODE; + wipSN.SEGMENT = curNode.SEGMENT; + wipSN.OPERATION_TIME = DateTime.Now; + var curShiftPeriod = GetShiftPeriodForNow(); + if (!curShiftPeriod.IsNullOrEmpty()) + { + wipSN.SFTS_CODE = curShiftPeriod.ShiftSys.SFTS_CODE; + wipSN.SFT_CODE = curShiftPeriod.Shift.SFT_CODE; + wipSN.PRD_CODE = curShiftPeriod.Period.PRD_CODE; + } + //濡傛灉鏄姇鍏ョ珯 + if (curNode.IS_INPUT == "Y") + { + var woSN = woSNs.First(q => q.SN == wipSN.SN); + woSN.STATUS = BIZ_MES_WO_SN.STATUSs.Inputed.GetValue(); + wipSN.STATUS = MES_WIP_DATA.STATUSs.Input.GetValue(); + wipSN.INLINE_DATE = DateTime.Now; + } + //濡傛灉鏄骇鍑虹珯 + if (curNode.IS_OUTPUT == "Y") + { + var woSN = woSNs.First(q => q.SN == wipSN.SN); + woSN.STATUS = BIZ_MES_WO_SN.STATUSs.Finished.GetValue(); + wipSN.STATUS = MES_WIP_DATA.STATUSs.Finished.GetValue(); + wipSN.OUTLINE_DATE = DateTime.Now; + } + //濡傛灉鏈夋彁浜や笉鑹� + if (!input.DFT_CODE.IsNullOrEmpty()) + { + wipSN.STATUS = MES_WIP_DATA.STATUSs.NG.GetValue(); + wipSN.DFT_FLAG = "Y"; + wipSN.DFT_COUNT++; + wipSN.DFT_CODE = input.DFT_CODE; + } } + + //宸ュ崟寮�宸� CurBatch.StartWorking(UserCode); - //濡傛灉鏄姇鍏ョ珯 - if (curNode.IS_INPUT == "Y") + //鎶婂綋鍓嶆潯鐮佸鍔犲埌褰撳墠鏉$爜鍒楄〃 + CurWipSNs = wipSNs; + CurWipSNHiss.Clear(); + foreach (var wipSN in wipSNs) { - woSN.STATUS = BIZ_MES_WO_SN.STATUSs.Inputed.GetValue(); - wipSN.STATUS = MES_WIP_DATA.STATUSs.Input.GetValue(); - wipSN.INLINE_DATE = DateTime.Now; + CurWipSNHiss.Add(new MES_WIP_HIS(wipSN, $"宸ュ崟[{wipSN.WORK_ORDER}]鏉$爜[{wipSN.SN}]鍦ㄥ矖浣峓{wipSN.POST_CODE}]杩囩珯宸ュ簭[{wipSN.NODE_NAME}]鎴愬姛")); } - //濡傛灉鏄骇鍑虹珯 - if (curNode.IS_OUTPUT == "Y") - { - woSN.STATUS = BIZ_MES_WO_SN.STATUSs.Finished.GetValue(); - wipSN.STATUS = MES_WIP_DATA.STATUSs.Finished.GetValue(); - wipSN.OUTLINE_DATE = DateTime.Now; - } - //濡傛灉鏈夋彁浜や笉鑹� - if (!input.DFT_CODE.IsNullOrEmpty()) - { - wipSN.STATUS = MES_WIP_DATA.STATUSs.NG.GetValue(); - wipSN.DFT_FLAG = "Y"; - wipSN.DFT_COUNT++; - wipSN.DFT_CODE = input.DFT_CODE; - } - - CurWipSNHis = new MES_WIP_HIS(CurWipSN = wipSN, $"宸ュ崟[{wipSN.WORK_ORDER}]鏉$爜[{wipSN.SN}]鍦ㄥ矖浣峓{wipSN.POST_CODE}]杩囩珯宸ュ簭[{wipSN.NODE_NAME}]鎴愬姛"); //鍒濆鍖栧伐姝ュ垪琛� Steps.Clear(); @@ -270,20 +296,20 @@ DBSubmitAction = () => { var db = GetCommitDB(); - db.Storageable(woSN, UserCode).ExecuteCommand(); - db.Storageable(wipSN, UserCode).ExecuteCommand(); - db.Storageable(CurWipSNHis, UserCode).ExecuteCommand(); + db.Storageable(woSNs, UserCode).ExecuteCommand(); + db.Storageable(wipSNs, UserCode).ExecuteCommand(); + db.Storageable(CurWipSNHiss, UserCode).ExecuteCommand(); //濡傛灉鏄姇鍏ョ珯 if (curNode.IS_INPUT == "Y") { - db.Updateable<BIZ_MES_WO>().SetColumns(q => q.INPUT_QTY == q.INPUT_QTY + 1).Where(q => q.ORDER_NO == CurBatch.WO.ORDER_NO).ExecuteCommand(); - db.Updateable<BIZ_MES_WO_BATCH>().SetColumns(q => q.INPUT_QTY == q.INPUT_QTY + 1).Where(q => q.BATCH_NO == CurBatch.Batch.BATCH_NO).ExecuteCommand(); + 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(); } //濡傛灉鏄骇鍑虹珯 if (curNode.IS_OUTPUT == "Y") { - db.Updateable<BIZ_MES_WO>().SetColumns(q => q.OUTPUT_QTY == q.OUTPUT_QTY + 1).Where(q => q.ORDER_NO == CurBatch.WO.ORDER_NO).ExecuteCommand(); - db.Updateable<BIZ_MES_WO_BATCH>().SetColumns(q => q.OUTPUT_QTY == q.OUTPUT_QTY + 1).Where(q => q.BATCH_NO == CurBatch.Batch.BATCH_NO).ExecuteCommand(); + 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(); } } }; @@ -376,8 +402,8 @@ SaveStepsCommitActionToDB(); //淇濆瓨鎴愬姛锛岃繑鍥炶繃绔欐秷鎭� - //action.LocaleMsg = new($"宸ュ崟[{CurWipSN.WORK_ORDER}]鐨勬潯鐮乕{CurWipSN.SN}]鍦ㄥ矖浣峓{CurWipSN.POST_CODE}]宸ュ簭[{CurWipSN.NODE_NAME}]杩囩珯鎴愬姛锛岀姸鎬乕{CurWipSN.STATUS.GetEnumDesc<MES_WIP_DATA.STATUSs>()}]", CurWipSN.WORK_ORDER, CurWipSN.SN, CurWipSN.POST_CODE, CurWipSN.NODE_NAME, CurWipSN.STATUS.GetEnumDesc<MES_WIP_DATA.STATUSs>()); - action.LocaleMsg = new("MES.Transaction.CollectNode.ScanSn.PassSuccess", CurWipSN.WORK_ORDER, CurWipSN.SN, CurWipSN.POST_CODE, CurWipSN.NODE_NAME,CurWipSN.STATUS.GetEnumDesc<MES_WIP_DATA.STATUSs>()); + //action.LocaleMsg = new($"宸ュ崟[{CurWipSN.WORK_ORDER}]鐨勬潯鐮乕{CurWipSN.SN}]鍦ㄥ矖浣峓{CurWipSN.POST_CODE}]宸ュ簭[{CurWipSN.NODE_NAME}]杩囩珯鎴愬姛锛岀姸鎬乕{CurWipSN.STATUS.GetEnumDesc<MES_WIP_DATA.STATUSs>()}]"); + action.LocaleMsg = new("MES.Transaction.CollectNode.ScanSn.PassSuccess", CurWipSNs.First().WORK_ORDER, CurSN, CurWipSNs.First().POST_CODE, CurWipSNs.First().NODE_NAME,CurWipSNs.First().STATUS.GetEnumDesc<MES_WIP_DATA.STATUSs>()); //閲嶇疆宸ュ簭 ResetNode(); return action; diff --git a/Tiger.Business.MES/Transaction/PackingNode.cs b/Tiger.Business.MES/Transaction/PackingNode.cs index b6b5ba4..b6ca249 100644 --- a/Tiger.Business.MES/Transaction/PackingNode.cs +++ b/Tiger.Business.MES/Transaction/PackingNode.cs @@ -75,25 +75,32 @@ //褰撳墠宀椾綅鍦ㄥ綋鍓嶅伐鍗曚笉鏄绔欙紝鍒欐煡鎵炬潯鐮佸凡缁戝畾鐨勫伐鍗曞綋浣滃綋鍓嶅伐鍗� else { - var wosn = Biz.Db.Queryable<BIZ_MES_WO_BATCH, BIZ_MES_WO_SN>((q, s) => new JoinQueryInfos(JoinType.Inner, q.ORDER_NO == s.WORK_ORDER)) - .ByAuth(input.AuthOption).Where((q, s) => s.SN == input.SN).Select((q, s) => new { Batch = q, SN = s }).First(); + var wosns = Biz.Db.Queryable<BIZ_MES_WO_BATCH, BIZ_MES_WO_SN>((q, s) => new JoinQueryInfos(JoinType.Inner, q.ORDER_NO == s.WORK_ORDER)) + .ByAuth(input.AuthOption).Where((q, s) => s.SN == input.SN || s.TRAY_SN == input.SN).Select((q, s) => new { Batch = q, SN = s }).ToList(); //鏌ユ壘鍒版潯鐮佸凡缁戝畾鐨勫伐鍗� - if (!wosn.IsNullOrEmpty()) + if (!wosns.IsNullOrEmpty()) { - if (wosn.Batch.ACT_LINE != CurLine.LINE_CODE) + if (wosns.Count > 1 && wosns.Any(q => q.SN.TRAY_SN != q.SN.OUTER_SN)) + { + action.IsSuccessed = false; + action.LocaleMsg = new($"鏉$爜[{0}]鏄浇鍏锋潯鐮侊紝璇锋壂鎻忚浇鍏蜂腑鐨勪骇鍝佹潯鐮佺户缁寘瑁呮搷浣�"); + action.LocaleMsg = new("MES.Transaction.PackingNode.Submit.OnlyMinPackage", input.SN); + return action; + } + if (wosns.First().Batch.ACT_LINE != CurLine.LINE_CODE) { action.IsSuccessed = false; //action.LocaleMsg = new($"鏉$爜[{0}]宸插湪浜х嚎[{1}]鎶曞叆鐢熶骇锛岃鍦ㄦ纭矖浣嶆壂鎻�"); - action.LocaleMsg = new("MES.Transaction.PackingNode.Submit.NotCorrectLine", input.SN, wosn.Batch.ACT_LINE); + action.LocaleMsg = new("MES.Transaction.PackingNode.Submit.NotCorrectLine", input.SN, wosns.First().Batch.ACT_LINE); return action; } else { - if (CurBatch?.Batch?.ORDER_NO != wosn.Batch.ORDER_NO) + if (CurBatch?.Batch?.ORDER_NO != wosns.First().Batch.ORDER_NO) { //鏉$爜宸茬粦瀹氱殑宸ュ崟涓嶇瓑浜庡綋鍓嶅伐鍗曞垯閲嶆柊閫夋嫨宸ュ崟 - var result = await SelectOrder(new() { AuthOption = input.AuthOption, OrderNo = wosn.Batch.ORDER_NO }); + var result = await SelectOrder(new() { AuthOption = input.AuthOption, OrderNo = wosns.First().Batch.ORDER_NO }); if (!result.IsSuccessed) { action.IsSuccessed = result.IsSuccessed; @@ -199,21 +206,26 @@ return woStatus; } //闈炴硶杩囩珯闃插憜锛氳繘鍏ュ伐搴忔椂瑕佸鍔犲垽鏂潯鐮佹槸鍚︽寜娴佺▼杩囩珯 - var wipSN = Biz.Db.Queryable<MES_WIP_DATA>().IncludesAllFirstLayer().First(q => q.SN == input.SN && q.WORK_ORDER == CurBatch.WO.ORDER_NO) ?? new MES_WIP_DATA() + var wipSNs = Biz.Db.Queryable<MES_WIP_DATA>().IncludesAllFirstLayer().Where(q => (q.SN == input.SN || q.TRAY_SN == input.SN) && q.WORK_ORDER == CurBatch.WO.ORDER_NO).ToList(); + if (wipSNs.IsNullOrEmpty()) { - SN = input.SN, - STATUS = MES_WIP_DATA.STATUSs.Init.GetValue(), - ITEM_CODE = CurBatch.WO.ITEM_CODE, - WORK_ORDER = CurBatch.Batch.ORDER_NO, - BATCH_NO = CurBatch.Batch.BATCH_NO, - HOLD_FLAG = "N", - REWORK_FLAG = CurBatch.WO.ORDER_TYPE == BIZ_MES_WO.ORDER_TYPEs.Rework.GetValue() ? "Y" : "N", - FINISHED_FLAG = "N", - INV_FLAG = "N", - DFT_FLAG = "N", - DFT_COUNT = 0, - }; - var canGotoNext = CurBatch.CanGotoNext(input, wipSN, curNode); + var wipSN = new MES_WIP_DATA() + { + SN = input.SN, + STATUS = MES_WIP_DATA.STATUSs.Init.GetValue(), + ITEM_CODE = CurBatch.WO.ITEM_CODE, + WORK_ORDER = CurBatch.Batch.ORDER_NO, + BATCH_NO = CurBatch.Batch.BATCH_NO, + HOLD_FLAG = "N", + REWORK_FLAG = CurBatch.WO.ORDER_TYPE == BIZ_MES_WO.ORDER_TYPEs.Rework.GetValue() ? "Y" : "N", + FINISHED_FLAG = "N", + INV_FLAG = "N", + DFT_FLAG = "N", + DFT_COUNT = 0, + }; + wipSNs.Add(wipSN); + } + var canGotoNext = CurBatch.CanGotoNext(input, wipSNs.First(), curNode); if (!canGotoNext.IsSuccessed) { return canGotoNext; @@ -223,70 +235,91 @@ if (Steps.IsNullOrEmpty()) { //缁戝畾鏉$爜鍒板伐鍗� - if (!CurBatch.WoSNs.Any(q => q.SN == input.SN)) - { - CurBatch.WoSNs.Add(new() - { - WORK_ORDER = CurBatch.Batch.ORDER_NO, - SN = input.SN, - STATUS = BIZ_MES_WO_SN.STATUSs.NotInput.GetValue(), - }); - } - var woSN = CurBatch.WoSNs.First(q => q.SN == input.SN); - woSN.AUTH_ORG = CurBatch.WO.AUTH_ORG; - woSN.AUTH_PROD = CurLine.LINE_CODE; - woSN.BATCH_NO = CurBatch.Batch.BATCH_NO; - - //鏉$爜杩囩珯 - wipSN.AUTH_ORG = CurBatch.WO.AUTH_ORG; - wipSN.AUTH_PROD = CurLine.LINE_CODE; - wipSN.STATUS = MES_WIP_DATA.STATUSs.OK.GetValue();//wipSN.STATUS > 0 ? MES_WIP_DATA.STATUSs.OK.GetValue() : wipSN.STATUS; - wipSN.ROT_CODE = CurBatch.WO.ROUTE_CODE; - wipSN.NODE_ID = curNode.ID; - wipSN.NODE_NAME = curNode.NODE_NAME; - wipSN.FTY_CODE = CurFactory.FTY_CODE; - wipSN.WS_CODE = CurWorkshop.WS_CODE; - wipSN.LINE_CODE = CurLine.LINE_CODE; - wipSN.POST_CODE = CurPosition.POST_CODE; - wipSN.OPER_CODE = curNode.OPER_CODE; - wipSN.SEGMENT = curNode.SEGMENT; - wipSN.OPERATION_TIME = DateTime.Now; - var curShiftPeriod = GetShiftPeriodForNow(); - if (!curShiftPeriod.IsNullOrEmpty()) + foreach (var wipSN in wipSNs) { - wipSN.SFTS_CODE = curShiftPeriod.ShiftSys.SFTS_CODE; - wipSN.SFT_CODE = curShiftPeriod.Shift.SFT_CODE; - wipSN.PRD_CODE = curShiftPeriod.Period.PRD_CODE; + if (!CurBatch.WoSNs.Any(q => q.SN == wipSN.SN)) + { + CurBatch.WoSNs.Add(new() + { + WORK_ORDER = CurBatch.Batch.ORDER_NO, + SN = wipSN.SN, + TRAY_SN = wipSN.TRAY_SN, + STATUS = BIZ_MES_WO_SN.STATUSs.NotInput.GetValue(), + }); + } } - CurBatch.StartWorking(UserCode); - - //濡傛灉鏄姇鍏ョ珯 - if (curNode.IS_INPUT == "Y") - { - woSN.STATUS = BIZ_MES_WO_SN.STATUSs.Inputed.GetValue(); - wipSN.STATUS = MES_WIP_DATA.STATUSs.Input.GetValue(); - wipSN.INLINE_DATE = DateTime.Now; - } - //濡傛灉鏄骇鍑虹珯 - if (curNode.IS_OUTPUT == "Y") - { - woSN.STATUS = BIZ_MES_WO_SN.STATUSs.Finished.GetValue(); - wipSN.STATUS = MES_WIP_DATA.STATUSs.Finished.GetValue(); - wipSN.OUTLINE_DATE = DateTime.Now; - } - //濡傛灉鏈夋彁浜や笉鑹� - if (!input.DFT_CODE.IsNullOrEmpty()) - { - wipSN.STATUS = MES_WIP_DATA.STATUSs.NG.GetValue(); - wipSN.DFT_FLAG = "Y"; - wipSN.DFT_COUNT++; - wipSN.DFT_CODE = input.DFT_CODE; - } - - CurWipSNHis = new MES_WIP_HIS(CurWipSN = wipSN, $"宸ュ崟[{wipSN.WORK_ORDER}]鐨勬潯鐮乕{wipSN.SN}]鍦ㄥ矖浣峓{wipSN.POST_CODE}]宸ュ簭[{wipSN.NODE_NAME}]杩囩珯鎴愬姛锛岀姸鎬乕{wipSN.STATUS.GetEnumDesc<MES_WIP_DATA.STATUSs>()}]"); - - //鍒濆鍖栧伐姝ュ垪琛� - Steps.Clear(); + + //鏇存柊宸ュ崟鏉$爜鏄庣粏淇℃伅 + var woSNs = CurBatch.WoSNs.Where(q => wipSNs.Any(w => q.SN == w.SN)).ToList(); + foreach (var woSN in woSNs) + { + woSN.AUTH_ORG = CurBatch.WO.AUTH_ORG; + woSN.AUTH_PROD = CurLine.LINE_CODE; + woSN.BATCH_NO = CurBatch.Batch.BATCH_NO; + } + + //鏉$爜杩囩珯 + foreach (var wipSN in wipSNs) + { + wipSN.AUTH_ORG = CurBatch.WO.AUTH_ORG; + wipSN.AUTH_PROD = CurLine.LINE_CODE; + wipSN.STATUS = MES_WIP_DATA.STATUSs.OK.GetValue();//wipSN.STATUS > 0 ? MES_WIP_DATA.STATUSs.OK.GetValue() : wipSN.STATUS; + wipSN.ROT_CODE = CurBatch.WO.ROUTE_CODE; + wipSN.NODE_ID = curNode.ID; + wipSN.NODE_NAME = curNode.NODE_NAME; + wipSN.FTY_CODE = CurFactory.FTY_CODE; + wipSN.WS_CODE = CurWorkshop.WS_CODE; + wipSN.LINE_CODE = CurLine.LINE_CODE; + wipSN.POST_CODE = CurPosition.POST_CODE; + wipSN.OPER_CODE = curNode.OPER_CODE; + wipSN.SEGMENT = curNode.SEGMENT; + wipSN.OPERATION_TIME = DateTime.Now; + var curShiftPeriod = GetShiftPeriodForNow(); + if (!curShiftPeriod.IsNullOrEmpty()) + { + wipSN.SFTS_CODE = curShiftPeriod.ShiftSys.SFTS_CODE; + wipSN.SFT_CODE = curShiftPeriod.Shift.SFT_CODE; + wipSN.PRD_CODE = curShiftPeriod.Period.PRD_CODE; + } + //濡傛灉鏄姇鍏ョ珯 + if (curNode.IS_INPUT == "Y") + { + var woSN = woSNs.First(q => q.SN == wipSN.SN); + woSN.STATUS = BIZ_MES_WO_SN.STATUSs.Inputed.GetValue(); + wipSN.STATUS = MES_WIP_DATA.STATUSs.Input.GetValue(); + wipSN.INLINE_DATE = DateTime.Now; + } + //濡傛灉鏄骇鍑虹珯 + if (curNode.IS_OUTPUT == "Y") + { + var woSN = woSNs.First(q => q.SN == wipSN.SN); + woSN.STATUS = BIZ_MES_WO_SN.STATUSs.Finished.GetValue(); + wipSN.STATUS = MES_WIP_DATA.STATUSs.Finished.GetValue(); + wipSN.OUTLINE_DATE = DateTime.Now; + } + //濡傛灉鏈夋彁浜や笉鑹� + if (!input.DFT_CODE.IsNullOrEmpty()) + { + wipSN.STATUS = MES_WIP_DATA.STATUSs.NG.GetValue(); + wipSN.DFT_FLAG = "Y"; + wipSN.DFT_COUNT++; + wipSN.DFT_CODE = input.DFT_CODE; + } + } + + //宸ュ崟寮�宸� + CurBatch.StartWorking(UserCode); + + //鎶婂綋鍓嶆潯鐮佸鍔犲埌褰撳墠鏉$爜鍒楄〃 + CurWipSNs = wipSNs; + CurWipSNHiss.Clear(); + foreach (var wipSN in wipSNs) + { + CurWipSNHiss.Add(new MES_WIP_HIS(wipSN, $"宸ュ崟[{wipSN.WORK_ORDER}]鏉$爜[{wipSN.SN}]鍦ㄥ矖浣峓{wipSN.POST_CODE}]杩囩珯宸ュ簭[{wipSN.NODE_NAME}]鎴愬姛")); + } + + //鍒濆鍖栧伐姝ュ垪琛� + Steps.Clear(); var curStep = new Biz.WorkStep(IWorkStep.Types.Node, this) { Sequence = Steps.Count + 1, @@ -294,20 +327,20 @@ DBSubmitAction = () => { var db = GetCommitDB(); - db.Storageable(woSN, UserCode).ExecuteCommand(); - db.Storageable(wipSN, UserCode).ExecuteCommand(); - db.Storageable(CurWipSNHis, UserCode).ExecuteCommand(); + db.Storageable(woSNs, UserCode).ExecuteCommand(); + db.Storageable(wipSNs, UserCode).ExecuteCommand(); + db.Storageable(CurWipSNHiss, UserCode).ExecuteCommand(); //濡傛灉鏄姇鍏ョ珯 if (curNode.IS_INPUT == "Y") { - db.Updateable<BIZ_MES_WO>().SetColumns(q => q.INPUT_QTY == q.INPUT_QTY + 1).Where(q => q.ORDER_NO == CurBatch.WO.ORDER_NO).ExecuteCommand(); - db.Updateable<BIZ_MES_WO_BATCH>().SetColumns(q => q.INPUT_QTY == q.INPUT_QTY + 1).Where(q => q.BATCH_NO == CurBatch.Batch.BATCH_NO).ExecuteCommand(); + 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(); } //濡傛灉鏄骇鍑虹珯 if (curNode.IS_OUTPUT == "Y") { - db.Updateable<BIZ_MES_WO>().SetColumns(q => q.OUTPUT_QTY == q.OUTPUT_QTY + 1).Where(q => q.ORDER_NO == CurBatch.WO.ORDER_NO).ExecuteCommand(); - db.Updateable<BIZ_MES_WO_BATCH>().SetColumns(q => q.OUTPUT_QTY == q.OUTPUT_QTY + 1).Where(q => q.BATCH_NO == CurBatch.Batch.BATCH_NO).ExecuteCommand(); + 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(); } } }; @@ -399,8 +432,8 @@ SaveStepsCommitActionToDB(); //淇濆瓨鎴愬姛锛岃繑鍥炶繃绔欐秷鎭� - //action.LocaleMsg = new($"宸ュ崟[{CurWipSN.WORK_ORDER}]鐨勬潯鐮乕{CurWipSN.SN}]鍦ㄥ矖浣峓{CurWipSN.POST_CODE}]宸ュ簭[{CurWipSN.NODE_NAME}]杩囩珯鎴愬姛锛岀姸鎬乕{CurWipSN.STATUS.GetEnumDesc<MES_WIP_DATA.STATUSs>()}]", CurWipSN.WORK_ORDER, CurWipSN.SN, CurWipSN.POST_CODE, CurWipSN.NODE_NAME, CurWipSN.STATUS.GetEnumDesc<MES_WIP_DATA.STATUSs>()); - action.LocaleMsg = new("MES.Transaction.PackingNode.ScanSn.PassSuccess", CurWipSN.WORK_ORDER, CurWipSN.SN, CurWipSN.POST_CODE, CurWipSN.NODE_NAME, CurWipSN.STATUS.GetEnumDesc<MES_WIP_DATA.STATUSs>()); + //action.LocaleMsg = new($"宸ュ崟[{CurWipSN.WORK_ORDER}]鐨勬潯鐮乕{CurWipSN.SN}]鍦ㄥ矖浣峓{CurWipSN.POST_CODE}]宸ュ簭[{CurWipSN.NODE_NAME}]杩囩珯鎴愬姛锛岀姸鎬乕{CurWipSN.STATUS.GetEnumDesc<MES_WIP_DATA.STATUSs>()}]"); + action.LocaleMsg = new("MES.Transaction.CollectNode.ScanSn.PassSuccess", CurWipSNs.First().WORK_ORDER, CurSN, CurWipSNs.First().POST_CODE, CurWipSNs.First().NODE_NAME,CurWipSNs.First().STATUS.GetEnumDesc<MES_WIP_DATA.STATUSs>()); //閲嶇疆宸ュ簭 ResetNode(); return action; @@ -441,7 +474,7 @@ case "NodeSubmit": action.IsSuccessed = false; //action.LocaleMsg = new($"姝e湪杩涜鏉$爜[{CurWipSN.SN}]鐨勮繃绔欎笟鍔★紝涓嶅厑璁告墜鍔ㄧ粨鏉熷寘瑁�"); - action.LocaleMsg = new("MES.Transaction.PackingNode.WorkingOnNodeSubmit", CurWipSN.SN); + action.LocaleMsg = new("MES.Transaction.PackingNode.WorkingOnNodeSubmit", CurSN); break; default: break; diff --git a/Tiger.Business.MES/Transaction/Position.cs b/Tiger.Business.MES/Transaction/Position.cs index ccd93fd..4e11575 100644 --- a/Tiger.Business.MES/Transaction/Position.cs +++ b/Tiger.Business.MES/Transaction/Position.cs @@ -55,8 +55,9 @@ public MES_SHIFT_SYS CurShiftSys { get; set; } public WorkBatch CurBatch { get; set; } public IWorkBatch WorkBatch => CurBatch; - public MES_WIP_DATA CurWipSN { get; set; } - public MES_WIP_HIS CurWipSNHis { get; set; } + public List<MES_WIP_DATA> CurWipSNs { get; set; } + public string CurSN => CurWipSNs.First().TRAY_SN.IsNullOrEmpty() ? CurWipSNs.First().SN : CurWipSNs.First().TRAY_SN; + public List<MES_WIP_HIS> CurWipSNHiss { get; set; } public Dictionary<string, object> Context { get; set; } = new(); public List<WorkStep> Steps { get; set; } = new(); public WorkStep CurStep { get; set; } @@ -174,8 +175,8 @@ public virtual void ResetNode() { Steps.Clear(); - CurWipSN = null; - CurWipSNHis = null; + CurWipSNs = null; + CurWipSNHiss = null; CurStep = null; } @@ -411,7 +412,9 @@ switch (pv.VAR_METHOD) { case "GetSN": - return CurWipSN.SN; + return string.Join(",", CurWipSNs.Select(q => q.SN)); + case "GetTraySN": + return CurSN; case "GetBAS_ITEM": return WorkBatch.Product.ToJson(); case "GetCustomer": diff --git a/Tiger.Business.MES/Transaction/TestNode.cs b/Tiger.Business.MES/Transaction/TestNode.cs index fee2960..4178dce 100644 --- a/Tiger.Business.MES/Transaction/TestNode.cs +++ b/Tiger.Business.MES/Transaction/TestNode.cs @@ -52,25 +52,25 @@ //褰撳墠宀椾綅鍦ㄥ綋鍓嶅伐鍗曚笉鏄绔欙紝鍒欐煡鎵炬潯鐮佸凡缁戝畾鐨勫伐鍗曞綋浣滃綋鍓嶅伐鍗� else { - var wosn = Biz.Db.Queryable<BIZ_MES_WO_BATCH, BIZ_MES_WO_SN>((q, s) => new JoinQueryInfos(JoinType.Inner, q.ORDER_NO == s.WORK_ORDER)) - .ByAuth(input.AuthOption).Where((q, s) => s.SN == input.SN).Select((q, s) => new { Batch = q, SN = s }).First(); + var wosns = Biz.Db.Queryable<BIZ_MES_WO_BATCH, BIZ_MES_WO_SN>((q, s) => new JoinQueryInfos(JoinType.Inner, q.ORDER_NO == s.WORK_ORDER)) + .ByAuth(input.AuthOption).Where((q, s) => s.SN == input.SN || s.TRAY_SN == input.SN).Select((q, s) => new { Batch = q, SN = s }).ToList(); //鏌ユ壘鍒版潯鐮佸凡缁戝畾鐨勫伐鍗� - if (!wosn.IsNullOrEmpty()) + if (!wosns.IsNullOrEmpty()) { - if (wosn.Batch.ACT_LINE != CurLine.LINE_CODE) + if (wosns.First().Batch.ACT_LINE != CurLine.LINE_CODE) { action.IsSuccessed = false; //action.LocaleMsg = new($"鏉$爜[{0}]宸插湪浜х嚎[{1}]鎶曞叆鐢熶骇锛岃鍦ㄦ纭矖浣嶆壂鎻�"); - action.LocaleMsg = new("MES.Transaction.PackingNode.Submit.NotCorrectLine", input.SN, wosn.Batch.ACT_LINE); + action.LocaleMsg = new("MES.Transaction.PackingNode.Submit.NotCorrectLine", input.SN, wosns.First().Batch.ACT_LINE); return action; } else { - if (CurBatch?.Batch?.ORDER_NO != wosn.Batch.ORDER_NO) + if (CurBatch?.Batch?.ORDER_NO != wosns.First().Batch.ORDER_NO) { //鏉$爜宸茬粦瀹氱殑宸ュ崟涓嶇瓑浜庡綋鍓嶅伐鍗曞垯閲嶆柊閫夋嫨宸ュ崟 - var result = await SelectOrder(new() { AuthOption = input.AuthOption, OrderNo = wosn.Batch.ORDER_NO }); + var result = await SelectOrder(new() { AuthOption = input.AuthOption, OrderNo = wosns.First().Batch.ORDER_NO }); if (!result.IsSuccessed) { action.IsSuccessed = result.IsSuccessed; @@ -176,21 +176,26 @@ return woStatus; } //闈炴硶杩囩珯闃插憜锛氳繘鍏ュ伐搴忔椂瑕佸鍔犲垽鏂潯鐮佹槸鍚︽寜娴佺▼杩囩珯 - var wipSN = Biz.Db.Queryable<MES_WIP_DATA>().IncludesAllFirstLayer().First(q => q.SN == input.SN && q.WORK_ORDER == CurBatch.WO.ORDER_NO) ?? new MES_WIP_DATA() + var wipSNs = Biz.Db.Queryable<MES_WIP_DATA>().IncludesAllFirstLayer().Where(q => (q.SN == input.SN || q.TRAY_SN == input.SN) && q.WORK_ORDER == CurBatch.WO.ORDER_NO).ToList(); + if (wipSNs.IsNullOrEmpty()) { - SN = input.SN, - STATUS = MES_WIP_DATA.STATUSs.Init.GetValue(), - ITEM_CODE = CurBatch.WO.ITEM_CODE, - WORK_ORDER = CurBatch.Batch.ORDER_NO, - BATCH_NO = CurBatch.Batch.BATCH_NO, - HOLD_FLAG = "N", - REWORK_FLAG = CurBatch.WO.ORDER_TYPE == BIZ_MES_WO.ORDER_TYPEs.Rework.GetValue() ? "Y" : "N", - FINISHED_FLAG = "N", - INV_FLAG = "N", - DFT_FLAG = "N", - DFT_COUNT = 0, - }; - var canGotoNext = CurBatch.CanGotoNext(input, wipSN, curNode); + var wipSN = new MES_WIP_DATA() + { + SN = input.SN, + STATUS = MES_WIP_DATA.STATUSs.Init.GetValue(), + ITEM_CODE = CurBatch.WO.ITEM_CODE, + WORK_ORDER = CurBatch.Batch.ORDER_NO, + BATCH_NO = CurBatch.Batch.BATCH_NO, + HOLD_FLAG = "N", + REWORK_FLAG = CurBatch.WO.ORDER_TYPE == BIZ_MES_WO.ORDER_TYPEs.Rework.GetValue() ? "Y" : "N", + FINISHED_FLAG = "N", + INV_FLAG = "N", + DFT_FLAG = "N", + DFT_COUNT = 0, + }; + wipSNs.Add(wipSN); + } + var canGotoNext = CurBatch.CanGotoNext(input, wipSNs.First(), curNode); if (!canGotoNext.IsSuccessed) { return canGotoNext; @@ -200,67 +205,88 @@ if (Steps.IsNullOrEmpty()) { //缁戝畾鏉$爜鍒板伐鍗� - if (!CurBatch.WoSNs.Any(q => q.SN == input.SN)) + foreach (var wipSN in wipSNs) { - CurBatch.WoSNs.Add(new() + if (!CurBatch.WoSNs.Any(q => q.SN == wipSN.SN)) { - WORK_ORDER = CurBatch.Batch.ORDER_NO, - SN = input.SN, - STATUS = BIZ_MES_WO_SN.STATUSs.NotInput.GetValue(), - }); + CurBatch.WoSNs.Add(new() + { + WORK_ORDER = CurBatch.Batch.ORDER_NO, + SN = wipSN.SN, + TRAY_SN = wipSN.TRAY_SN, + STATUS = BIZ_MES_WO_SN.STATUSs.NotInput.GetValue(), + }); + } } - var woSN = CurBatch.WoSNs.First(q => q.SN == input.SN); - woSN.AUTH_ORG = CurBatch.WO.AUTH_ORG; - woSN.AUTH_PROD = CurLine.LINE_CODE; - woSN.BATCH_NO = CurBatch.Batch.BATCH_NO; + + //鏇存柊宸ュ崟鏉$爜鏄庣粏淇℃伅 + var woSNs = CurBatch.WoSNs.Where(q => wipSNs.Any(w => q.SN == w.SN)).ToList(); + foreach (var woSN in woSNs) + { + woSN.AUTH_ORG = CurBatch.WO.AUTH_ORG; + woSN.AUTH_PROD = CurLine.LINE_CODE; + woSN.BATCH_NO = CurBatch.Batch.BATCH_NO; + } //鏉$爜杩囩珯 - wipSN.AUTH_ORG = CurBatch.WO.AUTH_ORG; - wipSN.AUTH_PROD = CurLine.LINE_CODE; - wipSN.STATUS = MES_WIP_DATA.STATUSs.OK.GetValue();//wipSN.STATUS > 0 ? MES_WIP_DATA.STATUSs.OK.GetValue() : wipSN.STATUS; - wipSN.ROT_CODE = CurBatch.WO.ROUTE_CODE; - wipSN.NODE_ID = curNode.ID; - wipSN.NODE_NAME = curNode.NODE_NAME; - wipSN.FTY_CODE = CurFactory.FTY_CODE; - wipSN.WS_CODE = CurWorkshop.WS_CODE; - wipSN.LINE_CODE = CurLine.LINE_CODE; - wipSN.POST_CODE = CurPosition.POST_CODE; - wipSN.OPER_CODE = curNode.OPER_CODE; - wipSN.SEGMENT = curNode.SEGMENT; - wipSN.OPERATION_TIME = DateTime.Now; - var curShiftPeriod = GetShiftPeriodForNow(); - if (!curShiftPeriod.IsNullOrEmpty()) + foreach (var wipSN in wipSNs) { - wipSN.SFTS_CODE = curShiftPeriod.ShiftSys.SFTS_CODE; - wipSN.SFT_CODE = curShiftPeriod.Shift.SFT_CODE; - wipSN.PRD_CODE = curShiftPeriod.Period.PRD_CODE; + wipSN.AUTH_ORG = CurBatch.WO.AUTH_ORG; + wipSN.AUTH_PROD = CurLine.LINE_CODE; + wipSN.STATUS = MES_WIP_DATA.STATUSs.OK.GetValue();//wipSN.STATUS > 0 ? MES_WIP_DATA.STATUSs.OK.GetValue() : wipSN.STATUS; + wipSN.ROT_CODE = CurBatch.WO.ROUTE_CODE; + wipSN.NODE_ID = curNode.ID; + wipSN.NODE_NAME = curNode.NODE_NAME; + wipSN.FTY_CODE = CurFactory.FTY_CODE; + wipSN.WS_CODE = CurWorkshop.WS_CODE; + wipSN.LINE_CODE = CurLine.LINE_CODE; + wipSN.POST_CODE = CurPosition.POST_CODE; + wipSN.OPER_CODE = curNode.OPER_CODE; + wipSN.SEGMENT = curNode.SEGMENT; + wipSN.OPERATION_TIME = DateTime.Now; + var curShiftPeriod = GetShiftPeriodForNow(); + if (!curShiftPeriod.IsNullOrEmpty()) + { + wipSN.SFTS_CODE = curShiftPeriod.ShiftSys.SFTS_CODE; + wipSN.SFT_CODE = curShiftPeriod.Shift.SFT_CODE; + wipSN.PRD_CODE = curShiftPeriod.Period.PRD_CODE; + } + //濡傛灉鏄姇鍏ョ珯 + if (curNode.IS_INPUT == "Y") + { + var woSN = woSNs.First(q => q.SN == wipSN.SN); + woSN.STATUS = BIZ_MES_WO_SN.STATUSs.Inputed.GetValue(); + wipSN.STATUS = MES_WIP_DATA.STATUSs.Input.GetValue(); + wipSN.INLINE_DATE = DateTime.Now; + } + //濡傛灉鏄骇鍑虹珯 + if (curNode.IS_OUTPUT == "Y") + { + var woSN = woSNs.First(q => q.SN == wipSN.SN); + woSN.STATUS = BIZ_MES_WO_SN.STATUSs.Finished.GetValue(); + wipSN.STATUS = MES_WIP_DATA.STATUSs.Finished.GetValue(); + wipSN.OUTLINE_DATE = DateTime.Now; + } + //濡傛灉鏈夋彁浜や笉鑹� + if (!input.DFT_CODE.IsNullOrEmpty()) + { + wipSN.STATUS = MES_WIP_DATA.STATUSs.NG.GetValue(); + wipSN.DFT_FLAG = "Y"; + wipSN.DFT_COUNT++; + wipSN.DFT_CODE = input.DFT_CODE; + } } + + //宸ュ崟寮�宸� CurBatch.StartWorking(UserCode); - //濡傛灉鏄姇鍏ョ珯 - if (curNode.IS_INPUT == "Y") + //鎶婂綋鍓嶆潯鐮佸鍔犲埌褰撳墠鏉$爜鍒楄〃 + CurWipSNs = wipSNs; + CurWipSNHiss.Clear(); + foreach (var wipSN in wipSNs) { - woSN.STATUS = BIZ_MES_WO_SN.STATUSs.Inputed.GetValue(); - wipSN.STATUS = MES_WIP_DATA.STATUSs.Input.GetValue(); - wipSN.INLINE_DATE = DateTime.Now; + CurWipSNHiss.Add(new MES_WIP_HIS(wipSN, $"宸ュ崟[{wipSN.WORK_ORDER}]鏉$爜[{wipSN.SN}]鍦ㄥ矖浣峓{wipSN.POST_CODE}]杩囩珯宸ュ簭[{wipSN.NODE_NAME}]鎴愬姛")); } - //濡傛灉鏄骇鍑虹珯 - if (curNode.IS_OUTPUT == "Y") - { - woSN.STATUS = BIZ_MES_WO_SN.STATUSs.Finished.GetValue(); - wipSN.STATUS = MES_WIP_DATA.STATUSs.Finished.GetValue(); - wipSN.OUTLINE_DATE = DateTime.Now; - } - //濡傛灉鏈夋彁浜や笉鑹� - if (!input.DFT_CODE.IsNullOrEmpty()) - { - wipSN.STATUS = MES_WIP_DATA.STATUSs.NG.GetValue(); - wipSN.DFT_FLAG = "Y"; - wipSN.DFT_COUNT++; - wipSN.DFT_CODE = input.DFT_CODE; - } - - CurWipSNHis = new MES_WIP_HIS(CurWipSN = wipSN, $"宸ュ崟[{wipSN.WORK_ORDER}]鏉$爜[{wipSN.SN}]鍦ㄥ矖浣峓{wipSN.POST_CODE}]杩囩珯宸ュ簭[{wipSN.NODE_NAME}]鎴愬姛"); //鍒濆鍖栧伐姝ュ垪琛� Steps.Clear(); @@ -271,20 +297,20 @@ DBSubmitAction = () => { var db = GetCommitDB(); - db.Storageable(woSN, UserCode).ExecuteCommand(); - db.Storageable(wipSN, UserCode).ExecuteCommand(); - db.Storageable(CurWipSNHis, UserCode).ExecuteCommand(); + db.Storageable(woSNs, UserCode).ExecuteCommand(); + db.Storageable(wipSNs, UserCode).ExecuteCommand(); + db.Storageable(CurWipSNHiss, UserCode).ExecuteCommand(); //濡傛灉鏄姇鍏ョ珯 if (curNode.IS_INPUT == "Y") { - db.Updateable<BIZ_MES_WO>().SetColumns(q => q.INPUT_QTY == q.INPUT_QTY + 1).Where(q => q.ORDER_NO == CurBatch.WO.ORDER_NO).ExecuteCommand(); - db.Updateable<BIZ_MES_WO_BATCH>().SetColumns(q => q.INPUT_QTY == q.INPUT_QTY + 1).Where(q => q.BATCH_NO == CurBatch.Batch.BATCH_NO).ExecuteCommand(); + 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(); } //濡傛灉鏄骇鍑虹珯 if (curNode.IS_OUTPUT == "Y") { - db.Updateable<BIZ_MES_WO>().SetColumns(q => q.OUTPUT_QTY == q.OUTPUT_QTY + 1).Where(q => q.ORDER_NO == CurBatch.WO.ORDER_NO).ExecuteCommand(); - db.Updateable<BIZ_MES_WO_BATCH>().SetColumns(q => q.OUTPUT_QTY == q.OUTPUT_QTY + 1).Where(q => q.BATCH_NO == CurBatch.Batch.BATCH_NO).ExecuteCommand(); + 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(); } } }; @@ -376,8 +402,8 @@ SaveStepsCommitActionToDB(); //淇濆瓨鎴愬姛锛岃繑鍥炶繃绔欐秷鎭� - //action.LocaleMsg = new($"宸ュ崟[{CurWipSN.WORK_ORDER}]鐨勬潯鐮乕{CurWipSN.SN}]鍦ㄥ矖浣峓{CurWipSN.POST_CODE}]宸ュ簭[{CurWipSN.NODE_NAME}]杩囩珯鎴愬姛锛岀姸鎬乕{CurWipSN.STATUS.GetEnumDesc<MES_WIP_DATA.STATUSs>()}]", CurWipSN.WORK_ORDER, CurWipSN.SN, CurWipSN.POST_CODE, CurWipSN.NODE_NAME, CurWipSN.STATUS.GetEnumDesc<MES_WIP_DATA.STATUSs>()); - action.LocaleMsg = new("MES.Transaction.TestNode.ScanSn.PassSuccess", CurWipSN.WORK_ORDER, CurWipSN.SN, CurWipSN.POST_CODE, CurWipSN.NODE_NAME, CurWipSN.STATUS.GetEnumDesc<MES_WIP_DATA.STATUSs>()); + //action.LocaleMsg = new($"宸ュ崟[{CurWipSN.WORK_ORDER}]鐨勬潯鐮乕{CurWipSN.SN}]鍦ㄥ矖浣峓{CurWipSN.POST_CODE}]宸ュ簭[{CurWipSN.NODE_NAME}]杩囩珯鎴愬姛锛岀姸鎬乕{CurWipSN.STATUS.GetEnumDesc<MES_WIP_DATA.STATUSs>()}]"); + action.LocaleMsg = new("MES.Transaction.CollectNode.ScanSn.PassSuccess", CurWipSNs.First().WORK_ORDER, CurSN, CurWipSNs.First().POST_CODE, CurWipSNs.First().NODE_NAME, CurWipSNs.First().STATUS.GetEnumDesc<MES_WIP_DATA.STATUSs>()); //閲嶇疆宸ュ簭 ResetNode(); return action; diff --git a/Tiger.Business.MES/WorkAction/Assembly.cs b/Tiger.Business.MES/WorkAction/Assembly.cs index a32e6e2..1a7a4fa 100644 --- a/Tiger.Business.MES/WorkAction/Assembly.cs +++ b/Tiger.Business.MES/WorkAction/Assembly.cs @@ -69,6 +69,7 @@ ItemInfo = info, RuleCode = assy.RULE_CODE, LoadQty = assy.QTY, + IsBatchItem = assy.IsBatchItem, }; var bom = Boms.FirstOrDefault(q => q.ITEM_CODE == assy.ITEM_CODE); if (!bom.IsNullOrEmpty()) @@ -104,7 +105,7 @@ { var action = new ApiAction<SubmitOutput>(new SubmitOutput()); - if (input.SN != CurPosition.CurWipSN.SN) + if (!CurPosition.CurWipSNs.Any(w => w.SN == input.SN)) { action = SaveAssembly(input, action); return action; @@ -170,31 +171,65 @@ //楠岃瘉閫氳繃鍒欎繚瀛樹笂鏂欎俊鎭� if (isOK) { - var record = new MES_WIP_ASSY() + //鎵规鐗╂枡鍒欏彧璁板綍涓�娆★紝闈炴壒娆$墿鏂欏垯瑕佹寜涓暟楠岃瘉鏁伴噺 + if (item.IsBatchItem) { - AUTH_ORG = CurPosition.WorkBatch.WO.AUTH_ORG, - AUTH_PROD = CurPosition.CurLine.LINE_CODE, - SN = input.SN, - PROD_SN = CurPosition.CurWipSN.SN, - ITEM_CODE = item.ItemInfo.ITEM_CODE, - QTY = 1, - UNIT = item.ItemInfo.UNIT, - WORK_ORDER = CurPosition.CurWipSN.WORK_ORDER, - BATCH_NO = CurPosition.CurWipSN.BATCH_NO, - ROT_CODE = CurPosition.CurWipSN.ROT_CODE, - NODE_ID = CurPosition.CurWipSN.NODE_ID, - NODE_NAME = CurPosition.CurWipSN.NODE_NAME, - FTY_CODE = CurPosition.CurWipSN.FTY_CODE, - WS_CODE = CurPosition.CurWipSN.WS_CODE, - LINE_CODE = CurPosition.CurWipSN.LINE_CODE, - POST_CODE = CurPosition.CurWipSN.POST_CODE, - OPER_CODE = CurPosition.CurWipSN.OPER_CODE, - SEGMENT = CurPosition.CurWipSN.SEGMENT, - }; - item.Records.Add(record); - if (item.Records.Sum(q => q.QTY) >= item.LoadQty) + foreach (var wipSn in CurPosition.CurWipSNs) + { + var record = new MES_WIP_ASSY() + { + AUTH_ORG = CurPosition.WorkBatch.WO.AUTH_ORG, + AUTH_PROD = CurPosition.CurLine.LINE_CODE, + SN = input.SN, + PROD_SN = wipSn.SN, + ITEM_CODE = item.ItemInfo.ITEM_CODE, + QTY = 1, + UNIT = item.ItemInfo.UNIT, + 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, + }; + item.Records.Add(record); + } + item.IsFinished = true; + } + else { - item.IsFinished = true; + var record = new MES_WIP_ASSY() + { + AUTH_ORG = CurPosition.WorkBatch.WO.AUTH_ORG, + AUTH_PROD = CurPosition.CurLine.LINE_CODE, + SN = input.SN, + PROD_SN = CurPosition.CurSN, + ITEM_CODE = item.ItemInfo.ITEM_CODE, + QTY = 1, + UNIT = item.ItemInfo.UNIT, + WORK_ORDER = CurPosition.CurWipSNs.First().WORK_ORDER, + BATCH_NO = CurPosition.CurWipSNs.First().BATCH_NO, + ROT_CODE = CurPosition.CurWipSNs.First().ROT_CODE, + NODE_ID = CurPosition.CurWipSNs.First().NODE_ID, + NODE_NAME = CurPosition.CurWipSNs.First().NODE_NAME, + FTY_CODE = CurPosition.CurWipSNs.First().FTY_CODE, + WS_CODE = CurPosition.CurWipSNs.First().WS_CODE, + LINE_CODE = CurPosition.CurWipSNs.First().LINE_CODE, + POST_CODE = CurPosition.CurWipSNs.First().POST_CODE, + OPER_CODE = CurPosition.CurWipSNs.First().OPER_CODE, + SEGMENT = CurPosition.CurWipSNs.First().SEGMENT, + }; + item.Records.Add(record); + + if (item.Records.Sum(q => q.QTY) >= item.LoadQty * CurPosition.CurWipSNs.Count) + { + item.IsFinished = true; + } } action.IsSuccessed = true; @@ -235,38 +270,44 @@ var action = new ApiAction<SubmitOutput>(new SubmitOutput()); //璁板綍琛屼负鎿嶄綔璁板綍 - var wipAct = new MES_WIP_ACT() + var wipActs = new List<MES_WIP_ACT>(); + foreach (var wipSn in CurPosition.CurWipSNs) { - AUTH_ORG = CurPosition.WorkBatch.WO.AUTH_ORG, - AUTH_PROD = CurPosition.CurLine.LINE_CODE, - HIS_ID = CurPosition.CurWipSNHis.ID, - SN = CurPosition.CurWipSN.SN, - STATUS = CurPosition.CurWipSN.STATUS, - ITEM_CODE = CurPosition.CurWipSN.ITEM_CODE, - WORK_ORDER = CurPosition.CurWipSN.WORK_ORDER, - BATCH_NO = CurPosition.CurWipSN.BATCH_NO, - ROT_CODE = CurPosition.CurWipSN.ROT_CODE, - NODE_ID = CurPosition.CurWipSN.NODE_ID, - NODE_NAME = CurPosition.CurWipSN.NODE_NAME, - ACT_ID = NodeAct.ID, - ACT_NAME = NodeAct.ACT_NAME, - FTY_CODE = CurPosition.CurWipSN.FTY_CODE, - WS_CODE = CurPosition.CurWipSN.WS_CODE, - LINE_CODE = CurPosition.CurWipSN.LINE_CODE, - POST_CODE = CurPosition.CurWipSN.POST_CODE, - OPER_CODE = CurPosition.CurWipSN.OPER_CODE, - SEGMENT = CurPosition.CurWipSN.SEGMENT, - TRAY_SN = CurPosition.CurWipSN.TRAY_SN, - OPERATION_TIME = DateTime.Now, - SFTS_CODE = CurPosition.CurWipSN.SFTS_CODE, - SFT_CODE = CurPosition.CurWipSN.SFT_CODE, - PRD_CODE = CurPosition.CurWipSN.PRD_CODE, - ACT_TYPE = NodeAct.ACT_TYPE, - ACT_SN = CurPosition.CurWipSN.SN, - ACT_VALUE_1 = CurAssembly.ToJson(), - ACT_RESULT = "Y", - TRACE_INFO = $"浠ヤ笅鐗╂枡涓婃枡瀹屾垚锛歿string.Join(",", CurAssembly.Items.Select(q => $"{q.ItemInfo.ITEM_NAME}({q.ItemInfo.ITEM_CODE})"))}", - }; + var wipAct = new MES_WIP_ACT() + { + AUTH_ORG = CurPosition.WorkBatch.WO.AUTH_ORG, + AUTH_PROD = CurPosition.CurLine.LINE_CODE, + HIS_ID = CurPosition.CurWipSNHiss.First(q => q.SN == wipSn.SN).ID, + SN = wipSn.SN, + STATUS = wipSn.STATUS, + 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, + ACT_ID = NodeAct.ID, + ACT_NAME = NodeAct.ACT_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, + TRAY_SN = wipSn.TRAY_SN, + OPERATION_TIME = DateTime.Now, + SFTS_CODE = wipSn.SFTS_CODE, + SFT_CODE = wipSn.SFT_CODE, + PRD_CODE = wipSn.PRD_CODE, + ACT_TYPE = NodeAct.ACT_TYPE, + ACT_SN = wipSn.SN, + ACT_VALUE_1 = CurAssembly.ToJson(), + ACT_RESULT = "Y", + TRACE_INFO = $"浠ヤ笅鐗╂枡涓婃枡瀹屾垚锛歿string.Join(",", CurAssembly.Items.Select(q => $"{q.ItemInfo.ITEM_NAME}({q.ItemInfo.ITEM_CODE})"))}", + }; + wipActs.Add(wipAct); + } + //鏁寸悊涓婃枡璁板綍 var records = new List<MES_WIP_ASSY>(); foreach (var item in CurAssembly.Items) { @@ -277,7 +318,7 @@ CurStep.DBSubmitAction = () => { var db = CurPosition.GetCommitDB(); - db.Storageable(wipAct, CurPosition.UserCode).ExecuteCommand(); + db.Storageable(wipActs, CurPosition.UserCode).ExecuteCommand(); db.Insertable(records, CurPosition.UserCode).ExecuteCommand(); }; diff --git a/Tiger.Business.MES/WorkAction/IPQC.cs b/Tiger.Business.MES/WorkAction/IPQC.cs index 3bede32..2468326 100644 --- a/Tiger.Business.MES/WorkAction/IPQC.cs +++ b/Tiger.Business.MES/WorkAction/IPQC.cs @@ -106,48 +106,53 @@ var action = new ApiAction<SubmitOutput>(new SubmitOutput()); //璁板綍琛屼负鎿嶄綔璁板綍 - var wipAct = new MES_WIP_ACT() + var wipActs = new List<MES_WIP_ACT>(); + foreach (var wipSn in CurPosition.CurWipSNs) { - AUTH_ORG = CurPosition.WorkBatch.WO.AUTH_ORG, - AUTH_PROD = CurPosition.CurLine.LINE_CODE, - HIS_ID = CurPosition.CurWipSNHis.ID, - SN = CurPosition.CurWipSN.SN, - STATUS = CurPosition.CurWipSN.STATUS, - ITEM_CODE = CurPosition.CurWipSN.ITEM_CODE, - WORK_ORDER = CurPosition.CurWipSN.WORK_ORDER, - BATCH_NO = CurPosition.CurWipSN.BATCH_NO, - ROT_CODE = CurPosition.CurWipSN.ROT_CODE, - NODE_ID = CurPosition.CurWipSN.NODE_ID, - NODE_NAME = CurPosition.CurWipSN.NODE_NAME, - ACT_ID = NodeAct.ID, - ACT_NAME = NodeAct.ACT_NAME, - FTY_CODE = CurPosition.CurWipSN.FTY_CODE, - WS_CODE = CurPosition.CurWipSN.WS_CODE, - LINE_CODE = CurPosition.CurWipSN.LINE_CODE, - POST_CODE = CurPosition.CurWipSN.POST_CODE, - OPER_CODE = CurPosition.CurWipSN.OPER_CODE, - SEGMENT = CurPosition.CurWipSN.SEGMENT, - TRAY_SN = CurPosition.CurWipSN.TRAY_SN, - OPERATION_TIME = DateTime.Now, - SFTS_CODE = CurPosition.CurWipSN.SFTS_CODE, - SFT_CODE = CurPosition.CurWipSN.SFT_CODE, - PRD_CODE = CurPosition.CurWipSN.PRD_CODE, - ACT_TYPE = NodeAct.ACT_TYPE, - ACT_SN = CurPosition.CurWipSN.SN, - ACT_VALUE_1 = "", - ACT_VALUE_2 = "", - ACT_VALUE_3 = "", - ACT_VALUE_4 = "", - ACT_VALUE_5 = "", - ACT_RESULT = "Y", - TRACE_INFO = $"鎵ц鎴愬姛", - }; + var wipAct = new MES_WIP_ACT() + { + AUTH_ORG = CurPosition.WorkBatch.WO.AUTH_ORG, + AUTH_PROD = CurPosition.CurLine.LINE_CODE, + HIS_ID = CurPosition.CurWipSNHiss.First(q => q.SN == wipSn.SN).ID, + SN = wipSn.SN, + STATUS = wipSn.STATUS, + 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, + ACT_ID = NodeAct.ID, + ACT_NAME = NodeAct.ACT_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, + TRAY_SN = wipSn.TRAY_SN, + OPERATION_TIME = DateTime.Now, + SFTS_CODE = wipSn.SFTS_CODE, + SFT_CODE = wipSn.SFT_CODE, + PRD_CODE = wipSn.PRD_CODE, + ACT_TYPE = NodeAct.ACT_TYPE, + ACT_SN = wipSn.SN, + ACT_VALUE_1 = "", + ACT_VALUE_2 = "", + ACT_VALUE_3 = "", + ACT_VALUE_4 = "", + ACT_VALUE_5 = "", + ACT_RESULT = "Y", + TRACE_INFO = $"鎵ц鎴愬姛", + }; + wipActs.Add(wipAct); + } //淇濆瓨鏁版嵁 CurStep.DBSubmitAction = () => { var db = CurPosition.GetCommitDB(); - db.Storageable(wipAct, CurPosition.UserCode).ExecuteCommand(); + db.Storageable(wipActs, CurPosition.UserCode).ExecuteCommand(); }; IsFinished = true; diff --git a/Tiger.Business.MES/WorkAction/PackingAction.cs b/Tiger.Business.MES/WorkAction/PackingAction.cs index 51a1f90..58008e4 100644 --- a/Tiger.Business.MES/WorkAction/PackingAction.cs +++ b/Tiger.Business.MES/WorkAction/PackingAction.cs @@ -123,7 +123,7 @@ //琛屼负璁惧畾鐨凮PTION_1鏄涓�灞傚寘瑁呯殑鏍囩妯℃澘浠g爜锛屽鏋滀负绌哄垯涓嶉渶瑕佹墦鍗� if (LabelDic[min.PKG_LEVEL].IsNullOrEmpty()) { - var msg = new Locale("MES.WorkAction.PackingAction.BeginMsg", min.PKG_LEVEL, min.PkgType.PKG_NAME, CurPosition.CurWipSN.SN); + var msg = new Locale("MES.WorkAction.PackingAction.BeginMsg", min.PKG_LEVEL, min.PkgType.PKG_NAME, CurPosition.CurSN); //var msg = new Locale($"宸叉壂鎻忕{dtl.PKG_LEVEL}灞傚寘瑁匸{dtl.PkgType.PKG_NAME}]鐨勬爣绛炬潯鐮乕{CurPosition.CurWipSN.SN}]"); return msg; } @@ -145,7 +145,7 @@ action.LocaleMsg = GetBeginMsg(); var min = PkgRule.Details.OrderBy(q => q.PKG_LEVEL).First(); - //琛屼负璁惧畾鐨凮PTION_1-9鏄寘瑁呬笉鍚屽眰绾х殑鏍囩妯℃澘浠g爜锛屽鏋滀负绌哄垯涓嶉渶瑕佹墦鍗� + //鏍规嵁鍖呰涓嶅悓灞傜骇鐨勬爣绛炬ā鏉夸唬鐮侊紝濡傛灉涓虹┖鍒欎笉闇�瑕佹墦鍗� if (LabelDic[min.PKG_LEVEL].IsNullOrEmpty()) { input.Data = new PackingActionInput() @@ -153,7 +153,7 @@ ExecCode = "Scan", IsFinish = true, PkgLevel = min.PKG_LEVEL, - PkgSN = CurPosition.CurWipSN.SN, + PkgSN = CurPosition.CurSN, }.ToJson(); action = Submit(input); } @@ -344,20 +344,20 @@ AUTH_PROD = CurPosition.CurLine.LINE_CODE, SN = pInput.PkgSN, PKG_TYPE = dtl.PkgType.PKG_NAME, - ITEM_CODE = CurPosition.CurWipSN.ITEM_CODE, - QTY = CurPosition.CurWipSN.QTY, + ITEM_CODE = CurPosition.CurWipSNs.First().ITEM_CODE, + QTY = CurPosition.CurWipSNs.First().QTY, UNIT = dtl.PkgType.PKG_NAME, - WORK_ORDER = CurPosition.CurWipSN.WORK_ORDER, - BATCH_NO = CurPosition.CurWipSN.BATCH_NO, - ROT_CODE = CurPosition.CurWipSN.ROT_CODE, - NODE_ID = CurPosition.CurWipSN.NODE_ID, - NODE_NAME = CurPosition.CurWipSN.NODE_NAME, - FTY_CODE = CurPosition.CurWipSN.FTY_CODE, - WS_CODE = CurPosition.CurWipSN.WS_CODE, - LINE_CODE = CurPosition.CurWipSN.LINE_CODE, - POST_CODE = CurPosition.CurWipSN.POST_CODE, - OPER_CODE = CurPosition.CurWipSN.OPER_CODE, - SEGMENT = CurPosition.CurWipSN.SEGMENT, + WORK_ORDER = CurPosition.CurWipSNs.First().WORK_ORDER, + BATCH_NO = CurPosition.CurWipSNs.First().BATCH_NO, + ROT_CODE = CurPosition.CurWipSNs.First().ROT_CODE, + NODE_ID = CurPosition.CurWipSNs.First().NODE_ID, + NODE_NAME = CurPosition.CurWipSNs.First().NODE_NAME, + FTY_CODE = CurPosition.CurWipSNs.First().FTY_CODE, + WS_CODE = CurPosition.CurWipSNs.First().WS_CODE, + LINE_CODE = CurPosition.CurWipSNs.First().LINE_CODE, + POST_CODE = CurPosition.CurWipSNs.First().POST_CODE, + OPER_CODE = CurPosition.CurWipSNs.First().OPER_CODE, + SEGMENT = CurPosition.CurWipSNs.First().SEGMENT, } }; FinishLevel++; @@ -376,20 +376,20 @@ AUTH_PROD = CurPosition.CurLine.LINE_CODE, SN = pInput.PkgSN, PKG_TYPE = dtl.PkgType.PKG_NAME, - ITEM_CODE = CurPosition.CurWipSN.ITEM_CODE, + ITEM_CODE = CurPosition.CurWipSNs.First().ITEM_CODE, QTY = CurPkgItem.Items.Sum(q => q.Package.QTY), UNIT = dtl.PkgType.PKG_NAME, - WORK_ORDER = CurPosition.CurWipSN.WORK_ORDER, - BATCH_NO = CurPosition.CurWipSN.BATCH_NO, - ROT_CODE = CurPosition.CurWipSN.ROT_CODE, - NODE_ID = CurPosition.CurWipSN.NODE_ID, - NODE_NAME = CurPosition.CurWipSN.NODE_NAME, - FTY_CODE = CurPosition.CurWipSN.FTY_CODE, - WS_CODE = CurPosition.CurWipSN.WS_CODE, - LINE_CODE = CurPosition.CurWipSN.LINE_CODE, - POST_CODE = CurPosition.CurWipSN.POST_CODE, - OPER_CODE = CurPosition.CurWipSN.OPER_CODE, - SEGMENT = CurPosition.CurWipSN.SEGMENT, + WORK_ORDER = CurPosition.CurWipSNs.First().WORK_ORDER, + BATCH_NO = CurPosition.CurWipSNs.First().BATCH_NO, + ROT_CODE = CurPosition.CurWipSNs.First().ROT_CODE, + NODE_ID = CurPosition.CurWipSNs.First().NODE_ID, + NODE_NAME = CurPosition.CurWipSNs.First().NODE_NAME, + FTY_CODE = CurPosition.CurWipSNs.First().FTY_CODE, + WS_CODE = CurPosition.CurWipSNs.First().WS_CODE, + LINE_CODE = CurPosition.CurWipSNs.First().LINE_CODE, + POST_CODE = CurPosition.CurWipSNs.First().POST_CODE, + OPER_CODE = CurPosition.CurWipSNs.First().OPER_CODE, + SEGMENT = CurPosition.CurWipSNs.First().SEGMENT, }; FinishLevel++; //瀹屾垚鍖呰鐨勫眰绾у皬浜庢渶澶栧眰鍖呰灞傜骇 @@ -522,9 +522,6 @@ throw dbTran.ErrorException; } - //鍒犻櫎宸ュ簭涓婁笅鏂囦腑鐨勫寘瑁呰褰� - CurPosition.Context.Remove("CurPackage"); - var data = new PackingActionOutput() { PkgInfo = CurPkg }; data.ExecCode = "Complete"; data.PkgLevel = CurPkg.Item.PKG_LEVEL; @@ -551,58 +548,75 @@ var action = new ApiAction<SubmitOutput>(new SubmitOutput()); //璁板綍琛屼负鎿嶄綔璁板綍 - var wipAct = new MES_WIP_ACT() + var wipActs = new List<MES_WIP_ACT>(); + foreach (var wipSn in CurPosition.CurWipSNs) { - AUTH_ORG = CurPosition.WorkBatch.WO.AUTH_ORG, - AUTH_PROD = CurPosition.CurLine.LINE_CODE, - HIS_ID = CurPosition.CurWipSNHis.ID, - SN = CurPosition.CurWipSN.SN, - STATUS = CurPosition.CurWipSN.STATUS, - ITEM_CODE = CurPosition.CurWipSN.ITEM_CODE, - WORK_ORDER = CurPosition.CurWipSN.WORK_ORDER, - BATCH_NO = CurPosition.CurWipSN.BATCH_NO, - ROT_CODE = CurPosition.CurWipSN.ROT_CODE, - NODE_ID = CurPosition.CurWipSN.NODE_ID, - NODE_NAME = CurPosition.CurWipSN.NODE_NAME, - ACT_ID = NodeAct.ID, - ACT_NAME = NodeAct.ACT_NAME, - FTY_CODE = CurPosition.CurWipSN.FTY_CODE, - WS_CODE = CurPosition.CurWipSN.WS_CODE, - LINE_CODE = CurPosition.CurWipSN.LINE_CODE, - POST_CODE = CurPosition.CurWipSN.POST_CODE, - OPER_CODE = CurPosition.CurWipSN.OPER_CODE, - SEGMENT = CurPosition.CurWipSN.SEGMENT, - TRAY_SN = CurPosition.CurWipSN.TRAY_SN, - OPERATION_TIME = DateTime.Now, - SFTS_CODE = CurPosition.CurWipSN.SFTS_CODE, - SFT_CODE = CurPosition.CurWipSN.SFT_CODE, - PRD_CODE = CurPosition.CurWipSN.PRD_CODE, - ACT_TYPE = NodeAct.ACT_TYPE, - ACT_SN = CurPosition.CurWipSN.SN, - ACT_RESULT = "Y", - TRACE_INFO = $"浜у搧鏉$爜[{CurPosition.CurWipSN.SN}]鍖呰瀹屾垚", - }; + var wipAct = new MES_WIP_ACT() + { + AUTH_ORG = CurPosition.WorkBatch.WO.AUTH_ORG, + AUTH_PROD = CurPosition.CurLine.LINE_CODE, + HIS_ID = CurPosition.CurWipSNHiss.First(q => q.SN == wipSn.SN).ID, + SN = wipSn.SN, + STATUS = wipSn.STATUS, + 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, + ACT_ID = NodeAct.ID, + ACT_NAME = NodeAct.ACT_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, + TRAY_SN = wipSn.TRAY_SN, + OPERATION_TIME = DateTime.Now, + SFTS_CODE = wipSn.SFTS_CODE, + SFT_CODE = wipSn.SFT_CODE, + PRD_CODE = wipSn.PRD_CODE, + ACT_TYPE = NodeAct.ACT_TYPE, + ACT_SN = wipSn.SN, + ACT_RESULT = "Y", + TRACE_INFO = $"浜у搧鏉$爜[{string.Join("锛�", CurPosition.CurSN)}]鍖呰瀹屾垚", + }; + wipActs.Add(wipAct); + } //淇濆瓨鏁版嵁 CurStep.DBSubmitAction = () => { var db = CurPosition.GetCommitDB(); - db.Storageable(wipAct, CurPosition.UserCode).ExecuteCommand(); + db.Storageable(wipActs, CurPosition.UserCode).ExecuteCommand(); }; - //濡傛灉宸ュ簭涓婁笅鏂囦腑娌℃湁鍖呰璁板綍鍒欐柊寤轰竴涓� - if (CurPosition.Context.ContainsKey("CurPackage")) + if (CurPkg.IsFinished) { - CurPosition.Context["CurPackage"] = CurPkg; + //鏈�澶栧眰鍖呰宸茬粡瀹屾垚鍖呰锛屽垯鎶婂伐搴忎腑鏆傚瓨鏍囪璁句负false锛岀粺涓�鎻愪氦鍖呰鍐呬骇鍝佺殑杩囩珯璁板綍 + CurPosition.NeedTemporaryStoreDBCommitAction = false; + //鍒犻櫎宸ュ簭涓婁笅鏂囦腑鐨勫寘瑁呰褰� + CurPosition.Context.Remove("CurPackage"); } else { - CurPosition.Context.Add("CurPackage", CurPkg); + //鏈�澶栧眰鍖呰鏈畬鎴愬寘瑁咃紝鍒欐妸宸ュ簭涓殏瀛樻爣璁拌涓簍rue锛屽緟鍏ㄩ儴鍖呰瀹屾垚鍐嶇粺涓�鎻愪氦鍖呰鍐呬骇鍝佺殑杩囩珯璁板綍 + CurPosition.NeedTemporaryStoreDBCommitAction = true; + //濡傛灉宸ュ簭涓婁笅鏂囦腑娌℃湁鍖呰璁板綍鍒欐柊寤轰竴涓� + if (CurPosition.Context.ContainsKey("CurPackage")) + { + CurPosition.Context["CurPackage"] = CurPkg; + } + else + { + CurPosition.Context.Add("CurPackage", CurPkg); + } } IsFinished = true; - action.LocaleMsg = new($"浜у搧鏉$爜[{CurPosition.CurWipSN.SN}]鍖呰瀹屾垚"); - action.LocaleMsg = new("MES.WorkAction.PackingAction.PackingSuccess", CurPosition.CurWipSN.SN); + action.LocaleMsg = new($"浜у搧鏉$爜[{CurPosition.CurSN}]鍖呰瀹屾垚"); + action.LocaleMsg = new("MES.WorkAction.PackingAction.PackingSuccess", CurPosition.CurSN); return action; } diff --git a/Tiger.Business.MES/WorkAction/PrintLabel.cs b/Tiger.Business.MES/WorkAction/PrintLabel.cs index 8f33876..ff6a384 100644 --- a/Tiger.Business.MES/WorkAction/PrintLabel.cs +++ b/Tiger.Business.MES/WorkAction/PrintLabel.cs @@ -50,7 +50,7 @@ /// <returns></returns> public Locale GetBeginMsg() { - var msg = new Locale("MES.WorkAction.PrintLabel.BeginMsg", CurPosition.CurWipSN.SN, Label.LABEL_CODE, Label.LABEL_NAME); + var msg = new Locale("MES.WorkAction.PrintLabel.BeginMsg", CurPosition.CurSN, Label.LABEL_CODE, Label.LABEL_NAME); //var msg = new Locale($"寮�濮嬫墦鍗版潯鐮乕{CurPosition.CurWipSN.SN}]鐨勬爣绛綶{Label.LABEL_CODE}: {Label.LABEL_NAME}]"); return msg; } @@ -107,45 +107,51 @@ var action = new ApiAction<SubmitOutput>(new SubmitOutput()); //璁板綍琛屼负鎿嶄綔璁板綍 - var wipAct = new MES_WIP_ACT() + var wipActs = new List<MES_WIP_ACT>(); + foreach (var wipSn in CurPosition.CurWipSNs) { - AUTH_ORG = CurPosition.WorkBatch.WO.AUTH_ORG, - AUTH_PROD = CurPosition.CurLine.LINE_CODE, - HIS_ID = CurPosition.CurWipSNHis.ID, - SN = CurPosition.CurWipSN.SN, - STATUS = CurPosition.CurWipSN.STATUS, - ITEM_CODE = CurPosition.CurWipSN.ITEM_CODE, - WORK_ORDER = CurPosition.CurWipSN.WORK_ORDER, - BATCH_NO = CurPosition.CurWipSN.BATCH_NO, - ROT_CODE = CurPosition.CurWipSN.ROT_CODE, - NODE_ID = CurPosition.CurWipSN.NODE_ID, - NODE_NAME = CurPosition.CurWipSN.NODE_NAME, - ACT_ID = NodeAct.ID, - ACT_NAME = NodeAct.ACT_NAME, - FTY_CODE = CurPosition.CurWipSN.FTY_CODE, - WS_CODE = CurPosition.CurWipSN.WS_CODE, - LINE_CODE = CurPosition.CurWipSN.LINE_CODE, - POST_CODE = CurPosition.CurWipSN.POST_CODE, - OPER_CODE = CurPosition.CurWipSN.OPER_CODE, - SEGMENT = CurPosition.CurWipSN.SEGMENT, - TRAY_SN = CurPosition.CurWipSN.TRAY_SN, - OPERATION_TIME = DateTime.Now, - SFTS_CODE = CurPosition.CurWipSN.SFTS_CODE, - SFT_CODE = CurPosition.CurWipSN.SFT_CODE, - PRD_CODE = CurPosition.CurWipSN.PRD_CODE, - ACT_TYPE = NodeAct.ACT_TYPE, - ACT_SN = CurPosition.CurWipSN.SN, - ACT_VALUE_1 = Label.LABEL_CODE, - ACT_VALUE_2 = Label.Variables.ToJson(), - ACT_RESULT = "Y", - TRACE_INFO = $"鏍囩{Label.LABEL_NAME}[{Label.LABEL_CODE}]鎵撳嵃鎴愬姛", - }; + var wipAct = new MES_WIP_ACT() + { + AUTH_ORG = CurPosition.WorkBatch.WO.AUTH_ORG, + AUTH_PROD = CurPosition.CurLine.LINE_CODE, + HIS_ID = CurPosition.CurWipSNHiss.First(q => q.SN == wipSn.SN).ID, + SN = wipSn.SN, + STATUS = wipSn.STATUS, + 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, + ACT_ID = NodeAct.ID, + ACT_NAME = NodeAct.ACT_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, + TRAY_SN = wipSn.TRAY_SN, + OPERATION_TIME = DateTime.Now, + SFTS_CODE = wipSn.SFTS_CODE, + SFT_CODE = wipSn.SFT_CODE, + PRD_CODE = wipSn.PRD_CODE, + ACT_TYPE = NodeAct.ACT_TYPE, + ACT_SN = wipSn.SN, + ACT_VALUE_1 = Label.LABEL_CODE, + ACT_VALUE_2 = Label.Variables.ToJson(), + ACT_RESULT = "Y", + TRACE_INFO = $"鏍囩{Label.LABEL_NAME}[{Label.LABEL_CODE}]鎵撳嵃鎴愬姛", + }; + wipActs.Add(wipAct); + } + //淇濆瓨鏁版嵁 CurStep.DBSubmitAction = () => { var db = CurPosition.GetCommitDB(); - db.Storageable(wipAct, CurPosition.UserCode).ExecuteCommand(); + db.Storageable(wipActs, CurPosition.UserCode).ExecuteCommand(); }; IsFinished = true; diff --git a/Tiger.Business.MES/WorkAction/WipExtInfo.cs b/Tiger.Business.MES/WorkAction/WipExtInfo.cs index 4587973..dbed0c1 100644 --- a/Tiger.Business.MES/WorkAction/WipExtInfo.cs +++ b/Tiger.Business.MES/WorkAction/WipExtInfo.cs @@ -23,7 +23,7 @@ public MES_WO_ACTION Setting { get; set; } #endregion public BAS_WIP_EXT ExtInfo { get; set; } - public MES_WIP_EXT CurWipExt { get; set; } + public List<MES_WIP_EXT> CurWipExt { get; set; } #endregion Propertys & Variables #region Functions @@ -44,12 +44,19 @@ var seq = Setting.ITEM_CODE.ToInt32(); ExtInfo = Biz.Db.Queryable<BAS_WIP_EXT>().Where(q => q.SEQ == seq).First(); //鑾峰彇褰撳墠SN鐨勬墿灞曚俊鎭� - CurWipExt = Biz.Db.Queryable<MES_WIP_EXT>().Where(q => q.SN == CurPosition.CurWipSN.SN).First() ?? new () + CurWipExt = Biz.Db.Queryable<MES_WIP_EXT>().Where(q => CurPosition.CurWipSNs.Any(w => w.SN == q.SN)).ToList(); + foreach (var wipSN in CurPosition.CurWipSNs) { - AUTH_ORG = CurPosition.CurWipSN.AUTH_ORG, - AUTH_PROD = CurPosition.CurWipSN.AUTH_PROD, - SN = CurPosition.CurWipSN.SN, - }; + if (!CurWipExt.Any(q => q.SN == wipSN.SN)) + { + CurWipExt.Add(new() + { + AUTH_ORG = wipSN.AUTH_ORG, + AUTH_PROD = wipSN.AUTH_PROD, + SN = wipSN.SN, + }); + } + } } /// <summary> @@ -111,7 +118,7 @@ //action.LocaleMsg = new Locale($"閿欒锛歔{ExtInfo.FIELD_NAME}]鏍囩鏉$爜涓嶈兘涓虹┖锛岃閲嶆柊鎵弿"); action.LocaleMsg = new Locale("MES.WorkAction.WipExtInfo.SnEmptyError", ExtInfo.FIELD_NAME); } - if (input.SN == CurPosition.CurWipSN.SN) + if (CurPosition.CurWipSNs.Any(w => w.SN == input.SN)) { action.IsSuccessed = isOK = false; //action.LocaleMsg = new Locale($"閿欒锛氭壂鎻忓埌浜у搧鏉$爜[{input.SN}]锛岃閲嶆柊鎵弿[{ExtInfo.FIELD_NAME}]鏍囩鏉$爜"); @@ -130,10 +137,10 @@ } catch (System.Exception ex) { - action.CatchExceptionWithLog(ex, $"鎵╁睍淇℃伅缁戝畾琛屼负锛氫骇鍝乕{CurPosition.CurWipSN.SN}]缁戝畾[{ExtInfo.FIELD_NAME}]鏍囩鏉$爜[{input.SN}]淇濆瓨寮傚父"); + action.CatchExceptionWithLog(ex, $"鎵╁睍淇℃伅缁戝畾琛屼负锛氫骇鍝乕{CurPosition.CurSN}]缁戝畾[{ExtInfo.FIELD_NAME}]鏍囩鏉$爜[{input.SN}]淇濆瓨寮傚父"); action.IsSuccessed = false; //action.LocaleMsg = new($"浜у搧[{CurPosition.CurWipSN.SN}]缁戝畾[{ExtInfo.FIELD_NAME}]鏍囩鏉$爜[{input.SN}]淇濆瓨寮傚父锛屽伐搴忓凡閲嶇疆锛岃閲嶆柊鎵弿杩涚珯浜у搧鏉$爜"); - action.LocaleMsg = new("MES.WorkAction.WipExtInfo.SaveExtInfoException", CurPosition.CurWipSN.SN, ExtInfo.FIELD_NAME, input.SN); + action.LocaleMsg = new("MES.WorkAction.WipExtInfo.SaveExtInfoException", CurPosition.CurSN, ExtInfo.FIELD_NAME, input.SN); CurPosition.ResetNode(); } return action; @@ -148,50 +155,55 @@ var action = new ApiAction<SubmitOutput>(new SubmitOutput()); //璁板綍琛屼负鎿嶄綔璁板綍 - var wipAct = new MES_WIP_ACT() + var wipActs = new List<MES_WIP_ACT>(); + foreach (var wipSn in CurPosition.CurWipSNs) { - AUTH_ORG = CurPosition.WorkBatch.WO.AUTH_ORG, - AUTH_PROD = CurPosition.CurLine.LINE_CODE, - HIS_ID = CurPosition.CurWipSNHis.ID, - SN = CurPosition.CurWipSN.SN, - STATUS = CurPosition.CurWipSN.STATUS, - ITEM_CODE = CurPosition.CurWipSN.ITEM_CODE, - WORK_ORDER = CurPosition.CurWipSN.WORK_ORDER, - BATCH_NO = CurPosition.CurWipSN.BATCH_NO, - ROT_CODE = CurPosition.CurWipSN.ROT_CODE, - NODE_ID = CurPosition.CurWipSN.NODE_ID, - NODE_NAME = CurPosition.CurWipSN.NODE_NAME, - ACT_ID = NodeAct.ID, - ACT_NAME = NodeAct.ACT_NAME, - FTY_CODE = CurPosition.CurWipSN.FTY_CODE, - WS_CODE = CurPosition.CurWipSN.WS_CODE, - LINE_CODE = CurPosition.CurWipSN.LINE_CODE, - POST_CODE = CurPosition.CurWipSN.POST_CODE, - OPER_CODE = CurPosition.CurWipSN.OPER_CODE, - SEGMENT = CurPosition.CurWipSN.SEGMENT, - TRAY_SN = CurPosition.CurWipSN.TRAY_SN, - OPERATION_TIME = DateTime.Now, - SFTS_CODE = CurPosition.CurWipSN.SFTS_CODE, - SFT_CODE = CurPosition.CurWipSN.SFT_CODE, - PRD_CODE = CurPosition.CurWipSN.PRD_CODE, - ACT_TYPE = NodeAct.ACT_TYPE, - ACT_SN = CurPosition.CurWipSN.SN, - ACT_VALUE_1 = CurWipExt.ToJson(), - ACT_RESULT = "Y", - TRACE_INFO = $"浜у搧[{CurPosition.CurWipSN.SN}]缁戝畾[{ExtInfo.FIELD_NAME}]鏍囩鏉$爜[{CurWipExt.GetType().GetProperty($"FIELD_{ExtInfo.SEQ.ToString("00")}")?.GetValue(CurWipExt)?.ToString()}]淇濆瓨鎴愬姛", - }; + var wipAct = new MES_WIP_ACT() + { + AUTH_ORG = CurPosition.WorkBatch.WO.AUTH_ORG, + AUTH_PROD = CurPosition.CurLine.LINE_CODE, + HIS_ID = CurPosition.CurWipSNHiss.First(q => q.SN == wipSn.SN).ID, + SN = wipSn.SN, + STATUS = wipSn.STATUS, + 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, + ACT_ID = NodeAct.ID, + ACT_NAME = NodeAct.ACT_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, + TRAY_SN = wipSn.TRAY_SN, + OPERATION_TIME = DateTime.Now, + SFTS_CODE = wipSn.SFTS_CODE, + SFT_CODE = wipSn.SFT_CODE, + PRD_CODE = wipSn.PRD_CODE, + ACT_TYPE = NodeAct.ACT_TYPE, + ACT_SN = wipSn.SN, + ACT_VALUE_1 = CurWipExt.ToJson(), + ACT_RESULT = "Y", + TRACE_INFO = $"浜у搧[{CurPosition.CurSN}]缁戝畾[{ExtInfo.FIELD_NAME}]鏍囩鏉$爜[{CurWipExt.GetType().GetProperty($"FIELD_{ExtInfo.SEQ.ToString("00")}")?.GetValue(CurWipExt)?.ToString()}]淇濆瓨鎴愬姛", + }; + wipActs.Add(wipAct); + } //淇濆瓨鏁版嵁 CurStep.DBSubmitAction = () => { var db = CurPosition.GetCommitDB(); - db.Storageable(wipAct, CurPosition.UserCode).ExecuteCommand(); + db.Storageable(wipActs, CurPosition.UserCode).ExecuteCommand(); db.Storageable(CurWipExt, CurPosition.UserCode).ExecuteCommand(); }; IsFinished = true; //action.LocaleMsg = new($"浜у搧[{CurPosition.CurWipSN.SN}]缁戝畾[{ExtInfo.FIELD_NAME}]鏍囩鏉$爜[{CurWipExt.GetType().GetProperty($"FIELD_{ExtInfo.SEQ.ToString("00")}")?.GetValue(CurWipExt)?.ToString()}]淇濆瓨鎴愬姛"); - action.LocaleMsg = new("MES.WorkAction.WipExtInfo.SaveSuccess", CurPosition.CurWipSN.SN, ExtInfo.FIELD_NAME, CurWipExt.GetType().GetProperty($"FIELD_{ExtInfo.SEQ.ToString("00")}")?.GetValue(CurWipExt)?.ToString()); + action.LocaleMsg = new("MES.WorkAction.WipExtInfo.SaveSuccess", CurPosition.CurSN, ExtInfo.FIELD_NAME, CurWipExt.GetType().GetProperty($"FIELD_{ExtInfo.SEQ.ToString("00")}")?.GetValue(CurWipExt)?.ToString()); return action; } diff --git a/Tiger.Business/MES/Biz.WorkBatch.cs b/Tiger.Business/MES/Biz.WorkBatch.cs index 2d151f3..c4445af 100644 --- a/Tiger.Business/MES/Biz.WorkBatch.cs +++ b/Tiger.Business/MES/Biz.WorkBatch.cs @@ -244,7 +244,7 @@ action.IsSuccessed = false; action.Data.SetValue(this, null); var nextList = Nodes.Where(q => q.IS_FIRST_NODE == "Y"); - action.LocaleMsg = new("MES.WorkBatch.GotoNextNodeException", wipSN.SN, nextNode.NODE_NAME, string.Join(", ", nextList.Select(q => q.NODE_NAME + (q.CAN_SKIP == "Y" ? $"({T(L("MES.WorkBatch.Optional"), input.Locale)})" : "")))); + action.LocaleMsg = new("MES.WorkBatch.GotoNextNodeException", input.SN, nextNode.NODE_NAME, string.Join(", ", nextList.Select(q => q.NODE_NAME + (q.CAN_SKIP == "Y" ? $"({T(L("MES.WorkBatch.Optional"), input.Locale)})" : "")))); return action; } } @@ -279,7 +279,7 @@ action.IsSuccessed = false; action.Data.SetValue(this, null); var nextList = reflowNodes.Where(q => wipSN.REFLOW_NODE.IsNullOrEmpty() || wipSN.REFLOW_NODE == q.NODE_NAME); - action.LocaleMsg = new("MES.WorkBatch.ReflowToNodeException", nextNode.NODE_NAME, wipSN.SN, curNode.NODE_NAME, string.Join(", ", nextList.Select(q => q.NODE_NAME + (q.CAN_SKIP == "Y" ? $"({T(L("MES.WorkBatch.Optional"), input.Locale)})" : "")))); + action.LocaleMsg = new("MES.WorkBatch.ReflowToNodeException", nextNode.NODE_NAME, input.SN, curNode.NODE_NAME, string.Join(", ", nextList.Select(q => q.NODE_NAME + (q.CAN_SKIP == "Y" ? $"({T(L("MES.WorkBatch.Optional"), input.Locale)})" : "")))); return action; } } @@ -289,7 +289,7 @@ { action.IsSuccessed = false; action.Data.SetValue(this, null); - action.LocaleMsg = new("MES.WorkBatch.PleaseGotoRepair", curNode.NODE_NAME, wipSN.SN); + action.LocaleMsg = new("MES.WorkBatch.PleaseGotoRepair", curNode.NODE_NAME, input.SN); return action; } //姝e父宸ュ簭杩囩珯 @@ -310,7 +310,7 @@ action.IsSuccessed = false; action.Data.SetValue(this, null); var nextList = nextNodes.Where(q => NodeSets.Any(s => s.NODE_ID == q.ID && s.IS_ACTIVE == "Y" && s.CAN_SKIP != "Y")); - action.LocaleMsg = new("MES.WorkBatch.GotoNextNodeException", wipSN.SN, nextNode.NODE_NAME, string.Join(", ", nextList.Select(q => q.NODE_NAME + (q.CAN_SKIP == "Y" ? $"({T(L("MES.WorkBatch.Optional"), input.Locale)})" : "")))); + action.LocaleMsg = new("MES.WorkBatch.GotoNextNodeException", input.SN, nextNode.NODE_NAME, string.Join(", ", nextList.Select(q => q.NODE_NAME + (q.CAN_SKIP == "Y" ? $"({T(L("MES.WorkBatch.Optional"), input.Locale)})" : "")))); return action; } //濡傛灉褰撳墠宸ュ簭娌℃湁蹇呴』鎵ц鐨勫悗缁伐搴忥紝鍒欏湪鍓嶇疆宸ュ簭鏌ユ壘杩樻湁娌℃湁鍚庣画宸ュ簭娌″畬鎴愮殑宸ュ簭锛屾湁鍒欏皾璇曟墽琛� @@ -339,7 +339,7 @@ action.IsSuccessed = false; action.Data.SetValue(this, null); var nextList = nextNodes.Where(q => NodeSets.Any(s => s.NODE_ID == q.ID && s.IS_ACTIVE == "Y")); - action.LocaleMsg = new("MES.WorkBatch.GotoNextNodeException", wipSN.SN, nextNode.NODE_NAME, string.Join(", ", nextList.Select(q => q.NODE_NAME + (q.CAN_SKIP == "Y" ? $"({T(L("MES.WorkBatch.Optional"), input.Locale)})" : "")))); + action.LocaleMsg = new("MES.WorkBatch.GotoNextNodeException", input.SN, nextNode.NODE_NAME, string.Join(", ", nextList.Select(q => q.NODE_NAME + (q.CAN_SKIP == "Y" ? $"({T(L("MES.WorkBatch.Optional"), input.Locale)})" : "")))); return action; } } diff --git a/Tiger.IBusiness/MES/Transaction/IPosition.cs b/Tiger.IBusiness/MES/Transaction/IPosition.cs index 1d2e6bc..72a16f7 100644 --- a/Tiger.IBusiness/MES/Transaction/IPosition.cs +++ b/Tiger.IBusiness/MES/Transaction/IPosition.cs @@ -18,8 +18,9 @@ public MES_LINE CurLine { get; set; } public MES_POSITION CurPosition { get; set; } public IWorkBatch WorkBatch { get; } - public MES_WIP_DATA CurWipSN { get; set; } - public MES_WIP_HIS CurWipSNHis { get; set; } + public List<MES_WIP_DATA> CurWipSNs { get; set; } + public string CurSN { get; } + public List<MES_WIP_HIS> CurWipSNHiss { get; set; } public Dictionary<string, object> Context { get; set; } /// <summary> /// 鏄惁闇�瑕佷复鏃跺瓨鍌ㄦ暟鎹簱鎻愪氦鎿嶄綔锛屽緟闇�瑕佺殑鏃跺�欏啀鎻愪氦 diff --git a/Tiger.Model.Net/Entitys/MES/BIZ_MES_WO_SN.cs b/Tiger.Model.Net/Entitys/MES/BIZ_MES_WO_SN.cs index b4553c0..928b95f 100644 --- a/Tiger.Model.Net/Entitys/MES/BIZ_MES_WO_SN.cs +++ b/Tiger.Model.Net/Entitys/MES/BIZ_MES_WO_SN.cs @@ -6,48 +6,58 @@ namespace Tiger.Model { - /// <summary> - /// 瀹炰綋锛氬伐鍗曟潯鐮佹槑缁� - /// </summary> - [Description("Primary:ID")] - [DisplayName("宸ュ崟鏉$爜鏄庣粏")] - [Serializable] - [SugarTable("BIZ_MES_WO_SN")] - public class BIZ_MES_WO_SN : DbEntityWithAuth - { - #region 鏋勯�犲嚱鏁� - /// <summary> - /// 瀹炰綋锛氬伐鍗曟潯鐮佹槑缁� - /// </summary> - public BIZ_MES_WO_SN() {} - #endregion - - #region 鍏叡灞炴�� - /// <summary> - /// 鍏宠仈宸ュ崟鍙� - /// </summary> - [DisplayName("鍏宠仈宸ュ崟鍙�")] - public string WORK_ORDER { get; set; } - /// <summary> - /// 鏉$爜 - /// </summary> - [DisplayName("鏉$爜")] - public string SN { get; set; } + /// <summary> + /// 瀹炰綋锛氬伐鍗曟潯鐮佹槑缁� + /// </summary> + [Description("Primary:ID")] + [DisplayName("宸ュ崟鏉$爜鏄庣粏")] + [Serializable] + [SugarTable("BIZ_MES_WO_SN")] + public class BIZ_MES_WO_SN : DbEntityWithAuth + { + #region 鏋勯�犲嚱鏁� /// <summary> - /// 鐘舵��(0NotInput鏈姇鍏1Inputed宸叉姇鍏2Finished宸插畬宸�) + /// 瀹炰綋锛氬伐鍗曟潯鐮佹槑缁� /// </summary> - [DisplayName("鐘舵��(0NotInput鏈姇鍏1Inputed宸叉姇鍏2Finished宸插畬宸�)")] - public int STATUS { get; set; } + public BIZ_MES_WO_SN() { } + #endregion + + #region 鍏叡灞炴�� + /// <summary> + /// 鍏宠仈宸ュ崟鍙� + /// </summary> + [DisplayName("鍏宠仈宸ュ崟鍙�")] + public string WORK_ORDER { get; set; } /// <summary> /// 宸ュ崟鎵规鍙� /// </summary> [DisplayName("宸ュ崟鎵规鍙�")] public string BATCH_NO { get; set; } /// <summary> + /// 鏉$爜 + /// </summary> + [DisplayName("鏉$爜")] + public string SN { get; set; } + /// <summary> + /// 鎵樼洏/杞藉叿鏉$爜 + /// </summary> + [DisplayName("鎵樼洏/杞藉叿鏉$爜")] + public string TRAY_SN { get; set; } + /// <summary> + /// 鏈�澶栧眰鍖呰鏉$爜 + /// </summary> + [DisplayName("鏈�澶栧眰鍖呰鏉$爜")] + public string OUTER_SN { get; set; } + /// <summary> + /// 鐘舵��(0NotInput鏈姇鍏1Inputed宸叉姇鍏2Finished宸插畬宸�) + /// </summary> + [DisplayName("鐘舵��(0NotInput鏈姇鍏1Inputed宸叉姇鍏2Finished宸插畬宸�)")] + public int STATUS { get; set; } + /// <summary> /// 澶囨敞 /// </summary> [DisplayName("澶囨敞")] - public string REMARK { get; set; } + public string REMARK { get; set; } #endregion #region 铏氭嫙灞炴�� @@ -86,19 +96,19 @@ /// 鏋氫妇锛氱姸鎬�(0NotInput鏈姇鍏1Inputed宸叉姇鍏2Finished宸插畬宸�) /// </summary> public enum STATUSs - { - [Description("鏈姇鍏�")] - NotInput = 0, - [Description("宸叉姇鍏�")] - Inputed = 1, + { + [Description("鏈姇鍏�")] + NotInput = 0, + [Description("宸叉姇鍏�")] + Inputed = 1, [Description("宸插畬宸�")] Finished = 2, } - #endregion + #endregion - #region 鍏叡鏂规硶 + #region 鍏叡鏂规硶 - #endregion + #endregion - }//endClass + }//endClass } \ No newline at end of file diff --git a/Tiger.Model.Net/Entitys/MES/ParameterEntity/PositionParameter.cs b/Tiger.Model.Net/Entitys/MES/ParameterEntity/PositionParameter.cs index 0256ef9..dd244a4 100644 --- a/Tiger.Model.Net/Entitys/MES/ParameterEntity/PositionParameter.cs +++ b/Tiger.Model.Net/Entitys/MES/ParameterEntity/PositionParameter.cs @@ -170,8 +170,15 @@ public class AssemblySetting { public string ITEM_CODE { get; set; } - public string RULE_CODE { get; set; } - public int QTY { get; set; } + public string RULE_CODE { get; set; } + /// <summary> + /// 鏄惁鎵规鐗╂枡 + /// </summary> + public bool IsBatchItem { get; set; } + /// <summary> + /// 涓婃枡鏁伴噺 + /// </summary> + public int QTY { get; set; } } /// <summary> @@ -192,6 +199,10 @@ public BAS_ITEM ItemInfo { get; set; } public string RuleCode { get; set; } public int LoadQty { get; set; } + /// <summary> + /// 鏄惁鎵规鐗╂枡 + /// </summary> + public bool IsBatchItem { get; set; } public List<MES_WIP_ASSY> Records { get; set; } = new List<MES_WIP_ASSY>(); public bool IsFinished { get; set; } = false; diff --git a/Tiger.Model.Net/Entitys/SYS/V_USER_MENU.cs b/Tiger.Model.Net/Entitys/SYS/V_USER_MENU.cs index d6079d2..81161c0 100644 --- a/Tiger.Model.Net/Entitys/SYS/V_USER_MENU.cs +++ b/Tiger.Model.Net/Entitys/SYS/V_USER_MENU.cs @@ -23,10 +23,6 @@ #region 鍏叡灞炴�� /// <summary> - /// GUID - /// </summary> - public string ID { get; set; } - /// <summary> /// 鐢ㄦ埛ID /// </summary> public string USER_ID { get; set; } diff --git a/Tiger.Model.Net/Entitys/SYS/V_USER_ORG.cs b/Tiger.Model.Net/Entitys/SYS/V_USER_ORG.cs index 6c85546..504ace8 100644 --- a/Tiger.Model.Net/Entitys/SYS/V_USER_ORG.cs +++ b/Tiger.Model.Net/Entitys/SYS/V_USER_ORG.cs @@ -23,10 +23,6 @@ #region 鍏叡灞炴�� /// <summary> - /// GUID - /// </summary> - public string ID { get; set; } - /// <summary> /// 鐢ㄦ埛ID /// </summary> public string USER_ID { get; set; } diff --git a/Tiger.Model.Net/Entitys/SYS/V_USER_PROD.cs b/Tiger.Model.Net/Entitys/SYS/V_USER_PROD.cs index 6083bb4..8e922bb 100644 --- a/Tiger.Model.Net/Entitys/SYS/V_USER_PROD.cs +++ b/Tiger.Model.Net/Entitys/SYS/V_USER_PROD.cs @@ -23,10 +23,6 @@ #region 鍏叡灞炴�� /// <summary> - /// GUID - /// </summary> - public string ID { get; set; } - /// <summary> /// 鐢ㄦ埛ID /// </summary> public string USER_ID { get; set; } diff --git a/Tiger.Model.Net/Entitys/SYS/V_USER_WH.cs b/Tiger.Model.Net/Entitys/SYS/V_USER_WH.cs index f5592cd..eb7d225 100644 --- a/Tiger.Model.Net/Entitys/SYS/V_USER_WH.cs +++ b/Tiger.Model.Net/Entitys/SYS/V_USER_WH.cs @@ -23,10 +23,6 @@ #region 鍏叡灞炴�� /// <summary> - /// GUID - /// </summary> - public string ID { get; set; } - /// <summary> /// 鐢ㄦ埛ID /// </summary> public string USER_ID { get; set; } diff --git a/Tiger.Model.Net/Entitys/WMS/V_SRM_ITEM.cs b/Tiger.Model.Net/Entitys/WMS/V_SRM_ITEM.cs index f2b01fa..a92502e 100644 --- a/Tiger.Model.Net/Entitys/WMS/V_SRM_ITEM.cs +++ b/Tiger.Model.Net/Entitys/WMS/V_SRM_ITEM.cs @@ -1,5 +1,4 @@ using System; -using System; using SqlSugar; using System.Linq; using System.ComponentModel; -- Gitblit v1.9.3