按照软件设计文档开始重构代码01

This commit is contained in:
2025-07-21 14:35:17 +08:00
parent a7b0a5d108
commit 29a2d44319
127 changed files with 12265 additions and 1586 deletions

View File

@@ -1,88 +1,65 @@
using System.Collections.ObjectModel;
using DMS.Core.Enums;
using System.Collections.Generic;
namespace DMS.Core.Models;
/// <summary>
/// 表示设备信息
/// 代表一个可管理的物理或逻辑设备
/// </summary>
public partial class Device
public class Device
{
/// <summary>
/// 唯一标识符。
/// </summary>
public int Id { get; set; }
/// <summary>
/// 设备名称用于UI显示和识别。
/// </summary>
public string Name { get; set; }
/// <summary>
/// 设备的描述信息。
/// </summary>
public string Description { get; set; }
/// <summary>
/// 设备的类型
/// 设备使用的通信协议
/// </summary>
public DeviceType DeviceType { get; set; }
/// <summary>
/// 设备的唯一标识符。
/// </summary>
public int Id { get; set; }
public ProtocolType Protocol { get; set; }
/// <summary>
/// 设备的IP地址。
/// </summary>
public string Ip { get; set; }
public string IpAddress { get; set; }
/// <summary>
/// 表示设备是否处于活动状态
/// 设备的通信端口号
/// </summary>
public bool IsActive { get; set; } = true;
public int Port { get; set; }
/// <summary>
/// 表示是否添加默认变量表
/// S7 PLC的机架号
/// </summary>
public bool IsAddDefVarTable { get; set; } = true;
public int Rack { get; set; }
/// <summary>
/// 表示设备是否正在运行
/// S7 PLC的槽号
/// </summary>
public bool IsRuning { get; set; }
public int Slot { get; set; }
/// <summary>
/// 设备的名称
/// OPC UA 服务器地址 (仅当 Protocol 为 OpcUa 时有效)
/// </summary>
public string Name { get; set; }
public string OpcUaServerUrl { get; set; }
/// <summary>
/// 设备的端口号
/// 指示此设备是否处于激活状态。只有激活的设备才会被轮询
/// </summary>
public int Prot { get; set; }
public bool IsActive { get; set; }
/// <summary>
/// PLC的CPU类型
/// 此设备包含的变量表集合
/// </summary>
//public CpuType cpuType;
/// <summary>
/// PLC的机架号。
/// </summary>
public short Rack { get; set; }
/// <summary>
/// PLC的槽号。
/// </summary>
public short Slot { get; set; }
/// <summary>
/// 设备的通信协议类型。
/// </summary>
public ProtocolType ProtocolType { get; set; }
/// <summary>
/// OPC UA Endpoint URL。
/// </summary>
public string OpcUaEndpointUrl { get; set; }=String.Empty;
/// <summary>
/// 设备关联的变量表列表。
/// </summary>
public ObservableCollection<VariableTable>? VariableTables { get; set; }
public List<VariableTable> VariableTables { get; set; } = new();
}