Browse Source

修改sysmgr,添加选择程序类型时拷贝配置文件

cxs 1 year ago
parent
commit
1e0dadaf2e

+ 1 - 1
Bin/x64/Debug/Config/ConfigTemplate/IncA/OTSProgMgrParam.pmf

@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<XMLData RunMode="ProfessionalMode" SysType="CleannessA">
+<XMLData RunMode="ProfessionalMode" SysType="IncA">
   <Member RegName="GenParam" DefaultArea="100" DefaultSampleName="Sample" DefaultShape="0" MeasParamFileFolderName=".\Config\ProData\" MeasSwitch="true" PartSTDLibFolderName=".\Config\SysData\" PropertyDisplayMode="0" StdLibFileName="OTSCleanlinessSTD1" StdLibTypeIndex="0" SteelTechnology="0" UseSysSTD="true" />
   <Member RegName="ImageProcParam" AutoBGRemoveType="0:MIDDLE" BGRemoveType="1:MANUAL" ErrodDilateParam="0" OverlapParam="0">
     <Member RegName="BGGray" end="255" start="80" />

+ 1 - 1
Bin/x64/Debug/Config/ConfigTemplate/IncA/OTSReportMgrParam.rpf

@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<XMLData systype="CleannessA">
+<XMLData systype="IncA">
   <Member RegName="Scale" strValue="1000" />
   <Member RegName="DefaultComputedColName" strValue="Area,EquivalentCircleDiameter,MaxDiameter,MinDiameter,DiameterRatio,FerretDiameter,PERP,PERI,INSCR,MEAN,ELONG,ASPECT_ELONG,Orientation" />
   <Member RegName="ElementsColName" strValue="Al,Si,C,S,N,O,Fe,Cr,Ni,Ca,Mg" />

+ 2 - 3
OTSIncAMeasureApp/OTSIncAMeasureApp.csproj

@@ -224,9 +224,8 @@
       <HintPath>..\OpenDll\OxfordApi61Dll\OINA.Extender.dll</HintPath>
       <Private>False</Private>
     </Reference>
-    <Reference Include="OpenCvSharp, Version=1.0.0.0, Culture=neutral, PublicKeyToken=6adad1e807fea099, processorArchitecture=MSIL">
-      <SpecificVersion>False</SpecificVersion>
-      <HintPath>..\packages\OpenCvSharpOriginal\OpenCvSharp.dll</HintPath>
+    <Reference Include="OpenCvSharp">
+      <HintPath>..\OpenDll\OpenCvSharp\OpenCvSharp.dll</HintPath>
       <Private>False</Private>
     </Reference>
     <Reference Include="OTS.WinFormsUI.Docking, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">

+ 26 - 2
OTSSysMgrApp/OTSSystemManagerForms.Designer.cs

@@ -47,6 +47,8 @@
             this.tabSysType = new System.Windows.Forms.TabPage();
             this.radioButton_CleannessA = new System.Windows.Forms.RadioButton();
             this.radioButton_IncA = new System.Windows.Forms.RadioButton();
+            this.coB_CleannessType = new System.Windows.Forms.ComboBox();
+            this.btn_ok = new System.Windows.Forms.Button();
             this.tabLanguage.SuspendLayout();
             ((System.ComponentModel.ISupportInitialize)(this.pictureBox3)).BeginInit();
             this.tabControl1.SuspendLayout();
@@ -247,6 +249,8 @@
             // 
             // tabSysType
             // 
+            this.tabSysType.Controls.Add(this.btn_ok);
+            this.tabSysType.Controls.Add(this.coB_CleannessType);
             this.tabSysType.Controls.Add(this.radioButton_CleannessA);
             this.tabSysType.Controls.Add(this.radioButton_IncA);
             this.tabSysType.Location = new System.Drawing.Point(4, 22);
@@ -271,14 +275,32 @@
             // radioButton_IncA
             // 
             this.radioButton_IncA.AutoSize = true;
-            this.radioButton_IncA.Location = new System.Drawing.Point(29, 32);
+            this.radioButton_IncA.Location = new System.Drawing.Point(29, 25);
             this.radioButton_IncA.Name = "radioButton_IncA";
             this.radioButton_IncA.Size = new System.Drawing.Size(65, 16);
             this.radioButton_IncA.TabIndex = 0;
             this.radioButton_IncA.TabStop = true;
             this.radioButton_IncA.Text = " OTS101";
             this.radioButton_IncA.UseVisualStyleBackColor = true;
-            this.radioButton_IncA.CheckedChanged += new System.EventHandler(this.radioButton_IncA_CheckedChanged);
+            // 
+            // coB_CleannessType
+            // 
+            this.coB_CleannessType.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
+            this.coB_CleannessType.FormattingEnabled = true;
+            this.coB_CleannessType.Location = new System.Drawing.Point(112, 70);
+            this.coB_CleannessType.Name = "coB_CleannessType";
+            this.coB_CleannessType.Size = new System.Drawing.Size(121, 20);
+            this.coB_CleannessType.TabIndex = 2;
+            // 
+            // btn_ok
+            // 
+            this.btn_ok.Location = new System.Drawing.Point(463, 101);
+            this.btn_ok.Name = "btn_ok";
+            this.btn_ok.Size = new System.Drawing.Size(75, 24);
+            this.btn_ok.TabIndex = 3;
+            this.btn_ok.Text = "确定";
+            this.btn_ok.UseVisualStyleBackColor = true;
+            this.btn_ok.Click += new System.EventHandler(this.btn_ok_Click);
             // 
             // OTSSystemManagerForms
             // 
@@ -330,5 +352,7 @@
         private System.Windows.Forms.TabPage tabSysType;
         private System.Windows.Forms.RadioButton radioButton_CleannessA;
         private System.Windows.Forms.RadioButton radioButton_IncA;
+        private System.Windows.Forms.ComboBox coB_CleannessType;
+        private System.Windows.Forms.Button btn_ok;
     }
 }

+ 36 - 10
OTSSysMgrApp/OTSSystemManagerForms.cs

@@ -206,6 +206,8 @@ namespace OTSSysMgrApp
                     rdb_en.Checked = true;
                     break;
             }
+            coB_CleannessType.Items.Add("CleannessA");
+            coB_CleannessType.Items.Add("BatteryCleannessA");
 
             ReadSysType();
         }
@@ -360,21 +362,45 @@ namespace OTSSysMgrApp
             }
         }
 
-        private void WriteSysType()
+        private void CopyConfigBySysType()
         {
-            string path = Application.StartupPath + @"\Config\SysData\OTSProgMgrParam.pmf";
-            string Type = "";
+             string sourceFilepath= Application.StartupPath + @"\Config\ConfigTemplate";
+
             if (radioButton_IncA.Checked)
             {
-                Type = "IncA";
+                sourceFilepath += "\\IncA";
             }
             else if (radioButton_CleannessA.Checked)
             {
-                Type = "CleannessA";
+                if(coB_CleannessType.Text=="")
+                {
+                    MessageBox.Show("请选择清洁度类型!", "warning");
+                    return;
+                }
+                if(coB_CleannessType.SelectedItem.ToString()== "CleannessA")
+                {
+                    sourceFilepath += "\\CleannessA";
+                }
+                else
+                {
+                    sourceFilepath += "\\BatteryCleannessA";
+                }
+            }
+            var files = Directory.GetFiles(sourceFilepath);
+            foreach (var file in files)
+            {
+                string tagretFile= Application.StartupPath + @"\Config";
+                var fileInfo = new FileInfo(file);
+                if(fileInfo.Name== "ReportTemplateConfig.xml")
+                {
+                    tagretFile += "\\ReportTemplate";
+                }
+                else
+                {
+                    tagretFile += "\\SysData";
+                }
+                fileInfo.CopyTo(tagretFile +"\\"+ fileInfo.Name, true);
             }
-            bool result = XMLOperationClass.WriteSysType(path, "SysType", Type);
-            string path2 = Application.StartupPath + @"\Config\SysData\OTSReportMgrParam.rpf";
-            bool resultreport = XMLOperationClass.WriteSysType(path2, "systype", Type);
         }
 
         private void GetSEMAndEDSController()
@@ -613,9 +639,9 @@ namespace OTSSysMgrApp
             ds.WriteXml(System.Windows.Forms.Application.StartupPath + @"/Resources/XMLData/LanguageDefine.xml");
         }
 
-        private void radioButton_IncA_CheckedChanged(object sender, EventArgs e)
+        private void btn_ok_Click(object sender, EventArgs e)
         {
-            WriteSysType();
+            CopyConfigBySysType();
         }
     }
 }