销售发货、调拨出库到人工出货区
This commit is contained in:
@@ -94,8 +94,8 @@ namespace Tnb.WarehouseMgr
|
||||
await s_taskExecuteSemaphore.WaitAsync();
|
||||
await _db.Ado.BeginTranAsync();
|
||||
//入库取终点 //出库起点
|
||||
OutStockStrategyQuery inStockStrategyInput = new() { warehouse_id = WmsWareHouseConst.WAREHOUSE_CP_ID, material_id = wmsOutstockD.material_id, qty = input.qty, code_batch = wmsOutstockD.pi_code };
|
||||
List<Tuple<string, WmsCarryH, WmsCarryCode, BasLocation>> items = await _wareHouseService.OutStockStrategy_saleRelease(inStockStrategyInput);
|
||||
OutStockStrategyQuery outStockStrategyInput = new() { warehouse_id = WmsWareHouseConst.WAREHOUSE_CP_ID, material_id = wmsOutstockD.material_id, qty = input.qty, code_batch = wmsOutstockD.pi_code, Region_id = WmsWareHouseConst.REGION_CPOutstock_ID };
|
||||
List<Tuple<string, WmsCarryH, WmsCarryCode, BasLocation>> items = await _wareHouseService.OutStockStrategy_saleRelease(outStockStrategyInput);
|
||||
|
||||
decimal canOutstockQty = items.Sum(r => r.Item3.codeqty).ParseToDecimal();
|
||||
if (canOutstockQty < input.qty)
|
||||
@@ -108,14 +108,28 @@ namespace Tnb.WarehouseMgr
|
||||
|
||||
Logger.LogInformation($"【Distribute】 预计生成{items_pretask.Count}条预任务");
|
||||
|
||||
|
||||
List<BasLocation> 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)
|
||||
List<BasLocation> endLocations = null;
|
||||
// 自动发货
|
||||
if (!input.isManual)
|
||||
{
|
||||
throw new AppFriendlyException("一楼没有足够的未锁定且空闲的出库工位", 500);
|
||||
}
|
||||
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);
|
||||
}
|
||||
}
|
||||
//人工发货
|
||||
else
|
||||
{
|
||||
InStockStrategyQuery inStockStrategyInput = new() { warehouse_id = WmsWareHouseConst.WAREHOUSE_CP_ID, Size = items_pretask.Count, Region_id = WmsWareHouseConst.REGION_CPManualOutstock_ID };
|
||||
endLocations = await _wareHouseService.InStockStrategy(inStockStrategyInput);
|
||||
|
||||
if (endLocations.Count < items_pretask.Count)
|
||||
{
|
||||
throw new AppFriendlyException("三楼人工出库区没有足够的未锁定且空闲的出库工位", 500);
|
||||
}
|
||||
}
|
||||
|
||||
// 预任务逻辑
|
||||
foreach (Tuple<string, WmsCarryH, WmsCarryCode, BasLocation> item in items_pretask)
|
||||
@@ -124,12 +138,31 @@ namespace Tnb.WarehouseMgr
|
||||
WmsCarryCode carryCode = item.Item3;
|
||||
BasLocation startLocation = item.Item4;
|
||||
// 根据一楼工位任务数平均分配任务 确定一楼工位
|
||||
BasLocation 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();
|
||||
|
||||
if (endLocation == null)
|
||||
BasLocation endLocation = null;
|
||||
// 自动发货
|
||||
if (!input.isManual)
|
||||
{
|
||||
throw new AppFriendlyException("一楼没有足够的未锁定且空闲的出库工位", 500);
|
||||
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();
|
||||
|
||||
if (endLocation == null)
|
||||
{
|
||||
throw new AppFriendlyException("一楼没有足够的未锁定且空闲的出库工位", 500);
|
||||
}
|
||||
}
|
||||
//人工发货
|
||||
else
|
||||
{
|
||||
InStockStrategyQuery inStockStrategyInput = new() { warehouse_id = WmsWareHouseConst.WAREHOUSE_CP_ID, Size = 1, Region_id = WmsWareHouseConst.REGION_CPManualOutstock_ID };
|
||||
endLocations = await _wareHouseService.InStockStrategy(inStockStrategyInput);
|
||||
|
||||
if (endLocations.Count < 1)
|
||||
{
|
||||
throw new AppFriendlyException("三楼人工出库区没有足够的未锁定且空闲的出库工位", 500);
|
||||
}
|
||||
endLocation = endLocations[0];
|
||||
}
|
||||
|
||||
WmsPointH sPoint = null!;
|
||||
WmsPointH ePoint = null!;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user