From 5fad59533bdb6ace24ab5b0061bca0a1fd850b27 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A6=82=E6=84=8F=20=E5=BD=AD?= <2417589739@qq.com> Date: Wed, 11 May 2022 16:17:08 +0800 Subject: [PATCH] =?UTF-8?q?=E9=94=99=E8=AF=AF=E6=8A=A5=E8=AD=A6=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- BPASmartClient.Device/BaseDevice.cs | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/BPASmartClient.Device/BaseDevice.cs b/BPASmartClient.Device/BaseDevice.cs index b8eea1ed..4f7d0a32 100644 --- a/BPASmartClient.Device/BaseDevice.cs +++ b/BPASmartClient.Device/BaseDevice.cs @@ -69,11 +69,11 @@ namespace BPASmartClient.Device /// /// 设备运行日志 /// - public ConcurrentDictionary Log { get; set; } = new ConcurrentDictionary(); + public List Log { get; set; } = new List(); /// /// 设备运行告警与错误 /// - public ConcurrentDictionary Error { get; set; } = new ConcurrentDictionary(); + public List Error { get; set; } = new List(); public List variableMonitors { get; set; } = new List(); @@ -90,7 +90,7 @@ namespace BPASmartClient.Device /// 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((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()