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