Kevin Kok Khah Whey
2023-11-07 5ae534ab606e6f2ba5ea60914224d665b0447d5a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
Quintiq file version 2.0
#parent: #root
StaticMethod CreateDataByYear (
  GlobalOTDSOP this,
  MacroPlans macroPlans,
  CapacityAndSaleBudgeCompareItemRows casbcirs,
  String popoa,
  String saleOrCapacity,
  CapacityAndSaleBudgeFilterYears years,
  CapacityAndSaleBudgeFilterMonths months
)
{
  TextBody:
  [*
    calculationConditions := ifexpr( saleOrCapacity = "产能", "PanelAllocation", "SalesVolume" );
    categories := construct( Strings );
    if ( popoa = "面板基地" ) {
      categories := selectuniquevalues( casbcirs, Elements, tempCASBCIR, true, tempCASBCIR.PlaceOfProductionOfArray() );
    } else if ( popoa = "事业部" ) {
      categories := selectuniquevalues( casbcirs, Elements, tempCASBCIR, true, tempCASBCIR.BusinessType() );
    }
    
    traverse ( years, Elements, y ) {
      traverse ( categories, Elements, c ) {
        timeStringAndScenarioName := [String]y.YearNo() + "年" + "-" + "目标";
        filterCASBCIR             := CapacityAndSaleBudgeChartElement::FilterCalculationRows( casbcirs, c, popoa );
        quantity                  := CapacityAndSaleBudgeChartElement::GetQuantity( filterCASBCIR, calculationConditions, "", y.YearNo(), months );
        CapacityAndSaleBudgeChartElement::Create( this, c, timeStringAndScenarioName, quantity );
        
        traverse ( macroPlans, Elements, mp ) {
          timeStringAndScenarioName := [String]y.YearNo() + "年" + "-" + mp.ScenarioName();
          quantity                  := CapacityAndSaleBudgeChartElement::GetQuantity( filterCASBCIR, calculationConditions, mp.ScenarioName(), y.YearNo(), months );
          CapacityAndSaleBudgeChartElement::Create( this, c, timeStringAndScenarioName, quantity );
        }
      }
    }
  *]
}