From 8c6fd742db249ad4cc819cf041eb98d880a3ef73 Mon Sep 17 00:00:00 2001
From: hutongqing <hutongqing@hnkhzn.com>
Date: 星期四, 02 一月 2025 15:09:07 +0800
Subject: [PATCH] 1

---
 WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs |   41 ++++++++++++++++++++++++++---------------
 1 files changed, 26 insertions(+), 15 deletions(-)

diff --git a/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs b/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs
index d46c554..f82ab1f 100644
--- a/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs
+++ b/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs
@@ -36,7 +36,7 @@
 namespace WIDESEAWCS_Tasks
 {
     [DisallowConcurrentExecution]
-    public class CommonConveyorLineJob : IJob
+    public class CommonConveyorLineJob : JobBase, IJob, IDisposable
     {
         private readonly ITaskService _taskService;
         private readonly ITaskExecuteDetailService _taskExecuteDetailService;
@@ -59,29 +59,34 @@
                 CommonConveyorLine conveyorLine = (CommonConveyorLine)context.JobDetail.JobDataMap.Get("JobParams");
                 if (conveyorLine != null)
                 {
+                    short[] values = conveyorLine.Communicator.Read<short>("DB2.0", 20);
+
+                    //bool result = conveyorLine.Communicator.Write("DB1.0", "AAABBB");
+                    //string testVal = conveyorLine.Communicator.Read<string>("DB1.0");
+
                     List<string> childDeviceCodes = _routerService.QueryAllPositions(conveyorLine.DeviceCode);
                     List<Task> tasks = new List<Task>();
                     foreach (string childDeviceCode in childDeviceCodes)
                     {
                         //Task task = Task.Run(() =>
                         //{
-                            ConveyorLineTaskCommand command = conveyorLine.ReadCustomer<ConveyorLineTaskCommand>(childDeviceCode);
-                            if (command != null)
+                        ConveyorLineTaskCommand command = conveyorLine.ReadCustomer<ConveyorLineTaskCommand>(childDeviceCode);
+                        if (command != null)
+                        {
+                            DeviceProtocolDetailDTO? deviceProtocolDetail = conveyorLine.DeviceProtocolDetailDTOs.FirstOrDefault(x => x.ProtocalDetailValue == command.InteractiveSignal.ToString() && x.DeviceProParamName == nameof(ConveyorLineTaskCommand.InteractiveSignal));
+                            if (deviceProtocolDetail != null)
                             {
-                                DeviceProtocolDetailDTO? deviceProtocolDetail = conveyorLine.DeviceProtocolDetailDTOs.FirstOrDefault(x => x.ProtocalDetailValue == command.InteractiveSignal.ToString() && x.DeviceProParamName == nameof(ConveyorLineTaskCommand.InteractiveSignal));
-                                if (deviceProtocolDetail != null)
+                                MethodInfo? method = GetType().GetMethod(deviceProtocolDetail.ProtocolDetailType);
+                                if (method != null)
                                 {
-                                    MethodInfo? method = GetType().GetMethod(deviceProtocolDetail.ProtocolDetailType);
-                                    if (method != null)
-                                    {
-                                        method.Invoke(this, new object[] { conveyorLine, command, childDeviceCode });
-                                    }
-                                    else
-                                    {
-                                        //todo 鏈壘鍒版柟娉曟椂
-                                    }
+                                    method.Invoke(this, new object[] { conveyorLine, command, childDeviceCode });
+                                }
+                                else
+                                {
+                                    //todo 鏈壘鍒版柟娉曟椂
                                 }
                             }
+                        }
                         //});
                         //tasks.Add(task);
                     }
@@ -96,6 +101,7 @@
             }
             finally
             {
+                WriteDebug("CommonConveyorLineJob", "test");
                 //Console.Out.WriteLine(DateTime.Now);
             }
             return Task.CompletedTask;
@@ -107,7 +113,7 @@
         /// <param name="conveyorLine">杈撻�佺嚎瀹炰緥瀵硅薄</param>
         /// <param name="command">璇诲彇鐨勮姹備俊鎭�</param>
         /// <param name="childDeviceCode">瀛愯澶囩紪鍙�</param>
-        public void RequestInbound(CommonConveyorLine conveyorLine, ConveyorLineTaskCommand command,string childDeviceCode)
+        public void RequestInbound(CommonConveyorLine conveyorLine, ConveyorLineTaskCommand command, string childDeviceCode)
         {
             if (_taskService.RequestWMSTask(command.Barcode, childDeviceCode).Status)
             {
@@ -217,5 +223,10 @@
                 Console.Out.WriteLine(content.Serialize());
             }
         }
+
+        public void Dispose()
+        {
+            GC.SuppressFinalize(this);
+        }
     }
 }

--
Gitblit v1.9.3