Subversion Repositories SmartDukaan

Rev

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

Rev 5423 Rev 5448
Line 110... Line 110...
110
        } catch (Exception e) {
110
        } catch (Exception e) {
111
            logger.error("Could not fetch all items. Retrying.", e);
111
            logger.error("Could not fetch all items. Retrying.", e);
112
            return fetchInventory(itemId);
112
            return fetchInventory(itemId);
113
        }
113
        }
114
    }
114
    }
115
    
115
 
116
    /**
116
    /**
117
     * 
117
     * 
118
     */
118
     */
119
    private void loadHotspotMappings() {
119
    private void loadHotspotMappings() {
120
        try {
120
        try {
121
            Client snapshotClient = new CatalogClient().getClient();
121
            Client snapshotClient = new CatalogClient().getClient();
122
            for (VendorItemMapping mapping : snapshotClient.getAllVendorItemMappings()) {
122
            for (VendorItemMapping mapping : snapshotClient.getAllVendorItemMappings()) {
123
                if (mapping.getVendorId() == 1) {
123
                if (mapping.getVendorId() == 1) {
124
                    hotspotMappings.put(mapping.getItemId(),
124
                    hotspotMappings.put(mapping.getItemId(),
125
                            mapping.getItemKey());
125
                            mapping.getItemKey().trim().toLowerCase());
126
                }
126
                }
127
            }
127
            }
128
        } catch (Exception e) {
128
        } catch (Exception e) {
129
            logger.error("Could not load vendor item mappings. Trying to reload.", e);
129
            logger.error("Could not load vendor item mappings. Trying to reload.", e);
130
            loadHotspotMappings();
130
            loadHotspotMappings();
Line 216... Line 216...
216
            Map<Item, PLBDetails> mismatches = new HashMap<Item, PLBDetails>();
216
            Map<Item, PLBDetails> mismatches = new HashMap<Item, PLBDetails>();
217
            List<Item> items = fetchItems();
217
            List<Item> items = fetchItems();
218
            for (Item item : items) {
218
            for (Item item : items) {
219
                if (hotspotMappings.containsKey(item.getId())) {
219
                if (hotspotMappings.containsKey(item.getId())) {
220
                    PLBDetails plbDetails = currentInventory
220
                    PLBDetails plbDetails = currentInventory
221
                            .get(hotspotMappings.get(item.getId()));
221
                            .get(hotspotMappings.get(item.getId()).trim().toLowerCase());
222
                    Long currentSnapshotAvailability = fetchInventory(item.getId()).getAvailability().get(warehouseId);
222
                    Long currentSnapshotAvailability = fetchInventory(item.getId()).getAvailability().get(warehouseId);
223
                    if ((currentSnapshotAvailability == null || currentSnapshotAvailability.equals(0l)) && 
223
                    if ((currentSnapshotAvailability == null || currentSnapshotAvailability.equals(0l)) && 
224
                        (plbDetails == null || plbDetails.getQuantity().longValue() == 0))
224
                        (plbDetails == null || plbDetails.getQuantity().longValue() == 0))
225
                    {
225
                    {
226
                        continue;
226
                        continue;