Quintiq file version 2.0
|
#parent: #root
|
Method SetOptTransitionQuantity (
|
LibOpt_Task task
|
)
|
{
|
Description: 'move over quantities from combi world onto period task in transition'
|
TextBody:
|
[*
|
// opt transition periodtask are linked to from-campaign by campaing sequence optimizer
|
this.Quantity( 0.0 );
|
|
if ( not isnull( this.TransitionPeriod_MP() ) )
|
{
|
fromcampaign := this.TransitionPeriod_MP().Transition_MP().FromCampaign();
|
transitionperiod := this.TransitionPeriod_MP();
|
|
traverse( fromcampaign,
|
OptCampaignPeriodTaskInCombiElement,
|
optpt )
|
{
|
val1 := guard( optpt.OptCampaignCombiElement().OptCampaignElementType().astype( OptCampaignTransitionType ).TransitionType_MP() = this.TransitionType_MP(), false ) ;
|
val2 := optpt.Operation() = this.OperationInTransition().OperationInTransitionType().Operation();
|
if ( val1 and val2 )
|
{
|
elt := optpt.OptCampaignCombiElement().astype( OptCampaignCombiElementTransition );
|
ocusp := elt.OptCampaignUnitSubPeriod();
|
|
use := ocusp.UnitPeriod() = transitionperiod.UnitPeriod();
|
if ( not use and elt.OptimizerDuration() = Duration::Zero() )
|
{
|
use := elt.IsFirstElementInUnitSubPeriod() and guard( ocusp.PreviousSubPeriod().UnitPeriod() = transitionperiod.UnitPeriod(), false ) // at the combi level the first elt could still continue the previous period combi transition
|
or ( elt.IsLastElementInUnitSubPeriod() and guard( ocusp.NextSubPeriod().UnitPeriod() = transitionperiod.UnitPeriod(), false ) ) // at the combi level the last elt can start the new transition (continued in next period)
|
}
|
|
if ( use )
|
{
|
this.Quantity( this.Quantity() + optpt.Quantity() );
|
}
|
}
|
}
|
}
|
else
|
{
|
if ( not isnull( task ) )
|
{
|
task.Log( 'null transition period' + [String] this.PeriodTaskOperation().Start() + this.PeriodTaskOperation().OperationID() + guard( this.TransitionType_MP().Name(), 'transtype unknown' ) );
|
}
|
}
|
*]
|
InterfaceProperties { Accessibility: 'Extensible' }
|
}
|