fix 任务获取支持根据厂区

This commit is contained in:
2024-06-07 18:05:29 +08:00
parent 9d1d069450
commit a3f4950df2
2 changed files with 9 additions and 3 deletions

View File

@@ -27,11 +27,16 @@ public class DeviceTaskGetRequest : PageDto, IValidatableObject
/// </summary>
public bool IsProcess { get; set; } = false;
/// <summary>
/// 厂区
/// </summary>
public string Factory { get; set; }
public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
{
if (Brand.IsEmpty() && DeviceUniqueNo.IsEmpty())
if (Brand.IsEmpty() && DeviceUniqueNo.IsEmpty() && Factory.IsEmpty())
{
yield return new ValidationResult("设备品牌和设备唯一号不能都为空", new[] { nameof(Brand), nameof(DeviceUniqueNo) });
yield return new ValidationResult("设备品牌,设备号和厂区不能都为空", new[] { nameof(Brand), nameof(DeviceUniqueNo), nameof(Factory) });
}
}
}
}