From 12b0846ee59a358fbf5bc392f74794b8ef13d8eb Mon Sep 17 00:00:00 2001 From: Rodney Chen <rodney.chen@hotmail.com> Date: 星期五, 13 九月 2024 15:55:06 +0800 Subject: [PATCH] 增加出货数量验证 --- Tiger.Business.MES/Transaction/TestNode.cs | 53 ++++++++++++++++++++++++++++++++++++----------------- 1 files changed, 36 insertions(+), 17 deletions(-) diff --git a/Tiger.Business.MES/Transaction/TestNode.cs b/Tiger.Business.MES/Transaction/TestNode.cs index 05f1056..b95ba93 100644 --- a/Tiger.Business.MES/Transaction/TestNode.cs +++ b/Tiger.Business.MES/Transaction/TestNode.cs @@ -47,6 +47,9 @@ //鍏堝垽鏂綋鍓嶅伐鍗曚笉涓虹┖涓斿綋鍓嶅矖浣嶅湪褰撳墠宸ュ崟鏄笉鏄绔欙紝濡傛灉鏄垯涓嶅厑璁稿彉鏇村綋鍓嶅伐鍗曪紝灏濊瘯鎶婃潯鐮佺粦瀹氬埌褰撳墠宸ュ崟 if (!CurBatch.IsNullOrEmpty() && CurBatch.IsFirstNode(PostCode)) { + //鏇存柊CurBatch + CurBatch?.Update(); + //鎻愪氦鏁版嵁 action = NodeSubmit(action, input); //鏇存柊宸ュ簭淇℃伅 if (!action.IsSuccessed) @@ -57,14 +60,14 @@ } else if (!IsFinishAllSteps) { - action.Data.OperInfo = SetOperNodeInfo(OperInfoDic[CurBatch.Batch.BATCH_NO]); + action.Data.OperInfo = SetOperNodeInfo(OperInfoDic[CurBatch.Batch.BATCH_NO], input.Locale); } } //褰撳墠宀椾綅鍦ㄥ綋鍓嶅伐鍗曚笉鏄绔欙紝鍒欐煡鎵炬潯鐮佸凡缁戝畾鐨勫伐鍗曞綋浣滃綋鍓嶅伐鍗� else { 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(); + .ByAuth(input.AuthOption).Where((q, s) => s.SN == input.SN || s.FLOW_SN == input.SN || s.TRAY_SN == input.SN).Select((q, s) => new { Batch = q, SN = s }).ToList(); //鏌ユ壘鍒版潯鐮佸凡缁戝畾鐨勫伐鍗� if (!wosns.IsNullOrEmpty()) @@ -92,11 +95,19 @@ return action; } } + //鏇存柊CurBatch + CurBatch?.Update(); //鏉$爜杩囩珯 action = NodeSubmit(action, input); - if (!IsFinishAllSteps) + if (!action.IsSuccessed && !CurWipSNs.Any()) { - action.Data.OperInfo = SetOperNodeInfo(OperInfoDic[CurBatch.Batch.BATCH_NO]); + var info = WoContext.GetSnOperInfo(input.SN).Data; + info.InputQty = OperInfoDic[CurBatch.Batch.BATCH_NO].InputQty; + action.Data.OperInfo = info; + } + else if (!IsFinishAllSteps) + { + action.Data.OperInfo = SetOperNodeInfo(OperInfoDic[CurBatch.Batch.BATCH_NO], input.Locale); } } } @@ -127,6 +138,9 @@ //瀹屾垚宸ュ簭鑺傜偣宸ユ鍚庯紝寮�濮嬫墽琛屽綋鍓嶅伐搴忕殑琛屼负宸ユ else if (IsFinishNodeSteps && !IsFinishAllSteps) { + //鏇存柊CurBatch + CurBatch?.Update(); + var submitStep = Steps.Where(q => q.ID == input.CurStepID && !q.IsFinished).FirstOrDefault(); if (submitStep.IsNullOrEmpty()) { @@ -157,7 +171,7 @@ //濡傛灉鎵�鏈夊伐姝ラ兘瀹屾垚 if (IsFinishAllSteps) { - result = DoIfFinishAllSteps(result); + result = DoIfFinishAllSteps(result, input.Locale); } else { @@ -206,7 +220,7 @@ return woStatus; } - 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(); + var wipSNs = Biz.Db.Queryable<MES_WIP_DATA>().IncludesAllFirstLayer().Where(q => q.SN == input.SN || q.FLOW_SN == input.SN || q.TRAY_SN == input.SN).ToList(); if (wipSNs.IsNullOrEmpty()) { var wipSN = new MES_WIP_DATA() @@ -239,7 +253,7 @@ action.Data.ShortMsg = new("宸ュ崟閿欒", ShortMessage.Types.Error); action.IsSuccessed = false; //action.LocaleMsg = new($"浜у搧[{CurSN}]涓嶅睘浜庡綋鍓嶅伐鍗曪紝璇峰垏鎹㈠埌宸ュ崟[{wipSNs.First().WORK_ORDER}]鍚庡啀鎵弿"); - action.LocaleMsg = new("MES.Transaction.TestNode.NodeSubmit.WoError", CurSN, wipSNs.First().WORK_ORDER); + action.LocaleMsg = new("MES.Transaction.TestNode.NodeSubmit.WoError", input.SN, wipSNs.First().WORK_ORDER); return action; } else @@ -247,7 +261,7 @@ action.Data.ShortMsg = new("浜х嚎閿欒", ShortMessage.Types.Error); action.IsSuccessed = false; //action.LocaleMsg = new($"浜у搧[{CurSN}]宸插湪浜х嚎[{wipSNs.First().LINE_CODE}]鎶曚骇锛岃鍒颁骇绾縖{wipSNs.First().LINE_CODE}]鎵弿"); - action.LocaleMsg = new("MES.Transaction.TestNode.NodeSubmit.LineError", CurSN, wipSNs.First().LINE_CODE); + action.LocaleMsg = new("MES.Transaction.TestNode.NodeSubmit.LineError", input.SN, wipSNs.First().LINE_CODE); return action; } } @@ -273,6 +287,7 @@ WORK_ORDER = CurBatch.Batch.ORDER_NO, WIP_ID = wipSN.ID, SN = wipSN.SN, + FLOW_SN = wipSN.SN, TRAY_SN = wipSN.TRAY_SN, STATUS = BIZ_MES_WO_SN.STATUSs.NotInput.GetValue(), }); @@ -382,7 +397,9 @@ 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}]鎴愬姛")); + var his = new MES_WIP_HIS(wipSN, $"宸ュ崟[{wipSN.WORK_ORDER}]鏉$爜[{wipSN.SN}]鍦ㄥ矖浣峓{wipSN.POST_CODE}]杩囩珯宸ュ簭[{wipSN.NODE_NAME}]鎴愬姛"); + wipSN.History.Add(his); + CurWipSNHiss.Add(his); } //鍒涘缓鍙橀噺鍏嬮殕瀵硅薄鐢ㄤ簬浼犲叆DBSubmitAction涓繚瀛樺綋鍓嶉渶瑕佹殏瀛樼殑鏁版嵁鍊� @@ -395,10 +412,12 @@ //鍒濆鍖栧伐姝ュ垪琛� Steps.Clear(); - var curStep = new Biz.WorkStep(IWorkStep.Types.Node, this) + var curStep = new Biz.WorkStep(IWorkStep.NodeTypes.Node, this) { + Name = "鎵弿浜у搧", Sequence = Steps.Count + 1, Node = curNode, + OperSetting = CurBatch.NodeSets.FirstOrDefault(q => q.NODE_ID == curNode.ID), DBSubmitAction = () => { //浣跨敤缁熶竴鐨勪簨鍔B瀵硅薄 @@ -443,15 +462,15 @@ } //瀹屾垚绗竴涓伐搴忚妭鐐瑰伐姝� - curStep.IsFinished = true; + curStep.Status = StepStatus.Finished; CurStep = curStep; } else if (!IsFinishNodeSteps) { - var curStep = Steps.Where(q => q.Type == IWorkStep.Types.Node && !q.IsFinished).OrderBy(q => q.Sequence).First(); + var curStep = Steps.Where(q => q.NodeType == IWorkStep.NodeTypes.Node && !q.IsFinished).OrderBy(q => q.Sequence).First(); //瀹屾垚褰撳墠宸ュ簭鑺傜偣宸ユ - curStep.IsFinished = true; + curStep.Status = StepStatus.Finished; CurStep = curStep; } @@ -461,7 +480,7 @@ //鏈畬鎴愭墍鏈夊伐搴忚妭鐐瑰伐姝� if (!IsFinishNodeSteps) { - var next = Steps.Where(q => q.Type == IWorkStep.Types.Node && !q.IsFinished).OrderBy(q => q.Sequence).First(); + var next = Steps.Where(q => q.NodeType == IWorkStep.NodeTypes.Node && !q.IsFinished).OrderBy(q => q.Sequence).First(); //璁剧疆鍚庣画鍙墽琛岀殑宸ユ鍒楄〃 NextSteps.Clear(); NextSteps.Add(next); @@ -489,7 +508,7 @@ if (IsFinishAllSteps) { action.Data.SetValue(CurBatch, CurStep, "", IsFinishAllSteps); - action = DoIfFinishAllSteps(action); + action = DoIfFinishAllSteps(action, input.Locale); } } catch (Exception ex) @@ -507,14 +526,14 @@ /// </summary> /// <param name="action"></param> /// <returns></returns> - public ApiAction<SubmitOutput> DoIfFinishAllSteps(ApiAction<SubmitOutput> action) + public ApiAction<SubmitOutput> DoIfFinishAllSteps(ApiAction<SubmitOutput> action, string locale) { //淇濆瓨鏁版嵁搴� SaveStepsCommitActionToDB(); //淇濆瓨鎴愬姛锛岃繑鍥炶繃绔欐秷鎭� OperInfoDic[CurBatch.Batch.BATCH_NO].InputQty += CurWipSNs.Count; - action.Data.OperInfo = SetOperNodeInfo(OperInfoDic[CurBatch.Batch.BATCH_NO]); + action.Data.OperInfo = SetOperNodeInfo(OperInfoDic[CurBatch.Batch.BATCH_NO], locale); action.Data.ShortMsg = new("杩囩珯鎴愬姛", ShortMessage.Types.Success); //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>()); -- Gitblit v1.9.3