Quintiq file version 2.0
|
#parent: #root
|
Method MergeSalesDemands (
|
LibOpt_Scope scope,
|
ProductInStockingPointInPeriodPlannings pispipsinrun
|
)
|
{
|
TextBody:
|
[*
|
pispipsforoptimization := selectset( pispipsinrun, Elements.astype( ProductInStockingPointInPeriodPlanningLeaf ), pispip, true );
|
bsdips := ProductInStockingPointInPeriodPlanningLeaf::GetPostponedSalesDemandForMerge( pispipsforoptimization, false ); // Merge only optimizer postponed sales demands. No un-merging if optimizer fails
|
//Propagate quantity after merging sales demand
|
traverse( bsdips, Elements, postponedsd )
|
{
|
pispip := postponedsd.ProductInStockingPointInPeriodPlanning();
|
// only deleted postponed sd if both the pispip and the pispip of the original sales demand are in scope. If the original sd is not in scope the postponed sd is kept as is (no replan).
|
if ( scope.Contains( pispip.PISPIPInOptimizerRun() )
|
and scope.Contains( postponedsd.OriginalSalesDemand().ProductInStockingPointInPeriodPlanning().PISPIPInOptimizerRun() ) )
|
{
|
postponedsd.Delete();
|
}
|
}
|
|
// Merge sales demands from before the horizon
|
traverse( scope.GetSDIPBeforeScopeInRun(), Elements.astype( LeafSalesDemandInPeriod ), lsdip )
|
{
|
traverse( lsdip, PostponedSalesDemand, postponedsd,
|
not postponedsd.IsManuallyPostponed()
|
and scope.Contains( postponedsd.ProductInStockingPointInPeriodPlanning().PISPIPInOptimizerRun() ) )
|
{
|
postponedsd.Delete();
|
}
|
}
|
|
traverse( scope.GetSDIPBeforeScopeInRun(), Elements.astype( AggregatedSalesDemandInPeriod ), asdip )
|
{
|
traverse( asdip, DisaggregatedSalesDemandInPeriod.PostponedSalesDemand, postponedsd,
|
not postponedsd.IsManuallyPostponed()
|
and scope.Contains( postponedsd.ProductInStockingPointInPeriodPlanning().PISPIPInOptimizerRun() ) )
|
{
|
postponedsd.Delete();
|
}
|
}
|
*]
|
InterfaceProperties { Accessibility: 'Module' }
|
}
|