lazhen
2024-06-26 a5b7c787696906ae51ed5e3f909c4581055944fe
财务产量报表合计显示完成
已修改16个文件
已添加5个文件
198 ■■■■ 文件已修改
_Main/BL/InfoMessages.qbl 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_FinancialProductionReport/Attribute_IsShow.qbl 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_FinancialProductionReport/Method_Clear.qbl 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_FinancialProductionReport/Method_Generate.qbl 44 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_FinancialProductionReport/Method_GenerateColumn.qbl 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_FinancialProductionSource/Method_AfterImport.qbl 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_FinancialProductionSource/Method_IsExistFutureMonthData.qbl 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_FinancialProductionSource/Method_ReadStructure.qbl 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_FinancialProductionSource/StaticMethod_Download.qbl 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_FinancialProductionSource/StaticMethod_DownloadTemplate.qbl 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_FinancialProductionSource/StaticMethod_Initialize.qbl 19 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/UI/MacroPlannerWebApp/Component_FormFinancialProductionReport/Component_MatrixEditorTable.def 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/UI/MacroPlannerWebApp/Component_FormFinancialProductionReport/Response_OnCreated.def 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/UI/MacroPlannerWebApp/Component_FormFinancialProductionReport/Response_PanelExport_ButtonExport_OnClick.def 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/UI/MacroPlannerWebApp/Component_FormFinancialProductionReport/Response_PanelFinancialProductionReportOperation_ButtonProductionExport_OnCl.def 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/UI/MacroPlannerWebApp/Component_FormFinancialProductionReport/Response_PanelFinancialProductionReportOperation_ButtonProductionImport_OnCl.def 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/UI/MacroPlannerWebApp/Component_FormFinancialProductionReport/Response_PanelGeneration_ddslGeneration_OnSelectionChanged.def 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/UI/MacroPlannerWebApp/Component_FormFinancialProductionReport/Response_PanelMQBMLB_ddslMQBMLB_OnSelectionChanged.def 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/UI/MacroPlannerWebApp/Component_FormFinancialProductionReport/Response_PanelPower_ddslPower_OnSelectionChanged.def 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/UI/MacroPlannerWebApp/Component_FormFinancialProductionReport/Response_PanelUnit_ddslUnit_OnCreated.def 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/UI/MacroPlannerWebApp/Component_FormFinancialProductionReport/Response_PanelUnit_ddslUnit_OnSelectionChanged.def 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/InfoMessages.qbl
@@ -98,6 +98,10 @@
  {
    DefaultText: 'The two products selected are the same.'
  }
  InfoMessage MP_FinancialProductionReport_Question
  {
    DefaultText: '导入模板包含未来月份的财务数据,是否覆盖系统计算结果?'
  }
  InfoMessage MP_LibCal_EventType_Exist
  {
    DefaultText: 'The ID or name is the same.'
_Main/BL/Type_FinancialProductionReport/Attribute_IsShow.qbl
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,7 @@
Quintiq file version 2.0
#parent: #root
Attribute IsShow
{
  #keys: '3[415136.0.853939545][415136.0.853939544][415136.0.853939546]'
  ValueType: Boolean
}
_Main/BL/Type_FinancialProductionReport/Method_Clear.qbl
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,13 @@
Quintiq file version 2.0
#parent: #root
Method Clear
{
  TextBody:
  [*
    // ç”„兰鸽 Jun-25-2024 (created)
    this.FinancialProductionColumn( relflush );
    this.FinancialProductionRow( relflush );
    this.GenerateColumn( this.FinancialProductionSource().MacroPlan() );
  *]
}
_Main/BL/Type_FinancialProductionReport/Method_Generate.qbl
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,44 @@
Quintiq file version 2.0
#parent: #root
Method Generate (
  FinancialProductionSearch search,
  Product_MPs products
)
{
  TextBody:
  [*
    // ç”„兰鸽 Jun-25-2024 (created)
    table      := selectobject( this, FinancialProductionSource.FinancialProductionReport, report, not report.IsShow() );
    allunit    := '<All>';
    //清空之前存储的显示数据
    this.Clear();
    //过滤后的产品id
    productids := selectuniquevalues( products, Elements, product, ( search.Generation() = allunit or product.Generation() = search.Generation() )
                                      and ( search.MqbMlb() = allunit or product.MQBMLB() = search.MqbMlb() )
                                      and ( search.Power() = allunit or product.Power() = search.Power() ), product.ID() );
    sumrow     := this.FinancialProductionRow( relnew, Name := 'SUM', Unit := search.Unit(), RowNr := table.FinancialProductionRow( relsize ) );
    traverse( table, FinancialProductionRow, row, row.Unit() = search.Unit() ){
      productid  := construct( Strings );
      productid.Add( row.Name() );
      if( productids.ContainsAll( productid ) ){
        showrow := this.FinancialProductionRow( relnew, Name := row.Name(), Unit := row.Unit(), RowNr := row.RowNr() );
        traverse( row, FinancialProductionCell, cell ){
          column   := selectobject( this, FinancialProductionColumn, column, column.Name() = cell.FinancialProductionColumn().Name() );
          sumcell  := selectobject( column, FinancialProductionCell, c, c.FinancialProductionRow() = sumrow );
          if( isnull( sumcell ) ){
            sumcell := column.FinancialProductionCell( relnew, Value := '0' );
            sumrow.FinancialProductionCell( relinsert, sumcell );
          }
          showcell := column.FinancialProductionCell( relnew, Value := cell.Value() );
          showrow.FinancialProductionCell( relinsert, showcell );
          value := [Real]cell.Value() + [Real]sumcell.Value();
          sumcell.Value( [String]value );
        }
      }
    }
  *]
}
_Main/BL/Type_FinancialProductionReport/Method_GenerateColumn.qbl
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,20 @@
Quintiq file version 2.0
#parent: #root
Method GenerateColumn (
  MacroPlan owner
)
{
  TextBody:
  [*
    // ç”„兰鸽 Jun-25-2024 (created)
    startofplanning           := owner.StartOfPlanning();
    startofyear               := startofplanning.StartOfYear();
    startofnextyear           := startofplanning.StartOfNextYear();
    for( start := startofyear; start < startofnextyear; start := start.StartOfNextMonth() ){
      periodtime := start.Date();
      periodname := periodtime.Format( "M2/D2/Y" );
      this.FinancialProductionColumn( relnew, Name := periodname, Period := periodtime );
    }
  *]
}
_Main/BL/Type_FinancialProductionSource/Method_AfterImport.qbl
@@ -6,24 +6,27 @@
  [*
    // ç”„兰鸽 Jun-24-2024 (created)
    allunit := FinancialProductionReport::GetDefaultAllUnit();
    table   := selectobject( this.MacroPlan(), FinancialProductionSource.FinancialProductionReport, table, not table.IsImport() );
    table   := selectobject( this.MacroPlan(), FinancialProductionSource.FinancialProductionReport, table, not table.IsImport() and not table.IsShow() );
    //info( '--------------------------', table.Name() );
    traverse( this, FinancialProductionReport, report ){
      productcolumn := selectobject( report, FinancialProductionColumn, column, column.Name() = 'Product' );
      unitcolumn    := selectobject( report, FinancialProductionColumn, column, column.Name() = 'Unit' );
    //  info( '----------------------1-----------------', productcolumn.Name(), unitcolumn.Name() );
      
      traverse( report, FinancialProductionRow, row ){
        product := selectobject( row, FinancialProductionCell, cell, cell.FinancialProductionColumn() = productcolumn );
        unit    := selectobject( row, FinancialProductionCell, cell, cell.FinancialProductionColumn() = unitcolumn );
    //    info( '----------------------2-----------------', product.Value(), unit.Value() );
        
        unitrow := selectobject( table, FinancialProductionRow, unitrow, unitrow.Name() = product.Value() and unitrow.Unit() = unit.Value() );
        allrow  := selectobject( table, FinancialProductionRow, allrow, allrow.Name() = product.Value() and allrow.Unit() = allunit );
        traverse( row, FinancialProductionCell, cell, cell.FinancialProductionColumn() <> productcolumn and cell.FinancialProductionColumn() <> unitcolumn and product.Value() = '120 kW Rotor' and unit.Value() = 'Assembly Plant (Spain)' ){
    //    info( '----------------------3-----------------', unitrow.Name(), unitrow.Unit() );
        // and product.Value() = '120 kW Rotor' and unit.Value() = 'Assembly Plant (Spain)'
        traverse( row, FinancialProductionCell, cell, cell.FinancialProductionColumn() <> productcolumn and cell.FinancialProductionColumn() <> unitcolumn ){
          column   := cell.FinancialProductionColumn();
          unitcell := selectobject( unitrow, FinancialProductionCell, unitcell, unitcell.FinancialProductionColumn().Name() = column.Name() );
          allcell  := selectobject( allrow, FinancialProductionCell, allcell, allcell.FinancialProductionColumn().Name() = column.Name() );
          info( isnull( unitcell ), isnull( allcell ), cell.Value(), unitcell.Value(), allcell.Value() );
    //      info( isnull( unitcell ), isnull( allcell ), cell.Value(), unitcell.Value(), allcell.Value() );
          if( not isnull( unitcell ) ){
            unitcell.Value( cell.Value() );
          }
_Main/BL/Type_FinancialProductionSource/Method_IsExistFutureMonthData.qbl
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,12 @@
Quintiq file version 2.0
#parent: #root
Method IsExistFutureMonthData () as Boolean
{
  TextBody:
  [*
    // ç”„兰鸽 Jun-26-2024 (created)
    startofplanning := this.MacroPlan().StartOfPlanning().Date().Format( 'M2/D2/Y' );
    columns         := selectset( this, FinancialProductionReport.FinancialProductionColumn, column, column.Name() > startofplanning );
    return exists( columns, Elements.FinancialProductionCell, cell, cell.Value() <> '' );
  *]
}
_Main/BL/Type_FinancialProductionSource/Method_ReadStructure.qbl
@@ -26,6 +26,6 @@
      Transaction::Transaction().Propagate( attribute( FinancialProductionColumn, Index ) );
    }
    //导入后处理数据
    this.AfterImport();
    //this.AfterImport();
  *]
}
_Main/BL/Type_FinancialProductionSource/StaticMethod_Download.qbl
@@ -1,16 +1,14 @@
Quintiq file version 2.0
#parent: #root
StaticMethod Download (
  MacroPlan macroPlan,
  Boolean istemplate
  MacroPlan macroPlan
) as BinaryValue
{
  Description: '下载财务报表数据'
  TextBody:
  [*
    startofplanning := macroPlan.StartOfPlanning().Date();
    allunit         := FinancialProductionReport::GetDefaultAllUnit();
    table := selectobject( macroPlan, FinancialProductionSource.FinancialProductionReport, table, not table.IsImport() );
    table := selectobject( macroPlan, FinancialProductionSource.FinancialProductionReport, table, not table.IsImport() and table.IsShow() );
    
    xmlDOMI := XMLDOMImplementation::Create();
    xmlDOM  := xmlDOMI.CreateDocumentFromString( '<?xml version="1.0" encoding="UTF-16"?><table><name>' + table.Name() + '</name></table>' );
@@ -35,7 +33,7 @@
    
    tableElement.AppendChild( productcolumnelement ); 
    tableElement.AppendChild( unitcolumnelement ); 
    traverse ( table, FinancialProductionColumn, column, not istemplate or column.Period() < startofplanning ) {
    traverse ( table, FinancialProductionColumn, column ) {
      columnelement := xmlDOM.CreateElement( "column" );
      nameelement   := xmlDOM.CreateElement( "name" );
      typeelement   := xmlDOM.CreateElement( "type" );
@@ -44,7 +42,7 @@
      columnelement.AppendChild( nameelement );
      columnelement.AppendChild( typeelement );
      
      cells := selectsortedset( column, FinancialProductionCell, cell, cell.FinancialProductionRow().Unit() <> allunit, cell.FinancialProductionRow().Name() );
      cells := selectsortedset( column, FinancialProductionCell, cell, cell.FinancialProductionRow().RowNr() );
    
      traverse ( cells, Elements, c ) {
        if( column.Index() = 0 ){
@@ -59,11 +57,7 @@
          unitcolumnelement.AppendChild( unitcellElement );
        }
        cellElement := xmlDOM.CreateElement( "cell" );
        if( istemplate ){
          cellElement.SetAttribute( "value", '' );
        }else{
          cellElement.SetAttribute( "value", c.Value() );
        }
        cellElement.SetAttribute( "value", c.Value() );
        columnelement.AppendChild( cellElement );
      }
      tableElement.AppendChild( columnelement );  
_Main/BL/Type_FinancialProductionSource/StaticMethod_DownloadTemplate.qbl
@@ -12,9 +12,9 @@
    tableElement              := xmlDOM.GetElementByTagName( "table", 0 );
    
    startofyear               := macroPlan.StartOfPlanning().StartOfYear();
    startofplanning           := macroPlan.StartOfPlanning();
    startofnextyear           := macroPlan.StartOfPlanning().StartOfNextYear();
    
    for( start := startofyear; start < startofplanning; start := start.StartOfNextMonth() ){
    for( start := startofyear; start < startofnextyear; start := start.StartOfNextMonth() ){
      columnElement := xmlDOM.CreateElement( "column" );
      nameElement   := xmlDOM.CreateElement( "name" );
      typeElement   := xmlDOM.CreateElement( "type" );
_Main/BL/Type_FinancialProductionSource/StaticMethod_Initialize.qbl
@@ -13,12 +13,17 @@
    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 );
    startofplanning           := owner.StartOfPlanning();
    startofnextmonth          := owner.StartOfPlanning().StartOfNextMonth();
    startofyear               := startofplanning.StartOfYear();
    startofnextyear           := startofplanning.StartOfNextYear();
    
    source.FinancialProductionSearch( relnew, Unit := allunit, Generation := allunit, MqbMlb := allunit, Power := allunit );
    search                    := source.FinancialProductionSearch( relnew, Unit := allunit, Generation := allunit, MqbMlb := allunit, Power := allunit );
    products                  := construct( Product_MPs );
    table.GenerateColumn( owner );
    
    traverse( owner, Product_MP.ProductInStockingPoint_MP, pisp, pisp.Product_MP().IsLeaf() and ( pisp.StockingPoint_MP().UnitID() = ccunit or pisp.StockingPoint_MP().UnitID() = dlunit ) ){
      unit := pisp.StockingPoint_MP().UnitID();
@@ -32,6 +37,7 @@
        dlrow := table.FinancialProductionRow( relnew, Name := pisp.ProductID(), Unit := unit );
      }
      if( isnull( allrow ) ){
        products.Add( pisp.Product_MP() );
        allrow := table.FinancialProductionRow( relnew, Name := pisp.ProductID(), Unit := allunit );
      }
      
@@ -39,10 +45,6 @@
        periodtime := start.Date();
        periodname := periodtime.Format( "M2/D2/Y" );
        column := selectobject( table, FinancialProductionColumn, column, column.Name() = periodname and column.Period() = periodtime );
        if( isnull( column ) ){
          column := table.FinancialProductionColumn( relnew, Name := periodname, Period := periodtime );
        }
        
        if( not isnull( ccrow ) ){
          ccrow.Initialize( column, ccunit );
@@ -72,5 +74,12 @@
        allrow.Initialize( column, pispip.NewSupplyProductionQuantity() );
      }
    }
    rows := selectsortedset( table, FinancialProductionRow, row, row.Name() );
    i    := 0;
    traverse( rows, Elements, e ){
      e.RowNr( i );
      i := i + 1;
    }
    showtable.Generate( search, products );
  *]
}
_Main/UI/MacroPlannerWebApp/Component_FormFinancialProductionReport/Component_MatrixEditorTable.def
@@ -45,8 +45,6 @@
          Properties:
          [
            DataType: 'FinancialProductionReport'
            FilterArguments: 'products:QLibMacroPlannerWebUI::ApplicationMacroPlanner.DataHolderProduct;search:QMacroPlanner::FormFinancialProductionReport.dhSearch'
            FixedFilter: 'object.Filter( search, products )'
            Source: 'DataHolderTable'
            Taborder: 0
            Transformation: 'FinancialProductionRow'
@@ -56,7 +54,7 @@
      Properties:
      [
        Legend: 'Name'
        SortCriteria: 'Name'
        SortCriteria: 'RowNr'
        Taborder: 1
      ]
    }
_Main/UI/MacroPlannerWebApp/Component_FormFinancialProductionReport/Response_OnCreated.def
@@ -10,12 +10,12 @@
    Body:
    [*
      //初始化
      //if( not exists( MacroPlan, FinancialProductionSource, source, not source.IsImport() ) ){
      if( not exists( MacroPlan, FinancialProductionSource, source, not source.IsImport() ) ){
        FinancialProductionSource::Initialize( MacroPlan );
      //}
      }
      //info( '------------------1----------------' );
      table := selectobject( MacroPlan, FinancialProductionSource.FinancialProductionReport, table, not table.IsImport() );
      //info( '------------------2----------------' );
      table := selectobject( MacroPlan, FinancialProductionSource.FinancialProductionReport, table, not table.IsImport() and table.IsShow() );
      info( '------------------2----------------', table.IsImport(), table.IsShow() );
      DataHolderTable.Data( table );
      
      dhSearch.Data( table.FinancialProductionSource().FinancialProductionSearch() );
_Main/UI/MacroPlannerWebApp/Component_FormFinancialProductionReport/Response_PanelExport_ButtonExport_OnClick.def
@@ -13,7 +13,7 @@
  {
    Body:
    [*
      binaryValue := FinancialProductionSource::Download( MacroPlan, false );
      binaryValue := FinancialProductionSource::Download( MacroPlan );
      
      Application.Download( "Financial productions.xlsx", binaryValue.AsBinaryData() );
    *]
_Main/UI/MacroPlannerWebApp/Component_FormFinancialProductionReport/Response_PanelFinancialProductionReportOperation_ButtonProductionExport_OnCl.def
@@ -13,7 +13,7 @@
  {
    Body:
    [*
      binaryValue := FinancialProductionSource::Download( MacroPlan, true );
      binaryValue := FinancialProductionSource::DownloadTemplate( MacroPlan );
      
      Application.Download( "Financial productions.xlsx", binaryValue.AsBinaryData() );
    *]
_Main/UI/MacroPlannerWebApp/Component_FormFinancialProductionReport/Response_PanelFinancialProductionReportOperation_ButtonProductionImport_OnCl.def
@@ -27,6 +27,12 @@
          source := FinancialProductionSource::Upload( MacroPlan, webFileBinaryData, fileName );
          source.ReadStructure();
          
          if( not source.IsExistFutureMonthData() or
              ( source.IsExistFutureMonthData() and WebMessageBox::Question( this, Translations::MP_FinancialProductionReport_Question(), 'Yes|No' ) = 0 ) ){
             source.AfterImport();
             DataHolderTable.Data().Generate( dhSearch.Data(), DataHolderProduct.Data() );
          }
          WebMessageBox::Success( Translations::A_VWED_Success() );
          traverse( MacroPlan, FinancialProductionSource, psource, psource.IsImport() and psource <> source ){
            psource.Delete();
_Main/UI/MacroPlannerWebApp/Component_FormFinancialProductionReport/Response_PanelGeneration_ddslGeneration_OnSelectionChanged.def
@@ -9,7 +9,10 @@
  {
    Body:
    [*
      dhSearch.Data().Generation( selection );
      if( dhSearch.Data().Generation() <> selection ){
        dhSearch.Data().Generation( selection );
        DataHolderTable.Data().Generate( dhSearch.Data(), DataHolderProduct.Data() );
      }
    *]
    GroupServerCalls: false
  }
_Main/UI/MacroPlannerWebApp/Component_FormFinancialProductionReport/Response_PanelMQBMLB_ddslMQBMLB_OnSelectionChanged.def
@@ -9,7 +9,10 @@
  {
    Body:
    [*
      dhSearch.Data().MqbMlb( selection );
      if( dhSearch.Data().MqbMlb() <> selection ){
        dhSearch.Data().MqbMlb( selection );
        DataHolderTable.Data().Generate( dhSearch.Data(), DataHolderProduct.Data() );
      }
    *]
    GroupServerCalls: false
  }
_Main/UI/MacroPlannerWebApp/Component_FormFinancialProductionReport/Response_PanelPower_ddslPower_OnSelectionChanged.def
@@ -9,7 +9,10 @@
  {
    Body:
    [*
      dhSearch.Data().Power( selection );
      if( dhSearch.Data().Power() <> selection ){
        dhSearch.Data().Power( selection );
        DataHolderTable.Data().Generate( dhSearch.Data(), DataHolderProduct.Data() );
      }
    *]
    GroupServerCalls: false
  }
_Main/UI/MacroPlannerWebApp/Component_FormFinancialProductionReport/Response_PanelUnit_ddslUnit_OnCreated.def
@@ -10,7 +10,7 @@
    Body:
    [*
      
      valueString := "<All>;Spider Assy Line 1;Body in White Line 3";
      valueString := "<All>;" + FinancialProductionReport::GetDefaultCCUnit() + ";" + FinancialProductionReport::GetDefaultDLUnit();
      
      this.Strings( valueString );
    *]
_Main/UI/MacroPlannerWebApp/Component_FormFinancialProductionReport/Response_PanelUnit_ddslUnit_OnSelectionChanged.def
@@ -9,7 +9,10 @@
  {
    Body:
    [*
      dhSearch.Data().Unit( selection );
      if( dhSearch.Data().Unit() <> selection ){
        dhSearch.Data().Unit( selection );
        DataHolderTable.Data().Generate( dhSearch.Data(), DataHolderProduct.Data() );
      }
    *]
    GroupServerCalls: false
  }