浏览代码

报告程序更新分布图导出(后台线程,log提示),

zhangjiaxin 3 年之前
父节点
当前提交
44350be220

+ 4 - 4
Bin/x64/Debug/Config/ProData/ReportTemplateConfig.xml

@@ -1,17 +1,17 @@
 <XmlConfig>
   <M_SY>
-    <str_tb_ZBT>Inclusions Analysis </str_tb_ZBT>
-    <str_tb_FBT>XXXXXXCompany</str_tb_FBT>
+    <str_tb_ZBT>Cleanness Analysis </str_tb_ZBT>
+    <str_tb_FBT>XXXXXX有限公司</str_tb_FBT>
     <str_tb_YPBH>0001</str_tb_YPBH>
     <str_tb_CKBZ>VDA19 ISO16232</str_tb_CKBZ>
     <b_ck_ypsm>True</b_ck_ypsm>
     <b_ck_jggk>True</b_ck_jggk>
   </M_SY>
   <M_YMYJ>
-    <str_tb_ymwb>Inclusion Analysis </str_tb_ymwb>
+    <str_tb_ymwb>清洁度分析报告</str_tb_ymwb>
     <str_tb_KHH>Copi0000123012</str_tb_KHH>
     <b_ck_ym>True</b_ck_ym>
-    <str_tb_yjwb>Inclusion Analysis </str_tb_yjwb>
+    <str_tb_yjwb>清洁度分析报告</str_tb_yjwb>
   </M_YMYJ>
   <M_KLFXJG>
     <b_ck_klcc_xsmk>True</b_ck_klcc_xsmk>

二进制
Bin/x64/Debug/Resources/ReportTemplate/Cleanness.rmf


二进制
Bin/x64/Debug/Resources/ReportTemplate/group1.rmf


+ 0 - 1
Bin/x64/Debug/Resources/XMLData/ResourceForMeasureSourceGrid-EN.xml

@@ -91,7 +91,6 @@
 			<member itemKey="20036" itemName="" itemText="QuantifyThreshold(EqualCircle/um)" description="进行X-ray quantify 分析的最小颗粒尺寸"/>
 			<member itemKey="20037" itemName="" itemText="FastX-ray(Ms)" description="进行X-ray quantify 分析的最小颗粒尺寸"/>
 			<member itemKey="20038" itemName="" itemText="Collect X-ray" description="Whether to collect X-ray during the detection process"/>
-			<member itemKey="20039" itemName="" itemText="XrayLimit"/>
 			<member itemKey="20185" itemName="" itemText="Spot Scan"/>
 			<member itemKey="20186" itemName="" itemText="Plane Scan"/>
 			<member itemKey="20200" itemName="" itemText="Yes" description=""/>

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

@@ -92,7 +92,6 @@
 			<member itemKey="20036" itemName="" itemText="分析阈值(等效圆直径/微米)" description="进行X-ray quantify 分析的最小颗粒尺寸"/>
 			<member itemKey="20037" itemName="" itemText="小颗粒x-ray时间(毫秒)" description="进行X-ray quantify 分析的最小颗粒尺寸"/>
 			<member itemKey="20038" itemName="" itemText="是否采集X-ray" description="检测过程中是否对颗粒进行X-ray采集"/>
-			<member itemKey="20039" itemName="" itemText="数量限值"/>
 			<member itemKey="20185" itemName="" itemText="点扫描" description=""/>
             <member itemKey="20186" itemName="" itemText="面扫描" description=""/>
 			<member itemKey="20200" itemName="" itemText="是" description=""/>
@@ -103,7 +102,7 @@
 			<member itemKey="20102" itemName="" itemText="输入分析x-ray时间。"/>
 			<member itemKey="20103" itemName="" itemText="选择分析x-ray扫描方式。"/>
 			<member itemKey="20104" itemName="" itemText="输入分析x-ray计数率期望值。"/>
-			<member itemKey="20105" itemName="" itemText=""/>
+			<member itemKey="20105" itemName="" itemText="spare"/>
 			<member itemKey="20106" itemName="" itemText="spare"/>
 			<member itemKey="20107" itemName="" itemText="spare"/>
 			<member itemKey="20108" itemName="" itemText="spare"/>

+ 11 - 20
OTS.sln

@@ -161,30 +161,21 @@ Global
 		{A3059BB1-9315-49DB-9680-FE16FAB1499D}.Release|x64.Build.0 = Release|x64
 		{A3059BB1-9315-49DB-9680-FE16FAB1499D}.Release|x86.ActiveCfg = Release|x86
 		{A3059BB1-9315-49DB-9680-FE16FAB1499D}.Release|x86.Build.0 = Release|x86
-		{BA8F9918-E809-4957-99D3-B2CD823BB236}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-		{BA8F9918-E809-4957-99D3-B2CD823BB236}.Debug|Any CPU.Build.0 = Debug|Any CPU
-		{BA8F9918-E809-4957-99D3-B2CD823BB236}.Debug|x64.ActiveCfg = Debug|Any CPU
-		{BA8F9918-E809-4957-99D3-B2CD823BB236}.Debug|x64.Build.0 = Debug|Any CPU
-		{BA8F9918-E809-4957-99D3-B2CD823BB236}.Debug|x86.ActiveCfg = Debug|Any CPU
-		{BA8F9918-E809-4957-99D3-B2CD823BB236}.Debug|x86.Build.0 = Debug|Any CPU
-		{BA8F9918-E809-4957-99D3-B2CD823BB236}.projectconfig|Any CPU.ActiveCfg = Release|Any CPU
-		{BA8F9918-E809-4957-99D3-B2CD823BB236}.projectconfig|Any CPU.Build.0 = Release|Any CPU
+		{BA8F9918-E809-4957-99D3-B2CD823BB236}.Debug|Any CPU.ActiveCfg = Debug|x64
+		{BA8F9918-E809-4957-99D3-B2CD823BB236}.Debug|x64.ActiveCfg = Debug|x64
+		{BA8F9918-E809-4957-99D3-B2CD823BB236}.Debug|x86.ActiveCfg = Debug|x64
+		{BA8F9918-E809-4957-99D3-B2CD823BB236}.projectconfig|Any CPU.ActiveCfg = Debug|x64
 		{BA8F9918-E809-4957-99D3-B2CD823BB236}.projectconfig|x64.ActiveCfg = Release|x64
 		{BA8F9918-E809-4957-99D3-B2CD823BB236}.projectconfig|x64.Build.0 = Release|x64
-		{BA8F9918-E809-4957-99D3-B2CD823BB236}.projectconfig|x86.ActiveCfg = Release|Any CPU
-		{BA8F9918-E809-4957-99D3-B2CD823BB236}.projectconfig|x86.Build.0 = Release|Any CPU
-		{BA8F9918-E809-4957-99D3-B2CD823BB236}.Release_oxford50|Any CPU.ActiveCfg = Release_oxford50|Any CPU
-		{BA8F9918-E809-4957-99D3-B2CD823BB236}.Release_oxford50|Any CPU.Build.0 = Release_oxford50|Any CPU
-		{BA8F9918-E809-4957-99D3-B2CD823BB236}.Release_oxford50|x64.ActiveCfg = Release_oxford50|x64
-		{BA8F9918-E809-4957-99D3-B2CD823BB236}.Release_oxford50|x64.Build.0 = Release_oxford50|x64
-		{BA8F9918-E809-4957-99D3-B2CD823BB236}.Release_oxford50|x86.ActiveCfg = Release_oxford50|Any CPU
-		{BA8F9918-E809-4957-99D3-B2CD823BB236}.Release_oxford50|x86.Build.0 = Release_oxford50|Any CPU
-		{BA8F9918-E809-4957-99D3-B2CD823BB236}.Release|Any CPU.ActiveCfg = Release|Any CPU
-		{BA8F9918-E809-4957-99D3-B2CD823BB236}.Release|Any CPU.Build.0 = Release|Any CPU
+		{BA8F9918-E809-4957-99D3-B2CD823BB236}.projectconfig|x86.ActiveCfg = Debug|x64
+		{BA8F9918-E809-4957-99D3-B2CD823BB236}.Release_oxford50|Any CPU.ActiveCfg = Release_oxford50|x64
+		{BA8F9918-E809-4957-99D3-B2CD823BB236}.Release_oxford50|x64.ActiveCfg = Release_oxford50|x86
+		{BA8F9918-E809-4957-99D3-B2CD823BB236}.Release_oxford50|x64.Build.0 = Release_oxford50|x86
+		{BA8F9918-E809-4957-99D3-B2CD823BB236}.Release_oxford50|x86.ActiveCfg = Release_oxford50|x86
+		{BA8F9918-E809-4957-99D3-B2CD823BB236}.Release|Any CPU.ActiveCfg = Release|x64
 		{BA8F9918-E809-4957-99D3-B2CD823BB236}.Release|x64.ActiveCfg = Release|x64
 		{BA8F9918-E809-4957-99D3-B2CD823BB236}.Release|x64.Build.0 = Release|x64
-		{BA8F9918-E809-4957-99D3-B2CD823BB236}.Release|x86.ActiveCfg = Release|Any CPU
-		{BA8F9918-E809-4957-99D3-B2CD823BB236}.Release|x86.Build.0 = Release|Any CPU
+		{BA8F9918-E809-4957-99D3-B2CD823BB236}.Release|x86.ActiveCfg = Release|x64
 		{CEA06DD1-5CD7-4B7D-A807-785718C3A854}.Debug|Any CPU.ActiveCfg = Debug|Win32
 		{CEA06DD1-5CD7-4B7D-A807-785718C3A854}.Debug|x64.ActiveCfg = Debug|x64
 		{CEA06DD1-5CD7-4B7D-A807-785718C3A854}.Debug|x64.Build.0 = Debug|x64

+ 33 - 263
OTSIncAReportApp/1-UI/Control_Graph/Controls/Control_DrawDistrbutionImageAndBSE.cs

@@ -1,6 +1,7 @@
 using NLog;
 
 using OTSIncAReportApp;
+using OTSIncAReportApp._3_ServiceCenter;
 using OTSIncAReportApp.DataOperation.DataAccess;
 using OTSIncAReportApp.DataOperation.Model;
 using OTSIncAReportApp.OTSSampleReportInfo;
@@ -1455,20 +1456,26 @@ namespace OTSIncAReportGraph.Controls
         //复制图像
         private void toolStripMenuItem_copyimage_Click(object sender, EventArgs e)
         {
-
-            //opencv_outpic();
-            ////outpic();
-            //opencv_outpic();
-            if (opencv_outpic((int)Outpic_enum.pic))
-            {
-                MessageBox.Show("Picture export complete");
-            }
-            else
+            SaveFileDialog sfd = new SaveFileDialog();
+            //|ALL Files(*.*)|*.*
+            //BMP Files(*.bmp)| *.bmp |
+            sfd.Filter = "png Files(*.png)| *.png |BMP Files(*.bmp)| *.bmp |JPG Files(*.jpg)|*.jpg;*.jpeg";
+            if (sfd.ShowDialog() == DialogResult.OK)
             {
-                MessageBox.Show("Picture export failed");
-            }
+                OutPIC outpic = new OutPIC();
+                outpic.m_list_allDfield = m_list_allDfield;
+                outpic.resultFile = resultFile;
+                outpic.sfd = sfd;
+                outpic.type = (int)Outpic_enum.pic;
+                Thread bThread = new Thread(new ThreadStart(outpic.opencv_outpic));
+                bThread.IsBackground = true;
+                bThread.Start();
+               
+
 
-            //CopyImage();
+              
+            }
+            
         }
 
         private void ToolStripMenuItem_movesempoint_Click(object sender, EventArgs e)
@@ -2051,250 +2058,7 @@ namespace OTSIncAReportGraph.Controls
             }
             return false;
         }
-        /// <summary>
-        /// 获取每行图片的位置配合opencv方法使用
-        /// </summary>
-        /// <returns></returns>
-        private List<DataTable> opencv_piclist()
-        {
-            List<DataTable> list_dt_picdata = new List<DataTable>();
-            DataTable picDatat = new DataTable();
-            picDatat.Columns.Add("X", typeof(double));
-            picDatat.Columns.Add("Y", typeof(double));
-            foreach (var f in m_list_allDfield)
-            {
-                DataRow dr = picDatat.NewRow();
-                dr["X"] = f.Rect.X;
-                dr["Y"] = f.Rect.Y;
-                picDatat.Rows.Add(dr);
-            }
-            int y_max = Convert.ToInt32(picDatat.Compute("Max(Y)", "true"));
-            int y_min = Convert.ToInt32(picDatat.Compute("Min(Y)", "true"));
-            DataTable total_dt_X = picDatat.Copy();
-            DataView dv_x = total_dt_X.DefaultView;
-            DataView dv_x_2 = dv_x.ToTable(true, "X").DefaultView;
-            dv_x_2.Sort = "X ASC";
-            total_dt_X = dv_x_2.ToTable();
-
-
-            DataTable total_dt_Y = picDatat.Copy();
-            DataView dv_Y = total_dt_Y.DefaultView;
-            DataView dv_Y_2 = dv_Y.ToTable(true, "Y").DefaultView;
-            dv_Y_2.Sort = "Y ASC";
-            total_dt_Y = dv_Y_2.ToTable();
-
-
-            for (int i = 0; i < total_dt_Y.Rows.Count; i++)
-            {
-                DataTable data = new DataTable();
-                data.Columns.Add("mat",typeof(Bitmap));
-                data.Columns.Add("X", typeof(double));
-                for (int a =0;a<total_dt_X.Rows.Count;a++)
-                {
-                    DataRow dr2 = data.NewRow();
-                    Bitmap bitmap = new Bitmap((int)m_list_allDfield[0].Rect.Width, (int)m_list_allDfield[0].Rect.Height);
-                    Graphics g = Graphics.FromImage(bitmap);
-                    g.Clear(Color.White);
-                    g.Dispose();
-                    dr2["mat"] = bitmap;
-                    dr2["X"] = total_dt_X.Rows[a]["X"];
-                    data.Rows.Add(dr2);
-                }
-                foreach (var f in m_list_allDfield)
-                {
-                    if (total_dt_Y.Rows[i]["Y"].ToString()==f.Rect.Y.ToString())
-                    {
-                        for (int c=0;c<data.Rows.Count;c++)
-                        {
-                            if (data.Rows[c]["X"].ToString()== f.Rect.X.ToString())
-                            {
-                                data.Rows[c]["mat"]= f.OriginalImage;
-                                data.Rows[c]["X"] = f.Rect.X;
-                            }
-                        }
-
-                    }
-                }
-                
-                
-                DataView dataView1 = data.DefaultView;
-                dataView1.Sort = "X ASC";
-                data = dataView1.ToTable();
-
-               
-                list_dt_picdata.Add(data);
-            }
-
-            return list_dt_picdata;
-        }
-        private bool opencv_outpic(int type)
-        {
-            SaveFileDialog sfd = new SaveFileDialog();
-            //|ALL Files(*.*)|*.*
-            //BMP Files(*.bmp)| *.bmp |
-            sfd.Filter = "png Files(*.png)| *.png |BMP Files(*.bmp)| *.bmp |JPG Files(*.jpg)|*.jpg;*.jpeg";
-            if (sfd.ShowDialog() == DialogResult.OK)
-            {
-                List<DataTable> list_dt_picdata = new List<DataTable>();
-                if (type==(int)Outpic_enum.pic)
-                {
-                    list_dt_picdata = opencv_piclist();
-                }else
-                    if (type==(int)Outpic_enum.Render_pic)
-                {
-                    list_dt_picdata = opencv_piclist_Render();
-                }
-                //List<DataTable> list_dt_picdata = opencv_piclist();
-                OpenCvSharp.Mat[] list_mats = new OpenCvSharp.Mat[list_dt_picdata.Count];
-                for (int i = 0; i < list_dt_picdata.Count; i++)
-                {
-                    OpenCvSharp.Mat[] mats = new OpenCvSharp.Mat[list_dt_picdata[i].Rows.Count];
-                    for (int a = 0; a < list_dt_picdata[i].Rows.Count; a++)
-                    {
-                        mats[a] = OpenCvSharp.Extensions.BitmapConverter.ToMat((Bitmap)list_dt_picdata[i].Rows[a]["mat"]);
-                    }
-                    OpenCvSharp.Mat pano = new OpenCvSharp.Mat();
-                    OpenCvSharp.Cv2.HConcat(mats, pano);
-                    list_mats[i] = pano;
-                }
-                OpenCvSharp.Mat save_pano = new OpenCvSharp.Mat();
-                OpenCvSharp.Cv2.VConcat(list_mats, save_pano);
-                OpenCvSharp.Cv2.ImWrite(sfd.FileName, save_pano);
-            }
-
-                return true;
-        }
-        private List<DataTable> opencv_piclist_Render()
-        {
-            List<DataTable> list_dt_picdata = new List<DataTable>();
-            DataTable picDatat = new DataTable();
-            List<Field> fieldlist = resultFile.List_OTSField;
-            picDatat.Columns.Add("X", typeof(double));
-            picDatat.Columns.Add("Y", typeof(double));
-            foreach (var f in m_list_allDfield)
-            {
-                DataRow dr = picDatat.NewRow();
-                dr["X"] = f.Rect.X;
-                dr["Y"] = f.Rect.Y;
-                picDatat.Rows.Add(dr);
-            }
-            int y_max = Convert.ToInt32(picDatat.Compute("Max(Y)", "true"));
-            int y_min = Convert.ToInt32(picDatat.Compute("Min(Y)", "true"));
-            DataTable total_dt_X = picDatat.Copy();
-            DataView dv_x = total_dt_X.DefaultView;
-            DataView dv_x_2 = dv_x.ToTable(true, "X").DefaultView;
-            dv_x_2.Sort = "X ASC";
-            total_dt_X = dv_x_2.ToTable();
-
-
-            DataTable total_dt_Y = picDatat.Copy();
-            DataView dv_Y = total_dt_Y.DefaultView;
-            DataView dv_Y_2 = dv_Y.ToTable(true, "Y").DefaultView;
-            dv_Y_2.Sort = "Y ASC";
-            total_dt_Y = dv_Y_2.ToTable();
-
-
-            for (int i = 0; i < total_dt_Y.Rows.Count; i++)
-            {
-                DataTable data = new DataTable();
-                data.Columns.Add("mat", typeof(Bitmap));
-                data.Columns.Add("X", typeof(double));
-                for (int a = 0; a < total_dt_X.Rows.Count; a++)
-                {
-                    DataRow dr2 = data.NewRow();
-                    Bitmap bitmap = new Bitmap((int)m_list_allDfield[0].Rect.Width, (int)m_list_allDfield[0].Rect.Height);
-                    Graphics g = Graphics.FromImage(bitmap);
-                    g.Clear(Color.White);
-                    g.Dispose();
-                    dr2["mat"] = bitmap;
-                    dr2["X"] = total_dt_X.Rows[a]["X"];
-                    data.Rows.Add(dr2);
-                }
-                foreach (var f in m_list_allDfield)
-                {
-                    if (total_dt_Y.Rows[i]["Y"].ToString() == f.Rect.Y.ToString())
-                    {
-                        for (int c = 0; c < data.Rows.Count; c++)
-                        {
-                            if (data.Rows[c]["X"].ToString() == f.Rect.X.ToString())
-                            {
-                                Bitmap image = new Bitmap(f.OriginalImage.Width, f.OriginalImage.Height);
-                                Graphics g2 = Graphics.FromImage(image);
-                                g2.DrawImage(f.OriginalImage, 0, 0, f.OriginalImage.Width, f.OriginalImage.Height);
-                                Graphics graph_2 = Graphics.FromImage(image);
-
-                                for (int a = 0; a < fieldlist.Count; a++)
-                                {
-                                    if (fieldlist[a].FieldID.ToString() == f.FieldID.ToString())
-                                    {
-                                        //先获取该Field中的所有Particle
-                                        List<Particle> list_particle;
-                                        list_particle = fieldlist[a].ParticleList;
-                                        //再循环计算所有的Particle对象
-                                        foreach (Particle particle in list_particle)
-                                        {
-                                            //创建DParticle颗粒
-                                            DisplayParticle dp = new DisplayParticle(particle);
-                                            List<Segment> list_seg;
-                                            list_seg = particle.SegmentList;
-                                            //创建颗粒分布图对应的类对象
-                                            List<DisplaySegment> list_dsegment = new List<DisplaySegment>();
-                                            //再循环取出里面所有的segment
-                                            foreach (Segment seg in list_seg)
-                                            {
-                                                #region 创建DSegment对象,并将STD分析出的化合物颜色保存到DSegment对象中
-
-                                                Point on_p = new Point() { X = seg.Start, Y = seg.Height };
-                                                Point off_p = new Point() { X = seg.Start + seg.Length, Y = seg.Height };
-                                                Pen npen = new Pen(dp.Color);
-                                                graph_2.DrawLine(npen, on_p, off_p);
-
-                                                #endregion
-                                            }
-                                        }
-                                    }
-                                }
-                                data.Rows[c]["mat"] = image;
-                                data.Rows[c]["X"] = f.Rect.X;
-                            }
-                        }
-                    }
-
-
-
-                    
-                    
-
-
-
-
-
-
-                    //if (total_dt_Y.Rows[i]["Y"].ToString() == f.Rect.Y.ToString())
-                    //{
-                    //    for (int c = 0; c < data.Rows.Count; c++)
-                    //    {
-                    //        if (data.Rows[c]["X"].ToString() == f.Rect.X.ToString())
-                    //        {
-                    //            data.Rows[c]["mat"] = f.OriginalImage;
-                    //            data.Rows[c]["X"] = f.Rect.X;
-                    //        }
-                    //    }
-
-                    //}
-                }
-
-
-                DataView dataView1 = data.DefaultView;
-                dataView1.Sort = "X ASC";
-                data = dataView1.ToTable();
-
-
-                list_dt_picdata.Add(data);
-            }
-
-            return list_dt_picdata;
-        }
+      
 
         private static byte[] ImgtoByte(Image img)
         {
@@ -2358,14 +2122,20 @@ namespace OTSIncAReportGraph.Controls
 
         private void ExportoriginalspliceToolStripMenuItem_Click(object sender, EventArgs e)
         {
-            if (opencv_outpic((int)Outpic_enum.Render_pic))
-            //if (outpic_Render())
-            {
-                MessageBox.Show("Picture export complete");
-            }
-            else
+            SaveFileDialog sfd = new SaveFileDialog();
+            //|ALL Files(*.*)|*.*
+            //BMP Files(*.bmp)| *.bmp |
+            sfd.Filter = "png Files(*.png)| *.png |BMP Files(*.bmp)| *.bmp |JPG Files(*.jpg)|*.jpg;*.jpeg";
+            if (sfd.ShowDialog() == DialogResult.OK)
             {
-                MessageBox.Show("Picture export failed");
+                OutPIC outpic = new OutPIC();
+                outpic.m_list_allDfield = m_list_allDfield;
+                outpic.resultFile = resultFile;
+                outpic.sfd = sfd;
+                outpic.type = (int)Outpic_enum.Render_pic;
+                Thread bThread = new Thread(new ThreadStart(outpic.opencv_outpic));
+                bThread.IsBackground = true;
+                bThread.Start();
             }
         }
     }

+ 436 - 24
OTSIncAReportApp/1-UI/OTSTemplateDesigner/Export_ReportTemplate.cs

@@ -112,8 +112,37 @@ namespace OTSIncAReportApp.OTSTemplateDesigner
         #endregion
 
         #region 一次性读取数据所需要的数据
+        private void GetSTL(out DataTable  data)
+        {
+            DataTable dt = new DataTable();
+            dt.Columns.Add("TypeId");
+            dt.Columns.Add("Hardness", typeof(double));
+            dt.Columns.Add("Hardness_detailed");
+            ResultFile resfile = m_otsreport_export.m_ReportApp.m_rstDataMgr.ResultFilesList[m_otsreport_export.m_ReportApp.m_rstDataMgr.GetWorkingResult()];
+            string str_libraryName = ((Dictionary<string, object>)((Dictionary<string, object>)((Dictionary<string, object>)resfile.ResultInfo["Sample"])["Members"])["MsrParams"])["STDName"].ToString();
+            
+            OTSSysMgrTools.SqLiteHelper sh = new OTSSysMgrTools.SqLiteHelper("data source='" + System.IO.Directory.GetCurrentDirectory()+ "\\Config\\SysData\\"+ str_libraryName + ".db" + "'");
+            DataTable dt_stl= sh.ExecuteQuery("select * from ClassifySTD");
+            for (int i=0;i< dt_stl.Rows.Count;i++)
+            {
+                DataRow dr = dt.NewRow();
+                dr["TypeId"] = dt_stl.Rows[i]["StrName"].ToString();
+                dr["Hardness_detailed"] = dt_stl.Rows[i]["Hardness"].ToString();
+                if (System.Text.RegularExpressions.Regex.Replace(dt_stl.Rows[i]["Hardness"].ToString(), @"[^\d.\d]", "").ToString()!="")
+                {
+                    dr["Hardness"] = Convert.ToDouble(System.Text.RegularExpressions.Regex.Replace(dt_stl.Rows[i]["Hardness"].ToString(), @"[^\d.\d]", ""));
+                }else
+                {
+                    dr["Hardness"] = 0;
+                }
+                dt.Rows.Add(dr);
+            }
+            data = dt;
+        }
         public bool GetDBData()
         {
+            //GetSTL();
+
             m_bt_DBData.Clear();
             m_bt_DBData.Columns.Clear();
             ParticleData fielddata = new ParticleData(m_otsreport_export.m_ReportApp.m_rstDataMgr.ResultFilesList[m_otsreport_export.m_ReportApp.m_rstDataMgr.GetWorkingResult()].FilePath);
@@ -224,9 +253,8 @@ namespace OTSIncAReportApp.OTSTemplateDesigner
         /// <returns></returns>
         public bool InsertReportTemplateTable_ParticlesGridDevidePage()
         {
-
+            
             int serialNumber = 1;
-
             //------------------加载模块,获取数据-------------------------------------------------
             m_otsreport_export.m_ReportApp.im_ParticlesGridDevidePage = new ParticlesGridDevidePage(m_otsreport_export.m_ReportApp);
 
@@ -238,8 +266,6 @@ namespace OTSIncAReportApp.OTSTemplateDesigner
             dv.Sort = "DMAX DESC";
             DataTable dt_ParticlesGridDevidePage = dv.ToTable();
 
-
-
             string str_resultPath = m_otsreport_export.m_ReportApp.m_rstDataMgr.ResultFilesList[m_otsreport_export.m_ReportApp.m_rstDataMgr.GetWorkingResult()].FilePath;
             //------------------加载模块,获取数据结束----------------------------------------------
             #region 创建要插入数据库表结构
@@ -319,18 +345,12 @@ namespace OTSIncAReportApp.OTSTemplateDesigner
 
             #endregion
 
-
-
-
             #region 插入-前20颗粒部份
-
            
             for (int i_row = 0; i_row < dt_ParticlesGridDevidePage.Rows.Count; i_row++)
             {
                 if (dt_ParticlesGridDevidePage.Rows[i_row].ItemArray[24].ToString()!= "Not Identified")
                 {
-
-
                     //获取颗粒的fieldid,和particleid
                     string str_fieldid = dt_ParticlesGridDevidePage.Rows[i_row]["fieldid"].ToString();
                     string str_particleid = dt_ParticlesGridDevidePage.Rows[i_row]["particleid"].ToString();
@@ -347,7 +367,6 @@ namespace OTSIncAReportApp.OTSTemplateDesigner
                     if (str_fieldid == "-1")
                         continue;
 
-
                     if (serialNumber > 20)
                         continue;
 
@@ -417,7 +436,6 @@ namespace OTSIncAReportApp.OTSTemplateDesigner
                     dr["DMIN"] = Math.Round(Convert.ToDouble(dt_ParticlesGridDevidePage.Rows[i_row]["dmin"]), 2).ToString();
                     dr["Class"] = dt_ParticlesGridDevidePage.Rows[i_row]["typename"].ToString();
 
-
                     List<string> list_max_elementname = new List<string>();
                     List<double> list_max_elementvale = new List<double>();
                     GetMaxElementFromDataTable(dt_ParticlesGridDevidePage, i_row, out list_max_elementname, out list_max_elementvale);
@@ -440,7 +458,6 @@ namespace OTSIncAReportApp.OTSTemplateDesigner
                     dr["ColName6"] = list_max_elementname[5];
                     dr["ColVal6"] = list_max_elementvale[5].ToString();
 
-
                     DT_Largest20.Rows.Add(dr);
                 }
             }
@@ -460,9 +477,7 @@ namespace OTSIncAReportApp.OTSTemplateDesigner
                     dt_GridDevidePage.Rows.Add(dt_ParticlesGridDevidePage.Rows[i].ItemArray);
                 }
             }
-
             m_otsreport_export.m_ReportApp.im_ParticlesGridDevidePage.SaveMarkParticleRectangleOnFieldFile(dt_GridDevidePage, out vs ,out data);
-
             string str_path_FIELD_FILES_MARK = str_resultPath + "\\FIELD_FILES_MARK\\";
             DirectoryInfo theFolder = new DirectoryInfo(str_path_FIELD_FILES_MARK);
             if (theFolder.Exists)
@@ -473,7 +488,6 @@ namespace OTSIncAReportApp.OTSTemplateDesigner
                     {
                         if (nextifile.Name.Contains(".bmp") == true || nextifile.Name.Contains(".BMP") == true)
                         {
-                            
                             //确认对应的帧图名
                             string str_fieldid = Path.GetFileNameWithoutExtension(nextifile.Name);
                             if (str_fieldid==vs[i].ToString())
@@ -483,7 +497,6 @@ namespace OTSIncAReportApp.OTSTemplateDesigner
                                 if (datarowlist.Count() > 0)
                                 {
                                     Bitmap ls_bp_fieldmark = new Bitmap(nextifile.FullName);
-
                                     DataRow dr = DT_field_dt.NewRow();
                                     MemoryStream newms_bp_fieldmark = new MemoryStream();
                                     ls_bp_fieldmark.Save(newms_bp_fieldmark, System.Drawing.Imaging.ImageFormat.Bmp);
@@ -492,19 +505,14 @@ namespace OTSIncAReportApp.OTSTemplateDesigner
                                     newms_bp_fieldmark.Read(newarr_fieldmark, 0, newarr_fieldmark.Length);
                                     dr["FieldImg"] = newarr_fieldmark;
                                     dr["FieldId"] = str_fieldid;
-
                                     ls_bp_fieldmark.Dispose();
                                     DT_field_dt.Rows.Add(dr);
 
                                 }
                             }
-
                         }
                     }
-
                 }
-
-
                 DT_field_dt_copy = DT_field_dt.Copy();
             }
 
@@ -607,13 +615,403 @@ namespace OTSIncAReportApp.OTSTemplateDesigner
             }
             #endregion
             FrameGraphParticleTable(dt_ParticlesGridDevidePage, str_resultPath, fielddata, DT_field_dt);
+            m_list_dt.Add(DT_field_dt_copy);
+            m_list_dt.Add(DT_Largest_frame);
+            m_list_dt.Add(DT_Largest20);
+
+            return true;
+        }
+
+        public bool InsertReportTemplateTable_ParticlesGridDevidePage_CleanlinessA()
+        {
+            DataTable dt_stl = new DataTable();
+            GetSTL(out dt_stl);
+
+            int serialNumber = 1;
+            //------------------加载模块,获取数据-------------------------------------------------
+            m_otsreport_export.m_ReportApp.im_ParticlesGridDevidePage = new ParticlesGridDevidePage(m_otsreport_export.m_ReportApp);
+
+            //根据sql条件,查询获取颗粒信息数据
+            ParticleData fielddata = new ParticleData(m_otsreport_export.m_ReportApp.m_rstDataMgr.ResultFilesList[m_otsreport_export.m_ReportApp.m_rstDataMgr.GetWorkingResult()].FilePath);
+            DataTable dt = InvalidRemoval(fielddata.GetIncaSurfaceData(), "TypeName");
+
+            dt.Columns.Add("Hardness", typeof(double));
+            dt.Columns.Add("Hardness_detailed");
+            for (int i=0;i<dt.Rows.Count;i++)
+            {
+               
+                for (int a=0;a< dt_stl.Rows.Count;a++)
+                {
+                    if (dt.Rows[i]["TypeName"].ToString() ==dt_stl.Rows[a]["TypeId"].ToString())
+                    {
+                        dt.Rows[i]["Hardness"] = Convert.ToDouble(dt_stl.Rows[a]["Hardness"]);
+                        dt.Rows[i]["Hardness_detailed"] = dt_stl.Rows[a]["Hardness_detailed"];
+                        break;
+                    }
+                }
+            }    
+            //将颗粒大小排序(从大到小)
+            DataView dv = dt.DefaultView;
+            dv.Sort = "Hardness DESC";
+            DataTable dt_ParticlesGridDevidePage = dv.ToTable();
+
+            string str_resultPath = m_otsreport_export.m_ReportApp.m_rstDataMgr.ResultFilesList[m_otsreport_export.m_ReportApp.m_rstDataMgr.GetWorkingResult()].FilePath;
+            //------------------加载模块,获取数据结束----------------------------------------------
+            #region 创建要插入数据库表结构
+            //插入模板需父子表,结构
+            //表名field_dt表:(父表)           帧图表
+            DataTable DT_field_dt = new DataTable();
+            DT_field_dt.TableName = "field_dt";
+            DataColumn colpictid2 = new DataColumn("FieldId");
+            colpictid2.DataType = typeof(int);
+            DT_field_dt.Columns.Add(colpictid2);
+            //图像列
+            DataColumn colpict2 = new DataColumn("FieldImg");
+            colpict2.DataType = System.Type.GetType("System.Byte[]");
+            DT_field_dt.Columns.Add(colpict2);
+
+            //表名Largest_frame表:(子表)       显示20条颗粒除外的部份颗粒信息
+            DataTable DT_field_dt_copy = new DataTable();
+            DataTable DT_Largest_frame = new DataTable();
+            DT_Largest_frame.TableName = "Largest_frame";
+            DT_Largest_frame.Columns.Add("pid");
+            DT_Largest_frame.Columns.Add("Size");
+            DT_Largest_frame.Columns.Add("Width");
+            DT_Largest_frame.Columns.Add("DMAX");
+            DT_Largest_frame.Columns.Add("DMIN");
+            DT_Largest_frame.Columns.Add("Class");
+            DT_Largest_frame.Columns.Add("ColName1");
+            DT_Largest_frame.Columns.Add("ColName2");
+            DT_Largest_frame.Columns.Add("ColName3");
+            DT_Largest_frame.Columns.Add("ColName4");
+            DT_Largest_frame.Columns.Add("ColName5");
+            DT_Largest_frame.Columns.Add("ColName6");
+            DT_Largest_frame.Columns.Add("ColVal1");
+            DT_Largest_frame.Columns.Add("ColVal2");
+            DT_Largest_frame.Columns.Add("ColVal3");
+            DT_Largest_frame.Columns.Add("ColVal4");
+            DT_Largest_frame.Columns.Add("ColVal5");
+            DT_Largest_frame.Columns.Add("ColVal6");
+            DataColumn colpictid = new DataColumn("FieldId");
+            colpictid.DataType = typeof(int);
+            DT_Largest_frame.Columns.Add(colpictid);
+            //图像列
+            DataColumn colpict = new DataColumn("p1");
+            colpict.DataType = System.Type.GetType("System.Byte[]");
+            DT_Largest_frame.Columns.Add(colpict);
 
+            //largest20表:(无关系表)       需要显示前20条带有显示能谱图像的颗粒表
+            DataTable DT_Largest20 = new DataTable();
+            DT_Largest20.TableName = "Largest20";
+            DT_Largest20.Columns.Add("pid");
+            DT_Largest20.Columns.Add("Size");
+            DT_Largest20.Columns.Add("Width");
+            DT_Largest20.Columns.Add("DMAX");
+            DT_Largest20.Columns.Add("DMIN");
+            DT_Largest20.Columns.Add("Class");
+            DT_Largest20.Columns.Add("ColName1");
+            DT_Largest20.Columns.Add("ColName2");
+            DT_Largest20.Columns.Add("ColName3");
+            DT_Largest20.Columns.Add("ColName4");
+            DT_Largest20.Columns.Add("ColName5");
+            DT_Largest20.Columns.Add("ColName6");
+            DT_Largest20.Columns.Add("ColVal1");
+            DT_Largest20.Columns.Add("ColVal2");
+            DT_Largest20.Columns.Add("ColVal3");
+            DT_Largest20.Columns.Add("ColVal4");
+            DT_Largest20.Columns.Add("ColVal5");
+            DT_Largest20.Columns.Add("ColVal6");
+            // 图像列
+            DataColumn colpict_20ago = new DataColumn("p1");
+            colpict_20ago.DataType = System.Type.GetType("System.Byte[]");
+            DT_Largest20.Columns.Add(colpict_20ago);
+            DataColumn colpict2_20ago = new DataColumn("p2");
+            colpict2_20ago.DataType = System.Type.GetType("System.Byte[]");
+            DT_Largest20.Columns.Add(colpict2_20ago);
+            DataColumn colpict3_20ago = new DataColumn("p3");
+            colpict3_20ago.DataType = System.Type.GetType("System.Byte[]");
+            DT_Largest20.Columns.Add(colpict3_20ago);
+
+            #endregion
+
+            #region 插入-前20颗粒部份
+
+            for (int i_row = 0; i_row < dt_ParticlesGridDevidePage.Rows.Count; i_row++)
+            {
+                if (dt_ParticlesGridDevidePage.Rows[i_row].ItemArray[24].ToString() != "Not Identified")
+                {
+                    //获取颗粒的fieldid,和particleid
+                    string str_fieldid = dt_ParticlesGridDevidePage.Rows[i_row]["fieldid"].ToString();
+                    string str_particleid = dt_ParticlesGridDevidePage.Rows[i_row]["particleid"].ToString();
+                    string str_subparticles = dt_ParticlesGridDevidePage.Rows[i_row]["SubParticles"].ToString();
+                    string str_typeid = dt_ParticlesGridDevidePage.Rows[i_row]["TypeId"].ToString();
+                    string str_typename = dt_ParticlesGridDevidePage.Rows[i_row]["TypeName"].ToString();
+                    string str_element = dt_ParticlesGridDevidePage.Rows[i_row]["Element"].ToString();
+
+                    //获取原始颗粒图像
+                    Bitmap bp_particle = new Bitmap(1, 1);
+                    string str_path = str_resultPath + "\\FIELD_FILES\\";
+                    string str_imagePath = str_path + "Field" + str_fieldid.ToString() + ".bmp";
+
+                    if (str_fieldid == "-1")
+                        continue;
+
+                    if (serialNumber > 20)
+                        continue;
+
+                    if (str_subparticles != null && str_subparticles != "")
+                    {
+                        //合并大颗粒
+                        double ScanFieldSize = 1142;
+                        Bitmap tempbit = fielddata.ReadImageFile(str_imagePath);
+                        int pixw = tempbit.Width;
+                        double xs = pixw / ScanFieldSize;
+                        bp_particle = fielddata.GetBitmapForBig(str_subparticles, xs, str_resultPath);
+                    }
+                    else
+                    {
+                        //正常颗粒
+                        Rectangle rectangle = new Rectangle() { X = Convert.ToInt32(dt_ParticlesGridDevidePage.Rows[i_row]["RectLeft"]), Y = Convert.ToInt32(dt_ParticlesGridDevidePage.Rows[i_row]["RectTop"]), Width = Convert.ToInt32(dt_ParticlesGridDevidePage.Rows[i_row]["RectWidth"]), Height = Convert.ToInt32(dt_ParticlesGridDevidePage.Rows[i_row]["RectHeight"]) };
+                        Bitmap bp_field = fielddata.ReadImageFile(str_imagePath);
+                        bp_particle = fielddata.GetBitmapByParticle(bp_field, rectangle);
+                        bp_particle.Tag = new List<string>() { dt_ParticlesGridDevidePage.Rows[i_row]["FieldId"].ToString(), dt_ParticlesGridDevidePage.Rows[i_row]["ParticleId"].ToString(), dt_ParticlesGridDevidePage.Rows[i_row]["TypeId"].ToString() };
+                    }
+                    //获取该颗粒的xray能谱图像
+                    System.Drawing.Bitmap bp_xraybp = ExportXRayBitmap(str_fieldid,
+                            str_particleid, Convert.ToInt32(str_typeid), str_typename, fielddata);
+                    Bitmap ls_xraybpnew = new Bitmap(1, 1);
+                    ls_xraybpnew = OTSIncAReportGraph.Class.DrawFunction.KiResizeImage(bp_xraybp, 700, 115);//能谱图处理
+
+                    //获取该颗粒的二次放大处理图像
+                    Bitmap ls_processbitmap = new Bitmap(1, 1);
+                    ls_processbitmap = OTSIncAReportGraph.Class.DrawFunction.GetReZoomBitmap(bp_particle);// (Bitmap)bp_particle.Clone();//待完善
+
+                    //再将图像转成二进制流-------------------------------------------------------------------
+                    //原图
+                    MemoryStream newms_p1 = new MemoryStream();
+                    bp_particle.Save(newms_p1, System.Drawing.Imaging.ImageFormat.Bmp);
+                    newms_p1.Seek(0, SeekOrigin.Begin);
+                    byte[] newarr_p1 = new byte[newms_p1.Length];
+                    newms_p1.Read(newarr_p1, 0, newarr_p1.Length);
+
+                    //二次放大图
+                    MemoryStream newms_p2 = new MemoryStream();
+                    ls_processbitmap.Save(newms_p2, System.Drawing.Imaging.ImageFormat.Bmp);
+                    newms_p2.Seek(0, SeekOrigin.Begin);
+                    byte[] newarr_p2 = new byte[newms_p2.Length];
+                    newms_p2.Read(newarr_p2, 0, newarr_p2.Length);
+
+                    //能谱图
+                    MemoryStream newms_p3 = new MemoryStream();
+                    ls_xraybpnew.Save(newms_p3, System.Drawing.Imaging.ImageFormat.Bmp);
+                    newms_p3.Seek(0, SeekOrigin.Begin);
+                    byte[] newarr_p3 = new byte[newms_p3.Length];
+                    newms_p3.Read(newarr_p3, 0, newarr_p3.Length);
+                    //---------------------------------------------------------------------------------------                  
+                    DataRow dr = DT_Largest20.NewRow();
+
+                    dr["p1"] = newarr_p1;
+                    dr["p2"] = newarr_p2;
+                    dr["p3"] = newarr_p3;
+                    newms_p1.Dispose();
+                    newms_p2.Dispose();
+                    newms_p3.Dispose();
+
+                    dr["pid"] = serialNumber++.ToString();
+                    //dr["pid"] = str_fieldid + dt_ParticlesGridDevidePage.Rows[i_row]["particleid"].ToString();
+                    dr["Size"] = Convert.ToDouble(dt_ParticlesGridDevidePage.Rows[i_row]["area"]).ToString("#0.00"); //可以需要选择切换,计算方式
+                    dr["Width"] = dt_ParticlesGridDevidePage.Rows[i_row]["rectwidth"].ToString();
+                    dr["DMAX"] = Math.Round(Convert.ToDouble(dt_ParticlesGridDevidePage.Rows[i_row]["dmax"]), 2).ToString();
+                    dr["DMIN"] = dt_ParticlesGridDevidePage.Rows[i_row]["Hardness_detailed"].ToString();
+                    dr["Class"] = dt_ParticlesGridDevidePage.Rows[i_row]["typename"].ToString();
+
+                    List<string> list_max_elementname = new List<string>();
+                    List<double> list_max_elementvale = new List<double>();
+                    GetMaxElementFromDataTable(dt_ParticlesGridDevidePage, i_row, out list_max_elementname, out list_max_elementvale);
+                    //元素1
+                    dr["ColName1"] = list_max_elementname[0];
+                    dr["ColVal1"] = list_max_elementvale[0].ToString();
+                    //元素2
+                    dr["ColName2"] = list_max_elementname[1];
+                    dr["ColVal2"] = list_max_elementvale[1].ToString();
+                    //元素3
+                    dr["ColName3"] = list_max_elementname[2];
+                    dr["ColVal3"] = list_max_elementvale[2].ToString();
+                    //元素4
+                    dr["ColName4"] = list_max_elementname[3];
+                    dr["ColVal4"] = list_max_elementvale[3].ToString();
+                    //元素5
+                    dr["ColName5"] = list_max_elementname[4];
+                    dr["ColVal5"] = list_max_elementvale[4].ToString();
+                    //元素6
+                    dr["ColName6"] = list_max_elementname[5];
+                    dr["ColVal6"] = list_max_elementvale[5].ToString();
+
+                    DT_Largest20.Rows.Add(dr);
+                }
+            }
+            #endregion
+
+            #region 插入-帧图图像部份
+            List<string> vs = new List<string>();
+            DataTable data = new DataTable();
+            //首先生成标记颗粒的帧图图像文件
+            DataTable dt_GridDevidePage = new DataTable();
+            dt_GridDevidePage = dt_ParticlesGridDevidePage.Copy();
+            dt_GridDevidePage.Clear();
+            for (int i = 0; i < dt_ParticlesGridDevidePage.Rows.Count; i++)
+            {
+                if (dt_ParticlesGridDevidePage.Rows[i]["TypeName"].ToString() != "Not Identified")
+                {
+                    dt_GridDevidePage.Rows.Add(dt_ParticlesGridDevidePage.Rows[i].ItemArray);
+                }
+            }
+            m_otsreport_export.m_ReportApp.im_ParticlesGridDevidePage.SaveMarkParticleRectangleOnFieldFile(dt_GridDevidePage, out vs, out data);
+            string str_path_FIELD_FILES_MARK = str_resultPath + "\\FIELD_FILES_MARK\\";
+            DirectoryInfo theFolder = new DirectoryInfo(str_path_FIELD_FILES_MARK);
+            if (theFolder.Exists)
+            {
+                for (int i = 0; i < vs.Count; i++)
+                {
+                    foreach (FileInfo nextifile in theFolder.GetFiles())
+                    {
+                        if (nextifile.Name.Contains(".bmp") == true || nextifile.Name.Contains(".BMP") == true)
+                        {
+                            //确认对应的帧图名
+                            string str_fieldid = Path.GetFileNameWithoutExtension(nextifile.Name);
+                            if (str_fieldid == vs[i].ToString())
+                            {
+                                //在数据表中有颗粒在该帧图中的话,则对该帧图标记图像进行读取存入数据库
+                                DataRow[] datarowlist = dt_GridDevidePage.Select(" fieldid = " + str_fieldid);
+                                if (datarowlist.Count() > 0)
+                                {
+                                    Bitmap ls_bp_fieldmark = new Bitmap(nextifile.FullName);
+                                    DataRow dr = DT_field_dt.NewRow();
+                                    MemoryStream newms_bp_fieldmark = new MemoryStream();
+                                    ls_bp_fieldmark.Save(newms_bp_fieldmark, System.Drawing.Imaging.ImageFormat.Bmp);
+                                    newms_bp_fieldmark.Seek(0, SeekOrigin.Begin);
+                                    byte[] newarr_fieldmark = new byte[newms_bp_fieldmark.Length];
+                                    newms_bp_fieldmark.Read(newarr_fieldmark, 0, newarr_fieldmark.Length);
+                                    dr["FieldImg"] = newarr_fieldmark;
+                                    dr["FieldId"] = str_fieldid;
+                                    ls_bp_fieldmark.Dispose();
+                                    DT_field_dt.Rows.Add(dr);
+
+                                }
+                            }
+                        }
+                    }
+                }
+                DT_field_dt_copy = DT_field_dt.Copy();
+            }
+
+            #endregion
+
+            #region 插入-前20颗粒外的颗粒
+            for (int i_row = 0; i_row < dt_ParticlesGridDevidePage.Rows.Count; i_row++)
+            {
+                if (dt_ParticlesGridDevidePage.Rows[i_row]["element"].ToString() == "")
+                    continue;
+                //获取颗粒的fieldid,和particleid
+                string str_fieldid = dt_ParticlesGridDevidePage.Rows[i_row]["fieldid"].ToString();
+                if (Convert.ToInt32(str_fieldid) < 20)
+                {
+
+                    string str_particleid = dt_ParticlesGridDevidePage.Rows[i_row]["particleid"].ToString();
+                    string str_subparticles = dt_ParticlesGridDevidePage.Rows[i_row]["SubParticles"].ToString();
+                    string str_typeid = dt_ParticlesGridDevidePage.Rows[i_row]["TypeId"].ToString();
+                    string str_typename = dt_ParticlesGridDevidePage.Rows[i_row]["TypeName"].ToString();
+                    string str_element = dt_ParticlesGridDevidePage.Rows[i_row]["Element"].ToString();
+
+                    //获取原始颗粒图像
+                    Bitmap bp_particle = new Bitmap(1, 1);
+                    string str_path = str_resultPath + "\\FIELD_FILES\\";
+                    string str_imagePath = str_path + "Field" + str_fieldid.ToString() + ".bmp";
+                    if (str_subparticles != null && str_subparticles != "")
+                    {
+                        //合并大颗粒
+                        //double ScanFieldSize = 1142;
+                        //Bitmap tempbit = fielddata.ReadImageFile(str_imagePath);
+                        //int pixw = tempbit.Width;
+                        //double xs = pixw / ScanFieldSize;
+                        //bp_particle = fielddata.GetBitmapForBig(str_subparticles, xs, str_resultPath);
+                        continue;
+                    }
+                    else
+                    {
+                        //正常颗粒
+                        Rectangle rectangle = new Rectangle() { X = Convert.ToInt32(dt_ParticlesGridDevidePage.Rows[i_row]["RectLeft"]), Y = Convert.ToInt32(dt_ParticlesGridDevidePage.Rows[i_row]["RectTop"]), Width = Convert.ToInt32(dt_ParticlesGridDevidePage.Rows[i_row]["RectWidth"]), Height = Convert.ToInt32(dt_ParticlesGridDevidePage.Rows[i_row]["RectHeight"]) };
+                        Bitmap bp_field = fielddata.ReadImageFile(str_imagePath);
+                        bp_particle = fielddata.GetBitmapByParticle(bp_field, rectangle);
+                        bp_particle.Tag = new List<string>() { dt_ParticlesGridDevidePage.Rows[i_row]["FieldId"].ToString(), dt_ParticlesGridDevidePage.Rows[i_row]["ParticleId"].ToString(), dt_ParticlesGridDevidePage.Rows[i_row]["TypeId"].ToString() };
+                    }
+
+                    //获取该颗粒的xray能谱图像
+                    System.Drawing.Bitmap bp_xraybp = ExportXRayBitmap(str_fieldid,
+                        str_particleid, Convert.ToInt32(str_typeid), str_typename, fielddata);
+
+                    //获取该颗粒的二次放大处理图像
+                    Bitmap ls_processbitmap = new Bitmap(1, 1);
+                    ls_processbitmap = (Bitmap)bp_particle.Clone();//待完善
+
+                    //再将图像转成二进制流-------------------------------------------------------------------
+                    //原图
+                    MemoryStream newms_p1 = new MemoryStream();
+                    bp_particle.Save(newms_p1, System.Drawing.Imaging.ImageFormat.Bmp);
+                    newms_p1.Seek(0, SeekOrigin.Begin);
+                    byte[] newarr_p1 = new byte[newms_p1.Length];
+                    newms_p1.Read(newarr_p1, 0, newarr_p1.Length);
+                    //---------------------------------------------------------------------------------------                  
+                    DataRow dr = DT_Largest_frame.NewRow();
+                    dr["p1"] = newarr_p1;
+                    newms_p1.Dispose();
+
+                    dr["pid"] = str_fieldid + dt_ParticlesGridDevidePage.Rows[i_row]["particleid"].ToString();
+                    dr["Size"] = Convert.ToDouble(dt_ParticlesGridDevidePage.Rows[i_row]["area"]).ToString("#0.00");  //可以需要选择切换,计算方式
+                    dr["Width"] = dt_ParticlesGridDevidePage.Rows[i_row]["rectwidth"].ToString();
+                    dr["DMAX"] = Math.Round(Convert.ToDouble(dt_ParticlesGridDevidePage.Rows[i_row]["dmax"]), 2).ToString();
+                    dr["DMIN"] = dt_ParticlesGridDevidePage.Rows[i_row]["Hardness_detailed"].ToString();
+                    dr["Class"] = dt_ParticlesGridDevidePage.Rows[i_row]["typename"].ToString();
+
+                    dr["fieldid"] = str_fieldid;
+
+                    List<string> list_max_elementname = new List<string>();
+                    List<double> list_max_elementvale = new List<double>();
+                    GetMaxElementFromDataTable(dt_ParticlesGridDevidePage, i_row, out list_max_elementname, out list_max_elementvale);
+                    //元素1
+                    dr["ColName1"] = list_max_elementname[0];
+                    dr["ColVal1"] = list_max_elementvale[0].ToString();
+                    //元素2
+                    dr["ColName2"] = list_max_elementname[1];
+                    dr["ColVal2"] = list_max_elementvale[1].ToString();
+                    //元素3
+                    dr["ColName3"] = list_max_elementname[2];
+                    dr["ColVal3"] = list_max_elementvale[2].ToString();
+                    //元素4
+                    dr["ColName4"] = list_max_elementname[3];
+                    dr["ColVal4"] = list_max_elementvale[3].ToString();
+                    //元素5
+                    dr["ColName5"] = list_max_elementname[4];
+                    dr["ColVal5"] = list_max_elementvale[4].ToString();
+                    //元素6
+                    dr["ColName6"] = list_max_elementname[5];
+                    dr["ColVal6"] = list_max_elementvale[5].ToString();
+
+
+                    DT_Largest_frame.Rows.Add(dr);
+                }
+
+            }
+            #endregion
+            FrameGraphParticleTable(dt_ParticlesGridDevidePage, str_resultPath, fielddata, DT_field_dt);
             m_list_dt.Add(DT_field_dt_copy);
             m_list_dt.Add(DT_Largest_frame);
             m_list_dt.Add(DT_Largest20);
 
             return true;
         }
+
+
         private bool JudgeWhetherItExists(int id, DataTable dt,string column)
         {
             for (int i=0;i<dt.Rows.Count;i++)
@@ -717,7 +1115,7 @@ namespace OTSIncAReportApp.OTSTemplateDesigner
                     dr["p1"] = newarr_p1;
                     newms_p1.Dispose();
 
-                    dr["pid"] = str_fieldid + dt_ParticlesGridDevidePage.Rows[i_row]["particleid"].ToString();
+                    dr["pid"] = /*str_fieldid + */dt_ParticlesGridDevidePage.Rows[i_row]["Hardness_detailed"].ToString();
                     dr["Size"] = Convert.ToDouble(dt_ParticlesGridDevidePage.Rows[i_row]["area"]).ToString("#0.00");  //可以需要选择切换,计算方式
                     dr["Width"] = dt_ParticlesGridDevidePage.Rows[i_row]["rectwidth"].ToString();
                     dr["DMAX"] = Math.Round(Convert.ToDouble(dt_ParticlesGridDevidePage.Rows[i_row]["dmax"]),2).ToString();
@@ -1353,7 +1751,8 @@ namespace OTSIncAReportApp.OTSTemplateDesigner
                             }
                         }
                         if (bl)
-                            dataTable.Rows[0][ta.Columns[a].ToString()] = Math.Round( Convert.ToDouble(decimal.Parse(ta.Compute("sum(" + ta.Columns[a].ToString() + ")", "").ToString()))/ ElementalSubstance,2);
+                            //datatSuncolumn(ta, ta.Columns[a].ToString());
+                            dataTable.Rows[0][ta.Columns[a].ToString()] = Math.Round(datatSuncolumn(ta, ta.Columns[a].ToString()) / ElementalSubstance,2);
                     }
                 }
                 dataTable.Rows[0]["Name"] = ClassName[i].ToString();
@@ -1364,6 +1763,19 @@ namespace OTSIncAReportApp.OTSTemplateDesigner
             }
             return dt_Class;
         }
+        private double  datatSuncolumn(DataTable dt ,string str)
+        {
+            double sum=0;
+            for (int i=0;i<dt.Rows.Count;i++)
+            {
+                if (dt.Rows[i][str].ToString()=="")
+                {
+                    dt.Rows[i][str] = 0;
+                }
+                sum = sum+Convert.ToDouble(dt.Rows[i][str].ToString());
+            }
+            return sum;
+        }
         private DataTable MaterialElementComposition(DataTable a_ElementalSubstance,int NumberOfColumns)
         {
             DataTable dt_ElementalSubstance = new DataTable();

+ 25 - 12
OTSIncAReportApp/1-UI/OTSTemplateDesigner/OTSReport_Export.cs

@@ -1,5 +1,6 @@
 using OTSIncAReportApp.Controls;
 using OTSIncAReportApp.DataOperation.DataAccess;
+using OTSIncAReportApp.DataOperation.Model;
 using OTSIncAReportApp.OTSSampleReportInfo;
 using OTSIncAReportApp.OTSTemplateDesigner;
 using OTSIncAReportApp.SysMgrTools;
@@ -1042,7 +1043,17 @@ namespace OTSIncAReportApp
             string arg1 = m_strDBpath.Replace(" ", "^");//参数1,是需要打开db数据库的路径
             string arg2 = tb_mblj.Text.Trim().Replace(" ", "^");//参数2,是模板文件的路径
             string arg3 = "MainReport";//主体报表
-            string arg4 = "100";//夹杂物数量
+            string arg4 = "";
+            ResultFile resfile = m_ReportApp.m_rstDataMgr.ResultFilesList[m_ReportApp.m_rstDataMgr.GetWorkingResult()];
+            if (((Dictionary<string, object>)((Dictionary<string, object>)((Dictionary<string, object>)resfile.ResultInfo["Sample"])["Members"])["MsrParams"])["SysType"].ToString() == "0:IncA")
+            {
+                 arg4 = "inca";//打卡夹杂物报告
+            }
+            else
+            {
+                arg4 = "Cleanness";//打卡清洁度报告
+            }
+                 
             string arg5 = "0-100";//打开的标记帧图图像数量
             process.Arguments = string.Format("{0} {1} {2} {3} {4}", arg1, arg2, arg3, arg4, arg5);  //多个参数用空格隔开
             process.WindowStyle = ProcessWindowStyle.Normal;
@@ -1924,7 +1935,18 @@ namespace OTSIncAReportApp
                     {
                         //判断颗粒列表是否导出
                         if (m_mbszclass.M_KLLBXX.b_ck_kllb_xsmk)
-                            m_export_reporttemplate.InsertReportTemplateTable_ParticlesGridDevidePage();
+                        {
+                            ResultFile resfile = m_ReportApp.m_rstDataMgr.ResultFilesList[m_ReportApp.m_rstDataMgr.GetWorkingResult()];
+                            if (((Dictionary<string, object>)((Dictionary<string, object>)((Dictionary<string, object>)resfile.ResultInfo["Sample"])["Members"])["MsrParams"])["SysType"].ToString() == "0:IncA")
+                            {
+                                m_export_reporttemplate.InsertReportTemplateTable_ParticlesGridDevidePage();
+                            }
+                            else
+                            {
+                                m_export_reporttemplate.InsertReportTemplateTable_ParticlesGridDevidePage_CleanlinessA();
+                            }
+                        }
+                            
                         lock (m_thread_flag)
                             m_thread_flag = strNill;
                     }
@@ -2178,8 +2200,7 @@ namespace OTSIncAReportApp
 
             //开始事务
             SQLiteTransaction tr = sh.BeginTranscation();
-            //try
-            //{
+           
                 //创建表 ResultGrid
                 string[] strcolumns_ResultGrid = { "CLJGMC", "YXSJ", "SCZS", "FLFA", "YJCTZ", "SCMJ", "CKBZ" };
                 string[] strcoltypes_ResultGrid = { "TEXT", "TEXT", "TEXT", "TEXT", "TEXT", "TEXT", "TEXT" };
@@ -2454,14 +2475,6 @@ namespace OTSIncAReportApp
                 //事务提交
                 sh.TranscationCommit(tr);
 
-            //}
-            //catch (Exception ee)
-            //{
-            //    //回滚
-            //    sh.TranscationRollback(tr);
-            //}
-            //finally
-            //{
                 //最后关闭连接
                 tr.Dispose();
                 tr = null;

+ 244 - 0
OTSIncAReportApp/3-ServiceCenter/OutPIC.cs

@@ -0,0 +1,244 @@
+using OTSIncAReportApp.DataOperation.Model;
+using OTSIncAReportGraph;
+using OTSIncAReportGraph.Controls;
+using System;
+using System.Collections.Generic;
+using System.Data;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+
+namespace OTSIncAReportApp._3_ServiceCenter
+{
+    class OutPIC
+    {
+        
+        //包含particle的field的列表对象
+        public List<DisplayField> m_list_allDfield = null;
+        public ResultFile resultFile = null;
+        public SaveFileDialog sfd = null;
+        public int type = 0;
+        /// <summary>
+        /// 获取每行图片的位置配合opencv方法使用
+        /// </summary>
+        /// <returns></returns>
+        private List<DataTable> opencv_piclist()
+        {
+            List<DataTable> list_dt_picdata = new List<DataTable>();
+            DataTable picDatat = new DataTable();
+            picDatat.Columns.Add("X", typeof(double));
+            picDatat.Columns.Add("Y", typeof(double));
+            foreach (var f in m_list_allDfield)
+            {
+                DataRow dr = picDatat.NewRow();
+                dr["X"] = f.Rect.X;
+                dr["Y"] = f.Rect.Y;
+                picDatat.Rows.Add(dr);
+            }
+            int y_max = Convert.ToInt32(picDatat.Compute("Max(Y)", "true"));
+            int y_min = Convert.ToInt32(picDatat.Compute("Min(Y)", "true"));
+            DataTable total_dt_X = picDatat.Copy();
+            DataView dv_x = total_dt_X.DefaultView;
+            DataView dv_x_2 = dv_x.ToTable(true, "X").DefaultView;
+            dv_x_2.Sort = "X ASC";
+            total_dt_X = dv_x_2.ToTable();
+
+
+            DataTable total_dt_Y = picDatat.Copy();
+            DataView dv_Y = total_dt_Y.DefaultView;
+            DataView dv_Y_2 = dv_Y.ToTable(true, "Y").DefaultView;
+            dv_Y_2.Sort = "Y ASC";
+            total_dt_Y = dv_Y_2.ToTable();
+
+
+            for (int i = 0; i < total_dt_Y.Rows.Count; i++)
+            {
+                NLog.LogManager.GetCurrentClassLogger().Info("Splice line"+i+1.ToString()+"of"+ total_dt_Y.Rows.Count.ToString()+".....");
+                DataTable data = new DataTable();
+                data.Columns.Add("mat", typeof(Bitmap));
+                data.Columns.Add("X", typeof(double));
+                for (int a = 0; a < total_dt_X.Rows.Count; a++)
+                {
+                    DataRow dr2 = data.NewRow();
+                    Bitmap bitmap = new Bitmap((int)m_list_allDfield[0].Rect.Width, (int)m_list_allDfield[0].Rect.Height);
+                    Graphics g = Graphics.FromImage(bitmap);
+                    g.Clear(Color.White);
+                    g.Dispose();
+                    dr2["mat"] = bitmap;
+                    dr2["X"] = total_dt_X.Rows[a]["X"];
+                    data.Rows.Add(dr2);
+                }
+                foreach (var f in m_list_allDfield)
+                {
+                    if (total_dt_Y.Rows[i]["Y"].ToString() == f.Rect.Y.ToString())
+                    {
+                        for (int c = 0; c < data.Rows.Count; c++)
+                        {
+                            if (data.Rows[c]["X"].ToString() == f.Rect.X.ToString())
+                            {
+                                data.Rows[c]["mat"] = f.OriginalImage;
+                                data.Rows[c]["X"] = f.Rect.X;
+                            }
+                        }
+
+                    }
+                }
+
+
+                DataView dataView1 = data.DefaultView;
+                dataView1.Sort = "X ASC";
+                data = dataView1.ToTable();
+
+
+                list_dt_picdata.Add(data);
+            }
+
+            return list_dt_picdata;
+        }
+        public void opencv_outpic(/*int type*/)
+        {
+            List<DataTable> list_dt_picdata = new List<DataTable>();
+            if (type == (int)Outpic_enum.pic)
+            {
+                list_dt_picdata = opencv_piclist();
+            }
+            else
+                    if (type == (int)Outpic_enum.Render_pic)
+            {
+                list_dt_picdata = opencv_piclist_Render();
+            }
+
+            OpenCvSharp.Mat[] list_mats = new OpenCvSharp.Mat[list_dt_picdata.Count];
+            NLog.LogManager.GetCurrentClassLogger().Info("Organize and splice all pictures......");
+            for (int i = 0; i < list_dt_picdata.Count; i++)
+            {
+                OpenCvSharp.Mat[] mats = new OpenCvSharp.Mat[list_dt_picdata[i].Rows.Count];
+                for (int a = 0; a < list_dt_picdata[i].Rows.Count; a++)
+                {
+                    mats[a] = OpenCvSharp.Extensions.BitmapConverter.ToMat((Bitmap)list_dt_picdata[i].Rows[a]["mat"]);
+                }
+                OpenCvSharp.Mat pano = new OpenCvSharp.Mat();
+                OpenCvSharp.Cv2.HConcat(mats, pano);
+                list_mats[i] = pano;
+                
+            }
+            NLog.LogManager.GetCurrentClassLogger().Info("Picture splicing completed.");
+            NLog.LogManager.GetCurrentClassLogger().Info("Save to disk......");
+            OpenCvSharp.Mat save_pano = new OpenCvSharp.Mat();
+            OpenCvSharp.Cv2.VConcat(list_mats, save_pano);
+            OpenCvSharp.Cv2.ImWrite(sfd.FileName, save_pano);
+            NLog.LogManager.GetCurrentClassLogger().Info("Save complete.");
+        }
+       
+        private List<DataTable> opencv_piclist_Render()
+        {
+            List<DataTable> list_dt_picdata = new List<DataTable>();
+            DataTable picDatat = new DataTable();
+            List<Field> fieldlist = resultFile.List_OTSField;
+            picDatat.Columns.Add("X", typeof(double));
+            picDatat.Columns.Add("Y", typeof(double));
+            foreach (var f in m_list_allDfield)
+            {
+                DataRow dr = picDatat.NewRow();
+                dr["X"] = f.Rect.X;
+                dr["Y"] = f.Rect.Y;
+                picDatat.Rows.Add(dr);
+            }
+            int y_max = Convert.ToInt32(picDatat.Compute("Max(Y)", "true"));
+            int y_min = Convert.ToInt32(picDatat.Compute("Min(Y)", "true"));
+            DataTable total_dt_X = picDatat.Copy();
+            DataView dv_x = total_dt_X.DefaultView;
+            DataView dv_x_2 = dv_x.ToTable(true, "X").DefaultView;
+            dv_x_2.Sort = "X ASC";
+            total_dt_X = dv_x_2.ToTable();
+
+
+            DataTable total_dt_Y = picDatat.Copy();
+            DataView dv_Y = total_dt_Y.DefaultView;
+            DataView dv_Y_2 = dv_Y.ToTable(true, "Y").DefaultView;
+            dv_Y_2.Sort = "Y ASC";
+            total_dt_Y = dv_Y_2.ToTable();
+
+
+            for (int i = 0; i < total_dt_Y.Rows.Count; i++)
+            {
+                NLog.LogManager.GetCurrentClassLogger().Info("Splice line" + i + 1.ToString() + "of" + total_dt_Y.Rows.Count.ToString() + ".....");
+
+                DataTable data = new DataTable();
+                data.Columns.Add("mat", typeof(Bitmap));
+                data.Columns.Add("X", typeof(double));
+                for (int a = 0; a < total_dt_X.Rows.Count; a++)
+                {
+                    DataRow dr2 = data.NewRow();
+                    Bitmap bitmap = new Bitmap((int)m_list_allDfield[0].Rect.Width, (int)m_list_allDfield[0].Rect.Height);
+                    Graphics g = Graphics.FromImage(bitmap);
+                    g.Clear(Color.White);
+                    g.Dispose();
+                    dr2["mat"] = bitmap;
+                    dr2["X"] = total_dt_X.Rows[a]["X"];
+                    data.Rows.Add(dr2);
+                }
+                foreach (var f in m_list_allDfield)
+                {
+                    if (total_dt_Y.Rows[i]["Y"].ToString() == f.Rect.Y.ToString())
+                    {
+                        for (int c = 0; c < data.Rows.Count; c++)
+                        {
+                            if (data.Rows[c]["X"].ToString() == f.Rect.X.ToString())
+                            {
+                                Bitmap image = new Bitmap(f.OriginalImage.Width, f.OriginalImage.Height);
+                                Graphics g2 = Graphics.FromImage(image);
+                                g2.DrawImage(f.OriginalImage, 0, 0, f.OriginalImage.Width, f.OriginalImage.Height);
+                                Graphics graph_2 = Graphics.FromImage(image);
+
+                                for (int a = 0; a < fieldlist.Count; a++)
+                                {
+                                    if (fieldlist[a].FieldID.ToString() == f.FieldID.ToString())
+                                    {
+                                        //先获取该Field中的所有Particle
+                                        List<Particle> list_particle;
+                                        list_particle = fieldlist[a].ParticleList;
+                                        //再循环计算所有的Particle对象
+                                        foreach (Particle particle in list_particle)
+                                        {
+                                            //创建DParticle颗粒
+                                            DisplayParticle dp = new DisplayParticle(particle);
+                                            List<Segment> list_seg;
+                                            list_seg = particle.SegmentList;
+                                            //创建颗粒分布图对应的类对象
+                                            List<DisplaySegment> list_dsegment = new List<DisplaySegment>();
+                                            //再循环取出里面所有的segment
+                                            foreach (Segment seg in list_seg)
+                                            {
+                                                #region 创建DSegment对象,并将STD分析出的化合物颜色保存到DSegment对象中
+
+                                                Point on_p = new Point() { X = seg.Start, Y = seg.Height };
+                                                Point off_p = new Point() { X = seg.Start + seg.Length, Y = seg.Height };
+                                                Pen npen = new Pen(dp.Color);
+                                                graph_2.DrawLine(npen, on_p, off_p);
+
+                                                #endregion
+                                            }
+                                        }
+                                    }
+                                }
+                                data.Rows[c]["mat"] = image;
+                                data.Rows[c]["X"] = f.Rect.X;
+                            }
+                        }
+                    }
+
+                }
+
+                DataView dataView1 = data.DefaultView;
+                dataView1.Sort = "X ASC";
+                data = dataView1.ToTable();
+                list_dt_picdata.Add(data);
+            }
+
+            return list_dt_picdata;
+        }
+    }
+}

+ 25 - 8
OTSIncAReportApp/OTSIncAReportApp.csproj

@@ -293,15 +293,21 @@
     <Compile Include="1-UI\Controls\myColorComboBox.Designer.cs">
       <DependentUpon>myColorComboBox.cs</DependentUpon>
     </Compile>
-    <Compile Include="1-UI\Control_Grids\ParticlesGridDevidePage.cs" />
+    <Compile Include="1-UI\Control_Grids\ParticlesGridDevidePage.cs">
+      <SubType>UserControl</SubType>
+    </Compile>
     <Compile Include="1-UI\Control_Grids\ParticlesGridDevidePage.Designer.cs">
       <DependentUpon>ParticlesGridDevidePage.cs</DependentUpon>
     </Compile>
-    <Compile Include="1-UI\Control_ECharts\EChart_ParticlesComposition.cs" />
+    <Compile Include="1-UI\Control_ECharts\EChart_ParticlesComposition.cs">
+      <SubType>UserControl</SubType>
+    </Compile>
     <Compile Include="1-UI\Control_ECharts\EChart_ParticlesComposition.Designer.cs">
       <DependentUpon>EChart_ParticlesComposition.cs</DependentUpon>
     </Compile>
-    <Compile Include="1-UI\Control_ECharts\EChart_Trianglediagram.cs" />
+    <Compile Include="1-UI\Control_ECharts\EChart_Trianglediagram.cs">
+      <SubType>UserControl</SubType>
+    </Compile>
     <Compile Include="1-UI\Control_ECharts\EChart_Trianglediagram.Designer.cs">
       <DependentUpon>EChart_Trianglediagram.cs</DependentUpon>
     </Compile>
@@ -342,7 +348,9 @@
     <Compile Include="1-UI\Control_Grids\CompositionDistributionGrid.designer.cs">
       <DependentUpon>CompositionDistributionGrid.cs</DependentUpon>
     </Compile>
-    <Compile Include="1-UI\Control_Grids\ElementCompositionAvgGrid.cs" />
+    <Compile Include="1-UI\Control_Grids\ElementCompositionAvgGrid.cs">
+      <SubType>UserControl</SubType>
+    </Compile>
     <Compile Include="1-UI\Control_Grids\ElementCompositionAvgGrid.designer.cs">
       <DependentUpon>ElementCompositionAvgGrid.cs</DependentUpon>
     </Compile>
@@ -436,7 +444,9 @@
     <Compile Include="1-UI\OTSMgrInfo\Triangulation_Edit.Designer.cs">
       <DependentUpon>Triangulation_Edit.cs</DependentUpon>
     </Compile>
-    <Compile Include="1-UI\frmReportApp.cs" />
+    <Compile Include="1-UI\frmReportApp.cs">
+      <SubType>Form</SubType>
+    </Compile>
     <Compile Include="1-UI\frmReportApp.Designer.cs">
       <DependentUpon>frmReportApp.cs</DependentUpon>
     </Compile>
@@ -446,11 +456,15 @@
     <Compile Include="1-UI\OTSMgrInfo\Triangulation_Item.Designer.cs">
       <DependentUpon>Triangulation_Item.cs</DependentUpon>
     </Compile>
-    <Compile Include="1-UI\OTSMgrInfo\Triangulation_List.cs" />
+    <Compile Include="1-UI\OTSMgrInfo\Triangulation_List.cs">
+      <SubType>Form</SubType>
+    </Compile>
     <Compile Include="1-UI\OTSMgrInfo\Triangulation_List.Designer.cs">
       <DependentUpon>Triangulation_List.cs</DependentUpon>
     </Compile>
-    <Compile Include="1-UI\Controls\OTSPeriodicTable\OTSPeriodicTableForm.cs" />
+    <Compile Include="1-UI\Controls\OTSPeriodicTable\OTSPeriodicTableForm.cs">
+      <SubType>Form</SubType>
+    </Compile>
     <Compile Include="1-UI\Controls\OTSPeriodicTable\OTSPeriodicTableForm.Designer.cs">
       <DependentUpon>OTSPeriodicTableForm.cs</DependentUpon>
     </Compile>
@@ -487,7 +501,9 @@
     </Compile>
     <Compile Include="1-UI\OTSTemplateDesigner\Export_NPOI_Excel.cs" />
     <Compile Include="1-UI\OTSTemplateDesigner\Export_ReportTemplate.cs" />
-    <Compile Include="1-UI\OTSTemplateDesigner\OTSReport_Export.cs" />
+    <Compile Include="1-UI\OTSTemplateDesigner\OTSReport_Export.cs">
+      <SubType>Form</SubType>
+    </Compile>
     <Compile Include="1-UI\OTSTemplateDesigner\OTSReport_Export.Designer.cs">
       <DependentUpon>OTSReport_Export.cs</DependentUpon>
     </Compile>
@@ -513,6 +529,7 @@
       <DependentUpon>OutputNlog.cs</DependentUpon>
     </Compile>
     <Compile Include="3-ServiceCenter\HardwareController.cs" />
+    <Compile Include="3-ServiceCenter\OutPIC.cs" />
     <Compile Include="Help.cs">
       <SubType>Form</SubType>
     </Compile>

+ 48 - 38
OTSIncAReportTemplate/OTSIncAReportTemplate.cs

@@ -168,7 +168,14 @@ namespace OTSIncAReportTemplate
             #region 选择报告模板
             if (m_mbszclass.M_KLLBXX.b_ck_kllb_xsmk == true && m_mbszclass.M_YSFXJG.b_ck_ysfx_xsmk == true && m_mbszclass.M_YSFXJG.b_ck_yscf_xsmk == true)
             {
-                rmReport1.LoadFromFile("Resources\\ReportTemplate\\Inca.rmf");
+                if (m_arg4== "inca")
+                {
+                    rmReport1.LoadFromFile("Resources\\ReportTemplate\\Inca.rmf");
+                }
+                else
+                {
+                    rmReport1.LoadFromFile("Resources\\ReportTemplate\\Cleanness.rmf");
+                }
             }
             else
             if (m_mbszclass.M_YSFXJG.b_ck_ysfx_xsmk == false && m_mbszclass.M_YSFXJG.b_ck_yscf_xsmk == false && m_mbszclass.M_KLLBXX.b_ck_kllb_xsmk == true)
@@ -206,40 +213,43 @@ namespace OTSIncAReportTemplate
             rmReport1.AddDataSet(ls_dt_PicInclusionAreaClassRatio, "Pic_InclusionareaClassRatio");
 
 
-            if (m_mbszclass.M_SYXT.b_ck_syxt_xsmk)//判断三元相图是否显示
+            if (m_arg4 == "inca")
             {
-                rmReport1.FindObject("GroupHeader1").Prop["Visible"] = true;
-                if (m_mbszclass.M_SYXT.str_cb_syxt_mhxssl == "2")
+                if (m_mbszclass.M_SYXT.b_ck_syxt_xsmk)//判断三元相图是否显示
                 {
-                    DataTable ls_dt_picSYXT = list_dt.Where(aa => aa.TableName.Contains("PicSYXT2T")).ToList()[0];//一排两个三元相图
-                    rmReport1.FindObject("MasterData18").Prop["Visible"] = false;
-                    rmReport1.FindObject("MasterData10").Prop["Visible"] = true;
-                    rmReport1.AddDataSet(ls_dt_picSYXT, "PicSYXT");//三元相图
-                    ls_dt_picSYXT.Dispose();
+                    rmReport1.FindObject("GroupHeader1").Prop["Visible"] = true;
+                    if (m_mbszclass.M_SYXT.str_cb_syxt_mhxssl == "2")
+                    {
+                        DataTable ls_dt_picSYXT = list_dt.Where(aa => aa.TableName.Contains("PicSYXT2T")).ToList()[0];//一排两个三元相图
+                        rmReport1.FindObject("MasterData18").Prop["Visible"] = false;
+                        rmReport1.FindObject("MasterData10").Prop["Visible"] = true;
+                        rmReport1.AddDataSet(ls_dt_picSYXT, "PicSYXT");//三元相图
+                        ls_dt_picSYXT.Dispose();
 
+                    }
+                    else if (m_mbszclass.M_SYXT.str_cb_syxt_mhxssl == "3")
+                    {
+                        DataTable ls_dt_picSYXT3T = list_dt.Where(aa => aa.TableName.Contains("PicSYXT3T")).ToList()[0];//一排三个三元相图
+                        rmReport1.FindObject("MasterData10").Prop["Visible"] = false;
+                        rmReport1.FindObject("MasterData18").Prop["Visible"] = true;
+                        rmReport1.AddDataSet(ls_dt_picSYXT3T, "PicSYXT3T");
+                        ls_dt_picSYXT3T.Dispose();
+                        //ls_dt_picSYXT3T.Clear();
+                    }
                 }
-                else if (m_mbszclass.M_SYXT.str_cb_syxt_mhxssl == "3")
+                else
                 {
-                    DataTable ls_dt_picSYXT3T = list_dt.Where(aa => aa.TableName.Contains("PicSYXT3T")).ToList()[0];//一排三个三元相图
-                    rmReport1.FindObject("MasterData10").Prop["Visible"] = false;
-                    rmReport1.FindObject("MasterData18").Prop["Visible"] = true;
-                    rmReport1.AddDataSet(ls_dt_picSYXT3T, "PicSYXT3T");
-                    ls_dt_picSYXT3T.Dispose();
-                    //ls_dt_picSYXT3T.Clear();
+                    //DataTable dataTable = new DataTable();
+                    //rmReport1.AddDataSet(dataTable, "PicSYXT2T");//三元相图
+                    //rmReport1.AddDataSet(dataTable, "PicSYXT3T");
+                    //dataTable.Dispose();
+                    //dataTable.Clear();
+                    //rmReport1.FindObject("GroupHeader81").Prop["Visible"] = false;
+                    //rmReport1.FindObject("MasterData96").Prop["Visible"] = false;
+                    //rmReport1.FindObject("MasterData10").Prop["Visible"] = false;
+                    //rmReport1.DeletePage(3);
                 }
             }
-            else
-            {
-                //DataTable dataTable = new DataTable();
-                //rmReport1.AddDataSet(dataTable, "PicSYXT2T");//三元相图
-                //rmReport1.AddDataSet(dataTable, "PicSYXT3T");
-                //dataTable.Dispose();
-                //dataTable.Clear();
-                //rmReport1.FindObject("GroupHeader81").Prop["Visible"] = false;
-                //rmReport1.FindObject("MasterData96").Prop["Visible"] = false;
-                //rmReport1.FindObject("MasterData10").Prop["Visible"] = false;
-                //rmReport1.DeletePage(3);
-            }
 
 
             if (m_mbszclass.M_SY.b_ck_ypsm)//判断样品说明是否显示
@@ -379,15 +389,15 @@ namespace OTSIncAReportTemplate
             }
             if (m_mbszclass.M_KLLBXX.b_ck_kllb_xsmk)//判断显示颗粒列表
             {
-                if (Convert.ToInt32(m_arg4) < 21)
-                {
-                    DataTable ls_dt_largest = list_dt.Where(aa => aa.TableName.Contains("Largest20")).ToList()[0];
-                    rmReport1.AddDataSet(ls_dt_largest, "Largest20");
-                    ls_dt_largest.Dispose();
-                    //ls_dt_largest.Clear();
-                }
-                else
-                {
+                //if (Convert.ToInt32(m_arg4) < 21)
+                //{
+                //    DataTable ls_dt_largest = list_dt.Where(aa => aa.TableName.Contains("Largest20")).ToList()[0];
+                //    rmReport1.AddDataSet(ls_dt_largest, "Largest20");
+                //    ls_dt_largest.Dispose();
+                //    //ls_dt_largest.Clear();
+                //}
+                //else
+                //{
                     DataTable ls_dt_largest = list_dt.Where(aa => aa.TableName.Contains("Largest20")).ToList()[0];
                     rmReport1.AddDataSet(ls_dt_largest, "Largest20");
                     ls_dt_largest.Dispose();
@@ -397,7 +407,7 @@ namespace OTSIncAReportTemplate
                     rmReport1.AddDataSet(ls_dt_largest2, "Largest2");
                     ls_dt_largest2.Dispose();
                     //ls_dt_largest2.Clear();
-                }
+                //}
                 //FlushMemory();
                 #region 主副表
                 DataTable ls_dt_frame = list_dt.Where(aa => aa.TableName.Contains("FrameGraphSubTable")).ToList()[0].Copy();//副表

+ 6 - 8
OTSIncAReportTemplate/OTSIncAReportTemplate.csproj

@@ -53,7 +53,7 @@
     <DefineConstants>DEBUG;TRACE</DefineConstants>
     <DebugType>full</DebugType>
     <PlatformTarget>x86</PlatformTarget>
-    <GenerateSerializationAssemblies>On</GenerateSerializationAssemblies>
+    <GenerateSerializationAssemblies>Auto</GenerateSerializationAssemblies>
     <LangVersion>7.3</LangVersion>
     <ErrorReport>prompt</ErrorReport>
   </PropertyGroup>
@@ -77,6 +77,11 @@
     <ErrorReport>prompt</ErrorReport>
     <Prefer32Bit>true</Prefer32Bit>
   </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release_oxford50|x86'">
+    <PlatformTarget>x86</PlatformTarget>
+    <OutputPath>..\Bin\x64\Release_oxford50\</OutputPath>
+    <GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
+  </PropertyGroup>
   <ItemGroup>
     <Reference Include="EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
       <HintPath>..\packages\EntityFramework.6.4.4\lib\net45\EntityFramework.dll</HintPath>
@@ -101,14 +106,7 @@
       <SpecificVersion>False</SpecificVersion>
       <HintPath>..\Bin\x64\Debug\ReportTemplateExe\System.Data.SQLite.dll</HintPath>
     </Reference>
-    <Reference Include="System.Data.SQLite.EF6, Version=1.0.114.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139, processorArchitecture=MSIL">
-      <HintPath>..\packages\System.Data.SQLite.EF6.1.0.114.0\lib\net46\System.Data.SQLite.EF6.dll</HintPath>
-    </Reference>
-    <Reference Include="System.Data.SQLite.Linq, Version=1.0.114.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139, processorArchitecture=MSIL">
-      <HintPath>..\packages\System.Data.SQLite.Linq.1.0.114.0\lib\net46\System.Data.SQLite.Linq.dll</HintPath>
-    </Reference>
     <Reference Include="System.Xml.Linq" />
-    <Reference Include="System.Data.DataSetExtensions" />
     <Reference Include="Microsoft.CSharp" />
     <Reference Include="System.Data" />
     <Reference Include="System.Deployment" />