Example #1
0
        /// <summary>
        /// 定时器
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private static void TaskTimer_Elapsed(object sender, ElapsedEventArgs e)
        {
            //作者:林添喜 2006-01-25  说明:任务调用
            string _log2 = string.Format("任务调用开始!");

            if (WriteTaskInfo)
            {
                OralceLogWriter.WriteSystemLog(_log2, "INFO");
            }

            //获取任务列表
            DataTable _rwdata = SQL_TaskCommon.GetTaskList();

            if (_rwdata != null)
            {
                foreach (DataRow _dr in _rwdata.Rows)
                {
                    try
                    {
                        string _rwid = _dr["RWID"].ToString();
                        string _lb   = _dr["RZLB"].ToString();
                        string _ml   = _dr["RWML"].ToString();
                        TaskController.RunTask(_rwid, _lb, _ml);
                    }
                    catch (Exception ex)
                    {
                        string _log = string.Format("任务调用时出现错误:{0}", ex.Message);
                        OralceLogWriter.WriteSystemLog(_log, "ERROR");
                    }
                }
            }
        }
Example #2
0
        /// <summary>
        /// 初始化任务服务
        /// </summary>
        private static void InitTask()
        {
            //添加测试任务插件
            Task_Test_Plugin _testPlugin = new Task_Test_Plugin();

            application.AddTask(_testPlugin.Name, _testPlugin as ITaskPlugin);

            //作者:林添喜 2006-02-03  说明:初始化任务
            //将所有未处理完的任务设置为错误
            SQL_TaskCommon.InitAllTaskState();

            //初始化时钟
            if (ConfigFile.RunTask)
            {
                ServerCommon.TaskTimer.Interval = 1000 * 60;
                ServerCommon.TaskTimer.Elapsed += new System.Timers.ElapsedEventHandler(TaskTimer_Elapsed);
                ServerCommon.TaskTimer.Enabled  = true;
                application.WriteMessage("任务运行机制启动完毕!");
            }
            else
            {
                application.WriteMessage("未设置RUNTASK参数为YES! 不启动任务运行机制!");
            }
        }
Example #3
0
 /// <summary>
 /// 写任务日志
 /// </summary>
 /// <param name="state">状态, 0:成功   1:警告  9:失败</param>
 /// <param name="_msg">消息</param>
 public virtual void WriteTaskLog(int state, string _msg)
 {
     SQL_TaskCommon.WriteTaskLog(this._Rwid, state, _msg);
 }
Example #4
0
        /// <summary>
        /// 写任务出错结果
        /// </summary>
        /// <param name="_errorMsg"></param>
        public virtual void WriteErrorResult(string _errorMsg)
        {
            DateTime _nextTime = _startTime.AddMinutes(_TimeStep);

            SQL_TaskCommon.WriteErrorResult(_Rwid, _startTime, _nextTime, _errorMsg);
        }
Example #5
0
        /// <summary>
        /// 写任务结果
        /// </summary>
        public virtual void WriteResult()
        {
            DateTime _nextTime = GetNextTime();

            SQL_TaskCommon.WriteResult(_Rwid, _startTime, _nextTime);
        }
Example #6
0
 /// <summary>
 /// 写任务开始状态
 /// </summary>
 public virtual void WriteRWState()
 {
     _startTime = DateTime.Now;
     SQL_TaskCommon.WriteRWState(_Rwid);
     WriteTaskLog(0, string.Format("任务[{0}]开始执行!", this._Rwid));
 }