using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Text.Json.Serialization;
namespace Mirle.Component.API.AutomatedGuideVehicleController.Models
{
///
/// Class for set mission request
///
public class SetMissionRequestDto : CommonMessage
{
///
/// Constructure
///
public SetMissionRequestDto()
{
SubMissions = new List();
}
///
/// Sub mission list
///
[Required, JsonPropertyName("sub_missions"), JsonPropertyOrder(101)]
public List SubMissions { get; set; }
///
/// Get set mission request data object
///
/// Auotmated guide vehicle controller protocol version
/// Message sequnce number
/// Message priority
/// Sub mission list
/// Set mission request data object
public static SetMissionRequestDto Get(string protocolVersion, string sequence, string priority, List subMission)
{
return new SetMissionRequestDto
{
ProtocolVersion = protocolVersion,
Sequence = sequence,
Timestamp = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"),
Priority = priority,
SubMissions = subMission
};
}
}
///
/// Class for sub mission
///
public class SubMission
{
///
/// Space is meaning port or station
///
[Required, StringLength(9), JsonPropertyName("space"), JsonPropertyOrder(1)]
public string Space { get; set; }
///
/// Current equipment completed executd action or will be execute action
///
///
/// load
/// unload
/// idle
/// ask-open-gate
/// read-code
/// ack-close-gate
///
[Required, StringLength(20), JsonPropertyName("action"), JsonPropertyOrder(2)]
public string Action { get; set; }
}
///
/// Get set mission reply data object
///
public class SetMissionReplyDto : CommonMessage
{
///
/// Code of reply
///
///
/// ACK
/// NG
///
[Required, StringLength(3), JsonPropertyName("reply"), JsonPropertyOrder(101)]
public string Reply { get; set; }
///
/// Failed reason when reply is NG
///
[StringLength(255), JsonPropertyName("reason"), JsonPropertyOrder(102)]
public string Reason { get; set; }
///
/// Get set mission reply data object
///
/// Automated guide vehicle controller protocol version
/// Message sequnce number
/// Message priority
/// Process result
/// Failed reason
/// Set mission reply data object
/// reply : true = ACK, false = NG
public static SetMissionReplyDto Get(string protocolVersion, string sequence, string priority, bool reply, string reason = "NA")
{
return new SetMissionReplyDto()
{
ProtocolVersion = protocolVersion,
Sequence = sequence,
Timestamp = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"),
Priority = priority,
Reply = reply ? "ACK" : "NG",
Reason = reason
};
}
}
///
/// Class for set mission result
///
public class SetMissionResultDto : CommonMessage
{
///
/// AMR identify number of executing task/mission
///
[Required, StringLength(10), JsonPropertyName("amr"), JsonPropertyOrder(101)]
public string AMR { get; set; }
///
/// Space is meaning port/station
///
[Required, StringLength(9), JsonPropertyName("space"), JsonPropertyOrder(102)]
public string Space { get; set; }
///
/// Current equipment completed executd action or will be execute action
///
///
/// load
/// unload
/// idle
/// ask-open-gate
/// read-code
/// ack-close-gate
///
[Required, StringLength(20), JsonPropertyName("action"), JsonPropertyOrder(103)]
public string Action { get; set; }
///
/// Permit equipment execute action or recevie equipment executed action
///
///
/// OK
/// NG
/// Cancel-by-user
/// OK-by-user
///
[Required, StringLength(14), JsonPropertyName("result"), JsonPropertyOrder(104)]
public string Result { get; set; }
///
/// Failed reason when result is NG/Cancel-by-user
///
[StringLength(255), JsonPropertyName("reason"), JsonPropertyOrder(105)]
public string Reason { get; set; }
}
///
/// Class for set mission ack
///
public class SetMissionAckDto : CommonMessage
{
///
/// Ack of message
///
///
/// OK
/// NG
///
[Required, StringLength(2), JsonPropertyName("ack"), JsonPropertyOrder(101)]
public string Ack { get; set; }
///
/// Get set mission ack data object
///
/// Automated guide vehicle ccontroller protocol version
/// Message sequnce number
/// Message priority
/// Process result
/// Set mission ack data object
/// ack : true = OK, false = NG
public static SetMissionAckDto Get(string protocolVersion, string sequence, string priority, bool ack)
{
return new SetMissionAckDto()
{
ProtocolVersion = protocolVersion,
Sequence = sequence,
Timestamp = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"),
Priority = priority,
Ack = ack ? "OK" : "NG"
};
}
}
}