From c6342a8eb6d2c40e9a21deab63b5babb3def3025 Mon Sep 17 00:00:00 2001 From: Rodney Chen <rodney.chen@hotmail.com> Date: 星期日, 13 四月 2025 17:14:50 +0800 Subject: [PATCH] 物料扩展表增加字段 上架需要按物料的默认储位进行限制,不允许上架到其他储位 没有默认储位则不限制,需要记录并调用接口反写到U9 --- Tiger.Business.WMS/Transaction/Yada/In_BIZ_U9_RECEIPT.cs | 111 ++++++++++++++++++++++++++++++++++--------------------- 1 files changed, 68 insertions(+), 43 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 ba35d1e..a034d84 100644 --- a/Tiger.Business.WMS/Transaction/Yada/In_BIZ_U9_RECEIPT.cs +++ b/Tiger.Business.WMS/Transaction/Yada/In_BIZ_U9_RECEIPT.cs @@ -13,6 +13,7 @@ using Tiger.Business.WMS.Sharetronic.Shelf; using Tiger.Model.Entitys.MES.U9C; using Tiger.Model.MES.Yada; +using static IronPython.Modules._ast; namespace Tiger.Business.WMS.Transaction { @@ -63,7 +64,7 @@ catch (Exception ex) { //鍙栨秷褰撳墠鎿嶄綔 - ResetScan(); + ResetTrans(); //action.CatchExceptionWithLog(ex, $"鎵弿[{input.SN}]寮傚父"); action.CatchExceptionWithLog(ex, Biz.L("WMS.Default.Scan.ScanException", input.SN)); } @@ -106,6 +107,14 @@ action.LocaleMsg = Biz.L("WMS.Default.ScanItem.ItemCodeNotExistsOrNotActive", inv.ItemInfo.ITEM_CODE.IsNullOrEmpty(inv.Barcode.ItemCode)); return SetOutPutMqttMsg(action, input.Locale); } + //榛樿鍌ㄤ綅楠岃瘉 + if (!inv.ItemInfo.DEFAULT_LOCATION.IsNullOrEmpty() && inv.ItemInfo.DEFAULT_LOCATION != CurScanShelf.LocationCode) + { + action.IsSuccessed = false; + //action.LocaleMsg = Biz.L("鐗╂枡[{0}]鍙厑璁镐笂鏋跺埌鍌ㄤ綅[{0}]锛岃閲嶆柊鎵弿鍌ㄤ綅"); + action.LocaleMsg = Biz.L("WMS.Default.ScanItem.DefaultLocationError", inv.ItemInfo.ITEM_CODE, inv.ItemInfo.DEFAULT_LOCATION); + return SetOutPutMqttMsg(action, input.Locale); + } CurInvItem = inv; } @@ -135,11 +144,21 @@ } //浠嶶9鑾峰彇鏀惰揣鍗曡淇℃伅 var u9Dtl = Biz.DataSource["YadaU9C"].Client.Queryable<mes_ReturnedDocInfo>().Where(x => x.RcvId == receipt.ID.ToDouble() && x.DocLineNo == receiptDtl.LINE_NO.ToDouble() && x.SplitFlag != 1).First(); + //鏀惰揣鍗曠殑鐘舵�佸垽鏂槸鍚﹀凡鎻愪氦IQC瀹℃牳锛屾湭閫氳繃IQC涓嶈兘涓婃灦 + if (!u9Dtl.IsNullOrEmpty() && u9Dtl.Status != 3) + { + action.IsSuccessed = false; + //action.LocaleMsg = Biz.L("鏀惰揣鍗曡鐘舵�乕{0}]寮傚父锛岃鍏堟彁浜QC妫�楠岀粨鏋�"); + action.LocaleMsg = Biz.L("WMS.In_BIZ_U9_RECEIPT.ScanItem.U9StatusException", u9Dtl.StatusName); + return SetOutPutMqttMsg(action, input.Locale); + } if (!u9Dtl.IsNullOrEmpty() && u9Dtl.RcvQtyTU != receiptDtl.QTY_OK) { receiptDtl.ID = u9Dtl.RcvLineId.ToString(); receiptDtl.QTY_OK = u9Dtl.RcvQtyTU; receiptDtl.QTY_NG = receiptDtl.QTY - receiptDtl.QTY_OK; + receiptDtl.ERP_STATUS_CODE = u9Dtl.Status.ToString(); + receiptDtl.ERP_STATUS_NAME = u9Dtl.StatusName; } var nLocation = new WMS_LOCATION(); @@ -171,6 +190,7 @@ action.LocaleMsg = Biz.L($"WMS.Default.ScanShelf.ItemAlreadyExistsInLocation", nLocation.LOCATION_CODE, locationData.SN); return SetOutPutMqttMsg(action, input.Locale); } + CurScanShelf.Location = nLocation; CurScanShelf.LocationCode = nLocation.LOCATION_CODE; } else @@ -192,7 +212,7 @@ action.IsSuccessed = false; //action.LocaleMsg = Biz.L("鍌ㄤ綅[{0}]鍙兘瀛樻斁涓�涓墿鏂�"); action.LocaleMsg = Biz.L("WMS.Default.ScanItem.LocationSingleFailure", nLocation.LOCATION_CODE); - ResetScan(); + ResetTrans(); return SetOutPutMqttMsg(action, input.Locale); } @@ -223,7 +243,7 @@ { action.IsSuccessed = false; action.LocaleMsg = putonResult.LocaleMsg; - ResetScan(); + ResetTrans(); return SetOutPutMqttMsg(action, input.Locale); } @@ -234,53 +254,51 @@ sn.IS_IN = "Y"; } //濡傛灉褰撳墠琛屼笂鏋跺畬鎴愭爣璁颁负寰呭鏍� - 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琛屽鎺ュ彛 - approveAction = () => + //褰撳墠鍗曟嵁鏄庣粏琛屽凡缁忓叏閮ㄤ笂鏋跺畬鎴愶紝鍙互璋冪敤U9琛屽鎺ュ彛锛屽鏋滆瀹″け璐ュ垯鎶ラ敊锛屾渶鍚庝竴涓笂鏋跺け璐� + var iInput = new SubmitLineInput { - var iInput = new SubmitLineInput + userId = UserCode, + IsLogin = true, + param = new() { - 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(); - } + 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 + { + receiptDtl.STATUS = BIZ_U9_RECEIPT.STATUSs.Finished.GetValue(); + } } else { receiptDtl.STATUS = BIZ_U9_RECEIPT.STATUSs.Storing.GetValue(); } + //鏇存柊鍗曟嵁鐘舵�� if (receipt.Details.Any(q => q.STATUS < BIZ_U9_RECEIPT.STATUSs.Review.GetValue())) { receipt.STATUS = BIZ_U9_RECEIPT.STATUSs.Storing.GetValue(); } - else + else if (receipt.Details.Any(q => q.STATUS < BIZ_U9_RECEIPT.STATUSs.Finished.GetValue())) { receipt.STATUS = BIZ_U9_RECEIPT.STATUSs.Review.GetValue(); + } + else + { + receipt.STATUS = BIZ_U9_RECEIPT.STATUSs.Finished.GetValue(); } //鍒涘缓鍙橀噺鍏嬮殕瀵硅薄鐢ㄤ簬浼犲叆DBSubmitAction涓繚瀛樺綋鍓嶉渶瑕佹殏瀛樼殑鏁版嵁鍊� @@ -291,17 +309,23 @@ 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.ID, q.STATUS, q.QTY_IN, q.QTY_OK, q.QTY_NG, q.UPDATE_TIME, q.UPDATE_USER }).ExecuteCommand(); + db.Updateable(receiptDtl, UserCode).UpdateColumns(q => new { q.ID, q.STATUS, q.QTY_IN, q.QTY_OK, q.QTY_NG, q.ERP_STATUS_CODE, q.ERP_STATUS_NAME, 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(); }); //瀹屾垚鎵�鏈夊鐞嗗悗浣跨敤浜嬪姟淇濆瓨鏁版嵁 - action = DoIfFinish(action, input.Locale, approveAction); + action = DoIfFinish(action, input.Locale, () => { + //璁剧疆褰撳墠鐗╂枡鐨勯粯璁ゅ偍浣� + if (CurInvItem.ItemInfo.DEFAULT_LOCATION.IsNullOrEmpty()) + { + SetDefaultLocation(MainDB, CurInvItem.ItemInfo, nLocation); + } + }); } catch (Exception ex) { //鍙栨秷褰撳墠鎿嶄綔 - ResetScan(); + ResetTrans(); //action.CatchExceptionWithLog(ex, $"鎵弿鏉$爜[{input.SN}]澶嶆牳寮傚父"); action.CatchExceptionWithLog(ex, Biz.L("WMS.Default.ScanItem.ScanException", input.SN)); } @@ -392,7 +416,7 @@ catch (Exception ex) { //鍙栨秷褰撳墠鎿嶄綔 - ResetScan(); + ResetTrans(); //action.CatchExceptionWithLog(ex, $"鎵弿璐ф灦/鍌ㄤ綅[{0}]寮傚父"); action.CatchExceptionWithLog(ex, Biz.L("WMS.Default.ScanShelf.ScanException", Code)); } @@ -433,29 +457,30 @@ action.LocaleMsg = Biz.L("WMS.Default.ScanItem.PutOnSucceeded", CurInvItem.SN, CurInvItem.Location.LOCATION_CODE); //閲嶇疆宸ュ簭 - ResetScanInfo(); + ResetScan(); return SetOutPutMqttMsg(action, locale); } #endregion /// <summary> - /// 閲嶇疆褰撳墠鎿嶄綔锛屾湁闇�瑕佸垯閲嶅啓姝ゆ柟娉� + /// 閲嶇疆浜嬪姟鏁版嵁锛屾湁闇�瑕佸垯閲嶅啓姝ゆ柟娉� /// </summary> - public override void ResetScan() + public override void ResetTrans() { - base.ResetScan(); - ResetScanInfo(); + ResetScan(); CurScanShelf = null; + base.ResetTrans(); } /// <summary> - /// 閲嶇疆鎵爜淇℃伅 + /// 閲嶇疆鏈鎵爜淇℃伅 /// </summary> - public void ResetScanInfo() + public override void ResetScan() { - Command = null; + Command = "Normal"; CurInvItem = null; + base.ResetScan(); } public override bool Close(bool needSaveHistoryLog = false) -- Gitblit v1.9.3