From 75dcfe564467731b993519eb59ce330703ed1d5b Mon Sep 17 00:00:00 2001
From: xiazhengtongxue <133085197+xiazhengtongxue@users.noreply.github.com>
Date: 星期六, 25 四月 2026 16:26:04 +0800
Subject: [PATCH] Merge branch 'dev' of http://115.159.85.185:8098/r/SuZhouGuanHong/ShanMeiXinNengYuan into dev

---
 Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService/TaskService.Status.cs |   47 +++++++++++++++++++++++++++++++++++++----------
 1 files changed, 37 insertions(+), 10 deletions(-)

diff --git a/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService/TaskService.Status.cs b/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService/TaskService.Status.cs
index f466db3..c760e6f 100644
--- a/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService/TaskService.Status.cs
+++ b/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService/TaskService.Status.cs
@@ -2,18 +2,9 @@
 using WIDESEAWCS_Common.TaskEnum;
 using WIDESEAWCS_Core;
 using WIDESEAWCS_Core.Enums;
-using WIDESEAWCS_DTO;
 using WIDESEAWCS_DTO.TaskInfo;
 using WIDESEAWCS_Model.Models;
-using WIDESEAWCS_QuartzJob;
 using WIDESEAWCS_QuartzJob.Models;
-using WIDESEAWCS_QuartzJob.Service;
-using WIDESEAWCS_Core;
-using WIDESEAWCS_Core.Enums;
-using WIDESEAWCS_Model.Models;
-using WIDESEAWCS_QuartzJob;
-using WIDESEAWCS_QuartzJob.Models;
-using WIDESEAWCS_QuartzJob.Service;
 
 namespace WIDESEAWCS_TaskInfoService;
 
@@ -165,7 +156,6 @@
             string oldCurrentPos = task.CurrentAddress;
             string oldNextPos = task.NextAddress;
 
-
             Dt_Router routers = _routerService.QueryNextRoute(oldNextPos, task.TargetAddress);
             if (routers == null) throw new Exception($"鏈壘鍒拌澶囪矾鐢变俊鎭�");
 
@@ -185,4 +175,41 @@
         }
         return null;
     }
+
+    /// <summary>
+    /// 鏍规嵁浠诲姟鍙枫�佸綋鍓嶅湴鍧�鏇存柊浠诲姟浣嶇疆淇℃伅
+    /// </summary>
+    /// <param name="taskNum">浠诲姟鍙�</param>
+    /// <param name="currentAddress">褰撳墠鍦板潃</param>
+    /// <param name="nextAddress">涓嬩竴鍦板潃</param>
+    /// <returns></returns>
+    public Dt_Task? UpdatePosition(int taskNum, string currentAddress, string nextAddress)
+    {
+        try
+        {
+            if (string.IsNullOrEmpty(currentAddress))
+                throw new ArgumentNullException(nameof(currentAddress), "褰撳墠鍦板潃涓嶈兘涓虹┖");
+
+            Dt_Task task = BaseDal.QueryFirst(x => x.TaskNum == taskNum && x.CurrentAddress == currentAddress);
+            if (task == null) throw new Exception($"鏈壘鍒拌浠诲姟淇℃伅,浠诲姟鍙�:銆恵taskNum}銆�");
+
+            string oldCurrentPos = task.CurrentAddress;
+            string oldNextPos = task.NextAddress;
+
+            task.CurrentAddress = task.NextAddress;
+            task.NextAddress = nextAddress;
+
+            task.ModifyDate = DateTime.Now;
+            task.Modifier = "System";
+            BaseDal.UpdateData(task);
+
+            _taskExecuteDetailService.AddTaskExecuteDetail(task.TaskId, $"绯荤粺鑷姩娴佺▼锛屾洿鏂板綋鍓嶄綅缃�恵oldCurrentPos} ----> {task.CurrentAddress}銆戝拰涓嬩竴浣嶇疆銆恵oldNextPos} ----> {task.NextAddress}銆�");
+            return task;
+        }
+        catch (Exception ex)
+        {
+            Console.WriteLine($"UpdatePosition 鏇存柊浠诲姟浣嶇疆澶辫触,浠诲姟鍙�:銆恵taskNum}銆�,閿欒淇℃伅:銆恵ex.Message}銆�");
+        }
+        return null;
+    }
 }
\ No newline at end of file

--
Gitblit v1.9.3