This commit is contained in:
qianhao.xu 2024-07-16 14:52:41 +08:00
parent 71793e9ad1
commit e4f0ba513d
2 changed files with 52 additions and 24 deletions

View File

@ -7,6 +7,21 @@ namespace DOAN.Model.MES.product.Dto
/// </summary>
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; }
}
/// <summary>

View File

@ -26,7 +26,18 @@ namespace DOAN.Service.MES.product
/// <returns></returns>
public PagedInfo<ProWorkorderDto> GetList(ProWorkorderQueryDto parm)
{
var predicate = Expressionable.Create<ProWorkorder>();
var predicate = Expressionable.Create<ProWorkorder>()
.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
/// <returns></returns>
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
/// <returns></returns>
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;
}
}