From 2adfc785179e551e6f99fd6799e7eebe360dd6c3 Mon Sep 17 00:00:00 2001
From: wanshenmean <cathay_xy@163.com>
Date: 星期六, 25 四月 2026 18:44:19 +0800
Subject: [PATCH] refactor(RobotJob): 移除HandleClientAsync方法中未使用的robotCrane参数

---
 Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/SocketServer/TcpSocketServer.Messaging.cs |   13 ++++++++-----
 1 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/SocketServer/TcpSocketServer.Messaging.cs b/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/SocketServer/TcpSocketServer.Messaging.cs
index 62c05dd..6c5b0ef 100644
--- a/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/SocketServer/TcpSocketServer.Messaging.cs
+++ b/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/SocketServer/TcpSocketServer.Messaging.cs
@@ -23,8 +23,7 @@
         /// <param name="client">TCP 瀹㈡埛绔繛鎺�</param>
         /// <param name="clientId">瀹㈡埛绔敮涓�鏍囪瘑</param>
         /// <param name="cancellationToken">鍙栨秷浠ょ墝</param>
-        /// <param name="robotCrane">鏈哄櫒浜虹姸鎬�</param>
-        public async Task HandleClientAsync(TcpClient client, string clientId, CancellationToken cancellationToken, RobotSocketState robotCrane)
+        public async Task HandleClientAsync(TcpClient client, string clientId, CancellationToken cancellationToken)
         {
             using (client)
             using (NetworkStream networkStream = client.GetStream())
@@ -60,10 +59,14 @@
                             break;
                         }
 
-                        if(message == lastMessage)
+                        // 鎸夊鎴风鍘婚噸锛氭鏌ユ槸鍚︿笌璇ュ鎴风涓婃娑堟伅鐩稿悓
+                        lock (_syncRoot)
                         {
-                            // 閲嶅娑堟伅锛屽拷鐣�
-                            continue;
+                            if (_clientLastMessage.TryGetValue(clientId, out var prev) && message == prev)
+                            {
+                                continue;
+                            }
+                            _clientLastMessage[clientId] = message;
                         }
 
                         // 鏇存柊瀹㈡埛绔姸鎬�

--
Gitblit v1.9.3