生产工单查询优化
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using ZR.Model.MES.pro;
|
||||
using Infrastructure.Model;
|
||||
using ZR.Model.MES.pro;
|
||||
using ZR.Model.MES.pro.DTO;
|
||||
|
||||
namespace ZR.Service.mes.pro.IService
|
||||
@@ -10,6 +11,7 @@ namespace ZR.Service.mes.pro.IService
|
||||
public (List<ProWorkOrder>, int) GetWorkorderList(int pageNum, int pageSize, int year, int week, int date, int isSchedule);
|
||||
public (List<ProWorkorder_v2>, int) GetWorkorderList_Piliang(int pageNum, int pageSize, int year, int week, int date, int isSchedule);
|
||||
|
||||
public ApiResult getWorkoderStates(int pageNum, int pageSize, int year, int week, int date, int isSchedule);
|
||||
|
||||
public string ImportExceldata(List<ProWorkorder_v2> proWorklplans);
|
||||
|
||||
|
||||
@@ -1,11 +1,14 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using Infrastructure;
|
||||
using Infrastructure;
|
||||
using Infrastructure.Attribute;
|
||||
using Infrastructure.Model;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using MiniExcelLibs;
|
||||
using Model.DBModel;
|
||||
using SqlSugar;
|
||||
using System;
|
||||
using System.IO;
|
||||
using ZR.Model.DTO.MES.pro;
|
||||
using ZR.Model.mes.pro;
|
||||
using ZR.Model.MES.pro;
|
||||
using ZR.Model.MES.pro.DTO;
|
||||
using ZR.Model.MES.wms;
|
||||
@@ -106,6 +109,64 @@ namespace ZR.Service.mes.pro
|
||||
return (proWorkorderList, totalCount);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取1000条数据生产计划状态
|
||||
/// </summary>
|
||||
/// <param name="pageNum"></param>
|
||||
/// <param name="pageSize"></param>
|
||||
/// <param name="year"></param>
|
||||
/// <param name="week"></param>
|
||||
/// <param name="date"></param>
|
||||
/// <param name="isSchedule"></param>
|
||||
/// <returns></returns>
|
||||
public ApiResult getWorkoderStates(int pageNum, int pageSize, int year, int week, int date, int isSchedule)
|
||||
{
|
||||
try
|
||||
{
|
||||
ApiResult result = new ApiResult();
|
||||
var predicate = Expressionable
|
||||
.Create<ProWorkorder_v2>()
|
||||
.AndIF(year > 0, it => it.Year == year)
|
||||
.AndIF(week > 0, it => it.Week == week)
|
||||
.AndIF(date > 0, it => it.Date == date)
|
||||
.ToExpression();
|
||||
|
||||
int totalCount = 0;
|
||||
List<ProWorkorder_v2> proWorkorderList = Context
|
||||
.Queryable<ProWorkorder_v2>()
|
||||
.Where(predicate)
|
||||
.OrderBy(it => it.Sort)
|
||||
.ToPageList(pageNum, pageSize, ref totalCount);
|
||||
ProWorkorderV2Dto_stateCount pcount = new ProWorkorderV2Dto_stateCount();
|
||||
if (proWorkorderList != null)
|
||||
{
|
||||
foreach (var item in proWorkorderList)
|
||||
{
|
||||
int State = CheckWorkOrder(item);
|
||||
pcount.total++;
|
||||
switch (State)
|
||||
{
|
||||
case 0: pcount.state0++; break;
|
||||
case 1: pcount.state1++; break;
|
||||
case 2: pcount.state2++; break;
|
||||
case 3: pcount.state3++; break;
|
||||
case 4: pcount.state4++; break;
|
||||
case 5: pcount.state5++; break;
|
||||
}
|
||||
}
|
||||
}
|
||||
result.Success().Data = pcount;
|
||||
return result;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ApiResult result = new ApiResult();
|
||||
result.Code = 101;
|
||||
result.Msg = ex.Message;
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取生产计划id
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user