yanweiyuan3
2023-08-09 588bc7829387dfc761cc25f06f77d4c81818bd10
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
Quintiq file version 2.0
#parent: #root
Method SmartPlanSetFinalRunRelations (
  Boolean isupstream,
  LibOpt_Scope scope,
  RunContextForCapacityPlanning runcontext
)
{
  Description: 'set relations to algorithmrun object of sub puzzle'
  TextBody:
  [*
    // If an operation has multiple outputs, we need to make sure the pispips of all those outputs are in the optimizer run
    if( isupstream )
    {
      traverse( scope.GetPeriodTaskOperationInOptimizerRun(), Elements.NewSupply.ProductInStockingPointInPeriodPlanningLeaf, nspispip,
                not scope.Contains(  nspispip.PISPIPInOptimizerRun() ) )
      {
        scope.Add( nspispip ); 
      }
    }
    else
    // If an operation has multiple inputs, we need to make sure the pispips of all those outputs are in the optimizer run
    {
      Transaction::Transaction().Propagate( relation( PeriodTaskOperation, DependentDemand ) ); // smart plan creates the PeriodTaskOperation object - so we need to make sure the relation is set
      traverse( scope.GetPeriodTaskOperationInOptimizerRun(), Elements.DependentDemand.ProductInStockingPointInPeriodPlanningLeaf, ddpispip,
                not scope.Contains( ddpispip.PISPIPInOptimizerRun() ) )
      {
        scope.Add( ddpispip ); 
      }
    }
  *]
  InterfaceProperties { Accessibility: 'Module' }
}