领胜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
using Bro.Common.Helper;
using Bro.Common.Interface;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing.Design;
using System.Reflection;
 
namespace Bro.Common.Base
{
    public class OperationConfigBase : IOperationConfig
    {
        /// <summary>
        /// 输入参数
        /// </summary>
        [JsonIgnore]
        [Category("输入配置")]
        [Description("输入参数配置")]
        [DisplayName("输入参数")]
        [TypeConverter(typeof(SimpleCollectionConvert<int>))]
        public List<int> InputPara { get; set; } = new List<int>();
 
        /// <summary>
        /// 异常反馈值
        /// </summary>
        [Category("异常反馈设置")]
        [Description("异常反馈值")]
        [DisplayName("异常反馈值")]
        public int ExceptionValue { get; set; } = 0;
 
        /// <summary>
        /// 发生异常时的重新尝试次数
        /// </summary>
        [Category("异常反馈设置")]
        [Description("发生异常时的重新尝试次数")]
        [DisplayName("重试次数")]
        public int ReTryTimes { get; set; } = 3;
 
        [Browsable(false)]
        public string MonitorSetId { get; set; } = "";
 
        [Browsable(false)]
        [JsonIgnore]
        public virtual string DeviceId { get; set; } = "";
    }
 
    public class InitialConfigBase : IInitialConfig
    {
        [Category("通用配置")]
        [Description("设备索引")]
        [ReadOnly(true)]
        public string Id { get; set; } = Guid.NewGuid().ToString().ToUpper();
 
        [Category("通用配置")]
        [Description("设备名称")]
        [DisplayName("设备名称")]
        public string Name { get; set; } = "UnNamed";
 
        /// <summary>
        /// 设备是否启用
        /// </summary>
        [Category("通用配置")]
        [Description("设备是否启用")]
        [DisplayName("启用状态")]
        public bool IsEnabled { get; set; } = false;
 
        private string driverType = "";
        /// <summary>
        /// 设备类型
        /// </summary>
        [Category("驱动类型")]
        [Description("设备驱动类型")]
        [TypeConverter(typeof(DeviceTypeConverter))]
        public virtual string DriverType
        {
            get
            {
                if (string.IsNullOrWhiteSpace(driverType))
                {
                    var attr = GetType().GetCustomAttribute<DeviceAttribute>();
                    if (attr != null)
                    {
                        driverType = attr.TypeCode;
                    }
                }
 
                return driverType;
            }
            set => driverType = value;
        }
 
        [Category("日志配置")]
        [Description("日志记录目录")]
        [DisplayName("日志目录")]
        [Editor(typeof(FoldDialogEditor), typeof(UITypeEditor))]
        public string LogPath { get; set; } = "";
 
        [Category("日志配置")]
        [Description("true:启用日志记录  false:不启用日志记录")]
        [DisplayName("日志状态")]
        public bool IsEnableLog { get; set; } = false;
 
        public virtual List<string> GetHalconToolPathList()
        {
            return new List<string>();
        }
 
        //public InitialConfigBase()
        //{
        //    var attr = this.GetType().GetCustomAttribute<DeviceAttribute>();
        //    if (attr != null)
        //    {
        //        this.DriverType = attr.TypeCode;
        //    }
        //}
    }
}