using System; using System.ComponentModel.DataAnnotations; using System.Text.Json.Serialization; namespace Mirle.Component.API.ProgrammableLogicController.Models { /// /// 發生異常回報類別 /// public class FP027HappenAlarmReportDto : CommonMessage { /// /// 異常代碼 /// [Required, StringLength(10), JsonPropertyName("alarm_code"), JsonPropertyOrder(101)] public string AlarmCode { get; set; } /// /// 異常等級 /// /// /// 0 = Warning
/// 1 = Alarm
///
[Required, JsonPropertyName("alarm_level"), JsonPropertyOrder(102)] public AlarmLevel AlarmLevel { get; set; } /// /// 異常敘述 /// [JsonPropertyName("alarm_desc"), JsonPropertyOrder(7)] public string AlarmDescription { get; set; } /// /// 設備編號 /// [Required, StringLength(10), JsonPropertyName("vehicle_id"), JsonPropertyOrder(103)] public string VehicleID { get; set; } /// /// 異常起始時間 /// [Required, JsonPropertyName("start_time"), JsonPropertyOrder(104)] public DateTime StartTime { get; set; } } /// /// 發生異常回應類別 /// public class TP028HappenAlarmAckDto : CommonMessage { /// /// 異常代碼 /// [Required, StringLength(10), JsonPropertyName("alarm_code"), JsonPropertyOrder(101)] public string AlarmCode { get; set; } /// /// 回應代碼 /// /// /// 0 = OK
/// 1 = NG
///
[Required, JsonPropertyName("reply_code"), JsonPropertyOrder(102)] public ReplyCode ReplyCode { get; set; } /// /// 取得發生異常回應 /// /// 交易名稱 /// 軟體編號 /// 任務編號 /// 異常代碼 /// 回應代碼 /// 發生異常回應 public static TP028HappenAlarmAckDto Get(TransactionName transName, string softwareID, string taskID, string alarmCode, ReplyCode replyCode) { return new TP028HappenAlarmAckDto() { Timetick = DateTime.Now, TransactionName = transName.ToTransactionName(), SoftwareID = softwareID, TaskID = taskID, AlarmCode = alarmCode, ReplyCode = replyCode }; } } }