Selaa lähdekoodia

feat dcr打包

yhluo 1 kuukausi sitten
vanhempi
commit
15f3ad8762
2 muutettua tiedostoa jossa 387 lisäystä ja 17 poistoa
  1. 167 16
      UAS_Tools_HY/Main.Designer.cs
  2. 220 1
      UAS_Tools_HY/Main.cs

+ 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}");
+            }
+        }
     }
 }