This commit is contained in:
qianhao.xu
2023-11-27 16:28:16 +08:00
parent 7ba84f96cd
commit 2a6ccc616e
10 changed files with 293 additions and 18 deletions

View File

@@ -1,4 +1,5 @@
using Infrastructure.Attribute;
using Microsoft.AspNetCore.Http.HttpResults;
using Microsoft.Extensions.DependencyInjection;
using SqlSugar;
using System;
@@ -8,9 +9,12 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ZR.Model.mes.pro;
using ZR.Model.MES.qc.DTO;
using ZR.Model.MES.qu;
using ZR.Model.MES.wm;
using ZR.Service.mes.pro.IService;
using ZR.Service.mes.qu.IService;
using static System.Runtime.InteropServices.JavaScript.JSType;
namespace ZR.Service.mes.qu
{
@@ -18,19 +22,40 @@ namespace ZR.Service.mes.qu
public class QcRoughService : BaseService<QcRough>, IQcRoughService
{
public (List<ProWorkorder>, int) GetWorkorderList(int pageNum, int pageSize, int year, int week, int date, int isSchedule)
public (List<Mr_QuRoughDTO>, int) GetStatisticslist(int pageNum, int pageSize, int year, int week, int date, int isSchedule)
{
var predicate = Expressionable.Create<ProWorkorder>()
.AndIF(year > 0, it => it.Year == year)
.AndIF(week > 0, it => it.Week == week)
.AndIF(date > 0, it => it.Date == date)
.AndIF(date > 0, it => it.Wrokerorder_status==isSchedule)
var predicate = Expressionable.Create<WmMaterialrequisition>()
.AndIF(year > 0, wm => wm.Year == year)
.AndIF(week > 0, wm => wm.Week == week)
.AndIF(date > 0, wm => wm.Date == date)
.ToExpression();
int totalCount = 0;
List<ProWorkorder> proWorkorderList = Context.Queryable<ProWorkorder>().Where(predicate).ToPageList(pageNum, pageSize, ref totalCount);
return (proWorkorderList, totalCount);
//联表查询
List<Mr_QuRoughDTO> mr_QusList = Context.Queryable<WmMaterialrequisition>()
.LeftJoin<QcRough>((wm, qc) =>wm.Id==qc.FkMaterialrequisitionId)
.Where(predicate)
.Select((wm,qc) => new Mr_QuRoughDTO {
Id = qc.Id,
FkMaterialrequisitionId=qc.FkMaterialrequisitionId,
Workblankpartnumber=wm.Workblankpartnumber,
Requirenum=wm.Requirenum,
Status = wm.Status,
Year = wm.Year,
Week = wm.Week,
Date = wm.Date,
RequireNum= qc.RequireNum,
ActualNumber=qc.ActualNumber,
RandomRate = qc.RandomRate,
Oks = qc.Oks,
Ngs = qc.Ngs,
OksRatio = qc.OksRatio,
IsFeeding = qc.IsFeeding
})
.ToPageList(pageNum, pageSize, ref totalCount);
return (mr_QusList, totalCount);
}
}
}