From 5e6f78ca4e8a022353b8d336e908b396aa6d20c8 Mon Sep 17 00:00:00 2001
From: lazhen <17772815105@139.com>
Date: 星期二, 15 十月 2024 18:11:48 +0800
Subject: [PATCH] 财务产量报表导入累计问题

---
 _Main/UI/MacroPlannerWebApp/Component_FormFinancialProductionReport/Response_PanelExport_369_ButtonExport696_OnClick.def |    2 
 _Main/UI/MacroPlannerWebApp/Component_FormInventorySummaryReport/Response_PanelExport_ButtonSummaryExport_OnClick.def    |    2 
 _Main/UI/MacroPlannerWebApp/Component_FormFinancialSalesReport/Response_PanelExport_ButtonExport570_OnClick.def          |    2 
 _Main/BL/Type_FinancialProductionReport/Method_ImportVerification.qbl                                                    |   18 +++---
 _Main/BL/Type_FinancialSalesReport/Method_ImportVerification.qbl                                                         |   22 +++---
 _Main/BL/Type_FinancialProductionSource/Method_AfterImport.qbl                                                           |   42 +++++++------
 _Main/BL/Type_FinancialSalesSource/Method_AfterImport.qbl                                                                |   41 +++++++------
 _Main/UI/MacroPlannerWebApp/Component_FormFinancialProductionReport/Component_PanelHeader.def                            |    1 
 _Main/UI/MacroPlannerWebApp/Component_FormFinancialSalesReport/Component_PanelHeader.def                                 |    1 
 9 files changed, 69 insertions(+), 62 deletions(-)

diff --git a/_Main/BL/Type_FinancialProductionReport/Method_ImportVerification.qbl b/_Main/BL/Type_FinancialProductionReport/Method_ImportVerification.qbl
index f7b6a58..9460bca 100644
--- a/_Main/BL/Type_FinancialProductionReport/Method_ImportVerification.qbl
+++ b/_Main/BL/Type_FinancialProductionReport/Method_ImportVerification.qbl
@@ -6,8 +6,8 @@
   [*
     // 鐢勫叞楦� Jun-27-2024 (created)
     owner           := this.FinancialProductionSource().MacroPlan();
-    startofthisyear := owner.StartOfPlanning().StartOfYear().Date();
-    startofnextyear := owner.StartOfPlanning().StartOfNextYear().Date();
+    //startofthisyear := owner.StartOfPlanning().StartOfYear().Date();
+    //startofnextyear := owner.StartOfPlanning().StartOfNextYear().Date();
     
     if ( exists( this, FinancialProductionColumn, column, ( column.Index() = 0 and column.Name() <> "Product" )             or 
                                                       ( column.Index() = 1 and column.Name() <> "Unit" )  ) ){
@@ -20,18 +20,18 @@
     } else {
       cnv2 := StringToDate::StandardConverter();
       cnv2.SetCustomConversion();
-      cnv2.CustomFormatString( "dd/MM/yyyy" );
+      cnv2.CustomFormatString( "MM/dd/yyyy");
     
       while ( not isnull( indexcolumn ) ) {
         if ( not cnv2.CanConvert( indexcolumn.Name() ) ) {
           error( Translations::MP_FinancialProductionReport_ImportIndetifyIllegalTime() );
         }
-        period := cnv2.Convert( indexcolumn.Name() );
-    
-        // 鍒ゆ柇鏄惁鍦ㄨ鍒掑懆鏈熷唴
-        if ( period < startofthisyear or period > startofnextyear ) {
-          error( Translations::MP_FinancialProductionReport_ImportIndetifyOverPeriod() );
-        }
+    //    period := cnv2.Convert( indexcolumn.Name() );
+    //
+    //    // 鍒ゆ柇鏄惁鍦ㄨ鍒掑懆鏈熷唴
+    //    if ( period < startofthisyear or period > startofnextyear ) {
+    //      error( Translations::MP_FinancialProductionReport_ImportIndetifyOverPeriod() );
+    //    }
         indexcolumn := indexcolumn.NextColumn();
       }
     }
diff --git a/_Main/BL/Type_FinancialProductionSource/Method_AfterImport.qbl b/_Main/BL/Type_FinancialProductionSource/Method_AfterImport.qbl
index 310a91b..8c5cef4 100644
--- a/_Main/BL/Type_FinancialProductionSource/Method_AfterImport.qbl
+++ b/_Main/BL/Type_FinancialProductionSource/Method_AfterImport.qbl
@@ -35,21 +35,13 @@
         }
         
         //璇诲彇姣忎竴琛岀殑鍗曞厓鏍�
-        traverse( row, FinancialProductionCell, cell, cell.FinancialProductionColumn() <> productcolumn and cell.FinancialProductionColumn() <> unitcolumn ){
+        traverse( row, FinancialProductionCell, cell, cell.FinancialProductionColumn() <> productcolumn and cell.FinancialProductionColumn() <> unitcolumn and cnv2.Convert( cell.FinancialProductionColumn().Name() ) <> beforeyearday ){
           period            := cnv2.Convert( cell.FinancialProductionColumn().Name() )
-          tablecolumn       := construct( FinancialProductionColumn );
-          if( period = beforeyearday ){
-            periodname      := yearday.Format( "M2/D2/Y" );
-            //鑾峰彇琚鍏ユ姤琛ㄧ殑鏃ユ湡鍒�
-            tablecolumn     := selectobject( table, FinancialProductionColumn, column, not column.IsDay() and column.Name() = periodname );
-            if( isnull( tablecolumn ) ){
-              tablecolumn   := table.FinancialProductionColumn( relnew, Name := periodname, Period := yearday.Date() );
-            }
-          }else{
-            tablecolumn     := selectobject( table, FinancialProductionColumn, column, not column.IsDay() and column.Name() = cell.FinancialProductionColumn().Name() );
-            if( isnull( tablecolumn ) ){
-              tablecolumn   := table.FinancialProductionColumn( relnew, Name := cell.FinancialProductionColumn().Name(), Period := cnv2.Convert( cell.FinancialProductionColumn().Name() ) );
-            }
+          periodname      := yearday.Format( "M2/D2/Y" );
+          //鑾峰彇琚鍏ユ姤琛ㄧ殑鏃ユ湡鍒�
+          tablecolumn     := selectobject( table, FinancialProductionColumn, column, not column.IsDay() and column.Name() = periodname );
+          if( isnull( tablecolumn ) ){
+            tablecolumn   := table.FinancialProductionColumn( relnew, Name := periodname, Period := yearday.Date() );
           }
           //鑾峰彇琚鍏ユ姤琛ㄧ殑鍗曞厓鏍�
           unitcell          := selectobject( unitrow, FinancialProductionCell, unitcell, unitcell.FinancialProductionColumn() = tablecolumn );
@@ -57,9 +49,14 @@
             unitcell        := tablecolumn.FinancialProductionCell( relnew, Quantity := [Real]cell.Value(), Value := cell.Value() );
             unitrow.FinancialProductionCell( relinsert, unitcell );
           }else{
-            if( unitcell.Quantity() <> [Real]cell.Value() ){
-              unitcell.Quantity( [Real]cell.Value() );
-              unitcell.IsUpdate( true );
+            previouscolumn  := cell.FinancialProductionColumn().PreviousColumn();
+            if( period = yearday.Date() and not isnull( previouscolumn ) and beforeyearday = cnv2.Convert( previouscolumn.Name() ) ){
+              previouscell  := selectobject( row, FinancialProductionCell, previouscell, previouscell.FinancialProductionColumn() = previouscolumn );
+              quantity      := [Real]cell.Value() + [Real]previouscell.Value();
+              if( unitcell.Quantity() <> quantity ){
+                unitcell.Quantity( quantity );
+                unitcell.IsUpdate( true );
+              }
             }
           }
           allcell           := selectobject( allrow, FinancialProductionCell, allcell, allcell.FinancialProductionColumn() = tablecolumn );
@@ -67,9 +64,14 @@
             allcell         := tablecolumn.FinancialProductionCell( relnew, Quantity := [Real]cell.Value(), Value := cell.Value() );
             allrow.FinancialProductionCell( relinsert, allcell );
           }else{
-            if( allcell.Quantity() <> [Real]cell.Value() ){
-              allcell.Quantity( [Real]cell.Value() );
-              allcell.IsUpdate( true );
+            previouscolumn  := cell.FinancialProductionColumn().PreviousColumn();
+            if( period = yearday.Date() and not isnull( previouscolumn ) and beforeyearday = cnv2.Convert( previouscolumn.Name() ) ){
+              previouscell  := selectobject( row, FinancialProductionCell, previouscell, previouscell.FinancialProductionColumn() = previouscolumn );
+              quantity      := [Real]cell.Value() + [Real]previouscell.Value();
+              if( unitcell.Quantity() <> quantity ){
+                allcell.Quantity( [Real]cell.Value() );
+                allcell.IsUpdate( true );
+              }
             }
           }
         }
diff --git a/_Main/BL/Type_FinancialSalesReport/Method_ImportVerification.qbl b/_Main/BL/Type_FinancialSalesReport/Method_ImportVerification.qbl
index b39339e..3afd388 100644
--- a/_Main/BL/Type_FinancialSalesReport/Method_ImportVerification.qbl
+++ b/_Main/BL/Type_FinancialSalesReport/Method_ImportVerification.qbl
@@ -6,8 +6,8 @@
   [*
     // 鐢勫叞楦� Jun-27-2024 (created)
     owner           := this.FinancialSalesSource().MacroPlan();
-    startofthisyear := owner.StartOfPlanning().StartOfYear().Date();
-    startofnextyear := owner.StartOfPlanning().StartOfNextYear().Date();
+    //startofthisyear := owner.StartOfPlanning().StartOfYear().Date();
+    //startofnextyear := owner.StartOfPlanning().StartOfNextYear().Date();
     
     if ( exists( this, FinancialSalesColumn, column, ( column.Index() = 0 and column.Name() <> "Product" )             or 
                                                       ( column.Index() = 1 and column.Name() <> "Unit" )  ) ){
@@ -20,20 +20,20 @@
     } else {
       cnv2 := StringToDate::StandardConverter();
       cnv2.SetCustomConversion();
-      cnv2.CustomFormatString( "dd/MM/yyyy" );
+      cnv2.CustomFormatString( "MM/dd/yyyy" );
     
       while ( not isnull( indexcolumn ) ) {
         if ( not cnv2.CanConvert( indexcolumn.Name() ) ) {
           error( Translations::MP_FinancialProductionReport_ImportIndetifyIllegalTime() );
         }
-        period := cnv2.Convert( indexcolumn.Name() );
-      //  info( "寮�濮嬫椂闂达細", this.SalesForecastInputSource().PlanningStartDate().Format( "Y-M2-D2" ),
-      //        "缁撴潫鏃堕棿锛�", this.SalesForecastInputSource().PlanningEndDate().Format( "Y-M2-D2" ),
-      //        "鍒楁椂闂达細", cnv2.Convert( indexColumn.name() ).Format( "Y-M2-D2" ) );
-        // 鍒ゆ柇鏄惁鍦ㄨ鍒掑懆鏈熷唴
-        if ( period < startofthisyear or period > startofnextyear ) {
-          error( Translations::MP_FinancialProductionReport_ImportIndetifyOverPeriod() );
-        }
+    //    period := cnv2.Convert( indexcolumn.Name() );
+    //  //  info( "寮�濮嬫椂闂达細", this.SalesForecastInputSource().PlanningStartDate().Format( "Y-M2-D2" ),
+    //  //        "缁撴潫鏃堕棿锛�", this.SalesForecastInputSource().PlanningEndDate().Format( "Y-M2-D2" ),
+    //  //        "鍒楁椂闂达細", cnv2.Convert( indexColumn.name() ).Format( "Y-M2-D2" ) );
+    //    // 鍒ゆ柇鏄惁鍦ㄨ鍒掑懆鏈熷唴
+    //    if ( period < startofthisyear or period > startofnextyear ) {
+    //      error( Translations::MP_FinancialProductionReport_ImportIndetifyOverPeriod() );
+    //    }
         indexcolumn := indexcolumn.NextColumn();
       }
     }
diff --git a/_Main/BL/Type_FinancialSalesSource/Method_AfterImport.qbl b/_Main/BL/Type_FinancialSalesSource/Method_AfterImport.qbl
index bfd3c4c..36d1094 100644
--- a/_Main/BL/Type_FinancialSalesSource/Method_AfterImport.qbl
+++ b/_Main/BL/Type_FinancialSalesSource/Method_AfterImport.qbl
@@ -30,32 +30,30 @@
           allrow            := table.FinancialSalesRow( relnew, Name := product.Value(), Unit := allunit );
         }
         
-        traverse( row, FinancialSalesCell, cell, cell.FinancialSalesColumn() <> productcolumn and cell.FinancialSalesColumn() <> unitcolumn ){
+        traverse( row, FinancialSalesCell, cell, cell.FinancialSalesColumn() <> productcolumn and cell.FinancialSalesColumn() <> unitcolumn and cnv2.Convert( cell.FinancialSalesColumn().Name() ) <> beforeyearday  ){
           column            := cell.FinancialSalesColumn();
           period            := cnv2.Convert( column.Name() )
+          periodname        := period.Format( "M2/D2/Y" )
           
           tablecolumn       := construct( FinancialSalesColumn );
-          if( period = beforeyearday ){
-            periodname      := yearday.Format( "M2/D2/Y" );
-            //鑾峰彇琚鍏ユ姤琛ㄧ殑鏃ユ湡鍒�
-            tablecolumn     := selectobject( table, FinancialSalesColumn, fscolumn, not fscolumn.IsDay() and fscolumn.Name() = periodname );
-            if( isnull( tablecolumn ) ){
-              tablecolumn   := table.FinancialSalesColumn( relnew, Name := periodname, Period := yearday.Date() );
-            }
-          }else{
-            tablecolumn     := selectobject( table, FinancialSalesColumn, fscolumn, not fscolumn.IsDay() and fscolumn.Name() = column.Name() );
-            if( isnull( tablecolumn ) ){
-              tablecolumn   := table.FinancialSalesColumn( relnew, Name := column.Name(), Period := cnv2.Convert( column.Name() ) );
-            }
+          //鑾峰彇琚鍏ユ姤琛ㄧ殑鏃ユ湡鍒�
+          tablecolumn     := selectobject( table, FinancialSalesColumn, fscolumn, not fscolumn.IsDay() and fscolumn.Name() = periodname );
+          if( isnull( tablecolumn ) ){
+            tablecolumn   := table.FinancialSalesColumn( relnew, Name := periodname, Period := yearday.Date() );
           }
           unitcell := selectobject( unitrow, FinancialSalesCell, unitcell, unitcell.FinancialSalesColumn().Name() = column.Name() );
           if( isnull( unitcell ) ){
             unitcell        := tablecolumn.FinancialSalesCell( relnew, Value := cell.Value() );
             unitrow.FinancialSalesCell( relinsert, unitcell );
           }else{
-            if( unitcell.Value() <> cell.Value() ){
-              unitcell.Value( cell.Value() );
-              unitcell.IsUpdate( true );
+            previouscolumn  := cell.FinancialSalesColumn().PreviousColumn();
+            if( period = yearday.Date() and not isnull( previouscolumn ) and beforeyearday = cnv2.Convert( previouscolumn.Name() ) ){
+              previouscell  := selectobject( row, FinancialSalesCell, previouscell, previouscell.FinancialSalesColumn() = previouscolumn );
+              quantity      := [Real]cell.Value() + [Real]previouscell.Value();
+              if( [Real]unitcell.Value() <> quantity ){
+                unitcell.Value( [String]( [Number]cell.Value() ) );
+                unitcell.IsUpdate( true );
+              }
             }
           }
           allcell  := selectobject( allrow, FinancialSalesCell, allcell, allcell.FinancialSalesColumn().Name() = column.Name() );
@@ -63,9 +61,14 @@
             allcell         := tablecolumn.FinancialSalesCell( relnew, Value := cell.Value() );
             allrow.FinancialSalesCell( relinsert, allcell );
           }else{
-            if( allcell.Value() <> cell.Value() ){
-              allcell.Value( cell.Value() );
-              allcell.IsUpdate( true );
+            previouscolumn  := cell.FinancialSalesColumn().PreviousColumn();
+            if( period = yearday.Date() and not isnull( previouscolumn ) and beforeyearday = cnv2.Convert( previouscolumn.Name() ) ){
+              previouscell  := selectobject( row, FinancialSalesCell, previouscell, previouscell.FinancialSalesColumn() = previouscolumn );
+              quantity      := [Real]cell.Value() + [Real]previouscell.Value();
+              if( [Real]allcell.Value() <> quantity ){
+                allcell.Value( [String]( [Number]cell.Value() ) );
+                allcell.IsUpdate( true );
+              }
             }
           }
         }
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormFinancialProductionReport/Component_PanelHeader.def b/_Main/UI/MacroPlannerWebApp/Component_FormFinancialProductionReport/Component_PanelHeader.def
index dcef188..d747539 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_FormFinancialProductionReport/Component_PanelHeader.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormFinancialProductionReport/Component_PanelHeader.def
@@ -10,6 +10,7 @@
   ]
   Properties:
   [
+    FixedSize: true
     Orientation: 'horizontal'
     Taborder: 0
   ]
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormFinancialProductionReport/Response_PanelExport_369_ButtonExport696_OnClick.def b/_Main/UI/MacroPlannerWebApp/Component_FormFinancialProductionReport/Response_PanelExport_369_ButtonExport696_OnClick.def
index 2ad8c4d..3ee2cc5 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_FormFinancialProductionReport/Response_PanelExport_369_ButtonExport696_OnClick.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormFinancialProductionReport/Response_PanelExport_369_ButtonExport696_OnClick.def
@@ -13,7 +13,7 @@
   {
     Body:
     [*
-      binaryValue := FinancialProductionSource::Download( MacroPlan );
+      binaryValue := FinancialProductionSource::Download( MacroPlan, dhFactorys.Data(), dhGenerations.Data(), dhPowers.Data(), dhMQBMLBs.Data() );
       
       Application.Download( FinancialProductionReport::GetDefaultName() + '.xlsx', binaryValue.AsBinaryData() );
     *]
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormFinancialSalesReport/Component_PanelHeader.def b/_Main/UI/MacroPlannerWebApp/Component_FormFinancialSalesReport/Component_PanelHeader.def
index 0570d30..5dbb1ce 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_FormFinancialSalesReport/Component_PanelHeader.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormFinancialSalesReport/Component_PanelHeader.def
@@ -10,6 +10,7 @@
   ]
   Properties:
   [
+    FixedSize: true
     Orientation: 'horizontal'
     Taborder: 0
   ]
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormFinancialSalesReport/Response_PanelExport_ButtonExport570_OnClick.def b/_Main/UI/MacroPlannerWebApp/Component_FormFinancialSalesReport/Response_PanelExport_ButtonExport570_OnClick.def
index 96fa9ae..a198312 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_FormFinancialSalesReport/Response_PanelExport_ButtonExport570_OnClick.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormFinancialSalesReport/Response_PanelExport_ButtonExport570_OnClick.def
@@ -13,7 +13,7 @@
   {
     Body:
     [*
-      binaryValue := FinancialSalesSource::Download( MacroPlan );
+      binaryValue := FinancialSalesSource::Download( MacroPlan, dhFactorys.Data(), dhGenerations.Data(), dhPowers.Data(), dhMQBMLBs.Data() );
       
       Application.Download( FinancialSalesReport::GetDefaultName() + '.xlsx', binaryValue.AsBinaryData() );
       //owner.FinancialSalesSource( relflush );
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormInventorySummaryReport/Response_PanelExport_ButtonSummaryExport_OnClick.def b/_Main/UI/MacroPlannerWebApp/Component_FormInventorySummaryReport/Response_PanelExport_ButtonSummaryExport_OnClick.def
index b3d157a..e049eb6 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_FormInventorySummaryReport/Response_PanelExport_ButtonSummaryExport_OnClick.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormInventorySummaryReport/Response_PanelExport_ButtonSummaryExport_OnClick.def
@@ -13,7 +13,7 @@
   {
     Body:
     [*
-      binaryValue := InventorySummarySource::Download( MacroPlan );
+      binaryValue := InventorySummarySource::Download( MacroPlan, dhFactorys.Data(), dhGenerations.Data(), dhPowers.Data(), dhMQBMLBs.Data(), dhSearch.Data() );
       
       Application.Download( InventorySummaryReport::GetDefaultName() + '.xlsx', binaryValue.AsBinaryData() );
     *]

--
Gitblit v1.9.3