wanshenmean
12 小时以前 96adc295cb04fd135d63d3a907f2732274f90965
Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_QuartzJob/QuartzNet/SchedulerCenterServer.cs
@@ -31,6 +31,7 @@
using WIDESEAWCS_QuartzJob.DTO;
using WIDESEAWCS_QuartzJob.CustomException;
using Quartz.Impl.Matchers;
using WIDESEAWCS_Core.LogHelper;
namespace WIDESEAWCS_QuartzJob
{
@@ -85,7 +86,7 @@
            WebResponseContent result = new WebResponseContent();
            try
            {
                if (_scheduler.IsShutdown && _scheduler.IsStarted)
                if (_scheduler.IsShutdown || !_scheduler.IsStarted)
                {
                    // 从Factory中获取Scheduler实例
                    NameValueCollection collection = new NameValueCollection
@@ -103,13 +104,13 @@
                {
                    //等待任务运行完成
                    await this._scheduler.Start();
                    await Console.Out.WriteLineAsync(QuartzJobInfoMessage.StartJobSuccess);
                    QuartzLogger.Info(QuartzJobInfoMessage.StartJobSuccess);
                    result = WebResponseContent.Instance.OK(QuartzJobInfoMessage.StartJobSuccess);
                    return result;
                }
                else
                {
                    await _scheduler.Shutdown();
                    // 调度器已在运行,直接返回提示
                    result = WebResponseContent.Instance.Error(QuartzJobInfoMessage.JobHasStart);
                    return result;
                }
@@ -134,16 +135,13 @@
                    //等待任务运行完成
                    await _scheduler.Shutdown(false);
                    await Console.Out.WriteLineAsync(QuartzJobInfoMessage.StopJobSuccess);
                    QuartzLogger.Info(QuartzJobInfoMessage.StopJobSuccess);
                    result = WebResponseContent.Instance.OK(QuartzJobInfoMessage.StopJobSuccess);
                    return result;
                }
                else
                {
                    IReadOnlyCollection<string> jobGroupNames = await _scheduler.GetJobGroupNames();
                    await _scheduler.PauseAll();
                    // 调度器已停止,直接返回提示(不再对已 shutdown 的 scheduler 调用 PauseAll)
                    result = WebResponseContent.Instance.Error(QuartzJobInfoMessage.JobHasStop);
                    return result;
                }
@@ -168,7 +166,7 @@
            {
                try
                {
                    if (_scheduler.IsShutdown && _scheduler.IsStarted)
                    if (_scheduler.IsShutdown || !_scheduler.IsStarted)
                    {
                        // 从Factory中获取Scheduler实例
                        NameValueCollection collection = new NameValueCollection