From cb385f0b515c738b503c5c75c9d7efcec323716d Mon Sep 17 00:00:00 2001
From: duyongjia <adu_555@163.com>
Date: 星期五, 28 二月 2025 09:12:40 +0800
Subject: [PATCH] 数据库脚本提交

---
 代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/DoubleStackerCraneJob.cs |   85 +++++++++++++++++++++---------------------
 1 files changed, 42 insertions(+), 43 deletions(-)

diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/DoubleStackerCraneJob.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/DoubleStackerCraneJob.cs"
index b5d847a..a9eb49d 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/DoubleStackerCraneJob.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/DoubleStackerCraneJob.cs"
@@ -52,10 +52,9 @@
 
         public  Task Execute(IJobExecutionContext context)
         {
-            WriteDebug("灏忓爢鍨涙満杩愯鏃ュ織", "寮�濮嬫椂闂�" + DateTime.Now);
+            
             CommonStackerCrane? stackerCraneOne = Storage.Devices.FirstOrDefault(x => x.DeviceCode == "SC02") as CommonStackerCrane;
             CommonStackerCrane? stackerCraneTwo = Storage.Devices.FirstOrDefault(x => x.DeviceCode == "SC03") as CommonStackerCrane;
-            WriteDebug(nameof(DoubleStackerCraneJob), $"灏忓爢鍨涙満浠诲姟鎵ц涓�...");
           
             try
             {
@@ -63,11 +62,11 @@
                 Dt_Task? task = GetTask();
                 
                 if (task != null)
-                {
-                    WriteDebug("灏忓爢鍨涙満杩愯鏃ュ織", $"灏忓爢鍨涙満浠诲姟鍙穥task.TaskNum}");
+                {      
                     CommonStackerCrane? StackerCrane = GetStrackerCrane(task, stackerCraneOne, stackerCraneTwo);
                     if (StackerCrane != null)
                     {
+                        WriteDebug(nameof(DoubleStackerCraneJob), $"灏忓爢鍨涙満浠诲姟鍙穥task.TaskNum}--{StackerCrane.DeviceCode}");
                         StackerCraneTaskCommand? stackerCraneTaskCommand = ConvertToStackerCraneTaskCommand(task);
                         if (stackerCraneTaskCommand != null)
                         {
@@ -80,8 +79,8 @@
                             }
                             else
                             {
-                                _taskService.UpdateTaskExceptionMessage(task.TaskNum, "鍫嗗灈鏈烘墽琛屼换鍔″懡浠ゅけ璐ワ紒");
-                                WriteDebug(nameof(DoubleStackerCraneJob), "鍫嗗灈鏈烘墽琛屼换鍔″懡浠ゅけ璐ワ紒");
+                                _taskService.UpdateTaskExceptionMessage(task.TaskNum, "鍫嗗灈鏈哄彂閫佷换鍔″懡浠ゅけ璐ワ紒");
+                                WriteDebug(nameof(DoubleStackerCraneJob), $"鍫嗗灈鏈哄彂閫佷换鍔″懡浠ゅけ璐ワ紒{task.TaskNum}");
                             }
                         }
 
@@ -96,55 +95,55 @@
             }
             catch (Exception ex)
             {
-                WriteError(nameof(CommonStackerCraneJob), "灏忓爢鍨涙満鎵ц浠诲姟寮傚父锛�", ex);
+                WriteError(nameof(DoubleStackerCraneJob), "灏忓爢鍨涙満鎵ц浠诲姟寮傚父锛�", ex);
             }
 
-            //璇诲彇鍫嗗灈鏈轰换鍔″彿鍜屼换鍔″畬鎴愮‘璁ょ姸鎬�
-            //Task.Run(delegate
-            //{
-               
-                try
+          
+
+            try
+            {
+                if (stackerCraneOne != null)//SC02
                 {
-                    if (stackerCraneOne != null)
-                    {    
-                        byte IsFinish = stackerCraneOne.Communicator.Read<byte>("DB106.22");
-                        int tasknum = stackerCraneOne.Communicator.Read<int>("DB106.18");
-                        if (IsFinish == 6)
-                        {
-                            if (stackerCraneOne.GetValue<StackerCraneDBName, short>(StackerCraneDBName.WorkType) != 5)
-                            {
-                                //鏆傛椂 鍏堝啓5:瀹屾垚纭 淇″彿
-                                _taskService.StackCraneTaskCompleted(tasknum);
-                                stackerCraneOne.SetValue(StackerCraneDBName.WorkType, 5);
-
-                            }
-                        }
-                    }
-
-                    if (stackerCraneTwo != null)
+                    byte IsOver = stackerCraneOne.Communicator.Read<byte>("DB106.22");
+                    int tasknum = stackerCraneOne.Communicator.Read<int>("DB106.18");
+                    WriteDebug(nameof(DoubleStackerCraneJob), $"灏忓爢鍨涙満SC02浠诲姟鍙峰爢鍨涙満浠诲姟鍙凤細{tasknum}鐘舵�侊細{IsOver}");
+                    if (IsOver == 6)
                     {
-                        //璇诲彇鍫嗗灈鏈轰换鍔″彿鍜屼换鍔″畬鎴愮‘璁ょ姸鎬�
-                        byte IsFinish = stackerCraneTwo.Communicator.Read<byte>("DB106.22");
-                        int tasknum = stackerCraneTwo.Communicator.Read<int>("DB106.18");
-                        if (IsFinish == 6)
+                        if (stackerCraneOne.GetValue<StackerCraneDBName, short>(StackerCraneDBName.WorkType) != 5)
                         {
-                            if (stackerCraneTwo.GetValue<StackerCraneDBName, short>(StackerCraneDBName.WorkType) != 5)
-                            {
-                                _taskService.StackCraneTaskCompleted(tasknum);
-                                stackerCraneTwo.SetValue(StackerCraneDBName.WorkType, 5);
-                            }
+                            _taskService.StackCraneTaskCompleted(tasknum);
+                            Console.Out.WriteLine("TaskCompleted" + tasknum);
+                            bool issuccess = stackerCraneOne.SetValue(StackerCraneDBName.WorkType, 5);
+
                         }
                     }
                 }
-                catch (Exception ex)
+
+                if (stackerCraneTwo != null)//SC03
                 {
-                    WriteError(nameof(DoubleStackerCraneJob), "鏌ヨ鎴栧啓鍏LC鐘舵�佸け璐ワ紒", ex);
+                    //璇诲彇鍫嗗灈鏈轰换鍔″彿鍜屼换鍔″畬鎴愮‘璁ょ姸鎬�
+                    byte IsOver = stackerCraneTwo.Communicator.Read<byte>("DB106.22");
+                    int tasknum = stackerCraneTwo.Communicator.Read<int>("DB106.18");
+                    WriteDebug(nameof(DoubleStackerCraneJob), $"灏忓爢鍨涙満SC03浠诲姟鍙峰爢鍨涙満浠诲姟鍙凤細{tasknum}鐘舵�侊細{IsOver}");
+                    if (IsOver == 6)
+                    {
+                        if (stackerCraneTwo.GetValue<StackerCraneDBName, short>(StackerCraneDBName.WorkType) != 5)
+                        {
+                            _taskService.StackCraneTaskCompleted(tasknum);
+                            Console.Out.WriteLine("TaskCompleted" + tasknum);
+                            bool issuccess = stackerCraneTwo.SetValue(StackerCraneDBName.WorkType, 5);
+                           
+                        }
+                    }
                 }
+            }
+            catch (Exception ex)
+            {
+                WriteError(nameof(DoubleStackerCraneJob), "鎵ц寮傚父锛�", ex);
+            }
 
 
-            //});
-
-            WriteDebug("灏忓爢鍨涙満杩愯鏃ュ織", "缁撴潫鏃堕棿" + DateTime.Now);
+           
             return Task.CompletedTask;
         }
 

--
Gitblit v1.9.3