生产工单查询优化
This commit is contained in:
@@ -382,6 +382,16 @@ namespace ZR.Admin.WebApi.Controllers.mes.pro
|
|||||||
return ToResponse(new ApiResult(200, "success", data));
|
return ToResponse(new ApiResult(200, "success", data));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取1000条工单的状态工单列表
|
||||||
|
/// </summary>
|
||||||
|
[HttpGet("getWorkoderStates")]
|
||||||
|
public ApiResult getWorkoderStates(int pageNum, int pageSize, int year = -1, int week = -1, int date = -1)
|
||||||
|
{
|
||||||
|
ApiResult apiResult = proWorkorderService.getWorkoderStates(pageNum, pageSize, year, week, date, 0);
|
||||||
|
|
||||||
|
return apiResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
BIN
ZR.Admin.WebApi/wwwroot/export/2025年51周5日计划-12-18-141250.xlsx
Normal file
BIN
ZR.Admin.WebApi/wwwroot/export/2025年51周5日计划-12-18-141250.xlsx
Normal file
Binary file not shown.
@@ -146,4 +146,21 @@ namespace ZR.Model.DTO.MES.pro
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public DateTime UpdatedTime { get; set; }
|
public DateTime UpdatedTime { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class ProWorkorderV2Dto_stateCount
|
||||||
|
{
|
||||||
|
public int total { get; set; } = 0;
|
||||||
|
//正常
|
||||||
|
public int state0 { get; set; }
|
||||||
|
//物料不存在
|
||||||
|
public int state1 { get; set; }
|
||||||
|
//毛坯号异常
|
||||||
|
public int state2 { get; set; }
|
||||||
|
//颜色异常
|
||||||
|
public int state3 { get; set; }
|
||||||
|
//规格异常
|
||||||
|
public int state4 { get; set; }
|
||||||
|
//物料不包含此描述
|
||||||
|
public int state5 { get; set; }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
using ZR.Model.MES.pro;
|
using Infrastructure.Model;
|
||||||
|
using ZR.Model.MES.pro;
|
||||||
using ZR.Model.MES.pro.DTO;
|
using ZR.Model.MES.pro.DTO;
|
||||||
|
|
||||||
namespace ZR.Service.mes.pro.IService
|
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>, 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 (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);
|
public string ImportExceldata(List<ProWorkorder_v2> proWorklplans);
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,14 @@
|
|||||||
using System;
|
using Infrastructure;
|
||||||
using System.IO;
|
|
||||||
using Infrastructure;
|
|
||||||
using Infrastructure.Attribute;
|
using Infrastructure.Attribute;
|
||||||
|
using Infrastructure.Model;
|
||||||
using Microsoft.AspNetCore.Hosting;
|
using Microsoft.AspNetCore.Hosting;
|
||||||
using MiniExcelLibs;
|
using MiniExcelLibs;
|
||||||
using Model.DBModel;
|
using Model.DBModel;
|
||||||
using SqlSugar;
|
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;
|
||||||
using ZR.Model.MES.pro.DTO;
|
using ZR.Model.MES.pro.DTO;
|
||||||
using ZR.Model.MES.wms;
|
using ZR.Model.MES.wms;
|
||||||
@@ -106,6 +109,64 @@ namespace ZR.Service.mes.pro
|
|||||||
return (proWorkorderList, totalCount);
|
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>
|
/// <summary>
|
||||||
/// 获取生产计划id
|
/// 获取生产计划id
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
Reference in New Issue
Block a user