Subversion Repositories SmartDukaan

Rev

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

Rev 10982 Rev 10983
Line 430... Line 430...
430
			txn.setStatusDescription("Order for flipkart ");
430
			txn.setStatusDescription("Order for flipkart ");
431
			List<in.shop2020.model.v1.order.Order> orderlist = new ArrayList<in.shop2020.model.v1.order.Order>();
431
			List<in.shop2020.model.v1.order.Order> orderlist = new ArrayList<in.shop2020.model.v1.order.Order>();
432
			double total_price=0;
432
			double total_price=0;
433
			InventoryService.Client inventoryClient = null;
433
			InventoryService.Client inventoryClient = null;
434
			Warehouse fulfillmentWarehouse= null;
434
			Warehouse fulfillmentWarehouse= null;
435
			boolean exit = false;
-
 
436
			LineItem lineItem = null;
435
			LineItem lineItem = null;
437
			lineItem = createLineItem(sku,unitSellingPrice,quantity);
436
			lineItem = createLineItem(sku,unitSellingPrice,quantity);
438
			logger.info(orderId+" "+subOrderId + "sku and Price " + sku + " " + unitSellingPrice);
437
			logger.info(orderId+" "+subOrderId + "sku and Price " + sku + " " + unitSellingPrice);
439
			lineItem.setExtra_info("flipkartOrderId = " + orderId + " flipkartsubOrderId = " + subOrderId);
438
			lineItem.setExtra_info("flipkartOrderId = " + orderId + " flipkartsubOrderId = " + subOrderId);
440
			in.shop2020.model.v1.order.Order t_order = new in.shop2020.model.v1.order.Order();
439
			in.shop2020.model.v1.order.Order t_order = new in.shop2020.model.v1.order.Order();
Line 479... Line 478...
479
					t_order.setPromised_delivery_time(calendar.getTimeInMillis());
478
					t_order.setPromised_delivery_time(calendar.getTimeInMillis());
480
					t_order.setExpected_delivery_time(calendar.getTimeInMillis());
479
					t_order.setExpected_delivery_time(calendar.getTimeInMillis());
481
				} catch(Exception e) {	
480
				} catch(Exception e) {	
482
					logger.error("Error in updating Shipping or Delivery Time for suborderid  " + subOrderId);
481
					logger.error("Error in updating Shipping or Delivery Time for suborderid  " + subOrderId);
483
					sb.append(orderId + " "+ subOrderId  + " Could not update delivery time" + " " + "\n");
482
					sb.append(orderId + " "+ subOrderId  + " Could not update delivery time" + " " + "\n");
484
					exit = true;
-
 
485
					continue;
483
					continue;
486
				}
484
				}
487
			}
485
			}
488
			inventoryClient = new InventoryClient().getClient();
486
			inventoryClient = new InventoryClient().getClient();
489
			try {
487
			try {
Line 516... Line 514...
516
				}
514
				}
517
 
515
 
518
				//logger.info("Billing warehouse id for suborderid  " + order.getSuborderId() + " is " + fulfillmentWarehouse.getBillingWarehouseId());
516
				//logger.info("Billing warehouse id for suborderid  " + order.getSuborderId() + " is " + fulfillmentWarehouse.getBillingWarehouseId());
519
				t_order.setWarehouse_id(billingWarehouseId);
517
				t_order.setWarehouse_id(billingWarehouseId);
520
				VendorItemPricing vendorItemPricing = new VendorItemPricing();
518
				VendorItemPricing vendorItemPricing = new VendorItemPricing();
-
 
519
				inventoryClient = new InventoryClient().getClient();
521
				if(fulfillmentWarehouse.getId()==7) {
520
				if(fulfillmentWarehouse.getId()==7) {
522
					Item item = new CatalogClient().getClient().getItem(lineItem.getItem_id());
521
					Item item = new CatalogClient().getClient().getItem(lineItem.getItem_id());
523
					vendorItemPricing = inventoryClient.getItemPricing(lineItem.getItem_id(), item.getPreferredVendor());
522
					vendorItemPricing = inventoryClient.getItemPricing(lineItem.getItem_id(), item.getPreferredVendor());
524
				} else {
523
				} else {
525
					vendorItemPricing = inventoryClient.getItemPricing(lineItem.getItem_id(), fulfillmentWarehouse.getVendor().getId());
524
					vendorItemPricing = inventoryClient.getItemPricing(lineItem.getItem_id(), fulfillmentWarehouse.getVendor().getId());
526
				}
525
				}
527
 
-
 
528
				t_order.getLineitems().get(0).setTransfer_price(vendorItemPricing.getTransferPrice());
526
				t_order.getLineitems().get(0).setTransfer_price(vendorItemPricing.getTransferPrice());
529
				t_order.getLineitems().get(0).setNlc(vendorItemPricing.getNlc());
527
				t_order.getLineitems().get(0).setNlc(vendorItemPricing.getNlc());
530
			} catch (InventoryServiceException e) {
528
			} catch (InventoryServiceException e) {
531
				logger.error("Error connecting inventory service for suborderid  " + orderId + " " + subOrderId , e);
529
				logger.error("Error connecting inventory service for suborderid  " + orderId + " " + subOrderId , e);
532
				sb.append(orderId + " " + subOrderId+ " Inventory Service Exception" + " " + "\n");
530
				sb.append(orderId + " " + subOrderId+ " Inventory Service Exception" + " " + "\n");
533
				exit = true;
-
 
534
				continue;
531
				continue;
535
			} catch (TTransportException e) {
532
			} catch (TTransportException e) {
536
				logger.error("Transport Exception with Inventory Service for suborderid  " + orderId + " " + subOrderId , e);
533
				logger.error("Transport Exception with Inventory Service for suborderid  " + orderId + " " + subOrderId , e);
537
				sb.append(orderId + " " + subOrderId + " Transport Exception with Inventory Service" + " " + "\n");
534
				sb.append(orderId + " " + subOrderId + " Transport Exception with Inventory Service" + " " + "\n");
538
				exit = true;
-
 
539
				continue;
535
				continue;
540
			} catch (TException e) {
536
			} catch (TException e) {
541
				logger.error("Exception with Inventory Service for suborderid  " + orderId + " " + subOrderId , e);
537
				logger.error("Exception with Inventory Service for suborderid  " + orderId + " " + subOrderId , e);
542
				sb.append(orderId + " " + subOrderId + " Exception in Inventory Service" + " " + "\n");
538
				sb.append(orderId + " " + subOrderId + " Exception in Inventory Service" + " " + "\n");
543
				exit = true;
-
 
544
				continue;
539
				continue;
545
			} catch (CatalogServiceException e) {
540
			} catch (CatalogServiceException e) {
546
				logger.error("Exception with Catalog Service for   " + orderId + " " + subOrderId + " while getting item " + lineItem.getItem_id(), e);
541
				logger.error("Exception with Catalog Service for   " + orderId + " " + subOrderId + " while getting item " + lineItem.getItem_id(), e);
547
				sb.append(orderId + " " + subOrderId + " Exception in Catalog Service" + " " + "\n");
542
				sb.append(orderId + " " + subOrderId + " Exception in Catalog Service" + " " + "\n");
548
				exit = true;
-
 
549
				continue;
543
				continue;
550
			}
544
			}
551
			t_order.setLogistics_provider_id(FLIPKART_LOGISTICS_ID);
545
			t_order.setLogistics_provider_id(FLIPKART_LOGISTICS_ID);
552
			t_order.setAirwaybill_no("");
546
			t_order.setAirwaybill_no("");
553
			t_order.setTracking_id("");
547
			t_order.setTracking_id("");
Line 555... Line 549...
555
			t_order.setOrderType(OrderType.B2C);
549
			t_order.setOrderType(OrderType.B2C);
556
			t_order.setSource(FLIPKART_SOURCE_ID);
550
			t_order.setSource(FLIPKART_SOURCE_ID);
557
			t_order.setOrderType(OrderType.B2C);
551
			t_order.setOrderType(OrderType.B2C);
558
			total_price = unitSellingPrice*quantity;
552
			total_price = unitSellingPrice*quantity;
559
			orderlist.add(t_order);
553
			orderlist.add(t_order);
560
			if(exit){
-
 
561
				continue;
-
 
562
			}
-
 
563
			txn.setOrders(orderlist);
554
			txn.setOrders(orderlist);
564
			try {
555
			try {
565
				transactionId =  String.valueOf(transaction_client.createTransaction(txn));
556
				transactionId =  String.valueOf(transaction_client.createTransaction(txn));
566
				logger.info("Transaction id is : " + transactionId);
557
				logger.info("Transaction id is : " + transactionId);
567
			} catch (TransactionServiceException e) {
558
			} catch (TransactionServiceException e) {