三楼人工库逻辑等

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

@@ -43,6 +43,7 @@ using Tnb.ProductionMgr.Entities;
using Tnb.BasicData;
using Tnb.ProductionMgr.Entities.Entity;
using Tnb.WarehouseMgr.Entities.Dto.Outputs;
using System.Threading;
namespace Tnb.WarehouseMgr
{
@@ -782,8 +783,14 @@ namespace Tnb.WarehouseMgr
[HttpPost, NonUnify, AllowAnonymous]
public async Task<Entities.Dto.Outputs.Result> DistributeBCK(MaterialTransferDistributeInput input)
{
SemaphoreSlim semaphoreSlimOutStock = null;
SemaphoreSlim semaphoreSlimInStock = null;
try
{
semaphoreSlimOutStock = _wareHouseService.GetSemaphore("outstock", WmsWareHouseConst.WAREHOUSE_BCK_ID);
await semaphoreSlimOutStock.WaitAsync();
semaphoreSlimInStock = _wareHouseService.GetSemaphore("instock", WmsWareHouseConst.WAREHOUSE_F2BCQ_ID);
await semaphoreSlimInStock.WaitAsync();
if (string.IsNullOrEmpty(input.source_id))
{
throw new AppFriendlyException("来源单据id不可为空", 500);
@@ -813,14 +820,13 @@ namespace Tnb.WarehouseMgr
if (wmsMaterialTransfer.warehouse_outstock != WmsWareHouseConst.WAREHOUSE_BCK_ID)
{
throw new AppFriendlyException($@"转库单{wmsMaterialTransfer.bill_code}库仓库不是四楼包材库,请检查!", HttpStatusCode.InternalServerError);
throw new AppFriendlyException($@"转库单{wmsMaterialTransfer.bill_code}库仓库不是四楼包材库,请检查!", HttpStatusCode.InternalServerError);
}
if (wmsMaterialTransfer.warehouse_instock != WmsWareHouseConst.WAREHOUSE_F2BCQ_ID)
{
throw new AppFriendlyException($@"转库单{wmsMaterialTransfer.bill_code}入库仓库不是二楼包材库,请检查!", HttpStatusCode.InternalServerError);
}
await s_taskExecuteSemaphore.WaitAsync();
await _db.Ado.BeginTranAsync();
//入库取终点 //出库起点
@@ -897,7 +903,8 @@ namespace Tnb.WarehouseMgr
}
finally
{
_ = s_taskExecuteSemaphore.Release();
semaphoreSlimOutStock.Release();
semaphoreSlimInStock.Release();
InvokeGenPretaskExcute();
}
@@ -1605,13 +1612,18 @@ namespace Tnb.WarehouseMgr
// throw new AppFriendlyException($"此料架的库位为空!{input.carry_code}", 500);
//}
if (string.IsNullOrEmpty(input.endlocation_id))
if (string.IsNullOrEmpty(input.endlocation_code))
{
Logger.LogWarning($"【CallRackToProductionLine】终点库位不能为空{input.endlocation_id}");
throw new AppFriendlyException($"终点库位不能为空!{input.endlocation_id}", 500);
Logger.LogWarning($"【CallRackToProductionLine】终点库位不能为空{input.endlocation_code}");
throw new AppFriendlyException($"终点库位不能为空!{input.endlocation_code}", 500);
}
//BasLocation endlocation = _db.Queryable<BasLocation>().Where(r => r.location_code == wmsCarryH.work_station).First();
BasLocation endlocation = await _db.Queryable<BasLocation>().Where(r => r.location_code == input.endlocation_code).FirstAsync();
if (endlocation == null)
{
throw new AppFriendlyException($"终点库位{input.endlocation_code}在系统中不存在!", 500);
}
WmsPretaskH wmsPretaskH = _db.Queryable<WmsPretaskH>().Where(r => r.carry_code == wmsCarryH.carry_code && r.status != WmsWareHouseConst.PRETASK_BILL_STATUS_COMPLE_ID && r.status != WmsWareHouseConst.PRETASK_BILL_STATUS_CANCEL_ID).First();
if (wmsPretaskH != null)
@@ -1622,7 +1634,7 @@ namespace Tnb.WarehouseMgr
CommonCreatePretaskInput commonCreatePretaskInput = new CommonCreatePretaskInput();
commonCreatePretaskInput.startlocation_id = wmsCarryH.location_id;
commonCreatePretaskInput.endlocation_id = input.endlocation_id;
commonCreatePretaskInput.endlocation_id = endlocation.id;
commonCreatePretaskInput.carry_id = wmsCarryH.id;
commonCreatePretaskInput.carry_code = wmsCarryH.carry_code;
commonCreatePretaskInput.task_type = "";
@@ -1681,11 +1693,11 @@ namespace Tnb.WarehouseMgr
JArray jArray = new JArray();
foreach (WmsCarryH wmsCarryH in wmsCarryHs)
{
if (wmsCarryH.carrystd_id != "26037267399717")
{
Logger.LogWarning($"【RackAndMatByWorkstation】工位{input.work_station}绑定的{wmsCarryH.carry_code}载具不是料架类型!请检查");
continue;
}
//if (wmsCarryH.carrystd_id != "26037267399717")
//{
// Logger.LogWarning($"【RackAndMatByWorkstation】工位{input.work_station}绑定的{wmsCarryH.carry_code}载具不是料架类型!请检查");
// continue;
//}
var matCodes = _db.Queryable<WmsCarryD>()
.InnerJoin<WmsCarryCode>((a, b) => a.membercarry_id == b.carry_id)