示例#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";
 }