using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using QMAPP.BLL;
using QMAPP.KB.Entity;
using QMFrameWork.Data;
using QMAPP.FJC.Entity.WIPManage;
using QMFrameWork.Log;
using QMAPP.FJC.Entity;
using QMAPP.FJC.DAL.WIPManage;
using QMAPP.FJC.Entity.Produce;
using QMAPP.FJC.BLL.Dict;
using QMAPP.FJC.Entity.Basic;
using QMAPP.FJC.BLL.Basic;
using System.Data;
namespace QMAPP.FJC.BLL.WIPManage
{
///
/// 模块编号:M7-1
/// 作 用:在制品库存
/// 作 者:王济
/// 编写日期:2015年07月06日
///
public class WIPInventoryBLL : BaseBLL
{
#region 获取列表
///
/// 获取列表
///
/// 条件
/// 数据页
/// 数据页
public DataResult GetList(Product condition, DataPage page)
{
DataResult result = new DataResult();
try
{
DataPage dataPage = new WIPInventoryDAL().GetList(condition, page);
#region 转换记录状态
List materielList = dataPage.Result as List;
DictManageBLL dictStatusBll = new DictManageBLL(DictKind.STATUS);
DictManageBLL dictUsingStateBll = new DictManageBLL(DictKind.USINGSTATE);
DictManageBLL dictOutFlagBll = new DictManageBLL(DictKind.OUTFLAG);
foreach (Product m in materielList)
{
//零件状态
m.STATUS = dictStatusBll.GetDictValue(m.STATUS);
//使用状态
m.USINGSTATE = dictUsingStateBll.GetDictValue(m.USINGSTATE);
//出库状态
m.OUTFLAG = dictOutFlagBll.GetDictValue(m.OUTFLAG);
}
#endregion
result.Result = dataPage;
result.IsSuccess = true;
return result;
}
catch (Exception ex)
{
LogManager.LogHelper.Error(new LogInfo()
{
ErrorInfo = ex,
Tag = ex.StackTrace,
Info = "在制品库存逻辑层-获取列表!"
});
result.IsSuccess = false;
result.Msg = Resource.SystemException;
throw ex;
}
}
#endregion
#region 导出数据
///
/// 获取导出的数据
///
/// 查询条件
/// 数据
public DataResult GetExportData(Product model)
{
DataResult result = new DataResult();
try
{
DataTable dt = new WIPInventoryDAL().GetExportData(model);
#region 转换字典
DictManageBLL dictStatusBll = new DictManageBLL(DictKind.STATUS);
DictManageBLL dictUsingStateBll = new DictManageBLL(DictKind.USINGSTATE);
DictManageBLL dictOutFlagBll = new DictManageBLL(DictKind.OUTFLAG);
foreach (DataRow item in dt.Rows)
{
item["STATUS"] = dictStatusBll.GetDictValue(item["STATUS"].ToString());
item["USINGSTATE"] = dictUsingStateBll.GetDictValue(item["USINGSTATE"].ToString());
item["OUTFLAG"] = dictOutFlagBll.GetDictValue(item["OUTFLAG"].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
#region 获取工序合集
///
/// 获取工序合集
///
/// 条件
/// *信息
public List GetProcessSetList(ProcessInfo model)
{
try
{
//获取设备信息集合
return new ProcessInfoBLL().GetAllList(model);
}
catch (Exception ex)
{
LogManager.LogHelper.Error(new LogInfo()
{
ErrorInfo = ex,
Tag = ex.StackTrace,
Info = "在制品库存逻辑层-获取班次信息集合!"
});
throw ex;
}
}
#endregion
#region 获取零件合集
///
/// 获取工序合集
///
/// 条件
/// *信息
public List GetProductSetList(ProductBasic model)
{
try
{
//获取设备信息集合
return new ProductBasicBLL().GetAllList(model);
}
catch (Exception ex)
{
LogManager.LogHelper.Error(new LogInfo()
{
ErrorInfo = ex,
Tag = ex.StackTrace,
Info = "在制品库存逻辑层-获取班次信息集合!"
});
throw ex;
}
}
#endregion
}
}