using System; using System.ComponentModel.DataAnnotations; using System.Text.Json.Serialization; namespace Mirle.Component.API.WarehouseExecutionSystem.Models { /// /// 完成命令回報類別 /// public class TW005FinishCommandReportDto : CommonMessage { /// /// 搬運命令序號 /// /// W[YYYYMMDDHH][Sequence * 5] [Required, StringLength(16), JsonPropertyName("cmd_sno"), JsonPropertyOrder(101)] public string CommandSequnceNumber { get; set; } /// /// 搬運命令完成狀態 /// /// /// 0 = Complete
/// 1 = Force Complete
/// 2 = Force Cancel
/// 2 = Failed
///
[Required, JsonPropertyName("complete_status"), JsonPropertyOrder(102)] public CommandCompleteStatus CompleteStatus { get; set; } /// /// 搬運命令完成時間 /// [Required, JsonPropertyName("finish_time"), JsonPropertyOrder(103)] public DateTime FinishTime { get; set; } /// /// 失敗原因 /// [JsonPropertyName("failed_reason"), JsonPropertyOrder(104)] public string FailedReason { get; set; } /// /// 取得完成命令回報 /// /// 交易名稱 /// 搬運命令序號 /// 搬運命令完成狀態 /// 搬運命令完成時間 /// 失敗原因 /// 完成命令回報 public static TW005FinishCommandReportDto Get(TransactionName transName, string commandSeqeunceNumber, CommandCompleteStatus completeStatus, DateTime finishTime, string faileReason = null) { return new TW005FinishCommandReportDto() { Timetick = DateTime.Now, TransactionName = transName.ToTransactionName(), CommandSequnceNumber = commandSeqeunceNumber, CompleteStatus = completeStatus, FinishTime = finishTime, FailedReason = faileReason }; } } /// /// 完成命令回應類別 /// public class FW006FinishCommandAckDto : CommonMessage { /// /// 搬運命令序號 /// /// W[YYYYMMDDHH][Sequence * 5] [Required, StringLength(16), JsonPropertyName("cmd_sno"), JsonPropertyOrder(101)] public string CommandSequnceNumber { get; set; } /// /// 回應代碼 /// /// /// 0 = OK
/// 1 = NG
///
[Required, JsonPropertyName("reply_code"), JsonPropertyOrder(102)] public ReplyCode ReplyCode { get; set; } /// /// 取得完成命令回應 /// /// 交易名稱 /// 搬運命令序號 /// 回應代碼 /// 完成命令回應 public static FW006FinishCommandAckDto Get(TransactionName transName, string commandSequnceNumberm, bool replyCode) { return new FW006FinishCommandAckDto() { Timetick = DateTime.Now, TransactionName = transName.ToTransactionName(), CommandSequnceNumber = commandSequnceNumberm, ReplyCode = replyCode ? ReplyCode.OK : ReplyCode.NG }; } } }