From c2b54113942b9e31a2a7b19001158b08df268a0a Mon Sep 17 00:00:00 2001
From: yanjinhui <3306209981@qq.com>
Date: 星期五, 06 三月 2026 17:46:29 +0800
Subject: [PATCH] 11

---
 代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs |   86 ++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 80 insertions(+), 6 deletions(-)

diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs"
index a16c631..7eb458b 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs"
@@ -16,10 +16,8 @@
 #endregion << 鐗� 鏈� 娉� 閲� >>
 
 using AutoMapper;
-using Dm;
 using SqlSugar;
 using System.Diagnostics.CodeAnalysis;
-using System.Threading.Tasks;
 using WIDESEAWCS_BasicInfoService;
 using WIDESEAWCS_Common;
 using WIDESEAWCS_Common.LocationEnum;
@@ -30,6 +28,7 @@
 using WIDESEAWCS_Core.Enums;
 using WIDESEAWCS_Core.Helper;
 using WIDESEAWCS_DTO;
+using WIDESEAWCS_DTO.AGV.HIKROBOT;
 using WIDESEAWCS_DTO.RGV.FOURBOT;
 using WIDESEAWCS_DTO.TaskInfo;
 using WIDESEAWCS_DTO.WMS;
@@ -71,7 +70,7 @@
         /// </summary>
         public IRepository<Dt_Task> Repository => BaseDal;
 
-        public TaskService(IRepository<Dt_Task> BaseDal, IRouterService routerService, ITaskExecuteDetailService taskExecuteDetailService, IRepository<Dt_TaskExecuteDetail> taskExecuteDetailRepository, IMapper mapper, IKLSLocationInfoService kLSLocationInfoService, IRGVLocationInfoService rGVLocationInfoService, IHKLocationInfoService hKLocationInfoService, IApiInfoService apiInfoService, ITrackloginfoService trackloginfoService) : base(BaseDal)
+        public TaskService(IRepository<Dt_Task> BaseDal, IRouterService routerService, ITaskExecuteDetailService taskExecuteDetailService, IRepository<Dt_TaskExecuteDetail> taskExecuteDetailRepository, IMapper mapper, IKLSLocationInfoService kLSLocationInfoService, IRGVLocationInfoService rGVLocationInfoService, IHKLocationInfoService hKLocationInfoService, IApiInfoService apiInfoService, ITrackloginfoService trackloginfoService, IStationMangerService stationMangerService) : base(BaseDal)
         {
             _routerService = routerService;
             _taskExecuteDetailService = taskExecuteDetailService;
@@ -82,6 +81,7 @@
             _hKLocationInfoService = hKLocationInfoService;
             _apiInfoService = apiInfoService;
             _trackloginfoService = trackloginfoService;
+            _stationMangerService=stationMangerService;
         }
         public WebResponseContent ReceiveWMSTask([NotNull] List<WMSTasksDTO> taskDTOs)
         {
@@ -160,7 +160,7 @@
                 bool isHK = dt_Task.TaskType == (int)TaskTypeEnum.Carry || dt_Task.TaskType == (int)TaskTypeEnum.CJInbound || dt_Task.TaskType == (int)TaskTypeEnum.CJInbound || dt_Task.TaskType == (int)TaskTypeEnum.CJOutbound;
                 //杩欓噷灏嗙姸鎬佹敼鍙樹簡198鍙栨秷浠诲姟
                 dt_Task.TaskType = TaskStatusEnum.WMSCancel.ObjToInt();
-                #region
+                #region 鍑箰澹�
                 if (isGALAXISTask)
                 {
                     var KLS = new CancelGALAXISTask
@@ -208,6 +208,32 @@
                         return content.Error($"浠诲姟澶辫触{fOURBOTReturn.data}");
                     }
                 }
+                #endregion
+                #region 娴峰悍
+                if (isHK)
+                {
+                    CancelHIKROBOTTask cancelHIKROBOTTask = new CancelHIKROBOTTask
+                    {
+                        robotTaskCode = dt_Task.WMSTaskNum,
+                        cancelType = "CANCEL"//鍘熻蒋鍙栨秷锛孌ROP浜哄伐浠嬪叆锛堝師纭彇娑堬級
+                    };
+                    Dt_ApiInfo? apiInfo = _apiInfoService.Repository.QueryFirst(x => x.ApiCode == nameof(CancelHIKROBOTTask));
+                    if (apiInfo == null) throw new Exception("鏈壘鍒板洓鍚戣溅AGV浠诲姟涓嬪彂鎺ュ彛閰嶇疆淇℃伅锛佽妫�鏌ユ帴鍙i厤缃�");
+                    string response = HttpHelper.Post(apiInfo.ApiAddress, cancelHIKROBOTTask.Serialize());
+                    HIKROBOTReturn hIKROBOTReturn = response.DeserializeObject<HIKROBOTReturn>();
+                    if (hIKROBOTReturn.code == "SUCCESS" && hIKROBOTReturn.message == "鎴愬姛")
+                    {
+                        //鐩存帴绉诲叆鍘嗗彶
+                        BaseDal.DeleteAndMoveIntoHty(dt_Task, OperateTypeEnum.鑷姩瀹屾垚);
+                        return content.OK("鍙栨秷浠诲姟鎴愬姛", dt_Task);
+                    }
+                    else
+                    {
+                        return content.Error($"浠诲姟澶辫触{hIKROBOTReturn.data}");
+                    }
+
+                }
+
                 #endregion
             }
             catch (Exception ex)
@@ -283,7 +309,7 @@
                     FOURBOTReturn fOURBOTReturn = response.DeserializeObject<FOURBOTReturn>();
                     if (fOURBOTReturn.returnCode == 0 && fOURBOTReturn.returnUserMsg == "鎴愬姛")
                     {
-
+                        BaseDal.UpdateData(dt_Task);
                         return content.OK("淇敼浠诲姟浼樺厛绾ф垚鍔�", dt_Task);
                     }
                     else
@@ -291,8 +317,31 @@
                         return content.Error($"浠诲姟澶辫触{fOURBOTReturn.data}");
                     }
                 }
-                #endregion
 
+                #endregion
+                #region 娴峰悍
+                if (isHK)
+                {
+                    var request = new HIKROBOTTaskGrade
+                    {
+                        robotTaskCode = dt_Task.WMSTaskNum,//浠诲姟鍙�
+                        initPriority = updateTaskPriority.taskPriority//浼樺厛绾�
+                    };
+                    Dt_ApiInfo? apiInfo = _apiInfoService.Repository.QueryFirst(x => x.ApiCode == nameof(HIKROBOTTaskGrade));
+                    if (apiInfo == null) throw new Exception("鏈壘鍒板洓鍚戣溅AGV浠诲姟涓嬪彂鎺ュ彛閰嶇疆淇℃伅锛佽妫�鏌ユ帴鍙i厤缃�");
+                    string response = HttpHelper.Post(apiInfo.ApiAddress, request.Serialize());
+                    HIKROBOTReturn hIKROBOTReturn = response.DeserializeObject<HIKROBOTReturn>();
+                    if (hIKROBOTReturn.code == "SUCCESS0" && hIKROBOTReturn.message == "鎴愬姛")
+                    {
+                        BaseDal.UpdateData(dt_Task);
+                        return content.OK("淇敼浠诲姟浼樺厛绾ф垚鍔�", dt_Task);
+                    }
+                    else
+                    {
+                        return content.Error($"浠诲姟澶辫触{hIKROBOTReturn.data}");
+                    }
+                }
+                #endregion
             }
             catch (Exception ex)
             {
@@ -1014,5 +1063,30 @@
                 return WebResponseContent.Instance.Error(ex.Message);
             }
         }
+
+        /// <summary>
+        /// 鎵归噺鏇存柊鍌ㄤ綅鐘舵��
+        /// </summary>
+        /// <param name="fOURBOTStorageStatusNotify"></param>
+        /// <returns></returns>
+        /// <exception cref="NotImplementedException"></exception>
+        public WebResponseContent multiSetNodeStatus(FOURBOTStorageStatusNotify fOURBOTStorageStatusNotify)
+        {
+            try
+            {
+                var Agvlocation = _rGVLocationInfoService.Repository.QueryData(x => fOURBOTStorageStatusNotify.storageCode.Contains(x.LocationCode));
+                foreach (var item in Agvlocation)
+                {
+                    item.LocationStatus = (int)(fOURBOTStorageStatusNotify.disable == 0 ? EnableStatusEnum.Normal : EnableStatusEnum.Disable);
+                }
+                _rGVLocationInfoService.UpdateData(Agvlocation);
+                return WebResponseContent.Instance.OK();
+            }
+            catch (Exception ex)
+            {
+
+                return WebResponseContent.Instance.Error(ex.Message);
+            }
+        }
     }
 }

--
Gitblit v1.9.3