yanweiyuan3
2023-10-27 d1d15b61dfcf7fd0f800b32359f082cf580ed556
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
35
36
37
38
39
40
41
42
43
Quintiq file version 2.0
#parent: #root
Method InitializeDialog (
  Strategy lastusedstrategy
) id:Method_DialogRunOptimizer_InitializeDialog
{
  #keys: '[136682.0.2060597919]'
  Body:
  [*
    // Set default values for components
    run := MacroPlan.Optimization().GetLastRegularAlgorithmRun();
    
    // Initialize dialog
    DropDownListStrategy.Data( lastusedstrategy );
    
    // Initialize dropdown puzzle
    Form.InitializeDropdownPuzzle();
    
    run := MacroPlan.Optimization().GetLastRegularAlgorithmRun();
    CheckboxOverrideManualPlan.Checked( guard( run.HasOverwrittenManualPlanning(), false ) );
    
    // Initialize periods
    // Set the default planning start and end
    feedback := '';
    if( Period_MP::HasPeriod( feedback, MacroPlan ) )
    {
      Form.SetDefaultPlanningStartAndEnd();
      
      // Prevent the usage of last optimizer start if it is historical
      if( not isnull( run )
          and MacroPlan.StartOfPlanningPeriod().Start() <= run.PeriodFirstStart() )
      {
        // Using bound value is not working as expected
        periodstart := select( MacroPlan, PlanningPeriod, p, p.Start() = run.PeriodFirstStart() );
        periodend := select( MacroPlan, PlanningPeriod, p, p.PeriodEnd() = run.PeriodLastEnd() );
        DropDownListPeriodsFrom.Data( periodstart );
        DropDownListPeriodsTo.Data( periodend );
      }
    }
    
    Form.ShowPopup();
  *]
}