日志重写

This commit is contained in:
a88359121
2025-07-31 11:04:47 +08:00
parent a803360523
commit 941564d8a4
28 changed files with 325 additions and 399 deletions
+22 -19
View File
@@ -17,6 +17,8 @@ namespace JinYuan.MES
{
public class MesDataProcess : IMes
{
private static LoggerHelp _logger = new LoggerHelp();
#region 1、登录验证
/// <summary>
/// 登录MES验证
@@ -80,7 +82,7 @@ namespace JinYuan.MES
catch (Exception ex)
{
resJson = $"调用员工权限校验接口发生异常:{ex.Message}";
LogHelper.Instance.WriteEX("调用员工权限校验接口", ex);
LoggerHelp.WriteEX("调用员工权限校验接口", ex);
}
return res;
@@ -145,8 +147,9 @@ namespace JinYuan.MES
catch (Exception ex)
{
resJson = $"设备参数设定值请求接口发生异常:{ex.Message}";
LogHelper.Instance.WriteEX("设备参数设定值请求接口", ex);
LoggerHelp.WriteEX("设备参数设定值请求接口", ex);
}
return null;
}
@@ -207,7 +210,7 @@ namespace JinYuan.MES
catch (Exception ex)
{
resJson = $"参数设定值变更接口发生异常:{ex.Message}";
LogHelper.Instance.WriteEX("参数设定值变更接口", ex);
LoggerHelp.WriteEX("参数设定值变更接口", ex);
}
return res;
@@ -262,7 +265,7 @@ namespace JinYuan.MES
long outTime = sw.ElapsedMilliseconds;
if (outTime > 1000)
{
LogHelper.Instance.WriteLog($"预焊进站PC<=>MES上传耗时:{outTime}ms,电芯码:{BarCode}", "MESTime");
LoggerHelp.WriteLog($"预焊进站PC<=>MES上传耗时:{outTime}ms,电芯码:{BarCode}", "MESTime");
}
if (string.IsNullOrEmpty(result))
@@ -296,7 +299,7 @@ namespace JinYuan.MES
Mesage = "调用进站接口超时或MES无返回信息!";
mesResType = MesResType.B;
resJson = $"产品进站信息(组装)接口发生异常:{ex.Message}";
LogHelper.Instance.WriteEX("产品进站信息(组装)接口", ex);
LoggerHelp.WriteEX("产品进站信息(组装)接口", ex);
}
return res;
@@ -353,7 +356,7 @@ namespace JinYuan.MES
long outTime = sw.ElapsedMilliseconds;
if (outTime > 1000)
{
LogHelper.Instance.WriteLog($"钢壳进站PC<=>MES上传耗时:{outTime}ms,钢壳码:{BarCode}", "MESTime");
LoggerHelp.WriteLog($"钢壳进站PC<=>MES上传耗时:{outTime}ms,钢壳码:{BarCode}", "MESTime");
}
if (string.IsNullOrEmpty(result))
@@ -383,7 +386,7 @@ namespace JinYuan.MES
catch (Exception ex)
{
resJson = $"产品进站信息(组装)接口发生异常:{ex.Message}";
LogHelper.Instance.WriteEX("产品进站信息(组装)接口", ex);
LoggerHelp.WriteEX("产品进站信息(组装)接口", ex);
}
return res;
@@ -440,7 +443,7 @@ namespace JinYuan.MES
long outTime = sw.ElapsedMilliseconds;
if (outTime > 1000)
{
LogHelper.Instance.WriteLog($"预焊进站PC<=>MES上传耗时:{outTime}ms,电芯码:{listBar[0]},{listBar[1]},{listBar[2]},{listBar[3]}", "MESTime");
LoggerHelp.WriteLog($"预焊进站PC<=>MES上传耗时:{outTime}ms,电芯码:{listBar[0]},{listBar[1]},{listBar[2]},{listBar[3]}", "MESTime");
}
if (string.IsNullOrEmpty(result))
@@ -475,7 +478,7 @@ namespace JinYuan.MES
catch (Exception ex)
{
resJson = $"产品进站信息(组装)接口发生异常:{ex.Message}";
LogHelper.Instance.WriteEX("产品进站信息(组装)接口", ex);
LoggerHelp.WriteEX("产品进站信息(组装)接口", ex);
}
return res;
@@ -555,7 +558,7 @@ namespace JinYuan.MES
long outTime = sw.ElapsedMilliseconds;
if (outTime > 1000)
{
LogHelper.Instance.WriteLog($"钢壳进出站PC<=>MES上传耗时:{outTime}ms,钢壳码:{m.CSBYHCODEA}", "MESTime");
LoggerHelp.WriteLog($"钢壳进出站PC<=>MES上传耗时:{outTime}ms,钢壳码:{m.CSBYHCODEA}", "MESTime");
}
if (string.IsNullOrEmpty(result))
@@ -584,7 +587,7 @@ namespace JinYuan.MES
catch (Exception ex)
{
resJson = $"产品出站信息(组装)接口发生异常:{ex.Message}";
LogHelper.Instance.WriteEX("产品出站信息(组装)接口", ex);
LoggerHelp.WriteEX("产品出站信息(组装)接口", ex);
}
return res;
@@ -665,7 +668,7 @@ namespace JinYuan.MES
long outTime = sw.ElapsedMilliseconds;
if (outTime > 1000)
{
LogHelper.Instance.WriteLog($"钢壳进出站PC<=>MES上传耗时:{outTime}ms,钢壳码:{m.CSBYHCODEA}", "MESTime");
LoggerHelp.WriteLog($"钢壳进出站PC<=>MES上传耗时:{outTime}ms,钢壳码:{m.CSBYHCODEA}", "MESTime");
}
if (string.IsNullOrEmpty(result))
@@ -694,7 +697,7 @@ namespace JinYuan.MES
catch (Exception ex)
{
resJson = $"产品进出站一体信息(组装)接口发生异常:{ex.Message}";
LogHelper.Instance.WriteEX("产品进出站一体信息(组装)接口", ex);
LoggerHelp.WriteEX("产品进出站一体信息(组装)接口", ex);
}
return res;
@@ -785,7 +788,7 @@ namespace JinYuan.MES
long outTime = sw.ElapsedMilliseconds;
if (outTime > 1000)
{
LogHelper.Instance.WriteLog($"外观检出站PC<=>MES上传耗时:{outTime}ms,电芯码:{listBar.CSBYHCODEA}", "MESTime");
LoggerHelp.WriteLog($"预焊出站PC<=>MES上传耗时:{outTime}ms,电芯码:{listBar.CSBYHCODEA}", "MESTime");
}
if (string.IsNullOrEmpty(result))
@@ -816,7 +819,7 @@ namespace JinYuan.MES
catch (Exception ex)
{
resJson = $"产品出站信息(组装)接口发生异常:{ex.Message}";
LogHelper.Instance.WriteEX("产品出站信息(组装)接口", ex);
LoggerHelp.WriteEX("产品出站信息(组装)接口", ex);
}
return res;
@@ -2864,7 +2867,7 @@ namespace JinYuan.MES
catch (Exception ex)
{
resJson = $"设备运行状态接口发生异常:{ex.Message}";
LogHelper.Instance.WriteEX("设备运行状态接口", ex);
LoggerHelp.WriteEX("设备运行状态接口", ex);
}
return res;
@@ -2933,7 +2936,7 @@ namespace JinYuan.MES
catch (Exception ex)
{
resJson = $"调用设备报警信息接口发生异常:{ex.Message}";
LogHelper.Instance.WriteEX("调用设备报警信息接口", ex);
LoggerHelp.WriteEX("调用设备报警信息接口", ex);
}
return res;
@@ -2976,7 +2979,7 @@ namespace JinYuan.MES
catch (Exception ex)
{
resJson = $"调用设备能耗信息接口:{ex.Message}";
LogHelper.Instance.WriteEX("调用设备能耗信息接口", ex);
LoggerHelp.WriteEX("调用设备能耗信息接口", ex);
}
return res;
@@ -3028,7 +3031,7 @@ namespace JinYuan.MES
catch (Exception ex)
{
resJson = $"调用风速接口:{ex.Message}";
LogHelper.Instance.WriteEX("调用风速接口", ex);
LoggerHelp.WriteEX("调用风速接口", ex);
}
return res;