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
  | Quintiq file version 2.0 
 |  #parent: #root 
 |  StaticMethod CreateOrUpdateForUnitPeriodQuantitys ( 
 |    UnitPeriodQuantitys unitperiodquantitys, 
 |    Boolean isbatcheditcapacity, 
 |    String timeunit, 
 |    Real mincapacity, 
 |    Real maxcapacity, 
 |    Boolean isbatcheditmaxloadpercentage, 
 |    Real maxloadpercentage, 
 |    Boolean isbatcheditnrofunitsopen, 
 |    Number nrofunitsopen, 
 |    Boolean isthisperiodonwards 
 |  ) 
 |  { 
 |    Description: 'Edit unit capacity from context menu of the unit period list in UI.' 
 |    TextBody: 
 |    [* 
 |      // soh yee Sep-17-2012 (created) 
 |       
 |      // Sort descendingly. 
 |      // For merging purpose ( not implemented yet ) and for avoiding of creating unit capacity with all having same time unit when all unit period quantities do not have a unit capacity. 
 |      unitperiodquantitys.Sort( attribute( UnitPeriodQuantity, Start ), false ); 
 |       
 |      traverse( unitperiodquantitys, Elements, upq ) 
 |      { 
 |        UnitCapacity::CreateOrUpdateForUnitPeriodQuantity( upq, 
 |                                                           isbatcheditcapacity, 
 |                                                           timeunit, 
 |                                                           mincapacity, 
 |                                                           maxcapacity, 
 |                                                           isbatcheditmaxloadpercentage, 
 |                                                           maxloadpercentage, 
 |                                                           isbatcheditnrofunitsopen, 
 |                                                           nrofunitsopen, 
 |                                                           isthisperiodonwards ); 
 |       
 |        // Without this all the relations will only set at the end of this method. 
 |        Transaction::Transaction().Propagate(); 
 |      } 
 |       
 |      // Get all units and clean up their unit capacities to remove repetition 
 |      units := selectset( unitperiodquantitys.Element( 0 ).MacroPlan(), Unit, unit, 
 |                          unit.UnitCapacity( relsize ) > 0 ); 
 |       
 |      UnitCapacity::RemoveRedundant( units ); 
 |    *] 
 |  } 
 |  
  |