| Quintiq file version 2.0 | 
| #parent: #root | 
| Method GetLastSmartPlanSettings ( | 
|   Boolean issmartplanforperiodtask, | 
|   output Boolean isoverridelockedplanning_o, | 
|   output Boolean isupstream_o, | 
|   output Boolean ismiddleoutsmartplan_o, | 
|   output Boolean isonlyplanonestepupstream_o, | 
|   output Boolean isusingselectedunits_o | 
| ) | 
| { | 
|   Description: 'Returns the smart plan settings from the latest smart plan run' | 
|   TextBody: | 
|   [* | 
|     // Martijn Feb-23-2017 (created) | 
|     algorithmrun := maxselect( this,  | 
|                                TempAlgorithmRunStore.AlgorithmRun,  | 
|                                run, | 
|                                run.IsSmartPlan()  | 
|                                and not run.IsSmartPlanForPeriodTask(), | 
|                                run.SequenceNr() ) | 
|      | 
|     // If no smart plan algorithm run exists, we use the default settings | 
|     isoverridelockedplanning_o := guard( algorithmrun.HasOverwrittenManualPlanning(), false ); | 
|     isupstream_o := guard( algorithmrun.IsUpstreamSmartPlan(), true ); | 
|     // If the previous smart plan run was an upstream smart plan run and the run before that was a middleout smart plan run, | 
|     // then the previous smart plan run was the 2nd step of a middle out smart plan | 
|     ismiddleoutsmartplan_o := guard( algorithmrun.IsUpstreamSmartPlan() and algorithmrun.Previous().IsMiddleOutSmartPlan(), false ); | 
|     isonlyplanonestepupstream_o := guard( algorithmrun.IsOnlyPlanOneStepUpstream(), false ); | 
|     isusingselectedunits_o := guard( algorithmrun.IsUsingSelectedUnits(), false ); | 
|   *] | 
|   InterfaceProperties { Accessibility: 'Module' } | 
| } |