yypsybs
2023-09-22 744ece58704eabc06b44d3df45216bcced80ed96
_Main/BL/Type_ScenarioManager/Method_CapacityAndSaleBudgeChart#95.qbl
@@ -2,7 +2,7 @@
#parent: #root
Method CapacityAndSaleBudgeChart (
  MacroPlans macroPlans,
  Boolean isCapacity,
  String saleOrCapacity,
  String groupBy,
  String byBusinessTypeOrByOrgCode,
  CapacityAndSaleBudgeFilterBusinessTypes businessTypes,
@@ -19,7 +19,7 @@
  [*
    // yypsybs Sep-19-2023 (created)
    // true, false
    info( isCapacity );
    info( saleOrCapacity );
    // 月;季度;半年;年
    info( groupBy );
    // 面板基地;事业部
@@ -82,18 +82,18 @@
          this.CapacityAndSaleBudgeChartElement( relnew, 
                                                 TimeStringAndScenarioName := [String]year.YearNo() + "年-目标",
                                                 BusinessTypeOrPlaceOfProductionOfArray := placeOfProductionOfArray, 
                                                 Quantity := ifexpr( isCapacity,
                                                                     MappingCapacityAndSaleBudge::GetSheetByYear( productCodeList, mpSync, year.YearNo() ),
                                                                     MappingAnnualBudget::GetSheetByYear( productCodeList, mpSync, year.YearNo() ) )
                                                 Quantity := ifexpr( saleOrCapacity = "销售额",
                                                                     MappingAnnualBudget::GetSheetByYear( productCodeList, mpSync, year.YearNo() ),
                                                                     MappingCapacityAndSaleBudge::GetSheetByYear( productCodeList, mpSync, year.YearNo() ) )
                                                 );  
          // S&OP
          traverse( macroPlans, Elements, macroPlan ) {
            this.CapacityAndSaleBudgeChartElement( relnew, 
                                                   TimeStringAndScenarioName := [String]year.YearNo() + "年-" + macroPlan.ScenarioName(),
                                                   BusinessTypeOrPlaceOfProductionOfArray := placeOfProductionOfArray, 
                                                   Quantity := ifexpr( isCapacity,
                                                                       Product_MP::GetNewSupplyByYear( productCodeList, macroPlan, year.YearNo() ),
                                                                       MappingCustomerOrder::GetNewSupplyByYear( productCodeList, macroPlan, year.YearNo() )
                                                   Quantity := ifexpr( saleOrCapacity = "销售额",
                                                                       MappingCustomerOrder::GetNewSupplyByYear( productCodeList, macroPlan, year.YearNo() ),
                                                                       Product_MP::GetNewSupplyByYear( productCodeList, macroPlan, year.YearNo() )
                                                                       )
                                                   ); 
          }                    
@@ -106,18 +106,18 @@
            this.CapacityAndSaleBudgeChartElement( relnew, 
                                                   TimeStringAndScenarioName := [String]year.YearNo() + "年-" + ifexpr( halfNo = 1, "上", "下" ) + "半年-目标",
                                                   BusinessTypeOrPlaceOfProductionOfArray := placeOfProductionOfArray, 
                                                   Quantity := ifexpr( isCapacity,
                                                                       MappingCapacityAndSaleBudge::GetSheetByHalfYear( productCodeList, mpSync, year.YearNo(), halfNo ),
                                                                       MappingAnnualBudget::GetSheetByHalfYear( productCodeList, mpSync, year.YearNo(), halfNo ) )
                                                   Quantity := ifexpr( saleOrCapacity = "销售额",
                                                                       MappingAnnualBudget::GetSheetByHalfYear( productCodeList, mpSync, year.YearNo(), halfNo ),
                                                                       MappingCapacityAndSaleBudge::GetSheetByHalfYear( productCodeList, mpSync, year.YearNo(), halfNo ) )
                                                   );  
            // S&OP
            traverse( macroPlans, Elements, macroPlan ) {
              this.CapacityAndSaleBudgeChartElement( relnew, 
                                                     TimeStringAndScenarioName := [String]year.YearNo() + "年-" + ifexpr( halfNo = 1, "上", "下" ) + "半年-" + macroPlan.ScenarioName(),
                                                     BusinessTypeOrPlaceOfProductionOfArray := placeOfProductionOfArray, 
                                                     Quantity := ifexpr( isCapacity,
                                                                         Product_MP::GetNewSupplyByHalfYear( productCodeList, macroPlan, year.YearNo(), halfNo ),
                                                                         MappingCustomerOrder::GetNewSupplyByHalfYear( productCodeList, macroPlan, year.YearNo(), halfNo )
                                                     Quantity := ifexpr( saleOrCapacity = "销售额",
                                                                         MappingCustomerOrder::GetNewSupplyByHalfYear( productCodeList, macroPlan, year.YearNo(), halfNo ),
                                                                         Product_MP::GetNewSupplyByHalfYear( productCodeList, macroPlan, year.YearNo(), halfNo )
                                                                         )
                                                     ); 
            }                    
@@ -134,9 +134,9 @@
            this.CapacityAndSaleBudgeChartElement( relnew, 
                                                   TimeStringAndScenarioName := [String]year.YearNo() + "年-第" + [String]seasonNo + "季度-目标",
                                                   BusinessTypeOrPlaceOfProductionOfArray := placeOfProductionOfArray, 
                                                   Quantity := ifexpr( isCapacity,
                                                                       MappingCapacityAndSaleBudge::GetSheetBySeason( productCodeList, mpSync, year.YearNo(), seasonNo ),
                                                                       MappingAnnualBudget::GetSheetBySeason( productCodeList, mpSync, year.YearNo(), seasonNo ) )
                                                   Quantity := ifexpr( saleOrCapacity = "销售额",
                                                                       MappingAnnualBudget::GetSheetBySeason( productCodeList, mpSync, year.YearNo(), seasonNo ),
                                                                       MappingCapacityAndSaleBudge::GetSheetBySeason( productCodeList, mpSync, year.YearNo(), seasonNo ) )
                                                   );  
      //      info( "productCodeList : " + [String]productCodeList.Size() );
            // S&OP
@@ -144,9 +144,9 @@
              this.CapacityAndSaleBudgeChartElement( relnew, 
                                                     TimeStringAndScenarioName := [String]year.YearNo() + "年-第" + [String]seasonNo + "季度-" + macroPlan.ScenarioName(),
                                                     BusinessTypeOrPlaceOfProductionOfArray := placeOfProductionOfArray, 
                                                     Quantity := ifexpr( isCapacity,
                                                                         Product_MP::GetNewSupplyBySeason( productCodeList, macroPlan, year.YearNo(), seasonNo ),
                                                                         MappingCustomerOrder::GetNewSupplyBySeason( productCodeList, macroPlan, year.YearNo(), seasonNo )
                                                     Quantity := ifexpr( saleOrCapacity = "销售额",
                                                                         MappingCustomerOrder::GetNewSupplyBySeason( productCodeList, macroPlan, year.YearNo(), seasonNo ) ,
                                                                         Product_MP::GetNewSupplyBySeason( productCodeList, macroPlan, year.YearNo(), seasonNo )
                                                                         )
                                                     ); 
            }                    
@@ -162,18 +162,18 @@
            this.CapacityAndSaleBudgeChartElement( relnew, 
                                                   TimeStringAndScenarioName := [String]year.YearNo() + "年-第" + monthNoString + "月-目标",
                                                   BusinessTypeOrPlaceOfProductionOfArray := placeOfProductionOfArray, 
                                                   Quantity := ifexpr( isCapacity,
                                                                       MappingCapacityAndSaleBudge::GetSheetByMonth( productCodeList, mpSync, year.YearNo(), month.MonthNo() ),
                                                                       MappingAnnualBudget::GetSheetByMonth( productCodeList, mpSync, year.YearNo(), month.MonthNo() ) )
                                                   Quantity := ifexpr( saleOrCapacity = "销售额",
                                                                       MappingAnnualBudget::GetSheetByMonth( productCodeList, mpSync, year.YearNo(), month.MonthNo() ),
                                                                       MappingCapacityAndSaleBudge::GetSheetByMonth( productCodeList, mpSync, year.YearNo(), month.MonthNo() ) )
                                                   );  
            // S&OP
            traverse( macroPlans, Elements, macroPlan ) {
              this.CapacityAndSaleBudgeChartElement( relnew, 
                                                     TimeStringAndScenarioName := [String]year.YearNo() + "年-第" + monthNoString + "月-" + macroPlan.ScenarioName(),
                                                     BusinessTypeOrPlaceOfProductionOfArray := placeOfProductionOfArray, 
                                                     Quantity := ifexpr( isCapacity,
                                                                         Product_MP::GetNewSupplyByMonth( productCodeList, macroPlan, year.YearNo(), month.MonthNo() ),
                                                                         MappingCustomerOrder::GetNewSupplyByMonth( productCodeList, macroPlan, year.YearNo(), month.MonthNo() )
                                                     Quantity := ifexpr( saleOrCapacity = "销售额",
                                                                         MappingCustomerOrder::GetNewSupplyByMonth( productCodeList, macroPlan, year.YearNo(), month.MonthNo() ),
                                                                         Product_MP::GetNewSupplyByMonth( productCodeList, macroPlan, year.YearNo(), month.MonthNo() )
                                                                         )
                                                     ); 
            }
@@ -188,18 +188,18 @@
          this.CapacityAndSaleBudgeChartElement( relnew, 
                                                 TimeStringAndScenarioName := [String]year.YearNo() + "年-目标",
                                                 BusinessTypeOrPlaceOfProductionOfArray := businessType, 
                                                 Quantity := ifexpr( isCapacity,
                                                                     MappingCapacityAndSaleBudge::GetSheetByYear( productCodeList, mpSync, year.YearNo() ),
                                                                     MappingAnnualBudget::GetSheetByYear( productCodeList, mpSync, year.YearNo() ) )
                                                 Quantity := ifexpr( saleOrCapacity = "销售额",
                                                                     MappingAnnualBudget::GetSheetByYear( productCodeList, mpSync, year.YearNo() ),
                                                                     MappingCapacityAndSaleBudge::GetSheetByYear( productCodeList, mpSync, year.YearNo() ) )
                                                 );  
          // S&OP
          traverse( macroPlans, Elements, macroPlan ) {
            this.CapacityAndSaleBudgeChartElement( relnew, 
                                                   TimeStringAndScenarioName := [String]year.YearNo() + "年-" + macroPlan.ScenarioName(),
                                                   BusinessTypeOrPlaceOfProductionOfArray := businessType, 
                                                   Quantity := ifexpr( isCapacity,
                                                                       Product_MP::GetNewSupplyByYear( productCodeList, macroPlan, year.YearNo() ),
                                                                       MappingCustomerOrder::GetNewSupplyByYear( productCodeList, macroPlan, year.YearNo() )
                                                   Quantity := ifexpr( saleOrCapacity = "销售额",
                                                                       MappingCustomerOrder::GetNewSupplyByYear( productCodeList, macroPlan, year.YearNo() ) ,
                                                                       Product_MP::GetNewSupplyByYear( productCodeList, macroPlan, year.YearNo() )
                                                                       )
                                                   ); 
          }                    
@@ -212,18 +212,18 @@
            this.CapacityAndSaleBudgeChartElement( relnew, 
                                                   TimeStringAndScenarioName := [String]year.YearNo() + "年-" + ifexpr( halfNo = 1, "上", "下" ) + "半年-目标",
                                                   BusinessTypeOrPlaceOfProductionOfArray := businessType, 
                                                   Quantity := ifexpr( isCapacity,
                                                                       MappingCapacityAndSaleBudge::GetSheetByHalfYear( productCodeList, mpSync, year.YearNo(), halfNo ),
                                                                       MappingAnnualBudget::GetSheetByHalfYear( productCodeList, mpSync, year.YearNo(), halfNo ) )
                                                   Quantity := ifexpr( saleOrCapacity = "销售额",
                                                                       MappingAnnualBudget::GetSheetByHalfYear( productCodeList, mpSync, year.YearNo(), halfNo ),
                                                                       MappingCapacityAndSaleBudge::GetSheetByHalfYear( productCodeList, mpSync, year.YearNo(), halfNo ) )
                                                   );  
            // S&OP
            traverse( macroPlans, Elements, macroPlan ) {
              this.CapacityAndSaleBudgeChartElement( relnew, 
                                                     TimeStringAndScenarioName := [String]year.YearNo() + "年-" + ifexpr( halfNo = 1, "上", "下" ) + "半年-" + macroPlan.ScenarioName(),
                                                     BusinessTypeOrPlaceOfProductionOfArray := businessType, 
                                                     Quantity := ifexpr( isCapacity,
                                                                         Product_MP::GetNewSupplyByHalfYear( productCodeList, macroPlan, year.YearNo(), halfNo ),
                                                                         MappingCustomerOrder::GetNewSupplyByHalfYear( productCodeList, macroPlan, year.YearNo(), halfNo )
                                                     Quantity := ifexpr( saleOrCapacity = "销售额",
                                                                         MappingCustomerOrder::GetNewSupplyByHalfYear( productCodeList, macroPlan, year.YearNo(), halfNo ) ,
                                                                         Product_MP::GetNewSupplyByHalfYear( productCodeList, macroPlan, year.YearNo(), halfNo )
                                                                         )
                                                     ); 
            }                    
@@ -238,18 +238,18 @@
            this.CapacityAndSaleBudgeChartElement( relnew, 
                                                   TimeStringAndScenarioName := [String]year.YearNo() + "年-第" + [String]seasonNo + "季度-目标",
                                                   BusinessTypeOrPlaceOfProductionOfArray := businessType, 
                                                   Quantity := ifexpr( isCapacity,
                                                                       MappingCapacityAndSaleBudge::GetSheetBySeason( productCodeList, mpSync, year.YearNo(), seasonNo ),
                                                                       MappingAnnualBudget::GetSheetBySeason( productCodeList, mpSync, year.YearNo(), seasonNo ) )
                                                   Quantity := ifexpr( saleOrCapacity = "销售额",
                                                                       MappingAnnualBudget::GetSheetBySeason( productCodeList, mpSync, year.YearNo(), seasonNo ),
                                                                       MappingCapacityAndSaleBudge::GetSheetBySeason( productCodeList, mpSync, year.YearNo(), seasonNo ) )
                                                   );  
            // S&OP
            traverse( macroPlans, Elements, macroPlan ) {
              this.CapacityAndSaleBudgeChartElement( relnew, 
                                                     TimeStringAndScenarioName := [String]year.YearNo() + "年-第" + [String]seasonNo + "季度-" + macroPlan.ScenarioName(),
                                                     BusinessTypeOrPlaceOfProductionOfArray := businessType, 
                                                     Quantity := ifexpr( isCapacity,
                                                                         Product_MP::GetNewSupplyBySeason( productCodeList, macroPlan, year.YearNo(), seasonNo ),
                                                                         MappingCustomerOrder::GetNewSupplyBySeason( productCodeList, macroPlan, year.YearNo(), seasonNo )
                                                     Quantity := ifexpr( saleOrCapacity = "销售额",
                                                                         MappingCustomerOrder::GetNewSupplyBySeason( productCodeList, macroPlan, year.YearNo(), seasonNo ),
                                                                         Product_MP::GetNewSupplyBySeason( productCodeList, macroPlan, year.YearNo(), seasonNo )
                                                                         )
                                                     ); 
            }                    
@@ -266,18 +266,18 @@
            this.CapacityAndSaleBudgeChartElement( relnew, 
                                                   TimeStringAndScenarioName := [String]year.YearNo() + "年-第" + monthNoString + "月-目标",
                                                   BusinessTypeOrPlaceOfProductionOfArray := businessType, 
                                                   Quantity := ifexpr( isCapacity,
                                                                       MappingAnnualBudget::GetSheetByMonth( productCodeList, mpSync, year.YearNo(), month.MonthNo() ),
                                                                       MappingCapacityAndSaleBudge::GetSheetByMonth( productCodeList, mpSync, year.YearNo(), month.MonthNo() ) )
                                                   Quantity := ifexpr( saleOrCapacity = "销售额",
                                                                       MappingCapacityAndSaleBudge::GetSheetByMonth( productCodeList, mpSync, year.YearNo(), month.MonthNo() ),
                                                                       MappingAnnualBudget::GetSheetByMonth( productCodeList, mpSync, year.YearNo(), month.MonthNo() ) )
                                                   );  
            // S&OP
            traverse( macroPlans, Elements, macroPlan ) {
              this.CapacityAndSaleBudgeChartElement( relnew, 
                                                     TimeStringAndScenarioName := [String]year.YearNo() + "年-第" + monthNoString + "月-" + macroPlan.ScenarioName(),
                                                     BusinessTypeOrPlaceOfProductionOfArray := businessType, 
                                                     Quantity := ifexpr( isCapacity,
                                                                         Product_MP::GetNewSupplyByMonth( productCodeList, macroPlan, year.YearNo(), month.MonthNo() ),
                                                                         MappingCustomerOrder::GetNewSupplyByMonth( productCodeList, macroPlan, year.YearNo(), month.MonthNo() )
                                                     Quantity := ifexpr( saleOrCapacity = "销售额",
                                                                         MappingCustomerOrder::GetNewSupplyByMonth( productCodeList, macroPlan, year.YearNo(), month.MonthNo() ) ,
                                                                         Product_MP::GetNewSupplyByMonth( productCodeList, macroPlan, year.YearNo(), month.MonthNo() )
                                                                         )
                                                     ); 
            }