SystemJob.cs 785 Bytes
using System;
using System.Threading.Tasks;
using Hh.Mes.Service.QuartzJobService;

namespace Quartz.Job
{
    /// <summary>
    /// 命名空间Quartz.Job 保持一致
    /// </summary>
    [PersistJobDataAfterExecution]
    [DisallowConcurrentExecution]
    public class SystemJob : IJob
    {
        public virtual Task Execute(IJobExecutionContext context)
        {
            try
            {
                new SystemJobService().Execute(null, null);
            }
            catch (Exception ex)
            {
                var jobContainer = new JobContainer(context)
                {
                    ExceptionInfo = ex.Message
                };
                jobContainer.LoggerJob();
            }
            return Task.CompletedTask;
        }
    }
}