lazhen
2024-10-15 5e6f78ca4e8a022353b8d336e908b396aa6d20c8
财务产量报表导入累计问题
已修改9个文件
131 ■■■■ 文件已修改
_Main/BL/Type_FinancialProductionReport/Method_ImportVerification.qbl 18 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_FinancialProductionSource/Method_AfterImport.qbl 42 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_FinancialSalesReport/Method_ImportVerification.qbl 22 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_FinancialSalesSource/Method_AfterImport.qbl 41 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/UI/MacroPlannerWebApp/Component_FormFinancialProductionReport/Component_PanelHeader.def 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/UI/MacroPlannerWebApp/Component_FormFinancialProductionReport/Response_PanelExport_369_ButtonExport696_OnClick.def 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/UI/MacroPlannerWebApp/Component_FormFinancialSalesReport/Component_PanelHeader.def 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/UI/MacroPlannerWebApp/Component_FormFinancialSalesReport/Response_PanelExport_ButtonExport570_OnClick.def 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/UI/MacroPlannerWebApp/Component_FormInventorySummaryReport/Response_PanelExport_ButtonSummaryExport_OnClick.def 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
_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();
      }
    }
_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 );
              }
            }
          }
        }
_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();
      }
    }
_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 );
              }
            }
          }
        }
_Main/UI/MacroPlannerWebApp/Component_FormFinancialProductionReport/Component_PanelHeader.def
@@ -10,6 +10,7 @@
  ]
  Properties:
  [
    FixedSize: true
    Orientation: 'horizontal'
    Taborder: 0
  ]
_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() );
    *]
_Main/UI/MacroPlannerWebApp/Component_FormFinancialSalesReport/Component_PanelHeader.def
@@ -10,6 +10,7 @@
  ]
  Properties:
  [
    FixedSize: true
    Orientation: 'horizontal'
    Taborder: 0
  ]
_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 );
_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() );
    *]