三楼人工库逻辑等

This commit is contained in:
2024-08-30 14:06:11 +08:00
parent a2514a1354
commit ca4fec4d7d
21 changed files with 500 additions and 314 deletions

View File

@@ -148,8 +148,11 @@ namespace Tnb.WarehouseMgr
public async Task<Tnb.WarehouseMgr.Entities.Dto.Outputs.Result> Distribute(SaleReleaseDistributeInput input)
{
Logger.LogInformation($"【Distribute】 销售出库下发");
SemaphoreSlim semaphoreSlim = null;
try
{
semaphoreSlim = _wareHouseService.GetSemaphore("outstock", WmsWareHouseConst.WAREHOUSE_CP_ID);
await semaphoreSlim.WaitAsync();
if (input.qty <= 0)
{
throw new AppFriendlyException("数量必须大于0", 500);
@@ -160,7 +163,6 @@ namespace Tnb.WarehouseMgr
}
WmsSaleD wmsOutstockD = await _db.Queryable<WmsSaleD>().FirstAsync(it => it.id == input.source_id);
await s_taskExecuteSemaphore.WaitAsync();
await _db.Ado.BeginTranAsync();
//入库取终点 //出库起点
OutStockStrategyQuery outStockStrategyInput = new() { warehouse_id = WmsWareHouseConst.WAREHOUSE_CP_ID, material_id = wmsOutstockD.material_id, qty = input.qty, code_batch = wmsOutstockD.code_batch, Region_id = WmsWareHouseConst.REGION_CPOutstock_ID };
@@ -188,6 +190,13 @@ namespace Tnb.WarehouseMgr
{
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);
}
}
//人工发货
else
@@ -400,7 +409,7 @@ namespace Tnb.WarehouseMgr
}
finally
{
_ = s_taskExecuteSemaphore.Release();
semaphoreSlim.Release();
await InvokeGenPretaskExcute();
}