From 91f8fb7a6b52f5c6ff2119e34ef1359ec79d189e Mon Sep 17 00:00:00 2001
From: yanjinhui <3306209981@qq.com>
Date: 星期四, 16 四月 2026 19:11:11 +0800
Subject: [PATCH] 优化重写plc信号以及编写海康小车报警信号

---
 代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/HKTaskMethods.cs |   51 +++++++++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 47 insertions(+), 4 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..7bf7905 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,9 @@
             try
             {
                 Dt_HKLocationInfo? hKLocationInfo = null;
-                if (taskType==(int)TaskTypeEnum.STURR)
+                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))
@@ -143,7 +143,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 +255,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 +464,48 @@
             return content;
         }
 
+
+
+        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