1
hutongqing
2024-09-13 3ca95f10e441ff66d4d62f8dfe202bfb26c3c8e8
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
76
77
78
79
80
81
82
83
84
using HslCommunication;
using HslCommunication.Core;
using Microsoft.VisualBasic.FileIO;
using Quartz;
using SixLabors.ImageSharp.PixelFormats;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
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 TestJob : IJob
    {
        public Task Execute(IJobExecutionContext context)
        {
            try
            {
                CommonStackerCrane commonStackerCrane = (CommonStackerCrane)context.JobDetail.JobDataMap.Get("JobParams");
 
                Console.Out.WriteLine(commonStackerCrane.DeviceName + "状态:" + commonStackerCrane.StackerCraneStatusDes);
 
                Console.Out.WriteLine(commonStackerCrane.DeviceName + "手自动状态:" + commonStackerCrane.StackerCraneAutoStatusDes);
 
                Console.Out.WriteLine(commonStackerCrane.DeviceName + "作业状态:" + commonStackerCrane.StackerCraneWorkStatusDes);
 
                //Console.Out.WriteLine(commonStackerCrane.DeviceName + "当前任务号:" + commonStackerCrane.GetValue<StackerCraneDBName, int>(StackerCraneDBName.CurrentTaskNum));
 
                //commonStackerCrane.SetValue(StackerCraneDBName.CurrentTaskNum, DateTime.Now.Second);
 
                //OperateResult<TimeSpan> operateResult = commonStackerCrane.Communicator.Wait("DB1.18", 1000, 60000, 1);
                //Console.Out.WriteLine(operateResult.Serialize());
 
                byte[] bytes = commonStackerCrane.Communicator.Read("DB1.1", 2);
                Console.Out.WriteLine(bytes.ToBoolArray().ToList().Serialize());
 
                bool[] bools = new bool[] { true, false, true };
                byte[] bytes1 = bools.ToByteArray();
                Console.Out.WriteLine(bytes1.ToList().Serialize());
 
                //StackerCraneCommand stackerCraneCommand = new StackerCraneCommand()
                //{
                //    TaskNum = 999,
                //    WorkType = 1,
                //    TrayType = 2,
                //    StartRow = 12,
                //    StartColumn = 13,
                //    StartLayer = 14,
                //    EndRow = 22,
                //    EndColumn = 23,
                //    EndLayer = 24,
                //};
 
                //bool flag = commonStackerCrane.SendCommand(stackerCraneCommand);
                //Console.Out.WriteLine(flag);
 
                //StackerCraneCommand stackerCraneCommand2 = new StackerCraneCommand();
                //stackerCraneCommand2 = commonStackerCrane.Communicator.ReadCustomer<StackerCraneCommand>("DB2.2");
                //Console.Out.WriteLine(stackerCraneCommand2.Serialize());
 
                Console.Out.WriteLine(DateTime.Now);
 
                Console.Out.WriteLine();
            }
            catch (Exception ex)
            {
                Console.Out.WriteLine(nameof(TestJob) + ":" + ex.Message);
            }
 
            return Task.CompletedTask;
        }
    }
 
    
}