From 0fdd0687f116ac43f7432227dfaa2ebc2f696575 Mon Sep 17 00:00:00 2001 From: Rodney Chen <rodney.chen@hotmail.com> Date: 星期日, 04 八月 2024 17:21:11 +0800 Subject: [PATCH] 增加扩展信息绑定工序 --- Tiger.Api/Controllers/Test/TestController.R.cs | 6 Tiger.Api/Language.db | 0 Tiger.Business.MES/Transaction/CollectNode.cs | 18 +++ Tiger.Business.MES/WorkAction/Assembly.cs | 7 Tiger.Business.MES/Transaction/PackingNode.cs | 33 ++++-- Tiger.Business.MES/WorkAction/PackingAction.cs | 14 ++ Tiger.Business.MES/WorkAction/WipExtInfo.cs | 185 +++++++++--------------------------- Tiger.Business.MES/Transaction/TestNode.cs | 19 +++ 8 files changed, 115 insertions(+), 167 deletions(-) diff --git a/Tiger.Api/Controllers/Test/TestController.R.cs b/Tiger.Api/Controllers/Test/TestController.R.cs index 7a4eedf..e4a11ff 100644 --- a/Tiger.Api/Controllers/Test/TestController.R.cs +++ b/Tiger.Api/Controllers/Test/TestController.R.cs @@ -325,8 +325,10 @@ { var data = action.Data.Data; - data?.ToString().JsonToObject<PackingActionInput>(); - var result = JsonConvert.DeserializeObject<PackingActionInput>(data?.ToString() ?? ""); + var act = Biz.Db.Queryable<MES_WO_ACTION>().First(q => q.ID == data); + + + var result = act.OPTION_1?.ToString().JsonToObject<List<WipPkgItem>>(); return Ok(result?.ToJson()); } diff --git a/Tiger.Api/Language.db b/Tiger.Api/Language.db index ced73f7..a2c30e8 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 070f91b..3088aa4 100644 --- a/Tiger.Business.MES/Transaction/CollectNode.cs +++ b/Tiger.Business.MES/Transaction/CollectNode.cs @@ -151,7 +151,8 @@ } catch (Exception ex) { - action.CatchExceptionWithLog(ex, $"閲囬泦宸ュ簭锛氭彁浜ゆ搷浣滄暟鎹紓甯�"); + //action.CatchExceptionWithLog(ex, $"閲囬泦宸ュ簭锛氭彁浜ゆ搷浣滄暟鎹紓甯�"); + action.CatchExceptionWithLog(ex, Biz.L("MES.Transaction.CollectNode.SubmitException")); } return action; } @@ -164,9 +165,9 @@ /// <returns></returns> public ApiAction<SubmitOutput> NodeSubmit(ApiAction<SubmitOutput> action, SubmitInput input) { + var curNode = CurBatch.GetNode(PostCode); try { - var curNode = CurBatch.GetNode(PostCode); //鍒ゆ柇宸ュ崟瀹炴椂鐘舵�佸垽鏂槸鍚﹀彲浠ョ敓浜� var woStatus = CurBatch.CheckCanProduce(curNode); if (!woStatus.IsSuccessed) @@ -291,7 +292,16 @@ //鏈夐渶瑕佺敤鎴锋彁浜や俊鎭垯娣诲姞宸ュ簭鑺傜偣鐨勫叾浠栧伐姝� //鏈�鍚庢坊鍔犲綋鍓嶅伐搴忕殑琛屼负宸ユ - GenerateSteps(curStep); + try + { + GenerateSteps(curStep); + } + catch (System.Exception ex) + { + ResetNode(); + //action.CatchExceptionWithLog(ex, $"{curNode.NODE_NAME}锛氬伐搴忚涓哄伐姝ョ敓鎴愬紓甯革紝璇锋鏌ュ伐搴忚涓鸿缃�"); + action.CatchExceptionWithLog(ex, Biz.L("MES.Transaction.CollectNode.NodeSubmit.GenerateStepsException", curNode.NODE_NAME)); + } //瀹屾垚绗竴涓伐搴忚妭鐐瑰伐姝� curStep.IsFinished = true; @@ -349,6 +359,8 @@ { ResetNode(); action.CatchExceptionWithLog(ex, $"閲囬泦宸ュ簭锛氬伐搴忚妭鐐瑰伐姝ユ彁浜ゆ暟鎹紓甯�"); + //action.CatchExceptionWithLog(ex, $"{curNode.NODE_NAME}锛氬伐搴忚妭鐐瑰伐姝ユ彁浜ゆ暟鎹紓甯革紝璇锋鏌ュ伐搴忚妭鐐硅缃�"); + action.CatchExceptionWithLog(ex, Biz.L("MES.Transaction.CollectNode.NodeSubmitException", curNode.NODE_NAME)); } return action; } diff --git a/Tiger.Business.MES/Transaction/PackingNode.cs b/Tiger.Business.MES/Transaction/PackingNode.cs index 5a3b770..6a65b6c 100644 --- a/Tiger.Business.MES/Transaction/PackingNode.cs +++ b/Tiger.Business.MES/Transaction/PackingNode.cs @@ -175,7 +175,8 @@ } catch (Exception ex) { - action.CatchExceptionWithLog(ex, $"鍖呰宸ュ簭锛氭彁浜ゆ搷浣滄暟鎹紓甯�"); + //action.CatchExceptionWithLog(ex, $"鍖呰宸ュ簭锛氭彁浜ゆ搷浣滄暟鎹紓甯�"); + action.CatchExceptionWithLog(ex, Biz.L("MES.Transaction.PackingNode.SubmitException")); } return action; } @@ -188,9 +189,9 @@ /// <returns></returns> public ApiAction<SubmitOutput> NodeSubmit(ApiAction<SubmitOutput> action, SubmitInput input) { + var curNode = CurBatch.GetNode(PostCode); try { - var curNode = CurBatch.GetNode(PostCode); //鍒ゆ柇宸ュ崟瀹炴椂鐘舵�佸垽鏂槸鍚﹀彲浠ョ敓浜� var woStatus = CurBatch.CheckCanProduce(curNode); if (!woStatus.IsSuccessed) @@ -311,14 +312,23 @@ } }; Steps.Add(curStep); - - //鏈夐渶瑕佺敤鎴锋彁浜や俊鎭垯娣诲姞宸ュ簭鑺傜偣鐨勫叾浠栧伐姝� - - //鏈�鍚庢坊鍔犲綋鍓嶅伐搴忕殑琛屼负宸ユ - GenerateSteps(curStep); - - //瀹屾垚绗竴涓伐搴忚妭鐐瑰伐姝� - curStep.IsFinished = true; + + //鏈夐渶瑕佺敤鎴锋彁浜や俊鎭垯娣诲姞宸ュ簭鑺傜偣鐨勫叾浠栧伐姝� + + //鏈�鍚庢坊鍔犲綋鍓嶅伐搴忕殑琛屼负宸ユ + try + { + GenerateSteps(curStep); + } + catch (System.Exception ex) + { + ResetNode(); + //action.CatchExceptionWithLog(ex, $"{curNode.NODE_NAME}锛氬伐搴忚涓哄伐姝ョ敓鎴愬紓甯革紝璇锋鏌ュ伐搴忚涓鸿缃�"); + action.CatchExceptionWithLog(ex, Biz.L("MES.Transaction.PackingNode.NodeSubmit.GenerateStepsException", curNode.NODE_NAME)); + } + + //瀹屾垚绗竴涓伐搴忚妭鐐瑰伐姝� + curStep.IsFinished = true; CurStep = curStep; } else if (!IsFinishNodeSteps) @@ -372,7 +382,8 @@ catch (Exception ex) { ResetNode(); - action.CatchExceptionWithLog(ex, $"鍖呰宸ュ簭锛氬伐搴忚妭鐐瑰伐姝ユ彁浜ゆ暟鎹紓甯�"); + //action.CatchExceptionWithLog(ex, $"{curNode.NODE_NAME}锛氬伐搴忚妭鐐瑰伐姝ユ彁浜ゆ暟鎹紓甯革紝璇锋鏌ュ伐搴忚妭鐐硅缃�"); + action.CatchExceptionWithLog(ex, Biz.L("MES.Transaction.PackingNode.NodeSubmitException", curNode.NODE_NAME)); } return action; } diff --git a/Tiger.Business.MES/Transaction/TestNode.cs b/Tiger.Business.MES/Transaction/TestNode.cs index 1b72e3d..6d34732 100644 --- a/Tiger.Business.MES/Transaction/TestNode.cs +++ b/Tiger.Business.MES/Transaction/TestNode.cs @@ -152,7 +152,8 @@ } catch (Exception ex) { - action.CatchExceptionWithLog(ex, $"娴嬭瘯宸ュ簭锛氭彁浜ゆ搷浣滄暟鎹紓甯�"); + //action.CatchExceptionWithLog(ex, $"娴嬭瘯宸ュ簭锛氭彁浜ゆ搷浣滄暟鎹紓甯�"); + action.CatchExceptionWithLog(ex, Biz.L("MES.Transaction.TestNode.SubmitException")); } return action; } @@ -165,9 +166,9 @@ /// <returns></returns> public ApiAction<SubmitOutput> NodeSubmit(ApiAction<SubmitOutput> action, SubmitInput input) { + var curNode = CurBatch.GetNode(PostCode); try { - var curNode = CurBatch.GetNode(PostCode); //鍒ゆ柇宸ュ崟瀹炴椂鐘舵�佸垽鏂槸鍚﹀彲浠ョ敓浜� var woStatus = CurBatch.CheckCanProduce(curNode); if (!woStatus.IsSuccessed) @@ -292,7 +293,16 @@ //鏈夐渶瑕佺敤鎴锋彁浜や俊鎭垯娣诲姞宸ュ簭鑺傜偣鐨勫叾浠栧伐姝� //鏈�鍚庢坊鍔犲綋鍓嶅伐搴忕殑琛屼负宸ユ - GenerateSteps(curStep); + try + { + GenerateSteps(curStep); + } + catch (System.Exception ex) + { + ResetNode(); + //action.CatchExceptionWithLog(ex, $"{curNode.NODE_NAME}锛氬伐搴忚涓哄伐姝ョ敓鎴愬紓甯革紝璇锋鏌ュ伐搴忚涓鸿缃�"); + action.CatchExceptionWithLog(ex, Biz.L("MES.Transaction.TestNode.NodeSubmit.GenerateStepsException", curNode.NODE_NAME)); + } //瀹屾垚绗竴涓伐搴忚妭鐐瑰伐姝� curStep.IsFinished = true; @@ -349,7 +359,8 @@ catch (Exception ex) { ResetNode(); - action.CatchExceptionWithLog(ex, $"娴嬭瘯宸ュ簭锛氬伐搴忚妭鐐瑰伐姝ユ彁浜ゆ暟鎹紓甯�"); + //action.CatchExceptionWithLog(ex, $"{curNode.NODE_NAME}锛氬伐搴忚妭鐐瑰伐姝ユ彁浜ゆ暟鎹紓甯革紝璇锋鏌ュ伐搴忚妭鐐硅缃�"); + action.CatchExceptionWithLog(ex, Biz.L("MES.Transaction.TestNode.NodeSubmitException", curNode.NODE_NAME)); } return action; } diff --git a/Tiger.Business.MES/WorkAction/Assembly.cs b/Tiger.Business.MES/WorkAction/Assembly.cs index df50610..d689b68 100644 --- a/Tiger.Business.MES/WorkAction/Assembly.cs +++ b/Tiger.Business.MES/WorkAction/Assembly.cs @@ -3,7 +3,6 @@ using System; using System.Collections.Generic; using System.Linq; -using System.Reflection; using System.Text; using System.Threading.Tasks; using Tiger.IBusiness; @@ -200,7 +199,7 @@ action.IsSuccessed = true; action.Data.Data = CurAssembly; - action.LocaleMsg = new Locale($"鎵弿鐗╂枡[{item.ItemInfo.ITEM_NAME}({item.ItemInfo.ITEM_CODE})鐨勬潯鐮乕{input.SN}]鎴愬姛锛岃缁х画涓婃枡"); + //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); //涓婃枡瀹屾垚 @@ -218,9 +217,9 @@ } catch (System.Exception ex) { - action.CatchExceptionWithLog(ex, $"涓婃枡琛屼负锛氶獙璇佹潯鐮乕{input.SN}]骞朵繚瀛樻暟鎹け璐�"); + action.CatchExceptionWithLog(ex, $"涓婃枡琛屼负锛氶獙璇佹潯鐮乕{input.SN}]骞朵繚瀛樻暟鎹紓甯�"); action.IsSuccessed = false; - action.LocaleMsg = new($"楠岃瘉鏉$爜[{input.SN}]骞朵繚瀛樻暟鎹け璐ワ紝宸ュ簭宸查噸缃紝璇烽噸鏂版壂鎻忚繘绔欎骇鍝佹潯鐮�"); + //action.LocaleMsg = new($"楠岃瘉鏉$爜[{input.SN}]骞朵繚瀛樻暟鎹紓甯革紝宸ュ簭宸查噸缃紝璇烽噸鏂版壂鎻忚繘绔欎骇鍝佹潯鐮�"); action.LocaleMsg = new("MES.WorkAction.Assembly.SaveAssemblyException", input.SN); CurPosition.ResetNode(); } diff --git a/Tiger.Business.MES/WorkAction/PackingAction.cs b/Tiger.Business.MES/WorkAction/PackingAction.cs index da3cebe..2b621c9 100644 --- a/Tiger.Business.MES/WorkAction/PackingAction.cs +++ b/Tiger.Business.MES/WorkAction/PackingAction.cs @@ -56,11 +56,17 @@ PkgRule = Biz.Db.Queryable<BAS_PKG_RULE>().Where(q => q.RULE_CODE == setting.PKG_CODE).IncludesAllFirstLayer().IncludesAllSecondLayer(q => q.Details).First(); } //鏍规嵁琛屼负璁剧疆鑾峰彇澶氬眰鍖呰鐨勬爣绛炬墦鍗版ā鏉垮瓧鍏� - for (int i = 1; i < 10; i++) + //for (int i = 1; i < 10; i++) + //{ + // var code = Setting.GetType().GetProperty($"OPTION_{i}")?.GetValue(Setting)?.ToString() ?? ""; + // var label = code.IsNullOrEmpty() ? null : Biz.Db.Queryable<BAS_LABEL_TEMP>().Where(q => q.LABEL_CODE == code).IncludesAllFirstLayer().First(); + // LabelDic.Add(i, label); + //} + var codes = Setting.OPTION_1?.ToString().JsonToObject<List<WipPkgItem>>(); + foreach (var code in codes) { - var code = Setting.GetType().GetProperty($"OPTION_{i}")?.GetValue(Setting)?.ToString() ?? ""; - var label = code.IsNullOrEmpty() ? null : Biz.Db.Queryable<BAS_LABEL_TEMP>().Where(q => q.LABEL_CODE == code).IncludesAllFirstLayer().First(); - LabelDic.Add(i, label); + var label = code.LABEL_CODE.IsNullOrEmpty() ? null : Biz.Db.Queryable<BAS_LABEL_TEMP>().Where(q => q.LABEL_CODE == code.LABEL_CODE).IncludesAllFirstLayer().First(); + LabelDic.Add(code.PKG_LEVEL, label); } //濡傛灉宸ュ簭涓婁笅鏂囦腑娌℃湁鍖呰璁板綍鍒欐柊寤轰竴涓紝鏈夊垯鑾峰彇褰撳墠鐨勫寘瑁呰褰� if (CurPosition.Context.ContainsKey("CurPackage") && !CurPosition.Context["CurPackage"].IsNullOrEmpty()) diff --git a/Tiger.Business.MES/WorkAction/WipExtInfo.cs b/Tiger.Business.MES/WorkAction/WipExtInfo.cs index 9026560..4587973 100644 --- a/Tiger.Business.MES/WorkAction/WipExtInfo.cs +++ b/Tiger.Business.MES/WorkAction/WipExtInfo.cs @@ -22,9 +22,8 @@ public MES_WO_NODE_ACT NodeAct { get; set; } public MES_WO_ACTION Setting { get; set; } #endregion - public List<BAS_PROD_BOM> Boms { get; set; } = new(); - public Dictionary<string, List<BAS_ITEM>> SubItemDic { get; set; } = new(); - public AssemblyInfo CurAssembly { get; set; } = new(); + public BAS_WIP_EXT ExtInfo { get; set; } + public MES_WIP_EXT CurWipExt { get; set; } #endregion Propertys & Variables #region Functions @@ -41,49 +40,16 @@ Setting = setting; #endregion - //鑾峰彇浜у搧BOM - Boms = Biz.Db.Queryable<BAS_PROD_BOM>().Where(q => q.PROD_CODE == CurPosition.WorkBatch.WO.ITEM_CODE).ToList(); - //鑾峰彇涓婃枡鐗╂枡 - var assyList = new List<AssemblySetting>(); - try + //鑾峰彇鎵╁睍瀛楁瀹氫箟 + 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 () { - assyList = setting.ITEM_CODE.JsonToObject<List<AssemblySetting>>(); - } - catch (System.Exception ex) - { - var codeList = setting.ITEM_CODE.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries); - foreach (var code in codeList) - { - assyList.Add(new() { ItemCode = code }); - } - } - var codes = assyList.Select(q => q.ItemCode).ToList(); - var items = Biz.Db.Queryable<BAS_ITEM>().Where(q => codes.Contains(q.ITEM_CODE) && q.AUTH_ORG == CurPosition.WorkBatch.WO.AUTH_ORG).ToList(); - //鑾峰彇涓婃枡鐗╂枡鐨勬浛浠f枡 - foreach (var assy in assyList) - { - var info = items.FirstOrDefault(q => q.ITEM_CODE == assy.ItemCode); - if (!info.IsNullOrEmpty()) - { - var item = new AssemblyItem - { - ItemInfo = info, - RuleCode = assy.RuleCode, - LoadQty = assy.Qty, - }; - var bom = Boms.FirstOrDefault(q => q.ITEM_CODE == assy.ItemCode); - if (!bom.IsNullOrEmpty()) - { - var subs = bom.SUB_CODE.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries); - var surItems = Biz.Db.Queryable<BAS_ITEM>().Where(q => subs.Contains(q.ITEM_CODE) && q.AUTH_ORG == CurPosition.WorkBatch.WO.AUTH_ORG).ToList(); - if (!SubItemDic.ContainsKey(assy.ItemCode)) - { - SubItemDic.Add(assy.ItemCode, surItems); - } - } - CurAssembly.Items.Add(item); - } - } + AUTH_ORG = CurPosition.CurWipSN.AUTH_ORG, + AUTH_PROD = CurPosition.CurWipSN.AUTH_PROD, + SN = CurPosition.CurWipSN.SN, + }; } /// <summary> @@ -92,8 +58,8 @@ /// <returns></returns> public Locale GetBeginMsg() { - var msg = new Locale("MES.WorkAction.WipExtInfo.BeginMsg", string.Join("锛�", CurAssembly.Items.Select(q => $"{q.ItemInfo.ITEM_NAME}({q.ItemInfo.ITEM_CODE})"))); - //var msg = new Locale($"璇锋壂鎻忎互涓嬮渶瑕佷笂鏂欑殑鐗╂枡鏉$爜锛歿string.Join("锛�", CurAssembly.Items.Select(q => $"{q.ItemInfo.ITEM_NAME}({q.ItemInfo.ITEM_CODE})"))}"); + var msg = new Locale("MES.WorkAction.WipExtInfo.BeginMsg", ExtInfo.FIELD_NAME); + //var msg = new Locale($"璇锋壂鎻忎骇鍝乕{CurPosition.CurWipSN.SN}]闇�瑕佺粦瀹氱殑[{ExtInfo.FIELD_NAME}]鏍囩鏉$爜"); return msg; } @@ -105,14 +71,10 @@ { var action = new ApiAction<SubmitOutput>(new SubmitOutput()); - if (input.SN != CurPosition.CurWipSN.SN) - { - action = SaveAssembly(input, action); - return action; - } + action.LocaleMsg = GetBeginMsg(); //濡傛灉杩斿洖鎴愬姛鍒欒涓哄綋鍓嶈涓哄彲浠ュ紑濮嬫墽琛岋紝鍚﹀垯杩斿洖澶辫触 - action.IsSuccessed = false; + action.IsSuccessed = true; return action; } @@ -124,7 +86,7 @@ { var action = new ApiAction<SubmitOutput>(new SubmitOutput()); - action = SaveAssembly(input, action); + action = SaveExtInfo(input, action); //涓婃枡鏁版嵁淇濆瓨澶辫触 if (!action.IsSuccessed) { @@ -137,91 +99,41 @@ return action; } - public ApiAction<SubmitOutput> SaveAssembly(SubmitInput input, ApiAction<SubmitOutput> action) + public ApiAction<SubmitOutput> SaveExtInfo(SubmitInput input, ApiAction<SubmitOutput> action) { try { - foreach (var item in CurAssembly.Items.Where(q => !q.IsFinished)) + var isOK = true; + //楠岃瘉鎵弿鐨勬潯鐮佹槸鍚N鐨勬墿灞曚俊鎭殑鏍囩 + if (input.SN.IsNullOrEmpty()) { - var isOK = true; - //鏍规嵁鏉$爜瑙勫垯楠岃瘉涓婃枡鏄惁姝g‘ - if (!item.RuleCode.IsNullOrEmpty()) - { - if (!Biz.CodeRule[item.RuleCode].IsNullOrEmpty()) - { - var result = Biz.CodeRule[item.RuleCode].Verify(input.SN); - if (!result.IsSuccessed) - { - isOK = false; - } - } - //涓嶅瓨鍦ㄦ潯鐮佽鍒欙紝鍒欏垽鏂槸鍚︽湁鑷畾涔夎鍒欙紝娌℃湁鍒欒繑鍥炲け璐� - else - { - switch (item.RuleCode) - { - case "鑷楠岃瘉": - break; - default: - isOK = false; - break; - } - } - } - //楠岃瘉閫氳繃鍒欎繚瀛樹笂鏂欎俊鎭� - if (isOK) - { - 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.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) - { - item.IsFinished = true; - } - - action.IsSuccessed = true; - action.Data.Data = CurAssembly; - action.LocaleMsg = new Locale($"鎵弿鐗╂枡[{item.ItemInfo.ITEM_NAME}({item.ItemInfo.ITEM_CODE})鐨勬潯鐮乕{input.SN}]鎴愬姛锛岃缁х画涓婃枡"); - action.LocaleMsg = new Locale("MES.WorkAction.WipExtInfo.LoadSuccess", item.ItemInfo.ITEM_NAME, item.ItemInfo.ITEM_CODE); - - //涓婃枡瀹屾垚 - if (CurAssembly.IsFinished) - { - action = End(); - } - return action; - } + action.IsSuccessed = isOK = false; + //action.LocaleMsg = new Locale($"閿欒锛歔{ExtInfo.FIELD_NAME}]鏍囩鏉$爜涓嶈兘涓虹┖锛岃閲嶆柊鎵弿"); + action.LocaleMsg = new Locale("MES.WorkAction.WipExtInfo.SnEmptyError", ExtInfo.FIELD_NAME); } + if (input.SN == CurPosition.CurWipSN.SN) + { + 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); + } + + //楠岃瘉閫氳繃鍒欎繚瀛樹笂鏂欎俊鎭� + if (isOK) + { + CurWipExt.GetType().GetProperty($"FIELD_{ExtInfo.SEQ.ToString("00")}")?.SetValue(CurWipExt, input.SN); + action = End(); + } + //閮芥病鏈夌墿鏂欓獙璇侀�氳繃锛屽垯杩斿洖閿欒淇℃伅 - action.IsSuccessed = false; - //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.WipExtInfo.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.CatchExceptionWithLog(ex, $"涓婃枡琛屼负锛氶獙璇佹潯鐮乕{input.SN}]骞朵繚瀛樻暟鎹け璐�"); + action.CatchExceptionWithLog(ex, $"鎵╁睍淇℃伅缁戝畾琛屼负锛氫骇鍝乕{CurPosition.CurWipSN.SN}]缁戝畾[{ExtInfo.FIELD_NAME}]鏍囩鏉$爜[{input.SN}]淇濆瓨寮傚父"); action.IsSuccessed = false; - action.LocaleMsg = new($"楠岃瘉鏉$爜[{input.SN}]骞朵繚瀛樻暟鎹け璐ワ紝宸ュ簭宸查噸缃紝璇烽噸鏂版壂鎻忚繘绔欎骇鍝佹潯鐮�"); - action.LocaleMsg = new("MES.WorkAction.WipExtInfo.SaveAssemblyException", input.SN); + //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); CurPosition.ResetNode(); } return action; @@ -264,27 +176,22 @@ PRD_CODE = CurPosition.CurWipSN.PRD_CODE, ACT_TYPE = NodeAct.ACT_TYPE, ACT_SN = CurPosition.CurWipSN.SN, - ACT_VALUE_1 = CurAssembly.ToJson(), + ACT_VALUE_1 = CurWipExt.ToJson(), ACT_RESULT = "Y", - TRACE_INFO = $"浠ヤ笅鐗╂枡涓婃枡瀹屾垚锛歿string.Join(",", CurAssembly.Items.Select(q => $"{q.ItemInfo.ITEM_NAME}({q.ItemInfo.ITEM_CODE})"))}", + TRACE_INFO = $"浜у搧[{CurPosition.CurWipSN.SN}]缁戝畾[{ExtInfo.FIELD_NAME}]鏍囩鏉$爜[{CurWipExt.GetType().GetProperty($"FIELD_{ExtInfo.SEQ.ToString("00")}")?.GetValue(CurWipExt)?.ToString()}]淇濆瓨鎴愬姛", }; - var records = new List<MES_WIP_ASSY>(); - foreach (var item in CurAssembly.Items) - { - records.AddRange(item.Records); - } //淇濆瓨鏁版嵁 CurStep.DBSubmitAction = () => { var db = CurPosition.GetCommitDB(); db.Storageable(wipAct, CurPosition.UserCode).ExecuteCommand(); - db.Insertable(records, CurPosition.UserCode).ExecuteCommand(); + db.Storageable(CurWipExt, CurPosition.UserCode).ExecuteCommand(); }; IsFinished = true; - //action.LocaleMsg = new($"浠ヤ笅鐗╂枡涓婃枡瀹屾垚锛歿string.Join("锛�", CurAssembly.Items.Select(q => $"{q.ItemInfo.ITEM_NAME}({q.ItemInfo.ITEM_CODE})"))}"); - action.LocaleMsg = new("MES.WorkAction.WipExtInfo.LoadFinish", string.Join("锛�", CurAssembly.Items.Select(q => $"{q.ItemInfo.ITEM_NAME}({q.ItemInfo.ITEM_CODE})"))); + //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()); return action; } -- Gitblit v1.9.3