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.
69 lines
1.7 KiB
69 lines
1.7 KiB
using FluentValidation;
|
|
using Kean.Domain.Task.Models;
|
|
using System;
|
|
|
|
namespace Kean.Domain.Task.Commands
|
|
{
|
|
/// <summary>
|
|
/// 创建避让命令
|
|
/// </summary>
|
|
public class AvertCommand : CommandValidator<AvertCommand>, ICommand
|
|
{
|
|
/// <summary>
|
|
/// 特征码
|
|
/// </summary>
|
|
internal const string Feature = "@Avert";
|
|
|
|
/// <summary>
|
|
/// 送入行为
|
|
/// (避让位置作为终点)
|
|
/// </summary>
|
|
public const string Entering = nameof(Entering);
|
|
|
|
/// <summary>
|
|
/// 取出行为
|
|
/// (避让位置作为起点)
|
|
/// </summary>
|
|
public const string Leaving = nameof(Leaving);
|
|
|
|
/// <summary>
|
|
/// 避让位置
|
|
/// </summary>
|
|
public Cell Cell { get; set; }
|
|
|
|
/// <summary>
|
|
/// 避让行为
|
|
/// </summary>
|
|
public string Behavior { get; set; }
|
|
|
|
/// <summary>
|
|
/// 优先级
|
|
/// </summary>
|
|
public int? Priority { get; set; }
|
|
|
|
/// <summary>
|
|
/// 前续连接
|
|
/// </summary>
|
|
public int? Previous { get; set; }
|
|
|
|
/// <summary>
|
|
/// 时间戳
|
|
/// </summary>
|
|
internal DateTime? Timestamp { get; set; }
|
|
|
|
/// <summary>
|
|
/// 验证项
|
|
/// </summary>
|
|
protected override void Validation()
|
|
{
|
|
RuleFor(r => r.Cell).NotEmpty().WithMessage("位置不允许空");
|
|
RuleFor(r => r.Behavior).NotEmpty().WithMessage("行为不允许空");
|
|
}
|
|
|
|
/// <summary>
|
|
/// 标识
|
|
/// </summary>
|
|
[Output]
|
|
public int? Id { get; private set; }
|
|
}
|
|
}
|