Comment out call to inventory manager. #374
This commit is contained in:
parent
ab6ed4a185
commit
917459f228
1 changed files with 29 additions and 7 deletions
|
|
@ -2265,15 +2265,36 @@ class APIController extends Controller
|
|||
foreach ($hubs as $hub)
|
||||
{
|
||||
$nearest_hubs_with_distance[] = $hub;
|
||||
if (!empty($hub['hub']->getBranchCode()))
|
||||
$nearest_branch_codes[] = $hub['hub']->getBranchCode();
|
||||
//if (!empty($hub['hub']->getBranchCode()))
|
||||
// $nearest_branch_codes[] = $hub['hub']->getBranchCode();
|
||||
}
|
||||
|
||||
// check if nearest hubs have branch codes
|
||||
if (count($nearest_branch_codes) == 0)
|
||||
return $selected_hub;
|
||||
//if (count($nearest_branch_codes) == 0)
|
||||
// return $selected_hub;
|
||||
|
||||
// assume all 10 have stock
|
||||
// find the nearest hub with available riders
|
||||
$nearest = null;
|
||||
foreach ($nearest_hubs_with_distance as $nhd)
|
||||
{
|
||||
if (count($nhd['hub']->getAvailableRiders()) > 0)
|
||||
{
|
||||
if (empty($nearest))
|
||||
$nearest = $nhd;
|
||||
else
|
||||
{
|
||||
if ($nhd['distance'] < $nearest['distance'])
|
||||
$nearest = $nhd;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$selected_hub = $nearest['hub'];
|
||||
|
||||
// uncomment this snippet when inventory check becomes active
|
||||
// get battery sku
|
||||
/*
|
||||
if ($batt != null)
|
||||
{
|
||||
$skus[] = $batt->getSAPCode();
|
||||
|
|
@ -2281,7 +2302,8 @@ class APIController extends Controller
|
|||
// api call to check inventory
|
||||
// pass the list of branch codes of nearest hubs and the skus
|
||||
// go through returned list of branch codes
|
||||
$hubs_with_inventory = $im->getBranchesInventory($nearest_branch_codes, $skus);
|
||||
// bypass inventory check for now
|
||||
// $hubs_with_inventory = $im->getBranchesInventory($nearest_branch_codes, $skus);
|
||||
if (!empty($hubs_with_inventory))
|
||||
{
|
||||
$nearest = [];
|
||||
|
|
@ -2320,8 +2342,8 @@ class APIController extends Controller
|
|||
}
|
||||
}
|
||||
$selected_hub = $nearest['hub'];
|
||||
}
|
||||
}
|
||||
}
|
||||
} */
|
||||
return $selected_hub;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue