You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

84 lines
2.9 KiB

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