From 7e0299298399c566b81b1ab786881998c746d228 Mon Sep 17 00:00:00 2001 From: Rodney Chen <rodney.chen@hotmail.com> Date: 星期三, 26 三月 2025 20:57:12 +0800 Subject: [PATCH] 优化了一些已知问题 --- Tiger.Business.WMS/Transaction/Yada/In_BIZ_U9_RECEIPT.cs | 75 ++++++++++++++++++++++--------------- 1 files changed, 45 insertions(+), 30 deletions(-) diff --git a/Tiger.Business.WMS/Transaction/Yada/In_BIZ_U9_RECEIPT.cs b/Tiger.Business.WMS/Transaction/Yada/In_BIZ_U9_RECEIPT.cs index 01088ed..05a5f3e 100644 --- a/Tiger.Business.WMS/Transaction/Yada/In_BIZ_U9_RECEIPT.cs +++ b/Tiger.Business.WMS/Transaction/Yada/In_BIZ_U9_RECEIPT.cs @@ -82,13 +82,13 @@ { //瑙f瀽鏉$爜 Result<IInventory> result = WMS_ITEM_Biz.WmsItem.Get(input.SN, input.AuthOption, true); - if (!result.IsSuccessed) - { - action.IsSuccessed = false; - action.LocaleMsg = result.LocaleMsg; - return SetOutPutMqttMsg(action, input.Locale); - } - var inv = result.Data as Inventory; + if (!result.IsSuccessed) + { + action.IsSuccessed = false; + action.LocaleMsg = result.LocaleMsg; + return SetOutPutMqttMsg(action, input.Locale); + } + var inv = result.Data as Inventory; //楠岃瘉鏉$爜鏄惁姝g‘ if (!inv.isNormalStatus || inv.Status != WMS_ITEM.STATUSs.WaitIn) @@ -219,49 +219,59 @@ } //鏇存柊鍗曟嵁淇℃伅 - foreach(var sn in receiptSn) + foreach (var sn in receiptSn) { sn.STATUS = WMS_ITEM.STATUSs.InStore.GetValue(); sn.IS_IN = "Y"; } //濡傛灉褰撳墠琛屼笂鏋跺畬鎴愭爣璁颁负寰呭鏍� - receiptDtl.QTY_IN = receipt.SnList.Where(q => q.LINE_NO == receiptDtl.LINE_NO && q.STATUS == WMS_ITEM.STATUSs.InStore.GetValue()).Sum(q => q.QTY); + Action approveAction = null; + receiptDtl.QTY_IN = receipt.SnList.Where(q => q.LINE_NO == receiptDtl.LINE_NO && q.STATUS == WMS_ITEM.STATUSs.InStore.GetValue()).Sum(q => q.QTY); if (receiptDtl.QTY_IN == receiptDtl.QTY_OK) { receiptDtl.STATUS = BIZ_U9_RECEIPT.STATUSs.Review.GetValue(); //褰撳墠鍗曟嵁鏄庣粏宸茬粡鍏ㄩ儴涓婃灦瀹屾垚锛屽彲浠ヨ皟鐢║9琛屽鎺ュ彛 - var iInput = new SubmitLineInput + approveAction = () => { - userId = UserCode, - IsLogin = true, - param = new() + var iInput = new SubmitLineInput { - RcvLineID = receiptDtl.ID, - RcvDocNo = receiptDtl.ORDER_NO, - DocLineNo = receiptDtl.LINE_NO, - OrgCode = receiptDtl.AUTH_ORG, + userId = UserCode, + IsLogin = true, + param = new() + { + RcvLineID = receiptDtl.ID, + RcvDocNo = receiptDtl.ORDER_NO, + DocLineNo = receiptDtl.LINE_NO, + OrgCode = receiptDtl.AUTH_ORG, + } + }; + var result = DI.Resolve<IWMS_U9C>().ReceivementApproveLine(iInput).Result; + if (!result.IsSuccessed) + { + throw new Exception(Biz.T(result.LocaleMsg, input.Locale)); + } + else + { + //鏇存柊鍗曟嵁淇℃伅 + MainDB.Updateable<BIZ_U9_RECEIPT_DTL>().SetColumns(q => q.STATUS == BIZ_U9_RECEIPT.STATUSs.Finished.GetValue()).Where(q => q.ID == receiptDtl.ID).ExecuteCommand(); + if (!MainDB.Queryable<BIZ_U9_RECEIPT_DTL>().Any(q => q.STATUS < BIZ_U9_RECEIPT.STATUSs.Finished.GetValue() && q.ORDER_NO == receipt.ORDER_NO)) + { + MainDB.Updateable<BIZ_U9_RECEIPT>().SetColumns(q => q.STATUS == BIZ_U9_RECEIPT.STATUSs.Finished.GetValue()).Where(q => q.ID == receipt.ID).ExecuteCommand(); + } } }; - var result = await DI.Resolve<IWMS_U9C>().ReceivementApproveLine(iInput); - if (!result.IsSuccessed) - { - action.IsSuccessed = false; - action.LocaleMsg = result.LocaleMsg; - return SetOutPutMqttMsg(action, input.Locale); - } } else { receiptDtl.STATUS = BIZ_U9_RECEIPT.STATUSs.Storing.GetValue(); } - var dtlStatus = receipt.Details.Select(q => q.STATUS).Distinct(); - if (dtlStatus.Count() == 1 && dtlStatus.First() == BIZ_U9_RECEIPT.STATUSs.Review.GetValue()) + if (receipt.Details.Any(q => q.STATUS < BIZ_U9_RECEIPT.STATUSs.Review.GetValue())) { - receipt.STATUS = BIZ_U9_RECEIPT.STATUSs.Review.GetValue(); + receipt.STATUS = BIZ_U9_RECEIPT.STATUSs.Storing.GetValue(); } else { - receipt.STATUS = BIZ_U9_RECEIPT.STATUSs.Storing.GetValue(); + receipt.STATUS = BIZ_U9_RECEIPT.STATUSs.Review.GetValue(); } //鍒涘缓鍙橀噺鍏嬮殕瀵硅薄鐢ㄤ簬浼犲叆DBSubmitAction涓繚瀛樺綋鍓嶉渶瑕佹殏瀛樼殑鏁版嵁鍊� @@ -277,7 +287,7 @@ }); //瀹屾垚鎵�鏈夊鐞嗗悗浣跨敤浜嬪姟淇濆瓨鏁版嵁 - action = DoIfFinish(action, input.Locale); + action = DoIfFinish(action, input.Locale, approveAction); } catch (Exception ex) { @@ -384,12 +394,17 @@ /// 瀹屾垚鎵�鏈夊鐞嗗悗浣跨敤浜嬪姟淇濆瓨鏁版嵁 /// </summary> /// <param name="action"></param> + /// <param name="locale"></param> + /// <param name="doAfterSave"></param> /// <returns></returns> - public ApiAction<ScanOutput> DoIfFinish(ApiAction<ScanOutput> action, string locale) + public ApiAction<ScanOutput> DoIfFinish(ApiAction<ScanOutput> action, string locale, Action doAfterSave = null) { //淇濆瓨鏁版嵁搴� SaveCommitListToDB(); + //淇濆瓨鏁版嵁鎴愬姛鍚庢墽琛� + doAfterSave?.Invoke(); + // 杩斿洖鏁版嵁 action.Data.Data = new DefaultInStoreOutput { -- Gitblit v1.9.3