From 67d4e9ca4267049cc67cff15828080d2d5dfce0b Mon Sep 17 00:00:00 2001
From: yangpeixing <yangpeixing@hnkhzn.com>
Date: 星期三, 01 四月 2026 16:23:01 +0800
Subject: [PATCH] 1

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

diff --git a/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs b/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs
index 9b21e9b..64341d2 100644
--- a/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs
+++ b/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs
@@ -26,6 +26,7 @@
 using System.ComponentModel;
 using System.Diagnostics.CodeAnalysis;
 using System.Linq;
+using System.Net.Sockets;
 using System.Reflection;
 using System.Text;
 using System.Threading.Tasks;
@@ -491,6 +492,48 @@
             catch (Exception ex)
             {
                 content = WebResponseContent.Instance.Error(ex.Message);
+            }
+            return content;
+        }
+
+
+        public WebResponseContent LedShowTask(string stationCode, string palletCode, int taskType)
+        {
+            WebResponseContent content = new WebResponseContent();
+            try
+            {
+                string ledApiAddress = AppSettings.Get("LEDApiAddress");
+                if (string.IsNullOrEmpty(ledApiAddress))
+                {
+                    return WebResponseContent.Instance.Error("鏈壘鍒癓ED鏈嶅姟鍦板潃");
+                }
+                string ipAddress = ledApiAddress;
+                int port = 8888; // 榛樿绔彛
+                string sendData = $"{stationCode}|{palletCode}|{taskType}";
+
+                using (TcpClient tcpClient = new TcpClient())
+                {
+                    tcpClient.ReceiveTimeout = 5000;
+                    tcpClient.SendTimeout = 5000;
+
+                    tcpClient.Connect(ipAddress, port);
+
+                    NetworkStream stream = tcpClient.GetStream();
+                    byte[] data = Encoding.UTF8.GetBytes(sendData);
+                    stream.Write(data, 0, data.Length);
+                    stream.Flush();
+
+                    Console.WriteLine($"鉁� TCP鏁版嵁鍙戦�佹垚鍔燂細{sendData}");
+                }
+
+            }
+            catch (SocketException socketEx)
+            {
+          
+            }
+            catch (Exception ex)
+            {
+                content = WebResponseContent.Instance.Error($"LED鎺ㄩ�佸け璐ワ細{ex.Message}");
             }
             return content;
         }
@@ -976,5 +1019,30 @@
                 return WebResponseContent.Instance.Error(ex.Message);
             }
         }
+
+        /// <summary>
+        /// 浠诲姟鎵嬪姩瀹屾垚
+        /// </summary>
+        /// <param name="taskNum"></param>
+        /// <returns></returns>
+        /// <exception cref="NotImplementedException"></exception>
+        public async Task<WebResponseContent> ManualTaskCompleted(int taskNum)
+        {
+            try
+            {
+                string url = "http://localhost:9290";
+                if (string.IsNullOrEmpty(url))
+                {
+                    return await Task.FromResult(WebResponseContent.Instance.Error($"鏈壘鍒癢CSApi鍦板潃,璇锋鏌ラ厤缃枃浠�"));
+                }
+                string response = HttpHelper.Post($"{url}/api/Task/TaskCompleted?taskNum=" + taskNum,taskNum.ToString());
+
+                return await Task.FromResult(JsonConvert.DeserializeObject<WebResponseContent>(response) ?? WebResponseContent.Instance.Error("杩斿洖閿欒"));
+            }
+            catch (Exception ex)
+            {
+                return await Task.FromResult(WebResponseContent.Instance.Error(ex.Message));
+            }
+        }
     }
 }

--
Gitblit v1.9.3