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.
 
 
 
 
 

56 lines
1.7 KiB

using System;
using System.ComponentModel.DataAnnotations;
using System.Text.Json.Serialization;
namespace Mirle.Component.API.WarehouseExecutionSystem.Models
{
/// <summary>
/// 心跳包回報類別
/// </summary>
public class TW013HeartbeatReportDto : CommonMessage
{
/// <summary>
/// 取得心跳包回報
/// </summary>
/// <param name="transName">交易名稱</param>
/// <returns>心跳包回報</returns>
public static TW013HeartbeatReportDto Get(TransactionName transName)
{
return new TW013HeartbeatReportDto()
{
Timetick = DateTime.Now,
TransactionName = transName.ToTransactionName()
};
}
}
/// <summary>
/// 心跳包回應類別
/// </summary>
public class FW014HeartbeatAckDto : 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="replyCode">回應代碼</param>
/// <returns>心跳包回應</returns>
public static FW014HeartbeatAckDto Get(TransactionName transName, bool replyCode)
{
return new FW014HeartbeatAckDto()
{
Timetick = DateTime.Now,
TransactionName = transName.ToTransactionName(),
ReplyCode = replyCode ? ReplyCode.OK : ReplyCode.NG
};
}
}
}