优先级、巷道、分区
This commit is contained in:
@@ -92,6 +92,8 @@ namespace Tnb.ProductionMgr
|
||||
private Thread? ElevatorTaskExceptionHandleThread;
|
||||
// 二楼空托盘自动补充到线边
|
||||
private static Timer? F2KTPsupplementtimer;
|
||||
// 原材料仓内转移
|
||||
private static Timer? YCLInternalTransfertimer;
|
||||
|
||||
|
||||
public SemaphoreSlim s_taskCheckGet = new(1);
|
||||
@@ -110,6 +112,7 @@ namespace Tnb.ProductionMgr
|
||||
public SemaphoreSlim s_taskFloor4MJX2MJCService = new(1);
|
||||
public SemaphoreSlim s_taskFloor4DMC2CPKService = new(1);
|
||||
public SemaphoreSlim s_taskF2KTPsupplement = new(1);
|
||||
public SemaphoreSlim s_taskYCLInternalTransfer = new(1);
|
||||
|
||||
private StackExRedisHelper _redisData;
|
||||
private readonly IPrdInstockService _prdInstockService;
|
||||
@@ -120,7 +123,7 @@ namespace Tnb.ProductionMgr
|
||||
private ISqlSugarClient db_BGWCarrySupplementtimer;
|
||||
private ISqlSugarClient db_YCLGLDPJInstocktimer;
|
||||
private ISqlSugarClient db_YCLWXDPJInstocktimer;
|
||||
private ISqlSugarClient db_Floor2UpMachinecodetimer;
|
||||
private ISqlSugarClient db_Floor2UpMachinecodetimer;
|
||||
private ISqlSugarClient db_Floor2timer送空托到上升降区;
|
||||
private ISqlSugarClient db_Floor2timer送满托到下升降区;
|
||||
private ISqlSugarClient db_Floor2timer移走上升降区未生成预任务且满托的料架;
|
||||
@@ -132,6 +135,7 @@ namespace Tnb.ProductionMgr
|
||||
private ISqlSugarClient db_Floor4DMC2CPK;
|
||||
private ISqlSugarClient db_ElevatorTaskExceptionHandle;
|
||||
private ISqlSugarClient db_F2KTPsupplement;
|
||||
private ISqlSugarClient db_YCLInternalTransfer;
|
||||
|
||||
|
||||
private readonly IWmsPDAScanInStockService _wmsPDAScanInStock;
|
||||
@@ -189,6 +193,7 @@ namespace Tnb.ProductionMgr
|
||||
db_Floor4DMC2CPK = repository.CopyNew();
|
||||
db_ElevatorTaskExceptionHandle = repository.CopyNew();
|
||||
db_F2KTPsupplement = repository.CopyNew();
|
||||
db_YCLInternalTransfer = repository.CopyNew();
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -274,7 +279,7 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
|
||||
}
|
||||
}
|
||||
}
|
||||
catch(NpgsqlException ex)
|
||||
catch (NpgsqlException ex)
|
||||
{
|
||||
Console.WriteLine("【CheckGet】" + ex.Message);
|
||||
LoggerSSX.LogError(ex.ToString());
|
||||
@@ -417,8 +422,8 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
|
||||
["TagName"] = strs[3],
|
||||
["Value"] = strs[4],
|
||||
};
|
||||
LoggerBGWCarrySupplement.LogInformation($"【ScanInStock】 八工位 {key} 发送PutDoneEmptyBox指令 {_eleCtlCfg.WriteTagUrl} {JsonConvert.SerializeObject(dicCommand)}");
|
||||
HttpClientHelper.GetRequestAsync(_eleCtlCfg.WriteTagUrl, dicCommand).Wait();
|
||||
//LoggerBGWCarrySupplement.LogInformation($"【ScanInStock】 八工位 {key} 发送PutDoneEmptyBox指令 {_eleCtlCfg.WriteTagUrl} {JsonConvert.SerializeObject(dicCommand)}");
|
||||
//HttpClientHelper.GetRequestAsync(_eleCtlCfg.WriteTagUrl, dicCommand).Wait();
|
||||
|
||||
|
||||
string coderesult = await GetStringTag(strs[0], strs[2]);
|
||||
@@ -429,11 +434,11 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
|
||||
{
|
||||
WmsCarryH? carry = db_Scantimer.Queryable<WmsCarryH>().Single(it => it.carry_code == coderesult);
|
||||
LoggerBGWCarrySupplement.LogInformation($"【ScanInStock】 八工位 {key} 查找{coderesult}绑定的托盘: {JsonConvert.SerializeObject(carry)}");
|
||||
//if (carry.location_id != "30773146852470")
|
||||
//{
|
||||
// LoggerBGWCarrySupplement.LogInformation($"【ScanInStock】 八工位 {key} 查找{coderesult}绑定的托盘{carry.carry_code}起始库位既不是空也不是拆盘机,此时不能生成入库任务(防止重复生成任务)");
|
||||
// continue;
|
||||
//}
|
||||
if (carry.location_id != WmsWareHouseConst.LOCATION_YCLBGWDRK)
|
||||
{
|
||||
LoggerBGWCarrySupplement.LogInformation($"【ScanInStock】 八工位 {key} 查找{coderesult}绑定的托盘{carry.carry_code}不是待入库状态(还未绑定物料),此时不能生成入库任务(防止重复生成任务)");
|
||||
continue;
|
||||
}
|
||||
if (carry != null)
|
||||
{
|
||||
if (db_Scantimer.Queryable<WmsDistaskH>().Where(p => p.carry_id == carry.id && p.status != WmsWareHouseConst.TASK_BILL_STATUS_COMPLE_ID && p.status != WmsWareHouseConst.TASK_BILL_STATUS_CANCEL_ID).Any())
|
||||
@@ -623,6 +628,89 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 原材料仓内转移
|
||||
/// </summary>
|
||||
/// <param name="state"></param>
|
||||
private async void YCLInternalTransfer(object? state)
|
||||
{
|
||||
if (s_taskYCLInternalTransfer.CurrentCount == 0)
|
||||
return;
|
||||
await s_taskYCLInternalTransfer.WaitAsync();
|
||||
Stopwatch stopwatch = new Stopwatch();
|
||||
stopwatch.Start();
|
||||
try
|
||||
{
|
||||
Console.WriteLine($"{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")} 开始执行YCLInternalTransfer");
|
||||
LoggerTimer.LogInformation($"{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")} 开始执行YCLInternalTransfer");
|
||||
|
||||
|
||||
OutStockStrategyQuery outStockStrategyInput = new()
|
||||
{
|
||||
warehouse_id = WmsWareHouseConst.WAREHOUSE_YCL_ID,
|
||||
Region_id = WmsWareHouseConst.REGION_YCLCache_ID,
|
||||
AvoidBusyPassage = true,
|
||||
Size = 5,
|
||||
filter_carry_status = false
|
||||
};
|
||||
List<WmsCarryH> items = await _wareHouseService.OutStockStrategy(outStockStrategyInput);
|
||||
|
||||
if (items.Count < 1)
|
||||
{
|
||||
LoggerF2KTPsupplement.LogWarning($"【YCLInternalTransfer】 没有可以出库的空载具");
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (WmsCarryH wmsCarryH in items)
|
||||
{
|
||||
BasLocation startlocation = await db_YCLInternalTransfer.Queryable<BasLocation>().Where(r => r.id == wmsCarryH.location_id).FirstAsync();
|
||||
InStockStrategyQuery inStockStrategyInput = new() { warehouse_id = "1", Size = 1, passage = startlocation.passage, AvoidBusyPassage = true, Region_id = WmsWareHouseConst.REGION_Purchase_ID };
|
||||
List<BasLocation> endLocations = await _wareHouseService.InStockStrategy(inStockStrategyInput);
|
||||
if (endLocations.Count() == 0)
|
||||
|
||||
{
|
||||
LoggerYCLInternalTransfer.LogWarning($"【YCLInternalTransfer】 当前巷道没有空库位可以入库或者有任务正在执行");
|
||||
continue;
|
||||
}
|
||||
BasLocation endLocation = endLocations.First();
|
||||
await db_YCLInternalTransfer.Ado.BeginTranAsync();
|
||||
|
||||
LoggerYCLInternalTransfer.LogInformation($"【YCLInternalTransfer】托盘{wmsCarryH.carry_code} {wmsCarryH.location_code} 转移到 {endLocation.location_code}");
|
||||
|
||||
bool result_createPretask = await createPretask(wmsCarryH.location_id, endLocation.id, wmsCarryH.id, wmsCarryH.carry_code, LoggerYCLInternalTransfer, db_YCLInternalTransfer);
|
||||
if (!result_createPretask)
|
||||
{
|
||||
LoggerYCLInternalTransfer.LogWarning($"【YCLInternalTransfer】 {wmsCarryH.location_code} 到 {endLocation.location_code} 预任务生成失败");
|
||||
throw new Exception($"【YCLInternalTransfer】 {wmsCarryH.location_code} 到 {endLocation.location_code} 预任务生成失败");
|
||||
}
|
||||
LoggerYCLInternalTransfer.LogWarning($"【YCLInternalTransfer】 {wmsCarryH.location_code} 到 {endLocation.location_code} 预任务生成成功");
|
||||
await db_YCLInternalTransfer.Ado.CommitTranAsync();
|
||||
}
|
||||
_ = _wareHouseService.GenTaskExecute();
|
||||
}
|
||||
catch (ObjectDisposedException ex)
|
||||
{
|
||||
LoggerYCLInternalTransfer.LogError($"【YCLInternalTransfer】 数据库连接异常:{ex.Message}");
|
||||
LoggerYCLInternalTransfer.LogError($"【YCLInternalTransfer】 数据库连接异常:{ex.StackTrace}");
|
||||
if (ex.Source == "Npgsql")
|
||||
db_YCLInternalTransfer = _repository.AsSugarClient().CopyNew();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine("【YCLInternalTransfer】" + ex.Message);
|
||||
LoggerYCLInternalTransfer.LogError($"【YCLInternalTransfer】 数据库连接异常:{ex}");
|
||||
// 数据库连接断开时会报错
|
||||
try { await db_YCLInternalTransfer.Ado.RollbackTranAsync(); } catch { };
|
||||
}
|
||||
finally
|
||||
{
|
||||
s_taskYCLInternalTransfer.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");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 供料叠盘机空托盘自动入库
|
||||
/// </summary>
|
||||
@@ -1381,7 +1469,7 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
|
||||
LoggerFloor2RackDelivery.LogError($"【送满托到下升降区】 起点{startLocation.id} {startLocation.location_code}上存在多个料架");
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
WmsPretaskH wmsPretaskH = db_Floor2timer送满托到下升降区.Queryable<WmsPretaskH>().Where(r => r.endlocation_code == wmsMechanicalArmH.location_code
|
||||
&& r.status != WmsWareHouseConst.PRETASK_BILL_STATUS_COMPLE_ID && r.status != WmsWareHouseConst.PRETASK_BILL_STATUS_CANCEL_ID).First();
|
||||
if (wmsPretaskH != null)
|
||||
@@ -1761,7 +1849,7 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
|
||||
// finally
|
||||
// {
|
||||
// s_taskPackOutstockService.Release();
|
||||
|
||||
|
||||
// stopwatch.Stop();
|
||||
// Console.WriteLine($"{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")} 结束四楼包材自动到二楼包材库 {stopwatch.ElapsedMilliseconds} ms");
|
||||
// LoggerTimer.LogInformation($"{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")} 结束执行四楼包材自动到二楼包材库 {stopwatch.ElapsedMilliseconds} ms");
|
||||
@@ -1790,7 +1878,7 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
|
||||
await _wareHouseService.ExecuteTargetFloorTask(wmsDistaskH);
|
||||
}
|
||||
}
|
||||
catch(Exception ex)
|
||||
catch (Exception ex)
|
||||
{
|
||||
LoggerFloor2RackDelivery.LogError($"【ElevatorTaskExceptionHandle】{ex.Message}");
|
||||
LoggerFloor2RackDelivery.LogError($"【ElevatorTaskExceptionHandle】{ex.StackTrace}");
|
||||
@@ -2216,7 +2304,7 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
|
||||
//锁定终点库位
|
||||
await db_Floor4MJX2MJC.Updateable<BasLocation>().SetColumns(r => new BasLocation { is_lock = 1 }).Where(r => r.id == endlocation.id).ExecuteCommandAsync();
|
||||
|
||||
bool result_createPretask = await createPretask(startlocation.id, endlocation.id, wmsCarryH.id, wmsCarryH.carry_code,
|
||||
bool result_createPretask = await createPretask(startlocation.id, endlocation.id, wmsCarryH.id, wmsCarryH.carry_code,
|
||||
LoggerFloor4DMC2CPK, db_Floor4DMC2CPK, WmsWareHouseConst.BIZTYPE_WMSSTERILIZATIONINSTOCKCH_ID, "", wmsSterilizationInstockH.id);
|
||||
if (!result_createPretask)
|
||||
{
|
||||
@@ -2364,9 +2452,44 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
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));
|
||||
@@ -2401,6 +2524,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));
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
@@ -2432,7 +2556,7 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
|
||||
Floor4DMC2CPKtimer?.Dispose();
|
||||
ElevatorTaskExceptionHandleThread.Abort();
|
||||
F2KTPsupplementtimer?.Dispose();
|
||||
|
||||
YCLInternalTransfertimer?.Dispose();
|
||||
}
|
||||
|
||||
#region 日志
|
||||
@@ -2452,7 +2576,7 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
|
||||
{
|
||||
get
|
||||
{
|
||||
string newFileName = $"{AppContext.BaseDirectory}/logs/customElevatorTask{DateTime.Now:yyyyMMdd}.log";
|
||||
string newFileName = $"{AppContext.BaseDirectory}/logs/{DateTime.Now:yyyyMMdd}/custom{DateTime.Now:yyyyMMdd}ElevatorTask.log";
|
||||
if (_LoggerElevatorTaskFileName != newFileName)
|
||||
{
|
||||
ILoggerFactory loggerFactory = LoggerFactory.Create(builder => builder.AddFile(newFileName, cfgOpts =>
|
||||
@@ -2480,40 +2604,6 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
|
||||
}
|
||||
}
|
||||
|
||||
protected string _LoggerBGWFileName = "";
|
||||
protected ILogger _LoggerBGW;
|
||||
protected ILogger LoggerBGW
|
||||
{
|
||||
get
|
||||
{
|
||||
string newFileName = $"{AppContext.BaseDirectory}/logs/customBGW{DateTime.Now:yyyyMMdd}.log";
|
||||
if (_LoggerBGWFileName != newFileName)
|
||||
{
|
||||
ILoggerFactory loggerFactory = LoggerFactory.Create(builder => builder.AddFile(newFileName, cfgOpts =>
|
||||
{
|
||||
|
||||
//cfgOpts.DateFormat = "yyyy-MM-dd HH:mm:ss.fff";
|
||||
cfgOpts.MessageFormat = (logMsg) =>
|
||||
{
|
||||
var logLevel = s_logLevelMap[logMsg.LogLevel];
|
||||
var sb = new StringBuilder();
|
||||
_ = sb.Append($"[{logLevel}] ");
|
||||
_ = sb.Append($"{logMsg.LogName} ");
|
||||
_ = sb.Append($"{DateTime.Now:yyyy-MM-dd HH:mm:ss.fff} ");
|
||||
_ = sb.Append($"#{logMsg.EventId.Id} ");
|
||||
_ = sb.Append(logMsg.Message + " ");
|
||||
_ = sb.Append(logMsg.Exception?.ToString());
|
||||
return sb.ToString();
|
||||
};
|
||||
|
||||
}));
|
||||
_LoggerBGW = loggerFactory.CreateLogger(this.GetType());
|
||||
_LoggerBGWFileName = newFileName;
|
||||
}
|
||||
return _LoggerBGW;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected string _LoggerSSXFileName = "";
|
||||
protected ILogger _LoggerSSX;
|
||||
@@ -2521,7 +2611,7 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
|
||||
{
|
||||
get
|
||||
{
|
||||
string newFileName = $"{AppContext.BaseDirectory}/logs/customSSX{DateTime.Now:yyyyMMdd}.log";
|
||||
string newFileName = $"{AppContext.BaseDirectory}/logs/{DateTime.Now:yyyyMMdd}/中储仓/custom{DateTime.Now:yyyyMMdd}中储仓输送线.log";
|
||||
if (_LoggerSSXFileName != newFileName)
|
||||
{
|
||||
ILoggerFactory loggerFactory = LoggerFactory.Create(builder => builder.AddFile(newFileName, cfgOpts =>
|
||||
@@ -2556,7 +2646,7 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
|
||||
{
|
||||
get
|
||||
{
|
||||
string newFileName = $"{AppContext.BaseDirectory}/logs/customFloor2UpDownMachine{DateTime.Now:yyyyMMdd}.log";
|
||||
string newFileName = $"{AppContext.BaseDirectory}/logs/{DateTime.Now:yyyyMMdd}/二楼暂存仓/custom{DateTime.Now:yyyyMMdd}二楼暂存仓机械手.log";
|
||||
if (_LoggerFloor2UpDownMachineFileName != newFileName)
|
||||
{
|
||||
ILoggerFactory loggerFactory = LoggerFactory.Create(builder => builder.AddFile(newFileName, cfgOpts =>
|
||||
@@ -2591,7 +2681,7 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
|
||||
{
|
||||
get
|
||||
{
|
||||
string newFileName = $"{AppContext.BaseDirectory}/logs/customFloor2RackDelivery{DateTime.Now:yyyyMMdd}.log";
|
||||
string newFileName = $"{AppContext.BaseDirectory}/logs/{DateTime.Now:yyyyMMdd}/二楼暂存仓/custom{DateTime.Now:yyyyMMdd}二楼暂存仓配送任务.log";
|
||||
if (_LoggerFloor2RackDeliveryFileName != newFileName)
|
||||
{
|
||||
ILoggerFactory loggerFactory = LoggerFactory.Create(builder => builder.AddFile(newFileName, cfgOpts =>
|
||||
@@ -2625,7 +2715,7 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
|
||||
{
|
||||
get
|
||||
{
|
||||
string newFileName = $"{AppContext.BaseDirectory}/logs/customBGWCarrySupplement{DateTime.Now:yyyyMMdd}.log";
|
||||
string newFileName = $"{AppContext.BaseDirectory}/logs/{DateTime.Now:yyyyMMdd}/原材料仓/custom{DateTime.Now:yyyyMMdd}八工位空托盘补充.log";
|
||||
if (_LoggerBGWCarrySupplementFileName != newFileName)
|
||||
{
|
||||
ILoggerFactory loggerFactory = LoggerFactory.Create(builder => builder.AddFile(newFileName, cfgOpts =>
|
||||
@@ -2659,7 +2749,7 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
|
||||
{
|
||||
get
|
||||
{
|
||||
string newFileName = $"{AppContext.BaseDirectory}/logs/customYCLGLDPJInstock{DateTime.Now:yyyyMMdd}.log";
|
||||
string newFileName = $"{AppContext.BaseDirectory}/logs/{DateTime.Now:yyyyMMdd}/原材料仓/custom{DateTime.Now:yyyyMMdd}原材料供料叠盘机.log";
|
||||
if (_LoggerYCLGLDPJInstockFileName != newFileName)
|
||||
{
|
||||
ILoggerFactory loggerFactory = LoggerFactory.Create(builder => builder.AddFile(newFileName, cfgOpts =>
|
||||
@@ -2693,7 +2783,7 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
|
||||
{
|
||||
get
|
||||
{
|
||||
string newFileName = $"{AppContext.BaseDirectory}/logs/customTimer{DateTime.Now:yyyyMMdd}.log";
|
||||
string newFileName = $"{AppContext.BaseDirectory}/logs/{DateTime.Now:yyyyMMdd}/custom{DateTime.Now:yyyyMMdd}Timer.log";
|
||||
if (_LoggerTimerFileName != newFileName)
|
||||
{
|
||||
ILoggerFactory loggerFactory = LoggerFactory.Create(builder => builder.AddFile(newFileName, cfgOpts =>
|
||||
@@ -2727,7 +2817,7 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
|
||||
{
|
||||
get
|
||||
{
|
||||
string newFileName = $"{AppContext.BaseDirectory}/logs/customFloor4DMJ2MJX{DateTime.Now:yyyyMMdd}.log";
|
||||
string newFileName = $"{AppContext.BaseDirectory}/logs/{DateTime.Now:yyyyMMdd}/四楼灭菌/custom{DateTime.Now:yyyyMMdd}待灭菌到上料点.log";
|
||||
if (_LoggerFloor4DMJ2MJXFileName != newFileName)
|
||||
{
|
||||
ILoggerFactory loggerFactory = LoggerFactory.Create(builder => builder.AddFile(newFileName, cfgOpts =>
|
||||
@@ -2761,7 +2851,7 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
|
||||
{
|
||||
get
|
||||
{
|
||||
string newFileName = $"{AppContext.BaseDirectory}/logs/customFloor4MJX2MJC{DateTime.Now:yyyyMMdd}.log";
|
||||
string newFileName = $"{AppContext.BaseDirectory}/logs/{DateTime.Now:yyyyMMdd}/四楼灭菌/custom{DateTime.Now:yyyyMMdd}下料点到灭菌区.log";
|
||||
if (_LoggerFloor4MJX2MJCFileName != newFileName)
|
||||
{
|
||||
ILoggerFactory loggerFactory = LoggerFactory.Create(builder => builder.AddFile(newFileName, cfgOpts =>
|
||||
@@ -2795,7 +2885,7 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
|
||||
{
|
||||
get
|
||||
{
|
||||
string newFileName = $"{AppContext.BaseDirectory}/logs/customFloor4DMC2CPK{DateTime.Now:yyyyMMdd}.log";
|
||||
string newFileName = $"{AppContext.BaseDirectory}/logs/{DateTime.Now:yyyyMMdd}/四楼灭菌/custom{DateTime.Now:yyyyMMdd}灭菌仓到成品仓.log";
|
||||
if (_LoggerFloor4DMC2CPKFileName != newFileName)
|
||||
{
|
||||
ILoggerFactory loggerFactory = LoggerFactory.Create(builder => builder.AddFile(newFileName, cfgOpts =>
|
||||
@@ -2829,7 +2919,7 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
|
||||
{
|
||||
get
|
||||
{
|
||||
string newFileName = $"{AppContext.BaseDirectory}/logs/custom二楼空托盘补充{DateTime.Now:yyyyMMdd}.log";
|
||||
string newFileName = $"{AppContext.BaseDirectory}/logs/{DateTime.Now:yyyyMMdd}/二楼组装线/custom{DateTime.Now:yyyyMMdd}二楼空托盘补充.log";
|
||||
if (_LoggerF2KTPsupplementFileName != newFileName)
|
||||
{
|
||||
ILoggerFactory loggerFactory = LoggerFactory.Create(builder => builder.AddFile(newFileName, cfgOpts =>
|
||||
@@ -2856,6 +2946,41 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
|
||||
return _LoggerF2KTPsupplement;
|
||||
}
|
||||
}
|
||||
|
||||
protected string _LoggerYCLInternalTransferFileName = "";
|
||||
protected ILogger _LoggerYCLInternalTransfer;
|
||||
protected ILogger LoggerYCLInternalTransfer
|
||||
{
|
||||
get
|
||||
{
|
||||
string newFileName = $"{AppContext.BaseDirectory}/logs/{DateTime.Now:yyyyMMdd}/原材料仓/custom{DateTime.Now:yyyyMMdd}原材料仓内转移.log";
|
||||
if (_LoggerYCLInternalTransferFileName != newFileName)
|
||||
{
|
||||
ILoggerFactory loggerFactory = LoggerFactory.Create(builder => builder.AddFile(newFileName, cfgOpts =>
|
||||
{
|
||||
|
||||
//cfgOpts.DateFormat = "yyyy-MM-dd HH:mm:ss.fff";
|
||||
cfgOpts.MessageFormat = (logMsg) =>
|
||||
{
|
||||
var logLevel = s_logLevelMap[logMsg.LogLevel];
|
||||
var sb = new StringBuilder();
|
||||
_ = sb.Append($"[{logLevel}] ");
|
||||
_ = sb.Append($"{logMsg.LogName} ");
|
||||
_ = sb.Append($"{DateTime.Now:yyyy-MM-dd HH:mm:ss.fff} ");
|
||||
_ = sb.Append($"#{logMsg.EventId.Id} ");
|
||||
_ = sb.Append(logMsg.Message + " ");
|
||||
_ = sb.Append(logMsg.Exception?.ToString());
|
||||
return sb.ToString();
|
||||
};
|
||||
|
||||
}));
|
||||
_LoggerYCLInternalTransfer = loggerFactory.CreateLogger(this.GetType());
|
||||
_LoggerYCLInternalTransferFileName = newFileName;
|
||||
}
|
||||
return _LoggerYCLInternalTransfer;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user