From 76e5a482a1be93af036ff6d75d367c7401810682 Mon Sep 17 00:00:00 2001 From: Rodney Chen <rodney.chen@hotmail.com> Date: 星期一, 14 十月 2024 17:04:27 +0800 Subject: [PATCH] 增加雅达生产报工行为(缺报工逻辑) --- Tiger.Business.MES/WorkAction/ThreeInOne.cs | 6 +- Tiger.Business.MES/WorkAction/YadaWoReport.cs | 64 ++++++++++--------------------- Tiger.Api/Language.db | 0 3 files changed, 24 insertions(+), 46 deletions(-) diff --git a/Tiger.Api/Language.db b/Tiger.Api/Language.db index 66d63da..97b853c 100644 --- a/Tiger.Api/Language.db +++ b/Tiger.Api/Language.db Binary files differ diff --git a/Tiger.Business.MES/WorkAction/ThreeInOne.cs b/Tiger.Business.MES/WorkAction/ThreeInOne.cs index b2ca033..50afc1d 100644 --- a/Tiger.Business.MES/WorkAction/ThreeInOne.cs +++ b/Tiger.Business.MES/WorkAction/ThreeInOne.cs @@ -268,7 +268,7 @@ var isOK = true; //瀹㈡埛鏉$爜宸茬粦瀹氬叾浠栧巶鍐呮潯鐮� - if (!CustCSN.IsNullOrEmpty() && !CustCSN.FLOW_SN.IsNullOrEmpty() && CustCSN.FLOW_SN != FlowCSN.FLOW_SN) + if (isOK && !CustCSN.IsNullOrEmpty() && !CustCSN.FLOW_SN.IsNullOrEmpty() && CustCSN.FLOW_SN != FlowCSN.FLOW_SN) { CurStep.SetStatusMessage(StepStatus.Error, Biz.L("璇锋壂鎻忔纭殑瀹㈡埛鏍囩")); action.Data.ShortMsg = new("璇锋壂鎻忔纭殑瀹㈡埛鏍囩", ShortMessage.Types.Failed); @@ -277,7 +277,7 @@ action.LocaleMsg = new("MES.WorkAction.ThreeInOne.BindingOtherSN", CurPosition.CurWipSNs.First().SN, CustCSN.CUST_SN, CustCSN.FLOW_SN); } //瀹㈡埛鏉$爜涓嶅睘浜庡綋鍓嶅伐鍗曠殑瀹㈡埛 - if (!CustCSN.IsNullOrEmpty() && CustCSN.CUST_CODE.IsNullOrEmpty(CurPosition.WorkBatch.WO.CUST_CODE) != CurPosition.WorkBatch.WO.CUST_CODE) + if (isOK && !CustCSN.IsNullOrEmpty() && CustCSN.CUST_CODE.IsNullOrEmpty(CurPosition.WorkBatch.WO.CUST_CODE) != CurPosition.WorkBatch.WO.CUST_CODE) { CurStep.SetStatusMessage(StepStatus.Error, Biz.L("璇锋壂鎻忔纭殑瀹㈡埛鏍囩")); action.Data.ShortMsg = new("璇锋壂鎻忔纭殑瀹㈡埛鏍囩", ShortMessage.Types.Failed); @@ -286,7 +286,7 @@ action.LocaleMsg = new("MES.WorkAction.ThreeInOne.NotSameCustomer", CustCSN.CUST_SN, CustCSN.CUST_CODE, CurPosition.WorkBatch.WO.CUST_CODE); } //楠岃瘉浜у搧瀹㈡埛鏍囩鏉$爜瑙勫垯 - if (!CustInfo.IsNullOrEmpty() && !CustInfo.RULE_CODE.IsNullOrEmpty() && !Biz.CodeRule[CustInfo.RULE_CODE].IsNullOrEmpty()) + if (isOK && !CustInfo.IsNullOrEmpty() && !CustInfo.RULE_CODE.IsNullOrEmpty() && !Biz.CodeRule[CustInfo.RULE_CODE].IsNullOrEmpty()) { var result = Biz.CodeRule[CustInfo.RULE_CODE].Verify(CustCSN.CUST_SN); if (!result.IsSuccessed) diff --git a/Tiger.Business.MES/WorkAction/YadaWoReport.cs b/Tiger.Business.MES/WorkAction/YadaWoReport.cs index 912ffc9..4e6da83 100644 --- a/Tiger.Business.MES/WorkAction/YadaWoReport.cs +++ b/Tiger.Business.MES/WorkAction/YadaWoReport.cs @@ -22,7 +22,7 @@ public MES_WO_NODE_ACT NodeAct { get; set; } public MES_WO_ACTION Setting { get; set; } #endregion - private MES_WIP_PKG CurPkg; + #endregion Propertys & Variables #region Functions @@ -39,29 +39,9 @@ Setting = setting; #endregion - CurPkg = Biz.Db.Queryable<MES_WIP_PKG>().Where(q => q.SN == CurPosition.CurSN && q.AUTH_ORG == CurPosition.WorkBatch.WO.AUTH_ORG).First() ?? new() - { - AUTH_ORG = CurPosition.WorkBatch.WO.AUTH_ORG, - AUTH_PROD = CurPosition.CurLine.LINE_CODE, - SN = CurPosition.CurSN, - PKG_TYPE = CurPosition.WorkBatch.WO.ItemInfo?.UNIT, - ITEM_CODE = CurPosition.CurWipSNs.First().ITEM_CODE, - QTY = CurPosition.CurWipSNs.Sum(q => q.QTY), - UNIT = CurPosition.WorkBatch.WO.ItemInfo?.UNIT, - WORK_ORDER = CurPosition.CurWipSNs.First().WORK_ORDER, - BATCH_NO = CurPosition.CurWipSNs.First().BATCH_NO, - ROT_CODE = CurPosition.CurWipSNs.First().ROT_CODE, - NODE_ID = CurPosition.CurWipSNs.First().NODE_ID, - NODE_NAME = CurPosition.CurWipSNs.First().NODE_NAME, - FTY_CODE = CurPosition.CurWipSNs.First().FTY_CODE, - WS_CODE = CurPosition.CurWipSNs.First().WS_CODE, - LINE_CODE = CurPosition.CurWipSNs.First().LINE_CODE, - POST_CODE = CurPosition.CurWipSNs.First().POST_CODE, - OPER_CODE = CurPosition.CurWipSNs.First().OPER_CODE, - SEGMENT = CurPosition.CurWipSNs.First().SEGMENT, - }; + - CurStep.Message = Biz.L("绛夊緟绉伴噸鏁版嵁"); + CurStep.Message = Biz.L("鐢熶骇鎶ュ伐"); CurStep.Status = StepStatus.Normal; } @@ -71,8 +51,8 @@ /// <returns></returns> public Locale GetBeginMsg() { - var msg = new Locale("MES.WorkAction.Weighing.BeginMsg", CurPosition.CurSN); - //var msg = new Locale($"璇锋妸浜у搧[{CurPosition.CurSN}]涓婄О绉伴噸"); + var msg = new Locale("MES.WorkAction.YadaWoReport.BeginMsg", CurPosition.WorkBatch.WO.ORDER_NO); + //var msg = new Locale($"宸ュ崟[{0}]鐢熶骇鎶ュ伐"); return msg; } @@ -87,10 +67,10 @@ action.LocaleMsg = GetBeginMsg(); //濡傛灉杩斿洖鎴愬姛鍒欒涓哄綋鍓嶈涓哄彲浠ュ紑濮嬫墽琛岋紝鍚﹀垯杩斿洖澶辫触 - CurStep.Message = Biz.L("绉伴噸寮�濮�"); + CurStep.Message = Biz.L("寮�濮嬬敓浜ф姤宸�"); CurStep.Status = StepStatus.Normal; action.IsSuccessed = true; - action.Data.ShortMsg = new("绉伴噸寮�濮�", ShortMessage.Types.Success); + action.Data.ShortMsg = new("寮�濮嬬敓浜ф姤宸�", ShortMessage.Types.Success); return action; } @@ -102,7 +82,7 @@ { var action = new ApiAction<SubmitOutput>(new SubmitOutput()); - action = SaveWeightInfo(input, action); + action = ReportToERP(input, action); //涓婃枡鏁版嵁淇濆瓨澶辫触 if (!action.IsSuccessed) { @@ -119,21 +99,20 @@ return action; } - public ApiAction<SubmitOutput> SaveWeightInfo(SubmitInput input, ApiAction<SubmitOutput> action) + public ApiAction<SubmitOutput> ReportToERP(SubmitInput input, ApiAction<SubmitOutput> action) { try { - var wInput = input?.Data?.JsonToObject<WeightInfo>(); - CurPkg.WEIGHT = wInput.Weight; - CurPkg.WEIGHT_UNIT = wInput.Unit; + + } catch (System.Exception ex) { - CurStep.Message = Biz.L("绉伴噸寮傚父"); + CurStep.Message = Biz.L("鐢熶骇鎶ュ伐寮傚父"); CurStep.Status = StepStatus.Error; - 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()); + action.Data.ShortMsg = new("鐢熶骇鎶ュ伐寮傚父", ShortMessage.Types.Error); + action.CatchExceptionWithLog(ex, $"鐢熶骇鎶ュ伐琛屼负锛氬伐鍗昜{CurPosition.WorkBatch.WO.ORDER_NO}]鐢熶骇鎶ュ伐寮傚父"); + action.LocaleMsg = new("MES.WorkAction.YadaWoReport.ReportToERPException", CurPosition.WorkBatch.WO.ORDER_NO); } return action; } @@ -184,29 +163,28 @@ ACT_TYPE = NodeAct.ACT_TYPE, ACT_SN = wipSn.SN, ACT_RESULT = "Y", + ACT_VALUE_1 = "鎶ュ叕鏁版嵁", ELAPSED_TIME = CurStep.GetElapsedTime().TotalMilliseconds.ToInt64(), - TRACE_INFO = $"鏉$爜[{CurPosition.CurSN}]绉伴噸鏁版嵁[{CurPkg.WEIGHT} {CurPkg.WEIGHT_UNIT}]淇濆瓨鎴愬姛", + TRACE_INFO = $"宸ュ崟[{CurPosition.WorkBatch.WO.ORDER_NO}]鐢熶骇鎶ュ伐鎴愬姛", }; wipActs.Add(wipAct); } //鍒涘缓鍙橀噺鍏嬮殕瀵硅薄鐢ㄤ簬浼犲叆DBSubmitAction涓繚瀛樺綋鍓嶉渶瑕佹殏瀛樼殑鏁版嵁鍊� var _wipActs = wipActs.Clone(); - var _CurPkg = CurPkg.Clone(); //淇濆瓨鏁版嵁 CurStep.DBSubmitAction = () => { var db = CurPosition.GetCommitDB(); db.Storageable(_wipActs, CurPosition.UserCode).ExecuteCommand(); - db.Storageable(_CurPkg, CurPosition.UserCode).ExecuteCommand(); }; IsFinished = true; - CurStep.Message = Biz.L("绉伴噸瀹屾垚"); + CurStep.Message = Biz.L("鐢熶骇鎶ュ伐瀹屾垚"); CurStep.Status = StepStatus.Finished; - 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); + action.Data.ShortMsg = new("鐢熶骇鎶ュ伐瀹屾垚", ShortMessage.Types.Success); + //action.LocaleMsg = new($"宸ュ崟[{0}]鐢熶骇鎶ュ伐鎴愬姛"); + action.LocaleMsg = new("MES.WorkAction.YadaWoReport.SaveSuccess", CurPosition.WorkBatch.WO.ORDER_NO); return action; } -- Gitblit v1.9.3