This commit is contained in:
qianhao.xu 2024-11-01 14:47:01 +08:00
parent 1f17ff190a
commit 9f3bfdf236
9 changed files with 61 additions and 2 deletions

View File

@ -3,6 +3,7 @@ using DOAN.Model.PBL.Dto;
using DOAN.Model.PBL;
using DOAN.Service.PBL.IPBLService;
using DOAN.Admin.WebApi.Filters;
using Infrastructure.Converter;
//创建时间2024-11-01
namespace DOAN.Admin.WebApi.Controllers.PBL
@ -33,6 +34,9 @@ namespace DOAN.Admin.WebApi.Controllers.PBL
[ActionPermissionFilter(Permission = "lightlog:list")]
public IActionResult QueryLightLog([FromQuery] LightLogQueryDto parm)
{
parm.TimeRange[0]= DOANConvertDateTime.ConvertLocalDateTime(parm.TimeRange[0]??DateTime.MinValue);
parm.TimeRange[1]= DOANConvertDateTime.ConvertLocalDateTime(parm.TimeRange[1]??DateTime.MinValue);
var response = _LightLogService.GetList(parm);
return SUCCESS(response);
}

View File

@ -3,6 +3,7 @@ using DOAN.Model.PBL.Dto;
using DOAN.Model.PBL;
using DOAN.Service.PBL.IPBLService;
using DOAN.Admin.WebApi.Filters;
using Infrastructure.Converter;
//创建时间2024-11-01
namespace DOAN.Admin.WebApi.Controllers.PBL
@ -33,6 +34,11 @@ namespace DOAN.Admin.WebApi.Controllers.PBL
[ActionPermissionFilter(Permission = "mesinterationlog:list")]
public IActionResult QueryMesInterationLog([FromQuery] MesInterationLogQueryDto parm)
{
parm.TimeRange[0]= DOANConvertDateTime.ConvertLocalDateTime(parm.TimeRange[0]??DateTime.MinValue);
parm.TimeRange[1]= DOANConvertDateTime.ConvertLocalDateTime(parm.TimeRange[1]??DateTime.MinValue);
var response = _MesInterationLogService.GetList(parm);
return SUCCESS(response);
}

View File

@ -6,6 +6,7 @@ namespace DOAN.Model.PBL.Dto
/// </summary>
public class LightLogQueryDto : PagerInfo
{
public DateTime?[] TimeRange { get; set; }=new DateTime?[2];
}
/// <summary>

View File

@ -6,6 +6,8 @@ namespace DOAN.Model.PBL.Dto
/// </summary>
public class MesInterationLogQueryDto : PagerInfo
{
public string Workorder { get; set; }
public DateTime?[] TimeRange { get; set; }=new DateTime?[2];
}
/// <summary>

View File

@ -71,7 +71,10 @@ namespace DOAN.Service.PBL
/// <returns></returns>
private static Expressionable<LightLog> QueryExp(LightLogQueryDto parm)
{
var predicate = Expressionable.Create<LightLog>();
var predicate = Expressionable.Create<LightLog>()
.AndIF(parm.TimeRange[0]>DateTime.MinValue, it => it.CreatedTime >=parm.TimeRange[0])
.AndIF(parm.TimeRange[1]>DateTime.MinValue, it => it.CreatedTime <=parm.TimeRange[1])
;
return predicate;
}

View File

@ -4,6 +4,7 @@ using DOAN.Model.PBL.Dto;
using DOAN.Model.PBL;
using DOAN.Repository;
using DOAN.Service.PBL.IPBLService;
using SqlSugar.SplitTableExtensions;
namespace DOAN.Service.PBL
{
@ -71,7 +72,11 @@ namespace DOAN.Service.PBL
/// <returns></returns>
private static Expressionable<MesInterationLog> QueryExp(MesInterationLogQueryDto parm)
{
var predicate = Expressionable.Create<MesInterationLog>();
var predicate = Expressionable.Create<MesInterationLog>()
.AndIF(string.IsNullOrEmpty(parm.Workorder),it=>it.Workorder.Contains(parm.Workorder))
.AndIF(parm.TimeRange[0]>DateTime.MinValue, it => it.CreatedTime >=parm.TimeRange[0])
.AndIF(parm.TimeRange[1]>DateTime.MinValue, it => it.CreatedTime <=parm.TimeRange[1])
;
return predicate;
}

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