From 0fdb04b7c451d7c59b226c25425722afd3364916 Mon Sep 17 00:00:00 2001 From: Rodney Chen <rodney.chen@hotmail.com> Date: 星期三, 25 九月 2024 16:37:52 +0800 Subject: [PATCH] 优化工序和行为逻辑 --- Tiger.Business.MES/WorkAction/WipExtInfo.cs | 37 ++++++++++++++++++++++++++++++++----- 1 files changed, 32 insertions(+), 5 deletions(-) diff --git a/Tiger.Business.MES/WorkAction/WipExtInfo.cs b/Tiger.Business.MES/WorkAction/WipExtInfo.cs index dbed0c1..6f3aa22 100644 --- a/Tiger.Business.MES/WorkAction/WipExtInfo.cs +++ b/Tiger.Business.MES/WorkAction/WipExtInfo.cs @@ -54,9 +54,13 @@ AUTH_ORG = wipSN.AUTH_ORG, AUTH_PROD = wipSN.AUTH_PROD, SN = wipSN.SN, + WIP_ID = wipSN.ID, }); } } + + CurStep.Message = Biz.L("鎵弿瑕佺粦瀹氱殑鏍囩"); + CurStep.Status = StepStatus.Normal; } /// <summary> @@ -81,7 +85,10 @@ action.LocaleMsg = GetBeginMsg(); //濡傛灉杩斿洖鎴愬姛鍒欒涓哄綋鍓嶈涓哄彲浠ュ紑濮嬫墽琛岋紝鍚﹀垯杩斿洖澶辫触 + CurStep.Message = Biz.L("缁戝畾寮�濮�"); + CurStep.Status = StepStatus.Normal; action.IsSuccessed = true; + action.Data.ShortMsg = new("缁戝畾寮�濮�", ShortMessage.Types.Success); return action; } @@ -114,12 +121,18 @@ //楠岃瘉鎵弿鐨勬潯鐮佹槸鍚N鐨勬墿灞曚俊鎭殑鏍囩 if (input.SN.IsNullOrEmpty()) { + CurStep.Message = Biz.L("缁戝畾澶辫触"); + CurStep.Status = StepStatus.Error; + 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)) { + CurStep.Message = Biz.L("缁戝畾澶辫触"); + CurStep.Status = StepStatus.Error; + 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); @@ -129,14 +142,16 @@ if (isOK) { CurWipExt.GetType().GetProperty($"FIELD_{ExtInfo.SEQ.ToString("00")}")?.SetValue(CurWipExt, input.SN); - action = End(); + action = End(input); } //閮芥病鏈夌墿鏂欓獙璇侀�氳繃锛屽垯杩斿洖閿欒淇℃伅 - } catch (System.Exception ex) { + CurStep.Message = Biz.L("缁戝畾寮傚父"); + CurStep.Status = StepStatus.Error; + 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}]淇濆瓨寮傚父锛屽伐搴忓凡閲嶇疆锛岃閲嶆柊鎵弿杩涚珯浜у搧鏉$爜"); @@ -150,7 +165,7 @@ /// 缁撴潫鎵ц宸ュ簭琛屼负 /// </summary> /// <returns></returns> - public ApiAction<SubmitOutput> End() + public ApiAction<SubmitOutput> End(SubmitInput input) { var action = new ApiAction<SubmitOutput>(new SubmitOutput()); @@ -162,6 +177,7 @@ { AUTH_ORG = CurPosition.WorkBatch.WO.AUTH_ORG, AUTH_PROD = CurPosition.CurLine.LINE_CODE, + WIP_ID = wipSn.ID, HIS_ID = CurPosition.CurWipSNHiss.First(q => q.SN == wipSn.SN).ID, SN = wipSn.SN, STATUS = wipSn.STATUS, @@ -179,7 +195,11 @@ POST_CODE = wipSn.POST_CODE, OPER_CODE = wipSn.OPER_CODE, SEGMENT = wipSn.SEGMENT, + FLOW_SN = wipSn.FLOW_SN, TRAY_SN = wipSn.TRAY_SN, + INNER_SN = wipSn.INNER_SN, + CARTON_SN = wipSn.CARTON_SN, + PALLET_SN = wipSn.PALLET_SN, OPERATION_TIME = DateTime.Now, SFTS_CODE = wipSn.SFTS_CODE, SFT_CODE = wipSn.SFT_CODE, @@ -188,20 +208,27 @@ ACT_SN = wipSn.SN, ACT_VALUE_1 = CurWipExt.ToJson(), ACT_RESULT = "Y", + ELAPSED_TIME = CurStep.GetElapsedTime().TotalMilliseconds.ToInt64(), TRACE_INFO = $"浜у搧[{CurPosition.CurSN}]缁戝畾[{ExtInfo.FIELD_NAME}]鏍囩鏉$爜[{CurWipExt.GetType().GetProperty($"FIELD_{ExtInfo.SEQ.ToString("00")}")?.GetValue(CurWipExt)?.ToString()}]淇濆瓨鎴愬姛", }; wipActs.Add(wipAct); } + //鍒涘缓鍙橀噺鍏嬮殕瀵硅薄鐢ㄤ簬浼犲叆DBSubmitAction涓繚瀛樺綋鍓嶉渶瑕佹殏瀛樼殑鏁版嵁鍊� + var _wipActs = wipActs.Clone(); + var _CurWipExt = CurWipExt.Clone(); //淇濆瓨鏁版嵁 CurStep.DBSubmitAction = () => { var db = CurPosition.GetCommitDB(); - db.Storageable(wipActs, CurPosition.UserCode).ExecuteCommand(); - db.Storageable(CurWipExt, CurPosition.UserCode).ExecuteCommand(); + db.Storageable(_wipActs, CurPosition.UserCode).ExecuteCommand(); + db.Storageable(_CurWipExt, CurPosition.UserCode).ExecuteCommand(); }; IsFinished = true; + CurStep.Message = Biz.L("缁戝畾瀹屾垚"); + CurStep.Status = StepStatus.Finished; + 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; -- Gitblit v1.9.3