/// <summary> /// 获取产品计划通过序号ID /// </summary> /// <param name="planid"></param> /// <returns></returns> public ProductionPlanMDL GetProductionPalnByID(int tid) { try { ProductionPlanMDL mdl = new ProductionPlanMDL(); DataSet dataSet = null; string strSql = "select * from production_plan where tid='{0}' "; strSql = string.Format(strSql, tid); dataSet = MySqlDBHelper.ExecuteDataSet(MySqlDBHelper.Conn, CommandType.Text, strSql); if (dataSet != null) { DataRow row = dataSet.Tables[0].Rows[0]; mdl.Prase(row); return(mdl); } return(null); } catch (Exception ex) { CLog.WriteErrLogInTrace(ex.Message); return(null); } }
/// <summary> /// 获取产线点 /// </summary> /// <param name="table"></param> /// <returns></returns> private AppointmentList GetPlanPoints(DataTable table) { try { AppointmentList list = new AppointmentList(); DateTime timeStart = new DateTime(this.dateTimePicker1.Value.Year, this.dateTimePicker1.Value.Month, this.dateTimePicker1.Value.Day, 7, 30, 0); DateTime timeEnd = timeStart; int hoursToAdd = 1; int minuteToAdd = 60; List <TimeRange> rangs = new List <TimeRange>(); //获取小时 for (int i = 0; i < 12; i++) { timeStart = timeStart.AddHours(hoursToAdd); timeEnd = timeStart.AddMinutes(minuteToAdd); TimeRange rang = new TimeRange(); rang.StartTime = timeStart; rang.EndTime = timeEnd; rangs.Add(rang); } foreach (DataRow itemRow in table.Rows) { foreach (TimeRange item in rangs) { DateTime ptime1 = Convert.ToDateTime(itemRow["start_time"].ToString()); DateTime ptime2 = Convert.ToDateTime(itemRow["end_time"]); if (item.IsInFullRange(ptime1, ptime2)) { ProductionPlanMDL mdl = new ProductionPlanMDL(); mdl.Prase(itemRow); BrakePlanAppointments app = new BrakePlanAppointments(); app.Subject = string.Format("型号:{0} 预计产量:{1}实际产量:{2}", mdl.BreakeID.ToString(), mdl.PlanNum.ToString(), mdl.Actual_num.ToString()); app.ColorBlockBrush = Brushes.OrangeRed; app.DateStart = ptime1; app.DateEnd = ptime2; app.MDL = mdl; list.Add(app); break; } if (item.IsInRange(ptime1)) { ProductionPlanMDL mdl = new ProductionPlanMDL(); mdl.Prase(itemRow); BrakePlanAppointments app = new BrakePlanAppointments(); app.Subject = string.Format("型号:{0} 预计产量:{1}/r/n实际产量:{2}", mdl.BreakeID.ToString(), mdl.PlanID.ToString(), mdl.Actual_num.ToString()); app.ColorBlockBrush = Brushes.OrangeRed; app.DateStart = ptime1; app.DateEnd = ptime2; app.MDL = mdl; list.Add(app); break; } } } return(list); } catch (Exception ex) { CLog.WriteErrLogInTrace(ex.StackTrace); return(null); } }