From fe28d603a518b0561ab684570e71c0d2811329ab Mon Sep 17 00:00:00 2001
From: lazhen <17772815105@139.com>
Date: 星期四, 15 八月 2024 14:02:45 +0800
Subject: [PATCH] 发动机管线报表bug

---
 _Main/BL/Type_EnginePipelineReport/Method_GenerateColumn.qbl                      |    4 +-
 _Main/BL/Type_EnginePipelineColumn/Attribute_EndDate.qbl                          |    8 ++++
 _Main/BL/Type_FinancialSalesSource/StaticMethod_Initialize.qbl                    |    2 
 _Main/BL/Type_EnginePipelineReport/Method_GetColumnByUnit.qbl                     |    4 +-
 _Main/BL/Type_EnginePipelineRow/Method_SetCellDemandValue.qbl                     |    4 +-
 _Main/BL/Type_MachiningPipelineReport/StaticMethod_GetDefaultCCProductionUnit.qbl |    2 
 /dev/null                                                                         |    7 ---
 _Main/BL/Type_EnginePipelineColumn/Attribute_StartDate.qbl                        |    8 ++++
 _Main/BL/Type_MachiningPipelineReport/StaticMethod_GetDefaultDLProductionUnit.qbl |    2 
 _Main/BL/Type_CCEngineLogisticsCostReport0/StaticMethod_Initialize.qbl            |    2 
 _Main/BL/Type_EnginePipelineSource/StaticMethod_Initialize.qbl                    |   14 +++---
 _Main/BL/Type_EnginePipelineReport/Method_Generate.qbl                            |    4 +-
 _Main/BL/Type_EnginePipelineRow/Method_SetCellProductionValue.qbl                 |    2 
 13 files changed, 36 insertions(+), 27 deletions(-)

diff --git a/_Main/BL/Type_CCEngineLogisticsCostReport0/StaticMethod_Initialize.qbl b/_Main/BL/Type_CCEngineLogisticsCostReport0/StaticMethod_Initialize.qbl
index 8bb3940..04845a1 100644
--- a/_Main/BL/Type_CCEngineLogisticsCostReport0/StaticMethod_Initialize.qbl
+++ b/_Main/BL/Type_CCEngineLogisticsCostReport0/StaticMethod_Initialize.qbl
@@ -171,7 +171,7 @@
       }
     }
     //闀挎槬鐭�旇繍杈撹垂鐢細瀹㈡埛闇�姹傛暟閲�/鍖呰瀹归噺/瑁呰浇瀹归噺*杩愯緭鍗曚环锛屽鎴烽渶姹傛暟閲忓彇鑷猣orecast閲宻ales segment涓洪暱鏄ョ殑鏁伴噺姹囨�伙紝鍐嶇敤鍏紡璁$畻锛屾湀搴﹁繘琛屾眹鎬伙紙鍙栧鎴烽渶姹傛暟閲忔崲绠楁垚杞︽锛�
-    traverse( owner, SalesDemand.astype( Forecast ), forecast, forecast.StartDate() < startofnextyear ){
+    traverse( owner, SalesDemand.astype( Forecast ), forecast, not isnull( forecast.SalesSegment_MP() ) and forecast.StartDate() < startofnextyear ){
       salessegment            := forecast.SalesSegment_MP();
       parentsalessegments     := salessegment.GetAllParent();
       //鏄惁灞炰簬闀挎槬
diff --git a/_Main/BL/Type_EnginePipelineColumn/Attribute_EndDate.qbl b/_Main/BL/Type_EnginePipelineColumn/Attribute_EndDate.qbl
new file mode 100644
index 0000000..63fc0ea
--- /dev/null
+++ b/_Main/BL/Type_EnginePipelineColumn/Attribute_EndDate.qbl
@@ -0,0 +1,8 @@
+Quintiq file version 2.0
+#parent: #root
+Attribute EndDate
+{
+  #keys: '3[415136.0.999760039][415136.0.999760038][415136.0.999760040]'
+  Description: '缁撴潫鏃ユ湡'
+  ValueType: Date
+}
diff --git a/_Main/BL/Type_EnginePipelineColumn/Attribute_Period.qbl b/_Main/BL/Type_EnginePipelineColumn/Attribute_Period.qbl
deleted file mode 100644
index b07e6fa..0000000
--- a/_Main/BL/Type_EnginePipelineColumn/Attribute_Period.qbl
+++ /dev/null
@@ -1,7 +0,0 @@
-Quintiq file version 2.0
-#parent: #root
-Attribute Period
-{
-  #keys: '3[415136.0.883574681][415136.0.883574680][415136.0.883574682]'
-  ValueType: Date
-}
diff --git a/_Main/BL/Type_EnginePipelineColumn/Attribute_StartDate.qbl b/_Main/BL/Type_EnginePipelineColumn/Attribute_StartDate.qbl
new file mode 100644
index 0000000..0453f82
--- /dev/null
+++ b/_Main/BL/Type_EnginePipelineColumn/Attribute_StartDate.qbl
@@ -0,0 +1,8 @@
+Quintiq file version 2.0
+#parent: #root
+Attribute StartDate
+{
+  #keys: '3[415136.0.999760029][415136.0.999760028][415136.0.999760030]'
+  Description: '寮�濮嬫棩鏈�'
+  ValueType: Date
+}
diff --git a/_Main/BL/Type_EnginePipelineReport/Method_Generate.qbl b/_Main/BL/Type_EnginePipelineReport/Method_Generate.qbl
index db2c717..cd19c53 100644
--- a/_Main/BL/Type_EnginePipelineReport/Method_Generate.qbl
+++ b/_Main/BL/Type_EnginePipelineReport/Method_Generate.qbl
@@ -132,7 +132,7 @@
           }
     
           for( demandr := showrowdemand.RowNr() + 1; demandr < showrowinventory.RowNr(); demandr := demandr + 1 ){
-            demandrow              := selectobject( this, Row, r, r.RowNr() = demandr );
+            demandrow              := selectobject( this, Row, r, r.RowNr() = demandr and r.Name() = row.Name() );
             if( not isnull( demandrow ) and not exists( demandrow, CellValue, cv, cv.Column() = column ) ){
               demandcell           := column.CellValue( relnew, Value := '' );
               demandrow.CellValue( relinsert, demandcell );
@@ -155,7 +155,7 @@
     }
     traverse( this, Column, column ){
       for( demandr := sumrowdemand.RowNr() + 1; demandr < sumrowinventory.RowNr(); demandr := demandr + 1 ){
-        demandrow              := selectobject( this, Row, r, r.RowNr() = demandr );
+        demandrow              := selectobject( this, Row, r, r.RowNr() = demandr and r.Name() = 'SUM' );
     //    info( '------------------14----------------' );
         if( not isnull( demandrow ) and not exists( demandrow, CellValue, cv, cv.Column() = column ) ){
           demandcell           := column.CellValue( relnew, Value := '' );
diff --git a/_Main/BL/Type_EnginePipelineReport/Method_GenerateColumn.qbl b/_Main/BL/Type_EnginePipelineReport/Method_GenerateColumn.qbl
index 525a923..c4e150b 100644
--- a/_Main/BL/Type_EnginePipelineReport/Method_GenerateColumn.qbl
+++ b/_Main/BL/Type_EnginePipelineReport/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_EnginePipelineReport/Method_GetColumnByUnit.qbl b/_Main/BL/Type_EnginePipelineReport/Method_GetColumnByUnit.qbl
index 97975cf..751a42f 100644
--- a/_Main/BL/Type_EnginePipelineReport/Method_GetColumnByUnit.qbl
+++ b/_Main/BL/Type_EnginePipelineReport/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_EnginePipelineRow/Method_SetCellDemandValue.qbl b/_Main/BL/Type_EnginePipelineRow/Method_SetCellDemandValue.qbl
index b1ce10b..ab43596 100644
--- a/_Main/BL/Type_EnginePipelineRow/Method_SetCellDemandValue.qbl
+++ b/_Main/BL/Type_EnginePipelineRow/Method_SetCellDemandValue.qbl
@@ -11,10 +11,10 @@
     // 鐢勫叞楦� Jun-24-2024 (created)
     cell := selectobject( this, Cell, cell, cell.Column() = column );
     
-    demand := selectobject( cell, Demand, demand, demand.EngineType() = cell.Row().Name() and demand.Model() = segment and demand.Period() = column.Period() );
+    demand := selectobject( cell, Demand, demand, demand.EngineType() = cell.Row().Name() and demand.Model() = segment and demand.Period() = column.StartDate() );
     
     if( isnull( demand ) ){
-      demand := cell.Demand( relnew, EngineType := cell.Row().Name(), Period := column.Period(), Model := segment, Quantity := 0 );
+      demand := cell.Demand( relnew, EngineType := cell.Row().Name(), Period := column.StartDate(), Model := segment, Quantity := 0 );
     }
     
     demand.Quantity( demand.Quantity() + quantity );
diff --git a/_Main/BL/Type_EnginePipelineRow/Method_SetCellProductionValue.qbl b/_Main/BL/Type_EnginePipelineRow/Method_SetCellProductionValue.qbl
index 97c34c8..9cff783 100644
--- a/_Main/BL/Type_EnginePipelineRow/Method_SetCellProductionValue.qbl
+++ b/_Main/BL/Type_EnginePipelineRow/Method_SetCellProductionValue.qbl
@@ -14,7 +14,7 @@
     production := cell.Production();
     
     if( isnull( production ) ){
-      production := cell.Production( relnew, EngineType := cell.Row().Name(), Period := column.Period(), DLProduction := 0, CCProduction := 0 );
+      production := cell.Production( relnew, EngineType := cell.Row().Name(), Period := column.StartDate(), DLProduction := 0, CCProduction := 0 );
     }
     
     if( isccunit ){
diff --git a/_Main/BL/Type_EnginePipelineSource/StaticMethod_Initialize.qbl b/_Main/BL/Type_EnginePipelineSource/StaticMethod_Initialize.qbl
index 0d45aa5..f9e39e3 100644
--- a/_Main/BL/Type_EnginePipelineSource/StaticMethod_Initialize.qbl
+++ b/_Main/BL/Type_EnginePipelineSource/StaticMethod_Initialize.qbl
@@ -47,7 +47,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();//鍥涜垗浜斿叆
           //浜ч噺鏄姞鎬�
@@ -68,16 +68,16 @@
     }
     
     //鐢熸垚闇�姹傛暟鎹�
-    traverse( owner, SalesDemand.astype( Forecast ), forecast, forecast.StartDate() < endperiod.StartDate() and forecast.Quantity() <> 0 
+    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 )
               and exists( forecast, PlanningSalesDemandInPeriod, psdip, psdip.Quantity() <> 0 ) ){
       row                 := table.GetRow( forecast.ProductID() );
-      weekstart           := owner.StartOfPlanning().Date();
+    //  weekstart           := owner.StartOfPlanning().Date();
       traverse( forecast, PlanningSalesDemandInPeriod, psdip, psdip.Quantity() <> 0 ){
         //澶�
         daycolumn         := table.GetColumnByUnit( Translations::MP_GlobalParameters_Day(), psdip.StartDate() );
         //鍛�
-        weekcolumn        := table.GetColumnByUnit( Translations::MP_GlobalParameters_Week(), weekstart );
+        weekcolumn        := table.GetColumnByUnit( Translations::MP_GlobalParameters_Week(), psdip.StartDate() );
           
         if( not isnull( daycolumn ) ){
           row.SetCellDemandValue( daycolumn, forecast.SalesSegmentName(), forecast.Quantity() );
@@ -85,9 +85,9 @@
         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();
-        } 
+    //    if( psdip.StartDate() = ( weekstart + Duration::Days( 6 ) ).Date() or psdip.PeriodStart() = endperiod.StartDate() ){
+    //      weekstart       := ( weekstart + Duration::Days( 7 ) ).Date();
+    //    } 
       }
     }
     
diff --git a/_Main/BL/Type_FinancialSalesSource/StaticMethod_Initialize.qbl b/_Main/BL/Type_FinancialSalesSource/StaticMethod_Initialize.qbl
index e521df4..31f6bcd 100644
--- a/_Main/BL/Type_FinancialSalesSource/StaticMethod_Initialize.qbl
+++ b/_Main/BL/Type_FinancialSalesSource/StaticMethod_Initialize.qbl
@@ -32,7 +32,7 @@
     table.GenerateColumn( owner );
     
     //棣栧厛鍦╢orecast鐣岄潰鏌ユ壘sales segment涓洪暱鏄ョ殑鎵�鏈夐渶姹傦紝璇嗗埆鍑篗LB鐨勬墍鏈変骇鍝侊紝姣忎釜浜у搧鎸夋湀姹囨�婚渶姹傛暟閲�
-    traverse( owner, SalesDemand.astype( Forecast ), forecast, forecast.StartDate() < startofnextyear and forecast.Quantity() <> 0 
+    traverse( owner, SalesDemand.astype( Forecast ), forecast, not isnull( forecast.SalesSegment_MP() ) and forecast.StartDate() < startofnextyear and forecast.Quantity() <> 0 
               and exists( forecast, PlanningSalesDemandInPeriod, psdip, psdip.Quantity() <> 0 ) ){
       salessegment            := forecast.SalesSegment_MP();
       parentsalessegments     := salessegment.GetAllParent();
diff --git a/_Main/BL/Type_MachiningPipelineReport/StaticMethod_GetDefaultCCProductionUnit.qbl b/_Main/BL/Type_MachiningPipelineReport/StaticMethod_GetDefaultCCProductionUnit.qbl
index 050172d..c197afd 100644
--- a/_Main/BL/Type_MachiningPipelineReport/StaticMethod_GetDefaultCCProductionUnit.qbl
+++ b/_Main/BL/Type_MachiningPipelineReport/StaticMethod_GetDefaultCCProductionUnit.qbl
@@ -5,7 +5,7 @@
   TextBody:
   [*
     // 鐢勫叞楦� Jun-25-2024 (created)
-    return '闀挎槬鏈哄姞浜х嚎';
+    return '闀挎槬鏈哄姞绾�';
     //return 'Assembly Plant (France)';
   *]
 }
diff --git a/_Main/BL/Type_MachiningPipelineReport/StaticMethod_GetDefaultDLProductionUnit.qbl b/_Main/BL/Type_MachiningPipelineReport/StaticMethod_GetDefaultDLProductionUnit.qbl
index 4056b04..b9ca520 100644
--- a/_Main/BL/Type_MachiningPipelineReport/StaticMethod_GetDefaultDLProductionUnit.qbl
+++ b/_Main/BL/Type_MachiningPipelineReport/StaticMethod_GetDefaultDLProductionUnit.qbl
@@ -5,7 +5,7 @@
   TextBody:
   [*
     // 鐢勫叞楦� Jun-25-2024 (created)
-    return '澶ц繛鏈哄姞浜х嚎';
+    return '澶ц繛鏈哄姞绾�';
     //return 'Assembly Plant (Spain)';
   *]
 }

--
Gitblit v1.9.3