chenqinghong
2024-05-07 3ec06a830367465068963156dcc1d8e522571c13
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
Quintiq file version 2.0
#parent: #root
Method PTF_TestLaunchOptimizer (
  output Real duration,
  output String response,
  String strategystr,
  String optimizerstr,
  String starttime,
  String endtime
) as Boolean id:Method_LibPTF_pnlTestRunner_PTF_TestLaunchOptimizer
{
  #keys: '[136682.0.314444061]'
  Body:
  [*
    return true; 
    /* DISABLED mjn3 
    
    issuccessful := false;
    
    // get all the relevent data to run optimizer
    // this was take out from the startprecisionctr to prevent the data retrieve take too long
    // since this test only tested on the performance of run optimizer not data retrieve
    
    strategy := select( ScenarioManager, Strategy, str, str.Name() = strategystr );
    MacroPlan.DuplicateStrategySettings( strategy, false );
    
    periodstart := null( Period_MP );
    periodend := null( Period_MP );
    
    convert := StringToDateTime::StandardConverter();
    convert.SetCustomConversion();
    convert.CustomFormatString( 'dd-MMM-yyyy' );
    
    if( convert.CanConvert( starttime ) and convert.CanConvert( endtime ) )
    {
      startdatetime := convert.Convert( starttime );
      enddatetime := convert.Convert( endtime );
      periodstart := maxselect( MacroPlan, Period_MP, p, p.Start() <= startdatetime, p.Start() );
      periodend := minselect( MacroPlan, Period_MP, p, p.End() >= enddatetime, p.End() );
    }
    
    preconditionflag := not isnull( strategy )
                        and not isnull( periodstart )
                        and not isnull( periodend ); // Your precondition before executing the action
    
    if( preconditionflag )
    {
      startprecisionctr := OS::PrecisionCounter();
      this.PTF_ExecutePreAsyncAction();
    
      isautotunecopy := false;
      hasautotunecopy := false;
      issmartplan := false;
      issmartplanforperiodtask := false;
      hastotalsupplyuser := false;
      totalsupplyuser := 0.0;
      isupstreamsmartplan := false;
      ismiddleoutsmartplan := false;
      isonlyplanonestepupstream := false;
      isforcenoautoscaling := false;
      ispostprocessing := false;
      isoverridelockedplanning := true;
      smartplanpispips := null( ProductInStockingPointInPeriodPlannings );
      isinventoryoptimization := false;
      isusingselectedunits := false;
      units := null( Units );
    
      MacroPlan.Algorithm().SynchronizeAllConstraintScaleType();
      MacroPlan.Algorithm().AlgorithmParameter().Update( issmartplan,
                                                         issmartplanforperiodtask,
                                                         hastotalsupplyuser,
                                                         totalsupplyuser,
                                                         isupstreamsmartplan,
                                                         ismiddleoutsmartplan,
                                                         isonlyplanonestepupstream,
                                                         ispostprocessing,
                                                         isforcenoautoscaling,
                                                         isoverridelockedplanning,
                                                         isinventoryoptimization,
                                                         isusingselectedunits, 
                                                         false );
    
    
      MacroPlan.UpdateParameters( isautotunecopy, hasautotunecopy,
                                  smartplanpispips,
                                  MacroPlan.StrategyMacroPlan(),
                                  ScenarioManager, 
                                  periodstart,
                                  periodend );
    
      smartplanpispip := null( ProductInStockingPointInPeriodPlannings );
      this.PTF_GetMPPTFLibrary().MacroPlan().RunCapacityPlanningAlgorithm( smartplanpispip, periodstart, periodend, units, null( Process_MP) );
      //12570
      //this.PTF_GetMPPTFLibrary().MacroPlan().RunOptimizer( strategy, param, true, periodstart, periodend,
      //                                                    true, null( Units ), true, null( ProductInStockingPoint_MPs ), false );
    
      duration   := this.PTF_GetDurationInMilisecond( startprecisionctr );
      response   := 'Launch Optimizer' ;
      issuccessful := true;
    }
    else
    {
      response := 'PTF_TestCreateData: Precondition failed because < input value not correct >'; // Your precondition failed reason
    }
    
    return issuccessful;
  *]
}