...
For hub Allocation using partition based method, a new IDB key will be used partition_based_origin_hub_allocation
while creating softadata and calling fn getConsignmentOriginHub
Code Block |
---|
else if(orgConfig.partition_based_origin_hub_allocation) { const lat = get(params, 'origin_address.lat', null); const lng = get(params, 'origin_address.lng', null); if (!lat || !lng){ throw helper.wrongInputError('', { message: 'latitude and latitude should be present for proximitypartition based hub allocation' }); } const partition = await extendedModels.Partition.findValidPartition( organisationId, { lat: inputParams.lat, lng: inputParams.lng, }, options); if( partition && partition.hub_id){ hubId = partition.hub_id; } } |
Similarly for destination hub allocation following logic will be added in getMultipleConsignmentDestinationHub
fn:
Code Block |
---|
else if(orgConfig.partition_based_hub_allocation) {
const lat = get(consignment, 'destination_address.lat', null);
const lng = get(consignment, 'destination_address.lng', null);
if (!lat || !lng){
throw helper.wrongInputError('', {
message: `${consignment.reference_number}:latitude and latitude should be present for partition based hub allocation`
});
}
const partition = await extendedModels.Partition.findValidPartition( organisationId,
{
lat,
lng,
}, options);
toRet[consignment.reference_number] = {
...partition
};
}
|