二楼缓存仓和暂存仓出入库优化
This commit is contained in:
@@ -47,14 +47,21 @@ namespace Tnb.WarehouseMgr
|
||||
public static SemaphoreSlim s_taskExecuteSemaphore = new(1);
|
||||
public static SemaphoreSlim s_elevatorStatusSemaphore = new(1);
|
||||
|
||||
|
||||
public static SemaphoreSlim _s_taskExecuteSemaphore_YCLInstock = new(1);
|
||||
public static SemaphoreSlim _s_taskExecuteSemaphore_YCLOutstock = new(1);
|
||||
|
||||
|
||||
public static SemaphoreSlim _s_taskExecuteSemaphore_F1ZCCInstock = new(1);
|
||||
public static SemaphoreSlim _s_taskExecuteSemaphore_F1ZCCOutstock = new(1);
|
||||
|
||||
public static SemaphoreSlim _s_taskExecuteSemaphore_F2ZCCInstock = new(1);
|
||||
public static SemaphoreSlim _s_taskExecuteSemaphore_F2ZCCOutstock = new(1);
|
||||
|
||||
public static SemaphoreSlim _s_taskExecuteSemaphore_F2HCCInstock = new(1);
|
||||
public static SemaphoreSlim _s_taskExecuteSemaphore_F2HCCOutstock = new(1);
|
||||
|
||||
public static SemaphoreSlim _s_taskExecuteSemaphore_F4DMJCInstock = new(1);
|
||||
public static SemaphoreSlim _s_taskExecuteSemaphore_F4DMJCOutstock = new(1);
|
||||
|
||||
protected static Dictionary<string, int> _s_eleUseStatusDic;
|
||||
|
||||
protected IEventPublisher? EventPublisher { set; get; }
|
||||
|
||||
@@ -109,6 +109,17 @@ namespace Tnb.WarehouseMgr
|
||||
get { return _s_taskExecuteSemaphore_F1ZCCOutstock; }
|
||||
}
|
||||
|
||||
public SemaphoreSlim s_taskExecuteSemaphore_F2ZCCInstock
|
||||
{
|
||||
get { return _s_taskExecuteSemaphore_F2ZCCInstock; }
|
||||
}
|
||||
|
||||
public SemaphoreSlim s_taskExecuteSemaphore_F2ZCCOutstock
|
||||
{
|
||||
get { return _s_taskExecuteSemaphore_F2ZCCOutstock; }
|
||||
}
|
||||
|
||||
|
||||
|
||||
public WareHouseService(ISqlSugarRepository<WmsInstockH> repository, IDictionaryDataService dictionaryDataService, StackExRedisHelper redisData,
|
||||
IBillRullService billRullService, IUserManager userManager, ICacheManager cacheManager, IElevatorControlService elevatorControlService,
|
||||
|
||||
@@ -580,6 +580,8 @@ namespace Tnb.WarehouseMgr
|
||||
{
|
||||
try
|
||||
{
|
||||
await _s_taskExecuteSemaphore_F2HCCOutstock.WaitAsync();
|
||||
|
||||
if (string.IsNullOrEmpty(input.source_id))
|
||||
{
|
||||
throw new AppFriendlyException("来源单据id不可为空", 500);
|
||||
@@ -642,8 +644,6 @@ namespace Tnb.WarehouseMgr
|
||||
PrdMoTask prdMoTask = organizeEntityCXs.First();
|
||||
|
||||
|
||||
|
||||
await s_taskExecuteSemaphore.WaitAsync();
|
||||
await _db.Ado.BeginTranAsync();
|
||||
|
||||
//入库取终点 //出库起点
|
||||
@@ -711,7 +711,7 @@ namespace Tnb.WarehouseMgr
|
||||
}
|
||||
finally
|
||||
{
|
||||
_ = s_taskExecuteSemaphore.Release();
|
||||
_s_taskExecuteSemaphore_F2HCCOutstock.Release();
|
||||
InvokeGenPretaskExcute();
|
||||
}
|
||||
|
||||
@@ -1532,6 +1532,7 @@ namespace Tnb.WarehouseMgr
|
||||
{
|
||||
try
|
||||
{
|
||||
await _s_taskExecuteSemaphore_F2ZCCOutstock.WaitAsync();
|
||||
OrganizeEntity organizeEntity = _db.Queryable<OrganizeEntity>().Where(r => r.Id == input.workstation_id).First();
|
||||
if (organizeEntity == null)
|
||||
{
|
||||
@@ -1632,6 +1633,10 @@ namespace Tnb.WarehouseMgr
|
||||
Logger.LogError("【CallRackToProductionLine】" + ex.StackTrace);
|
||||
return await ToApiResult(HttpStatusCode.InternalServerError, ex.Message);
|
||||
}
|
||||
finally
|
||||
{
|
||||
_s_taskExecuteSemaphore_F2ZCCOutstock.Release();
|
||||
}
|
||||
|
||||
return await ToApiResult(HttpStatusCode.OK, "成功");
|
||||
}
|
||||
@@ -1738,6 +1743,7 @@ namespace Tnb.WarehouseMgr
|
||||
{
|
||||
try
|
||||
{
|
||||
await _s_taskExecuteSemaphore_F2ZCCInstock.WaitAsync();
|
||||
List<WmsCarryD> wmsCarryDs = _db.Queryable<WmsCarryD>().Where(r => r.carry_id == wmsCarryH.id).ToList();
|
||||
if (wmsCarryDs.Count > 0)
|
||||
{
|
||||
@@ -1839,6 +1845,10 @@ namespace Tnb.WarehouseMgr
|
||||
await _db.Ado.RollbackTranAsync();
|
||||
return await ToApiResult(HttpStatusCode.InternalServerError, ex.Message);
|
||||
}
|
||||
finally
|
||||
{
|
||||
_s_taskExecuteSemaphore_F2ZCCInstock.Release();
|
||||
}
|
||||
return await ToApiResult(HttpStatusCode.OK, "成功");
|
||||
}
|
||||
|
||||
@@ -1846,6 +1856,7 @@ namespace Tnb.WarehouseMgr
|
||||
{
|
||||
try
|
||||
{
|
||||
await _s_taskExecuteSemaphore_F2HCCInstock.WaitAsync();
|
||||
BasLocation startlocation = _db.Queryable<BasLocation>().Where(r => r.id == input.startlocation_id).First();
|
||||
if (startlocation == null)
|
||||
{
|
||||
@@ -1898,6 +1909,10 @@ namespace Tnb.WarehouseMgr
|
||||
await _db.Ado.RollbackTranAsync();
|
||||
return await ToApiResult(HttpStatusCode.InternalServerError, ex.Message);
|
||||
}
|
||||
finally
|
||||
{
|
||||
_s_taskExecuteSemaphore_F2HCCInstock.Release();
|
||||
}
|
||||
return await ToApiResult(HttpStatusCode.OK, "成功");
|
||||
}
|
||||
|
||||
|
||||
@@ -60,9 +60,9 @@ namespace Tnb.WarehouseMgr
|
||||
{
|
||||
|
||||
if (input.data[nameof(OutStockStrategyQuery.warehouse_id)].ToString() == WmsWareHouseConst.WAREHOUSE_ZC_ID)
|
||||
{
|
||||
await _s_taskExecuteSemaphore_F1ZCCOutstock.WaitAsync();
|
||||
}
|
||||
else if (input.data[nameof(OutStockStrategyQuery.warehouse_id)].ToString() == WmsWareHouseConst.WAREHOUSE_HCC_ID)
|
||||
await _s_taskExecuteSemaphore_F2HCCOutstock.WaitAsync();
|
||||
try
|
||||
{
|
||||
Logger.Information("开始PDA空载具出库");
|
||||
@@ -236,9 +236,10 @@ namespace Tnb.WarehouseMgr
|
||||
finally
|
||||
{
|
||||
if (input.data[nameof(OutStockStrategyQuery.warehouse_id)].ToString() == WmsWareHouseConst.WAREHOUSE_ZC_ID)
|
||||
{
|
||||
_s_taskExecuteSemaphore_F1ZCCOutstock.Release();
|
||||
}
|
||||
else if (input.data[nameof(OutStockStrategyQuery.warehouse_id)].ToString() == WmsWareHouseConst.WAREHOUSE_HCC_ID)
|
||||
_s_taskExecuteSemaphore_F2HCCOutstock.Release();
|
||||
|
||||
await InvokeGenPretaskExcute();
|
||||
}
|
||||
return Task.FromResult(true);
|
||||
|
||||
@@ -143,15 +143,15 @@ namespace Tnb.WarehouseMgr
|
||||
|
||||
await db.Insertable(WmsPrdInstockCodes).ExecuteCommandAsync();
|
||||
|
||||
if (type == "25019163616533")
|
||||
if (type == DictConst.PrdMoTypeZS)
|
||||
{
|
||||
await _s_taskExecuteSemaphore_F1ZCCInstock.WaitAsync();
|
||||
}
|
||||
else if (type == "25019172714005")
|
||||
else if (type == DictConst.PrdMoTypeJC)
|
||||
{
|
||||
await _s_taskExecuteSemaphore_F1ZCCInstock.WaitAsync();
|
||||
await _s_taskExecuteSemaphore_F2HCCInstock.WaitAsync();
|
||||
}
|
||||
else if (type == "25019191681045")
|
||||
else if (type == DictConst.PrdMoTypeBZ)
|
||||
{
|
||||
|
||||
}
|
||||
@@ -177,7 +177,7 @@ namespace Tnb.WarehouseMgr
|
||||
string startlocation_id_ssx = null;
|
||||
|
||||
|
||||
if (type == "25019163616533")
|
||||
if (type == DictConst.PrdMoTypeZS)
|
||||
{
|
||||
Logger.LogInformation($"【PrdInstock】注塑车间生产提报");
|
||||
// 注塑线边库到2,4输送线
|
||||
@@ -231,7 +231,7 @@ namespace Tnb.WarehouseMgr
|
||||
throw new Exception($"注塑车间生成到中储仓的任务失败 {res2.msg}");
|
||||
}
|
||||
}
|
||||
else if (type == "25019172714005")
|
||||
else if (type == DictConst.PrdMoTypeJC)
|
||||
{
|
||||
Logger.LogInformation($"【PrdInstock】挤出车间生产提报");
|
||||
WmsCarryH wmsCarryH = await db.Queryable<WmsCarryH>().Where(r => r.id == wmsPrdInstockD.carry_id).FirstAsync();
|
||||
@@ -253,7 +253,7 @@ namespace Tnb.WarehouseMgr
|
||||
throw new Exception($"挤出车间生成到中储仓的任务失败 {res2.msg}");
|
||||
}
|
||||
}
|
||||
else if (type == "25019191681045")
|
||||
else if (type == DictConst.PrdMoTypeBZ)
|
||||
{
|
||||
Logger.LogInformation($"【PrdInstock】包装车间生产提报");
|
||||
WmsCarryH wmsCarryH = await db.Queryable<WmsCarryH>().Where(r => r.id == wmsPrdInstockD.carry_id).FirstAsync();
|
||||
@@ -289,15 +289,15 @@ namespace Tnb.WarehouseMgr
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (type == "25019163616533")
|
||||
if (type == DictConst.PrdMoTypeZS)
|
||||
{
|
||||
_s_taskExecuteSemaphore_F1ZCCInstock.Release();
|
||||
}
|
||||
else if (type == "25019172714005")
|
||||
else if (type == DictConst.PrdMoTypeJC)
|
||||
{
|
||||
_s_taskExecuteSemaphore_F1ZCCInstock.Release();
|
||||
_s_taskExecuteSemaphore_F2HCCInstock.Release();
|
||||
}
|
||||
else if (type == "25019191681045")
|
||||
else if (type == DictConst.PrdMoTypeBZ)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user