2024-11-04 14:56:09 +08:00

51 lines
2.1 KiB
C#

using DOAN.Infrastructure;
using DOAN.Model;
using DOAN.Model.MES.quality.IPQC;
using DOAN.Model.MES.quality.IPQC.Dto;
using DOAN.Repository;
using DOAN.Service.MES.quality.IQC.IService;
using Infrastructure.Attribute;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DOAN.Service.MES.quality.IQC
{
[AppService(ServiceType = typeof(IQcReportService), ServiceLifetime = LifeTime.Transient)]
public class QcReportService : BaseService<QcDefectCollection>, IQcReportService
{
/// <summary>
/// 查询报损单
/// </summary>
/// <param name="parm"></param>
/// <returns></returns>
public PagedInfo<QcDefectCollectionDto> GetList(QcDefectCollectionQueryDto2 parm)
{
parm.DateTime = ConvertDateTime.ConvertLocalDate(parm.DateTime ?? DateTime.MinValue);
var predicate = Expressionable.Create<QcDefectCollection>()
.AndIF(!string.IsNullOrEmpty(parm.MaterialCode), it => it.MaterialCode.Contains(parm.MaterialCode))
.AndIF(!string.IsNullOrEmpty(parm.MaterialName), it => it.MaterialName.Contains(parm.MaterialName))
.AndIF(!string.IsNullOrEmpty(parm.ProductCode), it => it.ProductCode.Contains(parm.ProductCode))
.AndIF(!string.IsNullOrEmpty(parm.ProductName), it => it.ProductName.Contains(parm.ProductName))
.AndIF(!string.IsNullOrEmpty(parm.LineCode), it => it.LineCode.Contains(parm.LineCode))
.AndIF(!string.IsNullOrEmpty(parm.SupplierCode), it => it.SupplierCode.Contains(parm.SupplierCode))
.AndIF(parm.DateTime != null && parm.DateTime > DateTime.MinValue.AddYears(1), it => it.DateTime == parm.DateTime)
.And(it => it.Tqm == 1||it.Tqm==2)
;
var response = Queryable()
.Where(predicate.ToExpression())
.OrderBy(it => it.MaterialCode)
.ToPage<QcDefectCollection, QcDefectCollectionDto>(parm);
return response;
}
}
}