From 8f7e6826d51a25c7b368c210dbb321d423d24a85 Mon Sep 17 00:00:00 2001
From: huangxiaoqiang <huangxiaoqiang@hnkhzn.com>
Date: 星期一, 10 十一月 2025 17:24:12 +0800
Subject: [PATCH] 1

---
 项目代码/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs |   89 ++++++++++++++++++++------------------------
 1 files changed, 40 insertions(+), 49 deletions(-)

diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs"
index 27df166..e5c00a9 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs"
@@ -3,6 +3,7 @@
 using LogLibrary.Log;
 using Mapster;
 using Newtonsoft.Json;
+using OfficeOpenXml.FormulaParsing.Excel.Functions.Math;
 using SqlSugar;
 using System.Diagnostics.CodeAnalysis;
 using System.Threading.Tasks;
@@ -123,28 +124,23 @@
 
                             task.NextAddress = station.stationChildCode;
 
-                            task.Floor = "1F";
+                            task.Floor = item.Floor;
 
                             task.AGVSign = "";
                         }
                         else if (task.TaskState.GetTaskStateGroup() == TaskStateGroup.AcrossFloorGroup)
                         {
-                            var station = _stationManagerRepository.QueryFirst(x => x.stationChildCode == item.SourceAddress);
+                            var next = _stationManagerRepository.QueryFirst(x => x.stationType == 5 && x.stationFloor == item.Floor);
 
-                            if (station != null)
-                            {
-                                var next = _stationManagerRepository.QueryFirst(x => x.stationType == 5 && x.stationFloor == station.stationFloor);
+                            task.TaskState = (int)TaskAcrossFloorStatusEnum.CarryNew;
 
-                                task.TaskState = (int)TaskAcrossFloorStatusEnum.CarryNew;
+                            task.CurrentAddress = item.SourceAddress;
 
-                                task.CurrentAddress = item.SourceAddress;
+                            task.NextAddress = next.stationChildCode;
 
-                                task.NextAddress = next.stationChildCode;
+                            task.Floor = item.Floor;
 
-                                task.Floor = station.stationFloor;
-
-                                task.AGVSign = "";
-                            }
+                            task.AGVSign = "";
                         }
                         else if (task.TaskState.GetTaskStateGroup() == TaskStateGroup.CarryGroup)
                         {
@@ -180,22 +176,17 @@
                         }
                         else if (task.TaskState.GetTaskStateGroup() == TaskStateGroup.AcrossFloorGroup)
                         {
-                            var station = _stationManagerRepository.QueryFirst(x => x.stationChildCode == item.SourceAddress);
+                            var next = _stationManagerRepository.QueryFirst(x => x.stationType == 5 && x.stationFloor == item.Floor);
 
-                            if (station != null)
-                            {
-                                var next = _stationManagerRepository.QueryFirst(x => x.stationType == 5 && x.stationFloor == station.stationFloor);
+                            task.TaskState = (int)TaskAcrossFloorStatusEnum.CarryNew;
 
-                                task.TaskState = (int)TaskAcrossFloorStatusEnum.CarryNew;
+                            task.CurrentAddress = item.SourceAddress;
 
-                                task.CurrentAddress = item.SourceAddress;
+                            task.NextAddress = next.stationChildCode;
 
-                                task.NextAddress = next.stationChildCode;
+                            task.Floor = item.Floor;
 
-                                task.Floor = station.stationFloor;
-
-                                task.AGVSign = "";
-                            }
+                            task.AGVSign = "";
                         }
                         else if (task.TaskState.GetTaskStateGroup() == TaskStateGroup.CarryGroup)
                         {
@@ -230,26 +221,20 @@
                         }
                         else if (task.TaskState.GetTaskStateGroup() == TaskStateGroup.AcrossFloorGroup)
                         {
-                            var station = _stationManagerRepository.QueryFirst(x => x.stationChildCode == item.SourceAddress);
+                            var next = _stationManagerRepository.QueryFirst(x => x.stationType == 5 && x.stationFloor == item.Floor);
 
-                            if (station != null)
-                            {
-                                var next = _stationManagerRepository.QueryFirst(x => x.stationType == 5 && x.stationFloor == station.stationFloor);
+                            task.TaskState = (int)TaskAcrossFloorStatusEnum.CarryNew;
 
-                                task.TaskState = (int)TaskAcrossFloorStatusEnum.CarryNew;
+                            task.CurrentAddress = item.SourceAddress;
 
-                                task.CurrentAddress = item.SourceAddress;
+                            task.NextAddress = next.stationChildCode;
 
-                                task.NextAddress = next.stationChildCode;
+                            task.Floor = item.Floor;
 
-                                task.Floor = station.stationFloor;
-
-                                task.AGVSign = "";
-                            }
+                            task.AGVSign = "";
                         }
                         else if (task.TaskState.GetTaskStateGroup() == TaskStateGroup.CarryGroup)
                         {
-                            var station = _stationManagerRepository.QueryFirst(x => x.stationChildCode == item.SourceAddress);
 
                             task.TaskState = (int)TaskAGVCarryStatusEnum.CarryNew;
 
@@ -257,7 +242,7 @@
 
                             task.NextAddress = task.TargetAddress;
 
-                            task.Floor = station.stationFloor;
+                            task.Floor = item.Floor;
 
                             task.AGVSign = "";
                         }
@@ -267,23 +252,19 @@
                     {
                         if (task.TaskState.GetTaskStateGroup() == TaskStateGroup.AcrossFloorGroup)
                         {
-                            var station = _stationManagerRepository.QueryFirst(x => x.stationChildCode == item.SourceAddress);
+                            var next = _stationManagerRepository.QueryFirst(x => x.stationType == 5 && x.stationFloor == item.Floor);
 
-                            if (station != null)
-                            {
-                                var next = _stationManagerRepository.QueryFirst(x => x.stationType == 5 && x.stationFloor == station.stationFloor);
+                            task.TaskState = (int)TaskAcrossFloorStatusEnum.CarryNew;
 
-                                task.TaskState = (int)TaskAcrossFloorStatusEnum.CarryNew;
+                            task.CurrentAddress = item.SourceAddress;
 
-                                task.CurrentAddress = item.SourceAddress;
+                            task.NextAddress = next.stationChildCode;
 
-                                task.NextAddress = next.stationChildCode;
+                            task.Floor = item.Floor;
 
-                                task.Floor = station.stationFloor;
-
-                                task.AGVSign = "";
-                            }
+                            task.AGVSign = "";
                         }
+
                     }
 
                     // 灏嗚浆鎹㈠悗鐨勪换鍔℃坊鍔犲埌浠诲姟鍒楄〃涓�
@@ -387,7 +368,7 @@
         /// <returns></returns>
         public Dt_Task QueryRequestTSJSignalTask()
         {
-            return BaseDal.QueryFirst(x => TaskAcrossFloorboundTypes.Contains(x.TaskType) && x.TaskState > (int)TaskAcrossFloorStatusEnum.CarryNew && (x.AGVSign == "RequestPickUp" || x.AGVSign == "RequestPut"));
+            return BaseDal.QueryFirst(x =>  x.TaskState > (int)TaskAcrossFloorStatusEnum.CarryNew && (x.AGVSign == "RequestPickUp" || x.AGVSign == "RequestPut"));
         }
 
         #endregion
@@ -483,6 +464,12 @@
                     if (task.TaskState == (int)TaskOutStatusEnum.SC_OutFinish)
                     {
                         content = StackCraneTaskCompleted(task.TaskNum);
+                        return content;
+                    }
+                    if (task.TaskState == (int)TaskOutStatusEnum.Line_OutExecuting)
+                    {
+                        var station = _stationManagerRepository.QueryFirst(x => x.stationChildCode == task.TargetAddress);
+                        SendAgvTask(station.stationRemark, task.TaskNum);
                     }
 
                 }
@@ -518,7 +505,7 @@
                         //// 鍙嶅簭鍒楀寲鍝嶅簲鍐呭
                         //content = JsonConvert.DeserializeObject<WebResponseContent>(abc);
 
-                        //LogFactory.WriteError($"Info_鑾峰彇璐т綅", $"鑾峰彇璐т綅,浠诲姟鍙�:銆恵task.TaskNum}銆�,鎵樼洏鍙凤細銆恵task.PalletCode}銆戣繑鍥炲弬鏁般�恵JsonConvert.SerializeObject(content)}銆憑Environment.NewLine}{Environment.NewLine}");
+                        //LogFactory.WriteError($"鑾峰彇璐т綅", $"鑾峰彇璐т綅,浠诲姟鍙�:銆恵task.TaskNum}銆�,鎵樼洏鍙凤細銆恵task.PalletCode}銆戣繑鍥炲弬鏁般�恵JsonConvert.SerializeObject(content)}銆�");
 
                         //// 妫�鏌ョ姸鎬佸苟杩斿洖
                         //if (!content.Status)
@@ -560,6 +547,8 @@
 
                     if (task.TaskState == (int)TaskAGVCarryStatusEnum.AGV_CarryFinish)
                     {
+                        CompletedTask(task.TaskNum);
+
                         task.ModifyDate = DateTime.Now;
                         task.Modifier = "System";
 
@@ -752,6 +741,8 @@
                     task.Modifier = "System";
                     BaseDal.UpdateData(task);
 
+                    content.OK(data: task);
+
                     _taskExecuteDetailService.AddTaskExecuteDetail(task.TaskId, $"鍫嗗灈鏈哄嚭搴撳畬鎴�");
                 }
                 else if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.InboundGroup && task.TaskState == (int)TaskInStatusEnum.SC_InExecuting)

--
Gitblit v1.9.3