Kaynağa Gözat

新增echar夹杂物面积比饼图,将夹杂物饼图加入至报告中

zhangjiaxin 3 yıl önce
ebeveyn
işleme
7f0ed8232a

BIN
Bin/x64/Debug/Resources/ReportTemplate/group1.rmf


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

@@ -892,6 +892,7 @@
 	  <Control name="AllParticles" text="AllParticles" />
 	  <Control name="SelectParticles" text="SelectParticles" />
 	  <Control name="DataSourceType" text="DataSourceType" />
+	  <Control name="InclusionAreaRatio" text="InclusionAreaRatio" />
     </Controls>
  </Form>
   <Form>

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

@@ -888,6 +888,7 @@
 	  <Control name="AllParticles" text="全部颗粒" />
 	  <Control name="SelectParticles" text="选择颗粒" />
 	  <Control name="DataSourceType" text="数据源类型" />
+	  <Control name="InclusionAreaRatio" text="夹杂物面积比" />
     </Controls>
  </Form>
  <Form>

+ 72 - 0
OTSIncAReportApp/1-UI/Control_ECharts/EChart_ParticlesComposition.cs

@@ -1,6 +1,7 @@
 using CefSharp;
 using CefSharp.WinForms;
 using Newtonsoft.Json;
+using OTSIncAReportApp.DataOperation.DataAccess;
 using OTSIncAReportApp.DataOperation.Model;
 using OTSIncAReportApp.OTSDataMgrFunction;
 using OTSIncAReportApp.OTSSampleReportInfo;
@@ -245,6 +246,72 @@ namespace OTSIncAReportApp.Control_ECharts
             return chart;
         }
 
+        private Chartdate GetInclusionAreaRatioData(string path)
+        {
+            DataOperation.DataAccess.ParticleData particledata = new DataOperation.DataAccess.ParticleData(path);
+            //创建新的图形数据源
+            Chartdate chart = new Chartdate();
+            chart.Title = m_ReportApp.m_reportname;
+            chart.YName = m_str_AxisY;
+
+            int sel = m_ReportApp.m_conditionChoose.m_SourceGridData.GetComboDownListIndexByItemName(OTS_REPORT_PROP_GRID_ITEMS.DATA_SOURCE_TYPE);
+            DataTable dt = particledata.GetAreaByAllIncA("");
+            //设置标签名称
+            List<string> listName = new List<string>();
+            //ListName
+            for (int i = 0; i < dt.Rows.Count; i++)
+            {
+                if (Convert.ToInt32(dt.Rows[i]["TypeId"]) < 100)
+                {
+                    continue;
+                }
+                listName.Add(dt.Rows[i]["TypeName"].ToString());
+            }
+            //for (int i = 0; i < dt.Rows.Count; i++)
+            //{
+            //    if (Convert.ToInt32(dt.Rows[i]["TypeId"]) > 100)
+            //    {
+            //        continue;
+            //    }
+            //    int index = FLID.IndexOf(Convert.ToInt32(dt.Rows[i]["TypeId"]));
+            //    if (index == -1)
+            //    {
+            //        index = 7;
+            //    }
+            //    string name = NameList[index];
+            //    if (listName.IndexOf(name) == -1)
+            //    {
+            //        listName.Add(name);
+
+            //    }
+            //}
+            chart.ListName = listName;
+
+            //设置数据
+            List<Item> listData = new List<Item>();
+            //ListData
+            for (int k = 0; k < dt.Rows.Count; k++)
+            {
+                string str = dt.Rows[k]["ar"].ToString();
+                string name = dt.Rows[k]["TypeName"].ToString();
+                if (Convert.ToInt32(dt.Rows[k]["TypeId"]) < 100)
+                {
+                    continue;
+                }
+
+                Item item = new Item()
+                {
+                    value = decimal.Round(decimal.Parse(dt.Rows[k]["ar"].ToString()), 2).ToString(),
+                    name = name
+                };
+                listData.Add(item);
+
+            }
+            chart.ListData = listData;
+            return chart;
+        }
+
+
         /// <summary>
         /// 获取颗粒成分数据
         /// </summary>
@@ -532,7 +599,12 @@ namespace OTSIncAReportApp.Control_ECharts
                 case "PSize":
                     chartdate = GetPSizeData(m_DataMgr.ResultFilesList[m_DataMgr.GetWorkingResult()].FilePath);
                     break;
+                case "InclusionareaRatio":
+                    chartdate = GetInclusionAreaRatioData(m_DataMgr.ResultFilesList[m_DataMgr.GetWorkingResult()].FilePath);
+                    break;
             }
+
+
             list.Add(chartdate);
             return list;
         }

+ 118 - 114
OTSIncAReportApp/1-UI/Control_Grids/ParticlesGridDevidePage.cs

@@ -1469,132 +1469,136 @@ namespace OTSIncAReportGrids
             DirectoryInfo theFolder = new DirectoryInfo(str_path_FIELD_FILES);
             if (theFolder.Exists)
             {
-                int numberOfPictures = 1;
-                for (int i = 0; i < theFolder.GetFiles().Count() - 1; i++)
-                {
-                    //if (dt_AllParticle.Select("  fieldid = " + i.ToString()).Count() == 0)
-                    //    continue;
-                    if (numberOfPictures > 10)
-                        continue;
+                //int numberOfPictures = 1;
+                //for (int i = 0; i < theFolder.GetFiles().Count() - 1; i++)
+                //{
+                //    //if (dt_AllParticle.Select("  fieldid = " + i.ToString()).Count() == 0)
+                //    //    continue;
+                //    if (numberOfPictures > 10)
+                //        continue;
 
-                    if (dataTable.Select(" fieldid = " + i.ToString()).Count() > 0)
-                    {
-                        numberOfPictures++;
-                        Image img = Image.FromFile(str_path_FIELD_FILES + theFolder.GetFiles()[i].Name);
-                        Bitmap ls_fieldbp = new Bitmap(img.Width, img.Height, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
-                        using (Graphics g = Graphics.FromImage(ls_fieldbp))
-                        {
-                            g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;
-                            g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
-                            g.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighQuality;
-                            g.DrawImage(img, 0, 0);
-                        }
+                //    if (dataTable.Select(" fieldid = " + i.ToString()).Count() > 0)
+                //    {
+                //        numberOfPictures++;
+                //        Image img = Image.FromFile(str_path_FIELD_FILES + theFolder.GetFiles()[i].Name);
+                //        Bitmap ls_fieldbp = new Bitmap(img.Width, img.Height, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
+                //        using (Graphics g = Graphics.FromImage(ls_fieldbp))
+                //        {
+                //            g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;
+                //            g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
+                //            g.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighQuality;
+                //            g.DrawImage(img, 0, 0);
+                //        }
 
-                        img.Dispose();
-                        img = null;
+                //        img.Dispose();
+                //        img = null;
 
-                        //循环将颗粒,进行标记到bitmap图上
-                        DataRow[] drlist = dt_AllParticle.Select("  fieldid = " + i.ToString());
-                        for (int i_row = 0; i_row < drlist.Count(); i_row++)
-                        {
-                            //string str_fieldid = drlist[i_row]["fieldid"].ToString();
-                            string str_particleid = drlist[i_row]["particleid"].ToString();
-                            string str_stdtypeid = drlist[i_row]["typeid"].ToString();
-                            string str_offset_rect_X = drlist[i_row]["RectLeft"].ToString();
-                            string str_offset_rect_Y = drlist[i_row]["RectTop"].ToString();
-                            string str_offset_rect_Width = drlist[i_row]["RectWidth"].ToString();
-                            string str_offset_rect_Height = drlist[i_row]["RectHeight"].ToString();
-
-                            //确定需要标记颗粒的定位
-                            Rectangle offset_rect = new Rectangle(Convert.ToInt32(str_offset_rect_X), Convert.ToInt32(str_offset_rect_Y),
-                    Convert.ToInt32(str_offset_rect_Width), Convert.ToInt32(str_offset_rect_Height));
-
-                            //向帧图进行标记颗粒位置
-                            Graphics g = Graphics.FromImage(ls_fieldbp);
-                            g.DrawRectangle(new Pen(Color.Aquamarine), offset_rect);
-
-                            //判断是否超出了图像外面,是的话,让文字在左侧显示,默认在右侧显示
-                            int ls_offsetx = offset_rect.X + offset_rect.Width;
-                            if (ls_offsetx > ls_fieldbp.Width - 10)
-                            {
-                                ls_offsetx = offset_rect.X - 10;
-                            }
-                            g.DrawString(i.ToString() + "" + str_particleid.ToString(),
-                                new Font("黑体", 8), new SolidBrush(Color.Aqua), new PointF(ls_offsetx, offset_rect.Y));
+                //        //循环将颗粒,进行标记到bitmap图上
+                //        DataRow[] drlist = dt_AllParticle.Select("  fieldid = " + i.ToString());
+                //        for (int i_row = 0; i_row < drlist.Count(); i_row++)
+                //        {
+                //            //string str_fieldid = drlist[i_row]["fieldid"].ToString();
+                //            string str_particleid = drlist[i_row]["particleid"].ToString();
+                //            string str_stdtypeid = drlist[i_row]["typeid"].ToString();
+                //            string str_offset_rect_X = drlist[i_row]["RectLeft"].ToString();
+                //            string str_offset_rect_Y = drlist[i_row]["RectTop"].ToString();
+                //            string str_offset_rect_Width = drlist[i_row]["RectWidth"].ToString();
+                //            string str_offset_rect_Height = drlist[i_row]["RectHeight"].ToString();
+
+                //            //确定需要标记颗粒的定位
+                //            Rectangle offset_rect = new Rectangle(Convert.ToInt32(str_offset_rect_X), Convert.ToInt32(str_offset_rect_Y),
+                //    Convert.ToInt32(str_offset_rect_Width), Convert.ToInt32(str_offset_rect_Height));
+
+                //            //向帧图进行标记颗粒位置
+                //            Graphics g = Graphics.FromImage(ls_fieldbp);
+                //            g.DrawRectangle(new Pen(Color.Aquamarine), offset_rect);
+
+                //            //判断是否超出了图像外面,是的话,让文字在左侧显示,默认在右侧显示
+                //            int ls_offsetx = offset_rect.X + offset_rect.Width;
+                //            if (ls_offsetx > ls_fieldbp.Width - 10)
+                //            {
+                //                ls_offsetx = offset_rect.X - 10;
+                //            }
+                //            g.DrawString(i.ToString() + "" + str_particleid.ToString(),
+                //                new Font("黑体", 8), new SolidBrush(Color.Aqua), new PointF(ls_offsetx, offset_rect.Y));
 
-                            //保存带有标记的帧图
-                            ls_fieldbp.Save(str_path_FIELD_FILES_MARK + i.ToString() + ".bmp");
+                //            //保存带有标记的帧图
+                //            ls_fieldbp.Save(str_path_FIELD_FILES_MARK + i.ToString() + ".bmp");
 
-                            //ls_fieldbp.Dispose();
-                        }
-                    }
+                //            //ls_fieldbp.Dispose();
+                //        }
+                //    }
 
 
-                }
+                //}
 
 
 
-                ////循环帧图,再循环各帧图中的颗粒,进行标记,保存
-                //foreach (FileInfo nextifile in theFolder.GetFiles())
-                //{
-                //    //找出所有的用户库文件,在这个目录中
-                //    if (nextifile.Name.Contains(".bmp") == true || nextifile.Name.Contains(".BMP") == true)
-                //    {
-                //        //确认对应的帧图名
-                //        string str_fieldid = Path.GetFileNameWithoutExtension(nextifile.Name);
-                //        str_fieldid = str_fieldid.Substring(5, str_fieldid.Length - 5);//减去field字符长度
-                //        if (dataTable.Select(" fieldid = " + str_fieldid).Count() > 0)
-                //        {
-                //            Image img = Image.FromFile(nextifile.FullName);
-                //            Bitmap ls_fieldbp = new Bitmap(img.Width, img.Height, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
-                //            using (Graphics g = Graphics.FromImage(ls_fieldbp))
-                //            {
-                //                g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;
-                //                g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
-                //                g.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighQuality;
-                //                g.DrawImage(img, 0, 0);
-                //            }
+                //循环帧图,再循环各帧图中的颗粒,进行标记,保存
+                foreach (FileInfo nextifile in theFolder.GetFiles())
+                {
+                    //找出所有的用户库文件,在这个目录中
+                    if (nextifile.Name.Contains(".bmp") == true || nextifile.Name.Contains(".BMP") == true)
+                    {
+                        //确认对应的帧图名
+                        string str_fieldid = Path.GetFileNameWithoutExtension(nextifile.Name);
+                        str_fieldid = str_fieldid.Substring(5, str_fieldid.Length - 5);//减去field字符长度
 
-                //            img.Dispose();
-                //            img = null;
+                        if (Convert.ToInt32(str_fieldid.ToString()) > 10)
+                            continue;
 
-                //            //循环将颗粒,进行标记到bitmap图上
-                //            DataRow[] drlist = dt_AllParticle.Select("  fieldid = " + str_fieldid);
-                //            for (int i_row = 0; i_row < drlist.Count(); i_row++)
-                //            {
-                //                //string str_fieldid = drlist[i_row]["fieldid"].ToString();
-                //                string str_particleid = drlist[i_row]["particleid"].ToString();
-                //                string str_stdtypeid = drlist[i_row]["typeid"].ToString();
-                //                string str_offset_rect_X = drlist[i_row]["RectLeft"].ToString();
-                //                string str_offset_rect_Y = drlist[i_row]["RectTop"].ToString();
-                //                string str_offset_rect_Width = drlist[i_row]["RectWidth"].ToString();
-                //                string str_offset_rect_Height = drlist[i_row]["RectHeight"].ToString();
-
-                //                //确定需要标记颗粒的定位
-                //                Rectangle offset_rect = new Rectangle(Convert.ToInt32(str_offset_rect_X), Convert.ToInt32(str_offset_rect_Y),
-                //        Convert.ToInt32(str_offset_rect_Width), Convert.ToInt32(str_offset_rect_Height));
-
-                //                //向帧图进行标记颗粒位置
-                //                Graphics g = Graphics.FromImage(ls_fieldbp);
-                //                g.DrawRectangle(new Pen(Color.Aquamarine), offset_rect);
-
-                //                //判断是否超出了图像外面,是的话,让文字在左侧显示,默认在右侧显示
-                //                int ls_offsetx = offset_rect.X + offset_rect.Width;
-                //                if (ls_offsetx > ls_fieldbp.Width - 10)
-                //                {
-                //                    ls_offsetx = offset_rect.X - 10;
-                //                }
-                //                g.DrawString(str_fieldid + "" + str_particleid.ToString(),
-                //                    new Font("黑体", 8), new SolidBrush(Color.Aqua), new PointF(ls_offsetx, offset_rect.Y));
-
-                //                //保存带有标记的帧图
-                //                ls_fieldbp.Save(str_path_FIELD_FILES_MARK + str_fieldid.ToString() + ".bmp");
-
-                //                //ls_fieldbp.Dispose();
-                //            }
-                //        }
-                //    }
-                //}
+                        if (dataTable.Select(" fieldid = " + str_fieldid).Count() > 0)
+                        {
+                            Image img = Image.FromFile(nextifile.FullName);
+                            Bitmap ls_fieldbp = new Bitmap(img.Width, img.Height, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
+                            using (Graphics g = Graphics.FromImage(ls_fieldbp))
+                            {
+                                g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;
+                                g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
+                                g.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighQuality;
+                                g.DrawImage(img, 0, 0);
+                            }
+
+                            img.Dispose();
+                            img = null;
+
+                            //循环将颗粒,进行标记到bitmap图上
+                            DataRow[] drlist = dt_AllParticle.Select("  fieldid = " + str_fieldid);
+                            for (int i_row = 0; i_row < drlist.Count(); i_row++)
+                            {
+                                //string str_fieldid = drlist[i_row]["fieldid"].ToString();
+                                string str_particleid = drlist[i_row]["particleid"].ToString();
+                                string str_stdtypeid = drlist[i_row]["typeid"].ToString();
+                                string str_offset_rect_X = drlist[i_row]["RectLeft"].ToString();
+                                string str_offset_rect_Y = drlist[i_row]["RectTop"].ToString();
+                                string str_offset_rect_Width = drlist[i_row]["RectWidth"].ToString();
+                                string str_offset_rect_Height = drlist[i_row]["RectHeight"].ToString();
+
+                                //确定需要标记颗粒的定位
+                                Rectangle offset_rect = new Rectangle(Convert.ToInt32(str_offset_rect_X), Convert.ToInt32(str_offset_rect_Y),
+                        Convert.ToInt32(str_offset_rect_Width), Convert.ToInt32(str_offset_rect_Height));
+
+                                //向帧图进行标记颗粒位置
+                                Graphics g = Graphics.FromImage(ls_fieldbp);
+                                g.DrawRectangle(new Pen(Color.Aquamarine), offset_rect);
+
+                                //判断是否超出了图像外面,是的话,让文字在左侧显示,默认在右侧显示
+                                int ls_offsetx = offset_rect.X + offset_rect.Width;
+                                if (ls_offsetx > ls_fieldbp.Width - 10)
+                                {
+                                    ls_offsetx = offset_rect.X - 10;
+                                }
+                                g.DrawString(str_fieldid + "" + str_particleid.ToString(),
+                                    new Font("黑体", 8), new SolidBrush(Color.Aqua), new PointF(ls_offsetx, offset_rect.Y));
+
+                                //保存带有标记的帧图
+                                ls_fieldbp.Save(str_path_FIELD_FILES_MARK + str_fieldid.ToString() + ".bmp");
+
+                                //ls_fieldbp.Dispose();
+                            }
+                        }
+                    }
+                }
             }
             //
             GC.Collect();

+ 2 - 0
OTSIncAReportApp/1-UI/OTSDisplaySourceGridData/OTSSampleReportInfo/OTSSampleReportInfo.cs

@@ -72,6 +72,8 @@ namespace OTSIncAReportApp.OTSSampleReportInfo
         ELEMENT_COMP = 2,
         PARTICALE_SIZE_DISTRIBUTION = 3,
         TRIO_CHART = 4,
+        INCLUSION_AREA_RATIO=5,
+
 
 
     }

+ 17 - 3
OTSIncAReportApp/1-UI/OTSDisplaySourceGridData/frmReportConditionChoose.cs

@@ -120,6 +120,7 @@ namespace OTSIncAReportApp
             string allParticles = resTable["allparticles"].ToString();//全部颗粒
             string selectParticles = resTable["selectparticles"].ToString();//选择颗粒
             string dataSourceType = resTable["datasourcetype"].ToString();//数据源类型
+            string InclusionAreaRatio = resTable["inclusionarearatio"].ToString();//夹杂物面积比
             #endregion
 
 
@@ -158,7 +159,7 @@ namespace OTSIncAReportApp
             list2.AddRange(listStd);
             AddGridData(OTS_REPORT_PROP_GRID_ITEMS.CALCULATE_TABLE_TYPE, dataTableType, OTS_ITEM_TYPES.COMBO, false, "Data table type", list2[0], list2, CALCULATE_TABLE_TYPE.MEASURE_INFO);
             // chart condition items
-            List<string> list22 = new List<string>() { commonClassification, granularComponent, elementComposition, particleSizeDistribution, ternaryPhaseDiagram };
+            List<string> list22 = new List<string>() { commonClassification, granularComponent, elementComposition, particleSizeDistribution, ternaryPhaseDiagram , InclusionAreaRatio };
             AddGridData(OTS_REPORT_PROP_GRID_ITEMS.CALCULATE_CHART_TYPE, dataTableType, OTS_ITEM_TYPES.COMBO, false, "Data graph type", list22[0], list22, CALCULATE_CHART_TYPE.COMMON_FIVE);
             //三元相图模板
             List<string> trio_listname = m_rstDataMgr.GetTriTemplateNameList();
@@ -828,7 +829,7 @@ namespace OTSIncAReportApp
                             m_ReportApp.im_EChart_ParticlesComposition.Dock = DockStyle.Fill;
                             m_ReportApp.m_reportname = m_reportname;
                             m_ReportApp.im_EChart_ParticlesComposition.m_str_AxisY = m_str_AxisY;
-                            m_ReportApp.type = "bar";
+                            m_ReportApp.type = "pie";
                             m_ReportApp.m_ChartsWindow.Controls.Add(m_ReportApp.im_EChart_ParticlesComposition);
                             m_ReportApp.m_ChartsWindow.Activate();
                             break;
@@ -841,7 +842,7 @@ namespace OTSIncAReportApp
                             m_ReportApp.im_EChart_ParticlesComposition.Dock = DockStyle.Fill;
                             m_ReportApp.m_reportname = m_reportname;
                             m_ReportApp.im_EChart_ParticlesComposition.m_str_AxisY = m_str_AxisY;
-                            m_ReportApp.type = "bar";
+                            m_ReportApp.type = "pie";
                             m_ReportApp.m_ChartsWindow.Controls.Add(m_ReportApp.im_EChart_ParticlesComposition);
                             m_ReportApp.m_ChartsWindow.Activate();
                             break;
@@ -860,6 +861,19 @@ namespace OTSIncAReportApp
                             m_ReportApp.m_ChartsWindow.Controls.Add(m_ReportApp.im_EChart_Trianglediagram);
                             m_ReportApp.m_ChartsWindow.Activate();
                             break;
+
+                        case CALCULATE_CHART_TYPE.INCLUSION_AREA_RATIO:
+                            m_reportname = "夹杂物面积比";
+                            m_str_AxisY = "平方微米";
+
+                            m_ReportApp.im_EChart_ParticlesComposition = new Control_ECharts.EChart_ParticlesComposition(m_ReportApp, "InclusionareaRatio");
+                            m_ReportApp.im_EChart_ParticlesComposition.Dock = DockStyle.Fill;
+                            m_ReportApp.m_reportname = m_reportname;
+                            m_ReportApp.im_EChart_ParticlesComposition.m_str_AxisY = m_str_AxisY;
+                            m_ReportApp.type = "pie";
+                            m_ReportApp.m_ChartsWindow.Controls.Add(m_ReportApp.im_EChart_ParticlesComposition);
+                            m_ReportApp.m_ChartsWindow.Activate();
+                            break;
                     }
                     #endregion 第三页窗体,分析数据图
                     break;

+ 65 - 0
OTSIncAReportApp/1-UI/OTSTemplateDesigner/Export_ReportTemplate.cs

@@ -754,6 +754,28 @@ namespace OTSIncAReportApp.OTSTemplateDesigner
         }
         #endregion
 
+        private DataTable GetPicDataTable_InclusionAreaRatio()
+        {
+            if (m_list_dt.Where(aa => aa.TableName.Contains("Pic_InclusionAreaRatio")).ToList().Count == 0)
+            {
+                //创建二进制列的数据表
+                DataTable ls_dt = new DataTable();
+                ls_dt.TableName = "Pic_InclusionAreaRatio";
+                DataColumn colpict = new DataColumn("pict");
+                colpict.DataType = System.Type.GetType("System.Byte[]");
+                ls_dt.Columns.Add(colpict);
+
+                m_list_dt.Add(ls_dt);
+
+                return ls_dt;
+            }
+            else
+            {
+                return m_list_dt.Where(aa => aa.TableName.Contains("Pic_InclusionAreaRatio")).ToList()[0];
+            }
+        }
+
+
         #region 插入元素图chart
         /// <summary>
         /// 用于元素图chart
@@ -781,6 +803,49 @@ namespace OTSIncAReportApp.OTSTemplateDesigner
         }
         #endregion
 
+        #region 插入夹杂物面积比图
+        public bool InsertReportTemplateChart_InclusionAreaRatio(string a_GraphicStyle)
+        {
+            //加载模块
+            m_otsreport_export.m_ReportApp.im_EChart_ParticlesComposition = new EChart_ParticlesComposition(m_otsreport_export.m_ReportApp, "InclusionareaRatio");
+            m_otsreport_export.m_ReportApp.m_reportname = "夹杂物面积比";
+            m_otsreport_export.m_ReportApp.type = a_GraphicStyle;
+            m_otsreport_export.m_ReportApp.timerKG = true;
+            m_otsreport_export.m_ReportApp.m_ChartsWindow.Controls.Add(m_otsreport_export.m_ReportApp.im_EChart_ParticlesComposition);
+
+            //弹出加载图片窗体
+            OTSReport_GetEChartImage og = new OTSReport_GetEChartImage();
+
+            //将EChart委托事件注册给加载图片窗体的方法
+            m_otsreport_export.m_ReportApp.im_EChart_ParticlesComposition.butclic += og.get_ParticalesCompositionChart;
+            og.ShowDialog();
+
+            //获取图片数据
+            string str = og.PicStr;
+
+            //将Base64String转为图片并保存
+            byte[] arr = Convert.FromBase64String(str.Substring(str.IndexOf(',') + 1));
+            MemoryStream ms = new MemoryStream(arr);
+            System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(ms);
+
+            //再将图转成流,流再转二进制-------------------------------------------
+            MemoryStream newms = new MemoryStream();
+            bmp.Save(newms, System.Drawing.Imaging.ImageFormat.Bmp);
+            newms.Seek(0, SeekOrigin.Begin);
+            byte[] newarr = new byte[newms.Length];
+            newms.Read(newarr, 0, newarr.Length);
+            newms.Dispose();
+            DataTable ls_dt = GetPicDataTable_InclusionAreaRatio();
+
+            DataRow dr = ls_dt.NewRow();
+            dr["pict"] = newarr;//图像二进制
+            ls_dt.Rows.Add(dr);
+
+            return true;
+        }
+        #endregion
+
+
         #region 插入颗粒成份图
         /// <summary>
         /// 向 模板设计器 中插入 颗粒成份图

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

@@ -1298,6 +1298,11 @@ namespace OTSIncAReportApp
                 string[] strcoltypes_PicKL = { "BLOB" };
                 sh.CreateTable("PicKL", strcolumns_PicKL, strcoltypes_PicKL);
 
+                //创建表 夹杂物面积比
+                string[] strcolumns_PicInclusionAreaRatio = { "pict" };
+                string[] strcoltypes_PicInclusionAreaRatio = { "BLOB" };
+                sh.CreateTable("PicInclusionAreaRatio", strcolumns_PicKL, strcoltypes_PicKL);
+
                 //创建表 PicYS
                 string[] strcolumns_PicYS = { "pict" };
                 string[] strcoltypes_PicYS = { "BLOB" };
@@ -1553,6 +1558,25 @@ namespace OTSIncAReportApp
                     int iresult = sh.ExecuteQuery(ls_sqlstr, "pict", byte_p1, tr);
                 }
 
+                //插入 Pic_InclusionAreaRatio
+                DataTable ls_PicInclusionAreaRatio = list_dt.Where(aa => aa.TableName.Contains("Pic_InclusionAreaRatio")).ToList()[0];
+                for (int i = 0; i < ls_PicInclusionAreaRatio.Rows.Count; i++)
+                {
+                    if (ls_PicInclusionAreaRatio.Rows[i][0] == null)
+                    {
+                        continue;
+                    }
+                    if (ls_PicInclusionAreaRatio.Rows[i][0] == DBNull.Value)
+                    {
+                        continue;
+                    }
+
+                    string ls_sqlstr = "insert into PicInclusionAreaRatio (pict) values(:pict)";
+                    byte[] byte_p1 = (byte[])ls_PicInclusionAreaRatio.Rows[i][0];
+                    int iresult = sh.ExecuteQuery(ls_sqlstr, "pict", byte_p1, tr);
+                }
+
+
                 //插入 PicYS
                 DataTable ls_PicYS = list_dt.Where(aa => aa.TableName.Contains("PicYS")).ToList()[0];
                 for (int i = 0; i < ls_PicYS.Rows.Count; i++)
@@ -1815,6 +1839,7 @@ namespace OTSIncAReportApp
                     if (ls_str.IndexOf(table["rictbox18"].ToString()) > -1)
                     {
                         m_export_reporttemplate.InsertReportTemplateTable_ElementCompositionAvgGrid();
+                        m_export_reporttemplate.InsertReportTemplateChart_InclusionAreaRatio("pie");
                         lock (m_thread_flag)
                             m_thread_flag = strNill;
                     }

+ 10 - 0
OTSIncAReportTemplate/OTSIncAReportTemplate.cs

@@ -199,6 +199,10 @@ namespace OTSIncAReportTemplate
             rmReport1.AddDataSet(ls_dt_AreaRatio, "AreaRatio");
 
 
+            DataTable ls_dt_PicInclusionAreaRatio = list_dt.Where(aa => aa.TableName.Contains("PicInclusionAreaRatio")).ToList()[0];
+            rmReport1.AddDataSet(ls_dt_PicInclusionAreaRatio, "PicInclusionAreaRatio");
+
+
             if (m_mbszclass.M_SYXT.b_ck_syxt_xsmk)//判断三元相图是否显示
             {
                 rmReport1.FindObject("GroupHeader81").Prop["Visible"] = true;
@@ -943,6 +947,12 @@ namespace OTSIncAReportTemplate
             ls_PicYS.TableName = "PicYS";
             list_dt.Add(ls_PicYS);
 
+
+            DataTable ls_PicInclusionAreaRatio = sh.ExecuteQuery("select * from PicInclusionAreaRatio");
+            ls_PicInclusionAreaRatio.TableName = "PicInclusionAreaRatio";
+            list_dt.Add(ls_PicInclusionAreaRatio);
+
+
             DataTable ls_PicSYXT2T = sh.ExecuteQuery("select * from PicSYXT2T");
             ls_PicSYXT2T.TableName = "PicSYXT2T";
             list_dt.Add(ls_PicSYXT2T);