From b891692b0006fbe8805a97580a1fa70c6736a72e Mon Sep 17 00:00:00 2001
From: xiaoding721 <33130084+xiaoding721@users.noreply.github.com>
Date: 星期五, 01 十一月 2024 16:24:50 +0800
Subject: [PATCH] Merge branch 'dev' of http://47.101.211.7:10101/r/VWED into dev

---
 _Main/BL/Type_EnginePipelineSource/StaticMethod_Initialize.qbl |   86 +++++++++++++++++++++++--------------------
 1 files changed, 46 insertions(+), 40 deletions(-)

diff --git a/_Main/BL/Type_EnginePipelineSource/StaticMethod_Initialize.qbl b/_Main/BL/Type_EnginePipelineSource/StaticMethod_Initialize.qbl
index dbb23a4..784080d 100644
--- a/_Main/BL/Type_EnginePipelineSource/StaticMethod_Initialize.qbl
+++ b/_Main/BL/Type_EnginePipelineSource/StaticMethod_Initialize.qbl
@@ -17,46 +17,52 @@
     
     products                  := construct( Product_MPs );
     //鍒濆鍖栧垪
-    table.GenerateColumn( owner, 'All', search.StartDate(), search.EndDate() );
+    table.GenerateColumn( owner, Translations::MP_GlobalParameters_Day(), search.StartDate(), search.EndDate() );
     endperiod                 := maxobject( owner, Period_MP, period, not period.IsHistorical() and period.TimeUnit() = Translations::MP_GlobalParameters_Day(), period.StartDate() );
     
     //鐢熸垚鐢熶骇鍜屽簱瀛樻暟鎹�
     traverse( owner, StockingPoint_MP, stockingpoint ){
+      unit                    := stockingpoint.Unit();
+      parentunits             := unit.GetAllParent();
       //鏄惁灞炰簬闀挎槬宸ュ巶
-      iscc                    := ( stockingpoint.ID().StartsWith( 'CC' ) or stockingpoint.ID().StartsWith( '闀挎槬' ) ) and stockingpoint.ID().EndsWith( '鍘傚唴搴�' );
+      iscc                    := stockingpoint.ID().StartsWith( 'CC' ) or unit.ID().StartsWith( 'CC' ) or exists( parentunits, Elements, punit, punit.ID().StartsWith( 'CC' ) );
       //鏄惁灞炰簬澶ц繛宸ュ巶
-      isdl                    := ( ( stockingpoint.ID().StartsWith( 'DL' ) or stockingpoint.ID().StartsWith( '澶ц繛' ) ) and stockingpoint.ID().EndsWith( '鍘傚唴搴�' ) ) or  stockingpoint.ID() = '澶ц繛澶栫搴�';
-      
-      traverse( stockingpoint, ProductInStockingPoint_MP, pisp,  pisp.Product_MP().IsLeaf() and not pisp.IsSystem() 
-                and exists( pisp.Product_MP().GetAllParent(), Elements, e, e.ID() = productparent ) 
-                and exists( pisp, ProductInStockingPointInPeriod, pispip, not pispip.Period_MP().IsHistorical() and pispip.Period_MP().TimeUnit() = Translations::MP_GlobalParameters_Day() and ( pispip.NewSupplyQuantity() <> 0 or pispip.PlannedInventoryLevelEnd() <> 0 ) ) ){
-        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() );
-        products.Add( pisp.Product_MP() );
-        traverse( pispips, Elements, pispip ){
-          //澶�
-          daycolumn         := table.GetColumnByUnit( Translations::MP_GlobalParameters_Day(), pispip.Start().Date() );
-          //鍛�
-          weekcolumn        := table.GetColumnByUnit( Translations::MP_GlobalParameters_Week(),  pispip.Start().Date() );
-          supplyquantity    := [Number]pispip.NewSupplyQuantity();//鍥涜垗浜斿叆
-          inventoryquantity := [Number]pispip.PlannedInventoryLevelEnd();//鍥涜垗浜斿叆
-          //浜ч噺鏄姞鎬�
-          if( iscc or isdl ){
-            row.SetCellProductionValue( daycolumn, iscc, [Real]supplyquantity );
-            row.SetCellProductionValue( weekcolumn, iscc, [Real]supplyquantity );
+      isdl                    := stockingpoint.ID().StartsWith( 'DL' ) or unit.ID().StartsWith( 'DL' ) or exists( parentunits, Elements, punit, punit.ID().StartsWith( 'DL' ) );
+      //鏄惁灞炰簬闀挎槬浜ч噺
+      isccproduction          := iscc and stockingpoint.ID().EndsWith( '鍘傚唴搴�' );
+      //鏄惁灞炰簬澶ц繛浜ч噺
+      isdlproduction          := isdl and stockingpoint.ID().EndsWith( '鍘傚唴搴�' ) or  stockingpoint.ID() = '澶ц繛澶栫搴�';
+      if( isccproduction or isdlproduction ){
+        traverse( stockingpoint, ProductInStockingPoint_MP, pisp,  pisp.Product_MP().IsLeaf() and not pisp.IsSystem() 
+                  and exists( pisp.Product_MP().GetAllParent(), Elements, e, e.ID() = productparent ) 
+                  and exists( pisp, ProductInStockingPointInPeriod, pispip, not pispip.Period_MP().IsHistorical() and pispip.Period_MP().TimeUnit() = Translations::MP_GlobalParameters_Day() and ( pispip.NewSupplyQuantity() <> 0 or pispip.PlannedInventoryLevelEnd() <> 0 ) ) ){
+          pispips             := selectsortedset( pisp, ProductInStockingPointInPeriod, pispip, not pispip.Period_MP().IsHistorical() 
+                                                  and pispip.Period_MP().TimeUnit() = Translations::MP_GlobalParameters_Day() and ( pispip.NewSupplyQuantity() <> 0 or pispip.PlannedInventoryLevelEnd() <> 0 ), pispip.Start() );
+          row := table.GetRow( pisp.ProductID() );
+          products.Add( pisp.Product_MP() );
+          traverse( pispips, Elements, pispip ){
+            //澶�
+            daycolumn         := table.GetColumnByUnit( Translations::MP_GlobalParameters_Day(), pispip.Start().Date() );
+            //鍛�
+    //        weekcolumn        := table.GetColumnByUnit( Translations::MP_GlobalParameters_Week(),  pispip.Start().Date() );
+            supplyquantity    := pispip.NewSupplyQuantity();//鍥涜垗浜斿叆
+            inventoryquantity := pispip.PlannedInventoryLevelEnd();
+            //浜ч噺鏄姞鎬�
+            if( isccproduction or isdlproduction ){
+              row.SetCellProductionValue( daycolumn, iscc, supplyquantity );
+    //          row.SetCellProductionValue( weekcolumn, iscc, supplyquantity );
+            }
+            //搴撳瓨闇�瑕佸彇鏈�鍚庝竴澶�
+            row.SetCellInventoryValue( daycolumn, [Real]inventoryquantity );
+        
+    //        if( pispip.Start().Date() = weekcolumn.EndDate() or pispip.Period_MP() = endperiod ){
+    //            
+    //          row.SetCellInventoryValue( weekcolumn, [Real]inventoryquantity );
+    //        } 
           }
-          //搴撳瓨闇�瑕佸彇鏈�鍚庝竴澶�
-          row.SetCellInventoryValue( daycolumn, [Real]inventoryquantity );
-      
-          if( pispip.Start().Date() = weekcolumn.EndDate() or pispip.Period_MP() = endperiod ){
-              
-            row.SetCellInventoryValue( weekcolumn, [Real]inventoryquantity );
-          } 
         }
       }
     }
-    
     //鐢熸垚闇�姹傛暟鎹�
     traverse( owner, SalesDemand.astype( Forecast ), forecast, not isnull( forecast.SalesSegment_MP() ) and forecast.StartDate() < endperiod.StartDate() and forecast.Quantity() <> 0 
               and exists( forecast.Product_MP().GetAllParent(), Elements, e, e.ID() = productparent )
@@ -68,26 +74,26 @@
         //澶�
         daycolumn         := table.GetColumnByUnit( Translations::MP_GlobalParameters_Day(), psdip.StartDate() );
         //鍛�
-        weekcolumn        := table.GetColumnByUnit( Translations::MP_GlobalParameters_Week(), psdip.StartDate() );
+    //    weekcolumn        := table.GetColumnByUnit( Translations::MP_GlobalParameters_Week(), psdip.StartDate() );
           
         if( not isnull( daycolumn ) ){
           row.SetCellDemandValue( daycolumn, forecast.SalesSegmentName(), forecast.Quantity() );
         }
-        if( not isnull( weekcolumn ) ){
-          row.SetCellDemandValue( weekcolumn, 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();
     //    } 
       }
     }
     
-    rows := selectsortedset( table, Row, row, row.Name() );
-    i    := 0;
-    traverse( rows, Elements, e ){
-      e.RowNr( i );
-      i := i + 1;
-    }
+    //rows := selectsortedset( table, Row, row, row.Name() );
+    //i    := 0;
+    //traverse( rows, Elements, e ){
+    //  e.RowNr( i );
+    //  i := i + 1;
+    //}
     showtable.Generate( search, products );
   *]
 }

--
Gitblit v1.9.3