|
|
@@ -69,11 +69,11 @@ namespace BPASmartClient.Device |
|
|
|
/// <summary> |
|
|
|
/// 设备运行日志 |
|
|
|
/// </summary> |
|
|
|
public ConcurrentDictionary<string, object> Log { get; set; } = new ConcurrentDictionary<string, object>(); |
|
|
|
public List<object> Log { get; set; } = new List<object>(); |
|
|
|
/// <summary> |
|
|
|
/// 设备运行告警与错误 |
|
|
|
/// </summary> |
|
|
|
public ConcurrentDictionary<string, object> Error { get; set; } = new ConcurrentDictionary<string, object>(); |
|
|
|
public List<object> Error { get; set; } = new List<object>(); |
|
|
|
|
|
|
|
public List<VariableMonitor> variableMonitors { get; set; } = new List<VariableMonitor>(); |
|
|
|
|
|
|
@@ -90,7 +90,7 @@ namespace BPASmartClient.Device |
|
|
|
/// <param name="info"></param> |
|
|
|
public void DeviceProcessLogShow(string info) |
|
|
|
{ |
|
|
|
Log.TryAdd(DeviceId.ToString(), new { Time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), Type = "流程", Text = info }); |
|
|
|
Log.Add(new { Time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), Type = "流程", Text = info }); |
|
|
|
MessageLog.GetInstance.DeviceProcessLogShow(DeviceId.ToString(), info); |
|
|
|
} |
|
|
|
|
|
|
@@ -112,10 +112,10 @@ namespace BPASmartClient.Device |
|
|
|
public virtual void StartMain() |
|
|
|
{ |
|
|
|
#region 测试添加几个日志与告警 |
|
|
|
Error.TryAdd(Guid.NewGuid().ToString(), new { Time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), Type = "落碗", Text = "落碗异常" }); |
|
|
|
Error.TryAdd(Guid.NewGuid().ToString(), new { Time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), Type = "煮面机", Text = "煮面机温度异常" }); |
|
|
|
Log.TryAdd(Guid.NewGuid().ToString(), new { Time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), Type = "初始化", Text = "初始化已完成" }); |
|
|
|
Log.TryAdd(Guid.NewGuid().ToString(), new { Time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), Type = "启动中", Text = "已完成外设启动" }); |
|
|
|
Error.Add(new { Time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), Type = "落碗", Text = "落碗异常" }); |
|
|
|
Error.Add(new { Time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), Type = "煮面机", Text = "煮面机温度异常" }); |
|
|
|
Log.Add(new { Time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), Type = "初始化", Text = "初始化已完成" }); |
|
|
|
Log.Add(new { Time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), Type = "启动中", Text = "已完成外设启动" }); |
|
|
|
#endregion |
|
|
|
|
|
|
|
ThreadManage.GetInstance().StartLong(new Action(() => |
|
|
@@ -170,7 +170,7 @@ namespace BPASmartClient.Device |
|
|
|
{ |
|
|
|
var res = alarmHelper.Alarms.FirstOrDefault(p => p.Info == s); |
|
|
|
if (res != null) |
|
|
|
Error.TryAdd(DeviceId.ToString(), new |
|
|
|
Error.Add(new |
|
|
|
{ |
|
|
|
Time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), |
|
|
|
Type = res.Grade, |
|
|
@@ -179,8 +179,7 @@ namespace BPASmartClient.Device |
|
|
|
}); |
|
|
|
alarmHelper.RemoveAction = new Action<string>((s) => |
|
|
|
{ |
|
|
|
if (Error.ContainsKey(DeviceId.ToString())) |
|
|
|
Error[DeviceId.ToString()] |
|
|
|
//Error; |
|
|
|
}); |
|
|
|
ThreadManage.GetInstance().StartLong(new Action(() => |
|
|
|
{ |
|
|
@@ -433,12 +432,12 @@ namespace BPASmartClient.Device |
|
|
|
|
|
|
|
public object GetError() |
|
|
|
{ |
|
|
|
return new {data= Error.Values.ToList() }; |
|
|
|
return new { data = Error }; |
|
|
|
} |
|
|
|
|
|
|
|
public object GetLog() |
|
|
|
{ |
|
|
|
return new { data = Log.Values.ToList() }; |
|
|
|
return new { data = Log }; |
|
|
|
} |
|
|
|
|
|
|
|
public object GetVariableMonitor() |
|
|
|