Esempio n. 1
0
function createTaskWithName($name)
{
    $taskpickup = new stdClass();
    $taskpickup->Coordinate = new stdClass();
    $taskpickup->Coordinate->Latitude = "62.254622";
    $taskpickup->Coordinate->Longitude = "25.787020";
    $taskpickup->Coordinate->System = "WGS84";
    $taskdelivery = new stdClass();
    $taskdelivery->Coordinate = new stdClass();
    $taskdelivery->Coordinate->Latitude = "62.270538";
    $taskdelivery->Coordinate->Longitude = "26.057074";
    $taskdelivery->Coordinate->System = "WGS84";
    $pickup = new stdClass();
    $pickup->Location = $taskpickup;
    $pickup->TimeWindow = createTimeWindowWithDuration("12");
    $pickup->Capacities = array(array("Amount" => 1, "Name" => "Weight"));
    $pickup->Type = "Pickup";
    $delivery = new stdClass();
    $delivery->Location = $taskdelivery;
    $delivery->TimeWindow = createTimeWindowWithDuration("12");
    $delivery->Capacities = array(array("Amount" => 1, "Name" => "Weight"));
    $delivery->Type = "Delivery";
    $task = new stdClass();
    $task->Name = "ExampleTask";
    $task->RelocationType = "None";
    $task->TaskEvents = array($pickup, $delivery);
}
Esempio n. 2
0
 public function testInvalidTaskCreationWithMultipleErrors()
 {
     $problem = $this->initWithProblem();
     $taskpickup = new stdClass();
     $taskpickup->Coordinate = new stdClass();
     $taskpickup->Coordinate->Latitude = "62.254622";
     $taskpickup->Coordinate->Longitude = "25.787020";
     $taskpickup->Coordinate->System = "WGS84";
     $taskdelivery = new stdClass();
     $taskdelivery->Coordinate = new stdClass();
     $taskdelivery->Coordinate->Latitude = "62.270538";
     $taskdelivery->Coordinate->Longitude = "26.057074";
     $taskdelivery->Coordinate->System = "WGS84";
     $pickup = new stdClass();
     $pickup->Location = $taskpickup;
     $pickup->TimeWindow = createTimeWindowWithDuration("12");
     $pickup->Capacities = array(array("Amount" => 1, "Name" => "Weight"));
     $pickup->Type = "Pickup";
     $delivery = new stdClass();
     $delivery->Location = $taskdelivery;
     $delivery->TimeWindow = createTimeWindowWithDuration("12");
     $delivery->Capacities = array(array("Amount" => 1, "Name" => "W"));
     $delivery->Type = "Delivery";
     $task = new stdClass();
     $task->RelocationType = "None";
     $task->TaskEvents = array($pickup, $delivery);
     $exception = null;
     try {
         $resp = $this->api->navigate(getLink($problem, "create-task"), $task);
     } catch (NFleetException $e) {
         $exception = $e;
     }
     echo $exception;
     $this->assertNotNull($exception);
     $this->assertEquals(2, count($exception->Items));
 }