qinchulong
2025-03-29 039a4a5433e7f80adc88b491b549e5d9486e4f9a
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
using Quartz;
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
using WIDESEA_Common.Tools;
using WIDESEA_Core.Utilities;
using WIDESEA_WCS.Jobs;
using WIDESEA_WCS.SchedulerExecute.AGV;
using WIDESEA_WCS.WCSClient;
 
namespace WIDESEA_WCS
{
    [DisallowConcurrentExecution]
    public class AGVJob : JobBase, IJob
    {
        public Task Execute(IJobExecutionContext context)
        {
            try
            {
               
                List<string> AGVS = new List<string> { "正极1号AGV", "正极2号AGV", "负极1号AGV", "负极2号AGV" };
                foreach (var item in AGVS)
                {
                    PLCClient client = WCSService.Clients.Find(v => v.PLCName == item);
                    AGVSchedulerExecute.SendAGVTask1(client);//发送AGV任务
                    AGVSchedulerExecute.UpdateState(client);//更新AGV任务
                }
                //var executeLog = ExecuteJob(context, () => Run(context));
            }
            catch (Exception ex)
            {
                WriteLog.Info("SendAGVTask").Write(ex.Message.ToString() + DateTime.Now, "SendAGVTask");
            }
            return Task.FromResult(string.Empty);
        }
 
        public string Run(IJobExecutionContext context)
        {
            JobDataMap data = context.JobDetail.JobDataMap;
            PLCClient client = data.Get("JobParams") as PLCClient;
          
            AGVSchedulerExecute.SendAGVTask1(client);
            AGVSchedulerExecute.UpdateState(client);
            return "";
        }
    }
}