Subversion Repositories SmartDukaan

Rev

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

Rev 11406 Rev 11471
Line 437... Line 437...
437
					List<AmazonFbaInventorySnapshot> fbaInventorySnapshotlist =  inventoryClient.getAllAmazonFbaItemInventory();
437
					List<AmazonFbaInventorySnapshot> fbaInventorySnapshotlist =  inventoryClient.getAllAmazonFbaItemInventory();
438
					String prefix;
438
					String prefix;
439
					for(Date date:dates){
439
					for(Date date:dates){
440
						if(fbaInventorySnapshotlist!=null){
440
						if(fbaInventorySnapshotlist!=null){
441
							for(AmazonFbaInventorySnapshot amazonFbaInventory:fbaInventorySnapshotlist){
441
							for(AmazonFbaInventorySnapshot amazonFbaInventory:fbaInventorySnapshotlist){
-
 
442
								AmazonFCWarehouseLocation location;
442
								if(amazonFbaInventory.getLocation().getValue()==AmazonFCWarehouseLocation.Bangalore.getValue()){
443
								if(amazonFbaInventory.getLocation().getValue()==AmazonFCWarehouseLocation.Bangalore.getValue()){
443
									prefix = "FBB";
444
									prefix = "FBB";
-
 
445
									location = AmazonFCWarehouseLocation.Bangalore;
444
								}
446
								}
445
								else if(amazonFbaInventory.getLocation().getValue()==AmazonFCWarehouseLocation.Mumbai.getValue()){
447
								else if(amazonFbaInventory.getLocation().getValue()==AmazonFCWarehouseLocation.Mumbai.getValue()){
446
									prefix = "FBA";
448
									prefix = "FBA";
-
 
449
									location = AmazonFCWarehouseLocation.Mumbai;
447
								}
450
								}
448
								else{
451
								else{
449
									continue;
452
									continue;
450
								}
453
								}
451
								if(orderDateItemIdFbaSaleSnapshotMap.containsKey(date) ){
454
								if(orderDateItemIdFbaSaleSnapshotMap.containsKey(date) ){
Line 454... Line 457...
454
										FbaSalesSnapshot fbaSalesSnapshot = new FbaSalesSnapshot();
457
										FbaSalesSnapshot fbaSalesSnapshot = new FbaSalesSnapshot();
455
										fbaSalesSnapshot.setTotalOrderCount(0);
458
										fbaSalesSnapshot.setTotalOrderCount(0);
456
										fbaSalesSnapshot.setPromotionOrderCount(0);
459
										fbaSalesSnapshot.setPromotionOrderCount(0);
457
										fbaSalesSnapshot.setTotalPromotionSale((float) 0);
460
										fbaSalesSnapshot.setTotalPromotionSale((float) 0);
458
										fbaSalesSnapshot.setTotalSale((float) 0);
461
										fbaSalesSnapshot.setTotalSale((float) 0);
-
 
462
										fbaSalesSnapshot.setFcLocation(location);
459
										ItemIdFbaSaleSnapshotMap.put(prefix+String.valueOf(amazonFbaInventory.getItem_id()),fbaSalesSnapshot);
463
										ItemIdFbaSaleSnapshotMap.put(prefix+String.valueOf(amazonFbaInventory.getItem_id()),fbaSalesSnapshot);
460
										orderDateItemIdFbaSaleSnapshotMap.put(date,ItemIdFbaSaleSnapshotMap);
464
										orderDateItemIdFbaSaleSnapshotMap.put(date,ItemIdFbaSaleSnapshotMap);
461
									}
465
									}
462
								}
466
								}
463
								else{
467
								else{
Line 465... Line 469...
465
									FbaSalesSnapshot fbaSalesSnapshot = new FbaSalesSnapshot();
469
									FbaSalesSnapshot fbaSalesSnapshot = new FbaSalesSnapshot();
466
									fbaSalesSnapshot.setTotalOrderCount(0);
470
									fbaSalesSnapshot.setTotalOrderCount(0);
467
									fbaSalesSnapshot.setPromotionOrderCount(0);
471
									fbaSalesSnapshot.setPromotionOrderCount(0);
468
									fbaSalesSnapshot.setTotalPromotionSale((float) 0);
472
									fbaSalesSnapshot.setTotalPromotionSale((float) 0);
469
									fbaSalesSnapshot.setTotalSale((float) 0);
473
									fbaSalesSnapshot.setTotalSale((float) 0);
-
 
474
									fbaSalesSnapshot.setFcLocation(location);
470
									ItemIdFbaSaleSnapshotMap.put(prefix+String.valueOf(amazonFbaInventory.getItem_id()),fbaSalesSnapshot);
475
									ItemIdFbaSaleSnapshotMap.put(prefix+String.valueOf(amazonFbaInventory.getItem_id()),fbaSalesSnapshot);
471
									orderDateItemIdFbaSaleSnapshotMap.put(date,ItemIdFbaSaleSnapshotMap);
476
									orderDateItemIdFbaSaleSnapshotMap.put(date,ItemIdFbaSaleSnapshotMap);
472
								}
477
								}
473
							}
478
							}
474
						}
479
						}
Line 488... Line 493...
488
								SimpleDateFormat istFormatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
493
								SimpleDateFormat istFormatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
489
								istFormatter .setLenient(false);
494
								istFormatter .setLenient(false);
490
								TimeZone zone= TimeZone.getTimeZone("GMT");
495
								TimeZone zone= TimeZone.getTimeZone("GMT");
491
								istFormatter.setTimeZone(zone);
496
								istFormatter.setTimeZone(zone);
492
								Date date = istFormatter.parse(nextLine[0]);
497
								Date date = istFormatter.parse(nextLine[0]);
493
								if(nextLine[1].length()> 0 && (nextLine[1].startsWith("FBA") || nextLine[1].startsWith("FBB"))){
498
								if(nextLine[1].length()> 0 && (nextLine[1].startsWith("FBA"))){
494
									nextLine[1] = nextLine[1].replaceAll("FBA",""); 
499
									nextLine[1] = nextLine[1].replaceAll("FBA",""); 
-
 
500
								}
-
 
501
								else if(nextLine[1].length()> 0 && nextLine[1].startsWith("FBB")){
495
									nextLine[1] = nextLine[1].replaceAll("FBB","");
502
									nextLine[1] = nextLine[1].replaceAll("FBB","");
496
								}
503
								}
497
								else{
504
								else{
498
									continue;
505
									continue;
499
								}
506
								}
Line 629... Line 636...
629
								amazonfbasalessnapshot.setSalePrice(itemIdSalePriceMap.get(item_id).getPrice());
636
								amazonfbasalessnapshot.setSalePrice(itemIdSalePriceMap.get(item_id).getPrice());
630
								amazonfbasalessnapshot.setSalePriceSnapshotDate(itemIdSalePriceMap.get(item_id).getDate().getTime());
637
								amazonfbasalessnapshot.setSalePriceSnapshotDate(itemIdSalePriceMap.get(item_id).getDate().getTime());
631
							}
638
							}
632
							else{
639
							else{
633
								amazonfbasalessnapshot.setSalePrice(0.0);
640
								amazonfbasalessnapshot.setSalePrice(0.0);
634
								amazonfbasalessnapshot.setSalePriceSnapshotDate(0);
-
 
635
							}
641
							}
636
							if(itemIdminMFNPriceMap.containsKey(item_id) && itemIdminMFNPriceMap.get(item_id).getPrice()!=0){
642
							if(itemIdminMFNPriceMap.containsKey(item_id) && itemIdminMFNPriceMap.get(item_id).getPrice()!=0){
637
								amazonfbasalessnapshot.setMinMfnPrice(itemIdminMFNPriceMap.get(item_id).getPrice());
643
								amazonfbasalessnapshot.setMinMfnPrice(itemIdminMFNPriceMap.get(item_id).getPrice());
-
 
644
								amazonfbasalessnapshot.setSalePriceSnapshotDate(0);
638
								amazonfbasalessnapshot.setMinMfnPriceSnapshotDate(itemIdminMFNPriceMap.get(item_id).getDate().getTime());
645
								amazonfbasalessnapshot.setMinMfnPriceSnapshotDate(itemIdminMFNPriceMap.get(item_id).getDate().getTime());
639
							}
646
							}
640
							else{
647
							else{
641
								amazonfbasalessnapshot.setMinMfnPrice(0.0);
648
								amazonfbasalessnapshot.setMinMfnPrice(0.0);
642
								amazonfbasalessnapshot.setMinMfnPriceSnapshotDate(0);
649
								amazonfbasalessnapshot.setMinMfnPriceSnapshotDate(0);
Line 661... Line 668...
661
								catch(TTransportException e){
668
								catch(TTransportException e){
662
									catalogClient   = catalogServiceClient.getClient();
669
									catalogClient   = catalogServiceClient.getClient();
663
									amazon_item=catalogClient.getAmazonItemDetails(item_id);
670
									amazon_item=catalogClient.getAmazonItemDetails(item_id);
664
								}
671
								}
665
								if(amazon_item.getItemid()==0){
672
								if(amazon_item.getItemid()==0){
666
									System.out.println("Skipping Item ID listing not present" + entry1.getKey() +" date : "+orderDate);
673
									//System.out.println("Skipping Item ID listing not present" + entry1.getKey() +" date : "+orderDate);
667
									continue;
674
									continue;
668
								}
675
								}
669
								amazonfbasalessnapshot.setOurPrice(amazon_item.getFbaPrice());
676
								amazonfbasalessnapshot.setOurPrice(amazon_item.getFbaPrice());
670
								amazonfbasalessnapshot.setOurPriceSnapshotDate(0);
677
								amazonfbasalessnapshot.setOurPriceSnapshotDate(0);
671
							}
678
							}
672
							amazonfbasalessnapshot.setAmazonFbaInventory(inventory);
679
							amazonfbasalessnapshot.setAmazonFbaInventory(inventory);
673
							amazonfbasalessnapshot.setFcLocation(location);
680
							amazonfbasalessnapshot.setFcLocation(entry1.getValue().getFcLocation());
-
 
681
							if(item_id==12530L){
-
 
682
								System.out.println("Item ID " + amazonfbasalessnapshot.getItem_id()+" "
-
 
683
										+"Order Count " + amazonfbasalessnapshot.getTotalOrderCount()+" "
-
 
684
										+"Order Date " + new Date(amazonfbasalessnapshot.getDateOfSale())+" "+"Location "+amazonfbasalessnapshot.getFcLocation()+"\n");
-
 
685
							}
674
							fbaSalesSnapShotList.add(amazonfbasalessnapshot);
686
							fbaSalesSnapShotList.add(amazonfbasalessnapshot);
675
						}
687
						}
676
					}
688
					}
677
					System.out.println("Order Details to be Updated Size... "+fbaSalesSnapShotList.size());
689
					System.out.println("Order Details to be Updated Size... "+fbaSalesSnapShotList.size());
678
					try{
690
					try{