1
huanghongfeng
2025-02-28 4d5e2e2340899e8cb8dd6855fcdd9ce384d78351
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
67
68
69
70
71
72
73
74
75
using HslCommunication;
using HslCommunication.Core;
using HslCommunication.WebSocket;
using Microsoft.AspNetCore.Http;
using Microsoft.VisualBasic.FileIO;
using Newtonsoft.Json;
using Quartz;
using Quartz.Util;
using SixLabors.ImageSharp.PixelFormats;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Reflection;
using System.Reflection.Metadata.Ecma335;
using System.Text;
using System.Threading.Tasks;
using WIDESEA_Common.Log;
using WIDESEAWCS_Communicator;
using WIDESEAWCS_Core.Helper;
using WIDESEAWCS_QuartzJob;
using WIDESEAWCS_QuartzJob.DeviceBase;
using WIDESEAWCS_QuartzJob.StackerCrane.Enum;
 
namespace WIDESEAWCS_Tasks
{
    [DisallowConcurrentExecution]
    public class LogJob : IJob
    {
        static object sendData = null;
        public Task Execute(IJobExecutionContext context)
        {
            try
            {
               
                Task.Run(() =>
                {
                    try
                    {
                        while (true)
                        {
                            Run(5);
                        }
                    }
                    catch { }
                });
 
            }
            catch (Exception ex)
            {
                Console.Out.WriteLine(nameof(LogJob) + ":" + ex.Message);
            }
 
            return Task.CompletedTask;
        }
        private static void Run(int saveDays)
        {
            sendData = new { code = "1002", Messagest = $"车轮SN号:123123123" };
            CacheData.WebSocket.PublishAllClientPayload(sendData.Serialize());
        }
 
        public class CacheData
        {
            public static WebSocketServer WebSocket = new WebSocketServer();
 
            public static void StartServer()
            {
                WebSocket = new WebSocketServer();
                WebSocket.ServerStart(1880);
            }
        }
    }
 
 
}