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.
100 lines
3.9 KiB
100 lines
3.9 KiB
using System;
|
|
using System.ComponentModel.DataAnnotations;
|
|
using System.Text.Json.Serialization;
|
|
|
|
namespace Mirle.Component.API.WarehouseExecutionSystem.Models
|
|
{
|
|
/// <summary>
|
|
/// 完成命令回報類別
|
|
/// </summary>
|
|
public class TW005FinishCommandReportDto : CommonMessage
|
|
{
|
|
/// <summary>
|
|
/// 搬運命令序號
|
|
/// </summary>
|
|
/// <remarks>W[YYYYMMDDHH][Sequence * 5]</remarks>
|
|
[Required, StringLength(16), JsonPropertyName("cmd_sno"), JsonPropertyOrder(101)]
|
|
public string CommandSequnceNumber { get; set; }
|
|
/// <summary>
|
|
/// 搬運命令完成狀態
|
|
/// </summary>
|
|
/// <value>
|
|
/// 0 = Complete <br/>
|
|
/// 1 = Force Complete <br/>
|
|
/// 2 = Force Cancel <br/>
|
|
/// 2 = Failed <br/>
|
|
/// </value>
|
|
[Required, JsonPropertyName("complete_status"), JsonPropertyOrder(102)]
|
|
public CommandCompleteStatus CompleteStatus { get; set; }
|
|
/// <summary>
|
|
/// 搬運命令完成時間
|
|
/// </summary>
|
|
[Required, JsonPropertyName("finish_time"), JsonPropertyOrder(103)]
|
|
public DateTime FinishTime { get; set; }
|
|
/// <summary>
|
|
/// 失敗原因
|
|
/// </summary>
|
|
[JsonPropertyName("failed_reason"), JsonPropertyOrder(104)]
|
|
public string FailedReason { get; set; }
|
|
/// <summary>
|
|
/// 取得完成命令回報
|
|
/// </summary>
|
|
/// <param name="transName">交易名稱</param>
|
|
/// <param name="commandSeqeunceNumber">搬運命令序號</param>
|
|
/// <param name="completeStatus">搬運命令完成狀態</param>
|
|
/// <param name="finishTime">搬運命令完成時間</param>
|
|
/// <param name="faileReason">失敗原因</param>
|
|
/// <returns>完成命令回報</returns>
|
|
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
|
|
};
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// 完成命令回應類別
|
|
/// </summary>
|
|
public class FW006FinishCommandAckDto : CommonMessage
|
|
{
|
|
/// <summary>
|
|
/// 搬運命令序號
|
|
/// </summary>
|
|
/// <remarks>W[YYYYMMDDHH][Sequence * 5]</remarks>
|
|
[Required, StringLength(16), JsonPropertyName("cmd_sno"), JsonPropertyOrder(101)]
|
|
public string CommandSequnceNumber { 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="commandSequnceNumberm">搬運命令序號</param>
|
|
/// <param name="replyCode">回應代碼</param>
|
|
/// <returns>完成命令回應</returns>
|
|
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
|
|
};
|
|
}
|
|
}
|
|
}
|