Selaa lähdekoodia

Add the automatic particle size table.

cxs 1 viikko sitten
vanhempi
commit
7c4684785e

+ 84 - 8
OTSIncAReportApp/1-UI/Control_DEVCharts/DEVChart_Trianglediagram.cs

@@ -65,7 +65,7 @@ namespace OTSIncAReportApp.Control_ECharts
             { //三元相图模板
                 template = m_condition.m_conditionData.GetPropItemDisplayValueByPropItemName(OTS_REPORT_PROP_GRID_ITEMS.TRIO_CHART_TYPE).ToString();
             }
-            //获取粒级表
+            
             string pathtpf = Application.StartupPath + "\\Config\\ProData\\DefaultTriTemplateFile.tpf";
             List<string> nameList = new List<string>();
             DataSet ds = XMLoperate.GetXmlData(pathtpf, "XMLData");
@@ -74,9 +74,47 @@ namespace OTSIncAReportApp.Control_ECharts
             //设置标签名称
             List<string> listName = new List<string>();
             //获取粒级表
-            string pathe = m_DataMgr.m_RptConfigFile.PartSizeFileFolder + m_DataMgr.m_RptConfigFile.PartSizeFile;
-            DataSet ds2 = XMLoperate.GetXml(pathe);
-            string sizestr = ds2.Tables[0].Rows[0]["Sizes"].ToString();
+            string sizestr = "";
+            if (m_ReportApp.m_rstDataMgr.m_RptConfigFile.PartSizeFile == "AUTO.psf")
+            {
+                double dn = 99999;
+                string sou1 = m_condition.m_CurrentConditions[OTS_REPORT_PROP_GRID_ITEMS.DATA_SOURCE].itemDisplayVal.ToString();
+                if (sou1.Contains("+"))
+                {
+                    for (int i = 0; i < sou1.Split('+').Length; i++)
+                    {
+                        ResultFile resultFile = m_ReportApp.m_rstDataMgr.ResultFilesList.Find(s => s.anotherFileName == sou1.Split('+')[i]);
+                        if (resultFile != null)
+                        {
+                            if (dn > resultFile.GetParticleMINECD())
+                            {
+                                dn = resultFile.GetParticleMINECD();
+                            }
+                        }
+                    }
+                }
+                else
+                {
+                    ResultFile resultFile = m_ReportApp.m_rstDataMgr.CurResultFile;
+                    dn = resultFile.GetParticleMINECD();
+                }
+                sizestr = dn.ToString() + ",";
+                for (double p = dn; p < 50; p = p * Math.Sqrt(2))
+                {
+                    if (p > dn && p <= 50.5)
+                    {
+                        double dd = Math.Round(p);
+                        sizestr += dd.ToString() + ",";
+                    }
+                }
+                sizestr = sizestr.Remove(sizestr.Length - 1, 1);
+            }
+            else
+            {
+                string pathe = m_DataMgr.m_RptConfigFile.PartSizeFileFolder + m_DataMgr.m_RptConfigFile.PartSizeFile;
+                DataSet ds2 = XMLoperate.GetXml(pathe);
+                sizestr = ds2.Tables[0].Rows[0]["Sizes"].ToString();
+            }
             for (int i = 0; i < sizestr.Split(',').Length - 1; i++)
             {
                 if (sizestr.Split(',')[i].Length > 0)
@@ -492,11 +530,49 @@ namespace OTSIncAReportApp.Control_ECharts
             ParticleData particledata = new ParticleData(filepath);
             //设置标签名称
             List<string> listName = new List<string>();
-            //获取粒级表
-            string pathe = m_DataMgr.m_RptConfigFile.PartSizeFileFolder + m_DataMgr.m_RptConfigFile.PartSizeFile;
-            DataSet ds = XMLoperate.GetXml(pathe);
-            string sizestr = ds.Tables[0].Rows[0]["Sizes"].ToString();
 
+            //获取粒级表
+            string sizestr = "";
+            if (m_ReportApp.m_rstDataMgr.m_RptConfigFile.PartSizeFile == "AUTO.psf")
+            {
+                double dn = 99999;
+                string sou1 = m_condition.m_CurrentConditions[OTS_REPORT_PROP_GRID_ITEMS.DATA_SOURCE].itemDisplayVal.ToString();
+                if (sou1.Contains("+"))
+                {
+                    for (int i = 0; i < sou1.Split('+').Length; i++)
+                    {
+                        ResultFile resultFile = m_ReportApp.m_rstDataMgr.ResultFilesList.Find(s => s.anotherFileName == sou1.Split('+')[i]);
+                        if (resultFile != null)
+                        {
+                            if (dn > resultFile.GetParticleMINECD())
+                            {
+                                dn = resultFile.GetParticleMINECD();
+                            }
+                        }
+                    }
+                }
+                else
+                {
+                    ResultFile resultFile = m_ReportApp.m_rstDataMgr.CurResultFile;
+                    dn = resultFile.GetParticleMINECD();
+                }
+                sizestr = dn.ToString() + ",";
+                for (double p = dn; p < 50; p = p * Math.Sqrt(2))
+                {
+                    if (p > dn && p <= 50.5)
+                    {
+                        double dd = Math.Round(p);
+                        sizestr += dd.ToString() + ",";
+                    }
+                }
+                sizestr = sizestr.Remove(sizestr.Length - 1, 1);
+            }
+            else
+            {
+                string pathe = m_DataMgr.m_RptConfigFile.PartSizeFileFolder + m_DataMgr.m_RptConfigFile.PartSizeFile;
+                DataSet ds = XMLoperate.GetXml(pathe);
+                sizestr = ds.Tables[0].Rows[0]["Sizes"].ToString();
+            }
             for (int i = 0; i < sizestr.Split(',').Length - 1; i++)
             {
                 if (sizestr.Split(',')[i].Length > 0)

+ 77 - 40
OTSIncAReportApp/1-UI/Control_Grids/ParticlesSizeGrid.cs

@@ -45,7 +45,9 @@ namespace OTSIncAReportGrids
         List<string> list_fileName = new List<string>();
 		#endregion
 
-		#region 自定义方法
+		
+        
+        #region 自定义方法
 
 		private string getWhere(string max, string min, string col, string partic)
         {
@@ -65,17 +67,83 @@ namespace OTSIncAReportGrids
         /// </summary>
         public void BindDataGridView(string path, int num, string filename)
         {
-
             List<string> colid = new List<string>() { "rowid", "pname", "color", "TypeId", "Largest", "Total" };
             List<string> colname = new List<string>() { table["str1"].ToString(), table["str8"].ToString(), table["str9"].ToString(), "TypeId", table["str10"].ToString(), table["str11"].ToString() };
 
             OTSGridView gridView = new OTSGridView();
-
             OTSIncAReportApp.DataOperation.DataAccess.ParticleData particledata = new OTSIncAReportApp.DataOperation.DataAccess.ParticleData(path);
+
+
+
+            DataTable dtp = particledata.GetParticleAll("");
+            string sizestr = null;
+            string con = "";
+            if (condition != "")
+            {
+                con = condition;
+            }
+            else
+            {
+                con = source.GetPropItemDisplayValueByPropItemName(OTS_REPORT_PROP_GRID_ITEMS.SIZE_CAL_METHOD_TYPE).ToString();
+            }
+
+            string po = "";
+            switch (con)
+            {
+                case "DMAX":
+                    po = "DMAX";
+                    break;
+                case "DMIN":
+                    po = "DMIN";
+                    break;
+                case "ECD":
+                    po = "Area";
+                    break;
+                case "FERET":
+                    po = "DFERET";
+                    break;
+            }
             //获取粒级表
-            string path1 = m_ReportApp.m_rstDataMgr.m_RptConfigFile.PartSizeFileFolder + m_ReportApp.m_rstDataMgr.m_RptConfigFile.PartSizeFile;
-            DataSet ds = OTSIncAReportApp.DataOperation.DataAccess.XMLoperate.GetXml(path1);
-            string sizestr = ds.Tables[0].Rows[0]["Sizes"].ToString();
+            if (m_ReportApp.m_rstDataMgr.m_RptConfigFile.PartSizeFile == "AUTO.psf")
+            {
+                double dn = 99999;
+                string sou = source.GetPropItemDisplayValueByPropItemName(OTS_REPORT_PROP_GRID_ITEMS.DATA_SOURCE).ToString();
+                if (sou.Contains("+"))
+                {
+                    for (int i = 0; i < sou.Split('+').Length; i++)
+                    {
+                        ResultFile resultFile = m_ReportApp.m_rstDataMgr.ResultFilesList.Find(s => s.anotherFileName == sou.Split('+')[i]);
+                        if (resultFile != null)
+                        {
+                            if(dn> resultFile.GetParticleMINECD())
+                            {
+                                dn = resultFile.GetParticleMINECD();
+                            }
+                        }
+                    }
+                }
+                else
+                {
+                    ResultFile resultFile = m_ReportApp.m_rstDataMgr.CurResultFile;
+                    dn = resultFile.GetParticleMINECD();
+                }
+                sizestr = dn.ToString()+",";
+                for(double p= dn; p<50;p=p * Math.Sqrt(2))
+                {
+                    if(p > dn&& p <= 50.5)
+                    {
+                        double dd = Math.Round(p);
+                        sizestr += dd.ToString() + ",";
+                    }
+                }
+                sizestr = sizestr.Remove(sizestr.Length - 1, 1);
+            }
+            else
+            {
+                string path1 = m_ReportApp.m_rstDataMgr.m_RptConfigFile.PartSizeFileFolder + m_ReportApp.m_rstDataMgr.m_RptConfigFile.PartSizeFile;
+                DataSet ds = OTSIncAReportApp.DataOperation.DataAccess.XMLoperate.GetXml(path1);
+                sizestr = ds.Tables[0].Rows[0]["Sizes"].ToString();
+            }
 
             for (int i = 0; i < sizestr.Split(',').Length - 1; i++)
             {
@@ -184,34 +252,8 @@ namespace OTSIncAReportGrids
                 m_dt.Rows[add_rowindex]["Class"] = dt.Rows[i]["GroupName"];
             }
 
-            DataTable dtp = particledata.GetParticleAll(filedAndParticl);
-            string con = "";
-            if (condition != "")
-            {
-                con = condition;
-            }
-            else
-            {
-                //idx = m_ReportApp.m_DataMgrFun.GetPropIndexByPropItemName(m_ReportApp.SourceGridData.ConditionItemList, OTSIncAReportApp.OTSSampleReportInfo.OTS_REPORT_PROP_GRID_ITEMS.SIZE_CAL_METHOD_TYPE);
-                con = source.GetPropItemDisplayValueByPropItemName(OTS_REPORT_PROP_GRID_ITEMS.SIZE_CAL_METHOD_TYPE).ToString();
-            }
-
-            string po = "";
-            switch (con)
-            {
-                case "DMAX":
-                    po = "DMAX";
-                    break;
-                case "DMIN":
-                    po = "DMIN";
-                    break;
-                case "ECD":
-                    po = "Area";
-                    break;
-                case "FERET":
-                    po = "DFERET";
-                    break;
-            }
+            
+            
             for (int i = 0; i < gridView.Rows.Count - 1; i++)
             {
                 for (int j = 6; j < colid.Count; j++)
@@ -370,6 +412,7 @@ namespace OTSIncAReportGrids
             list_table_Point.Clear();
             list_fileName.Clear();
 	
+
 			string sou = source.GetPropItemDisplayValueByPropItemName(OTS_REPORT_PROP_GRID_ITEMS.DATA_SOURCE).ToString();
             if (sou.Contains("+"))
             {
@@ -396,12 +439,6 @@ namespace OTSIncAReportGrids
                  
                 }
             }
-
-
-            for (int i = 0; i < list_table_data.Count; i++)
-            { 
-            
-            }
         }
 
         public void SetGraphicType(ReportCondition sourceGridData)

+ 0 - 5
OTSIncAReportApp/1-UI/OTSDisplaySourceGridData/frmReportConditionChoose.cs

@@ -526,11 +526,6 @@ namespace OTSIncAReportApp
                 {
                     var sampleData1 = m_CurrentConditions[OTS_REPORT_PROP_GRID_ITEMS.DATA_SOURCE_TYPE];
                     list.Insert(2, sampleData1);
-					var sampleDataA5 = m_CurrentConditions[OTS_REPORT_PROP_GRID_ITEMS.GRAPHIC_TYPE];
-					list.Add(sampleDataA5);
-					//all particle types
-					//var stditm = m_CurrentConditions[OTS_REPORT_PROP_GRID_ITEMS.STD_ID];
-					//list.Add(stditm);
 				}
                 if ((int)sampleData3.itemVal == (int)CALCULATE_TABLE_TYPE.TRIO_CHART)
                 {

+ 11 - 13
OTSIncAReportApp/1-UI/OTSMgrInfo/frmReportSysConfig.cs

@@ -1,5 +1,4 @@
 using OTSCommon;
-
 using OTSIncAReportApp;
 using OTSIncAReportApp.Controls;
 using OTSIncAReportApp.OTSRstMgrFunction;
@@ -11,6 +10,8 @@ using System.IO;
 using System.Windows.Forms;
 using Language = OTSIncAReportApp.SysMgrTools.Language;
 
+
+
 namespace OTSIncAReprotCharts
 {
     public partial class frmReportSysConfig : Form
@@ -53,9 +54,9 @@ namespace OTSIncAReprotCharts
         #endregion
 
         #region 自定义方法
-
         public void InitData()
         {
+
             DirectoryInfo theFolder = new DirectoryInfo(strbpath);
             if (!theFolder.Exists)
                 return;
@@ -70,6 +71,7 @@ namespace OTSIncAReprotCharts
                     comboBox_PartiSizeFileFolder.Items.Add(nextifile.Name);
                 }
             }
+            comboBox_PartiSizeFileFolder.Items.Add("AUTO.psf");
             
 
             cB_sjtmbwj.Items.Clear();
@@ -78,7 +80,6 @@ namespace OTSIncAReprotCharts
 
             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());
@@ -242,18 +243,15 @@ namespace OTSIncAReprotCharts
                 MessageBox.Show("please check params!");
             }
 
-
-
-
-
-
-            //根据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());
+            if(comboBox_PartiSizeFileFolder.Text.ToString()!= "AUTO.psf")
+            {
+                //根据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, "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());

+ 28 - 9
OTSIncAReportApp/2-CommonFunction/OTSRstMgrFunction/ResultDataMgr.cs

@@ -201,7 +201,7 @@ namespace OTSIncAReportApp.OTSRstMgrFunction
                     ret_list.Add(nextifile.Name);
                 }
             }
-
+            ret_list.Add("AUTO.psf");
             return ret_list;
         }
         public List<string> GetSTDIdList()
@@ -226,16 +226,35 @@ namespace OTSIncAReportApp.OTSRstMgrFunction
             return stdSet.ToList();
 
         }
-            /// <summary>
-            /// 根据系统设置默认的粒级表的路径,获取粒级表List
-            /// </summary>
-            /// <param name="path"></param>
-            /// <returns></returns>
-            public List<string> GetPartSizeList()
+        /// <summary>
+        /// 根据系统设置默认的粒级表的路径,获取粒级表List
+        /// </summary>
+        /// <param name="path"></param>
+        /// <returns></returns>
+        public List<string> GetPartSizeList()
         {
-            DataSet ds = DataOperation.DataAccess.XMLoperate.GetXml(m_RptConfigFile.PartSizeFileFolder + m_RptConfigFile.PartSizeFile);
-            string sizestr = ds.Tables[0].Rows[0]["Sizes"].ToString();
+            string sizestr = "";
             List<string> sizeList = new List<string>();
+            if (m_RptConfigFile.PartSizeFile != "AUTO.psf")
+            {
+                DataSet ds = DataOperation.DataAccess.XMLoperate.GetXml(m_RptConfigFile.PartSizeFileFolder + m_RptConfigFile.PartSizeFile);
+                sizestr = ds.Tables[0].Rows[0]["Sizes"].ToString();
+            }
+            else
+            {
+                double dn;
+                dn = m_curResultFile.GetParticleMINECD();
+                sizestr = dn.ToString() + ",";
+                for (double p = dn; p < 50; p = p * Math.Sqrt(2))
+                {
+                    if (p > dn && p <= 50.5)
+                    {
+                        double dd = Math.Round(p);
+                        sizestr += dd.ToString() + ",";
+                    }
+                }
+                sizestr = sizestr.Remove(sizestr.Length - 1, 1);
+            }
             for (int i = 0; i < sizestr.Split(',').Length - 1; i++)
             {
                 if (sizestr.Split(',')[i].Length > 0)

+ 12 - 0
OTSIncAReportApp/2-CommonFunction/OTSRstMgrFunction/ResultFile.cs

@@ -288,6 +288,18 @@ namespace OTSIncAReportApp.OTSRstMgrFunction
             string ResultDbPath = FilePath + "\\FIELD_FILES\\Inclusion.db";
             return ResultDbPath;
         }
+        public double GetParticleMINECD()
+        {
+            Dictionary<string, object> sampleMembers = ((Dictionary<string, object>)((Dictionary<string, object>)ResultInfo["Sample"])["Members"]);
+            Dictionary<string, object> MsrParams = (Dictionary<string, object>)sampleMembers["MsrParams"];
+            Dictionary<string, object> ImageProcessParam = ((Dictionary<string, object>)((Dictionary<string, object>)MsrParams["Members"])["ImageProcessParam"]);
+            Dictionary<string, object> Members = (Dictionary<string, object>)MsrParams["Members"];
+            Dictionary<string, object> IPP = ((Dictionary<string, object>)((Dictionary<string, object>)MsrParams["Members"])["ImageProcessParam"]);
+            Dictionary<string, object> IncArea = ((Dictionary<string, object>)((Dictionary<string, object>)IPP["Members"])["IncArea"]);
+            double dparticleMINECD = float.Parse(IncArea["start"].ToString());
+            return dparticleMINECD;
+        }
+
         public string FileId
         {
             get;