陈清红
2025-04-14 880f3c0257eeb8c37761d484258fdd102a369a19
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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
Quintiq file version 2.0
#parent: #root
Method GenerateBenchmark (
  String namegroup,
  Number endproductstoadd,
  Number intermediatetoadd,
  Number periodstoadd,
  Boolean addtriplotsize,
  Real usertriplotsize,
  Boolean addptolotsize,
  Real userptolotsize,
  Boolean addptominqty,
  Real userptominqty,
  Boolean addinputlotsize,
  Real userinputlotsize,
  Boolean setlotcost,
  Boolean setinventorybalancing,
  Boolean addcapacitysmoothing,
  Real smoothingdelta,
  Boolean addpostponentspec,
  Number postponementnrperiods
)
{
  TextBody:
  [*
    /* example usage call via macroplan test method 
    
    namegroup := 'MyProduct'; 
    endproductstoadd := 1; // create this many x 3 (body, tab, end)
    intermediatetoadd := 1; // split intermediate products into this many 
    periodstoadd := 1; 
    
    addtriplotsize := true; 
    usertriplotsize := 100.0; 
    
    addptolotsize := true; 
    userptolotsize := 1000.0; 
    
    addptominqty := true; 
    userptominqty := 5000.0; 
    
    addinputlotsize := true; 
    userinputlotsize := 1000.0; 
    
    setlotcost := true; 
    
    setinventorymixbalancing := true; 
    
    addcapsmoothing := true; 
    smoothingdelta := 2.0; // 2% smoothing 
    
    addpostponement := true; 
    postponementnrperiods := 6; // parameter used for both horizon and max postponement
    
    this.GenerateBenchmark( namegroup, 
                            endproductstoadd, 
                            intermediatetoadd, 
                            periodstoadd, 
                            addtriplotsize, 
                            usertriplotsize, 
                            addptolotsize, 
                            userptolotsize, 
                            addptominqty, 
                            userptominqty, 
                            addinputlotsize, 
                            userinputlotsize, 
                            setlotcost, 
                            setinventorymixbalancing, 
                            addcapsmoothing, 
                            smoothingdelta, 
                            addpostponement, 
                            postponementnrperiods );
    */
    
    // >>>>>>>>>>>>>>>>>>>>>>>>> script
    
    this.GenerateBenchmarkAddEndProducts( endproductstoadd, namegroup );
    group := select(  this, Product_MP, p, p.ID() = namegroup ); 
    
    addedbodys := selectset(  group, AllChildren.AsChildren, p, true, p.Name() ~ 'Body' ); 
    addedtabs := selectset(  group, AllChildren.AsChildren, p, true, p.Name() ~ 'Tab' ); 
    addedends := selectset(  group, AllChildren.AsChildren, p, true, p.Name() ~ 'End' ); 
    
    addedall := addedbodys.Union( addedtabs ).Union( addedends ); 
    
    Transaction::Transaction().Propagate(); 
    
    // Create intermediate product going down to ingot 
    intermediate_1 := this.GenerateBenchmarkAddIntermediateProducts( intermediatetoadd, addedall ); 
    
    traverse( intermediate_1, Elements, p ) { debuginfo(  'created', p.ID() ) }; 
    
    intermediate_2 := this.GenerateBenchmarkAddIntermediateProducts( intermediatetoadd, intermediate_1 ); 
    traverse( intermediate_2, Elements, p ) { debuginfo(  'created', p.ID() ) }; 
    
    intermediate_3 := this.GenerateBenchmarkAddIntermediateProducts( intermediatetoadd, intermediate_2 ); 
    traverse( intermediate_3, Elements, p ) { debuginfo(  'created', p.ID() ) }; 
    
    Transaction::Transaction().Propagate(); 
    
    debuginfo(  'Adding periods' ); 
    this.GenerateBenchmarkAddPeriods( periodstoadd );
    
    if ( addtriplotsize ) 
    {
      this.GenerateBenchmarkAddTripLotsize( usertriplotsize ); 
    }
    
    if ( addptolotsize ) 
    {
      this.GenerateBenchmarkAddPTOLotsize( userptolotsize, setlotcost ); 
    }
    
    if ( addptominqty ) 
    {
      this.GenerateBenchmarkAddPTOProcMinQty( userptominqty ); 
    }
    
    if ( addinputlotsize ) 
    {
      this.GenerateBenchmarkAddInputLotSize( userinputlotsize ); 
    }
    
    if ( setinventorybalancing ) 
    {
      this.GenerateBenchmarkAddInventoryMixBalancing(); 
    }
    
    if ( addcapacitysmoothing ) 
    {
      this.GenerateBenchmarkAddCapacitySmoothing( smoothingdelta ); 
    }
    
    if ( addpostponentspec ) 
    {
      this.GenerateBenchmarkAddPostponementSpecification( postponementnrperiods ); 
    }
    
    // <<<<<<<<<<<<<<<<<<<<<<<<<<<< end script
  *]
  InterfaceProperties { Accessibility: 'Module' }
}