From c74a399f02c4c4a9b3ef5c2d67fc48feb1a2406f Mon Sep 17 00:00:00 2001
From: lazhen <17772815105@139.com>
Date: 星期四, 14 十一月 2024 10:58:02 +0800
Subject: [PATCH] 计划库存去掉紧缺件数据

---
 _Main/BL/Type_InventoryPlanArchiveVersion/StaticMethod_GenerateData.qbl |   44 ++++++++++++++++++++++++--------------------
 1 files changed, 24 insertions(+), 20 deletions(-)

diff --git a/_Main/BL/Type_InventoryPlanArchiveVersion/StaticMethod_GenerateData.qbl b/_Main/BL/Type_InventoryPlanArchiveVersion/StaticMethod_GenerateData.qbl
index b664b69..9c03d40 100644
--- a/_Main/BL/Type_InventoryPlanArchiveVersion/StaticMethod_GenerateData.qbl
+++ b/_Main/BL/Type_InventoryPlanArchiveVersion/StaticMethod_GenerateData.qbl
@@ -8,8 +8,10 @@
   Description: '鐢熸垚璁″垝搴撳瓨瀛樻。鏁版嵁'
   TextBody:
   [*
-    //interfaceDataset.InventoryPlanArchiveVersion( relflush );
+    interfaceDataset.InventoryPlanArchiveVersion( relflush );
     info( '-------------------------Start---------------------');
+    machineproductparent   := MachiningPipelineReport::GetDefaultProductParent();
+    engineproductparent    := EnginePipelineReport::GetDefaultProductParent();
     allunit                := AssemblyOnlinePlanVersion::GetDefaultAllUnit();
     name                   := InventoryPlanArchiveVersion::GetDefaultName();
     search                 := interfaceDataset.InventoryPlanArchiveVersionSearch( relnew, Product := allunit, TimeUnit := Translations::MP_GlobalParameters_Day(), Unit := allunit, StartDate := Date::MinDate(), EndDate := Date::MaxDate() );
@@ -46,26 +48,28 @@
         inventoryindex      := inventoryindex + 1;
       }
     }
-    traverse ( macroPlan, Product_MP.ProductInStockingPoint_MP, pispmp, not pispmp.IsSystem() and pispmp.IsLeaf() ) {
-      unit                 := ifexpr( pispmp.StockingPointID().Regex( "澶ц繛" ) or pispmp.StockingPointID().Regex( "DL" ), FinancialProductionReport::GetDefaultDLUnit(), FinancialProductionReport::GetDefaultCCUnit() );
-      inventoryrow         := table.GetRowByUnit( pispmp.Product_MP(), unit );
-      traverse ( pispmp, ProductInStockingPointInPeriodPlanning.astype( ProductInStockingPointInPeriodPlanningLeaf ), pispippl, not pispippl.IsPeriodFrozen() ) {
-        startdate          := pispippl.Start().Date();
-        daycolumn          := table.GetColumnByTimeUnit( Translations::MP_GlobalParameters_Day(), startdate );
-        weekcolumn         := table.GetColumnByTimeUnit( Translations::MP_GlobalParameters_Week(), startdate );
-        monthcolumn        := table.GetColumnByTimeUnit( Translations::MP_GlobalParameters_Month(), startdate );
-        actinventoryKey    := pispmp.ProductID() + startdate.AsQUILL();
-        actinventoryhandle := actinventorytree.GetHandle( actinventoryKey );
-        actinventoryindex  := guard( actinventorytree.Root().Child( actinventoryhandle ),null( NamedValue ));
-        
-        actinventoryqty    := 0.0;
-        if( not isnull( actinventoryindex )){
-          actinventoryqty  := inventoryqrys.Element( actinventoryindex.GetValueAsNumber() );
+    traverse( macroPlan, Product_MP, product, exists( product.GetAllParent(), Elements, e, e.ID() = machineproductparent or e.ID() = engineproductparent ) ){ 
+      traverse ( product, ProductInStockingPoint_MP, pispmp, not pispmp.IsSystem() and pispmp.IsLeaf() ) {
+        unit                 := ifexpr( pispmp.StockingPointID().Regex( "澶ц繛" ) or pispmp.StockingPointID().Regex( "DL" ), FinancialProductionReport::GetDefaultDLUnit(), FinancialProductionReport::GetDefaultCCUnit() );
+        inventoryrow         := table.GetRowByUnit( pispmp.Product_MP(), unit );
+        traverse ( pispmp, ProductInStockingPointInPeriodPlanning.astype( ProductInStockingPointInPeriodPlanningLeaf ), pispippl, not pispippl.IsPeriodFrozen() ) {
+          startdate          := pispippl.Start().Date();
+          daycolumn          := table.GetColumnByTimeUnit( Translations::MP_GlobalParameters_Day(), startdate );
+          weekcolumn         := table.GetColumnByTimeUnit( Translations::MP_GlobalParameters_Week(), startdate );
+          monthcolumn        := table.GetColumnByTimeUnit( Translations::MP_GlobalParameters_Month(), startdate );
+          actinventoryKey    := pispmp.ProductID() + startdate.AsQUILL();
+          actinventoryhandle := actinventorytree.GetHandle( actinventoryKey );
+          actinventoryindex  := guard( actinventorytree.Root().Child( actinventoryhandle ),null( NamedValue ));
+          
+          actinventoryqty    := 0.0;
+          if( not isnull( actinventoryindex )){
+            actinventoryqty  := inventoryqrys.Element( actinventoryindex.GetValueAsNumber() );
+          }
+          inventoryrow.SetQuantity( daycolumn, pispippl.InventoryLevelEnd(), actinventoryqty );
+          inventoryrow.SetQuantity( weekcolumn, pispippl.InventoryLevelEnd(), actinventoryqty );
+          inventoryrow.SetQuantity( monthcolumn, pispippl.InventoryLevelEnd(), actinventoryqty );
+      
         }
-        inventoryrow.SetQuantity( daycolumn, pispippl.InventoryLevelEnd(), actinventoryqty );
-        inventoryrow.SetQuantity( weekcolumn, pispippl.InventoryLevelEnd(), actinventoryqty );
-        inventoryrow.SetQuantity( monthcolumn, pispippl.InventoryLevelEnd(), actinventoryqty );
-    
       }
     }
     

--
Gitblit v1.9.3