From 43df9f774a50dcee98c9ea861b1baa646f6f3ac6 Mon Sep 17 00:00:00 2001 From: schangxiang@126.com <schangxiang@126.com> Date: 周三, 26 6月 2024 11:53:27 +0800 Subject: [PATCH] 2 --- DataCapture/iWare_SCADA_DataCapture/iWare_SCADA_FormTest/Form1.cs | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 55 insertions(+), 0 deletions(-) diff --git a/DataCapture/iWare_SCADA_DataCapture/iWare_SCADA_FormTest/Form1.cs b/DataCapture/iWare_SCADA_DataCapture/iWare_SCADA_FormTest/Form1.cs index f8ac998..b28acd6 100644 --- a/DataCapture/iWare_SCADA_DataCapture/iWare_SCADA_FormTest/Form1.cs +++ b/DataCapture/iWare_SCADA_DataCapture/iWare_SCADA_FormTest/Form1.cs @@ -9,6 +9,7 @@ using System.Text; using System.Threading.Tasks; using System.Windows.Forms; +using static System.Windows.Forms.VisualStyles.VisualStyleElement.TaskbarClock; namespace iWare_SCADA_FormTest { @@ -43,5 +44,59 @@ } } + + private void button2_Click(object sender, EventArgs e) + { + try + { + string path = ConfigHelper.GetConfigString("OP60QualityData_Test"); + + var newFiles = FileHelper.DetectNewFiles(path, "*.dfq", 300, DateTime.Now.AddDays(-100), DateTime.Now.AddDays(1)); + + foreach (System.IO.FileInfo file in newFiles) + { + //MessageBox.Show("鎵惧埌鏂囦欢:" + file.FullName); + var toPath = file.FullName.Replace("Measuring_Data_df_Test", "Measuring_Data_df_Copy"); + //MessageBox.Show("瑕佺Щ鍔ㄥ埌:" + file.FullName); + File.Move(file.FullName, toPath);//绉诲姩 + } + + MessageBox.Show("鎴愬姛"); + } + catch (Exception ex) + { + MessageBox.Show("寮傚父:" + ex.Message); + } + } + + private void button3_Click(object sender, EventArgs e) + { + try + { + string path = ConfigHelper.GetConfigString("OP60QualityData_Zhengshi"); + + var newFiles = FileHelper.DetectNewFiles(path, "*.dfq", 300, DateTime.Now.AddDays(-100), DateTime.Now.AddDays(1)); + + foreach (System.IO.FileInfo source_doFile in newFiles) + { + //MessageBox.Show("鎵惧埌FullName:" + source_doFile.FullName+ ",Name:" + source_doFile.Name); + + //鐩爣鏂囦欢鐨勫畬鏁寸洰褰� + string destFileName = source_doFile.FullName.Replace("Measuring_Data_dfq", "Measuring_Data_df_Copy"); + string source_file_name = source_doFile.Name.Replace(".dfq", "");//涓嶅甫鎵╁睍鍚嶇殑鏂囦欢鍚嶅瓧 + destFileName = destFileName.Replace(source_file_name, source_file_name + "_" + "_" + DateTime.Now.ToString("yyyyMMddHHmmss")); + File.Copy(source_doFile.FullName, destFileName, true); + + //FileInfo destFile = new FileInfo(destFileName); + //MessageBox.Show("鏂版枃浠舵壘鍒癋ullName:" + destFile.FullName + ",Name:" + destFile.Name); + } + + MessageBox.Show("鎴愬姛"); + } + catch (Exception ex) + { + MessageBox.Show("寮傚父:" + ex.Message); + } + } } } -- Gitblit v1.9.3