using System;
using System.ComponentModel.DataAnnotations;
using System.Text.Json.Serialization;
namespace Mirle.Component.API.ProgrammableLogicController.Models
{
///
/// 完成命令回報類別
///
public class FP005FinishCommandReportDto : CommonMessage
{
///
/// 任務狀態
///
///
/// 0 = Complete
/// 1 = Force Complete
/// 2 = Failed
/// 3 = Cancel
/// 4 = Force Cancel
///
[Required, JsonPropertyName("task_status"), JsonPropertyOrder(101)]
public TaskCompleteStatus TaskStatus { get; set; }
///
/// 任務完成時間
///
[Required, JsonPropertyName("finish_time"), JsonPropertyOrder(102)]
public DateTime FinishTime { get; set; }
///
/// 任務失敗原因
///
[StringLength(255), JsonPropertyName("failed_reason"), JsonPropertyOrder(103)]
public string FailedReason { get; set; }
}
///
/// 完成命令回應類別
///
public class TP006FinishCommandAckDto : CommonMessage
{
///
/// 回應代碼
///
///
/// 0 = OK
/// 1 = NG
///
[Required, JsonPropertyName("reply_code"), JsonPropertyOrder(101)]
public ReplyCode ReplyCode { get; set; }
///
/// 取得完成命令回應
///
/// 交易名稱
/// 軟體編號
/// 任務編號
/// 回應代碼
/// 完成命令回應
public static TP006FinishCommandAckDto Get(TransactionName transName, string softwareID, string taskID, ReplyCode replyCode)
{
return new TP006FinishCommandAckDto()
{
Timetick = DateTime.Now,
TransactionName = transName.ToTransactionName(),
SoftwareID = softwareID,
TaskID = taskID,
ReplyCode = replyCode
};
}
}
}