From 24fd3e64d49d386bed242cdbfbf91fc875a7425e Mon Sep 17 00:00:00 2001
From: yanjinhui <3306209981@qq.com>
Date: 星期六, 14 三月 2026 10:28:09 +0800
Subject: [PATCH] Merge branch 'master' of http://115.159.85.185:8098/r/RuiShengZhiNeng/GaoPuLiTiKu

---
 代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/KLSTaskMethods.cs |   68 ++++++++++++++++++++++++++++++---
 1 files changed, 61 insertions(+), 7 deletions(-)

diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/KLSTaskMethods.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/KLSTaskMethods.cs"
index a94fe87..1b24246 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/KLSTaskMethods.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/KLSTaskMethods.cs"
@@ -10,6 +10,9 @@
 using WIDESEAWCS_Common.LocationEnum;
 using WIDESEAWCS_Common;
 using WIDESEAWCS_Common.TaskEnum;
+using WIDESEAWCS_DTO;
+using WIDESEAWCS_ITaskInfoService;
+using WIDESEAWCS_Core.Helper;
 
 namespace WIDESEAWCS_TaskInfoService
 {
@@ -26,12 +29,12 @@
             WebResponseContent content = new WebResponseContent();
             try
             {
-                int containerType = taskDTO.containerCode.Contains("LLM") ? LocationTypeEnum.LargePallet.ObjToInt() : LocationTypeEnum.SmallPallet.ObjToInt();
+                int containerType = taskDTO.containerCode.Contains("LLM") ? (int)LocationTypeEnum.LargePallet : (int)LocationTypeEnum.SmallPallet;
                 #region 鐐瑰埌鐐�
                 if (!string.IsNullOrEmpty(taskDTO.toLocationCode))
                 {
                     var LocationInfo = _kLSLocationInfoService.Repository.QueryFirst(x => x.LocationCode == taskDTO.toLocationCode) ?? throw new Exception($"鏈壘鍒扮粓鐐硅揣浣嶃�恵taskDTO.toLocationCode}銆�");
-                    if (LocationInfo.LocationStatus != LocationStatusEnum.Free.ObjToInt()) throw new Exception($"缁堢偣璐т綅銆恵taskDTO.toLocationCode}銆戣揣浣嶇姸鎬佷笉涓虹┖璐т綅");
+                    if (LocationInfo.LocationStatus != (int)LocationStatusEnum.Free) throw new Exception($"缁堢偣璐т綅銆恵taskDTO.toLocationCode}銆戣揣浣嶇姸鎬佷笉涓虹┖璐т綅");
                 }
                 #endregion
                 //鑾峰彇璐т綅淇℃伅
@@ -44,7 +47,7 @@
                     Grade = taskDTO.taskPriority,
                     PalletCode = taskDTO.containerCode,
                     Roadway = kLSLocationInfo.RoadwayNo,
-                    TaskState = TaskStatusEnum.New.ObjToInt(),
+                    TaskState = (int)TaskStatusEnum.New,
                     TaskType = taskType,
                     SourceAddress = taskDTO.fromLocationCode,
                     CurrentAddress = taskDTO.fromLocationCode,
@@ -52,7 +55,12 @@
                     TargetAddress = kLSLocationInfo.LocationCode,
                     Creater = "WMS",
                 };
-                kLSLocationInfo.LocationStatus = LocationStatusEnum.InLock.ObjToInt();
+                kLSLocationInfo.LocationStatus = (int)LocationStatusEnum.InLock;
+                #region 涓嬪彂鍑箰澹换鍔�
+                content = SendKLSTask(dt_Task);
+                if (!content.Status) throw new Exception(content.Message);
+                dt_Task.TaskState = (int)TaskStatusEnum.Execut;
+                #endregion
                 try
                 {
                     Db.Ado.BeginTran();
@@ -94,7 +102,7 @@
             try
             {
                 Dt_KLSLocationInfo? kLSLocationInfo = _kLSLocationInfoService.Repository.QueryFirst(x => x.LocationCode == taskDTO.fromLocationCode) ?? throw new Exception($"鏈壘鍒拌捣鐐瑰簱浣嶃�恵taskDTO.fromLocationCode}銆戯紒");
-                if (kLSLocationInfo.LocationStatus != LocationStatusEnum.InStock.ObjToInt()) throw new Exception($"璧风偣搴撲綅銆恵taskDTO.fromLocationCode}銆戝綋鍓嶅簱浣嶇姸鎬佷笉鍙嚭搴擄紒");
+                if (kLSLocationInfo.LocationStatus != (int)LocationStatusEnum.InStock) throw new Exception($"璧风偣搴撲綅銆恵taskDTO.fromLocationCode}銆戝綋鍓嶅簱浣嶇姸鎬佷笉鍙嚭搴擄紒");
                 Dt_Task dt_Task = new()
                 {
                     TaskNum = GetTaskNum(nameof(SequenceEnum.SeqTaskNum)),
@@ -103,7 +111,7 @@
                     Grade = taskDTO.taskPriority,
                     PalletCode = taskDTO.containerCode,
                     Roadway = kLSLocationInfo.RoadwayNo,
-                    TaskState = TaskStatusEnum.New.ObjToInt(),
+                    TaskState = (int)TaskStatusEnum.New,
                     TaskType = taskType,
                     SourceAddress = taskDTO.fromLocationCode,
                     CurrentAddress = taskDTO.fromLocationCode,
@@ -111,7 +119,12 @@
                     TargetAddress = taskDTO.toLocationCode,
                     Creater = "WMS",
                 };
-                kLSLocationInfo.LocationStatus = LocationStatusEnum.OutLock.ObjToInt();
+                kLSLocationInfo.LocationStatus = (int)LocationStatusEnum.OutLock;
+                #region 涓嬪彂鍑箰澹换鍔�
+                content = SendKLSTask(dt_Task);
+                if (!content.Status) throw new Exception(content.Message);
+                dt_Task.TaskState = (int)TaskStatusEnum.Execut;
+                #endregion
                 try
                 {
                     Db.Ado.BeginTran();
@@ -142,6 +155,47 @@
         }
         #endregion
 
+        #region 涓嬪彂鍑箰澹换鍔�
+        public WebResponseContent SendKLSTask(Dt_Task task)
+        {
+            WebResponseContent content = new WebResponseContent();
+            GALAXISTaskInfo gALAXISTaskInfo = new();
+            GALAXISReturn agvContent = new();
+            try
+            {
+                gALAXISTaskInfo.groupId = DateTime.Now.ToString("yyMMddHHmmss") + task.TaskNum;
+                gALAXISTaskInfo.msgTime = DateTime.Now.ToString();
+                GALAXISTask gALAXISTask = new GALAXISTask()
+                {
+                    taskId = task.WMSTaskNum,
+                    taskType = task.TaskType == (int)TaskTypeEnum.MLInbound ? 0 : 1,
+                    barCode = task.PalletCode,
+                    endNode = task.TargetAddress,
+                    startNode = task.SourceAddress,
+                    priorityCode = task.Grade
+                };
+                gALAXISTaskInfo.tasks.Add(gALAXISTask);
+                Dt_ApiInfo? apiInfo = _apiInfoService.Repository.QueryFirst(x => x.ApiCode == nameof(GALAXISTaskInfo)) ?? throw new Exception("鏈壘鍒板嚡涔愬+AGV浠诲姟涓嬪彂鎺ュ彛閰嶇疆淇℃伅锛佽妫�鏌ユ帴鍙i厤缃�");
+                string response = HttpHelper.Post(apiInfo.ApiAddress, gALAXISTaskInfo.Serialize());
+                agvContent = response.DeserializeObject<GALAXISReturn>();
+                content.OK(data: agvContent);
+                if (agvContent.success)
+                {
+                    if (agvContent.data.returnStatus != 0) throw new Exception(agvContent.data.returnInfo);
+                }
+            }
+            catch (Exception ex)
+            {
+                content.Error(ex.Message);
+            }
+            finally
+            {
+                _trackloginfoService.AddTrackLog(gALAXISTaskInfo, content, "涓嬪彂鍑箰澹獳GV浠诲姟", "", agvContent.data.returnInfo);
+            }
+            return content;
+        }
+        #endregion
+
         #region 5 璺ㄦゼ灞傝繍杈撲换鍔″垱寤�
         public WebResponseContent CarryTask(TaskDTO taskDTO, int taskType)
         {

--
Gitblit v1.9.3