From ce3b28cdcdb2b6a912413cd9e744d0ecadcb78a0 Mon Sep 17 00:00:00 2001
From: wankeda <Administrator@DESKTOP-HAU3ST3>
Date: 星期二, 13 一月 2026 17:47:30 +0800
Subject: [PATCH] 优化成品出入库流程代码
---
WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 51 insertions(+), 0 deletions(-)
diff --git a/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs b/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs
index 9b21e9b..ec175c1 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,56 @@
return content;
}
+
+ public WebResponseContent LedShowTask(string stationCode, string palletCode, int taskType)
+ {
+ WebResponseContent content = new WebResponseContent();
+ try
+ {
+ // 鑾峰彇LED鏈嶅姟鍦板潃閰嶇疆
+ string ledApiAddress = AppSettings.Get("LEDApiAddress");
+ if (string.IsNullOrEmpty(ledApiAddress))
+ {
+ return WebResponseContent.Instance.Error("鏈壘鍒癓ED鏈嶅姟鍦板潃");
+ }
+
+ // 瑙f瀽IP鍦板潃锛堝鐞嗗彲鑳藉寘鍚殑http://鍓嶇紑锛�
+ string ipAddress = ledApiAddress;
+ int port = 8888; // 榛樿绔彛
+
+ // 鎷兼帴鎺ㄩ�佹牸寮�
+ string sendData = $"{stationCode}|{palletCode}|{taskType}";
+
+ // TCP杩炴帴WinForm
+ using (TcpClient tcpClient = new TcpClient())
+ {
+ // 璁剧疆杩炴帴瓒呮椂
+ tcpClient.ReceiveTimeout = 5000;
+ tcpClient.SendTimeout = 5000;
+
+ // 杩炴帴TCP鏈嶅姟
+ 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