Add MQTT runtime control and device data pipeline

This commit is contained in:
zhougf committed 2026-05-31 10:55:22 +08:00
1 parent 96d8309793
commit 8a0aa8f7cb
31 files changed
+30842 -20

No files matched your search

@@ -0,0 +1,44 @@
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using WalkingTec.Mvvm.Core;
namespace HHWMS.Web.Models
{
[Table("DeviceAlarmRecord")]
[Display(Name = "DeviceAlarmRecord", Description = "设备告警记录")]
public class DeviceAlarmRecord : BasePoco
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public new int ID { get; set; }
[Display(Name = "DeviceAlarmRecord.DeviceId", Description = "设备唯一标识")]
[StringLength(100, ErrorMessage = "Validate.{0}stringmax{1}")]
[Required(ErrorMessage = "Validate.{0}required")]
public string DeviceId { get; set; }
[Display(Name = "DeviceAlarmRecord.AlarmCode", Description = "告警代码")]
[StringLength(100, ErrorMessage = "Validate.{0}stringmax{1}")]
public string AlarmCode { get; set; }
[Display(Name = "DeviceAlarmRecord.AlarmMessage", Description = "告警内容")]
[StringLength(500, ErrorMessage = "Validate.{0}stringmax{1}")]
public string AlarmMessage { get; set; }
[Display(Name = "DeviceAlarmRecord.StartTime", Description = "告警开始时间")]
public DateTime StartTime { get; set; }
[Display(Name = "DeviceAlarmRecord.EndTime", Description = "告警恢复时间")]
public DateTime? EndTime { get; set; }
[Display(Name = "DeviceAlarmRecord.IsActive", Description = "是否仍在告警")]
public bool IsActive { get; set; }
[Display(Name = "DeviceAlarmRecord.LastSeenTime", Description = "最后出现时间")]
public DateTime? LastSeenTime { get; set; }
[Display(Name = "DeviceAlarmRecord.RepeatCount", Description = "重复出现次数")]
public int RepeatCount { get; set; }
}
}
@@ -0,0 +1,46 @@
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using WalkingTec.Mvvm.Core;
namespace HHWMS.Web.Models
{
[Table("DeviceCurrentState")]
[Display(Name = "DeviceCurrentState", Description = "设备当前状态")]
public class DeviceCurrentState : BasePoco
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public new int ID { get; set; }
[Display(Name = "DeviceCurrentState.DeviceId", Description = "设备唯一标识")]
[StringLength(100, ErrorMessage = "Validate.{0}stringmax{1}")]
[Required(ErrorMessage = "Validate.{0}required")]
public string DeviceId { get; set; }
[Display(Name = "DeviceCurrentState.DeviceName", Description = "设备显示名称")]
[StringLength(100, ErrorMessage = "Validate.{0}stringmax{1}")]
public string DeviceName { get; set; }
[Display(Name = "DeviceCurrentState.DeviceType", Description = "设备类型")]
[StringLength(30, ErrorMessage = "Validate.{0}stringmax{1}")]
public string DeviceType { get; set; }
[Display(Name = "DeviceCurrentState.Status", Description = "当前状态")]
[StringLength(30, ErrorMessage = "Validate.{0}stringmax{1}")]
public string Status { get; set; }
[Display(Name = "DeviceCurrentState.LastPayloadTime", Description = "最后设备数据时间")]
public DateTime? LastPayloadTime { get; set; }
[Display(Name = "DeviceCurrentState.LastUpdateTime", Description = "最后状态更新时间")]
public DateTime? LastUpdateTime { get; set; }
[Display(Name = "DeviceCurrentState.AlarmSummary", Description = "当前告警摘要")]
[StringLength(500, ErrorMessage = "Validate.{0}stringmax{1}")]
public string AlarmSummary { get; set; }
[Display(Name = "DeviceCurrentState.RealtimeJson", Description = "清洗后的实时数据")]
public string RealtimeJson { get; set; }
}
}
@@ -0,0 +1,44 @@
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using WalkingTec.Mvvm.Core;
namespace HHWMS.Web.Models
{
[Table("DeviceMetricTrendPoint")]
[Display(Name = "DeviceMetricTrendPoint", Description = "设备指标趋势聚合点")]
public class DeviceMetricTrendPoint : BasePoco
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public new int ID { get; set; }
[Display(Name = "DeviceMetricTrendPoint.DeviceId", Description = "设备唯一标识")]
[StringLength(100, ErrorMessage = "Validate.{0}stringmax{1}")]
[Required(ErrorMessage = "Validate.{0}required")]
public string DeviceId { get; set; }
[Display(Name = "DeviceMetricTrendPoint.MetricName", Description = "指标名称")]
[StringLength(60, ErrorMessage = "Validate.{0}stringmax{1}")]
[Required(ErrorMessage = "Validate.{0}required")]
public string MetricName { get; set; }
[Display(Name = "DeviceMetricTrendPoint.BucketTime", Description = "聚合时间桶")]
public DateTime BucketTime { get; set; }
[Display(Name = "DeviceMetricTrendPoint.AvgValue", Description = "平均值")]
[Column(TypeName = "decimal(18,4)")]
public decimal AvgValue { get; set; }
[Display(Name = "DeviceMetricTrendPoint.MaxValue", Description = "最大值")]
[Column(TypeName = "decimal(18,4)")]
public decimal MaxValue { get; set; }
[Display(Name = "DeviceMetricTrendPoint.MinValue", Description = "最小值")]
[Column(TypeName = "decimal(18,4)")]
public decimal MinValue { get; set; }
[Display(Name = "DeviceMetricTrendPoint.SampleCount", Description = "样本数")]
public int SampleCount { get; set; }
}
}
@@ -0,0 +1,45 @@
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using WalkingTec.Mvvm.Core;
namespace HHWMS.Web.Models
{
[Table("DeviceProductionDaily")]
[Display(Name = "DeviceProductionDaily", Description = "设备日产能汇总")]
public class DeviceProductionDaily : BasePoco
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public new int ID { get; set; }
[Display(Name = "DeviceProductionDaily.DeviceId", Description = "设备唯一标识")]
[StringLength(100, ErrorMessage = "Validate.{0}stringmax{1}")]
[Required(ErrorMessage = "Validate.{0}required")]
public string DeviceId { get; set; }
[Display(Name = "DeviceProductionDaily.ProductionDate", Description = "生产日期")]
public DateTime ProductionDate { get; set; }
[Display(Name = "DeviceProductionDaily.StartCounter", Description = "当日开始累计值")]
public int StartCounter { get; set; }
[Display(Name = "DeviceProductionDaily.EndCounter", Description = "当日结束累计值")]
public int EndCounter { get; set; }
[Display(Name = "DeviceProductionDaily.ProduceCount", Description = "当日产量")]
public int ProduceCount { get; set; }
[Display(Name = "DeviceProductionDaily.RuntimeMinutes", Description = "运行分钟数")]
public int RuntimeMinutes { get; set; }
[Display(Name = "DeviceProductionDaily.CuttimeMinutes", Description = "加工分钟数")]
public int CuttimeMinutes { get; set; }
[Display(Name = "DeviceProductionDaily.AlarmMinutes", Description = "报警分钟数")]
public int AlarmMinutes { get; set; }
[Display(Name = "DeviceProductionDaily.OfflineMinutes", Description = "离线分钟数")]
public int OfflineMinutes { get; set; }
}
}