增加分页

This commit is contained in:
qianhao.xu
2024-12-23 18:34:58 +08:00
parent 80cbe486fd
commit 9d22ec83eb
4 changed files with 33 additions and 22 deletions

View File

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

View File

@@ -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; }
}
}

View File

@@ -21,9 +21,9 @@ public interface IReportFlowService: IBaseService<ProReportwork01>
bool ShipmentProcessReportwork(string workorder, int processId, int finish_num, int bad_num, string customer_order, string Worker);
List<ProReportWorkDetialDto> GetWorkOrderReportWorkList(string workorder);
List<ProReportWorkDetialDto> GetReportInfoByName(string Name);
PagedInfo<ProReportWorkDetialDto> GetReportInfoByName(ProReportWorkDto2 query);
List<BaseWorkProcessesDto> GetProcessByRoute(int route_id);
List<ProReportWorkDetialDto> GetReportByProcessId(int processId);
PagedInfo<ProReportWorkDetialDto> GetReportByProcessId(ProReportWorkDto3 query);
}

View File

@@ -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<ProReportwork01>, IReportFlowServic
.ToList();
}
public List<ProReportWorkDetialDto> GetReportInfoByName(string Name)
public PagedInfo<ProReportWorkDetialDto> GetReportInfoByName(ProReportWorkDto2 query)
{
string NickName = Context.Queryable<SysUser>().Where(it => it.UserName == Name).Select(it => it.NickName).First();
Name = string.IsNullOrEmpty(NickName) ? Name + "|异常人员|" : NickName;
string NickName = Context.Queryable<SysUser>().Where(it => it.UserName == query.name).Select(it => it.NickName).First();
query.name = string.IsNullOrEmpty(NickName) ? query.name + "|异常人员|" : NickName;
return Context.Queryable<ProReportwork01>()
.LeftJoin<BaseWorkProcesses>((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<BaseWorkProcesses>((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<ProReportwork01>, IReportFlowServic
}
public List<ProReportWorkDetialDto> GetReportByProcessId(int processId)
public PagedInfo<ProReportWorkDetialDto> GetReportByProcessId(ProReportWorkDto3 query)
{
return Context.Queryable<ProReportwork01>()
.LeftJoin<BaseWorkProcesses>((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);
}
}