领胜LDS 键盘AOI检测项目
wells.liu
2020-07-06 99587d3c26f5b952cb7dc87a56be91b08c5d277b
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
using Bro.Common.Helper;
using System;
using System.Collections.Generic;
using static Bro.Common.Helper.EnumHelper;
 
namespace Bro.Common.Model
{
    public class PLCItem : IComplexDisplay
    {
        /// <summary>
        /// 读写地址
        /// </summary>
        public string Address { get; set; } = "";
 
        /// <summary>
        /// 读写地址长度
        /// </summary>
        public int ItemLength { get; set; } = 1;
 
        /// <summary>
        /// PLC项目值
        /// </summary>   
        public List<int> ItemValues { get; set; } = new List<int>();
 
        /// <summary>
        /// 是否写数据 1:读数据 2:写数据 4:监控 参见枚举PLCOpType
        /// </summary>
        public PLCOpType PLCOpType { get; set; } = PLCOpType.Read;
 
        public DateTime OpTimeStamp { get; set; } = DateTime.Now;
 
        public string GetDisplayText()
        {
            switch (PLCOpType)
            {
                case PLCOpType.Read:
                    return $"{PLCOpType.GetEnumDescription()}{Address},长度{ItemLength}";
                case PLCOpType.Write:
                    return $"{PLCOpType.GetEnumDescription()}{Address},数值{string.Join(" ", ItemValues)}";
                default:
                    return $"{PLCOpType.GetEnumDescription()}{Address},长度{ItemLength},数值{string.Join(" ", ItemValues)}";
            }
        }
    }
}