Equipment.cs
4.61 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
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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Collections.Generic;
using TableAttribute = System.ComponentModel.DataAnnotations.Schema.TableAttribute;
using ColumnAttribute = System.ComponentModel.DataAnnotations.Schema.ColumnAttribute;
using System;
namespace HHECS.Model.Entities
{
/// <summary>
/// 设备
/// </summary>
[Table("equipment")]
public class Equipment : BaseEntityCU<int>
{
private string code;
/// <summary>
/// 设备编码,唯一且有规律易识别
/// </summary>
[Column(Order = 2)]
[MaxLength(50)]
[Required]
public string Code
{
get { return code; }
set { code = value; }
}
private string name;
/// <summary>
/// 设备名
/// </summary>
[Column(Order = 3)]
[MaxLength(50)]
[Required]
public string Name
{
get { return name; }
set { name = value; }
}
private int equipmentTypeId;
/// <summary>
/// 关联到设备类型Id
/// </summary>
[Column(Order = 4)]
[Required]
public int EquipmentTypeId
{
get { return equipmentTypeId; }
set { equipmentTypeId = value; }
}
private string ip;
/// <summary>
/// 此处写到这台设备对应的IP,一般为PLC的IP
/// </summary>
[Column(Order = 5)]
[MaxLength(20)]
public string IP
{
get { return ip; }
set { ip = value; }
}
/// <summary>
/// 出厂日期
/// </summary>
public DateTime? ProdTime { get; set; }
/// <summary>
/// 保养起始时间
/// </summary>
public DateTime? MaintainStartTime { get; set; }
//todo:更多属性待讨论
/// <summary>
/// 所在区域,出于调度目的或其他划分,比如:为兼容转轨堆垛机设定,正常情况下与巷道相同,转轨情况下对应虚拟划分巷道
/// </summary>
[Column(Order = 8)]
[MaxLength(50)]
public string DestinationArea { get; set; }
private string description;
/// <summary>
/// 图片文件名称
/// </summary>
public string ImageName { get; set; }
/// <summary>
/// 描述
/// </summary>
[Column(Order = 22)]
[MaxLength(200)]
public string Description
{
get { return description; }
set { description = value; }
}
/// <summary>
/// 维护规则Id
/// </summary>
[Column(Order = 27)]
public int? EquipmentMaintainRuleId { get; set; }
private bool disable;
/// <summary>
/// 是否启用
/// </summary>
[Column(Order = 45)]
[Required]
public bool Disable
{
get { return disable; }
set { disable = value; }
}
/// <summary>
/// 仓库编码
/// </summary>
[MaxLength(50)]
public string WarehouseCode { get; set; }
/// <summary>
/// 温度
/// </summary>
public double Temperature { get; set; }
/// <summary>
/// 震动
/// </summary>
public double Shake { get; set; }
#region 外键
/// <summary>
/// 逻辑外键实体-设备保养规格
/// </summary>
public EquipmentMaintainRule EquipmentMaintainRule { get; set; }
/// <summary>
/// 逻辑外键实体-设备类型
/// </summary>
public EquipmentType EquipmentType { get; set; }
private List<EquipmentProp> equipmentProps = new List<EquipmentProp>();
/// <summary>
/// 逻辑外键实体-设备属性
/// </summary>
public List<EquipmentProp> EquipmentProps
{
get { return equipmentProps; }
set
{
equipmentProps = value;
}
}
/// <summary>
/// 获取设备属性
/// </summary>
/// <param name="key">设备属性code </param>
/// <returns></returns>
[NotMapped]
public EquipmentProp this[string key]
{
get
{
return equipmentProps?.Find(t => t.EquipmentTypePropTemplateCode == key);
}
}
[NotMapped]
public string WarehouseCodeExt { get; set; }
#endregion
}
}