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 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' }
}