Example 63 : Debugging allocations using consignment code

Printer-friendly version

 This example shows how to see why a particular service was not selected using a consignment code.

package com.metapack.dm.test;
 
import com.metapack.deliverymanager.client.AllocationFilter;
import com.metapack.deliverymanager.client.DateRange;
import com.metapack.deliverymanager.client.webservices.DebugService;
 
public class Example63 extends ExampleBase {
 
	public void run() throws Exception {
		DebugService service = createDebugService();
 
		DateRange acceptableCollectionSlot = new DateRange( 
				createDate( "2009-02-14T00:00:00" ) , 
				null );
 
		AllocationFilter filter = new AllocationFilter();
		filter.setFirstCollectionOnly( true );
		filter.setAcceptableCollectionSlots( new DateRange[] { acceptableCollectionSlot } );
		filter.setPreFilterSortOrder1( ExampleBase.SORT_EARLIEST_COLLECTION_ASCENDING );
		filter.setFilterGroup1( ExampleBase.FILTER_GROUP_SERVICE );
		filter.setSortOrder1( ExampleBase.SORT_COST_CHEAPEST );
 
		String[] messages = service.debugConsignmentWhyNot( "DMC01V00VD31" , filter );
		for( String message : messages ) {
			System.out.println( message );
		}
	}
 
	public static void main(String[] args ){
		Example63 ex = new Example63();
		try {
			ex.run();
		} catch( Exception e ) {
			e.printStackTrace();
		}
	}
}