You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

72 lines
2.6 KiB

6 months ago
using Entity.Api.Req;
using Entity.DbModel.Station;
using HybirdFrameworkCore.Autofac.Attribute;
using HybirdFrameworkCore.Entity;
using HybirdFrameworkCore.Utils;
using Repository.Station;
namespace Service.Station;
[Scope]
public class EquipAlarmRecordService : BaseServices<EquipAlarmRecord>
{
public EquipAlarmProcessRecordRepository ProcessRecordRepository { get; set; }
public EquipAlarmRecordService(EquipAlarmRecordRepository dal)
{
BaseDal = dal;
}
/// <summary>
/// 查询未处理报警列表
/// </summary>
/// <param name="typeCode">设备类型:-1-查询全部0-充电机1-电表2-水冷机3-plc<</param>
/// <param name="equipCode">设备编码</param>
/// <returns></returns>
public Result<PageResult<EquipAlarmRecord>> QueryEquipAlarmPage(QueryAlarmReq req)
{
int totalCount = 0;
int reqTypeCode = req.TypeCode;
var equipCode = req.EquipCode;
List<EquipAlarmRecord> list = BaseDal.Queryable().WhereIF(reqTypeCode != -1, it => it.EquipTypeCode == reqTypeCode)
.WhereIF(ObjUtils.IsNotNullOrWhiteSpace(equipCode), it => it.EquipCode == equipCode)
.ToPageList(req.PageNum, req.PageSize, ref totalCount);
PageResult<EquipAlarmRecord> result = new PageResult<EquipAlarmRecord>()
{
PageNum = req.PageNum,
PageSize = req.PageSize,
ToTal = totalCount,
Rows = list
};
return Result<PageResult<EquipAlarmRecord>>.Success(result);
}
/// <summary>
/// 查询已处理报警列表
/// </summary>
/// <param name="typeCode">设备类型:-1-查询全部0-充电机1-电表2-水冷机3-plc</param>
/// <param name="equipCode">设备编码</param>
/// <returns></returns>
public Result<PageResult<EquipAlarmProcessRecord>> QueryEquipAlarmProcessPage(QueryAlarmReq req)
{
int totalCount = 0;
int reqTypeCode = req.TypeCode;
var equipCode = req.EquipCode;
List<EquipAlarmProcessRecord> list = ProcessRecordRepository.Queryable().WhereIF(reqTypeCode != -1, it => it.EquipTypeCode == reqTypeCode)
.WhereIF(ObjUtils.IsNotNullOrWhiteSpace(equipCode), it => it.EquipCode == equipCode)
.ToPageList(req.PageNum, req.PageSize, ref totalCount);
PageResult<EquipAlarmProcessRecord> result = new PageResult<EquipAlarmProcessRecord>()
{
PageNum = req.PageNum,
PageSize = req.PageSize,
ToTal = totalCount,
Rows = list
};
return Result<PageResult<EquipAlarmProcessRecord>>.Success(result);
}
}