Просмотр исходного кода

修改无颗粒概况报错的bug

cxs 1 неделя назад
Родитель
Сommit
0011fd19db

+ 8 - 2
OTSIncAReportApp/1-UI/Control_Grids/ParticlesGridDevidePage/ListOfSimilarParticles.cs

@@ -188,7 +188,7 @@ namespace OTSIncAReportApp._1_UI.Control_Grids.ParticlesGridDevidePage
 
             //设置每列的宽度
             dgV_SimilarParticles.Columns[0].Width = 30;//第一列序号的宽度设置一下吧,要不太丑
-            dgV_SimilarParticles.Columns[1].Width = 50;
+            dgV_SimilarParticles.Columns[1].Width = 100;
             for (int i = 4; i < dgV_SimilarParticles.Columns.Count; i++)
             {
                 dgV_SimilarParticles.Columns[i].Width = 65;
@@ -425,7 +425,13 @@ namespace OTSIncAReportApp._1_UI.Control_Grids.ParticlesGridDevidePage
                             double num = 0;
                             if (double.TryParse(particles.Rows[i][enl.Current.Key].ToString(), out num))
                             {
-                                dgV_SimilarParticles.Rows[add_rowindex].Cells[k].Value = Math.Round(num, 2);
+                                if (enl.Current.Key == "SimilarRatio")
+                                {
+                                    dgV_SimilarParticles.Rows[add_rowindex].Cells[k].Value = Math.Round(num, 5);
+                                }
+                                else 
+                                { 
+                                    dgV_SimilarParticles.Rows[add_rowindex].Cells[k].Value = Math.Round(num, 2);}
                             }
                             else if (enl.Current.Key == "Element")
                             {

+ 8 - 4
OTSIncAReportApp/3-ServiceCenter/DataOperation/DataAccess/FieldData.cs

@@ -144,13 +144,17 @@ namespace OTSIncAReportApp.DataOperation.DataAccess
         /// <returns></returns>
         public double GetparticleArea()
         {
-            //存放查询数据的数据表
             DataTable DT = null;
-
-
             string sql = "select sum(Area) from IncAData";
             DT = dbHelper.ExecuteDataTable(sql, null);
-            return DT.Rows.Count > 0 ? Convert.ToDouble(DT.Rows[0][0]) : 0;
+            if (DT == null) return 0;
+            double particleArea = 0;
+            if(double.TryParse(DT.Rows[0][0].ToString(),out particleArea))
+            {
+               return particleArea;
+            }else{
+                return 0;
+            }
 
         }