using System; using System.Collections.Generic; using System.Linq; using System.Text; using QMAPP.BLL; using QMAPP.FJC.Entity.FIS; using QMAPP.Entity; using QMFrameWork.Log; using QMAPP.FJC.Entity; using QMFrameWork.Data; using QMAPP.FJC.DAL.FIS; using System.Data; using QMAPP.FJC.BLL.Dict; using QMAPP.MD.Entity; using QMAPP.MD.DAL; using QMAPP.FJC.DAL.ProductionPlan; using QMAPP.FJC.Entity.ProductionPlan; using QMFrameWork.Common.Util; using QMAPP.FJC.Entity.FileCopy.FIS; using QMAPP.FJC.Entity.TianJin; using QMAPP.FJC.DAL.TianJin; namespace QMAPP.FJC.BLL.TianJin { public class TJDoorPlankPlanBLL : BaseBLL { #region 获取信息 /// /// 获取信息 /// /// 条件 /// 信息 public DataResult Get(TJOrderPlan model) { DataResult result = new DataResult(); try { result.Result = new TJDoorPlankPlanDAL().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; } /// /// 获取FIS插单的位置 /// /// /// public DataResult GetFISInsertPos(TJOrderPlan model) { DataResult result = new DataResult(); try { var dal= new TJDoorPlankPlanDAL(); //var position =dal.Get(model); //if (position == null) //{ // throw new Exception("获取FIS插单位置信息失败!"); //} //if(!string.Equals(position.PLANSOURCE,EnumGeter.WORKORDERTYPE.FIS.GetHashCode().ToString())) //{ // result.Msg = "只能选择FIS计划作为插单位置!"; // result.IsSuccess = false; // return result; //} result.Result = null; } 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 获取列表 /// /// 获取列表 /// /// 条件 /// 数据页 /// 数据页 public DataResult GetList(TJOrderPlan condition, DataPage page) { DataResult result = new DataResult(); try { //获取订单计划信息列表 DataPage dataPage = new TJDoorPlankPlanDAL().GetList(condition, page); //DataPage dataPage = new DataPage(); List list = page.Result as List; #region 显示类型 //处理字典信息 DictManageBLL dictPLANSTATE = new DictManageBLL(DictKind.PLAN_STATE); foreach (var info in list) { info.PLAN_STATE = dictPLANSTATE.GetDictValue(info.PLAN_STATE); } #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 #region 信息是否重复 /// /// 判断名称是否存在 /// /// /// true:已存在;fasel:不存在。 public int ExistsOrderPlan(TJOrderPlan model) { try { return new TJDoorPlankPlanDAL().ExistsOrderPlan(model); } catch (Exception ex) { throw ex; } } #endregion #region 插入信息 /// /// 插入信息(单表) /// /// 信息 /// 插入行数 public DataResult Insert(TJOrderPlan model) { DataResult result = new DataResult(); //基本信息 model.PID = Guid.NewGuid().ToString(); model.PLAN_STATE = "0"; model.CREATEUSER = this.LoginUser.UserID; model.CREATEDATE = DateTime.Now; model.UPDATEUSER = model.CREATEUSER; model.UPDATEDATE = model.CREATEDATE; TJDoorPlankPlanDAL cmdDAL = new TJDoorPlankPlanDAL(); model.MATERIAL_NAME = cmdDAL.GetMATERIALNAME(model.MATERIAL_CODE); try { //获取流水号 var SEQSTR = this.GetOrderPlanSeq(model); model.PLAN_SEQ = SEQSTR; //计划单号 model.PLAN_NO = "DP" + model.PLAN_DATE.ToString("yyyyMMdd") + SEQSTR; result.Result = new TJDoorPlankPlanDAL().Insert(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 获取流水号信息 /// /// 获取流水号信息 /// /// /// public string GetOrderPlanSeq(TJOrderPlan condition) { TJOrderPlan fisplan = new TJOrderPlan(); TJOrderPlanDAL TJOrderPlanDAL = new TJOrderPlanDAL(); //根据表皮条码获取本体信息 try { fisplan = new TJOrderPlanDAL().GetOrderPlanSeq(condition); //若存在记录,流水号加1,且更新 if (fisplan != null) { return (Convert.ToInt32(fisplan.PLAN_SEQ) + 1).ToString().PadLeft(3, '0'); } //不存在则插入此日期信息 else { return "001"; } } catch (Exception ex) { LogManager.LogHelper.Error(new LogInfo() { ErrorInfo = ex, Tag = ex.StackTrace, Info = "仪表板逻辑层-获取流水号本体信息!" }); throw ex; } } #endregion #region 更新信息 /// /// 更新信息 /// /// /// 更新行数 public DataResult Update(TJOrderPlan model) { DataResult result = new DataResult(); model.UPDATEUSER = this.LoginUser.UserID; try { if (model.PLAN_STATE != "0") { result.IsSuccess = false; result.Msg = "计划已经下发,无法修改!"; return result; } #region 判断数量 TJDoorPlankPlanDAL cmdDAL = new TJDoorPlankPlanDAL(); model.MATERIAL_NAME = cmdDAL.GetMATERIALNAME(model.MATERIAL_CODE); //获取流水号 var SEQSTR = this.GetOrderPlanSeq(model); model.PLAN_SEQ = SEQSTR; //计划单号 model.PLAN_NO = "DP" + model.PLAN_DATE.ToString("yyyyMMdd") + SEQSTR; TJOrderPlanDAL TJOrderPlanDAL = new TJOrderPlanDAL(); #endregion using (IDataSession session = AppDataFactory.CreateMainSession()) { TJOrderPlanDAL.Update(model); } result.IsSuccess = true; result.Msg = "修改成功!"; return result; } 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 删除 /// /// 删除信息 /// /// /// 删除个数 public DataResult Delete(string strs) { int count = 0; DataResult result = new DataResult(); try { TJWorkOrderDAL TJworkOrderDal = new TJWorkOrderDAL(); TJOrderPlanDAL TJOrderPlanDAL = new TJOrderPlanDAL(); //可以删除的订单 List deleteOrderList = new List(); TJOrderPlan op = TJOrderPlanDAL.Get(new TJOrderPlan() { PID = strs }); int Num = TJworkOrderDal.GetAllWorkOrder(strs); if (op.PLAN_STATE == EnumGeter.PLANSTATE.INIT.GetHashCode().ToString() || (op.PLAN_STATE == EnumGeter.PLANSTATE.COMMIT.GetHashCode().ToString() && Num == 0)) { //删除订单 TJOrderPlanDAL.DeleteOrderPlan(op); TJworkOrderDal.BatchDeleteByOrderPlan(new TJWorkOrder() { ORDERPLANID = op.PID }); } else { result.IsSuccess = false; result.Msg = "只有初始化或是确认生产并且生产数量为0订单可以删除!"; return result; } result.Result = count; result.Msg = "订单删除成功!"; result.IsSuccess = true; return result; } catch (Exception ex) { throw ex; } } /// /// 删除信息 /// /// 信息 /// 删除个数 public int DeleteDoorPlankPlan(TJOrderPlan model) { int count = 0; int number = new TJDoorPlankPlanDAL().DelCheck(model); if (number > 0) { return count; } count = new TJDoorPlankPlanDAL().Delete(model); return count; } #endregion #region 发布 /// /// 发布信息 /// /// /// 发布个数 public DataResult PutOut(string strs) { DataResult result = new DataResult(); try { TJOrderPlanDAL TJOrderPlanDAL = new TJOrderPlanDAL(); List validorderPlanList = new List(); TJOrderPlan op = TJOrderPlanDAL.Get(new TJOrderPlan { PID = strs }); if (op.PLAN_STATE != EnumGeter.PLANSTATE.INIT.GetHashCode().ToString()) { result.IsSuccess = false; result.Msg = "只有初始状态下的订单能够进行发布!"; return result; } DataTable totalDt = GetWorkOrderTable(); op.PLAN_STATE = EnumGeter.PLANSTATE.COMMIT.GetHashCode().ToString(); op.UPDATEUSER = this.LoginUser.UserID; totalDt = this.PutOutOrderPlan(op, totalDt); using (IDataSession session = AppDataFactory.CreateMainSession()) { IDbConnection dbConn = DbManager.MainConnectionInfo.Connection; if (dbConn.State == ConnectionState.Closed) { dbConn.Open(); } IDbTransaction ids = dbConn.BeginTransaction(); TJOrderPlanDAL.Update(op); session.DbHelper.BulkCopyData(totalDt, "T_PP_TJFY_WORKORDER", dbConn, ids); ids.Commit(); } result.IsSuccess = true; return result; } catch (Exception ex) { throw ex; } } /// /// 发布信息 /// /// 信息 /// 发布个数 public DataTable PutOutOrderPlan(TJOrderPlan info, DataTable workOrderDt) { WorkCellDAL workCelldal = new WorkCellDAL(); if (info.MATERIAL_CODE.Length > 8) { for (int i = 0; i < info.QTY; i++) { DataRow workOrder = workOrderDt.NewRow(); workOrder["PID"] = Guid.NewGuid().ToString(); workOrder["ORDERPLANID"] = info.PID; workOrder["ORDERPLAN_NO"] = (info.PLAN_NO.ToString() + (i + 1).ToString().PadLeft(4, '0')); workOrder["SEQ"] = info.PLAN_NO.Substring(info.PLAN_NO.Length - 2, 2) + (i + 1).ToString().PadLeft(4, '0'); workOrder["MATERIAL_CODE"] = info.MATERIAL_CODE; workOrder["MATERIAL_NAME"] = info.MATERIAL_NAME; workOrder["PLAN_DATE"] = info.PLAN_DATE; workOrder["PRODUCTCODE"] = ""; if (info.MATERIAL_NAME.Contains("左前")) { workOrder["MOULD_CODE"] = "LF"; } else if (info.MATERIAL_NAME.Contains("左后")) { workOrder["MOULD_CODE"] = "LR"; } else if (info.MATERIAL_NAME.Contains("右前")) { workOrder["MOULD_CODE"] = "RF"; } else if (info.MATERIAL_NAME.Contains("右后")) { workOrder["MOULD_CODE"] = "RR"; } workOrder["LINENO"] = info.LINENO; workOrder["STATE"] = EnumGeter.WORKPLANSTATE.INIT.GetHashCode().ToString(); workOrder["UPDATEDATE"] = DateTime.Now.ToString(); workOrderDt.Rows.Add(workOrder); } } else { var list = "LF,LR,RF,RR".Split(','); var dal = new TJDoorPlankPlanDAL(); var MachineList = dal.GetListMachine(info.MATERIAL_CODE); //注入派工单信息 for (int i = 0; i < info.QTY; i++) { foreach (var seq in list) { DataRow workOrder = workOrderDt.NewRow(); workOrder["PID"] = Guid.NewGuid().ToString(); workOrder["ORDERPLANID"] = info.PID; workOrder["ORDERPLAN_NO"] = (info.PLAN_NO.ToString() + (i + 1).ToString().PadLeft(4, '0')); workOrder["SEQ"] = info.PLAN_NO.Substring(info.PLAN_NO.Length - 2, 2) + (i + 1).ToString().PadLeft(4, '0'); var WEIZHI = ""; switch (seq) { case "LF": WEIZHI = "左前"; break; case "LR": WEIZHI = "左后"; break; case "RF": WEIZHI = "右前"; break; case "RR": WEIZHI = "右后"; break; } var Machine = MachineList.Where(p => p.MATERIALNAME.Contains(WEIZHI)).ToList(); if (Machine != null && Machine.Count>0) { workOrder["MATERIAL_CODE"] = Machine[0].MATERIALNO; } else workOrder["MATERIAL_CODE"] = ""; workOrder["MATERIAL_NAME"] = info.MATERIAL_NAME; workOrder["PLAN_DATE"] = info.PLAN_DATE; workOrder["PRODUCTCODE"] = ""; workOrder["MOULD_CODE"] = seq; workOrder["LINENO"] = info.LINENO; workOrder["STATE"] = EnumGeter.WORKPLANSTATE.INIT.GetHashCode().ToString(); workOrder["UPDATEDATE"] = DateTime.Now.ToString(); workOrderDt.Rows.Add(workOrder); } } } return workOrderDt; } public static string GET_MATERIAL_CODE(string MOULD_CODE,string MATERIAL_CODE) { return ""; } //public List PutOutOrderPlan(TJOrderPlan info, int number, int lastIndex) //{ // List wolist = new List(); // WorkCellDAL workCelldal = new WorkCellDAL(); // string pbomcode = info.PBOM_CODE; // List list = workCelldal.GetFirstWorkCell(pbomcode); // var dicPRI = new DictManageBLL(Dict.DictKind.ORDERPRI); // //注入派工单信息 // for (int i = 0; i < number; i++) // { // foreach (var seq in list) // { // WorkOrder wo = new WorkOrder(); // wo.PID = Guid.NewGuid().ToString(); // wo.ORDERPLANID = info.PID; // wo.ORDERPLAN_NO = (info.PLAN_NO.ToString() + (i + 1 + lastIndex).ToString().PadLeft(4, '0')); // wo.ORDER_TYPE = info.PLANSOURCE; // wo.SEQ = (i + 1 + lastIndex).ToString().PadLeft(6, '0'); // wo.MATERIAL_CODE = info.MATERIAL_CODE; // wo.PBOM_CODE = info.PBOM_CODE; // wo.QTY = 1; // wo.COMPLETE_QTY = 0; // wo.PLAN_DATE = info.PLAN_DATE; // wo.SHIFT_CODE = info.SHIFT_CODE; // wo.WORKCENTER_CODE = info.WORKCENTER_CODE; // wo.WORKCELL_CODE = seq.WORKCELL_CODE; // wo.WORKLOC_CODE = ""; // wo.REMARK = ""; // wo.EQPT_NAME = ""; // wo.EQPT_CODE = ""; // wo.STATE = Convert.ToInt32(EnumGeter.WORKPLANSTATE.INIT.GetHashCode().ToString()); // wo.PRI = Convert.ToInt32(dicPRI.GetDictValue(info.PLANSOURCE)); // wo.PRINTED = "0"; // wolist.Add(wo); // } // } // return wolist; //} #endregion #region 导出数据 /// /// 获取导出的数据 /// /// 查询条件 /// 数据 public DataTable GetExportData(TJOrderPlan model) { try { //DataTable dt = new TJDoorPlankPlanDAL().GetExportData(model); DataTable dt = new DataTable(); DictManageBLL dictPRODUCEREQUIRE = new DictManageBLL(DictKind.PRODUCEREQUIRE); DictManageBLL dictPLANSOURCE = new DictManageBLL(DictKind.PLANSOURCE); DictManageBLL dictPLANSTATE = new DictManageBLL(DictKind.PLAN_STATE); foreach (DataRow dr in dt.Rows) { //替换状态类别显示值 dr["PRODUCEREQUIRE"] = dictPRODUCEREQUIRE.GetDictValue(dr["PRODUCEREQUIRE"].ToString()); //info.PLANSOURCE = dictPLANSOURCE.GetDictValue(info.PLANSOURCE); dr["PLANSOURCE"] = dictPLANSOURCE.GetDictValue(dr["PLANSOURCE"].ToString()); dr["PLAN_STATE"] = dictPLANSTATE.GetDictValue(dr["PLAN_STATE"].ToString()); } return dt; } catch (Exception ex) { throw ex; } } #endregion #region 导入数据 --Web-导入计划 /// /// 导入Excel表数据 /// /// Excel列表 /// 区域信息 /// 工厂信息 /// 零件类别信息 /// 结果 public DataResult GetImportData(List list, Material materialmodel, QMAPP.FJC.Entity.Basic.MachineInfo machine, FJC.Entity.Basic.ProduceShift produceshiftmodel, QMAPP.MD.Entity.WorkCell workcellmodel) { DataResult result = new DataResult(); TJDoorPlankPlanDAL cmDal = new TJDoorPlankPlanDAL(); List List = new List(); int index = 0; int num = 0; try { result.Result = new ImportMessage(); result.Result.Errors = new List(); using (IDataSession session = AppDataFactory.CreateMainSession()) { //获取流水号 导入数据的顺序号 导入文件自己定义 //var SEQSTR = this.GetOrderPlanSeq(model); foreach (TJOrderPlan ma in list) { index++; num++; //计划单号 ma.PLAN_NO = "DP" + ma.PLAN_DATE.ToString("yyyyMMdd") + ma.PLAN_SEQ.PadLeft(3,'0'); TJDoorPlankPlanDAL cmdDAL = new TJDoorPlankPlanDAL(); ma.MATERIAL_NAME = cmdDAL.GetMATERIALNAME(ma.MATERIAL_CODE); //修改改时根据主键等信息获取详细内容信息 TJOrderPlan oldInfo = cmDal.Get(ma); if (oldInfo != null) { //更新 ma.PID = oldInfo.PID; ma.PLAN_SEQ = oldInfo.PLAN_SEQ; ma.MATERIAL_CODE = oldInfo.MATERIAL_CODE; ma.MATERIAL_NAME = oldInfo.MATERIAL_NAME; ma.PLAN_STATE = oldInfo.PLAN_STATE; ma.LINENO = oldInfo.LINENO; ma.CREATEUSER = oldInfo.CREATEUSER; ma.CREATEDATE = oldInfo.CREATEDATE; ma.UPDATEUSER = this.LoginUser.UserID; ma.UPDATEDATE = oldInfo.UPDATEDATE; ma.IsNewInfo = false; result.Result.updateNum += 1; } else { //新增 oldInfo = new TJOrderPlan(); ma.PID = Guid.NewGuid().ToString(); ma.PLAN_STATE = EnumGeter.PLANSTATE.INIT.GetHashCode().ToString(); ma.CREATEUSER = this.LoginUser.UserID; ma.CREATEDATE = DateTime.Now; ma.IsNewInfo = true; result.Result.insertNum += 1; } List.Add(ma); } } //导入 cmDal.GetImportData(List); result.Msg = "导入成功"; result.IsSuccess = true; return result; } catch (Exception ex) { result.IsSuccess = false; result.Ex = ex; return result; } } #endregion #region 获取产品表 /// /// 获取产品表 /// /// private DataTable GetOrderPlanTable() { DataTable dt = new DataTable(); dt.Columns.Add(new DataColumn() { ColumnName = "PID", DataType = typeof(string) }); dt.Columns.Add(new DataColumn() { ColumnName = "FACTORY_CODE", DataType = typeof(string) }); dt.Columns.Add(new DataColumn() { ColumnName = "PLAN_NO", DataType = typeof(string) }); dt.Columns.Add(new DataColumn() { ColumnName = "PLAN_SEQ", DataType = typeof(string) }); dt.Columns.Add(new DataColumn() { ColumnName = "PLAN_STATE", DataType = typeof(string) }); dt.Columns.Add(new DataColumn() { ColumnName = "MATERIAL_CODE", DataType = typeof(string) }); dt.Columns.Add(new DataColumn() { ColumnName = "PBOM_CODE", DataType = typeof(string) }); dt.Columns.Add(new DataColumn() { ColumnName = "ROUTE_CODE", DataType = typeof(string) }); dt.Columns.Add(new DataColumn() { ColumnName = "REMARK", DataType = typeof(string) }); dt.Columns.Add(new DataColumn() { ColumnName = "QTY", DataType = typeof(int) }); dt.Columns.Add(new DataColumn() { ColumnName = "COMPLETE_QTY", DataType = typeof(int) }); dt.Columns.Add(new DataColumn() { ColumnName = "PLAN_DATE", DataType = typeof(DateTime) }); dt.Columns.Add(new DataColumn() { ColumnName = "SHIFT_CODE", DataType = typeof(string) }); dt.Columns.Add(new DataColumn() { ColumnName = "PLANSOURCE", DataType = typeof(int) }); dt.Columns.Add(new DataColumn() { ColumnName = "PRODUCEREQUIRE", DataType = typeof(string) }); dt.Columns.Add(new DataColumn() { ColumnName = "CREATEDATE", DataType = typeof(DateTime) }); dt.Columns.Add(new DataColumn() { ColumnName = "CREATEUSER", DataType = typeof(string) }); dt.Columns.Add(new DataColumn() { ColumnName = "UPDATEDATE", DataType = typeof(DateTime) }); dt.Columns.Add(new DataColumn() { ColumnName = "UPDATEUSER", DataType = typeof(string) }); dt.Columns.Add(new DataColumn() { ColumnName = "WORKCENTER_CODE", DataType = typeof(string) }); return dt; } private DataTable GetWorkOrderTable() { DataTable dt = new DataTable(); dt.Columns.Add(new DataColumn() { ColumnName = "PID", DataType = typeof(string) }); dt.Columns.Add(new DataColumn() { ColumnName = "ORDERPLANID", DataType = typeof(string) }); dt.Columns.Add(new DataColumn() { ColumnName = "ORDERPLAN_NO", DataType = typeof(string) }); dt.Columns.Add(new DataColumn() { ColumnName = "SEQ", DataType = typeof(string) }); dt.Columns.Add(new DataColumn() { ColumnName = "MATERIAL_CODE", DataType = typeof(string) }); dt.Columns.Add(new DataColumn() { ColumnName = "MATERIAL_NAME", DataType = typeof(string) }); dt.Columns.Add(new DataColumn() { ColumnName = "PLAN_DATE", DataType = typeof(DateTime) }); dt.Columns.Add(new DataColumn() { ColumnName = "PRODUCTCODE", DataType = typeof(string) }); dt.Columns.Add(new DataColumn() { ColumnName = "STATE", DataType = typeof(int) }); dt.Columns.Add(new DataColumn() { ColumnName = "MOULD_CODE", DataType = typeof(string) }); dt.Columns.Add(new DataColumn() { ColumnName = "LINENO", DataType = typeof(string) }); dt.Columns.Add(new DataColumn() { ColumnName = "UPDATEDATE", DataType = typeof(string) }); return dt; } #endregion #region 保存FIS插单 /// /// 保存FIS插单 /// /// 信息 /// 插入行数 //public DataResult SaveFISInsert(TJOrderPlan model, List materiallist,bool Publish) //{ // List List = new List(); // DataResult result = new DataResult(); // TJDoorPlankPlanDAL cmdDAL = new TJDoorPlankPlanDAL(); // cmdDAL.BaseSession = AppDataFactory.CreateMainSession(); // var InsertNum = cmdDAL.GetMaxFISInsertNum(model) + 1; // foreach (Material ma in materiallist) // { // TJOrderPlan planmodel = new TJOrderPlan(); // planmodel.MATERIAL_CODE = ma.MATERIAL_CODE; // planmodel.PID = Guid.NewGuid().ToString(); // planmodel.QTY = model.QTY; // planmodel.PLAN_DATE = model.PLAN_DATE; // //planmodel.SHIFT_CODE = model.SHIFT_CODE; // planmodel.PRODUCEREQUIRE = "0"; // planmodel.PLAN_STATE = "0"; // //计划来源 // planmodel.PLANSOURCE = model.PLANSOURCE; // //顺序号 // planmodel.PLAN_SEQ = string.Format("{0}-{1:D1}", model.PLAN_SEQ, InsertNum); // var seqstr = model.PLAN_SEQ; // if (seqstr.Length < 4) // { // seqstr = seqstr.PadLeft(4, '0'); // } // else if (seqstr.Length > 4) // { // seqstr = seqstr.Substring(seqstr.Length - 4); // } // string matype = ma.MATERIAL_TYPE_CODE; // //计划单号 // planmodel.PLAN_NO = string.Format("DPINS{0:yyyyMMdd}{1}{2}{3:D1}", // model.PLAN_DATE, // matype.Substring(matype.Length - 2, 2), // seqstr, // InsertNum); // Pbom pbomcode = new PbomDAL().Get(new Pbom { MATERIAL_CODE = planmodel.MATERIAL_CODE }); // planmodel.PBOM_CODE = pbomcode.PBOM_CODE; // string workcentercode = new WorkCellDAL().GetWorkcenter(model.ORDER_TYPE); // planmodel.WORKCENTER_CODE = workcentercode; // if (planmodel.WORKCENTER_CODE != "") // { // string factory = new FactoryDAL().GetFactoryWithWorkcenter(planmodel.WORKCENTER_CODE); // planmodel.FACTORY_CODE = factory; // } // planmodel.CREATEUSER = this.LoginUser.UserID; // planmodel.CREATEDATE = DateTime.Now; // planmodel.UPDATEUSER = planmodel.CREATEUSER; // planmodel.UPDATEDATE = planmodel.CREATEDATE; // List.Add(planmodel); // } // try // { // if (ExistsOrderPlan(model) > 0) // { // result.IsSuccess = false; // result.Msg = Resource.MaterielCodeIsHave; // return result; // } // result.Result = cmdDAL.InsertDoorPlan(List); // } // 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 获取列表(为了修改顺序号使用) /// /// 获取列表 /// /// 条件 /// 数据页 /// 数据页 public DataResult GetDoorPlankPlanList(TJOrderPlan condition, DataPage page) { DataResult result = new DataResult(); try { //获取信息列表 DataPage dataPage = new TJDoorPlankPlanDAL().GetDoorPlankPlanList(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; } #endregion #region 更新顺序号信息 /// /// 更新顺序号信息 /// /// /// 更新个数 public DataResult UpdateDoorPlankPlanSeq(TJOrderPlan TJOrderPlan) { int count = 0; DataResult result = new DataResult(); try { //foreach (string str in list) //{ // TJOrderPlan op = new TJOrderPlan(); // op.PID = str; // op.PLAN_SEQ = TJOrderPlan.PLAN_SEQ; // result.Result += this.UpdateSeq(op); //} result.Result = count; result.Msg = "更新成功!"; result.IsSuccess = true; return result; } catch (Exception ex) { throw ex; } } /// /// 更新顺序号信息 /// /// 信息 /// 删除个数 public int UpdateSeq(TJOrderPlan model) { int count = 0; count = new TJDoorPlankPlanDAL().UpdateSeq(model); return count; } #endregion #region 门板计划物料号CD /// /// 门板计划物料号CD /// /// /// public List GetMaterialDoorPlanForCD(FISAssembly info) { List result = new List(); try { result = new TJDoorPlankPlanDAL().GetMaterialDoorPlanForCD(info); //转换高低配和颜色 } catch (Exception ex) { throw ex; } return result; } #endregion #region 获取本体信息 /// /// 获取本体信息 /// /// /// public FISAssembly GetFISMaterialInfoCD(string IdInfo) { FISAssembly Fisassmble = new FISAssembly(); //根据表皮条码获取本体信息 Fisassmble.Id = IdInfo; try { List FisassmbleList = new TJDoorPlankPlanDAL().GetMaterialDoorPlanForCD(Fisassmble); foreach (FISAssembly m in FisassmbleList) { Fisassmble.MESModulFL = m.MESModulFL; Fisassmble.MESModulFR = m.MESModulFR; Fisassmble.MESModulRL = m.MESModulRL; Fisassmble.MESModulRR = m.MESModulRR; Fisassmble.AsmSetCode = m.AsmSetCode; } } catch (Exception ex) { LogManager.LogHelper.Error(new LogInfo() { ErrorInfo = ex, Tag = ex.StackTrace, Info = "产品档案逻辑层-获取本体信息!" }); throw ex; } return Fisassmble; } #endregion } }