日志重写
This commit is contained in:
@@ -31,6 +31,7 @@ namespace JinYuan.ControlCenters
|
||||
{
|
||||
public partial class ControlCenter
|
||||
{
|
||||
private static LoggerHelp _logger = new LoggerHelp();
|
||||
/// <summary>
|
||||
/// 打印日志方法
|
||||
/// </summary>
|
||||
@@ -139,7 +140,7 @@ namespace JinYuan.ControlCenters
|
||||
DicStationFunction = new Dictionary<string, dgStationFunction>();
|
||||
|
||||
DicStationFunction.Add("电芯进站", FeedingStation);
|
||||
//DicStationFunction.Add("NG出站", NGStation);
|
||||
DicStationFunction.Add("NG出站", NGStation);
|
||||
DicStationFunction.Add("电芯出站", BlankingStation);
|
||||
|
||||
for (int i = 0; i < CommonMethods.ChatLineCount; i++)
|
||||
@@ -262,14 +263,14 @@ namespace JinYuan.ControlCenters
|
||||
JYResult<byte[]> resByte = CommonMethods.PlcLink.ReadValue<JYResult<byte[]>>($"{pf.VarList[1].VarAddress}", Data_Type.ArrByte, Convert.ToUInt16(pf.VarList[1].OffsetOrLenght));
|
||||
sw1.Stop();
|
||||
CommonMethods.AddDataMonitorLog(0, $"{pf.GroupName},耗时:{sw1.Elapsed.TotalMilliseconds}ms");
|
||||
LogHelper.Instance.WriteLog( $"读取工位:{pf.GroupName},启动读取字节共耗时:" + sw1.Elapsed.TotalMilliseconds, "循环读取PLC工位");
|
||||
LoggerHelp.WriteLog("循环读取PLC工位" + $"读取工位:{pf.GroupName},启动读取字节共耗时:" + sw1.Elapsed.TotalMilliseconds);
|
||||
//置位 PLC-防止重复读取
|
||||
CommonMethods.PlcLink.WriteInt16(pf.VarList[0].VarAddress, 2);//置位,读取进行中的标志
|
||||
|
||||
if (resByte == null)
|
||||
{
|
||||
CommonMethods.AddDataMonitorLog(0, $"上料工位:{pf.GroupName},起始地址:{pf.VarList[1].VarAddress},得到空字节数组");
|
||||
LogHelper.Instance.WriteLog( $"读取工位:{pf.GroupName},起始地址:{pf.VarList[1].VarAddress},得到空字节数组", "循环读取PLC上料工位");
|
||||
LoggerHelp.WriteLog("循环读取PLC上料工位"+$"读取工位:{pf.GroupName},起始地址:{pf.VarList[1].VarAddress},得到空字节数组");
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -286,14 +287,14 @@ namespace JinYuan.ControlCenters
|
||||
// }, null);
|
||||
//}
|
||||
//// private Dictionary<string, dgStationFunction> DicStationFunction;
|
||||
DicStationFunction[pf.GroupName].BeginInvoke(resByte, pf, null, null);//信息解析
|
||||
DicStationFunction[pf.GroupName].BeginInvoke(resByte, pf, null, null);//信息解析
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
CommonMethods.AddLog(true, ex.Message);
|
||||
LogHelper.Instance.WriteEX(ex);
|
||||
LoggerHelp.WriteEX(ex);
|
||||
}
|
||||
}
|
||||
Thread.Sleep(200);
|
||||
@@ -1359,7 +1360,7 @@ namespace JinYuan.ControlCenters
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogHelper.Instance.WriteEX(ex);
|
||||
LoggerHelp.WriteEX(ex);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1842,7 +1843,7 @@ namespace JinYuan.ControlCenters
|
||||
catch (Exception ex)
|
||||
{
|
||||
CommonMethods.AddLog(true, "设备状态" + ex.Message);
|
||||
LogHelper.Instance.WriteEX(ex);
|
||||
LoggerHelp.WriteEX(ex);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
@@ -204,11 +204,13 @@ namespace JinYuan.ControlCenters
|
||||
if (bArrays == null)
|
||||
{
|
||||
CommonMethods.PlcLink.WriteInt16(pf.VarList[0].VarAddress, 0);//置位0
|
||||
CommonMethods.AddLog(false, $"电芯进站PLC有触发信号,但无数据!");
|
||||
LogHelper.Instance.WriteLog($"电芯进站PLC有触发信号,但无数据!", "Info");
|
||||
CommonMethods.AddLog(false, $"电芯进站PLC有触发信号,但无数据!");//存系统日志
|
||||
LoggerHelp.WriteLog($"电芯进站PLC有触发信号,但无数据!", "Info");
|
||||
}
|
||||
if (bArrays.IsSuccess && bArrays.Content != null)
|
||||
{
|
||||
|
||||
|
||||
sw2.Restart();
|
||||
//解析数据
|
||||
//1257 3个条码
|
||||
@@ -389,7 +391,7 @@ namespace JinYuan.ControlCenters
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogHelper.Instance.WriteError($"外观检测进站线程数据解析:{ex}", "SysErrorLog");
|
||||
LoggerHelp.WriteLog($"外观检测进站线程数据解析:{ex}", "SysErrorLog");
|
||||
}
|
||||
|
||||
|
||||
@@ -485,7 +487,7 @@ namespace JinYuan.ControlCenters
|
||||
{
|
||||
JYResult result = CommonMethods.PlcLink.WriteValue("D80", 1, Data_Type.Short);//反馈PLC结果
|
||||
CommonMethods.AddDataMonitorLog(1, $"服务器连接失败!解决办法:1、请检查MES网络,2、查看服务器是否正常!!");
|
||||
LogHelper.Instance.WriteError($"服务器连接失败:{ex}", "系统报错");
|
||||
LoggerHelp.WriteLog($"服务器连接失败:{ex}", "系统报错");
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -501,13 +503,13 @@ namespace JinYuan.ControlCenters
|
||||
}
|
||||
else
|
||||
{
|
||||
LogHelper.Instance.WriteError($"电芯进站数据List为空", "SysErrorLog");
|
||||
LoggerHelp.WriteLog($"电芯进站数据List为空", "SysErrorLog");
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogHelper.Instance.WriteError($"外观检测上料保存处理异常:{ex}", "SysErrorLog");
|
||||
LoggerHelp.WriteLog($"外观检测上料保存处理异常:{ex}", "SysErrorLog");
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
@@ -522,7 +524,7 @@ namespace JinYuan.ControlCenters
|
||||
{
|
||||
CommonMethods.PlcLink.WriteInt16(pf.VarList[0].VarAddress, 0);//置位0
|
||||
CommonMethods.AddLog(false, $"NG出站PLC有触发信号,但无数据!");
|
||||
LogHelper.Instance.WriteLog($"NG出站PLC有触发信号,但无数据!", "SysErrorLog");
|
||||
LoggerHelp.WriteLog($"NG出站PLC有触发信号,但无数据!", "SysErrorLog");
|
||||
}
|
||||
#region 预焊机
|
||||
//if (bArrays.IsSuccess && bArrays.Content != null)
|
||||
@@ -1637,7 +1639,7 @@ namespace JinYuan.ControlCenters
|
||||
{
|
||||
CommonMethods.PlcLink.WriteInt16(pf.VarList[0].VarAddress, 0);//置位0
|
||||
CommonMethods.AddLog(false, $"电芯出站PLC有触发信号,但无数据!");
|
||||
LogHelper.Instance.WriteLog($"电芯出站PLC有触发信号,但无数据!", "SysErrorLog");
|
||||
LoggerHelp.WriteLog($"电芯出站PLC有触发信号,但无数据!", "SysErrorLog");
|
||||
}
|
||||
if (bArrays.IsSuccess && bArrays.Content != null)
|
||||
{
|
||||
@@ -1911,7 +1913,7 @@ namespace JinYuan.ControlCenters
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogHelper.Instance.WriteError($"外观检测出站线程数据解析:{ex}", "SysErrorLog");
|
||||
LoggerHelp.WriteLog($"外观检测出站线程数据解析:{ex}", "SysErrorLog");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1942,7 +1944,7 @@ namespace JinYuan.ControlCenters
|
||||
}
|
||||
JYResult result3 = CommonMethods.PlcLink.WriteValue(pf.VarList[0].VarAddress, 0);//置位0
|
||||
CommonMethods.AddDataMonitorLog(0, $"发送信息给PLC:{result1.IsSuccess},{MyRes[0]},{MyRes[1]},{MyRes[2]}");
|
||||
LogHelper.Instance.WriteLog($"发送信息给PLC:{result1.IsSuccess},{MyRes[0]},{MyRes[1]},{MyRes[2]}");
|
||||
LoggerHelp.WriteLog($"发送信息给PLC:{result1.IsSuccess},{MyRes[0]},{MyRes[1]},{MyRes[2]}");
|
||||
|
||||
Task.Run(() => { SendDateMQTT.Instance.EnterandExitSendMessge(1); });
|
||||
//数据存储 - 异步处理
|
||||
@@ -2034,12 +2036,12 @@ namespace JinYuan.ControlCenters
|
||||
}
|
||||
else
|
||||
{
|
||||
LogHelper.Instance.WriteError($"电芯出站数据List为空", "SysErrorLog");
|
||||
LoggerHelp.WriteLog($"电芯出站数据List为空", "SysErrorLog");
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogHelper.Instance.WriteError($"电芯出站数据保存异常:{ex}", "SysErrorLog");
|
||||
LoggerHelp.WriteLog($"电芯出站数据保存异常:{ex}", "SysErrorLog");
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
@@ -225,7 +225,7 @@ namespace JinYuan.ControlCenters
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogHelper.Instance.WriteEX(ex);
|
||||
LoggerHelp.WriteEX(ex);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -234,7 +234,7 @@ namespace JinYuan.ControlCenters
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogHelper.Instance.WriteEX(ex);
|
||||
LoggerHelp.WriteEX(ex);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
@@ -62,7 +62,7 @@ namespace JinYuan.ControlCenters
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogHelper.Instance.WriteEX("调用MES设备报警接口", ex);
|
||||
LoggerHelp.WriteEX("调用MES设备报警接口", ex);
|
||||
}
|
||||
return resJson;
|
||||
|
||||
@@ -104,7 +104,7 @@ namespace JinYuan.ControlCenters
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogHelper.Instance.WriteEX("调用MES设备运行状态接口", ex);
|
||||
LoggerHelp.WriteEX("调用MES设备运行状态接口", ex);
|
||||
}
|
||||
return resJson;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user