导出
This commit is contained in:
parent
80cc3e1aba
commit
084947b38a
@ -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);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -23,5 +23,7 @@ namespace DOAN.Service.MES.product.IService
|
||||
|
||||
int UpdateProReportwork(ProReportwork parm);
|
||||
|
||||
List<ProReportworkDto> UserExport(DateTime handleDate);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -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>>();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
38
Infrastructure/Converter/DOANConvertDateTime.cs
Normal file
38
Infrastructure/Converter/DOANConvertDateTime.cs
Normal 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;
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user