using System;
using System.ComponentModel.DataAnnotations;
using System.Text.Json.Serialization;
namespace Mirle.Component.API.AutomatedGuideVehicleController.Models
{
///
/// 車輛清單請求類別
///
public class SetAmrListRequestDto : CommonMessage
{
///
/// 區域
///
///
/// all
///
[Required, StringLength(3), JsonPropertyName("zone"), JsonPropertyOrder(101)]
public string Zone { get; set; }
///
/// 取得車輛清單請求
///
/// 通訊協議版本
/// 訊息流水號
/// 訊息優先權
/// 車輛清單請求
public static SetAmrListRequestDto Get(string protocolVersion, string sequence, string priority)
{
return new SetAmrListRequestDto()
{
ProtocolVersion = protocolVersion,
Sequence = sequence,
Timestamp = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"),
Priority = priority,
Zone = "all"
};
}
}
///
/// 車輛清單回應類別
///
public class SetAmrListReplyDto : CommonMessage
{
///
/// 指令確認結果
///
///
/// ACK
/// NG
///
[Required, StringLength(3), JsonPropertyName("reply"), JsonPropertyOrder(101)]
public string Reply { get; set; }
///
/// 失敗理由
///
[StringLength(255), JsonPropertyName("reason"), JsonPropertyOrder(102)]
public string Reason { get; set; }
///
/// 取得車輛清單回應
///
/// 通訊協議版本
/// 訊息流水號
/// 訊息優先權
/// 回應結果
/// 失敗原因
/// 車輛清單回應
/// reply : true = ACK, false = NG
public static SetAmrListReplyDto Get(string protocolVersion, string sequence, string priority, bool reply, string reason = "NA")
{
return new SetAmrListReplyDto()
{
ProtocolVersion = protocolVersion,
Sequence = sequence,
Timestamp = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"),
Priority = priority,
Reply = reply ? "ACK" : "NG",
Reason = reason
};
}
}
///
/// 車輛清單回報類別
///
public class SetAmrListResultDto : CommonMessage
{
///
/// 車輛總數
///
[Required, JsonPropertyName("count"), JsonPropertyOrder(101)]
public string Count { get; set; }
///
/// 車輛名稱列表
///
/// 逗號分隔
[JsonPropertyName("amrs"), JsonPropertyOrder(102)]
public string Amrs { get; set; }
}
///
/// 車輛清單回應類別
///
public class SetAmrListAckDto : CommonMessage
{
///
/// 回應
///
///
/// OK
///
[Required, StringLength(2), JsonPropertyName("ack"), JsonPropertyOrder(101)]
public string Ack { get; set; }
///
/// 取得車輛清單回應
///
/// 通訊協議版本
/// 訊息流水號
/// 訊息優先權
/// 車輛清單回應
public static SetAmrListAckDto Get(string protocolVersion, string sequence, string priority)
{
return new SetAmrListAckDto()
{
ProtocolVersion = protocolVersion,
Sequence = sequence,
Timestamp = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"),
Priority = priority,
Ack = "OK"
};
}
}
}