From b66483f277fcdb920313a5636b4b22575d74f295 Mon Sep 17 00:00:00 2001 From: fyf Date: Wed, 11 May 2022 11:51:44 +0800 Subject: [PATCH] gengx --- BPASmartClient.Device/BaseDevice.cs | 18 +++++++++++++----- BPASmartClient.Device/IDevice.cs | 9 +++++++++ BPASmartClient.IoT/DataVClient.cs | 2 ++ BPASmartClient.IoT/Model/IOT/IOTDevModel.cs | 8 ++++++++ 4 files changed, 32 insertions(+), 5 deletions(-) diff --git a/BPASmartClient.Device/BaseDevice.cs b/BPASmartClient.Device/BaseDevice.cs index 1d74b93a..c49e6932 100644 --- a/BPASmartClient.Device/BaseDevice.cs +++ b/BPASmartClient.Device/BaseDevice.cs @@ -47,14 +47,13 @@ namespace BPASmartClient.Device public bool IsHealth { get; protected set; } /// - /// 设备流程日志 + /// 设备运行日志 /// - public ConcurrentQueue Log { get; set; } = new ConcurrentQueue(); - + public ConcurrentDictionary Log { get; set; }=new ConcurrentDictionary(); /// - /// 错误报警集合 + /// 设备运行告警与错误 /// - protected ConcurrentDictionary Error = new ConcurrentDictionary(); + public ConcurrentDictionary Error { get; set; } = new ConcurrentDictionary(); //外设状态,硬件设备数据 protected ConcurrentDictionary peripheralStatus = new ConcurrentDictionary(); @@ -77,6 +76,15 @@ namespace BPASmartClient.Device public virtual void StartMain() { + #region 测试添加几个日志与告警 + 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.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 = "煮面机温度异常" }); + + + #endregion ThreadManage.GetInstance().StartLong(new Action(() => { foreach (var peripheral in peripherals) diff --git a/BPASmartClient.Device/IDevice.cs b/BPASmartClient.Device/IDevice.cs index 0aacf986..fb8525cf 100644 --- a/BPASmartClient.Device/IDevice.cs +++ b/BPASmartClient.Device/IDevice.cs @@ -1,6 +1,7 @@ using BPA.Message.Enum; using BPASmartClient.Peripheral; using System; +using System.Collections.Concurrent; using System.Collections.Generic; using System.Linq; using System.Text; @@ -30,6 +31,14 @@ namespace BPASmartClient.Device /// DeviceStatus Status { get; set; } /// + /// 运行日志 + /// + public ConcurrentDictionary Log { get; set; } + /// + /// 运行告警 + /// + public ConcurrentDictionary Error { get; set; } + /// /// 是否忙碌 /// bool IsBusy { get; } diff --git a/BPASmartClient.IoT/DataVClient.cs b/BPASmartClient.IoT/DataVClient.cs index c0236c46..edadfb4d 100644 --- a/BPASmartClient.IoT/DataVClient.cs +++ b/BPASmartClient.IoT/DataVClient.cs @@ -149,6 +149,8 @@ namespace BPASmartClient.IoT IsHealth = device.IsHealth?"健康":"故障", IsHealthColor = !device.IsHealth ? new ALYColor { r = 255, g = 0, b = 0, a = 1 } : new ALYColor { r = 51, g = 232, b = 34, a = 1 }, Status = device.Status.GetStatus(), + gjxx= device.Error, + rzxx= device.Log }; dataVNode.Add(obj); }); diff --git a/BPASmartClient.IoT/Model/IOT/IOTDevModel.cs b/BPASmartClient.IoT/Model/IOT/IOTDevModel.cs index b1186572..488125f1 100644 --- a/BPASmartClient.IoT/Model/IOT/IOTDevModel.cs +++ b/BPASmartClient.IoT/Model/IOT/IOTDevModel.cs @@ -83,6 +83,14 @@ namespace DataVAPI.Tool.IOT /// public string NodeStatus { get; set; } /// + /// 运行日志 + /// + public string SZXX { get; set; } + /// + /// 运行告警 + /// + public string GJXX { get; set; } + /// /// Model /// public IOTDevSXModel()