Equipment.cs
2.81 KB
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
using FreeSql.DataAnnotations;
using System.ComponentModel.DataAnnotations;
namespace HHECS.DAQShared.Models
{
[Table(Name = "daq_equipment")]
[Index($"uk_{nameof(Code)}", $"{nameof(Code)}", true)]
public class Equipment : BaseEntityCU<int>
{
/// <summary>
/// 设备编码,唯一且有规律易识别
/// </summary>
[Column(IsNullable = false, Position = 2)]
[MaxLength(50)]
public string Code { get; set; } = null!;
/// <summary>
/// 设备名
/// </summary>
[Column(IsNullable = false, Position = 3)]
[MaxLength(50)]
public string Name { get; set; } = null!;
/// <summary>
/// 关联到设备类型Id
/// </summary>
[Column(IsNullable = false, Position = 4)]
public int EquipmentTypeId { get; set; }
/// <summary>
/// 此处写到这台设备对应的IP,一般为PLC的IP
/// </summary>
[Column(IsNullable = false, Position = 5)]
[MaxLength(20)]
public string IP { get; set; } = null!;
/// <summary>
/// 标定设备所在区域,他可能在一个仓库,也可能在一条产线上
/// </summary>
[Column(Position = 8)]
[MaxLength(50)]
public string DestinationArea { get; set; } = null!;
/// <summary>
/// 连接名
/// </summary>
public string ConnectName { get; set; } = null!;
/// <summary>
/// 描述
/// </summary>
[Column(Position = 29)]
[MaxLength(200)]
public string Description { get; set; } = null!;
/// <summary>
/// 是否禁用
/// </summary>
[Column(Position = 33)]
[Required]
public bool Disable { get; set; }
/// <summary>
/// 逻辑外键实体-设备类型
/// </summary>
public EquipmentType EquipmentType { get; set; } = null!;
/// <summary>
/// 逻辑外键实体-设备属性
/// </summary>
public List<EquipmentProp> EquipmentProps { get; set; } = new List<EquipmentProp>();
/// <summary>
/// 获取设备属性
/// </summary>
/// <param name="key">设备属性Code</param>
/// <returns></returns>
[Column(IsIgnore = true)]
public EquipmentProp this[string key]
{
get
{
string key2 = key;
return EquipmentProps?.Find((EquipmentProp t) => t.Code == key2) ?? new EquipmentProp();
}
}
/// <summary>
/// 项目编号
/// </summary>
public string ProjectCode { get; set; } = null!;
/// <summary>
/// 仓库编号
/// </summary>
public string FactoryCode { get; set; } = null!;
}
}