wangxinhui
2024-12-26 78b99e5348592a29ca1393a5e13db619cc4eba56
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
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
{
    /// <summary>
    /// 入壳机上下料调度
    /// </summary>
    [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;
        }
    }
}