haorenhui
2023-10-30 6d6cc10d9e8e242661da7fd655dec155a09d676c
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
56
57
58
59
60
61
62
Quintiq file version 2.0
#parent: Toolbar/btnOk
Response OnClick () id:Response_Toolbar_btnOk_OnClick
{
  #keys: '[11660.0.771099266]'
  Body:
  [*
    // Run algorithm
    // Running the optimizer asynchronous after copy the optimizer setting from scenario manager
    issmartplan := false;
    issmartplanperiodtask := false; 
    hastotalsupplyuser := false;
    totalsupplyuser := 0.0;
    smartplanpispip := null( ProductInStockingPointInPeriodPlannings );
    forcenoautoscaling := false; 
    isupstreamsmartplan := false;
    ismiddleoutsmartplan := false;
    isonlyplanonestepupstream := false;
    ispostprocessing := false;
    isusingselectedunits := false;
    units := null( Units );
    
    MacroPlan.RunOptimizer( issmartplan,                                           // FIX for time being call into this -- replace by call into meta mip
                            issmartplanperiodtask, 
                            hastotalsupplyuser,
                            totalsupplyuser,
                            smartplanpispip,
                            isupstreamsmartplan,
                            ismiddleoutsmartplan,
                            isonlyplanonestepupstream,
                            ispostprocessing,
                            forcenoautoscaling, 
                            Dialog.SelectionStrategy().Data(),
                            Dialog.CheckBoxOverrideManualPlanning().Checked(),
                            Dialog.SelectionPeriodFrom().Data(),
                            Dialog.SelectionPeriodTo().Data(),
                            false,
                            isusingselectedunits,
                            units,  // IsInventoryOptimizationRun 
                            null( Process_MP ),
                            SelectionOptimizerPuzzle.Data() ); // OptimizerPuzzle, used to change the last puzzle used
    
    Application.RemoveHistory();
    
    Dialog.Close();
  *]
  DefinitionID: 'Responsedef_GUIButtonBase_OnClick'
  Precondition:
  [*
    activescenario := DataHolderActiveScenario.Data();
    return not ScenarioManager::HasOptimizerRun( ScenarioManager, activescenario, feedback )
           and MacroPlan.CanPlan( feedback )
           and ScenarioManager::HasCapacityForMaximumNumberofConcurrentRuns( ScenarioManager, activescenario, true, feedback )
           and AlgorithmRun::ValidateInputSelectOptimizer( feedback,
                                                           SelectionOptimizerPuzzle.Data(),
                                                           SelectionStrategy.Data(),
                                                           SelectionPeriodFrom.Data(),
                                                           SelectionPeriodTo.Data(),
                                                           MacroPlan, false );  //iswebapp = FALSE
  *]
  UserRequiresReadWrite: true
}