From f94288b728f81b20c29e626526c584c11a7894a3 Mon Sep 17 00:00:00 2001
From: z8018 <1282578289@qq.com>
Date: 星期六, 05 四月 2025 14:02:06 +0800
Subject: [PATCH] 1

---
 项目代码/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/Gantry/GantryJob.cs |   42 +++++++++++++++++++++++++++++-------------
 1 files changed, 29 insertions(+), 13 deletions(-)

diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/Gantry/GantryJob.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/Gantry/GantryJob.cs"
index 40f70f0..0834dca 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/Gantry/GantryJob.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/Gantry/GantryJob.cs"
@@ -4,6 +4,9 @@
 using System.Text;
 using System.Threading.Tasks;
 using Quartz;
+using WIDESEAWCS_Common.TaskEnum;
+using WIDESEAWCS_Core.Helper;
+using WIDESEAWCS_IBasicInfoRepository;
 using WIDESEAWCS_ITaskInfoRepository;
 using WIDESEAWCS_ITaskInfoService;
 using WIDESEAWCS_Model.Models;
@@ -19,10 +22,12 @@
     {
         private readonly ITaskRepository _taskRepository;
         private readonly ITaskService _taskService;
-        public GantryJob(ITaskRepository taskRepository, ITaskService taskService)
+        private readonly IContainerItemRepository _containerItemRepository;
+        public GantryJob(ITaskRepository taskRepository, ITaskService taskService, IContainerItemRepository containerItemRepository)
         {
             _taskRepository = taskRepository;
             _taskService = taskService;
+            _containerItemRepository = containerItemRepository;
         }
 
         public Task Execute(IJobExecutionContext context)
@@ -48,36 +53,47 @@
                         if(task != null)
                         {
                             string[] takePositions = task.CurrentAddress.Split("-");
-                            if(takePositions.Length != 4)
+                            if(takePositions.Length != 5)
                             {
                                 //WriteError
                                 return Task.CompletedTask;
                             }
 
                             string[] putPositions = task.NextAddress.Split("-");
-                            if (putPositions.Length != 4)
+                            if (putPositions.Length != 5)
                             {
                                 //WriteError
                                 return Task.CompletedTask;
                             }
-                            otherDevice.SetValue(GantryDBName.TwoHand, task.TaskNum);
+
+                            Dt_ContainerItem containerItem = _containerItemRepository.QueryFirst(x => x.ItemCode == task.PalletCode);
+                            if (containerItem == null)
+                            {
+                                //WriteError
+                                return Task.CompletedTask;
+                            }
+
+                            otherDevice.SetValue(GantryDBName.TwoHand, true);
 
                             otherDevice.SetValue(GantryDBName.TaskNum, task.TaskNum);
-                            otherDevice.SetValue(GantryDBName.TakePosition, Convert.ToInt32(takePositions[0]));
+                            //otherDevice.SetValue(GantryDBName.TakePosition, Convert.ToInt32(takePositions[0]));
                             otherDevice.SetValue(GantryDBName.TakePositionX, Convert.ToInt32(takePositions[1]));
                             otherDevice.SetValue(GantryDBName.TakePositionY, Convert.ToInt32(takePositions[2]));
                             otherDevice.SetValue(GantryDBName.TakePositionZ, Convert.ToInt32(takePositions[3]));
-                            otherDevice.SetValue(GantryDBName.TakePositionR, 0);
-                            otherDevice.SetValue(GantryDBName.PutPosition, Convert.ToInt32(putPositions[0]));
+                            otherDevice.SetValue(GantryDBName.TakePositionR, Convert.ToInt32(takePositions[4]));
+                            //otherDevice.SetValue(GantryDBName.PutPosition, Convert.ToInt32(putPositions[0]));
                             otherDevice.SetValue(GantryDBName.PutPositionX, Convert.ToInt32(putPositions[1]));
                             otherDevice.SetValue(GantryDBName.PutPositionY, Convert.ToInt32(putPositions[2]));
                             otherDevice.SetValue(GantryDBName.PutPositionZ, Convert.ToInt32(putPositions[3]));
-                            otherDevice.SetValue(GantryDBName.PutPositionR, 0);
-                            otherDevice.SetValue(GantryDBName.Length, task.TaskNum);
-                            otherDevice.SetValue(GantryDBName.Width, task.TaskNum);
-                            otherDevice.SetValue(GantryDBName.Height, task.TaskNum);
-                            otherDevice.SetValue(GantryDBName.WorkType, task.TaskNum);
-                            otherDevice.SetValue(GantryDBName.StartCommand, task.TaskNum);
+                            otherDevice.SetValue(GantryDBName.PutPositionR, Convert.ToInt32(putPositions[4]));
+                            otherDevice.SetValue(GantryDBName.Length, containerItem.ItemLength);
+                            otherDevice.SetValue(GantryDBName.Width, containerItem.ItemWidth);
+                            otherDevice.SetValue(GantryDBName.Height, containerItem.ItemHeight);
+                            otherDevice.SetValue(GantryDBName.WorkType, 1);
+                            otherDevice.SetValue(GantryDBName.StartCommand, 1);
+
+                            task.TaskState = TaskStatusEnum.Gantry_Executing.ObjToInt();
+                            _taskRepository.UpdateData(task);
                         }
                     }
                     else if(gantryWorkStatus == 5)

--
Gitblit v1.9.3