diff --git a/DOAN.Admin.WebApi/Controllers/MES/product/ProReportworkController.cs b/DOAN.Admin.WebApi/Controllers/MES/product/ProReportworkController.cs index 5e6e68b..2370b2a 100644 --- a/DOAN.Admin.WebApi/Controllers/MES/product/ProReportworkController.cs +++ b/DOAN.Admin.WebApi/Controllers/MES/product/ProReportworkController.cs @@ -13,6 +13,8 @@ using DOAN.Model.System.Dto; using DOAN.Model; using DOAN.Service.JobKanban.IService; using DOAN.Service.MES.group.IService; +using DOAN.Infrastructure; +using Infrastructure.Converter; //创建时间:2024-07-23 namespace DOAN.Admin.WebApi.Controllers @@ -131,6 +133,25 @@ namespace DOAN.Admin.WebApi.Controllers return SUCCESS(response); } + + //TODO 导出excel + /// + /// 导出excel + /// + /// + /// + [HttpGet("export")] + [Log(Title = "报工导出", BusinessType = BusinessType.EXPORT)] + public IActionResult UserExport(DateTime handleDate) + { + handleDate=DOANConvertDateTime.ConvertLocalDate(handleDate); + + var list =_ProReportworkService.UserExport(handleDate); + + var result = ExportExcelMini(list, "report", "报工列表"); + + return ExportExcel(result.Item2, result.Item1); + } } diff --git a/DOAN.Service/MES/product/IService/IProReportworkService.cs b/DOAN.Service/MES/product/IService/IProReportworkService.cs index 07ce97a..b47e9c9 100644 --- a/DOAN.Service/MES/product/IService/IProReportworkService.cs +++ b/DOAN.Service/MES/product/IService/IProReportworkService.cs @@ -23,5 +23,7 @@ namespace DOAN.Service.MES.product.IService int UpdateProReportwork(ProReportwork parm); + List UserExport(DateTime handleDate); + } } diff --git a/DOAN.Service/MES/product/ProReportworkService.cs b/DOAN.Service/MES/product/ProReportworkService.cs index 512f9de..5b85615 100644 --- a/DOAN.Service/MES/product/ProReportworkService.cs +++ b/DOAN.Service/MES/product/ProReportworkService.cs @@ -101,5 +101,12 @@ namespace DOAN.Service.MES.product return Update(model, true); } + public List UserExport(DateTime handleDate) + { + DateTime AddhandleDate = handleDate.AddDays(1); + + return Context.Queryable().Where(it => it.CreatedTime >= handleDate&&it.CreatedTime<=AddhandleDate).ToList().Adapt>(); + } + } } \ No newline at end of file diff --git a/Infrastructure/Converter/DOANConvertDateTime.cs b/Infrastructure/Converter/DOANConvertDateTime.cs new file mode 100644 index 0000000..55f3694 --- /dev/null +++ b/Infrastructure/Converter/DOANConvertDateTime.cs @@ -0,0 +1,38 @@ +using System; + +namespace Infrastructure.Converter; + +public class DOANConvertDateTime +{ + /// + /// 日期转本地日期 + /// + /// + /// + public static DateTime ConvertLocalDateTime(DateTime handleDate) + { + if (handleDate.Kind == DateTimeKind.Utc) + { + handleDate = handleDate.ToLocalTime(); + + } + + return handleDate.Date; + } + + /// + /// 日期转本地日期 + /// + /// + /// + public static DateTime ConvertLocalDate(DateTime handleDate) + { + if (handleDate.Kind == DateTimeKind.Utc) + { + handleDate = handleDate.ToLocalTime(); + + } + + return handleDate; + } +}