Subversion Repositories SmartDukaan

Rev

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

Rev 9501 Rev 9502
Line 86... Line 86...
86
			e.printStackTrace();
86
			e.printStackTrace();
87
		}
87
		}
88
		for(SnapdealItemDetails snapdealItem:allSnapdealItems){
88
		for(SnapdealItemDetails snapdealItem:allSnapdealItems){
89
			snapdealItemMap.put(snapdealItem.getSkuAtSnapdeal(),snapdealItem);
89
			snapdealItemMap.put(snapdealItem.getSkuAtSnapdeal(),snapdealItem);
90
			itemSnapdealMap.put(snapdealItem.getItem_id(), snapdealItem);
90
			itemSnapdealMap.put(snapdealItem.getItem_id(), snapdealItem);
-
 
91
			System.out.println("Creating Item and Snapdeal Map " + snapdealItem.getItem_id() + " " + snapdealItem.getSkuAtSnapdeal());
91
		}
92
		}
92
		in.shop2020.model.v1.order.TransactionService.Client transactionClient = null;
93
		in.shop2020.model.v1.order.TransactionService.Client transactionClient = null;
93
		try {
94
		try {
94
			transactionClient = new TransactionClient("support_transaction_service_server_host","transaction_service_server_port").getClient();
95
			transactionClient = new TransactionClient("support_transaction_service_server_host","transaction_service_server_port").getClient();
95
			lastUpdatedInventoryTime = transactionClient.getSourceDetail(7).getLastUpdatedOn();
96
			lastUpdatedInventoryTime = transactionClient.getSourceDetail(7).getLastUpdatedOn();
Line 605... Line 606...
605
	public static void main(String[] args) throws NumberFormatException, TException, ClientProtocolException, IOException {
606
	public static void main(String[] args) throws NumberFormatException, TException, ClientProtocolException, IOException {
606
		fetchinventoryhistoryfromsnapdeal();
607
		fetchinventoryhistoryfromsnapdeal();
607
		fetchcurrentinventoryfromsnapdeal();
608
		fetchcurrentinventoryfromsnapdeal();
608
		calculateinventory();
609
		calculateinventory();
609
		in.shop2020.model.v1.catalog.CatalogService.Client catalogServiceClient = null;
610
		in.shop2020.model.v1.catalog.CatalogService.Client catalogServiceClient = null;
610
		SnapdealItem snapdealitem = null;
-
 
611
		try {
611
		try {
612
			catalogServiceClient = new CatalogClient().getClient();
612
			catalogServiceClient = new CatalogClient().getClient();
613
		} catch (TTransportException e) {
613
		} catch (TTransportException e) {
614
			// TODO Auto-generated catch block
614
			// TODO Auto-generated catch block
615
			e.printStackTrace();
615
			e.printStackTrace();
Line 623... Line 623...
623
		long availability,reserve,defaultinventory,holdinventory,actualavailability,heldorders=0,sent_inventory;
623
		long availability,reserve,defaultinventory,holdinventory,actualavailability,heldorders=0,sent_inventory;
624
		SnapdealItemForInventory  inventoryItem;
624
		SnapdealItemForInventory  inventoryItem;
625
		StringBuffer outOfStockItems =new StringBuffer();
625
		StringBuffer outOfStockItems =new StringBuffer();
626
		StringBuffer backInStockItems =new StringBuffer();
626
		StringBuffer backInStockItems =new StringBuffer();
627
		long sku = 0;
627
		long sku = 0;
-
 
628
		SnapdealItemDetails snapdealitem;
628
		for(Inventory inventory:currentInventoryItemList){
629
		for(Inventory inventory:currentInventoryItemList){
629
			//System.out.println(inventory.getSupc()+" "+inventory.getSellerSku()+ " " +inventory.getProductName()+" "+inventory.getAvailableInventory()+" "+inventory.isLive()+" "+itemIdpendingOrdersMap.get(Long.parseLong(inventory.getSellerSku())));
630
			//System.out.println(inventory.getSupc()+" "+inventory.getSellerSku()+ " " +inventory.getProductName()+" "+inventory.getAvailableInventory()+" "+inventory.isLive()+" "+itemIdpendingOrdersMap.get(Long.parseLong(inventory.getSellerSku())));
630
			try{
-
 
631
				if(snapdealItemMap.containsKey(inventory.getSellerSku())){
631
				if(snapdealItemMap.containsKey(inventory.getSellerSku())){
632
					sku = snapdealItemMap.get(inventory.getSellerSku()).getItem_id(); 
632
					snapdealitem = snapdealItemMap.get(inventory.getSellerSku()); 
-
 
633
					sku =  snapdealitem.getItem_id();
633
				}
634
				}
634
				else{
635
				else{
635
					continue;
636
					continue;
636
				}
637
				}
637
				snapdealitem = catalogServiceClient.getSnapdealItem(sku);
-
 
638
			}
-
 
639
			catch(TTransportException e){
-
 
640
				catalogServiceClient = new CatalogClient().getClient();
-
 
641
				snapdealitem = catalogServiceClient.getSnapdealItem(sku);
-
 
642
			}
-
 
643
			if(snapdealitem.getItem_id()!=0 && snapdealitem.isIsListedOnSnapdeal() && !snapdealitem.isSuppressInventoryFeed()){
638
			if(snapdealitem.getItem_id()!=0 && snapdealitem.isIsListedOnSnapdeal() && !snapdealitem.isSuppressInventoryFeed()){
644
				inventoryItem = allItemsInventoryMap.get(sku);
639
				inventoryItem = allItemsInventoryMap.get(sku);
645
				if(inventoryItem==null){
640
				if(inventoryItem==null){
646
					continue;
641
					continue;
647
				}
642
				}