From 5f8bcf34b598f40388661497c74c788b13b904dc Mon Sep 17 00:00:00 2001
From: lazhen <17772815105@139.com>
Date: 星期四, 15 八月 2024 14:41:41 +0800
Subject: [PATCH] 机加件管线报表周度bug

---
 _Main/BL/Type_MachiningPipelineSource0/StaticMethod_Initialize.qbl |   13 +++++++------
 1 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/_Main/BL/Type_MachiningPipelineSource0/StaticMethod_Initialize.qbl b/_Main/BL/Type_MachiningPipelineSource0/StaticMethod_Initialize.qbl
index 3b9867c..c6a9c85 100644
--- a/_Main/BL/Type_MachiningPipelineSource0/StaticMethod_Initialize.qbl
+++ b/_Main/BL/Type_MachiningPipelineSource0/StaticMethod_Initialize.qbl
@@ -48,7 +48,7 @@
           if( exists( productparents, Elements, e, e.ID() = productparent ) ){//鏌ヨ浜у搧绫诲瀷鏄彂鍔ㄦ満
             row               := table.GetRow( pisp.ProductID() );
             products.Add( pisp.Product_MP() );
-            weekstart         := owner.StartOfPlanning().Date();
+    //        weekstart         := owner.StartOfPlanning().Date();
             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() );
             
@@ -56,7 +56,7 @@
               //澶�
               daycolumn        := table.GetColumnByUnit( Translations::MP_GlobalParameters_Day(), pispip.Start().Date() );
               //鍛�
-              weekcolumn       := table.GetColumnByUnit( Translations::MP_GlobalParameters_Week(), weekstart );
+              weekcolumn       := table.GetColumnByUnit( Translations::MP_GlobalParameters_Week(), pispip.Start().Date() );
               
               supplyquantity   := [Number]pispip.NewSupplyQuantity();//鍥涜垗浜斿叆
               inventoryquantity:= [Number]pispip.PlannedInventoryLevelEnd();//鍥涜垗浜斿叆
@@ -75,8 +75,9 @@
               //搴撳瓨
               if( iscc or isdl ){
                 row.SetCellInventoryValue( daycolumn, iscc, [Real]inventoryquantity );
-                if( pispip.Start() = weekstart + Duration::Days( 6 ) or pispip.Period_MP() = endperiod ){
-                  weekstart      := ( weekstart + Duration::Days( 7 ) ).Date();
+                if( weekcolumn.EndDate() = pispip.Start().Date() or pispip.Period_MP() = endperiod ){
+    //            if( pispip.Start() = weekstart + Duration::Days( 6 ) or pispip.Period_MP() = endperiod ){
+    //              weekstart      := ( weekstart + Duration::Days( 7 ) ).Date();
                   row.SetCellInventoryValue( weekcolumn, iscc, [Real]inventoryquantity );
                 }
               }
@@ -92,14 +93,14 @@
       traverse( table, Column, column ){
         cell := selectobject( row, Cell, cell, cell.Column() = column );
         if( column.TimeUnit() = Translations::MP_GlobalParameters_Day() ){
-          tpcell := selectobject( tprow, TransferPlanCell, tpcell, tpcell.TransferPlanColumn().ColumnDate() = column.Period() );
+          tpcell := selectobject( tprow, TransferPlanCell, tpcell, tpcell.TransferPlanColumn().ColumnDate() = column.StartDate() );
           if( tprow.SourceStockpoingPointID() = 'CC' and tprow.TargetStockpoingPointID() = 'DL' ){
             cell.CCTransferQty( [Real]tpcell.Value() );
           }else if( tprow.SourceStockpoingPointID() = 'DL' and tprow.TargetStockpoingPointID() = 'CC' ){
             cell.DLTransferQty( [Real]tpcell.Value() );
           }
         }else if( column.TimeUnit() = Translations::MP_GlobalParameters_Week() ){
-          period := column.Period() + Duration::Days( 6 );
+          period := column.StartDate() + Duration::Days( 6 );
           tpcell := selectobject( tprow, TransferPlanCell, tpcell, tpcell.TransferPlanColumn().ColumnDate() = period.Date() );
           
           if( tprow.SourceStockpoingPointID() = 'CC' and tprow.TargetStockpoingPointID() = 'DL' ){

--
Gitblit v1.9.3