Subversion Repositories SmartDukaan

Rev

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

Rev 8709 Rev 9640
Line 63... Line 63...
63
    
63
    
64
    private static String logFile;
64
    private static String logFile;
65
    
65
    
66
    private static int maxCount;
66
    private static int maxCount;
67
    
67
    
-
 
68
    private static final int EBAYSOURCE = 6;
-
 
69
    private static final int SNAPDEALSOURCE = 7;
-
 
70
    private static final int FLIPKARTSOURCE = 8;
-
 
71
    
68
    static {
72
    static {
69
        try {
73
        try {
70
            logFile = ConfigClient.getClient().get(ConfigClientKeys.push_prices_to_prod_log_file.toString());
74
            logFile = ConfigClient.getClient().get(ConfigClientKeys.push_prices_to_prod_log_file.toString());
71
            maxCount = Integer.parseInt(ConfigClient.getClient().get(ConfigClientKeys.push_prices_to_prod_max_count.toString()));    
75
            maxCount = Integer.parseInt(ConfigClient.getClient().get(ConfigClientKeys.push_prices_to_prod_max_count.toString()));    
72
        } catch(ConfigException ce) {
76
        } catch(ConfigException ce) {
Line 1058... Line 1062...
1058
        if(tItemInventory != null) {
1062
        if(tItemInventory != null) {
1059
        	Map<Long, Long> availabilityMap = tItemInventory.getAvailability();
1063
        	Map<Long, Long> availabilityMap = tItemInventory.getAvailability();
1060
        	Map<Long, Long> reservedMap = tItemInventory.getReserved();
1064
        	Map<Long, Long> reservedMap = tItemInventory.getReserved();
1061
        	Map<Long, Long> heldMap = tItemInventory.getHeld();
1065
        	Map<Long, Long> heldMap = tItemInventory.getHeld();
1062
            for(Entry<Long, Long> availability : availabilityMap.entrySet()) {
1066
            for(Entry<Long, Long> availability : availabilityMap.entrySet()) {
-
 
1067
            	Map<Integer, Long> heldInventoryMap = new HashMap<Integer, Long>();
1063
            	warehousedata = new ItemInventory();
1068
            	warehousedata = new ItemInventory();
1064
            	warehousedata.setWarehouseId(availability.getKey());
1069
            	warehousedata.setWarehouseId(availability.getKey());
1065
            	warehousedata.setAvailability(availability.getValue());
1070
            	warehousedata.setAvailability(availability.getValue());
1066
            	warehousedata.setReserved(reservedMap.get(availability.getKey()));
1071
            	warehousedata.setReserved(reservedMap.get(availability.getKey()));
1067
            	warehousedata.setHeld(heldMap.get(availability.getKey()));
1072
            	warehousedata.setHeld(heldMap.get(availability.getKey()));
-
 
1073
            	try {
-
 
1074
	            	if(warehousedata.getHeld()>0) {
-
 
1075
	            		InventoryService.Client inventoryClient = new InventoryClient().getClient();
-
 
1076
	            		heldInventoryMap = inventoryClient.getHeldInventoryMapForItem(thriftItem.getId(), availability.getKey());
-
 
1077
	            	}
-
 
1078
	            	if(heldInventoryMap.size()>0) {
-
 
1079
	            		for(Integer source : heldInventoryMap.keySet()) {
-
 
1080
	            			switch(source) {
-
 
1081
	            				case EBAYSOURCE: warehousedata.setEbayHeld(heldInventoryMap.get(source));
-
 
1082
	            				case SNAPDEALSOURCE: warehousedata.setSnapdealHeld(heldInventoryMap.get(source));
-
 
1083
	            				case FLIPKARTSOURCE: warehousedata.setFlipkartHeld(heldInventoryMap.get(source));
-
 
1084
	            			}
-
 
1085
	            		}
-
 
1086
	            	}
-
 
1087
            	} catch (Exception e) {
-
 
1088
            		logger.error("Error in getting data from holdInventoryDetail for itemId " + thriftItem.getId() + 
-
 
1089
            				" and warehouse " +availability.getKey());
-
 
1090
            	}
1068
            	itemInventoryMap.put(warehousedata.getWarehouseId(), warehousedata);
1091
            	itemInventoryMap.put(warehousedata.getWarehouseId(), warehousedata);
1069
            }
1092
            }
1070
        }
1093
        }
1071
        else {
1094
        else {
1072
        	itemInventoryMap = null;
1095
        	itemInventoryMap = null;
Line 1222... Line 1245...
1222
            if(thriftItemInventory != null) {
1245
            if(thriftItemInventory != null) {
1223
            	Map<Long, Long> availabilityMap = thriftItemInventory.getAvailability();
1246
            	Map<Long, Long> availabilityMap = thriftItemInventory.getAvailability();
1224
            	Map<Long, Long> reservedMap = thriftItemInventory.getReserved();
1247
            	Map<Long, Long> reservedMap = thriftItemInventory.getReserved();
1225
            	Map<Long, Long> heldMap = thriftItemInventory.getHeld();
1248
            	Map<Long, Long> heldMap = thriftItemInventory.getHeld();
1226
                for(Entry<Long, Long> availability : availabilityMap.entrySet()) {
1249
                for(Entry<Long, Long> availability : availabilityMap.entrySet()) {
-
 
1250
                	Map<Integer, Long> heldInventoryMap = new HashMap<Integer, Long>();
1227
                	warehousedata = new ItemInventory();
1251
                	warehousedata = new ItemInventory();
1228
                	warehousedata.setWarehouseId(availability.getKey());
1252
                	warehousedata.setWarehouseId(availability.getKey());
1229
                	warehousedata.setAvailability(availability.getValue());
1253
                	warehousedata.setAvailability(availability.getValue());
1230
                	warehousedata.setReserved(reservedMap.get(availability.getKey()));
1254
                	warehousedata.setReserved(reservedMap.get(availability.getKey()));
1231
                	warehousedata.setHeld(heldMap.get(availability.getKey()));
1255
                	warehousedata.setHeld(heldMap.get(availability.getKey()));
-
 
1256
                	try {
-
 
1257
	            		if(warehousedata.getHeld()>0) {
-
 
1258
	                		heldInventoryMap = inventoryClient.getHeldInventoryMapForItem(itemId, availability.getKey());
-
 
1259
	                	}
-
 
1260
	                	if(heldInventoryMap.size()>0) {
-
 
1261
	                		for(Integer source : heldInventoryMap.keySet()) {
-
 
1262
	                			switch(source) {
-
 
1263
	                				case EBAYSOURCE: warehousedata.setEbayHeld(heldInventoryMap.get(source));
-
 
1264
	                				case SNAPDEALSOURCE: warehousedata.setSnapdealHeld(heldInventoryMap.get(source));
-
 
1265
	                				case FLIPKARTSOURCE: warehousedata.setFlipkartHeld(heldInventoryMap.get(source));
-
 
1266
	                			}
-
 
1267
	                		}
-
 
1268
	                	} 
-
 
1269
                	}catch (Exception e) {
-
 
1270
                		logger.error("Error in getting data from holdInventoryDetail for itemId " + itemId + 
-
 
1271
                				" and warehouse " +availability.getKey());
1232
                	
1272
                	}
1233
                	itemInventoryMap.put(warehousedata.getWarehouseId(), warehousedata);
1273
                	itemInventoryMap.put(warehousedata.getWarehouseId(), warehousedata);
1234
                }
1274
                }
1235
            }
1275
            }
1236
            else {
1276
            else {
1237
            	itemInventoryMap = null;
1277
            	itemInventoryMap = null;