From 52ba6b195a4126df405ef453d52ba6eaab6521da Mon Sep 17 00:00:00 2001
From: yanjinhui <3306209981@qq.com>
Date: 星期五, 17 四月 2026 17:37:32 +0800
Subject: [PATCH] 优化3-4楼提升机以及添加报错接口

---
 代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/HKTaskMethods.cs |   59 ++++++++++++++++++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 54 insertions(+), 5 deletions(-)

diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/HKTaskMethods.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/HKTaskMethods.cs"
index 606617e..fa1faeb 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/HKTaskMethods.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/HKTaskMethods.cs"
@@ -34,9 +34,10 @@
             try
             {
                 Dt_HKLocationInfo? hKLocationInfo = null;
-                if (taskType==(int)TaskTypeEnum.STURR)
+                int containerType = taskDTO.containerCode.Contains("LXM") ? (int)LocationTypeEnum.LargePallet : (int)LocationTypeEnum.SmallPallet;
+                if (taskType == (int)TaskTypeEnum.STURR)
                 {
-                    var reslut=_stationInfo.Repository.QueryFirst(x=>x.StationCode==taskDTO.fromLocationCode) ?? throw new Exception($"鏈壘鍒拌捣鐐硅揣浣嶃�恵taskDTO.fromLocationCode}銆�");
+                    var reslut = _stationInfo.Repository.QueryFirst(x => x.StationCode == taskDTO.fromLocationCode) ?? throw new Exception($"鏈壘鍒拌捣鐐硅揣浣嶃�恵taskDTO.fromLocationCode}銆�");
                 }
                 #region 鐐瑰埌鐐�
                 if (!string.IsNullOrEmpty(taskDTO.toLocationCode))
@@ -47,7 +48,7 @@
                 #endregion
                 //鑾峰彇璐т綅淇℃伅
                 else
-                    hKLocationInfo = _hKLocationInfoService.GetFreeLocationInfo(taskDTO.toAreaCode) ?? throw new Exception($"鏈壘鍒扮粓鐐瑰簱鍖恒�恵taskDTO.toAreaCode}銆戝彲鐢ㄧ┖璐т綅锛�");
+                    hKLocationInfo = _hKLocationInfoService.GetFreeLocationInfo(taskDTO.toAreaCode, containerType) ?? throw new Exception($"鏈壘鍒扮粓鐐瑰簱鍖恒�恵taskDTO.toAreaCode}銆戝彲鐢ㄧ┖璐т綅锛�");
                 if (taskType == (int)TaskTypeEnum.Q1TSJ4)
                 {
                     var device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == "TSJ") as OtherDevice;
@@ -143,7 +144,7 @@
                         throw new Exception($"缁堢偣绔欏彴銆恵taskDTO.toLocationCode}銆戠姸鎬佷笉涓虹┖闂诧紒");
                     }
                 }
-                    Dt_Task dt_Task = new Dt_Task()
+                Dt_Task dt_Task = new Dt_Task()
                 {
                     TaskNum = GetTaskNum(nameof(SequenceEnum.SeqTaskNum)),
                     WMSTaskNum = taskDTO.taskCode,
@@ -255,7 +256,7 @@
             {
                 var tasktype = (TaskTypeEnum)Enum.GetValues(typeof(TaskTypeEnum)).GetValue(task.TaskType - 1);
                 hIKROBOTTaskSubmit.initPriority = task.Grade;
-                if (task.PalletCode== "MR-Q3-600LE-D(M)")
+                if (task.PalletCode == "MR-Q3-600LE-D(M)")
                 {
                     hIKROBOTTaskSubmit.robotType = "19"; //娴峰悍 杞繍杞�
                 }
@@ -464,5 +465,53 @@
             return content;
         }
 
+
+
+        /// <summary>
+        /// 娴峰悍璁惧鎶ヨ
+        /// </summary>
+        /// <param name="hKDeviceAalarmDTO"></param>
+        /// <returns></returns>
+        public WebResponseContent HKDeviceAlarm(HKDeviceAalarmDTO hKDeviceAalarmDTO)
+        {
+            WebResponseContent content = new WebResponseContent();
+            WMSReturn wMSReturn = null;
+            HKDeviceAalarmDTO hIKROBOTDeviceAlarm = null;
+            try
+            {
+                Dt_ApiInfo? apiInfo = _apiInfoService.Repository.QueryFirst(x => x.ApiCode == nameof(HKDeviceAalarmDTO)) ?? throw new Exception("鏈壘鍒颁笂鎶ユ捣搴稟GV璁惧鎶ヨ鎺ュ彛閰嶇疆淇℃伅锛佽妫�鏌ユ帴鍙i厤缃�");
+                hIKROBOTDeviceAlarm = new HKDeviceAalarmDTO()
+                {
+                    robotTaskCode = hKDeviceAalarmDTO.robotTaskCode,
+                    taskWarnCode = hKDeviceAalarmDTO.taskWarnCode,
+                    startTime = hKDeviceAalarmDTO.startTime,
+                    singleRobotCode = hKDeviceAalarmDTO.singleRobotCode,
+                    errorCode = hKDeviceAalarmDTO.errorCode,
+                    errorMsg = hKDeviceAalarmDTO.errorMsg,
+                    extra = hKDeviceAalarmDTO.extra,
+                };
+
+                string response = HttpHelper.Post(apiInfo.ApiAddress,hIKROBOTDeviceAlarm.Serialize());
+                wMSReturn = response.DeserializeObject<WMSReturn>();
+                if (wMSReturn.success == true && wMSReturn.message == "success")
+                {
+                    content.OK("涓婃姤娴峰悍AGV璁惧鎶ヨ淇℃伅鎴愬姛");
+                }
+                else
+                {
+                    content.Error(wMSReturn.message);
+                }
+            }
+            catch (Exception ex)
+            {
+                content.Error(ex.Message);
+            }
+            finally
+            {
+                _trackloginfoService.AddTrackLog(hIKROBOTDeviceAlarm, content, "涓婃姤娴峰悍AGV璁惧鎶ヨ淇℃伅", "", "");
+            }
+            return content;
+        }
+
     }
 }

--
Gitblit v1.9.3