/// <summary> /// 获取数据 /// </summary> public void UpdateData(DateTime pDt, int pHourPer) { try { using (DataSubmittedEntities db = new DataSubmittedEntities()) { string startTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); SystemLog.GetInstance().Log.Info(string.Format("{0}:开始获取中间表数据", startTime)); db.SP_StaDataSource(pHourPer, pDt); string endTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); SystemLog.GetInstance().Log.Info(string.Format("{0}:结束获取中间表数据", endTime)); SystemLog.GetInstance().Log.Info(string.Format("统计中间表数据耗时{0}秒", (DateTime.Parse(endTime) - DateTime.Parse(startTime)).TotalSeconds)); this.State = 1; if (State == 1) { int timeHour; DateTime dt = pDt.AddHours(-1); if (pHourPer == 0) { timeHour = 23; } else { if (pHourPer == 1) { timeHour = 0; } else { timeHour = pHourPer - 1; } } this.Notify(new ThreadParameter(dt, timeHour)); } } } catch (Exception ex) { SystemLog.GetInstance().Log.Info(ex.Message); } }