using System;
using System.Collections.Generic;
using System.Data;
using QMAPP.BLL;
using QMAPP.Entity;
using QMAPP.FJC.BLL.Dict;
using QMAPP.FJC.DAL.EquipMentAlarmManage;
using QMAPP.FJC.Entity.WarnManage;
using QMFrameWork.Data;
using QMFrameWork.Log;
namespace QMAPP.FJC.BLL.WarnManage
{
///
/// 模块编号:M6-1设备报警记录查询
/// 作 用:设备报警记录查询
/// 作 者:张敬贺
/// 编写日期:2015年06月17日
///
public class EquipMentAlarmBLL : BaseBLL
{
#region 获取列表
///
/// 获取列表
///
/// 条件
/// 数据页
/// 数据页
public DataResult GetList(WarnInfo condition, DataPage page)
{
DataResult result = new DataResult();
try
{
result.IsSuccess = true;
page = new EquipMentAlarmDAL().GetList(condition, page);
List list = page.Result as List;
//处理字典信息
DictManageBLL dictWARNTYPE = new DictManageBLL(DictKind.WARNTYPE);
DictManageBLL dictCREATETYPE = new DictManageBLL(DictKind.CREATETYPE);
DictManageBLL dictISDEAL = new DictManageBLL(DictKind.ISDEAL);
DictManageBLL dictISDONE = new DictManageBLL(DictKind.ISDONE);
foreach (var info in list)
{
//替换是否发送显示值
info.ISDEAL = dictISDEAL.GetDictValue(info.ISDEAL);
//替换是否完成显示值
info.ISDONE = dictISDONE.GetDictValue(info.ISDONE);
//替换报警类别显示值
info.WARNTYPE = dictWARNTYPE.GetDictValue(info.WARNTYPE);
//替换生成方式显示值
info.CREATETYPE = dictCREATETYPE.GetDictValue(info.CREATETYPE);
}
result.Result = page;
}
catch (Exception ex)
{
LogManager.LogHelper.Error(new LogInfo()
{
ErrorInfo = ex,
Tag = ex.StackTrace,
Info = "设备报警信息获取列表错误!"
});
result.IsSuccess = false;
result.Msg = "设备报警信息获取列表错误!";
}
return result;
}
#endregion
#region 导出数据
///
/// 获取导出的数据
///
/// 查询条件
/// 数据
public DataResult GetExportData(WarnInfo model)
{
DataResult result = new DataResult();
try
{
result.IsSuccess = true;
result.Result = new EquipMentAlarmDAL().GetExportData(model);
//处理字典信息
DictManageBLL dictPROCESSTYPE = new DictManageBLL(DictKind.PROCESSTYPE);
DictManageBLL dictWARNTYPE = new DictManageBLL(DictKind.WARNTYPE);
foreach (DataRow dr in result.Result.Rows)
{
//替换是否发送显示值
dr["ISDEAL"] = dictPROCESSTYPE.GetDictValue(dr["ISDEAL"].ToString());
//替换是否完成显示值
dr["ISDONE"] = dictWARNTYPE.GetDictValue(dr["ISDONE"].ToString());
//替换报警类别显示值
dr["WARNTYPE"] = dictWARNTYPE.GetDictValue(dr["WARNTYPE"].ToString());
//替换生成方式显示值
dr["CREATETYPE"] = dictWARNTYPE.GetDictValue(dr["CREATETYPE"].ToString());
}
}
catch (Exception ex)
{
LogManager.LogHelper.Error(new LogInfo()
{
ErrorInfo = ex,
Tag = ex.StackTrace,
Info = "设备报警信息导出错误!"
});
result.IsSuccess = false;
result.Msg = "设备报警信息导出错误!";
}
return result;
}
#endregion
}
}