安灯大屏

This commit is contained in:
quowingwang 2026-01-06 10:03:03 +08:00
parent 74dc1edf07
commit d7fc42b67c
3 changed files with 34 additions and 1 deletions

View File

@ -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>
/// 查询报警记录详情 /// 查询报警记录详情
/// </summary> /// </summary>

View File

@ -9,6 +9,8 @@ using Microsoft.AspNetCore.Server.Kestrel.Core;
using SqlSugar; using SqlSugar;
using SqlSugar.Extensions; using SqlSugar.Extensions;
using System; using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq; using System.Linq;
using ZR.Model; using ZR.Model;
using ZR.Model.MES.andon; using ZR.Model.MES.andon;
@ -80,6 +82,24 @@ namespace ZR.Service.mes.andon
return response; return response;
} }
public List<AndonAlarmRecordDto> GetListToWeek()
{
DateTime now = DateTime.Now;
DateTime endTime = now;
Calendar calendar = CultureInfo.CurrentCulture.Calendar;
// 获取当天是本周的第几天WeekOfDay1=周一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) public PagedInfo<AndonAlarmRecordDto> GetListToday(AndonAlarmRecordQueryDto parm)
{ {
var predicate = Expressionable.Create<AndonAlarmRecord>(); var predicate = Expressionable.Create<AndonAlarmRecord>();

View File

@ -13,7 +13,7 @@ namespace ZR.Service.mes.andon.Iservice
public interface IAndonAlarmRecordService : IBaseService<AndonAlarmRecord> public interface IAndonAlarmRecordService : IBaseService<AndonAlarmRecord>
{ {
PagedInfo<AndonAlarmRecordDto> GetList(AndonAlarmRecordQueryDto parm); PagedInfo<AndonAlarmRecordDto> GetList(AndonAlarmRecordQueryDto parm);
List<AndonAlarmRecordDto> GetListToWeek();
PagedInfo<AndonAlarmRecordDto> GetListToday(AndonAlarmRecordQueryDto parm); PagedInfo<AndonAlarmRecordDto> GetListToday(AndonAlarmRecordQueryDto parm);
AndonAlarmRecord GetInfo(int Id); AndonAlarmRecord GetInfo(int Id);