From e4f68445aabdbbbf38845ba1af6f15348b00af02 Mon Sep 17 00:00:00 2001
From: wanshenmean <cathay_xy@163.com>
Date: 星期一, 30 三月 2026 13:49:58 +0800
Subject: [PATCH] feat(TaskService): CompleteTaskAsync添加任务历史保存逻辑

---
 Code/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs |   12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/Code/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs b/Code/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs
index ae80dca..aaf105e 100644
--- a/Code/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs
+++ b/Code/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs
@@ -254,7 +254,7 @@
                     {
                         return content.Error($"浠诲姟瀹屾垚澶辫触锛歁ES杩涚珯澶辫触: {inboundResult?.Data?.Msg ?? inboundResult?.ErrorMessage ?? "鏈煡閿欒"}");
                     }
-                    return await CompleteTaskAsync(task);
+                    return await CompleteTaskAsync(task, "Inbound");
                 });
             }
             catch (Exception ex)
@@ -308,7 +308,7 @@
                         return content.Error($"浠诲姟瀹屾垚澶辫触锛歁ES鍑虹珯澶辫触: {outboundResult?.Data?.Msg ?? outboundResult?.ErrorMessage ?? "鏈煡閿欒"}");
                     }
 
-                    return await CompleteTaskAsync(task);
+                    return await CompleteTaskAsync(task, "Outbound");
                 });
             }
             catch (Exception ex)
@@ -354,7 +354,7 @@
                     if (!updateSourceResult || !updateTargetResult || !updateStockResult)
                         return WebResponseContent.Instance.Error("绉诲簱浠诲姟瀹屾垚澶辫触");
 
-                    return await CompleteTaskAsync(task);
+                    return await CompleteTaskAsync(task, "Relocation");
                 });
             }
             catch (Exception ex)
@@ -565,14 +565,16 @@
         /// <summary>
         /// 瀹屾垚浠诲姟鍚庣粺涓�澶勭悊锛堝垹闄や换鍔℃暟鎹級
         /// </summary>
-        private async Task<WebResponseContent> CompleteTaskAsync(Dt_Task task)
+        private async Task<WebResponseContent> CompleteTaskAsync(Dt_Task task, string operateType)
         {
             var deleteTaskResult = await BaseDal.DeleteDataAsync(task);
             if (!deleteTaskResult) return WebResponseContent.Instance.Error("浠诲姟瀹屾垚澶辫触");
 
-            // 淇濈暀鍘嗗彶瀵硅薄鏋勫缓閫昏緫锛屽悗缁彲鎺ュ叆鍘嗗彶琛ㄨ惤搴�
             var historyTask = _mapper.Map<Dt_Task_Hty>(task);
             historyTask.InsertTime = DateTime.Now;
+            historyTask.OperateType = operateType;
+            var saveResult = _task_HtyService.AddData(historyTask);
+            if (!saveResult.Status) return WebResponseContent.Instance.Error("浠诲姟鍘嗗彶淇濆瓨澶辫触");
 
             return WebResponseContent.Instance.OK("浠诲姟瀹屾垚");
         }

--
Gitblit v1.9.3