From 4ecfe88d40b1a4f42cd8bc569b679768806e289f Mon Sep 17 00:00:00 2001
From: xiazhengtongxue <133085197+xiazhengtongxue@users.noreply.github.com>
Date: 星期六, 25 四月 2026 16:25:52 +0800
Subject: [PATCH] 1

---
 Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService/TaskService.Complete.cs |   33 +++++++++++++++++++++++++++++++++
 1 files changed, 33 insertions(+), 0 deletions(-)

diff --git a/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService/TaskService.Complete.cs b/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService/TaskService.Complete.cs
index 9b13ce6..11c75a0 100644
--- a/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService/TaskService.Complete.cs
+++ b/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService/TaskService.Complete.cs
@@ -1,6 +1,7 @@
 using MapsterMapper;
 using SqlSugar;
 using System.Diagnostics.CodeAnalysis;
+using System.Threading.Tasks;
 using WIDESEA_Core;
 using WIDESEAWCS_Common.TaskEnum;
 using WIDESEAWCS_Core;
@@ -176,5 +177,37 @@
         List<Dt_Task> tasks = BaseDal.QueryData(x => taskKeys.Contains(x.TaskId));
         BaseDal.DeleteAndMoveIntoHty(tasks, OperateTypeEnum.浜哄伐鍒犻櫎);
         return WebResponseContent.Instance.OK($"鎴愬姛鍒犻櫎{tasks.Count}鏉℃暟鎹�");
+    }
+
+    /// <summary>
+    /// 浠诲姟鍙栨秷
+    /// </summary>
+    /// <param name="taskNum"></param>
+    /// <returns></returns>
+    public WebResponseContent CancelTask(int taskNum)
+    {
+        WebResponseContent content = new WebResponseContent();
+        try
+        {
+            if (taskNum <= 0) return content.Error("浠诲姟缂栧彿鏃犳晥");
+
+            Dt_Task task = BaseDal.QueryFirst(x => x.TaskNum == taskNum);
+            if (task == null) return content.OK("浠诲姟涓嶅瓨鍦紝寮哄埗鍙栨秷");
+
+            task.TaskStatus = (int)TaskOutStatusEnum.OutCancel;
+
+            if (task.TaskStatus == (int)TaskInStatusEnum.InNew || task.TaskStatus == (int)TaskOutStatusEnum.OutNew)
+            {
+                bool deleteResult = BaseDal.DeleteAndMoveIntoHty(task, OperateTypeEnum.鑷姩鍒犻櫎);
+                if (!deleteResult) return content.Error("鍒犻櫎浠诲姟澶辫触");
+                return content.OK();
+            }
+            
+        }
+        catch (Exception ex)
+        {
+            content.Error($"WCS浠诲姟鍙栨秷鎺ュ彛澶辫触锛寋ex.Message}");
+        }
+        return content.Error("褰撳墠浠诲姟鍦ㄦ墽琛屼腑锛�");
     }
 }
\ No newline at end of file

--
Gitblit v1.9.3