Initial commit

This commit is contained in:
2026-07-13 09:25:40 +07:00
parent c08ff54676
commit bccfb156d7
1938 changed files with 641646 additions and 0 deletions

View File

@@ -0,0 +1,13 @@
namespace RobotNet10.FleetManager.Shared.DTOs.Responses;
/// <summary>
/// Error response DTO for API error responses
/// </summary>
public class ErrorResponseDto
{
public string Error { get; set; } = string.Empty;
public string? ErrorCode { get; set; }
public Dictionary<string, object>? Details { get; set; }
}

View File

@@ -0,0 +1,22 @@
using System.ComponentModel.DataAnnotations;
namespace RobotNet10.FleetManager.Shared.DTOs.Robot;
/// <summary>
/// Request to create a new robot
/// </summary>
public class CreateRobotRequest
{
[Required(ErrorMessage = "RobotId is required")]
[StringLength(64, ErrorMessage = "RobotId must not exceed 64 characters")]
public string RobotId { get; set; } = string.Empty;
[Required(ErrorMessage = "Name is required")]
[StringLength(256, ErrorMessage = "Name must not exceed 256 characters")]
public string Name { get; set; } = string.Empty;
[Required(ErrorMessage = "ModelId is required")]
public Guid ModelId { get; set; }
public Guid? MapId { get; set; }
}

View File

@@ -0,0 +1,28 @@
namespace RobotNet10.FleetManager.Shared.DTOs.Robot;
/// <summary>
/// Robot data transfer object
/// </summary>
public class RobotDto
{
public Guid Id { get; set; }
public string RobotId { get; set; } = string.Empty;
public string Name { get; set; } = string.Empty;
public Guid ModelId { get; set; }
/// <summary>
/// Robot model name (from navigation property)
/// </summary>
public string? ModelName { get; set; }
public Guid? MapId { get; set; }
public string? MapName { get; set; }
public DateTime CreatedDate { get; set; }
public DateTime? UpdatedDate { get; set; }
}

View File

@@ -0,0 +1,37 @@
using RobotNet.VDA5050.State;
using RobotNet.VDA5050.Visualization;
namespace RobotNet10.FleetManager.Shared.DTOs.Robot;
public class RobotMonitorBoardcastData
{
public string RobotId { get; set; } = string.Empty;
public Load[] Loads { get; set; } = [];
public BatteryState Battery { get; set; } = new();
public Error[] Errors { get; set; } = [];
public Information[] Infomations { get; set; } = [];
public AgvPosition AgvPosition { get; set; } = new();
public Velocity AgvVelocity { get; set; } = new();
public NavigationPath Path { get; set; } = new();
public DateTime LastUpdateTime { get; set; }
}
public class NavigationPath
{
public string NavigationState { get; set; } = string.Empty;
public NavigationPathEdge[] RobotPath { get; set; } = [];
public NavigationPathEdge[] RobotBasePath { get; set; } = [];
}
public class NavigationPathEdge()
{
public double StartX { get; set; }
public double StartY { get; set; }
public double EndX { get; set; }
public double EndY { get; set; }
public double ControlPoint1X { get; set; }
public double ControlPoint1Y { get; set; }
public double ControlPoint2X { get; set; }
public double ControlPoint2Y { get; set; }
public int Degree { get; set; }
}

View File

@@ -0,0 +1,19 @@
using System.ComponentModel.DataAnnotations;
namespace RobotNet10.FleetManager.Shared.DTOs.Robot;
/// <summary>
/// Request to update an existing robot
/// </summary>
public class UpdateRobotRequest
{
[StringLength(64, ErrorMessage = "RobotId must not exceed 64 characters")]
public string? RobotId { get; set; }
[StringLength(256, ErrorMessage = "Name must not exceed 256 characters")]
public string? Name { get; set; }
public Guid? ModelId { get; set; }
public Guid? MapId { get; set; }
}

View File

@@ -0,0 +1,45 @@
using System.ComponentModel.DataAnnotations;
using RobotNet10.FleetManager.Shared.Enums;
namespace RobotNet10.FleetManager.Shared.DTOs.RobotModel;
/// <summary>
/// Request to create a new robot model
/// </summary>
public class CreateRobotModelRequest
{
[Required(ErrorMessage = "ModelName is required")]
[StringLength(256, ErrorMessage = "ModelName must not exceed 256 characters")]
public string ModelName { get; set; } = string.Empty;
[Required(ErrorMessage = "Length is required")]
[Range(0.01, 1000, ErrorMessage = "Length must be between 0.01 and 1000 meters")]
public double Length { get; set; }
[Required(ErrorMessage = "Width is required")]
[Range(0.01, 1000, ErrorMessage = "Width must be between 0.01 and 1000 meters")]
public double Width { get; set; }
[Required(ErrorMessage = "ImageWidth is required")]
[Range(1, 10000, ErrorMessage = "ImageWidth must be between 1 and 10000 pixels")]
public int ImageWidth { get; set; }
[Required(ErrorMessage = "ImageHeight is required")]
[Range(1, 10000, ErrorMessage = "ImageHeight must be between 1 and 10000 pixels")]
public int ImageHeight { get; set; }
[Required(ErrorMessage = "NavigationPointX is required")]
public double NavigationPointX { get; set; }
[Required(ErrorMessage = "NavigationPointY is required")]
public double NavigationPointY { get; set; }
[Required(ErrorMessage = "NavigationType is required")]
public NavigationType NavigationType { get; set; }
/// <summary>
/// Foreign key to VehicleType (in MapManager database)
/// Optional - can be set later
/// </summary>
public Guid? VehicleTypeId { get; set; }
}

View File

@@ -0,0 +1,80 @@
namespace RobotNet10.FleetManager.Shared.DTOs.RobotModel;
/// <summary>
/// Map validation result for robot model
/// </summary>
public class MapValidationResultDto
{
/// <summary>
/// Whether the map data is valid after filtering and validation
/// </summary>
public bool IsValid { get; set; }
/// <summary>
/// List of validation errors
/// </summary>
public List<ValidationError> Errors { get; set; } = [];
/// <summary>
/// List of validation warnings
/// </summary>
public List<ValidationWarning> Warnings { get; set; } = [];
/// <summary>
/// Number of nodes removed during validation
/// </summary>
public int NodesRemoved { get; set; }
/// <summary>
/// Number of edges removed during validation
/// </summary>
public int EdgesRemoved { get; set; }
}
/// <summary>
/// Validation error information
/// </summary>
public class ValidationError
{
/// <summary>
/// Error code (e.g., "NODE_NO_EDGES", "EDGE_MISSING_START_NODE")
/// </summary>
public string Code { get; set; } = string.Empty;
/// <summary>
/// Human-readable error message
/// </summary>
public string Message { get; set; } = string.Empty;
/// <summary>
/// Entity ID that caused the error (NodeId or EdgeId)
/// </summary>
public string? EntityId { get; set; }
/// <summary>
/// Entity type ("Node" or "Edge")
/// </summary>
public string? EntityType { get; set; }
}
/// <summary>
/// Validation warning information
/// </summary>
public class ValidationWarning
{
/// <summary>
/// Warning code
/// </summary>
public string Code { get; set; } = string.Empty;
/// <summary>
/// Human-readable warning message
/// </summary>
public string Message { get; set; } = string.Empty;
/// <summary>
/// Entity ID related to the warning
/// </summary>
public string? EntityId { get; set; }
}

View File

@@ -0,0 +1,42 @@
using RobotNet10.FleetManager.Shared.Enums;
namespace RobotNet10.FleetManager.Shared.DTOs.RobotModel;
/// <summary>
/// Robot model data transfer object
/// </summary>
public class RobotModelDto
{
public Guid Id { get; set; }
public string ModelName { get; set; } = string.Empty;
public double Length { get; set; }
public double Width { get; set; }
public int ImageWidth { get; set; }
public int ImageHeight { get; set; }
public double NavigationPointX { get; set; }
public double NavigationPointY { get; set; }
public NavigationType NavigationType { get; set; }
/// <summary>
/// Foreign key to VehicleType (in MapManager database)
/// Links RobotModel to VehicleType for map filtering
/// </summary>
public Guid? VehicleTypeId { get; set; }
public DateTime CreatedDate { get; set; }
public DateTime? UpdatedDate { get; set; }
/// <summary>
/// Number of robots using this model
/// </summary>
public int RobotCount { get; set; }
}

View File

@@ -0,0 +1,87 @@
using RobotNet10.MapEditor.Shared.DTOs.Edge;
using RobotNet10.MapEditor.Shared.DTOs.Node;
namespace RobotNet10.FleetManager.Shared.DTOs.RobotModel;
/// <summary>
/// Validated map data for a robot model
/// Contains filtered and validated nodes/edges based on VehicleType properties
/// </summary>
public class RobotModelMapDataDto
{
/// <summary>
/// Robot model ID
/// </summary>
public Guid RobotModelId { get; set; }
/// <summary>
/// Robot model name
/// </summary>
public string RobotModelName { get; set; } = string.Empty;
/// <summary>
/// Vehicle type ID (from MapManager)
/// </summary>
public Guid? VehicleTypeId { get; set; }
/// <summary>
/// Vehicle type name (for display)
/// </summary>
public string? VehicleTypeName { get; set; }
/// <summary>
/// Layout level ID (MapId from RobotModel)
/// </summary>
public Guid? LevelId { get; set; }
/// <summary>
/// Layout level identifier (for display)
/// </summary>
public string? LevelName { get; set; }
/// <summary>
/// Valid nodes after filtering and validation
/// </summary>
public List<NodeDto> ValidNodes { get; set; } = [];
/// <summary>
/// Valid edges after filtering and validation
/// </summary>
public List<EdgeDto> ValidEdges { get; set; } = [];
/// <summary>
/// Total number of nodes in the level (before filtering)
/// </summary>
public int TotalNodesInLevel { get; set; }
/// <summary>
/// Total number of edges in the level (before filtering)
/// </summary>
public int TotalEdgesInLevel { get; set; }
/// <summary>
/// Number of nodes after filtering by VehicleType (before validation)
/// </summary>
public int FilteredNodesCount { get; set; }
/// <summary>
/// Number of edges after filtering by VehicleType (before validation)
/// </summary>
public int FilteredEdgesCount { get; set; }
/// <summary>
/// Number of valid nodes after validation
/// </summary>
public int ValidNodesCount => ValidNodes.Count;
/// <summary>
/// Number of valid edges after validation
/// </summary>
public int ValidEdgesCount => ValidEdges.Count;
/// <summary>
/// Validation result with errors and warnings
/// </summary>
public MapValidationResultDto ValidationResult { get; set; } = new();
}

View File

@@ -0,0 +1,18 @@
namespace RobotNet10.FleetManager.Shared.DTOs.RobotModel;
/// <summary>
/// Robot model usage information DTO
/// </summary>
public class RobotModelUsageInfoDto
{
public Guid Id { get; set; }
public string ModelName { get; set; } = string.Empty;
public int RobotCount { get; set; }
/// <summary>
/// Indicates whether this model can be deleted (no robots using it)
/// </summary>
public bool CanDelete => RobotCount == 0;
}

View File

@@ -0,0 +1,37 @@
using System.ComponentModel.DataAnnotations;
using RobotNet10.FleetManager.Shared.Enums;
namespace RobotNet10.FleetManager.Shared.DTOs.RobotModel;
/// <summary>
/// Request to update an existing robot model
/// </summary>
public class UpdateRobotModelRequest
{
[StringLength(256, ErrorMessage = "ModelName must not exceed 256 characters")]
public string? ModelName { get; set; }
[Range(0.01, 1000, ErrorMessage = "Length must be between 0.01 and 1000 meters")]
public double? Length { get; set; }
[Range(0.01, 1000, ErrorMessage = "Width must be between 0.01 and 1000 meters")]
public double? Width { get; set; }
[Range(1, 10000, ErrorMessage = "ImageWidth must be between 1 and 10000 pixels")]
public int? ImageWidth { get; set; }
[Range(1, 10000, ErrorMessage = "ImageHeight must be between 1 and 10000 pixels")]
public int? ImageHeight { get; set; }
public double? NavigationPointX { get; set; }
public double? NavigationPointY { get; set; }
public NavigationType? NavigationType { get; set; }
/// <summary>
/// Foreign key to VehicleType (in MapManager database)
/// Optional - can be set or cleared
/// </summary>
public Guid? VehicleTypeId { get; set; }
}