| Line 2170... |
Line 2170... |
| 2170 |
|
2170 |
|
| 2171 |
}
|
2171 |
}
|
| 2172 |
|
2172 |
|
| 2173 |
|
2173 |
|
| 2174 |
@RequestMapping(value = "/getPoCatalogsItems", method = RequestMethod.GET)
|
2174 |
@RequestMapping(value = "/getPoCatalogsItems", method = RequestMethod.GET)
|
| 2175 |
public String getPoCatalogsItems(HttpServletRequest request, @RequestParam int catalogId, @RequestParam float price, Model model)
|
2175 |
public String getPoCatalogsItems(HttpServletRequest request, @RequestParam int catalogId, @RequestParam int warehouseId, @RequestParam float price, Model model)
|
| 2176 |
throws Exception {
|
2176 |
throws Exception {
|
| 2177 |
List<Item> poItems = itemRepository.selectAllByCatalogItemId(catalogId);
|
2177 |
List<Item> poItems = itemRepository.selectAllByCatalogItemId(catalogId);
|
| - |
|
2178 |
|
| - |
|
2179 |
List<Integer> itemIds = poItems.stream().map(x -> x.getId()).collect(Collectors.toList());
|
| - |
|
2180 |
|
| - |
|
2181 |
Map<Integer, Integer> saholicInventoryMap = saholicInventoryService.getTotalAvailabilityByItemIds(itemIds);
|
| - |
|
2182 |
|
| - |
|
2183 |
Set<Integer> availableStockItemIds = saholicInventoryMap.entrySet().stream()
|
| - |
|
2184 |
.filter(x -> x.getValue() > 0)
|
| - |
|
2185 |
.map(Map.Entry::getKey)
|
| - |
|
2186 |
.collect(Collectors.toSet());
|
| - |
|
2187 |
|
| - |
|
2188 |
List<WarehouseIntransitDataModel> warehouseIntransitDataModels = saholicInventoryService.getWarehouseIntransistDataList().stream().filter((x -> x.getWarehouseId() == warehouseId)).collect(Collectors.toList());
|
| - |
|
2189 |
|
| - |
|
2190 |
Set<Integer> intransitItemIds = warehouseIntransitDataModels.stream()
|
| - |
|
2191 |
.filter(x -> x.getQty() > 0)
|
| - |
|
2192 |
.map(WarehouseIntransitDataModel::getItemId)
|
| - |
|
2193 |
.collect(Collectors.toSet());
|
| - |
|
2194 |
|
| - |
|
2195 |
// Filter intransitItemIds to only those in itemIds
|
| - |
|
2196 |
Set<Integer> intransitItemIdsFiltered = new HashSet<>(intransitItemIds);
|
| - |
|
2197 |
intransitItemIdsFiltered.retainAll(itemIds);
|
| - |
|
2198 |
|
| - |
|
2199 |
Set<Integer> itemIdsWithBothStocks = new HashSet<>();
|
| - |
|
2200 |
itemIdsWithBothStocks.addAll(intransitItemIdsFiltered); // keeps only the common ones
|
| - |
|
2201 |
itemIdsWithBothStocks.addAll(availableStockItemIds); // keeps only the common ones
|
| - |
|
2202 |
|
| - |
|
2203 |
LOGGER.info("itemIds {}", itemIds);
|
| - |
|
2204 |
LOGGER.info("itemIdsWithBothStocks {}", itemIdsWithBothStocks);
|
| - |
|
2205 |
LOGGER.info("availableStockItemIds {}", availableStockItemIds);
|
| - |
|
2206 |
LOGGER.info("intransitItemIdsFiltered {}", intransitItemIdsFiltered);
|
| - |
|
2207 |
List<Item> instockItems = itemRepository.selectByIds(itemIdsWithBothStocks);
|
| - |
|
2208 |
|
| 2178 |
model.addAttribute("poItems", poItems);
|
2209 |
model.addAttribute("poItems", instockItems);
|
| 2179 |
model.addAttribute("price", price);
|
2210 |
model.addAttribute("price", price);
|
| 2180 |
|
2211 |
|
| 2181 |
return "po-catalog-items";
|
2212 |
return "po-catalog-items";
|
| 2182 |
}
|
2213 |
}
|
| 2183 |
|
2214 |
|
| Line 2215... |
Line 2246... |
| 2215 |
LocalDateTime curDate = LocalDate.now().atStartOfDay();
|
2246 |
LocalDateTime curDate = LocalDate.now().atStartOfDay();
|
| 2216 |
|
2247 |
|
| 2217 |
FofoStore fofoStore = fofoStoreRepository.selectByRetailerId(fofoId);
|
2248 |
FofoStore fofoStore = fofoStoreRepository.selectByRetailerId(fofoId);
|
| 2218 |
CustomRetailer customRetailer = retailerService.getFofoRetailer(fofoId);
|
2249 |
CustomRetailer customRetailer = retailerService.getFofoRetailer(fofoId);
|
| 2219 |
|
2250 |
|
| - |
|
2251 |
int warehouseId = fofoStore.getWarehouseId();
|
| - |
|
2252 |
|
| 2220 |
List<BrandWisePartnerSaleModel> brandWisePartnerSaleModels = fofoStoreRepository.selectGroupByBrandWarehousePartnerSale(Arrays.asList(fofoId));
|
2253 |
List<BrandWisePartnerSaleModel> brandWisePartnerSaleModels = fofoStoreRepository.selectGroupByBrandWarehousePartnerSale(Arrays.asList(fofoId));
|
| 2221 |
LOGGER.info("brandWisePartnerSaleModels {}", brandWisePartnerSaleModels);
|
2254 |
LOGGER.info("brandWisePartnerSaleModels {}", brandWisePartnerSaleModels);
|
| 2222 |
|
2255 |
|
| 2223 |
Map<String, Long> brandToMtdMap = brandWisePartnerSaleModels.stream().collect(Collectors.toMap(x -> x.getBrand(), x -> x.getMtd()));
|
2256 |
Map<String, Long> brandToMtdMap = brandWisePartnerSaleModels.stream().collect(Collectors.toMap(x -> x.getBrand(), x -> x.getMtd()));
|
| 2224 |
|
2257 |
|
| Line 2458... |
Line 2491... |
| 2458 |
model.addAttribute("brandToMtdMap", brandToMtdMap);
|
2491 |
model.addAttribute("brandToMtdMap", brandToMtdMap);
|
| 2459 |
model.addAttribute("catalogWiseQtyMap", catalogWiseQtyMap);
|
2492 |
model.addAttribute("catalogWiseQtyMap", catalogWiseQtyMap);
|
| 2460 |
model.addAttribute("intransistSummaryList", intransistSummaryList);
|
2493 |
model.addAttribute("intransistSummaryList", intransistSummaryList);
|
| 2461 |
model.addAttribute("brand", brand);
|
2494 |
model.addAttribute("brand", brand);
|
| 2462 |
model.addAttribute("fofoId", fofoId);
|
2495 |
model.addAttribute("fofoId", fofoId);
|
| - |
|
2496 |
model.addAttribute("warehouseId", warehouseId);
|
| 2463 |
model.addAttribute("customRetailer", customRetailer);
|
2497 |
model.addAttribute("customRetailer", customRetailer);
|
| 2464 |
model.addAttribute("shortInvest", shortInvest);
|
2498 |
model.addAttribute("shortInvest", shortInvest);
|
| 2465 |
model.addAttribute("purchaseMtd", purchaseMtd);
|
2499 |
model.addAttribute("purchaseMtd", purchaseMtd);
|
| 2466 |
model.addAttribute("purchasedFtd", purchasedFtd);
|
2500 |
model.addAttribute("purchasedFtd", purchasedFtd);
|
| 2467 |
model.addAttribute("saleMtd", saleMtd);
|
2501 |
model.addAttribute("saleMtd", saleMtd);
|