80 lines
2.2 KiB
C#
80 lines
2.2 KiB
C#
using Infrastructure.Attribute;
|
|
using Infrastructure.Extensions;
|
|
using RIZO.Model.MES.alarm;
|
|
using RIZO.Model.MES.alarm.Dto;
|
|
using RIZO.Repository;
|
|
using RIZO.Service.MES.alarm.IService;
|
|
|
|
namespace RIZO.Service.MES.alarm
|
|
{
|
|
/// <summary>
|
|
/// PLC报警信息Service业务层处理
|
|
/// </summary>
|
|
[AppService(ServiceType = typeof(IAlarmInfoService), ServiceLifetime = LifeTime.Transient)]
|
|
public class AlarmInfoService : BaseService<AlarmInfo>, IAlarmInfoService
|
|
{
|
|
/// <summary>
|
|
/// 查询PLC报警信息列表
|
|
/// </summary>
|
|
/// <param name="parm"></param>
|
|
/// <returns></returns>
|
|
public PagedInfo<AlarmInfoDto> GetList(AlarmInfoQueryDto parm)
|
|
{
|
|
var predicate = QueryExp(parm);
|
|
|
|
var response = Queryable()
|
|
.Where(predicate.ToExpression())
|
|
.ToPage<AlarmInfo, AlarmInfoDto>(parm);
|
|
|
|
return response;
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// 获取详情
|
|
/// </summary>
|
|
/// <param name="Id"></param>
|
|
/// <returns></returns>
|
|
public AlarmInfo GetInfo(int Id)
|
|
{
|
|
var response = Queryable()
|
|
.Where(x => x.Id == Id)
|
|
.First();
|
|
|
|
return response;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 添加PLC报警信息
|
|
/// </summary>
|
|
/// <param name="model"></param>
|
|
/// <returns></returns>
|
|
public AlarmInfo AddAlarmInfo(AlarmInfo model)
|
|
|
|
{
|
|
return Insertable(model).ExecuteReturnEntity();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 修改PLC报警信息
|
|
/// </summary>
|
|
/// <param name="model"></param>
|
|
/// <returns></returns>
|
|
public int UpdateAlarmInfo(AlarmInfo model)
|
|
{
|
|
return Update(model, true);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 查询导出表达式
|
|
/// </summary>
|
|
/// <param name="parm"></param>
|
|
/// <returns></returns>
|
|
private static Expressionable<AlarmInfo> QueryExp(AlarmInfoQueryDto parm)
|
|
{
|
|
var predicate = Expressionable.Create<AlarmInfo>();
|
|
|
|
return predicate;
|
|
}
|
|
}
|
|
} |