Пример #1
3
 /**
  * @param array $results
  */
 protected function finish($results)
 {
     $order = $this->_orders[$results['orderNum'] - 1];
     if (!Orders::getInstance()->assignWarehouse($order)) {
         echo "No warehouses have enough stock for this order!\n";
     } else {
         echo "Warehouse assigned successfully.\n";
     }
 }
Пример #2
2
 /**
  * @param array $results
  */
 protected function finish($results)
 {
     $order = $this->_orders[$results['orderNum'] - 1];
     $product = $this->_products[$results['productNum'] - 1];
     $order->addProduct($product);
     Orders::getInstance()->save($order);
     echo "Product added to order successfully.\n";
 }
Пример #3
1
 /**
  * Assign a warehouse based on stock availability and distance from order
  * @param Order $order
  * @return bool
  */
 public function assignWarehouse($order)
 {
     $warehouseId = $this->findWarehouse($order);
     if (!$warehouseId) {
         return false;
     }
     $order->setWarehouseId($warehouseId);
     Orders::getInstance()->save($order);
     return true;
 }
Пример #4
-2
 /**
  * @param array $results
  */
 protected function finish($results)
 {
     $product = new Order($results);
     Orders::getInstance()->save($product);
     echo "Order added successfully.\n";
 }