116 lines
3.0 KiB
C#
116 lines
3.0 KiB
C#
using System.ComponentModel.DataAnnotations;
|
|
using Kurisu.AspNetCore.Utils.Extensions;
|
|
|
|
namespace Dlhis.External.Appointment.Dto;
|
|
|
|
public class AppointmentReceiveItemDto : IValidatableObject
|
|
{
|
|
/// <summary>
|
|
/// 姓名
|
|
/// </summary>
|
|
[Required(ErrorMessage = "姓名必填")]
|
|
public string Name { get; set; }
|
|
|
|
/// <summary>
|
|
/// 手机号
|
|
/// </summary>
|
|
[StringLength(11, MinimumLength = 11)]
|
|
[Required]
|
|
public string Phone { get; set; }
|
|
|
|
/// <summary>
|
|
/// 证件类型
|
|
/// </summary>
|
|
[Required]
|
|
public string IdType { get; set; }
|
|
|
|
/// <summary>
|
|
/// 证件号/工号
|
|
/// </summary>
|
|
[Required(ErrorMessage = "证件号/工号")]
|
|
public string IdNo { get; set; }
|
|
|
|
/// <summary>
|
|
/// 车牌
|
|
/// </summary>
|
|
public string LicensePlate { get; set; }
|
|
|
|
/// <summary>
|
|
/// 备注
|
|
/// </summary>
|
|
public string Remark { get; set; }
|
|
|
|
/// <summary>
|
|
/// 社保照片
|
|
/// </summary>
|
|
public string ImageUrl { get; set; }
|
|
|
|
|
|
/// <summary>
|
|
/// 预约门岗区域
|
|
/// </summary>
|
|
[Required(ErrorMessage = "预约门岗区域不可为空")]
|
|
public string ApplyDoorArea { get; set; }
|
|
|
|
/// <summary>
|
|
/// 访客开始
|
|
/// </summary>
|
|
public DateTime DoorStart { get; set; }
|
|
|
|
/// <summary>
|
|
/// 访问结束
|
|
/// </summary>
|
|
public DateTime DoorEnd { get; set; }
|
|
|
|
/// <summary>
|
|
/// 是否进入车间
|
|
/// </summary>
|
|
public bool IsEnterWorkplace { get; set; }
|
|
|
|
/// <summary>
|
|
/// 申请车间区域
|
|
/// </summary>
|
|
public List<string> ApplyWorkplaceAreas { get; set; }
|
|
|
|
/// <summary>
|
|
/// 车间访问开始
|
|
/// </summary>
|
|
public DateTime? WorkplaceStart { get; set; }
|
|
|
|
/// <summary>
|
|
/// 车间访问结束
|
|
/// </summary>
|
|
public DateTime? WorkplaceEnd { get; set; }
|
|
|
|
/// <inheritdoc />
|
|
public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
|
|
{
|
|
if (DoorStart >= DoorEnd)
|
|
{
|
|
yield return new ValidationResult($"{Name}门禁来访时间有误", new[] { nameof(DoorStart) });
|
|
}
|
|
|
|
if (IsEnterWorkplace)
|
|
{
|
|
if (ApplyWorkplaceAreas.IsEmpty())
|
|
{
|
|
yield return new ValidationResult($"{Name}车间区域不可为空", new[] { nameof(ApplyWorkplaceAreas) });
|
|
}
|
|
|
|
if (WorkplaceStart >= WorkplaceEnd)
|
|
{
|
|
yield return new ValidationResult($"{Name}车间来访时间有误", new[] { nameof(WorkplaceStart) });
|
|
}
|
|
|
|
if (WorkplaceStart < DoorStart || WorkplaceStart > DoorEnd)
|
|
{
|
|
yield return new ValidationResult($"{Name}车间来访时间需在门禁时间范围内", new[] { nameof(WorkplaceStart) });
|
|
}
|
|
|
|
if (WorkplaceEnd < DoorStart || WorkplaceEnd > DoorEnd)
|
|
{
|
|
yield return new ValidationResult($"{Name}车间来访时间需在门禁时间范围内", new[] { nameof(WorkplaceStart) });
|
|
}
|
|
}
|
|
}
|
|
} |