yypsybs
2023-09-22 744ece58704eabc06b44d3df45216bcced80ed96
_Main/BL/Type_ScenarioManager/Method_CapacityAndSaleBudgeChart.qbl
@@ -2,7 +2,7 @@
#parent: #root
Method CapacityAndSaleBudgeChart (
  MacroPlans macroPlans,
  Boolean isCapacity,
  String saleOrCapacity,
  String groupBy,
  String byBusinessTypeOrByOrgCode,
  String businessTypeChosen,
@@ -22,7 +22,7 @@
  [*
    // yypsybs Sep-19-2023 (created)
    // true, false
    info( isCapacity );
    info( saleOrCapacity );
    // 月;季度;半年;年
    info( groupBy );
    // 面板基地;事业部
@@ -61,20 +61,18 @@
        this.CapacityAndSaleBudgeChartElement( relnew, 
                                               TimeStringAndScenarioName := [String]year + "年-目标",
                                               BusinessTypeOrPlaceOfProductionOfArray := placeOfProductionOfArray, 
                                               Quantity := ifexpr( isCapacity,
                                                                   MappingCapacityAndSaleBudge::GetSheetByYear( productCodeList, mpSync, [Number]year ),
                                                                   // todo QID 23
                                                                   MappingAnnualBudget::GetSheetByYear( productCodeList, mpSync, [Number]year ) )
                                               Quantity := ifexpr( saleOrCapacity = "销售额",
                                                                   MappingAnnualBudget::GetSheetByYear( productCodeList, mpSync, [Number]year ),
                                                                   MappingCapacityAndSaleBudge::GetSheetByYear( productCodeList, mpSync, [Number]year ) )
                                               );  
        // S&OP
        traverse( macroPlans, Elements, macroPlan ) {
          this.CapacityAndSaleBudgeChartElement( relnew, 
                                                 TimeStringAndScenarioName := [String]year + "年-" + macroPlan.ScenarioName(),
                                                 BusinessTypeOrPlaceOfProductionOfArray := placeOfProductionOfArray, 
                                                 Quantity := ifexpr( isCapacity,
                                                                     Product_MP::GetNewSupplyByYear( productCodeList, macroPlan, [Number]year ),
                                                                     // todo
                                                                     0.0 )
                                                 Quantity := ifexpr( saleOrCapacity = "销售额",
                                                                     0.0,
                                                                     Product_MP::GetNewSupplyByYear( productCodeList, macroPlan, [Number]year ) )
                                                 ); 
        }                    
      }
@@ -86,18 +84,18 @@
          this.CapacityAndSaleBudgeChartElement( relnew, 
                                                 TimeStringAndScenarioName := [String]year + "年-" + ifexpr( halfNo = 1, "上", "下" ) + "半年-目标",
                                                 BusinessTypeOrPlaceOfProductionOfArray := placeOfProductionOfArray, 
                                                 Quantity := ifexpr( isCapacity,
                                                                     MappingCapacityAndSaleBudge::GetSheetByHalfYear( productCodeList, mpSync, [Number]year, halfNo ),
                                                                     MappingAnnualBudget::GetSheetByHalfYear( productCodeList, mpSync, [Number]year, halfNo ) )
                                                 Quantity := ifexpr( saleOrCapacity = "销售额",
                                                                     MappingAnnualBudget::GetSheetByHalfYear( productCodeList, mpSync, [Number]year, halfNo ),
                                                                     MappingCapacityAndSaleBudge::GetSheetByHalfYear( productCodeList, mpSync, [Number]year, halfNo ) )
                                                 );  
          // S&OP
          traverse( macroPlans, Elements, macroPlan ) {
            this.CapacityAndSaleBudgeChartElement( relnew, 
                                                   TimeStringAndScenarioName := [String]year + "年-" + ifexpr( halfNo = 1, "上", "下" ) + "半年-" + macroPlan.ScenarioName(),
                                                   BusinessTypeOrPlaceOfProductionOfArray := placeOfProductionOfArray, 
                                                   Quantity := ifexpr( isCapacity,
                                                                       Product_MP::GetNewSupplyByHalfYear( productCodeList, macroPlan, [Number]year, halfNo ),
                                                                       0.0 )
                                                   Quantity := ifexpr( saleOrCapacity = "销售额",
                                                                       0.0,
                                                                       Product_MP::GetNewSupplyByHalfYear( productCodeList, macroPlan, [Number]year, halfNo ) )
                                                   ); 
          }                    
        }
@@ -113,9 +111,9 @@
          this.CapacityAndSaleBudgeChartElement( relnew, 
                                                 TimeStringAndScenarioName := [String]year + "年-第" + [String]seasonNo + "季度-目标",
                                                 BusinessTypeOrPlaceOfProductionOfArray := placeOfProductionOfArray, 
                                                 Quantity := ifexpr( isCapacity,
                                                                     MappingCapacityAndSaleBudge::GetSheetBySeason( productCodeList, mpSync, [Number]year, seasonNo ),
                                                                     MappingAnnualBudget::GetSheetBySeason( productCodeList, mpSync, [Number]year, seasonNo ) )
                                                 Quantity := ifexpr( saleOrCapacity = "销售额",
                                                                     MappingAnnualBudget::GetSheetBySeason( productCodeList, mpSync, [Number]year, seasonNo ),
                                                                     MappingCapacityAndSaleBudge::GetSheetBySeason( productCodeList, mpSync, [Number]year, seasonNo ) )
                                                 );  
    //      info( "productCodeList : " + [String]productCodeList.Size() );
          // S&OP
@@ -123,9 +121,9 @@
            this.CapacityAndSaleBudgeChartElement( relnew, 
                                                   TimeStringAndScenarioName := [String]year + "年-第" + [String]seasonNo + "季度-" + macroPlan.ScenarioName(),
                                                   BusinessTypeOrPlaceOfProductionOfArray := placeOfProductionOfArray, 
                                                   Quantity := ifexpr( isCapacity,
                                                                       Product_MP::GetNewSupplyBySeason( productCodeList, macroPlan, [Number]year, seasonNo ),
                                                                       0.0 )
                                                   Quantity := ifexpr( saleOrCapacity = "销售额",
                                                                       0.0,
                                                                       Product_MP::GetNewSupplyBySeason( productCodeList, macroPlan, [Number]year, seasonNo ) )
                                                   ); 
          }                    
        }
@@ -139,18 +137,18 @@
          this.CapacityAndSaleBudgeChartElement( relnew, 
                                                 TimeStringAndScenarioName := [String]year + "年-第" + monthNoString + "月-目标",
                                                 BusinessTypeOrPlaceOfProductionOfArray := placeOfProductionOfArray, 
                                                 Quantity := ifexpr( isCapacity,
                                                                     MappingCapacityAndSaleBudge::GetSheetByMonth( productCodeList, mpSync, [Number]year, monthNo ),
                                                                     MappingAnnualBudget::GetSheetByMonth( productCodeList, mpSync, [Number]year, monthNo ) )
                                                 Quantity := ifexpr( saleOrCapacity = "销售额",
                                                                     MappingAnnualBudget::GetSheetByMonth( productCodeList, mpSync, [Number]year, monthNo ),
                                                                     MappingCapacityAndSaleBudge::GetSheetByMonth( productCodeList, mpSync, [Number]year, monthNo ) )
                                                 );  
          // S&OP
          traverse( macroPlans, Elements, macroPlan ) {
            this.CapacityAndSaleBudgeChartElement( relnew, 
                                                   TimeStringAndScenarioName := [String]year + "年-第" + monthNoString + "月-" + macroPlan.ScenarioName(),
                                                   BusinessTypeOrPlaceOfProductionOfArray := placeOfProductionOfArray, 
                                                   Quantity := ifexpr( isCapacity,
                                                                       Product_MP::GetNewSupplyByMonth( productCodeList, macroPlan, [Number]year, monthNo ),
                                                                       0.0 )
                                                   Quantity := ifexpr( saleOrCapacity = "销售额",
                                                                       0.0,
                                                                       Product_MP::GetNewSupplyByMonth( productCodeList, macroPlan, [Number]year, monthNo ) )
                                                   ); 
          }                    
        }
@@ -163,18 +161,18 @@
        this.CapacityAndSaleBudgeChartElement( relnew, 
                                               TimeStringAndScenarioName := [String]year + "年-目标",
                                               BusinessTypeOrPlaceOfProductionOfArray := businessType, 
                                               Quantity := ifexpr( isCapacity,
                                                                   MappingCapacityAndSaleBudge::GetSheetByYear( productCodeList, mpSync, [Number]year ),
                                                                   MappingAnnualBudget::GetSheetByYear( productCodeList, mpSync, [Number]year ) )
                                               Quantity := ifexpr( saleOrCapacity = "销售额",
                                                                   MappingAnnualBudget::GetSheetByYear( productCodeList, mpSync, [Number]year ),
                                                                   MappingCapacityAndSaleBudge::GetSheetByYear( productCodeList, mpSync, [Number]year ) )
                                               );  
        // S&OP
        traverse( macroPlans, Elements, macroPlan ) {
          this.CapacityAndSaleBudgeChartElement( relnew, 
                                                 TimeStringAndScenarioName := [String]year + "年-" + macroPlan.ScenarioName(),
                                                 BusinessTypeOrPlaceOfProductionOfArray := businessType, 
                                                 Quantity := ifexpr( isCapacity,
                                                                     Product_MP::GetNewSupplyByYear( productCodeList, macroPlan, [Number]year ),
                                                                     0.0 )
                                                 Quantity := ifexpr( saleOrCapacity = "销售额",
                                                                     0.0,
                                                                     Product_MP::GetNewSupplyByYear( productCodeList, macroPlan, [Number]year ) )
                                                 ); 
        }                    
      }
@@ -186,18 +184,18 @@
          this.CapacityAndSaleBudgeChartElement( relnew, 
                                                 TimeStringAndScenarioName := [String]year + "年-" + ifexpr( halfNo = 1, "上", "下" ) + "半年-目标",
                                                 BusinessTypeOrPlaceOfProductionOfArray := businessType, 
                                                 Quantity := ifexpr( isCapacity,
                                                                     MappingCapacityAndSaleBudge::GetSheetByHalfYear( productCodeList, mpSync, [Number]year, halfNo ),
                                                                     MappingAnnualBudget::GetSheetByHalfYear( productCodeList, mpSync, [Number]year, halfNo ) )
                                                 Quantity := ifexpr( saleOrCapacity = "销售额",
                                                                     MappingAnnualBudget::GetSheetByHalfYear( productCodeList, mpSync, [Number]year, halfNo ),
                                                                     MappingCapacityAndSaleBudge::GetSheetByHalfYear( productCodeList, mpSync, [Number]year, halfNo ) )
                                                 );  
          // S&OP
          traverse( macroPlans, Elements, macroPlan ) {
            this.CapacityAndSaleBudgeChartElement( relnew, 
                                                   TimeStringAndScenarioName := [String]year + "年-" + ifexpr( halfNo = 1, "上", "下" ) + "半年-" + macroPlan.ScenarioName(),
                                                   BusinessTypeOrPlaceOfProductionOfArray := businessType, 
                                                   Quantity := ifexpr( isCapacity,
                                                                       Product_MP::GetNewSupplyByHalfYear( productCodeList, macroPlan, [Number]year, halfNo ),
                                                                       0.0 )
                                                   Quantity := ifexpr( saleOrCapacity = "销售额",
                                                                       0.0,
                                                                       Product_MP::GetNewSupplyByHalfYear( productCodeList, macroPlan, [Number]year, halfNo ) )
                                                   ); 
          }                    
        }
@@ -210,18 +208,18 @@
          this.CapacityAndSaleBudgeChartElement( relnew, 
                                                 TimeStringAndScenarioName := [String]year + "年-第" + [String]seasonNo + "季度-目标",
                                                 BusinessTypeOrPlaceOfProductionOfArray := businessType, 
                                                 Quantity := ifexpr( isCapacity,
                                                                     MappingCapacityAndSaleBudge::GetSheetBySeason( productCodeList, mpSync, [Number]year, seasonNo ),
                                                                     MappingAnnualBudget::GetSheetBySeason( productCodeList, mpSync, [Number]year, seasonNo ) )
                                                 Quantity := ifexpr( saleOrCapacity = "销售额",
                                                                     MappingAnnualBudget::GetSheetBySeason( productCodeList, mpSync, [Number]year, seasonNo ),
                                                                     MappingCapacityAndSaleBudge::GetSheetBySeason( productCodeList, mpSync, [Number]year, seasonNo ) )
                                                 );  
          // S&OP
          traverse( macroPlans, Elements, macroPlan ) {
            this.CapacityAndSaleBudgeChartElement( relnew, 
                                                   TimeStringAndScenarioName := [String]year + "年-第" + [String]seasonNo + "季度-" + macroPlan.ScenarioName(),
                                                   BusinessTypeOrPlaceOfProductionOfArray := businessType, 
                                                   Quantity := ifexpr( isCapacity,
                                                                       Product_MP::GetNewSupplyBySeason( productCodeList, macroPlan, [Number]year, seasonNo ),
                                                                       0.0 )
                                                   Quantity := ifexpr( saleOrCapacity = "销售额",
                                                                       0.0,
                                                                       Product_MP::GetNewSupplyBySeason( productCodeList, macroPlan, [Number]year, seasonNo ) )
                                                   ); 
          }                    
        }
@@ -235,18 +233,18 @@
          this.CapacityAndSaleBudgeChartElement( relnew, 
                                                 TimeStringAndScenarioName := [String]year + "年-第" + monthNoString + "月-目标",
                                                 BusinessTypeOrPlaceOfProductionOfArray := businessType, 
                                                 Quantity := ifexpr( isCapacity,
                                                                     MappingCapacityAndSaleBudge::GetSheetByMonth( productCodeList, mpSync, [Number]year, monthNo ),
                                                                     MappingAnnualBudget::GetSheetByMonth( productCodeList, mpSync, [Number]year, monthNo ) )
                                                 Quantity := ifexpr( saleOrCapacity = "销售额",
                                                                     MappingAnnualBudget::GetSheetByMonth( productCodeList, mpSync, [Number]year, monthNo ),
                                                                     MappingCapacityAndSaleBudge::GetSheetByMonth( productCodeList, mpSync, [Number]year, monthNo ) )
                                                 );  
          // S&OP
          traverse( macroPlans, Elements, macroPlan ) {
            this.CapacityAndSaleBudgeChartElement( relnew, 
                                                   TimeStringAndScenarioName := [String]year + "年-第" + monthNoString + "月-" + macroPlan.ScenarioName(),
                                                   BusinessTypeOrPlaceOfProductionOfArray := businessType, 
                                                   Quantity := ifexpr( isCapacity,
                                                                       Product_MP::GetNewSupplyByMonth( productCodeList, macroPlan, [Number]year, monthNo ),
                                                                       0.0 )
                                                   Quantity := ifexpr( saleOrCapacity = "销售额",
                                                                       0.0,
                                                                       Product_MP::GetNewSupplyByMonth( productCodeList, macroPlan, [Number]year, monthNo ) )
                                                   ); 
          }                    
        }