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.
271 lines
7.4 KiB
271 lines
7.4 KiB
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel.DataAnnotations;
|
|
using System.Linq;
|
|
using System.Web;
|
|
|
|
namespace ICSSoft.Frame.Data.Entity
|
|
{
|
|
public class ParamModels
|
|
{
|
|
|
|
}
|
|
|
|
|
|
public class MoInsertModel
|
|
{
|
|
[Required(AllowEmptyStrings = false)]
|
|
public string Type { get; set; }
|
|
|
|
[Required(AllowEmptyStrings = false)]
|
|
public List<MoInsertData> datas { get; set; }
|
|
}
|
|
|
|
public class MoInsertData
|
|
{
|
|
|
|
/// <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 = false)]
|
|
public bool? MOBIOSVER { get; set; }
|
|
/// <summary>
|
|
/// 制单人
|
|
/// </summary>
|
|
[Required(AllowEmptyStrings = false)]
|
|
public string CreateUser { get; set; }
|
|
/// <summary>
|
|
/// 制单时间
|
|
/// </summary>
|
|
[Required(AllowEmptyStrings = false)]
|
|
public DateTime ?CreateTime { get; set; }
|
|
/// <summary>
|
|
/// 部门名称
|
|
/// </summary>
|
|
[Required(AllowEmptyStrings = false)]
|
|
public string MDeptName { get; set; }
|
|
|
|
/// <summary>
|
|
/// 部门编码
|
|
/// </summary>
|
|
[Required(AllowEmptyStrings = false)]
|
|
public string MDeptCode { get; set; }
|
|
|
|
/// <summary>
|
|
/// 修改时间
|
|
/// </summary>
|
|
[Required(AllowEmptyStrings = false)]
|
|
public DateTime ?MTIME { get; set; }
|
|
|
|
|
|
[Required(AllowEmptyStrings = true)]
|
|
public string ProjectCode { get; set; }
|
|
|
|
[Required(AllowEmptyStrings = true)]
|
|
public string ProjectSeq { get; set; }
|
|
|
|
/// <summary>
|
|
/// 成本中心
|
|
/// </summary>
|
|
[Required(AllowEmptyStrings = true)]
|
|
public string CostCenter { get; set; }
|
|
|
|
/// <summary>
|
|
/// 母工单
|
|
/// </summary>
|
|
[Required(AllowEmptyStrings = true)]
|
|
public string MotherMo{ get; set; }
|
|
|
|
/// <summary>
|
|
/// 上级工单
|
|
/// </summary>
|
|
[Required(AllowEmptyStrings = true)]
|
|
public string SuperiorMo { get; set; }
|
|
}
|
|
}
|
|
|
|
public class MoModifityModel
|
|
{
|
|
[Required(AllowEmptyStrings = false)]
|
|
public string Type { get; set; }
|
|
|
|
[Required(AllowEmptyStrings = false)]
|
|
public List<MoModifityData> datas { get; set; }
|
|
}
|
|
|
|
|
|
public class MoModifityData
|
|
{
|
|
|
|
/// <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 bool? 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 = true)]
|
|
public string MDeptCode { get; set; }
|
|
|
|
[Required(AllowEmptyStrings = true)]
|
|
public DateTime? MTIME { get; set; }
|
|
|
|
[Required(AllowEmptyStrings = true)]
|
|
public string ProjectCode { get; set; }
|
|
|
|
|
|
[Required(AllowEmptyStrings = true)]
|
|
public string ProjectSeq { get; set; }
|
|
|
|
[Required(AllowEmptyStrings = true)]
|
|
public string CostCenter { get; set; }
|
|
|
|
/// <summary>
|
|
/// 母工单
|
|
/// </summary>
|
|
[Required(AllowEmptyStrings = true)]
|
|
public string MotherMo { get; set; }
|
|
|
|
/// <summary>
|
|
/// 上级工单
|
|
/// </summary>
|
|
[Required(AllowEmptyStrings = true)]
|
|
public string SuperiorMo { get; set; }
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public static class ParamsValidateHelper
|
|
{
|
|
public static void CheckNull<T,D>(T param)
|
|
{
|
|
var typeParm = typeof(T);
|
|
foreach (var pro in typeParm.GetProperties())
|
|
{
|
|
if (!pro.PropertyType.IsValueType&&pro.PropertyType.Name.ToUpper()!="STRING") //类
|
|
{
|
|
var instance = pro.GetValue(param,null);
|
|
|
|
if (typeof(IEnumerable).IsAssignableFrom(instance.GetType()))
|
|
{
|
|
|
|
foreach (var a in (IEnumerable<D>)instance)
|
|
{
|
|
CheckNull<D,Object>(a);
|
|
}
|
|
}
|
|
else
|
|
CheckNull<D, Object>((D)instance);
|
|
}
|
|
else //值
|
|
{
|
|
var proValue = pro.GetValue(param, null);
|
|
|
|
var attrs = pro.GetCustomAttributes(typeof(RequiredAttribute), false);
|
|
|
|
foreach (var attr in attrs)
|
|
{
|
|
if (attr is RequiredAttribute && (proValue == null || string.IsNullOrEmpty(proValue.ToString())) && ((RequiredAttribute)attr).AllowEmptyStrings == false)
|
|
throw new Exception($"NullOrEmptyParam:{pro.Name}");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|