using System;
using System.ComponentModel.DataAnnotations;
using System.Text.Json.Serialization;
namespace Mirle.Component.API.WarehouseExecutionSystem.Models
{
///
/// 執行命令回報類別
///
public class TW003ExecuteCommandReportDto : CommonMessage
{
///
/// 搬運命令序號
///
/// W[YYYYMMDDHH][Sequence * 5]
[Required, StringLength(16), JsonPropertyName("cmd_sno"), JsonPropertyOrder(101)]
public string CommandSequnceNumber { get; set; }
///
/// 搬運命令開始時間
///
[Required, JsonPropertyName("start_time"), JsonPropertyOrder(102)]
public DateTime StartTime { get; set; }
///
/// 取得執行命令回報
///
/// 交易名稱
/// 搬運命令序號
/// 搬運命令開始時間
/// 執行命令回報
public static TW003ExecuteCommandReportDto Get(TransactionName transName, string commandSequnceNumber, DateTime startTime)
{
return new TW003ExecuteCommandReportDto()
{
Timetick = DateTime.Now,
TransactionName = transName.ToTransactionName(),
CommandSequnceNumber = commandSequnceNumber,
StartTime = startTime
};
}
}
///
/// 執行命令回應類別
///
public class FW004ExecuteCommandAckDto : 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 FW004ExecuteCommandAckDto Get(TransactionName transName, string commandSequnceNumber, bool replyCode)
{
return new FW004ExecuteCommandAckDto()
{
Timetick = DateTime.Now,
TransactionName = transName.ToTransactionName(),
CommandSequnceNumber = commandSequnceNumber,
ReplyCode = replyCode ? ReplyCode.OK : ReplyCode.NG
};
}
}
}