From b8e446c0d42658e39e3a924de43ffcd58660bed6 Mon Sep 17 00:00:00 2001
From: hongji.li <hongji.a.li@capgemini.com>
Date: 星期四, 02 十一月 2023 16:03:25 +0800
Subject: [PATCH] pegging form优化

---
 _Main/BL/Type_PeggingResult/StaticMethod_GenerateNewSupply.qbl |   24 ++++++++++++++----------
 1 files changed, 14 insertions(+), 10 deletions(-)

diff --git a/_Main/BL/Type_PeggingResult/StaticMethod_GenerateNewSupply.qbl b/_Main/BL/Type_PeggingResult/StaticMethod_GenerateNewSupply.qbl
index cc10732..24adf59 100644
--- a/_Main/BL/Type_PeggingResult/StaticMethod_GenerateNewSupply.qbl
+++ b/_Main/BL/Type_PeggingResult/StaticMethod_GenerateNewSupply.qbl
@@ -11,7 +11,7 @@
 {
   TextBody:
   [*
-    //info( "渚涘簲绫诲瀷锛圢ewSupply锛�", "    渚涘簲閲忥細", ns.Quantity(), "    婊¤冻锛�", fulfillmentQuantity );
+    info( "渚涘簲绫诲瀷锛圢ewSupply锛�", "    渚涘簲閲忥細", ns.Quantity(), "    婊¤冻锛�", fulfillmentQuantity );
     
     pisp := ns.ProductInStockingPointInPeriodPlanningLeaf().ProductInStockingPoint_MP();
     
@@ -30,16 +30,18 @@
     ontype ( ns.PeriodTask_MP() ) {
       PeriodTaskOperation as pto : {
         childPeggingResult.SupplyType( "浜х嚎渚涘簲" );
-    //    info( "鎿嶄綔鍛ㄦ湡浠诲姟    ", "渚涘簲鏃堕棿锛�", ns.Start().Format( "Y-M2-D2" ), "    鍛ㄦ湡浠诲姟KEY锛�", pto.Key(), "    ",
-    //          ns.ProductInStockingPointInPeriodPlanningLeaf().ProductInStockingPoint_MP().Name() );
+        info( "鎿嶄綔鍛ㄦ湡浠诲姟    ", "渚涘簲鏃堕棿锛�", ns.Start().Format( "Y-M2-D2" ), "    鍛ㄦ湡浠诲姟KEY锛�", pto.Key(), "    ",
+              ns.ProductInStockingPointInPeriodPlanningLeaf().ProductInStockingPoint_MP().Name() );
         traverse ( pto, DependentDemand, dd, dd.Quantity() > 0 ) {
           traverse ( dd, Fulfillment, f ) {
+            fulfillmentQuantity := ( dd.Quantity() / ns.Quantity() ) * fulfillmentQuantity;
+            totalSupply := sum( dd, Fulfillment, tempF, tempF.Quantity() );
+            orderFulfillmentQuantity := ( f.Quantity() / totalSupply ) * fulfillmentQuantity;
             actualFulfillmentQuantity := f.Quantity();
             smp1 := f.Supply_MP();
             numberOfPlies++;
-            fulfillmentQuantity := ( dd.Quantity() / ns.Quantity() ) * fulfillmentQuantity;
-    //        info( "--------------------------------------------------------------" );
-            PeggingResult::GeneratePeggingResult( peggingProductInSalesDemandBase, numberOfPlies, smp1, actualFulfillmentQuantity, fulfillmentQuantity, childPeggingResult );
+            info( "--------------------------------------------------------------" );
+            PeggingResult::GeneratePeggingResult( peggingProductInSalesDemandBase, numberOfPlies, smp1, actualFulfillmentQuantity, orderFulfillmentQuantity, childPeggingResult );
             numberOfPlies--;
           }
         }
@@ -50,14 +52,16 @@
         targetDependentDemand := select( ptll, DependentDemand, dd, 
                                          dd.ProcessInput().ProductInStockingPoint_MP().ProductID() = ns.ProductInStockingPointInPeriodPlanningLeaf().ProductInStockingPoint_MP().ProductID() and
                                          dd.Quantity() = ns.Quantity() );
-    //    info( "杞﹂亾鍛ㄦ湡浠诲姟    ", "渚涘簲鏃堕棿锛�", ns.Start().Format( "Y-M2-D2" ), "    鍛ㄦ湡浠诲姟KEY锛�", ptll.Key(), "    ", 
-    //          ns.ProductInStockingPointInPeriodPlanningLeaf().ProductInStockingPoint_MP().Name() );
+        info( "杞﹂亾鍛ㄦ湡浠诲姟    ", "渚涘簲鏃堕棿锛�", ns.Start().Format( "Y-M2-D2" ), "    鍛ㄦ湡浠诲姟KEY锛�", ptll.Key(), "    ", 
+              ns.ProductInStockingPointInPeriodPlanningLeaf().ProductInStockingPoint_MP().Name() );
         traverse ( targetDependentDemand, Fulfillment, f ) {
+          totalSupply := sum( targetDependentDemand, Fulfillment, tempF, tempF.Quantity() );
+          orderFulfillmentQuantity := ( f.Quantity() / totalSupply ) * fulfillmentQuantity;
           actualFulfillmentQuantity := f.Quantity();
           smp1 := f.Supply_MP();
           numberOfPlies++;
-    //      info( "--------------------------------------------------------------" );
-          PeggingResult::GeneratePeggingResult( peggingProductInSalesDemandBase, numberOfPlies, smp1, actualFulfillmentQuantity, fulfillmentQuantity, childPeggingResult );
+          info( "--------------------------------------------------------------" );
+          PeggingResult::GeneratePeggingResult( peggingProductInSalesDemandBase, numberOfPlies, smp1, actualFulfillmentQuantity, orderFulfillmentQuantity, childPeggingResult );
           numberOfPlies--;
         }
       }

--
Gitblit v1.9.3