实现设备数据通过MQTT上传功能,包括: 1. 新增DeviceUploadData实体及DTO 2. 添加MQTT服务处理设备消息 3. 实现设备数据存储逻辑 4. 创建相关控制器和服务接口
129 lines
3.2 KiB
C#
129 lines
3.2 KiB
C#
using System.ComponentModel.DataAnnotations;
|
|
using System.Text.Json.Serialization;
|
|
|
|
namespace ZR.Model.Dto
|
|
{
|
|
/// <summary>
|
|
/// 查询对象
|
|
/// </summary>
|
|
public class DeviceUploadDataQueryDto : PagerInfo
|
|
{
|
|
}
|
|
// 网关发来数据
|
|
public class DeviceUploadDataGatWayDto
|
|
{
|
|
[JsonPropertyName("time")]
|
|
public long Time { get; set; }
|
|
[JsonPropertyName("params")]
|
|
public DeviceUploadDataParamsDto DeviceParams { get; set; }
|
|
}
|
|
/// <summary>
|
|
/// 传来参数对象
|
|
/// </summary>
|
|
public class DeviceUploadDataParamsDto
|
|
{
|
|
/// <summary>
|
|
/// 底漆循环温度DB1014.444
|
|
/// </summary>
|
|
[JsonPropertyName("Value01")]
|
|
public decimal Value01 { get; set; }
|
|
|
|
/// <summary>
|
|
/// 底漆循环湿度DB1014.498
|
|
/// </summary>
|
|
[JsonPropertyName("Value02")]
|
|
public decimal Value02 { get; set; }
|
|
|
|
/// <summary>
|
|
/// 色漆循环温度DB1014.552
|
|
/// </summary>
|
|
[JsonPropertyName("Value03")]
|
|
public decimal Value03 { get; set; }
|
|
|
|
/// <summary>
|
|
/// 色漆循环湿度DB1014.610
|
|
/// </summary>
|
|
[JsonPropertyName("Value04")]
|
|
public decimal Value04 { get; set; }
|
|
|
|
/// <summary>
|
|
/// 清漆循环温度DB1014.664
|
|
/// </summary>
|
|
[JsonPropertyName("Value05")]
|
|
public decimal Value05 { get; set; }
|
|
|
|
/// <summary>
|
|
/// 清漆循环湿度DB1014.722
|
|
/// </summary>
|
|
[JsonPropertyName("Value06")]
|
|
public decimal Value06 { get; set; }
|
|
|
|
/// <summary>
|
|
/// 纯水电导率DB1012.220
|
|
/// </summary>
|
|
[JsonPropertyName("Value07")]
|
|
public decimal Value07 { get; set; }
|
|
|
|
/// <summary>
|
|
/// 水份烘干温度DB1014.776
|
|
/// </summary>
|
|
[JsonPropertyName("Value08")]
|
|
public decimal Value08 { get; set; }
|
|
|
|
/// <summary>
|
|
/// 清漆烘干温度DB1014.892
|
|
/// </summary>
|
|
[JsonPropertyName("Value09")]
|
|
public decimal Value09 { get; set; }
|
|
|
|
/// <summary>
|
|
/// Value10
|
|
/// </summary>
|
|
[JsonPropertyName("Value10")]
|
|
public decimal Value10 { get; set; }
|
|
}
|
|
|
|
/// <summary>
|
|
/// 输入输出对象
|
|
/// </summary>
|
|
public class DeviceUploadDataDto
|
|
{
|
|
[Required(ErrorMessage = "主键不能为空")]
|
|
public long Id { get; set; }
|
|
|
|
public string FactoryCode { get; set; }
|
|
|
|
public string WorkshopCode { get; set; }
|
|
|
|
public string LineCode { get; set; }
|
|
|
|
public string DeviceCode { get; set; }
|
|
|
|
public string DictCode { get; set; }
|
|
|
|
public string Remark { get; set; }
|
|
|
|
public string Value01 { get; set; }
|
|
|
|
public string Value02 { get; set; }
|
|
|
|
public string Value03 { get; set; }
|
|
|
|
public string Value04 { get; set; }
|
|
|
|
public string Value05 { get; set; }
|
|
|
|
public string Value06 { get; set; }
|
|
|
|
public string Value07 { get; set; }
|
|
|
|
public string Value08 { get; set; }
|
|
|
|
public string Value09 { get; set; }
|
|
|
|
public string Value10 { get; set; }
|
|
|
|
|
|
|
|
}
|
|
} |