电梯调整等

This commit is contained in:
2024-09-06 11:06:01 +08:00
parent 27536bfd7c
commit be75d77d3e
10 changed files with 175 additions and 81 deletions

View File

@@ -114,12 +114,12 @@ namespace Tnb.WarehouseMgr
// 自动发货
if (!input.isManual)
{
endLocations = await _db.Queryable<BasLocation>().Where(r => _wareHouseService.GetFloor1OutstockLocation().Contains(r.id) && r.is_lock == 0 && r.is_use == "0").ToListAsync();
//endLocations = await _db.Queryable<BasLocation>().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);
//}
}
//人工发货
else
@@ -145,18 +145,28 @@ namespace Tnb.WarehouseMgr
// 自动发货
if (!input.isManual)
{
endLocation = await _db.Queryable<BasLocation>().Where(r => _wareHouseService.GetFloor1OutstockLocation().Contains(r.id) && r.is_lock == 0 && r.is_use == "0").OrderBy("is_lock, task_nums, location_code").FirstAsync();
#region
// 3-1 第三次改动
endLocation = null;
// 正常情况下交替入,如果左右两侧缓存数量不一致 优先补充托盘数量少那一侧
List<BasLocation> locations_left = await _db.Queryable<BasLocation>()
.InnerJoin<WmsElevatorcacheArea>((a, b) => a.id == b.location_id)
.Where((a, b) => b.name == "3楼发货左").OrderBy("a.is_lock,a.is_use,a.carry_count+a.task_nums,a.location_code").ToListAsync();
List<BasLocation> locations_right = await _db.Queryable<BasLocation>()
.InnerJoin<WmsElevatorcacheArea>((a, b) => a.id == b.location_id)
.Where((a, b) => b.name == "3楼发货右").OrderBy("a.is_lock,a.is_use,a.carry_count+a.task_nums,a.location_code").ToListAsync();
decimal leftQty = locations_left.Sum(r => r.carry_count + r.task_nums);
decimal rightQty = locations_right.Sum(r => r.carry_count + r.task_nums);
if (leftQty <= rightQty)
endLocation = locations_left.FirstOrDefault();
else
endLocation = locations_right.FirstOrDefault();
if (endLocation == null)
{
throw new AppFriendlyException("一楼没有足够的未锁定且空闲的出库工位", 500);
}
List<BasLocation> endLocations_temp = await _db.Queryable<BasLocation>().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);
throw new AppFriendlyException($"载具{carry.carry_code}无法选到缓存区库位,请检查电梯缓存分区配置表", 500);
}
#endregion
}
//人工发货
else