From 9eeca6aa905cffea1c95d965b4790fbd20ce2275 Mon Sep 17 00:00:00 2001
From: hutongqing <hutongqing@hnkhzn.com>
Date: 星期五, 25 十月 2024 16:19:16 +0800
Subject: [PATCH] 更新字典数据获取

---
 WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs |   73 ++++++++++++++++++++++++++++++------
 1 files changed, 60 insertions(+), 13 deletions(-)

diff --git a/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs b/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs
index cf2f6af..b1f3bab 100644
--- a/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs
+++ b/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs
@@ -26,17 +26,17 @@
 using System.Threading.Tasks;
 using WIDESEAWCS_Core;
 using WIDESEAWCS_Core.Helper;
-using WIDESEAWCS_IBasicInfoService;
 using WIDESEAWCS_ITaskInfoService;
 using WIDESEAWCS_Model.Models;
 using WIDESEAWCS_QuartzJob;
 using WIDESEAWCS_QuartzJob.DTO;
+using WIDESEAWCS_QuartzJob.Service;
 using WIDESEAWCS_Tasks.ConveyorLineJob;
 
 namespace WIDESEAWCS_Tasks
 {
     [DisallowConcurrentExecution]
-    public class CommonConveyorLineJob : IJob
+    public class CommonConveyorLineJob : JobBase, IJob
     {
         private readonly ITaskService _taskService;
         private readonly ITaskExecuteDetailService _taskExecuteDetailService;
@@ -53,15 +53,18 @@
 
         public Task Execute(IJobExecutionContext context)
         {
+            //Console.Out.WriteLine(DateTime.Now);
             try
             {
                 CommonConveyorLine conveyorLine = (CommonConveyorLine)context.JobDetail.JobDataMap.Get("JobParams");
                 if (conveyorLine != null)
                 {
                     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)
                         {
@@ -75,38 +78,58 @@
                                 }
                                 else
                                 {
-                                    //todo 鏈壘鍒板搴斿鐞嗘柟娉�
+                                    //todo 鏈壘鍒版柟娉曟椂
                                 }
                             }
                         }
+                        //});
+                        //tasks.Add(task);
                     }
+
+                    Task.WaitAll(tasks.ToArray());
                 }
 
             }
             catch (Exception ex)
             {
-                Console.Out.WriteLine(nameof(CommonConveyorLineJob) + ":" + ex.ToString());
+                //Console.Out.WriteLine(nameof(CommonConveyorLineJob) + ":" + ex.ToString());
             }
-
+            finally
+            {
+                WriteDebug("CommonConveyorLineJob", "test");
+                //Console.Out.WriteLine(DateTime.Now);
+            }
             return Task.CompletedTask;
         }
 
-        public void RequestInbound(CommonConveyorLine conveyorLine, ConveyorLineTaskCommand command,string childDeviceCode)
+        /// <summary>
+        /// 杈撻�佺嚎璇锋眰鍏ュ簱
+        /// </summary>
+        /// <param name="conveyorLine">杈撻�佺嚎瀹炰緥瀵硅薄</param>
+        /// <param name="command">璇诲彇鐨勮姹備俊鎭�</param>
+        /// <param name="childDeviceCode">瀛愯澶囩紪鍙�</param>
+        public void RequestInbound(CommonConveyorLine conveyorLine, ConveyorLineTaskCommand command, string childDeviceCode)
         {
-            if (_taskService.RequestWMsTask(command.Barcode, childDeviceCode).Status)
+            if (_taskService.RequestWMSTask(command.Barcode, childDeviceCode).Status)
             {
                 Dt_Task task = _taskService.QueryConveyorLineTask(conveyorLine.DeviceCode, childDeviceCode);
                 if (task != null)
                 {
                     ConveyorLineTaskCommand taskCommand = _mapper.Map<ConveyorLineTaskCommand>(task);
                     taskCommand.InteractiveSignal = command.InteractiveSignal;
-                    bool t = conveyorLine.SendCommand(taskCommand, childDeviceCode);
+                    conveyorLine.SendCommand(taskCommand, childDeviceCode);
 
                     _taskService.UpdateTaskStatusToNext(task);
                 }
             }
         }
 
+        /// <summary>
+        /// 杈撻�佺嚎璇锋眰鍏ュ簱涓嬩竴鍦板潃
+        /// </summary>
+        /// <param name="conveyorLine">杈撻�佺嚎瀹炰緥瀵硅薄</param>
+        /// <param name="command">璇诲彇鐨勮姹備俊鎭�</param>
+        /// <param name="childDeviceCode">瀛愯澶囩紪鍙�</param>
         public void RequestInNextAddress(CommonConveyorLine conveyorLine, ConveyorLineTaskCommand command, string childDeviceCode)
         {
             Dt_Task task = _taskService.QueryExecutingConveyorLineTask(command.TaskNum, childDeviceCode);
@@ -117,11 +140,17 @@
                 {
                     ConveyorLineTaskCommand taskCommand = _mapper.Map<ConveyorLineTaskCommand>(newTask);
                     taskCommand.InteractiveSignal = command.InteractiveSignal;
-                    bool t = conveyorLine.SendCommand(taskCommand, childDeviceCode);
+                    conveyorLine.SendCommand(taskCommand, childDeviceCode);
                 }
             }
         }
 
+        /// <summary>
+        /// 杈撻�佺嚎鍏ュ簱瀹屾垚
+        /// </summary>
+        /// <param name="conveyorLine">杈撻�佺嚎瀹炰緥瀵硅薄</param>
+        /// <param name="command">璇诲彇鐨勮姹備俊鎭�</param>
+        /// <param name="childDeviceCode">瀛愯澶囩紪鍙�</param>
         public void ConveyorLineInFinish(CommonConveyorLine conveyorLine, ConveyorLineTaskCommand command, string childDeviceCode)
         {
             Dt_Task task = _taskService.QueryExecutingConveyorLineTask(command.TaskNum, childDeviceCode);
@@ -133,6 +162,12 @@
             }
         }
 
+        /// <summary>
+        /// 杈撻�佺嚎璇锋眰鍑轰俊鎭�
+        /// </summary>
+        /// <param name="conveyorLine">杈撻�佺嚎瀹炰緥瀵硅薄</param>
+        /// <param name="command">璇诲彇鐨勮姹備俊鎭�</param>
+        /// <param name="childDeviceCode">瀛愯澶囩紪鍙�</param>
         public void RequestOutbound(CommonConveyorLine conveyorLine, ConveyorLineTaskCommand command, string childDeviceCode)
         {
             Dt_Task task = _taskService.QueryConveyorLineTask(conveyorLine.DeviceCode, childDeviceCode);
@@ -140,12 +175,18 @@
             {
                 ConveyorLineTaskCommand taskCommand = _mapper.Map<ConveyorLineTaskCommand>(task);
                 taskCommand.InteractiveSignal = command.InteractiveSignal;
-                bool t = conveyorLine.SendCommand(taskCommand, childDeviceCode);
+                conveyorLine.SendCommand(taskCommand, childDeviceCode);
 
                 _taskService.UpdateTaskStatusToNext(task);
             }
         }
 
+        /// <summary>
+        /// 杈撻�佺嚎璇锋眰鍑哄簱涓嬩竴鍦板潃
+        /// </summary>
+        /// <param name="conveyorLine">杈撻�佺嚎瀹炰緥瀵硅薄</param>
+        /// <param name="command">璇诲彇鐨勮姹備俊鎭�</param>
+        /// <param name="childDeviceCode">瀛愯澶囩紪鍙�</param>
         public void RequestOutNextAddress(CommonConveyorLine conveyorLine, ConveyorLineTaskCommand command, string childDeviceCode)
         {
             Dt_Task task = _taskService.QueryExecutingConveyorLineTask(command.TaskNum, childDeviceCode);
@@ -156,17 +197,23 @@
                 {
                     ConveyorLineTaskCommand taskCommand = _mapper.Map<ConveyorLineTaskCommand>(newTask);
                     taskCommand.InteractiveSignal = command.InteractiveSignal;
-                    bool t = conveyorLine.SendCommand(taskCommand, childDeviceCode);
+                    conveyorLine.SendCommand(taskCommand, childDeviceCode);
                 }
             }
         }
 
+        /// <summary>
+        /// 杈撻�佺嚎鍑哄簱瀹屾垚
+        /// </summary>
+        /// <param name="conveyorLine">杈撻�佺嚎瀹炰緥瀵硅薄</param>
+        /// <param name="command">璇诲彇鐨勮姹備俊鎭�</param>
+        /// <param name="childDeviceCode">瀛愯澶囩紪鍙�</param>
         public void ConveyorLineOutFinish(CommonConveyorLine conveyorLine, ConveyorLineTaskCommand command, string childDeviceCode)
         {
             Dt_Task task = _taskService.QueryExecutingConveyorLineTask(command.TaskNum, childDeviceCode);
             if (task != null)
             {
-                bool t = conveyorLine.SetValue(ConveyorLineDBName.WriteInteractiveSignal, 0, childDeviceCode);
+                conveyorLine.SetValue(ConveyorLineDBName.WriteInteractiveSignal, 0, childDeviceCode);
                 WebResponseContent content = _taskService.UpdateTaskStatusToNext(task);
                 Console.Out.WriteLine(content.Serialize());
             }

--
Gitblit v1.9.3