98 lines
2.4 KiB
C#
98 lines
2.4 KiB
C#
using System.ComponentModel.DataAnnotations;
|
|
using Dlhis.External.Appointment.Dto;
|
|
using Kurisu.AspNetCore.Utils.Extensions;
|
|
|
|
namespace Dlhis.External.Appointment.Request;
|
|
|
|
public class AppointmentReceiveRequest : IValidatableObject
|
|
{
|
|
/// <summary>
|
|
/// 流水号
|
|
/// </summary>
|
|
[Required(ErrorMessage = "流水号必填")]
|
|
public string No { get; set; }
|
|
|
|
/// <summary>
|
|
/// 标题
|
|
/// </summary>
|
|
[Required(ErrorMessage = "标题必填")]
|
|
public string Title { get; set; }
|
|
|
|
/// <summary>
|
|
/// 对接人工号
|
|
/// </summary>
|
|
[Required(ErrorMessage = "对接人工号必填")]
|
|
public string Code { get; set; }
|
|
|
|
/// <summary>
|
|
/// 预约区域
|
|
/// </summary>
|
|
[Required(ErrorMessage = "申请预约区域必填")]
|
|
public string ApplyArea { get; set; }
|
|
|
|
/// <summary>
|
|
/// 来访人公司
|
|
/// </summary>
|
|
[Required(ErrorMessage = "来源公司不可为空")]
|
|
public string Company { get; set; }
|
|
|
|
/// <summary>
|
|
/// 申请时间
|
|
/// </summary>
|
|
public DateTime ApplyTime { get; set; }
|
|
|
|
/// <summary>
|
|
/// 预约厂区
|
|
/// </summary>
|
|
[Required(ErrorMessage = "厂区不可为空")]
|
|
public string Factory { get; set; }
|
|
|
|
/// <summary>
|
|
/// 申请事由
|
|
/// </summary>
|
|
[Required(ErrorMessage = "申请事由不能为空")]
|
|
public string Reason { get; set; }
|
|
|
|
/// <summary>
|
|
/// 访客开始
|
|
/// </summary>
|
|
public DateTime Start { get; set; }
|
|
|
|
/// <summary>
|
|
/// 访问结束
|
|
/// </summary>
|
|
public DateTime End { get; set; }
|
|
|
|
/// <summary>
|
|
/// 备注
|
|
/// </summary>
|
|
public string Remark { get; set; }
|
|
|
|
/// <summary>
|
|
/// 是否进入车间
|
|
/// </summary>
|
|
public bool IsEnterWorkplace { get; set; }
|
|
|
|
/// <summary>
|
|
/// 明细
|
|
/// </summary>
|
|
[MinLength(1, ErrorMessage = "明细必填")]
|
|
public List<AppointmentReceiveItemDto> Items { get; set; }
|
|
|
|
|
|
public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
|
|
{
|
|
if (IsEnterWorkplace)
|
|
{
|
|
if (Items.Any(x => x.ImageUrl.IsEmpty()))
|
|
{
|
|
yield return new ValidationResult("社保照片不可为空", new[] { "ImageUrl" });
|
|
}
|
|
}
|
|
|
|
if (Start >= End)
|
|
{
|
|
yield return new ValidationResult("来访时间不能大于等于离开时间", new[] { nameof(Start), nameof(End) });
|
|
}
|
|
}
|
|
} |