Browse Source

Merge repos.ubtob.net:usoft/mes-client

callm 1 month ago
parent
commit
2736529aea

+ 59 - 126
UAS_MES_HYSX/FunctionCode/Make/Make_WirelessThroughput.Designer.cs

@@ -41,6 +41,8 @@
             this.ProtDetails = new UAS_MES_NEW.CustomControl.GroupBoxWithBorder.GroupBoxWithBorder();
             this.tableLayoutPanel2 = new System.Windows.Forms.TableLayoutPanel();
             this.panel1 = new System.Windows.Forms.Panel();
+            this.comboBox1 = new System.Windows.Forms.ComboBox();
+            this.label20 = new System.Windows.Forms.Label();
             this.ExePath = new System.Windows.Forms.TextBox();
             this.ProductList = new System.Windows.Forms.TextBox();
             this.IPList = new System.Windows.Forms.TextBox();
@@ -64,23 +66,15 @@
             this.Password = new System.Windows.Forms.TextBox();
             this.panel2 = new System.Windows.Forms.Panel();
             this.tableLayoutPanel3 = new System.Windows.Forms.TableLayoutPanel();
-            this.DownMax = new System.Windows.Forms.TextBox();
-            this.DownMin = new System.Windows.Forms.TextBox();
-            this.UpMax = new System.Windows.Forms.TextBox();
             this.ResMin = new System.Windows.Forms.Label();
             this.label17 = new System.Windows.Forms.Label();
             this.ResMax = new System.Windows.Forms.Label();
             this.label16 = new System.Windows.Forms.Label();
-            this.label14 = new System.Windows.Forms.Label();
-            this.label13 = new System.Windows.Forms.Label();
             this.label12 = new System.Windows.Forms.Label();
-            this.UpMin = new System.Windows.Forms.TextBox();
             this.label15 = new System.Windows.Forms.Label();
             this.textBox1 = new System.Windows.Forms.TextBox();
             this.label11 = new System.Windows.Forms.Label();
             this.OperatResult = new UAS_MES_NEW.CustomControl.RichText.RichTextAutoBottom();
-            this.label20 = new System.Windows.Forms.Label();
-            this.comboBox1 = new System.Windows.Forms.ComboBox();
             this.SNDetails.SuspendLayout();
             this.tableLayoutPanel1.SuspendLayout();
             this.ProtDetails.SuspendLayout();
@@ -247,18 +241,18 @@
             // 
             // panel1
             // 
+            this.panel1.Controls.Add(this.Radio1);
+            this.panel1.Controls.Add(this.Radio2);
             this.panel1.Controls.Add(this.comboBox1);
             this.panel1.Controls.Add(this.label20);
             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.Locat1);
             this.panel1.Controls.Add(this.label18);
-            this.panel1.Controls.Add(this.Locat3);
             this.panel1.Controls.Add(this.Locat2);
-            this.panel1.Controls.Add(this.Locat1);
-            this.panel1.Controls.Add(this.Radio2);
-            this.panel1.Controls.Add(this.Radio1);
+            this.panel1.Controls.Add(this.Locat3);
             this.panel1.Controls.Add(this.Account);
             this.panel1.Controls.Add(this.label5);
             this.panel1.Controls.Add(this.label10);
@@ -276,6 +270,30 @@
             this.panel1.Size = new System.Drawing.Size(1076, 289);
             this.panel1.TabIndex = 12;
             // 
+            // comboBox1
+            // 
+            this.comboBox1.FormattingEnabled = true;
+            this.comboBox1.Items.AddRange(new object[] {
+            "指令一",
+            "指令二"});
+            this.comboBox1.Location = new System.Drawing.Point(681, 154);
+            this.comboBox1.Name = "comboBox1";
+            this.comboBox1.Size = new System.Drawing.Size(227, 39);
+            this.comboBox1.TabIndex = 25;
+            this.comboBox1.Visible = false;
+            this.comboBox1.SelectedIndexChanged += new System.EventHandler(this.comboBox1_SelectedIndexChanged);
+            // 
+            // label20
+            // 
+            this.label20.AutoSize = true;
+            this.label20.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.label20.Location = new System.Drawing.Point(537, 159);
+            this.label20.Name = "label20";
+            this.label20.Size = new System.Drawing.Size(159, 28);
+            this.label20.TabIndex = 24;
+            this.label20.Text = "测试指令模式:";
+            this.label20.Visible = false;
+            // 
             // ExePath
             // 
             this.ExePath.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
@@ -324,12 +342,13 @@
             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(839, 160);
+            this.Locat3.Location = new System.Drawing.Point(842, 204);
             this.Locat3.Name = "Locat3";
             this.Locat3.Size = new System.Drawing.Size(187, 32);
             this.Locat3.TabIndex = 16;
             this.Locat3.Text = "安居云固件TF卡";
             this.Locat3.UseVisualStyleBackColor = true;
+            this.Locat3.Visible = false;
             this.Locat3.Click += new System.EventHandler(this.Locat3_Click);
             // 
             // Locat2
@@ -337,12 +356,13 @@
             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(667, 160);
+            this.Locat2.Location = new System.Drawing.Point(670, 204);
             this.Locat2.Name = "Locat2";
             this.Locat2.Size = new System.Drawing.Size(166, 32);
             this.Locat2.TabIndex = 15;
             this.Locat2.Text = "中心固件TF卡";
             this.Locat2.UseVisualStyleBackColor = true;
+            this.Locat2.Visible = false;
             this.Locat2.Click += new System.EventHandler(this.Locat2_Click);
             // 
             // Locat1
@@ -350,12 +370,13 @@
             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(539, 160);
+            this.Locat1.Location = new System.Drawing.Point(542, 204);
             this.Locat1.Name = "Locat1";
             this.Locat1.Size = new System.Drawing.Size(122, 32);
             this.Locat1.TabIndex = 14;
             this.Locat1.Text = "系统内置";
             this.Locat1.UseVisualStyleBackColor = true;
+            this.Locat1.Visible = false;
             this.Locat1.Click += new System.EventHandler(this.Locat1_Click);
             // 
             // Radio2
@@ -363,7 +384,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(696, 198);
+            this.Radio2.Location = new System.Drawing.Point(696, 107);
             this.Radio2.Name = "Radio2";
             this.Radio2.Size = new System.Drawing.Size(108, 32);
             this.Radio2.TabIndex = 13;
@@ -376,7 +397,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(539, 198);
+            this.Radio1.Location = new System.Drawing.Point(538, 108);
             this.Radio1.Name = "Radio1";
             this.Radio1.Size = new System.Drawing.Size(125, 32);
             this.Radio1.TabIndex = 12;
@@ -435,7 +456,7 @@
             this.label6.Name = "label6";
             this.label6.Size = new System.Drawing.Size(153, 28);
             this.label6.TabIndex = 2;
-            this.label6.Text = "iperf 服务地址:";
+            this.label6.Text = "iperf 服务端口:";
             // 
             // label9
             // 
@@ -500,62 +521,32 @@
             // 
             // tableLayoutPanel3
             // 
-            this.tableLayoutPanel3.ColumnCount = 4;
-            this.tableLayoutPanel3.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 25F));
-            this.tableLayoutPanel3.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 25F));
-            this.tableLayoutPanel3.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 25F));
-            this.tableLayoutPanel3.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 25F));
-            this.tableLayoutPanel3.Controls.Add(this.DownMax, 2, 2);
-            this.tableLayoutPanel3.Controls.Add(this.DownMin, 1, 2);
-            this.tableLayoutPanel3.Controls.Add(this.UpMax, 2, 1);
-            this.tableLayoutPanel3.Controls.Add(this.ResMin, 3, 2);
+            this.tableLayoutPanel3.ColumnCount = 2;
+            this.tableLayoutPanel3.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
+            this.tableLayoutPanel3.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
+            this.tableLayoutPanel3.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 20F));
+            this.tableLayoutPanel3.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 20F));
+            this.tableLayoutPanel3.Controls.Add(this.ResMin, 1, 2);
             this.tableLayoutPanel3.Controls.Add(this.label17, 0, 2);
-            this.tableLayoutPanel3.Controls.Add(this.ResMax, 3, 1);
+            this.tableLayoutPanel3.Controls.Add(this.ResMax, 1, 1);
             this.tableLayoutPanel3.Controls.Add(this.label16, 0, 1);
-            this.tableLayoutPanel3.Controls.Add(this.label14, 2, 0);
-            this.tableLayoutPanel3.Controls.Add(this.label13, 1, 0);
             this.tableLayoutPanel3.Controls.Add(this.label12, 0, 0);
-            this.tableLayoutPanel3.Controls.Add(this.UpMin, 1, 1);
-            this.tableLayoutPanel3.Controls.Add(this.label15, 3, 0);
+            this.tableLayoutPanel3.Controls.Add(this.label15, 1, 0);
             this.tableLayoutPanel3.Location = new System.Drawing.Point(5, 60);
             this.tableLayoutPanel3.Name = "tableLayoutPanel3";
             this.tableLayoutPanel3.RowCount = 3;
             this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 33.33333F));
             this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 33.33333F));
             this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 33.33333F));
-            this.tableLayoutPanel3.Size = new System.Drawing.Size(532, 159);
+            this.tableLayoutPanel3.Size = new System.Drawing.Size(361, 159);
             this.tableLayoutPanel3.TabIndex = 15;
             // 
-            // DownMax
-            // 
-            this.DownMax.Anchor = System.Windows.Forms.AnchorStyles.Left;
-            this.DownMax.Location = new System.Drawing.Point(269, 113);
-            this.DownMax.Name = "DownMax";
-            this.DownMax.Size = new System.Drawing.Size(100, 39);
-            this.DownMax.TabIndex = 15;
-            // 
-            // DownMin
-            // 
-            this.DownMin.Anchor = System.Windows.Forms.AnchorStyles.Left;
-            this.DownMin.Location = new System.Drawing.Point(136, 113);
-            this.DownMin.Name = "DownMin";
-            this.DownMin.Size = new System.Drawing.Size(100, 39);
-            this.DownMin.TabIndex = 14;
-            // 
-            // UpMax
-            // 
-            this.UpMax.Anchor = System.Windows.Forms.AnchorStyles.Left;
-            this.UpMax.Location = new System.Drawing.Point(269, 60);
-            this.UpMax.Name = "UpMax";
-            this.UpMax.Size = new System.Drawing.Size(100, 39);
-            this.UpMax.TabIndex = 13;
-            // 
             // ResMin
             // 
             this.ResMin.Anchor = System.Windows.Forms.AnchorStyles.Left;
             this.ResMin.AutoSize = true;
             this.ResMin.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.ResMin.Location = new System.Drawing.Point(402, 118);
+            this.ResMin.Location = new System.Drawing.Point(183, 118);
             this.ResMin.Name = "ResMin";
             this.ResMin.Size = new System.Drawing.Size(24, 28);
             this.ResMin.TabIndex = 11;
@@ -577,7 +568,7 @@
             this.ResMax.Anchor = System.Windows.Forms.AnchorStyles.Left;
             this.ResMax.AutoSize = true;
             this.ResMax.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.ResMax.Location = new System.Drawing.Point(402, 65);
+            this.ResMax.Location = new System.Drawing.Point(183, 65);
             this.ResMax.Name = "ResMax";
             this.ResMax.Size = new System.Drawing.Size(24, 28);
             this.ResMax.TabIndex = 7;
@@ -594,28 +585,6 @@
             this.label16.TabIndex = 4;
             this.label16.Text = "上行带宽";
             // 
-            // label14
-            // 
-            this.label14.Anchor = System.Windows.Forms.AnchorStyles.Left;
-            this.label14.AutoSize = true;
-            this.label14.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.label14.Location = new System.Drawing.Point(269, 12);
-            this.label14.Name = "label14";
-            this.label14.Size = new System.Drawing.Size(54, 28);
-            this.label14.TabIndex = 2;
-            this.label14.Text = "上限";
-            // 
-            // label13
-            // 
-            this.label13.Anchor = System.Windows.Forms.AnchorStyles.Left;
-            this.label13.AutoSize = true;
-            this.label13.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.label13.Location = new System.Drawing.Point(136, 12);
-            this.label13.Name = "label13";
-            this.label13.Size = new System.Drawing.Size(54, 28);
-            this.label13.TabIndex = 1;
-            this.label13.Text = "下限";
-            // 
             // label12
             // 
             this.label12.Anchor = System.Windows.Forms.AnchorStyles.Left;
@@ -627,20 +596,12 @@
             this.label12.TabIndex = 0;
             this.label12.Text = "Mbps";
             // 
-            // UpMin
-            // 
-            this.UpMin.Anchor = System.Windows.Forms.AnchorStyles.Left;
-            this.UpMin.Location = new System.Drawing.Point(136, 60);
-            this.UpMin.Name = "UpMin";
-            this.UpMin.Size = new System.Drawing.Size(100, 39);
-            this.UpMin.TabIndex = 12;
-            // 
             // label15
             // 
             this.label15.Anchor = System.Windows.Forms.AnchorStyles.Left;
             this.label15.AutoSize = true;
             this.label15.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.label15.Location = new System.Drawing.Point(402, 12);
+            this.label15.Location = new System.Drawing.Point(183, 12);
             this.label15.Name = "label15";
             this.label15.Size = new System.Drawing.Size(75, 28);
             this.label15.TabIndex = 3;
@@ -675,28 +636,6 @@
             this.OperatResult.TabIndex = 89;
             this.OperatResult.Text = "";
             // 
-            // label20
-            // 
-            this.label20.AutoSize = true;
-            this.label20.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.label20.Location = new System.Drawing.Point(534, 115);
-            this.label20.Name = "label20";
-            this.label20.Size = new System.Drawing.Size(159, 28);
-            this.label20.TabIndex = 24;
-            this.label20.Text = "测试指令模式:";
-            // 
-            // comboBox1
-            // 
-            this.comboBox1.FormattingEnabled = true;
-            this.comboBox1.Items.AddRange(new object[] {
-            "指令一",
-            "指令二"});
-            this.comboBox1.Location = new System.Drawing.Point(678, 110);
-            this.comboBox1.Name = "comboBox1";
-            this.comboBox1.Size = new System.Drawing.Size(227, 39);
-            this.comboBox1.TabIndex = 25;
-            this.comboBox1.SelectedIndexChanged += new System.EventHandler(this.comboBox1_SelectedIndexChanged);
-            // 
             // Make_WirelessThroughput
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 18F);
@@ -709,18 +648,18 @@
             this.Name = "Make_WirelessThroughput";
             this.Text = "Make_WirelessThroughput";
             this.Load += new System.EventHandler(this.Make_WirelessThroughput_Load);
-            this.SNDetails.ResumeLayout(true);
-            this.tableLayoutPanel1.ResumeLayout(true);
+            this.SNDetails.ResumeLayout(false);
+            this.tableLayoutPanel1.ResumeLayout(false);
             this.tableLayoutPanel1.PerformLayout();
-            this.ProtDetails.ResumeLayout(true);
-            this.tableLayoutPanel2.ResumeLayout(true);
-            this.panel1.ResumeLayout(true);
+            this.ProtDetails.ResumeLayout(false);
+            this.tableLayoutPanel2.ResumeLayout(false);
+            this.panel1.ResumeLayout(false);
             this.panel1.PerformLayout();
-            this.panel2.ResumeLayout(true);
+            this.panel2.ResumeLayout(false);
             this.panel2.PerformLayout();
-            this.tableLayoutPanel3.ResumeLayout(true);
+            this.tableLayoutPanel3.ResumeLayout(false);
             this.tableLayoutPanel3.PerformLayout();
-            this.ResumeLayout(true);
+            this.ResumeLayout(false);
 
         }
 
@@ -762,16 +701,10 @@
         private System.Windows.Forms.TableLayoutPanel tableLayoutPanel3;
         private System.Windows.Forms.Label label12;
         private System.Windows.Forms.Label label15;
-        private System.Windows.Forms.Label label14;
-        private System.Windows.Forms.Label label13;
         private System.Windows.Forms.Label ResMin;
         private System.Windows.Forms.Label label17;
         private System.Windows.Forms.Label ResMax;
         private System.Windows.Forms.Label label16;
-        private System.Windows.Forms.TextBox UpMin;
-        private System.Windows.Forms.TextBox DownMax;
-        private System.Windows.Forms.TextBox DownMin;
-        private System.Windows.Forms.TextBox UpMax;
         private System.Windows.Forms.Label label18;
         private System.Windows.Forms.TextBox IPList;
         private System.Windows.Forms.TextBox ProductList;

+ 59 - 33
UAS_MES_HYSX/FunctionCode/Make/Make_WirelessThroughput.cs

@@ -34,45 +34,35 @@ namespace UAS_MES_NEW.Make
         DataTable dt;
         DataHelper dh;
 
-        string telnetPort;
+        string curIp, telnetPort,testType;
+        List<string> cmdList = new List<string>();
 
         private void Make_WirelessThroughput_Load(object sender, EventArgs e)
         {
             dh = SystemInf.dh;
             try
             {
-                string hostName = Dns.GetHostName();
-                IPHostEntry hostEntry = Dns.GetHostEntry(hostName);
+                IPHostEntry hostEntry = Dns.GetHostEntry(Dns.GetHostName());
 
                 foreach (IPAddress ip in hostEntry.AddressList)
                 {
                     if (ip.AddressFamily == AddressFamily.InterNetwork)
                     {
-                        IPList.Text = ip.ToString();
+                        curIp = ip.ToString();
                     }
                 }
             }
             catch (Exception ex)
             {
-                ShowMsg(0, $"获取iperf服务器地址失败,{ex.Message}");
-            }
-            if (!IPList.Text.Contains(":"))
-            {
-                IPList.Text = IPList.Text + ":5021";
+                ShowMsg(0, $"获取iperf服务器地址或产品IP失败,请手动填写,{ex.Message}");
             }
 
+            IPList.Text = "5021";
             telnetPort = "23";
 
-            //if (!ProductList.Text.Contains(":"))
-            //{
-            //    ProductList.Text = ProductList.Text + ":23";
-            //}
-
             Locat1.Visible = false;
             Locat2.Visible = false;
             Locat3.Visible = false;
-            Radio1.Visible = false;
-            Radio2.Visible = false;
         }
 
         private void SN_KeyDown(object sender, KeyEventArgs e)
@@ -87,17 +77,28 @@ namespace UAS_MES_NEW.Make
 
 
             SQL.Clear();
-            //SQL.Append($"SELECT pr_test_account,pr_test_password FROM makeserial,product WHERE ms_sncode = '{sn}' AND ms_prodcode = pr_code");
-            SQL.Append($"SELECT * FROM (SELECT pr_test_account,pr_test_password FROM makeserial,product WHERE ms_sncode = '{sn}' AND ms_prodcode = pr_code ORDER BY ms_indate DESC) WHERE ROWNUM = 1");
+            SQL.Append($@"SELECT pr_test_account,pr_test_password,pr_test_start,pr_test_cmd1,pr_test_cmd2,pr_test_cmd3 FROM makeserial,product
+                        WHERE ms_sncode = '{sn}' AND ms_prodcode = pr_code ORDER BY ms_id DESC");
             dt = (DataTable)dh.ExecuteSql(SQL.ToString(), "select");
             if (dt.Rows.Count == 0)
             {
-                ShowMsg(0, $"序列号:{sn}未维护吞吐量测试账户密码");
+                ShowMsg(0, $"序列号:{sn}未维护吞吐量基础信息");
             }
             else
             {
                 Account.Text = dt.Rows[0]["pr_test_account"].ToString();
                 Password.Text = dt.Rows[0]["pr_test_password"].ToString();
+
+                cmdList.Add(dt.Rows[0]["pr_test_start"].ToString());
+                if(testType == "2.4G")
+                {
+                    cmdList.Add(dt.Rows[0]["pr_test_cmd1"].ToString());
+                }
+                else
+                {
+                    cmdList.Add(dt.Rows[0]["pr_test_cmd2"].ToString());
+                }
+                cmdList.Add(dt.Rows[0]["pr_test_cmd3"].ToString());
             }
 
             if (IsCheckSet()) return;
@@ -106,15 +107,14 @@ namespace UAS_MES_NEW.Make
 
             ShowMsg(1, $"开始测试");
 
-            int iSPort = Convert.ToInt32(IPList.Text.Trim().Split(':')[1]);
             var tester = new CameraIperfTester(
                 timeOut: TestTime.Text.Trim(),
-                cameraIp: ProductList.Text.Trim().Split(':')[0],
+                cameraIp: ProductList.Text.Trim(),
                 cameraPort: Convert.ToInt32(telnetPort),
                 username: Account.Text.Trim(),
                 password: Password.Text.Trim(),
-                iperfServerIp: IPList.Text.Trim().Split(':')[0],
-                iperfServerPort: iSPort
+                iperfServerIp: curIp,
+                iperfServerPort: Convert.ToInt32(IPList.Text.Trim())
             );
 
             string parentPath = Path.GetDirectoryName(ExePath.Text.Trim());
@@ -124,7 +124,7 @@ namespace UAS_MES_NEW.Make
                 Directory.CreateDirectory(logsPath);
             }
 
-            string Msg = tester.TestStart(SN.Text.Trim(), ExePath.Text.Trim(), logsPath, comboBox1.SelectedIndex.ToString());
+            string Msg = tester.TestStart(SN.Text.Trim(), ExePath.Text.Trim(), logsPath, cmdList);
             if (Msg.StartsWith("NG"))
             {
                 ShowMsg(0, Msg);
@@ -135,14 +135,13 @@ namespace UAS_MES_NEW.Make
             ShowMsg(1, $"OK,上行速率: {upRate},下行速率: {downRate}");
             ResMax.Text = upRate;
             ResMin.Text = downRate;
-            //string tDetail = $"upRate/{upRate};downRate/{downRate}";
-            if (comboBox1.SelectedIndex.ToString() == "0")
+            if (testType == "2.4G")
             {
-                CheckPassStation(SN.Text, "PASS", upRate, downRate, "2.4G");
+                CheckPassStation(SN.Text, "PASS", upRate, downRate, testType);
             }
             else
             {
-                CheckPassStation(SN.Text, "PASS", upRate, downRate, "5G");
+                CheckPassStation(SN.Text, "PASS", upRate, downRate, testType);
             }
         }
 
@@ -341,7 +340,7 @@ namespace UAS_MES_NEW.Make
                 this.iperfServerPort = iperfServerPort;
             }
 
-            public string TestStart(string sn, string iP, string lD,string cmdType)
+            public string TestStart(string sn, string iP, string lD,List<string> cmdList)
             {
                 StringBuilder Msg = new StringBuilder();
 
@@ -353,7 +352,7 @@ namespace UAS_MES_NEW.Make
                 logDirectory = lD;
 
                 Msg.Clear();
-                Msg.Append(StartIperfTest(cmdType));
+                Msg.Append(StartIperfTest(cmdList));
 
                 return Msg.ToString();
             }
@@ -408,14 +407,39 @@ namespace UAS_MES_NEW.Make
                 }
             }
 
-            public string StartIperfTest(string cmdType)
+            public string StartIperfTest(List<string> cmdList)
             {
                 try
                 {
                     StringBuilder streamTxt = new StringBuilder();
                     string upRate, downRate, cmdLog, upLog, downLog;
 
-                    if (cmdType == "0")
+                    WriteStream(_telnetStream, cmdList[2]);
+                    streamTxt.Append(ReadStream(_telnetStream));
+
+                    WriteStream(_telnetStream, cmdList[0].Replace("Port", iperfServerPort.ToString()));
+                    streamTxt.Append(ReadStream(_telnetStream));
+
+                    cmdLog = Path.Combine(logDirectory, $"{SN}_CMD.log");
+                    File.WriteAllText(cmdLog, streamTxt.ToString());
+
+                    upLog = Path.Combine(logDirectory, $"{SN}_up.log");
+                    downLog = Path.Combine(logDirectory, $"{SN}_down.log");
+
+                    RunIperfClient(cmdList[1].Replace("IP", cameraIp).Replace("Port", iperfServerPort.ToString()) + "-R", iperfPath, upLog);
+                    RunIperfClient(cmdList[1].Replace("IP", cameraIp).Replace("Port", iperfServerPort.ToString()), iperfPath, downLog);
+
+                    upRate = ParseIperfBitrate(upLog);
+                    downRate = ParseIperfBitrate(downLog);
+                    Close();
+
+                    if (string.IsNullOrEmpty(upRate) || string.IsNullOrEmpty(downRate))
+                    {
+                        return $"NG,产前维护指令测试失败,请核对指令或使用吞吐量日志解析";
+                    }
+                    return $"OK,{upRate}|{downRate}";
+
+                    /*if (cmdType == "0")
                     {
                         WriteStream(_telnetStream, "killall iperf3");
                         streamTxt.Append(ReadStream(_telnetStream));
@@ -481,7 +505,7 @@ namespace UAS_MES_NEW.Make
                             return $"NG,指令二获取测试结果,请核对指令或使用吞吐量日志解析";
                         }
                         return $"OK,{upRate}|{downRate}";
-                    }
+                    }*/
                 }
                 catch (Exception ex)
                 {
@@ -648,6 +672,7 @@ namespace UAS_MES_NEW.Make
         {
             if (Radio1.Checked)
             {
+                testType = "2.4G";
                 Radio2.Checked = false;
             }
         }
@@ -656,6 +681,7 @@ namespace UAS_MES_NEW.Make
         {
             if (Radio2.Checked)
             {
+                testType = "5G";
                 Radio1.Checked = false;
             }
         }

+ 167 - 16
UAS_Tools_HY/Main.Designer.cs

@@ -121,6 +121,13 @@
             this.Page2 = new System.Windows.Forms.TabPage();
             this.MsgBox = new System.Windows.Forms.ListBox();
             this.FileDetail_Box = new System.Windows.Forms.Panel();
+            this.handPathVal = new System.Windows.Forms.TextBox();
+            this.handPathLab = new System.Windows.Forms.Label();
+            this.listenVal = new System.Windows.Forms.TextBox();
+            this.listenLab = new System.Windows.Forms.Label();
+            this.buildStart = new System.Windows.Forms.Button();
+            this.handExeLab = new System.Windows.Forms.Label();
+            this.handTime = new System.Windows.Forms.DateTimePicker();
             this.FileCountVal = new System.Windows.Forms.TextBox();
             this.FileCountLab = new System.Windows.Forms.Label();
             this.timerLab1 = new System.Windows.Forms.Label();
@@ -138,6 +145,11 @@
             this.currUser = new System.Windows.Forms.Label();
             this.currTime = new System.Windows.Forms.Label();
             this.top = new System.Windows.Forms.Panel();
+            this.FileDetail_Box1 = new System.Windows.Forms.Panel();
+            this.handTimeLab = new System.Windows.Forms.Label();
+            this.handExeVal = new System.Windows.Forms.TextBox();
+            this.handExeLab1 = new System.Windows.Forms.Label();
+            this.buildConfirm = new System.Windows.Forms.Button();
             this.Pagination.SuspendLayout();
             this.Page1.SuspendLayout();
             this.checkPagination.SuspendLayout();
@@ -163,6 +175,7 @@
             this.FileDetail_Box.SuspendLayout();
             this.bottom.SuspendLayout();
             this.top.SuspendLayout();
+            this.FileDetail_Box1.SuspendLayout();
             this.SuspendLayout();
             // 
             // Pagination
@@ -1173,6 +1186,7 @@
             // 
             this.Page2.BackColor = System.Drawing.SystemColors.Control;
             this.Page2.Controls.Add(this.MsgBox);
+            this.Page2.Controls.Add(this.FileDetail_Box1);
             this.Page2.Controls.Add(this.FileDetail_Box);
             this.Page2.Cursor = System.Windows.Forms.Cursors.Default;
             this.Page2.Location = new System.Drawing.Point(4, 34);
@@ -1188,9 +1202,9 @@
             this.MsgBox.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
             this.MsgBox.FormattingEnabled = true;
             this.MsgBox.ItemHeight = 24;
-            this.MsgBox.Location = new System.Drawing.Point(3, 191);
+            this.MsgBox.Location = new System.Drawing.Point(3, 166);
             this.MsgBox.Name = "MsgBox";
-            this.MsgBox.Size = new System.Drawing.Size(1240, 393);
+            this.MsgBox.Size = new System.Drawing.Size(1240, 418);
             this.MsgBox.TabIndex = 0;
             this.MsgBox.DrawItem += new System.Windows.Forms.DrawItemEventHandler(this.MsgBox_DrawItem);
             // 
@@ -1209,16 +1223,82 @@
             this.FileDetail_Box.Controls.Add(this.FtpAccountLab);
             this.FileDetail_Box.Controls.Add(this.timerVal);
             this.FileDetail_Box.Controls.Add(this.timerLab);
-            this.FileDetail_Box.Dock = System.Windows.Forms.DockStyle.Top;
             this.FileDetail_Box.Location = new System.Drawing.Point(3, 3);
             this.FileDetail_Box.Name = "FileDetail_Box";
             this.FileDetail_Box.Size = new System.Drawing.Size(1240, 188);
             this.FileDetail_Box.TabIndex = 1;
             // 
+            // handPathVal
+            // 
+            this.handPathVal.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.handPathVal.Location = new System.Drawing.Point(120, 129);
+            this.handPathVal.Name = "handPathVal";
+            this.handPathVal.Size = new System.Drawing.Size(322, 31);
+            this.handPathVal.TabIndex = 20;
+            this.handPathVal.Click += new System.EventHandler(this.handPathVal_Click);
+            // 
+            // handPathLab
+            // 
+            this.handPathLab.AutoSize = true;
+            this.handPathLab.Location = new System.Drawing.Point(13, 129);
+            this.handPathLab.Name = "handPathLab";
+            this.handPathLab.Size = new System.Drawing.Size(101, 28);
+            this.handPathLab.TabIndex = 19;
+            this.handPathLab.Text = "导出路径:";
+            // 
+            // listenVal
+            // 
+            this.listenVal.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.listenVal.Location = new System.Drawing.Point(120, 89);
+            this.listenVal.Name = "listenVal";
+            this.listenVal.Size = new System.Drawing.Size(322, 31);
+            this.listenVal.TabIndex = 18;
+            this.listenVal.Click += new System.EventHandler(this.listenVal_Click);
+            // 
+            // listenLab
+            // 
+            this.listenLab.AutoSize = true;
+            this.listenLab.Location = new System.Drawing.Point(13, 92);
+            this.listenLab.Name = "listenLab";
+            this.listenLab.Size = new System.Drawing.Size(101, 28);
+            this.listenLab.TabIndex = 17;
+            this.listenLab.Text = "监控路径:";
+            // 
+            // buildStart
+            // 
+            this.buildStart.Cursor = System.Windows.Forms.Cursors.Hand;
+            this.buildStart.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.buildStart.Location = new System.Drawing.Point(557, 125);
+            this.buildStart.Name = "buildStart";
+            this.buildStart.Size = new System.Drawing.Size(100, 31);
+            this.buildStart.TabIndex = 16;
+            this.buildStart.Text = "开启处理";
+            this.buildStart.UseVisualStyleBackColor = true;
+            this.buildStart.Click += new System.EventHandler(this.buildStart_Click);
+            // 
+            // handExeLab
+            // 
+            this.handExeLab.AutoSize = true;
+            this.handExeLab.Location = new System.Drawing.Point(13, 11);
+            this.handExeLab.Name = "handExeLab";
+            this.handExeLab.Size = new System.Drawing.Size(143, 28);
+            this.handExeLab.TabIndex = 15;
+            this.handExeLab.Text = "处理间隔时间:";
+            // 
+            // handTime
+            // 
+            this.handTime.CustomFormat = "yyyy-MM-dd HH";
+            this.handTime.Format = System.Windows.Forms.DateTimePickerFormat.Custom;
+            this.handTime.Location = new System.Drawing.Point(120, 46);
+            this.handTime.Name = "handTime";
+            this.handTime.ShowUpDown = true;
+            this.handTime.Size = new System.Drawing.Size(185, 35);
+            this.handTime.TabIndex = 14;
+            // 
             // FileCountVal
             // 
             this.FileCountVal.Anchor = System.Windows.Forms.AnchorStyles.Left;
-            this.FileCountVal.Location = new System.Drawing.Point(629, 19);
+            this.FileCountVal.Location = new System.Drawing.Point(1144, 16);
             this.FileCountVal.Name = "FileCountVal";
             this.FileCountVal.Size = new System.Drawing.Size(65, 35);
             this.FileCountVal.TabIndex = 13;
@@ -1228,7 +1308,7 @@
             // 
             this.FileCountLab.Anchor = System.Windows.Forms.AnchorStyles.Left;
             this.FileCountLab.AutoSize = true;
-            this.FileCountLab.Location = new System.Drawing.Point(515, 22);
+            this.FileCountLab.Location = new System.Drawing.Point(1030, 19);
             this.FileCountLab.Name = "FileCountLab";
             this.FileCountLab.Size = new System.Drawing.Size(122, 28);
             this.FileCountLab.TabIndex = 12;
@@ -1238,7 +1318,7 @@
             // 
             this.timerLab1.Anchor = System.Windows.Forms.AnchorStyles.Left;
             this.timerLab1.AutoSize = true;
-            this.timerLab1.Location = new System.Drawing.Point(454, 22);
+            this.timerLab1.Location = new System.Drawing.Point(969, 19);
             this.timerLab1.Name = "timerLab1";
             this.timerLab1.Size = new System.Drawing.Size(33, 28);
             this.timerLab1.TabIndex = 11;
@@ -1249,7 +1329,7 @@
             this.FtpListen.Cursor = System.Windows.Forms.Cursors.Hand;
             this.FtpListen.Enabled = false;
             this.FtpListen.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.FtpListen.Location = new System.Drawing.Point(620, 121);
+            this.FtpListen.Location = new System.Drawing.Point(1135, 118);
             this.FtpListen.Name = "FtpListen";
             this.FtpListen.Size = new System.Drawing.Size(100, 38);
             this.FtpListen.TabIndex = 10;
@@ -1261,7 +1341,7 @@
             // 
             this.FtpConnect.Cursor = System.Windows.Forms.Cursors.Hand;
             this.FtpConnect.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.FtpConnect.Location = new System.Drawing.Point(490, 122);
+            this.FtpConnect.Location = new System.Drawing.Point(1005, 119);
             this.FtpConnect.Name = "FtpConnect";
             this.FtpConnect.Size = new System.Drawing.Size(100, 37);
             this.FtpConnect.TabIndex = 9;
@@ -1273,7 +1353,7 @@
             // 
             this.FtpPathVal.Anchor = System.Windows.Forms.AnchorStyles.Left;
             this.FtpPathVal.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.FtpPathVal.Location = new System.Drawing.Point(398, 72);
+            this.FtpPathVal.Location = new System.Drawing.Point(913, 69);
             this.FtpPathVal.Name = "FtpPathVal";
             this.FtpPathVal.Size = new System.Drawing.Size(322, 31);
             this.FtpPathVal.TabIndex = 7;
@@ -1282,7 +1362,7 @@
             // 
             this.FtpPathLab.Anchor = System.Windows.Forms.AnchorStyles.Left;
             this.FtpPathLab.AutoSize = true;
-            this.FtpPathLab.Location = new System.Drawing.Point(296, 74);
+            this.FtpPathLab.Location = new System.Drawing.Point(811, 71);
             this.FtpPathLab.Name = "FtpPathLab";
             this.FtpPathLab.Size = new System.Drawing.Size(137, 28);
             this.FtpPathLab.TabIndex = 6;
@@ -1291,7 +1371,7 @@
             // FtpPwVal
             // 
             this.FtpPwVal.Anchor = System.Windows.Forms.AnchorStyles.Left;
-            this.FtpPwVal.Location = new System.Drawing.Point(94, 71);
+            this.FtpPwVal.Location = new System.Drawing.Point(609, 68);
             this.FtpPwVal.Name = "FtpPwVal";
             this.FtpPwVal.Size = new System.Drawing.Size(180, 35);
             this.FtpPwVal.TabIndex = 5;
@@ -1300,7 +1380,7 @@
             // 
             this.FtpPwLab.Anchor = System.Windows.Forms.AnchorStyles.Left;
             this.FtpPwLab.AutoSize = true;
-            this.FtpPwLab.Location = new System.Drawing.Point(12, 74);
+            this.FtpPwLab.Location = new System.Drawing.Point(527, 71);
             this.FtpPwLab.Name = "FtpPwLab";
             this.FtpPwLab.Size = new System.Drawing.Size(95, 28);
             this.FtpPwLab.TabIndex = 4;
@@ -1309,7 +1389,7 @@
             // FtpAccountVal
             // 
             this.FtpAccountVal.Anchor = System.Windows.Forms.AnchorStyles.Left;
-            this.FtpAccountVal.Location = new System.Drawing.Point(94, 20);
+            this.FtpAccountVal.Location = new System.Drawing.Point(609, 17);
             this.FtpAccountVal.Name = "FtpAccountVal";
             this.FtpAccountVal.Size = new System.Drawing.Size(180, 35);
             this.FtpAccountVal.TabIndex = 3;
@@ -1318,7 +1398,7 @@
             // 
             this.FtpAccountLab.Anchor = System.Windows.Forms.AnchorStyles.Left;
             this.FtpAccountLab.AutoSize = true;
-            this.FtpAccountLab.Location = new System.Drawing.Point(12, 22);
+            this.FtpAccountLab.Location = new System.Drawing.Point(527, 19);
             this.FtpAccountLab.Name = "FtpAccountLab";
             this.FtpAccountLab.Size = new System.Drawing.Size(95, 28);
             this.FtpAccountLab.TabIndex = 2;
@@ -1327,7 +1407,7 @@
             // timerVal
             // 
             this.timerVal.Anchor = System.Windows.Forms.AnchorStyles.Left;
-            this.timerVal.Location = new System.Drawing.Point(398, 19);
+            this.timerVal.Location = new System.Drawing.Point(913, 16);
             this.timerVal.Name = "timerVal";
             this.timerVal.Size = new System.Drawing.Size(54, 35);
             this.timerVal.TabIndex = 1;
@@ -1337,7 +1417,7 @@
             // 
             this.timerLab.Anchor = System.Windows.Forms.AnchorStyles.Left;
             this.timerLab.AutoSize = true;
-            this.timerLab.Location = new System.Drawing.Point(296, 22);
+            this.timerLab.Location = new System.Drawing.Point(811, 19);
             this.timerLab.Name = "timerLab";
             this.timerLab.Size = new System.Drawing.Size(101, 28);
             this.timerLab.TabIndex = 0;
@@ -1394,6 +1474,63 @@
             this.top.Size = new System.Drawing.Size(1254, 625);
             this.top.TabIndex = 3;
             // 
+            // FileDetail_Box1
+            // 
+            this.FileDetail_Box1.Controls.Add(this.buildConfirm);
+            this.FileDetail_Box1.Controls.Add(this.handExeLab1);
+            this.FileDetail_Box1.Controls.Add(this.handExeVal);
+            this.FileDetail_Box1.Controls.Add(this.handTimeLab);
+            this.FileDetail_Box1.Controls.Add(this.handPathVal);
+            this.FileDetail_Box1.Controls.Add(this.listenVal);
+            this.FileDetail_Box1.Controls.Add(this.handPathLab);
+            this.FileDetail_Box1.Controls.Add(this.handTime);
+            this.FileDetail_Box1.Controls.Add(this.handExeLab);
+            this.FileDetail_Box1.Controls.Add(this.listenLab);
+            this.FileDetail_Box1.Controls.Add(this.buildStart);
+            this.FileDetail_Box1.Dock = System.Windows.Forms.DockStyle.Top;
+            this.FileDetail_Box1.Location = new System.Drawing.Point(3, 3);
+            this.FileDetail_Box1.Name = "FileDetail_Box1";
+            this.FileDetail_Box1.Size = new System.Drawing.Size(1240, 163);
+            this.FileDetail_Box1.TabIndex = 21;
+            // 
+            // handTimeLab
+            // 
+            this.handTimeLab.AutoSize = true;
+            this.handTimeLab.Location = new System.Drawing.Point(13, 51);
+            this.handTimeLab.Name = "handTimeLab";
+            this.handTimeLab.Size = new System.Drawing.Size(101, 28);
+            this.handTimeLab.TabIndex = 21;
+            this.handTimeLab.Text = "当前时段:";
+            // 
+            // handExeVal
+            // 
+            this.handExeVal.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.handExeVal.Location = new System.Drawing.Point(120, 9);
+            this.handExeVal.Name = "handExeVal";
+            this.handExeVal.Size = new System.Drawing.Size(62, 31);
+            this.handExeVal.TabIndex = 22;
+            // 
+            // handExeLab1
+            // 
+            this.handExeLab1.AutoSize = true;
+            this.handExeLab1.Location = new System.Drawing.Point(188, 11);
+            this.handExeLab1.Name = "handExeLab1";
+            this.handExeLab1.Size = new System.Drawing.Size(54, 28);
+            this.handExeLab1.TabIndex = 23;
+            this.handExeLab1.Text = "分钟";
+            // 
+            // buildConfirm
+            // 
+            this.buildConfirm.Cursor = System.Windows.Forms.Cursors.Hand;
+            this.buildConfirm.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.buildConfirm.Location = new System.Drawing.Point(448, 125);
+            this.buildConfirm.Name = "buildConfirm";
+            this.buildConfirm.Size = new System.Drawing.Size(100, 31);
+            this.buildConfirm.TabIndex = 24;
+            this.buildConfirm.Text = "确定";
+            this.buildConfirm.UseVisualStyleBackColor = true;
+            this.buildConfirm.Click += new System.EventHandler(this.buildConfirm_Click);
+            // 
             // Main
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(11F, 24F);
@@ -1446,6 +1583,8 @@
             this.bottom.ResumeLayout(false);
             this.bottom.PerformLayout();
             this.top.ResumeLayout(false);
+            this.FileDetail_Box1.ResumeLayout(false);
+            this.FileDetail_Box1.PerformLayout();
             this.ResumeLayout(false);
 
         }
@@ -1561,5 +1700,17 @@
         private System.Windows.Forms.Label timerLab;
         private System.Windows.Forms.TextBox FileCountVal;
         private System.Windows.Forms.Label FileCountLab;
+        private System.Windows.Forms.DateTimePicker handTime;
+        private System.Windows.Forms.Label handExeLab;
+        private System.Windows.Forms.TextBox listenVal;
+        private System.Windows.Forms.Label listenLab;
+        private System.Windows.Forms.Button buildStart;
+        private System.Windows.Forms.TextBox handPathVal;
+        private System.Windows.Forms.Label handPathLab;
+        private System.Windows.Forms.Panel FileDetail_Box1;
+        private System.Windows.Forms.Label handTimeLab;
+        private System.Windows.Forms.Label handExeLab1;
+        private System.Windows.Forms.TextBox handExeVal;
+        private System.Windows.Forms.Button buildConfirm;
     }
 }

+ 220 - 1
UAS_Tools_HY/Main.cs

@@ -1,5 +1,6 @@
 using Microsoft.Office.Interop.Excel;
 using System;
+using System.Collections.Concurrent;
 using System.Collections.Generic;
 using System.ComponentModel;
 using System.Data;
@@ -14,14 +15,15 @@ using System.Runtime.InteropServices;
 using System.Security.Principal;
 using System.Text;
 using System.Text.RegularExpressions;
+using System.Threading;
 using System.Threading.Tasks;
 using System.Windows.Forms;
 using UAS_Tools_HY;
 using UAS_Tools_HY.Properties;
 using UAS_Tools_HY.PublicMethods;
-using static System.Windows.Forms.VisualStyles.VisualStyleElement;
 using Application = Microsoft.Office.Interop.Excel.Application;
 using DataTable = System.Data.DataTable;
+using Timer = System.Windows.Forms.Timer;
 
 namespace UAS_MES_Tools
 {
@@ -39,10 +41,14 @@ namespace UAS_MES_Tools
         int ishaveInd;
 
         Timer File_timer;
+        Timer File_timer1;
 
         string saveFiles;
 
         int currentNum = 1;
+
+        private CancellationTokenSource _currentOperationCts;
+
         public Main(string account, string password)
         {
             _Account = account;
@@ -102,6 +108,11 @@ namespace UAS_MES_Tools
             timerVal.Text = "30";
             FileCountVal.Text = "10";
             FtpPathVal.Text = "ftp://10.18.13.48:21";
+
+            handExeVal.Text = "120";
+            File_timer1 = new Timer();
+            File_timer1.Interval = Convert.ToInt32(handExeVal.Text) * 1000;
+            File_timer1.Tick += FileTimer_Tick;
         }
 
         private void SN_KeyDown(object sender, KeyEventArgs e)
@@ -705,6 +716,8 @@ namespace UAS_MES_Tools
         {
             string currentDate = DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss");
             currTime.Text = currentDate;
+
+            handTime.Value = new DateTime(DateTime.Now.Year,DateTime.Now.Month,DateTime.Now.Day,DateTime.Now.Hour,0, 0);
         }
 
         private async void FtpConnect_Click(object sender, EventArgs e)
@@ -1135,5 +1148,211 @@ namespace UAS_MES_Tools
                 LogMessage($"NG,压缩失败:{ex.Message}");
             }
         }
+
+        private void listenVal_Click(object sender, EventArgs e)
+        {
+            using (FolderBrowserDialog folderDialog = new FolderBrowserDialog())
+            {
+                folderDialog.Description = "请选择监控文件夹";
+                folderDialog.SelectedPath = listenVal.Text;
+
+                if (folderDialog.ShowDialog() == DialogResult.OK)
+                {
+                    listenVal.Text = folderDialog.SelectedPath;
+                }
+            }
+        }
+
+        private void handPathVal_Click(object sender, EventArgs e)
+        {
+            using (FolderBrowserDialog folderDialog = new FolderBrowserDialog())
+            {
+                folderDialog.Description = "请选择导出文件夹";
+                folderDialog.SelectedPath = handPathVal.Text;
+
+                if (folderDialog.ShowDialog() == DialogResult.OK)
+                {
+                    handPathVal.Text = folderDialog.SelectedPath;
+                }
+            }
+        }
+
+        private void buildConfirm_Click(object sender, EventArgs e)
+        {
+            if (buildConfirm.Text == "确定")
+            {
+                if (string.IsNullOrEmpty(handExeVal.Text))
+                {
+                    LogMessage($"NG,请填写处理间隔时间");
+                    return;
+                }
+                if (string.IsNullOrEmpty(listenVal.Text))
+                {
+                    LogMessage($"NG,请填写监控路径");
+                    return;
+                }
+                if (string.IsNullOrEmpty(handPathVal.Text))
+                {
+                    LogMessage($"NG,请填写导出路径");
+                    return;
+                }
+
+                handExeVal.Enabled = false;
+                handTime.Enabled = false;
+                listenVal.Enabled = false;
+                handPathVal.Enabled = false;
+                buildConfirm.Text = "取消";
+            }
+            else
+            {
+                handExeVal.Enabled = true;
+                handTime.Enabled = true;
+                listenVal.Enabled = true;
+                handPathVal.Enabled = true;
+                buildConfirm.Text = "确定";
+            }
+        }
+
+        private void buildStart_Click(object sender, EventArgs e)
+        {
+            if(buildStart.Text == "开启处理")
+            {
+                buildStart.Text = "关闭处理";
+                File_timer1.Interval = Convert.ToInt32(handExeVal.Text) * 60 * 1000;
+                File_timer1.Start();
+                FileTimer_Tick(null, null);
+            }
+            else
+            {
+                buildStart.Text = "开启处理";
+                File_timer.Stop();
+            }
+        }
+
+        private async void FileTimer_Tick(object sender, EventArgs e)
+        {
+            _currentOperationCts?.Cancel();
+            _currentOperationCts = new CancellationTokenSource();
+
+            try
+            {
+                await Task.Run(() => ProcessFilesInternal(_currentOperationCts.Token));
+            }
+            catch (OperationCanceledException)
+            {
+                LogMessage("文件处理操作被新任务取消。");
+            }
+            catch (Exception ex)
+            {
+                LogMessage($"NG,定时器任务启动失败: {ex}");
+            }
+            /*try
+            {
+                string[] txtFiles = Directory.GetFiles(listenVal.Text, $"*.json");
+                string currentHour = DateTime.Now.ToString("yyyyMMdd_hh");
+                string outPath = Path.Combine(handPathVal.Text, currentHour + "_Count_" + txtFiles.Length);
+                if (!Directory.Exists(outPath))
+                {
+                    Directory.CreateDirectory(outPath);
+                }
+
+                foreach (string file in txtFiles)
+                {
+                    string targetFile = Path.Combine(outPath, Path.GetFileName(file));
+                    if (File.Exists(targetFile))
+                    {
+                        File.Delete(targetFile);
+                    }
+                    File.Move(file, targetFile);
+                }
+
+                string zipPath = outPath + ".zip";
+                if (File.Exists(zipPath))
+                {
+                    File.Delete(zipPath);
+                }
+                ZipFile.CreateFromDirectory(outPath, zipPath);
+                LogMessage($"OK,文件已压缩到:{zipPath}");
+            }
+            catch(Exception ex)
+            {
+                LogMessage($"NG,解析文件列表失败: {ex.Message}");
+            }*/
+        }
+        private void ProcessFilesInternal(CancellationToken cancellationToken)
+        {
+            try
+            {
+                var txtFiles = Directory.EnumerateFiles(listenVal.Text, "*.json", SearchOption.TopDirectoryOnly).ToList();
+                int fileCount = txtFiles.Count;
+                if (fileCount == 0)
+                {
+                    LogMessage("没有找到需要处理的 .json 文件。");
+                    return;
+                }
+                cancellationToken.ThrowIfCancellationRequested();
+
+                LogMessage($"已找到找到 {fileCount} 个json文件,开始处理...");
+                string currentHour = DateTime.Now.ToString("yyyyMMdd_HH");
+                string outPath = Path.Combine(handPathVal.Text, $"{currentHour}_{Convert.ToInt32(handExeVal.Text)}_Count_{fileCount}");
+
+                cancellationToken.ThrowIfCancellationRequested();
+                if (!Directory.Exists(outPath))
+                {
+                    Directory.CreateDirectory(outPath);
+                }
+
+                int movedCount = 0;
+                foreach (string file in txtFiles)
+                {
+                    cancellationToken.ThrowIfCancellationRequested();
+                    string targetFile = Path.Combine(outPath, Path.GetFileName(file));
+                    if (File.Exists(targetFile))
+                    {
+                        File.Delete(targetFile);
+                    }
+
+                    File.Move(file, targetFile);
+                    movedCount++;
+
+                    if (movedCount % 1000 == 0)
+                    {
+                        LogMessage($"已移动 {movedCount}/{fileCount} 个文件...");
+                    }
+                }
+                LogMessage($"成功移动 {movedCount} 个文件到 '{outPath}'");
+                string zipPath = outPath + ".zip";
+
+                cancellationToken.ThrowIfCancellationRequested();
+                if (File.Exists(zipPath))
+                {
+                    File.Delete(zipPath);
+                }
+
+                ZipFile.CreateFromDirectory(outPath, zipPath);
+                //Directory.Delete(outPath, true);
+                LogMessage($"OK, {fileCount} 个文件已成功压缩到: {zipPath}");
+            }
+            catch (OperationCanceledException)
+            {
+                LogMessage("OK, 文件处理操作被用户取消。");
+            }
+            catch (UnauthorizedAccessException ex)
+            {
+                LogMessage($"NG, 访问被拒绝,可能没有足够权限读写文件或目录: {ex.Message}");
+            }
+            catch (DirectoryNotFoundException ex)
+            {
+                LogMessage($"NG, 指定的路径不存在: {ex.Message}");
+            }
+            catch (IOException ex)
+            {
+                LogMessage($"NG, 文件 I/O 错误: {ex.Message}");
+            }
+            catch (Exception ex)
+            {
+                LogMessage($"NG, 文件处理过程中发生未知错误: {ex}");
+            }
+        }
     }
 }