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

87 lines
2.2 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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