| Line 399... |
Line 399... |
| 399 |
|
399 |
|
| 400 |
@Override
|
400 |
@Override
|
| 401 |
public List<FocusedShortageModel> focusedModelShortageValidation(int fofoId,
|
401 |
public List<FocusedShortageModel> focusedModelShortageValidation(int fofoId,
|
| 402 |
Map<Integer, Integer> catalogCartQtyMap) throws ProfitMandiBusinessException {
|
402 |
Map<Integer, Integer> catalogCartQtyMap) throws ProfitMandiBusinessException {
|
| 403 |
|
403 |
|
| 404 |
logger.info("fofoId {}", fofoId);
|
- |
|
| 405 |
|
- |
|
| 406 |
focusedModelVariantMap.put(1022771, Arrays.asList(1022771));
|
- |
|
| 407 |
focusedModelVariantMap.put(1023025, Arrays.asList(1022975, 1022945));
|
- |
|
| 408 |
|
- |
|
| 409 |
focusedModelVariantMap.put(1023027, Arrays.asList(1022706));
|
- |
|
| 410 |
|
- |
|
| 411 |
focusedModelVariantMap.put(1022976, Arrays.asList(1022744));
|
- |
|
| 412 |
focusedModelVariantMap.put(1023045, Arrays.asList(1022768));
|
- |
|
| 413 |
|
- |
|
| 414 |
focusedModelVariantMap.put(1023066, Arrays.asList(1022858));
|
- |
|
| 415 |
|
- |
|
| 416 |
Map<Integer, Long> inStockItemModel = new HashMap<>();
|
- |
|
| 417 |
Map<Integer, Long> itempendingIndent = new HashMap<>();
|
- |
|
| 418 |
Map<Integer, Long> grnItemPendingOrders = new HashMap<>();
|
- |
|
| 419 |
|
- |
|
| 420 |
Map<Integer, Integer> focusedModelMap = null;
|
- |
|
| 421 |
|
- |
|
| 422 |
inStockItemModel = currentInventorySnapshotRepository.selectSumInMobileStockGroupByCatalog(fofoId).stream()
|
404 |
Map<Integer, Long> inStockItemModel = currentInventorySnapshotRepository.selectSumInMobileStockGroupByCatalog(fofoId).stream()
|
| 423 |
.collect(Collectors.toMap(x -> x.getCatalogItemId(), x -> x.getQty()));
|
405 |
.collect(Collectors.toMap(x -> x.getCatalogItemId(), x -> x.getQty()));
|
| 424 |
|
406 |
|
| 425 |
itempendingIndent = transactionService.getInTransitOrders(fofoId).stream()
|
407 |
Map<Integer, Long> itempendingIndent = transactionService.getInTransitOrders(fofoId).stream()
|
| 426 |
.collect(Collectors.groupingBy(x -> x.getLineItem().getItem().getCatalogItemId(),
|
408 |
.collect(Collectors.groupingBy(x -> x.getLineItem().getItem().getCatalogItemId(),
|
| 427 |
Collectors.summingLong(x -> (long) x.getLineItem().getQuantity())));
|
409 |
Collectors.summingLong(x -> (long) x.getLineItem().getQuantity())));
|
| 428 |
|
410 |
|
| 429 |
grnItemPendingOrders = orderRepository.selectPendingGrnOrders(fofoId).stream()
|
411 |
Map<Integer, Long> grnItemPendingOrders = orderRepository.selectPendingGrnOrders(fofoId).stream()
|
| 430 |
.collect(Collectors.groupingBy(x -> x.getLineItem().getItem().getCatalogItemId(),
|
412 |
.collect(Collectors.groupingBy(x -> x.getLineItem().getItem().getCatalogItemId(),
|
| 431 |
Collectors.summingLong(x -> (long) x.getLineItem().getQuantity())));
|
413 |
Collectors.summingLong(x -> (long) x.getLineItem().getQuantity())));
|
| 432 |
List<PartnerRegion> partnerRegions = partnerRegionRepository.selectByfofoId(fofoId);
|
- |
|
| 433 |
|
414 |
|
| 434 |
FofoStore fofoStore = fofoStoreRepository.selectByRetailerId(fofoId);
|
415 |
FofoStore fofoStore = fofoStoreRepository.selectByRetailerId(fofoId);
|
| 435 |
|
416 |
|
| 436 |
List<String> retailerBlockBrands = retailerBlockBrandRepository.selectAllByRetailer(fofoId).stream()
|
417 |
List<String> retailerBlockBrands = retailerBlockBrandRepository.selectAllByRetailer(fofoId).stream()
|
| 437 |
.map(x -> x.getBlockBrands()).collect(Collectors.toList());
|
418 |
.map(x -> x.getBlockBrands()).collect(Collectors.toList());
|
| 438 |
|
419 |
|
| - |
|
420 |
List<PartnerRegion> partnerRegions = partnerRegionRepository.selectByfofoId(fofoId);
|
| - |
|
421 |
Map<Integer, Integer> focusedModelMap;
|
| 439 |
if (partnerRegions.size() > 0) {
|
422 |
if (partnerRegions.size() > 0) {
|
| 440 |
focusedModelMap = focusedModelRepository
|
423 |
focusedModelMap = focusedModelRepository
|
| 441 |
.selectAllByRegionIds(
|
424 |
.selectAllByRegionIds(
|
| 442 |
partnerRegions.stream().map(x -> x.getRegionId()).collect(Collectors.toList()))
|
425 |
partnerRegions.stream().map(x -> x.getRegionId()).collect(Collectors.toList()))
|
| 443 |
.stream().collect(Collectors.toMap(x -> x.getCatalogId(), x -> x.getMinimumQty()));
|
426 |
.stream().collect(Collectors.toMap(x -> x.getCatalogId(), x -> x.getMinimumQty()));
|
| 444 |
} else {
|
427 |
} else {
|
| 445 |
focusedModelMap = new HashMap<>();
|
428 |
focusedModelMap = new HashMap<>();
|
| 446 |
}
|
429 |
}
|
| 447 |
|
430 |
|
| - |
|
431 |
return focusedModelShortageValidation(fofoId, catalogCartQtyMap, inStockItemModel,
|
| - |
|
432 |
itempendingIndent, grnItemPendingOrders, fofoStore, retailerBlockBrands, focusedModelMap);
|
| - |
|
433 |
}
|
| - |
|
434 |
|
| - |
|
435 |
@Override
|
| - |
|
436 |
public List<FocusedShortageModel> focusedModelShortageValidation(int fofoId,
|
| - |
|
437 |
Map<Integer, Integer> catalogCartQtyMap,
|
| - |
|
438 |
Map<Integer, Long> inStockItemModel,
|
| - |
|
439 |
Map<Integer, Long> itempendingIndent,
|
| - |
|
440 |
Map<Integer, Long> grnItemPendingOrders,
|
| - |
|
441 |
FofoStore fofoStore,
|
| - |
|
442 |
List<String> retailerBlockBrands,
|
| - |
|
443 |
Map<Integer, Integer> focusedModelMap) throws ProfitMandiBusinessException {
|
| - |
|
444 |
|
| - |
|
445 |
logger.info("fofoId {}", fofoId);
|
| - |
|
446 |
|
| - |
|
447 |
focusedModelVariantMap.put(1022771, Arrays.asList(1022771));
|
| - |
|
448 |
focusedModelVariantMap.put(1023025, Arrays.asList(1022975, 1022945));
|
| - |
|
449 |
focusedModelVariantMap.put(1023027, Arrays.asList(1022706));
|
| - |
|
450 |
focusedModelVariantMap.put(1022976, Arrays.asList(1022744));
|
| - |
|
451 |
focusedModelVariantMap.put(1023045, Arrays.asList(1022768));
|
| - |
|
452 |
focusedModelVariantMap.put(1023066, Arrays.asList(1022858));
|
| - |
|
453 |
|
| 448 |
Map<Integer, Integer> catalogItemAailabilityMap = new HashMap<>();
|
454 |
Map<Integer, Integer> catalogItemAailabilityMap = new HashMap<>();
|
| 449 |
|
455 |
|
| 450 |
for (Entry<Integer, Integer> fm : focusedModelMap.entrySet()) {
|
456 |
for (Entry<Integer, Integer> fm : focusedModelMap.entrySet()) {
|
| 451 |
List<Item> items = itemRepository.selectAllByCatalogItemId(fm.getKey());
|
457 |
List<Item> items = itemRepository.selectAllByCatalogItemId(fm.getKey());
|
| 452 |
int allColorNetAvailability = 0;
|
458 |
int allColorNetAvailability = 0;
|