using Quartz; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading; using System.Threading.Tasks; using WIDESEA_Common.Tools; namespace WIDESEA_WCS { /// /// 入壳机上下料调度 /// [DisallowConcurrentExecution] public class JobRK_1209 : IJob { private static int lockObj1 = 0; public Task Execute(IJobExecutionContext context) { if (lockObj1 == 0) { try { lockObj1 = 1; Task task = Task.Run(() => { while (true) { try { WriteLog.GetLog().Write($"开始时间:{DateTime.Now} --------------", $"入壳机上下料调度"); StackerExecutor.RKSB_UpTask(); //入壳机上料任务 StackerExecutor.RKSB_DownTask(); //入壳机下料任务 WriteLog.GetLog().Write($"结束时间:{DateTime.Now} --------------", $"入壳机上下料调度"); } catch { } Thread.Sleep(200); } }); } catch (Exception ex) { lockObj1 = 0; throw new Exception(ex.Message); } } return Task.CompletedTask; } } }