using System.ComponentModel.DataAnnotations; using Dlhis.Entity.Device.Enums; using Kurisu.AspNetCore.DataAccess.Dto; using Kurisu.AspNetCore.Utils.Extensions; namespace Dlhis.Middle.Request; public class DeviceTaskGetRequest : PageDto, IValidatableObject { /// /// 品牌 /// public string Brand { get; set; } /// /// 设备号 /// public string DeviceUniqueNo { get; set; } /// /// 任务类型 /// public List Types { get; set; } /// /// 获取处理中的任务 /// public bool IsProcess { get; set; } = false; /// /// 厂区 /// public string Factory { get; set; } public IEnumerable Validate(ValidationContext validationContext) { if (Brand.IsEmpty() && DeviceUniqueNo.IsEmpty() && Factory.IsEmpty()) { yield return new ValidationResult("设备品牌,设备号和厂区不能都为空", new[] { nameof(Brand), nameof(DeviceUniqueNo), nameof(Factory) }); } } }