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 { /// <summary> /// 模块编号:M3-3 /// 作 用:表皮信息查询 /// 作 者:张敬贺 /// 编写日期:2015年05月26日 ///</summary> public class EpidermisBLL : 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 { result.IsSuccess = true; page = new EpidermisDAL().GetList(condition, page); List<Epidermis> list = page.Result as List<Epidermis>; //处理字典信息 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 更新表皮相关物料信息 /// <summary> /// 更新表皮相关物料信息 /// </summary> /// <param name=""></param> /// <returns>更新行数</returns> 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 导出数据 /// <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 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 获取投料信息列表 /// <summary> /// 获取列表 /// </summary> /// <param name="condition">条件</param> /// <param name="page">数据页</param> /// <returns>数据页</returns> public DataResult<List<InjectionRecorder>> GetProductInfectionList(string id) { DataResult<List<InjectionRecorder>> result = new DataResult<List<InjectionRecorder>>(); try { List<InjectionRecorder> list = new List<InjectionRecorder>(); 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 /// <summary> /// /// </summary> /// <param name="str"></param> /// <returns></returns> 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 } }