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.
 
 
 
 
 

79 lines
3.0 KiB

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