| Line 37... |
Line 37... |
| 37 |
|
37 |
|
| 38 |
import javax.xml.bind.JAXBContext;
|
38 |
import javax.xml.bind.JAXBContext;
|
| 39 |
import javax.xml.bind.JAXBException;
|
39 |
import javax.xml.bind.JAXBException;
|
| 40 |
import javax.xml.bind.Marshaller;
|
40 |
import javax.xml.bind.Marshaller;
|
| 41 |
import javax.xml.bind.Unmarshaller;
|
41 |
import javax.xml.bind.Unmarshaller;
|
| 42 |
|
- |
|
| 43 |
import org.apache.thrift.TException;
|
42 |
import org.apache.thrift.TException;
|
| 44 |
import org.apache.thrift.transport.TTransportException;
|
43 |
import org.apache.thrift.transport.TTransportException;
|
| 45 |
import org.slf4j.Logger;
|
44 |
import org.slf4j.Logger;
|
| 46 |
import org.slf4j.LoggerFactory;
|
45 |
import org.slf4j.LoggerFactory;
|
| 47 |
|
46 |
|
| 48 |
import order.SaholicAPI;
|
47 |
import order.SaholicAPI;
|
| 49 |
import order.ObjectFactory;
|
48 |
import order.ObjectFactory;
|
| 50 |
import order.SaholicAPI.Order;
|
49 |
import order.SaholicAPI.Order;
|
| 51 |
|
50 |
|
| 52 |
public class ProcessSnapdealOrder {
|
51 |
public class ProcessSnapdealOrder {
|
| 53 |
//private static final int SNAPDEAL_SOURCE_ID = 3;
|
- |
|
| 54 |
private static final int SNAPDEAL_SOURCE_ID = 7;
|
52 |
private static final int SNAPDEAL_SOURCE_ID = 7;
|
| 55 |
private static final String FIRSTFLIGHT = "First Flight";
|
53 |
private static final String FIRSTFLIGHT = "First Flight";
|
| 56 |
private static final String DELHIVERY = "DELHIVERY";
|
54 |
private static final String DELHIVERY = "DELHIVERY";
|
| 57 |
private static final String BLUEDART = "Bluedart";
|
55 |
private static final String BLUEDART = "Bluedart";
|
| 58 |
private static final String CHHOTU = "CHHOTU";
|
56 |
private static final String CHHOTU = "CHHOTU";
|
| Line 143... |
Line 141... |
| 143 |
t_order.setCod(false);
|
141 |
t_order.setCod(false);
|
| 144 |
System.out.println("t order created");
|
142 |
System.out.println("t order created");
|
| 145 |
try {
|
143 |
try {
|
| 146 |
Calendar time = Calendar.getInstance();
|
144 |
Calendar time = Calendar.getInstance();
|
| 147 |
time.add(Calendar.DAY_OF_MONTH, 1);
|
145 |
time.add(Calendar.DAY_OF_MONTH, 1);
|
| 148 |
t_order.setPromised_shipping_time(time.getTimeInMillis());
|
146 |
t_order.setPromised_shipping_time(order.getShipByDate().getMillisecond());
|
| 149 |
t_order.setExpected_shipping_time(time.getTimeInMillis());
|
147 |
t_order.setExpected_shipping_time(order.getShipByDate().getMillisecond());
|
| 150 |
time.add(Calendar.DAY_OF_MONTH, 3);
|
148 |
time.add(Calendar.DAY_OF_MONTH, 3);
|
| 151 |
t_order.setPromised_delivery_time(time.getTimeInMillis());
|
149 |
t_order.setPromised_delivery_time(time.getTimeInMillis());
|
| 152 |
t_order.setExpected_delivery_time(time.getTimeInMillis());
|
150 |
t_order.setExpected_delivery_time(time.getTimeInMillis());
|
| 153 |
System.out.println("Dates set in transaction");
|
151 |
System.out.println("Dates set in transaction");
|
| 154 |
} catch(Exception e) {
|
152 |
} catch(Exception e) {
|
| 155 |
logger.error("Error in updating Shipping or Delivery Time for suborderid " + order.getSuborderId());
|
153 |
logger.error("Error in updating Shipping or Delivery Time for suborderid " + order.getSuborderId());
|
| 156 |
continue;
|
154 |
continue;
|
| 157 |
}
|
155 |
}
|
| 158 |
/*InventoryService.Client inventoryClient = null;
|
156 |
InventoryService.Client inventoryClient = null;
|
| 159 |
//Warehouse fulfillmentWarehouse= null;
|
157 |
Warehouse fulfillmentWarehouse= null;
|
| 160 |
try {
|
158 |
try {
|
| 161 |
//inventoryClient = new InventoryClient().getClient();
|
159 |
inventoryClient = new InventoryClient().getClient();
|
| - |
|
160 |
List<Long> itemAvailability = inventoryClient.getItemAvailabilityAtLocation(order.getSKUCode(), 1);
|
| - |
|
161 |
fulfillmentWarehouse = inventoryClient.getWarehouse(itemAvailability.get(0));
|
| - |
|
162 |
t_order.setFulfilmentWarehouseId(fulfillmentWarehouse.getId());
|
| - |
|
163 |
t_order.setWarehouse_id(fulfillmentWarehouse.getBillingWarehouseId());
|
| - |
|
164 |
|
| 162 |
//VendorItemPricing vendorItemPricing = inventoryClient.getItemPricing(lineItem.getItem_id(), fulfillmentWarehouse.getVendor().getId());
|
165 |
VendorItemPricing vendorItemPricing = inventoryClient.getItemPricing(lineItem.getItem_id(), fulfillmentWarehouse.getVendor().getId());
|
| 163 |
//t_order.getLineitems().get(0).setTransfer_price(vendorItemPricing.getTransferPrice());
|
166 |
t_order.getLineitems().get(0).setTransfer_price(vendorItemPricing.getTransferPrice());
|
| 164 |
//t_order.getLineitems().get(0).setNlc(vendorItemPricing.getNlc());
|
167 |
t_order.getLineitems().get(0).setNlc(vendorItemPricing.getNlc());
|
| 165 |
} catch (InventoryServiceException e) {
|
168 |
} catch (InventoryServiceException e) {
|
| 166 |
continue;
|
169 |
continue;
|
| 167 |
} catch (TTransportException e) {
|
170 |
} catch (TTransportException e) {
|
| 168 |
// TODO Auto-generated catch block
|
171 |
// TODO Auto-generated catch block
|
| 169 |
e.printStackTrace();
|
172 |
e.printStackTrace();
|
| 170 |
} catch (TException e) {
|
173 |
} catch (TException e) {
|
| 171 |
// TODO Auto-generated catch block
|
174 |
// TODO Auto-generated catch block
|
| 172 |
e.printStackTrace();
|
175 |
e.printStackTrace();
|
| 173 |
}*/
|
176 |
}
|
| 174 |
if(order.getCourier().equalsIgnoreCase(FIRSTFLIGHT)) {
|
177 |
if(order.getCourier().equalsIgnoreCase(FIRSTFLIGHT)) {
|
| 175 |
t_order.setLogistics_provider_id(12);
|
178 |
t_order.setLogistics_provider_id(12);
|
| 176 |
} else if(order.getCourier().equalsIgnoreCase(DELHIVERY)) {
|
179 |
} else if(order.getCourier().equalsIgnoreCase(DELHIVERY)) {
|
| 177 |
t_order.setLogistics_provider_id(13);
|
180 |
t_order.setLogistics_provider_id(13);
|
| 178 |
} else if(order.getCourier().equalsIgnoreCase(BLUEDART)) {
|
181 |
} else if(order.getCourier().equalsIgnoreCase(BLUEDART)) {
|