Administrator
2023-09-21 e8be76a40ae0b3cb1d37a6e91e25c1284a50347f
_Main/BL/Type_ScenarioManager/Method_CapacityAndSaleBudgeCompare.qbl
@@ -52,7 +52,7 @@
        // 记录每行包含哪些product
        CapacityAndSaleBudgeCompareItemRowProduct::CreateIfNotExist( row, productCode );
      } else {
    //    info( "111111" );
        info( "no boms for product : " + productCode );
      }
    }
    info( "CapacityAndSaleBudgeCompareItemRow : " + [String]selectset( this, CapacityAndSaleBudgeCompareItemRow, item, true ).Size() );
@@ -71,32 +71,29 @@
    // 格式: 面板分配量 - 年 - 月(1-12 & total) - 年度预算/scenarioName
    info( "dealing 面板分配量" )
    if( CapacityAndSaleBudgeFilterItem::Contains( items, "面板分配量" ) ) {
      // 历史数据
      traverse( months, Elements, month ) {
        columnMonth := CapacityAndSaleBudgeCompareItemColumn::CreateIfNotExist( this, "面板分配量-" + [String]month.MonthNo() + "月-年度预算" );
      traverse( years, Elements, year ) {
        // 历史数据
        traverse( months, Elements, month ) {
          columnMonth := CapacityAndSaleBudgeCompareItemColumn::CreateIfNotExist( this, "面板分配量-" + [String]year.YearNo() + "年-" + [String]month.MonthNo() + "月-年度预算" );
          traverse( this, CapacityAndSaleBudgeCompareItemRow, row ) {
            cellReal := MappingCapacityAndSaleBudge::GetSheetByMonth( row.GetProductCodes(), mpSync, DateTime::Now().Year(), month.MonthNo() );
            cell := columnMonth.CapacityAndSaleBudgeCompareItemCell( relnew, CellContent := [String]cellReal );
            cell.CapacityAndSaleBudgeCompareItemRow( relset, row );
          }
        }
        columnYear := CapacityAndSaleBudgeCompareItemColumn::CreateIfNotExist( this, "面板分配量-" + [String]year.YearNo() + "年-total-年度预算" );
        traverse( this, CapacityAndSaleBudgeCompareItemRow, row ) {
          cellReal := MappingCapacityAndSaleBudge::GetSheetByMonth( row.GetProductCodes(), mpSync, DateTime::Now().Year(), month.MonthNo() );
    //      cellReal := Real::Random( 1.0, 999.0 );
          cell := columnMonth.CapacityAndSaleBudgeCompareItemCell( relnew, CellContent := [String]cellReal );
          cellReal := MappingCapacityAndSaleBudge::GetSheetByYear( row.GetProductCodes(), mpSync, year.YearNo() );
          cell := columnYear.CapacityAndSaleBudgeCompareItemCell( relnew, CellContent := [String]cellReal );
          cell.CapacityAndSaleBudgeCompareItemRow( relset, row );
        }
      }
      columnYear := CapacityAndSaleBudgeCompareItemColumn::CreateIfNotExist( this, "面板分配量-total-年度预算" );
      traverse( this, CapacityAndSaleBudgeCompareItemRow, row ) {
        cellReal := MappingCapacityAndSaleBudge::GetSheetByYear( row.GetProductCodes(), mpSync, DateTime::Now().Year() );
    //    cellReal := Real::Random( 1.0, 999.0 );
        cell := columnYear.CapacityAndSaleBudgeCompareItemCell( relnew, CellContent := [String]cellReal );
        cell.CapacityAndSaleBudgeCompareItemRow( relset, row );
      }
      // S&OP数据
      traverse( years, Elements, year ) {
        // S&OP数据
        traverse( macroPlans, Elements, macroPlan ) {
          traverse( months, Elements, month ) {
            columnMonth := CapacityAndSaleBudgeCompareItemColumn::CreateIfNotExist( this, 
                                                                                    "面板分配量-" + [String]year.YearNo() + "年-" + [String]month.MonthNo() + "月-" + macroPlan.ScenarioName() );
            traverse( this, CapacityAndSaleBudgeCompareItemRow, row ) {
              cellReal := Product_MP::GetNewSupplyByMonth( row.GetProductCodes(), macroPlan, year.YearNo(), month.MonthNo() );
    //          cellReal := Real::Random( 1.0, 999.0 );
              cell := columnMonth.CapacityAndSaleBudgeCompareItemCell( relnew, CellContent := [String]cellReal );
              cell.CapacityAndSaleBudgeCompareItemRow( relset, row );
            }
@@ -105,7 +102,6 @@
                                                                                 "面板分配量-" + [String]year.YearNo() + "年-total-" + macroPlan.ScenarioName() );
          traverse( this, CapacityAndSaleBudgeCompareItemRow, row ) {
            cellReal := Product_MP::GetNewSupplyByYear( row.GetProductCodes(), macroPlan, year.YearNo() );
    //        cellReal := Real::Random( 1.0, 999.0 );
            cell := columnYear.CapacityAndSaleBudgeCompareItemCell( relnew, CellContent := [String]cellReal );
            cell.CapacityAndSaleBudgeCompareItemRow( relset, row );
          }
@@ -115,37 +111,36 @@
    // 年度销售额
    info( "dealing 销售额" )
    if( CapacityAndSaleBudgeFilterItem::Contains( items, "销售额" ) ) {
      // 历史数据
      traverse( months, Elements, month ) {
        columnMonth := CapacityAndSaleBudgeCompareItemColumn::CreateIfNotExist( this, "对外销售额-" + "-" + [String]month.MonthNo() + "月-年度预算" );
      traverse( years, Elements, year ) {
        // 历史数据
        traverse( months, Elements, month ) {
          columnMonth := CapacityAndSaleBudgeCompareItemColumn::CreateIfNotExist( this, "对外销售额-" + [String]year.YearNo() + "年-" + [String]month.MonthNo() + "月-年度预算" );
          traverse( this, CapacityAndSaleBudgeCompareItemRow, row ) {
            cellReal := MappingCapacityAndSaleBudge::GetSaleByMonth( row.GetProductCodes(), mpSync, year.YearNo(), month.MonthNo() );
            cell := columnMonth.CapacityAndSaleBudgeCompareItemCell( relnew, CellContent := [String]cellReal );
            cell.CapacityAndSaleBudgeCompareItemRow( relset, row );
          }
        }
        columnYear := CapacityAndSaleBudgeCompareItemColumn::CreateIfNotExist( this, "对外销售额-" + [String]year.YearNo() + "年-年度预算" );
        traverse( this, CapacityAndSaleBudgeCompareItemRow, row ) {
          cellReal := MappingCapacityAndSaleBudge::GetSaleByMonth( row.GetProductCodes(), mpSync, DateTime::Now().Year(), month.MonthNo() );
    //      cellReal := Real::Random( 1.0, 999.0 );
          cell := columnMonth.CapacityAndSaleBudgeCompareItemCell( relnew, CellContent := [String]cellReal );
          cellReal := MappingCapacityAndSaleBudge::GetSaleByYear( row.GetProductCodes(), mpSync, year.YearNo() );
          cell := columnYear.CapacityAndSaleBudgeCompareItemCell( relnew, CellContent := [String]cellReal );
          cell.CapacityAndSaleBudgeCompareItemRow( relset, row );
        }
      }
      columnYear := CapacityAndSaleBudgeCompareItemColumn::CreateIfNotExist( this, "对外销售额-total-年度预算" );
      traverse( this, CapacityAndSaleBudgeCompareItemRow, row ) {
        cellReal := MappingCapacityAndSaleBudge::GetSaleByYear( row.GetProductCodes(), mpSync, DateTime::Now().Year() );
    //    cellReal := Real::Random( 1.0, 999.0 );
        cell := columnYear.CapacityAndSaleBudgeCompareItemCell( relnew, CellContent := [String]cellReal );
        cell.CapacityAndSaleBudgeCompareItemRow( relset, row );
      }
      // S&OP数据
      traverse( years, Elements, year ) {
        // S&OP数据
        traverse( macroPlans, Elements, macroPlan ) {
          traverse( months, Elements, month ) {
            columnMonth := CapacityAndSaleBudgeCompareItemColumn::CreateIfNotExist( this, "对外销售额-" + [String]year.YearNo() + "年-" + [String]month.MonthNo() + "月-" + macroPlan.ScenarioName() );
            traverse( this, CapacityAndSaleBudgeCompareItemRow, row ) {
              cellReal := MappingForecast::GetBalanceByMonth( row.GetProductCodes(), mappingParent, year.YearNo(), month.MonthNo() );
              cellReal := MappingAnnualBudget::GetSaleByMonth( row.GetProductCodes(), mpSync, year.YearNo(), month.MonthNo() );
              cell := columnMonth.CapacityAndSaleBudgeCompareItemCell( relnew, CellContent := [String]cellReal );
              cell.CapacityAndSaleBudgeCompareItemRow( relset, row );
            }
          }
          columnYear := CapacityAndSaleBudgeCompareItemColumn::CreateIfNotExist( this, "对外销售额-" + [String]year.YearNo() + "年-total-" + macroPlan.ScenarioName() );
          traverse( this, CapacityAndSaleBudgeCompareItemRow, row ) {
            cellReal := MappingForecast::GetBalanceByYear( row.GetProductCodes(), mappingParent, year.YearNo() );
            // QID 23
            cellReal := MappingAnnualBudget::GetSaleByYear( row.GetProductCodes(), mpSync, year.YearNo() );
            cell := columnYear.CapacityAndSaleBudgeCompareItemCell( relnew, CellContent := [String]cellReal );
            cell.CapacityAndSaleBudgeCompareItemRow( relset, row );
          }
@@ -158,7 +153,8 @@
      // 历史数据
      columnYear := CapacityAndSaleBudgeCompareItemColumn::CreateIfNotExist( this, "大张盈利额-年度预算" );
      traverse( this, CapacityAndSaleBudgeCompareItemRow, row ) {
        // todo
        // todo
        // QID 23
        cell := columnYear.CapacityAndSaleBudgeCompareItemCell( relnew, CellContent := [String]Number::Random( 0, 0 ) );
        cell.CapacityAndSaleBudgeCompareItemRow( relset, row );
      }
@@ -178,6 +174,7 @@
      columnYear := CapacityAndSaleBudgeCompareItemColumn::CreateIfNotExist( this, "产品盈利额-年度预算" );
      traverse( this, CapacityAndSaleBudgeCompareItemRow, row ) {
        // todo
        // QID 23
        cell := columnYear.CapacityAndSaleBudgeCompareItemCell( relnew, CellContent := [String]Number::Random( 0, 0 ) );
        cell.CapacityAndSaleBudgeCompareItemRow( relset, row );
      }