原材料仓、中储仓出入库优化
This commit is contained in:
@@ -52,6 +52,9 @@ namespace Tnb.WarehouseMgr
|
||||
public static SemaphoreSlim _s_taskExecuteSemaphore_YCLOutstock = new(1);
|
||||
|
||||
|
||||
public static SemaphoreSlim _s_taskExecuteSemaphore_F1ZCCInstock = new(1);
|
||||
public static SemaphoreSlim _s_taskExecuteSemaphore_F1ZCCOutstock = new(1);
|
||||
|
||||
protected static Dictionary<string, int> _s_eleUseStatusDic;
|
||||
|
||||
protected IEventPublisher? EventPublisher { set; get; }
|
||||
|
||||
@@ -698,14 +698,7 @@ namespace Tnb.WarehouseMgr
|
||||
{
|
||||
var disTask = await _db.Queryable<WmsDistaskH>().FirstAsync(it => it.bill_code == input.taskCode);
|
||||
|
||||
/* 20240627 记录异常情况: WCS给我们发取货完成信号之后,如果我们返回了异常 WCS会一直重试20次,但是AGV已经取货走了,并成功送到库位,此时会给我们反馈放货信号,
|
||||
* 但是由于取货信号一直返回异常,WCS还是会一直重试,会出现我们收到到货信号后又会收到取货信号的异常情况,这里加个任务执行状态判断,用于避免这种情况
|
||||
*/
|
||||
//if (disTask.status == WmsWareHouseConst.TASK_BILL_STATUS_COMPLE_ID)
|
||||
//{
|
||||
// return await ToApiResult(HttpStatusCode.OK, "此任务");
|
||||
//}
|
||||
|
||||
|
||||
Logger.Information($"【TaskCallback】 【接收】{input.taskCode} WCS信号 任务状态上报->接收参数:{JsonConvert.SerializeObject(input)}");
|
||||
try
|
||||
{
|
||||
|
||||
@@ -98,6 +98,17 @@ namespace Tnb.WarehouseMgr
|
||||
get { return _s_taskExecuteSemaphore_YCLOutstock; }
|
||||
}
|
||||
|
||||
public SemaphoreSlim s_taskExecuteSemaphore_F1ZCCInstock
|
||||
{
|
||||
get { return _s_taskExecuteSemaphore_F1ZCCInstock; }
|
||||
}
|
||||
|
||||
public SemaphoreSlim s_taskExecuteSemaphore_F1ZCCOutstock
|
||||
{
|
||||
get { return _s_taskExecuteSemaphore_F1ZCCOutstock; }
|
||||
}
|
||||
|
||||
|
||||
public WareHouseService(ISqlSugarRepository<WmsInstockH> repository, IDictionaryDataService dictionaryDataService, StackExRedisHelper redisData,
|
||||
IBillRullService billRullService, IUserManager userManager, ICacheManager cacheManager, IElevatorControlService elevatorControlService,
|
||||
IWmsCarryBindService wmsCarryBindService,
|
||||
@@ -3226,6 +3237,9 @@ namespace Tnb.WarehouseMgr
|
||||
BasLocation startLocation = null;
|
||||
|
||||
int index = 0;
|
||||
|
||||
await _s_taskExecuteSemaphore_F1ZCCInstock.WaitAsync();
|
||||
|
||||
await _db.Ado.BeginTranAsync();
|
||||
foreach (WmsCarryD wmsCarryD in wmsCarryCodes)
|
||||
{
|
||||
@@ -3316,6 +3330,7 @@ namespace Tnb.WarehouseMgr
|
||||
}
|
||||
finally
|
||||
{
|
||||
_s_taskExecuteSemaphore_F1ZCCInstock.Release();
|
||||
s_floor2CreatePretask.Release();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,6 +68,10 @@ namespace Tnb.WarehouseMgr
|
||||
}
|
||||
public async Task<dynamic> WmsEmptyIn(VisualDevModelDataCrInput input)
|
||||
{
|
||||
if (input.data[nameof(OutStockStrategyQuery.warehouse_id)].ToString() == WmsWareHouseConst.WAREHOUSE_ZC_ID)
|
||||
{
|
||||
await _s_taskExecuteSemaphore_F1ZCCInstock.WaitAsync();
|
||||
}
|
||||
try
|
||||
{
|
||||
await _db.Ado.BeginTranAsync();
|
||||
@@ -217,6 +221,10 @@ namespace Tnb.WarehouseMgr
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (input.data[nameof(OutStockStrategyQuery.warehouse_id)].ToString() == WmsWareHouseConst.WAREHOUSE_ZC_ID)
|
||||
{
|
||||
_s_taskExecuteSemaphore_F1ZCCInstock.Release();
|
||||
}
|
||||
//向队列写入消息
|
||||
await InvokeGenPretaskExcute();
|
||||
}
|
||||
|
||||
@@ -65,7 +65,10 @@ namespace Tnb.WarehouseMgr
|
||||
|
||||
public async Task<dynamic> WmsEmptyOut(VisualDevModelDataCrInput input)
|
||||
{
|
||||
|
||||
if (input.data[nameof(OutStockStrategyQuery.warehouse_id)].ToString() == WmsWareHouseConst.WAREHOUSE_ZC_ID)
|
||||
{
|
||||
await _s_taskExecuteSemaphore_F1ZCCOutstock.WaitAsync();
|
||||
}
|
||||
try
|
||||
{
|
||||
await _db.Ado.BeginTranAsync();
|
||||
@@ -257,6 +260,10 @@ namespace Tnb.WarehouseMgr
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (input.data[nameof(OutStockStrategyQuery.warehouse_id)].ToString() == WmsWareHouseConst.WAREHOUSE_ZC_ID)
|
||||
{
|
||||
_s_taskExecuteSemaphore_F1ZCCOutstock.Release();
|
||||
}
|
||||
await InvokeGenPretaskExcute();
|
||||
}
|
||||
return Task.FromResult(true);
|
||||
|
||||
@@ -468,7 +468,7 @@ namespace Tnb.WarehouseMgr
|
||||
}
|
||||
});
|
||||
|
||||
await s_taskDistributeYCL2ZCC.WaitAsync();
|
||||
await _s_taskExecuteSemaphore_F1ZCCInstock.WaitAsync();
|
||||
WmsMaterialTransferD wmsMaterialTransferD = await _db.Queryable<WmsMaterialTransferD>().FirstAsync(it => it.id == input.source_id);
|
||||
WmsMaterialTransfer wmsMaterialTransfer = await _db.Queryable<WmsMaterialTransfer>().FirstAsync(it => it.id == wmsMaterialTransferD.bill_id);
|
||||
|
||||
@@ -561,7 +561,7 @@ namespace Tnb.WarehouseMgr
|
||||
}
|
||||
finally
|
||||
{
|
||||
_ = s_taskDistributeYCL2ZCC.Release();
|
||||
_s_taskExecuteSemaphore_F1ZCCInstock.Release();
|
||||
InvokeGenPretaskExcute();
|
||||
}
|
||||
|
||||
@@ -1111,7 +1111,7 @@ namespace Tnb.WarehouseMgr
|
||||
[HttpPost, NonUnify, AllowAnonymous]
|
||||
public async Task<Entities.Dto.Outputs.Result> DistributeToZCC(MaterialTransferDistributeToZCCInput input)
|
||||
{
|
||||
s_taskDistributeToZCC.Wait();
|
||||
await _s_taskExecuteSemaphore_F1ZCCOutstock.WaitAsync();
|
||||
|
||||
try
|
||||
{
|
||||
@@ -1239,7 +1239,7 @@ namespace Tnb.WarehouseMgr
|
||||
}
|
||||
finally
|
||||
{
|
||||
s_taskDistributeToZCC.Release();
|
||||
_s_taskExecuteSemaphore_F1ZCCOutstock.Release();
|
||||
InvokeGenPretaskExcute();
|
||||
}
|
||||
return await ToApiResult(HttpStatusCode.OK, "成功");
|
||||
@@ -1254,7 +1254,7 @@ namespace Tnb.WarehouseMgr
|
||||
[HttpPost, NonUnify, AllowAnonymous]
|
||||
public async Task<Entities.Dto.Outputs.Result> DistributeZCCToYCL(MaterialTransferDistributeToZCCInput input)
|
||||
{
|
||||
s_taskDistributeZCCToYCL.Wait();
|
||||
await _s_taskExecuteSemaphore_F1ZCCOutstock.WaitAsync();
|
||||
|
||||
try
|
||||
{
|
||||
@@ -1375,7 +1375,7 @@ namespace Tnb.WarehouseMgr
|
||||
}
|
||||
finally
|
||||
{
|
||||
s_taskDistributeZCCToYCL.Release();
|
||||
_s_taskExecuteSemaphore_F1ZCCOutstock.Release(); ;
|
||||
InvokeGenPretaskExcute();
|
||||
}
|
||||
return await ToApiResult(HttpStatusCode.OK, "成功");
|
||||
|
||||
@@ -57,7 +57,10 @@ namespace Tnb.WarehouseMgr
|
||||
|
||||
private async Task<dynamic> PDAWmsEmptyIn(VisualDevModelDataCrInput input)
|
||||
{
|
||||
|
||||
if (input.data[nameof(OutStockStrategyQuery.warehouse_id)].ToString() == WmsWareHouseConst.WAREHOUSE_ZC_ID)
|
||||
{
|
||||
await _s_taskExecuteSemaphore_F1ZCCInstock.WaitAsync();
|
||||
}
|
||||
try
|
||||
{
|
||||
await _db.Ado.BeginTranAsync();
|
||||
@@ -178,6 +181,10 @@ namespace Tnb.WarehouseMgr
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (input.data[nameof(OutStockStrategyQuery.warehouse_id)].ToString() == WmsWareHouseConst.WAREHOUSE_ZC_ID)
|
||||
{
|
||||
_s_taskExecuteSemaphore_F1ZCCInstock.Release();
|
||||
}
|
||||
await InvokeGenPretaskExcute();
|
||||
}
|
||||
return Task.FromResult(true);
|
||||
|
||||
@@ -59,6 +59,10 @@ namespace Tnb.WarehouseMgr
|
||||
private async Task<dynamic> PDAWmsEmptyOut(VisualDevModelDataCrInput input)
|
||||
{
|
||||
|
||||
if (input.data[nameof(OutStockStrategyQuery.warehouse_id)].ToString() == WmsWareHouseConst.WAREHOUSE_ZC_ID)
|
||||
{
|
||||
await _s_taskExecuteSemaphore_F1ZCCOutstock.WaitAsync();
|
||||
}
|
||||
try
|
||||
{
|
||||
Logger.Information("开始PDA空载具出库");
|
||||
@@ -231,6 +235,10 @@ namespace Tnb.WarehouseMgr
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (input.data[nameof(OutStockStrategyQuery.warehouse_id)].ToString() == WmsWareHouseConst.WAREHOUSE_ZC_ID)
|
||||
{
|
||||
_s_taskExecuteSemaphore_F1ZCCOutstock.Release();
|
||||
}
|
||||
await InvokeGenPretaskExcute();
|
||||
}
|
||||
return Task.FromResult(true);
|
||||
|
||||
@@ -60,6 +60,8 @@ namespace Tnb.WarehouseMgr
|
||||
var db = _db;
|
||||
if (dbConn != null)
|
||||
db = dbConn;
|
||||
|
||||
string type = "";
|
||||
try
|
||||
{
|
||||
await db.Ado.BeginTranAsync();
|
||||
@@ -67,7 +69,6 @@ namespace Tnb.WarehouseMgr
|
||||
WmsPrdInstockH prdInstockH = db.Queryable<WmsPrdInstockH>().Where(r => r.prd_bill_code == input.prd_bill_code).First();
|
||||
|
||||
string prd_instock_code_id = "";
|
||||
string type = "";
|
||||
// 新建主表
|
||||
if (prdInstockH == null)
|
||||
{
|
||||
@@ -142,6 +143,19 @@ namespace Tnb.WarehouseMgr
|
||||
|
||||
await db.Insertable(WmsPrdInstockCodes).ExecuteCommandAsync();
|
||||
|
||||
if (type == "25019163616533")
|
||||
{
|
||||
await _s_taskExecuteSemaphore_F1ZCCInstock.WaitAsync();
|
||||
}
|
||||
else if (type == "25019172714005")
|
||||
{
|
||||
await _s_taskExecuteSemaphore_F1ZCCInstock.WaitAsync();
|
||||
}
|
||||
else if (type == "25019191681045")
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
foreach (WmsPrdInstockD wmsPrdInstockD in WmsPrdInstockDs)
|
||||
{
|
||||
//入库取终点
|
||||
@@ -275,6 +289,19 @@ namespace Tnb.WarehouseMgr
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (type == "25019163616533")
|
||||
{
|
||||
_s_taskExecuteSemaphore_F1ZCCInstock.Release();
|
||||
}
|
||||
else if (type == "25019172714005")
|
||||
{
|
||||
_s_taskExecuteSemaphore_F1ZCCInstock.Release();
|
||||
}
|
||||
else if (type == "25019191681045")
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
_wareHouseService.GenTaskExecute();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user