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_MachiningPipelineColumn0/Attribute_StartDate.qbl     |    7 +++++++
 /dev/null                                                          |    7 -------
 _Main/BL/Type_MachiningPipelineColumn0/Attribute_EndDate.qbl       |    7 +++++++
 _Main/BL/Type_MachiningPipelineReport/Method_GetColumnByUnit.qbl   |    4 ++--
 _Main/BL/Type_MachiningPipelineReport/Method_GenerateColumn.qbl    |    4 ++--
 _Main/BL/Type_MachiningPipelineSource0/StaticMethod_Initialize.qbl |   13 +++++++------
 6 files changed, 25 insertions(+), 17 deletions(-)

diff --git a/_Main/BL/Type_MachiningPipelineColumn0/Attribute_EndDate.qbl b/_Main/BL/Type_MachiningPipelineColumn0/Attribute_EndDate.qbl
new file mode 100644
index 0000000..0b796c8
--- /dev/null
+++ b/_Main/BL/Type_MachiningPipelineColumn0/Attribute_EndDate.qbl
@@ -0,0 +1,7 @@
+Quintiq file version 2.0
+#parent: #root
+Attribute EndDate
+{
+  #keys: '3[415136.0.1004832687][415136.0.1004832686][415136.0.1004832688]'
+  ValueType: Date
+}
diff --git a/_Main/BL/Type_MachiningPipelineColumn0/Attribute_Period.qbl b/_Main/BL/Type_MachiningPipelineColumn0/Attribute_Period.qbl
deleted file mode 100644
index 4ee9a29..0000000
--- a/_Main/BL/Type_MachiningPipelineColumn0/Attribute_Period.qbl
+++ /dev/null
@@ -1,7 +0,0 @@
-Quintiq file version 2.0
-#parent: #root
-Attribute Period
-{
-  #keys: '3[415136.0.886711554][415136.0.886711553][415136.0.886711555]'
-  ValueType: Date
-}
diff --git a/_Main/BL/Type_MachiningPipelineColumn0/Attribute_StartDate.qbl b/_Main/BL/Type_MachiningPipelineColumn0/Attribute_StartDate.qbl
new file mode 100644
index 0000000..6a2d095
--- /dev/null
+++ b/_Main/BL/Type_MachiningPipelineColumn0/Attribute_StartDate.qbl
@@ -0,0 +1,7 @@
+Quintiq file version 2.0
+#parent: #root
+Attribute StartDate
+{
+  #keys: '3[415136.0.1004832677][415136.0.1004832676][415136.0.1004832678]'
+  ValueType: Date
+}
diff --git a/_Main/BL/Type_MachiningPipelineReport/Method_GenerateColumn.qbl b/_Main/BL/Type_MachiningPipelineReport/Method_GenerateColumn.qbl
index 525a923..c4e150b 100644
--- a/_Main/BL/Type_MachiningPipelineReport/Method_GenerateColumn.qbl
+++ b/_Main/BL/Type_MachiningPipelineReport/Method_GenerateColumn.qbl
@@ -17,13 +17,13 @@
         periodtime          := period.StartDate();
         periodname          := periodtime.Format( "M2/D2/Y" );
         
-        this.Column( relnew, Name := periodname, Period := periodtime, TimeUnit := Translations::MP_GlobalParameters_Day() );
+        this.Column( relnew, Name := periodname, StartDate := periodtime, EndDate := periodtime, TimeUnit := Translations::MP_GlobalParameters_Day() );
       }
       
       if( timeunit = 'All' or timeunit = Translations::MP_GlobalParameters_Week() ){
         if( period.StartDate() = weekstart ){
           weekperiodname    := weekstart.Format( "M2/D2/Y" );
-          this.Column( relnew, Name := weekperiodname, Period := weekstart, TimeUnit := Translations::MP_GlobalParameters_Week() );
+          this.Column( relnew, Name := weekperiodname, StartDate := weekstart, EndDate := ( weekstart + Duration::Days( 6 ) ).Date(), TimeUnit := Translations::MP_GlobalParameters_Week() );
           weekstart         := ( weekstart + Duration::Days( 7 ) ).Date();
         }
       }
diff --git a/_Main/BL/Type_MachiningPipelineReport/Method_GetColumnByUnit.qbl b/_Main/BL/Type_MachiningPipelineReport/Method_GetColumnByUnit.qbl
index 1c5b4cb..67af163 100644
--- a/_Main/BL/Type_MachiningPipelineReport/Method_GetColumnByUnit.qbl
+++ b/_Main/BL/Type_MachiningPipelineReport/Method_GetColumnByUnit.qbl
@@ -8,9 +8,9 @@
   TextBody:
   [*
     // 鐢勫叞楦� Aug-7-2024 (created)
-    periodname := period.Format( "M2/D2/Y" );
+    //periodname := period.Format( "M2/D2/Y" );
     
-    column := selectobject( this, Column, column, column.Name() = periodname and column.Period() = period and column.TimeUnit() = unit );
+    column := selectobject( this, Column, column, column.StartDate() <= period and column.EndDate() >= period and column.TimeUnit() = unit );
     
     return column;
   *]
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