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