/// <summary> /// 加载新计划 /// </summary> /// <returns></returns> public static PlinePlanMDL ReloadNewPlan(string pId) { PlinePlanMDL mdl = null; try { PlinePlanDAL dal = new PlinePlanDAL(); if (dal.PlanExists(pId) <= 0) { mdl = PlinePlanMDL.BuildDefualtPlan(Convert.ToInt32(BaseVariable.LineID), DateTime.Now); if (dal.AddPlinePlan(mdl) > 0) { return(mdl); } return(null); } else { mdl = dal.GetPlanInfo(pId); return(mdl); } return(null); } catch (Exception ex) { CLog.WriteErrLog(ex.Message.ToString()); } return(null); }
private void DoAssemblyPlan() { try { PlanInfoForm dialog = new PlanInfoForm(); PlinePlanDAL dal = new PlinePlanDAL(); string plineid = DateTime.Now.ToString("yyyyMMdd") + BaseVariable.LineID; if (dal.PlanExists(plineid) <= 0) { if (dal.AddPlinePlan(PlinePlanMDL.BuildedPlan(Convert.ToInt32(BaseVariable.LineID) , DateTime.Now)) <= 0) { MessageBox.Show("加载产线配置失败,请检查配置文件信息!", "提示", MessageBoxButtons.OK); return; } } PlinePlanMDL mdl = dal.GetPlanInfo(plineid); if (mdl == null) { MessageBox.Show("加载产线配置失败,请检查配置文件信息!", "提示", MessageBoxButtons.OK); return; } dialog.PLAN = mdl; if (dialog.ShowDialog() == DialogResult.OK) { if (dal.UpdatePlinePlan(dialog.PLAN) > 0) { MessageBox.Show("修改产线配置信息成功!", "提示", MessageBoxButtons.OK); return; } else { MessageBox.Show("修改产线配置信息失败!", "提示", MessageBoxButtons.OK); return; } } } catch (System.Exception ex) { MessageBox.Show(ex.Message.ToString(), "提示", MessageBoxButtons.OK); } }
/// <summary> /// 加载模板计划 /// </summary> public void LoadTempPlan() { try { List <PlinePlanMDL> lists = PlinePlanMDL.InitialPlans(BaseVariable.LineNames, DateTime.Now); PlinePlanDAL dal = new PlinePlanDAL(); foreach (PlinePlanMDL mdl in lists) { if (dal.PlanExists(mdl.PLANID) <= 0) { dal.AddPlinePlan(mdl); } } } catch { throw; } }
/// <summary> /// 加载默认计划 /// </summary> /// <returns></returns> public bool LoadSystemDefualtPlan() { try { // List<PlinePlanMDL> lists = PlinePlanMDL.InitialPlans(BaseVariable.LineNames, DateTime.Now); int linid = Convert.ToInt32(BaseVariable.LineID); PlinePlanMDL mdl = PlinePlanMDL.BuildDefualtPlan(linid, DateTime.Now); PlinePlanDAL dal = new PlinePlanDAL(); if (dal.PlanExists(mdl.PLANID) <= 0) { if (dal.AddPlinePlan(mdl) > 0) { this.curPlan = mdl; return(true); } } else { curPlan = dal.GetPlanInfo(mdl.PLANID); if (curPlan != null) { return(true); } } return(false); } catch { throw; } }