天津投入产出系统后端
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.

125 lines
4.2 KiB

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 生产发运统计
/// <summary>
/// 生产发运统计
/// </summary>
/// <param name="condition"></param>
/// <returns></returns>
public DataResult<List<ShipmentCountConditionModel>> GetMainList(ShipmentCountConditionModel condition)
{
DataResult<List<ShipmentCountConditionModel>> result = new DataResult<List<ShipmentCountConditionModel>>();
try
{
if (condition.WORKCENTER_CODE.Contains("IP") == false)
{
result.Result = new ShipmentCountDAL().GetDPList(condition);
List<ShipmentCountConditionModel> 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 获取物料产品列表
/// <summary>
/// 获取物料产品列表
/// </summary>
/// <param name="condition"></param>
/// <returns></returns>
public DataResult<List<ShipmentCountConditionModel>> GetWList()
{
DataResult<List<ShipmentCountConditionModel>> result = new DataResult<List<ShipmentCountConditionModel>>();
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 导出数据
/// <summary>
/// 获取导出的数据
/// </summary>
/// <param name="user">查询条件</param>
/// <returns>数据</returns>
public DataResult<DataTable> GetExportData(ShipmentCountConditionModel model)
{
DataResult<DataTable> result = new DataResult<DataTable>();
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
}
}