add-添加喷码机心跳报警

dev
liuwf 4 months ago
parent 5d543ce35a
commit 7453cd61d2

@ -54,6 +54,8 @@ namespace SlnMesnac.Business
private FJ500Comm.FJ500SP fj500s = new FJ500Comm.FJ500SP();
//喷码机喷码失败或者设备状态检查重试次数
private int PmTryAmount = 0;
//喷码机心跳每次收到回复刷新时间如果超过1分钟则认为喷码机断开连接添加一条报警
private DateTime PmHeartTime = DateTime.Now;
private readonly IMesProductPlanService _mesProductPlanService;
private readonly IMesProductOrderService _mesProductOrderService;
private readonly IMesPrdBarCodeService _barCodeTaskService;
@ -135,6 +137,15 @@ namespace SlnMesnac.Business
_logger.LogError("checkStatus异常:" + ex.Message);
}
Thread.Sleep(1000 * 30);
if (DateTime.Now - PmHeartTime > TimeSpan.FromMinutes(2))
{
//报警
_logger.LogError("====================喷码机通讯心跳失败预警,推送报警");
AddAlarm(WarnStatusEnum.30);
PmTryAmount++;
}
}
});
}
@ -149,6 +160,7 @@ namespace SlnMesnac.Business
/// <param name="str"></param>
private void PmCodeHandler(string str)
{
PmHeartTime = DateTime.Now;
try
{
int LastTryAmount = PmTryAmount;

@ -84,10 +84,12 @@ namespace SlnMesnac.Business
_mesPrdBarCodeService = serviceProvider.GetRequiredService<IMesPrdBarCodeService>();
_configInfoBusiness = configInfoBusiness;
}
public void TestTran()
{

@ -46,9 +46,9 @@ namespace SlnMesnac.Serilog
#endregion
Log.Logger = new LoggerConfiguration().MinimumLevel.Information().WriteTo.Console()
.WriteTo.File(Path.Combine(logPath, "Info.log"), LogEventLevel.Information, fileSizeLimitBytes: 5 * 1024)
.WriteTo.File(Path.Combine(logPath, "Error.log"), LogEventLevel.Error, fileSizeLimitBytes: 5 * 1024)
.WriteTo.File(Path.Combine(logPath, "Warn.log"), LogEventLevel.Warning, fileSizeLimitBytes: 5 * 1024)
.WriteTo.File(Path.Combine(logPath, "Info.log"), LogEventLevel.Information)
.WriteTo.File(Path.Combine(logPath, "Error.log"), LogEventLevel.Error)
.WriteTo.File(Path.Combine(logPath, "Warn.log"), LogEventLevel.Warning)
//.WriteTo.File(Path.Combine(logPath, "Debug.log"), LogEventLevel.Debug, fileSizeLimitBytes: 5 * 1024)
.CreateLogger();
app.UseSerilogRequestLogging();

@ -238,7 +238,6 @@ namespace SlnMesnac.WPF.Page
}
/// <summary>
/// OEE设备关机采集
/// </summary>

Loading…
Cancel
Save