private void InsertQuaReport(object source) { MSYS.DAL.DbOperator opt = new MSYS.DAL.DbOperator(); DataSet times = opt.CreateDataSetOra("select date_begin as time from ht_prod_schedule where substr(date_begin,1,10) = '" + System.DateTime.Now.ToString("yyyy-MM-dd") + "' union select date_end as time from ht_prod_schedule where substr(date_end,1,10) = '" + System.DateTime.Now.ToString("yyyy-MM-dd") + "'"); if (times != null && times.Tables[0].Rows.Count > 0) { foreach (DataRow time in times.Tables[0].Rows) { if (System.DateTime.Now - Convert.ToDateTime(time["time"].ToString()) > new TimeSpan(0, 20, 0) && System.DateTime.Now - Convert.ToDateTime(time["time"].ToString()) < new TimeSpan(0, 50, 0)) { //对每一班组的生产过程数据进行统计分析计算 try { QltRecoder.insertQuaReport(System.DateTime.Now.AddHours(-8)); } catch (Exception) { if (QualityTimer != null) { QualityTimer.Dispose(); QualityTimer = null; } } } } } }
public void Qua_Start_Click(object sender, EventArgs e) { InsertProdReportAsTime(QuaTime.Text.Substring(0, 10)); QltRecoder.insertQuaReport(Convert.ToDateTime(QuaTime.Text)); // ProdRecoder.ProdRecord(QuaTime.Text,""); // MSYS.DAL.DbOperator opt = new MSYS.DAL.DbOperator(); //DataSet times = opt.CreateDataSetOra("select date_begin as time from ht_prod_schedule where date_begin between '2018-12-01' and '2018-12-15'"); // if (times != null && times.Tables[0].Rows.Count > 0) // { // foreach (DataRow time in times.Tables[0].Rows) // { // ProdRecoder.ProdRecord(time["time"].ToString()); // } // } }