Kevin Kok Khah Whey
2023-11-07 5ae534ab606e6f2ba5ea60914224d665b0447d5a
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: '[137862.0.112808159]'
  Body:
  [*
    // runs the optimizer based on last selected options
    
    isUsingSelectedUnits := CheckboxIsSelectedUnits.Checked();
    units :=  DataHolderSelectedUnitsForSmartPlan.Data();
    run := MacroPlan.Optimization().GetLastRegularAlgorithmRun();
    issmartplan := true;
    issmartplanforperiodtask := false;
    isupstreamsmartplan := RadioButtonGroupSmartPlanDirection.BoundValue() = SmartPlanSetting::Upstream();
    ismiddleoutsmartplan := RadioButtonGroupSmartPlanDirection.BoundValue() = SmartPlanSetting::MiddleOut();
    totalsupplyuser := 0.0;
    if( hastotalsupplyuser )
    {
      totalsupplyuser := ApplicationMacroPlanner.FormatStringToReal( EditFieldTotalSupply.Text() );
    }
    
    strategy := DropDownListStrategy.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 );
    
    
    //YY: TODO 
    //Undo after caling job
    //Application.RemoveHistory();
  *]
}