From eec9f268552af1d0ce8c95312930770669f1cc18 Mon Sep 17 00:00:00 2001 From: Rodney Chen <rodney.chen@hotmail.com> Date: 星期五, 16 八月 2024 22:40:16 +0800 Subject: [PATCH] 增加客户端需要的工序信息和短消息 --- Tiger.Business.MES/Transaction/PackingNode.cs | 79 ++++++++++++++++++++++++++++++--------- 1 files changed, 61 insertions(+), 18 deletions(-) diff --git a/Tiger.Business.MES/Transaction/PackingNode.cs b/Tiger.Business.MES/Transaction/PackingNode.cs index af22a2f..0c6de97 100644 --- a/Tiger.Business.MES/Transaction/PackingNode.cs +++ b/Tiger.Business.MES/Transaction/PackingNode.cs @@ -55,9 +55,9 @@ //濡傛灉琛屼负琚爣璁版垚宸插畬鎴愶紝鍒欓噸缃伐搴� if (TempPkgAction.IsFinished) { + action.Data.OperInfo = OperInfoDic.ContainsKey(CurBatch?.Batch?.BATCH_NO ?? "") ? OperInfoDic[CurBatch.Batch.BATCH_NO] : new(); ResetNode(); } - return action; } //NodeSubmit锛氫骇鍝佽繃绔欙紝姝e父浜у搧杩囩珯閫昏緫 else @@ -70,7 +70,10 @@ if (!CurBatch.IsNullOrEmpty() && CurBatch.IsFirstNode(PostCode)) { action = NodeSubmit(action, input); - return action; + //鏇存柊宸ュ簭淇℃伅 + var info = WoContext.GetSnOperInfo(input.SN).Data; + info.InputQty = OperInfoDic[CurBatch.Batch.BATCH_NO].InputQty; + action.Data.OperInfo = info; } //褰撳墠宀椾綅鍦ㄥ綋鍓嶅伐鍗曚笉鏄绔欙紝鍒欐煡鎵炬潯鐮佸凡缁戝畾鐨勫伐鍗曞綋浣滃綋鍓嶅伐鍗� else @@ -83,6 +86,8 @@ { if (wosns.Count > 1 && wosns.Any(q => q.SN.TRAY_SN != q.SN.OUTER_SN)) { + action.Data.ShortMsg = new("璇锋壂鎻忎骇鍝�", ShortMessage.Types.Error); + action.Data.OperInfo = new(); action.IsSuccessed = false; action.LocaleMsg = new($"鏉$爜[{0}]鏄浇鍏锋潯鐮侊紝璇锋壂鎻忚浇鍏蜂腑鐨勪骇鍝佹潯鐮佺户缁寘瑁呮搷浣�"); action.LocaleMsg = new("MES.Transaction.PackingNode.Submit.OnlyMinPackage", input.SN); @@ -90,10 +95,11 @@ } if (wosns.First().Batch.ACT_LINE != CurLine.LINE_CODE) { + action.Data.ShortMsg = new("浜х嚎閿欒", ShortMessage.Types.Error); + action.Data.OperInfo = new(); action.IsSuccessed = false; //action.LocaleMsg = new($"鏉$爜[{0}]宸插湪浜х嚎[{1}]鎶曞叆鐢熶骇锛岃鍦ㄦ纭矖浣嶆壂鎻�"); action.LocaleMsg = new("MES.Transaction.PackingNode.Submit.NotCorrectLine", input.SN, wosns.First().Batch.ACT_LINE); - return action; } else { @@ -103,14 +109,16 @@ var result = await SelectOrder(new() { AuthOption = input.AuthOption, OrderNo = wosns.First().Batch.ORDER_NO }); if (!result.IsSuccessed) { - action.IsSuccessed = result.IsSuccessed; + action.Data.ShortMsg = new("宸ュ崟寮傚父", ShortMessage.Types.Error); + action.Data.OperInfo = new(); + action.IsSuccessed = result.IsSuccessed; action.LocaleMsg = result.LocaleMsg; return action; } } //鏉$爜杩囩珯 action = NodeSubmit(action, input); - return action; + action.Data.OperInfo = SetOperNodeInfo(OperInfoDic[CurBatch.Batch.BATCH_NO]); } } //鏌ユ壘涓嶅埌鏉$爜宸茬粦瀹氱殑宸ュ崟 @@ -119,18 +127,20 @@ //娌℃湁褰撳墠宸ュ崟锛屽垯鍏堥�夋嫨宸ュ崟鍚庡啀鎵弿鏉$爜 if (CurBatch.IsNullOrEmpty()) { + action.Data.ShortMsg = new("鏈�夋嫨宸ュ崟", ShortMessage.Types.Error); + action.Data.OperInfo = new(); action.IsSuccessed = false; //action.LocaleMsg = new($"鏈�夋嫨宸ュ崟锛岃鍏堥�夋嫨瑕佺敓浜х殑宸ュ崟"); action.LocaleMsg = new("MES.Transaction.PackingNode.Submit.NotSelectOrderException"); - return action; } //鏈夊綋鍓嶅伐鍗曚笖涓嶆槸鎶曞叆锛屽垯鎻愮ず鏉$爜鏈姇鍏ョ敓浜э紝璇峰厛鍘婚绔欐壂鎻� else { + action.Data.ShortMsg = new("鏈姇鍏ョ敓浜�", ShortMessage.Types.Error); + action.Data.OperInfo = new(); action.IsSuccessed = false; //action.LocaleMsg = new($"鏉$爜[{input.SN}]灏氭湭鎶曞叆鐢熶骇锛岃鍏堝幓棣栫珯鎵弿", input.SN); action.LocaleMsg = new("MES.Transaction.PackingNode.Submit.NotInputException", input.SN); - return action; } } } @@ -142,7 +152,7 @@ if (submitStep.IsNullOrEmpty()) { action = BeginNextActionStep(input); - return action; + action.Data.OperInfo = OperInfoDic[CurBatch.Batch.BATCH_NO]; } else { @@ -168,20 +178,28 @@ //濡傛灉鎵�鏈夊伐姝ラ兘瀹屾垚 if (IsFinishAllSteps) { - return DoIfFinishAllSteps(result); + result = DoIfFinishAllSteps(result); } + result.Data.OperInfo = OperInfoDic[CurBatch.Batch.BATCH_NO]; return result; } } //娌℃湁鍙墽琛岀殑宸ユ - ResetNode(); - action.IsSuccessed = false; - //action.LocaleMsg = new($"宀椾綅[{CurPosition.POST_CODE}]宸ユ鎵ц寮傚父锛岃閲嶆柊鎵弿浜у搧鏉$爜", CurPosition.POST_CODE); - action.LocaleMsg = new("MES.Transaction.PackingNode.Submit.WorkStepException", CurPosition.POST_CODE); + else + { + action.Data.ShortMsg = new("閲嶇疆鎵弿", ShortMessage.Types.Error); + action.Data.OperInfo = OperInfoDic.ContainsKey(CurBatch?.Batch?.BATCH_NO ?? "") ? OperInfoDic[CurBatch.Batch.BATCH_NO] : new(); + ResetNode(); + action.IsSuccessed = false; + //action.LocaleMsg = new($"宀椾綅[{CurPosition.POST_CODE}]宸ユ鎵ц寮傚父锛岃閲嶆柊鎵弿浜у搧鏉$爜", CurPosition.POST_CODE); + action.LocaleMsg = new("MES.Transaction.PackingNode.Submit.WorkStepException", CurPosition.POST_CODE); + } } } catch (Exception ex) { + action.Data.ShortMsg = new("宸ュ簭寮傚父", ShortMessage.Types.Error); + action.Data.OperInfo = OperInfoDic.ContainsKey(CurBatch?.Batch?.BATCH_NO ?? "") ? OperInfoDic[CurBatch.Batch.BATCH_NO] : new(); //action.CatchExceptionWithLog(ex, $"鍖呰宸ュ簭锛氭彁浜ゆ搷浣滄暟鎹紓甯�"); action.CatchExceptionWithLog(ex, Biz.L("MES.Transaction.PackingNode.SubmitException")); } @@ -203,9 +221,10 @@ var woStatus = CurBatch.CheckCanProduce(curNode); if (!woStatus.IsSuccessed) { + woStatus.Data.ShortMsg = new("宸ュ崟寮傚父", ShortMessage.Types.Error); 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(); if (wipSNs.IsNullOrEmpty()) { @@ -226,9 +245,33 @@ }; wipSNs.Add(wipSN); } + + //濡傛灉鏉$爜涓嶆槸褰撳墠宸ュ崟鎴栬�呬骇绾跨殑鍒欐姤閿� + if (wipSNs.Any(q => q.WORK_ORDER != CurBatch.WO.ORDER_NO || q.LINE_CODE != CurLine.LINE_CODE)) + { + if (wipSNs.First().LINE_CODE == CurLine.LINE_CODE) + { + action.Data.ShortMsg = new("宸ュ崟閿欒", ShortMessage.Types.Error); + action.IsSuccessed = false; + //action.LocaleMsg = new($"浜у搧[{CurSN}]涓嶅睘浜庡綋鍓嶅伐鍗曪紝璇峰垏鎹㈠埌宸ュ崟[{wipSNs.First().WORK_ORDER}]鍚庡啀鎵弿"); + action.LocaleMsg = new("MES.Transaction.PackingNode.NodeSubmit.WoError", CurSN, wipSNs.First().WORK_ORDER); + return action; + } + else + { + 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.PackingNode.NodeSubmit.LineError", CurSN, wipSNs.First().LINE_CODE); + return action; + } + } + + //闈炴硶杩囩珯闃插憜锛氳繘鍏ュ伐搴忔椂瑕佸鍔犲垽鏂潯鐮佹槸鍚︽寜娴佺▼杩囩珯 var canGotoNext = CurBatch.CanGotoNext(input, wipSNs.First(), curNode); if (!canGotoNext.IsSuccessed) { + woStatus.Data.ShortMsg = new("杩涚珯閿欒", ShortMessage.Types.Error); return canGotoNext; } @@ -466,6 +509,7 @@ } catch (Exception ex) { + action.Data.ShortMsg = new("宸ユ寮傚父", ShortMessage.Types.Error); ResetNode(); //action.CatchExceptionWithLog(ex, $"{curNode.NODE_NAME}锛氬伐搴忚妭鐐瑰伐姝ユ彁浜ゆ暟鎹紓甯革紝璇锋鏌ュ伐搴忚妭鐐硅缃�"); action.CatchExceptionWithLog(ex, Biz.L("MES.Transaction.PackingNode.NodeSubmitException", curNode.NODE_NAME)); @@ -484,13 +528,12 @@ SaveStepsCommitActionToDB(); //淇濆瓨鎴愬姛锛岃繑鍥炶繃绔欐秷鎭� + OperInfoDic[CurBatch.Batch.BATCH_NO].InputQty += CurWipSNs.Count; + 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>()); //閲嶇疆宸ュ簭 - //if (!isClone) - { - ResetNode(); - } + ResetNode(); return action; } -- Gitblit v1.9.3