Quintiq file version 2.0
|
#parent: #root
|
MultiTransaction ExecutePeriodRoll (
|
DateTime rollto,
|
PeriodSpecification_MP periodspecification
|
)
|
{
|
Description: 'Roll to the given date. Using multitransaction to break down the transaction such that it consume lesser memory.'
|
ExecuteContinuous: true
|
FreeMemory: true
|
OnFailureText:
|
[*
|
debuginfo( "Period roll failed!", errormessage );
|
this.IsRollingPeriod( false ); // Set IsRollingPeriod to false if fails
|
this.UpdateLastPlanningAction( false, false, true, false ); // isReset, isPlan, isRoll, isLockUnlock
|
*]
|
Priority: 'Default'
|
ReleaseHistory: true
|
Text:
|
[*
|
/* IMPORTANT NOTE
|
The period roll goes by this sequence:
|
1) Set MP.IsRollingPeriod to true
|
2) Synchronize periods, in this synchronize, no instance will be deleted, they will be set to IsDeleted to assume is deleted
|
3) Aggregation/Disaggregation
|
4) Delete all obsolte instances
|
5) Set MP.IsRollingPeriod to false
|
*/
|
stopcondition := false;
|
|
if ( step = 0 )
|
{
|
// Synchronize all periods
|
this.PeriodParameter_MP().Update( rollto, periodspecification, false, false );
|
}
|
else if ( step = 1 )
|
{
|
this.HandlePostPeriodRollPeriodTaskOperations();
|
}
|
else if ( step = 2 )
|
{
|
this.HandlePostPeriodRollSalesDemands();
|
this.HandlePostPeriodRollGlobalParameters();
|
}
|
else if ( step = 3 )
|
{
|
// Clean up
|
this.DeleteObsoletePeriodAndCleanObsoletePeriodTasks();
|
this.IsRollingPeriod( false );
|
this.CleanUpActuals();
|
}
|
this.UpdateLastPlanningAction( false, false, true, false ); // isReset, isPlan, isRoll, isLockUnlock
|
return step = 3 or stopcondition;
|
*]
|
}
|