lazhen
2025-01-09 8afe90b633046db39042aada36b88193062f8cff
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
34
Quintiq file version 2.0
#parent: #root
Method StartAfterPreprocessing (Boolean canstart, LibOpt_SnapshotOptimizerRunController snapshotruncontroller) as stream[JSON]
{
  Description:
  [*
    If the `LibOpt_OptimizerRunController` gives approval to start the run, then this method calls `StartAfterPreprocessing` to start the `LibOpt_Run`.
    
    This method creates a snapshot if the `LibOpt_Run` was aborted while it was waiting for approval from the `LibOpt_OptimizerRunController`.
  *]
  TextBody:
  [*
    result := null( stream[JSON] );
    
    // While unlikely, a run can be aborted after the optimizer gave approval to start the run, but before this method is called. 
    // So we include not this.IsAborted() to ensure that the run isn't accidentially started anyway.
    if( canstart and not this.IsAborted() )
    {
      snapshotruncontroller.StartedOn( DateTime::Now() );
      result := this.StartAfterPreprocessing();
    }
    else
    {
      this.Stop();
      LibOpt_SnapshotWarning::Throw( this, 
                                     snapshotruncontroller,
                                     Translations::LibOpt_OptimizerRunController_WarningAbortedWhileRequested(), 
                                     LibOpt_Issue::Severity_2_Low() );
    }
    
    return result;
  *]
  InterfaceProperties { Accessibility: 'Module' }
}