diff --git a/DOAN.Model/MES/product/Dto/ProWorkorderDto.cs b/DOAN.Model/MES/product/Dto/ProWorkorderDto.cs index 1a2ac64..265cabb 100644 --- a/DOAN.Model/MES/product/Dto/ProWorkorderDto.cs +++ b/DOAN.Model/MES/product/Dto/ProWorkorderDto.cs @@ -7,6 +7,21 @@ namespace DOAN.Model.MES.product.Dto /// public class ProWorkorderQueryDto : PagerInfo { + + public string ProductionName { get; set; } + + public string ProductionCode { get; set; } + + public string CustomCode { get; set; } + + public DateTime? WorkorderDate { get; set; } + + public int? Year { get; set; } + + public int? Week { get; set; } + + public int? Date { get; set; } + } /// diff --git a/DOAN.Service/MES/product/ProWorkorderService.cs b/DOAN.Service/MES/product/ProWorkorderService.cs index bf72504..a71df83 100644 --- a/DOAN.Service/MES/product/ProWorkorderService.cs +++ b/DOAN.Service/MES/product/ProWorkorderService.cs @@ -26,7 +26,18 @@ namespace DOAN.Service.MES.product /// public PagedInfo GetList(ProWorkorderQueryDto parm) { - var predicate = Expressionable.Create(); + var predicate = Expressionable.Create() + .AndIF(!string.IsNullOrEmpty(parm.ProductionName),it=>it.ProductionName.Contains(parm.ProductionName)) + .AndIF(!string.IsNullOrEmpty(parm.ProductionCode),it=>it.ProductionCode.Contains(parm.ProductionCode)) + .AndIF(!string.IsNullOrEmpty(parm.CustomCode),it=>it.CustomCode.Contains(parm.CustomCode)) + .AndIF(parm.WorkorderDate>DateTime.MinValue, it=>it.WorkorderDate== parm.WorkorderDate) + .AndIF(parm.Year > 0, it=>it.Year == parm.Year) + .AndIF(parm.Week > 0, it=>it.Week == parm.Week) + .AndIF(parm.Date > 0, it=>it.Date == parm.Date) + + + + ; var response = Queryable() .Where(predicate.ToExpression()) @@ -57,6 +68,8 @@ namespace DOAN.Service.MES.product /// public ProWorkorder AddProWorkorder(ProWorkorder model) { + model.Id= SnowFlakeSingle.Instance.NextId().ToString(); + return Context.Insertable(model).ExecuteReturnEntity(); } @@ -67,29 +80,29 @@ namespace DOAN.Service.MES.product /// public int UpdateProWorkorder(ProWorkorder model) { - //var response = Update(w => w.Id == model.Id, it => new ProWorkorder() - //{ - // ProductionName = model.ProductionName, - // ProductionCode = model.ProductionCode, - // CustomCode = model.CustomCode, - // DeliveryNum = model.DeliveryNum, - // Unit = model.Unit, - // PackageNum = model.PackageNum, - // Sort = model.Sort, - // WorkorderDate = model.WorkorderDate, - // Year = model.Year, - // Week = model.Week, - // Date = model.Date, - // Priority = model.Priority, - // Status = model.Status, - // Remark = model.Remark, - // CreatedBy = model.CreatedBy, - // CreatedTime = model.CreatedTime, - // UpdatedBy = model.UpdatedBy, - // UpdatedTime = model.UpdatedTime, - //}); - //return response; - return Update(model, true); + var response = Update(w => w.Id == model.Id, it => new ProWorkorder() + { + ProductionName = model.ProductionName, + ProductionCode = model.ProductionCode, + CustomCode = model.CustomCode, + DeliveryNum = model.DeliveryNum, + Unit = model.Unit, + PackageNum = model.PackageNum, + Sort = model.Sort, + WorkorderDate = model.WorkorderDate, + Year = model.Year, + Week = model.Week, + Date = model.Date, + Priority = model.Priority, + Status = model.Status, + Remark = model.Remark, + CreatedBy = model.CreatedBy, + CreatedTime = model.CreatedTime, + UpdatedBy = model.UpdatedBy, + UpdatedTime = model.UpdatedTime, + }); + return response; + } }