增加报警

This commit is contained in:
2025-01-01 17:41:48 +08:00
parent f26bf28181
commit 7b5df5877d
16 changed files with 896 additions and 122 deletions

View File

@@ -0,0 +1,75 @@
using FreeSql.DataAnnotations;
using System;
namespace CapMachine.Model.Alarm
{
/// <summary>
/// 报警配置信息
/// </summary>
[Table(Name = "AlarmConfig")]
public class AlarmConfig
{
/// <summary>
/// 主键
/// </summary>
[Column(IsPrimary = true, IsIdentity = true)]
public long Id { get; set; }
/// <summary>
/// 报警配置类别
/// </summary>
[Column(Name = "Category", IsNullable = false, StringLength = 20)]
public string? Category { get; set; }
/// <summary>
/// 报警的地址
/// </summary>
[Column(Name = "Address", IsNullable = false, StringLength = 20)]
public string? Address { get; set; }
/// <summary>
/// 报警等级
/// </summary>
[Column(Name = "AlarmLevel", IsNullable = false)]
public AlarmLevel AlarmLevel { get; set; }
/// <summary>
/// 激活类型
/// </summary>
[Column(Name = "ActiveType", IsNullable = false)]
public ActiveType ActiveType { get; set; }
/// <summary>
/// 报警配置名称
/// </summary>
[Column(Name = "Name", IsNullable = false, StringLength = 50)]
public string? Name { get; set; }
/// <summary>
/// 报警消息
/// </summary>
[Column(Name = "Message", IsNullable = false, StringLength = 150)]
public string? Message { get; set; }
/// <summary>
/// 布尔激活的阀值
/// </summary>
[Column(Name = "BoolActiveValue", IsNullable = false)]
public bool BoolActiveValue { get; set; }
/// <summary>
/// 报警上限阀值
/// </summary>
[Column(Name = "ThresholdUp", DbType = "decimal(8, 3)", IsNullable = true)]
public decimal ThresholdUp { get; set; }
/// <summary>
/// 报警下限阀值
/// </summary>
[Column(Name = "ThresholdDown", DbType = "decimal(8, 3)", IsNullable = true)]
public decimal ThresholdDown { get; set; }
[Column(ServerTime = DateTimeKind.Local, CanUpdate = false)]
public DateTime CreateTime { get; set; }
}
}

View File

@@ -0,0 +1,45 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CapMachine.Model.Alarm
{
/// <summary>
/// 报警等级
/// </summary>
public enum AlarmLevel
{
/// <summary>
/// 一级
/// </summary>
Level1=1,
/// <summary>
/// 二级
/// </summary>
Level2 = 2,
/// <summary>
/// 三级
/// </summary>
Level3 = 3,
}
/// <summary>
/// 报警激活类型
/// </summary>
public enum ActiveType
{
/// <summary>
/// 阀值
/// </summary>
Threshold = 1,
/// <summary>
/// 布尔类型
/// </summary>
Bool = 2,
}
}

View File

@@ -0,0 +1,59 @@
using FreeSql.DataAnnotations;
using System;
namespace CapMachine.Model.Alarm
{
/// <summary>
/// PLC报警 HistoryAlarm
/// </summary>
[Table(Name = "HistoryAlarm")]
public class HistoryAlarm
{
/// <summary>
/// 主键
/// </summary>
[Column(IsPrimary = true, IsIdentity = true)]
public long Id { get; set; }
/// <summary>
/// 报警消息分类
/// </summary>
[Column(Name = "Category", IsNullable = false, StringLength = 20)]
public string? Category { get; set; }
/// <summary>
/// 报警等级
/// </summary>
[Column(Name = "AlarmLevel", IsNullable = false)]
public AlarmLevel AlarmLevel { get; set; }
/// <summary>
/// 报警名称
/// </summary>
[Column(Name = "Name", IsNullable = false, StringLength = 50)]
public string? Name { get; set; }
/// <summary>
/// 报警消息
/// </summary>
[Column(Name = "Message", IsNullable = false, StringLength = 150)]
public string? Message { get; set; }
/// <summary>
/// 报警时长
/// 秒
/// </summary>
[Column(Name = "Duration")]
public long Duration { get; set; }
[Column(Name = "CreateTime")]
public DateTime CreateTime { get; set; }
/// <summary>
/// ///////////////////////////////////////////导航属性///////////////////////////////////////////////////////
/// </summary>
//public Guid? AlarmAddressId { get; set; }
//public AlarmAddress AlarmAddress { get; set; }
}
}