From 763e8b714dcf5f25db6e805929dbd2d6f365f167 Mon Sep 17 00:00:00 2001
From: admin <admin@admin.com>
Date: 星期五, 18 十月 2024 09:46:31 +0800
Subject: [PATCH] 包装计划优化

---
 _Main/BL/Type_PackagingPlanCell/StaticMethod_GenerateReport.qbl |   21 ++++++++++++++-------
 1 files changed, 14 insertions(+), 7 deletions(-)

diff --git a/_Main/BL/Type_PackagingPlanCell/StaticMethod_GenerateReport.qbl b/_Main/BL/Type_PackagingPlanCell/StaticMethod_GenerateReport.qbl
index 78add67..2d1b73c 100644
--- a/_Main/BL/Type_PackagingPlanCell/StaticMethod_GenerateReport.qbl
+++ b/_Main/BL/Type_PackagingPlanCell/StaticMethod_GenerateReport.qbl
@@ -36,13 +36,8 @@
         // 鍒涘缓鍗曞厓鏍�
         cell := select( ppr, PackagingPlanCell, tempPPCell, tempPPCell.PackagingPlanColumn() = ppc );
         if ( isnull( cell ) ) {
-          cell := ppr.PackagingPlanCell( relnew );
-          cell.NetDemand( pispipl.InventoryLevelEnd() + pispipl.NewSupplyQuantity() - pispipl.DependentDemandAndSalesDemandQuantity() );
-          cell.EndingInventory( pispipl.InventoryLevelEnd() );
+          cell := ppr.PackagingPlanCell( relnew ); 
           cell.PackagingPlanColumn( relset, ppc );
-        } else {
-          cell.NetDemand( cell.NetDemand() + ( pispipl.InventoryLevelEnd() + pispipl.NewSupplyQuantity() - pispipl.DependentDemandAndSalesDemandQuantity() ) );
-          cell.EndingInventory( cell.EndingInventory() + pispipl.InventoryLevelEnd() );
         }
         
         // 璁剧疆璋冨嚭
@@ -65,12 +60,24 @@
           cell.TransferIn( cell.TransferIn() + pit.Quantity() );
         }
         
-        // 闀挎槬宸ュ巶鐗规畩鎯呭喌璁剧疆鍖呰搴撳瓨鍜岄潪鍖呰搴撳瓨
+        // 澶ц繛宸ュ巶璁剧疆鍊�
+        if ( factory = "澶ц繛宸ュ巶" ) {
+          // 鍑�闇�姹�&鍓╀綑搴撳瓨
+          cell.NetDemand( cell.NetDemand() + pispipl.DependentDemandAndSalesDemandQuantity() );
+          cell.EndingInventory( cell.EndingInventory() + pispipl.InventoryLevelEnd() );
+        }
+        
+        // 闀挎槬宸ュ巶璁剧疆鍊�
         if ( factory = "闀挎槬宸ュ巶" ) {
+          // 鍓╀綑搴撳瓨
+          cell.EndingInventory( cell.EndingInventory() + pispipl.InventoryLevelEnd() );
+          
+          // 鍑�闇�姹傘�愬彧鍙栫嚎杈瑰簱銆�&鍖呰搴撳瓨&闈炲寘瑁呭簱瀛�
           if ( pisp.StockingPointID().Regex( "澶栫搴�" ) ) {
             cell.CC_PackagingInventory( pispipl.InventoryLevelEnd() );
           } else if ( pisp.StockingPointID().Regex( "绾胯竟搴�" ) ) {
             cell.CC_UnpackagedInventory( pispipl.InventoryLevelEnd() );
+            cell.NetDemand( cell.NetDemand() + pispipl.DependentDemandAndSalesDemandQuantity() );
           }
         }
         

--
Gitblit v1.9.3