From 660578a29abae9e3a4584de89d0642820e592b46 Mon Sep 17 00:00:00 2001
From: xiaoding721 <33130084+xiaoding721@users.noreply.github.com>
Date: 星期一, 21 十月 2024 10:24:51 +0800
Subject: [PATCH] 修复一些bug

---
 _Main/BL/Type_LocalCell_DemandComparison/StaticMethod_Compared.qbl |   32 +++++++++++++++++++-------------
 1 files changed, 19 insertions(+), 13 deletions(-)

diff --git a/_Main/BL/Type_LocalCell_DemandComparison/StaticMethod_Compared.qbl b/_Main/BL/Type_LocalCell_DemandComparison/StaticMethod_Compared.qbl
index f774c24..e760b4c 100644
--- a/_Main/BL/Type_LocalCell_DemandComparison/StaticMethod_Compared.qbl
+++ b/_Main/BL/Type_LocalCell_DemandComparison/StaticMethod_Compared.qbl
@@ -58,7 +58,7 @@
         columns := construct( LocalColumns );
         LocalCell_DemandComparison::GenerateColumnIndex( baseVersionTable,localTable,columnTree,columns );
         LocalCell_DemandComparison::GenerateColumnIndex( compareVersionTable,localTable,columnTree,columns );
-        columnNames := selectvalues( columns,Elements,column,true,column.Name() );
+        columnNames := selectvalues( columns,Elements,column,true,column.CustomName());
         
         // 鐢熸垚鏁版嵁
         for ( rowIndex := 0; rowIndex < rowKeys.Size(); rowIndex++ ) {
@@ -75,24 +75,30 @@
           
           row := localTable.LocalRow( relnew,Index := localTable.GetRowIndexCache()  );
           
-          traverse( columnNames,Elements,columnName ){
+          traverse( columnNames,Elements,columnName ,columnName <> "" ){
             columnHandle := columnTree.GetHandle( columnName );
-            columnIndex := columnTree.Root().Child( columnHandle ).GetValueAsNumber();
-            column := columns.Element( columnIndex );
+            columnIndex := guard( columnTree.Root().Child( columnHandle ) , null( NamedValue ));
+            column := null( LocalColumn );
+            if( not isnull( columnIndex )){
+              column := columns.Element( columnIndex.GetValueAsNumber() );
+            }
+            if( isnull( column )){
+              error( columnName + " is null." ); 
+            }
             
             baseVersionCell := constnull( GeneralExcelImportAndExportDataCell );
             baseVersionCellHandle := baseVersionCellTree.GetHandle( columnName );
-            try{
-              baseVersionCellIndex := baseVersionCellTree.Root().Child( baseVersionCellHandle ).GetValueAsNumber();
-              baseVersionCell := baseVersionCells.Element( baseVersionCellIndex );
-            }onerror{}
+            baseVersionCellIndex := guard( baseVersionCellTree.Root().Child( baseVersionCellHandle ),null( NamedValue ));
+            if( not isnull( baseVersionCellIndex )){
+              baseVersionCell := baseVersionCells.Element( baseVersionCellIndex.GetValueAsNumber() );
+            }
             
             compareVersionCell := constnull( GeneralExcelImportAndExportDataCell );
             compareVersionCellHandle := compareVersionCellTree.GetHandle( columnName );
-            try{
-              compareVersionCellIndex := compareVersionCellTree.Root().Child( compareVersionCellHandle ).GetValueAsNumber();
-              compareVersionCell := compareVersionCells.Element( compareVersionCellIndex );
-            }onerror{}
+            compareVersionCellIndex := guard( compareVersionCellTree.Root().Child( compareVersionCellHandle ),null( NamedValue ));
+            if( not isnull( compareVersionCellIndex )){
+              compareVersionCell := compareVersionCells.Element( compareVersionCellIndex.GetValueAsNumber() );
+            }
             
             if( columnName = "浜у湴" or columnName = "杞﹀瀷" or columnName = "鍙戝姩鏈洪浂浠跺彿" or columnName = "鍙戝姩鏈哄洓浣嶇爜" ){
               row.LocalCell( relnew,LocalCell_DemandComparison,LocalColumn := column,
@@ -137,7 +143,7 @@
       if( not isnull( compareVersionFile )){
         compareVersionFile.Close(); 
       }
-      error( e );
+      error( e.GeneralInformation() );
     }
     
     return localTable;

--
Gitblit v1.9.3