Skip to content

Commit

Permalink
Add allowedVehicleIndices to CSV upload (#11)
Browse files Browse the repository at this point in the history
Co-authored-by: Chris Morabito <[email protected]>
  • Loading branch information
jmccollum-woolpert and cmorabito-woolpert authored Oct 31, 2022
1 parent 79fb247 commit 5f0245a
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -596,6 +596,7 @@ export class CsvUploadDialogComponent implements OnDestroy, OnInit {
LoadDemand3Value: this.fb.control(''),
LoadDemand4Type: this.fb.control(''),
LoadDemand4Value: this.fb.control(''),
AllowedVehicleIndices: this.fb.control(''),
},
{
validators: [
Expand Down
1 change: 1 addition & 0 deletions application/frontend/src/app/core/models/csv.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ export enum ShipmentFields {
LoadDemand3Value,
LoadDemand4Type,
LoadDemand4Value,
AllowedVehicleIndices,
}

export enum VehicleFields {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { RelaxationLevel } from '../models';
import {
reducer,
initialState,
State,
selectInjectedModelConstraint,
selectAllowLargeDeadlineDespiteInterruptionRisk,
selectGeodesicMetersPerSecond,
Expand Down
11 changes: 11 additions & 0 deletions application/frontend/src/app/core/services/csv.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,13 @@ export class CsvService {
...this.mapToLoadDemands(shipment, mapping),
...this.mapToPickup(shipment, mapping, timeWindows.pickup),
...this.mapToDelivery(shipment, mapping, timeWindows.delivery),
...this.mapKeyToModelValue(
'allowedVehicleIndices',
'AllowedVehicleIndices',
shipment,
mapping,
this.commaSeparatedStringToIntArray
),
};
return parsedShipment;
});
Expand Down Expand Up @@ -650,6 +657,10 @@ export class CsvService {
return { seconds: value };
}

private commaSeparatedStringToIntArray(value: string): number[] {
return value.split(',').map((entry) => parseInt(entry, 10));
}

geocodeLocation(location: string): Observable<ILatLng | GeocodeErrorResponse> {
// First try to split the location as at Lat,Lng pair
// Then geocode what the user provides if coordinates can't be parsed
Expand Down
14 changes: 7 additions & 7 deletions application/frontend/src/assets/shipmentsSample.csv
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
label,penaltyCost,pickupArrivalWaypoint,pickupDuration,pickupCost,pickupStartTime,pickupSoftStartTime,pickupEndTime,pickupSoftEndTime,pickupCostPerHourBeforeSoftStartTime,pickupCostPerHourAfterSoftEndTime,deliveryArrivalWaypoint,deliveryDuration,deliveryCost,deliveryStartTime,deliverySoftStartTime,deliveryEndTime,deliverySoftEndTime,deliveryCostPerHourBeforeSoftStartTime,deliveryCostPerHourAfterSoftEndTime,loadDemand1Type,loadDemand1Value,loadDemand2Type,loadDemand2Value,loadDemand3Type,loadDemand3Value,loadDemand4Type,loadDemand4Value
Package A,50,"1250 1st Ave S, Seattle, WA 98134",600,,2021-08-02T13:00:00.000Z,,2021-08-02T14:00:00.000Z,,,,,,,,,,,,,,,,,,,,
Large Shipment A,1000,"7277 Perimeter Rd S, Seattle, WA 98108",3600,50,2021-08-02T08:00:00.000Z,2021-08-02T09:00:00.000Z,2021-08-02T12:00:00.000Z,2021-08-02T11:00:00.000Z,500,500,"47.67051436887835, -122.12049628332548",3600,50,2021-08-02T12:00:00.000Z,2021-08-02T13:00:00.000Z,2021-08-02T21:00:00.000Z,2021-08-02T17:00:00.000Z,500,500,weight_lbs,500,pallets,1,oversized,1,parcels,100
Shipment Set,200,"47.63164007564745, -122.14098126029408",60,,2021-08-02T08:00:00.000Z,,2021-08-02T17:00:00.000Z,,,,,,,,,,,,,,,,,,,,
Large Shipment B,200,"47.51503316671915, -122.26664837759289",600,50,2021-08-02T06:00:00.000Z,2021-08-02T08:00:00.000Z,2021-08-02T11:00:00.000Z,2021-08-02T10:00:00.000Z,50,50,"3077 78th Ave SE, Mercer Island, WA 98040",600,,,,,,,,pallets,5,oversized,2,parcels,100,weight_lbs,1500
Shipment Set 2,100,"1510 Belmont Ave, Seattle, WA 98122",60,,,,,,,,,,,,,,,,,,,,,,,,
Small Package,5,"400 Broad St, Seattle, WA 98109",,,,,,,,,"200 S 3rd St, Renton, WA 98057",,,,,,,,,,,,,,,,
label,penaltyCost,pickupArrivalWaypoint,pickupDuration,pickupCost,pickupStartTime,pickupSoftStartTime,pickupEndTime,pickupSoftEndTime,pickupCostPerHourBeforeSoftStartTime,pickupCostPerHourAfterSoftEndTime,deliveryArrivalWaypoint,deliveryDuration,deliveryCost,deliveryStartTime,deliverySoftStartTime,deliveryEndTime,deliverySoftEndTime,deliveryCostPerHourBeforeSoftStartTime,deliveryCostPerHourAfterSoftEndTime,loadDemand1Type,loadDemand1Value,loadDemand2Type,loadDemand2Value,loadDemand3Type,loadDemand3Value,loadDemand4Type,loadDemand4Value,allowedVehicleIndices
Package A,50,"1250 1st Ave S, Seattle, WA 98134",600,,2021-08-02T13:00:00.000Z,,2021-08-02T14:00:00.000Z,,,,,,,,,,,,,,,,,,,,,"1,2"
Large Shipment A,1000,"7277 Perimeter Rd S, Seattle, WA 98108",3600,50,2021-08-02T08:00:00.000Z,2021-08-02T09:00:00.000Z,2021-08-02T12:00:00.000Z,2021-08-02T11:00:00.000Z,500,500,"47.67051436887835, -122.12049628332548",3600,50,2021-08-02T12:00:00.000Z,2021-08-02T13:00:00.000Z,2021-08-02T21:00:00.000Z,2021-08-02T17:00:00.000Z,500,500,weight_lbs,500,pallets,1,oversized,1,parcels,100,,
Shipment Set,200,"47.63164007564745, -122.14098126029408",60,,2021-08-02T08:00:00.000Z,,2021-08-02T17:00:00.000Z,,,,,,,,,,,,,,,,,,,,,,
Large Shipment B,200,"47.51503316671915, -122.26664837759289",600,50,2021-08-02T06:00:00.000Z,2021-08-02T08:00:00.000Z,2021-08-02T11:00:00.000Z,2021-08-02T10:00:00.000Z,50,50,"3077 78th Ave SE, Mercer Island, WA 98040",600,,,,,,,,pallets,5,oversized,2,parcels,100,weight_lbs,1500,,
Shipment Set 2,100,"1510 Belmont Ave, Seattle, WA 98122",60,,,,,,,,,,,,,,,,,,,,,,,,,"1"
Small Package,5,"400 Broad St, Seattle, WA 98109",,,,,,,,,"200 S 3rd St, Renton, WA 98057",,,,,,,,,,,,,,,,,"0,1,2"

0 comments on commit 5f0245a

Please sign in to comment.