From 9efbae46f8a30801a7285bb668526fc661be42e7 Mon Sep 17 00:00:00 2001
From: Administrator <renhui.hao@capgemini.com>
Date: 星期日, 08 十月 2023 21:12:05 +0800
Subject: [PATCH] Merge remote-tracking branch 'refs/remotes/origin/dev'

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

diff --git a/_Main/BL/Type_CapacityAllocationResults/StaticMethod_IterativeGeneration2.qbl b/_Main/BL/Type_CapacityAllocationResults/StaticMethod_IterativeGeneration2.qbl
index b327f63..dcd7365 100644
--- a/_Main/BL/Type_CapacityAllocationResults/StaticMethod_IterativeGeneration2.qbl
+++ b/_Main/BL/Type_CapacityAllocationResults/StaticMethod_IterativeGeneration2.qbl
@@ -16,6 +16,22 @@
     //info( "鐩爣鏃堕棿锛�", targetDate.Format( "Y-M2-D2" ) );
     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(),

--
Gitblit v1.9.3