for(order in orders) {
var quantity : Int = Std.parseInt(order.quantity);
+ var to_pick = toPick(order);
// We don't need to remove the quantity which is picked
// as we have already counted it in the initial location calculation.
- quantity -= toPick(order);
while(0 >= left && locationIter.hasNext()) {
location = locationIter.next();
left += quantityForLocation;
formatLocation(location, "Delivery", left);
}
- left -= quantity;
+ if(to_pick>0)
+ qoh -= quantity
+ else
+ left -= quantity;
var now = Date.now();
- formatOrder(order, left, now.getTime() > location.delivery.getTime() ? now : location.delivery, now);
+ formatOrder(order, to_pick>0 ? qoh : left, now.getTime() > location.delivery.getTime() ? now : location.delivery, now);
}
// display the left locations
$order = $orders[$_g];
++$_g;
$quantity = Std::parseInt($order->quantity);
- $quantity -= $this->toPick($order);
+ $to_pick = $this->toPick($order);
while(0 >= $left && $locationIter->hasNext()) {
$location = $locationIter->next();
$quantityForLocation = $location->quantityOnHand($this->stock_id, null) + $location->quantityOnOrder($this->stock_id);
$this->formatLocation($location, "Delivery", $left);
unset($quantityForLocation);
}
- $left -= $quantity;
+ if($to_pick > 0) {
+ $qoh -= $quantity;
+ } else {
+ $left -= $quantity;
+ }
$now = Date::now();
- $this->formatOrder($order, $left, ItemScheduler_6($this, $_g, $left, $location, $locationIter, $locations, $now, $order, $orders, $qoh, $quantity, $startDate, $total_picked), $now);
- unset($quantity,$order,$now);
+ $this->formatOrder($order, (($to_pick > 0) ? $qoh : $left), ItemScheduler_6($this, $_g, $left, $location, $locationIter, $locations, $now, $order, $orders, $qoh, $quantity, $startDate, $to_pick, $total_picked), $now);
+ unset($to_pick,$quantity,$order,$now);
}
}
while(0 >= $left && $locationIter->hasNext()) {
}
}
}
-function ItemScheduler_6(&$»this, &$_g, &$left, &$location, &$locationIter, &$locations, &$now, &$order, &$orders, &$qoh, &$quantity, &$startDate, &$total_picked) {
+function ItemScheduler_6(&$»this, &$_g, &$left, &$location, &$locationIter, &$locations, &$now, &$order, &$orders, &$qoh, &$quantity, &$startDate, &$to_pick, &$total_picked) {
if($now->getTime() > $location->delivery->getTime()) {
return $now;
} else {