From 974cb705f74c43bd58cf5c78a61b50d9eade1f8b Mon Sep 17 00:00:00 2001
From: xiaoding721 <33130084+xiaoding721@users.noreply.github.com>
Date: 星期一, 18 十一月 2024 16:03:07 +0800
Subject: [PATCH] 更新 Method_Enable.qbl

---
 _Main/BL/Type_LockPeriod/Method_Enable.qbl |   19 +++++++++----------
 1 files changed, 9 insertions(+), 10 deletions(-)

diff --git a/_Main/BL/Type_LockPeriod/Method_Enable.qbl b/_Main/BL/Type_LockPeriod/Method_Enable.qbl
index 56456a3..baec9a8 100644
--- a/_Main/BL/Type_LockPeriod/Method_Enable.qbl
+++ b/_Main/BL/Type_LockPeriod/Method_Enable.qbl
@@ -9,16 +9,15 @@
     // Akari Oct-30-2024 (created)
     offlinePlanRow := select( offlinePlanTable,Row,row,row.ProductID() = this.ProductInStockingPoint_MP().ProductID() and row.StockingPointID() = this.ProductInStockingPoint_MP().StockingPointID() );
     
-    offlinePlanCells := selectset( offlinePlanRow, Cell,cell,cell.Column().TimeUnit() = "Day" );
-    offlinePlanCellIndexTree := NamedValueTree::Create();
-    for( i := 0; i< offlinePlanCells.Size(); i++ ){
-      offlinePlanCell := offlinePlanCells.Element( i );
-      offlinePlanCellHandle := offlinePlanCellIndexTree.GetHandle( offlinePlanCell.Column().StartDate().AsQUILL() );
-      offlinePlanCellIndexTree.Root().AddChild( offlinePlanCellHandle,i );
-    }
-    
-    
-    if( not this.IsEnable() ){
+    if( not this.IsEnable() and not isnull( offlinePlanRow )){
+      offlinePlanCells := selectset( offlinePlanRow, Cell,cell,cell.Column().TimeUnit() = "Day" );
+      offlinePlanCellIndexTree := NamedValueTree::Create();
+      for( i := 0; i< offlinePlanCells.Size(); i++ ){
+        offlinePlanCell := offlinePlanCells.Element( i );
+        offlinePlanCellHandle := offlinePlanCellIndexTree.GetHandle( offlinePlanCell.Column().StartDate().AsQUILL() );
+        offlinePlanCellIndexTree.Root().AddChild( offlinePlanCellHandle,i );
+      }
+      
       this.IsEnable( true );
       
       pispips := selectset( this,ProductInStockingPoint_MP.ProductInStockingPointInPeriod.astype( ProductInStockingPointInPeriodPlanningLeaf ),period,period.Period_MP().StartDate() <= this.LockDate() );

--
Gitblit v1.9.3