From f4b1cd1ea4e8002795f0867c2e56209641d5225e Mon Sep 17 00:00:00 2001
From: lazhen <17772815105@139.com>
Date: 星期三, 14 八月 2024 10:19:20 +0800
Subject: [PATCH] 发动机管线报表删掉所有机加件

---
 _Main/BL/Type_EnginePipelineSource/StaticMethod_Initialize.qbl |   83 +++++++++++++++++++++++------------------
 1 files changed, 47 insertions(+), 36 deletions(-)

diff --git a/_Main/BL/Type_EnginePipelineSource/StaticMethod_Initialize.qbl b/_Main/BL/Type_EnginePipelineSource/StaticMethod_Initialize.qbl
index 727038c..77b75de 100644
--- a/_Main/BL/Type_EnginePipelineSource/StaticMethod_Initialize.qbl
+++ b/_Main/BL/Type_EnginePipelineSource/StaticMethod_Initialize.qbl
@@ -36,49 +36,60 @@
       isdl         := unit.ID() = dlalienunit or unit.ID() = dlmplineunit  or exists( parentunits, Elements, punit, punit.ID() = dlalienunit or punit.ID() = dlmplineunit );
       
       traverse( stockingpoint, ProductInStockingPoint_MP, pisp,  pisp.Product_MP().IsLeaf() and not pisp.IsSystem() ){
-        weekstart             := owner.StartOfPlanning().Date();
-        pispips               := selectsortedset( pisp, ProductInStockingPointInPeriod, pispip, not pispip.Period_MP().IsHistorical() 
-                                                  and pispip.Period_MP().TimeUnit() = Translations::MP_GlobalParameters_Day(), pispip.Start() );
-        row := table.GetRow( pisp.ProductID() );
-        traverse( pispips, Elements, pispip ){
-          //澶�
-          daycolumn           := table.GetColumnByUnit( Translations::MP_GlobalParameters_Day(), pispip.Start().Date() );
-          //鍛�
-          weekcolumn          := table.GetColumnByUnit( Translations::MP_GlobalParameters_Week(), weekstart );
-          supplyquantity      := [Number]pispip.NewSupplyQuantity();//鍥涜垗浜斿叆
-          inventoryquantity   := [Number]pispip.PlannedInventoryLevelEnd();//鍥涜垗浜斿叆
-          //浜ч噺鏄姞鎬�
-          if( iscc or isdl ){
-            row.SetCellProductionValue( daycolumn, iscc, [Real]supplyquantity );
-            row.SetCellProductionValue( weekcolumn, iscc, [Real]supplyquantity );
+        product               := pisp.Product_MP();
+        productparents        := product.GetAllParent();
+        if( exists( productparents, Elements, e, e.ID() = '鍙戝姩鏈�' ) ){//鏌ヨ浜у搧绫诲瀷鏄彂鍔ㄦ満
+          weekstart           := owner.StartOfPlanning().Date();
+          pispips             := selectsortedset( pisp, ProductInStockingPointInPeriod, pispip, not pispip.Period_MP().IsHistorical() 
+                                                    and pispip.Period_MP().TimeUnit() = Translations::MP_GlobalParameters_Day(), pispip.Start() );
+          row := table.GetRow( pisp.ProductID() );
+          traverse( pispips, Elements, pispip ){
+            //澶�
+            daycolumn         := table.GetColumnByUnit( Translations::MP_GlobalParameters_Day(), pispip.Start().Date() );
+            //鍛�
+            weekcolumn        := table.GetColumnByUnit( Translations::MP_GlobalParameters_Week(), weekstart );
+            supplyquantity    := [Number]pispip.NewSupplyQuantity();//鍥涜垗浜斿叆
+            inventoryquantity := [Number]pispip.PlannedInventoryLevelEnd();//鍥涜垗浜斿叆
+            //浜ч噺鏄姞鎬�
+            if( iscc or isdl ){
+              row.SetCellProductionValue( daycolumn, iscc, [Real]supplyquantity );
+              row.SetCellProductionValue( weekcolumn, iscc, [Real]supplyquantity );
+            }
+            //搴撳瓨闇�瑕佸彇鏈�鍚庝竴澶�
+            row.SetCellInventoryValue( daycolumn, [Real]inventoryquantity );
+      
+            if( pispip.Start() = weekstart + Duration::Days( 6 ) or pispip.Period_MP() = endperiod ){
+              weekstart       := ( weekstart + Duration::Days( 7 ) ).Date();
+              
+              row.SetCellInventoryValue( weekcolumn, [Real]inventoryquantity );
+            } 
           }
-          //搴撳瓨闇�瑕佸彇鏈�鍚庝竴澶�
-          row.SetCellInventoryValue( daycolumn, [Real]inventoryquantity );
-    
-          if( pispip.Start() = weekstart + Duration::Days( 6 ) or pispip.Period_MP() = endperiod ){
-            weekstart         := ( weekstart + Duration::Days( 7 ) ).Date();
-            
-            row.SetCellInventoryValue( weekcolumn, [Real]inventoryquantity );
-          } 
         }
       }
     }
     
     //鐢熸垚闇�姹傛暟鎹�
     traverse( owner, SalesDemand.astype( Forecast ), forecast ){
-      row                   := table.GetRow( forecast.ProductID() );
-      weekstart             := owner.StartOfPlanning().Date();
-      traverse( forecast, PlanningSalesDemandInPeriod, psdip ){
-        //澶�
-        daycolumn           := table.GetColumnByUnit( Translations::MP_GlobalParameters_Day(), psdip.StartDate() );
-        //鍛�
-        weekcolumn          := table.GetColumnByUnit( Translations::MP_GlobalParameters_Week(), weekstart );
-        
-        if( not isnull( daycolumn ) ){
-          row.SetCellDemandValue( daycolumn, forecast.SalesSegmentName(), forecast.Quantity() );
-        }
-        if( not isnull( weekcolumn ) ){
-          row.SetCellDemandValue( weekcolumn, forecast.SalesSegmentName(), forecast.Quantity() );
+      product               := forecast.Product_MP();
+      productparents        := product.GetAllParent();
+      if( exists( productparents, Elements, e, e.ID() = '鍙戝姩鏈�' ) ){//鏌ヨ浜у搧绫诲瀷鏄彂鍔ㄦ満
+        row                 := table.GetRow( forecast.ProductID() );
+        weekstart           := owner.StartOfPlanning().Date();
+        traverse( forecast, PlanningSalesDemandInPeriod, psdip ){
+          //澶�
+          daycolumn         := table.GetColumnByUnit( Translations::MP_GlobalParameters_Day(), psdip.StartDate() );
+          //鍛�
+          weekcolumn        := table.GetColumnByUnit( Translations::MP_GlobalParameters_Week(), weekstart );
+          
+          if( not isnull( daycolumn ) ){
+            row.SetCellDemandValue( daycolumn, forecast.SalesSegmentName(), forecast.Quantity() );
+          }
+          if( not isnull( weekcolumn ) ){
+            row.SetCellDemandValue( weekcolumn, forecast.SalesSegmentName(), forecast.Quantity() );
+          }
+          if( psdip.StartDate() = ( weekstart + Duration::Days( 6 ) ).Date() or psdip.PeriodStart() = endperiod.StartDate() ){
+            weekstart       := ( weekstart + Duration::Days( 7 ) ).Date();
+          } 
         }
       }
     }

--
Gitblit v1.9.3