天津投入产出系统后端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

134 lines
4.9 KiB

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
{
/// <summary>
/// 模块编号:M7-5
/// 作 用:滞留品查询逻辑层
/// 作 者:王丹丹
/// 编写日期:2015年06月26日
///</summary>
public class DetentionBLL : BaseBLL
{
#region 获取列表
/// <summary>
/// 获取列表
/// </summary>
/// <param name="condition">条件</param>
/// <param name="page">数据页</param>
/// <returns>数据页</returns>
public DataResult<DataPage> GetList(Main condition, DataPage page)
{
DataResult<DataPage> result = new DataResult<DataPage>();
try
{
DataPage dataPage = new DetentionDAL().GetList(condition, page);
#region 转换加工阶段、是否合格、高低配、颜色显示类型
List<Main> List = dataPage.Result as List<Main>;
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 导出数据
/// <summary>
/// 获取导出的数据
/// </summary>
/// <param name="user">查询条件</param>
/// <returns>数据</returns>
public DataResult<DataTable> GetExportData(Main model)
{
DataResult<DataTable> result = new DataResult<DataTable>();
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
}
}