From d57815781381a23be2255f1f93b480950c6c39a8 Mon Sep 17 00:00:00 2001
From: huangxiaoqiang <huangxiaoqiang@hnkhzn.com>
Date: 星期五, 14 十一月 2025 17:20:24 +0800
Subject: [PATCH] 新增任务看板滚动功能及优化文档布局在 Home.vue中新增任务看板滚动显示功能,优化数据总览和图表样式新增 iconfont 字体文件及相关样式,提升页面视觉效果。在 TaskService.cs和 AGVSignal.cs中新增对RelocationGroup 的任务状态处理逻辑。新增EnumHelper.cs 中的枚举描述获取方法,支持动态描述解析优化按钮逻辑,统一“其他出库”和“调拨出库”的处理方式更新文档布局文件,调整引用路径、索引和视图状态。 在StockInfoService.cs中新增任务数据查询逻辑,支持任务状态描述返回。

---
 项目代码/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs |  205 ++++++++++++++++++++++++++++++--------------------
 1 files changed, 122 insertions(+), 83 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 244db76..4eceba9 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)
                         {
@@ -218,7 +209,7 @@
                     {
                         if (task.TaskState.GetTaskStateGroup() == TaskStateGroup.RelocationGroup)
                         {
-                            task.TaskState = (int)TaskRelocationStatusEnum.RelocationNew;
+                            //task.TaskState = (int)TaskRelocationStatusEnum.RelocationNew;
 
                             task.CurrentAddress = item.SourceAddress;
 
@@ -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,17 @@
                     if (task.TaskState == (int)TaskOutStatusEnum.SC_OutFinish)
                     {
                         content = StackCraneTaskCompleted(task.TaskNum);
+                        return content;
+                    }
+                    if (task.TaskState == (int)TaskOutStatusEnum.Line_OutExecuting)
+                    {
+                        string TargetAddress = GetLocation(task.PalletCode);
+                        if (TargetAddress == "")
+                        {
+                            return content.Error($"鏈幏鍙栧嚭搴撶粓鐐硅揣浣嶄俊鎭�");
+                        }
+                        task.NextAddress = TargetAddress;
+                        task.TargetAddress = TargetAddress;
                     }
 
                 }
@@ -495,45 +487,21 @@
                     {
                         #region 鍏ュ簱璋冪敤鎺ュ彛鑾峰彇璐т綅鍦板潃
 
-                        var taskDto = new RequestTaskDto()
+                        string TargetAddress= GetLocation(task.PalletCode);
+                        if (TargetAddress == null)
                         {
-                            Position = task.NextAddress,
-                            PalletCode = task.PalletCode,
-                        };
-
-                        // 鑾峰彇WMSip鍦板潃
-                        var configz = _sys_ConfigService.GetConfigsByCategory(CateGoryConst.CONFIG_SYS_IPAddress);
-                        var wmsBasez = configz.Where(x => x.ConfigKey == SysConfigKeyConst.WMSIP_BASE).FirstOrDefault()?.ConfigValue;
-                        var requestLocation = configz.Where(x => x.ConfigKey == SysConfigKeyConst.RequestLocation).FirstOrDefault()?.ConfigValue;
-                        if (wmsBasez == null || requestLocation == null)
-                        {
-                            throw new InvalidOperationException("WMS IP 鏈厤缃�");
+                            return content.Error($"鏈幏鍙栧叆搴撶粓鐐硅揣浣嶄俊鎭�");
                         }
-                        var wmsIpAddrss = wmsBasez + requestLocation;
-
-                        // 鍙戦�佽姹傚苟绛夊緟鍝嶅簲
-                        var abc = HttpHelper.PostAsync(wmsIpAddrss, taskDto.ToJsonString()).Result;
-                        if (abc == null)
-                            return content.Error();
-                        // 鍙嶅簭鍒楀寲鍝嶅簲鍐呭
-                        content = JsonConvert.DeserializeObject<WebResponseContent>(abc);
-
-                        LogFactory.WriteError($"鑾峰彇璐т綅", $"鑾峰彇璐т綅,浠诲姟鍙�:銆恵task.TaskNum}銆�,鎵樼洏鍙凤細銆恵task.PalletCode}銆戣繑鍥炲弬鏁般�恵JsonConvert.SerializeObject(content)}銆�");
-
-                        // 妫�鏌ョ姸鎬佸苟杩斿洖
-                        if (!content.Status)
-                        {
-                            return content;
-                        }
-
-                        // 鍙嶅簭鍒楀寲浠诲姟鏁版嵁
-                        var taskResult = JsonConvert.DeserializeObject<WMSTaskDTO>(content.Data.ToString());
 
                         task.CurrentAddress = task.NextAddress;
-                        task.NextAddress = task.TargetAddress;
-                        task.TargetAddress = task.NextAddress;
+                        task.NextAddress = TargetAddress;
+                        task.TargetAddress = TargetAddress;
 
                         #endregion 鍏ュ簱璋冪敤鎺ュ彛鑾峰彇璐т綅鍦板潃
+                    }
+                    else if (task.TaskState == (int)TaskInStatusEnum.Line_InExecuting)
+                    {
+                        UpdateStartLocationInfo(task);
                     }
                     else if (task.TaskState == (int)TaskInStatusEnum.SC_InFinish)
                     {
@@ -560,6 +528,28 @@
 
                     if (task.TaskState == (int)TaskAGVCarryStatusEnum.AGV_CarryFinish)
                     {
+                        CompletedTask(task.TaskNum);
+
+                        task.ModifyDate = DateTime.Now;
+                        task.Modifier = "System";
+
+                        Dt_Task_Hty task_Hty = _mapper.Map<Dt_Task_Hty>(task);
+                        task_Hty.TaskId = 0;
+
+                        BaseDal.DeleteData(task);
+                        _taskHtyRepository.AddData(task_Hty);
+                    }
+                }
+                else if (task.TaskState.GetTaskStateGroup() == TaskStateGroup.RelocationGroup)
+                {
+                    int nextStatus = task.TaskState.GetNextNotCompletedStatus<TaskRelocationStatusEnum>();
+
+                    task.TaskState = nextStatus;
+
+                    if (task.TaskState == (int)TaskRelocationStatusEnum.SC_RelocationFinish|| task.TaskState == (int)TaskRelocationStatusEnum.AGV_RelocationFinish)
+                    {
+                        CompletedTask(task.TaskNum);
+
                         task.ModifyDate = DateTime.Now;
                         task.Modifier = "System";
 
@@ -641,7 +631,7 @@
 
                         taskNew.CurrentAddress = stationManager.stationChildCode;
 
-                        taskNew.NextAddress = task.TargetAddress;
+                        taskNew.NextAddress = taskDTO.TargetAddress;
 
                         taskNew.Floor = stationManager.stationFloor;
 
@@ -704,6 +694,46 @@
             return content;
         }
 
+        public string GetLocation(string palletCode)
+        {
+            var config = _sys_ConfigService.GetConfigsByCategory(CateGoryConst.CONFIG_SYS_IPAddress);
+            var wmsBase = config.FirstOrDefault(x => x.ConfigKey == SysConfigKeyConst.WMSIP_BASE)?.ConfigValue;
+            var updateTask = config.FirstOrDefault(x => x.ConfigKey == SysConfigKeyConst.RequestLocation)?.ConfigValue;
+            if (wmsBase == null || updateTask == null)
+            {
+                throw new InvalidOperationException("WMS IP 鏈厤缃�");
+            }
+            var wmsIpAddress = wmsBase + updateTask;
+            var keys = new Dictionary<string, object>()
+            {
+                {"palletCode", palletCode}
+            };
+            var result = HttpHelper.GetAsync(wmsIpAddress, keys).Result;
+            WebResponseContent? content = JsonConvert.DeserializeObject<WebResponseContent>(result);
+            if (content.Status)
+            {
+                return content.Data.ToString();
+            }
+            else
+            {
+                return string.Empty;
+            }
+        }
+
+        public void UpdateStartLocationInfo(Dt_Task task)
+        {
+            var config = _sys_ConfigService.GetConfigsByCategory(CateGoryConst.CONFIG_SYS_IPAddress);
+            var wmsBase = config.FirstOrDefault(x => x.ConfigKey == SysConfigKeyConst.WMSIP_BASE)?.ConfigValue;
+            var updateTask = config.FirstOrDefault(x => x.ConfigKey == SysConfigKeyConst.UpdateStartLocationInfo)?.ConfigValue;
+            if (wmsBase == null || updateTask == null)
+            {
+                throw new InvalidOperationException("WMS IP 鏈厤缃�");
+            }
+            var wmsIpAddress = wmsBase + updateTask;
+
+            var result = HttpHelper.PostAsync(wmsIpAddress, task.ToJsonString()).Result;
+        }
+
         public void CompletedTask(int taskNum)
         {
             #region WMS鍚屾浠诲姟瀹屾垚
@@ -751,6 +781,10 @@
                     task.ModifyDate = DateTime.Now;
                     task.Modifier = "System";
                     BaseDal.UpdateData(task);
+
+                    UpdateStartLocationInfo(task);
+
+                    content.OK(data: task);
 
                     _taskExecuteDetailService.AddTaskExecuteDetail(task.TaskId, $"鍫嗗灈鏈哄嚭搴撳畬鎴�");
                 }
@@ -898,6 +932,11 @@
             return BaseDal.QueryFirst(x => x.Roadway == deviceNo && x.TaskType == (int)TaskRelocationTypeEnum.Relocation && x.TaskState == (int)TaskRelocationStatusEnum.RelocationNew);
         }
 
+        public Dt_Task QueryExecutingTask(string deviceNo)
+        {
+            return BaseDal.QueryFirst(x => x.Roadway == deviceNo &&( x.TaskState == (int)TaskRelocationStatusEnum.SC_RelocationExecuting || x.TaskState == (int)TaskOutStatusEnum.SC_OutExecuting || x.TaskState == (int)TaskInStatusEnum.SC_InExecuting));
+        }
+
 
         private string GetIpAddress(string baseIp, string name)
         {

--
Gitblit v1.9.3