按照软件设计文档开始重构代码01
This commit is contained in:
14
DMS.Application/DTOs/CreateDeviceDto.cs
Normal file
14
DMS.Application/DTOs/CreateDeviceDto.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
using DMS.Core.Enums;
|
||||
|
||||
namespace DMS.Application.DTOs;
|
||||
|
||||
/// <summary>
|
||||
/// 用于创建新设备时传输数据的DTO。
|
||||
/// </summary>
|
||||
public class CreateDeviceDto
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public ProtocolType Protocol { get; set; }
|
||||
public string IpAddress { get; set; }
|
||||
public int Port { get; set; }
|
||||
}
|
||||
11
DMS.Application/DTOs/CreateDeviceWithDetailsDto.cs
Normal file
11
DMS.Application/DTOs/CreateDeviceWithDetailsDto.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
namespace DMS.Application.DTOs;
|
||||
|
||||
/// <summary>
|
||||
/// 用于创建新设备及其关联的变量表和菜单的DTO。
|
||||
/// </summary>
|
||||
public class CreateDeviceWithDetailsDto
|
||||
{
|
||||
public CreateDeviceDto Device { get; set; }
|
||||
public VariableTableDto VariableTable { get; set; }
|
||||
// public MenuBeanDto Menu { get; set; } // 如果需要包含菜单信息
|
||||
}
|
||||
18
DMS.Application/DTOs/DeviceDto.cs
Normal file
18
DMS.Application/DTOs/DeviceDto.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
namespace DMS.Application.DTOs;
|
||||
|
||||
/// <summary>
|
||||
/// 用于在UI上显示设备基本信息的DTO。
|
||||
/// </summary>
|
||||
public class DeviceDto
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string Protocol { get; set; }
|
||||
public string IpAddress { get; set; }
|
||||
public int Port { get; set; }
|
||||
public int Rack { get; set; }
|
||||
public int Slot { get; set; }
|
||||
public string OpcUaServerUrl { get; set; }
|
||||
public bool IsActive { get; set; }
|
||||
public string Status { get; set; } // "在线", "离线", "连接中..."
|
||||
}
|
||||
15
DMS.Application/DTOs/MenuBeanDto.cs
Normal file
15
DMS.Application/DTOs/MenuBeanDto.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
namespace DMS.Application.DTOs;
|
||||
|
||||
/// <summary>
|
||||
/// 用于在UI上显示菜单项的DTO。
|
||||
/// </summary>
|
||||
public class MenuBeanDto
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public int? ParentId { get; set; }
|
||||
public string Header { get; set; }
|
||||
public string Icon { get; set; }
|
||||
public string TargetViewKey { get; set; }
|
||||
public string NavigationParameter { get; set; }
|
||||
public int DisplayOrder { get; set; }
|
||||
}
|
||||
24
DMS.Application/DTOs/MqttServerDto.cs
Normal file
24
DMS.Application/DTOs/MqttServerDto.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using System;
|
||||
|
||||
namespace DMS.Application.DTOs;
|
||||
|
||||
/// <summary>
|
||||
/// 用于在UI上显示MQTT服务器配置信息的DTO。
|
||||
/// </summary>
|
||||
public class MqttServerDto
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string ServerName { get; set; }
|
||||
public string BrokerAddress { get; set; }
|
||||
public int Port { get; set; }
|
||||
public string Username { get; set; }
|
||||
public string Password { get; set; }
|
||||
public bool IsActive { get; set; }
|
||||
public string SubscribeTopic { get; set; }
|
||||
public string PublishTopic { get; set; }
|
||||
public string ClientId { get; set; }
|
||||
public DateTime CreatedAt { get; set; }
|
||||
public DateTime? ConnectedAt { get; set; }
|
||||
public long ConnectionDuration { get; set; }
|
||||
public string MessageFormat { get; set; }
|
||||
}
|
||||
19
DMS.Application/DTOs/UpdateDeviceDto.cs
Normal file
19
DMS.Application/DTOs/UpdateDeviceDto.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
using DMS.Core.Enums;
|
||||
|
||||
namespace DMS.Application.DTOs;
|
||||
|
||||
/// <summary>
|
||||
/// 用于更新设备时传输数据的DTO。
|
||||
/// </summary>
|
||||
public class UpdateDeviceDto
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string Name { get; set; }
|
||||
public ProtocolType Protocol { get; set; }
|
||||
public string IpAddress { get; set; }
|
||||
public int Port { get; set; }
|
||||
public int Rack { get; set; }
|
||||
public int Slot { get; set; }
|
||||
public string OpcUaServerUrl { get; set; }
|
||||
public bool IsActive { get; set; }
|
||||
}
|
||||
12
DMS.Application/DTOs/UserDto.cs
Normal file
12
DMS.Application/DTOs/UserDto.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
namespace DMS.Application.DTOs;
|
||||
|
||||
/// <summary>
|
||||
/// 用于在UI上显示用户信息的DTO。
|
||||
/// </summary>
|
||||
public class UserDto
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string Username { get; set; }
|
||||
public string Role { get; set; }
|
||||
public bool IsActive { get; set; }
|
||||
}
|
||||
32
DMS.Application/DTOs/VariableDto.cs
Normal file
32
DMS.Application/DTOs/VariableDto.cs
Normal file
@@ -0,0 +1,32 @@
|
||||
using DMS.Core.Enums;
|
||||
using System;
|
||||
|
||||
namespace DMS.Application.DTOs;
|
||||
|
||||
/// <summary>
|
||||
/// 用于在UI上显示变量基本信息的DTO。
|
||||
/// </summary>
|
||||
public class VariableDto
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string Address { get; set; }
|
||||
public SignalType DataType { get; set; }
|
||||
public PollLevelType PollLevel { get; set; }
|
||||
public bool IsActive { get; set; }
|
||||
public int VariableTableId { get; set; }
|
||||
public string OpcUaNodeId { get; set; }
|
||||
public bool IsHistoryEnabled { get; set; }
|
||||
public double HistoryDeadband { get; set; }
|
||||
public bool IsAlarmEnabled { get; set; }
|
||||
public double AlarmMinValue { get; set; }
|
||||
public double AlarmMaxValue { get; set; }
|
||||
public double AlarmDeadband { get; set; }
|
||||
public ProtocolType Protocol { get; set; }
|
||||
public CSharpDataType CSharpDataType { get; set; }
|
||||
public string ConversionFormula { get; set; }
|
||||
public DateTime CreatedAt { get; set; }
|
||||
public DateTime UpdatedAt { get; set; }
|
||||
public string UpdatedBy { get; set; }
|
||||
public bool IsModified { get; set; }
|
||||
}
|
||||
14
DMS.Application/DTOs/VariableHistoryDto.cs
Normal file
14
DMS.Application/DTOs/VariableHistoryDto.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
using System;
|
||||
|
||||
namespace DMS.Application.DTOs;
|
||||
|
||||
/// <summary>
|
||||
/// 用于在UI上显示变量历史记录的DTO。
|
||||
/// </summary>
|
||||
public class VariableHistoryDto
|
||||
{
|
||||
public long Id { get; set; }
|
||||
public int VariableId { get; set; }
|
||||
public string Value { get; set; }
|
||||
public DateTime Timestamp { get; set; }
|
||||
}
|
||||
13
DMS.Application/DTOs/VariableMqttAliasDto.cs
Normal file
13
DMS.Application/DTOs/VariableMqttAliasDto.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
namespace DMS.Application.DTOs;
|
||||
|
||||
/// <summary>
|
||||
/// 用于在UI上显示和管理变量与MQTT服务器关联别名的DTO。
|
||||
/// </summary>
|
||||
public class VariableMqttAliasDto
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public int VariableId { get; set; }
|
||||
public int MqttServerId { get; set; }
|
||||
public string MqttServerName { get; set; } // 用于UI显示关联的服务器名称
|
||||
public string Alias { get; set; }
|
||||
}
|
||||
16
DMS.Application/DTOs/VariableTableDto.cs
Normal file
16
DMS.Application/DTOs/VariableTableDto.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
using DMS.Core.Enums;
|
||||
|
||||
namespace DMS.Application.DTOs;
|
||||
|
||||
/// <summary>
|
||||
/// 用于在UI上显示变量表基本信息的DTO。
|
||||
/// </summary>
|
||||
public class VariableTableDto
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string Description { get; set; }
|
||||
public bool IsActive { get; set; }
|
||||
public int DeviceId { get; set; }
|
||||
public ProtocolType Protocol { get; set; }
|
||||
}
|
||||
Reference in New Issue
Block a user