239 lines
5.6 KiB
PHP
239 lines
5.6 KiB
PHP
<?php
|
|
|
|
namespace App\Ramcar;
|
|
|
|
use CrEOF\Spatial\PHP\Types\Geometry\Point;
|
|
|
|
use DateTime;
|
|
|
|
class HubCriteria
|
|
{
|
|
protected $point; // coordinates of source
|
|
protected $limit_results; // number of results to return
|
|
protected $limit_distance; // distance limit for search in km
|
|
protected $flag_inventory_check; // flag if we need to check for inventory
|
|
protected $flag_riders_check; // flag if we need to check for riders available
|
|
protected $jo_type; // jo service needed
|
|
protected $date_time; // date and time to check if hub is open or not
|
|
protected $items; // array of items: items[sku] = quantity to check for
|
|
protected $payment_method; // payment method of JO
|
|
protected $flag_emergency; // flag if emergency or not
|
|
protected $flag_round_robin; // flag if we use round robin or not
|
|
protected $jo_id; // JO id. This is null if called from mobile API
|
|
protected $customer_id; // customer id
|
|
protected $customer_class; // customer class
|
|
protected $order_date; // date JO was created
|
|
protected $service_type; // service type of JO
|
|
protected $jo_origin; // origin of JO
|
|
|
|
public function __construct()
|
|
{
|
|
// TODO: default values might still change
|
|
$this->limit_results = 10;
|
|
$this->limit_distance = 500;
|
|
$this->jo_type = '';
|
|
$this->date_time = new DateTime();
|
|
$this->flag_inventory_check = false;
|
|
$this->flag_riders_check = false;
|
|
$this->items = [];
|
|
$this->payment_method = '';
|
|
$this->flag_emergency = false;
|
|
$this->flag_round_robin = false;
|
|
$this->jo_id = null;
|
|
$this->customer_id = null;
|
|
$this->customer_class = null;
|
|
$this->order_date = new DateTime();
|
|
$this->service_type = null;
|
|
$this->jo_origin = null;
|
|
}
|
|
|
|
public function setPoint(Point $point)
|
|
{
|
|
$this->point = $point;
|
|
return $this;
|
|
}
|
|
|
|
public function getPoint()
|
|
{
|
|
return $this->point;
|
|
}
|
|
|
|
public function setLimitResults($limit_results)
|
|
{
|
|
$this->limit_results = $limit_results;
|
|
return $this;
|
|
}
|
|
|
|
public function getLimitResults()
|
|
{
|
|
return $this->limit_results;
|
|
}
|
|
|
|
public function setLimitDistance($limit_distance)
|
|
{
|
|
$this->limit_distance = $limit_distance;
|
|
return $this;
|
|
}
|
|
|
|
public function getLimitDistance()
|
|
{
|
|
return $this->limit_distance;
|
|
}
|
|
|
|
public function setInventoryCheck($flag_inventory_check = true)
|
|
{
|
|
$this->flag_inventory_check = $flag_inventory_check;
|
|
return $this;
|
|
}
|
|
|
|
public function hasInventoryCheck()
|
|
{
|
|
return $this->flag_inventory_check;
|
|
}
|
|
|
|
public function setRidersCheck($flag_riders_check = true)
|
|
{
|
|
$this->flag_riders_check = $flag_riders_check;
|
|
return $this;
|
|
}
|
|
|
|
public function hasRidersCheck()
|
|
{
|
|
return $this->flag_riders_check;
|
|
}
|
|
|
|
public function setJoType($jo_type)
|
|
{
|
|
// TODO: validate the jo type
|
|
$this->jo_type = $jo_type;
|
|
return $this;
|
|
}
|
|
|
|
public function getJoType()
|
|
{
|
|
return $this->jo_type;
|
|
}
|
|
|
|
public function setDateTime(DateTime $date_time)
|
|
{
|
|
$this->date_time = $date_time;
|
|
return $this;
|
|
}
|
|
|
|
public function getDateTime()
|
|
{
|
|
return $this->date_time;
|
|
}
|
|
|
|
public function addItem($sku, $quantity)
|
|
{
|
|
// at this point, sku is assumed to be a valid item
|
|
$this->items[$sku] = $quantity;
|
|
return $this;
|
|
}
|
|
|
|
public function getItems()
|
|
{
|
|
return $this->items;
|
|
}
|
|
|
|
public function setPaymentMethod($payment_method)
|
|
{
|
|
$this->payment_method = $payment_method;
|
|
return $this;
|
|
}
|
|
|
|
public function getPaymentMethod()
|
|
{
|
|
return $this->payment_method;
|
|
}
|
|
|
|
public function setEmergency($flag_emergency = true)
|
|
{
|
|
$this->flag_emergency = $flag_emergency;
|
|
return $this;
|
|
}
|
|
|
|
public function isEmergency()
|
|
{
|
|
return $this->flag_emergency;
|
|
}
|
|
|
|
public function setRoundRobin($flag_round_robin = true)
|
|
{
|
|
$this->flag_round_robin = $flag_round_robin;
|
|
return $this;
|
|
}
|
|
|
|
public function isRoundRobin()
|
|
{
|
|
return $this->flag_round_robin;
|
|
}
|
|
|
|
public function setJobOrderId($jo_id)
|
|
{
|
|
$this->jo_id = $jo_id;
|
|
return $this;
|
|
}
|
|
|
|
public function getJobOrderId()
|
|
{
|
|
return $this->jo_id;
|
|
}
|
|
|
|
public function setCustomerId($customer_id)
|
|
{
|
|
$this->customer_id = $customer_id;
|
|
return $this;
|
|
}
|
|
|
|
public function getCustomerId()
|
|
{
|
|
return $this->customer_id;
|
|
}
|
|
|
|
public function setCustomerClass($customer_class)
|
|
{
|
|
$this->customer_class = $customer_class;
|
|
return $this;
|
|
}
|
|
|
|
public function getCustomerClass()
|
|
{
|
|
return $this->customer_class;
|
|
}
|
|
|
|
public function setOrderDate($order_date)
|
|
{
|
|
$this->order_date = $order_date;
|
|
return $this;
|
|
}
|
|
|
|
public function getOrderDate()
|
|
{
|
|
return $this->order_date;
|
|
}
|
|
|
|
public function setServiceType($service_type)
|
|
{
|
|
$this->service_type = $service_type;
|
|
return $this;
|
|
}
|
|
|
|
public function getServiceType()
|
|
{
|
|
return $this->service_type;
|
|
}
|
|
|
|
public function setJoOrigin($jo_origin)
|
|
{
|
|
$this->jo_origin = $jo_origin;
|
|
return $this;
|
|
}
|
|
|
|
public function getJoOrigin()
|
|
{
|
|
return $this->jo_origin;
|
|
}
|
|
}
|
|
|