销售发货接口、原材料仓优化调整、日志优化

This commit is contained in:
2024-07-29 15:49:52 +08:00
parent 0e09a8187c
commit b1027b6e49
15 changed files with 393 additions and 76 deletions

View File

@@ -391,9 +391,9 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
//扫码入库
private async void ScanInStock(object? state)
{
if (s_taskScan.CurrentCount == 0)
if (_wareHouseService.s_taskExecuteSemaphore_YCLInstock.CurrentCount == 0)
return;
await s_taskScan.WaitAsync();
await _wareHouseService.s_taskExecuteSemaphore_YCLInstock.WaitAsync();
Stopwatch stopwatch = new Stopwatch();
stopwatch.Start();
try
@@ -485,7 +485,7 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
}
finally
{
s_taskScan.Release();
_wareHouseService.s_taskExecuteSemaphore_YCLInstock.Release();
stopwatch.Stop();
Console.WriteLine($"{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")} 结束执行ScanInStock {stopwatch.ElapsedMilliseconds} ms");
LoggerTimer.LogInformation($"{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")} 结束执行ScanInStock {stopwatch.ElapsedMilliseconds} ms");
@@ -634,9 +634,13 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
/// <param name="state"></param>
private async void YCLInternalTransfer(object? state)
{
if (s_taskYCLInternalTransfer.CurrentCount == 0)
if (_wareHouseService.s_taskExecuteSemaphore_YCLInstock.CurrentCount == 0)
return;
await s_taskYCLInternalTransfer.WaitAsync();
if (_wareHouseService.s_taskExecuteSemaphore_YCLOutstock.CurrentCount == 0)
return;
await _wareHouseService.s_taskExecuteSemaphore_YCLInstock.WaitAsync();
await _wareHouseService.s_taskExecuteSemaphore_YCLOutstock.WaitAsync();
Stopwatch stopwatch = new Stopwatch();
stopwatch.Start();
try
@@ -650,7 +654,7 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
warehouse_id = WmsWareHouseConst.WAREHOUSE_YCL_ID,
Region_id = WmsWareHouseConst.REGION_YCLCache_ID,
AvoidBusyPassage = true,
Size = 5,
Size = 76,
filter_carry_status = false
};
List<WmsCarryH> items = await _wareHouseService.OutStockStrategy(outStockStrategyInput);
@@ -704,7 +708,9 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
}
finally
{
s_taskYCLInternalTransfer.Release();
_wareHouseService.s_taskExecuteSemaphore_YCLInstock.Release();
_wareHouseService.s_taskExecuteSemaphore_YCLOutstock.Release();
stopwatch.Stop();
Console.WriteLine($"{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")} 结束执行YCLInternalTransfer {stopwatch.ElapsedMilliseconds} ms");
LoggerTimer.LogInformation($"{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")} 结束执行YCLInternalTransfer {stopwatch.ElapsedMilliseconds} ms");
@@ -716,9 +722,9 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
/// </summary>
private async void YCLGLDPJInstock(object? state)
{
if (s_taskYCLGLDPJInstock.CurrentCount == 0)
if (_wareHouseService.s_taskExecuteSemaphore_YCLInstock.CurrentCount == 0)
return;
await s_taskYCLGLDPJInstock.WaitAsync();
await _wareHouseService.s_taskExecuteSemaphore_YCLInstock.WaitAsync();
Stopwatch stopwatch = new Stopwatch();
stopwatch.Start();
try
@@ -752,11 +758,11 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
continue;
}
// 找到未锁定且未占用的库位
var endLocations = db_YCLGLDPJInstocktimer.Queryable<BasLocation>()
.Where(a => a.is_lock == 0 && a.is_use == "0" && a.wh_id == WmsWareHouseConst.WAREHOUSE_YCL_ID && a.location_code.Contains("YCL-") && a.is_type == "0");
LoggerYCLGLDPJInstock.LogInformation($"【YCLGLDPJInstock】 sql {endLocations.ToSqlString()}");
// 找到未锁定且未占用的库位
InStockStrategyQuery inStockStrategyInput = new() { warehouse_id = "1", Size = 1, AvoidBusyPassage = true, Region_id = WmsWareHouseConst.REGION_Purchase_ID };
List<BasLocation> endLocations = await _wareHouseService.InStockStrategy(inStockStrategyInput);
if (endLocations.Count() == 0)
{
@@ -802,7 +808,7 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
}
finally
{
s_taskYCLGLDPJInstock.Release();
_wareHouseService.s_taskExecuteSemaphore_YCLInstock.Release();
stopwatch.Stop();
Console.WriteLine($"{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")} 结束执行YCLGLDPJInstock {stopwatch.ElapsedMilliseconds} ms");
LoggerTimer.LogInformation($"{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")} 结束执行YCLGLDPJInstock {stopwatch.ElapsedMilliseconds} ms");
@@ -814,9 +820,9 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
/// </summary>
private async void YCLWXDPJInstock(object? state)
{
if (s_taskYCLWXDPJInstock.CurrentCount == 0)
if (_wareHouseService.s_taskExecuteSemaphore_YCLInstock.CurrentCount == 0)
return;
await s_taskYCLWXDPJInstock.WaitAsync();
await _wareHouseService.s_taskExecuteSemaphore_YCLInstock.WaitAsync();
Stopwatch stopwatch = new Stopwatch();
stopwatch.Start();
try
@@ -849,10 +855,8 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
}
// 找到未锁定且未占用的库位
var endLocations = db_YCLWXDPJInstocktimer.Queryable<BasLocation>()
.Where(a => a.is_lock == 0 && a.is_use == "0" && a.wh_id == WmsWareHouseConst.WAREHOUSE_YCL_ID && a.location_code.Contains("YCL-") && a.is_type == "0");
LoggerYCLGLDPJInstock.LogInformation($"【YCLWXDPJInstock】 sql {endLocations.ToSqlString()}");
InStockStrategyQuery inStockStrategyInput = new() { warehouse_id = "1", Size = 1, AvoidBusyPassage = true, Region_id = WmsWareHouseConst.REGION_Purchase_ID };
List<BasLocation> endLocations = await _wareHouseService.InStockStrategy(inStockStrategyInput);
if (endLocations.Count() == 0)
{
@@ -897,7 +901,7 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
}
finally
{
s_taskYCLWXDPJInstock.Release();
_wareHouseService.s_taskExecuteSemaphore_YCLInstock.Release();
stopwatch.Stop();
Console.WriteLine($"{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")} 结束执行YCLWXDPJInstock {stopwatch.ElapsedMilliseconds} ms");
LoggerTimer.LogInformation($"{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")} 结束执行YCLWXDPJInstock {stopwatch.ElapsedMilliseconds} ms");
@@ -2459,41 +2463,6 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
public Task StartAsync(CancellationToken cancellationToken)
{
//Readtimer = new Timer(GetRedisData, null, TimeSpan.Zero, TimeSpan.FromSeconds(300));
CheckGettimer = new Timer(CheckGet, null, TimeSpan.Zero, TimeSpan.FromSeconds(2));
Scantimer = new Timer(ScanInStock, null, TimeSpan.Zero, TimeSpan.FromSeconds(2));
SSXcodetimer = new Timer(SSXcode, null, TimeSpan.Zero, TimeSpan.FromSeconds(2));
// 八工位缓存区补充空托盘
BGWCarrySupplementtimer = new Timer(BGWCarrySupplement, null, TimeSpan.Zero, TimeSpan.FromSeconds(2));
// 供料叠盘机空托盘自动入库
YCLGLDPJInstocktimer = new Timer(YCLGLDPJInstock, null, TimeSpan.Zero, TimeSpan.FromSeconds(2));
// 外协叠盘机空托盘自动入库
//YCLWXDPJInstocktimer = new Timer(YCLWXDPJInstock, null, TimeSpan.Zero, TimeSpan.FromSeconds(100000));
// 二楼上升降机
Floor2UpMachinecodetimer = new Timer(Floor2UpMachinecode, null, TimeSpan.Zero, TimeSpan.FromSeconds(2));
// 二楼料架配送
Floor2timer送空托到上升降区 = new Timer(, null, TimeSpan.Zero, TimeSpan.FromSeconds(2));
Floor2timer送满托到下升降区 = new Timer(, null, TimeSpan.Zero, TimeSpan.FromSeconds(2));
Floor2timer移走上升降区未生成预任务且满托的料架 = new Timer(, null, TimeSpan.Zero, TimeSpan.FromSeconds(2));
Floor2timer移走下升降区未生成预任务且空托的料架 = new Timer(, null, TimeSpan.Zero, TimeSpan.FromSeconds(2));
GenTaskExecutetimer = new Timer(GenTaskExecute, null, TimeSpan.Zero, TimeSpan.FromSeconds(2));
// 停用
//PackOutstockServicetimer = new Timer(PackOutstockService, null, TimeSpan.Zero, TimeSpan.FromSeconds(60));
ElevatorTaskExceptionHandleThread = new Thread(ElevatorTaskExceptionHandle);
ElevatorTaskExceptionHandleThread.Start();
Floor4DMJ2MJXtimer = new Timer(Floor4DMJ2MJX, null, TimeSpan.Zero, TimeSpan.FromSeconds(2));
Floor4MJX2MJCtimer = new Timer(Floor4MJX2MJC, null, TimeSpan.Zero, TimeSpan.FromSeconds(2));
Floor4DMC2CPKtimer = new Timer(Floor4DMC2CPK, null, TimeSpan.Zero, TimeSpan.FromSeconds(2));
F2KTPsupplementtimer = new Timer(F2KTPsupplement, null, TimeSpan.Zero, TimeSpan.FromSeconds(2));//Readtimer = new Timer(GetRedisData, null, TimeSpan.Zero, TimeSpan.FromSeconds(300));
CheckGettimer = new Timer(CheckGet, null, TimeSpan.Zero, TimeSpan.FromSeconds(10));
Scantimer = new Timer(ScanInStock, null, TimeSpan.Zero, TimeSpan.FromSeconds(60));
SSXcodetimer = new Timer(SSXcode, null, TimeSpan.Zero, TimeSpan.FromSeconds(10));
@@ -2504,7 +2473,7 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
YCLGLDPJInstocktimer = new Timer(YCLGLDPJInstock, null, TimeSpan.Zero, TimeSpan.FromSeconds(30));
// 外协叠盘机空托盘自动入库
//YCLWXDPJInstocktimer = new Timer(YCLWXDPJInstock, null, TimeSpan.Zero, TimeSpan.FromSeconds(100000));
YCLWXDPJInstocktimer = new Timer(YCLWXDPJInstock, null, TimeSpan.Zero, TimeSpan.FromSeconds(30));
// 二楼上升降机
Floor2UpMachinecodetimer = new Timer(Floor2UpMachinecode, null, TimeSpan.Zero, TimeSpan.FromSeconds(20));
@@ -2528,7 +2497,7 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
Floor4DMC2CPKtimer = new Timer(Floor4DMC2CPK, null, TimeSpan.Zero, TimeSpan.FromSeconds(30));
F2KTPsupplementtimer = new Timer(F2KTPsupplement, null, TimeSpan.Zero, TimeSpan.FromSeconds(30));
YCLInternalTransfertimer = new Timer(YCLInternalTransfer, null, TimeSpan.Zero, TimeSpan.FromSeconds(180));
YCLInternalTransfertimer = new Timer(YCLInternalTransfer, null, TimeSpan.Zero, TimeSpan.FromSeconds(10800));
return Task.CompletedTask;
}