Initial commit
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace RobotNet10.FleetManager.Services.OpenACS;
|
||||
|
||||
public class TrafficRequestType
|
||||
{
|
||||
public static string IN => "in";
|
||||
public static string OUT => "out";
|
||||
}
|
||||
|
||||
public class TrafficACSRequestBody(string agvId, string trafficZoneId, string inOut)
|
||||
{
|
||||
[JsonPropertyName("agvid")]
|
||||
[Required]
|
||||
public string AgvId { get; set; } = agvId;
|
||||
|
||||
[JsonPropertyName("area")]
|
||||
[Required]
|
||||
public string TrafficZoneId { get; set; } = trafficZoneId;
|
||||
|
||||
[JsonPropertyName("inout")]
|
||||
[Required]
|
||||
public string InOut { get; set; } = inOut;
|
||||
}
|
||||
|
||||
public class TrafficACSRequest
|
||||
{
|
||||
[JsonPropertyName("header")]
|
||||
[Required]
|
||||
public ACSHeader Header { get; set; } = new("TRAFFIC_REQ", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"));
|
||||
|
||||
[JsonPropertyName("body")]
|
||||
[Required]
|
||||
public TrafficACSRequestBody Body { get; set; }
|
||||
|
||||
public TrafficACSRequest(string agvId, string trafficZoneId, string inOut)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(agvId))
|
||||
throw new ArgumentException("AGV ID không thể rỗng.", nameof(agvId));
|
||||
if (string.IsNullOrWhiteSpace(trafficZoneId))
|
||||
throw new ArgumentException("Traffic Zone ID không thể rỗng.", nameof(trafficZoneId));
|
||||
if (string.IsNullOrWhiteSpace(inOut))
|
||||
throw new ArgumentException("In OUT không thể rỗng.", nameof(inOut));
|
||||
|
||||
Body = new(agvId, trafficZoneId, inOut);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user