From 084201e1437dc26ace65b8c0a2d02fcaa013961a Mon Sep 17 00:00:00 2001
From: dengjunjie <dengjunjie@hnkhzn.com>
Date: 星期三, 18 三月 2026 16:22:06 +0800
Subject: [PATCH] 1

---
 代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/KLSTaskMethods.cs |   38 ++++++++++++++++++++++++++++++++------
 1 files changed, 32 insertions(+), 6 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 1b24246..2f36005 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"
@@ -27,18 +27,20 @@
         public WebResponseContent CreateKLSNewInTask(TaskDTO taskDTO, int taskType)
         {
             WebResponseContent content = new WebResponseContent();
+            Dt_KLSLocationInfo? kLSLocationInfo = null;
             try
             {
                 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 != (int)LocationStatusEnum.Free) throw new Exception($"缁堢偣璐т綅銆恵taskDTO.toLocationCode}銆戣揣浣嶇姸鎬佷笉涓虹┖璐т綅");
+                    kLSLocationInfo = _kLSLocationInfoService.Repository.QueryFirst(x => x.LocationCode == taskDTO.toLocationCode) ?? throw new Exception($"鏈壘鍒扮粓鐐硅揣浣嶃�恵taskDTO.toLocationCode}銆�");
+                    if (kLSLocationInfo.LocationStatus != (int)LocationStatusEnum.Free) throw new Exception($"缁堢偣璐т綅銆恵taskDTO.toLocationCode}銆戣揣浣嶇姸鎬佷笉涓虹┖璐т綅");
                 }
                 #endregion
                 //鑾峰彇璐т綅淇℃伅
-                Dt_KLSLocationInfo? kLSLocationInfo = _kLSLocationInfoService.GetFreeLocationInfo(taskDTO.toAreaCode, containerType) ?? throw new Exception($"鏈壘鍒扮粓鐐瑰簱鍖恒�恵taskDTO.toAreaCode}銆戝彲鐢ㄧ┖璐т綅锛�");
+                else
+                    kLSLocationInfo = _kLSLocationInfoService.GetFreeLocationInfo(taskDTO.toAreaCode, containerType) ?? throw new Exception($"鏈壘鍒扮粓鐐瑰簱鍖恒�恵taskDTO.toAreaCode}銆戝彲鐢ㄧ┖璐т綅锛�");
                 Dt_Task dt_Task = new()
                 {
                     TaskNum = GetTaskNum(nameof(SequenceEnum.SeqTaskNum)),
@@ -60,6 +62,7 @@
                 content = SendKLSTask(dt_Task);
                 if (!content.Status) throw new Exception(content.Message);
                 dt_Task.TaskState = (int)TaskStatusEnum.Execut;
+                dt_Task.Dispatchertime = DateTime.Now;
                 #endregion
                 try
                 {
@@ -103,6 +106,7 @@
             {
                 Dt_KLSLocationInfo? kLSLocationInfo = _kLSLocationInfoService.Repository.QueryFirst(x => x.LocationCode == taskDTO.fromLocationCode) ?? throw new Exception($"鏈壘鍒拌捣鐐瑰簱浣嶃�恵taskDTO.fromLocationCode}銆戯紒");
                 if (kLSLocationInfo.LocationStatus != (int)LocationStatusEnum.InStock) throw new Exception($"璧风偣搴撲綅銆恵taskDTO.fromLocationCode}銆戝綋鍓嶅簱浣嶇姸鎬佷笉鍙嚭搴擄紒");
+                if (kLSLocationInfo.PalletCode != taskDTO.containerCode) throw new Exception($"璧风偣搴撲綅銆恵taskDTO.fromLocationCode}銆戠粦瀹氭枡绠卞彿銆恵kLSLocationInfo.PalletCode}銆戜笌浠诲姟鏂欑鍙枫�恵taskDTO.containerCode}銆戜笉鍖归厤锛�");
                 Dt_Task dt_Task = new()
                 {
                     TaskNum = GetTaskNum(nameof(SequenceEnum.SeqTaskNum)),
@@ -124,6 +128,7 @@
                 content = SendKLSTask(dt_Task);
                 if (!content.Status) throw new Exception(content.Message);
                 dt_Task.TaskState = (int)TaskStatusEnum.Execut;
+                dt_Task.Dispatchertime = DateTime.Now;
                 #endregion
                 try
                 {
@@ -215,15 +220,36 @@
         #region 6 瑁佸壀閫佽揣
         public WebResponseContent CJCarryTaske(TaskDTO taskDTO, int taskType)
         {
+            WebResponseContent content = new WebResponseContent();
             try
             {
-
-                return WebResponseContent.Instance.OK();
+                Dt_Task dt_Task = new Dt_Task()
+                {
+                    TaskNum = GetTaskNum(nameof(SequenceEnum.SeqTaskNum)),
+                    WMSTaskNum = taskDTO.taskCode,
+                    //WMSId = GetTaskNum(nameof(SequenceEnum.SeqTaskNum)),
+                    Grade = taskDTO.taskPriority,
+                    PalletCode = taskDTO.containerCode,
+                    Roadway = "",
+                    TaskState = (int)TaskStatusEnum.New,
+                    TaskType = taskType,
+                    SourceAddress = taskDTO.fromLocationCode,
+                    CurrentAddress = taskDTO.fromLocationCode,
+                    NextAddress = taskDTO.toLocationCode,
+                    TargetAddress = taskDTO.toLocationCode,
+                    Creater = "WMS",
+                };
+                content = SendHIKROBOTTask(dt_Task);
+                if (!content.Status) throw new Exception(content.Message);
+                dt_Task.TaskState = (int)TaskStatusEnum.Execut;
+                dt_Task.Dispatchertime = DateTime.Now;
+                BaseDal.AddData(dt_Task);
             }
             catch (Exception ex)
             {
-                throw new Exception(ex.Message);
+                content.Error(ex.Message);
             }
+            return content;
         }
         #endregion
     }

--
Gitblit v1.9.3