Browse Source

报告 程序 管理 添加 粒级表、尺寸计算法、三元图 默认设置
程序管理中优化系统切换

cxs 1 year ago
parent
commit
f89f00c81e

+ 2 - 2
Bin/x64/Debug/Resources/XMLData/AppResource_ZH.xml

@@ -296,12 +296,12 @@
 	  <Control name="button15" text="取消" />
 	  <Control name="groupBox3" text="粒级设置" />
 	  <Control name="label16" text="文件" />
-	  <Control name="label4" text="文件夹" />
+	  <Control name="label4" text="粒级表" />
 	  <Control name="label20" text="文件" />
 	  <Control name="btn_ybcsqx" text="取  消" />
 	  <Control name="btn_ybcsbc" text="确   定" />
 	  <Control name="label7" text="文件夹" />
-	  <Control name="label17" text="文件" />
+	  <Control name="label17" text="三元图" />
 	  <Control name="label5" text="文件夹" />
 	  <Control name="groupBox6" text="三元图模板设置" />
 	  <Control name="groupBox7" text="颗粒分析标准库设置" />

+ 8 - 1
OTSCommon/ReportModel/RptConfigFile.cs

@@ -13,7 +13,7 @@ namespace OTSCommon.Model
     public class RptConfigFile
     {
         private string path;
-        private const string ConfigFileFolder = @".\Config\ProData\";
+        public const string ConfigFileFolder = @".\Config\ProData\";
         private const string m_TriTempFile = "DefaultTriTemplateFile.tpf";
 
         public static string m_ReportMgrParamFile = "\\Config\\SysData\\OTSReportMgrParam.rpf"; //报告对应使用的参数文件名
@@ -91,6 +91,13 @@ namespace OTSCommon.Model
             get { return ConfigFileFolder; }
 
 
+        }
+
+        public string ReportMgrParamFile
+        {
+            get { return m_ReportMgrParamFile; }
+
+
         }
 
         /// <summary>

+ 26 - 4
OTSIncAReportApp/1-UI/OTSDisplaySourceGridData/frmReportConditionChoose.cs

@@ -137,9 +137,10 @@ namespace OTSIncAReportApp
             List<string> list1 = new List<string>() { distributionMap, arrangementDiagram };
             AddGridData(OTS_REPORT_PROP_GRID_ITEMS.IMAGE_DISPLAY_TYPE, graphicDisplayMode, OTS_ITEM_TYPES.COMBO, false, "image display mode", list1[0], list1, IMAGE_DISPLAY_TYPE.DISTRIBUTION);
             AddGridData(OTS_REPORT_PROP_GRID_ITEMS.IMAGE_TYPE, particleDisplayMode, OTS_ITEM_TYPES.COMBO, false, "distribution image Type", bseOriginal, new List<string>() { bseOriginal, classifiedDisplay, originalSplicing, originalDistribution }, DISTRIBUTION_IMAGE_SHOW_MODE.BSE);
+            var DefaultPartSize = m_rstDataMgr.GetDefaultPartSize();
             //粒级表
             List<string> list_partsizelist = m_rstDataMgr.GetPartSizeFileList();//从系统默认的路径中查找出所有的粒级表文件
-            AddGridData(OTS_REPORT_PROP_GRID_ITEMS.GRAIN_SIZE_CLASS_TABLE, particleSizeTable, OTS_ITEM_TYPES.COMBO, false, "Particle Table", list_partsizelist[0], list_partsizelist, 0);
+            AddGridData(OTS_REPORT_PROP_GRID_ITEMS.GRAIN_SIZE_CLASS_TABLE, particleSizeTable, OTS_ITEM_TYPES.COMBO, false, "Particle Table", DefaultPartSize, list_partsizelist, list_partsizelist.IndexOf(DefaultPartSize));
             //粒级
             List<string> sizeList = new List<string>();
             sizeList = m_rstDataMgr.GetPartSizeList();//获取粒级后额外增加全部,自定义,选项
@@ -153,8 +154,29 @@ namespace OTSIncAReportApp
             //排列图显示类别
             List<string> list3 = new List<string>() { sortByType, arrangeBySize };
             AddGridData(OTS_REPORT_PROP_GRID_ITEMS.IMAGEGRID_DIS_TYPE, arrangementMode, OTS_ITEM_TYPES.COMBO, false, "Measured Data", list3[0], list3, IMAGEGRID_DIS_TYPE.CLASSIFY_TYPE);
+            var DefaultSIZE_CAL_METHOD_TYPE=m_rstDataMgr.GetDefaultSIZE_CAL_METHOD_TYPE();
+
+            int ind = 0;
+            switch (DefaultSIZE_CAL_METHOD_TYPE)
+            {
+                case "CIRCLE":
+                    ind = (int)SIZE_CAL_METHOD_TYPE.CIRCLE;
+                    break;
+                case "DFERET":
+                    ind = (int)SIZE_CAL_METHOD_TYPE.DFERET;
+                    break;
+                case "DMAX":
+                    ind = (int)SIZE_CAL_METHOD_TYPE.DMAX;
+                    break;
+                case "DMIN":
+                    ind = (int)SIZE_CAL_METHOD_TYPE.DMIN;
+                    break;
+
+                default: ind = 0; break;
+            }
+
             //计算方式
-            AddGridData(OTS_REPORT_PROP_GRID_ITEMS.SIZE_CAL_METHOD_TYPE, dimensionCalculationMethod, OTS_ITEM_TYPES.COMBO, false, "image property calculation method", "ECD", m_rstDataMgr.GetSizeCalMethodTypeList(), SIZE_CAL_METHOD_TYPE.CIRCLE);
+            AddGridData(OTS_REPORT_PROP_GRID_ITEMS.SIZE_CAL_METHOD_TYPE, dimensionCalculationMethod, OTS_ITEM_TYPES.COMBO, false, "image property calculation method", DefaultSIZE_CAL_METHOD_TYPE, m_rstDataMgr.GetSizeCalMethodTypeList(), ind);
             //数据表类型
             List<string> list2 = new List<string>() { surveyResults, sampleMeasurementInformation, granularComponent, particleSizeDistribution, averageElementComposition };
             ResultFile resultinfo = m_rstDataMgr.ResultFilesList[m_rstDataMgr.GetWorkingResultId()];
@@ -174,10 +196,10 @@ namespace OTSIncAReportApp
             // chart condition items
             List<string> list22 = new List<string>() { commonClassification, granularComponent, particleSizeDistribution, ternaryPhaseDiagram, InclusionAreaRatio };
             AddGridData(OTS_REPORT_PROP_GRID_ITEMS.CALCULATE_CHART_TYPE, dataTableType, OTS_ITEM_TYPES.COMBO, false, "Data graph type", list22[0], list22, CALCULATE_CHART_TYPE.COMMON_FIVE);
-          
+            var DefaultTRIO_CHART_TYPE = m_rstDataMgr.GetDefaultTRIO_CHART_TYPE();
             //三元相图模板
             List<string> trio_listname = m_rstDataMgr.GetTriTemplateNameList();
-            AddGridData(OTS_REPORT_PROP_GRID_ITEMS.TRIO_CHART_TYPE, ternaryPhaseDiagram, OTS_ITEM_TYPES.COMBO, false, "Ternary phase diagram", trio_listname.First(), trio_listname, null);
+            AddGridData(OTS_REPORT_PROP_GRID_ITEMS.TRIO_CHART_TYPE, ternaryPhaseDiagram, OTS_ITEM_TYPES.COMBO, false, "Ternary phase diagram", DefaultTRIO_CHART_TYPE, trio_listname, trio_listname.IndexOf(DefaultTRIO_CHART_TYPE));
           
             //颗粒分类ID
             List<string> stdlistname = m_rstDataMgr.GetSTDIdList();

+ 84 - 19
OTSIncAReportApp/1-UI/OTSMgrInfo/frmReportSysConfig.Designer.cs

@@ -61,9 +61,15 @@ namespace OTSIncAReprotCharts
             this.folderBrowserDialog1 = new System.Windows.Forms.FolderBrowserDialog();
             this.groupBox2 = new System.Windows.Forms.GroupBox();
             this.label1 = new System.Windows.Forms.Label();
+            this.comboBox_PartiSizeFileFolder = new System.Windows.Forms.ComboBox();
+            this.cB_sjtmbwj = new System.Windows.Forms.ComboBox();
+            this.groupBox1 = new System.Windows.Forms.GroupBox();
+            this.cB_SIZE_CAL_METHOD_TYPE = new System.Windows.Forms.ComboBox();
+            this.label2 = new System.Windows.Forms.Label();
             this.groupBox3.SuspendLayout();
             this.groupBox6.SuspendLayout();
             this.groupBox2.SuspendLayout();
+            this.groupBox1.SuspendLayout();
             this.SuspendLayout();
             // 
             // listView2
@@ -180,8 +186,8 @@ namespace OTSIncAReprotCharts
             // 
             // groupBox3
             // 
+            this.groupBox3.Controls.Add(this.comboBox_PartiSizeFileFolder);
             this.groupBox3.Controls.Add(this.btn_PartSize);
-            this.groupBox3.Controls.Add(this.tb_PartiSizeFileFolder);
             this.groupBox3.Controls.Add(this.label4);
             this.groupBox3.Location = new System.Drawing.Point(8, 8);
             this.groupBox3.Margin = new System.Windows.Forms.Padding(2, 1, 2, 1);
@@ -206,7 +212,7 @@ namespace OTSIncAReprotCharts
             // tb_PartiSizeFileFolder
             // 
             this.tb_PartiSizeFileFolder.Enabled = false;
-            this.tb_PartiSizeFileFolder.Location = new System.Drawing.Point(125, 17);
+            this.tb_PartiSizeFileFolder.Location = new System.Drawing.Point(545, 23);
             this.tb_PartiSizeFileFolder.Margin = new System.Windows.Forms.Padding(2, 1, 2, 1);
             this.tb_PartiSizeFileFolder.Name = "tb_PartiSizeFileFolder";
             this.tb_PartiSizeFileFolder.Size = new System.Drawing.Size(336, 21);
@@ -220,12 +226,12 @@ namespace OTSIncAReprotCharts
             this.label4.Name = "label4";
             this.label4.Size = new System.Drawing.Size(41, 12);
             this.label4.TabIndex = 2;
-            this.label4.Text = "文件夹";
+            this.label4.Text = "粒级表";
             // 
             // tb_sjtmbwj
             // 
             this.tb_sjtmbwj.Enabled = false;
-            this.tb_sjtmbwj.Location = new System.Drawing.Point(125, 37);
+            this.tb_sjtmbwj.Location = new System.Drawing.Point(606, 94);
             this.tb_sjtmbwj.Margin = new System.Windows.Forms.Padding(2, 1, 2, 1);
             this.tb_sjtmbwj.Name = "tb_sjtmbwj";
             this.tb_sjtmbwj.Size = new System.Drawing.Size(335, 21);
@@ -234,7 +240,7 @@ namespace OTSIncAReprotCharts
             // tb_sjtmb
             // 
             this.tb_sjtmb.Enabled = false;
-            this.tb_sjtmb.Location = new System.Drawing.Point(125, 15);
+            this.tb_sjtmb.Location = new System.Drawing.Point(606, 69);
             this.tb_sjtmb.Margin = new System.Windows.Forms.Padding(2, 1, 2, 1);
             this.tb_sjtmb.Name = "tb_sjtmb";
             this.tb_sjtmb.Size = new System.Drawing.Size(373, 21);
@@ -242,7 +248,7 @@ namespace OTSIncAReprotCharts
             // 
             // btn_ybcsqx
             // 
-            this.btn_ybcsqx.Location = new System.Drawing.Point(444, 185);
+            this.btn_ybcsqx.Location = new System.Drawing.Point(444, 253);
             this.btn_ybcsqx.Margin = new System.Windows.Forms.Padding(2, 1, 2, 1);
             this.btn_ybcsqx.Name = "btn_ybcsqx";
             this.btn_ybcsqx.Size = new System.Drawing.Size(67, 23);
@@ -253,7 +259,7 @@ namespace OTSIncAReprotCharts
             // 
             // btn_ybcsbc
             // 
-            this.btn_ybcsbc.Location = new System.Drawing.Point(373, 185);
+            this.btn_ybcsbc.Location = new System.Drawing.Point(373, 253);
             this.btn_ybcsbc.Margin = new System.Windows.Forms.Padding(2, 1, 2, 1);
             this.btn_ybcsbc.Name = "btn_ybcsbc";
             this.btn_ybcsbc.Size = new System.Drawing.Size(67, 23);
@@ -264,7 +270,7 @@ namespace OTSIncAReprotCharts
             // 
             // btn_sjtmbwj
             // 
-            this.btn_sjtmbwj.Location = new System.Drawing.Point(463, 37);
+            this.btn_sjtmbwj.Location = new System.Drawing.Point(463, 26);
             this.btn_sjtmbwj.Margin = new System.Windows.Forms.Padding(2, 1, 2, 1);
             this.btn_sjtmbwj.Name = "btn_sjtmbwj";
             this.btn_sjtmbwj.Size = new System.Drawing.Size(33, 19);
@@ -276,17 +282,17 @@ namespace OTSIncAReprotCharts
             // label17
             // 
             this.label17.AutoSize = true;
-            this.label17.Location = new System.Drawing.Point(10, 41);
+            this.label17.Location = new System.Drawing.Point(10, 30);
             this.label17.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
             this.label17.Name = "label17";
-            this.label17.Size = new System.Drawing.Size(29, 12);
+            this.label17.Size = new System.Drawing.Size(41, 12);
             this.label17.TabIndex = 2;
-            this.label17.Text = "文件";
+            this.label17.Text = "三元图";
             // 
             // label5
             // 
             this.label5.AutoSize = true;
-            this.label5.Location = new System.Drawing.Point(10, 19);
+            this.label5.Location = new System.Drawing.Point(550, 72);
             this.label5.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
             this.label5.Name = "label5";
             this.label5.Size = new System.Drawing.Size(41, 12);
@@ -295,16 +301,14 @@ namespace OTSIncAReprotCharts
             // 
             // groupBox6
             // 
-            this.groupBox6.Controls.Add(this.tb_sjtmb);
-            this.groupBox6.Controls.Add(this.label5);
-            this.groupBox6.Controls.Add(this.tb_sjtmbwj);
+            this.groupBox6.Controls.Add(this.cB_sjtmbwj);
             this.groupBox6.Controls.Add(this.btn_sjtmbwj);
             this.groupBox6.Controls.Add(this.label17);
-            this.groupBox6.Location = new System.Drawing.Point(8, 55);
+            this.groupBox6.Location = new System.Drawing.Point(8, 53);
             this.groupBox6.Margin = new System.Windows.Forms.Padding(2, 1, 2, 1);
             this.groupBox6.Name = "groupBox6";
             this.groupBox6.Padding = new System.Windows.Forms.Padding(2, 1, 2, 1);
-            this.groupBox6.Size = new System.Drawing.Size(501, 65);
+            this.groupBox6.Size = new System.Drawing.Size(501, 60);
             this.groupBox6.TabIndex = 1;
             this.groupBox6.TabStop = false;
             this.groupBox6.Text = "三元相图模板设置";
@@ -339,7 +343,7 @@ namespace OTSIncAReprotCharts
             this.groupBox2.Controls.Add(this.label1);
             this.groupBox2.Controls.Add(this.tb_blyz);
             this.groupBox2.Controls.Add(this.label22);
-            this.groupBox2.Location = new System.Drawing.Point(8, 124);
+            this.groupBox2.Location = new System.Drawing.Point(8, 192);
             this.groupBox2.Margin = new System.Windows.Forms.Padding(2, 1, 2, 1);
             this.groupBox2.Name = "groupBox2";
             this.groupBox2.Padding = new System.Windows.Forms.Padding(2, 1, 2, 1);
@@ -357,12 +361,65 @@ namespace OTSIncAReprotCharts
             this.label1.TabIndex = 2;
             this.label1.Text = "特征/夹杂物指数=特征总面积/检测视场总面积*系数";
             // 
+            // comboBox_PartiSizeFileFolder
+            // 
+            this.comboBox_PartiSizeFileFolder.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
+            this.comboBox_PartiSizeFileFolder.FormattingEnabled = true;
+            this.comboBox_PartiSizeFileFolder.Location = new System.Drawing.Point(125, 15);
+            this.comboBox_PartiSizeFileFolder.Name = "comboBox_PartiSizeFileFolder";
+            this.comboBox_PartiSizeFileFolder.Size = new System.Drawing.Size(333, 20);
+            this.comboBox_PartiSizeFileFolder.TabIndex = 5;
+            // 
+            // cB_sjtmbwj
+            // 
+            this.cB_sjtmbwj.FormattingEnabled = true;
+            this.cB_sjtmbwj.Location = new System.Drawing.Point(125, 24);
+            this.cB_sjtmbwj.Name = "cB_sjtmbwj";
+            this.cB_sjtmbwj.Size = new System.Drawing.Size(333, 20);
+            this.cB_sjtmbwj.TabIndex = 5;
+            // 
+            // groupBox1
+            // 
+            this.groupBox1.Controls.Add(this.cB_SIZE_CAL_METHOD_TYPE);
+            this.groupBox1.Controls.Add(this.label2);
+            this.groupBox1.Location = new System.Drawing.Point(8, 123);
+            this.groupBox1.Margin = new System.Windows.Forms.Padding(2, 1, 2, 1);
+            this.groupBox1.Name = "groupBox1";
+            this.groupBox1.Padding = new System.Windows.Forms.Padding(2, 1, 2, 1);
+            this.groupBox1.Size = new System.Drawing.Size(501, 56);
+            this.groupBox1.TabIndex = 86;
+            this.groupBox1.TabStop = false;
+            this.groupBox1.Text = "尺寸计算方法设置";
+            // 
+            // cB_SIZE_CAL_METHOD_TYPE
+            // 
+            this.cB_SIZE_CAL_METHOD_TYPE.FormattingEnabled = true;
+            this.cB_SIZE_CAL_METHOD_TYPE.Location = new System.Drawing.Point(125, 22);
+            this.cB_SIZE_CAL_METHOD_TYPE.Name = "cB_SIZE_CAL_METHOD_TYPE";
+            this.cB_SIZE_CAL_METHOD_TYPE.Size = new System.Drawing.Size(333, 20);
+            this.cB_SIZE_CAL_METHOD_TYPE.TabIndex = 5;
+            // 
+            // label2
+            // 
+            this.label2.AutoSize = true;
+            this.label2.Location = new System.Drawing.Point(10, 26);
+            this.label2.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
+            this.label2.Name = "label2";
+            this.label2.Size = new System.Drawing.Size(77, 12);
+            this.label2.TabIndex = 2;
+            this.label2.Text = "尺寸计算方法";
+            // 
             // frmReportSysConfig
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
-            this.ClientSize = new System.Drawing.Size(526, 225);
+            this.ClientSize = new System.Drawing.Size(520, 283);
+            this.Controls.Add(this.groupBox1);
+            this.Controls.Add(this.tb_sjtmbwj);
+            this.Controls.Add(this.tb_sjtmb);
+            this.Controls.Add(this.label5);
             this.Controls.Add(this.groupBox2);
+            this.Controls.Add(this.tb_PartiSizeFileFolder);
             this.Controls.Add(this.groupBox6);
             this.Controls.Add(this.groupBox3);
             this.Controls.Add(this.btn_ybcsqx);
@@ -382,7 +439,10 @@ namespace OTSIncAReprotCharts
             this.groupBox6.PerformLayout();
             this.groupBox2.ResumeLayout(false);
             this.groupBox2.PerformLayout();
+            this.groupBox1.ResumeLayout(false);
+            this.groupBox1.PerformLayout();
             this.ResumeLayout(false);
+            this.PerformLayout();
 
         }
 
@@ -417,5 +477,10 @@ namespace OTSIncAReprotCharts
         private System.Windows.Forms.GroupBox groupBox2;
         private Button btn_PartSize;
         private Label label1;
+        private ComboBox comboBox_PartiSizeFileFolder;
+        private ComboBox cB_sjtmbwj;
+        private GroupBox groupBox1;
+        private ComboBox cB_SIZE_CAL_METHOD_TYPE;
+        private Label label2;
     }
 }

+ 77 - 4
OTSIncAReportApp/1-UI/OTSMgrInfo/frmReportSysConfig.cs

@@ -1,11 +1,15 @@
-using OTSCommon.Model;
+using OTSCommon;
+using OTSCommon.Model;
 using OTSIncAReportApp;
+using OTSIncAReportApp.Controls;
 using OTSIncAReportApp.OTSDataMgrFunction;
 using OTSIncAReportApp.OTSMgrInfo;
 using OTSIncAReportApp.SysMgrTools;
 using System;
 using System.Data;
+using System.IO;
 using System.Windows.Forms;
+using Language = OTSIncAReportApp.SysMgrTools.Language;
 
 namespace OTSIncAReprotCharts
 {
@@ -51,11 +55,68 @@ namespace OTSIncAReprotCharts
         {
             //初始化数据
             InitMyComponent();
+            InitData();
         }
 
         #endregion
 
         #region 自定义方法
+
+        public void InitData()
+        {
+            DirectoryInfo theFolder = new DirectoryInfo(tb_PartiSizeFileFolder.Text);
+            if (!theFolder.Exists)
+                return;
+
+            comboBox_PartiSizeFileFolder.Items.Clear();
+            //读取遍历粒级文件信息
+            foreach (FileInfo nextifile in theFolder.GetFiles())
+            {
+                //找出粒级文件
+                if (nextifile.Name.Contains(".psf") == true || nextifile.Name.Contains(".PSF") == true)
+                {
+                    comboBox_PartiSizeFileFolder.Items.Add(nextifile.Name);
+                }
+            }
+            
+
+            cB_sjtmbwj.Items.Clear();
+            //三元相图模板配置文件
+            string path = m_DataMgrFun.m_RptConfigFile.TrigTemplateFileFolder + "\\" + m_DataMgrFun.m_RptConfigFile.TriTempFile;
+
+            DataSet ds = XMLoperate.GetXmlData(path, "XMLData");
+            DataTable dt = ds.Tables["Member"];
+
+            for (int i = 0; i < dt.Rows.Count; i++)
+            {
+                cB_sjtmbwj.Items.Add(dt.Rows[i]["TemplateName"].ToString());
+            }
+
+            cB_SIZE_CAL_METHOD_TYPE.Items.Clear();
+            cB_SIZE_CAL_METHOD_TYPE.Items.AddRange(m_DataMgrFun.GetSizeCalMethodTypeList().ToArray());
+
+
+            DataSet ds1 = XMLoperate.GetXmlData(Application.StartupPath + RptConfigFile.m_ReportMgrParamFile, "XMLData");
+            DataTable dt1 = ds1.Tables["Member"];
+            foreach (DataRow element in dt1.Rows)
+            {
+                string RegName = element["RegName"].ToString();
+
+                if (RegName == "PartSizeFile")
+                {
+                    comboBox_PartiSizeFileFolder.SelectedIndex = comboBox_PartiSizeFileFolder.Items.IndexOf(element["name"].ToString());
+                }
+
+                if (RegName == "TRIO_CHART_TYPE")
+                {
+                    cB_sjtmbwj.SelectedIndex = cB_sjtmbwj.Items.IndexOf(element["strValue"].ToString());
+                }
+                if (RegName == "SIZE_CAL_METHOD_TYPE")
+                {
+                    cB_SIZE_CAL_METHOD_TYPE.SelectedIndex = cB_SIZE_CAL_METHOD_TYPE.Items.IndexOf(element["strValue"].ToString());
+                }
+            }
+        }
         public void InitMyComponent()
         {
             string imagepath;
@@ -215,7 +276,7 @@ namespace OTSIncAReprotCharts
         private void btn_ybcsbc_Click(object sender, EventArgs e)
         {
             double blyz = 0;
-            if (!double.TryParse(tb_blyz.Text.ToString(),out blyz))
+            if (!double.TryParse(tb_blyz.Text.ToString(), out blyz))
             {
                 MessageBox.Show("please check params!");
             }
@@ -224,10 +285,22 @@ namespace OTSIncAReprotCharts
 
             String strTritempFile = tb_sjtmb.Text;
             string strTritemp = tb_sjtmbwj.Text;
-         
+
+
+            //根据xml读取内容
+            XmlOperateUtil xmlutil = new XmlOperateUtil(".\\Config\\ProData\\"+comboBox_PartiSizeFileFolder.Text.ToString());
+            string PartiSize=xmlutil.GetAttribute("Name", "XMLData");
+
             //比例因子
             OTSIncAReportApp.DataOperation.DataAccess.XMLoperate.EditXmlInfo(Application.StartupPath + RptConfigFile.m_ReportMgrParamFile, "Scale", "strValue", tb_blyz.Text.ToString());
-
+            OTSIncAReportApp.DataOperation.DataAccess.XMLoperate.EditXmlInfo(Application.StartupPath + RptConfigFile.m_ReportMgrParamFile, "PartSizeFile", "name", comboBox_PartiSizeFileFolder.Text.ToString());
+            //OTSIncAReportApp.DataOperation.DataAccess.XMLoperate.EditXmlInfo(Application.StartupPath + RptConfigFile.m_ReportMgrParamFile, "PartSize", "strValue", PartiSize);
+            OTSIncAReportApp.DataOperation.DataAccess.XMLoperate.EditXmlInfo(Application.StartupPath + RptConfigFile.m_ReportMgrParamFile, "TRIO_CHART_TYPE", "strValue", cB_sjtmbwj.Text.ToString());
+            OTSIncAReportApp.DataOperation.DataAccess.XMLoperate.EditXmlInfo(Application.StartupPath + RptConfigFile.m_ReportMgrParamFile, "SIZE_CAL_METHOD_TYPE", "strValue", cB_SIZE_CAL_METHOD_TYPE.Text.ToString());
+            if (m_ReportApp.m_rstDataMgr.CurResultFile != null)
+            {
+                m_ReportApp.m_conditionChoose.SetDefaultConditionValue();
+            }
             this.Close();
         }
         #endregion

+ 20 - 0
OTSIncAReportApp/2-CommonFunction/OTSDataMgrFunction/ResultDataMgr.cs

@@ -324,6 +324,26 @@ namespace OTSIncAReportApp.OTSDataMgrFunction
             return ret_list;
         }
 
+        public string GetDefaultPartSize()
+        {
+            DataSet ds = DataOperation.DataAccess.XMLoperate.GetXml(Application.StartupPath + m_RptConfigFile.ReportMgrParamFile);
+            string sizestr = ds.Tables[1].Rows[3]["name"].ToString();
+            return sizestr;
+        }
+        public string GetDefaultTRIO_CHART_TYPE()
+        {
+            DataSet ds = DataOperation.DataAccess.XMLoperate.GetXml(Application.StartupPath + m_RptConfigFile.ReportMgrParamFile);
+            string sizestr = ds.Tables[1].Rows[5]["strValue"].ToString();
+            return sizestr;
+        }
+
+        public string GetDefaultSIZE_CAL_METHOD_TYPE()
+        {
+            DataSet ds = DataOperation.DataAccess.XMLoperate.GetXml(Application.StartupPath + m_RptConfigFile.ReportMgrParamFile);
+            string sizestr = ds.Tables[1].Rows[6]["strValue"].ToString();
+            return sizestr;
+        }
+
         /// <summary>
         /// 获取计算方法列表
         /// </summary>

+ 9 - 0
OTSSysMgrApp/OTSSysMgrApp.csproj

@@ -240,6 +240,12 @@
     <Compile Include="ShowXRayElementResultForm.Designer.cs">
       <DependentUpon>ShowXRayElementResultForm.cs</DependentUpon>
     </Compile>
+    <Compile Include="SwitchSystemValidation.cs">
+      <SubType>Form</SubType>
+    </Compile>
+    <Compile Include="SwitchSystemValidation.Designer.cs">
+      <DependentUpon>SwitchSystemValidation.cs</DependentUpon>
+    </Compile>
     <Compile Include="XMLOperationClass.cs" />
     <EmbeddedResource Include="About.resx">
       <DependentUpon>About.cs</DependentUpon>
@@ -264,6 +270,9 @@
     <EmbeddedResource Include="ShowXRayElementResultForm.resx">
       <DependentUpon>ShowXRayElementResultForm.cs</DependentUpon>
     </EmbeddedResource>
+    <EmbeddedResource Include="SwitchSystemValidation.resx">
+      <DependentUpon>SwitchSystemValidation.cs</DependentUpon>
+    </EmbeddedResource>
     <None Include="app.manifest" />
     <None Include="Properties\Settings.settings">
       <Generator>SettingsSingleFileGenerator</Generator>

+ 0 - 13
OTSSysMgrApp/OTSSystemManagerForms.Designer.cs

@@ -44,7 +44,6 @@
             this.button1 = new System.Windows.Forms.Button();
             this.tabSysType = new System.Windows.Forms.TabPage();
             this.pictureBox4 = new System.Windows.Forms.PictureBox();
-            this.btn_ok = new System.Windows.Forms.Button();
             this.coB_CleannessType = new System.Windows.Forms.ComboBox();
             this.radioButton_CleannessA = new System.Windows.Forms.RadioButton();
             this.radioButton_IncA = new System.Windows.Forms.RadioButton();
@@ -226,7 +225,6 @@
             // tabSysType
             // 
             this.tabSysType.Controls.Add(this.pictureBox4);
-            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);
@@ -249,16 +247,6 @@
             this.pictureBox4.TabIndex = 9;
             this.pictureBox4.TabStop = false;
             // 
-            // btn_ok
-            // 
-            this.btn_ok.Location = new System.Drawing.Point(358, 16);
-            this.btn_ok.Name = "btn_ok";
-            this.btn_ok.Size = new System.Drawing.Size(36, 78);
-            this.btn_ok.TabIndex = 3;
-            this.btn_ok.Text = "OK";
-            this.btn_ok.UseVisualStyleBackColor = true;
-            this.btn_ok.Click += new System.EventHandler(this.btn_ok_Click);
-            // 
             // coB_CleannessType
             // 
             this.coB_CleannessType.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
@@ -377,7 +365,6 @@
         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;
         private System.Windows.Forms.TabPage tabother;
         private System.Windows.Forms.PictureBox pictureBox1;
         private System.Windows.Forms.Button btn_otherconfig;

+ 61 - 45
OTSSysMgrApp/OTSSystemManagerForms.cs

@@ -202,9 +202,11 @@ namespace OTSSysMgrApp
             }
             coB_CleannessType.Items.Add("CleannessA");
             coB_CleannessType.Items.Add("BatteryCleannessA");
-
+            this.coB_CleannessType.SelectedIndexChanged -= new System.EventHandler(this.coB_CleannessType_SelectedIndexChanged);
+            coB_CleannessType.SelectedIndex=0;
+            this.coB_CleannessType.SelectedIndexChanged += new System.EventHandler(this.coB_CleannessType_SelectedIndexChanged);
             ReadSysType();
-            btn_ok.Enabled = false;
+            //btn_ok.Enabled = false;
         }
         /// <summary>
         /// 将所有参数保存
@@ -326,71 +328,74 @@ namespace OTSSysMgrApp
             }
 
         }
-
         private void ReadSysType()
         {
             string path = Application.StartupPath + @"\Config\SysData\OTSProgMgrParam.pmf";
             string Type = "";
-            bool result = XMLOperationClass.ReadSysType(path, "SysType",ref Type);
+            bool result = XMLOperationClass.ReadSysType(path, "SysType", ref Type);
             if (result)
             {
-                if(Type== "IncA")
+                this.radioButton_IncA.CheckedChanged -= new System.EventHandler(this.radioButton_IncA_CheckedChanged);
+                if (Type == "IncA")
                 {
                     radioButton_IncA.Checked = true;
                 }
-                else if(Type == "CleannessA")
+                else if (Type == "CleannessA")
                 {
                     radioButton_CleannessA.Checked = true;
                 }
+                this.radioButton_IncA.CheckedChanged += new System.EventHandler(this.radioButton_IncA_CheckedChanged);
             }
         }
 
-        private void CopyConfigBySysType()
-        {
-            DialogResult dialogResult= MessageBox.Show("操作有风险,将会采用默认系统配置初始化当前所有配置文件,是否继续?点击否仅切换系统", "删除提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
-            if(dialogResult==DialogResult.Cancel)
-            {
-                WriteSysType();
-                return;
-            }
-            string sourceFilepath= Application.StartupPath + @"\Config\ConfigTemplate";
 
-            if (radioButton_IncA.Checked)
-            {
-                sourceFilepath += "\\IncA";
-            }
-            else if (radioButton_CleannessA.Checked)
+
+        private bool CopyConfigBySysType()
+        {
+            SwitchSystemValidation switchSystemValidation = new SwitchSystemValidation();
+            DialogResult dialogResult = switchSystemValidation.ShowDialog();
+            if (dialogResult == DialogResult.OK)
             {
-                if(coB_CleannessType.Text=="")
-                {
-                    MessageBox.Show("请选择清洁度类型!", "warning");
-                    return;
-                }
-                if(coB_CleannessType.SelectedItem.ToString()== "CleannessA")
+                if (switchSystemValidation.UpdateFile)
                 {
-                    sourceFilepath += "\\CleannessA";
+                    WriteSysType();
+                    return true;
                 }
-                else
+                string sourceFilepath = Application.StartupPath + @"\Config\ConfigTemplate";
+                if (radioButton_IncA.Checked)
                 {
-                    sourceFilepath += "\\BatteryCleannessA";
+                    sourceFilepath += "\\IncA";
                 }
-            }
-            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")
+                else if (radioButton_CleannessA.Checked)
                 {
-                    tagretFile += "\\ReportTemplate";
+                    if (coB_CleannessType.SelectedItem.ToString() == "CleannessA")
+                    {
+                        sourceFilepath += "\\CleannessA";
+                    }
+                    else
+                    {
+                        sourceFilepath += "\\BatteryCleannessA";
+                    }
                 }
-                else
+                var files = Directory.GetFiles(sourceFilepath);
+                foreach (var file in files)
                 {
-                    tagretFile += "\\SysData";
+                    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);
                 }
-                fileInfo.CopyTo(tagretFile +"\\"+ fileInfo.Name, true);
+                MessageBox.Show("Configure successful!", "Tip");
+                return true;
             }
-            MessageBox.Show("Configure successful!", "Tip");
+            return false;
         }
 
         private void GetSEMAndEDSController()
@@ -603,18 +608,29 @@ namespace OTSSysMgrApp
 
         private void btn_ok_Click(object sender, EventArgs e)
         {
-            CopyConfigBySysType();
+            //CopyConfigBySysType();
         }
 
         private void radioButton_IncA_CheckedChanged(object sender, EventArgs e)
         {
-            btn_ok.Enabled = true;
+            bool r = radioButton_IncA.Checked;
+            if (!CopyConfigBySysType())
+            {
+                this.radioButton_IncA.CheckedChanged -= new System.EventHandler(this.radioButton_IncA_CheckedChanged);
+                radioButton_CleannessA.Checked = r;
+                radioButton_IncA.Checked = !r;
+                this.radioButton_IncA.CheckedChanged += new System.EventHandler(this.radioButton_IncA_CheckedChanged);
+            }
         }
 
         private void coB_CleannessType_SelectedIndexChanged(object sender, EventArgs e)
         {
-
-            btn_ok.Enabled = true;
+            if(radioButton_CleannessA.Checked)
+            {
+                this.radioButton_IncA.CheckedChanged -= new System.EventHandler(this.radioButton_IncA_CheckedChanged);
+                CopyConfigBySysType();
+                this.radioButton_IncA.CheckedChanged += new System.EventHandler(this.radioButton_IncA_CheckedChanged);
+            }
         }
         private void WriteSysType()
         {

+ 107 - 0
OTSSysMgrApp/SwitchSystemValidation.Designer.cs

@@ -0,0 +1,107 @@
+
+namespace OTSSysMgrApp
+{
+    partial class SwitchSystemValidation
+    {
+        /// <summary>
+        /// Required designer variable.
+        /// </summary>
+        private System.ComponentModel.IContainer components = null;
+
+        /// <summary>
+        /// Clean up any resources being used.
+        /// </summary>
+        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
+        protected override void Dispose(bool disposing)
+        {
+            if (disposing && (components != null))
+            {
+                components.Dispose();
+            }
+            base.Dispose(disposing);
+        }
+
+        #region Windows Form Designer generated code
+
+        /// <summary>
+        /// Required method for Designer support - do not modify
+        /// the contents of this method with the code editor.
+        /// </summary>
+        private void InitializeComponent()
+        {
+            this.cB_updatefile = new System.Windows.Forms.CheckBox();
+            this.btn_OK = new System.Windows.Forms.Button();
+            this.btn_CANCEL = new System.Windows.Forms.Button();
+            this.label1 = new System.Windows.Forms.Label();
+            this.SuspendLayout();
+            // 
+            // cB_updatefile
+            // 
+            this.cB_updatefile.AutoSize = true;
+            this.cB_updatefile.Location = new System.Drawing.Point(41, 64);
+            this.cB_updatefile.Name = "cB_updatefile";
+            this.cB_updatefile.Size = new System.Drawing.Size(108, 16);
+            this.cB_updatefile.TabIndex = 0;
+            this.cB_updatefile.Text = "初始化配置文件";
+            this.cB_updatefile.UseVisualStyleBackColor = true;
+            this.cB_updatefile.CheckedChanged += new System.EventHandler(this.cB_updatefile_CheckedChanged);
+            // 
+            // btn_OK
+            // 
+            this.btn_OK.Location = new System.Drawing.Point(214, 92);
+            this.btn_OK.Name = "btn_OK";
+            this.btn_OK.Size = new System.Drawing.Size(75, 23);
+            this.btn_OK.TabIndex = 1;
+            this.btn_OK.Text = "OK";
+            this.btn_OK.UseVisualStyleBackColor = true;
+            this.btn_OK.Click += new System.EventHandler(this.btn_OK_Click);
+            // 
+            // btn_CANCEL
+            // 
+            this.btn_CANCEL.Location = new System.Drawing.Point(307, 92);
+            this.btn_CANCEL.Name = "btn_CANCEL";
+            this.btn_CANCEL.Size = new System.Drawing.Size(75, 23);
+            this.btn_CANCEL.TabIndex = 2;
+            this.btn_CANCEL.Text = "CANCEL";
+            this.btn_CANCEL.UseVisualStyleBackColor = true;
+            this.btn_CANCEL.Click += new System.EventHandler(this.btn_CANCEL_Click);
+            // 
+            // label1
+            // 
+            this.label1.AutoSize = true;
+            this.label1.Font = new System.Drawing.Font("宋体", 18F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.label1.Location = new System.Drawing.Point(23, 22);
+            this.label1.Name = "label1";
+            this.label1.Size = new System.Drawing.Size(285, 24);
+            this.label1.TabIndex = 3;
+            this.label1.Text = "是否确认切换系统类型?";
+            // 
+            // SwitchSystemValidation
+            // 
+            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
+            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+            this.ClientSize = new System.Drawing.Size(394, 127);
+            this.Controls.Add(this.label1);
+            this.Controls.Add(this.btn_CANCEL);
+            this.Controls.Add(this.btn_OK);
+            this.Controls.Add(this.cB_updatefile);
+            this.MaximizeBox = false;
+            this.MinimizeBox = false;
+            this.Name = "SwitchSystemValidation";
+            this.ShowIcon = false;
+            this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
+            this.Text = "SwitchSystemValidation";
+            this.Load += new System.EventHandler(this.SwitchSystemValidation_Load);
+            this.ResumeLayout(false);
+            this.PerformLayout();
+
+        }
+
+        #endregion
+
+        private System.Windows.Forms.CheckBox cB_updatefile;
+        private System.Windows.Forms.Button btn_OK;
+        private System.Windows.Forms.Button btn_CANCEL;
+        private System.Windows.Forms.Label label1;
+    }
+}

+ 48 - 0
OTSSysMgrApp/SwitchSystemValidation.cs

@@ -0,0 +1,48 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+
+namespace OTSSysMgrApp
+{
+    public partial class SwitchSystemValidation : Form
+    {
+        
+        public bool UpdateFile
+        {
+            get;
+            set;
+        }
+
+        public SwitchSystemValidation()
+        {
+            InitializeComponent();
+        }
+
+        private void SwitchSystemValidation_Load(object sender, EventArgs e)
+        {
+
+        }
+
+        private void btn_OK_Click(object sender, EventArgs e)
+        {
+            this.DialogResult = DialogResult.OK;
+            this.Close();
+        }
+
+        private void cB_updatefile_CheckedChanged(object sender, EventArgs e)
+        {
+            UpdateFile = cB_updatefile.Checked;
+        }
+
+        private void btn_CANCEL_Click(object sender, EventArgs e)
+        {
+            this.Close();
+        }
+    }
+}

+ 120 - 0
OTSSysMgrApp/SwitchSystemValidation.resx

@@ -0,0 +1,120 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+  <!-- 
+    Microsoft ResX Schema 
+    
+    Version 2.0
+    
+    The primary goals of this format is to allow a simple XML format 
+    that is mostly human readable. The generation and parsing of the 
+    various data types are done through the TypeConverter classes 
+    associated with the data types.
+    
+    Example:
+    
+    ... ado.net/XML headers & schema ...
+    <resheader name="resmimetype">text/microsoft-resx</resheader>
+    <resheader name="version">2.0</resheader>
+    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+        <value>[base64 mime encoded serialized .NET Framework object]</value>
+    </data>
+    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+        <comment>This is a comment</comment>
+    </data>
+                
+    There are any number of "resheader" rows that contain simple 
+    name/value pairs.
+    
+    Each data row contains a name, and value. The row also contains a 
+    type or mimetype. Type corresponds to a .NET class that support 
+    text/value conversion through the TypeConverter architecture. 
+    Classes that don't support this are serialized and stored with the 
+    mimetype set.
+    
+    The mimetype is used for serialized objects, and tells the 
+    ResXResourceReader how to depersist the object. This is currently not 
+    extensible. For a given mimetype the value must be set accordingly:
+    
+    Note - application/x-microsoft.net.object.binary.base64 is the format 
+    that the ResXResourceWriter will generate, however the reader can 
+    read any of the formats listed below.
+    
+    mimetype: application/x-microsoft.net.object.binary.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
+            : and then encoded with base64 encoding.
+    
+    mimetype: application/x-microsoft.net.object.soap.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+            : and then encoded with base64 encoding.
+
+    mimetype: application/x-microsoft.net.object.bytearray.base64
+    value   : The object must be serialized into a byte array 
+            : using a System.ComponentModel.TypeConverter
+            : and then encoded with base64 encoding.
+    -->
+  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
+    <xsd:element name="root" msdata:IsDataSet="true">
+      <xsd:complexType>
+        <xsd:choice maxOccurs="unbounded">
+          <xsd:element name="metadata">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" />
+              </xsd:sequence>
+              <xsd:attribute name="name" use="required" type="xsd:string" />
+              <xsd:attribute name="type" type="xsd:string" />
+              <xsd:attribute name="mimetype" type="xsd:string" />
+              <xsd:attribute ref="xml:space" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="assembly">
+            <xsd:complexType>
+              <xsd:attribute name="alias" type="xsd:string" />
+              <xsd:attribute name="name" type="xsd:string" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="data">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
+              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+              <xsd:attribute ref="xml:space" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="resheader">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" />
+            </xsd:complexType>
+          </xsd:element>
+        </xsd:choice>
+      </xsd:complexType>
+    </xsd:element>
+  </xsd:schema>
+  <resheader name="resmimetype">
+    <value>text/microsoft-resx</value>
+  </resheader>
+  <resheader name="version">
+    <value>2.0</value>
+  </resheader>
+  <resheader name="reader">
+    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+  <resheader name="writer">
+    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+</root>