领胜LDS 键盘AOI检测项目
xcd
2020-07-02 3b0e2084501ea07fbcd1f984585bd64e3a0df241
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
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 PLCWarningSet : IComplexDisplay, IWarningSet
    {
        [Category("索引设置")]
        [Description("PLC警报索引——字索引")]
        [DisplayName("警报字索引")]
        public int WarningIndex_Word { get; set; }
 
        [Category("索引设置")]
        [Description("PLC警报索引——位索引")]
        [DisplayName("警报位索引")]
        public int WarningIndex_Bit { 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 Id { get; set; } = Guid.NewGuid().ToString();
 
        [Category("个性化设置")]
        [Description("警报")]
        [DisplayName("警报名称")]
        public string Name { get; set; } = "";
 
        [Browsable(false)]
        public string DisplayText => GetDisplayText();
 
        public string GetDisplayText()
        {
            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 IOType 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}";
        }
    }
}