using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using QMFrameWork.Common.Encrypt;
using QMFrameWork.Data;
using QMAPP.FJC.DAL.Operation;
using QMAPP.FJC.Entity.Operation;
using QMAPP.BLL;
using QMAPP.Entity;
using QMAPP.FJC.Entity.ProduceManage;
using QMAPP.FJC.BLL.Dict;
using QMAPP.FJC.BLL.Basic;
using QMAPP.Entity;
using QMFrameWork.Log;
using QMAPP.FJC.Entity.Injection;
using QMAPP.FJC.DAL.FeedInManage;
namespace QMAPP.FJC.BLL.Operation
{
///
/// 模块编号:
/// 作 用:成品信息查询
/// 作 者:郭兆福
/// 编写日期:2018年03月12日
///
public class ProductEndBLL : BaseBLL
{
#region 成品信息查询
#region 获取信息
///
/// 获取信息
///
/// 条件
/// 信息
public ProductEnd Get(ProductEnd model)
{
try
{
return new ProductEndDAL().Get(model);
}
catch (Exception ex)
{
throw ex;
}
}
///
/// 获取信息
///
/// 条件
/// 信息
//public ProductEnd GetByCondition(ProductEnd model)
//{
// try
// {
// List list = new ProductEndDAL().GetList(model);
// if (list.Count > 0)
// {
// return list[0];
// }
// return null;
// }
// catch (Exception ex)
// {
// throw ex;
// }
//}
public QMAPP.FJC.Entity.Basic.MaterialCodeInit GetMaterialSetByCondition(QMAPP.FJC.Entity.Basic.MaterialCodeInit condition)
{
return new QMAPP.FJC.DAL.Basic.MaterialCodeInitDAL().GetByCondition(condition);
}
#endregion
#region 获取列表
///
/// 获取列表
///
/// 条件
/// 数据页
/// 数据页
public DataResult GetList(ProductEnd condition, DataPage page)
{
DataResult result = new DataResult();
try
{
result.IsSuccess = true;
page = new ProductEndDAL().GetAllList(condition, page);
List list = page.Result as List;
//处理字典信息
DictManageBLL dictPROCESSTYPE = new DictManageBLL(DictKind.PROCESSTYPE);
DictManageBLL dictColor = new DictManageBLL(DictKind.COLOR);
DictManageBLL dictSTATUS = new DictManageBLL(DictKind.LJSTATUS);
DictManageBLL dictOUTFLAG = new DictManageBLL(DictKind.OUTFLAG);
DictManageBLL dictHL = new DictManageBLL(DictKind.HAndL);
DictManageBLL dictYN = new DictManageBLL(DictKind.ValidFlg);
foreach (var info in list)
{
//替换工序类别显示值
info.CURRENTPROCESS = dictPROCESSTYPE.GetDictValue(info.CURRENTPROCESS);
//替换零件类别显示值
info.COLOR = dictColor.GetDictValue(info.COLOR);
//替换零件类别显示值
info.STATUS = dictSTATUS.GetDictValue(info.STATUS);
//替换出库标记显示值
info.OUTFLAG = dictOUTFLAG.GetDictValue(info.OUTFLAG);
//替换使用状态显示值
info.HB = dictHL.GetDictValue(info.HB);
//info.COMPLETEFLAG = dictYN.GetDictValue(info.COMPLETEFLAG);
////info.COMPLETETIMESTR = dictColor.GetDictValue(info.COLOR);
//info.COMPLETEDATE = (info.COMPLETETIME == System.DateTime.MinValue) ? ""
// : info.COMPLETETIME.ToString("yyyy-MM-dd HH:mm:ss");
}
page.Result = list;
result.Result = page;
}
catch (Exception ex)
{
LogManager.LogHelper.Error(new LogInfo()
{
ErrorInfo = ex,
Tag = ex.StackTrace,
Info = "本体信息获取列表错误!"
});
result.IsSuccess = false;
result.Msg = "本体信息获取列表错误!";
}
return result;
}
///
/// 获取列表
///
/// 条件
/// 全部数据
//public List GetAllList(ProductEnd condition)
//{
// try
// {
// return new ProductEndDAL().GetList(condition);
// }
// catch (Exception ex)
// {
// throw ex;
// }
//}
#endregion
#region 加载零件列表
///
/// 加载零件列表11111111111
///
/// 条件
/// 数据页
public DataResult> GetListWithProduct(ProductEnd condition)
{
DataResult> result = new DataResult>();
result.IsSuccess = true;
try
{
result.Result = new ProductEndDAL().GetListWithProduct(condition);
}
catch (Exception ex)
{
throw ex;
}
return result;
}
#endregion
#region 导出数据
///
/// 获取导出的数据
///
/// 查询条件
/// 数据
public DataResult GetExportData(ProductEnd model)
{
DataResult result = new DataResult();
result.IsSuccess = true;
try
{
result.Result = new ProductEndDAL().GetExportData(model);
//处理字典信息
DictManageBLL dictPROCESSTYPE = new DictManageBLL(DictKind.PROCESSTYPE);
DictManageBLL dictColor = new DictManageBLL(DictKind.COLOR);
DictManageBLL dictSTATUS = new DictManageBLL(DictKind.LJSTATUS);
DictManageBLL dictOUTFLAG = new DictManageBLL(DictKind.OUTFLAG);
DictManageBLL dictHL = new DictManageBLL(DictKind.HAndL);
DictManageBLL dictYN = new DictManageBLL(DictKind.ValidFlg);
foreach (DataRow dr in result.Result.Rows)
{
//替换工序类别显示值
//dr["CURRENTPROCESS"] = dictPROCESSTYPE.GetDictValue(dr["CURRENTPROCESS"].ToString());
//替换零件类别显示值
dr["COLOR"] = dictColor.GetDictValue(dr["COLOR"].ToString());
//替换零件类别显示值
dr["STATUS"] = dictSTATUS.GetDictValue(dr["STATUS"].ToString());
//替换出库标记显示值
dr["OUTFLAG"] = dictOUTFLAG.GetDictValue(dr["OUTFLAG"].ToString());
//替换使用状态显示值
dr["HB"] = dictHL.GetDictValue(dr["HB"].ToString());
}
}
catch (Exception ex)
{
throw ex;
}
return result;
}
#endregion
#endregion
}
}