From 9d22ec83eb34fd773add77074d02ccbbec5f3a4d Mon Sep 17 00:00:00 2001 From: "qianhao.xu" Date: Mon, 23 Dec 2024 18:34:58 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=88=86=E9=A1=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Mobile/ReportFlowController.cs | 12 ++++---- .../Mobile/ReportFlow/Dto/ProReportWorkDto.cs | 9 ++++++ .../Mobile/IService/IReportFlowService.cs | 4 +-- DOAN.Service/Mobile/ReportFlowService.cs | 30 ++++++++++--------- 4 files changed, 33 insertions(+), 22 deletions(-) diff --git a/DOAN.Admin.WebApi/Controllers/Mobile/ReportFlowController.cs b/DOAN.Admin.WebApi/Controllers/Mobile/ReportFlowController.cs index 1adad67..34e228c 100644 --- a/DOAN.Admin.WebApi/Controllers/Mobile/ReportFlowController.cs +++ b/DOAN.Admin.WebApi/Controllers/Mobile/ReportFlowController.cs @@ -141,14 +141,14 @@ public class ReportFlowController : BaseController //TODO 输入姓名拼音,查询此人今日报工记录 [HttpGet("get_report_info_by_name")] - public IActionResult GetReportInfoByName(string name) + public IActionResult GetReportInfoByName([FromQuery] ProReportWorkDto2 query ) { - if (string.IsNullOrEmpty(name)) + if (string.IsNullOrEmpty(query.name)) { throw new CustomException("name is null"); } - var response= _reportFlowService.GetReportInfoByName(name); + var response= _reportFlowService.GetReportInfoByName(query); return SUCCESS(response); } @@ -169,12 +169,12 @@ public class ReportFlowController : BaseController //TODO 输入工序id 查询今天报工记录 [HttpGet("get_report_by_processid")] - public IActionResult GetReportByProcessId(int processId) + public IActionResult GetReportByProcessId([FromQuery] ProReportWorkDto3 query) { - if (processId <= 0) { + if (query.processId <= 0) { throw new CustomException("processId is error"); } - var response = _reportFlowService.GetReportByProcessId(processId); + var response = _reportFlowService.GetReportByProcessId(query); return SUCCESS(response); } diff --git a/DOAN.Model/Mobile/ReportFlow/Dto/ProReportWorkDto.cs b/DOAN.Model/Mobile/ReportFlow/Dto/ProReportWorkDto.cs index 77ffeda..7256421 100644 --- a/DOAN.Model/Mobile/ReportFlow/Dto/ProReportWorkDto.cs +++ b/DOAN.Model/Mobile/ReportFlow/Dto/ProReportWorkDto.cs @@ -14,4 +14,13 @@ namespace DOAN.Model.Mobile.ReportFlow.Dto public int bad_num { get; set; } public string process_operator { get; set; } } + + public class ProReportWorkDto2:PagerInfo + { + public string name { get; set; } + } + public class ProReportWorkDto3 : PagerInfo + { + public int processId { get; set; } + } } diff --git a/DOAN.Service/Mobile/IService/IReportFlowService.cs b/DOAN.Service/Mobile/IService/IReportFlowService.cs index 7c6a279..b375065 100644 --- a/DOAN.Service/Mobile/IService/IReportFlowService.cs +++ b/DOAN.Service/Mobile/IService/IReportFlowService.cs @@ -21,9 +21,9 @@ public interface IReportFlowService: IBaseService bool ShipmentProcessReportwork(string workorder, int processId, int finish_num, int bad_num, string customer_order, string Worker); List GetWorkOrderReportWorkList(string workorder); - List GetReportInfoByName(string Name); + PagedInfo GetReportInfoByName(ProReportWorkDto2 query); List GetProcessByRoute(int route_id); - List GetReportByProcessId(int processId); + PagedInfo GetReportByProcessId(ProReportWorkDto3 query); } \ No newline at end of file diff --git a/DOAN.Service/Mobile/ReportFlowService.cs b/DOAN.Service/Mobile/ReportFlowService.cs index 6aaef1c..c6c8547 100644 --- a/DOAN.Service/Mobile/ReportFlowService.cs +++ b/DOAN.Service/Mobile/ReportFlowService.cs @@ -1,9 +1,11 @@ +using DOAN.Model; using DOAN.Model.MES.base_; using DOAN.Model.MES.base_.Dto; using DOAN.Model.MES.product; using DOAN.Model.Mobile.ReportFlow.Dto; using DOAN.Model.Public; using DOAN.Model.System; +using DOAN.Repository; using DOAN.Service.Mobile.IService; using DOAN.Service.Public.IPublicService; using Infrastructure.Attribute; @@ -195,21 +197,21 @@ public class ReportFlowService : BaseService, IReportFlowServic .ToList(); } - public List GetReportInfoByName(string Name) + public PagedInfo GetReportInfoByName(ProReportWorkDto2 query) { - string NickName = Context.Queryable().Where(it => it.UserName == Name).Select(it => it.NickName).First(); - Name = string.IsNullOrEmpty(NickName) ? Name + "|异常人员|" : NickName; + string NickName = Context.Queryable().Where(it => it.UserName == query.name).Select(it => it.NickName).First(); + query.name = string.IsNullOrEmpty(NickName) ? query.name + "|异常人员|" : NickName; return Context.Queryable() - .LeftJoin((rw, wp) => rw.ProcessId == wp.Id) - .Where((rw, wp) => rw.Worker == Name && rw.JobDateTime >= DateTime.Today && rw.JobDateTime < DateTime.Today.AddDays(1)) - .OrderBy(rw => rw.ProcessId) - .Select((rw, wp) => new ProReportWorkDetialDto() - { - ProcessName = wp.Name, - }, true) - .ToList(); + .LeftJoin((rw, wp) => rw.ProcessId == wp.Id) + .Where((rw, wp) => rw.Worker == query.name && rw.JobDateTime >= DateTime.Today && rw.JobDateTime < DateTime.Today.AddDays(1)) + .OrderBy(rw => rw.ProcessId) + .Select((rw, wp) => new ProReportWorkDetialDto() + { + ProcessName = wp.Name, + }, true) + .ToPage_NO_Convert(query); } @@ -225,17 +227,17 @@ public class ReportFlowService : BaseService, IReportFlowServic } - public List GetReportByProcessId(int processId) + public PagedInfo GetReportByProcessId(ProReportWorkDto3 query) { return Context.Queryable() .LeftJoin((rw, wp) => rw.ProcessId == wp.Id) - .Where((rw, wp) => rw.ProcessId == processId && rw.JobDateTime >= DateTime.Today && rw.JobDateTime < DateTime.Today.AddDays(1)) + .Where((rw, wp) => rw.ProcessId == query.processId && rw.JobDateTime >= DateTime.Today && rw.JobDateTime < DateTime.Today.AddDays(1)) .OrderBy(rw => rw.ProcessId) .Select((rw, wp) => new ProReportWorkDetialDto() { ProcessName = wp.Name, }, true) - .ToList(); + .ToPage_NO_Convert(query); } }