61 lines
2.2 KiB
C#
61 lines
2.2 KiB
C#
using DOAN.Model.MES.base_;
|
|
using DOAN.Model;
|
|
using DOAN.Model.MES.product;
|
|
using DOAN.Model.MES.product.Dto;
|
|
using DOAN.Service.MES.product.IService;
|
|
using Infrastructure.Attribute;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using DOAN.Repository;
|
|
|
|
|
|
|
|
namespace DOAN.Service.MES.product
|
|
{
|
|
/// <summary>
|
|
/// 生产工单Service业务层处理
|
|
/// </summary>
|
|
[AppService(ServiceType = typeof(IProWorkorderSchedule), ServiceLifetime = LifeTime.Transient)]
|
|
public class ProWorkorderSchedule : BaseService<ProWorkorder>, IProWorkorderSchedule
|
|
{
|
|
/// <summary>
|
|
/// 查询生产工单列表
|
|
/// </summary>
|
|
/// <param name="parm"></param>
|
|
/// <returns></returns>
|
|
public PagedInfo<ProWorkorderDto> GetList(ProWorkorderQueryDto parm)
|
|
{
|
|
if (parm.WorkorderDate != null && parm.WorkorderDate.Length > 0)
|
|
{
|
|
parm.WorkorderDate[0] = parm.WorkorderDate[0].Date;
|
|
parm.WorkorderDate[1] = parm.WorkorderDate[1].Date;
|
|
|
|
}
|
|
|
|
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 != null && parm.WorkorderDate[0] > DateTime.MinValue, it => it.WorkorderDate >= parm.WorkorderDate[0])
|
|
.AndIF(parm.WorkorderDate != null && parm.WorkorderDate[1] > DateTime.MinValue, it => it.WorkorderDate <= parm.WorkorderDate[1])
|
|
.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())
|
|
.OrderBy(it => it.WorkorderDate)
|
|
.ToPage<ProWorkorder, ProWorkorderDto>(parm);
|
|
|
|
|
|
|
|
|
|
return response;
|
|
}
|
|
|
|
}
|
|
} |