Example 58 : Allocating a consignment using a booking code

Printer-friendly version

This demonstrates how to allocate a consignment using a booking code

package com.metapack.dm.test;
 
import com.metapack.deliverymanager.client.Consignment;
import com.metapack.deliverymanager.client.webservices.AllocationService;
 
/**
 * The DM 2.x version of this call was demonstrated in Example 11
 * 
 * @author apowney
 *
 */
public class Example58 extends ExampleBase {
 
	public void run() throws Exception {
		AllocationService service = createAllocationService();
 
		Consignment[] consignments = service.allocateConsignmentsWithBookingCode( 
				new String[] { "DMC01V00M0BQ" } , 
				"@CHEAPSERVICES" );
		if( ! "Allocated".equals( consignments[0].getStatus() ) ) {
			consignments = service.allocateConsignmentsWithBookingCode(  
					new String[] { "DMC01V00M0BQ" } , 
					"@EXPENSIVESERVICES" );
		}
	}
}