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.
144 lines
4.7 KiB
144 lines
4.7 KiB
4 years ago
|
using System;
|
||
|
using System.Collections.Generic;
|
||
|
using System.Linq;
|
||
|
using QMAPP.BLL;
|
||
|
using QMAPP.Entity;
|
||
|
using QMAPP.FJC.BLL.Basic;
|
||
|
using QMAPP.FJC.DAL.EM;
|
||
|
using QMAPP.FJC.Entity.Basic;
|
||
|
using QMAPP.FJC.Entity.Equipment;
|
||
|
using QMFrameWork.Data;
|
||
|
using QMFrameWork.Log;
|
||
|
using Resource = QMAPP.FJC.Entity.Resource;
|
||
|
|
||
|
namespace QMAPP.FJC.BLL.Equipment
|
||
|
{
|
||
|
public class UsageLogBLL : BaseBLL
|
||
|
{
|
||
|
#region 获取信息
|
||
|
/// <summary>
|
||
|
/// 获取信息
|
||
|
/// </summary>
|
||
|
/// <param name="">条件</param>
|
||
|
/// <returns>信息</returns>
|
||
|
public DataResult<UsageLogEntity> Get(UsageLogEntity model)
|
||
|
{
|
||
|
DataResult<UsageLogEntity> result = new DataResult<UsageLogEntity>();
|
||
|
try
|
||
|
{
|
||
|
result.Result = new UsageLogDAL().Get(model);
|
||
|
}
|
||
|
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 获取列表
|
||
|
/// <summary>
|
||
|
/// 获取列表
|
||
|
/// </summary>
|
||
|
/// <param name="condition">条件</param>
|
||
|
/// <param name="page">数据页</param>
|
||
|
/// <returns>数据页</returns>
|
||
|
public DataResult<DataPage> GetList(UsageLogEntity condition, DataPage page)
|
||
|
{
|
||
|
DataResult<DataPage> result = new DataResult<DataPage>();
|
||
|
try
|
||
|
{
|
||
|
DataPage dataPage = new UsageLogDAL().GetList(condition, page);
|
||
|
|
||
|
#region 转换设备状态、接收控制指令、工序类别显示类型
|
||
|
List<UsageLogEntity> InfoList = dataPage.Result as List<UsageLogEntity>;
|
||
|
var mouldList = new MouldBLL().GetAllList(new Mould());
|
||
|
var machineInfoList = new MachineInfoBLL().GetAllList(new MachineInfo());
|
||
|
foreach (UsageLogEntity m in InfoList)
|
||
|
{
|
||
|
//模具
|
||
|
var mould = mouldList.FirstOrDefault(x => x.PID == m.MOULD_PID);
|
||
|
if (mould != null)
|
||
|
{
|
||
|
m.MOULD_PID_TXT = mould.MOULD_NAME;
|
||
|
m.MOULD_PID = mould.MOULD_CODE;
|
||
|
}
|
||
|
|
||
|
//设备
|
||
|
var machineInfo = machineInfoList.FirstOrDefault(x => x.PID == m.MACHINE_PID);
|
||
|
if (machineInfo != null)
|
||
|
{
|
||
|
m.MACHINE_PID_TXT = machineInfo.MACHINENAME;
|
||
|
m.MACHINE_PID = machineInfo.MACHINECODDE;
|
||
|
}
|
||
|
}
|
||
|
//查询磨具号
|
||
|
if (!string.IsNullOrEmpty(condition.MOULD_PID))
|
||
|
{
|
||
|
dataPage.Result = InfoList.Where(x => x.MOULD_PID.Contains(condition.MOULD_PID)).ToList();
|
||
|
}
|
||
|
#endregion
|
||
|
|
||
|
result.Result = dataPage;
|
||
|
}
|
||
|
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
|
||
|
|
||
|
/// <summary>
|
||
|
/// 获取列表
|
||
|
/// </summary>
|
||
|
/// <param name="condition">条件</param>
|
||
|
/// <param name="page">数据页</param>
|
||
|
/// <returns>数据页</returns>
|
||
|
public DataResult<DataPage> GetCountList(UsageLogEntity condition, DataPage page)
|
||
|
{
|
||
|
DataResult<DataPage> result = new DataResult<DataPage>();
|
||
|
try
|
||
|
{
|
||
|
DataPage dataPage = new UsageLogDAL().GetCountList(condition, page);
|
||
|
result.Result = dataPage;
|
||
|
}
|
||
|
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;
|
||
|
}
|
||
|
|
||
|
|
||
|
}
|
||
|
}
|
||
|
|