Subversion Repositories SmartDukaan

Rev

Rev 20020 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 20020 Rev 20023
Line 135... Line 135...
135
			if(trackreply!=null){
135
			if(trackreply!=null){
136
				log.info("Successfully get Fedex Reached Destination Orders");
136
				log.info("Successfully get Fedex Reached Destination Orders");
137
				TrackDetail[] trackDetails=trackreply.getTrackDetails();
137
				TrackDetail[] trackDetails=trackreply.getTrackDetails();
138
				SimpleDateFormat dateformat = new SimpleDateFormat("yyyy-MM-dd");
138
				SimpleDateFormat dateformat = new SimpleDateFormat("yyyy-MM-dd");
139
				SimpleDateFormat timeformat = new SimpleDateFormat("HH:mm:ss");
139
				SimpleDateFormat timeformat = new SimpleDateFormat("HH:mm:ss");
-
 
140
				List<String> statusCodes = new ArrayList<String>();
140
trackDetailsLoop:for (int i=0; i< trackDetails.length; i++) {
141
trackDetailsLoop:for (int i=0; i< trackDetails.length; i++) {
141
					TrackEvent trackEvents[]= trackDetails[i].getEvents();
142
					TrackEvent trackEvents[]= trackDetails[i].getEvents();
-
 
143
					if (!(trackDetails[i].getStatusCode() == null || trackDetails[i].getStatusCode().trim().isEmpty())){
-
 
144
						statusCodes.add(trackDetails[i].getStatusCode().trim());
-
 
145
					}
142
					if(trackEvents!=null && trackEvents.length > 0){
146
					if(trackEvents!=null && trackEvents.length > 0){
143
						for(TrackEvent te : trackEvents){
147
						for(TrackEvent te : trackEvents){
144
							if("AF".equalsIgnoreCase(te.getEventType())){
148
							if(("AF".equalsIgnoreCase(te.getEventType()) || "AR".equalsIgnoreCase(te.getEventType())) && statusCodes.contains("FD")){
145
								fedexReachedDestinationOrdersMap.put(awbNumber, dateformat.format(te.getTimestamp().getTime())+" "+timeformat.format(te.getTimestamp().getTime()));
149
								fedexReachedDestinationOrdersMap.put(awbNumber, dateformat.format(te.getTimestamp().getTime())+" "+timeformat.format(te.getTimestamp().getTime()));
146
								break trackDetailsLoop;
150
								break trackDetailsLoop;
147
							}	
151
							}	
148
						}
152
						}
149
					}
153
					}
Line 294... Line 298...
294
			TrackDetail[] trackDetails=trackreply.getTrackDetails();
298
			TrackDetail[] trackDetails=trackreply.getTrackDetails();
295
			SimpleDateFormat dateformat = new SimpleDateFormat("dd-MMM-yyyy");
299
			SimpleDateFormat dateformat = new SimpleDateFormat("dd-MMM-yyyy");
296
			SimpleDateFormat timeformat = new SimpleDateFormat("HH:mm:ss");
300
			SimpleDateFormat timeformat = new SimpleDateFormat("HH:mm:ss");
297
			for (int i=0; i< trackDetails.length; i++) {
301
			for (int i=0; i< trackDetails.length; i++) {
298
				TrackEvent trackEvents[]= trackDetails[i].getEvents();
302
				TrackEvent trackEvents[]= trackDetails[i].getEvents();
-
 
303
				System.out.println("Status code "+trackDetails[i].getStatusCode());
299
				if(trackEvents!=null && trackEvents.length > 0){
304
				if(trackEvents!=null && trackEvents.length > 0){
300
					for(TrackEvent te : trackEvents){
305
					for(TrackEvent te : trackEvents){
-
 
306
						System.out.print("Code "+te.getStatusExceptionCode());
-
 
307
						System.out.print(" Event code "+te.getEventType());
-
 
308
						System.out.print(" Event Desc "+te.getEventDescription());
-
 
309
						System.out.println(" Add "+te.getAddress().getCity());
301
						ShipmentUpdate shipUpdate = new ShipmentUpdate();
310
						ShipmentUpdate shipUpdate = new ShipmentUpdate();
302
						if(te.getAddress()!=null){
311
						if(te.getAddress()!=null){
303
							if(te.getAddress().getCity()!=null){
312
							if(te.getAddress().getCity()!=null){
304
								shipUpdate.city= te.getAddress().getCity();
313
								shipUpdate.city= te.getAddress().getCity();
305
							}
314
							}
Line 324... Line 333...
324
		}
333
		}
325
	}
334
	}
326
	
335
	
327
	public static void main(String[] args) {
336
	public static void main(String[] args) {
328
		FedExTrackingService trackClient = new FedExTrackingService(WarehouseLocation.Delhi);
337
		FedExTrackingService trackClient = new FedExTrackingService(WarehouseLocation.Delhi);
329
		List<ShipmentUpdate> updates = trackClient.getUpdates("783305300460");
338
		List<ShipmentUpdate> updates = trackClient.getUpdates("783305226332");
330
		for(ShipmentUpdate update: updates){
339
		for(ShipmentUpdate update: updates){
331
			System.out.println(update.toString());
340
			System.out.println(update.toString());
332
		}
341
		}
333
	}
342
	}
334
 
343