From a4122d504f8fc5f0626eaa0cbc270b47742812d9 Mon Sep 17 00:00:00 2001
From: hutongqing <hutongqing@hnkhzn.com>
Date: 星期一, 26 八月 2024 17:13:36 +0800
Subject: [PATCH] 1

---
 WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs |   21 ++++++++-------------
 1 files changed, 8 insertions(+), 13 deletions(-)

diff --git a/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs b/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs
index 77f830e..11a4743 100644
--- a/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs
+++ b/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs
@@ -55,7 +55,7 @@
                             if (task != null)
                             {
                                 StackerCraneTaskCommand? stackerCraneTaskCommand = ConvertToStackerCraneTaskCommand(task);
-                                if(stackerCraneTaskCommand != null)
+                                if (stackerCraneTaskCommand != null)
                                 {
                                     bool sendFlag = commonStackerCrane.SendCommand(stackerCraneTaskCommand);
                                     if (sendFlag)
@@ -84,7 +84,7 @@
         private void CommonStackerCrane_StackerCraneTaskCompletedEventHandler(object? sender, WIDESEAWCS_QuartzJob.StackerCrane.StackerCraneTaskCompletedEventArgs e)
         {
             CommonStackerCrane commonStackerCrane = sender as CommonStackerCrane;
-            if (commonStackerCrane.GetValue<StackerCraneDBName,short>(StackerCraneDBName.WorkType) != 5)
+            if (commonStackerCrane.GetValue<StackerCraneDBName, short>(StackerCraneDBName.WorkType) != 5)
             {
                 Console.Out.WriteLine("TaskCompleted" + e.TaskNum);
                 _taskService.StackCraneTaskCompleted(e.TaskNum);
@@ -106,10 +106,10 @@
             }
             else
             {
-                if (!int.TryParse(Enum.Parse<TaskOutboundTypeEnum>(commonStackerCrane.LastTaskType.ToString()).ToString(), out int taskType))
+                if (commonStackerCrane.LastTaskType.GetValueOrDefault().GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup)
                 {
                     task = _taskService.QueryStackerCraneInTask(commonStackerCrane.DeviceCode);
-                    if(task == null)
+                    if (task == null)
                     {
                         task = _taskService.QueryStackerCraneOutTask(commonStackerCrane.DeviceCode);
                     }
@@ -120,7 +120,7 @@
                 }
             }
 
-            if (task != null && !int.TryParse(Enum.Parse<TaskOutboundTypeEnum>(task.TaskType.ToString()).ToString(), out int result))
+            if (task != null && task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup)
             {
                 if (OutTaskStationIsOccupied(task) != null)
                 {
@@ -189,7 +189,7 @@
             stackerCraneTaskCommand.TaskNum = task.TaskNum;
             stackerCraneTaskCommand.WorkType = 1;
             stackerCraneTaskCommand.TrayType = 0;
-            if (!int.TryParse(Enum.Parse<TaskInboundTypeEnum>(task.TaskType.ToString()).ToString(), out int result))//鍒ゆ柇鏄惁鏄叆搴撲换鍔�
+            if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.InboundGroup)//鍒ゆ柇鏄惁鏄叆搴撲换鍔�
             {
                 List<Dt_Router> routers = _routerService.QueryNextRoutes(task.CurrentAddress, task.Roadway);
                 if (routers.Count > 0)
@@ -218,7 +218,7 @@
                     return null;
                 }
             }
-            else if (!int.TryParse(Enum.Parse<TaskOutboundTypeEnum>(task.TaskType.ToString()).ToString(), out result))
+            else if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup)
             {
                 List<Dt_Router> routers = _routerService.QueryNextRoutes(task.Roadway, task.TargetAddress);
                 if (routers.Count > 0)
@@ -247,7 +247,7 @@
                     return null;
                 }
             }
-            else if (!int.TryParse(Enum.Parse<TaskRelocationTypeEnum>(task.TaskType.ToString()).ToString(), out result))
+            else if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.RelocationGroup)
             {
                 string[] targetCodes = task.NextAddress.Split("-");
                 if (targetCodes.Length == 3)
@@ -276,11 +276,6 @@
                     return null;
                 }
             }
-            else if (!int.TryParse(Enum.Parse<TaskOtherTypeEnum>(task.TaskType.ToString()).ToString(), out result))
-            {
-
-            }
-
             return stackerCraneTaskCommand;
         }
     }

--
Gitblit v1.9.3