yanweiyuan3
2023-08-09 588bc7829387dfc761cc25f06f77d4c81818bd10
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
Quintiq file version 2.0
#parent: #root
Function CalcMaxCapacity
{
  TextBody:
  [*
    // Soh Yee Aug-26-2012 (created)
    
    
    // The MaxCapacity doesn't need to be divided by the the period's duration.
    // For example, if its time unit is Week, max capacity is 1000, but the period duration is 5 days, the max capacity is still 1000 for 5 days.
    value := guard( this.StockingPointCapacity().MaxCapacity(),
                    this.StockingPoint_MP().MacroPlan().GlobalParameters_MP().DefaultMaxCapacityForStockingPoint() );
                   
    
    // MaxCapacity will be 0 if the period is not within the stocking point period validity.
    if( this.Duration() = Duration::Zero() or ( this.StockingPoint_MP().IsSystem() and not this.StockingPoint_MP().IsPlannedInfinite() ) )
    {
      value := 0;
    }
    
    this.MaxCapacity( value );
  *]
}