From df654b152303810df01db7ce05be90e86272586f Mon Sep 17 00:00:00 2001 From: majian <780924089@qq.com> Date: Tue, 3 Sep 2024 16:23:52 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BA=93=E4=BD=8D=E8=BD=BD=E5=85=B7=E6=95=B0?= =?UTF-8?q?=EF=BC=8C=E7=81=AD=E8=8F=8C=E5=85=A5=E5=BA=93=E5=8D=95=E5=8F=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Entity/BasLocation.cs | 4 ++++ .../Entity/WmsSterilizationInstockH.cs | 5 +++++ .../Tnb.WarehouseMgr/DeviceProviderService.cs | 1 - .../Tnb.WarehouseMgr/WareHouseService.cs | 6 +++-- .../Tnb.WarehouseMgr/WmsSaleReleaseService.cs | 22 +++++++++---------- 5 files changed, 24 insertions(+), 14 deletions(-) diff --git a/BasicData/Tnb.BasicData.Entities/Entity/BasLocation.cs b/BasicData/Tnb.BasicData.Entities/Entity/BasLocation.cs index 34c97eb5..9a570ae1 100644 --- a/BasicData/Tnb.BasicData.Entities/Entity/BasLocation.cs +++ b/BasicData/Tnb.BasicData.Entities/Entity/BasLocation.cs @@ -134,4 +134,8 @@ public partial class BasLocation : BaseEntity /// 通道 /// public string passage { get; set; } + /// + /// 载具数量 + /// + public int carry_count { get; set; } } diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsSterilizationInstockH.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsSterilizationInstockH.cs index 3d15f8dd..4a20ffa4 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsSterilizationInstockH.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsSterilizationInstockH.cs @@ -89,4 +89,9 @@ public partial class WmsSterilizationInstockH : BaseEntity /// public string? status { get; set; } + + /// + /// 单号 + /// + public string? bill_code { get; set; } } diff --git a/WarehouseMgr/Tnb.WarehouseMgr/DeviceProviderService.cs b/WarehouseMgr/Tnb.WarehouseMgr/DeviceProviderService.cs index 7d560705..7bfe5fb2 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/DeviceProviderService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/DeviceProviderService.cs @@ -799,7 +799,6 @@ namespace Tnb.WarehouseMgr List disTasks = new() { disTask }; if (input.action == "LOAD") { - TaskExecuteAfterUpInput taskExecuteAfterUpInput = new() { disTaskIds = disTasks.Select(x => x.id).ToList() diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs index f7354a63..dd68cccf 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs @@ -2637,7 +2637,7 @@ namespace Tnb.WarehouseMgr if (carryAndLocIds?.Count > 0) { List startLocationIds = carryAndLocIds.Select(x => x.startlocation_id).ToList(); - _ = await db.Updateable().SetColumns(it => new BasLocation { is_use = ((int)EnumCarryStatus.空闲).ToString(), is_lock = 0 }).Where(it => startLocationIds.Contains(it.id)).ExecuteCommandAsync(); + _ = await db.Updateable().SetColumns(it => new BasLocation { is_use = ((int)EnumCarryStatus.空闲).ToString(), is_lock = 0, carry_count = it.carry_count - 1 }).Where(it => startLocationIds.Contains(it.id)).ExecuteCommandAsync(); } List disTasks = db.Queryable().Where(r => input.disTaskIds.Contains(r.id)).ToList(); @@ -2755,6 +2755,7 @@ namespace Tnb.WarehouseMgr List<(string carry_id, string carry_status, string endlocation_id, string endlocation_code)> multiList = disTasks.Select(it => (it.carry_id, it.carry_status, it.endlocation_id, it.endlocation_code)).ToList(); Dictionary locWhIdMap = await db.Queryable().Where(it => multiList.Select(x => x.endlocation_id).Contains(it.id)).ToDictionaryAsync(it => it.id, it => it.wh_id); Dictionary locTypeMap = await db.Queryable().Where(it => multiList.Select(x => x.endlocation_id).Contains(it.id)).ToDictionaryAsync(it => it.id, it => it.is_type); + Dictionary locCarrycountMap = await db.Queryable().Where(it => multiList.Select(x => x.endlocation_id).Contains(it.id)).ToDictionaryAsync(it => it.id, it => it.carry_count); List carryIts = new(); List carryCodeIts = new(); List locIts = new(); @@ -2801,6 +2802,7 @@ namespace Tnb.WarehouseMgr { id = multiList[i].endlocation_id, is_lock = 0, + carry_count = locCarrycountMap[endLocId] == null ? 1: int.Parse(locCarrycountMap[endLocId].ToString()) + 1, is_use = string.IsNullOrEmpty(multiList[i].carry_status) ? ((int)EnumCarryStatus.占用).ToString() : multiList[i].carry_status }; if (!string.IsNullOrEmpty(multiList[i].carry_status)) @@ -2823,7 +2825,7 @@ namespace Tnb.WarehouseMgr //更新条码的库位和仓库信息 _ = await db.Updateable(carryCodeIts).UpdateColumns(it => new { it.warehouse_id, it.location_id, it.location_code }).ExecuteCommandAsync(); //更新库位信息,使用状态为 使用,锁定状态为未锁定 - _ = await db.Updateable(locIts).UpdateColumns(it => new { it.is_use, it.is_lock }).ExecuteCommandAsync(); + _ = await db.Updateable(locIts).UpdateColumns(it => new { it.is_use, it.is_lock, it.carry_count }).ExecuteCommandAsync(); Logger.Information($"【TaskComplate】 更新库位 {JsonConvert.SerializeObject(locIts)}"); /* var loginType= _userManager?.LoginType ?? "web"; Log.Information($"_userManager.LoginType={loginType}"); diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsSaleReleaseService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsSaleReleaseService.cs index 8ffc1545..864d3c6d 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsSaleReleaseService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsSaleReleaseService.cs @@ -183,19 +183,19 @@ namespace Tnb.WarehouseMgr // 自动发货 if (!input.isManual) { - endLocations = await _db.Queryable().Where(r => _wareHouseService.GetFloor1OutstockLocation().Contains(r.id) && r.is_lock == 0 && r.is_use == "0").ToListAsync(); + //endLocations = await _db.Queryable().Where(r => _wareHouseService.GetFloor1OutstockLocation().Contains(r.id) && r.is_lock == 0 && r.is_use == "0").ToListAsync(); - if (endLocations.Count < items_pretask.Count) - { - throw new AppFriendlyException("一楼没有足够的未锁定且空闲的出库工位", 500); - } + //if (endLocations.Count < items_pretask.Count) + //{ + // throw new AppFriendlyException("一楼没有足够的未锁定且空闲的出库工位", 500); + //} - List endLocations_temp = await _db.Queryable().Where(r => r.region_id == WmsWareHouseConst.REGION_CPOutstockCache_ID && r.is_lock == 0 && r.is_use == "0").ToListAsync(); + //List endLocations_temp = await _db.Queryable().Where(r => r.region_id == WmsWareHouseConst.REGION_CPOutstockCache_ID && r.is_lock == 0 && r.is_use == "0").ToListAsync(); - if (endLocations_temp.Count < items_pretask.Count) - { - throw new AppFriendlyException($"三楼发货时,没有可用的暂存库位可以使用,需要下发任务{items_pretask.Count}条,可用的暂存库位只有{endLocations_temp.Count}条", 500); - } + //if (endLocations_temp.Count < items_pretask.Count) + //{ + // throw new AppFriendlyException($"三楼发货时,没有可用的暂存库位可以使用,需要下发任务{items_pretask.Count}条,可用的暂存库位只有{endLocations_temp.Count}条", 500); + //} } //人工发货 else @@ -232,7 +232,7 @@ namespace Tnb.WarehouseMgr } List locations = await _db.Queryable() .InnerJoin((a, b) => a.id == b.location_id) - .Where((a, b) => b.name == YCLInnerTransfer.value).OrderBy("a.location_code,a.is_lock,a.is_use,task_nums").ToListAsync(); + .Where((a, b) => b.name == YCLInnerTransfer.value).OrderBy("a.is_lock,a.is_use,carry_count,a.location_code").ToListAsync(); endLocation = locations.FirstOrDefault();