فهرست منبع

修复优化颗粒列表引起的bug并重新修改获取总条目方式

CXS 3 سال پیش
والد
کامیت
4f6c66d856

+ 2 - 0
OTSIncAReportApp/Control_Grids/ParticlesGridDevidePage.Designer.cs

@@ -226,6 +226,7 @@
             this.cbB_order.Name = "cbB_order";
             this.cbB_order.Size = new System.Drawing.Size(160, 26);
             this.cbB_order.TabIndex = 1;
+            this.cbB_order.Visible = false;
             this.cbB_order.SelectedIndexChanged += new System.EventHandler(this.cbB_order_SelectedIndexChanged);
             // 
             // label_order
@@ -237,6 +238,7 @@
             this.label_order.Size = new System.Drawing.Size(89, 18);
             this.label_order.TabIndex = 0;
             this.label_order.Text = "排序方式:";
+            this.label_order.Visible = false;
             // 
             // panel1
             // 

+ 19 - 16
OTSIncAReportApp/Control_Grids/ParticlesGridDevidePage.cs

@@ -16,6 +16,7 @@ using System.Drawing;
 using System.Drawing.Imaging;
 using System.IO;
 using System.Linq;
+using System.Reflection;
 using System.Threading;
 using System.Windows.Forms;
 
@@ -161,8 +162,18 @@ namespace OTSIncAReportGrids
         {
             m_ReportApp = ReportApp;
             result = m_ReportApp.resultFilesList[m_ReportApp.WorkingResult];
+
+            //设置窗体的双缓冲
+            this.SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.ResizeRedraw | ControlStyles.AllPaintingInWmPaint, true);
+            this.UpdateStyles();
+
             InitializeComponent();
 
+            //利用反射设置DataGridView的双缓冲
+            Type dgvType = this.dgV_ParticlesDevidePage.GetType();
+            PropertyInfo pi = dgvType.GetProperty("DoubleBuffered",BindingFlags.Instance | BindingFlags.NonPublic);
+            pi.SetValue(this.dgV_ParticlesDevidePage, true, null);
+
             m_frm_userprogress = new Frm_UserProgress();
 
             m_mythread_state = false;
@@ -366,6 +377,8 @@ namespace OTSIncAReportGrids
 
         private void BindDataGridView()
         {
+            dgV_ParticlesDevidePage.Visible = false;
+
             #region 加载显示进度条部份
             this.Cursor = Cursors.WaitCursor;
             m_frm_userprogress = new Frm_UserProgress();
@@ -525,7 +538,8 @@ namespace OTSIncAReportGrids
 
             string filePath = result.FilePath + "\\FIELD_FILES\\";
             KeyValuePair<string, Bitmap> FieldImage = new KeyValuePair<string, Bitmap>();
-            int DelParticlesCount = 0;        //此值= 合成拼接颗粒的所有子颗粒数目-拼接颗粒数目 , 颗粒总数 = 所有子颗粒数目 - 合成拼接颗粒的所有子颗粒数目 + 拼接颗粒数目;
+
+            RecordCount = fielddata.GetCountOfParticles(condition) + fielddata.GetCountOfMergedParticles(condition); //此值= 合成拼接颗粒的所有子颗粒数目-拼接颗粒数目 , 颗粒总数 = 所有子颗粒数目 - 合成拼接颗粒的所有子颗粒数目 + 拼接颗粒数目;
 
             for (int i = 0; i < particles.Rows.Count; i++)
             {
@@ -570,20 +584,6 @@ namespace OTSIncAReportGrids
                                     dgV_ParticlesDevidePage.Rows[add_rowindex].Cells[k].Value = bmap;
                                     dgV_ParticlesDevidePage.Rows[add_rowindex].Cells[k].Style.BackColor = Color.Azure;
                                     dgV_ParticlesDevidePage.Rows[add_rowindex].DefaultCellStyle.ForeColor = Color.Chocolate;
-
-                                    DelParticlesCount+= str.Length-1;
-
-                                    //在颗粒总数中去除合成拼接颗粒的所有子颗粒数目
-                                    foreach (var part in str)
-                                    {
-                                        DataRow[] foundRow;
-                                        foundRow = particles.Select("fieldid = "+part.Split(':')[0]+ "and particleid = "+ part.Split(':')[1], "");
-                                        foreach (DataRow row in foundRow)
-                                        {
-                                            particles.Rows.Remove(row);
-                                        }
-                                    }
-
                                 }
                                 else
                                 {
@@ -661,7 +661,8 @@ namespace OTSIncAReportGrids
                     }
                 }
             }
-            RecordCount = fielddata.GetCountOfPsrticles(condition)- DelParticlesCount;
+            
+
             #region 加载进度条进度部份结束
             //加载完成设置鼠标为默认
             this.Cursor = Cursors.Default;
@@ -670,6 +671,8 @@ namespace OTSIncAReportGrids
             //加载完成,关闭进度条
             m_frm_userprogress.Close();
             #endregion
+
+            dgV_ParticlesDevidePage.Visible = true;
         }
 
 

+ 7 - 7
OTSIncAReportApp/DataOperation/DataAccess/ParticleData.cs

@@ -387,22 +387,22 @@ namespace OTSIncAReportApp.DataOperation.DataAccess
         /// </summary>
         /// <param name="condition"></param>
         /// <returns></returns>
-        public int GetCountOfMergedPsrticles(string condition)
+        public int GetCountOfMergedParticles(string condition)
         {
-            string sqliteString = "select count(*) from MergedParticleInfo " + condition;
+            string sqliteString = "select count(*) from MergedParticleInfo where 1=1 " + condition;
             DataTable DT = dbHelper.ExecuteQuery(sqliteString);
-            int Count = int.Parse(DT.Rows[0]["Count"].ToString());
+            int Count = int.Parse(DT.Rows[0][0].ToString());
             return Count;
         }
 
         /// <summary>
-        /// 获取正常颗粒总数,包含组成合并颗粒的几个部分
+        /// 获取正常颗粒总数,去除组成合并颗粒的几个部分
         /// </summary>
         /// <param name="condition"></param>
         /// <returns></returns>
-        public int GetCountOfPsrticles(string condition)
+        public int GetCountOfParticles(string condition)
         {
-            string sqliteString = "select count(*) from INcAData where 1=1 " + condition;
+            string sqliteString = "select count ( * ) from INcAData where xrayid > -1"+condition+" and instr(','||(select ifnull(group_concat(SubParticles, ','),'') from MergedParticleInfo)|| ',',',' || fieldid || ':' || particleid || ',')= 0 ";
             DataTable DT = dbHelper.ExecuteQuery(sqliteString);
             int Count = int.Parse(DT.Rows[0][0].ToString());
             return Count;
@@ -418,7 +418,7 @@ namespace OTSIncAReportApp.DataOperation.DataAccess
         public DataTable GetInfoForPartucleDevidePage(int currentPage, int pagesize, string OrderFunction, string condition)
         {
             int p = (currentPage - 1) * pagesize;
-            string sqliteString = "select fieldid,particleid,AveGray,RectLeft,RectTop,RectWidth,RectHeight,Area,PosX,PosY,TypeId,ElementNum,SegmentNum,FieldPosX as 'SEMPosX',FieldPosY as 'SEMPosY',ParticleId,DMAX,DMIN,DPERP,PERIMETER,ORIENTATION,DINSCR,DMEAN,DELONG,DFERET,TypeName,TypeColor,SubParticles, (select group_concat(name || '-' || Percentage, ';') from ElementChemistry where XRayId = MergedParticleInfo.XRayId and fieldid = MergedParticleInfo.fieldid) as Element from MergedParticleInfo where 1=1 " + condition + " union select fieldid,particleid,AveGray,RectLeft,RectTop,RectWidth,RectHeight,Area,PosX,PosY,TypeId,ElementNum,SegmentNum,FieldPosX,FieldPosY,ParticleId,DMAX,DMIN,DPERP,PERIMETER,ORIENTATION,DINSCR,DMEAN,DELONG,DFERET,TypeName,TypeColor,'' as SubParticles,(select group_concat(name || '-' || Percentage, ';') from ElementChemistry where XRayId = INcAData.XRayId and fieldid = INcAData.fieldid  ) as Element from INcAData where xrayid > -1 and instr(','||(select ifnull(group_concat(SubParticles, '&'),'') from MergedParticleInfo)|| ',',',' || fieldid || ':' || particleid || ',')= 0 " + condition + " order by " + OrderFunction + " limit " + pagesize.ToString() + " offset " + p.ToString();
+            string sqliteString = "select fieldid,particleid,AveGray,RectLeft,RectTop,RectWidth,RectHeight,Area,PosX,PosY,TypeId,ElementNum,SegmentNum,FieldPosX as 'SEMPosX',FieldPosY as 'SEMPosY',ParticleId,DMAX,DMIN,DPERP,PERIMETER,ORIENTATION,DINSCR,DMEAN,DELONG,DFERET,TypeName,TypeColor,SubParticles, (select group_concat(name || '-' || Percentage, ';') from ElementChemistry where XRayId = MergedParticleInfo.XRayId and fieldid = MergedParticleInfo.fieldid) as Element from MergedParticleInfo where 1=1 " + condition + " union select fieldid,particleid,AveGray,RectLeft,RectTop,RectWidth,RectHeight,Area,PosX,PosY,TypeId,ElementNum,SegmentNum,FieldPosX,FieldPosY,ParticleId,DMAX,DMIN,DPERP,PERIMETER,ORIENTATION,DINSCR,DMEAN,DELONG,DFERET,TypeName,TypeColor,'' as SubParticles,(select group_concat(name || '-' || Percentage, ';') from ElementChemistry where XRayId = INcAData.XRayId and fieldid = INcAData.fieldid  ) as Element from INcAData where xrayid > -1 and instr(','||(select ifnull(group_concat(SubParticles, ','),'') from MergedParticleInfo)|| ',',',' || fieldid || ':' || particleid || ',')= 0 " + condition + " order by " + OrderFunction + " limit " + pagesize.ToString() + " offset " + p.ToString();
             DataTable DT = dbHelper.ExecuteQuery(sqliteString);
             return DT;
         }