三楼人工库逻辑等

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

@@ -165,8 +165,11 @@ namespace Tnb.WarehouseMgr
[HttpPost, NonUnify, AllowAnonymous]
public async Task<Tnb.WarehouseMgr.Entities.Dto.Outputs.Result> OutsourcedPartsInstock(OutsourcedPartsInstockInput input)
{
SemaphoreSlim semaphoreSlim = null;
try
{
semaphoreSlim = _wareHouseService.GetSemaphore("instock", WmsWareHouseConst.WAREHOUSE_CP_ID);
await semaphoreSlim.WaitAsync();
if (string.IsNullOrEmpty(input.carry_code))
{
throw new AppFriendlyException("载具编号不可为空", 500);
@@ -193,10 +196,9 @@ namespace Tnb.WarehouseMgr
{
throw new AppFriendlyException("此成品调拨任务已完成,不允许重复提交", 500);
}
await s_taskExecuteSemaphore.WaitAsync();
await _db.Ado.BeginTranAsync();
//入库取终点 //出库起点
InStockStrategyQuery inStockStrategyInput = new() { warehouse_id = WmsWareHouseConst.WAREHOUSE_CP_ID, Size = 1 };
InStockStrategyQuery inStockStrategyInput = new() { warehouse_id = WmsWareHouseConst.WAREHOUSE_CP_ID,Region_id = WmsWareHouseConst.REGION_CPOutstock_ID, Size = 1 };
List<BasLocation> endLocations = await _wareHouseService.InStockStrategy(inStockStrategyInput);
if (endLocations.Count == 0)
{
@@ -364,7 +366,7 @@ namespace Tnb.WarehouseMgr
}
finally
{
_ = s_taskExecuteSemaphore.Release();
semaphoreSlim.Release();
await InvokeGenPretaskExcute();
}
@@ -379,6 +381,7 @@ namespace Tnb.WarehouseMgr
[HttpPost, NonUnify, AllowAnonymous]
public async Task<Tnb.WarehouseMgr.Entities.Dto.Outputs.Result> FinishproductOutstockSign(FinishproductOutstockSignInput input)
{
Logger.LogInformation($"【FinishproductOutstockSign】载具签收 {input.carry_code}");
if (string.IsNullOrEmpty(input.carry_code))
{
@@ -455,8 +458,8 @@ namespace Tnb.WarehouseMgr
}
catch (Exception ex)
{
Logger.Error($"【FinishproductOutstockSign】 {ex.Message}");
Logger.Error($"【FinishproductOutstockSign】 {ex.StackTrace}");
Logger.LogWarning($"【FinishproductOutstockSign】 {ex.Message}");
Logger.LogWarning($"【FinishproductOutstockSign】 {ex.StackTrace}");
await _db.Ado.RollbackTranAsync();
return await ToApiResult(HttpStatusCode.InternalServerError, ex.Message);
}
@@ -478,7 +481,28 @@ namespace Tnb.WarehouseMgr
throw new AppFriendlyException("请选择区域", 500);
}
try
{
OutStockStrategyQuery outStockStrategyInput = new() { warehouse_id = WmsWareHouseConst.WAREHOUSE_CP_ID, qty = 200, Region_id = WmsWareHouseConst.REGION_CPManualOutstock_ID, filter_carry_status = false };
List<WmsCarryH> items = await _wareHouseService.OutStockStrategy(outStockStrategyInput);
foreach (WmsCarryH wmsCarryH in items)
{
FinishproductOutstockSignInput signInput = new FinishproductOutstockSignInput();
signInput.carry_code = wmsCarryH.carry_code;
Entities.Dto.Outputs.Result result = await FinishproductOutstockSign(signInput);
if (result.code != HttpStatusCode.OK)
{
throw new Exception($@"库位{wmsCarryH.location_code}中的载具{wmsCarryH.carry_code}签收失败! 错误信息:{result.msg}");
}
}
}
catch (Exception ex)
{
Logger.LogWarning($"【FinishproductOutstockSignAll】 {ex.Message}");
Logger.LogWarning($"【FinishproductOutstockSignAll】 {ex.StackTrace}");
return await ToApiResult(HttpStatusCode.InternalServerError, ex.Message);
}
return await ToApiResult(HttpStatusCode.OK, "成功");
}
}