using DMS.Core.Enums; using SqlSugar; using SqlSugar.DbConvert; namespace DMS.Infrastructure.Entities; /// /// 设备实体类,对应数据库中的 Devices 表。 /// public class DbDevice { /// /// 设备ID,主键且自增。 /// [SugarColumn(IsPrimaryKey = true, IsIdentity = true)] public int Id { get; set; } /// /// 设备名称。 /// public string Name { get; set; } /// /// 设备描述。 /// [SugarColumn(IsNullable = true)] public string Description { get; set; } /// /// 设备通信协议类型,对应 ProtocolType 枚举。 /// [SugarColumn(ColumnDataType="varchar(20)",SqlParameterDbType=typeof(EnumToStringConvert))] public ProtocolType Protocol { get; set; } /// /// 设备IP地址。 /// public string IpAddress { get; set; } /// /// 设备端口号。 /// public int Port { get; set; } /// /// 设备机架号 (针对PLC等设备)。 /// [SugarColumn(IsNullable = true)] public short Rack { get; set; } /// /// 设备槽号 (针对PLC等设备)。 /// [SugarColumn(IsNullable = true)] public short Slot { get; set; } /// /// /// [SugarColumn(ColumnDataType="varchar(20)",SqlParameterDbType=typeof(EnumToStringConvert))] public CpuType CpuType { get; set; } /// /// 设备槽号 (针对PLC等设备)。 /// [SugarColumn(ColumnDataType="varchar(20)",SqlParameterDbType=typeof(EnumToStringConvert))] public DeviceType DeviceType { get; set; } /// /// OPC UA服务器的URL地址。 /// [SugarColumn(IsNullable = true)] public string OpcUaServerUrl { get; set; } /// /// 设备是否激活/启用。 /// public bool IsActive { get; set; } [SugarColumn(IsIgnore = true)] public bool IsRunning { get; set; } /// /// 此设备包含的变量表集合。 /// [SugarColumn(IsIgnore = true)] public List VariableTables { get; set; } = new(); }