| | |
| | | using 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; } |
| | | |
| | |
| | | [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("当该触发索引的值与设置的TriggerValue相同时,警报触发")] |
| | | [DisplayName("触发索引")] |
| | | public int TriggerIndex { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 警报类型 |
| | | /// </summary> |
| | | [Category("警报设置")] |
| | | [DisplayName("警报类型")] |
| | | [Description("警报设置:运动板卡 IO 类型(IN OUT)")] |
| | | public IOModel WarningIOModel { get; set; } |
| | | |
| | | [Category("触发设置")] |
| | | [Description("true:高电平触发报警 false:低电平触发报警")] |
| | | [DisplayName("触发值")] |
| | | public bool TriggerValue { get; set; } = true; |
| | | |
| | | [Category("警报内容")] |
| | | [Description("警报代码")] |
| | | [DisplayName("警报代码")] |
| | | public string WarningCode { get; set; } |
| | | |
| | | [Category("警报内容")] |
| | | [Description("警报描述")] |
| | | [DisplayName("警报描述")] |
| | | public string WarningDescription { get; set; } |
| | | |
| | | [Category("级别设置")] |
| | | [Description("警报级别")] |
| | | [DisplayName("警报级别")] |
| | | public int WarningLvl { get; set; } = 0; |
| | | |
| | | /// <summary> |
| | | /// 表示报警状态,是报警地址值和警报触发值比较后的结果 |
| | | /// true 正在报警 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}"; |
| | | } |
| | | } |
| | | } |