yunchai
2023-10-12 e8619d825e5f09daf129b4847bf2bf4e660d40c5
_Main/BL/Type_GlobalDTOTable/Method_CapacityAndSaleBudgeCompare.qbl
@@ -5,9 +5,7 @@
  CapacityAndSaleBudgeFilterItems items,
  CapacityAndSaleBudgeFilterYears years,
  CapacityAndSaleBudgeFilterMonths months,
  MPSync mpSync,
  GlobalOTDTable otdTable,
  MacroPlan mappingParent
  GlobalOTDTable otdTable
)
{
  Description: 'todo : mappingParent改为mpSync, random删了'
@@ -37,16 +35,16 @@
    this.CapacityAndSaleBudgeCompareItemRow( relflush );
    this.CapacityAndSaleBudgeCompareItemColumn( relflush );
    // ====汇总所有出现的产品====
    historyData := selectset( mpSync, MappingCapacityAndSaleBudge, item, true );
    historyData := selectset( this, Global_MappingAnnualBudgetData, item, true );
    debuginfo( "historyData : " + [String]historyData.Size() )
    traverse( historyData, Elements, one ) {
      productCode := one.ProductCode();
      MappingBOM::CreateTestData( mappingParent, "事业部" + [String](productCode.Length() mod 3), [String](productCode.Length() mod 4), productCode );
      boms := selectset( mappingParent, MappingBOM, bom, bom.ProductCode() = productCode );
      productCode := one.ProductID();
      Global_MappingOperationBOM::CreateTestData( otdTable, "事业部" + [String](productCode.Length() mod 3), "面板基地" + [String](productCode.Length() mod 4), productCode );
      boms := selectset( otdTable, Global_MappingOperationBOM, bom, bom.ProductCode() = productCode );
      if( boms.Size() > 0 ) {
        bom := boms.First();
        businessType := bom.BusinessType();
        placeOfProductionOfArray := one.PlaceOfProductionOfArray();
        placeOfProductionOfArray := bom.OrganCode();
        // 相同面板基地和事业部的放一行
        row := CapacityAndSaleBudgeCompareItemRow::CreateIfNotExist( this, businessType, placeOfProductionOfArray );
        // 记录每行包含哪些product
@@ -57,7 +55,7 @@
    }
    debuginfo( "CapacityAndSaleBudgeCompareItemRow : " + [String]selectset( this, CapacityAndSaleBudgeCompareItemRow, item, true ).Size() );
    // ====从左向右生成列头与内容====
    // 事业部,组织
    // 事业部,面板基地
    debuginfo( "dealing businessType and placeOfProductionOfArray" )
    columnBusinessType := CapacityAndSaleBudgeCompareItemColumn::CreateIfNotExist( this, "事业部" );
    columnPlaceOfProductionOfArray := CapacityAndSaleBudgeCompareItemColumn::CreateIfNotExist( this, "面板基地" );
@@ -69,7 +67,7 @@
    }
    // 面板分配量 - 年度预算 (sheets)
    // 格式: 面板分配量 - 年 - 月(1-12 & total) - 年度预算/scenarioName
    info( "dealing 面板分配量" )
    debuginfo( "dealing 面板分配量" )
    if( CapacityAndSaleBudgeFilterItem::Contains( items, "面板分配量" ) ) {
      traverse( years, Elements, year ) {
        debuginfo( "面板分配量" + [String]year.YearNo() + "年" );
@@ -78,14 +76,14 @@
        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() );
            cellReal := Global_MappingForecast::GetQuantityByMonth( row.GetProductCodes(), this, 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::GetSheetByYear( row.GetProductCodes(), mpSync, year.YearNo() );
          cellReal := Global_MappingForecast::GetQuantityByYear( row.GetProductCodes(), this, year.YearNo() );
          cell := columnYear.CapacityAndSaleBudgeCompareItemCell( relnew, CellContent := [String]cellReal );
          cell.CapacityAndSaleBudgeCompareItemRow( relset, row );
        }
@@ -121,14 +119,14 @@
        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() );
            cellReal := Global_MappingAnnualBudgetData::GetSaleByMonth( row.GetProductCodes(), this, 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::GetSaleByYear( row.GetProductCodes(), mpSync, year.YearNo() );
          cellReal := Global_MappingAnnualBudgetData::GetSaleByYear( row.GetProductCodes(), this, year.YearNo() );
          cell := columnYear.CapacityAndSaleBudgeCompareItemCell( relnew, CellContent := [String]cellReal );
          cell.CapacityAndSaleBudgeCompareItemRow( relset, row );
        }
@@ -138,7 +136,7 @@
          traverse( months, Elements, month ) {
            columnMonth := CapacityAndSaleBudgeCompareItemColumn::CreateIfNotExist( this, "对外销售额-" + [String]year.YearNo() + "年-" + [String]month.MonthNo() + "月-" + macroPlan.ScenarioName() );
            traverse( this, CapacityAndSaleBudgeCompareItemRow, row ) {
              cellReal := MappingAnnualBudget::GetSaleByMonth( row.GetProductCodes(), mpSync, year.YearNo(), month.MonthNo() );
              cellReal := Forecast::GetFulfilledBalanceByMonth( row.GetProductCodes(), macroPlan, year.YearNo(), month.MonthNo() );
              cell := columnMonth.CapacityAndSaleBudgeCompareItemCell( relnew, CellContent := [String]cellReal );
              cell.CapacityAndSaleBudgeCompareItemRow( relset, row );
            }
@@ -146,7 +144,7 @@
          columnYear := CapacityAndSaleBudgeCompareItemColumn::CreateIfNotExist( this, "对外销售额-" + [String]year.YearNo() + "年-total-" + macroPlan.ScenarioName() );
          traverse( this, CapacityAndSaleBudgeCompareItemRow, row ) {
            // QID 23
            cellReal := MappingAnnualBudget::GetSaleByYear( row.GetProductCodes(), mpSync, year.YearNo() );
            cellReal := Forecast::GetFulfilledBalanceByYear( row.GetProductCodes(), macroPlan, year.YearNo() );
            cell := columnYear.CapacityAndSaleBudgeCompareItemCell( relnew, CellContent := [String]cellReal );
            cell.CapacityAndSaleBudgeCompareItemRow( relset, row );
          }