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.Api/Language.db | 0 Tiger.Business.MES/Transaction/CollectNode.cs | 72 ++++++++-- Tiger.Business.MES/WorkAction/Assembly.cs | 7 Tiger.Business.MES/WorkAction/Weighing.cs | 3 Tiger.Business/MES/WoContext.cs | 67 +++++++++ Tiger.Business.MES/Transaction/PackingNode.cs | 79 ++++++++-- Tiger.Business.MES/Transaction/Position.cs | 24 +++ Tiger.Model.Net/Entitys/MES/ParameterEntity/PositionParameter.cs | 6 Tiger.Business.MES/Transaction/TestNode.cs | 72 ++++++++-- Tiger.Business.MES/WorkAction/IPQC.cs | 5 Tiger.Business.MES/WorkAction/PackingAction.cs | 22 ++ Tiger.Business.MES/WorkAction/PrintLabel.cs | 3 Tiger.Business.MES/WorkAction/WipExtInfo.cs | 5 Tiger.Model.Net/Entitys/Api/Base.cs | 6 14 files changed, 315 insertions(+), 56 deletions(-) diff --git a/Tiger.Api/Language.db b/Tiger.Api/Language.db index e57407c..a3fef0a 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 00ec0b6..5eeaa41 100644 --- a/Tiger.Business.MES/Transaction/CollectNode.cs +++ b/Tiger.Business.MES/Transaction/CollectNode.cs @@ -47,7 +47,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 @@ -60,10 +63,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 { @@ -73,14 +77,16 @@ var result = await SelectOrder(new() { AuthOption = input.AuthOption, OrderNo = wosns.First().Batch.ORDER_NO }); if (!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 = NodeSubmit(action, input); + action.Data.OperInfo = SetOperNodeInfo(OperInfoDic[CurBatch.Batch.BATCH_NO]); } } //鏌ユ壘涓嶅埌鏉$爜宸茬粦瀹氱殑宸ュ崟 @@ -89,18 +95,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.CollectNode.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.CollectNode.Submit.NotInputException", input.SN); - return action; } } } @@ -112,7 +120,7 @@ if (submitStep.IsNullOrEmpty()) { action = BeginNextActionStep(input); - return action; + action.Data.OperInfo = OperInfoDic[CurBatch.Batch.BATCH_NO]; } else { @@ -138,19 +146,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.CollectNode.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.CollectNode.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(); + ResetNode(); //action.CatchExceptionWithLog(ex, $"閲囬泦宸ュ簭锛氭彁浜ゆ搷浣滄暟鎹紓甯�"); action.CatchExceptionWithLog(ex, Biz.L("MES.Transaction.CollectNode.SubmitException")); } @@ -172,9 +189,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()) { @@ -195,9 +213,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.CollectNode.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.CollectNode.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; } @@ -435,8 +477,8 @@ } catch (Exception ex) { + action.Data.ShortMsg = new("宸ユ寮傚父", ShortMessage.Types.Error); ResetNode(); - action.CatchExceptionWithLog(ex, $"閲囬泦宸ュ簭锛氬伐搴忚妭鐐瑰伐姝ユ彁浜ゆ暟鎹紓甯�"); //action.CatchExceptionWithLog(ex, $"{curNode.NODE_NAME}锛氬伐搴忚妭鐐瑰伐姝ユ彁浜ゆ暟鎹紓甯革紝璇锋鏌ュ伐搴忚妭鐐硅缃�"); action.CatchExceptionWithLog(ex, Biz.L("MES.Transaction.CollectNode.NodeSubmitException", curNode.NODE_NAME)); } @@ -454,6 +496,8 @@ 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>()); //閲嶇疆宸ュ簭 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; } diff --git a/Tiger.Business.MES/Transaction/Position.cs b/Tiger.Business.MES/Transaction/Position.cs index 757ae4e..eb431bf 100644 --- a/Tiger.Business.MES/Transaction/Position.cs +++ b/Tiger.Business.MES/Transaction/Position.cs @@ -56,7 +56,7 @@ public WorkBatch CurBatch { get; set; } public IWorkBatch WorkBatch => CurBatch; public List<MES_WIP_DATA> CurWipSNs { get; set; } = new(); - public string CurSN => CurWipSNs.Any() ? (CurWipSNs.First().TRAY_SN.IsNullOrEmpty() ? CurWipSNs.First().SN : CurWipSNs.First().TRAY_SN) : ""; + public string CurSN => (CurWipSNs.Any() ? (CurWipSNs.First().TRAY_SN.IsNullOrEmpty() ? CurWipSNs.First().SN : CurWipSNs.First().TRAY_SN) : ""); public List<MES_WIP_HIS> CurWipSNHiss { get; set; } = new(); public List<MES_WIP_DFT> CurDefects { get; set; } = new(); public Dictionary<string, object> Context { get; set; } = new(); @@ -73,7 +73,8 @@ public bool NeedTemporaryStoreDBCommitAction { get; set; } = false; protected List<Action> DBCommitList { get; set; } = new(); protected List<Position> NodeCommitList { get; set; } = new(); - + protected Dictionary<string, OperInfo> OperInfoDic { get; set; } = new(); + protected OperInfo CurOperInfo { get; set; } #endregion Propertys & Variables #region Functions @@ -125,6 +126,7 @@ WoContext.WoBatchDic.Add(wb.Batch.BATCH_NO, wb); } CurBatch = WoContext.GetBatch(input.OrderNo, CurLine.LINE_CODE); + OperInfoDic.Add(CurBatch.Batch.BATCH_NO, new()); action.Data = new { WorkOrder = CurBatch.WO, Bacth = CurBatch.Batch }; } catch (Exception ex) @@ -184,6 +186,24 @@ } /// <summary> + /// 璁剧疆褰撳墠鏉$爜鐨勫伐搴忎俊鎭� + /// </summary> + public OperInfo SetOperNodeInfo(OperInfo info) + { + if (CurWipSNs.Any()) + { + info.CurNode = CurWipSNs.First().NODE_NAME; + info.NextNode = string.Join(",", CurBatch.GetNextNodes(CurWipSNs.First()).Select(q => q.NODE_NAME)); + } + else + { + info.CurNode = " 鈥� "; + info.NextNode = " 鈥� "; + } + return info; + } + + /// <summary> /// 鐢熸垚浼犲叆宸ユ鍚庣画鐨勮涓哄埌宸ユ鍒楄〃 /// </summary> /// <param name="parent"></param> diff --git a/Tiger.Business.MES/Transaction/TestNode.cs b/Tiger.Business.MES/Transaction/TestNode.cs index 0cf1bf4..81213e3 100644 --- a/Tiger.Business.MES/Transaction/TestNode.cs +++ b/Tiger.Business.MES/Transaction/TestNode.cs @@ -38,6 +38,7 @@ public async Task<ApiAction<SubmitOutput>> Submit(SubmitInput input) { var action = new ApiAction<SubmitOutput>(new SubmitOutput()); + try { //宸ユ鍒楄〃涓虹┖鎴栬�呭伐搴忚妭鐐瑰伐姝ユ湁鏈畬鎴愭椂锛屼紭鍏堝畬鎴愬伐搴忚妭鐐瑰伐姝� @@ -47,7 +48,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 @@ -60,10 +64,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 { @@ -73,6 +78,8 @@ var result = await SelectOrder(new() { AuthOption = input.AuthOption, OrderNo = wosns.First().Batch.ORDER_NO }); if (!result.IsSuccessed) { + action.Data.ShortMsg = new("宸ュ崟寮傚父", ShortMessage.Types.Error); + action.Data.OperInfo = new(); action.IsSuccessed = result.IsSuccessed; action.LocaleMsg = result.LocaleMsg; return action; @@ -80,7 +87,7 @@ } //鏉$爜杩囩珯 action = NodeSubmit(action, input); - return action; + action.Data.OperInfo = SetOperNodeInfo(OperInfoDic[CurBatch.Batch.BATCH_NO]); } } //鏌ユ壘涓嶅埌鏉$爜宸茬粦瀹氱殑宸ュ崟 @@ -89,31 +96,32 @@ //娌℃湁褰撳墠宸ュ崟锛屽垯鍏堥�夋嫨宸ュ崟鍚庡啀鎵弿鏉$爜 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.TestNode.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.TestNode.Submit.NotInputException", input.SN); - return action; } } } } - //瀹屾垚绗竴姝ワ紝鍚庡紑濮嬫墽琛屽綋鍓嶅伐搴忕殑琛屼负鍒楄〃 - //瀹屾垚宸ュ簭鑺傜偣宸ユ鍚庯紝鍚庡紑濮嬫墽琛屽綋鍓嶅伐搴忕殑琛屼负宸ユ + //瀹屾垚宸ュ簭鑺傜偣宸ユ鍚庯紝寮�濮嬫墽琛屽綋鍓嶅伐搴忕殑琛屼负宸ユ else if (IsFinishNodeSteps && !IsFinishAllSteps) { var submitStep = Steps.Where(q => q.ID == input.CurStepID && !q.IsFinished).FirstOrDefault(); if (submitStep.IsNullOrEmpty()) { action = BeginNextActionStep(input); - return action; + action.Data.OperInfo = OperInfoDic[CurBatch.Batch.BATCH_NO]; } else { @@ -139,19 +147,27 @@ //濡傛灉鎵�鏈夊伐姝ラ兘瀹屾垚 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.TestNode.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.TestNode.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.TestNode.SubmitException")); } @@ -173,9 +189,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()) { @@ -196,9 +213,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.TestNode.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.TestNode.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; } @@ -436,6 +477,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.TestNode.NodeSubmitException", curNode.NODE_NAME)); @@ -454,6 +496,8 @@ 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>()); //閲嶇疆宸ュ簭 diff --git a/Tiger.Business.MES/WorkAction/Assembly.cs b/Tiger.Business.MES/WorkAction/Assembly.cs index ab68c80..25ea331 100644 --- a/Tiger.Business.MES/WorkAction/Assembly.cs +++ b/Tiger.Business.MES/WorkAction/Assembly.cs @@ -113,6 +113,7 @@ //濡傛灉杩斿洖鎴愬姛鍒欒涓哄綋鍓嶈涓哄彲浠ュ紑濮嬫墽琛岋紝鍚﹀垯杩斿洖澶辫触 action.IsSuccessed = false; + action.Data.ShortMsg = new("绛夊緟涓婃枡", ShortMessage.Types.Normal); return action; } @@ -238,7 +239,8 @@ } action.IsSuccessed = true; - action.Data.Data = CurAssembly; + action.Data.ShortMsg = new("涓婃枡鎴愬姛", ShortMessage.Types.Success); + action.Data.Data = CurAssembly; //action.LocaleMsg = new Locale($"鎵弿鐗╂枡[{item.ItemInfo.ITEM_NAME}({item.ItemInfo.ITEM_CODE})鐨勬潯鐮乕{input.SN}]鎴愬姛锛岃缁х画涓婃枡"); action.LocaleMsg = new Locale("MES.WorkAction.Assembly.LoadSuccess", item.ItemInfo.ITEM_NAME, item.ItemInfo.ITEM_CODE); @@ -252,11 +254,13 @@ } //閮芥病鏈夌墿鏂欓獙璇侀�氳繃锛屽垯杩斿洖閿欒淇℃伅 action.IsSuccessed = false; + action.Data.ShortMsg = new("涓婃枡澶辫触", ShortMessage.Types.Failed); //action.LocaleMsg = new($"鏉$爜[{input.SN}]楠岃瘉澶辫触锛屼笉鏄互涓嬬墿鏂欑殑鏉$爜锛歿string.Join("锛�", CurAssembly.Items.Where(q => !q.IsFinished).Select(q => $"{q.ItemInfo.ITEM_NAME}({q.ItemInfo.ITEM_CODE})"))}"); action.LocaleMsg = new("MES.WorkAction.Assembly.LoadFail", input.SN, string.Join("锛�", CurAssembly.Items.Where(q => !q.IsFinished).Select(q => $"{q.ItemInfo.ITEM_NAME}({q.ItemInfo.ITEM_CODE})"))); } catch (System.Exception ex) { + action.Data.ShortMsg = new("涓婃枡寮傚父", ShortMessage.Types.Exception); action.CatchExceptionWithLog(ex, $"涓婃枡琛屼负锛氶獙璇佹潯鐮乕{input.SN}]骞朵繚瀛樻暟鎹紓甯�"); action.IsSuccessed = false; //action.LocaleMsg = new($"楠岃瘉鏉$爜[{input.SN}]骞朵繚瀛樻暟鎹紓甯革紝宸ュ簭宸查噸缃紝璇烽噸鏂版壂鎻忚繘绔欎骇鍝佹潯鐮�"); @@ -336,6 +340,7 @@ }; IsFinished = true; + action.Data.ShortMsg = new("涓婃枡瀹屾垚", ShortMessage.Types.Success); //action.LocaleMsg = new($"浠ヤ笅鐗╂枡涓婃枡瀹屾垚锛歿string.Join("锛�", CurAssembly.Items.Select(q => $"{q.ItemInfo.ITEM_NAME}({q.ItemInfo.ITEM_CODE})"))}"); action.LocaleMsg = new("MES.WorkAction.Assembly.LoadFinish", string.Join("锛�", CurAssembly.Items.Select(q => $"{q.ItemInfo.ITEM_NAME}({q.ItemInfo.ITEM_CODE})"))); return action; diff --git a/Tiger.Business.MES/WorkAction/IPQC.cs b/Tiger.Business.MES/WorkAction/IPQC.cs index 933ed6e..199d8d4 100644 --- a/Tiger.Business.MES/WorkAction/IPQC.cs +++ b/Tiger.Business.MES/WorkAction/IPQC.cs @@ -60,6 +60,7 @@ //濡傛灉鏍规嵁杈撳叆鍙互寮�濮嬫墽琛屽綋鍓嶈涓哄垯鏍囪涓烘垚鍔燂紝鍚﹀垯澶辫触 action.IsSuccessed = false; + action.Data.ShortMsg = new("鎵撳嵃寮�濮�", ShortMessage.Types.Success); return action; } /// <summary> @@ -85,6 +86,7 @@ //鎻愪氦鏁版嵁鎵ц澶辫触 else { + action.Data.ShortMsg = new("娴嬭瘯澶辫触", ShortMessage.Types.Failed); action.IsSuccessed = false; //action.LocaleMsg = new($"鎵ц澶辫触"); action.LocaleMsg = new("MES.WorkAction.IPQC.Fail"); @@ -163,7 +165,8 @@ }; IsFinished = true; - action.LocaleMsg = new($"琛屼负缁撴潫"); + action.Data.ShortMsg = new("娴嬭瘯瀹屾垚", ShortMessage.Types.Success); + action.LocaleMsg = new($"娴嬭瘯缁撴潫"); //action.LocaleMsg = new("MES.WorkAction.IPQC.Finish"); return action; } diff --git a/Tiger.Business.MES/WorkAction/PackingAction.cs b/Tiger.Business.MES/WorkAction/PackingAction.cs index 4c47c62..88f623c 100644 --- a/Tiger.Business.MES/WorkAction/PackingAction.cs +++ b/Tiger.Business.MES/WorkAction/PackingAction.cs @@ -175,6 +175,7 @@ CurCmd = data; PrintTimes++; action.Data.Data = data; + action.Data.ShortMsg = new("鎵撳嵃鏍囩", ShortMessage.Types.Normal); //action.LocaleMsg = new Locale($"寮�濮嬬{PrintTimes}娆℃墦鍗扮{min.PKG_LEVEL}灞傚寘瑁匸{min.PkgType.PKG_NAME}]鐨勬爣绛綶{LabelDic[min.PKG_LEVEL]?.LABEL_CODE}: {LabelDic[min.PKG_LEVEL].LABEL_NAME}]"); action.LocaleMsg = new Locale("MES.WorkAction.PackingAction.BeginPrint", PrintTimes, min.PKG_LEVEL, min.PkgType.PKG_NAME, LabelDic[min.PKG_LEVEL]?.LABEL_CODE, LabelDic[min.PKG_LEVEL].LABEL_NAME); } @@ -203,6 +204,7 @@ if (!pInput.IsFinish || pInput.PkgSN.IsNullOrEmpty()) { var dtl = PkgRule.Details.First(q => q.PKG_LEVEL == pInput.PkgLevel); + action.Data.ShortMsg = new("鎵弿閿欒", ShortMessage.Types.Error); action.IsSuccessed = false; //action.LocaleMsg = new($"鏉$爜鎵弿澶辫触锛岃閲嶆柊鎵弿绗瑊dtl.PKG_LEVEL}灞傚寘瑁匸{dtl.PkgType.PKG_NAME}]鐨勬爣绛炬潯鐮�"); action.LocaleMsg = new("MES.WorkAction.PackingAction.ScanFail", dtl.PKG_LEVEL, dtl.PkgType.PKG_NAME); @@ -212,6 +214,7 @@ if (GetPackageList(CurPkg.Item).Any(q => q.SN == pInput.PkgSN)) { var dtl = PkgRule.Details.First(q => q.PKG_LEVEL == pInput.PkgLevel); + action.Data.ShortMsg = new("鎵弿閿欒", ShortMessage.Types.Error); action.IsSuccessed = false; //action.LocaleMsg = new($"鏉$爜[{pInput.PkgSN}]鏃犻渶閲嶅鎵弿锛岃鎵弿绗瑊dtl.PKG_LEVEL}灞傚寘瑁匸{dtl.PkgType.PKG_NAME}]鐨勬爣绛炬潯鐮�"); action.LocaleMsg = new("MES.WorkAction.PackingAction.ScanRepeat", pInput.PkgSN, dtl.PKG_LEVEL, dtl.PkgType.PKG_NAME); @@ -221,6 +224,10 @@ CurCmd = null; PrintTimes = 0; action = SavePkgData(input, action); + if (action.IsSuccessed) + { + action.Data.ShortMsg = new("鎵弿鎴愬姛", ShortMessage.Types.Success); + } } break; //Print锛氭墦鍗帮紝鎵撳嵃褰撳墠鍖呰灞傜骇鐨勬爣绛� @@ -238,6 +245,7 @@ data.PkgLevel = dtl.PKG_LEVEL; CurCmd = data; action.Data.Data = data; + action.Data.ShortMsg = new("鎵弿鏍囩", ShortMessage.Types.Normal); //action.LocaleMsg = new($"璇锋壂鎻忕{dtl.PKG_LEVEL}灞傚寘瑁匸{dtl.PkgType.PKG_NAME}]鐨勬爣绛炬潯鐮�"); action.LocaleMsg = new("MES.WorkAction.PackingAction.PleaseScanLabel", dtl.PKG_LEVEL, dtl.PkgType.PKG_NAME); } @@ -249,6 +257,7 @@ { PrintTimes++; action.Data.Data = CurCmd; + action.Data.ShortMsg = new("閲嶆柊鎵撳嵃", ShortMessage.Types.Normal); //action.LocaleMsg = new Locale($"寮�濮媨PrintTimes}娆℃墦鍗扮{dtl.PKG_LEVEL}灞傚寘瑁匸{dtl.PkgType.PKG_NAME}]鐨勬爣绛綶{LabelDic[dtl.PKG_LEVEL]?.LABEL_CODE}: {LabelDic[dtl.PKG_LEVEL].LABEL_NAME}]"); action.LocaleMsg = new Locale("MES.WorkAction.PackingAction.BeginPrint", PrintTimes, dtl.PKG_LEVEL, dtl.PkgType.PKG_NAME, LabelDic[dtl.PKG_LEVEL]?.LABEL_CODE, LabelDic[dtl.PKG_LEVEL].LABEL_NAME); } @@ -256,6 +265,7 @@ { CurCmd = null; PrintTimes = 0; + action.Data.ShortMsg = new("鎵撳嵃澶辫触", ShortMessage.Types.Failed); action.IsSuccessed = false; //action.LocaleMsg = new($"灏濊瘯绗瑊PrintTimes}娆℃墦鍗扮{dtl.PKG_LEVEL}灞傚寘瑁匸{dtl.PkgType.PKG_NAME}]鐨勬爣绛綶{LabelDic[dtl.PKG_LEVEL]?.LABEL_CODE}: {LabelDic[dtl.PKG_LEVEL].LABEL_NAME}]澶辫触锛屽伐搴忓凡閲嶇疆锛岃閲嶆柊鎵弿杩涚珯浜у搧鏉$爜"); action.LocaleMsg = new("MES.WorkAction.PackingAction.PrintFail3Times", PrintTimes, dtl.PKG_LEVEL, dtl.PkgType.PKG_NAME, LabelDic[dtl.PKG_LEVEL]?.LABEL_CODE, LabelDic[dtl.PKG_LEVEL].LABEL_NAME); @@ -277,6 +287,7 @@ data.PkgLevel = CurPkgItem.PKG_LEVEL; CurCmd = data; action.Data.Data = data; + action.Data.ShortMsg = new("鍖呰鎴愬姛", ShortMessage.Types.Success); //action.LocaleMsg = new($"璇锋妸鍖呰[{CurPkgItem.Package.SN}]涓婄О绉伴噸"); action.LocaleMsg = new("MES.WorkAction.PackingAction.PleaseWeighing", CurPkgItem.Package.SN); } @@ -301,6 +312,7 @@ else { action.IsSuccessed = false; + action.Data.ShortMsg = new("绉伴噸澶辫触", ShortMessage.Types.Failed); //action.LocaleMsg = new($"鍖呰[{CurPkgItem.Package.SN}]绉伴噸鏁版嵁寮傚父锛岃閲嶆柊涓婄О绉伴噸"); action.LocaleMsg = new("MES.WorkAction.PackingAction.PleaseWeighingAgain", CurPkgItem.Package.SN); return action; @@ -331,6 +343,7 @@ data.PkgLevel = dtl.PKG_LEVEL; CurCmd = data; action.Data.Data = data; + action.Data.ShortMsg = new("鎵弿鏍囩", ShortMessage.Types.Normal); //action.LocaleMsg = new($"璇锋壂鎻忕{dtl.PKG_LEVEL}灞傚寘瑁匸{dtl.PkgType.PKG_NAME}]鐨勬爣绛炬潯鐮�"); action.LocaleMsg = new("MES.WorkAction.PackingAction.PleaseScanLabel", dtl.PKG_LEVEL, dtl.PkgType.PKG_NAME); } @@ -346,6 +359,7 @@ CurCmd = data; PrintTimes++; action.Data.Data = data; + action.Data.ShortMsg = new("鎵撳嵃鏍囩", ShortMessage.Types.Normal); //action.LocaleMsg = new Locale($"寮�濮嬬{PrintTimes}娆℃墦鍗扮{min.PKG_LEVEL}灞傚寘瑁匸{min.PkgType.PKG_NAME}]鐨勬爣绛綶{LabelDic[min.PKG_LEVEL]?.LABEL_CODE}: {LabelDic[min.PKG_LEVEL].LABEL_NAME}]"); action.LocaleMsg = new Locale("MES.WorkAction.PackingAction.BeginPrint", PrintTimes, dtl.PKG_LEVEL, dtl.PkgType.PKG_NAME, LabelDic[dtl.PKG_LEVEL]?.LABEL_CODE, LabelDic[dtl.PKG_LEVEL].LABEL_NAME); } @@ -522,6 +536,7 @@ //鏁版嵁寮傚父 else { + action.Data.ShortMsg = new("鍖呰閿欒", ShortMessage.Types.Error); var pdtl = PkgRule.Details.First(q => q.PKG_LEVEL == pInput.PkgLevel); action.IsSuccessed = false; //action.LocaleMsg = new($"瀹㈡埛绔彁浜ょ殑鍖呰灞傜骇[{pdtl.PKG_LEVEL}]({pdtl.PkgType.PKG_NAME})鏁版嵁涓嶆槸姝e湪澶勭悊鐨勫寘瑁呭眰绾{dtl.PKG_LEVEL}]({dtl.PkgType.PKG_NAME})锛屽伐搴忓凡閲嶇疆锛岃閲嶆柊鎵弿杩涚珯浜у搧鏉$爜"); @@ -532,6 +547,7 @@ } catch (System.Exception ex) { + action.Data.ShortMsg = new("鍖呰寮傚父", ShortMessage.Types.Exception); var dtl = PkgRule.Details.First(q => q.PKG_LEVEL == pInput.PkgLevel); action.CatchExceptionWithLog(ex, $"鍖呰琛屼负锛氭壂鎻忕{dtl.PKG_LEVEL}灞傚寘瑁匸{dtl.PkgType.PKG_NAME}]鐨勬爣绛炬潯鐮乕{input.SN}]鍚庝繚瀛樻暟鎹け璐�"); action.IsSuccessed = false; @@ -562,6 +578,7 @@ data.PkgLevel = CurPkg.Item.PKG_LEVEL; CurCmd = data; action.Data.Data = data; + action.Data.ShortMsg = new("淇濆瓨鍖呰鏁版嵁", ShortMessage.Types.Normal); //action.LocaleMsg = new($"绗瑊CurPkg.Item.PKG_LEVEL}灞傚寘瑁匸{CurPkg.Item.PKG_NAME}]宸茬粡鍏ㄩ儴瀹屾垚锛屼繚瀛樺寘瑁呮暟鎹�"); action.LocaleMsg = new("MES.WorkAction.PackingAction.PackageComplete", CurPkg.Item.PKG_LEVEL, CurPkg.Item.PKG_NAME); @@ -685,8 +702,9 @@ } IsFinished = true; - action.LocaleMsg = new($"浜у搧鏉$爜[{CurPosition.CurSN}]鍖呰瀹屾垚"); - action.LocaleMsg = new("MES.WorkAction.PackingAction.PackingSuccess", CurPosition.CurSN); + action.Data.ShortMsg = new("鍖呰瀹屾垚", ShortMessage.Types.Success); + action.LocaleMsg = new($"鏉$爜[{CurPkg.Item.Package.SN}]鍖呰瀹屾垚"); + action.LocaleMsg = new("MES.WorkAction.PackingAction.PackingSuccess", CurPkg.Item.Package.SN); return action; } diff --git a/Tiger.Business.MES/WorkAction/PrintLabel.cs b/Tiger.Business.MES/WorkAction/PrintLabel.cs index 85234b9..a3f2941 100644 --- a/Tiger.Business.MES/WorkAction/PrintLabel.cs +++ b/Tiger.Business.MES/WorkAction/PrintLabel.cs @@ -69,6 +69,7 @@ //濡傛灉杩斿洖鎴愬姛鍒欒涓哄綋鍓嶈涓哄彲浠ュ紑濮嬫墽琛岋紝鍚﹀垯杩斿洖澶辫触 action.IsSuccessed = true; + action.Data.ShortMsg = new("鎵撳嵃寮�濮�", ShortMessage.Types.Success); return action; } @@ -87,6 +88,7 @@ //鎻愪氦鏁版嵁鎵ц澶辫触 else { + action.Data.ShortMsg = new("鎵撳嵃澶辫触", ShortMessage.Types.Failed); action.IsSuccessed = false; //action.LocaleMsg = new($"鏍囩{Label.LABEL_NAME}[{Label.LABEL_CODE}]鎵撳嵃澶辫触", Label.LABEL_NAME); action.LocaleMsg = new("MES.WorkAction.PrintLabel.PrintFail", Label.LABEL_NAME, Label.LABEL_CODE); @@ -161,6 +163,7 @@ }; IsFinished = true; + action.Data.ShortMsg = new("鎵撳嵃瀹屾垚", ShortMessage.Types.Success); //action.LocaleMsg = new($"鏍囩{Label.LABEL_NAME}[{Label.LABEL_CODE}]鎵撳嵃鎴愬姛", Label.LABEL_NAME); action.LocaleMsg = new("MES.WorkAction.PrintLabel.PrintSuccess", Label.LABEL_NAME, Label.LABEL_CODE); return action; diff --git a/Tiger.Business.MES/WorkAction/Weighing.cs b/Tiger.Business.MES/WorkAction/Weighing.cs index 0fbb9b3..73be11e 100644 --- a/Tiger.Business.MES/WorkAction/Weighing.cs +++ b/Tiger.Business.MES/WorkAction/Weighing.cs @@ -84,6 +84,7 @@ //濡傛灉杩斿洖鎴愬姛鍒欒涓哄綋鍓嶈涓哄彲浠ュ紑濮嬫墽琛岋紝鍚﹀垯杩斿洖澶辫触 action.IsSuccessed = true; + action.Data.ShortMsg = new("绉伴噸寮�濮�", ShortMessage.Types.Success); return action; } @@ -122,6 +123,7 @@ } catch (System.Exception ex) { + action.Data.ShortMsg = new("绉伴噸寮傚父", ShortMessage.Types.Error); action.CatchExceptionWithLog(ex, $"绉伴噸琛屼负锛氭潯鐮乕{CurPosition.CurSN}]绉伴噸鏁版嵁[{input?.Data.ToString()}]淇濆瓨寮傚父"); action.LocaleMsg = new("MES.WorkAction.Weighing.SaveWeightInfoException", CurPosition.CurSN, input?.Data.ToString()); } @@ -191,6 +193,7 @@ }; IsFinished = true; + action.Data.ShortMsg = new("绉伴噸瀹屾垚", ShortMessage.Types.Success); //action.LocaleMsg = new($"鏉$爜[{CurPosition.CurSN}]绉伴噸鏁版嵁[{CurPkg.WEIGHT} {CurPkg.WEIGHT_UNIT}]淇濆瓨鎴愬姛"); action.LocaleMsg = new("MES.WorkAction.Weighing.SaveSuccess", CurPosition.CurSN, CurPkg.WEIGHT, CurPkg.WEIGHT_UNIT); return action; diff --git a/Tiger.Business.MES/WorkAction/WipExtInfo.cs b/Tiger.Business.MES/WorkAction/WipExtInfo.cs index 7f445e4..14a059c 100644 --- a/Tiger.Business.MES/WorkAction/WipExtInfo.cs +++ b/Tiger.Business.MES/WorkAction/WipExtInfo.cs @@ -83,6 +83,7 @@ //濡傛灉杩斿洖鎴愬姛鍒欒涓哄綋鍓嶈涓哄彲浠ュ紑濮嬫墽琛岋紝鍚﹀垯杩斿洖澶辫触 action.IsSuccessed = true; + action.Data.ShortMsg = new("缁戝畾寮�濮�", ShortMessage.Types.Success); return action; } @@ -115,12 +116,14 @@ //楠岃瘉鎵弿鐨勬潯鐮佹槸鍚N鐨勬墿灞曚俊鎭殑鏍囩 if (input.SN.IsNullOrEmpty()) { + action.Data.ShortMsg = new("缁戝畾澶辫触", ShortMessage.Types.Failed); action.IsSuccessed = isOK = false; //action.LocaleMsg = new Locale($"閿欒锛歔{ExtInfo.FIELD_NAME}]鏍囩鏉$爜涓嶈兘涓虹┖锛岃閲嶆柊鎵弿"); action.LocaleMsg = new Locale("MES.WorkAction.WipExtInfo.SnEmptyError", ExtInfo.FIELD_NAME); } if (CurPosition.CurWipSNs.Any(w => w.SN == input.SN)) { + action.Data.ShortMsg = new("缁戝畾澶辫触", ShortMessage.Types.Failed); action.IsSuccessed = isOK = false; //action.LocaleMsg = new Locale($"閿欒锛氭壂鎻忓埌浜у搧鏉$爜[{input.SN}]锛岃閲嶆柊鎵弿[{ExtInfo.FIELD_NAME}]鏍囩鏉$爜"); action.LocaleMsg = new Locale("MES.WorkAction.WipExtInfo.ScanProdSnError", input.SN, ExtInfo.FIELD_NAME); @@ -137,6 +140,7 @@ } catch (System.Exception ex) { + action.Data.ShortMsg = new("缁戝畾寮傚父", ShortMessage.Types.Exception); action.CatchExceptionWithLog(ex, $"鎵╁睍淇℃伅缁戝畾琛屼负锛氫骇鍝乕{CurPosition.CurSN}]缁戝畾[{ExtInfo.FIELD_NAME}]鏍囩鏉$爜[{input.SN}]淇濆瓨寮傚父"); action.IsSuccessed = false; //action.LocaleMsg = new($"浜у搧[{CurPosition.CurWipSN.SN}]缁戝畾[{ExtInfo.FIELD_NAME}]鏍囩鏉$爜[{input.SN}]淇濆瓨寮傚父锛屽伐搴忓凡閲嶇疆锛岃閲嶆柊鎵弿杩涚珯浜у搧鏉$爜"); @@ -210,6 +214,7 @@ }; IsFinished = true; + action.Data.ShortMsg = new("缁戝畾瀹屾垚", ShortMessage.Types.Success); //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.CurSN, ExtInfo.FIELD_NAME, CurWipExt.GetType().GetProperty($"FIELD_{ExtInfo.SEQ.ToString("00")}")?.GetValue(CurWipExt)?.ToString()); return action; diff --git a/Tiger.Business/MES/WoContext.cs b/Tiger.Business/MES/WoContext.cs index afd8333..78b28b5 100644 --- a/Tiger.Business/MES/WoContext.cs +++ b/Tiger.Business/MES/WoContext.cs @@ -4,6 +4,7 @@ using System; using System.Collections.Generic; using System.Linq; +using System.Net.WebSockets; using System.Text; using System.Threading.Tasks; using Tiger.IBusiness; @@ -148,7 +149,71 @@ catch (Exception ex) { //action.CatchExceptionWithLog(ex, $"鑾峰彇鏉$爜[{sn}]鐨勪笅涓�涓伐搴忚妭鐐瑰垪琛ㄥ紓甯�"); - action.CatchExceptionWithLog(ex, Biz.L("MES.WoContext.GetSnNextNodesException")); + action.CatchExceptionWithLog(ex, Biz.L("MES.WoContext.GetSnNextNodesException", sn)); + } + return action; + } + + /// <summary> + /// 璁剧疆褰撳墠鏉$爜鐨勫伐搴忎俊鎭� + /// </summary> + public static ApiAction<OperInfo> GetSnOperInfo(string sn) + { + var action = new ApiAction<OperInfo>(new OperInfo()); + try + { + var wipSNs = Biz.Db.Queryable<MES_WIP_DATA>().IncludesAllFirstLayer().Where(q => (q.SN == sn || q.FLOW_SN == sn || q.TRAY_SN == sn || q.INNER_SN == sn || q.CARTON_SN == sn || q.PALLET_SN == sn)).ToList(); + if (wipSNs.IsNullOrEmpty()) + { + var woSNs = Biz.Db.Queryable<BIZ_MES_WO_SN>().Where(q => (q.SN == sn || q.TRAY_SN == sn || q.OUTER_SN == sn)).ToList(); + //鏌ユ壘鍒版潯鐮佸凡缁戝畾鐨勫伐鍗� + if (!woSNs.IsNullOrEmpty()) + { + foreach (var woSN in woSNs) + { + var wipSN = new MES_WIP_DATA() + { + SN = sn, + FLOW_SN = sn, + STATUS = MES_WIP_DATA.STATUSs.Init.GetValue(), + ITEM_CODE = woSN.ITEM_CODE, + WORK_ORDER = woSN.WORK_ORDER, + BATCH_NO = woSN.BATCH_NO, + HOLD_FLAG = "N", + FINISHED_FLAG = "N", + INV_FLAG = "N", + DFT_FLAG = "N", + DFT_COUNT = 0, + }; + wipSNs.Add(wipSN); + } + } + } + if (wipSNs.IsNullOrEmpty()) + { + action.IsSuccessed = false; + //action.LocaleMsg = new($"鎵句笉鍒版潯鐮乕{sn}]鐨勭敓浜т俊鎭�", sn); + action.LocaleMsg = new("MES.WoContext.SnNotFound", sn); + } + else + { + if (!WoBatchDic.Any(q => q.Value.WO.ORDER_NO == wipSNs.First().WORK_ORDER)) + { + var wb = new WorkBatch(wipSNs.First().WORK_ORDER).Init(""); + WoBatchDic.Add(wb.Batch.BATCH_NO, wb); + } + var wo = WoBatchDic.FirstOrDefault(q => q.Value.WO.ORDER_NO == wipSNs.First().WORK_ORDER).Value; + action.Data = new() + { + CurNode = wipSNs.First().NODE_NAME, + NextNode = string.Join(",", wo.GetNextNodes(wipSNs.First()).Select(q => q.NODE_NAME)), + }; + } + } + catch (Exception ex) + { + //action.CatchExceptionWithLog(ex, $"鑾峰彇鏉$爜[{sn}]鐨勫伐搴忎俊鎭紓甯�"); + action.CatchExceptionWithLog(ex, Biz.L("MES.WoContext.GetSnOperInfoException", sn)); } return action; } diff --git a/Tiger.Model.Net/Entitys/Api/Base.cs b/Tiger.Model.Net/Entitys/Api/Base.cs index 19c437f..8bc7b9b 100644 --- a/Tiger.Model.Net/Entitys/Api/Base.cs +++ b/Tiger.Model.Net/Entitys/Api/Base.cs @@ -27,6 +27,12 @@ public class ShortMessage { + public ShortMessage(string msg, Types type) + { + Content = msg; + Type = type; + } + public string Content { get; set; } public Types Type { get; set; } diff --git a/Tiger.Model.Net/Entitys/MES/ParameterEntity/PositionParameter.cs b/Tiger.Model.Net/Entitys/MES/ParameterEntity/PositionParameter.cs index fb7cf93..c81ac27 100644 --- a/Tiger.Model.Net/Entitys/MES/ParameterEntity/PositionParameter.cs +++ b/Tiger.Model.Net/Entitys/MES/ParameterEntity/PositionParameter.cs @@ -235,8 +235,8 @@ /// </summary> public class OperInfo { - public string NextNode { get; set; } - public string CurNode { get; set; } - public int InputQty { get; set; } + public string NextNode { get; set; } = " 鈥� "; + public string CurNode { get; set; } = " 鈥� "; + public int InputQty { get; set; } = 0; } } -- Gitblit v1.9.3