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
43
44
45
Quintiq file version 2.0
#parent: #root
StaticMethod CreateDataByQuarter (
  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 ) {
        for ( i := 1; i < 5; i ++ ) {
          targetMonth := selectset( months, Elements, tempM, tempM.MonthNo() >= ( ( i - 1 ) * 3 + 1  ) and 
                                    tempM.MonthNo() <= ( i * 3 ) );
          if ( targetMonth.Size() > 0 ) {                                              
            timeStringAndScenarioName := [String]y.YearNo() + "年" + "-" + "第" + [String]i + "季度" + "-" + "目标";
            info( targetMonth.Size() );
            filterCASBCIR             := CapacityAndSaleBudgeChartElement::FilterCalculationRows( casbcirs, c, popoa );
            quantity                  := CapacityAndSaleBudgeChartElement::GetQuantity( filterCASBCIR, calculationConditions, "", y.YearNo(), targetMonth );
            CapacityAndSaleBudgeChartElement::Create( this, c, timeStringAndScenarioName, quantity );
           
            traverse ( macroPlans, Elements, mp ) {
              timeStringAndScenarioName := [String]y.YearNo() + "年" + "-" + "第" + [String]i + "季度" + "-" + mp.ScenarioName();
              quantity                  := CapacityAndSaleBudgeChartElement::GetQuantity( filterCASBCIR, calculationConditions, mp.ScenarioName(), y.YearNo(), targetMonth );
              CapacityAndSaleBudgeChartElement::Create( this, c, timeStringAndScenarioName, quantity );
            }
          }
        }
      }
    }
  *]
}