Browse Source

修改报告程序无标准库名称,修改报告模板配置增加测量放大倍数

zhangjiaxin 3 years ago
parent
commit
2cb18bbfa5

+ 31 - 6
OTSIncAReportApp/1-UI/Control_Grids/ResultGrid.cs

@@ -132,6 +132,7 @@ namespace OTSIncAReportGrids
 
             }
             TimeSpan timeSpan = end - star;
+            string all_FiledCount= ((Dictionary<string, object>)((Dictionary<string, object>)((Dictionary<string, object>)resfile.ResultInfo["Sample"])["Members"])["SEMDataMsr"])["TotalFields"].ToString();
 
             int filedCount = fielddata.GetFiledCount();
             Dictionary<string, object> sampleMembers = ((Dictionary<string, object>)((Dictionary<string, object>)resfile.ResultInfo["Sample"])["Members"]);
@@ -164,9 +165,17 @@ namespace OTSIncAReportGrids
             keyValues.Add(table["col2"].ToString(), star.ToString("yyyy-MM-dd HH:mm:ss"));
             keyValues.Add(table["col3"].ToString(), end.ToString("yyyy-MM-dd HH:mm:ss"));
             keyValues.Add(table["col4"].ToString(), Math.Round(timeSpan.TotalMinutes, 2).ToString() + "mins");
-            keyValues.Add(table["col5"].ToString(), filedCount.ToString());
-
-            keyValues.Add(table["col6"].ToString(), ((Dictionary<string, object>)((Dictionary<string, object>)((Dictionary<string, object>)resfile.ResultInfo["Sample"])["Members"])["MsrParams"])["STDName"].ToString());
+            keyValues.Add(table["col5"].ToString(), all_FiledCount.ToString());
+            string LibraryName = "";
+            if ("NoSTDDB"== ((Dictionary<string, object>)((Dictionary<string, object>)((Dictionary<string, object>)resfile.ResultInfo["Sample"])["Members"])["MsrParams"])["STDName"].ToString())
+            {
+                LibraryName = "OTSIncASysSTD";
+            }
+            else
+            {
+                LibraryName = ((Dictionary<string, object>)((Dictionary<string, object>)((Dictionary<string, object>)resfile.ResultInfo["Sample"])["Members"])["MsrParams"])["STDName"].ToString();
+            }
+            keyValues.Add(table["col6"].ToString(), LibraryName);
             keyValues.Add(table["col7"].ToString(), fielddata.GetparticleCount().ToString());
             keyValues.Add(table["col8"].ToString(), filedsArea.ToString());
             keyValues.Add(table["col9"].ToString(), particleArea.ToString());
@@ -209,7 +218,12 @@ namespace OTSIncAReportGrids
 
             }
             TimeSpan timeSpan = end - star;
-
+            string all_FiledCount = ((Dictionary<string, object>)((Dictionary<string, object>)((Dictionary<string, object>)resfile.ResultInfo["Sample"])["Members"])["SEMDataMsr"])["TotalFields"].ToString();
+            //当前屏幕尺寸/µm
+            double  ScanFieldSize = Convert.ToDouble( ((Dictionary<string, object>)((Dictionary<string, object>)((Dictionary<string, object>)resfile.ResultInfo["Sample"])["Members"])["SEMDataMsr"])["ScanFieldSize"]);
+            //100倍时屏幕尺寸/µm
+            double  ScanFieldSize100 =  Convert.ToDouble(((Dictionary<string, object>)((Dictionary<string, object>)((Dictionary<string, object>)resfile.ResultInfo["Sample"])["Members"])["SEMDataMsr"])["ScanFieldSize100"]);
+            double  Magnification = ScanFieldSize100 / ScanFieldSize * 100;
             int filedCount = fielddata.GetFiledCount();
             Dictionary<string, object> sampleMembers = ((Dictionary<string, object>)((Dictionary<string, object>)resfile.ResultInfo["Sample"])["Members"]);
             Dictionary<string, object> semDataMsr = (Dictionary<string, object>)sampleMembers["SEMDataMsr"];
@@ -241,15 +255,26 @@ namespace OTSIncAReportGrids
             keyValues.Add(table["col2"].ToString(), star.ToString("yyyy-MM-dd HH:mm:ss"));
             keyValues.Add(table["col3"].ToString(), end.ToString("yyyy-MM-dd HH:mm:ss"));
             keyValues.Add(table["col4"].ToString(), Math.Round(timeSpan.TotalMinutes, 2).ToString() + "mins");
-            keyValues.Add(table["col5"].ToString(), filedCount.ToString());
+            keyValues.Add(table["col5"].ToString(), all_FiledCount.ToString());
+
+            string LibraryName = "";
+            if ("NoSTDDB" == ((Dictionary<string, object>)((Dictionary<string, object>)((Dictionary<string, object>)resfile.ResultInfo["Sample"])["Members"])["MsrParams"])["STDName"].ToString())
+            {
+                LibraryName = "OTSIncASysSTD";
+            }
+            else
+            {
+                LibraryName = ((Dictionary<string, object>)((Dictionary<string, object>)((Dictionary<string, object>)resfile.ResultInfo["Sample"])["Members"])["MsrParams"])["STDName"].ToString();
+            }
 
-            keyValues.Add(table["col6"].ToString(), ((Dictionary<string, object>)((Dictionary<string, object>)((Dictionary<string, object>)resfile.ResultInfo["Sample"])["Members"])["MsrParams"])["STDName"].ToString());
+            keyValues.Add(table["col6"].ToString(), LibraryName);
             keyValues.Add(table["col7"].ToString(), fielddata.GetparticleCount().ToString());
             keyValues.Add(table["col8"].ToString(), filedsArea.ToString());
             keyValues.Add(table["col9"].ToString(), particleArea.ToString());
             keyValues.Add(table["col10"].ToString(), ratio.ToString());
 
             keyValues.Add(table["col11"].ToString(), sizestr);
+            keyValues.Add("Magnification", Math.Round(Magnification,2).ToString());
 
             return keyValues;
         }

+ 207 - 0
OTSIncAReportApp/1-UI/ElementSubscript.cs

@@ -0,0 +1,207 @@
+using OTSRptPeriodicTable;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace OTSIncAReportApp._1_UI
+{
+    public  class ElementSubscript
+    {
+        List<subscript> subscripts = GetListsubscript();
+
+        private static List<subscript> GetListsubscript()
+        {
+            List<subscript> List_subscript = new List<subscript>();
+            subscript ls_subscript = new subscript();
+
+            ls_subscript = new subscript();
+            ls_subscript.Name = "0";
+            ls_subscript.NumEntity = "&#8320";
+            ls_subscript.HexEntity = "\x2080";
+            ls_subscript.CharactrName = "SUBSCRIPT ZERO";
+            List_subscript.Add(ls_subscript);
+
+            ls_subscript = new subscript();
+            ls_subscript.Name = "1";
+            ls_subscript.NumEntity = "&#8321";
+            ls_subscript.HexEntity = "\x2081";
+            ls_subscript.CharactrName = "SUBSCRIPT ONE";
+            List_subscript.Add(ls_subscript);
+
+            ls_subscript = new subscript();
+            ls_subscript.Name = "2";
+            ls_subscript.NumEntity = "&#8322";
+            ls_subscript.HexEntity = "\x2082";
+            ls_subscript.CharactrName = "SUBSCRIPT TWO";
+            List_subscript.Add(ls_subscript);
+
+            ls_subscript = new subscript();
+            ls_subscript.Name = "3";
+            ls_subscript.NumEntity = "&#8323";
+            ls_subscript.HexEntity = "\x2083";
+            ls_subscript.CharactrName = "SUBSCRIPT THREE";
+            List_subscript.Add(ls_subscript);
+
+            ls_subscript = new subscript();
+            ls_subscript.Name = "4";
+            ls_subscript.NumEntity = "&#8324";
+            ls_subscript.HexEntity = "\x2084";
+            ls_subscript.CharactrName = "SUBSCRIPT FOUR";
+            List_subscript.Add(ls_subscript);
+
+            ls_subscript = new subscript();
+            ls_subscript.Name = "5";
+            ls_subscript.NumEntity = "&#8325";
+            ls_subscript.HexEntity = "\x2085";
+            ls_subscript.CharactrName = "SUBSCRIPT FIVE";
+            List_subscript.Add(ls_subscript);
+
+            ls_subscript = new subscript();
+            ls_subscript.Name = "6";
+            ls_subscript.NumEntity = "&#8326";
+            ls_subscript.HexEntity = "\x2086";
+            ls_subscript.CharactrName = "SUBSCRIPT SIX";
+            List_subscript.Add(ls_subscript);
+
+            ls_subscript = new subscript();
+            ls_subscript.Name = "7";
+            ls_subscript.NumEntity = "&#8327";
+            ls_subscript.HexEntity = "\x2087";
+            ls_subscript.CharactrName = "SUBSCRIPT SEVEN";
+            List_subscript.Add(ls_subscript);
+
+            ls_subscript = new subscript();
+            ls_subscript.Name = "8";
+            ls_subscript.NumEntity = "&#8328";
+            ls_subscript.HexEntity = "\x2088";
+            ls_subscript.CharactrName = "SUBSCRIPT EIGHT";
+            List_subscript.Add(ls_subscript);
+
+            ls_subscript = new subscript();
+            ls_subscript.Name = "9";
+            ls_subscript.NumEntity = "&#8329";
+            ls_subscript.HexEntity = "\x2089";
+            ls_subscript.CharactrName = "SUBSCRIPT NINE";
+            List_subscript.Add(ls_subscript);
+
+            return List_subscript;
+        }
+
+        /// <summary>
+        /// 将数字转换成下标转义符
+        /// </summary>
+        /// <param name="str"></param>
+        /// <returns></returns>
+        private string Getsubscript(string str)
+        {
+            if (subscripts.Count==0)
+            {
+                subscripts = GetListsubscript();
+            }
+            for (int i=0;i< subscripts.Count;i++)
+            {
+                if (subscripts[i].Name==str)
+                {
+                    return subscripts[i].HexEntity;
+                }
+            }
+            return "";
+        }
+
+        public string Getsubscriptstring(string str)
+        {
+            string[] strarray = str.Split('-');
+            string strSubscript = "";
+            for (int j=0;j< strarray.Length;j++)
+            {
+                char[] strCharArr = strarray[j].ToCharArray();
+                string Escape = "";
+                for (int i = 0; i < strCharArr.Length; i++)
+                {
+                    if (i < 2)
+                    {
+                        Escape = Escape + strCharArr[i];
+                        continue;
+                    }
+                    else
+                    {
+                        if (System.Text.RegularExpressions.Regex.IsMatch(strCharArr[i].ToString(), @"^[+-]?\d*[.]?\d*$"))
+                        {
+                            Escape = Escape + Getsubscript(strCharArr[i].ToString());
+                        }
+                        else
+                        {
+                            Escape = Escape + strCharArr[i];
+                        }
+                    }
+                }
+                strSubscript = strSubscript + Escape+"-";
+            }
+
+
+
+            string[] vs = strSubscript.Split('-');
+            string output = "";
+
+
+         
+
+            
+            if (vs.Length>2)
+            {
+                for (int i = 0; i < vs.Length - 1; i++)
+                {
+                    if (i == vs.Length - 2)
+                    {
+                        output = output + vs[i].ToString();
+                    }
+                    else
+                    {
+                        output = output + vs[i].ToString() + "-";
+                    }
+
+                }
+            }
+            else
+            {
+               
+                for (int i = 0; i < vs.Length - 1; i++)
+                {
+                    output = output + vs[i].ToString();
+                }
+            }
+
+
+            return output;
+        }
+    }
+    public class subscript
+    {
+        string _Name;//正常显示字符
+        string _NumEntity;//
+        string _HexEntity;//十六进制
+        string _CharactrName;
+        public string Name
+        {
+            get { return _Name; }
+            set { _Name = value; }
+        }
+        public string NumEntity
+        {
+            get { return _NumEntity; }
+            set { _NumEntity = value; }
+        }
+        public string HexEntity
+        {
+            get { return _HexEntity; }
+            set { _HexEntity = value; }
+        }
+        public string CharactrName
+        {
+            get { return _CharactrName; }
+            set { _CharactrName = value; }
+        }
+    }
+}

+ 9 - 6
OTSIncAReportApp/1-UI/OTSMgrInfo/Triangulation_Edit.cs

@@ -1,4 +1,5 @@
-using OTSRptPeriodicTable;
+using OTSIncAReportApp._1_UI;
+using OTSRptPeriodicTable;
 using System;
 using System.Collections.Generic;
 using System.Data;
@@ -100,11 +101,13 @@ namespace OTSIncAReportApp.OTSMgrInfo
                 MessageBox.Show("Please enter full information!");
                 return;
             }
-            string TemplateName = txtType1.Text.Trim() + "." + txtType2.Text.Trim() + "." + txtType3.Text.Trim();
-            string Element = cboElement1.Text + "." + txtElement2.Text.Trim() + "." + cboElement3.Text;
-            string Group = txtType1.Text.Trim() + "-" + cboElement1.Text + "." +
-                            txtType2.Text.Trim() + "-" + txtElement2.Text.Trim() + "." +
-                            txtType3.Text.Trim() + "-" + cboElement3.Text;
+            ElementSubscript subscript = new ElementSubscript();
+            //subscript.Getsubscriptstring(txtType3.Text.Trim());
+            string TemplateName = subscript.Getsubscriptstring(txtType1.Text.Trim()) + "." + subscript.Getsubscriptstring(txtType2.Text.Trim()) + "." + subscript.Getsubscriptstring(txtType3.Text.Trim());
+            string Element = subscript.Getsubscriptstring( cboElement1.Text) + "." + subscript.Getsubscriptstring(txtElement2.Text.Trim()) + "." + subscript.Getsubscriptstring(cboElement3.Text);
+            string Group = subscript.Getsubscriptstring(txtType1.Text.Trim()) + "-" + subscript.Getsubscriptstring(cboElement1.Text) + "." +
+                            subscript.Getsubscriptstring(txtType2.Text.Trim()) + "-" + subscript.Getsubscriptstring(txtElement2.Text.Trim()) + "." +
+                            subscript.Getsubscriptstring(txtType3.Text.Trim()) + "-" + subscript.Getsubscriptstring(cboElement3.Text);
 
             //获取三元相图模板配置文件
             string pathe = m_frmReportApp.m_rstDataMgr.m_RptConfigFile.TrigTemplateFileFolder + "\\" + m_frmReportApp.m_rstDataMgr.m_RptConfigFile.TriTempFile;

+ 15 - 5
OTSIncAReportApp/1-UI/OTSTemplateDesigner/Export_ReportTemplate.cs

@@ -1,4 +1,5 @@
-using OTSIncAReportApp.Control_ECharts;
+using OTSIncAReportApp._1_UI;
+using OTSIncAReportApp.Control_ECharts;
 using OTSIncAReportApp.DataOperation.DataAccess;
 using OTSIncAReportApp.DataOperation.Model;
 using OTSIncAReportGraph.Controls;
@@ -80,6 +81,7 @@ namespace OTSIncAReportApp.OTSTemplateDesigner
                 string str_FLFA = "";
                 string str_YJCTZ = "";
                 string str_SCMJ = "";
+            string Magnification = "";
                 string str_CKBZ = "GB/T30834-2014";
 
                 keyValues_ResultGrid.TryGetValue(ls_resultgrid.table["col1"].ToString(), out str_CLJGMC);//测量结果名称
@@ -89,8 +91,10 @@ namespace OTSIncAReportApp.OTSTemplateDesigner
                 keyValues_ResultGrid.TryGetValue(ls_resultgrid.table["col7"].ToString(), out str_YJCTZ);//已检测特征
                 keyValues_ResultGrid.TryGetValue(ls_resultgrid.table["col8"].ToString(), out str_SCMJ);//视场面积
 
-                //将获取到的数据转换成报告模板能接收的格式。
-                DataTable ls_new_dt = new DataTable();
+            keyValues_ResultGrid.TryGetValue("Magnification", out Magnification);//放大倍数
+
+            //将获取到的数据转换成报告模板能接收的格式。
+            DataTable ls_new_dt = new DataTable();
                 ls_new_dt.TableName = "ResultGrid";
                 ls_new_dt.Columns.Add("CLJGMC"); //测量结果名称
                 ls_new_dt.Columns.Add("YXSJ");      //运行时间
@@ -99,6 +103,7 @@ namespace OTSIncAReportApp.OTSTemplateDesigner
                 ls_new_dt.Columns.Add("YJCTZ");     //已检测特征
                 ls_new_dt.Columns.Add("SCMJ");      //视场面积
                 ls_new_dt.Columns.Add("CKBZ");      //参考标准
+            ls_new_dt.Columns.Add("FDBS");
 
                 //行转列,这里不会发生改变,所以这样写
                 DataRow dr = ls_new_dt.NewRow();
@@ -109,8 +114,8 @@ namespace OTSIncAReportApp.OTSTemplateDesigner
                 dr["YJCTZ"] = str_YJCTZ;
                 dr["SCMJ"] = str_SCMJ;
                 dr["CKBZ"] = str_CKBZ;
-
-                ls_new_dt.Rows.Add(dr);
+            dr["FDBS"] = Magnification;
+            ls_new_dt.Rows.Add(dr);
 
                 m_list_dt.Add(ls_new_dt);
                 return ls_new_dt;
@@ -227,6 +232,11 @@ namespace OTSIncAReportApp.OTSTemplateDesigner
                 }
                 m_bt_DBData.Rows.Add(dr);
             }
+            //ElementSubscript subscript = new ElementSubscript();
+            //for (int i=0;i< m_bt_DBData.Rows.Count;i++)
+            //{
+            //    m_bt_DBData.Rows[i]["TypeName"] = subscript.Getsubscriptstring(m_bt_DBData.Rows[i]["TypeName"].ToString());
+            //}
 
             return true;
         }

+ 4 - 4
OTSIncAReportApp/1-UI/OTSTemplateDesigner/OTSReport_Export.cs

@@ -1329,8 +1329,8 @@ namespace OTSIncAReportApp
             //try
             //{
                 //创建表 ResultGrid
-                string[] strcolumns_ResultGrid = { "CLJGMC", "YXSJ", "SCZS", "FLFA", "YJCTZ", "SCMJ", "CKBZ" };
-                string[] strcoltypes_ResultGrid = { "TEXT", "TEXT", "TEXT", "TEXT", "TEXT", "TEXT", "TEXT" };
+                string[] strcolumns_ResultGrid = { "CLJGMC", "YXSJ", "SCZS", "FLFA", "YJCTZ", "SCMJ", "CKBZ" , "FDBS" };
+                string[] strcoltypes_ResultGrid = { "TEXT", "TEXT", "TEXT", "TEXT", "TEXT", "TEXT", "TEXT" , "TEXT" };
 
 
                 //创建表 Largest_frame
@@ -2287,8 +2287,8 @@ namespace OTSIncAReportApp
             SQLiteTransaction tr = sh.BeginTranscation();
            
                 //创建表 ResultGrid
-                string[] strcolumns_ResultGrid = { "CLJGMC", "YXSJ", "SCZS", "FLFA", "YJCTZ", "SCMJ", "CKBZ" };
-                string[] strcoltypes_ResultGrid = { "TEXT", "TEXT", "TEXT", "TEXT", "TEXT", "TEXT", "TEXT" };
+                string[] strcolumns_ResultGrid = { "CLJGMC", "YXSJ", "SCZS", "FLFA", "YJCTZ", "SCMJ", "CKBZ", "FDBS" };
+                string[] strcoltypes_ResultGrid = { "TEXT", "TEXT", "TEXT", "TEXT", "TEXT", "TEXT", "TEXT" , "TEXT" };
                 sh.CreateTable("ResultGrid", strcolumns_ResultGrid, strcoltypes_ResultGrid);
 
                 //创建表 GB1_A

+ 1 - 0
OTSIncAReportApp/OTSIncAReportApp.csproj

@@ -276,6 +276,7 @@
     <Reference Include="System.Xml" />
   </ItemGroup>
   <ItemGroup>
+    <Compile Include="1-UI\ElementSubscript.cs" />
     <Compile Include="1-UI\frmCharts.cs">
       <SubType>Form</SubType>
     </Compile>