| Quintiq file version 2.0 | 
| #parent: #root | 
| StaticMethod UpdateFirstLastPISPIP ( | 
|   ProductInStockingPoint_MP pisp, | 
|   Period_MP firstperiod, | 
|   Period_MP lastperiod | 
| ) | 
| { | 
|   TextBody: | 
|   [* | 
|     /* | 
|     firstpispip := select(  pisp, ProductInStockingPointInPeriodPlanning, pispip, true, pispip.Period_MP() = firstperiod ).astype( ProductInStockingPointInPeriodPlanningLeaf );  | 
|     lastpispip := select(  pisp, ProductInStockingPointInPeriodPlanning, pispip, true, pispip.Period_MP() = lastperiod ).astype( ProductInStockingPointInPeriodPlanningLeaf );  | 
|      | 
|      | 
|     pisp.FirstPISPIPRectangleMeta( relset, firstpispip );  | 
|     pisp.LastPISPIPRectangleMeta( relset, lastpispip );  | 
|     if ( isnull( firstpispip ) or isnull( lastpispip ) )  | 
|     { | 
|       debuginfo(  firstperiod.Start(), firstperiod.End(), firstperiod.IsPlanning() );  | 
|       debuginfo(  lastperiod.Start(), lastperiod.End(), lastperiod.IsPlanning() );  | 
|       debuginfo(  pisp.Name() );  | 
|      | 
|       debuginfo(  guard( [String]firstpispip.Key(), 'null key' ), guard( [String]lastpispip.Key(), 'null key' ) );  | 
|     } | 
|      | 
|     */ | 
|      | 
|     firstpispip := pisp.FirstPlanningPISPIP();  | 
|     first := firstperiod.Start();  | 
|     while(  not isnull( firstpispip ) and firstpispip.Start() < first )  | 
|     { | 
|       firstpispip := firstpispip.NextPlanningPISPIP();  | 
|     } | 
|     firstp := firstpispip.astype( ProductInStockingPointInPeriodPlanningLeaf );  | 
|      | 
|     lastpispip := pisp.LastPlanningPISPIP();  | 
|     last := lastperiod.Start();  | 
|     while(  not isnull( lastpispip ) and lastpispip.Start() > last )  | 
|     { | 
|       lastpispip := lastpispip.PreviousPlanningPISPIP();  | 
|     } | 
|     lastp := lastpispip.astype(  ProductInStockingPointInPeriodPlanningLeaf );  | 
|      | 
|     pisp.FirstPISPIPRectangleMeta( relset, firstp );  | 
|     pisp.LastPISPIPRectangleMeta( relset, lastp ); | 
|     if ( isnull( firstp) or isnull( lastp ) )  | 
|     { | 
|       debuginfo(  guard( [String]firstpispip.Key(), 'null key' ), guard( [String]lastpispip.Key(), 'null key' ) );  | 
|       debuginfo( 'firstp null=', isnull( firstp), 'lastp null=', isnull( lastp ) );  | 
|     } | 
|   *] | 
|   InterfaceProperties { Accessibility: 'Module' } | 
| } |