using System; using System.Collections.Generic; using System.Data; using QMAPP.BLL; using QMAPP.Entity; using QMAPP.FJC.BLL.Dict; using QMAPP.FJC.DAL.FeedInManage; using QMAPP.FJC.Entity.FeedInManage; using QMAPP.FJC.Entity.Injection; using QMFrameWork.Data; using QMFrameWork.Log; namespace QMAPP.FJC.BLL.FeedInManage { /// /// 模块编号:M3-3 /// 作 用:表皮信息查询 /// 作 者:张敬贺 /// 编写日期:2015年05月26日 /// public class EpidermisBLL : BaseBLL { #region 获取列表 /// /// 获取列表 /// /// 条件 /// 数据页 /// 数据页 public DataResult GetList(Epidermis condition, DataPage page) { DataResult result = new DataResult(); try { result.IsSuccess = true; page = new EpidermisDAL().GetList(condition, page); List list = page.Result as List; //处理字典信息 DictManageBLL dictPROCESSTYPE = new DictManageBLL(DictKind.PROCESSTYPE); DictManageBLL dictPRODUCTTYPE = new DictManageBLL(DictKind.PRODUCTTYPE); DictManageBLL dictSTATUS = new DictManageBLL(DictKind.LJSTATUS); DictManageBLL dictOUTFLAG = new DictManageBLL(DictKind.OUTFLAG); DictManageBLL dictUSINGSTATE = new DictManageBLL(DictKind.USINGSTATE); DictManageBLL dictColor = new DictManageBLL(DictKind.COLOR); foreach (var info in list) { //替换工序类别显示值 info.CURRENTPROCESS = dictPROCESSTYPE.GetDictValue(info.CURRENTPROCESS); //替换零件类别显示值 info.PRODUCTTYPE = dictPRODUCTTYPE.GetDictValue(info.PRODUCTTYPE); //替换零件类别显示值 info.STATUS = dictSTATUS.GetDictValue(info.STATUS); //替换出库标记显示值 info.OUTFLAG = dictOUTFLAG.GetDictValue(info.OUTFLAG); //替换使用状态显示值 info.USINGSTATE = dictUSINGSTATE.GetDictValue(info.USINGSTATE); info.COLOR = dictColor.GetDictValue(info.COLOR); } result.Result = page; } catch (Exception ex) { LogManager.LogHelper.Error(new LogInfo() { ErrorInfo = ex, Tag = ex.StackTrace, Info = "表皮信息获取列表错误!" }); result.IsSuccess = false; result.Msg = "表皮信息获取列表错误!"; } return result; } #endregion #region 更新表皮相关物料信息 /// /// 更新表皮相关物料信息 /// /// /// 更新行数 public DataResult UpdateMaterial(InjectionRecorder model) { DataResult result = new DataResult(); try { //基本信息 model.UPDATEUSER = this.LoginUser.UserID; int count = new EpidermisDAL().UpdateMaterial(model); if (count > 0) { result.IsSuccess = true; } } catch (Exception ex) { LogManager.LogHelper.Error(new LogInfo() { ErrorInfo = ex, Tag = ex.StackTrace, Info = "表皮信息更新批次号错误!" }); result.IsSuccess = false; result.Msg = "表皮信息更新批次号错误!"; throw ex; } return result; } #endregion #region 导出数据 /// /// 获取导出的数据 /// /// 查询条件 /// 数据 public DataResult GetExportData(Epidermis model) { DataResult result = new DataResult(); try { result.IsSuccess = true; result.Result = new EpidermisDAL().GetExportData(model); //处理字典信息 DictManageBLL dictPROCESSTYPE = new DictManageBLL(DictKind.PROCESSTYPE); DictManageBLL dictPRODUCTTYPE = new DictManageBLL(DictKind.PRODUCTTYPE); DictManageBLL dictSTATUS = new DictManageBLL(DictKind.LJSTATUS); DictManageBLL dictOUTFLAG = new DictManageBLL(DictKind.OUTFLAG); DictManageBLL dictUSINGSTATE = new DictManageBLL(DictKind.USINGSTATE); foreach (DataRow dr in result.Result.Rows) { //替换工序类别显示值 dr["CURRENTPROCESS"] = dictPROCESSTYPE.GetDictValue(dr["CURRENTPROCESS"].ToString()); //替换零件类别显示值 dr["PRODUCTTYPE"] = dictPRODUCTTYPE.GetDictValue(dr["PRODUCTTYPE"].ToString()); //替换零件类别显示值 dr["STATUS"] = dictSTATUS.GetDictValue(dr["STATUS"].ToString()); //替换出库标记显示值 dr["OUTFLAG"] = dictOUTFLAG.GetDictValue(dr["OUTFLAG"].ToString()); //替换使用状态显示值 dr["USINGSTATE"] = dictUSINGSTATE.GetDictValue(dr["USINGSTATE"].ToString()); } } catch (Exception ex) { LogManager.LogHelper.Error(new LogInfo() { ErrorInfo = ex, Tag = ex.StackTrace, Info = "表皮信息更新批次号错误!" }); result.IsSuccess = false; result.Msg = "表皮信息更新批次号错误!"; } return result; } #endregion #region 获取投料信息列表 /// /// 获取列表 /// /// 条件 /// 数据页 /// 数据页 public DataResult> GetProductInfectionList(string id) { DataResult> result = new DataResult>(); try { List list = new List(); result.IsSuccess = true; list = new EpidermisDAL().GetProductInfectionList(id); //处理字典信息 //DictManageBLL dictMATERIALTYPE = new DictManageBLL(DictKind.MATERIALTYPE); //foreach (var info in list) //{ // //替换物料类别显示值 // info.MATERIALTYPE = dictMATERIALTYPE.GetDictValue(info.MATERIALTYPE); //} result.Result = list; } catch (Exception ex) { LogManager.LogHelper.Error(new LogInfo() { ErrorInfo = ex, Tag = ex.StackTrace, Info = "获取投料信息错误!" }); result.IsSuccess = false; result.Msg = "获取投料信息错误!"; } return result; } #endregion #region UseComplete /// /// /// /// /// public DataResult UseComplete(string str) { DataResult result = new DataResult(); result.IsSuccess = true; int count = 0; try { Epidermis info = new EpidermisDAL().Get(new Epidermis { PID = str }); //基本信息 info.USINGSTATE = QMAPP.FJC.Entity.EnumGeter.USINGSTATE.USED.GetHashCode().ToString(); info.UPDATEUSER = this.LoginUser.UserID; count += new EpidermisDAL().Update(info); if (count == 0) { result.IsSuccess = false; result.Msg = "使用完成记录失败!"; return result; } } catch (Exception ex) { LogManager.LogHelper.Error(new LogInfo() { ErrorInfo = ex, Tag = ex.StackTrace, Info = "使用完成记录失败!" }); result.IsSuccess = false; result.Msg = "完成生产记录异常!"; result.Ex = ex; } return result; } #endregion } }