This commit is contained in:
qianhao.xu 2024-11-04 13:47:51 +08:00
parent 80cc3e1aba
commit 084947b38a
4 changed files with 68 additions and 0 deletions

View File

@ -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
/// <summary>
/// 导出excel
/// </summary>
/// <param name="user"></param>
/// <returns></returns>
[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);
}
}

View File

@ -23,5 +23,7 @@ namespace DOAN.Service.MES.product.IService
int UpdateProReportwork(ProReportwork parm);
List<ProReportworkDto> UserExport(DateTime handleDate);
}
}

View File

@ -101,5 +101,12 @@ namespace DOAN.Service.MES.product
return Update(model, true);
}
public List<ProReportworkDto> UserExport(DateTime handleDate)
{
DateTime AddhandleDate = handleDate.AddDays(1);
return Context.Queryable<ProReportwork>().Where(it => it.CreatedTime >= handleDate&&it.CreatedTime<=AddhandleDate).ToList().Adapt<List<ProReportworkDto>>();
}
}
}

View File

@ -0,0 +1,38 @@
using System;
namespace Infrastructure.Converter;
public class DOANConvertDateTime
{
/// <summary>
/// 日期转本地日期
/// </summary>
/// <param name="handleDate"></param>
/// <returns></returns>
public static DateTime ConvertLocalDateTime(DateTime handleDate)
{
if (handleDate.Kind == DateTimeKind.Utc)
{
handleDate = handleDate.ToLocalTime();
}
return handleDate.Date;
}
/// <summary>
/// 日期转本地日期
/// </summary>
/// <param name="handleDate"></param>
/// <returns></returns>
public static DateTime ConvertLocalDate(DateTime handleDate)
{
if (handleDate.Kind == DateTimeKind.Utc)
{
handleDate = handleDate.ToLocalTime();
}
return handleDate;
}
}