Browse Source

修复大数据量导出报告显示图片不稳定的bug,修改饼状图中存在多个Invalid项的问题(修改为不显示)

zhangjiaxin 3 years ago
parent
commit
ed5fa29d50

+ 23 - 3
OTSIncAReportApp/1-UI/Control_ECharts/EChart_ParticlesComposition.cs

@@ -303,7 +303,8 @@ namespace OTSIncAReportApp.Control_ECharts
             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("");
+            DataTable data = particledata.GetAreaByAllIncA("");
+            DataTable dt = ConSolidateInvalid(data);
             //设置标签名称
             List<string> listName = new List<string>();
             //ListName
@@ -395,7 +396,9 @@ namespace OTSIncAReportApp.Control_ECharts
             keyValues_ResultGrid.TryGetValue(ls_resultgrid.table["col5"].ToString(), out str_SCZS);//视场总数
 
             DataOperation.DataAccess.ParticleData particledata = new DataOperation.DataAccess.ParticleData(path);
-            DataTable AreaInformationOfAllElements = particledata.GetAreaByAllIncA("");//获取所有分类面积和数量信息
+           
+            DataTable data = particledata.GetAreaByAllIncA("");//获取所有分类面积和数量信息
+            DataTable AreaInformationOfAllElements = ConSolidateInvalid(data);
             DataTable AllAnalysisDetails = new DataTable();
             AllAnalysisDetails.Columns.Add("Name");
             AllAnalysisDetails.Columns.Add("TypeId");
@@ -501,7 +504,24 @@ namespace OTSIncAReportApp.Control_ECharts
             }
             return AllAnalysisDetails1;
         }
-
+        private DataTable ConSolidateInvalid(DataTable dt)
+        {
+           
+            DataTable dt_invalid = dt.Clone();
+            DataTable dt_no_invalid = dt.Clone();
+            for (int i = 0; i < dt.Rows.Count; i++)
+            {
+                if (dt.Rows[i]["TypeName"].ToString()=="Invalid")
+                {
+                    dt_invalid.Rows.Add(dt.Rows[i].ItemArray);
+                }
+                else
+                {
+                    dt_no_invalid.Rows.Add(dt.Rows[i].ItemArray);
+                }
+            }
+            return dt_no_invalid;
+        }
         /// <summary>
         /// 获取颗粒成分数据
         /// </summary>

+ 3 - 2
OTSIncAReportApp/1-UI/Control_ECharts/EChart_Trianglediagram.Designer.cs

@@ -39,10 +39,11 @@
             // 
             // EChart_Trianglediagram
             // 
-            this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 18F);
+            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+            this.Margin = new System.Windows.Forms.Padding(2);
             this.Name = "EChart_Trianglediagram";
-            this.Size = new System.Drawing.Size(1160, 715);
+            this.Size = new System.Drawing.Size(773, 477);
             this.Load += new System.EventHandler(this.EChart_Trianglediagram_Load);
             this.ResumeLayout(false);
 

+ 1 - 0
OTSIncAReportApp/1-UI/Control_ECharts/EChart_Trianglediagram.cs

@@ -628,6 +628,7 @@ namespace OTSIncAReportApp.Control_ECharts
                 butclic(m_ReportApp.js.MessageText);
                 timer1.Enabled = false;
                 m_ReportApp.timerKG = false;
+                m_ReportApp.js.MessageText = "";
             }
         }
 

+ 48 - 9
OTSIncAReportApp/1-UI/OTSTemplateDesigner/Export_ReportTemplate.cs

@@ -1425,6 +1425,10 @@ namespace OTSIncAReportApp.OTSTemplateDesigner
                 for (int i = 0; i < ls_gv.Rows.Count; i++)
                 {
                     DataRow dr2 = ls_element_dt.NewRow();
+                    if (ls_gv.Rows[i].Cells[1].Value.ToString()== "Invalid")
+                    {
+                        continue;
+                    }
                     dr2["PName"] = ls_gv.Rows[i].Cells[1].Value.ToString();
                     dr2["Count"] = ls_gv.Rows[i].Cells[2].Value.ToString();
 
@@ -2331,19 +2335,28 @@ namespace OTSIncAReportApp.OTSTemplateDesigner
 
 
             //加载模块
-            m_otsreport_export.m_ReportApp.im_EChart_Trianglediagram = new EChart_Trianglediagram(m_otsreport_export.m_ReportApp, TemplateList[selectindex]);
+            //m_otsreport_export.m_ReportApp.im_EChart_Trianglediagram = new EChart_Trianglediagram(m_otsreport_export.m_ReportApp, TemplateList[selectindex]);
+            //m_otsreport_export.m_ReportApp.timerKG = true;
+            //m_otsreport_export.m_ReportApp.im_EChart_Trianglediagram.condition = m_otsreport_export.m_mbszclass.M_SYXT.index_cb_syxt_jsfs;
+            //m_otsreport_export.m_ReportApp.im_EChart_Trianglediagram.Report = true;
+            //m_otsreport_export.m_ReportApp.m_ChartsWindow.Controls.Add(m_otsreport_export.m_ReportApp.im_EChart_Trianglediagram);
+
+
+
+            EChart_Trianglediagram eChart_Trianglediagram= new EChart_Trianglediagram(m_otsreport_export.m_ReportApp, TemplateList[selectindex]);
             m_otsreport_export.m_ReportApp.timerKG = true;
-            m_otsreport_export.m_ReportApp.im_EChart_Trianglediagram.condition = m_otsreport_export.m_mbszclass.M_SYXT.index_cb_syxt_jsfs;
-            m_otsreport_export.m_ReportApp.im_EChart_Trianglediagram.Report = true;
-            m_otsreport_export.m_ReportApp.m_ChartsWindow.Controls.Add(m_otsreport_export.m_ReportApp.im_EChart_Trianglediagram);
+            eChart_Trianglediagram.condition = m_otsreport_export.m_mbszclass.M_SYXT.index_cb_syxt_jsfs;
+            eChart_Trianglediagram.Report = true;
+            m_otsreport_export.m_ReportApp.m_ChartsWindow.Controls.Add(eChart_Trianglediagram);
 
             //ls_echart_trianglediagram.
             //弹出加载图片窗体
-            OTSReport_GetEChartImage og = new OTSReport_GetEChartImage();
 
+            OTSReport_GetEChartImage og = new OTSReport_GetEChartImage();
+            //System.Threading.Thread.Sleep(2000);
             //将EChart委托事件注册给加载图片窗体的方法
-            m_otsreport_export.m_ReportApp.im_EChart_Trianglediagram.butclic += og.get_ParticalesCompositionChart;
-
+            //m_otsreport_export.m_ReportApp.im_EChart_Trianglediagram.butclic += og.get_ParticalesCompositionChart;
+            eChart_Trianglediagram.butclic += og.get_ParticalesCompositionChart;
             og.ShowDialog();
 
             //获取图片数据
@@ -2351,18 +2364,23 @@ namespace OTSIncAReportApp.OTSTemplateDesigner
 
             //将Base64String转为图片并保存
             byte[] arr = Convert.FromBase64String(str.Substring(str.IndexOf(',') + 1));
-            MemoryStream ms = new MemoryStream(arr);
+            using (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);
             newarr = new byte[newms.Length];
             newms.Read(newarr, 0, newarr.Length);
             newms.Dispose();
-
+            };
 
             return newarr;
         }
@@ -2375,6 +2393,27 @@ namespace OTSIncAReportApp.OTSTemplateDesigner
         {
             try
             {
+                ////创建二进制列的数据表,循环插入三元选择的模板
+                //DataTable dt_pic = GetPicDataTable_PicSYXT2T();
+                //List<byte[]> lt_by = new List<byte[]>();
+                //for (int i = 0; i < m_otsreport_export.m_mbszclass.M_SYXT.list_lbv_syxt_mblb_index.Count; i ++)
+                //{
+                //    byte[] newarr, newarr2;
+                //    newarr = GetByte_InsertReportTemplateChart_Trianglediagram(m_otsreport_export.m_mbszclass.M_SYXT.list_lbv_syxt_mblb_index[i]);
+                //    lt_by.Add(newarr);
+                    
+                //    newarr2 = null;
+                //    DataRow dr = dt_pic.NewRow();
+                //    dr["pict"] = newarr;//图像二进制
+                //    dr["pict2"] = newarr2;//图像二进制
+                //    dt_pic.Rows.Add(dr);
+                //}
+                //if (lt_by.GroupBy(i => i).Where(g => g.Count() > 1).Count() >= 1)
+                //{
+                //    MessageBox.Show("图片重复");
+                //}
+
+
                 //创建二进制列的数据表,循环插入三元选择的模板
                 DataTable ls_dt = GetPicDataTable_PicSYXT2T();
                 DataTable ls_dt3t = GetPicDataTable_PicSYXT3T();

+ 37 - 37
OTSIncAReportApp/1-UI/OTSTemplateDesigner/OTSReport_TemplateDesignerRM.Designer.cs

@@ -75,12 +75,12 @@
             this.label33 = new System.Windows.Forms.Label();
             this.label42 = new System.Windows.Forms.Label();
             this.groupBox8 = new System.Windows.Forms.GroupBox();
-            this.groupBox3 = new System.Windows.Forms.GroupBox();
+            this.groupBox_zt = new System.Windows.Forms.GroupBox();
             this.ParticleList_5 = new System.Windows.Forms.Label();
             this.cb_FrameChart_p2 = new System.Windows.Forms.ComboBox();
             this.ParticleList_4 = new System.Windows.Forms.Label();
             this.cb_FrameChart_p1 = new System.Windows.Forms.ComboBox();
-            this.groupBox2 = new System.Windows.Forms.GroupBox();
+            this.groupBox_px = new System.Windows.Forms.GroupBox();
             this.comboBox_p3 = new System.Windows.Forms.ComboBox();
             this.ParticleList_3 = new System.Windows.Forms.Label();
             this.comboBox_p2 = new System.Windows.Forms.ComboBox();
@@ -120,8 +120,8 @@
             this.groupBox6.SuspendLayout();
             this.groupBox7.SuspendLayout();
             this.groupBox8.SuspendLayout();
-            this.groupBox3.SuspendLayout();
-            this.groupBox2.SuspendLayout();
+            this.groupBox_zt.SuspendLayout();
+            this.groupBox_px.SuspendLayout();
             this.panel2.SuspendLayout();
             ((System.ComponentModel.ISupportInitialize)(this.pictureBox8)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.pictureBox6)).BeginInit();
@@ -624,8 +624,8 @@
             // 
             // groupBox8
             // 
-            this.groupBox8.Controls.Add(this.groupBox3);
-            this.groupBox8.Controls.Add(this.groupBox2);
+            this.groupBox8.Controls.Add(this.groupBox_zt);
+            this.groupBox8.Controls.Add(this.groupBox_px);
             this.groupBox8.Controls.Add(this.ck_kllb_npxx);
             this.groupBox8.Controls.Add(this.ck_kllb_fdtx);
             this.groupBox8.Controls.Add(this.ck_kllb_ystx);
@@ -643,18 +643,18 @@
             this.groupBox8.TabStop = false;
             this.groupBox8.Text = "颗粒列表";
             // 
-            // groupBox3
+            // groupBox_zt
             // 
-            this.groupBox3.Controls.Add(this.ParticleList_5);
-            this.groupBox3.Controls.Add(this.cb_FrameChart_p2);
-            this.groupBox3.Controls.Add(this.ParticleList_4);
-            this.groupBox3.Controls.Add(this.cb_FrameChart_p1);
-            this.groupBox3.Location = new System.Drawing.Point(9, 227);
-            this.groupBox3.Name = "groupBox3";
-            this.groupBox3.Size = new System.Drawing.Size(249, 125);
-            this.groupBox3.TabIndex = 55;
-            this.groupBox3.TabStop = false;
-            this.groupBox3.Text = "帧图表";
+            this.groupBox_zt.Controls.Add(this.ParticleList_5);
+            this.groupBox_zt.Controls.Add(this.cb_FrameChart_p2);
+            this.groupBox_zt.Controls.Add(this.ParticleList_4);
+            this.groupBox_zt.Controls.Add(this.cb_FrameChart_p1);
+            this.groupBox_zt.Location = new System.Drawing.Point(9, 227);
+            this.groupBox_zt.Name = "groupBox_zt";
+            this.groupBox_zt.Size = new System.Drawing.Size(249, 125);
+            this.groupBox_zt.TabIndex = 55;
+            this.groupBox_zt.TabStop = false;
+            this.groupBox_zt.Text = "帧图表";
             // 
             // ParticleList_5
             // 
@@ -696,20 +696,20 @@
             this.cb_FrameChart_p1.Size = new System.Drawing.Size(216, 20);
             this.cb_FrameChart_p1.TabIndex = 54;
             // 
-            // groupBox2
-            // 
-            this.groupBox2.Controls.Add(this.comboBox_p3);
-            this.groupBox2.Controls.Add(this.ParticleList_3);
-            this.groupBox2.Controls.Add(this.comboBox_p2);
-            this.groupBox2.Controls.Add(this.ParticleList_2);
-            this.groupBox2.Controls.Add(this.ParticleList_1);
-            this.groupBox2.Controls.Add(this.comboBox_p1);
-            this.groupBox2.Location = new System.Drawing.Point(9, 55);
-            this.groupBox2.Name = "groupBox2";
-            this.groupBox2.Size = new System.Drawing.Size(249, 166);
-            this.groupBox2.TabIndex = 54;
-            this.groupBox2.TabStop = false;
-            this.groupBox2.Text = "最大排序表";
+            // groupBox_px
+            // 
+            this.groupBox_px.Controls.Add(this.comboBox_p3);
+            this.groupBox_px.Controls.Add(this.ParticleList_3);
+            this.groupBox_px.Controls.Add(this.comboBox_p2);
+            this.groupBox_px.Controls.Add(this.ParticleList_2);
+            this.groupBox_px.Controls.Add(this.ParticleList_1);
+            this.groupBox_px.Controls.Add(this.comboBox_p1);
+            this.groupBox_px.Location = new System.Drawing.Point(9, 55);
+            this.groupBox_px.Name = "groupBox_px";
+            this.groupBox_px.Size = new System.Drawing.Size(249, 166);
+            this.groupBox_px.TabIndex = 54;
+            this.groupBox_px.TabStop = false;
+            this.groupBox_px.Text = "最大排序表";
             // 
             // comboBox_p3
             // 
@@ -1105,10 +1105,10 @@
             this.groupBox7.PerformLayout();
             this.groupBox8.ResumeLayout(false);
             this.groupBox8.PerformLayout();
-            this.groupBox3.ResumeLayout(false);
-            this.groupBox3.PerformLayout();
-            this.groupBox2.ResumeLayout(false);
-            this.groupBox2.PerformLayout();
+            this.groupBox_zt.ResumeLayout(false);
+            this.groupBox_zt.PerformLayout();
+            this.groupBox_px.ResumeLayout(false);
+            this.groupBox_px.PerformLayout();
             this.panel2.ResumeLayout(false);
             this.panel2.PerformLayout();
             ((System.ComponentModel.ISupportInitialize)(this.pictureBox8)).EndInit();
@@ -1204,8 +1204,8 @@
         private System.Windows.Forms.Button button3;
         private System.Windows.Forms.GroupBox groupBZ;
         private System.Windows.Forms.TextBox textBox_strBZ;
-        private System.Windows.Forms.GroupBox groupBox2;
-        private System.Windows.Forms.GroupBox groupBox3;
+        private System.Windows.Forms.GroupBox groupBox_px;
+        private System.Windows.Forms.GroupBox groupBox_zt;
         private System.Windows.Forms.Label ParticleList_5;
         private System.Windows.Forms.ComboBox cb_FrameChart_p2;
         private System.Windows.Forms.Label ParticleList_4;

+ 12 - 22
OTSIncAReportTemplate/OTSIncAReportTemplate.cs

@@ -207,8 +207,18 @@ namespace OTSIncAReportTemplate
                     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.FindObject("MasterData18").Prop["Visible"] = false;
+                    List<byte[]> list_by = new List<byte[]>();
+                    for (int i = 0; i < ls_dt_picSYXT.Rows.Count;i++)
+                    {
+                        list_by.Add((byte[])ls_dt_picSYXT.Rows[i][0]);
+                    }
+
+                    if (list_by.GroupBy(i => i).Where(g => g.Count() > 1).Count() >= 1)
+                    {
+                        MessageBox.Show("图片重复");
+                    }
+                    rmReport1.FindObject("MasterData10").Prop["Visible"] = true;
                         rmReport1.AddDataSet(ls_dt_picSYXT, "PicSYXT");//三元相图
                         ls_dt_picSYXT.Dispose();
 
@@ -875,17 +885,6 @@ namespace OTSIncAReportTemplate
             ls_ResultGrid.TableName = "ResultGrid";
             list_dt.Add(ls_ResultGrid);
             
-
-            //string strmix = m_arg5.Substring(0, m_arg5.IndexOf("-"));
-            //MessageBox.Show(strmix);
-            //string strmax = m_arg5.Substring(m_arg5.IndexOf("-") + 1, m_arg5.Length - m_arg5.IndexOf("-") - 1);
-            //MessageBox.Show(strmax);
-
-            //DataTable ls_Largest_frame2 = sh.ExecuteQuery("select * from Largest_frame where cast(fieldid as int) > " + "1" + " and cast(fieldid as int) < " + "100" + " ");
-            //ls_Largest_frame2.TableName = "Largest_frame";
-            //list_dt.Add(ls_Largest_frame2);
-
-            //DataTable ls_FrameGraphSubTable = sh.ExecuteQuery("select * from FrameGraphSubTable where cast(fieldid as int) > " + strmix + " and cast(fieldid as int) < " + strmax + " ");
             DataTable ls_FrameGraphSubTable = sh.ExecuteQuery("select * from FrameGraphSubTable ");
             ls_FrameGraphSubTable.TableName = "FrameGraphSubTable";
             list_dt.Add(ls_FrameGraphSubTable);
@@ -899,12 +898,6 @@ namespace OTSIncAReportTemplate
             ls_AreaRatio.TableName = "AreaRatio";
             list_dt.Add(ls_AreaRatio);
 
-
-            //DataTable ls_Largest2new = sh.ExecuteQuery("select * from Largest2new");
-            //ls_Largest2new.TableName = "Largest2new";
-            //list_dt.Add(ls_Largest2new);
-
-            //DataTable ls_field_dt = sh.ExecuteQuery("select * from field_dt where cast(fieldid as int) > " + strmix + " and cast(fieldid as int) < " + strmax + " ");
             DataTable ls_field_dt = sh.ExecuteQuery("select * from field_dt ");
             ls_field_dt.TableName = "field_dt";
             list_dt.Add(ls_field_dt);
@@ -929,9 +922,6 @@ namespace OTSIncAReportTemplate
             ls_Particel_subdivision.TableName = "Particel_subdivision";
             list_dt.Add(ls_Particel_subdivision);
 
-            //DataTable ls_PicKL = sh.ExecuteQuery("select * from PicKL");
-            //ls_PicKL.TableName = "PicKL";
-            //list_dt.Add(ls_PicKL);
 
             DataTable ls_PicYS = sh.ExecuteQuery("select * from PicYS");
             ls_PicYS.TableName = "PicYS";