public void Timer1_Elapsed(object sender, System.Timers.ElapsedEventArgs e) { return; TimerTools Timer = new TimerTools(); // 得到 hour minute second 如果等于某个值就开始执行某个程序。 int intHour = e.SignalTime.Hour; int intMinute = e.SignalTime.Minute; int intSecond = e.SignalTime.Second; //定制时间; 比如 在10:30 :00 的时候执行某个函数 //int iHour = 10; //int iMinute = 30; //int iSecond = 00; //设置 每秒钟的开始执行一次 //if (intSecond == iSecond) //{ //} //设置 每个小时的偶数分钟开始执行 if (intMinute % 2 == 0) { Timer.TimerRequest(); string WeekDay = DateTime.Now.DayOfWeek.ToString(); //每周一调用一次 if (WeekDay == "Monday" && intHour == 1 && intMinute == 0) { Timer.TimerSupplyCapacitySend(); Timer.TimerDemandForecastRequest();//获取需求预测 } } //设置 每天的2点发送部件详细数据 if ((intHour == 2 && intMinute == 00)) { Timer.TimerPartDatailsSend(); } if ((intHour == 3 && intMinute == 00)) { Timer.TimerTotalInventorySend(); } }
/// <summary> /// 获取需求预测 /// </summary> /// <returns></returns> public string DemandForecastRequest() { Timer.TimerDemandForecastRequest(); return(""); }