From 5d16fa127ab2005b56ddb9c8d8c2ff1ff0f5826d Mon Sep 17 00:00:00 2001
From: lazhen <17772815105@139.com>
Date: 星期二, 22 十月 2024 17:47:43 +0800
Subject: [PATCH] 发动机物流成本报表导入报错处理

---
 _Main/Sys/Repr/Global/CCEngineLogisticsCostCell.qrp                                                                               |   77 +++++++++++
 _Main/UI/MacroPlannerWebApp/Component_FormFinancialSalesReport/Response_PanelOperation_ButtonSalesImport_OnClick.def              |    3 
 _Main/BL/Type_FinancialProductionSource/StaticMethod_Initialize.qbl                                                               |   16 +
 _Main/BL/Type_CCEngineLogisticsCostReport0/StaticMethod_GetDefaultName.qbl                                                        |    2 
 _Main/BL/Type_CCEngineLogisticsCostReport/StaticMethod_Import.qbl                                                                 |   16 -
 _Main/BL/Type_CCEngineLogisticsCostReport0/StaticMethod_InitializeNew.qbl                                                         |   12 
 _Main/BL/Type_FinancialSalesSource/StaticMethod_InitializeNew.qbl                                                                 |   16 +
 /dev/null                                                                                                                         |   13 -
 _Main/BL/Type_CCEngineLogisticsCostReport0/Method_Generate.qbl                                                                    |   11 +
 _Main/BL/Type_CCEngineLogisticsCostReport/Method_Generate.qbl                                                                     |    9 +
 _Main/UI/MacroPlannerWebApp/Component_FormFinancialSalesReport/Component_PanelFinancialSalesReport.def                            |    1 
 _Main/Sys/Repr/Global/DLEngineLogisticsCostCell.qrp                                                                               |  143 ++++++++++++++++++++
 _Main/UI/MacroPlannerWebApp/Component_FormFinancialProductionReport/Response_PanelExport_369_bRefresh_OnClick.def                 |    2 
 _Main/BL/Type_CCEngineLogisticsCostReport/StaticMethod_Initialize.qbl                                                             |   12 
 _Main/UI/MacroPlannerWebApp/Component_FormFinancialSalesReport/Response_PanelExport_bRefresh_OnClick.def                          |    2 
 _Main/BL/Type_CCEngineLogisticsCostReport0/StaticMethod_Download.qbl                                                              |   12 +
 _Main/BL/Type_FinancialProductionReport/Method_GenerateShow.qbl                                                                   |   14 +
 _Main/BL/Type_FinancialSalesSource/Method_AfterImport.qbl                                                                         |   10 
 _Main/UI/MacroPlannerWebApp/Component_FormFinancialProductionReport/Response_PanelOperation_ButtonProductionImport660_OnClick.def |    3 
 _Main/BL/Type_FinancialSalesReport/Method_GenerateShow.qbl                                                                        |    8 +
 _Main/BL/Type_CCEngineLogisticsCostReport0/StaticMethod_Import.qbl                                                                |   15 -
 21 files changed, 319 insertions(+), 78 deletions(-)

diff --git a/_Main/BL/Type_CCEngineLogisticsCostCell/Function_CalcAllCost.qbl b/_Main/BL/Type_CCEngineLogisticsCostCell/Function_CalcAllCost.qbl
deleted file mode 100644
index c23582b..0000000
--- a/_Main/BL/Type_CCEngineLogisticsCostCell/Function_CalcAllCost.qbl
+++ /dev/null
@@ -1,13 +0,0 @@
-Quintiq file version 2.0
-#parent: #root
-Function CalcAllCost
-{
-  Description: '璁$畻鎬昏垂鐢�'
-  TextBody:
-  [*
-    // 鐢勫叞楦� Aug-12-2024 (created)
-    value := this.EstimateTotalCost() * [Real]this.CoefficientValue();
-    
-    this.AllCost( value );
-  *]
-}
diff --git a/_Main/BL/Type_CCEngineLogisticsCostCell0/Function_CalcAllCost.qbl b/_Main/BL/Type_CCEngineLogisticsCostCell0/Function_CalcAllCost.qbl
deleted file mode 100644
index c23582b..0000000
--- a/_Main/BL/Type_CCEngineLogisticsCostCell0/Function_CalcAllCost.qbl
+++ /dev/null
@@ -1,13 +0,0 @@
-Quintiq file version 2.0
-#parent: #root
-Function CalcAllCost
-{
-  Description: '璁$畻鎬昏垂鐢�'
-  TextBody:
-  [*
-    // 鐢勫叞楦� Aug-12-2024 (created)
-    value := this.EstimateTotalCost() * [Real]this.CoefficientValue();
-    
-    this.AllCost( value );
-  *]
-}
diff --git a/_Main/BL/Type_CCEngineLogisticsCostReport/Method_Generate.qbl b/_Main/BL/Type_CCEngineLogisticsCostReport/Method_Generate.qbl
index 0d48222..d2e883a 100644
--- a/_Main/BL/Type_CCEngineLogisticsCostReport/Method_Generate.qbl
+++ b/_Main/BL/Type_CCEngineLogisticsCostReport/Method_Generate.qbl
@@ -36,7 +36,7 @@
             sumcell  := sumrow.Initialize( column );
           }
           //鏄剧ず鏈堝崟鍏冩牸
-          showcell   := showrow.Cell( relnew, RentInCost := cell.RentInCost(), RentOutOfCost := cell.RentOutOfCost(), WerkToRentTransCost := cell.WerkToRentTransCost(), RentStorCost := cell.RentStorCost(), CoefficientValue := cell.CoefficientValue() );
+          showcell   := showrow.Cell( relnew, RentInCost := cell.RentInCost(), RentOutOfCost := cell.RentOutOfCost(), WerkToRentTransCost := cell.WerkToRentTransCost(), RentStorCost := cell.RentStorCost(), CoefficientValue := cell.CoefficientValue(), AllCost := cell.EstimateTotalCost() * [Real]cell.CoefficientValue() );
           column.Cell( relinsert, showcell );
           //鏄剧ず骞村崟鍏冩牸
           yearcell.RentInCost( cell.RentInCost() + yearcell.RentInCost() );
@@ -54,6 +54,13 @@
           sumcell.WerkToRentTransCost( cell.WerkToRentTransCost() + sumcell.WerkToRentTransCost() );
           sumcell.RentStorCost( cell.RentStorCost() + sumcell.RentStorCost() );
         }
+        yearcell.AllCost( yearcell.EstimateTotalCost() * [Real]yearcell.CoefficientValue() );
+      }
+    }
+    traverse( sumrow, Cell, cell ){
+      cell.AllCost( cell.EstimateTotalCost() * [Real]cell.CoefficientValue() );
+      if( exists( cell.Column(), Cell, acell, acell.IsUpdate() ) ){
+        cell.IsUpdate( true );
       }
     }
   *]
diff --git a/_Main/BL/Type_CCEngineLogisticsCostReport/StaticMethod_Import.qbl b/_Main/BL/Type_CCEngineLogisticsCostReport/StaticMethod_Import.qbl
index 190be2b..e5819b2 100644
--- a/_Main/BL/Type_CCEngineLogisticsCostReport/StaticMethod_Import.qbl
+++ b/_Main/BL/Type_CCEngineLogisticsCostReport/StaticMethod_Import.qbl
@@ -10,13 +10,13 @@
   TextBody:
   [*
     // 鐢勫叞楦� Sep-20-2024 (created)
-    name                      := CCEngineLogisticsCostReport::GetDefaultName();
+    //name                      := CCEngineLogisticsCostReport::GetDefaultName();
     source                    := GeneralExcelImportAndExportDataSource::Upload( recycle, binaryValue, OS::TempPath() + "template.xlsx" );
     source.ReadStructure();
     Transaction::Transaction().Propagate( attribute( GeneralExcelImportAndExportDataColumn, ColumnIndex ) );
     
     //娓呯┖瀵煎叆涔嬪墠鐨勮〃
-    owner.CCEngineLogisticsCostReport( relflush );
+    //owner.CCEngineLogisticsCostReport( relflush );
     cnv2 := StringToDate::StandardConverter();
     cnv2.SetCustomConversion();
     //cnv2.CustomFormatString( "M2/D2/Y" );
@@ -26,9 +26,7 @@
     productcolumn             := selectobject( source, GeneralExcelImportAndExportDataTable.GeneralExcelImportAndExportDataColumn, column, column.ColumnIndex() = 0 );
     attricolumn               := selectobject( source, GeneralExcelImportAndExportDataTable.GeneralExcelImportAndExportDataColumn, column, column.ColumnIndex() = 1 );
     //鐢熸垚鏂拌〃鐨勬棩鏈熷垪
-    table                     := owner.CCEngineLogisticsCostReport( relnew, ID := name, Name := name );
-    showtable                 := owner.CCEngineLogisticsCostReport( relnew, ID := name + 'Show', Name := name, IsShow := true );
-    table.GenerateColumn( owner );
+    table                     := CCEngineLogisticsCostReport::InitiateSearch( owner );
     traverse( source, GeneralExcelImportAndExportDataTable.GeneralExcelImportAndExportDataRow, excelrow ){
       productcell             := selectobject( excelrow, GeneralExcelImportAndExportDataCell, excelcell, excelcell.GeneralExcelImportAndExportDataColumn() = productcolumn );
       //澶勭悊鏈鍚屾鐨勪骇鍝�
@@ -77,13 +75,5 @@
         }
       }
     }
-    rows := selectsortedset( table, Row, row, row.Name() );
-    i    := 0;
-    traverse( rows, Elements, e ){
-      e.RowNr( i );
-      i := i + 1;
-    }
-    //
-    showtable.Generate( owner.CCEngineLogisticsCostSearch(), products );
   *]
 }
diff --git a/_Main/BL/Type_CCEngineLogisticsCostReport/StaticMethod_Initialize.qbl b/_Main/BL/Type_CCEngineLogisticsCostReport/StaticMethod_Initialize.qbl
index 572e04a..bbf9847 100644
--- a/_Main/BL/Type_CCEngineLogisticsCostReport/StaticMethod_Initialize.qbl
+++ b/_Main/BL/Type_CCEngineLogisticsCostReport/StaticMethod_Initialize.qbl
@@ -150,12 +150,12 @@
         }
       }
     }
-    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 );
   *]
diff --git a/_Main/BL/Type_CCEngineLogisticsCostReport0/Method_Generate.qbl b/_Main/BL/Type_CCEngineLogisticsCostReport0/Method_Generate.qbl
index 8ed89f7..c3051ae 100644
--- a/_Main/BL/Type_CCEngineLogisticsCostReport0/Method_Generate.qbl
+++ b/_Main/BL/Type_CCEngineLogisticsCostReport0/Method_Generate.qbl
@@ -45,7 +45,8 @@
                                       , DLRentOutOfCost              := cell.DLRentOutOfCost()
                                       , WerkToDLRentTransCost        := cell.WerkToDLRentTransCost()
                                       , DLRentStorCost               := cell.DLRentStorCost()
-                                      , CoefficientValue             := cell.CoefficientValue() );
+                                      , CoefficientValue             := cell.CoefficientValue()
+                                      , AllCost                      := cell.EstimateTotalCost() * [Real]cell.CoefficientValue() );
           column.Cell( relinsert, showcell );
           //鏄剧ず骞村崟鍏冩牸
           yearcell.CCRentInCost( cell.CCRentInCost() + yearcell.CCRentInCost() );
@@ -78,6 +79,14 @@
           sumcell.WerkToDLRentTransCost( cell.WerkToDLRentTransCost() + sumcell.WerkToDLRentTransCost() );
           sumcell.DLRentStorCost( cell.DLRentStorCost() + sumcell.DLRentStorCost() );
         }
+        yearcell.AllCost( yearcell.EstimateTotalCost() * [Real]yearcell.CoefficientValue() );
+      }
+    }
+    
+    traverse( sumrow, Cell, cell ){
+      cell.AllCost( cell.EstimateTotalCost() * [Real]cell.CoefficientValue() );
+      if( exists( cell.Column(), Cell, acell, acell.IsUpdate() ) ){
+        cell.IsUpdate( true );
       }
     }
     info( '-------------------------g------------end---------------------------------' );
diff --git a/_Main/BL/Type_CCEngineLogisticsCostReport0/StaticMethod_Download.qbl b/_Main/BL/Type_CCEngineLogisticsCostReport0/StaticMethod_Download.qbl
index 04d5dbc..b289258 100644
--- a/_Main/BL/Type_CCEngineLogisticsCostReport0/StaticMethod_Download.qbl
+++ b/_Main/BL/Type_CCEngineLogisticsCostReport0/StaticMethod_Download.qbl
@@ -95,6 +95,10 @@
           product12cellElement := xmlDOM.CreateElement( "cell" );
           product12cellElement.SetAttribute( "value", row.Name() );
           productcolumnelement.AppendChild( product12cellElement );
+          
+          product13cellElement := xmlDOM.CreateElement( "cell" );
+          product13cellElement.SetAttribute( "value", row.Name() );
+          productcolumnelement.AppendChild( product13cellElement );
           //Attribute
           //闀挎槬澶栫搴撳叆搴撹垂鐢�
           ccrententercostcellElement := xmlDOM.CreateElement( "cell" );
@@ -131,6 +135,10 @@
           //澶ц繛澶栫搴撲粨鍌ㄨ垂鐢�
           dlrentstoragecostcellElement := xmlDOM.CreateElement( "cell" );
           dlrentstoragecostcellElement.SetAttribute( "value", '澶ц繛澶栫搴撲粨鍌ㄨ垂鐢�' );//DLRentStorageCost
+          attricolumnelement.AppendChild( dlrentstoragecostcellElement );
+          //澶ц繛澶栫搴撳叾浠栬垂鐢�
+          dlrentstoragecostcellElement := xmlDOM.CreateElement( "cell" );
+          dlrentstoragecostcellElement.SetAttribute( "value", '澶ц繛澶栫搴撳叾浠栬垂鐢�' );//DLRentStorageCost
           attricolumnelement.AppendChild( dlrentstoragecostcellElement );
           //棰勮鎬昏垂鐢�
           estimatedtotalcostcellElement := xmlDOM.CreateElement( "cell" );
@@ -181,6 +189,10 @@
         dlrentstoragecostcellElement := xmlDOM.CreateElement( "cell" );
         dlrentstoragecostcellElement.SetAttribute( "value", c.DLRentStorCost().Format( 'N(Dec)' ) );
         columnelement.AppendChild( dlrentstoragecostcellElement );
+        //澶ц繛澶栫搴撳叾浠栬垂鐢�
+        dlrentstoragecostcellElement := xmlDOM.CreateElement( "cell" );
+        dlrentstoragecostcellElement.SetAttribute( "value", c.DLRentOtherCost().Format( 'N(Dec)' ) );
+        columnelement.AppendChild( dlrentstoragecostcellElement );
         //棰勮鎬昏垂鐢�
         estimatedtotalcostcellElement := xmlDOM.CreateElement( "cell" );
         estimatedtotalcostcellElement.SetAttribute( "value", c.EstimateTotalCost().Format( 'N(Dec)' ) );
diff --git a/_Main/BL/Type_CCEngineLogisticsCostReport0/StaticMethod_GetDefaultName.qbl b/_Main/BL/Type_CCEngineLogisticsCostReport0/StaticMethod_GetDefaultName.qbl
index 5f29f58..257fc9c 100644
--- a/_Main/BL/Type_CCEngineLogisticsCostReport0/StaticMethod_GetDefaultName.qbl
+++ b/_Main/BL/Type_CCEngineLogisticsCostReport0/StaticMethod_GetDefaultName.qbl
@@ -5,6 +5,6 @@
   TextBody:
   [*
     // 鐢勫叞楦� Jun-25-2024 (created)
-    return 'CC engine logistics cost reports';
+    return 'DL engine logistics cost reports';
   *]
 }
diff --git a/_Main/BL/Type_CCEngineLogisticsCostReport0/StaticMethod_Import.qbl b/_Main/BL/Type_CCEngineLogisticsCostReport0/StaticMethod_Import.qbl
index 2726257..b6edd38 100644
--- a/_Main/BL/Type_CCEngineLogisticsCostReport0/StaticMethod_Import.qbl
+++ b/_Main/BL/Type_CCEngineLogisticsCostReport0/StaticMethod_Import.qbl
@@ -10,13 +10,12 @@
   TextBody:
   [*
     // 鐢勫叞楦� Sep-20-2024 (created)
-    name                      := CCEngineLogisticsCostReport::GetDefaultName();
+    //name                      := CCEngineLogisticsCostReport::GetDefaultName();
     source                    := GeneralExcelImportAndExportDataSource::Upload( recycle, binaryValue, OS::TempPath() + "template.xlsx" );
     source.ReadStructure();
     Transaction::Transaction().Propagate( attribute( GeneralExcelImportAndExportDataColumn, ColumnIndex ) );
     
     //娓呯┖瀵煎叆涔嬪墠鐨勮〃
-    owner.DLEngineLogisticsCostReport( relflush );
     cnv2 := StringToDate::StandardConverter();
     cnv2.SetCustomConversion();
     //cnv2.CustomFormatString( "M2/D2/Y" );
@@ -26,9 +25,7 @@
     productcolumn             := selectobject( source, GeneralExcelImportAndExportDataTable.GeneralExcelImportAndExportDataColumn, column, column.ColumnIndex() = 0 );
     attricolumn               := selectobject( source, GeneralExcelImportAndExportDataTable.GeneralExcelImportAndExportDataColumn, column, column.ColumnIndex() = 1 );
     //鐢熸垚鏂拌〃鐨勬棩鏈熷垪
-    table                     := owner.DLEngineLogisticsCostReport( relnew, ID := name, Name := name );
-    showtable                 := owner.DLEngineLogisticsCostReport( relnew, ID := name + 'Show', Name := name, IsShow := true );
-    table.GenerateColumn( owner );
+    table                     := DLEngineLogisticsCostReport::InitiateSearch( owner );
     traverse( source, GeneralExcelImportAndExportDataTable.GeneralExcelImportAndExportDataRow, excelrow ){
       productcell             := selectobject( excelrow, GeneralExcelImportAndExportDataCell, excelcell, excelcell.GeneralExcelImportAndExportDataColumn() = productcolumn );
       //澶勭悊鏈鍚屾鐨勪骇鍝�
@@ -87,13 +84,5 @@
         }
       }
     }
-    rows := selectsortedset( table, Row, row, row.Name() );
-    i    := 0;
-    traverse( rows, Elements, e ){
-      e.RowNr( i );
-      i := i + 1;
-    }
-    //
-    showtable.Generate( owner.DLEngineLogisticsCostSearch(), products );
   *]
 }
diff --git a/_Main/BL/Type_CCEngineLogisticsCostReport0/StaticMethod_InitializeNew.qbl b/_Main/BL/Type_CCEngineLogisticsCostReport0/StaticMethod_InitializeNew.qbl
index 08b0f6f..0828d4e 100644
--- a/_Main/BL/Type_CCEngineLogisticsCostReport0/StaticMethod_InitializeNew.qbl
+++ b/_Main/BL/Type_CCEngineLogisticsCostReport0/StaticMethod_InitializeNew.qbl
@@ -220,12 +220,12 @@
       }
     }
     
-    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;
+    //}
     info( '-------------------------------------end----------------------------------' );
     //
     showtable.Generate( search, products );
diff --git a/_Main/BL/Type_FinancialProductionReport/Method_GenerateShow.qbl b/_Main/BL/Type_FinancialProductionReport/Method_GenerateShow.qbl
index 45ed8d4..bcccd0d 100644
--- a/_Main/BL/Type_FinancialProductionReport/Method_GenerateShow.qbl
+++ b/_Main/BL/Type_FinancialProductionReport/Method_GenerateShow.qbl
@@ -24,15 +24,15 @@
         yearcell              := yearcolumn.FinancialProductionCell( relnew, Quantity := 0 );
         showrow.FinancialProductionCell( relinsert, yearcell );
         traverse( row, FinancialProductionCell, cell, not cell.FinancialProductionColumn().IsDay() ){
-          column   := selectobject( this, FinancialProductionColumn, column, column.Name() = cell.FinancialProductionColumn().Name() and not column.IsDay() );
+          column              := selectobject( this, FinancialProductionColumn, column, column.Name() = cell.FinancialProductionColumn().Name() and not column.IsDay() );
           
-          sumcell  := selectobject( column, FinancialProductionCell, c, c.FinancialProductionRow() = sumrow );
+          sumcell             := selectobject( column, FinancialProductionCell, c, c.FinancialProductionRow() = sumrow );
           if( isnull( sumcell ) ){
-            sumcell := column.FinancialProductionCell( relnew, Quantity := 0);
+            sumcell           := column.FinancialProductionCell( relnew, Quantity := 0);
             sumrow.FinancialProductionCell( relinsert, sumcell );
           }
           
-          showcell := column.FinancialProductionCell( relnew, Quantity := cell.Quantity(), IsUpdate := cell.IsUpdate()  );
+          showcell            := column.FinancialProductionCell( relnew, Quantity := cell.Quantity(), IsUpdate := cell.IsUpdate()  );
           showrow.FinancialProductionCell( relinsert, showcell );
           yearcell.Quantity( yearcell.Quantity() + cell.Quantity() );
           sumyearcell.Quantity( sumyearcell.Quantity() + cell.Quantity() );
@@ -40,5 +40,11 @@
         }
       }
     }
+    traverse( this, FinancialProductionColumn, column ){
+      if( exists( column, FinancialProductionCell, cell, cell.IsUpdate() ) ){
+        sumcell               := selectobject( sumrow, FinancialProductionCell, sumcell, sumcell.FinancialProductionColumn() = column );
+        sumcell.IsUpdate( true );
+      }
+    }
   *]
 }
diff --git a/_Main/BL/Type_FinancialProductionSource/StaticMethod_Initialize.qbl b/_Main/BL/Type_FinancialProductionSource/StaticMethod_Initialize.qbl
index 8e87020..678d5cc 100644
--- a/_Main/BL/Type_FinancialProductionSource/StaticMethod_Initialize.qbl
+++ b/_Main/BL/Type_FinancialProductionSource/StaticMethod_Initialize.qbl
@@ -7,19 +7,21 @@
   TextBody:
   [*
     // 鐢勫叞楦� Jun-24-2024 (created)
-    owner.FinancialProductionSource( relflush );
+    traverse( owner, FinancialProductionSource, source, not source.IsImport() ){
+      source.Delete();
+    }
     owner.FPImportData( relflush );
     ccunit                    := FinancialProductionReport::GetDefaultCCUnit();
     dlunit                    := FinancialProductionReport::GetDefaultDLUnit();
     allunit                   := FinancialProductionReport::GetDefaultAllUnit();
     source                    := owner.FinancialProductionSource( relnew, IsImport := false, Name := FinancialProductionReport::GetDefaultName() );
     table                     := source.FinancialProductionReport( relnew, ID := source.Name(), Name := source.Name(), IsImport := false );
-    showtable                 := source.FinancialProductionReport( relnew, ID := source.Name() + 'Show', Name := source.Name(), IsImport := false, IsShow := true );
+    source.FinancialProductionReport( relnew, ID := source.Name() + 'Show', Name := source.Name(), IsImport := false, IsShow := true );
     startofplanning           := owner.StartOfPlanning().Date();
     //startofyear               := startofplanning.StartOfYear();
     startofnextyear           := startofplanning.StartOfNextYear();
     
-    search                    := owner.FinancialProductionSearch( relnew, Unit := allunit, Generation := allunit, MqbMlb := allunit, Power := allunit );
+    //search                    := owner.FinancialProductionSearch( relnew, Unit := allunit, Generation := allunit, MqbMlb := allunit, Power := allunit );
     
     productids                := construct( Strings );
     table.GenerateColumn( owner );
@@ -52,7 +54,11 @@
         }
       }
     }
-    factorys                  := selectset( owner, Factory, factory, factory.ID() = FinancialProductionReport::GetDefaultAllUnit() );
-    showtable.Generate( search, factorys, productids );
+    excelsource               := selectobject( owner, FinancialProductionSource, excelsource, excelsource.IsImport() );
+    if( not isnull( excelsource ) ){
+      excelsource.AfterImport();
+    }
+    //factorys                  := selectset( owner, Factory, factory, factory.ID() = FinancialProductionReport::GetDefaultAllUnit() );
+    //showtable.Generate( search, factorys, productids );
   *]
 }
diff --git a/_Main/BL/Type_FinancialSalesReport/Method_GenerateShow.qbl b/_Main/BL/Type_FinancialSalesReport/Method_GenerateShow.qbl
index 58c304f..f37bed3 100644
--- a/_Main/BL/Type_FinancialSalesReport/Method_GenerateShow.qbl
+++ b/_Main/BL/Type_FinancialSalesReport/Method_GenerateShow.qbl
@@ -19,7 +19,7 @@
       productid.Add( row.Name() );
       
       if( productids.ContainsAll( productid ) ){
-        showrow         := this.FinancialSalesRow( relnew, Name := factory.Format( 'S(Len(10))' ).Concat( row.Name() ), Unit := row.Unit() );
+        showrow         := this.FinancialSalesRow( relnew, Name := factory.Format( 'S(Len(10))' ).Concat( row.Name() ), Unit := row.Unit(), Factory := factory );
         row.Product_MP().FinancialSalesRow( relinsert, showrow );
         yearcell        := yearcolumn.FinancialSalesCell( relnew, Value := '0' );
         showrow.FinancialSalesCell( relinsert, yearcell );
@@ -42,5 +42,11 @@
         }
       }
     }
+    traverse( this, FinancialSalesColumn, column ){
+      if( exists( column, FinancialSalesCell, cell, cell.IsUpdate() ) ){
+        sumcell         := selectobject( sumrow, FinancialSalesCell, sumcell, sumcell.FinancialSalesColumn() = column );
+        sumcell.IsUpdate( true );
+      }
+    }
   *]
 }
diff --git a/_Main/BL/Type_FinancialSalesSource/Method_AfterImport.qbl b/_Main/BL/Type_FinancialSalesSource/Method_AfterImport.qbl
index 36d1094..43dbe28 100644
--- a/_Main/BL/Type_FinancialSalesSource/Method_AfterImport.qbl
+++ b/_Main/BL/Type_FinancialSalesSource/Method_AfterImport.qbl
@@ -25,7 +25,7 @@
         if( isnull( unitrow ) ){
           unitrow           := table.FinancialSalesRow( relnew, Name := product.Value(), Unit := unit.Value() );
         }
-        allrow  := selectobject( table, FinancialSalesRow, allrow, allrow.Name() = product.Value() and allrow.Unit() = allunit );
+        allrow              := selectobject( table, FinancialSalesRow, allrow, allrow.Name() = product.Value() and allrow.Unit() = allunit );
         if( isnull( unitrow ) ){
           allrow            := table.FinancialSalesRow( relnew, Name := product.Value(), Unit := allunit );
         }
@@ -41,7 +41,7 @@
           if( isnull( tablecolumn ) ){
             tablecolumn   := table.FinancialSalesColumn( relnew, Name := periodname, Period := yearday.Date() );
           }
-          unitcell := selectobject( unitrow, FinancialSalesCell, unitcell, unitcell.FinancialSalesColumn().Name() = column.Name() );
+          unitcell := selectobject( unitrow, FinancialSalesCell, unitcell, unitcell.FinancialSalesColumn() = tablecolumn );
           if( isnull( unitcell ) ){
             unitcell        := tablecolumn.FinancialSalesCell( relnew, Value := cell.Value() );
             unitrow.FinancialSalesCell( relinsert, unitcell );
@@ -51,12 +51,12 @@
               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.Value( [String]( [Number]quantity ) );
                 unitcell.IsUpdate( true );
               }
             }
           }
-          allcell  := selectobject( allrow, FinancialSalesCell, allcell, allcell.FinancialSalesColumn().Name() = column.Name() );
+          allcell  := selectobject( allrow, FinancialSalesCell, allcell, allcell.FinancialSalesColumn() = tablecolumn  );
           if( isnull( unitcell ) ){
             allcell         := tablecolumn.FinancialSalesCell( relnew, Value := cell.Value() );
             allrow.FinancialSalesCell( relinsert, allcell );
@@ -66,7 +66,7 @@
               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.Value( [String]( [Number]quantity ) );
                 allcell.IsUpdate( true );
               }
             }
diff --git a/_Main/BL/Type_FinancialSalesSource/StaticMethod_InitializeNew.qbl b/_Main/BL/Type_FinancialSalesSource/StaticMethod_InitializeNew.qbl
index 208fe2e..f4def0f 100644
--- a/_Main/BL/Type_FinancialSalesSource/StaticMethod_InitializeNew.qbl
+++ b/_Main/BL/Type_FinancialSalesSource/StaticMethod_InitializeNew.qbl
@@ -8,7 +8,9 @@
   TextBody:
   [*
     // 鐢勫叞楦� Jun-24-2024 (created)
-    owner.FinancialSalesSource( relflush );
+    traverse( owner, FinancialSalesSource, source, not source.IsImport() ){
+      source.Delete();
+    }
     owner.FSImportData( relflush );
     productids                := construct( Strings );
     allunit                   := FinancialSalesReport::GetDefaultAllUnit();
@@ -20,12 +22,12 @@
     
     source                    := owner.FinancialSalesSource( relnew, IsImport := false, Name := FinancialSalesReport::GetDefaultName() );
     table                     := source.FinancialSalesReport( relnew, ID := source.Name(), Name := source.Name(), IsImport := false );
-    showtable                 := source.FinancialSalesReport( relnew, ID := source.Name() + 'Show', Name := source.Name(), IsImport := false, IsShow := true );
+    source.FinancialSalesReport( relnew, ID := source.Name() + 'Show', Name := source.Name(), IsImport := false, IsShow := true );
     startofplanning           := owner.StartOfPlanning().Date();
     //startofyear               := startofplanning.StartOfYear();
     startofnextyear           := startofplanning.StartOfNextYear();
     
-    search                    := owner.FinancialSalesSearch( relnew, Unit := allunit, Generation := allunit, MqbMlb := allunit, Power := allunit );
+    //search                    := owner.FinancialSalesSearch( relnew, Unit := allunit, Generation := allunit, MqbMlb := allunit, Power := allunit );
     
     table.GenerateColumn( owner );
     
@@ -131,7 +133,11 @@
     //    }
     //  }
     //}
-    factorys                  := selectset( owner, Factory, factory, factory.ID() = FinancialProductionReport::GetDefaultAllUnit() );
-    showtable.Generate( search, factorys, productids );
+    excelsource               := selectobject( owner, FinancialSalesSource, excelsource, excelsource.IsImport() );
+    if( not isnull( excelsource ) ){
+      excelsource.AfterImport();
+    }
+    //factorys                  := selectset( owner, Factory, factory, factory.ID() = FinancialProductionReport::GetDefaultAllUnit() );
+    //showtable.Generate( search, factorys, productids );
   *]
 }
diff --git a/_Main/Sys/Repr/Global/CCEngineLogisticsCostCell.qrp b/_Main/Sys/Repr/Global/CCEngineLogisticsCostCell.qrp
index cd90a20..d9d9f08 100644
--- a/_Main/Sys/Repr/Global/CCEngineLogisticsCostCell.qrp
+++ b/_Main/Sys/Repr/Global/CCEngineLogisticsCostCell.qrp
@@ -6,36 +6,113 @@
   {
     AttributeKey: '[415136.0.1160240044]'
     Synonym: '鎬昏垂鐢�'
+    Conditional:
+    [
+      DataRepresentation.Conditional
+      {
+        BackgroundColor: '$FF6666'
+        ConditionBody: 'object.IsUpdate()'
+        ConversionBody: ''
+        DefaultBackgroundColor: false
+        InheritConversion: false
+      }
+    ]
   }
   AttributeRepresentation CoefficientValue
   {
     AttributeKey: '[415136.0.1188511346]'
     Synonym: '绯绘暟'
+    Conditional:
+    [
+      DataRepresentation.Conditional
+      {
+        BackgroundColor: '$FF6666'
+        ConditionBody: 'object.IsUpdate()'
+        ConversionBody: ''
+        DefaultBackgroundColor: false
+        InheritConversion: false
+      }
+    ]
   }
   AttributeRepresentation EstimateTotalCost
   {
     AttributeKey: '[415136.0.1160240036]'
     Synonym: '棰勮鎬昏垂鐢�'
+    Conditional:
+    [
+      DataRepresentation.Conditional
+      {
+        BackgroundColor: '$FF6666'
+        ConditionBody: 'object.IsUpdate()'
+        ConversionBody: ''
+        DefaultBackgroundColor: false
+        InheritConversion: false
+      }
+    ]
   }
   AttributeRepresentation RentInCost
   {
     AttributeKey: '[415136.0.1160164662]'
     Synonym: '澶栫搴撳叆搴撹垂鐢�'
+    Conditional:
+    [
+      DataRepresentation.Conditional
+      {
+        BackgroundColor: '$FF6666'
+        ConditionBody: 'object.IsUpdate()'
+        ConversionBody: ''
+        DefaultBackgroundColor: false
+        InheritConversion: false
+      }
+    ]
   }
   AttributeRepresentation RentOutOfCost
   {
     AttributeKey: '[415136.0.1160164672]'
     Synonym: '澶栫搴撳嚭搴撹垂鐢�'
+    Conditional:
+    [
+      DataRepresentation.Conditional
+      {
+        BackgroundColor: '$FF6666'
+        ConditionBody: 'object.IsUpdate()'
+        ConversionBody: ''
+        DefaultBackgroundColor: false
+        InheritConversion: false
+      }
+    ]
   }
   AttributeRepresentation RentStorCost
   {
     AttributeKey: '[415136.0.1160164707]'
     Synonym: '澶栫搴撲粨鍌ㄨ垂鐢�'
+    Conditional:
+    [
+      DataRepresentation.Conditional
+      {
+        BackgroundColor: '$FF6666'
+        ConditionBody: 'object.IsUpdate()'
+        ConversionBody: ''
+        DefaultBackgroundColor: false
+        InheritConversion: false
+      }
+    ]
   }
   AttributeRepresentation WerkToRentTransCost
   {
     AttributeKey: '[415136.0.1160240024]'
     Synonym: '鍘傚唴鍒板绉熷簱杩愯緭璐圭敤'
+    Conditional:
+    [
+      DataRepresentation.Conditional
+      {
+        BackgroundColor: '$FF6666'
+        ConditionBody: 'object.IsUpdate()'
+        ConversionBody: ''
+        DefaultBackgroundColor: false
+        InheritConversion: false
+      }
+    ]
   }
   RelationRepresentation Column { RelationKey: '[415136.0.986881392]' Visibility: 'Normal' }
 }
diff --git a/_Main/Sys/Repr/Global/DLEngineLogisticsCostCell.qrp b/_Main/Sys/Repr/Global/DLEngineLogisticsCostCell.qrp
index 047ceef..2f5d5ae 100644
--- a/_Main/Sys/Repr/Global/DLEngineLogisticsCostCell.qrp
+++ b/_Main/Sys/Repr/Global/DLEngineLogisticsCostCell.qrp
@@ -6,66 +6,209 @@
   {
     AttributeKey: '[415136.0.1160164830]'
     Synonym: '鎬昏垂鐢�'
+    Conditional:
+    [
+      DataRepresentation.Conditional
+      {
+        BackgroundColor: '$FF6666'
+        ConditionBody: 'object.IsUpdate()'
+        ConversionBody: ''
+        DefaultBackgroundColor: false
+        InheritConversion: false
+      }
+    ]
   }
   AttributeRepresentation CCLongTransCost
   {
     AttributeKey: '[415136.0.1160164734]'
     Synonym: '闀挎槬闀块�旇繍杈撹垂鐢�'
+    Conditional:
+    [
+      DataRepresentation.Conditional
+      {
+        BackgroundColor: '$FF6666'
+        ConditionBody: 'object.IsUpdate()'
+        ConversionBody: ''
+        DefaultBackgroundColor: false
+        InheritConversion: false
+      }
+    ]
   }
   AttributeRepresentation CCRentInCost
   {
     AttributeKey: '[415136.0.1160164742]'
     Synonym: '闀挎槬澶栫搴撳叆搴撹垂鐢�'
+    Conditional:
+    [
+      DataRepresentation.Conditional
+      {
+        BackgroundColor: '$FF6666'
+        ConditionBody: 'object.IsUpdate()'
+        ConversionBody: ''
+        DefaultBackgroundColor: false
+        InheritConversion: false
+      }
+    ]
   }
   AttributeRepresentation CCRentOutOfCost
   {
     AttributeKey: '[415136.0.1160164750]'
     Synonym: '闀挎槬澶栫搴撳嚭搴撹垂鐢�'
+    Conditional:
+    [
+      DataRepresentation.Conditional
+      {
+        BackgroundColor: '$FF6666'
+        ConditionBody: 'object.IsUpdate()'
+        ConversionBody: ''
+        DefaultBackgroundColor: false
+        InheritConversion: false
+      }
+    ]
   }
   AttributeRepresentation CCRentStorCost
   {
     AttributeKey: '[415136.0.1160164771]'
     Synonym: '闀挎槬澶栫搴撲粨鍌ㄨ垂鐢�'
+    Conditional:
+    [
+      DataRepresentation.Conditional
+      {
+        BackgroundColor: '$FF6666'
+        ConditionBody: 'object.IsUpdate()'
+        ConversionBody: ''
+        DefaultBackgroundColor: false
+        InheritConversion: false
+      }
+    ]
   }
   AttributeRepresentation CCShorTransCost
   {
     AttributeKey: '[415136.0.1160164779]'
     Synonym: '闀挎槬鐭�旇繍杈撹垂鐢�'
+    Conditional:
+    [
+      DataRepresentation.Conditional
+      {
+        BackgroundColor: '$FF6666'
+        ConditionBody: 'object.IsUpdate()'
+        ConversionBody: ''
+        DefaultBackgroundColor: false
+        InheritConversion: false
+      }
+    ]
   }
   AttributeRepresentation CoefficientValue
   {
     AttributeKey: '[415136.0.1188511355]'
     Synonym: '绯绘暟'
+    Conditional:
+    [
+      DataRepresentation.Conditional
+      {
+        BackgroundColor: '$FF6666'
+        ConditionBody: 'object.IsUpdate()'
+        ConversionBody: ''
+        DefaultBackgroundColor: false
+        InheritConversion: false
+      }
+    ]
   }
   AttributeRepresentation DLRentInCost
   {
     AttributeKey: '[415136.0.1160164787]'
     Synonym: '澶ц繛澶栫搴撳叆搴撹垂鐢�'
+    Conditional:
+    [
+      DataRepresentation.Conditional
+      {
+        BackgroundColor: '$FF6666'
+        ConditionBody: 'object.IsUpdate()'
+        ConversionBody: ''
+        DefaultBackgroundColor: false
+        InheritConversion: false
+      }
+    ]
   }
   AttributeRepresentation DLRentOtherCost
   {
     AttributeKey: '[415136.0.1184074681]'
     Synonym: '澶ц繛澶栫搴撳叾浠栬垂鐢�'
+    Conditional:
+    [
+      DataRepresentation.Conditional
+      {
+        BackgroundColor: '$FF6666'
+        ConditionBody: 'object.IsUpdate()'
+        ConversionBody: ''
+        DefaultBackgroundColor: false
+        InheritConversion: false
+      }
+    ]
   }
   AttributeRepresentation DLRentOutOfCost
   {
     AttributeKey: '[415136.0.1160164795]'
     Synonym: '澶ц繛澶栫搴撳嚭搴撹垂鐢�'
+    Conditional:
+    [
+      DataRepresentation.Conditional
+      {
+        BackgroundColor: '$FF6666'
+        ConditionBody: 'object.IsUpdate()'
+        ConversionBody: ''
+        DefaultBackgroundColor: false
+        InheritConversion: false
+      }
+    ]
   }
   AttributeRepresentation DLRentStorCost
   {
     AttributeKey: '[415136.0.1160164806]'
     Synonym: '澶ц繛澶栫搴撲粨鍌ㄨ垂鐢�'
+    Conditional:
+    [
+      DataRepresentation.Conditional
+      {
+        BackgroundColor: '$FF6666'
+        ConditionBody: 'object.IsUpdate()'
+        ConversionBody: ''
+        DefaultBackgroundColor: false
+        InheritConversion: false
+      }
+    ]
   }
   AttributeRepresentation EstimateTotalCost
   {
     AttributeKey: '[415136.0.1160164814]'
     Synonym: '棰勮鎬昏垂鐢�'
+    Conditional:
+    [
+      DataRepresentation.Conditional
+      {
+        BackgroundColor: '$FF6666'
+        ConditionBody: 'object.IsUpdate()'
+        ConversionBody: ''
+        DefaultBackgroundColor: false
+        InheritConversion: false
+      }
+    ]
   }
   AttributeRepresentation WerkToDLRentTransCost
   {
     AttributeKey: '[415136.0.1160164822]'
     Synonym: '鍘傚唴鍒板绉熷簱杩愯緭璐圭敤'
+    Conditional:
+    [
+      DataRepresentation.Conditional
+      {
+        BackgroundColor: '$FF6666'
+        ConditionBody: 'object.IsUpdate()'
+        ConversionBody: ''
+        DefaultBackgroundColor: false
+        InheritConversion: false
+      }
+    ]
   }
   RelationRepresentation Column { RelationKey: '[415136.0.992900194]' Visibility: 'Normal' }
 }
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormFinancialProductionReport/Response_PanelExport_369_bRefresh_OnClick.def b/_Main/UI/MacroPlannerWebApp/Component_FormFinancialProductionReport/Response_PanelExport_369_bRefresh_OnClick.def
index e61a571..ed101ef 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_FormFinancialProductionReport/Response_PanelExport_369_bRefresh_OnClick.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormFinancialProductionReport/Response_PanelExport_369_bRefresh_OnClick.def
@@ -15,7 +15,7 @@
     [*
       FinancialProductionSource::Initialize( MacroPlan );
       
-      table := selectobject( MacroPlan, FinancialProductionSource.FinancialProductionReport, table, not table.IsImport() and table.IsShow() );
+      table := FinancialProductionSource::InitiateSearch( MacroPlan );
       
       DataHolderTable.Data( table );
       
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormFinancialProductionReport/Response_PanelOperation_ButtonProductionImport660_OnClick.def b/_Main/UI/MacroPlannerWebApp/Component_FormFinancialProductionReport/Response_PanelOperation_ButtonProductionImport660_OnClick.def
index 4c7abdd..3fed469 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_FormFinancialProductionReport/Response_PanelOperation_ButtonProductionImport660_OnClick.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormFinancialProductionReport/Response_PanelOperation_ButtonProductionImport660_OnClick.def
@@ -29,8 +29,9 @@
           
           if( not source.IsExistFutureMonthData() or 
               ( source.IsExistFutureMonthData() and WebMessageBox::Question( this, Translations::MP_FinancialProductionReport_Question(), 'Yes|No' ) = 0 ) ){
+             FinancialSalesSource::InitializeNew( MacroPlan );
              source.AfterImport();
-             FinancialProductionSource::InitiateSearch( MacroPlan );
+             DataHolderTable.Data( FinancialProductionSource::InitiateSearch( MacroPlan ) );
           }
           
           WebMessageBox::Success( Translations::A_VWED_Success() );
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormFinancialSalesReport/Component_PanelFinancialSalesReport.def b/_Main/UI/MacroPlannerWebApp/Component_FormFinancialSalesReport/Component_PanelFinancialSalesReport.def
index 5163288..39a3275 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_FormFinancialSalesReport/Component_PanelFinancialSalesReport.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormFinancialSalesReport/Component_PanelFinancialSalesReport.def
@@ -10,6 +10,7 @@
   ]
   Properties:
   [
+    Orientation: 'horizontal'
     Taborder: 2
   ]
 }
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormFinancialSalesReport/Response_PanelExport_bRefresh_OnClick.def b/_Main/UI/MacroPlannerWebApp/Component_FormFinancialSalesReport/Response_PanelExport_bRefresh_OnClick.def
index 330cc27..0308160 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_FormFinancialSalesReport/Response_PanelExport_bRefresh_OnClick.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormFinancialSalesReport/Response_PanelExport_bRefresh_OnClick.def
@@ -15,7 +15,7 @@
     [*
       FinancialSalesSource::InitializeNew( MacroPlan );
       
-      table := selectobject( MacroPlan, FinancialSalesSource.FinancialSalesReport, table, not table.IsImport() and table.IsShow() );
+      table := FinancialSalesSource::InitiateSearch( MacroPlan );//selectobject( MacroPlan, FinancialSalesSource.FinancialSalesReport, table, not table.IsImport() and table.IsShow() );
       
       DataHolderTable.Data( table );
       
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormFinancialSalesReport/Response_PanelOperation_ButtonSalesImport_OnClick.def b/_Main/UI/MacroPlannerWebApp/Component_FormFinancialSalesReport/Response_PanelOperation_ButtonSalesImport_OnClick.def
index c8b312a..edc3ece 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_FormFinancialSalesReport/Response_PanelOperation_ButtonSalesImport_OnClick.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormFinancialSalesReport/Response_PanelOperation_ButtonSalesImport_OnClick.def
@@ -29,8 +29,9 @@
           //濡傛灉瀛樺湪璁″垝寮�濮嬪悗鐨勬棩鏈熸暟鎹渶瑕佺偣鍑荤‘璁�
           if( not source.IsExistFutureMonthData() or 
               ( source.IsExistFutureMonthData() and WebMessageBox::Question( this, Translations::MP_FinancialProductionReport_Question(), 'Yes|No' ) = 0 ) ){
+             FinancialSalesSource::InitializeNew( MacroPlan );
              source.AfterImport();
-             FinancialSalesSource::InitiateSearch( MacroPlan );
+             DataHolderTable.Data( FinancialSalesSource::InitiateSearch( MacroPlan ) );
           }
           
           WebMessageBox::Success( Translations::A_VWED_Success() );

--
Gitblit v1.9.3