fix 调整时段码结构
This commit is contained in:
@@ -1,22 +1,23 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using Dlhis.Entity.Device.Enums;
|
||||
using Dlhis.Entity.Device.Models;
|
||||
|
||||
namespace Dlhis.Basic.Device.Request;
|
||||
|
||||
public class DeviceTimePeriodSaveRequest : IValidatableObject
|
||||
public class DeviceTimePeriodSaveRequest
|
||||
{
|
||||
public long? Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 卡类型 timeperiod
|
||||
/// </summary>
|
||||
[Range(2, 3)]
|
||||
[Range(2, 3, ErrorMessage = "卡类型有误")]
|
||||
public int CardType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 分配类型 DeviceTimePeriodAssignEnumType
|
||||
/// </summary>
|
||||
[EnumDataType(typeof(DeviceTimePeriodAssignEnumType))]
|
||||
[EnumDataType(typeof(DeviceTimePeriodAssignEnumType), ErrorMessage = "时段分配类型有误")]
|
||||
public DeviceTimePeriodAssignEnumType AssignType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
@@ -26,46 +27,9 @@ public class DeviceTimePeriodSaveRequest : IValidatableObject
|
||||
public Guid Value { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 上班开始
|
||||
/// 星期配置
|
||||
/// </summary>
|
||||
[Required]
|
||||
public TimeOnly OnStart { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 上班结束
|
||||
/// </summary>
|
||||
[Required]
|
||||
public TimeOnly OnEnd { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 下班开始
|
||||
/// </summary>
|
||||
[Required]
|
||||
public TimeOnly OffStart { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 下班结束
|
||||
/// </summary>
|
||||
[Required]
|
||||
public TimeOnly OffEnd { get; set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
|
||||
{
|
||||
if (OnStart >= OnEnd)
|
||||
{
|
||||
yield return new ValidationResult("上班时段范围有误", new[] { nameof(OnStart) });
|
||||
}
|
||||
|
||||
if (OffStart >= OffEnd)
|
||||
{
|
||||
yield return new ValidationResult("下班时段范围有误", new[] { nameof(OffStart) });
|
||||
}
|
||||
|
||||
|
||||
if (OnEnd >= OffStart)
|
||||
{
|
||||
yield return new ValidationResult("上下班时段范围有误", new[] { nameof(OnEnd) });
|
||||
}
|
||||
}
|
||||
[MinLength(7, ErrorMessage = "配置有误")]
|
||||
[MaxLength(7, ErrorMessage = "配置有误")]
|
||||
public List<DeviceWeekDayTimePeriod> Sections { get; set; }
|
||||
}
|
||||
Reference in New Issue
Block a user