Browse Source

Merge branch 'OTSRelease3_0' of http://36.129.163.148:30080/gogsadmin/OTS into OTSRelease3_0

gsp 1 year ago
parent
commit
3d6faeea57

+ 2 - 2
Bin/x64/Debug/Resources/XMLData/ResourceForSTDManage-ZH.xml

@@ -1,9 +1,9 @@
 <?xml version="1.0" encoding="utf-8" ?>
 <Resource>
   <Form>
-    <Name>Form_ConstantsEditor2</Name>
+    <Name>Form_Main</Name>
     <Controls>
-	  <Control name="Form_ConstantsEditor2" text="标准库编辑器"/>
+	  <Control name="Form_Main" text="标准库编辑器"/>
       <Control name="ribbon_ESDMaxRules" text="最大EDS规则"/>
       <Control name="ribbon_ZeroRules" text="零元素规则"/>
       <Control name="ribbon_UserConstants" text="用户常量库"/>

+ 52 - 0
OTSIncAReportApp/1-UI/OTSReportExport/OTSReport_Template_CleannessA.cs

@@ -10,6 +10,7 @@ using System.Collections;
 using System.Collections.Generic;
 using System.Data;
 using System.Drawing;
+using System.IO;
 using System.Windows.Forms;
 
 namespace OTSIncAReportApp.OTSTemplateDesigner
@@ -619,6 +620,13 @@ namespace OTSIncAReportApp.OTSTemplateDesigner
                         Bitmap bitmap = (Bitmap)Image.FromFile(filePath).Clone();
                         pictureBox7.Image.Dispose();
                         pictureBox7.Image = (Image)bitmap.Clone();
+
+                        if (!IsPathWithinDirectory(filePath, System.IO.Directory.GetCurrentDirectory() + "\\Config\\ReportTemplate"))
+                        {
+                            //Console.WriteLine("图片路径在指定的文件夹内。");
+                            CopyPicture(filePath, System.IO.Directory.GetCurrentDirectory() + "\\Config\\ReportTemplate\\");
+                        }
+                        //CopyPicture(filePath, System.IO.Directory.GetCurrentDirectory() + "\\Config\\ReportTemplate\\");
                     }
                     catch
                     {
@@ -628,6 +636,50 @@ namespace OTSIncAReportApp.OTSTemplateDesigner
             }
         }
 
+
+        /// <summary>
+        /// 复制图片指定路径
+        /// </summary>
+        /// <param name="sourceImagePath">源图片路径</param>
+        /// <param name="targetFolderPath">目标文件夹路径(确保文件夹存在,否则需要创建它)</param>
+        private void CopyPicture(string sourceImagePath, string targetFolderPath)
+        {
+
+            // 构造目标图片路径(如果图片名要改变,可以在这里指定新的名字)  
+            string targetImagePath = Path.Combine(targetFolderPath, Path.GetFileName(sourceImagePath));
+
+            // 确保目标文件夹存在  
+            if (!Directory.Exists(targetFolderPath))
+            {
+                Directory.CreateDirectory(targetFolderPath);
+            }
+
+            // 复制图片到目标路径  
+            try
+            {
+                File.Copy(sourceImagePath, targetImagePath, true); // 第三个参数为true表示如果目标文件已存在,则覆盖它  
+            }
+            catch (Exception ex)
+            {
+                MessageBox.Show("图片复制失败:" + ex.Message);
+            }
+        }
+
+        public static bool IsPathWithinDirectory(string filePath, string directoryPath)
+        {
+            // 确保directoryPath以目录分隔符结尾  
+            if (!directoryPath.EndsWith(Path.DirectorySeparatorChar.ToString()))
+            {
+                directoryPath += Path.DirectorySeparatorChar;
+            }
+
+            // 使用Path.GetFullPath来规范化路径,这样可以处理相对路径和当前目录等  
+            string fullPath = Path.GetFullPath(filePath);
+            string fullDirectoryPath = Path.GetFullPath(directoryPath);
+
+            // 判断fullPath是否以fullDirectoryPath为前缀  
+            return fullPath.StartsWith(fullDirectoryPath, StringComparison.OrdinalIgnoreCase);
+        }
         private void ParticleList_3_Click(object sender, EventArgs e)
         {
 

+ 57 - 0
OTSIncAReportApp/1-UI/OTSReportExport/OTSReport_Template_INCA.cs

@@ -10,6 +10,7 @@ using System.Collections;
 using System.Collections.Generic;
 using System.Data;
 using System.Drawing;
+using System.IO;
 using System.Windows.Forms;
 
 namespace OTSIncAReportApp.OTSTemplateDesigner
@@ -684,6 +685,19 @@ namespace OTSIncAReportApp.OTSTemplateDesigner
                         Bitmap bitmap = (Bitmap)Image.FromFile(filePath).Clone();
                         pictureBox7.Image.Dispose();
                         pictureBox7.Image = (Image)bitmap.Clone();
+
+                        if (!IsPathWithinDirectory(filePath, System.IO.Directory.GetCurrentDirectory() + "\\Config\\ReportTemplate"))
+                        {
+                            //Console.WriteLine("图片路径在指定的文件夹内。");
+                            CopyPicture(filePath, System.IO.Directory.GetCurrentDirectory() + "\\Config\\ReportTemplate\\");
+                        }
+                        //else
+                        //{
+                        //    Console.WriteLine("图片路径不在指定的文件夹内。");
+                        //}
+
+
+                        //CopyPicture(filePath, System.IO.Directory.GetCurrentDirectory() + "\\Config\\ReportTemplate\\");
                     }
                     catch
                     {
@@ -692,6 +706,49 @@ namespace OTSIncAReportApp.OTSTemplateDesigner
                 }
             }
         }
+        /// <summary>
+        /// 复制图片指定路径
+        /// </summary>
+        /// <param name="sourceImagePath">源图片路径</param>
+        /// <param name="targetFolderPath">目标文件夹路径(确保文件夹存在,否则需要创建它)</param>
+        private void CopyPicture(string sourceImagePath,string targetFolderPath)
+        {
+  
+            // 构造目标图片路径(如果图片名要改变,可以在这里指定新的名字)  
+            string targetImagePath = Path.Combine(targetFolderPath, Path.GetFileName(sourceImagePath));
+
+            // 确保目标文件夹存在  
+            if (!Directory.Exists(targetFolderPath))
+            {
+                Directory.CreateDirectory(targetFolderPath);
+            }
+
+            // 复制图片到目标路径  
+            try
+            {
+                File.Copy(sourceImagePath, targetImagePath, true); // 第三个参数为true表示如果目标文件已存在,则覆盖它  
+            }
+            catch (Exception ex)
+            {
+                MessageBox.Show("图片复制失败:"+ ex.Message);
+            }
+        }
+
+        public static bool IsPathWithinDirectory(string filePath, string directoryPath)
+        {
+            // 确保directoryPath以目录分隔符结尾  
+            if (!directoryPath.EndsWith(Path.DirectorySeparatorChar.ToString()))
+            {
+                directoryPath += Path.DirectorySeparatorChar;
+            }
+
+            // 使用Path.GetFullPath来规范化路径,这样可以处理相对路径和当前目录等  
+            string fullPath = Path.GetFullPath(filePath);
+            string fullDirectoryPath = Path.GetFullPath(directoryPath);
+
+            // 判断fullPath是否以fullDirectoryPath为前缀  
+            return fullPath.StartsWith(fullDirectoryPath, StringComparison.OrdinalIgnoreCase);
+        }
 
         private void ck_kllb_fjzt_CheckedChanged(object sender, EventArgs e)
         {

+ 2 - 2
OTSPartA_STDEditor/UI/STDRuleslist.Designer.cs

@@ -40,8 +40,8 @@
             // 
             // Grid_Minerals
             // 
-            this.Grid_Minerals.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
-            | System.Windows.Forms.AnchorStyles.Right)));
+            this.Grid_Minerals.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
+            | System.Windows.Forms.AnchorStyles.Left)));
             this.Grid_Minerals.BackColor = System.Drawing.SystemColors.Control;
             this.Grid_Minerals.ContextMenuStrip = this.MenuStrip_STDRulelist;
             this.Grid_Minerals.EnableSort = true;