using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using QMAPP.MESReport.Entity.LineQTY;
using QMAPP.MESReport.DAL.LineQTY;
using QMAPP.BLL;
using QMFrameWork.Data;
using QMAPP.Entity;
using System.Data;
using QMAPP.MESReport.Entity.Tables;
using QMAPP.FJC.BLL.Dict;
namespace QMAPP.MESReport.BLL.LineQTY
{
public class ShipmentCountBLL : BaseBLL
{
#region 生产发运统计
///
/// 生产发运统计
///
///
///
public DataResult> GetMainList(ShipmentCountConditionModel condition)
{
DataResult> result = new DataResult>();
try
{
if (condition.WORKCENTER_CODE.Contains("IP") == false)
{
result.Result = new ShipmentCountDAL().GetDPList(condition);
List list = result.Result;
DictManageBLL dictColor = new DictManageBLL(DictKind.COLOR);
DictManageBLL dictHL = new DictManageBLL(DictKind.HAndL);
foreach (var s in list)
{
s.MATERIAL_CODE = dictColor.GetDictValue(s.MATERIAL_CODE);
s.MATERIAL_NAME = (string.IsNullOrEmpty(dictHL.GetDictValue(s.MATERIAL_NAME))) ? "低配" : dictHL.GetDictValue(s.MATERIAL_NAME);
}
}
else
{
result.Result = new ShipmentCountDAL().GetIPList(condition);
}
result.IsSuccess = true;
return result;
}
catch (Exception ex)
{
result.IsSuccess = false;
result.Msg = ex.ToString();
return result;
}
}
#endregion
#region 获取物料产品列表
///
/// 获取物料产品列表
///
///
///
public DataResult> GetWList()
{
DataResult> result = new DataResult>();
try
{
result.Result = new ShipmentCountDAL().GetWList();
result.IsSuccess = true;
return result;
}
catch (Exception ex)
{
result.IsSuccess = false;
result.Msg = ex.ToString();
return result;
}
}
#endregion
#region 导出数据
///
/// 获取导出的数据
///
/// 查询条件
/// 数据
public DataResult GetExportData(ShipmentCountConditionModel model)
{
DataResult result = new DataResult();
try
{
result.IsSuccess = true;
result.Result = new ShipmentCountDAL().GetExportData(model);
if (model.WORKCENTER_CODE == "DPLFY/DPRFY")
{
foreach (DataRow dr in result.Result.Rows)
{
DictManageBLL dictColor = new DictManageBLL(DictKind.COLOR);
DictManageBLL dictHL = new DictManageBLL(DictKind.HAndL);
dr["MATERIAL_CODE"] = dictColor.GetDictValue(dr["MATERIAL_CODE"].ToString());
dr["MATERIAL_NAME"] = (string.IsNullOrEmpty(dictHL.GetDictValue(dr["MATERIAL_NAME"].ToString()))) ? "低配" : dictHL.GetDictValue(dr["MATERIAL_NAME"].ToString());
dr["MaterialValue"]=dr["MATERIAL_NAME"].ToString()+dr["MATERIAL_CODE"].ToString();
}
}
}
catch (Exception ex)
{
result.IsSuccess = false;
result.Msg = "导出错误!";
}
return result;
}
#endregion
}
}