From c049523656adcbab2d16df48faa94c672063c0dc Mon Sep 17 00:00:00 2001 From: Rodney Chen <rodney.chen@hotmail.com> Date: 星期日, 30 三月 2025 18:44:59 +0800 Subject: [PATCH] 备料任务初版 --- Tiger.Business.WMS/Transaction/Yada/Out_BIZ_WMS_PREP.cs | 87 +++++++++++++++++++++++++++++++++++-------- 1 files changed, 71 insertions(+), 16 deletions(-) diff --git a/Tiger.Business.WMS/Transaction/Yada/Out_BIZ_WMS_PREP.cs b/Tiger.Business.WMS/Transaction/Yada/Out_BIZ_WMS_PREP.cs index 652119f..75a0eb3 100644 --- a/Tiger.Business.WMS/Transaction/Yada/Out_BIZ_WMS_PREP.cs +++ b/Tiger.Business.WMS/Transaction/Yada/Out_BIZ_WMS_PREP.cs @@ -12,7 +12,8 @@ using Tiger.Model.Sharetronic.Shelf; using Tiger.Business.WMS.Sharetronic.Shelf; using Tiger.Model.Entitys.MES.U9C; -using Tiger.Model.Entitys.MES.Position; +using Tiger.Business.WMS.Common; +using Tiger.Model.Base; namespace Tiger.Business.WMS.Transaction { @@ -24,12 +25,13 @@ public IOut_BIZ_WMS_PREP Init(string id, string userCode, string apiHost, string orgCode) { base.Init(id, userCode, apiHost, orgCode); + CurPREP = new(MainDB, userCode, orgCode); Logger.Console.Info($"Start {this.GetType().Name} Transaction[ID: {TransID}]"); return this; } #region Propertys & Variables - + private Preparation CurPREP; #endregion #region Functions @@ -41,23 +43,31 @@ var action = new ApiAction<ScanOutput>(new ScanOutput()); try { - if (input.SN.IsNullOrEmpty()) + + if (input.Command == "ScanOrder") { - action.IsSuccessed = false; - //action.LocaleMsg = Biz.L("鏉$爜涓嶈兘涓虹┖"); - action.LocaleMsg = Biz.L("WMS.Default.ScanItem.SnEmptyFailure"); - return SetOutPutMqttMsg(action, input.Locale); + action = await ScanOrder(input); } - //鍒ゆ柇鎵弿鐨勬槸鍚﹁揣鏋� - var whUnit = await MainDB.Queryable<V_WH_UNIT>().Where(t => (t.SHELF_CODE.ToUpper() == input.SN || t.LOCATION_CODE.ToUpper() == input.SN) && t.AUTH_ORG == OrgCode).IncludesAllFirstLayer().FirstAsync(); - //if (string.IsNullOrEmpty(CurScanShelf?.ShelfCode)) - if (!whUnit.IsNullOrEmpty() || string.IsNullOrEmpty(CurScanShelf?.ShelfCode)) + else { - action = await ScanShelf(input.SN, whUnit); - } - else//鎵弿鐗╂枡骞跺鏍� - { - action = await ScanItem(input); + if (input.SN.IsNullOrEmpty()) + { + action.IsSuccessed = false; + //action.LocaleMsg = Biz.L("鏉$爜涓嶈兘涓虹┖"); + action.LocaleMsg = Biz.L("WMS.Default.ScanItem.SnEmptyFailure"); + return SetOutPutMqttMsg(action, input.Locale); + } + //鍒ゆ柇鎵弿鐨勬槸鍚﹁揣鏋� + var whUnit = await MainDB.Queryable<V_WH_UNIT>().Where(t => (t.SHELF_CODE.ToUpper() == input.SN || t.LOCATION_CODE.ToUpper() == input.SN) && t.AUTH_ORG == OrgCode).IncludesAllFirstLayer().FirstAsync(); + //if (string.IsNullOrEmpty(CurScanShelf?.ShelfCode)) + if (!whUnit.IsNullOrEmpty() || string.IsNullOrEmpty(CurScanShelf?.ShelfCode)) + { + action = await ScanShelf(input.SN, whUnit); + } + else//鎵弿鐗╂枡骞跺鏍� + { + action = await ScanItem(input); + } } } catch (Exception ex) @@ -68,6 +78,50 @@ action.CatchExceptionWithLog(ex, Biz.L("WMS.Default.Scan.ScanException", input.SN)); } return SetOutPutMqttMsg(action, input.Locale); + } + + /// <summary> + /// 鎵弿涓嬫灦鍗曟嵁鍙风爜 + /// </summary> + public async Task<ApiAction<ScanOutput>> ScanOrder(BaseInput input) + { + var action = new ApiAction<ScanOutput>(new ScanOutput()); + try + { + var inputOrder = input?.Data?.JsonToObject<BIZ_WMS_PREP>(); + if ((inputOrder?.BIZ_TYPE).IsNullOrEmpty() || (inputOrder?.SOURCE_ORDER ?? "").IsNullOrEmpty()) + { + action.IsSuccessed = false; + //action.LocaleMsg = Biz.L($"璇烽�夋嫨姝g‘鐨勫鏂欎换鍔$被鍨嬪拰鍗曞彿"); + action.LocaleMsg = Biz.L("WMS.Out_BIZ_WMS_PREP.ScanOrder.InputOrderIsNull"); + return action; + } + if (!CurPREP.PrepOrder.IsNullOrEmpty() && inputOrder.BIZ_TYPE != CurPREP.PrepOrder.BIZ_TYPE) + { + action.IsSuccessed = false; + //action.LocaleMsg = Biz.L($"褰撳墠澶囨枡浠诲姟[{0}]鐨勪笟鍔$被鍨嬩负{1}锛屽闇�鍒囨崲澶囨枡涓氬姟锛岃閫�鍑哄悗閲嶆柊閫夋嫨"); + action.LocaleMsg = Biz.L("WMS.Out_BIZ_WMS_PREP.ScanOrder.BizTypeError", CurPREP.PrepOrder.ORDER_NO, CurPREP.PrepOrder.BIZ_TYPE.GetEnumDesc<BIZ_WMS_PREP.BIZ_TYPEs>()); + return action; + } + + if (CurPREP.PrepOrder.IsNullOrEmpty() || !CurPREP.PrepOrder.SourceOrders.Any(q => q.SOURCE_ORDER == inputOrder.SOURCE_ORDER)) + { + action = CurPREP.AddOrder(inputOrder.BIZ_TYPE.GetEnum<BIZ_WMS_PREP.BIZ_TYPEs>(), inputOrder.SOURCE_CODE); + } + else + { + //action.LocaleMsg = Biz.L($"褰撳墠澶囨枡浠诲姟[{0}]宸插寘鍚崟鎹甗{1}]锛屾棤闇�閲嶅鎿嶄綔"); + action.LocaleMsg = Biz.L("WMS.Out_BIZ_WMS_PREP.ScanOrder.Repeat", CurPREP.PrepOrder.ORDER_NO, inputOrder.SOURCE_ORDER); + } + } + catch (Exception ex) + { + //鍙栨秷褰撳墠鎿嶄綔 + ResetScan(); + //action.CatchExceptionWithLog(ex, $"澶囨枡浠诲姟鎵弿鍗曟嵁寮傚父(Data: {0})"); + action.CatchExceptionWithLog(ex, Biz.L("WMS.Out_BIZ_WMS_PREP.ScanOrderException", input?.Data)); + } + return action; } /// <summary> @@ -419,6 +473,7 @@ { base.ResetScan(); ResetScanInfo(); + CurPREP = new(MainDB, UserCode, OrgCode); CurScanShelf = null; } -- Gitblit v1.9.3