Subversion Repositories SmartDukaan

Rev

Rev 8929 | Rev 9143 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 8929 Rev 8941
Line 80... Line 80...
80
import org.apache.struts2.convention.annotation.Results;
80
import org.apache.struts2.convention.annotation.Results;
81
import org.apache.thrift.TException;
81
import org.apache.thrift.TException;
82
import org.apache.thrift.transport.TTransportException;
82
import org.apache.thrift.transport.TTransportException;
83
 
83
 
84
import com.ShipWebServiceClient;
84
import com.ShipWebServiceClient;
-
 
85
import com.fedex.ship.stub.AssociatedShipmentDetail;
85
import com.fedex.ship.stub.CompletedPackageDetail;
86
import com.fedex.ship.stub.CompletedPackageDetail;
86
import com.fedex.ship.stub.CompletedShipmentDetail;
87
import com.fedex.ship.stub.CompletedShipmentDetail;
-
 
88
import com.fedex.ship.stub.OperationalInstruction;
-
 
89
import com.fedex.ship.stub.PackageOperationalDetail;
87
import com.fedex.ship.stub.ProcessShipmentReply;
90
import com.fedex.ship.stub.ProcessShipmentReply;
-
 
91
import com.fedex.ship.stub.StringBarcode;
88
import com.fedex.ship.stub.TrackingId;
92
import com.fedex.ship.stub.TrackingId;
89
 
93
 
90
/**
94
/**
91
 * @author vikas
95
 * @author vikas
92
 * 
96
 * 
Line 606... Line 610...
606
				ProcessShipmentReply  processShipmentReply = ShipWebServiceClient.getShipmentCreationReply(t_order,fedexAccountInfo.getClientDetail(),fedexAccountInfo.getWad(),fedexAccountInfo.getEndPointAddress());
610
				ProcessShipmentReply  processShipmentReply = ShipWebServiceClient.getShipmentCreationReply(t_order,fedexAccountInfo.getClientDetail(),fedexAccountInfo.getWad(),fedexAccountInfo.getEndPointAddress());
607
				CompletedShipmentDetail completedShipmentDetails = processShipmentReply.getCompletedShipmentDetail();
611
				CompletedShipmentDetail completedShipmentDetails = processShipmentReply.getCompletedShipmentDetail();
608
				CompletedPackageDetail completedPackageDetails =  completedShipmentDetails.getCompletedPackageDetails(0);
612
				CompletedPackageDetail completedPackageDetails =  completedShipmentDetails.getCompletedPackageDetails(0);
609
				TrackingId  trackId= completedPackageDetails.getTrackingIds(0);
613
				TrackingId  trackId= completedPackageDetails.getTrackingIds(0);
610
				t_order = transactionClient.updateOrderAWB(t_order.getId(), trackId.getTrackingNumber());
614
				t_order = transactionClient.updateOrderAWB(t_order.getId(), trackId.getTrackingNumber());
-
 
615
				//Start:-Added By Manish Sharma for FedEx Integration - Shipment Creation on 21-Aug-2013
-
 
616
				CompletedPackageDetail[] cpd= completedShipmentDetails.getCompletedPackageDetails();
-
 
617
				AssociatedShipmentDetail[] asdetails = completedShipmentDetails.getAssociatedShipments();
-
 
618
				List<in.shop2020.model.v1.order.Attribute> attrList = new ArrayList<in.shop2020.model.v1.order.Attribute>();
-
 
619
				if(t_order.isCod()){
-
 
620
					if(asdetails!=null){
-
 
621
						for(AssociatedShipmentDetail as : asdetails){
-
 
622
							if(as.getType().getValue().equalsIgnoreCase("COD_RETURN")){
-
 
623
								PackageOperationalDetail pod = as.getPackageOperationalDetail();
-
 
624
								StringBarcode[] barcodes = pod.getBarcodes().getStringBarcodes();
-
 
625
								for(StringBarcode bc : barcodes){
-
 
626
									in.shop2020.model.v1.order.Attribute attr3 = new in.shop2020.model.v1.order.Attribute();
-
 
627
									attr3.setName("FedEx_COD_Return_BarCode");
-
 
628
									attr3.setValue(bc.getValue());
-
 
629
									attrList.add(attr3);
-
 
630
								}
-
 
631
								
-
 
632
								String codReturnTrackingNo= as.getTrackingId().getTrackingNumber();
-
 
633
								in.shop2020.model.v1.order.Attribute attr4 = new in.shop2020.model.v1.order.Attribute();
-
 
634
								attr4.setName("FedEx_COD_Return_Tracking_No");
-
 
635
								attr4.setValue(codReturnTrackingNo);
-
 
636
								attrList.add(attr4);
-
 
637
							}
-
 
638
						}
-
 
639
					}
-
 
640
				}
-
 
641
				for(CompletedPackageDetail cd : cpd){
-
 
642
					PackageOperationalDetail pod = cd.getOperationalDetail();
-
 
643
					StringBarcode[] barcodes = pod.getBarcodes().getStringBarcodes();
-
 
644
					for(StringBarcode bc : barcodes){
-
 
645
						in.shop2020.model.v1.order.Attribute attr1 = new in.shop2020.model.v1.order.Attribute();
-
 
646
						attr1.setName("FedEx_Package_BarCode");
-
 
647
						attr1.setValue(bc.getValue());
-
 
648
						attrList.add(attr1);
-
 
649
					}
-
 
650
					OperationalInstruction[] ois = pod.getOperationalInstructions();
-
 
651
					in.shop2020.model.v1.order.Attribute attr2 = new in.shop2020.model.v1.order.Attribute();
-
 
652
					for(OperationalInstruction oi : ois){
-
 
653
						if(oi.getNumber().intValue()==5){
-
 
654
							attr2.setName("FedEx_Location_Code");
-
 
655
							attr2.setValue(oi.getContent());
-
 
656
							attrList.add(attr2);
-
 
657
						}
-
 
658
					}						
-
 
659
				}
-
 
660
				transactionClient.setOrderAttributes(t_order.getId(), attrList);
-
 
661
				//End:-Added By Manish Sharma for FedEx Integration - Shipment Creation on 21-Aug-2013
-
 
662
 
611
			}
663
			}
612
		} catch(Exception e) {
664
		} catch(Exception e) {
613
			log.error("Unable to update address for orderId : " + orderId + "and address : " + 
665
			log.error("Unable to update address for orderId : " + orderId + "and address : " + 
614
					line1 + ", " + line2+ ", " + city + ", " + state + ", " + pin, e);
666
					line1 + ", " + line2+ ", " + city + ", " + state + ", " + pin, e);
615
		}
667
		}