Quintiq file version 2.0
|
#parent: #root
|
Method CreateUnitPeriod (
|
Period_MP period
|
) as UnitPeriod
|
{
|
Description: 'Create a unit period based on capacity type'
|
TextBody:
|
[*
|
// soh yee Sep-3-2015 (moved)
|
|
// Null period
|
unitperiod := UnitPeriod::FindUnitPeriodTypeIndex( this.ID(), period.Start(), period.End() );
|
|
if( isnull( unitperiod ) )
|
{
|
// Capacity time
|
if( this.CapacityType() = GlobalParameters_MP::GetCapacityTypeTime() )
|
{
|
unitperiod := UnitPeriodTime::Create( this, period );
|
}
|
// Capacity quantity
|
else if( this.CapacityType() = GlobalParameters_MP::GetCapacityTypeQuantity() )
|
{
|
unitperiod := UnitPeriodQuantity::Create( this, period );
|
}
|
// Capacity infinite
|
else if( this.CapacityType() = GlobalParameters_MP::GetCapacityTypeInfinite() )
|
{
|
unitperiod := UnitPeriodInfinite::Create( this, period );
|
}
|
// Capacity time aggregation
|
else if( this.CapacityType() = GlobalParameters_MP::GetCapacityTypeTimeAggregation() )
|
{
|
unitperiod := UnitPeriodTimeAggregation::Create( this, period );
|
}
|
// Capacity quantity aggregation
|
else if( this.CapacityType() = GlobalParameters_MP::GetCapacityTypeQuantityAggregation() )
|
{
|
unitperiod := UnitPeriodQuantityAggregation::Create( this, period );
|
}
|
// Capacity Transport time
|
else if( this.CapacityType() = GlobalParameters_MP::GetCapacityTypeTransportTime() )
|
{
|
unitperiod := UnitPeriodTransportTime::Create( this, period );
|
}
|
// Capacity Transport quantity
|
else if( this.CapacityType() = GlobalParameters_MP::GetCapacityTypeTransportQuantity() )
|
{
|
unitperiod := UnitPeriodTransportQuantity::Create( this, period );
|
}
|
}
|
|
return unitperiod;
|
*]
|
}
|