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

282 lines
8.8 KiB

using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using QMFrameWork.Common.Encrypt;
using QMFrameWork.Data;
using QMAPP.FJC.DAL.Injection;
using QMAPP.FJC.Entity.Injection;
using QMAPP.BLL;
using QMAPP.FJC.BLL.Dict;
using QMAPP.Entity;
using QMAPP.FJC.Entity.Basic;
using QMAPP.FJC.BLL.Basic;
using QMAPP.FJC.Entity;
using QMAPP.FJC.DAL.Basic;
using QMFrameWork.Log;
namespace QMAPP.FJC.BLL.Injection
{
/// <summary>
/// 模块编号:M3-2
/// 作 用:浇注投料记录逻辑层
/// 作 者:王庆男
/// 编写日期:2015年08月31日
///</summary>
public class PouringRecorderBLL : BaseBLL
{
#region 获取信息
/// <summary>
/// 获取信息
/// </summary>
/// <param name="">条件</param>
/// <returns>信息</returns>
public InjectionRecorder Get(InjectionRecorder model)
{
try
{
return new InjectionRecorderDAL().Get(model);
}
catch (Exception ex)
{
LogManager.LogHelper.Error(new LogInfo()
{
ErrorInfo = ex,
Tag = ex.StackTrace,
Info = "浇注投料记录逻辑层-获取信息!"
});
throw ex;
}
}
#endregion
#region 获取列表
/// <summary>
/// 获取列表
/// </summary>
/// <param name="condition">条件</param>
/// <param name="page">数据页</param>
/// <returns>数据页</returns>
public DataPage GetRecordList(InjectionRecorder condition, DataPage page)
{
try
{
//获取信息列表
DataPage dataPage = new InjectionRecorderDAL().GetInjectionRecordList(condition, page);
#region 转换物料类别、设备分类、工序类别显示类型
List<InjectionRecorder> recorderList = dataPage.Result as List<InjectionRecorder>;
DictManageBLL dictIJMTypeBll = new DictManageBLL(DictKind.INJECTIONMATERIALTYPE);
DictManageBLL dictProcessTypeBll = new DictManageBLL(DictKind.PROCESSTYPE);
DictManageBLL dictMachineTypeBll = new DictManageBLL(DictKind.MACHINETYPE);
foreach (InjectionRecorder m in recorderList)
{
//物料类别
m.MATERIALTYPETXT = dictIJMTypeBll.GetDictValue(m.MATERIALTYPE);
//工序类别
m.PROCESSTYPETXT = dictProcessTypeBll.GetDictValue(m.PROCESSTYPE);
//设备分类
m.MACHINETYPETXT = dictMachineTypeBll.GetDictValue(m.MACHINETYPE);
}
#endregion
return dataPage;
}
catch (Exception ex)
{
LogManager.LogHelper.Error(new LogInfo()
{
ErrorInfo = ex,
Tag = ex.StackTrace,
Info = "浇注投料记录逻辑层-获取列表!"
});
throw ex;
}
}
#endregion
#region 更新信息
/// <summary>
/// 更新信息
/// </summary>
/// <param name=""></param>
/// <returns>更新行数</returns>
public DataResult<int> Update(InjectionRecorder model)
{
DataResult<int> result = new DataResult<int>();
try
{
//基本信息
model.UPDATEUSER = this.LoginUser.UserID;
result.Result= new InjectionRecorderDAL().Update(model);
result.IsSuccess = true;
result.Msg = Resource.MsgSuccess;
}
catch (Exception ex)
{
LogManager.LogHelper.Error(new LogInfo()
{
ErrorInfo = ex,
Tag = ex.StackTrace,
Info = "浇注投料记录逻辑层-更新信息!"
});
result.IsSuccess = false;
result.Msg = Resource.SystemException;
}
return result;
}
#endregion
#region 删除
/// <summary>
/// 删除信息
/// </summary>
/// <param name=""></param>
/// <returns>删除个数</returns>
public int Delete(string strs)
{
int count = 0;
string[] list = strs.Split(":".ToCharArray());
InjectionRecorder model = new InjectionRecorder();
try
{
//判断记录是否可删除
foreach (var item in list)
{
//获取投料信息
model.PID = item;
model = Get(model);
//如果投料信息的使用重量不等于0,则不允许删除
if (model.USEDWEIGHTSUM != 0)
return -1;
}
foreach (string str in list)
{
count += this.DeleteInjectionRecorder(new InjectionRecorder { PID = str });
}
return count;
}
catch (Exception ex)
{
LogManager.LogHelper.Error(new LogInfo()
{
ErrorInfo = ex,
Tag = ex.StackTrace,
Info = "浇注投料记录逻辑层-删除!"
});
throw ex;
}
}
/// <summary>
/// 删除信息
/// </summary>
/// <param name="">信息</param>
/// <returns>删除个数</returns>
public int DeleteInjectionRecorder(InjectionRecorder model)
{
int count = 0;
try
{
count = new InjectionRecorderDAL().Delete(model);
return count;
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
#region 获取班次信息集合
/// <summary>
/// 获取班次信息集合
/// </summary>
/// <param name="">条件</param>
/// <returns>*信息</returns>
public List<ProduceShift> GetProduceShiftList(ProduceShift model)
{
try
{
//获取设备信息集合
return new ProduceShiftDAL().GetList(model);
}
catch (Exception ex)
{
LogManager.LogHelper.Error(new LogInfo()
{
ErrorInfo = ex,
Tag = ex.StackTrace,
Info = "浇注投料记录逻辑层-获取班次信息集合!"
});
throw ex;
}
}
#endregion
#region 获取设备信息集合
/// <summary>
/// 获取设备信息集合
/// </summary>
/// <param name="">条件</param>
/// <returns>*信息</returns>
public List<MachineInfo> GetMachineInfoList(MachineInfo model)
{
try
{
//获取设备信息集合
return new MachineInfoDAL().GetList(model);
}
catch (Exception ex)
{
LogManager.LogHelper.Error(new LogInfo()
{
ErrorInfo = ex,
Tag = ex.StackTrace,
Info = "浇注投料记录逻辑层-获取设备信息集合!"
});
throw ex;
}
}
#endregion
#region 更新零件投料关联表
/// <summary>
/// 更新零件投料关联表
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public DataResult<int> UpdateProductInjection(InjectionRecorder model)
{
DataResult<int> result = new DataResult<int>();
try
{
//基本信息
model.UPDATEUSER = this.LoginUser.UserID;
result.Result = new InjectionRecorderDAL().UpdateProductInjection(model);
result.IsSuccess = true;
result.Msg = Resource.MsgSuccess;
}
catch (Exception ex)
{
LogManager.LogHelper.Error(new LogInfo()
{
ErrorInfo = ex,
Tag = ex.StackTrace,
Info = "浇注投料记录逻辑层-更新零件投料关联表!"
});
result.IsSuccess = false;
result.Msg = Resource.SystemException;
}
return result;
}
#endregion
}
}