Subversion Repositories SmartDukaan

Rev

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

Rev 5223 Rev 5230
Line 128... Line 128...
128
 
128
 
129
			Long warehouseId = Long.parseLong(inventoryUpdate.getwarehouseId());
129
			Long warehouseId = Long.parseLong(inventoryUpdate.getwarehouseId());
130
			String timestamp = inventoryUpdate.getCurrentTimestamp();
130
			String timestamp = inventoryUpdate.getCurrentTimestamp();
131
			Map<String, Long> availability = new HashMap<String, Long>();
131
			Map<String, Long> availability = new HashMap<String, Long>();
132
			List<Update> updates = inventoryUpdate.getUpdates();
132
			List<Update> updates = inventoryUpdate.getUpdates();
-
 
133
			if (updates != null) {
133
			for(Update update: updates){
134
	            for(Update update: updates){
134
				String key = update.getKey();
135
	                String key = update.getKey();
135
				long quantity = (long) Double.parseDouble(update.getQuantity());
136
	                long quantity = (long) Double.parseDouble(update.getQuantity());
136
				if(availability.containsKey(key)){
137
	                if(availability.containsKey(key)){
137
					quantity = quantity + availability.get(key);
138
	                    quantity = quantity + availability.get(key);
138
				}
139
	                }
139
				availability.put(key, quantity);
140
	                availability.put(key, quantity);
-
 
141
	            }			    
140
			}
142
			}
141
 
143
 
142
			//Update the snapshot before the history since that is more important.
144
			//Update the snapshot before the history since that is more important.
143
			snapshotClient.updateInventory(warehouseId, timestamp, availability);
145
			snapshotClient.updateInventory(warehouseId, timestamp, availability);
144
			historyClient.updateInventoryHistory(warehouseId, timestamp, availability);
146
			historyClient.updateInventoryHistory(warehouseId, timestamp, availability);