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.
 
 
 
 
 

69 lines
2.3 KiB

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