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.
161 lines
5.6 KiB
161 lines
5.6 KiB
4 years ago
|
using System;
|
||
|
using System.Collections.Generic;
|
||
|
using System.Linq;
|
||
|
using System.Text;
|
||
|
using QMAPP.Entity;
|
||
|
using QMAPP.BLL;
|
||
|
using QMAPP.FJC.Entity.FeedInManage;
|
||
|
using QMFrameWork.Data;
|
||
|
using QMFrameWork.Log;
|
||
|
using System.Data;
|
||
|
using QMAPP.FJC.DAL.WIPManage;
|
||
|
using QMAPP.FJC.Entity;
|
||
|
|
||
|
namespace QMAPP.FJC.BLL.WIPManage
|
||
|
{
|
||
|
/// <summary>
|
||
|
/// 20171023gzf
|
||
|
/// </summary>
|
||
|
public class WIPProductCountBLL : BaseBLL
|
||
|
{
|
||
|
#region 获取列表
|
||
|
/// <summary>
|
||
|
/// 获取列表
|
||
|
/// </summary>
|
||
|
/// <param name="condition">条件</param>
|
||
|
/// <param name="page">数据页</param>
|
||
|
/// <returns>数据页</returns>
|
||
|
public DataResult<DataPage> GetList(Epidermis condition, DataPage page)
|
||
|
{
|
||
|
DataResult<DataPage> result = new DataResult<DataPage>();
|
||
|
try
|
||
|
{
|
||
|
//获取信息列表
|
||
|
page = new WIPProductCountDAL().GetList(condition, page);
|
||
|
|
||
|
#region 转换状态显示类型
|
||
|
//List<Epidermis> fisOrderList = page.Result as List<Epidermis>;
|
||
|
////处理字典信息
|
||
|
//DictManageBLL dictSCANSTATE = new DictManageBLL(DictKind.SCANSTATE);
|
||
|
|
||
|
//foreach (var info in fisOrderList)
|
||
|
//{
|
||
|
// info.SCANSTATE = dictSCANSTATE.GetDictValue(info.SCANSTATE);
|
||
|
//}
|
||
|
#endregion
|
||
|
|
||
|
result.Result = page;
|
||
|
}
|
||
|
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;
|
||
|
}
|
||
|
|
||
|
/// <summary>
|
||
|
/// 查询注塑件数量
|
||
|
/// </summary>
|
||
|
/// <param name="materialtype"></param>
|
||
|
/// <param name="materialcode"></param>
|
||
|
/// <returns></returns>
|
||
|
public DataResult<DataPage> GetPlasticPartCount(string materialtype, string materialcode,DataPage page)
|
||
|
{
|
||
|
DataResult<DataPage> result = new DataResult<DataPage>();
|
||
|
try
|
||
|
{
|
||
|
var dal=new WIPProductCountDAL();
|
||
|
//获取信息列表
|
||
|
var list = dal.GetIMSCount(materialtype, materialcode,page);
|
||
|
var partusingcount = dal.GetPlasticPartUsingCount(materialtype, materialcode);
|
||
|
var partscrapcount = dal.GetPlasticPartScrapCount(materialtype, materialcode);
|
||
|
var partcounting = dal.GetPlasticPartCounting(materialtype, materialcode);
|
||
|
var partout = dal.GetPlasticPartOut(materialtype, materialcode);
|
||
|
|
||
|
|
||
|
|
||
|
foreach (var imscount in list.Result as List<Epidermis>)
|
||
|
{
|
||
|
var usecount=partusingcount.FirstOrDefault(p=>p.MATERIAL_CODE==imscount.MATERIAL_CODE);
|
||
|
if (usecount != null)
|
||
|
{
|
||
|
imscount.CAPACITY = imscount.CAPACITY - usecount.USINGCOUNT;
|
||
|
}
|
||
|
var scrapcount = partscrapcount.FirstOrDefault(p => p.MATERIAL_CODE == imscount.MATERIAL_CODE);
|
||
|
if (scrapcount != null)
|
||
|
{
|
||
|
imscount.CAPACITY = imscount.CAPACITY - scrapcount.USINGCOUNT;
|
||
|
}
|
||
|
var counting = partcounting.FirstOrDefault(p => p.MATERIAL_CODE == imscount.MATERIAL_CODE);
|
||
|
if (counting != null)
|
||
|
{
|
||
|
imscount.CAPACITY = imscount.CAPACITY + counting.USINGCOUNT;
|
||
|
}
|
||
|
var outcount = partout.FirstOrDefault(p => p.MATERIAL_CODE == imscount.MATERIAL_CODE);
|
||
|
if (outcount != null)
|
||
|
{
|
||
|
imscount.CAPACITY = imscount.CAPACITY - outcount.USINGCOUNT;
|
||
|
}
|
||
|
imscount.UNUSED = (imscount.CAPACITY).ToString();
|
||
|
}
|
||
|
|
||
|
result.Result = list;
|
||
|
}
|
||
|
catch (Exception ex)
|
||
|
{
|
||
|
LogManager.LogHelper.Error(new LogInfo()
|
||
|
{
|
||
|
ErrorInfo = ex,
|
||
|
Tag = ex.StackTrace
|
||
|
});
|
||
|
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(Epidermis model)
|
||
|
{
|
||
|
DataResult<DataTable> result = new DataResult<DataTable>();
|
||
|
try
|
||
|
{
|
||
|
result.IsSuccess = true;
|
||
|
result.Result = new WIPProductCountDAL().GetExportData(model);
|
||
|
}
|
||
|
catch (Exception ex)
|
||
|
{
|
||
|
LogManager.LogHelper.Error(new LogInfo()
|
||
|
{
|
||
|
ErrorInfo = ex,
|
||
|
Tag = ex.StackTrace,
|
||
|
Info = "在制品统计信息导出错误!"
|
||
|
});
|
||
|
result.IsSuccess = false;
|
||
|
result.Msg = "在制品统计信息导出错误!";
|
||
|
}
|
||
|
return result;
|
||
|
}
|
||
|
#endregion
|
||
|
}
|
||
|
}
|