42 lines
1.4 KiB
C#
42 lines
1.4 KiB
C#
using System.ComponentModel.DataAnnotations;
|
|
using System.Text.Json.Serialization;
|
|
|
|
namespace RobotNet.RobotManager.Services.OpenACS;
|
|
|
|
public class TrafficACSRequestBody(string agvId, string trafficZoneId, string inOut)
|
|
{
|
|
[JsonPropertyName("agv_id")]
|
|
[Required]
|
|
public string AgvId { get; set; } = agvId;
|
|
|
|
[JsonPropertyName("traffic_zone_id")]
|
|
[Required]
|
|
public string TrafficZoneId { get; set; } = trafficZoneId;
|
|
|
|
[JsonPropertyName("inout")]
|
|
[Required]
|
|
public string InOut { get; set; } = inOut;
|
|
}
|
|
|
|
public class TrafficACSRequestV2
|
|
{
|
|
[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 TrafficACSRequestV2(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);
|
|
}
|
|
} |