@@ -3,34 +3,34 @@ |
||
3 | 3 | |
4 | 4 | class ActivityTypes |
5 | 5 | { |
6 | - const AREA_REMOVED = 'area-removed'; |
|
7 | - const AREA_ADDED = 'area-added'; |
|
8 | - const AREA_UPDATED = 'area-updated'; |
|
9 | - const DELETE_DESTINATION = 'delete-destination'; |
|
10 | - const INSERT_DESTINATION = 'insert-destination'; |
|
11 | - const DESTINATION_OUT_SEQUENCE = 'destination-out-sequence'; |
|
12 | - const DRIVER_ARRIVED_EARLY = 'driver-arrived-early'; |
|
13 | - const DRIVER_ARRIVED_LATE = 'driver-arrived-late'; |
|
14 | - const DRIVER_ARRIVED_ON_TIME = 'driver-arrived-on-time'; |
|
15 | - const GEOFENCE_LEFT = 'geofence-left'; |
|
16 | - const GEOFENCE_ENTERED = 'geofence-entered'; |
|
17 | - const MARK_DESTINATION_DEPARTED = 'mark-destination-departed'; |
|
18 | - const MARK_DESTINATION_VISITED = 'mark-destination-visited'; |
|
19 | - const MEMBER_CREATED = 'member-created'; |
|
20 | - const MEMBER_DELETED = 'member-deleted'; |
|
21 | - const MEMBER_MODIFIED = 'member-modified'; |
|
22 | - const MOVE_DESTINATION = 'move-destination'; |
|
23 | - const NOTE_INSERT = 'note-insert'; |
|
24 | - const ROUTE_DELETE = 'route-delete'; |
|
25 | - const ROUTE_OPTIMIZED = 'route-optimized'; |
|
26 | - const ROUTE_OWNER_CHANGED = 'route-owner-changed'; |
|
27 | - const ROUTE_DUPLICATE = 'route-duplicate'; |
|
28 | - const UPDATE_DESTINATIONS = 'update-destinations'; |
|
29 | - const USER_MESSAGE = 'user_message'; |
|
6 | + const AREA_REMOVED = 'area-removed'; |
|
7 | + const AREA_ADDED = 'area-added'; |
|
8 | + const AREA_UPDATED = 'area-updated'; |
|
9 | + const DELETE_DESTINATION = 'delete-destination'; |
|
10 | + const INSERT_DESTINATION = 'insert-destination'; |
|
11 | + const DESTINATION_OUT_SEQUENCE = 'destination-out-sequence'; |
|
12 | + const DRIVER_ARRIVED_EARLY = 'driver-arrived-early'; |
|
13 | + const DRIVER_ARRIVED_LATE = 'driver-arrived-late'; |
|
14 | + const DRIVER_ARRIVED_ON_TIME = 'driver-arrived-on-time'; |
|
15 | + const GEOFENCE_LEFT = 'geofence-left'; |
|
16 | + const GEOFENCE_ENTERED = 'geofence-entered'; |
|
17 | + const MARK_DESTINATION_DEPARTED = 'mark-destination-departed'; |
|
18 | + const MARK_DESTINATION_VISITED = 'mark-destination-visited'; |
|
19 | + const MEMBER_CREATED = 'member-created'; |
|
20 | + const MEMBER_DELETED = 'member-deleted'; |
|
21 | + const MEMBER_MODIFIED = 'member-modified'; |
|
22 | + const MOVE_DESTINATION = 'move-destination'; |
|
23 | + const NOTE_INSERT = 'note-insert'; |
|
24 | + const ROUTE_DELETE = 'route-delete'; |
|
25 | + const ROUTE_OPTIMIZED = 'route-optimized'; |
|
26 | + const ROUTE_OWNER_CHANGED = 'route-owner-changed'; |
|
27 | + const ROUTE_DUPLICATE = 'route-duplicate'; |
|
28 | + const UPDATE_DESTINATIONS = 'update-destinations'; |
|
29 | + const USER_MESSAGE = 'user_message'; |
|
30 | 30 | |
31 | - static function getConstants() { |
|
32 | - $atc = new \ReflectionClass('Route4Me\\Enum\\ActivityTypes'); |
|
33 | - return $atc->getConstants(); |
|
34 | - } |
|
31 | + static function getConstants() { |
|
32 | + $atc = new \ReflectionClass('Route4Me\\Enum\\ActivityTypes'); |
|
33 | + return $atc->getConstants(); |
|
34 | + } |
|
35 | 35 | } |
36 | 36 |
@@ -3,9 +3,9 @@ |
||
3 | 3 | |
4 | 4 | class TravelMode |
5 | 5 | { |
6 | - const DRIVING = 'Driving'; |
|
7 | - const WALKING = 'Walking'; |
|
8 | - const TRUCKING = 'Trucking'; |
|
9 | - const CYCLING = 'Cycling'; |
|
10 | - const TRANSIT = 'Transit'; |
|
6 | + const DRIVING = 'Driving'; |
|
7 | + const WALKING = 'Walking'; |
|
8 | + const TRUCKING = 'Trucking'; |
|
9 | + const CYCLING = 'Cycling'; |
|
10 | + const TRANSIT = 'Transit'; |
|
11 | 11 | } |
@@ -3,26 +3,26 @@ |
||
3 | 3 | |
4 | 4 | class StatusUpdateType |
5 | 5 | { |
6 | - const PICKUP = 'pickup'; |
|
7 | - const DROPOFF = 'dropoff'; |
|
8 | - const NOANSWER = 'noanswer'; |
|
9 | - const NOTFOUND = 'notfound'; |
|
10 | - const NOTPAID = 'notpaid'; |
|
11 | - const PAID = 'paid'; |
|
12 | - const WRONGDELIVERY = 'wrongdelivery'; |
|
13 | - const WRONGADDRESSRECIPIENT = 'wrongaddressrecipient'; |
|
14 | - const NOTPRESENT = 'notpresent'; |
|
15 | - const PARTS_MISSING = 'parts_missing'; |
|
16 | - const SERVICE_RENDERED = 'service_rendered'; |
|
17 | - const FOLLOW_UP = 'follow_up'; |
|
18 | - const LEFT_INFORMATION = 'left_information'; |
|
19 | - const SPOKE_WITH_DECISION_MAKER = 'spoke_with_decision_maker'; |
|
20 | - const SPOKE_WITH_DECISION_INFLUENCER = 'spoke_with_decision_influencer'; |
|
21 | - const SPOKE_WITH_DECISION_INFLUENCER = 'spoke_with_decision_influencer'; |
|
22 | - const COMPETITIVE_ACCOUNT = 'competitive_account'; |
|
23 | - const SCHEDULED_FOLLOW_UP_MEETING = 'scheduled_follow_up_meeting'; |
|
24 | - const SCHEDULED_LUNCH = 'scheduled_lunch'; |
|
25 | - const SCHEDULED_PRODUCT_DEMO = 'scheduled_product_demo'; |
|
26 | - const SCHEDULED_CLINICAL_DEMO = 'scheduled_clinical_demo'; |
|
27 | - const NO_OPPORTUNITY = 'no_opportunity'; |
|
6 | + const PICKUP = 'pickup'; |
|
7 | + const DROPOFF = 'dropoff'; |
|
8 | + const NOANSWER = 'noanswer'; |
|
9 | + const NOTFOUND = 'notfound'; |
|
10 | + const NOTPAID = 'notpaid'; |
|
11 | + const PAID = 'paid'; |
|
12 | + const WRONGDELIVERY = 'wrongdelivery'; |
|
13 | + const WRONGADDRESSRECIPIENT = 'wrongaddressrecipient'; |
|
14 | + const NOTPRESENT = 'notpresent'; |
|
15 | + const PARTS_MISSING = 'parts_missing'; |
|
16 | + const SERVICE_RENDERED = 'service_rendered'; |
|
17 | + const FOLLOW_UP = 'follow_up'; |
|
18 | + const LEFT_INFORMATION = 'left_information'; |
|
19 | + const SPOKE_WITH_DECISION_MAKER = 'spoke_with_decision_maker'; |
|
20 | + const SPOKE_WITH_DECISION_INFLUENCER = 'spoke_with_decision_influencer'; |
|
21 | + const SPOKE_WITH_DECISION_INFLUENCER = 'spoke_with_decision_influencer'; |
|
22 | + const COMPETITIVE_ACCOUNT = 'competitive_account'; |
|
23 | + const SCHEDULED_FOLLOW_UP_MEETING = 'scheduled_follow_up_meeting'; |
|
24 | + const SCHEDULED_LUNCH = 'scheduled_lunch'; |
|
25 | + const SCHEDULED_PRODUCT_DEMO = 'scheduled_product_demo'; |
|
26 | + const SCHEDULED_CLINICAL_DEMO = 'scheduled_clinical_demo'; |
|
27 | + const NO_OPPORTUNITY = 'no_opportunity'; |
|
28 | 28 | } |
@@ -3,7 +3,7 @@ |
||
3 | 3 | |
4 | 4 | class OptimizationType |
5 | 5 | { |
6 | - const DISTANCE = 'Distance'; |
|
7 | - const TIME = 'Time'; |
|
8 | - const TIME_WITH_TRAFFIC = 'timeWithTraffic'; |
|
6 | + const DISTANCE = 'Distance'; |
|
7 | + const TIME = 'Time'; |
|
8 | + const TIME_WITH_TRAFFIC = 'timeWithTraffic'; |
|
9 | 9 | } |
@@ -3,10 +3,10 @@ |
||
3 | 3 | |
4 | 4 | class OptimizationStates |
5 | 5 | { |
6 | - const INITIAL = 1; |
|
7 | - const MATRIX_PROCESSING = 2; |
|
8 | - const OPTIMIZING = 3; |
|
9 | - const OPTIMIZED = 4; |
|
10 | - const ERROR = 5; |
|
11 | - const COMPUTING_DIRECTIONS = 6; |
|
6 | + const INITIAL = 1; |
|
7 | + const MATRIX_PROCESSING = 2; |
|
8 | + const OPTIMIZING = 3; |
|
9 | + const OPTIMIZED = 4; |
|
10 | + const ERROR = 5; |
|
11 | + const COMPUTING_DIRECTIONS = 6; |
|
12 | 12 | } |
@@ -3,7 +3,7 @@ |
||
3 | 3 | |
4 | 4 | class TerritoryTypes |
5 | 5 | { |
6 | - const CIRCLE = 'circle'; |
|
7 | - const POLY = 'poly'; |
|
8 | - const RECT = 'rect'; |
|
6 | + const CIRCLE = 'circle'; |
|
7 | + const POLY = 'poly'; |
|
8 | + const RECT = 'rect'; |
|
9 | 9 | } |
@@ -14,8 +14,8 @@ discard block |
||
14 | 14 | Route4Me::setApiKey('11111111111111111111111111111111'); |
15 | 15 | |
16 | 16 | $activityParameters = ActivityParameters::fromArray(array( |
17 | - "limit" => 10, |
|
18 | - "offset" => 0 |
|
17 | + "limit" => 10, |
|
18 | + "offset" => 0 |
|
19 | 19 | )); |
20 | 20 | |
21 | 21 | $activities = new ActivityParameters(); |
@@ -23,6 +23,6 @@ discard block |
||
23 | 23 | $results = $activities->getValue($actresults, "results"); |
24 | 24 | |
25 | 25 | foreach ($results as $result) { |
26 | - Route4Me::simplePrint($result); |
|
27 | - echo "<br>"; |
|
26 | + Route4Me::simplePrint($result); |
|
27 | + echo "<br>"; |
|
28 | 28 | } |
@@ -16,9 +16,9 @@ discard block |
||
16 | 16 | Route4Me::setApiKey('11111111111111111111111111111111'); |
17 | 17 | |
18 | 18 | $activityParameters = ActivityParameters::fromArray(array( |
19 | - "limit" => 10, |
|
20 | - "offset" => 0, |
|
21 | - "start" => strtotime("-1 week") |
|
19 | + "limit" => 10, |
|
20 | + "offset" => 0, |
|
21 | + "start" => strtotime("-1 week") |
|
22 | 22 | )); |
23 | 23 | |
24 | 24 | $activities = new ActivityParameters(); |
@@ -26,6 +26,6 @@ discard block |
||
26 | 26 | $results = $activities->getValue($actresults, "results"); |
27 | 27 | |
28 | 28 | foreach ($results as $result) { |
29 | - Route4Me::simplePrint($result); |
|
30 | - echo "<br>"; |
|
29 | + Route4Me::simplePrint($result); |
|
30 | + echo "<br>"; |
|
31 | 31 | } |
@@ -44,21 +44,21 @@ discard block |
||
44 | 44 | $locationsFieldsMapping['monthly_nth_wwhat'] = 17; |
45 | 45 | |
46 | 46 | if (($handle = fopen("$source_file", "r"))!==FALSE) { |
47 | - $oAbook = new AddressBookLocation(); |
|
47 | + $oAbook = new AddressBookLocation(); |
|
48 | 48 | |
49 | - $results = $oAbook->addLocationsFromCsvFile($handle, $locationsFieldsMapping); |
|
49 | + $results = $oAbook->addLocationsFromCsvFile($handle, $locationsFieldsMapping); |
|
50 | 50 | |
51 | - echo "Errors: <br><br>"; |
|
51 | + echo "Errors: <br><br>"; |
|
52 | 52 | |
53 | - foreach ($results['fail'] as $evalue) { |
|
54 | - echo $evalue."<br>"; |
|
55 | - } |
|
53 | + foreach ($results['fail'] as $evalue) { |
|
54 | + echo $evalue."<br>"; |
|
55 | + } |
|
56 | 56 | |
57 | - echo "Successes: <br><br>"; |
|
57 | + echo "Successes: <br><br>"; |
|
58 | 58 | |
59 | - foreach ($results['success'] as $svalue) { |
|
60 | - echo $svalue."<br>"; |
|
61 | - } |
|
59 | + foreach ($results['success'] as $svalue) { |
|
60 | + echo $svalue."<br>"; |
|
61 | + } |
|
62 | 62 | } |
63 | 63 | |
64 | 64 | /* Add orders with schedules from a CSV file */ |
@@ -78,20 +78,20 @@ discard block |
||
78 | 78 | $ordersFieldsMapping['day_scheduled_for_YYMMDD'] = 8; |
79 | 79 | |
80 | 80 | if (($handle = fopen("$orders_file", "r"))!==FALSE) { |
81 | - $order = new Order(); |
|
82 | - $results = $order->addOrdersFromCsvFile($handle, $ordersFieldsMapping); |
|
81 | + $order = new Order(); |
|
82 | + $results = $order->addOrdersFromCsvFile($handle, $ordersFieldsMapping); |
|
83 | 83 | |
84 | - echo "Errors: <br><br>"; |
|
84 | + echo "Errors: <br><br>"; |
|
85 | 85 | |
86 | - foreach ($results['fail'] as $evalue) { |
|
87 | - echo $evalue."<br>"; |
|
88 | - } |
|
86 | + foreach ($results['fail'] as $evalue) { |
|
87 | + echo $evalue."<br>"; |
|
88 | + } |
|
89 | 89 | |
90 | - echo "Successes: <br><br>"; |
|
90 | + echo "Successes: <br><br>"; |
|
91 | 91 | |
92 | - foreach ($results['success'] as $svalue) { |
|
93 | - echo $svalue."<br>"; |
|
94 | - } |
|
92 | + foreach ($results['success'] as $svalue) { |
|
93 | + echo $svalue."<br>"; |
|
94 | + } |
|
95 | 95 | } |
96 | 96 | |
97 | 97 | /* Get Hybrid Optimization */ |
@@ -100,63 +100,63 @@ discard block |
||
100 | 100 | $sched_date = date("Y-m-d", $ep); |
101 | 101 | |
102 | 102 | $hybridParams = array( |
103 | - "target_date_string" => $sched_date, |
|
104 | - "timezone_offset_minutes" => 480 |
|
103 | + "target_date_string" => $sched_date, |
|
104 | + "timezone_offset_minutes" => 480 |
|
105 | 105 | ); |
106 | 106 | |
107 | 107 | $optimization = new OptimizationProblem(); |
108 | 108 | $hybridOptimization = $optimization->getHybridOptimization($hybridParams); |
109 | 109 | |
110 | 110 | if ($hybridOptimization!=null) { |
111 | - if (isset($hybridOptimization['optimization_problem_id'])) { |
|
112 | - $optid = $hybridOptimization['optimization_problem_id']; |
|
111 | + if (isset($hybridOptimization['optimization_problem_id'])) { |
|
112 | + $optid = $hybridOptimization['optimization_problem_id']; |
|
113 | 113 | |
114 | - echo "Hibrid optimization with optimization_problem_id = $optid <br><br>"; |
|
114 | + echo "Hibrid optimization with optimization_problem_id = $optid <br><br>"; |
|
115 | 115 | |
116 | - /* Add depots to the Hybrid Optimization */ |
|
117 | - $depotfile = "depots.csv"; |
|
116 | + /* Add depots to the Hybrid Optimization */ |
|
117 | + $depotfile = "depots.csv"; |
|
118 | 118 | |
119 | - if (($handle = fopen("$depotfile", "r"))!==FALSE) { |
|
120 | - $columns = fgetcsv($handle, $max_line_length, $delemietr); |
|
119 | + if (($handle = fopen("$depotfile", "r"))!==FALSE) { |
|
120 | + $columns = fgetcsv($handle, $max_line_length, $delemietr); |
|
121 | 121 | |
122 | - if (empty($columns)) { |
|
123 | - $error['message'] = 'Empty'; |
|
124 | - return ($error); |
|
125 | - } |
|
122 | + if (empty($columns)) { |
|
123 | + $error['message'] = 'Empty'; |
|
124 | + return ($error); |
|
125 | + } |
|
126 | 126 | |
127 | - $depotsParams = array( |
|
128 | - 'optimization_problem_id' => $optid, |
|
129 | - 'delete_old_depots' => true, |
|
130 | - ); |
|
127 | + $depotsParams = array( |
|
128 | + 'optimization_problem_id' => $optid, |
|
129 | + 'delete_old_depots' => true, |
|
130 | + ); |
|
131 | 131 | |
132 | - $iRow = 1; |
|
133 | - $depotAddresses = array(); |
|
132 | + $iRow = 1; |
|
133 | + $depotAddresses = array(); |
|
134 | 134 | |
135 | - while (($rows = fgetcsv($handle, $max_line_length, $delemietr))!==false) { |
|
136 | - if ($rows[0] && $rows[1] && $rows[3] && array(null)!==$rows) { |
|
137 | - $depotAddress['lat'] = $rows[0]; |
|
138 | - $depotAddress['lng'] = $rows[1]; |
|
139 | - $depotAddress['address'] = $rows[3]; |
|
140 | - array_push($depotAddresses, $depotAddress); |
|
141 | - } |
|
142 | - } |
|
135 | + while (($rows = fgetcsv($handle, $max_line_length, $delemietr))!==false) { |
|
136 | + if ($rows[0] && $rows[1] && $rows[3] && array(null)!==$rows) { |
|
137 | + $depotAddress['lat'] = $rows[0]; |
|
138 | + $depotAddress['lng'] = $rows[1]; |
|
139 | + $depotAddress['address'] = $rows[3]; |
|
140 | + array_push($depotAddresses, $depotAddress); |
|
141 | + } |
|
142 | + } |
|
143 | 143 | |
144 | - $depotsParams['new_depots'] = $depotAddresses; |
|
144 | + $depotsParams['new_depots'] = $depotAddresses; |
|
145 | 145 | |
146 | - $optProblem = new OptimizationProblem(); |
|
146 | + $optProblem = new OptimizationProblem(); |
|
147 | 147 | |
148 | - $resultDepots = $optProblem->addDepotsToHybrid($depotsParams); |
|
148 | + $resultDepots = $optProblem->addDepotsToHybrid($depotsParams); |
|
149 | 149 | |
150 | - /* Reoptimize hybrid optimization */ |
|
150 | + /* Reoptimize hybrid optimization */ |
|
151 | 151 | |
152 | - if ($resultDepots!=null) { |
|
153 | - $problemParams = array( |
|
154 | - 'optimization_problem_id' => $optid |
|
155 | - ); |
|
156 | - $problem = OptimizationProblem::reoptimize($problemParams); |
|
152 | + if ($resultDepots!=null) { |
|
153 | + $problemParams = array( |
|
154 | + 'optimization_problem_id' => $optid |
|
155 | + ); |
|
156 | + $problem = OptimizationProblem::reoptimize($problemParams); |
|
157 | 157 | |
158 | - Route4Me::simplePrint($problem); |
|
159 | - } |
|
160 | - } |
|
161 | - } |
|
158 | + Route4Me::simplePrint($problem); |
|
159 | + } |
|
160 | + } |
|
161 | + } |
|
162 | 162 | } |