领胜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
using Bro.Common.Helper;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using static Bro.Common.Helper.EnumHelper;
 
namespace Bro.Common.Model
{
    public class IOItem : IComplexDisplay
    {
        /// <summary>
        /// IO点编号
        /// </summary>
        [Category("IO配置")]
        [Description("IO点编号")]
        public virtual int IONum { get; set; }
 
        /// <summary>
        /// IO点的值
        /// </summary>
        [Category("IO配置")]
        [Description("IO数值")]
        public virtual int Value { get; set; }
 
        /// <summary>
        /// IO点是in还是out
        /// </summary>   
        [Category("IO配置")]
        [Description("IO类型")]
        public virtual IOType IOType { get; set; }
 
        public string GetDisplayText()
        {
            return $"{IOType.GetEnumDescription()},编号{IONum},IO点的值{Value}";
        }
    }
 
    public class IODefinition : IOItem
    {
        [Category("IO配置")]
        [Description("IO用途描述")]
        public string IODesc { get; set; }
 
        [Category("IO配置")]
        [Description("备注说明")]
        public string Remark { get; set; }
 
        [Browsable(false)]
        [JsonIgnore]
        public override int Value { get; set; }
 
        public new string GetDisplayText()
        {
            return $"{IODesc} {IOType.GetEnumDescription()} {IONum}";
        }
    }
 
    public class IORefrenceItem
    {
        [Category("IO操作配置")]
        [Description("需要操作的IO")]
        public IOItem IOItem { get; set; } = new IOItem();
 
        [Category("IO操作配置")]
        [Description("需要操作的IO的数值")]
        public int CheckValue { get => IOItem.Value; set => IOItem.Value = value; }
 
        [Browsable(false)]
        [JsonIgnore]
        public List<IODefinition> IOItemSource { get; set; } = new List<IODefinition>();
    }
}