瀏覽代碼

添加颗粒列表排序
处理IfElementAnalysis字段添加后报告大分组显示错误的问题

cxs 1 年之前
父節點
當前提交
7af95d4e80

+ 10 - 2
OTSCPP/OTSClassifyEngine/ExpressionParseEngine/ParticleSTDDB.cpp

@@ -73,7 +73,15 @@ namespace OTSClassifyEngine
 		CString cmdstr = "select * from ClassifySTD left join STDGroups on ClassifySTD.GroupId=STDGroups.id";
 		auto query = myDB->GetCommandStringQuery(cmdstr);
 		ASSERT(query);
-		
+		int cols = query->GetColCount();
+		int defineCols =(int) CParticleSTDTable::ColumnID::MAX -(int) CParticleSTDTable::ColumnID::MIN;
+		if (cols != defineCols)
+		{
+			LogErrorTrace(__FILE__, __LINE__, _T("std db version is not match!"));
+			return NULL;
+		}
+
+
 		auto partstdlist= ReadParticleSTDList(query);
 		partStd->setSTDList(partstdlist);
 
@@ -85,7 +93,7 @@ namespace OTSClassifyEngine
 	PartSTDRuleItemList CParticleSTDDB::ReadParticleSTDList(CDBQueryBasePtr a_query)
 	{
 		PartSTDRuleItemList listSTDItem;
-
+		
 		int nRowId = 0;
 		int nWrongItems = 0;
 		while (!a_query->IsEOF())

+ 5 - 1
OTSCPP/OTSClassifyEngine/SpectrumCompareEngine/OTSSTDLibFileMgr.cpp

@@ -105,7 +105,11 @@ namespace OTSClassifyEngine
 
 		GetParticleSTDDB();
 
-		 m_pParticleSTDDB->GetPartSTDLib(lib,bClear);
+		 
+		 if (m_pParticleSTDDB->GetPartSTDLib(lib,bClear) == NULL)
+		 {
+			 return false;
+		 }
 
 		return TRUE;
 	}

+ 2 - 1
OTSIncAReportApp/1-UI/Control_Grids/ParticlesGridDevidePage.Designer.cs

@@ -430,7 +430,7 @@
             this.ToolStripMenuItemDelete_Particle,
             this.ImportSTDDb});
             this.contextMenuStrip1.Name = "contextMenuStrip1";
-            this.contextMenuStrip1.Size = new System.Drawing.Size(211, 252);
+            this.contextMenuStrip1.Size = new System.Drawing.Size(211, 230);
             // 
             // ToolStripMenuItem1
             // 
@@ -541,6 +541,7 @@
             this.dgV_ParticlesDevidePage.RowTemplate.Height = 23;
             this.dgV_ParticlesDevidePage.Size = new System.Drawing.Size(1502, 741);
             this.dgV_ParticlesDevidePage.TabIndex = 5;
+            this.dgV_ParticlesDevidePage.SortCompare += new System.Windows.Forms.DataGridViewSortCompareEventHandler(this.dgV_ParticlesDevidePage_SortCompare);
             this.dgV_ParticlesDevidePage.MouseDown += new System.Windows.Forms.MouseEventHandler(this.dgV_ParticlesDevidePage_MouseDown);
             // 
             // ParticlesGridDevidePage

+ 11 - 18
OTSIncAReportApp/1-UI/Control_Grids/ParticlesGridDevidePage.cs

@@ -584,7 +584,6 @@ namespace OTSIncAReportGrids
 
             dgV_ParticlesDevidePage.Rows.Clear();
             dgV_ParticlesDevidePage.Columns.Clear();
-            //string startFun = ((Dictionary<string, object>)((Dictionary<string, object>)((Dictionary<string, object>)result.ResultInfo["Sample"])["Members"])["MsrParams"])["SysType"].ToString();
 
             var startFun = m_ReportApp.m_RptConfigFile.Systype;
             //从报告xml文件中加载,显示计算列,显示元素信息
@@ -715,8 +714,12 @@ namespace OTSIncAReportGrids
                     }
                     else
                     {
-                        /*int columndid = */
                         dgV_ParticlesDevidePage.Columns.Add(en.Current.Key, en.Current.Value);
+                        if (en.Current.Key == "Area" || en.Current.Key == "EquivalentCircleDiameter" || en.Current.Key == "MaxDiameter" || en.Current.Key == "MinDiameter" || en.Current.Key == "DiameterRatio" || en.Current.Key == "FerretDiameter" || en.Current.Key == "PERP" || en.Current.Key == "PERI" || en.Current.Key == "INSCR" || en.Current.Key == "MEAN" || en.Current.Key == "ELONG" || en.Current.Key == "ASPECT_ELONG" || en.Current.Key == "Orientation")
+                        {
+                            int id = dgV_ParticlesDevidePage.Columns.Count;
+                            dgV_ParticlesDevidePage.Columns[id - 1].Tag = "NumericType";
+                        }
                     }
 
                 }
@@ -746,6 +749,8 @@ namespace OTSIncAReportGrids
             for (int i = 0; i < ElementTypeSort.Count; i++)
             {
                 dgV_ParticlesDevidePage.Columns.Add(ElementTypeSort[i], ElementTypeSort[i]);
+                int id = dgV_ParticlesDevidePage.Columns.Count;
+                dgV_ParticlesDevidePage.Columns[id - 1].Tag = "NumericType";
             }
             double jd = 95f / (double)particles.Rows.Count;//计算进度刻度
 
@@ -1057,24 +1062,10 @@ namespace OTSIncAReportGrids
         private void dgV_ParticlesDevidePage_SortCompare(object sender, DataGridViewSortCompareEventArgs e)
         {
             //排序中
-            if (this.dgV_ParticlesDevidePage.Rows[e.RowIndex1].Tag != null && this.dgV_ParticlesDevidePage.Rows[e.RowIndex1].Tag.ToString() == "统计行")
-            {
-                //ROW1>ROW2  
-                e.SortResult = 1;
-                if (this.dgV_ParticlesDevidePage.SortOrder == SortOrder.Descending)
-                    e.SortResult = -1;
-                e.Handled = true;
-                return;
-            }
-
-            if (this.dgV_ParticlesDevidePage.Rows[e.RowIndex2].Tag != null && this.dgV_ParticlesDevidePage.Rows[e.RowIndex2].Tag.ToString() == "统计行")
+            if (e.Column.Tag != null && e.Column.Tag.ToString() == "NumericType")
             {
-                //ROW1<ROW2  
-                e.SortResult = -1;
-                if (this.dgV_ParticlesDevidePage.SortOrder == SortOrder.Descending)
-                    e.SortResult = 1;
+                e.SortResult = double.Parse(e.CellValue1.ToString()).CompareTo(double.Parse(e.CellValue2.ToString()));
                 e.Handled = true;
-                return;
             }
         }
 
@@ -1878,6 +1869,7 @@ namespace OTSIncAReportGrids
 
             if (sfd.ShowDialog() == DialogResult.OK)
             {
+                Cursor = Cursors.WaitCursor;
                 //IWorkbook workbook = new HSSFWorkbook();   //用于创建.xls  office2003开始以前的
                 IWorkbook workbook = new NPOI.XSSF.UserModel.XSSFWorkbook();        //用于创建.xlsx office2007开始以后的
                 ISheet sheet;
@@ -2064,6 +2056,7 @@ namespace OTSIncAReportGrids
 
                 MessageBox.Show("Export complete!");
 
+                Cursor = Cursors.Default;
                 //导出完成后,打开Excel文件
                 if (File.Exists(sfd.FileName))
                 {