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.
130 lines
4.5 KiB
130 lines
4.5 KiB
using System;
|
|
using System.ComponentModel.DataAnnotations;
|
|
using System.Text.Json.Serialization;
|
|
|
|
namespace Mirle.Component.API.AutomatedGuideVehicleController.Models
|
|
{
|
|
/// <summary>
|
|
/// 車輛清單請求類別
|
|
/// </summary>
|
|
public class SetAmrListRequestDto : CommonMessage
|
|
{
|
|
/// <summary>
|
|
/// 區域
|
|
/// </summary>
|
|
/// <value>
|
|
/// all
|
|
/// </value>
|
|
[Required, StringLength(3), JsonPropertyName("zone"), JsonPropertyOrder(101)]
|
|
public string Zone { get; set; }
|
|
/// <summary>
|
|
/// 取得車輛清單請求
|
|
/// </summary>
|
|
/// <param name="protocolVersion">通訊協議版本</param>
|
|
/// <param name="sequence">訊息流水號</param>
|
|
/// <param name="priority">訊息優先權</param>
|
|
/// <returns>車輛清單請求</returns>
|
|
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"
|
|
};
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// 車輛清單回應類別
|
|
/// </summary>
|
|
public class SetAmrListReplyDto : CommonMessage
|
|
{
|
|
/// <summary>
|
|
/// 指令確認結果
|
|
/// </summary>
|
|
/// <value>
|
|
/// ACK <br/>
|
|
/// NG <br/>
|
|
/// </value>
|
|
[Required, StringLength(3), JsonPropertyName("reply"), JsonPropertyOrder(101)]
|
|
public string Reply { get; set; }
|
|
/// <summary>
|
|
/// 失敗理由
|
|
/// </summary>
|
|
[StringLength(255), JsonPropertyName("reason"), JsonPropertyOrder(102)]
|
|
public string Reason { get; set; }
|
|
/// <summary>
|
|
/// 取得車輛清單回應
|
|
/// </summary>
|
|
/// <param name="protocolVersion">通訊協議版本</param>
|
|
/// <param name="sequence">訊息流水號</param>
|
|
/// <param name="priority">訊息優先權</param>
|
|
/// <param name="reply">回應結果</param>
|
|
/// <param name="reason">失敗原因</param>
|
|
/// <returns>車輛清單回應</returns>
|
|
/// <remarks>reply : true = ACK, false = NG</remarks>
|
|
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
|
|
};
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// 車輛清單回報類別
|
|
/// </summary>
|
|
public class SetAmrListResultDto : CommonMessage
|
|
{
|
|
/// <summary>
|
|
/// 車輛總數
|
|
/// </summary>
|
|
[Required, JsonPropertyName("count"), JsonPropertyOrder(101)]
|
|
public string Count { get; set; }
|
|
/// <summary>
|
|
/// 車輛名稱列表
|
|
/// </summary>
|
|
/// <remarks>逗號分隔</remarks>
|
|
[JsonPropertyName("amrs"), JsonPropertyOrder(102)]
|
|
public string Amrs { get; set; }
|
|
}
|
|
/// <summary>
|
|
/// 車輛清單回應類別
|
|
/// </summary>
|
|
public class SetAmrListAckDto : CommonMessage
|
|
{
|
|
/// <summary>
|
|
/// 回應
|
|
/// </summary>
|
|
/// <value>
|
|
/// OK <br/>
|
|
/// </value>
|
|
[Required, StringLength(2), JsonPropertyName("ack"), JsonPropertyOrder(101)]
|
|
public string Ack { get; set; }
|
|
/// <summary>
|
|
/// 取得車輛清單回應
|
|
/// </summary>
|
|
/// <param name="protocolVersion">通訊協議版本</param>
|
|
/// <param name="sequence">訊息流水號</param>
|
|
/// <param name="priority">訊息優先權</param>
|
|
/// <returns>車輛清單回應</returns>
|
|
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"
|
|
};
|
|
}
|
|
}
|
|
}
|