From e8619d825e5f09daf129b4847bf2bf4e660d40c5 Mon Sep 17 00:00:00 2001
From: yunchai <yunying.chai@capgemini.com>
Date: 星期四, 12 十月 2023 09:29:21 +0800
Subject: [PATCH] Merge remote-tracking branch 'refs/remotes/origin/dev'

---
 _Main/BL/Type_CapacityAllocationResults/StaticMethod_IterativeGeneration2.qbl |   28 ++++++++++++++++++++++------
 1 files changed, 22 insertions(+), 6 deletions(-)

diff --git a/_Main/BL/Type_CapacityAllocationResults/StaticMethod_IterativeGeneration2.qbl b/_Main/BL/Type_CapacityAllocationResults/StaticMethod_IterativeGeneration2.qbl
index b327f63..226f832 100644
--- a/_Main/BL/Type_CapacityAllocationResults/StaticMethod_IterativeGeneration2.qbl
+++ b/_Main/BL/Type_CapacityAllocationResults/StaticMethod_IterativeGeneration2.qbl
@@ -14,8 +14,24 @@
   [*
     numberOfLayers++;
     //info( "鐩爣鏃堕棿锛�", targetDate.Format( "Y-M2-D2" ) );
-    info( pisp.Name() );
+    //info( pisp.Name() );
     traverse ( pisp, ProductInStockingPointInPeriodPlanning.astype( ProductInStockingPointInPeriodPlanningLeaf ), pispippl, pispippl.Start().Date() = targetDate ) {
+      //info( "鏄惁鏈変緵搴旓細", pispippl.NewSupply( relsize ) > 0, "    搴撳瓨锛�", pispippl.InventoryLevelEnd() );
+      if ( numberOfLayers <> 1 and pispippl.NewSupply( relsize ) = 0 ) {
+        previous := pispippl.PreviousPlanningPISPIP().astype( ProductInStockingPointInPeriodPlanningLeaf );
+        if ( not previous.Period_MP().IsHistorical() ) {
+          previousDate := previous.Start().Date();
+          CapacityAllocationResults::IterativeGeneration2( globalOTDTable,
+                                                           pisp,
+                                                           previousDate,
+                                                           carrcs,
+                                                           numberOfLayers,
+                                                           firstLevelSupply,
+                                                           currentLayerDependentDemandQuantity
+                                                          );
+        }
+      } 
+      
       traverse ( pispippl, NewSupply, ns, ns.Quantity() > 0 ) {
         if ( numberOfLayers = 1 ) {
           firstLevelSupply := ns;
@@ -24,7 +40,7 @@
         ontype( ns.PeriodTask_MP() ) {
           PeriodTaskOperation as pto : {
     //        info( "Operation鍛ㄦ湡浠诲姟..." );     
-            traverse ( ns, PeriodTask_MP.astype( PeriodTaskOperation ).DependentDemand, dd ) {
+            traverse ( ns, PeriodTask_MP.astype( PeriodTaskOperation ).DependentDemand, dd, dd.Quantity() > 0 ) {
               if ( numberOfLayers = 1 ) {
                 currentLayerDependentDemandQuantity := ns.Quantity();
               }
@@ -56,8 +72,8 @@
                                                         ModuleMeasurementUnit := firstLevelSupply.ProductInStockingPointInPeriodPlanningLeaf().ProductInStockingPoint_MP().UnitOfMeasureName(),
                                                         ModuleBase            := guard( firstLevelSupply.PeriodTask_MP().astype( PeriodTaskOperation ).Operation().UnitID(), "杞﹂亾杩愯緭" ),
                                                         Division              := carrc.Division(),
-                                                        RequirementDate       := ns.Start().Date(),
-                                                        Date                  := ns.Start().Date(),
+                                                        RequirementDate       := firstLevelSupply.Start().Date(),
+                                                        Date                  := firstLevelSupply.Start().Date(),
                                                         Description           := "",
                                                         ID                    := OS::GenerateGUIDAsString(),
                                                         ProductID             := ns.ProductInStockingPointInPeriodPlanningLeaf().ProductInStockingPoint_MP().ProductID(),
@@ -67,7 +83,7 @@
                                                        );
                                                         
             }
-            info( "-----------------------------------------------------------------------------------------------------------------" );
+            //info( "-----------------------------------------------------------------------------------------------------------------" );
           }
           
           PeriodTaskLaneLeg as ptll : {
@@ -76,7 +92,7 @@
     //        info( "灞傛暟锛�", numberOfLayers,"    褰撳墠渚涘簲鐨刾isp锛�", ns.ProductInStockingPointInPeriodPlanningLeaf().ProductInStockingPoint_MP().Name(), "    鎬讳緵搴斿�硷細", ns.Quantity(), "    闇�瑕佷緵搴斿�硷細", currentLayerDependentDemandQuantity,
     //              "    褰撳墠闇�姹俻isp锛�", targetDependentDemand.ProductInStockingPointInPeriodPlanningLeaf().ProductInStockingPoint_MP().Name(), "    闇�姹傚�硷細", currentLayerDependentDemandQuantity );
     //        info( "LaneLeg鍛ㄦ湡浠诲姟..." );
-            info( "-----------------------------------------------------------------------------------------------------------------" );
+            //info( "-----------------------------------------------------------------------------------------------------------------" );
             CapacityAllocationResults::IterativeGeneration2( globalOTDTable,
                                                              targetDependentDemand.ProductInStockingPointInPeriodPlanningLeaf().ProductInStockingPoint_MP(),
                                                              targetDate,

--
Gitblit v1.9.3