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);