yypsybs
2023-10-10 550ebcf02217f8a0c6fe9001fcfa8e42e9cd6b83
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
44
45
46
47
48
49
50
51
52
53
54
55
Quintiq file version 2.0
#parent: #root
Method RunOptimizer (
  structured[ProductInStockingPointInPeriodPlanning] smartplanpispips,
  Boolean hastotalsupplyuser,
  Boolean isonlyplanonestepupstream,
  Boolean isoverwritemanual
) id:Method_DialogSmartPlan_RunOptimizer
{
  #keys: '[122872.1.872833979]'
  Body:
  [*
    // runs the optimizer based on last selected options
    
    isUsingSelectedUnits := CheckBoxIsSelectedUnits.Checked();
    units := DataHolderSelectedUnitsForSmartPlan.Data()
    run := MacroPlan.GetLastAlgorithmRun();
    issmartplan := true;
    issmartplanforperiodtask := false;
    isupstreamsmartplan := RadioButtonGroupUpstreamDownstream.BoundValue() = SmartPlanSetting::Upstream();
    ismiddleoutsmartplan := RadioButtonGroupUpstreamDownstream.BoundValue() = SmartPlanSetting::MiddleOut();
    totalsupplyuser := 0.0;
    if( hastotalsupplyuser )
    {
      totalsupplyuser := ApplicationLibMacroPlanner.FormatStringToReal( EditorTotalSupply.Text() );
    }
    strategy := SelectionStrategy.Data();
    
    periodstart := MacroPlan.FirstPlanningPeriod();
    periodend := MacroPlan.LastPlanningPeriod();
    AlgorithmRun::GetLastOptimizationHorizon( run, MacroPlan, periodstart, periodend );
    
    MacroPlan.RunSmartPlan( issmartplan,
                            issmartplanforperiodtask,
                            smartplanpispips,
                            hastotalsupplyuser,
                            totalsupplyuser,
                            isupstreamsmartplan,
                            ismiddleoutsmartplan,
                            isonlyplanonestepupstream,
                            strategy,
                            isoverwritemanual,
                            periodstart,
                            periodend,
                            isUsingSelectedUnits,
                            units,
                            null( Process_MP ), 
                            false );
    
    if ( not MacroPlan.GlobalParameters_MP().RunSmartPlanSynchronously() ) 
    {
      Application.RemoveHistory();
    }
  *]
}