From 86e8080c8c44aad510d0f6a9ccfa37e3a18fc552 Mon Sep 17 00:00:00 2001 From: Rodney Chen <rodney.chen@hotmail.com> Date: 星期三, 25 十二月 2024 11:10:54 +0800 Subject: [PATCH] 优化了一些已知问题 --- Tiger.Business.WMS/Transaction/In_Default.cs | 59 ++++++++++++++++++++++++++++++++++------------------------- 1 files changed, 34 insertions(+), 25 deletions(-) diff --git a/Tiger.Business.WMS/Transaction/In_Default.cs b/Tiger.Business.WMS/Transaction/In_Default.cs index 6f8211d..2a6048d 100644 --- a/Tiger.Business.WMS/Transaction/In_Default.cs +++ b/Tiger.Business.WMS/Transaction/In_Default.cs @@ -58,12 +58,14 @@ action.LocaleMsg = Biz.L("WMS.Default.ScanItem.SnEmptyFailure"); return SetOutPutMqttMsg(action, input.Locale); } - //璐ф灦涓虹┖鍒欐壂鎻忕殑璁や负鏄揣鏋� - if (string.IsNullOrEmpty(CurScanShelf?.ShelfCode)) + //鍒ゆ柇鎵弿鐨勬槸鍚﹁揣鏋� + var whUnit = await Biz.Db.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()) { - action = await ScanShelf(input.SN); + action = await ScanShelf(input.SN, whUnit); } - //鎵弿鐗╂枡骞跺鏍� + else//鎵弿鐗╂枡骞跺鏍� { action = await ScanItem(input); } @@ -341,7 +343,7 @@ /// <summary> /// 鎵弿璐ф灦鎴栬�呭偍浣� /// </summary> - public async Task<ApiAction<ScanOutput>> ScanShelf(string Code) + public async Task<ApiAction<ScanOutput>> ScanShelf(string Code, V_WH_UNIT whUnit) { var action = new ApiAction<ScanOutput>(new ScanOutput() { Command = Command }); try @@ -357,10 +359,10 @@ CurScanShelf = new ScanShelfInfo(); // 鏌ヨ璐ф灦淇℃伅 - var whUnit = await Biz.Db.Queryable<V_WH_UNIT>().Where(t => t.SHELF_CODE.ToUpper() == Code.ToUpper() && t.AUTH_ORG == OrgCode).IncludesAllFirstLayer().FirstAsync(); + whUnit = whUnit.IsNullOrEmpty(await Biz.Db.Queryable<V_WH_UNIT>().Where(t => (t.SHELF_CODE.ToUpper() == Code || t.LOCATION_CODE.ToUpper() == Code) && t.AUTH_ORG == OrgCode).IncludesAllFirstLayer().FirstAsync()); // 鎵弿璐ф灦浠g爜锛屼笖涓烘櫤鑳借揣鏋� - if (whUnit != null && whUnit.SHELF_TYPE == WMS_SHELF.SHELF_TYPEs.Smart.GetValue()) + if (!whUnit.IsNullOrEmpty() && whUnit.SHELF_CODE == Code) { CurScanShelf.Shelf = whUnit.Shelf; CurScanShelf.WarehouseCode = whUnit.WH_CODE; @@ -370,26 +372,26 @@ CurScanShelf.IsSmartRack = true; } // 鎵弿搴撲綅浠g爜 - else + else if (!whUnit.IsNullOrEmpty() && whUnit.LOCATION_CODE == Code) { - var nLocation = await Biz.Db.Queryable<V_WH_UNIT>().Where(t => t.LOCATION_CODE.ToUpper() == Code.ToUpper() && t.AUTH_ORG == OrgCode).IncludesAllFirstLayer().FirstAsync(); - if (nLocation == null) - { - action.IsSuccessed = false; - //action.LocaleMsg = Biz.L("鍌ㄤ綅[{0}]涓嶅瓨鍦�"); - action.LocaleMsg = Biz.L("WMS.Default.ScanShelf.LocationNotExist", Code); - return action; - } - if (nLocation.IS_ACTIVE == "N") + //var nLocation = await Biz.Db.Queryable<V_WH_UNIT>().Where(t => t.LOCATION_CODE.ToUpper() == Code.ToUpper() && t.AUTH_ORG == OrgCode).IncludesAllFirstLayer().FirstAsync(); + //if (nLocation == null) + //{ + // action.IsSuccessed = false; + // //action.LocaleMsg = Biz.L("鍌ㄤ綅[{0}]涓嶅瓨鍦�"); + // action.LocaleMsg = Biz.L("WMS.Default.ScanShelf.LocationNotExist", Code); + // return action; + //} + if (whUnit.IS_ACTIVE == "N") { action.IsSuccessed = false; //action.LocaleMsg = Biz.L("鎵弿鐨勫偍浣峓{0}]鏈惎鐢�"); action.LocaleMsg = Biz.L("WMS.Default.ScanShelf.ShelfOrLocationDisabled", Code); return action; } - if (nLocation.Shelf.IsLightShelf || nLocation.Location.IS_SINGLE == "Y") + if (whUnit.Shelf.IsLightShelf || whUnit.Location.IS_SINGLE == "Y") { - var locationData = Biz.Db.Queryable<WMS_ITEM>().Where(q => q.LOCATION_ID == nLocation.LOCATION_ID && q.AUTH_ORG == OrgCode).First(); + var locationData = Biz.Db.Queryable<WMS_ITEM>().Where(q => q.LOCATION_ID == whUnit.LOCATION_ID && q.AUTH_ORG == OrgCode).First(); if (!locationData.IsNullOrEmpty()) { action.IsSuccessed = false; @@ -398,14 +400,21 @@ return action; } } - CurScanShelf.Shelf = nLocation.Shelf; - CurScanShelf.Location = nLocation.Location; - CurScanShelf.WarehouseCode = nLocation.WH_CODE; - CurScanShelf.RegionCode = nLocation.REGION_CODE; - CurScanShelf.ShelfCode = nLocation.SHELF_CODE; - CurScanShelf.LocationCode = nLocation.LOCATION_CODE; + CurScanShelf.Shelf = whUnit.Shelf; + CurScanShelf.Location = whUnit.Location; + CurScanShelf.WarehouseCode = whUnit.WH_CODE; + CurScanShelf.RegionCode = whUnit.REGION_CODE; + CurScanShelf.ShelfCode = whUnit .SHELF_CODE; + CurScanShelf.LocationCode = whUnit.LOCATION_CODE; CurScanShelf.IsSmartRack = false; } + else + { + action.IsSuccessed = false; + //action.LocaleMsg = Biz.L("璇疯緭鍏ユ垨鎵弿鏈夋晥鐨勮揣鏋�/鍌ㄤ綅鐮�"); + action.LocaleMsg = Biz.L("WMS.Default.ScanShelf.ShelfCanNotEmpty"); + return action; + } CurScanShelf.IsScanShelf = true; //action.LocaleMsg = Biz.L("鎵弿璐ф灦/鍌ㄤ綅[{0}]鎴愬姛"); -- Gitblit v1.9.3