From f6a92e607d7b48813a732613e442734f2f16da76 Mon Sep 17 00:00:00 2001 From: zhoukeda <1315948824@qq.com> Date: Tue, 17 Oct 2023 10:44:48 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=9C=8B=E6=9D=BF=E5=92=8C?= =?UTF-8?q?=E7=A7=BB=E5=8A=A8=E7=AB=AF=E7=9A=84=E4=BB=BB=E5=8A=A1=E5=8D=95?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Dto/PrdManage/PrdMoTaskListOutput.cs | 12 ++++++++++++ .../Tnb.ProductionMgr/PrdPackReportService.cs | 19 +++++++++++++++---- 2 files changed, 27 insertions(+), 4 deletions(-) create mode 100644 ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdMoTaskListOutput.cs diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdMoTaskListOutput.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdMoTaskListOutput.cs new file mode 100644 index 00000000..7f72eb6b --- /dev/null +++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdMoTaskListOutput.cs @@ -0,0 +1,12 @@ +using JNPF.Common.Filter; + +namespace Tnb.ProductionMgr.Entities.Dto.PrdManage +{ + public class PrdMoTaskListOutput : PageInputBase + { + /// + /// 工位id + /// + public string stationId { get; set; } + } +} \ No newline at end of file diff --git a/ProductionMgr/Tnb.ProductionMgr/PrdPackReportService.cs b/ProductionMgr/Tnb.ProductionMgr/PrdPackReportService.cs index 664a4b4d..1878168f 100644 --- a/ProductionMgr/Tnb.ProductionMgr/PrdPackReportService.cs +++ b/ProductionMgr/Tnb.ProductionMgr/PrdPackReportService.cs @@ -347,9 +347,9 @@ namespace Tnb.ProductionMgr /// /// [HttpPost] - public async Task GetPadPrdMoTaskList(PrdPackReportQueryInput input) + public async Task GetPadPrdMoTaskList(PrdMoTaskListOutput input) { - if (string.IsNullOrEmpty(input.stationId)) + if (string.IsNullOrEmpty(input.stationId)) { return new { @@ -357,7 +357,16 @@ namespace Tnb.ProductionMgr list = Array.Empty() }; } - + + Dictionary queryJson = string.IsNullOrEmpty(input.queryJson) ? new Dictionary() : input.queryJson.ToObject>(); + string mo_task_code = queryJson.ContainsKey("mo_task_code") ? queryJson["mo_task_code"].ToString() : ""; + string mo_task_status = queryJson.ContainsKey("mo_task_status") ? queryJson["mo_task_status"].ToString() : ""; + if (string.IsNullOrEmpty(input.sidx)) + { + input.sidx = "create_time"; + input.sort = "desc"; + } + var result = await _db.Queryable() .LeftJoin((a, b) => a.material_id == b.id) .LeftJoin((a, b, c) => a.process_id == c.id) @@ -366,6 +375,8 @@ namespace Tnb.ProductionMgr .LeftJoin((a,b,c,d,e,f)=>a.eqp_id==f.id) .LeftJoin((a,b,c,d,e,f,g)=>a.mold_id==g.id) .Where((a, b) => a.workstation_id == input.stationId && (a.mo_task_status == DictConst.ToBeStartedEnCode || a.mo_task_status == DictConst.MoStatusPauseCode || a.mo_task_status == DictConst.ComplatedEnCode || a.mo_task_status == DictConst.InProgressEnCode) ) + .WhereIF(!string.IsNullOrEmpty(mo_task_code),a=>a.mo_task_code.Contains(mo_task_code)) + .WhereIF(!string.IsNullOrEmpty(mo_task_status),a=>a.mo_task_status.Contains(mo_task_status)) .Select((a, b, c, d, e,f,g) => new PADPackageTaskPageOutput { id = a.id, @@ -398,7 +409,7 @@ namespace Tnb.ProductionMgr schedule_type = a.schedule_type, }) .MergeTable() - .OrderByDescending((a) => a.create_time) + .OrderBy($"{input.sidx} {input.sort}") .ToPagedListAsync(input.currentPage, int.MaxValue); return PageResult.SqlSugarPageResult(result);