hongji.li
2023-11-01 8fe535effe8ad184a82e565c3c066a94a8525606
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
Quintiq file version 2.0
#parent: #root
Method CapacityAndSaleBudgeCompare (
  MacroPlans macroPlans,
  CapacityAndSaleBudgeFilterItems items,
  CapacityAndSaleBudgeFilterYears years,
  CapacityAndSaleBudgeFilterMonths months,
  const GlobalOTDTable globalOTDTable
)
{
  Description: 'todo : mappingParent改为mpSync, random删了'
  TextBody:
  [*
    if ( years.Size() = 0 ) {
      years := selectset( this, CapacityAndSaleBudgeFilterYear, tempCASBFY, tempCASBFY.YearNo() = Date::ActualDate().Year() );
    }
    if ( months.Size() = 0 ) {
      months := selectsortedset( this, CapacityAndSaleBudgeFilterMonth, item, item.MonthNo() );
    }
    
    this.CapacityAndSaleBudgeCompareItemRow( relflush );
    this.CapacityAndSaleBudgeCompareItemColumn( relflush );
    
    CapacityAndSaleBudgeCompareItemCell::CreateData( globalOTDTable, this );
    
    if ( CapacityAndSaleBudgeFilterItem::Contains( items, "面板分配量" ) ) {
      traverse ( years, Elements, year ) {
        CapacityAndSaleBudgeCompareItemCell::CreatePanelAllocationBudget( this, months, year, globalOTDTable );
        CapacityAndSaleBudgeCompareItemCell::CreatePanelAllocationByScenario( macroPlans, this, months, year );
      }
    }
    
    if ( CapacityAndSaleBudgeFilterItem::Contains( items, "销售额" ) ) {
      traverse ( years, Elements, year ) {
        CapacityAndSaleBudgeCompareItemCell::CreateSalesVolume( this, months, year, globalOTDTable );
        CapacityAndSaleBudgeCompareItemCell::CreateSalesVolumeByScenario( macroPlans, this, months, year );
      }
    }
    
    // 大张盈利额
    //traverse ( years, Elements, year ) {
    //  // 历史数据
    //  columnYear := CapacityAndSaleBudgeCompareItemColumn::CreateIfNotExist( this, "大张盈利额-" + [String]year.YearNo() + "年-年度预算" );
    //  traverse ( this, CapacityAndSaleBudgeCompareItemRow, row ) {
    //    cell := columnYear.CapacityAndSaleBudgeCompareItemCell( relnew, CellContent := [String]Number::Random( 0, 0 ) );
    //    cell.CapacityAndSaleBudgeCompareItemRow( relset, row );
    //  }
    //  // S&OP数据
    //  traverse( macroPlans, Elements, macroPlan ) {
    //    columnYear := CapacityAndSaleBudgeCompareItemColumn::CreateIfNotExist( this, "大张盈利额-" + [String]year.YearNo() + "年-" + macroPlan.ScenarioName() );
    //    traverse( this, CapacityAndSaleBudgeCompareItemRow, row ) {
    //      cell := columnYear.CapacityAndSaleBudgeCompareItemCell( relnew, CellContent := [String]Number::Random( 0, 0 ) );
    //      cell.CapacityAndSaleBudgeCompareItemRow( relset, row );
    //    }
    //  }
    //}
    //// 产品盈利额
    //traverse ( years, Elements, year ) {
    //  // 历史数据
    //  columnYear := CapacityAndSaleBudgeCompareItemColumn::CreateIfNotExist( this, "产品盈利额-" + [String]year.YearNo() + "年-年度预算" );
    //  traverse ( this, CapacityAndSaleBudgeCompareItemRow, row ) {
    //    cell := columnYear.CapacityAndSaleBudgeCompareItemCell( relnew, CellContent := [String]Number::Random( 0, 0 ) );
    //    cell.CapacityAndSaleBudgeCompareItemRow( relset, row );
    //  }
    //  // S&OP数据
    //  traverse ( macroPlans, Elements, macroPlan ) {
    //    columnYear := CapacityAndSaleBudgeCompareItemColumn::CreateIfNotExist( this, "产品盈利额-" + [String]year.YearNo() + "年-" + macroPlan.ScenarioName() );
    //    traverse ( this, CapacityAndSaleBudgeCompareItemRow, row ) {
    //      // todo
    //      cell := columnYear.CapacityAndSaleBudgeCompareItemCell( relnew, CellContent := [String]Number::Random( 0, 0 ) );
    //      cell.CapacityAndSaleBudgeCompareItemRow( relset, row );
    //    }
    //  }
    //}
    
    // 设置rowNo和columnNo
    rowNo := 1;
    rowSorted := selectsortedset( this, CapacityAndSaleBudgeCompareItemRow, item, item.PlaceOfProductionOfArray() + "_" + item.BusinessType() );
    traverse( rowSorted, Elements, item ) {
      item.RowNo( rowNo );
      rowNo := rowNo + 1;
    }
    columnNo := 1;
    traverse( this, CapacityAndSaleBudgeCompareItemColumn, item ) {
      item.ColumnNo( columnNo );
      columnNo := columnNo + 1;
    }
  *]
}