using System; using System.ComponentModel.DataAnnotations; using System.Text.Json.Serialization; namespace Mirle.Component.API.AutomatedGuideVehicleController.Models { /// /// Class fro set mission status request /// public class SetMissionStatusRequestDto : CommonMessage { /// /// Mission sequence of task /// [Required, StringLength(6), JsonPropertyName("mission_sequence"), JsonPropertyOrder(101)] public string MissionSequence { get; set; } /// /// task command /// /// /// pause
/// resume
/// cancel
///
[Required, StringLength(6), JsonPropertyName("command"), JsonPropertyOrder(102)] public string Command { get; set; } /// /// Get set misssion status request data object /// /// Automated guide vehicle controller protocol version /// Message sequence number /// Mission sequence of task /// Set mission status request data object public static SetMissionStatusRequestDto Get(string protocolVersion, string sequence, string missionSequence) { return new SetMissionStatusRequestDto() { ProtocolVersion = protocolVersion, Sequence = sequence, Timestamp = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"), Priority = "1", MissionSequence = missionSequence, Command = "cancel" }; } } /// /// Class for set mission status reply /// public class SetMissionStatusReplyDto : CommonMessage { /// /// Reply of result /// /// /// ACK
/// NG
///
[Required, StringLength(3), JsonPropertyName("reply"), JsonPropertyOrder(101)] public string Reply { get; set; } /// /// Mission sequnce of task /// [Required, StringLength(6), JsonPropertyName("mission_sequence"), JsonPropertyOrder(102)] public string MissionSequence { get; set; } /// /// Failed reason when reply is NG /// [StringLength(255), JsonPropertyName("reason"), JsonPropertyOrder(103)] public string Reason { get; set; } /// /// Get set mission status reply data object /// /// Automated guide vehicle controller protocol version /// Message sequnce number /// Message priority /// Mission sequnce of task /// Reply of result /// 失敗原因 /// Set mission status reply data object /// reply : true = ACK, false = NG public static SetMissionStatusReplyDto Get(string protocolVersion, string sequence, string priority, string missionSequnce, bool reply, string reason = "NA") { return new SetMissionStatusReplyDto() { ProtocolVersion = protocolVersion, Sequence = sequence, Timestamp = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"), Priority = priority, Reply = reply ? "ACK" : "NG", MissionSequence = missionSequnce, Reason = reason }; } } /// /// Class for set mission status result /// public class SetMissionStatusResultDto : CommonMessage { /// /// Mission sequnce of task /// [Required, StringLength(6), JsonPropertyName("mission_sequence"), JsonPropertyOrder(101)] public string MissionSequence { get; set; } /// /// Task command /// /// /// pause
/// resume
/// cancel
///
[Required, StringLength(6), JsonPropertyName("command"), JsonPropertyOrder(102)] public string Command { get; set; } /// /// Action result /// /// /// OK
/// NG
///
[Required, StringLength(2), JsonPropertyName("result"), JsonPropertyOrder(103)] public string Result { get; set; } /// /// 失敗理由 /// [StringLength(255), JsonPropertyName("reason"), JsonPropertyOrder(104)] public string Reason { get; set; } } /// /// 控制任務回應類別 /// public class SetMissionStatusAckDto : CommonMessage { /// /// 回應 /// /// /// OK /// [Required, StringLength(2), JsonPropertyName("ack"), JsonPropertyOrder(101)] public string Ack { get; set; } /// /// 取得控制任務回應 /// /// 通訊協議版本 /// 訊息流水號 /// 訊息優先權 /// 控制任務回應 public static SetMissionStatusAckDto Get(string protocolVersion, string sequnce, string priority) { return new SetMissionStatusAckDto() { ProtocolVersion = protocolVersion, Sequence = sequnce, Timestamp = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"), Priority = priority, Ack = "OK" }; } } }