2025-07-21 18:49:49 +08:00
|
|
|
|
using DMS.Core.Enums;
|
2025-06-12 18:41:46 +08:00
|
|
|
|
using SqlSugar;
|
2025-07-21 18:49:49 +08:00
|
|
|
|
using SqlSugar.DbConvert;
|
2025-07-21 14:35:17 +08:00
|
|
|
|
|
|
|
|
|
|
namespace DMS.Infrastructure.Entities;
|
2025-06-10 22:13:06 +08:00
|
|
|
|
|
2025-07-03 13:17:25 +08:00
|
|
|
|
/// <summary>
|
2025-07-21 14:35:17 +08:00
|
|
|
|
/// 设备实体类,对应数据库中的 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>
|
2025-07-21 14:35:17 +08:00
|
|
|
|
/// 设备ID,主键且自增。
|
2025-07-03 13:17:25 +08:00
|
|
|
|
/// </summary>
|
2025-07-21 14:35:17 +08:00
|
|
|
|
[SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
|
2025-07-03 13:17:25 +08:00
|
|
|
|
public int Id { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
2025-07-21 14:35:17 +08:00
|
|
|
|
/// 设备名称。
|
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>
|
2025-07-21 14:35:17 +08:00
|
|
|
|
/// 设备通信协议类型,对应 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))]
|
2025-07-21 14:35:17 +08:00
|
|
|
|
public ProtocolType Protocol { get; set; }
|
2025-07-04 14:42:28 +08:00
|
|
|
|
|
2025-07-05 01:31:44 +08:00
|
|
|
|
/// <summary>
|
2025-07-21 14:35:17 +08:00
|
|
|
|
/// 设备IP地址。
|
2025-07-05 01:31:44 +08:00
|
|
|
|
/// </summary>
|
2025-07-21 14:35:17 +08:00
|
|
|
|
public string IpAddress { get; set; }
|
2025-07-05 01:31:44 +08:00
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
2025-07-21 14:35:17 +08:00
|
|
|
|
/// 设备端口号。
|
2025-07-05 01:31:44 +08:00
|
|
|
|
/// </summary>
|
2025-07-21 14:35:17 +08:00
|
|
|
|
public int Port { get; set; }
|
2025-07-05 01:31:44 +08:00
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
2025-07-21 14:35:17 +08:00
|
|
|
|
/// 设备机架号 (针对PLC等设备)。
|
2025-07-05 01:31:44 +08:00
|
|
|
|
/// </summary>
|
2025-07-21 18:49:49 +08:00
|
|
|
|
[SugarColumn(IsNullable = true)]
|
2025-07-27 21:08:58 +08:00
|
|
|
|
public short Rack { get; set; }
|
2025-07-05 01:31:44 +08:00
|
|
|
|
|
2025-07-03 13:17:25 +08:00
|
|
|
|
/// <summary>
|
2025-07-21 14:35:17 +08:00
|
|
|
|
/// 设备槽号 (针对PLC等设备)。
|
2025-07-03 13:17:25 +08:00
|
|
|
|
/// </summary>
|
2025-07-21 18:49:49 +08:00
|
|
|
|
[SugarColumn(IsNullable = true)]
|
2025-07-27 21:08:58 +08:00
|
|
|
|
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; }
|
2025-06-23 17:01:06 +08:00
|
|
|
|
|
2025-07-08 20:19:06 +08:00
|
|
|
|
/// <summary>
|
2025-07-21 14:35:17 +08:00
|
|
|
|
/// OPC UA服务器的URL地址。
|
2025-07-08 20:19:06 +08:00
|
|
|
|
/// </summary>
|
2025-07-21 18:49:49 +08:00
|
|
|
|
[SugarColumn(IsNullable = true)]
|
2025-07-21 14:35:17 +08:00
|
|
|
|
public string OpcUaServerUrl { get; set; }
|
2025-07-08 20:19:06 +08:00
|
|
|
|
|
2025-07-03 13:17:25 +08:00
|
|
|
|
/// <summary>
|
2025-07-21 14:35:17 +08:00
|
|
|
|
/// 设备是否激活/启用。
|
2025-07-03 13:17:25 +08:00
|
|
|
|
/// </summary>
|
2025-07-21 14:35:17 +08:00
|
|
|
|
public bool IsActive { get; set; }
|
2025-07-21 23:04:28 +08:00
|
|
|
|
|
|
|
|
|
|
|
2025-07-27 21:08:58 +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
|
|
|
|
}
|