using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using QMAPP.BLL;
using QMFrameWork.Data;
using QMAPP.FJC.Entity.Operation;
using QMAPP.KB.Entity;
using QMAPP.FJC.DAL.WIPManage;
using QMAPP.FJC.BLL.Dict;
using QMFrameWork.Log;
using QMAPP.FJC.Entity;
using System.Data;
namespace QMAPP.FJC.BLL.WIPManage
{
///
/// 模块编号:M7-5
/// 作 用:滞留品查询逻辑层
/// 作 者:王丹丹
/// 编写日期:2015年06月26日
///
public class DetentionBLL : BaseBLL
{
#region 获取列表
///
/// 获取列表
///
/// 条件
/// 数据页
/// 数据页
public DataResult GetList(Main condition, DataPage page)
{
DataResult result = new DataResult();
try
{
DataPage dataPage = new DetentionDAL().GetList(condition, page);
#region 转换加工阶段、是否合格、高低配、颜色显示类型
List List = dataPage.Result as List;
DictManageBLL dictOperateStateBll = new DictManageBLL(DictKind.OPERATESTATE);
DictManageBLL dictProductStatusBll = new DictManageBLL(DictKind.PRODUCTSTATUS);
DictManageBLL dictHAndLBll = new DictManageBLL(DictKind.HAndL);
DictManageBLL dictColorBll = new DictManageBLL(DictKind.COLOR);
foreach (Main m in List)
{
//加工阶段
m.PROCESSSTATETXT = dictOperateStateBll.GetDictValue(m.PROCESSSTATE);
//是否合格
m.STATUSTXT = dictProductStatusBll.GetDictValue(m.STATUS);
//高低配
m.HBTXT = dictHAndLBll.GetDictValue(m.HB);
//颜色
m.COLORTXT = dictColorBll.GetDictValue(m.COLOR);
m.COMPLETEDATE = (m.COMPLETETIME == System.DateTime.MinValue) ? ""
: (m.COMPLETETIME.ToString("yyyy-MM-dd HH:mm:ss"));
}
#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(Main model)
{
DataResult result = new DataResult();
try
{
DataTable dt = new DetentionDAL().GetExportData(model);
#region 转换加工阶段、是否合格、高低配、颜色显示类型
DictManageBLL dictOperateStateBll = new DictManageBLL(DictKind.OPERATESTATE);
DictManageBLL dictProductStatusBll = new DictManageBLL(DictKind.PRODUCTSTATUS);
DictManageBLL dictHAndLBll = new DictManageBLL(DictKind.HAndL);
DictManageBLL dictColorBll = new DictManageBLL(DictKind.COLOR);
foreach (DataRow item in dt.Rows)
{
//加工阶段
item["PROCESSSTATE"] = dictOperateStateBll.GetDictValue(item["PROCESSSTATE"].ToString());
//是否合格
item["STATUS"] = dictProductStatusBll.GetDictValue(item["STATUS"].ToString());
//高低配
item["HB"] = dictHAndLBll.GetDictValue(item["HB"].ToString());
//颜色
item["COLOR"] = dictColorBll.GetDictValue(item["COLOR"].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
}
}