From 9d1660270272180cd71147d6ddd53d1382643d2e Mon Sep 17 00:00:00 2001
From: wenxiangchao <wenxiangchao@ihengxin.com.cn>
Date: 星期一, 02 十一月 2026 18:00:14 +0800
Subject: [PATCH] merge: 并入远程 Initial commit 作为历史根节点

---
 CellStepSender/StepSender.cs |   69 ++++++++++++++++++++++++++++++++++
 1 files changed, 69 insertions(+), 0 deletions(-)

diff --git a/CellStepSender/StepSender.cs b/CellStepSender/StepSender.cs
new file mode 100644
index 0000000..1914c0b
--- /dev/null
+++ b/CellStepSender/StepSender.cs
@@ -0,0 +1,69 @@
+锘縰sing System;
+using System.Threading;
+
+namespace CellStepSender
+{
+    internal class StepSender
+    {
+        /// <summary>
+        /// 鍙戦�佹祴璇曟暟鎹�
+        /// </summary>
+        /// <param name="ip">IP</param>
+        /// <param name="port">绔彛</param>
+        /// <param name="ovenIndex">鐐変笅鏍�</param>
+        /// <param name="cellIndex">绌翠綅涓嬫爣</param>
+        /// <param name="step">娴嬭瘯椤�</param>
+        /// <param name="value">娴嬭瘯鍊�</param>
+        /// <param name="limitUp">涓婇檺</param>
+        /// <param name="limitDown">涓嬮檺</param>
+        /// <param name="unit">鍗曚綅</param>
+        /// <param name="result">娴嬭瘯缁撴灉</param>
+        /// <param name="updateTime">娴嬭瘯鏃堕棿</param>
+        /// <param name="errorMsg">寮傚父淇℃伅</param>
+        /// <returns>鏄惁鍙戦�佹垚鍔�</returns>
+        public static bool SendStep(
+            string ip, int port,
+            int ovenIndex, int cellIndex, string step, string value, string limitUp,
+            string limitDown, string unit, string result, string updateTime, out string errorMsg)
+        {
+
+            errorMsg = null;
+            TcpClientTool3 client = null;
+            try
+            {
+                client = new TcpClientTool3(ip, port);
+                string res = null;
+                client.ExecuteMessageChanged += (sender, data) =>
+                {
+                    res = data;
+                };
+                client.Connect();
+
+                string msg = $"{ovenIndex};{cellIndex};{step},{value},{limitUp},{limitDown},{unit},{result},{updateTime}\n";
+                client.Send(msg);
+
+                int time = 1;
+                while (res == null && time <= 50)
+                {
+                    Thread.Sleep(100);
+                    time++;
+                }
+                if (res == null)
+                {
+                    errorMsg = "Time Out";
+                }
+                return res == "1";
+
+            }
+            catch (Exception ex)
+            {
+                errorMsg = ex.Message;
+                return false;
+            }
+            finally
+            {
+                client?.Disconnect();
+            }
+        }
+    }
+}

--
Gitblit v1.9.1