From e9f47e76b9932949c9df829e98b09938eb93e870 Mon Sep 17 00:00:00 2001 From: wells.liu <wells.liu@broconcentric.com> Date: 星期三, 01 七月 2020 17:53:09 +0800 Subject: [PATCH] 完成 板卡警报+监听功能 --- src/Bro.Common.Model/Model/WarningSet.cs | 95 ++++++++++++++++++++++++++++++++++++++++++++--- 1 files changed, 89 insertions(+), 6 deletions(-) diff --git a/src/Bro.Common.Model/Model/WarningSet.cs b/src/Bro.Common.Model/Model/WarningSet.cs index 43fbbae..a57dbab 100644 --- a/src/Bro.Common.Model/Model/WarningSet.cs +++ b/src/Bro.Common.Model/Model/WarningSet.cs @@ -1,23 +1,24 @@ 锘縰sing Bro.Common.Helper; +using Bro.Common.Interface; using Newtonsoft.Json; using System; using System.ComponentModel; +using static Bro.Common.Helper.EnumHelper; namespace Bro.Common.Model { - /// <summary> - /// 璀︽姤閰嶇疆 + /// PLC璀︽姤閰嶇疆 /// </summary> - public class WarningSet : IComplexDisplay + public class WarningSet : IComplexDisplay, IWarningSet { [Category("绱㈠紩璁剧疆")] - [Description("璀︽姤绱㈠紩鈥斺�斿瓧绱㈠紩")] + [Description("PLC璀︽姤绱㈠紩鈥斺�斿瓧绱㈠紩")] [DisplayName("璀︽姤瀛楃储寮�")] public int WarningIndex_Word { get; set; } [Category("绱㈠紩璁剧疆")] - [Description("璀︽姤绱㈠紩鈥斺�斾綅绱㈠紩")] + [Description("PLC璀︽姤绱㈠紩鈥斺�斾綅绱㈠紩")] [DisplayName("璀︽姤浣嶇储寮�")] public int WarningIndex_Bit { get; set; } @@ -57,9 +58,91 @@ [JsonIgnore] public DateTime TriggerTime { get; set; } = DateTime.Now; + [Browsable(false)] + public string Id { get; set; } = Guid.NewGuid().ToString(); + + [Category("涓�у寲璁剧疆")] + [Description("璀︽姤")] + [DisplayName("璀︽姤鍚嶇О")] + public string Name { get; set; } = ""; + + [Browsable(false)] + public string DisplayText => GetDisplayText(); + public string GetDisplayText() { - return $"{WarningIndex_Word}:{WarningIndex_Bit}-{WarningCode}-{WarningDescription}"; + return $"{Name}-{WarningIndex_Word}:{WarningIndex_Bit}-{WarningCode}-{WarningDescription}"; + } + } + + /// <summary> + /// 杩愬姩鏉垮崱璀︽姤閰嶇疆瀵硅薄 + /// </summary> + public class MotionCardWarningSet : IComplexDisplay, IWarningSet + { + [Browsable(false)] + public string Id { get; set; } = Guid.NewGuid().ToString(); + + [Category("涓�у寲璁剧疆")] + [Description("璀︽姤")] + [DisplayName("璀︽姤鍚嶇О")] + public string Name { get; set; } = ""; + + [Category("瑙﹀彂璁剧疆")] + [Description("褰撹瑙﹀彂绱㈠紩鐨勫�间笌璁剧疆鐨凾riggerValue鐩稿悓鏃讹紝璀︽姤瑙﹀彂")] + [DisplayName("瑙﹀彂绱㈠紩")] + public int TriggerIndex { get; set; } + + /// <summary> + /// 璀︽姤绫诲瀷 + /// </summary> + [Category("璀︽姤璁剧疆")] + [DisplayName("璀︽姤绫诲瀷")] + [Description("璀︽姤璁剧疆锛氳繍鍔ㄦ澘鍗� IO 绫诲瀷锛圛N OUT锛�")] + public IOModel WarningIOModel { get; set; } + + [Category("瑙﹀彂璁剧疆")] + [Description("true锛氶珮鐢靛钩瑙﹀彂鎶ヨ false锛氫綆鐢靛钩瑙﹀彂鎶ヨ")] + [DisplayName("瑙﹀彂鍊�")] + public bool TriggerValue { get; set; } = true; + + [Category("璀︽姤鍐呭")] + [Description("璀︽姤浠g爜")] + [DisplayName("璀︽姤浠g爜")] + public string WarningCode { get; set; } + + [Category("璀︽姤鍐呭")] + [Description("璀︽姤鎻忚堪")] + [DisplayName("璀︽姤鎻忚堪")] + public string WarningDescription { get; set; } + + [Category("绾у埆璁剧疆")] + [Description("璀︽姤绾у埆")] + [DisplayName("璀︽姤绾у埆")] + public int WarningLvl { get; set; } = 0; + + /// <summary> + /// 琛ㄧず鎶ヨ鐘舵�侊紝鏄姤璀﹀湴鍧�鍊煎拰璀︽姤瑙﹀彂鍊兼瘮杈冨悗鐨勭粨鏋� + /// true 姝e湪鎶ヨ false 鍙栨秷鎶ヨ + /// </summary> + [Browsable(false)] + [JsonIgnore] + public bool CurrentStatus { get; set; } = false; + + [Browsable(false)] + [JsonIgnore] + public string Source { get; set; } = ""; + + [Browsable(false)] + [JsonIgnore] + public DateTime TriggerTime { get; set; } = DateTime.Now; + + [Browsable(false)] + public string DisplayText => GetDisplayText(); + + public string GetDisplayText() + { + return $"{Name}-{WarningIOModel.GetEnumDescription()}:{WarningCode}-{WarningDescription}"; } } } -- Gitblit v1.8.0