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
Quintiq file version 2.0
#parent: #root
Method GetLatestPISPIPInScope (
  const LibOpt_Scope scope
) const as const ProductInStockingPointInPeriodPlanningLeaf
{
  TextBody:
  [*
    // pre condition: 'this' itself is not in scope
    // returns:  1st pispip < current pispip that is in scope
    value := constnull( ProductInStockingPointInPeriodPlanningLeaf );
    pisp := this.ProductInStockingPoint_MP(); 
    latestpispip := pisp.LatestPISPIPInScope(); 
    assert( scope.Contains( this.StockingPointInPeriod().SPIPInOptimizerRun() ), 'SPIP not in scope while calling for latest pispip in scope' ); 
    if ( not isnull( latestpispip ) 
         and latestpispip.Start() < this.Start() ) // scopes have no gaps wrt pispips - so if the latest pispip is after 'this' and 'this itself is not in scope the entire block in scope is after 'this' 
    {                                              // so in that case there is nothing in scope before 'this'
      value := latestpispip.astype( ProductInStockingPointInPeriodPlanningLeaf ); 
    }
    return value;
  *]
  InterfaceProperties { Accessibility: 'Module' }
}