public int GetChangeTimeByUnit(string lineID, string unitid) { int ct = 0; try { DataSet dataSet = null; string strSql = "SELECT * FROM tlb_line_change WHERE PLID='{0}' AND UNITID='{1}' "; strSql = string.Format(strSql, lineID, unitid); dataSet = MySqlDBHelper.ExecuteDataSet(MySqlDBHelper.Conn, CommandType.Text, strSql); if (dataSet == null || dataSet.Tables[0].Rows.Count <= 0) { return(0); } ///获取换型时间秒为单位 foreach (DataRow row in dataSet.Tables[0].Rows) { ct += ChangeTimeMDL.ParseDataRow(row).TIME_MIG; } return(ct); } catch { throw; } }
/// <summary> /// 获取换型时间 /// </summary> /// <param name="lineID"></param> /// <param name="range"></param> /// <returns>minutes</returns> public int GetChangeTime(string lineID, TimeRange range, ref string ems) { int ct = 0; try { DataSet dataSet = null; string strSql = "SELECT * FROM tlb_line_change WHERE PLID='{0}' AND CUR_TIME BETWEEN '{1}' AND '{2}'"; strSql = string.Format(strSql, lineID, range.StartTime, range.EndTime); dataSet = MySqlDBHelper.ExecuteDataSet(MySqlDBHelper.Conn, CommandType.Text, strSql); if (dataSet == null || dataSet.Tables[0].Rows.Count <= 0) { return(0); } foreach (DataRow row in dataSet.Tables[0].Rows) { ChangeTimeMDL dml = ChangeTimeMDL.ParseDataRow(row); ct += dml.TIME_MIG; ems += dml.CUR_PN + ","; } return(ct); } catch { throw; } }
//public int public List <ChangeTimeMDL> GetChangeTimeItems(string lineID, TimeRange range) { List <ChangeTimeMDL> ret = new List <ChangeTimeMDL>(); try { DataSet dataSet = null; string strSql = "SELECT * FROM tlb_line_change WHERE PLID='{0}' AND CUR_TIME BETWEEN '{1}' AND '{2}'"; strSql = string.Format(strSql, lineID, range.StartTime, range.EndTime); dataSet = MySqlDBHelper.ExecuteDataSet(MySqlDBHelper.Conn, CommandType.Text, strSql); if (dataSet == null || dataSet.Tables[0].Rows.Count <= 0) { return(null); } foreach (DataRow row in dataSet.Tables[0].Rows) { ChangeTimeMDL dml = ChangeTimeMDL.ParseDataRow(row); ret.Add(dml); } return(ret); } catch { throw; } }