| Line 2... |
Line 2... |
| 2 |
|
2 |
|
| 3 |
import in.shop2020.model.v1.catalog.Amazonlisted;
|
3 |
import in.shop2020.model.v1.catalog.Amazonlisted;
|
| 4 |
import in.shop2020.model.v1.catalog.CatalogService;
|
4 |
import in.shop2020.model.v1.catalog.CatalogService;
|
| 5 |
import in.shop2020.model.v1.catalog.CatalogServiceException;
|
5 |
import in.shop2020.model.v1.catalog.CatalogServiceException;
|
| 6 |
import in.shop2020.model.v1.catalog.Item;
|
6 |
import in.shop2020.model.v1.catalog.Item;
|
| - |
|
7 |
import in.shop2020.model.v1.catalog.SnapdealItem;
|
| 7 |
import in.shop2020.model.v1.inventory.InventoryService;
|
8 |
import in.shop2020.model.v1.inventory.InventoryService;
|
| 8 |
import in.shop2020.model.v1.inventory.InventoryServiceException;
|
9 |
import in.shop2020.model.v1.inventory.InventoryServiceException;
|
| 9 |
import in.shop2020.model.v1.inventory.InventoryType;
|
10 |
import in.shop2020.model.v1.inventory.InventoryType;
|
| 10 |
import in.shop2020.model.v1.inventory.VendorItemPricing;
|
11 |
import in.shop2020.model.v1.inventory.VendorItemPricing;
|
| 11 |
import in.shop2020.model.v1.inventory.Warehouse;
|
12 |
import in.shop2020.model.v1.inventory.Warehouse;
|
| Line 409... |
Line 410... |
| 409 |
} catch(Exception e) {
|
410 |
} catch(Exception e) {
|
| 410 |
logger.error("Error in updating Shipping or Delivery Time for suborderid " + subOrderId);
|
411 |
logger.error("Error in updating Shipping or Delivery Time for suborderid " + subOrderId);
|
| 411 |
sb.append(orderId + " "+ subOrderId + " Could not update delivery time" + " " + "\n");
|
412 |
sb.append(orderId + " "+ subOrderId + " Could not update delivery time" + " " + "\n");
|
| 412 |
continue;
|
413 |
continue;
|
| 413 |
}
|
414 |
}
|
| - |
|
415 |
SnapdealItem snapdealItem = new CatalogClient().getClient().getSnapdealItem(sku);;
|
| 414 |
try {
|
416 |
try {
|
| - |
|
417 |
|
| - |
|
418 |
if(snapdealItem.getItem_id()!=0 && snapdealItem.getWarehouseId()!=0) {
|
| 415 |
inventoryClient = new InventoryClient().getClient();
|
419 |
fulfillmentWarehouse = inventoryClient.getWarehouse(snapdealItem.getWarehouseId());
|
| - |
|
420 |
} else {
|
| 416 |
List<Long> itemAvailability = inventoryClient.getItemAvailabilityAtLocation(sku, 1);
|
421 |
List<Long> itemAvailability = inventoryClient.getItemAvailabilityAtLocation(sku, 1);
|
| 417 |
fulfillmentWarehouse = inventoryClient.getWarehouse(itemAvailability.get(0));
|
422 |
fulfillmentWarehouse = inventoryClient.getWarehouse(itemAvailability.get(0));
|
| 418 |
if(fulfillmentWarehouse.getStateId()!=0){
|
423 |
if(fulfillmentWarehouse.getStateId()!=0){
|
| 419 |
fulfillmentWarehouse = inventoryClient.getWarehouse(7);
|
424 |
fulfillmentWarehouse = inventoryClient.getWarehouse(7);
|
| - |
|
425 |
}
|
| 420 |
}
|
426 |
}
|
| 421 |
t_order.setFulfilmentWarehouseId(fulfillmentWarehouse.getId());
|
427 |
t_order.setFulfilmentWarehouseId(fulfillmentWarehouse.getId());
|
| 422 |
long billingWarehouseId = 0;
|
428 |
long billingWarehouseId = 0;
|
| 423 |
if(fulfillmentWarehouse.getBillingWarehouseId()== 0) {
|
429 |
if(fulfillmentWarehouse.getBillingWarehouseId()== 0) {
|
| 424 |
inventoryClient = new InventoryClient().getClient();
|
430 |
inventoryClient = new InventoryClient().getClient();
|
| 425 |
List<Warehouse> warehouses = inventoryClient.getWarehouses(WarehouseType.OURS, InventoryType.GOOD, fulfillmentWarehouse.getVendor().getId(), 0, 0);
|
431 |
List<Warehouse> warehouses = inventoryClient.getWarehouses(WarehouseType.OURS, InventoryType.GOOD, fulfillmentWarehouse.getVendor().getId(), 0, 0);
|
| 426 |
for(Warehouse warehouse : warehouses) {
|
432 |
for(Warehouse warehouse : warehouses) {
|
| 427 |
if(warehouse.getBillingWarehouseId()!=0) {
|
433 |
if(warehouse.getBillingWarehouseId()!=0) {
|
| 428 |
billingWarehouseId = warehouse.getBillingWarehouseId();
|
434 |
billingWarehouseId = warehouse.getBillingWarehouseId();
|
| 429 |
break;
|
435 |
break;
|
| 430 |
}
|
436 |
}
|
| 431 |
}
|
437 |
}
|
| 432 |
}else {
|
438 |
}else {
|
| 433 |
billingWarehouseId = fulfillmentWarehouse.getBillingWarehouseId();
|
439 |
billingWarehouseId = fulfillmentWarehouse.getBillingWarehouseId();
|
| 434 |
}
|
440 |
}
|
| 435 |
|
441 |
|
| - |
|
442 |
//logger.info("Billing warehouse id for suborderid " + order.getSuborderId() + " is " + fulfillmentWarehouse.getBillingWarehouseId());
|
| 436 |
t_order.setWarehouse_id(billingWarehouseId);
|
443 |
t_order.setWarehouse_id(billingWarehouseId);
|
| 437 |
VendorItemPricing vendorItemPricing = new VendorItemPricing();
|
444 |
VendorItemPricing vendorItemPricing = new VendorItemPricing();
|
| 438 |
if(fulfillmentWarehouse.getId()==7) {
|
445 |
if(fulfillmentWarehouse.getId()==7) {
|
| 439 |
Item item = new CatalogClient().getClient().getItem(lineItem.getItem_id());
|
446 |
Item item = new CatalogClient().getClient().getItem(lineItem.getItem_id());
|
| 440 |
vendorItemPricing = inventoryClient.getItemPricing(lineItem.getItem_id(), item.getPreferredVendor());
|
447 |
vendorItemPricing = inventoryClient.getItemPricing(lineItem.getItem_id(), item.getPreferredVendor());
|
| 441 |
} else {
|
448 |
} else {
|
| 442 |
vendorItemPricing = inventoryClient.getItemPricing(lineItem.getItem_id(), fulfillmentWarehouse.getVendor().getId());
|
449 |
vendorItemPricing = inventoryClient.getItemPricing(lineItem.getItem_id(), fulfillmentWarehouse.getVendor().getId());
|
| 443 |
}
|
450 |
}
|
| 444 |
|
451 |
|
| 445 |
t_order.getLineitems().get(0).setTransfer_price(vendorItemPricing.getTransferPrice());
|
452 |
t_order.getLineitems().get(0).setTransfer_price(vendorItemPricing.getTransferPrice());
|
| 446 |
t_order.getLineitems().get(0).setNlc(vendorItemPricing.getNlc());
|
453 |
t_order.getLineitems().get(0).setNlc(vendorItemPricing.getNlc());
|
| 447 |
} catch (InventoryServiceException e) {
|
454 |
} catch (InventoryServiceException e) {
|
| 448 |
logger.error("Error connecting inventory service for suborderid " + orderId + " " + subOrderId , e);
|
455 |
logger.error("Error connecting inventory service for suborderid " + orderId + " " + subOrderId , e);
|
| 449 |
sb.append(orderId + " " + subOrderId+ " Inventory Service Exception" + " " + "\n");
|
456 |
sb.append(orderId + " " + subOrderId+ " Inventory Service Exception" + " " + "\n");
|