1
yanjinhui
2025-06-12 10c497ad3b1802e1c8feed8df0a290a407ec72bc
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
using Autofac.Core;
using HslCommunication;
using HslCommunication.Core;
using HslCommunication.WebSocket;
using Microsoft.Extensions.Hosting;
using Microsoft.VisualBasic.FileIO;
using Newtonsoft.Json;
using Quartz;
using SixLabors.ImageSharp.PixelFormats;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using WIDESEAWCS_Communicator;
using WIDESEAWCS_Core.Helper;
using WIDESEAWCS_ISystemServices;
using WIDESEAWCS_ITaskInfoService;
using WIDESEAWCS_Model.Models;
using WIDESEAWCS_QuartzJob;
using WIDESEAWCS_QuartzJob.DeviceBase;
using WIDESEAWCS_QuartzJob.StackerCrane.Enum;
using WIDESEAWCS_Tasks.OHT;
 
namespace WIDESEAWCS_Tasks
{
    [DisallowConcurrentExecution]
    public class SSGOneJob : JobBase, IJob
    {
        public static bool W_ZXJ_Heat = true;
        public static bool W_TC_Heat = true;
        WebSocketServer _webSocketServer;
        private readonly Idt_ErrormsginfoService _ErrormsginfoService;
        public SSGOneJob(WebSocketServer webSocketServer,Idt_ErrormsginfoService errormsginfoService)
        {
            _webSocketServer = webSocketServer;
            _ErrormsginfoService = errormsginfoService;
        }
 
        public Task Execute(IJobExecutionContext context)
        {
            bool flag = context.JobDetail.JobDataMap.TryGetValue("JobParams", out object? value);
            if (flag && value != null)
            {                
                try
                {
                    OtherDevice device = (OtherDevice)value;
 
                    //状态数据发送给前端
                    string ohtData = JsonConvert.SerializeObject(device.Communicator.IsConnected);
                    _webSocketServer.PublishAllClientPayload(ohtData);
                }
                catch (Exception ex)
                {
                    //状态数据发送给前端
                    _webSocketServer.PublishAllClientPayload("false");
                    _ErrormsginfoService.UpdateErrorMsg(ex.Message, 1);
                }
            }
            return Task.CompletedTask;
        }
    }
}