安灯大屏
This commit is contained in:
parent
74dc1edf07
commit
d7fc42b67c
@ -39,6 +39,19 @@ namespace ZR.Admin.WebApi.Controllers.andon
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 查询报警记录列表
|
||||
/// </summary>
|
||||
/// <param name="parm"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("listToWeek")]
|
||||
[ActionPermissionFilter(Permission = "business:andonalarmrecord:list")]
|
||||
public IActionResult QueryAndonAlarmRecordToWeek()
|
||||
{
|
||||
var response = _AndonAlarmRecordService.GetListToWeek();
|
||||
return SUCCESS(response);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查询报警记录详情
|
||||
/// </summary>
|
||||
|
||||
@ -9,6 +9,8 @@ using Microsoft.AspNetCore.Server.Kestrel.Core;
|
||||
using SqlSugar;
|
||||
using SqlSugar.Extensions;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using ZR.Model;
|
||||
using ZR.Model.MES.andon;
|
||||
@ -80,6 +82,24 @@ namespace ZR.Service.mes.andon
|
||||
return response;
|
||||
}
|
||||
|
||||
public List<AndonAlarmRecordDto> GetListToWeek()
|
||||
{
|
||||
DateTime now = DateTime.Now;
|
||||
DateTime endTime = now;
|
||||
Calendar calendar = CultureInfo.CurrentCulture.Calendar;
|
||||
// 获取当天是本周的第几天(WeekOfDay:1=周一,7=周日)
|
||||
int dayOfWeek = (int)calendar.GetDayOfWeek(now);
|
||||
// 计算本周第一天(减去“当天在本周的偏移量 -1”)
|
||||
DateTime startTime = now.AddDays(-(dayOfWeek - 1)).Date; // 截断时分秒为00:00:00
|
||||
var predicate = Expressionable.Create<AndonAlarmRecord>();
|
||||
predicate.And(a => a.CreatedTime >= startTime && a.CreatedTime <= endTime);
|
||||
List<AndonAlarmRecordDto> queryList = Queryable()
|
||||
.Where(predicate.ToExpression())
|
||||
.Select<AndonAlarmRecordDto>()
|
||||
.ToList();
|
||||
return queryList;
|
||||
}
|
||||
|
||||
public PagedInfo<AndonAlarmRecordDto> GetListToday(AndonAlarmRecordQueryDto parm)
|
||||
{
|
||||
var predicate = Expressionable.Create<AndonAlarmRecord>();
|
||||
|
||||
@ -13,7 +13,7 @@ namespace ZR.Service.mes.andon.Iservice
|
||||
public interface IAndonAlarmRecordService : IBaseService<AndonAlarmRecord>
|
||||
{
|
||||
PagedInfo<AndonAlarmRecordDto> GetList(AndonAlarmRecordQueryDto parm);
|
||||
|
||||
List<AndonAlarmRecordDto> GetListToWeek();
|
||||
PagedInfo<AndonAlarmRecordDto> GetListToday(AndonAlarmRecordQueryDto parm);
|
||||
AndonAlarmRecord GetInfo(int Id);
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user