From 208a9afadac81484fa150c0a236618facab93c52 Mon Sep 17 00:00:00 2001
From: duyongjia <adu_555@163.com>
Date: 星期一, 02 十二月 2024 11:17:39 +0800
Subject: [PATCH] 最新修改上传

---
 代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/DoubleStackerCraneJob.cs |   90 +++++++++++++++++++++++++++------------------
 1 files changed, 54 insertions(+), 36 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..a1cedbf 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);
+            //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("灏忓爢鍨涙満杩愯鏃ュ織", $"灏忓爢鍨涙満浠诲姟鍙穥task.TaskNum}");
                         StackerCraneTaskCommand? stackerCraneTaskCommand = ConvertToStackerCraneTaskCommand(task);
                         if (stackerCraneTaskCommand != null)
                         {
@@ -96,55 +95,74 @@
             }
             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浠诲姟瀹屾垚淇″彿鍊�:{IsOver}浠诲姟鍙凤細{tasknum}");
+                    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);
+                            Console.Out.WriteLine("TaskCompleted" + tasknum);
+                            bool issuccess = stackerCraneOne.SetValue(StackerCraneDBName.WorkType, 5);
+                            if (issuccess)
                             {
-                                _taskService.StackCraneTaskCompleted(tasknum);
-                                stackerCraneTwo.SetValue(StackerCraneDBName.WorkType, 5);
+                                WriteDebug(nameof(DoubleStackerCraneJob), $"灏忓爢鍨涙満SC02浠诲姟鍙峰啓鍏ヤ换鍔″畬鎴愮‘璁ゅ��5鎴愬姛{tasknum}");
+                            }
+                            else
+                            {
+                                WriteDebug(nameof(DoubleStackerCraneJob), $"灏忓爢鍨涙満SC02浠诲姟鍙峰啓鍏ヤ换鍔″畬鎴愮‘璁ゅ��5澶辫触{tasknum}");
+                            }
+
+                        }
+                    }
+                }
+
+                if (stackerCraneTwo != null)//SC03
+                {
+                    //璇诲彇鍫嗗灈鏈轰换鍔″彿鍜屼换鍔″畬鎴愮‘璁ょ姸鎬�
+                    byte IsOver = stackerCraneTwo.Communicator.Read<byte>("DB106.22");
+                    int tasknum = stackerCraneTwo.Communicator.Read<int>("DB106.18");
+                   // WriteDebug(nameof(DoubleStackerCraneJob), $"璇诲彇灏忓爢鍨涙満SC03浠诲姟瀹屾垚淇″彿鍊�:{IsOver}浠诲姟鍙凤細{tasknum}");
+                    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);
+                            if (issuccess)
+                            {
+                                WriteDebug(nameof(DoubleStackerCraneJob), $"灏忓爢鍨涙満SC03浠诲姟鍙峰啓鍏ヤ换鍔″畬鎴愮‘璁ゅ��5鎴愬姛{tasknum}");
+                            }
+                            else
+                            {
+                                WriteDebug(nameof(DoubleStackerCraneJob), $"灏忓爢鍨涙満SC03浠诲姟鍙峰啓鍏ヤ换鍔″畬鎴愮‘璁ゅ��5澶辫触{tasknum}");
                             }
                         }
                     }
                 }
-                catch (Exception ex)
-                {
-                    WriteError(nameof(DoubleStackerCraneJob), "鏌ヨ鎴栧啓鍏LC鐘舵�佸け璐ワ紒", ex);
-                }
+            }
+            catch (Exception ex)
+            {
+                WriteError(nameof(DoubleStackerCraneJob), "鏌ヨ鎴栧啓鍏LC鐘舵�佸け璐ワ紒", ex);
+            }
 
 
             //});
 
-            WriteDebug("灏忓爢鍨涙満杩愯鏃ュ織", "缁撴潫鏃堕棿" + DateTime.Now);
+            //WriteDebug("灏忓爢鍨涙満杩愯鏃ュ織", "缁撴潫鏃堕棿" + DateTime.Now);
             return Task.CompletedTask;
         }
 

--
Gitblit v1.9.3