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.
552 lines
18 KiB
552 lines
18 KiB
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using QMAPP.BLL;
|
|
using QMAPP.Entity;
|
|
using QMAPP.FJC.BLL.Dict;
|
|
using QMAPP.FJC.BLL.Operation;
|
|
using QMAPP.FJC.DAL.Basic;
|
|
using QMAPP.FJC.DAL.Injection;
|
|
using QMAPP.FJC.Entity;
|
|
using QMAPP.FJC.Entity.Basic;
|
|
using QMAPP.FJC.Entity.Injection;
|
|
using QMAPP.FJC.Entity.Operation;
|
|
using QMFrameWork.Data;
|
|
using QMFrameWork.Log;
|
|
namespace QMAPP.FJC.BLL.Injection
|
|
{
|
|
/// <summary>
|
|
/// 模块编号:M3-1
|
|
/// 作 用:注塑投料记录逻辑层
|
|
/// 作 者:王丹丹
|
|
/// 编写日期:2015年06月05日
|
|
///</summary>
|
|
public class InjectionRecorderBLL : 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 GetList(InjectionRecorder condition, DataPage page)
|
|
{
|
|
try
|
|
{
|
|
//获取信息列表
|
|
DataPage dataPage = new InjectionRecorderDAL().GetList(condition, page);
|
|
|
|
#region 转换操作者,入料口
|
|
List<InjectionRecorder> injectionRecorderList = dataPage.Result as List<InjectionRecorder>;
|
|
DictManageBLL dictInjectionterminalBll = new DictManageBLL(DictKind.INJECTIONTERMINAL);
|
|
DictManageBLL dictMeTypeBll = new DictManageBLL(DictKind.INJECTIONMATERIALTYPE);
|
|
foreach (InjectionRecorder m in injectionRecorderList)
|
|
{
|
|
m.INJECTIONTERMINALNAME = dictInjectionterminalBll.GetDictValue(m.INJECTIONTERMINAL.ToString("00"));
|
|
|
|
if (!string.IsNullOrEmpty(m.MATERIALTYPE))
|
|
{
|
|
m.MATERIALTYPENAME = dictMeTypeBll.GetDictValue(m.MATERIALTYPE.ToString());
|
|
}
|
|
}
|
|
|
|
#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="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="model"></param>
|
|
/// <returns></returns>
|
|
public bool ExistsInjectionRecorder(string iPid)
|
|
{
|
|
try
|
|
{
|
|
return new InjectionRecorderDAL().ExistsProductInJection(iPid);
|
|
}
|
|
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> Insert(InjectionRecorder model)
|
|
{
|
|
DataResult<int> result = new DataResult<int>();
|
|
try
|
|
{
|
|
//基本信息
|
|
model.PID = Guid.NewGuid().ToString();
|
|
model.CREATEDATE = DateTime.Now;
|
|
model.UPDATEUSER = model.CREATEUSER;
|
|
model.UPDATEDATE = model.CREATEDATE;
|
|
InjectionRecorderDAL cmdDAL = new InjectionRecorderDAL();
|
|
result.Result = new InjectionRecorderDAL().Insert(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 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 DataResult<int> Delete(string strs)
|
|
{
|
|
DataResult<int> result = new DataResult<int>();
|
|
string[] list = strs.Split(":".ToCharArray());
|
|
try
|
|
{
|
|
foreach (string str in list)
|
|
{
|
|
result.Result += this.DeleteInjectionRecorder(new InjectionRecorder { PID = str });
|
|
}
|
|
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;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 删除信息
|
|
/// </summary>
|
|
/// <param name=""></param>
|
|
/// <returns>删除个数</returns>
|
|
public DataResult<int> DeleteSingle(string str)
|
|
{
|
|
DataResult<int> result = new DataResult<int>();
|
|
|
|
try
|
|
{
|
|
ProductInjectionBLL productInjectionBLL = new ProductInjectionBLL();
|
|
if (productInjectionBLL.ExistsProductInjection(new ProductInjection { PID = str }))
|
|
{
|
|
result.IsSuccess = false;
|
|
result.Msg = Resource.InjectionIsHaving;
|
|
return result;
|
|
}
|
|
result.Result += this.DeleteInjectionRecorder(new InjectionRecorder { PID = str });
|
|
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;
|
|
}
|
|
|
|
/// <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)
|
|
{
|
|
LogManager.LogHelper.Error(new LogInfo()
|
|
{
|
|
ErrorInfo = ex,
|
|
Tag = ex.StackTrace,
|
|
Info = "原材料投料-删除信息"
|
|
});
|
|
throw ex;
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 获取班次信息集合
|
|
/// <summary>
|
|
/// 获取班次信息集合
|
|
/// </summary>
|
|
/// <param name="">条件</param>
|
|
/// <returns>*信息</returns>
|
|
public List<ProduceShift> GetProduceShiftList(ProduceShift model)
|
|
{
|
|
try
|
|
{
|
|
//获取设备信息集合
|
|
return new ProduceShiftDAL().GetList(model).ToList();
|
|
}
|
|
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
|
|
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
/// <param name="recorders"></param>
|
|
/// <returns></returns>
|
|
public bool CheckInjectMaterial(InjectionInfo recorders)
|
|
{
|
|
try
|
|
{
|
|
return new InjectionRecorderDAL().CheckInjectMaterial(recorders);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
LogManager.LogHelper.Error(new LogInfo()
|
|
{
|
|
ErrorInfo = ex,
|
|
Tag = ex.StackTrace,
|
|
Info = "原材料投料-判断零件信息是否存在"
|
|
});
|
|
throw ex;
|
|
}
|
|
}
|
|
|
|
public DataResult InsertNew(InjectionInfo model)
|
|
{
|
|
DataResult<int> result = new DataResult<int>();
|
|
try
|
|
{
|
|
//基本信息
|
|
model.PID = Guid.NewGuid().ToString();
|
|
model.CREATEDATE = DateTime.Now;
|
|
model.UPDATEUSER = model.CREATEUSER;
|
|
model.UPDATEDATE = model.CREATEDATE;
|
|
InjectionRecorderDAL cmdDAL = new InjectionRecorderDAL();
|
|
result.Result = new InjectionRecorderDAL().InsertNew(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;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 查验是否存在此批次物料(楼上)
|
|
/// </summary>
|
|
/// <param name="recorders"></param>
|
|
/// <returns></returns>
|
|
public DataResult<InjectionInfo> GetCheckInjection(InjectionInfo recorders)
|
|
{
|
|
DataResult<InjectionInfo> result = new DataResult<InjectionInfo>();
|
|
try
|
|
{
|
|
result.Result = new InjectionRecorderDAL().GetInjectMaterial(recorders);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
LogManager.LogHelper.Error(new LogInfo()
|
|
{
|
|
ErrorInfo = ex,
|
|
Tag = ex.StackTrace,
|
|
Info = "原材料投料-判断零件信息是否存在"
|
|
});
|
|
throw ex;
|
|
}
|
|
result.IsSuccess = true;
|
|
return result;
|
|
}
|
|
|
|
|
|
|
|
#region 获取料罐与孔信息集合
|
|
/// <summary>
|
|
/// 获取设备信息集合
|
|
/// </summary>
|
|
/// <param name="">条件</param>
|
|
/// <returns>*信息</returns>
|
|
public List<InjectHole> GetInjectHoleList()
|
|
{
|
|
try
|
|
{
|
|
//获取设备信息集合
|
|
return new InjectionRecorderDAL().GetInjectHoleList();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
LogManager.LogHelper.Error(new LogInfo()
|
|
{
|
|
ErrorInfo = ex,
|
|
Tag = ex.StackTrace,
|
|
Info = "注塑投料记录逻辑层-获取料孔信息集合"
|
|
});
|
|
throw ex;
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
/// <param name="model"></param>
|
|
/// <returns></returns>
|
|
public InjectionInfo WriteMaterialDetail(InjectionInfo model)
|
|
{
|
|
try
|
|
{
|
|
return new InjectionRecorderDAL().GetInjectMaterial(model);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
LogManager.LogHelper.Error(new LogInfo()
|
|
{
|
|
ErrorInfo = ex,
|
|
Tag = ex.StackTrace,
|
|
Info = "原材料投料-获取信息"
|
|
});
|
|
throw ex;
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|
|
|