using System;
using System.Collections.Generic;
using System.Data;
using QMAPP.BLL;
using QMAPP.FJC.BLL.Dict;
using QMAPP.FJC.DAL.EquipMentAlarmManage;
using QMAPP.FJC.Entity;
using QMAPP.FJC.Entity.WarnManage;
using QMAPP.KB.Entity;
using QMFrameWork.Data;
using QMFrameWork.Log;
namespace QMAPP.FJC.BLL.WarnManage
{
///
/// 模块编号:M6-2
/// 作 用:设备停机记录查询
/// 作 者:王丹丹
/// 编写日期:2015年06月18日
///
public class EquipMentMaintainSearchBLL : BaseBLL
{
#region 获取列表
///
/// 获取列表
///
/// 条件
/// 数据页
/// 数据页
public DataResult GetList(EquipMentMaintain condition, DataPage page)
{
DataResult result = new DataResult();
try
{
DataPage dataPage = new EquipMentMaintainDAL().GetList(condition, page);
#region 转换报警类别、工序类别显示类型
List List = dataPage.Result as List;
DictManageBLL dictAlarmTypeBll = new DictManageBLL(DictKind.WARNTYPE);
DictManageBLL dictProcessTypeBll = new DictManageBLL(DictKind.PROCESSTYPE);
foreach (EquipMentMaintain m in List)
{
//报警类别
m.WARNTYPE = dictAlarmTypeBll.GetDictValue(m.WARNTYPE);
//工序类别
m.PROCESSTYPE = dictProcessTypeBll.GetDictValue(m.PROCESSTYPE);
}
#endregion
result.Result = dataPage;
}
catch (Exception ex)
{
LogManager.LogHelper.Error(new LogInfo()
{
ErrorInfo = ex,
Tag = ex.StackTrace,
Info = "设备停机记录查询-获取列表!"
});
result.IsSuccess = false;
result.Msg = Resource.SystemException;
throw ex;
}
result.IsSuccess = true;
return result;
}
#endregion
#region 导出数据
///
/// 获取导出的数据
///
/// 查询条件
/// 数据
public DataResult GetExportData(EquipMentMaintain model)
{
DataResult result = new DataResult();
try
{
DataTable dt = new EquipMentMaintainDAL().GetExportData(model);
#region 转换报警类别、工序类别显示类型
DictManageBLL dictAlarmTypeBll = new DictManageBLL(DictKind.WARNTYPE);
DictManageBLL dictProcessTypeBll = new DictManageBLL(DictKind.PROCESSTYPE);
foreach (DataRow item in dt.Rows)
{
//报警类别
item["WARNTYPE"] = dictAlarmTypeBll.GetDictValue(item["WARNTYPE"].ToString());
//工序类别
item["PROCESSTYPE"] = dictProcessTypeBll.GetDictValue(item["PROCESSTYPE"].ToString());
}
#endregion
result.Result = dt;
}
catch (Exception ex)
{
LogManager.LogHelper.Error(new LogInfo()
{
ErrorInfo = ex,
Tag = ex.StackTrace,
Info = "设备停机记录查询-导出数据!"
});
result.IsSuccess = false;
result.Msg = Resource.SystemException;
throw ex;
}
result.IsSuccess = true;
return result;
}
#endregion
}
}