You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
178 lines
5.1 KiB
178 lines
5.1 KiB
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel.DataAnnotations;
|
|
using System.Linq;
|
|
using System.Web;
|
|
|
|
namespace WebApplication1.Models
|
|
{
|
|
public class ParamModels
|
|
{
|
|
|
|
}
|
|
|
|
public class MoInsertModel
|
|
{
|
|
|
|
/// <summary>
|
|
/// 工单号
|
|
/// </summary>
|
|
[Required(AllowEmptyStrings = false)]
|
|
public string Mocode { get; set; }
|
|
/// <summary>
|
|
/// 行号
|
|
/// </summary>
|
|
[Required(AllowEmptyStrings = false)]
|
|
public int MOSEQ { get; set; }
|
|
/// <summary>
|
|
/// 工单数量
|
|
/// </summary>
|
|
[Required(AllowEmptyStrings = false)]
|
|
public decimal MOPLANQTY { get; set; }
|
|
/// <summary>
|
|
/// 计划开始日期
|
|
/// </summary>
|
|
[Required(AllowEmptyStrings = false)]
|
|
public DateTime MOPLANSTARTDATE { get; set; }
|
|
/// <summary>
|
|
/// 计划结束日期
|
|
/// </summary>
|
|
[Required(AllowEmptyStrings = false)]
|
|
public DateTime MOPLANENDDATE { get; set; }
|
|
/// <summary>
|
|
/// 工单下发时间
|
|
/// </summary>
|
|
[Required(AllowEmptyStrings = false)]
|
|
public DateTime MODOWNDATE { get; set; }
|
|
/// <summary>
|
|
/// 产品编码
|
|
/// </summary>
|
|
[Required(AllowEmptyStrings = false)]
|
|
public string ITEMCODE { get; set; }
|
|
/// <summary>
|
|
/// ERP工单是否关闭
|
|
/// </summary>
|
|
[Required(AllowEmptyStrings = true)]
|
|
public string MOBIOSVER { get; set; }
|
|
/// <summary>
|
|
/// 制单人
|
|
/// </summary>
|
|
[Required(AllowEmptyStrings = true)]
|
|
public string CreateUser { get; set; }
|
|
/// <summary>
|
|
/// 制单时间
|
|
/// </summary>
|
|
[Required(AllowEmptyStrings = true)]
|
|
public DateTime CreateTime { get; set; }
|
|
/// <summary>
|
|
/// 部门名称
|
|
/// </summary>
|
|
[Required(AllowEmptyStrings = true)]
|
|
public string MDeptName { get; set; }
|
|
/// <summary>
|
|
/// 修改时间
|
|
/// </summary>
|
|
[Required(AllowEmptyStrings = false)]
|
|
public DateTime MTIME { get; set; }
|
|
}
|
|
|
|
|
|
public class MoModifityModel
|
|
{
|
|
|
|
/// <summary>
|
|
/// 工单号
|
|
/// </summary>
|
|
[Required(AllowEmptyStrings = false)]
|
|
public string Mocode { get; set; }
|
|
/// <summary>
|
|
/// 行号
|
|
/// </summary>
|
|
[Required(AllowEmptyStrings = false)]
|
|
public int MOSEQ { get; set; }
|
|
/// <summary>
|
|
/// 工单数量
|
|
/// </summary>
|
|
[Required(AllowEmptyStrings = true)]
|
|
public decimal MOPLANQTY { get; set; }
|
|
/// <summary>
|
|
/// 计划开始日期
|
|
/// </summary>
|
|
[Required(AllowEmptyStrings = true)]
|
|
public DateTime MOPLANSTARTDATE { get; set; }
|
|
/// <summary>
|
|
/// 计划结束日期
|
|
/// </summary>
|
|
[Required(AllowEmptyStrings = true)]
|
|
public DateTime MOPLANENDDATE { get; set; }
|
|
/// <summary>
|
|
/// 工单下发时间
|
|
/// </summary>
|
|
[Required(AllowEmptyStrings = true)]
|
|
public DateTime MODOWNDATE { get; set; }
|
|
/// <summary>
|
|
/// 产品编码
|
|
/// </summary>
|
|
[Required(AllowEmptyStrings = true)]
|
|
public string ITEMCODE { get; set; }
|
|
/// <summary>
|
|
/// ERP工单是否关闭
|
|
/// </summary>
|
|
[Required(AllowEmptyStrings = true)]
|
|
public string MOBIOSVER { get; set; }
|
|
/// <summary>
|
|
/// 制单人
|
|
/// </summary>
|
|
[Required(AllowEmptyStrings = true)]
|
|
public string CreateUser { get; set; }
|
|
/// <summary>
|
|
/// 制单时间
|
|
/// </summary>
|
|
[Required(AllowEmptyStrings = true)]
|
|
public DateTime CreateTime { get; set; }
|
|
/// <summary>
|
|
/// 部门名称
|
|
/// </summary>
|
|
[Required(AllowEmptyStrings = true)]
|
|
public string MDeptName { get; set; }
|
|
|
|
[Required(AllowEmptyStrings = true)]
|
|
public DateTime MTIME { get; set; }
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public static class ParamsValidateHelper
|
|
{
|
|
public static void CheckNull<T>(T param)
|
|
{
|
|
var typeParm = typeof(T);
|
|
foreach (var pro in typeParm.GetProperties())
|
|
{
|
|
if (pro.PropertyType.IsClass) //类
|
|
{
|
|
var instance = pro.GetValue(param);
|
|
CheckNull(instance);
|
|
}
|
|
else if (pro.PropertyType.IsValueType) //值
|
|
{
|
|
var proValue = pro.GetValue(param, null);
|
|
var attrs = pro.GetCustomAttributes(typeof(RequiredAttribute), false);
|
|
|
|
foreach (var attr in attrs)
|
|
{
|
|
if (attr is RequiredAttribute && string.IsNullOrEmpty(pro.GetValue(param).ToString()) && ((RequiredAttribute)attr).AllowEmptyStrings == false)
|
|
throw new Exception($"NullOrEmptyParam:{pro.Name}");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
}
|