From a1285c5bcea445e4c3c2a3e4fe47b9c9b1e9c1a7 Mon Sep 17 00:00:00 2001
From: lazhen <17772815105@139.com>
Date: 星期五, 01 十一月 2024 16:59:40 +0800
Subject: [PATCH] Merge branch 'dev' of http://47.101.211.7:10101/r/VWED into dev-zlg

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

diff --git a/_Main/BL/Type_LockPeriod/Method_Enable.qbl b/_Main/BL/Type_LockPeriod/Method_Enable.qbl
index d613476..ccff833 100644
--- a/_Main/BL/Type_LockPeriod/Method_Enable.qbl
+++ b/_Main/BL/Type_LockPeriod/Method_Enable.qbl
@@ -7,26 +7,57 @@
   TextBody:
   [*
     // Akari Oct-30-2024 (created)
-    offlinePlanRow := select( offlinePlanTable,NewOfflinePlanRow,row,row.ProductID() = this.ProductInStockingPoint_MP().ProductID() );
+    offlinePlanRow := select( offlinePlanTable,NewOfflinePlanRow,row,row.ProductID() = this.ProductInStockingPoint_MP().ProductID() and row.StockingPointID() = this.ProductInStockingPoint_MP().StockingPointID() );
+    
+    offlinePlanCells := selectset( offlinePlanRow, NewOfflinePlanCell,cell,true );
+    offlinePlanCellIndexTree := NamedValueTree::Create();
+    for( i := 0; i< offlinePlanCells.Size(); i++ ){
+      offlinePlanCell := offlinePlanCells.Element( i );
+      offlinePlanCellHandle := offlinePlanCellIndexTree.GetHandle( offlinePlanCell.NewOfflinePlanColumn().StartDate().AsQUILL() );
+      offlinePlanCellIndexTree.Root().AddChild( offlinePlanCellHandle,i );
+    }
+    
     
     if( not this.IsEnable() ){
+      this.IsEnable( true );
+      
       pispips := selectset( this,ProductInStockingPoint_MP.ProductInStockingPointInPeriod.astype( ProductInStockingPointInPeriodPlanningLeaf ),period,period.Period_MP().StartDate() <= this.LockDate() );
       traverse( pispips,Elements,element ){
+        element.IsLock( true );
+        offlinePlanCellHandle := offlinePlanCellIndexTree.GetHandle( element.Period_MP().StartDate().AsQUILL() );
+        offlinePlanCellIndex := guard( offlinePlanCellIndexTree.Root().Child( offlinePlanCellHandle),null( NamedValue ));
+        offlinePlanCellQuantity := 0.0;
+        if( not isnull( offlinePlanCellIndex )){
+          offlinePlanCell := offlinePlanCells.Element( offlinePlanCellIndex.GetValueAsNumber() );
+          offlinePlanCellQuantity := offlinePlanCell.Quantity();
+        }
         if( element.NewSupply( relsize ) = 1 ){
           traverse( element,NewSupply,newSupply ){
-            
+            newSupply.Update( offlinePlanCellQuantity );
           }
         }else if( element.NewSupply( relsize ) > 1 ){
-          
+          newSupplys := selectset( element,NewSupply,newSupply,true );
+          for( i := 1; i < newSupplys.Size(); i++ ){
+            newSupply := newSupplys.Element( i );
+            newSupply.Update( 0.0 );
+          }
+          newSupplys.Element( 0 ).Update( offlinePlanCellQuantity )
         }else if( element.NewSupply( relsize ) = 0 ){
-          unit := element.StockingPointInPeriod().StockingPoint_MP().Unit();
-          operaction := select( unit,Operation,op,true );
-          // PeriodTaskOperation::Create( )
+          if( offlinePlanCellQuantity <> 0 ){
+            info( "new supply is null" );
+            unit := element.StockingPointInPeriod().StockingPoint_MP().Unit();
+            operaction := select( unit,Operation,op,true );
+            if( not isnull( operaction )){
+              info( "operaction is null" );
+              // unitPeriod := element.Period_MP().UnitPeriod()
+              // PeriodTaskOperation::Create( operaction,unitPeriod,quantity,false );
+            }else{
+              
+            }
+          }
         }
-        
-        
-    
       }
+      ProductInStockingPointInPeriod::LockUnlockPlanning( pispips, true, true );
     }
   *]
 }

--
Gitblit v1.9.3