From 6e9f630e4e12738d98241b684e6227e02010b6c5 Mon Sep 17 00:00:00 2001
From: Huangxiaoqiang-03 <1247017146@qq.com>
Date: 星期五, 01 十一月 2024 17:30:30 +0800
Subject: [PATCH] 1

---
 代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs |   65 +++++++++++++++++++-------------
 1 files changed, 38 insertions(+), 27 deletions(-)

diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs"
index 1178b32..6900e9a 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs"
@@ -1,4 +1,5 @@
-锘縰sing Microsoft.AspNetCore.Components.Routing;
+锘縰sing HslCommunication;
+using Microsoft.AspNetCore.Components.Routing;
 using Quartz;
 using SqlSugar.Extensions;
 using System;
@@ -8,12 +9,14 @@
 using System.Net;
 using System.Text;
 using System.Threading.Tasks;
+using WIDESEA_Core.Enums;
 using WIDESEAWCS_Core.Enums;
 using WIDESEAWCS_ITaskInfoRepository;
 using WIDESEAWCS_ITaskInfoService;
 using WIDESEAWCS_Model.Models;
 using WIDESEAWCS_QuartzJob;
 using WIDESEAWCS_QuartzJob.DeviceBase;
+using WIDESEAWCS_QuartzJob.DTO;
 using WIDESEAWCS_QuartzJob.Models;
 using WIDESEAWCS_QuartzJob.Service;
 using WIDESEAWCS_Tasks.StackerCraneJob;
@@ -93,7 +96,7 @@
             }
             catch (Exception ex)
             {
-                Console.WriteLine(nameof(CommonStackerCraneJob) + ":" + ex.ToString());
+                //Console.WriteLine(nameof(CommonStackerCraneJob) + ":" + ex.ToString());
             }
             return Task.CompletedTask;
         }
@@ -131,8 +134,8 @@
             }
             else
             {
-                bool flag = speStackerCrane.LastTaskType.GetValueOrDefault().GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup;
-                if (flag)
+                bool flag = speStackerCrane.LastTaskType == TaskTypeEnum.Inbound.ObjToInt() || speStackerCrane.LastTaskType == TaskTypeEnum.PalletInbound.ObjToInt();
+                if (flag==false)
                 {
                     task = _taskService.QueryStackerCraneInTask(speStackerCrane.DeviceCode);
                     if (task == null)
@@ -145,19 +148,6 @@
                     task = _taskService.QueryStackerCraneOutTask(speStackerCrane.DeviceCode);
                 }
             }
-
-            if (task != null && task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup)
-            {
-
-                List<Dt_Task> tasks = _taskService.QueryStackerCraneOutTasks(speStackerCrane.DeviceCode, task.TargetAddress);
-                foreach (var item in tasks)
-                {
-                    return task;
-                }
-                return task;
-
-            }
-
             return task;
         }
 
@@ -192,13 +182,34 @@
             return null;
         }
 
-        /// <summary>
-        /// 浠诲姟瀹炰綋杞崲鎴愬懡浠odel
-        /// </summary>
-        /// <param name="task">浠诲姟瀹炰綋</param>
-        /// <returns></returns>
-        /// <exception cref="Exception"></exception>
-        public StackerCraneTaskCommand? ConvertToStackerCraneTaskCommand([NotNull] Dt_Task task)
+        public bool SendCommands(StackerCraneTaskCommand command,SpeStackerCrane speStackerCrane)
+        {
+            try
+            {
+                speStackerCrane.SetValue(StackerCraneDBName.TaskNum, command.TaskNum);
+                speStackerCrane.SetValue(StackerCraneDBName.StartRow, command.StartRow);
+                speStackerCrane.SetValue(StackerCraneDBName.StartColumn, command.StartColumn);
+                speStackerCrane.SetValue(StackerCraneDBName.StartLayer, command.StartLayer);
+                speStackerCrane.SetValue(StackerCraneDBName.EndRow, command.EndRow);
+                speStackerCrane.SetValue(StackerCraneDBName.EndColumn, command.EndColumn);
+                speStackerCrane.SetValue(StackerCraneDBName.EndLayer, command.EndLayer);
+                speStackerCrane.SetValue(StackerCraneDBName.Barcode, command.Barcode);
+                speStackerCrane.SetValue(StackerCraneDBName.WorkType, command.WorkType);
+                speStackerCrane.SetValue(StackerCraneDBName.TrayType, command.TrayType);
+                return true;
+            }
+            catch (Exception ex)
+            {
+                return false;
+            }
+        }
+            /// <summary>
+            /// 浠诲姟瀹炰綋杞崲鎴愬懡浠odel
+            /// </summary>
+            /// <param name="task">浠诲姟瀹炰綋</param>
+            /// <returns></returns>
+            /// <exception cref="Exception"></exception>
+            public StackerCraneTaskCommand? ConvertToStackerCraneTaskCommand([NotNull] Dt_Task task)
         {
             StackerCraneTaskCommand stackerCraneTaskCommand = new StackerCraneTaskCommand();
 
@@ -206,7 +217,7 @@
             stackerCraneTaskCommand.TaskNum = task.TaskNum;
             stackerCraneTaskCommand.WorkType = 1;
             stackerCraneTaskCommand.TrayType = 0;
-            if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.InboundGroup)//鍒ゆ柇鏄惁鏄叆搴撲换鍔�
+            if (task.TaskType == TaskTypeEnum.Inbound.ObjToInt() || task.TaskType == TaskTypeEnum.PalletInbound.ObjToInt())//鍒ゆ柇鏄惁鏄叆搴撲换鍔�
             {
                 if (task.SourceAddress != null && task.TargetAddress != null)
                 {
@@ -243,7 +254,7 @@
                     return null;
                 }
             }
-            else if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup)
+            else if (task.TaskType == TaskTypeEnum.Outbound.ObjToInt() || task.TaskType == TaskTypeEnum.PalletOutbound.ObjToInt())
             {
                 if (task.SourceAddress != null && task.TargetAddress != null)
                 {
@@ -280,7 +291,7 @@
                     return null;
                 }
             }
-            else if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.RelocationGroup)
+            else if (task.TaskType == TaskTypeEnum.Relocation.ObjToInt())
             {
                 if (task.SourceAddress != null && task.TargetAddress != null)
                 {

--
Gitblit v1.9.3