三楼人工库逻辑等

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

@@ -79,8 +79,11 @@ namespace Tnb.WarehouseMgr
public async Task<Tnb.WarehouseMgr.Entities.Dto.Outputs.Result> Distribute(WmsTransferOutstockInput 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);
@@ -91,7 +94,6 @@ namespace Tnb.WarehouseMgr
}
WmsTransferOutstockD wmsOutstockD = await _db.Queryable<WmsTransferOutstockD>().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.pi_code, Region_id = WmsWareHouseConst.REGION_CPOutstock_ID };
@@ -149,6 +151,12 @@ 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
@@ -327,7 +335,7 @@ namespace Tnb.WarehouseMgr
}
finally
{
_ = s_taskExecuteSemaphore.Release();
semaphoreSlim.Release();
await InvokeGenPretaskExcute();
}