Explorar o código

1,增加递归删除ftp文件夹功能;
2,生成参数界面可选择HUB_FCT,支持仅导出到本地;
3, FCT治具测试账户登录后,测试路径自动改为HUB_FCT_Test。

Dail hai 1 ano
pai
achega
cd345999f7

BIN=BIN
.vs/Welling_Motor_Debug_Tool/v17/.suo


+ 75 - 30
Welling_Motor_Debug_Tool/GenerateParams.Designer.cs

@@ -77,7 +77,9 @@
             this.textBox_BikeThroSpeed = new System.Windows.Forms.TextBox();
             this.label13 = new System.Windows.Forms.Label();
             this.textBox_BikeWheel = new System.Windows.Forms.TextBox();
+            this.label39 = new System.Windows.Forms.Label();
             this.tabPage_Advance = new System.Windows.Forms.TabPage();
+            this.pictureBox1 = new System.Windows.Forms.PictureBox();
             this.richTextBox_AdvanceParams = new System.Windows.Forms.RichTextBox();
             this.tabPage_Note = new System.Windows.Forms.TabPage();
             this.button_NoteRead = new System.Windows.Forms.Button();
@@ -130,8 +132,9 @@
             this.button_ChangeModelFile = new System.Windows.Forms.Button();
             this.button_DeletModelFile = new System.Windows.Forms.Button();
             this.button_LoadFile = new System.Windows.Forms.Button();
-            this.label39 = new System.Windows.Forms.Label();
-            this.pictureBox1 = new System.Windows.Forms.PictureBox();
+            this.radioButton_HUB_FCT = new System.Windows.Forms.RadioButton();
+            this.checkBox_SyncFac = new System.Windows.Forms.CheckBox();
+            this.groupBox6 = new System.Windows.Forms.GroupBox();
             this.tabControl1.SuspendLayout();
             this.tabPage_Simple.SuspendLayout();
             this.groupBox5.SuspendLayout();
@@ -139,11 +142,12 @@
             this.groupBox3.SuspendLayout();
             this.groupBox2.SuspendLayout();
             this.tabPage_Advance.SuspendLayout();
+            ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
             this.tabPage_Note.SuspendLayout();
             this.groupBox1.SuspendLayout();
             ((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).BeginInit();
             this.statusStrip1.SuspendLayout();
-            ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
+            this.groupBox6.SuspendLayout();
             this.SuspendLayout();
             // 
             // button_ExportParams
@@ -676,6 +680,17 @@
             this.textBox_BikeWheel.Size = new System.Drawing.Size(65, 29);
             this.textBox_BikeWheel.TabIndex = 1;
             // 
+            // label39
+            // 
+            this.label39.AutoSize = true;
+            this.label39.Font = new System.Drawing.Font("微软雅黑", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.label39.ForeColor = System.Drawing.Color.Red;
+            this.label39.Location = new System.Drawing.Point(11, 569);
+            this.label39.Name = "label39";
+            this.label39.Size = new System.Drawing.Size(449, 25);
+            this.label39.TabIndex = 0;
+            this.label39.Text = "注意:简易参数界面内容在高级参数界面修改无效!\r\n";
+            // 
             // tabPage_Advance
             // 
             this.tabPage_Advance.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(255)))), ((int)(((byte)(192)))));
@@ -689,6 +704,17 @@
             this.tabPage_Advance.TabIndex = 1;
             this.tabPage_Advance.Text = "高级参数";
             // 
+            // pictureBox1
+            // 
+            this.pictureBox1.Image = global::Welling_Motor_Debug_Tool.Properties.Resources.Lock;
+            this.pictureBox1.Location = new System.Drawing.Point(433, 6);
+            this.pictureBox1.Name = "pictureBox1";
+            this.pictureBox1.Size = new System.Drawing.Size(45, 45);
+            this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
+            this.pictureBox1.TabIndex = 9;
+            this.pictureBox1.TabStop = false;
+            this.pictureBox1.Click += new System.EventHandler(this.pictureBox1_Click);
+            // 
             // richTextBox_AdvanceParams
             // 
             this.richTextBox_AdvanceParams.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(192)))));
@@ -1074,7 +1100,7 @@
             // 
             this.pictureBox2.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(255)))), ((int)(((byte)(192)))));
             this.pictureBox2.Image = global::Welling_Motor_Debug_Tool.Properties.Resources.about;
-            this.pictureBox2.Location = new System.Drawing.Point(853, 696);
+            this.pictureBox2.Location = new System.Drawing.Point(855, 706);
             this.pictureBox2.Name = "pictureBox2";
             this.pictureBox2.Size = new System.Drawing.Size(167, 23);
             this.pictureBox2.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
@@ -1124,7 +1150,7 @@
             // 
             this.radioButton_MIGIC.AutoSize = true;
             this.radioButton_MIGIC.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(113)))), ((int)(((byte)(185)))));
-            this.radioButton_MIGIC.Location = new System.Drawing.Point(868, 565);
+            this.radioButton_MIGIC.Location = new System.Drawing.Point(16, 30);
             this.radioButton_MIGIC.Name = "radioButton_MIGIC";
             this.radioButton_MIGIC.Size = new System.Drawing.Size(77, 25);
             this.radioButton_MIGIC.TabIndex = 24;
@@ -1136,7 +1162,7 @@
             // 
             this.radioButton_HUB.AutoSize = true;
             this.radioButton_HUB.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(113)))), ((int)(((byte)(185)))));
-            this.radioButton_HUB.Location = new System.Drawing.Point(955, 565);
+            this.radioButton_HUB.Location = new System.Drawing.Point(16, 61);
             this.radioButton_HUB.Name = "radioButton_HUB";
             this.radioButton_HUB.Size = new System.Drawing.Size(62, 25);
             this.radioButton_HUB.TabIndex = 24;
@@ -1253,27 +1279,41 @@
             this.button_LoadFile.UseVisualStyleBackColor = false;
             this.button_LoadFile.Click += new System.EventHandler(this.button_LoadFile_Click);
             // 
-            // label39
-            // 
-            this.label39.AutoSize = true;
-            this.label39.Font = new System.Drawing.Font("微软雅黑", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.label39.ForeColor = System.Drawing.Color.Red;
-            this.label39.Location = new System.Drawing.Point(11, 569);
-            this.label39.Name = "label39";
-            this.label39.Size = new System.Drawing.Size(449, 25);
-            this.label39.TabIndex = 0;
-            this.label39.Text = "注意:简易参数界面内容在高级参数界面修改无效!\r\n";
-            // 
-            // pictureBox1
-            // 
-            this.pictureBox1.Image = global::Welling_Motor_Debug_Tool.Properties.Resources.Lock;
-            this.pictureBox1.Location = new System.Drawing.Point(433, 6);
-            this.pictureBox1.Name = "pictureBox1";
-            this.pictureBox1.Size = new System.Drawing.Size(45, 45);
-            this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
-            this.pictureBox1.TabIndex = 9;
-            this.pictureBox1.TabStop = false;
-            this.pictureBox1.Click += new System.EventHandler(this.pictureBox1_Click);
+            // radioButton_HUB_FCT
+            // 
+            this.radioButton_HUB_FCT.AutoSize = true;
+            this.radioButton_HUB_FCT.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(113)))), ((int)(((byte)(185)))));
+            this.radioButton_HUB_FCT.Location = new System.Drawing.Point(16, 92);
+            this.radioButton_HUB_FCT.Name = "radioButton_HUB_FCT";
+            this.radioButton_HUB_FCT.Size = new System.Drawing.Size(98, 25);
+            this.radioButton_HUB_FCT.TabIndex = 24;
+            this.radioButton_HUB_FCT.Text = "HUB_FCT";
+            this.radioButton_HUB_FCT.UseVisualStyleBackColor = true;
+            this.radioButton_HUB_FCT.Click += new System.EventHandler(this.radioButton_HUB_Click);
+            // 
+            // checkBox_SyncFac
+            // 
+            this.checkBox_SyncFac.AutoSize = true;
+            this.checkBox_SyncFac.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(113)))), ((int)(((byte)(185)))));
+            this.checkBox_SyncFac.Location = new System.Drawing.Point(868, 675);
+            this.checkBox_SyncFac.Name = "checkBox_SyncFac";
+            this.checkBox_SyncFac.Size = new System.Drawing.Size(125, 25);
+            this.checkBox_SyncFac.TabIndex = 28;
+            this.checkBox_SyncFac.Text = "仅导出到本地";
+            this.checkBox_SyncFac.UseVisualStyleBackColor = true;
+            // 
+            // groupBox6
+            // 
+            this.groupBox6.Controls.Add(this.radioButton_MIGIC);
+            this.groupBox6.Controls.Add(this.radioButton_HUB);
+            this.groupBox6.Controls.Add(this.radioButton_HUB_FCT);
+            this.groupBox6.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(113)))), ((int)(((byte)(185)))));
+            this.groupBox6.Location = new System.Drawing.Point(868, 463);
+            this.groupBox6.Name = "groupBox6";
+            this.groupBox6.Size = new System.Drawing.Size(149, 127);
+            this.groupBox6.TabIndex = 29;
+            this.groupBox6.TabStop = false;
+            this.groupBox6.Text = "配置类型";
             // 
             // GenerateParams
             // 
@@ -1281,6 +1321,8 @@
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
             this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(255)))), ((int)(((byte)(192)))));
             this.ClientSize = new System.Drawing.Size(1034, 761);
+            this.Controls.Add(this.groupBox6);
+            this.Controls.Add(this.checkBox_SyncFac);
             this.Controls.Add(this.button_LoadFile);
             this.Controls.Add(this.button_DeletModelFile);
             this.Controls.Add(this.label41);
@@ -1291,8 +1333,6 @@
             this.Controls.Add(this.label_BT);
             this.Controls.Add(this.label_Ver);
             this.Controls.Add(this.statusStrip1);
-            this.Controls.Add(this.radioButton_HUB);
-            this.Controls.Add(this.radioButton_MIGIC);
             this.Controls.Add(this.comboBox_ModelFile);
             this.Controls.Add(this.pictureBox2);
             this.Controls.Add(this.groupBox1);
@@ -1324,13 +1364,15 @@
             this.groupBox2.ResumeLayout(false);
             this.groupBox2.PerformLayout();
             this.tabPage_Advance.ResumeLayout(false);
+            ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
             this.tabPage_Note.ResumeLayout(false);
             this.groupBox1.ResumeLayout(false);
             this.groupBox1.PerformLayout();
             ((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).EndInit();
             this.statusStrip1.ResumeLayout(false);
             this.statusStrip1.PerformLayout();
-            ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
+            this.groupBox6.ResumeLayout(false);
+            this.groupBox6.PerformLayout();
             this.ResumeLayout(false);
             this.PerformLayout();
 
@@ -1440,5 +1482,8 @@
         private System.Windows.Forms.Button button_LoadFile;
         private System.Windows.Forms.Label label39;
         private System.Windows.Forms.PictureBox pictureBox1;
+        private System.Windows.Forms.RadioButton radioButton_HUB_FCT;
+        private System.Windows.Forms.CheckBox checkBox_SyncFac;
+        private System.Windows.Forms.GroupBox groupBox6;
     }
 }

+ 143 - 88
Welling_Motor_Debug_Tool/GenerateParams.cs

@@ -975,30 +975,34 @@ namespace Welling_Motor_Debug_Tool
         private void button_ExportParams_Click(object sender, EventArgs e)
         {
             //检查
-            if ((radioButton_MIGIC.Checked | radioButton_HUB.Checked) == false)
+            if ((radioButton_MIGIC.Checked | radioButton_HUB.Checked | radioButton_HUB_FCT.Checked) == false)
             {
                 MessageBox.Show("请选择产品类型", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                 return;
             }
-            foreach (Control c in groupBox1.Controls)
+            //不导出到本地时需填写完整订单信息
+            if (!checkBox_SyncFac.Checked)
             {
-                if (c is TextBox)
+                foreach (Control c in groupBox1.Controls)
                 {
-                    if (c.Text == "")
-                    {
-                        MessageBox.Show("信息填写不完整", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
-                        return;
-                    }
-                    if (c.Text.Contains('_'))
+                    if (c is TextBox)
                     {
-                        if ((c.Name != "textBox_ProductTag")&& (c.Name != "textBox_SoftwareVer"))
+                        if (c.Text == "")
                         {
-                            MessageBox.Show("\"" + c.Text + "\"" + "包含字符'_'", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
+                            MessageBox.Show("信息填写不完整", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                             return;
-                        }                        
+                        }
+                        if (c.Text.Contains('_'))
+                        {
+                            if ((c.Name != "textBox_ProductTag") && (c.Name != "textBox_SoftwareVer"))
+                            {
+                                MessageBox.Show("\"" + c.Text + "\"" + "包含字符'_'", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
+                                return;
+                            }
+                        }
                     }
                 }
-            }
+            }            
 
             //分割参数
             string[] lines = richTextBox_AdvanceParams.Text.Split(new string[] { "\n" }, StringSplitOptions.None);
@@ -1142,91 +1146,142 @@ namespace Welling_Motor_Debug_Tool
                 return;
             }
 
-            //确定本地保存路径
-            string Date = DateTime.Now.ToString("yyyy-MM-dd");
-            string LocalPath = localInfo.LocalPath + "\\" + localInfo.CfgPathName + "\\" + Date;
-            if (!Directory.Exists(LocalPath))
+            //不导出本地时,上传服务器
+            if (!checkBox_SyncFac.Checked)
             {
-                Directory.CreateDirectory(LocalPath);
-            }
+                //确定本地保存路径
+                string Date = DateTime.Now.ToString("yyyy-MM-dd");
+                string LocalPath = localInfo.LocalPath + "\\" + localInfo.CfgPathName + "\\" + Date;
+                if (!Directory.Exists(LocalPath))
+                {
+                    Directory.CreateDirectory(LocalPath);
+                }
 
-            //确定远程保存路径
-            string ServerPath = "";
-            if (radioButton_HUB.Checked)
-            {
-                if (!myFtp.DirectoryExist("HUB_Control_TEST/cfg", Date))
-                    myFtp.MakeDir("HUB_Control_TEST/cfg" + "/" + Date);
-                ServerPath = "HUB_Control_TEST/cfg" + "/" + Date;
-            }
-            else if (radioButton_MIGIC.Checked)
-            {
-                if (!myFtp.DirectoryExist("MIGIC_TEST/cfg", Date))
-                    myFtp.MakeDir("MIGIC_TEST/cfg" + "/" + Date);
-                ServerPath = "MIGIC_TEST/cfg" + "/" + Date;
-            }      
-            
-            //确定文件名
-            string fileName = "";
-            fileName = textBox_ProductName.Text + "_" + textBox_MarkCode.Text + "-" + textBox_CustomerName.Text + "-" +
-                       textBox_MarkNum.Text + "_" + textBox_OtherInfo.Text + "_" + textBox_SoftwareVer.Text + "_" +
-                       DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss").Replace("/", "-").Replace(":", string.Empty).Replace(" ", "-");
-
-            //保存.src文件
-            System.IO.File.WriteAllText(LocalPath + "\\" + fileName + ".src", richTextBox_AdvanceParams.Text);
-
-            //检查是否存在转换工具
-            if (!Directory.Exists(localInfo.ToolsPath + "\\" + "GenerateParamsFile"))
-            {
-                Directory.CreateDirectory(localInfo.ToolsPath + "\\" + "GenerateParamsFile");
-                myFtp.DownloadFile("Tools/GenerateParamsFile/ConsoleApp2.exe", localInfo.ToolsPath + "\\" + "GenerateParamsFile");
-                myFtp.DownloadFile("Tools/GenerateParamsFile/Newtonsoft.Json.xml", localInfo.ToolsPath + "\\" + "GenerateParamsFile");
-                myFtp.DownloadFile("Tools/GenerateParamsFile/Newtonsoft.Json.dll", localInfo.ToolsPath + "\\" + "GenerateParamsFile");
-            }
-            else
-            {
-                //程序使用最新版本
-                if (System.IO.File.Exists(localInfo.ToolsPath + "\\" + "GenerateParamsFile" + "\\" + "ConsoleApp2.exe"))
-                    System.IO.File.Delete(localInfo.ToolsPath + "\\" + "GenerateParamsFile" + "\\" + "ConsoleApp2.exe");
-                myFtp.DownloadFile("Tools/GenerateParamsFile/ConsoleApp2.exe", localInfo.ToolsPath + "\\" + "GenerateParamsFile");
-                //库文件不更新
-                if (!System.IO.File.Exists(localInfo.ToolsPath + "\\" + "GenerateParamsFile" + "\\" + "Newtonsoft.Json.xml"))
+                //确定远程保存路径
+                string ServerPath = "";
+                if (radioButton_HUB.Checked)
+                {
+                    if (!myFtp.DirectoryExist("HUB_Control_TEST/cfg", Date))
+                        myFtp.MakeDir("HUB_Control_TEST/cfg" + "/" + Date);
+                    ServerPath = "HUB_Control_TEST/cfg" + "/" + Date;
+                }
+                else if (radioButton_MIGIC.Checked)
+                {
+                    if (!myFtp.DirectoryExist("MIGIC_TEST/cfg", Date))
+                        myFtp.MakeDir("MIGIC_TEST/cfg" + "/" + Date);
+                    ServerPath = "MIGIC_TEST/cfg" + "/" + Date;
+                }
+                else if (radioButton_HUB_FCT.Checked)
+                {
+                    if (!myFtp.DirectoryExist("HUB_Control_FCT/cfg", Date))
+                        myFtp.MakeDir("HUB_Control_FCT/cfg" + "/" + Date);
+                    ServerPath = "HUB_Control_FCT/cfg" + "/" + Date;
+                }
+
+                //确定文件名
+                string fileName = "";
+                fileName = textBox_ProductName.Text + "_" + textBox_MarkCode.Text + "-" + textBox_CustomerName.Text + "-" +
+                           textBox_MarkNum.Text + "_" + textBox_OtherInfo.Text + "_" + textBox_SoftwareVer.Text + "_" +
+                           DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss").Replace("/", "-").Replace(":", string.Empty).Replace(" ", "-");
+
+                //保存.src文件
+                System.IO.File.WriteAllText(LocalPath + "\\" + fileName + ".src", richTextBox_AdvanceParams.Text);
+
+                //检查是否存在转换工具
+                if (!Directory.Exists(localInfo.ToolsPath + "\\" + "GenerateParamsFile"))
+                {
+                    Directory.CreateDirectory(localInfo.ToolsPath + "\\" + "GenerateParamsFile");
+                    myFtp.DownloadFile("Tools/GenerateParamsFile/ConsoleApp2.exe", localInfo.ToolsPath + "\\" + "GenerateParamsFile");
                     myFtp.DownloadFile("Tools/GenerateParamsFile/Newtonsoft.Json.xml", localInfo.ToolsPath + "\\" + "GenerateParamsFile");
-                if (!System.IO.File.Exists(localInfo.ToolsPath + "\\" + "GenerateParamsFile" + "\\" + "Newtonsoft.Json.dll"))
                     myFtp.DownloadFile("Tools/GenerateParamsFile/Newtonsoft.Json.dll", localInfo.ToolsPath + "\\" + "GenerateParamsFile");
-            }
-
-            //转换.ttcfg文件
-            ProcessStartInfo startInfo = new ProcessStartInfo();
-            startInfo.FileName = localInfo.ToolsPath + "\\" + "GenerateParamsFile" + "\\" + "ConsoleApp2.exe";
-            startInfo.Arguments = "\"" + LocalPath + "\\" + fileName + ".src" + "\"";
-            System.Diagnostics.Process.Start(startInfo);
-            Thread.Sleep(1000);
-
-            //保存页面
-            Double scaleX = PrimaryScreen.ScaleX;
-            Double scaleY = PrimaryScreen.ScaleY;
-            Bitmap bit = new Bitmap((int)(this.Width * scaleX), (int)(this.Height * scaleY));//实例化一个和窗体一样大的bitmap
-            Graphics g = Graphics.FromImage(bit);
-            g.CopyFromScreen((int)(this.Left * scaleX), (int)(this.Top * scaleY), 0, 0, new Size((int)(this.Width * scaleX), (int)(this.Height * scaleY)));//保存整个窗体为图片              
-            bit.Save(LocalPath + "\\" + fileName + ".png");
-
-            //生成pdf文件,上传服务器
-            //...
+                }
+                else
+                {
+                    //程序使用最新版本
+                    if (System.IO.File.Exists(localInfo.ToolsPath + "\\" + "GenerateParamsFile" + "\\" + "ConsoleApp2.exe"))
+                        System.IO.File.Delete(localInfo.ToolsPath + "\\" + "GenerateParamsFile" + "\\" + "ConsoleApp2.exe");
+                    myFtp.DownloadFile("Tools/GenerateParamsFile/ConsoleApp2.exe", localInfo.ToolsPath + "\\" + "GenerateParamsFile");
+                    //库文件不更新
+                    if (!System.IO.File.Exists(localInfo.ToolsPath + "\\" + "GenerateParamsFile" + "\\" + "Newtonsoft.Json.xml"))
+                        myFtp.DownloadFile("Tools/GenerateParamsFile/Newtonsoft.Json.xml", localInfo.ToolsPath + "\\" + "GenerateParamsFile");
+                    if (!System.IO.File.Exists(localInfo.ToolsPath + "\\" + "GenerateParamsFile" + "\\" + "Newtonsoft.Json.dll"))
+                        myFtp.DownloadFile("Tools/GenerateParamsFile/Newtonsoft.Json.dll", localInfo.ToolsPath + "\\" + "GenerateParamsFile");
+                }
 
-            //上传            
-            bool result1 = myFtp.UploadFile(LocalPath + "\\" + fileName + ".src", ServerPath);
-            bool result2 = myFtp.UploadFile(LocalPath + "\\" + fileName + ".ttcfg", ServerPath);
-            bool result3 = myFtp.UploadFile(LocalPath + "\\" + fileName + ".png", ServerPath);
-            if (result1 & result2 & result3)
-            {
-                MessageBoxTimeOut.Show("上传成功", "提示", 1000, MessageBoxButtons.OK);
+                //转换.ttcfg文件
+                ProcessStartInfo startInfo = new ProcessStartInfo();
+                startInfo.FileName = localInfo.ToolsPath + "\\" + "GenerateParamsFile" + "\\" + "ConsoleApp2.exe";
+                startInfo.Arguments = "\"" + LocalPath + "\\" + fileName + ".src" + "\"";
+                System.Diagnostics.Process.Start(startInfo);
+                Thread.Sleep(1000);
+
+                //保存页面
+                Double scaleX = PrimaryScreen.ScaleX;
+                Double scaleY = PrimaryScreen.ScaleY;
+                Bitmap bit = new Bitmap((int)(this.Width * scaleX), (int)(this.Height * scaleY));//实例化一个和窗体一样大的bitmap
+                Graphics g = Graphics.FromImage(bit);
+                g.CopyFromScreen((int)(this.Left * scaleX), (int)(this.Top * scaleY), 0, 0, new Size((int)(this.Width * scaleX), (int)(this.Height * scaleY)));//保存整个窗体为图片              
+                bit.Save(LocalPath + "\\" + fileName + ".png");
+
+                //生成pdf文件,上传服务器
+                //...
+
+                //上传            
+                bool result1 = myFtp.UploadFile(LocalPath + "\\" + fileName + ".src", ServerPath);
+                bool result2 = myFtp.UploadFile(LocalPath + "\\" + fileName + ".ttcfg", ServerPath);
+                bool result3 = myFtp.UploadFile(LocalPath + "\\" + fileName + ".png", ServerPath);
+                if (result1 & result2 & result3)
+                {
+                    MessageBoxTimeOut.Show("上传成功", "提示", 1000, MessageBoxButtons.OK);
+                }
+                else
+                {
+                    MessageBox.Show("上传失败", "提示", MessageBoxButtons.OK);
+                }
             }
+            //导出本地指定路径
             else
             {
-                MessageBox.Show("上传失败", "提示", MessageBoxButtons.OK);
+                SaveFileDialog saveFileDialog = new SaveFileDialog();
+                saveFileDialog.Filter = "配置文件(*.ttcfg)|*.ttcfg";
+                DialogResult result = saveFileDialog.ShowDialog();
+                if (result == DialogResult.OK)
+                {
+                    string filePath = saveFileDialog.FileName + "_" + DateTime.Now.ToString("yyyyMMddHHmmss");
+                    //保存src文件
+                    System.IO.File.WriteAllText(filePath + ".src", richTextBox_AdvanceParams.Text);                    
+                    //检查是否存在转换工具
+                    if (!Directory.Exists(localInfo.ToolsPath + "\\" + "GenerateParamsFile"))
+                    {
+                        Directory.CreateDirectory(localInfo.ToolsPath + "\\" + "GenerateParamsFile");
+                        myFtp.DownloadFile("Tools/GenerateParamsFile/ConsoleApp2.exe", localInfo.ToolsPath + "\\" + "GenerateParamsFile");
+                        myFtp.DownloadFile("Tools/GenerateParamsFile/Newtonsoft.Json.xml", localInfo.ToolsPath + "\\" + "GenerateParamsFile");
+                        myFtp.DownloadFile("Tools/GenerateParamsFile/Newtonsoft.Json.dll", localInfo.ToolsPath + "\\" + "GenerateParamsFile");
+                    }
+                    else
+                    {
+                        //程序使用最新版本
+                        if (System.IO.File.Exists(localInfo.ToolsPath + "\\" + "GenerateParamsFile" + "\\" + "ConsoleApp2.exe"))
+                            System.IO.File.Delete(localInfo.ToolsPath + "\\" + "GenerateParamsFile" + "\\" + "ConsoleApp2.exe");
+                        myFtp.DownloadFile("Tools/GenerateParamsFile/ConsoleApp2.exe", localInfo.ToolsPath + "\\" + "GenerateParamsFile");
+                        //库文件不更新
+                        if (!System.IO.File.Exists(localInfo.ToolsPath + "\\" + "GenerateParamsFile" + "\\" + "Newtonsoft.Json.xml"))
+                            myFtp.DownloadFile("Tools/GenerateParamsFile/Newtonsoft.Json.xml", localInfo.ToolsPath + "\\" + "GenerateParamsFile");
+                        if (!System.IO.File.Exists(localInfo.ToolsPath + "\\" + "GenerateParamsFile" + "\\" + "Newtonsoft.Json.dll"))
+                            myFtp.DownloadFile("Tools/GenerateParamsFile/Newtonsoft.Json.dll", localInfo.ToolsPath + "\\" + "GenerateParamsFile");
+                    }
+                    //转换.ttcfg文件
+                    ProcessStartInfo startInfo = new ProcessStartInfo();
+                    startInfo.FileName = localInfo.ToolsPath + "\\" + "GenerateParamsFile" + "\\" + "ConsoleApp2.exe";
+                    startInfo.Arguments = filePath + ".src";
+                    System.Diagnostics.Process.Start(startInfo);
+                    Thread.Sleep(1000);
+
+                    MessageBoxTimeOut.Show("导出本地完成", "提示", 1000, MessageBoxButtons.OK);
+                }
+
             }
 
-           
         }
 
     }

+ 15 - 10
Welling_Motor_Debug_Tool/Scan.Designer.cs

@@ -40,29 +40,34 @@
             // label1
             // 
             this.label1.AutoSize = true;
-            this.label1.Location = new System.Drawing.Point(23, 32);
+            this.label1.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.label1.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(113)))), ((int)(((byte)(185)))));
+            this.label1.Location = new System.Drawing.Point(11, 23);
             this.label1.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
             this.label1.Name = "label1";
-            this.label1.Size = new System.Drawing.Size(88, 25);
+            this.label1.Size = new System.Drawing.Size(74, 21);
             this.label1.TabIndex = 0;
-            this.label1.Text = "请入:";
+            this.label1.Text = "请入:";
             // 
             // textBox_Scan
             // 
             this.textBox_Scan.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(192)))));
-            this.textBox_Scan.Location = new System.Drawing.Point(28, 63);
+            this.textBox_Scan.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(113)))), ((int)(((byte)(185)))));
+            this.textBox_Scan.Location = new System.Drawing.Point(15, 63);
             this.textBox_Scan.Margin = new System.Windows.Forms.Padding(6);
             this.textBox_Scan.Name = "textBox_Scan";
-            this.textBox_Scan.Size = new System.Drawing.Size(449, 33);
+            this.textBox_Scan.Size = new System.Drawing.Size(462, 33);
             this.textBox_Scan.TabIndex = 1;
             // 
             // button_Enter
             // 
-            this.button_Enter.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(192)))), ((int)(((byte)(128)))));
-            this.button_Enter.Location = new System.Drawing.Point(486, 63);
+            this.button_Enter.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(113)))), ((int)(((byte)(185)))));
+            this.button_Enter.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.button_Enter.ForeColor = System.Drawing.Color.White;
+            this.button_Enter.Location = new System.Drawing.Point(486, 60);
             this.button_Enter.Margin = new System.Windows.Forms.Padding(6);
             this.button_Enter.Name = "button_Enter";
-            this.button_Enter.Size = new System.Drawing.Size(80, 33);
+            this.button_Enter.Size = new System.Drawing.Size(80, 38);
             this.button_Enter.TabIndex = 2;
             this.button_Enter.Text = "确认";
             this.button_Enter.UseVisualStyleBackColor = false;
@@ -73,7 +78,7 @@
             this.button_keyboard.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(113)))), ((int)(((byte)(185)))));
             this.button_keyboard.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
             this.button_keyboard.ForeColor = System.Drawing.Color.White;
-            this.button_keyboard.Location = new System.Drawing.Point(28, 106);
+            this.button_keyboard.Location = new System.Drawing.Point(15, 105);
             this.button_keyboard.Name = "button_keyboard";
             this.button_keyboard.Size = new System.Drawing.Size(91, 43);
             this.button_keyboard.TabIndex = 43;
@@ -109,7 +114,7 @@
             this.MaximizeBox = false;
             this.Name = "Scan";
             this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
-            this.Text = "入";
+            this.Text = "入";
             this.Load += new System.EventHandler(this.Scan_Load);
             ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
             this.ResumeLayout(false);

+ 1 - 1
Welling_Motor_Debug_Tool/Version.Designer.cs

@@ -90,7 +90,7 @@
             // richTextBox_Log
             // 
             this.richTextBox_Log.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(224)))), ((int)(((byte)(224)))), ((int)(((byte)(224)))));
-            this.richTextBox_Log.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.richTextBox_Log.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
             this.richTextBox_Log.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(113)))), ((int)(((byte)(185)))));
             this.richTextBox_Log.Location = new System.Drawing.Point(14, 81);
             this.richTextBox_Log.Name = "richTextBox_Log";

+ 15 - 10
Welling_Motor_Debug_Tool/Version.cs

@@ -15,11 +15,17 @@ namespace Welling_Motor_Debug_Tool
     public partial class Version : Form
     {
         //修改记录
-        string ChangeLog = "修改记录:\r\n" + 
-            "V2.1.6\r\n" +
-            "1,修改控制器内阻校准指令,增加写入存储标志;\r\n" +
-            "2,参数生成界面增加导入样机测试记录的文件功能;\r\n" +
-            "3,参数生成界面增加锁,防止误触。\r\n\r\n" +
+        string ChangeLog = "修改记录:\r\n" +
+            "V" + mainForm.Version + "\r\n" +
+            "1,增加整车信息2、用户骑行参数界面,支持上位机读写;\r\n" +
+            "2,增加车架ODO里程写入和读取;\r\n" +
+            "3,增加产品标签写入,支持32位字符;\r\n" +
+            "4,生成参数界面可选择HUB_FCT,支持仅导出到本地;\r\n" +
+            "5,FCT治具测试账户登录后,测试路径自动改为HUB_FCT_Test;\r\n" +
+            "6,增加删除指定配置文件和样机测试记录文件,支持文件夹递归删除。\r\n\r\n" +
+            "V2.1.8\r\n" +
+            "1,限制FCT治具测试账户需要联网使用;\r\n" +
+            "2,量产测试和检验模式下,双击配置文件可删除选中的配置文件。\r\n\r\n" +
             "V2.1.7\r\n" +
             "1,解决系统显示缩放后,截图显示不完全的问题;\r\n" +
             "2,允许离线使用是关闭网络定时检测;\r\n" +
@@ -28,11 +34,10 @@ namespace Welling_Motor_Debug_Tool
             "5,部分提示框修改为自动关闭;\r\n" +
             "6,增加读取本机信息功能;\r\n" +
             "7,启动时自动上传登录日志,包含本机信息。\r\n\r\n" +
-            "V2.1.8\r\n" +
-            "1,限制FCT治具测试账户需要联网使用;\r\n" +
-            "2,量产测试和检验模式下,双击配置文件可删除选中的配置文件。\r\n\r\n" +
-            "V" + mainForm.Version + "\r\n" +
-            "\r\n"
+            "V2.1.6\r\n" +
+            "1,修改控制器内阻校准指令,增加写入存储标志;\r\n" +
+            "2,参数生成界面增加导入样机测试记录的文件功能;\r\n" +
+            "3,参数生成界面增加锁,防止误触。\r\n"
             ;
 
         //存储路径文件

BIN=BIN
Welling_Motor_Debug_Tool/bin/Debug/Welling_Motor_Debug_Tool_V2.1.8.exe


BIN=BIN
Welling_Motor_Debug_Tool/bin/Debug/Welling_Motor_Debug_Tool_V2.1.9.exe


+ 41 - 1
Welling_Motor_Debug_Tool/ftp.cs

@@ -193,7 +193,7 @@ namespace Welling_Motor_Debug_Tool
         }
 
         /// <summary>
-        /// 删除文件夹
+        /// 删除文件夹,只能删除空文件夹
         /// </summary>
         /// <param name="folderName"></param>
         public void RemoveDirectory(string folderName)
@@ -201,6 +201,7 @@ namespace Welling_Motor_Debug_Tool
             try
             {
                 Uri uri = new Uri("ftp://" + serverIP + ":" + serverPort + "/" + folderName);
+
                 FtpWebRequest reqFTP;
                 reqFTP = (FtpWebRequest)FtpWebRequest.Create(uri);
 
@@ -225,6 +226,45 @@ namespace Welling_Motor_Debug_Tool
             }
         }
 
+        /// <summary>
+        /// 删除目录下面的内容
+        /// </summary>
+        /// <param name="folderName"></param>
+        public void DelDirectoryWithAll(string folderName)
+        {
+            try
+            {                
+                //获取文件列表
+                string[] fileList = GetFileNameList(folderName);
+                //先删除所有文件
+                if (fileList != null && fileList.Length > 0)
+                {
+                    foreach (string file in fileList)
+                    {
+                        DeleteFile(folderName + "/" + file);
+                    }
+                }
+                //获取文件夹
+                string[] pathList = GetDirectoryList(folderName);
+                foreach (string path in pathList)
+                {
+                    if (string.IsNullOrWhiteSpace(path))
+                        continue;
+                    //子目录存在目录递归
+                    if (GetFilesDetailList(folderName + "/" + path) != null && GetFilesDetailList(folderName + "/" + path).Length > 0)
+                    {
+                        DelDirectoryWithAll(folderName + "/" + path);
+                    }
+                    //删除该级目录
+                    RemoveDirectory(folderName + "/" + path);
+                }
+            }
+            catch (Exception ex)
+            {
+                throw new Exception("文件夹删除失败!" + ex.Message);
+            }
+        }
+
         /// <summary>
         /// 获取当前目录下明细(包含文件和文件夹)
         /// </summary>

+ 41 - 41
Welling_Motor_Debug_Tool/mainForm.Designer.cs

@@ -96,17 +96,19 @@ namespace Welling_Motor_Debug_Tool
             this.电机温度ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
             this.toolStripTextBox_ThT_Motor = new System.Windows.Forms.ToolStripTextBox();
             this.力矩传感器检验ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
-            this.uART协议ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+            this.UART协议ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
             this.协议类型ToolStripMenuItem = new System.Windows.Forms.ToolStripComboBox();
             this.工具箱ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
             this.运行信息记录ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
             this.计算器ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
             this.页面保存ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
             this.屏幕键盘ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
-            this.指令调试ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
             this.删除远程文件ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
             this.生产配置文件ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+            this.toolStripTextBox_DelCfgFile = new System.Windows.Forms.ToolStripComboBox();
             this.样机测试记录ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+            this.toolStripTextBox_DelLogFile = new System.Windows.Forms.ToolStripComboBox();
+            this.指令调试ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
             this.查询ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
             this.调试记录数据ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
             this.生产记录数据ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
@@ -587,8 +589,6 @@ namespace Welling_Motor_Debug_Tool
             this.label_UserName = new System.Windows.Forms.Label();
             this.label124 = new System.Windows.Forms.Label();
             this.label46 = new System.Windows.Forms.Label();
-            this.toolStripTextBox_DelCfgFile = new System.Windows.Forms.ToolStripComboBox();
-            this.toolStripTextBox_DelLogFile = new System.Windows.Forms.ToolStripComboBox();
             this.menuStrip_Set.SuspendLayout();
             this.statusStrip1.SuspendLayout();
             this.groupBox1.SuspendLayout();
@@ -812,7 +812,7 @@ namespace Welling_Motor_Debug_Tool
             this.电机类型ToolStripMenuItem,
             this.判断阈值ToolStripMenuItem,
             this.力矩传感器检验ToolStripMenuItem,
-            this.uART协议ToolStripMenuItem});
+            this.UART协议ToolStripMenuItem});
             this.配置ToolStripMenuItem.ForeColor = System.Drawing.Color.White;
             this.配置ToolStripMenuItem.Name = "配置ToolStripMenuItem";
             this.配置ToolStripMenuItem.Size = new System.Drawing.Size(54, 25);
@@ -1211,13 +1211,13 @@ namespace Welling_Motor_Debug_Tool
             this.力矩传感器检验ToolStripMenuItem.Text = "力矩检验参数";
             this.力矩传感器检验ToolStripMenuItem.Click += new System.EventHandler(this.力矩传感器检验ToolStripMenuItem_Click);
             // 
-            // uART协议ToolStripMenuItem
+            // UART协议ToolStripMenuItem
             // 
-            this.uART协议ToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
+            this.UART协议ToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
             this.协议类型ToolStripMenuItem});
-            this.uART协议ToolStripMenuItem.Name = "uART协议ToolStripMenuItem";
-            this.uART协议ToolStripMenuItem.Size = new System.Drawing.Size(192, 26);
-            this.uART协议ToolStripMenuItem.Text = "UART协议设置";
+            this.UART协议ToolStripMenuItem.Name = "UART协议ToolStripMenuItem";
+            this.UART协议ToolStripMenuItem.Size = new System.Drawing.Size(192, 26);
+            this.UART协议ToolStripMenuItem.Text = "UART协议设置";
             // 
             // 协议类型ToolStripMenuItem
             // 
@@ -1250,45 +1250,38 @@ namespace Welling_Motor_Debug_Tool
             // 运行信息记录ToolStripMenuItem
             // 
             this.运行信息记录ToolStripMenuItem.Name = "运行信息记录ToolStripMenuItem";
-            this.运行信息记录ToolStripMenuItem.Size = new System.Drawing.Size(180, 26);
+            this.运行信息记录ToolStripMenuItem.Size = new System.Drawing.Size(176, 26);
             this.运行信息记录ToolStripMenuItem.Text = "自动记录";
             this.运行信息记录ToolStripMenuItem.Click += new System.EventHandler(this.记录数据ToolStripMenuItem_Click);
             // 
             // 计算器ToolStripMenuItem
             // 
             this.计算器ToolStripMenuItem.Name = "计算器ToolStripMenuItem";
-            this.计算器ToolStripMenuItem.Size = new System.Drawing.Size(180, 26);
+            this.计算器ToolStripMenuItem.Size = new System.Drawing.Size(176, 26);
             this.计算器ToolStripMenuItem.Text = "计算器";
             this.计算器ToolStripMenuItem.Click += new System.EventHandler(this.计算器ToolStripMenuItem_Click);
             // 
             // 页面保存ToolStripMenuItem
             // 
             this.页面保存ToolStripMenuItem.Name = "页面保存ToolStripMenuItem";
-            this.页面保存ToolStripMenuItem.Size = new System.Drawing.Size(180, 26);
+            this.页面保存ToolStripMenuItem.Size = new System.Drawing.Size(176, 26);
             this.页面保存ToolStripMenuItem.Text = "页面保存";
             this.页面保存ToolStripMenuItem.Click += new System.EventHandler(this.页面保存ToolStripMenuItem_Click);
             // 
             // 屏幕键盘ToolStripMenuItem
             // 
             this.屏幕键盘ToolStripMenuItem.Name = "屏幕键盘ToolStripMenuItem";
-            this.屏幕键盘ToolStripMenuItem.Size = new System.Drawing.Size(180, 26);
+            this.屏幕键盘ToolStripMenuItem.Size = new System.Drawing.Size(176, 26);
             this.屏幕键盘ToolStripMenuItem.Text = "屏幕键盘";
             this.屏幕键盘ToolStripMenuItem.Click += new System.EventHandler(this.屏幕键盘ToolStripMenuItem_Click);
             // 
-            // 指令调试ToolStripMenuItem
-            // 
-            this.指令调试ToolStripMenuItem.Enabled = false;
-            this.指令调试ToolStripMenuItem.Name = "指令调试ToolStripMenuItem";
-            this.指令调试ToolStripMenuItem.Size = new System.Drawing.Size(180, 26);
-            this.指令调试ToolStripMenuItem.Text = "指令调试";
-            // 
             // 删除远程文件ToolStripMenuItem
             // 
             this.删除远程文件ToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
             this.生产配置文件ToolStripMenuItem,
             this.样机测试记录ToolStripMenuItem});
             this.删除远程文件ToolStripMenuItem.Name = "删除远程文件ToolStripMenuItem";
-            this.删除远程文件ToolStripMenuItem.Size = new System.Drawing.Size(180, 26);
+            this.删除远程文件ToolStripMenuItem.Size = new System.Drawing.Size(176, 26);
             this.删除远程文件ToolStripMenuItem.Text = "删除远程文件";
             // 
             // 生产配置文件ToolStripMenuItem
@@ -1296,17 +1289,40 @@ namespace Welling_Motor_Debug_Tool
             this.生产配置文件ToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
             this.toolStripTextBox_DelCfgFile});
             this.生产配置文件ToolStripMenuItem.Name = "生产配置文件ToolStripMenuItem";
-            this.生产配置文件ToolStripMenuItem.Size = new System.Drawing.Size(180, 26);
+            this.生产配置文件ToolStripMenuItem.Size = new System.Drawing.Size(176, 26);
             this.生产配置文件ToolStripMenuItem.Text = "生产配置文件";
             // 
+            // toolStripTextBox_DelCfgFile
+            // 
+            this.toolStripTextBox_DelCfgFile.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
+            this.toolStripTextBox_DelCfgFile.Name = "toolStripTextBox_DelCfgFile";
+            this.toolStripTextBox_DelCfgFile.Size = new System.Drawing.Size(100, 25);
+            this.toolStripTextBox_DelCfgFile.SelectedIndexChanged += new System.EventHandler(this.toolStripTextBox_DelCfgFile_SelectedIndexChanged);
+            this.toolStripTextBox_DelCfgFile.Click += new System.EventHandler(this.toolStripTextBox_DelCfgFile_Click);
+            // 
             // 样机测试记录ToolStripMenuItem
             // 
             this.样机测试记录ToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
             this.toolStripTextBox_DelLogFile});
             this.样机测试记录ToolStripMenuItem.Name = "样机测试记录ToolStripMenuItem";
-            this.样机测试记录ToolStripMenuItem.Size = new System.Drawing.Size(180, 26);
+            this.样机测试记录ToolStripMenuItem.Size = new System.Drawing.Size(176, 26);
             this.样机测试记录ToolStripMenuItem.Text = "样机测试记录";
             // 
+            // toolStripTextBox_DelLogFile
+            // 
+            this.toolStripTextBox_DelLogFile.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
+            this.toolStripTextBox_DelLogFile.Name = "toolStripTextBox_DelLogFile";
+            this.toolStripTextBox_DelLogFile.Size = new System.Drawing.Size(100, 25);
+            this.toolStripTextBox_DelLogFile.SelectedIndexChanged += new System.EventHandler(this.toolStripTextBox_DelLogFile_SelectedIndexChanged);
+            this.toolStripTextBox_DelLogFile.Click += new System.EventHandler(this.toolStripTextBox_DelLogFile_Click);
+            // 
+            // 指令调试ToolStripMenuItem
+            // 
+            this.指令调试ToolStripMenuItem.Enabled = false;
+            this.指令调试ToolStripMenuItem.Name = "指令调试ToolStripMenuItem";
+            this.指令调试ToolStripMenuItem.Size = new System.Drawing.Size(176, 26);
+            this.指令调试ToolStripMenuItem.Text = "指令调试";
+            // 
             // 查询ToolStripMenuItem
             // 
             this.查询ToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
@@ -6663,22 +6679,6 @@ namespace Welling_Motor_Debug_Tool
             this.label46.TabIndex = 21;
             this.label46.Text = "/";
             // 
-            // toolStripTextBox_DelCfgFile
-            // 
-            this.toolStripTextBox_DelCfgFile.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
-            this.toolStripTextBox_DelCfgFile.Name = "toolStripTextBox_DelCfgFile";
-            this.toolStripTextBox_DelCfgFile.Size = new System.Drawing.Size(100, 25);
-            this.toolStripTextBox_DelCfgFile.SelectedIndexChanged += new System.EventHandler(this.toolStripTextBox_DelCfgFile_SelectedIndexChanged);
-            this.toolStripTextBox_DelCfgFile.Click += new System.EventHandler(this.toolStripTextBox_DelCfgFile_Click);
-            // 
-            // toolStripTextBox_DelLogFile
-            // 
-            this.toolStripTextBox_DelLogFile.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
-            this.toolStripTextBox_DelLogFile.Name = "toolStripTextBox_DelLogFile";
-            this.toolStripTextBox_DelLogFile.Size = new System.Drawing.Size(100, 25);
-            this.toolStripTextBox_DelLogFile.SelectedIndexChanged += new System.EventHandler(this.toolStripTextBox_DelLogFile_SelectedIndexChanged);
-            this.toolStripTextBox_DelLogFile.Click += new System.EventHandler(this.toolStripTextBox_DelLogFile_Click);
-            // 
             // mainForm
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(10F, 21F);
@@ -7340,7 +7340,7 @@ namespace Welling_Motor_Debug_Tool
         private Button button_MOS_Cal;
         private Label label79;
         private Label label78;
-        private ToolStripMenuItem uART协议ToolStripMenuItem;
+        private ToolStripMenuItem UART协议ToolStripMenuItem;
         private ToolStripComboBox 协议类型ToolStripMenuItem;
         private ToolStripMenuItem 本机信息ToolStripMenuItem;
         private Label label_UserName;

+ 27 - 29
Welling_Motor_Debug_Tool/mainForm.cs

@@ -433,6 +433,7 @@ namespace Welling_Motor_Debug_Tool
                             电机类型ToolStripMenuItem.Visible = true;
                             中置电机ToolStripMenuItem.Enabled = false;
                             轮毂电机ToolStripMenuItem.Enabled = false;
+                            UART协议ToolStripMenuItem.Visible = false;
                             //隐藏研发调试界面
                             tabPage_MotorParam.Parent = null;
                             tabPage_BikeParam.Parent = null;
@@ -513,6 +514,7 @@ namespace Welling_Motor_Debug_Tool
                             //显示生产信息
                             生产信息ToolStripMenuItem.Visible = true;
                             //显示电机类型,但不可编辑
+                            UART协议ToolStripMenuItem.Visible = true;
                             电机类型ToolStripMenuItem.Visible = true;
                             中置电机ToolStripMenuItem.Enabled = true;
                             轮毂电机ToolStripMenuItem.Enabled = true;
@@ -548,9 +550,10 @@ namespace Welling_Motor_Debug_Tool
                             //显示生产信息
                             生产信息ToolStripMenuItem.Visible = true;
                             //显示电机类型,但不可编辑
-                            电机类型ToolStripMenuItem.Visible = true;
-                            中置电机ToolStripMenuItem.Enabled = true;
-                            轮毂电机ToolStripMenuItem.Enabled = true;
+                            UART协议ToolStripMenuItem.Visible = false;
+                            电机类型ToolStripMenuItem.Visible = false;
+                            中置电机ToolStripMenuItem.Enabled = false;
+                            轮毂电机ToolStripMenuItem.Enabled = false;
                             //隐藏研发调试界面
                             tabPage_MotorParam.Parent = null;
                             tabPage_BikeParam.Parent = null;
@@ -568,23 +571,12 @@ namespace Welling_Motor_Debug_Tool
                             tabPage_DebugInfo.Parent = null;
                             //显示运行信息
                             tabPage_RunInfo.Parent = tabControl2;
-                            //根据电机类型修改生产信息和电机类型
-                            if (EnterForm1.comboBox_User.Text.Contains("中置"))
-                            {
-                                中置电机ToolStripMenuItem.Checked = true;
-                                轮毂电机ToolStripMenuItem.Checked = false;
-                                toolStripTextBox_MACPD.Text = "MM_MC1";
-                                toolStripTextBox_ServerPath.Text = "MIGIC_TEST";
-                                ConfigFileSave(false, localInfo.LocalPath + localInfo.ConfigFileName);
-                            }
-                            else if (EnterForm1.comboBox_User.Text.Contains("轮毂"))
-                            {
-                                中置电机ToolStripMenuItem.Checked = false;
-                                轮毂电机ToolStripMenuItem.Checked = true;
-                                toolStripTextBox_MACPD.Text = "GF_250_1";
-                                toolStripTextBox_ServerPath.Text = "HUB_Control_TEST";
-                                ConfigFileSave(false, localInfo.LocalPath + localInfo.ConfigFileName);
-                            }
+                            //目前仅轮毂使用   
+                            中置电机ToolStripMenuItem.Checked = false;
+                            轮毂电机ToolStripMenuItem.Checked = true;
+                            toolStripTextBox_MACPD.Text = "GF_250_1";
+                            toolStripTextBox_ServerPath.Text = "HUB_Control_FCT";
+                            ConfigFileSave(false, localInfo.LocalPath + localInfo.ConfigFileName);
                             //显示量产测试界面
                             tabPage_ProductMode_Write.Parent = tabControl1;
                             tabPage_ProductMode_Write.Select();
@@ -5822,6 +5814,8 @@ namespace Welling_Motor_Debug_Tool
             if (!mySerialProcess.mySerial.IsOpen)
             {
                 MessageBox.Show("请检查串口连接!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
+                //按钮禁止操作
+                button__FacMode_Start.Enabled = true;
                 return;
             }
 
@@ -8309,11 +8303,11 @@ namespace Welling_Motor_Debug_Tool
 
             toolStripTextBox_DelCfgFile.Items.Clear();
 
-            //日期列表加载,显示最近30
+            //日期列表加载,显示最近30
             if (DateList.Length > 30)
             {
-                toolStripTextBox_DelCfgFile.Items.Add("30天以前文件无法删除");                
-                toolStripTextBox_DelCfgFile.Items.Add("---");                
+                toolStripTextBox_DelCfgFile.Items.Add("支持最近30条");                
+                toolStripTextBox_DelCfgFile.Items.Add("-----");                
             }
             for (int i = (DateList.Length > 30) ? (DateList.Length - 30) : 0; i < DateList.Length; i++)//显示最近30个日期
             {
@@ -8353,9 +8347,11 @@ namespace Welling_Motor_Debug_Tool
                             {
                                 try
                                 {
-                                    myFtp.DeleteFile(toolStripTextBox_ServerPath.Text + "\\" + localInfo.CfgPathName + "\\" + toolStripTextBox_DelCfgFile.Text + "\\" + DelFile);
-                                    myFtp.DeleteFile(toolStripTextBox_ServerPath.Text + "\\" + localInfo.CfgPathName + "\\" + toolStripTextBox_DelCfgFile.Text + "\\" + Path.GetFileNameWithoutExtension(DelFile) + ".src");
-                                    myFtp.DeleteFile(toolStripTextBox_ServerPath.Text + "\\" + localInfo.CfgPathName + "\\" + toolStripTextBox_DelCfgFile.Text + "\\" + Path.GetFileNameWithoutExtension(DelFile) + ".png");
+                                    if (DelFile.Contains("."))
+                                        DelFile = Path.GetFileNameWithoutExtension(DelFile);
+                                    myFtp.DeleteFile(toolStripTextBox_ServerPath.Text + "\\" + localInfo.CfgPathName + "\\" + toolStripTextBox_DelCfgFile.Text + "\\" + DelFile + ".ttcfg");
+                                    myFtp.DeleteFile(toolStripTextBox_ServerPath.Text + "\\" + localInfo.CfgPathName + "\\" + toolStripTextBox_DelCfgFile.Text + "\\" + DelFile + ".src");
+                                    myFtp.DeleteFile(toolStripTextBox_ServerPath.Text + "\\" + localInfo.CfgPathName + "\\" + toolStripTextBox_DelCfgFile.Text + "\\" + DelFile + ".png");
                                     MessageBoxTimeOut.Show("删除成功", "提示", 1000, MessageBoxButtons.OK, MessageBoxIcon.Information);
                                 }
                                 catch (Exception)
@@ -8398,8 +8394,8 @@ namespace Welling_Motor_Debug_Tool
             //日期列表加载,显示最近30天
             if (DateList.Length > 30)
             {
-                toolStripTextBox_DelLogFile.Items.Add("30天以前文件无法删除");
-                toolStripTextBox_DelLogFile.Items.Add("---");
+                toolStripTextBox_DelLogFile.Items.Add("支持最近30条");
+                toolStripTextBox_DelLogFile.Items.Add("-----");
             }
             for (int i = (DateList.Length > 30) ? (DateList.Length - 30) : 0; i < DateList.Length; i++)//显示最近30个日期
             {
@@ -8439,7 +8435,9 @@ namespace Welling_Motor_Debug_Tool
                             {
                                 try
                                 {
-                                    myFtp.RemoveDirectory(toolStripTextBox_ServerPath.Text + "\\" + localInfo.SampleFileName + "\\" + toolStripTextBox_DelLogFile.Text + "\\" + DelFile);                                    
+                                    //删除指定目录下面所有文件和文件夹
+                                    myFtp.DelDirectoryWithAll(toolStripTextBox_ServerPath.Text + "\\" + localInfo.SampleFileName + "\\" + toolStripTextBox_DelLogFile.Text + "\\" + DelFile);
+                                    myFtp.RemoveDirectory(toolStripTextBox_ServerPath.Text + "\\" + localInfo.SampleFileName + "\\" + toolStripTextBox_DelLogFile.Text + "\\" + DelFile);
                                     MessageBoxTimeOut.Show("删除成功", "提示", 1000, MessageBoxButtons.OK, MessageBoxIcon.Information);
                                 }
                                 catch (Exception)

BIN=BIN
Welling_Motor_Debug_Tool/obj/Debug/Welling_Motor_Debug_Tool.csproj.GenerateResource.cache


BIN=BIN
Welling_Motor_Debug_Tool/obj/Debug/Welling_Motor_Debug_Tool.exe


BIN=BIN
Welling_Motor_Debug_Tool/obj/Debug/Welling_Motor_Debug_Tool.pdb