Files
DMS/DMS.Infrastructure/Entities/DbDevice.cs

87 lines
2.2 KiB
C#
Raw Normal View History

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