Quintiq file version 2.0
|
#parent: #root
|
Method ResetPeriodTasksAndResetKPI (
|
Boolean resetmanual,
|
Boolean resetoptimizer,
|
OptimizerPuzzle optimizerpuzzle,
|
Date unplanafterstart
|
)
|
{
|
Description: 'Reset period tasks and update KPI'
|
TextBody:
|
[*
|
// FrozenPeriod moves to Unit level
|
// During reset, to traverse all active LeadingPeriod, then only filter out frozen PT
|
|
// Handleing case null( OptimizerPuzzle )
|
if( isnull( optimizerpuzzle ) )
|
{
|
optimizerpuzzle := this.OptimizerPuzzleWorld();
|
}
|
|
// Use the logic used by the dialog to create all subsets
|
// Populate the IsInclduedFinal
|
// We get the 100% correct result for unit, product, stocking point
|
|
// Getting list of included units / included products / included stockingpoint
|
// Prevent from calling GetIncludedUnits multiple times
|
includedUnits := optimizerpuzzle.GetIncludedUnits();
|
includedProducts := optimizerpuzzle.GetIncludedProducts();
|
includedStockingPoint := optimizerpuzzle.GetIncludedStockingPoints( includedUnits );
|
includedPISP := optimizerpuzzle.GetIncludedPISP( includedProducts, includedStockingPoint );
|
|
// Reset PeriodTasks
|
// Get routings with Operations and pisps included in the optimizer puzzle scope
|
routings := optimizerpuzzle.GetIncludedRoutings( includedUnits, includedPISP );
|
|
// Traverse in scope routings in order to reset PeriodTask operation not frozen
|
traverse( routings, Elements, routing )
|
{
|
routing.ResetRouting( resetmanual, resetoptimizer, unplanafterstart );
|
}
|
|
// Reset Trips
|
// Get process Laneleg in optimizer puzzle scope ( Unit, destination StockingPoint_MP in scope )
|
processesLaneleg := optimizerpuzzle.GetIncludedLaneLegs( includedUnits, includedPISP );
|
|
// Reset products in trips only if the product in trip is in scope ( Product_MP in scope )
|
traverse( processesLaneleg, Elements.Trip.ProductInTrip, pit, optimizerpuzzle.IsProductIncluded( pit.Product_MP(), includedProducts ) and pit.Trip().Departure().Date() >= unplanafterstart )
|
{
|
pit.ResetProductInTrip( resetmanual, resetoptimizer );
|
}
|
|
|
// Some pispips do not have new supply and period task due to pre & post-processing time.
|
traverse( this, Unit.Process_MP.ProcessOutput.ProductInStockingPoint_MP, pisp, pisp.IsLeaf() )
|
{
|
traverse( pisp, ProductInStockingPointInPeriodPlanning.astype( ProductInStockingPointInPeriodPlanningLeaf ), p, not p.IsPeriodFrozen() and p.Start().Date() >= unplanafterstart )
|
{
|
if( p.NewSupply( relsize ) = 0 )
|
{
|
p.ResetQuantitySetByOptimizer();
|
}
|
|
p.MergeSalesDemand( resetmanual )
|
}
|
}
|
|
if( resetmanual )
|
{
|
traverse( this, Period_MP.ProductInStockingPointInPeriod, pispip, pispip.Start().Date() >= unplanafterstart )
|
{
|
pispip.UpdateTotalSupplyUser( false, 0.0 );
|
pispip.UpdateTotalAvailableSupplyUser( false, 0.0 );
|
}
|
}
|
|
// Remove pegging
|
this.RemovePegging( resetmanual, resetoptimizer );
|
|
// Calculate KPI Score
|
this.CalculateKPIScore( false );
|
|
this.UpdateLastPlanningAction( true, false, false, false ); // isReset, isPlan, isRoll, isLockUnlock
|
|
// Change lastUsedReset OptimizerPuzzle
|
if( not isnull( optimizerpuzzle ) )
|
{
|
optimizerpuzzle.ChangeLastUsedResetPuzzle();
|
}
|
*]
|
InterfaceProperties { Accessibility: 'Extensible' }
|
}
|