Subversion Repositories SmartDukaan

Rev

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

Rev 34472 Rev 34487
Line 2328... Line 2328...
2328
        List<String> finalSortedBrands = new ArrayList<>();
2328
        List<String> finalSortedBrands = new ArrayList<>();
2329
        finalSortedBrands.addAll(sortedBrandsByMtd);
2329
        finalSortedBrands.addAll(sortedBrandsByMtd);
2330
        finalSortedBrands.addAll(remainingBrands);
2330
        finalSortedBrands.addAll(remainingBrands);
2331
        finalSortedBrands.addAll(remainingBrandsWithoutStock);
2331
        finalSortedBrands.addAll(remainingBrandsWithoutStock);
2332
 
2332
 
-
 
2333
        Map<Integer, Integer> processingOrderMap = null;
-
 
2334
        List<PartnerStockDetailModel> pendingIndents = new ArrayList<>();
-
 
2335
        Map<Integer, PartnerStockDetailModel> pendingIndentsDetailMap = new HashMap<>();
-
 
2336
 
-
 
2337
        Map<Integer, Integer> processingOrder = orderRepository.selectOrders(fofoId, orderStatusList).stream()
-
 
2338
                .collect(Collectors.groupingBy(x -> x.getLineItem().getItemId(),
-
 
2339
                        Collectors.summingInt(x -> x.getLineItem().getQuantity())));
-
 
2340
        if (!processingOrder.isEmpty()) {
-
 
2341
            processingOrderMap = itemRepository.selectByIds(processingOrder.keySet()).stream()
-
 
2342
                    .collect(Collectors.groupingBy(x -> x.getCatalogItemId(),
-
 
2343
                            Collectors.summingInt(x -> processingOrder.get(x.getId()))));
-
 
2344
            pendingIndents.addAll(getBrandItemwiseDetail(brand, processingOrderMap));
-
 
2345
            pendingIndentsDetailMap = pendingIndents.stream().collect(Collectors.toMap(x -> x.getCatalogId(), x -> x));
-
 
2346
 
-
 
2347
        }
-
 
2348
        LOGGER.info("pendingIndents {}", pendingIndents);
-
 
2349
        LOGGER.info("pendingIndentsDetailMap {}", pendingIndentsDetailMap);
-
 
2350
 
2333
        model.addAttribute("brandStatusWiseStockListMap", sortedBrandStatusWiseStockListMap);
2351
        model.addAttribute("brandStatusWiseStockListMap", sortedBrandStatusWiseStockListMap);
-
 
2352
        model.addAttribute("pendingIndentsDetailMap", pendingIndentsDetailMap);
2334
        model.addAttribute("brands", finalSortedBrands);
2353
        model.addAttribute("brands", finalSortedBrands);
2335
        model.addAttribute("brandToMtdMap", brandToMtdMap);
2354
        model.addAttribute("brandToMtdMap", brandToMtdMap);
2336
        model.addAttribute("brand", brand);
2355
        model.addAttribute("brand", brand);
2337
        model.addAttribute("fofoId", fofoId);
2356
        model.addAttribute("fofoId", fofoId);
2338
        model.addAttribute("customRetailer", customRetailer);
2357
        model.addAttribute("customRetailer", customRetailer);
Line 2412... Line 2431...
2412
        }
2431
        }
2413
 
2432
 
2414
        return inStocks;
2433
        return inStocks;
2415
    }
2434
    }
2416
 
2435
 
-
 
2436
    private List<PartnerStockDetailModel> getBrandItemwiseDetail(String brand,
-
 
2437
                                                                 Map<Integer, Integer> catalogIdAndQtyMap) throws ProfitMandiBusinessException {
-
 
2438
        List<PartnerStockDetailModel> inStocks = new ArrayList<>();
-
 
2439
 
-
 
2440
        for (Entry<Integer, Integer> inStock : catalogIdAndQtyMap.entrySet()) {
-
 
2441
            List<Item> items = itemRepository.selectAllByCatalogItemId(inStock.getKey());
-
 
2442
            PartnerStockDetailModel psdp = new PartnerStockDetailModel();
-
 
2443
            psdp.setBrand(items.get(0).getBrand());
-
 
2444
            psdp.setItemDescription(items.get(0).getBrand() + " " + items.get(0).getModelName() + " "
-
 
2445
                    + items.get(0).getModelNumber());
-
 
2446
            psdp.setQty(inStock.getValue());
-
 
2447
            psdp.setCatalogId(items.get(0).getCatalogItemId());
-
 
2448
            inStocks.add(psdp);
-
 
2449
        }
-
 
2450
 
-
 
2451
        return inStocks;
-
 
2452
    }
-
 
2453
 
2417
    private FocusedModelShortageModel getFocusedModelShortage(int qty, int catalogId,
2454
    private FocusedModelShortageModel getFocusedModelShortage(int qty, int catalogId,
2418
                                                              Map<Integer, Integer> processingOrderMap, Map<Integer, Integer> grnPendingOrdersMap,
2455
                                                              Map<Integer, Integer> processingOrderMap, Map<Integer, Integer> grnPendingOrdersMap,
2419
                                                              Map<Integer, Integer> catalogIdAndQtyMap, int fofoId,
2456
                                                              Map<Integer, Integer> catalogIdAndQtyMap, int fofoId,
2420
                                                              Map<Integer, Map<Integer, List<SaholicPOItem>>> warehousePoItemAvailabilityMap, List<Item> items,
2457
                                                              Map<Integer, Map<Integer, List<SaholicPOItem>>> warehousePoItemAvailabilityMap, List<Item> items,
2421
                                                              CustomRetailer customRetailer) throws ProfitMandiBusinessException {
2458
                                                              CustomRetailer customRetailer) throws ProfitMandiBusinessException {