111
zhanghonglin
2026-01-05 f797a0e6d079aa25aee23d7aa4064d144d1efa74
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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Quartz;
using WIDESEAWCS_QuartzJob;
using WIDESEAWCS_Tasks.DBName;
 
namespace WIDESEAWCS_Tasks
{
    [DisallowConcurrentExecution]
    public class FillingJob : JobBase, IJob
    {
        public Task Execute(IJobExecutionContext context)
        {
            //连接设备
            bool flag = context.JobDetail.JobDataMap.TryGetValue("JobParams", out object? value);
            if (flag && value != null)
            {
                OtherDevice device = (OtherDevice)value;
                //OtherDevice TCevice = (OtherDevice)Storage.Devices.Find(v => v.DeviceName == "天车");
                if (device.Communicator.IsConnected)
                {
                    //读
                    short a = device.GetValue<FillingDBName, short>(FillingDBName.R_ceshi);
                    //写
                    device.SetValue(FillingDBName.W_ceshia, "zy");
                    device.SetValue(FillingDBName.W_ceshib, "wq");
                    device.SetValue(FillingDBName.W_ceshic, "df");
                }
            }
            return Task.CompletedTask;
        }
    }
}