From c6e53b0983e6864d3d28d01894a2053305c2e3fb Mon Sep 17 00:00:00 2001
From: wankeda <Administrator@DESKTOP-HAU3ST3>
Date: 星期四, 15 一月 2026 17:27:11 +0800
Subject: [PATCH] 1
---
WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs | 43 +++++++++++++++++++++++++++++++++++++++++++
1 files changed, 43 insertions(+), 0 deletions(-)
diff --git a/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs b/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs
index 9b21e9b..ff6d505 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;
@@ -495,6 +496,48 @@
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;
+ }
+
/// <summary>
///
/// </summary>
--
Gitblit v1.9.3