From 1d61b45846ac2e5cb0a8366365613c44c1319289 Mon Sep 17 00:00:00 2001 From: Rodney Chen <rodney.chen@hotmail.com> Date: 星期三, 26 三月 2025 18:06:17 +0800 Subject: [PATCH] 优化收货单上架行数量判断 --- Tiger.Business.WMS/Transaction/Yada/In_BIZ_U9_RECEIPT.cs | 62 ++++++++++++++++++++++-------- 1 files changed, 45 insertions(+), 17 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 657daea..b8cd9af 100644 --- a/Tiger.Business.WMS/Transaction/Yada/In_BIZ_U9_RECEIPT.cs +++ b/Tiger.Business.WMS/Transaction/Yada/In_BIZ_U9_RECEIPT.cs @@ -11,6 +11,8 @@ using Tiger.IBusiness; using Tiger.Model.Sharetronic.Shelf; using Tiger.Business.WMS.Sharetronic.Shelf; +using Tiger.Model.Entitys.MES.U9C; +using Tiger.Model.MES.Yada; namespace Tiger.Business.WMS.Transaction { @@ -84,7 +86,7 @@ { action.IsSuccessed = false; action.LocaleMsg = result.LocaleMsg; - return action; + return SetOutPutMqttMsg(action, input.Locale); } var inv = result.Data as Inventory; @@ -94,7 +96,7 @@ action.IsSuccessed = false; //action.LocaleMsg = Biz.L("鐘舵�乕{0}]寮傚父锛岃閲嶆柊鎵弿"); action.LocaleMsg = Biz.L("WMS.Default.ScanItem.StatusException", string.Join(',', inv.StatusList.Select(q => q.GetDesc()))); - return action; + return SetOutPutMqttMsg(action, input.Locale); } //鐗╂枡楠岃瘉 if (inv.ItemInfo.IsNullOrEmpty() || inv.ItemInfo.IS_ACTIVE == "N") @@ -102,7 +104,7 @@ action.IsSuccessed = false; //action.LocaleMsg = Biz.L("鐗╂枡缂栫爜[{0}]涓嶅瓨鍦ㄦ垨鑰呰鐗╂枡鏈惎鐢�"); action.LocaleMsg = Biz.L("WMS.Default.ScanItem.ItemCodeNotExistsOrNotActive", inv.ItemInfo.ITEM_CODE.IsNullOrEmpty(inv.Barcode.ItemCode)); - return action; + return SetOutPutMqttMsg(action, input.Locale); } CurInvItem = inv; } @@ -113,7 +115,7 @@ action.IsSuccessed = false; //action.LocaleMsg = Biz.L("鏀惰揣鍗曚腑鎵句笉鍒版潯鐮佹墍灞炵殑鍗曟嵁[{0}]淇℃伅锛岃閲嶆柊鎵弿鏀惰揣鍗曠殑鏉$爜鎴栭�夋嫨姝g‘鐨勫姛鑳戒笂鏋�"); action.LocaleMsg = Biz.L("WMS.In_BIZ_U9_RECEIPT.ScanItem.ReceiptNotExists", CurInvItem.Items.First().TRANS_NO); - return action; + return SetOutPutMqttMsg(action, input.Locale); } var receiptDtl = receipt.Details.First(q => q.LINE_NO == CurInvItem.Items.First().TRANS_LINE); if (receiptDtl.STATUS > BIZ_U9_RECEIPT.STATUSs.Storing.GetValue()) @@ -121,7 +123,7 @@ action.IsSuccessed = false; //action.LocaleMsg = Biz.L("鏀惰揣鍗曚腑琛孾{0}]鐘舵�乕{1}]寮傚父锛岃鎵弿姝g‘鐨勬潯鐮�"); action.LocaleMsg = Biz.L("WMS.In_BIZ_U9_RECEIPT.ScanItem.ReceiptDtlStatusException", receiptDtl.LINE_NO, receiptDtl.STATUS.GetEnumDesc<BIZ_U9_RECEIPT.STATUSs>()); - return action; + return SetOutPutMqttMsg(action, input.Locale); } var receiptSn = receipt.SnList.Where(q => CurInvItem.Items.Any(i => i.SN == q.SN)).ToList(); if (receiptSn.Any(q => q.STATUS != WMS_ITEM.STATUSs.WaitIn.GetValue())) @@ -129,7 +131,14 @@ action.IsSuccessed = false; //action.LocaleMsg = Biz.L("鏀惰揣鍗曚腑鏉$爜[{0}]鐘舵�乕{1}]寮傚父锛岃鎵弿姝g‘鐨勬潯鐮�"); action.LocaleMsg = Biz.L("WMS.In_BIZ_U9_RECEIPT.ScanItem.ReceiptSnStatusException", CurInvItem.SN, receiptSn.First(q => q.STATUS != WMS_ITEM.STATUSs.WaitIn.GetValue()).STATUS.GetEnumDesc<WMS_ITEM.STATUSs>()); - return action; + return SetOutPutMqttMsg(action, input.Locale); + } + //浠嶶9鑾峰彇鏀惰揣鍗曡淇℃伅 + var u9Dtl = Biz.DataSource["YadaU9C"].Client.Queryable<mes_ReturnedDocInfo>().Where(x => x.RcvLineId == receiptDtl.ID.ToDouble()).First(); + if (!u9Dtl.IsNullOrEmpty() && u9Dtl.RcvQtyTU != receiptDtl.QTY_OK) + { + receiptDtl.QTY_OK = u9Dtl.RcvQtyTU; + receiptDtl.QTY_NG = receiptDtl.QTY - receiptDtl.QTY_OK; } var nLocation = new WMS_LOCATION(); @@ -141,7 +150,7 @@ { action.IsSuccessed = false; action.LocaleMsg = Biz.L(shelfApiResult.GetData<string>()); - return action; + return SetOutPutMqttMsg(action, input.Locale); } var reaultShelf = shelfApiResult.GetData<ShelfChangeModel>(); @@ -151,7 +160,7 @@ action.IsSuccessed = false; //action.LocaleMsg = Biz.L($"璐ф灦[{0}]涓笉瀛樺湪id涓篬{1}]鐨勫偍浣嶏紝璇峰厛缁存姢璐ф灦淇℃伅"); action.LocaleMsg = Biz.L("WMS.Default.ScanItem.LocationNotExistsInShelf", CurScanShelf.Shelf.SHELF_CODE, reaultShelf.ledAddr); - return action; + return SetOutPutMqttMsg(action, input.Locale); } var locationData = MainDB.Queryable<WMS_ITEM>().Where(q => q.LOCATION_ID == nLocation.ID).First(); if (!locationData.IsNullOrEmpty()) @@ -159,7 +168,7 @@ action.IsSuccessed = false; //action.LocaleMsg = Biz.L("鍌ㄤ綅[{0}]宸插瓨鏈夌墿鏂橻{1}]锛岃妫�鏌ョ郴缁熷簱瀛樹俊鎭�"); action.LocaleMsg = Biz.L($"WMS.Default.ScanShelf.ItemAlreadyExistsInLocation", nLocation.LOCATION_CODE, locationData.SN); - return action; + return SetOutPutMqttMsg(action, input.Locale); } CurScanShelf.LocationCode = nLocation.LOCATION_CODE; } @@ -170,7 +179,7 @@ action.IsSuccessed = false; //action.LocaleMsg = Biz.L("璇疯緭鍏ユ垨鎵弿鏈夋晥鐨勮揣鏋�/鍌ㄤ綅鐮�"); action.LocaleMsg = Biz.L("WMS.Default.ScanShelf.ShelfCanNotEmpty"); - return action; + return SetOutPutMqttMsg(action, input.Locale); } nLocation = await MainDB.Queryable<WMS_LOCATION>().Where(t => t.LOCATION_CODE == CurScanShelf.LocationCode && t.AUTH_ORG == OrgCode).FirstAsync(); @@ -183,7 +192,7 @@ //action.LocaleMsg = Biz.L("鍌ㄤ綅[{0}]鍙兘瀛樻斁涓�涓墿鏂�"); action.LocaleMsg = Biz.L("WMS.Default.ScanItem.LocationSingleFailure", nLocation.LOCATION_CODE); ResetScan(); - return action; + return SetOutPutMqttMsg(action, input.Locale); } //鎵ц涓婃灦鏁版嵁澶勭悊 @@ -205,7 +214,7 @@ action.IsSuccessed = false; action.LocaleMsg = putonResult.LocaleMsg; ResetScan(); - return action; + return SetOutPutMqttMsg(action, input.Locale); } //鏇存柊鍗曟嵁淇℃伅 @@ -215,11 +224,30 @@ sn.IS_IN = "Y"; } //濡傛灉褰撳墠琛屼笂鏋跺畬鎴愭爣璁颁负寰呭鏍� - receiptDtl.QTY_IN = receipt.SnList.Where(q => q.LINE_NO == receiptDtl.LINE_NO).Sum(q => q.QTY); - if (receiptDtl.QTY_IN == receiptDtl.QTY) + 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 + { + userId = UserCode, + IsLogin = true, + param = new() + { + RcvLineID = receiptDtl.ID, + RcvDocNo = receiptDtl.ORDER_NO, + DocLineNo = receiptDtl.LINE_NO, + OrgCode = receiptDtl.AUTH_ORG, + } + }; + 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 { @@ -243,7 +271,7 @@ var db = GetCommitDB(); //鏁版嵁淇濆瓨閫昏緫 db.Updateable(receipt, UserCode).UpdateColumns(q => new { q.STATUS, q.UPDATE_TIME, q.UPDATE_USER }).ExecuteCommand(); - db.Updateable(receiptDtl, UserCode).UpdateColumns(q => new { q.STATUS, q.QTY_IN, q.UPDATE_TIME, q.UPDATE_USER }).ExecuteCommand(); + db.Updateable(receiptDtl, UserCode).UpdateColumns(q => new { q.STATUS, q.QTY_IN, q.QTY_OK, q.QTY_NG, q.UPDATE_TIME, q.UPDATE_USER }).ExecuteCommand(); db.Updateable(receiptSn, UserCode).UpdateColumns(q => new { q.STATUS, q.IS_IN, q.UPDATE_TIME, q.UPDATE_USER }).ExecuteCommand(); }); @@ -257,7 +285,7 @@ //action.CatchExceptionWithLog(ex, $"鎵弿鏉$爜[{input.SN}]澶嶆牳寮傚父"); action.CatchExceptionWithLog(ex, Biz.L("WMS.Default.ScanItem.ScanException", input.SN)); } - return action; + return SetOutPutMqttMsg(action, input.Locale); } /// <summary> @@ -381,7 +409,7 @@ //閲嶇疆宸ュ簭 ResetScanInfo(); - return action; + return SetOutPutMqttMsg(action, locale); } #endregion -- Gitblit v1.9.3