瀏覽代碼

feat 调试吞吐量

yhluo 1 月之前
父節點
當前提交
8cfed99a89

+ 80 - 55
UAS_MES_HYSX/FunctionCode/Make/Make_WirelessThroughput.Designer.cs

@@ -41,7 +41,10 @@
             this.ProtDetails = new UAS_MES_NEW.CustomControl.GroupBoxWithBorder.GroupBoxWithBorder();
             this.tableLayoutPanel2 = new System.Windows.Forms.TableLayoutPanel();
             this.panel1 = new System.Windows.Forms.Panel();
+            this.ExePath = new System.Windows.Forms.TextBox();
+            this.ProductList = new System.Windows.Forms.TextBox();
             this.IPList = new System.Windows.Forms.TextBox();
+            this.label19 = new System.Windows.Forms.Label();
             this.label18 = new System.Windows.Forms.Label();
             this.Locat3 = new System.Windows.Forms.CheckBox();
             this.Locat2 = new System.Windows.Forms.CheckBox();
@@ -56,7 +59,7 @@
             this.label6 = new System.Windows.Forms.Label();
             this.label9 = new System.Windows.Forms.Label();
             this.label7 = new System.Windows.Forms.Label();
-            this.Start = new System.Windows.Forms.Button();
+            this.Clear = new System.Windows.Forms.Button();
             this.label8 = new System.Windows.Forms.Label();
             this.Password = new System.Windows.Forms.TextBox();
             this.panel2 = new System.Windows.Forms.Panel();
@@ -76,7 +79,6 @@
             this.textBox1 = new System.Windows.Forms.TextBox();
             this.label11 = new System.Windows.Forms.Label();
             this.OperatResult = new UAS_MES_NEW.CustomControl.RichText.RichTextAutoBottom();
-            this.ProductList = new System.Windows.Forms.TextBox();
             this.SNDetails.SuspendLayout();
             this.tableLayoutPanel1.SuspendLayout();
             this.ProtDetails.SuspendLayout();
@@ -94,7 +96,7 @@
             this.SNDetails.Font = new System.Drawing.Font("微软雅黑", 12F);
             this.SNDetails.Location = new System.Drawing.Point(0, 0);
             this.SNDetails.Name = "SNDetails";
-            this.SNDetails.Size = new System.Drawing.Size(1366, 123);
+            this.SNDetails.Size = new System.Drawing.Size(1600, 123);
             this.SNDetails.TabIndex = 2;
             this.SNDetails.TabStop = false;
             this.SNDetails.Text = "产品序列信息";
@@ -125,16 +127,16 @@
             this.tableLayoutPanel1.RowCount = 1;
             this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
             this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 83F));
-            this.tableLayoutPanel1.Size = new System.Drawing.Size(1360, 83);
+            this.tableLayoutPanel1.Size = new System.Drawing.Size(1594, 83);
             this.tableLayoutPanel1.TabIndex = 0;
             // 
             // productName
             // 
             this.productName.AutoSize = true;
             this.productName.Dock = System.Windows.Forms.DockStyle.Fill;
-            this.productName.Location = new System.Drawing.Point(858, 0);
+            this.productName.Location = new System.Drawing.Point(1005, 0);
             this.productName.Name = "productName";
-            this.productName.Size = new System.Drawing.Size(499, 83);
+            this.productName.Size = new System.Drawing.Size(586, 83);
             this.productName.TabIndex = 7;
             this.productName.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
             // 
@@ -142,9 +144,9 @@
             // 
             this.productCode.AutoSize = true;
             this.productCode.Dock = System.Windows.Forms.DockStyle.Fill;
-            this.productCode.Location = new System.Drawing.Point(592, 0);
+            this.productCode.Location = new System.Drawing.Point(693, 0);
             this.productCode.Name = "productCode";
-            this.productCode.Size = new System.Drawing.Size(173, 83);
+            this.productCode.Size = new System.Drawing.Size(204, 83);
             this.productCode.TabIndex = 6;
             this.productCode.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
             // 
@@ -152,9 +154,9 @@
             // 
             this.workOrder.AutoSize = true;
             this.workOrder.Dock = System.Windows.Forms.DockStyle.Fill;
-            this.workOrder.Location = new System.Drawing.Point(341, 0);
+            this.workOrder.Location = new System.Drawing.Point(399, 0);
             this.workOrder.Name = "workOrder";
-            this.workOrder.Size = new System.Drawing.Size(158, 83);
+            this.workOrder.Size = new System.Drawing.Size(186, 83);
             this.workOrder.TabIndex = 5;
             this.workOrder.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
             // 
@@ -162,9 +164,9 @@
             // 
             this.label4.AutoSize = true;
             this.label4.Dock = System.Windows.Forms.DockStyle.Fill;
-            this.label4.Location = new System.Drawing.Point(771, 0);
+            this.label4.Location = new System.Drawing.Point(903, 0);
             this.label4.Name = "label4";
-            this.label4.Size = new System.Drawing.Size(81, 83);
+            this.label4.Size = new System.Drawing.Size(96, 83);
             this.label4.TabIndex = 3;
             this.label4.Text = "产品名称: ";
             this.label4.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
@@ -175,7 +177,7 @@
             this.label1.Dock = System.Windows.Forms.DockStyle.Fill;
             this.label1.Location = new System.Drawing.Point(3, 0);
             this.label1.Name = "label1";
-            this.label1.Size = new System.Drawing.Size(81, 83);
+            this.label1.Size = new System.Drawing.Size(96, 83);
             this.label1.TabIndex = 0;
             this.label1.Text = "序列号: ";
             this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
@@ -184,9 +186,9 @@
             // 
             this.label3.AutoSize = true;
             this.label3.Dock = System.Windows.Forms.DockStyle.Fill;
-            this.label3.Location = new System.Drawing.Point(505, 0);
+            this.label3.Location = new System.Drawing.Point(591, 0);
             this.label3.Name = "label3";
-            this.label3.Size = new System.Drawing.Size(81, 83);
+            this.label3.Size = new System.Drawing.Size(96, 83);
             this.label3.TabIndex = 2;
             this.label3.Text = "产品编号: ";
             this.label3.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
@@ -195,9 +197,9 @@
             // 
             this.label2.AutoSize = true;
             this.label2.Dock = System.Windows.Forms.DockStyle.Fill;
-            this.label2.Location = new System.Drawing.Point(254, 0);
+            this.label2.Location = new System.Drawing.Point(297, 0);
             this.label2.Name = "label2";
-            this.label2.Size = new System.Drawing.Size(81, 83);
+            this.label2.Size = new System.Drawing.Size(96, 83);
             this.label2.TabIndex = 1;
             this.label2.Text = "工单: ";
             this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
@@ -206,9 +208,9 @@
             // 
             this.serialNumber.AutoSize = true;
             this.serialNumber.Dock = System.Windows.Forms.DockStyle.Fill;
-            this.serialNumber.Location = new System.Drawing.Point(90, 0);
+            this.serialNumber.Location = new System.Drawing.Point(105, 0);
             this.serialNumber.Name = "serialNumber";
-            this.serialNumber.Size = new System.Drawing.Size(158, 83);
+            this.serialNumber.Size = new System.Drawing.Size(186, 83);
             this.serialNumber.TabIndex = 4;
             this.serialNumber.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
             // 
@@ -220,7 +222,7 @@
             this.ProtDetails.Font = new System.Drawing.Font("微软雅黑", 12F);
             this.ProtDetails.Location = new System.Drawing.Point(0, 123);
             this.ProtDetails.Name = "ProtDetails";
-            this.ProtDetails.Size = new System.Drawing.Size(1366, 333);
+            this.ProtDetails.Size = new System.Drawing.Size(1600, 333);
             this.ProtDetails.TabIndex = 3;
             this.ProtDetails.TabStop = false;
             this.ProtDetails.Text = "测试设置";
@@ -229,8 +231,8 @@
             // tableLayoutPanel2
             // 
             this.tableLayoutPanel2.ColumnCount = 2;
-            this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 60F));
-            this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 40F));
+            this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 67.87955F));
+            this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 32.12045F));
             this.tableLayoutPanel2.Controls.Add(this.panel1, 0, 0);
             this.tableLayoutPanel2.Controls.Add(this.panel2, 1, 0);
             this.tableLayoutPanel2.Dock = System.Windows.Forms.DockStyle.Fill;
@@ -238,13 +240,15 @@
             this.tableLayoutPanel2.Name = "tableLayoutPanel2";
             this.tableLayoutPanel2.RowCount = 1;
             this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
-            this.tableLayoutPanel2.Size = new System.Drawing.Size(1360, 295);
+            this.tableLayoutPanel2.Size = new System.Drawing.Size(1594, 295);
             this.tableLayoutPanel2.TabIndex = 12;
             // 
             // panel1
             // 
+            this.panel1.Controls.Add(this.ExePath);
             this.panel1.Controls.Add(this.ProductList);
             this.panel1.Controls.Add(this.IPList);
+            this.panel1.Controls.Add(this.label19);
             this.panel1.Controls.Add(this.label18);
             this.panel1.Controls.Add(this.Locat3);
             this.panel1.Controls.Add(this.Locat2);
@@ -259,15 +263,31 @@
             this.panel1.Controls.Add(this.label6);
             this.panel1.Controls.Add(this.label9);
             this.panel1.Controls.Add(this.label7);
-            this.panel1.Controls.Add(this.Start);
+            this.panel1.Controls.Add(this.Clear);
             this.panel1.Controls.Add(this.label8);
             this.panel1.Controls.Add(this.Password);
             this.panel1.Dock = System.Windows.Forms.DockStyle.Fill;
             this.panel1.Location = new System.Drawing.Point(3, 3);
             this.panel1.Name = "panel1";
-            this.panel1.Size = new System.Drawing.Size(810, 289);
+            this.panel1.Size = new System.Drawing.Size(1076, 289);
             this.panel1.TabIndex = 12;
             // 
+            // ExePath
+            // 
+            this.ExePath.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.ExePath.Location = new System.Drawing.Point(681, 14);
+            this.ExePath.Name = "ExePath";
+            this.ExePath.Size = new System.Drawing.Size(608, 31);
+            this.ExePath.TabIndex = 23;
+            this.ExePath.Click += new System.EventHandler(this.ExePath_Click);
+            // 
+            // ProductList
+            // 
+            this.ProductList.Location = new System.Drawing.Point(151, 65);
+            this.ProductList.Name = "ProductList";
+            this.ProductList.Size = new System.Drawing.Size(293, 39);
+            this.ProductList.TabIndex = 20;
+            // 
             // IPList
             // 
             this.IPList.Location = new System.Drawing.Point(152, 14);
@@ -275,6 +295,16 @@
             this.IPList.Size = new System.Drawing.Size(293, 39);
             this.IPList.TabIndex = 19;
             // 
+            // label19
+            // 
+            this.label19.AutoSize = true;
+            this.label19.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.label19.Location = new System.Drawing.Point(534, 17);
+            this.label19.Name = "label19";
+            this.label19.Size = new System.Drawing.Size(153, 28);
+            this.label19.TabIndex = 21;
+            this.label19.Text = "iperf 启动路径:";
+            // 
             // label18
             // 
             this.label18.AutoSize = true;
@@ -290,7 +320,7 @@
             this.Locat3.AutoSize = true;
             this.Locat3.Cursor = System.Windows.Forms.Cursors.Hand;
             this.Locat3.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.Locat3.Location = new System.Drawing.Point(899, 16);
+            this.Locat3.Location = new System.Drawing.Point(882, 70);
             this.Locat3.Name = "Locat3";
             this.Locat3.Size = new System.Drawing.Size(187, 32);
             this.Locat3.TabIndex = 16;
@@ -303,7 +333,7 @@
             this.Locat2.AutoSize = true;
             this.Locat2.Cursor = System.Windows.Forms.Cursors.Hand;
             this.Locat2.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.Locat2.Location = new System.Drawing.Point(714, 16);
+            this.Locat2.Location = new System.Drawing.Point(697, 70);
             this.Locat2.Name = "Locat2";
             this.Locat2.Size = new System.Drawing.Size(166, 32);
             this.Locat2.TabIndex = 15;
@@ -316,7 +346,7 @@
             this.Locat1.AutoSize = true;
             this.Locat1.Cursor = System.Windows.Forms.Cursors.Hand;
             this.Locat1.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.Locat1.Location = new System.Drawing.Point(562, 17);
+            this.Locat1.Location = new System.Drawing.Point(545, 71);
             this.Locat1.Name = "Locat1";
             this.Locat1.Size = new System.Drawing.Size(122, 32);
             this.Locat1.TabIndex = 14;
@@ -329,7 +359,7 @@
             this.Radio2.AutoSize = true;
             this.Radio2.Cursor = System.Windows.Forms.Cursors.Hand;
             this.Radio2.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.Radio2.Location = new System.Drawing.Point(719, 133);
+            this.Radio2.Location = new System.Drawing.Point(702, 187);
             this.Radio2.Name = "Radio2";
             this.Radio2.Size = new System.Drawing.Size(108, 32);
             this.Radio2.TabIndex = 13;
@@ -342,7 +372,7 @@
             this.Radio1.AutoSize = true;
             this.Radio1.Cursor = System.Windows.Forms.Cursors.Hand;
             this.Radio1.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.Radio1.Location = new System.Drawing.Point(562, 133);
+            this.Radio1.Location = new System.Drawing.Point(545, 187);
             this.Radio1.Name = "Radio1";
             this.Radio1.Size = new System.Drawing.Size(125, 32);
             this.Radio1.TabIndex = 12;
@@ -372,7 +402,7 @@
             // 
             this.label10.AutoSize = true;
             this.label10.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.label10.Location = new System.Drawing.Point(749, 77);
+            this.label10.Location = new System.Drawing.Point(732, 131);
             this.label10.Name = "label10";
             this.label10.Size = new System.Drawing.Size(103, 28);
             this.label10.TabIndex = 10;
@@ -388,7 +418,7 @@
             // 
             // TestTime
             // 
-            this.TestTime.Location = new System.Drawing.Point(680, 71);
+            this.TestTime.Location = new System.Drawing.Point(663, 125);
             this.TestTime.Name = "TestTime";
             this.TestTime.Size = new System.Drawing.Size(63, 39);
             this.TestTime.TabIndex = 9;
@@ -407,7 +437,7 @@
             // 
             this.label9.AutoSize = true;
             this.label9.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.label9.Location = new System.Drawing.Point(568, 77);
+            this.label9.Location = new System.Drawing.Point(551, 131);
             this.label9.Name = "label9";
             this.label9.Size = new System.Drawing.Size(101, 28);
             this.label9.TabIndex = 8;
@@ -423,17 +453,17 @@
             this.label7.TabIndex = 3;
             this.label7.Text = "登录账户:";
             // 
-            // Start
+            // Clear
             // 
-            this.Start.Cursor = System.Windows.Forms.Cursors.Hand;
-            this.Start.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.Start.Location = new System.Drawing.Point(573, 228);
-            this.Start.Name = "Start";
-            this.Start.Size = new System.Drawing.Size(140, 47);
-            this.Start.TabIndex = 7;
-            this.Start.Text = "开始测试";
-            this.Start.UseVisualStyleBackColor = true;
-            this.Start.Click += new System.EventHandler(this.Start_Click);
+            this.Clear.Cursor = System.Windows.Forms.Cursors.Hand;
+            this.Clear.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.Clear.Location = new System.Drawing.Point(603, 236);
+            this.Clear.Name = "Clear";
+            this.Clear.Size = new System.Drawing.Size(135, 39);
+            this.Clear.TabIndex = 7;
+            this.Clear.Text = "清除提示";
+            this.Clear.UseVisualStyleBackColor = true;
+            this.Clear.Click += new System.EventHandler(this.Clear_Click);
             // 
             // label8
             // 
@@ -459,9 +489,9 @@
             this.panel2.Controls.Add(this.textBox1);
             this.panel2.Controls.Add(this.label11);
             this.panel2.Dock = System.Windows.Forms.DockStyle.Fill;
-            this.panel2.Location = new System.Drawing.Point(819, 3);
+            this.panel2.Location = new System.Drawing.Point(1085, 3);
             this.panel2.Name = "panel2";
-            this.panel2.Size = new System.Drawing.Size(538, 289);
+            this.panel2.Size = new System.Drawing.Size(506, 289);
             this.panel2.TabIndex = 13;
             // 
             // tableLayoutPanel3
@@ -637,22 +667,15 @@
             this.OperatResult.Location = new System.Drawing.Point(0, 456);
             this.OperatResult.Margin = new System.Windows.Forms.Padding(4);
             this.OperatResult.Name = "OperatResult";
-            this.OperatResult.Size = new System.Drawing.Size(1366, 312);
+            this.OperatResult.Size = new System.Drawing.Size(1600, 444);
             this.OperatResult.TabIndex = 89;
             this.OperatResult.Text = "";
             // 
-            // ProductList
-            // 
-            this.ProductList.Location = new System.Drawing.Point(151, 65);
-            this.ProductList.Name = "ProductList";
-            this.ProductList.Size = new System.Drawing.Size(293, 39);
-            this.ProductList.TabIndex = 20;
-            // 
             // Make_WirelessThroughput
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 18F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
-            this.ClientSize = new System.Drawing.Size(1366, 768);
+            this.ClientSize = new System.Drawing.Size(1600, 900);
             this.Controls.Add(this.OperatResult);
             this.Controls.Add(this.ProtDetails);
             this.Controls.Add(this.SNDetails);
@@ -695,7 +718,7 @@
         private System.Windows.Forms.Label label7;
         private System.Windows.Forms.TextBox Password;
         private System.Windows.Forms.TextBox Account;
-        private System.Windows.Forms.Button Start;
+        private System.Windows.Forms.Button Clear;
         private CustomControl.RichText.RichTextAutoBottom OperatResult;
         private System.Windows.Forms.TextBox TestTime;
         private System.Windows.Forms.Label label9;
@@ -726,5 +749,7 @@
         private System.Windows.Forms.Label label18;
         private System.Windows.Forms.TextBox IPList;
         private System.Windows.Forms.TextBox ProductList;
+        private System.Windows.Forms.TextBox ExePath;
+        private System.Windows.Forms.Label label19;
     }
 }

+ 261 - 46
UAS_MES_HYSX/FunctionCode/Make/Make_WirelessThroughput.cs

@@ -1,4 +1,6 @@
-using System;
+using DevExpress.Utils.Drawing.Helpers;
+using NPOI.SS.Formula.Functions;
+using System;
 using System.Collections.Generic;
 using System.ComponentModel;
 using System.Data;
@@ -6,6 +8,7 @@ using System.Diagnostics;
 using System.Drawing;
 using System.IO;
 using System.Linq;
+using System.Net;
 using System.Net.Sockets;
 using System.Text;
 using System.Text.RegularExpressions;
@@ -15,6 +18,7 @@ using System.Web.UI.WebControls.WebParts;
 using System.Windows.Forms;
 using UAS_MES_NEW.DataOperate;
 using UAS_MES_NEW.Entity;
+using UAS_MES_NEW.PublicMethod;
 
 namespace UAS_MES_NEW.Make
 {
@@ -32,45 +36,123 @@ namespace UAS_MES_NEW.Make
         private void Make_WirelessThroughput_Load(object sender, EventArgs e)
         {
             dh = SystemInf.dh;
+            try
+            {
+                string hostName = Dns.GetHostName();
+                IPHostEntry hostEntry = Dns.GetHostEntry(hostName);
+
+                foreach (IPAddress ip in hostEntry.AddressList)
+                {
+                    if (ip.AddressFamily == AddressFamily.InterNetwork)
+                    {
+                        IPList.Text = ip.ToString();
+                    }
+                }
+            }
+            catch (Exception ex)
+            {
+                ShowMsg(0, $"获取iperf服务器地址失败,{ex.Message}");
+            }
         }
 
-        private void Start_Click(object sender, EventArgs e)
+        private void SN_KeyDown(object sender, KeyEventArgs e)
         {
+            if (e.KeyCode != Keys.Enter) return;
+
             if (IsCheckSet()) return;
 
+            string sn = SN.Text.Trim();
+            if (SN.Text.IndexOf(';') > 0) SN.Text = sn.Replace(";", ";");
+            else SN.Text = sn;
+            UpdateSN("L", SN.Text.Trim());
+
+            int iSPort = 5001;
+
             ShowMsg(1, $"开始测试");
             var tester = new CameraIperfTester(
+                timeOut: TestTime.Text.Trim(),
                 cameraIp: ProductList.Text.Trim(),
                 cameraPort: 23,
                 username: Account.Text.Trim(),
                 password: ProductList.Text.Trim(),
                 iperfServerIp: IPList.Text.Trim(),
-                iperfServerPort : 5201
+                iperfServerPort: iSPort
             );
 
             string Msg = tester.TelnetConnect();
-            if (Msg.Substring(0,2) != "OK")
+            if (Msg.Substring(0, 2) != "OK")
             {
                 ShowMsg(0, $"Telnet登录失败,{Msg}");
                 return;
             }
             ShowMsg(1, $"Telnet登录成功");
 
-            Msg = tester.StartIperfTest(@"D:\MesCoder\Company\慧眼\吞吐量测试\iperf3.exe", @"D:\MesCoder\Company\慧眼\吞吐量测试\iperf_logs");
+            string parentPath = Path.GetDirectoryName(ExePath.Text.Trim());
+            string logsPath = Path.Combine(parentPath, "iperf_logs");
+            if (!Directory.Exists(logsPath))
+            {
+                Directory.CreateDirectory(logsPath);
+            }
+
+            //string[] comList = new string[] {
+            //    "killall iperf3_mstar",
+            //    "cp /mnt/tf/usb1_1/iperf3_mstar/var/tmp/ -f",
+            //    "chmod a+x /var/tmp/iperf3_mstar",
+            //    $"/var/tmp/iperf3_mstar -s -p {iSPort} -i 1 &"
+            //};
+            string[] comList = new string[] {
+                $"iperf3 -s -p {iSPort} -i 1&"
+            };
+
+            Msg = tester.StartIperfTest(SN.Text.Trim(), ExePath.Text.Trim(), logsPath, comList);
             if (Msg.Substring(0, 2) != "OK")
             {
                 ShowMsg(0, $"iperf3启动失败,{Msg}");
                 return;
             }
+            string upRate = Msg.Split('|')[0];
+            string downRate = Msg.Split('|')[1];
+            ShowMsg(1, $"OK,上行速率: {upRate},下行速率: {downRate}");
+            ResMax.Text = upRate;
+            ResMin.Text = downRate;
+            CheckPassStation(SN.Text, upRate, downRate, "PASS");
         }
-
-        private void SN_KeyDown(object sender, KeyEventArgs e)
+        private void CheckPassStation(string sn, string upRate, string downRate, string testRes)
         {
-            if (e.KeyCode != Keys.Enter) return;
-            UpdateSN("L", SN.Text.Trim());
-
+            string oWO, oWOId, oErrMsg = "";
+            if (LogicHandler.CheckStepSNAndMacode(workOrder.Text, User.UserSourceCode, sn, User.UserCode, out oWO, out oWOId, out oErrMsg))
+            {
+                if (LogicHandler.SetStepResult(oWO, User.UserSourceCode, sn, "无线吞吐量", "OK", User.UserCode, out oErrMsg))
+                {
+                    List<string> param = new List<string>() { };
+                    string outMsg = "";
+                    param.Add(oWO);
+                    param.Add(sn);
+                    param.Add(User.UserSourceCode);
+                    param.Add(testRes);
+                    param.Add("");
+                    param.Add("");
+                    param.Add("WirelessThroughput");
+                    param.Add("");
+                    param.Add(outMsg);
+                    string[] paramList = param.ToArray();
+                    dh.CallProcedure("cs_insert_testrejects", ref paramList);
+                    if (paramList[8].Substring(0, 2) == "OK")
+                    {
+                        ShowMsg(1, $"序列号{sn}采集成功:测试结果为{testRes}");
+                        LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, oWO, User.UserLineCode, User.UserSourceCode, "无线吞吐量", "无线吞吐量过站成功", sn, "");
+                    }
+                }
+                else
+                {
+                    ShowMsg(0, $"序列号{sn},处理过站NG:{oErrMsg}");
+                }
+            }
+            else
+            {
+                ShowMsg(0, $"序列号{sn},过站核对NG:{oErrMsg}");
+            }
         }
-
         private bool IsCheckSet()
         {
             if (string.IsNullOrEmpty(IPList.Text))
@@ -97,6 +179,17 @@ namespace UAS_MES_NEW.Make
                 return true;
             }
 
+            if (string.IsNullOrEmpty(ExePath.Text))
+            {
+                ShowMsg(0, "请输入启动iperf3文件");
+                return true;
+            }
+
+            if (!File.Exists(ExePath.Text))
+            {
+                Console.WriteLine("iperf3启动文件不存在");
+            }
+
             if (string.IsNullOrEmpty(TestTime.Text))
             {
                 ShowMsg(0, "请输入测试时长");
@@ -148,14 +241,19 @@ namespace UAS_MES_NEW.Make
 
         public class CameraIperfTester
         {
+            int timeOut;
             string cameraIp;
             int cameraPort;
             string username;
             string password;
             string iperfServerIp;
             int iperfServerPort;
-            public CameraIperfTester(string cameraIp, int cameraPort, string username, string password, string iperfServerIp, int iperfServerPort)
+
+            private TcpClient _telnetClient;
+            private NetworkStream _telnetStream;
+            public CameraIperfTester(string timeOut, string cameraIp, int cameraPort, string username, string password, string iperfServerIp, int iperfServerPort)
             {
+                this.timeOut = Convert.ToInt32(timeOut) * 1000;
                 this.cameraIp = cameraIp;
                 this.cameraPort = cameraPort;
                 this.username = username;
@@ -164,61 +262,147 @@ namespace UAS_MES_NEW.Make
                 this.iperfServerPort = iperfServerPort;
             }
 
-            public string StartIperfTest(string iperfPath,string logDirectory)
+            public string StartIperfTest(string SN, string iperfPath,string logDirectory, string[] CList)
             {
-                return "OK,测试";
+                if (_telnetStream == null)
+                    return "NG,未建立连接";
+                try
+                {
+                    foreach (var comItem in CList)
+                    {
+                        WriteStream(_telnetStream, comItem);
+                        ReadStream(_telnetStream);
+                    }
+
+                    Thread.Sleep(1000); // 等服务端启动
+
+                    string upLog = Path.Combine(logDirectory, $"{SN}_up.log");
+                    string downLog = Path.Combine(logDirectory, $"{SN}_down.log");
+
+                    RunIperfClient($"-c {cameraIp} -p {iperfServerPort} -t 10 -w 1M -i 1 -P 8 -R", iperfPath, upLog);
+                    RunIperfClient($"-c {cameraIp} -p {iperfServerPort} -t 10 -w 1M -i 1 -P 8", iperfPath, downLog);
+
+                    double upRate = ParseIperfBitrate(upLog);
+                    double downRate = ParseIperfBitrate(downLog);
+
+                    return $"OK,{upRate}|{downRate}";
+                }
+                catch (Exception ex)
+                {
+                    return $"NG,{ex.Message}";
+                }
             }
 
             public string TelnetConnect()
             {
                 try
                 {
-                    using (TcpClient client = new TcpClient())
+                    _telnetClient = new TcpClient();
+                    IAsyncResult connectResult = _telnetClient.BeginConnect(cameraIp, cameraPort, null, null);
+                    bool connected = connectResult.AsyncWaitHandle.WaitOne(TimeSpan.FromMilliseconds(timeOut));
+                    if (!connected)
                     {
-                        IAsyncResult connectResult = client.BeginConnect(cameraIp, cameraPort, null, null);
-                        bool connected = connectResult.AsyncWaitHandle.WaitOne(TimeSpan.FromMilliseconds(5000)); // 5秒连接超时
+                        _telnetClient.Close();
+                        return "NG,连接超时";
+                    }
 
-                        if (!connected)
-                        {
-                            client.Close();
-                            return "NG,连接超时";
-                        }
+                    try
+                    {
+                        _telnetClient.EndConnect(connectResult);
+                    }
+                    catch (SocketException ex)
+                    {
+                        return $"NG,连接失败: {ex.Message}";
+                    }
 
-                        try
-                        {
-                            client.EndConnect(connectResult);
-                        }
-                        catch (SocketException ex)
-                        {
-                            return $"NG,连接失败: {ex.Message}";
-                        }
+                    _telnetStream = _telnetClient.GetStream();
+                    _telnetStream.ReadTimeout = 3000; // 3S读取超时
 
-                        using (NetworkStream stream = client.GetStream())
-                        {
-                            // 3S读取超时
-                            stream.ReadTimeout = 3000;
+                    StringBuilder fullResponse = new StringBuilder();
 
-                            StringBuilder fullResponse = new StringBuilder();
+                    string welcomeResponse = ReadStream(_telnetStream);
+                    fullResponse.Append(welcomeResponse);
 
-                            string welcomeResponse = ReadStream(stream);
-                            fullResponse.Append(welcomeResponse);
+                    WriteStream(_telnetStream, username);
+                    string usernameResponse = ReadStream(_telnetStream);
+                    fullResponse.Append(usernameResponse);
 
-                            WriteStream(stream, username);
-                            string usernameResponse = ReadStream(stream);
-                            fullResponse.Append(usernameResponse);
+                    WriteStream(_telnetStream, password);
+                    string loginResponse = ReadStream(_telnetStream);
+                    fullResponse.Append(loginResponse);
 
-                            WriteStream(stream, password);
-                            string loginResponse = ReadStream(stream);
-                            fullResponse.Append(loginResponse);
+                    return $"OK,{fullResponse.ToString()}";
+                }
+                catch (Exception ex)
+                {
+                    return $"NG,{ex.Message}";
+                }
+            }
+            private void RunIperfClient(string args, string path, string logPath)
+            {
+                var psi = new ProcessStartInfo
+                {
+                    FileName = path,
+                    Arguments = args,
+                    RedirectStandardOutput = true,
+                    RedirectStandardError = true,
+                    UseShellExecute = false,
+                    CreateNoWindow = true
+                };
+
+                using (var process = Process.Start(psi))
+                {
+                    string output = process.StandardOutput.ReadToEnd();
+                    string error = process.StandardError.ReadToEnd();
+                    process.WaitForExit(5000); // 最多等 15 秒
 
-                            return $"OK,{fullResponse.ToString()}";
+                    File.WriteAllText(logPath, output + Environment.NewLine + error);
+                }
+            }
+            private double ParseIperfBitrate(string logPath)
+            {
+                if (!File.Exists(logPath)) return 0.0;
+                var lines = File.ReadAllLines(logPath);
+                foreach (var line in lines)
+                {
+                    if (line.Trim().StartsWith("[SUM]"))
+                    {
+                        var regex = new Regex(@"\d+\.?\d*\s+Mbits/sec");
+                        var match = regex.Match(line);
+                        if (match.Success)
+                        {
+                            var mbitsPart = match.Value.Replace("Mbits/sec", "").Trim();
+                            if (double.TryParse(mbitsPart, out double rate))
+                            {
+                                return rate;
+                            }
                         }
                     }
                 }
-                catch (Exception ex)
+
+                var summaryLine = lines.LastOrDefault(l => l.Contains("sender") || l.Contains("receiver"));
+                if (summaryLine != null)
                 {
-                    return $"NG,{ex.Message}";
+                    var parts = summaryLine.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
+                    for (int i = parts.Length - 1; i >= 0; i--)
+                    {
+                        if (parts[i].Contains("Mbits/sec") && i > 0)
+                        {
+                            if (double.TryParse(parts[i - 1], out double rate))
+                            {
+                                return rate;
+                            }
+                        }
+                        else if (parts[i].Contains("Gbits/sec") && i > 0)
+                        {
+                            if (double.TryParse(parts[i - 1], out double rate))
+                            {
+                                return rate * 1000; // 转为 Mbps
+                            }
+                        }
+                    }
                 }
+                return 0.0;
             }
 
             private void WriteStream(NetworkStream stream, string text)
@@ -340,5 +524,36 @@ namespace UAS_MES_NEW.Make
             TestTime.SelectAll();
         }
 
+        private void ExePath_Click(object sender, EventArgs e)
+        {
+            using (OpenFileDialog openFileDialog = new OpenFileDialog())
+            {
+                openFileDialog.Title = "选择iperf3启动文件";
+                openFileDialog.Filter = "可执行文件 (*.exe)|*.exe|所有文件 (*.*)|*.*";
+                openFileDialog.FilterIndex = 1; 
+                openFileDialog.RestoreDirectory = true;
+
+                // 设置初始目录(可选)
+                if (!string.IsNullOrEmpty(ExePath.Text) && System.IO.File.Exists(ExePath.Text))
+                {
+                    openFileDialog.InitialDirectory = System.IO.Path.GetDirectoryName(ExePath.Text);
+                }
+                else
+                {
+                    openFileDialog.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles);
+                }
+
+                if (openFileDialog.ShowDialog() == DialogResult.OK)
+                {
+                    ExePath.Text = openFileDialog.FileName;
+                    ShowMsg(1, $"已成功选择iperf3启动文件");
+                }
+            }
+        }
+
+        private void Clear_Click(object sender, EventArgs e)
+        {
+            OperatResult.Clear();
+        }
     }
 }