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
39
40
41
42
Quintiq file version 2.0
#parent: #root
StaticMethod CreateDataByMonth (
  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 ) {
        traverse ( months, Elements, m ) {
          filterCASBCIR := CapacityAndSaleBudgeChartElement::FilterCalculationRows( casbcirs, c, popoa );
          timeStringAndScenarioName := [String]y.YearNo() + "年" + "-" + [String]m.MonthNo() + "月" + "-" + "目标";
          targetMonths := construct( CapacityAndSaleBudgeFilterMonths );
          targetMonths.Add( m );
          quantity  := CapacityAndSaleBudgeChartElement::GetQuantity( filterCASBCIR, calculationConditions, "", y.YearNo(), targetMonths );
          CapacityAndSaleBudgeChartElement::Create( this, c, timeStringAndScenarioName, quantity );
         
          traverse ( macroPlans, Elements, mp ) {
            timeStringAndScenarioName := [String]y.YearNo() + "年" + "-" + [String]m.MonthNo() + "月" + "-" + mp.ScenarioName();
            quantity                  := CapacityAndSaleBudgeChartElement::GetQuantity( filterCASBCIR, calculationConditions, mp.ScenarioName(), y.YearNo(), targetMonths );
            CapacityAndSaleBudgeChartElement::Create( this, c, timeStringAndScenarioName, quantity );
          }
        }
      }
    }
  *]
}