| Line 558... |
Line 558... |
| 558 |
Map<Integer, FocusedModel> focusedModelMap = focusedModelRepository.selectAll().stream()
|
558 |
Map<Integer, FocusedModel> focusedModelMap = focusedModelRepository.selectAll().stream()
|
| 559 |
.collect(Collectors.toMap(FocusedModel::getCatalogId, Function.identity()));
|
559 |
.collect(Collectors.toMap(FocusedModel::getCatalogId, Function.identity()));
|
| 560 |
|
560 |
|
| 561 |
LocalDate currentMonthDate = LocalDate.now();
|
561 |
LocalDate currentMonthDate = LocalDate.now();
|
| 562 |
MonthlyPlanned monthlyPlanned = null;
|
562 |
MonthlyPlanned monthlyPlanned = null;
|
| - |
|
563 |
List<Integer> fofoOrderIds = null;
|
| 563 |
LOGGER.info("localDate" + LocalDate.now());
|
564 |
LOGGER.info("localDate" + LocalDate.now());
|
| 564 |
if (LocalDate.now().isAfter(LocalDate.now().withDayOfMonth(25))
|
565 |
if (LocalDate.now().isAfter(LocalDate.now().withDayOfMonth(25))
|
| 565 |
&& LocalDate.now().isBefore(LocalDate.now().plusMonths(1).withDayOfMonth(8))) {
|
566 |
&& LocalDate.now().isBefore(LocalDate.now().plusMonths(1).withDayOfMonth(8))) {
|
| 566 |
currentMonthDate = LocalDate.now().plusMonths(1).withDayOfMonth(1);
|
567 |
currentMonthDate = LocalDate.now().plusMonths(1).withDayOfMonth(1);
|
| 567 |
monthlyPlanned = monthlyPlannedRepository.selectByFofoIdYearMonth(fofoId, currentMonthDate);
|
568 |
monthlyPlanned = monthlyPlannedRepository.selectByFofoIdYearMonth(fofoId, currentMonthDate);
|
| 568 |
LOGGER.info("monthlyPlanned2" + monthlyPlanned);
|
569 |
LOGGER.info("monthlyPlanned2" + monthlyPlanned);
|
| - |
|
570 |
fofoOrderIds = fofoOrderRepository.selectByFofoIdBetweenCreatedTimeStamp(loginDetails.getFofoId(),
|
| - |
|
571 |
LocalDateTime.now().minusDays(15), LocalDateTime.now()).stream().map(x -> x.getId())
|
| - |
|
572 |
.collect(Collectors.toList());
|
| 569 |
|
573 |
|
| 570 |
model.addAttribute("planningMonth", LocalDate.now().plusMonths(1).getMonth());
|
574 |
model.addAttribute("planningMonth", LocalDate.now().plusMonths(1).getMonth());
|
| 571 |
} else if (LocalDate.now().isAfter(LocalDate.now().withDayOfMonth(8))
|
575 |
} else if (LocalDate.now().isAfter(LocalDate.now().withDayOfMonth(8))
|
| 572 |
&& (LocalDate.now().isBefore(LocalDate.now().withDayOfMonth(26)))) {
|
576 |
&& (LocalDate.now().isBefore(LocalDate.now().withDayOfMonth(26)))) {
|
| 573 |
currentMonthDate = LocalDate.now().withDayOfMonth(1);
|
577 |
currentMonthDate = LocalDate.now().withDayOfMonth(1);
|
| - |
|
578 |
LocalDateTime curDate = LocalDate.now().atStartOfDay();
|
| 574 |
monthlyPlanned = monthlyPlannedRepository.selectByFofoIdYearMonth(fofoId, currentMonthDate);
|
579 |
monthlyPlanned = monthlyPlannedRepository.selectByFofoIdYearMonth(fofoId, currentMonthDate);
|
| 575 |
model.addAttribute("planningMonth", currentMonthDate.getMonth());
|
580 |
model.addAttribute("planningMonth", currentMonthDate.getMonth());
|
| - |
|
581 |
model.addAttribute("mtd", true);
|
| 576 |
model.addAttribute("freezed", true);
|
582 |
model.addAttribute("freezed", true);
|
| - |
|
583 |
fofoOrderIds = fofoOrderRepository.selectByFofoIdBetweenCreatedTimeStamp(loginDetails.getFofoId(),
|
| - |
|
584 |
curDate.withDayOfMonth(1), curDate.with(LocalTime.MAX)).stream().map(x -> x.getId())
|
| - |
|
585 |
.collect(Collectors.toList());
|
| 577 |
LOGGER.info("monthlyPlanned1" + monthlyPlanned);
|
586 |
LOGGER.info("monthlyPlanned1" + monthlyPlanned);
|
| 578 |
} else if (LocalDate.now().isBefore(LocalDate.now().withDayOfMonth(8))) {
|
587 |
} else if (LocalDate.now().isBefore(LocalDate.now().withDayOfMonth(8))) {
|
| 579 |
currentMonthDate = LocalDate.now().withDayOfMonth(1);
|
588 |
currentMonthDate = LocalDate.now().withDayOfMonth(1);
|
| 580 |
monthlyPlanned = monthlyPlannedRepository.selectByFofoIdYearMonth(fofoId, currentMonthDate);
|
589 |
monthlyPlanned = monthlyPlannedRepository.selectByFofoIdYearMonth(fofoId, currentMonthDate);
|
| 581 |
LOGGER.info("monthlyPlanned3" + monthlyPlanned);
|
590 |
LOGGER.info("monthlyPlanned3" + monthlyPlanned);
|
| - |
|
591 |
fofoOrderIds = fofoOrderRepository.selectByFofoIdBetweenCreatedTimeStamp(loginDetails.getFofoId(),
|
| - |
|
592 |
LocalDateTime.now().minusDays(15), LocalDateTime.now()).stream().map(x -> x.getId())
|
| - |
|
593 |
.collect(Collectors.toList());
|
| 582 |
model.addAttribute("planningMonth", LocalDate.now().getMonth());
|
594 |
model.addAttribute("planningMonth", LocalDate.now().getMonth());
|
| 583 |
}
|
595 |
}
|
| 584 |
|
596 |
|
| 585 |
Map<Integer, Integer> plannedDetailMap = null;
|
597 |
Map<Integer, Integer> plannedDetailMap = null;
|
| 586 |
if (monthlyPlanned != null) {
|
598 |
if (monthlyPlanned != null) {
|
| 587 |
plannedDetailMap = plannedDetailRepository.selectByPlannedId(monthlyPlanned.getId()).stream()
|
599 |
plannedDetailMap = plannedDetailRepository.selectByPlannedId(monthlyPlanned.getId()).stream()
|
| 588 |
.collect(Collectors.toMap(x -> x.getCatalogId(), x -> x.getQuantity()));
|
600 |
.collect(Collectors.toMap(x -> x.getCatalogId(), x -> x.getQuantity()));
|
| 589 |
|
601 |
|
| 590 |
}
|
602 |
}
|
| 591 |
LOGGER.info("plannedDetailMap" + plannedDetailMap);
|
603 |
LOGGER.info("plannedDetailMap" + plannedDetailMap);
|
| 592 |
List<Integer> fofoOrderIds = fofoOrderRepository.selectByFofoIdBetweenCreatedTimeStamp(loginDetails.getFofoId(),
|
- |
|
| 593 |
LocalDateTime.now().minusDays(15), LocalDateTime.now()).stream().map(x -> x.getId())
|
- |
|
| 594 |
.collect(Collectors.toList());
|
- |
|
| - |
|
604 |
|
| 595 |
LOGGER.info("fofoOrderIds" + fofoOrderIds);
|
605 |
LOGGER.info("fofoOrderIds" + fofoOrderIds);
|
| 596 |
Map<String, Object> equalsJoinMap = new HashMap<>();
|
606 |
Map<String, Object> equalsJoinMap = new HashMap<>();
|
| 597 |
equalsJoinMap.put("orderId", fofoOrderIds);
|
607 |
equalsJoinMap.put("orderId", fofoOrderIds);
|
| 598 |
|
608 |
|
| 599 |
Map<Integer, Integer> last15daysMap = itemRepository
|
609 |
Map<Integer, Integer> last15daysMap = itemRepository
|
| Line 674... |
Line 684... |
| 674 |
}
|
684 |
}
|
| 675 |
Integer inTransitQuantity = itemsInTransit.get(item.getId());
|
685 |
Integer inTransitQuantity = itemsInTransit.get(item.getId());
|
| 676 |
int inTransitQty = (inTransitQuantity == null ? 0 : inTransitQuantity);
|
686 |
int inTransitQty = (inTransitQuantity == null ? 0 : inTransitQuantity);
|
| 677 |
catalogListingModel.setInTransitQuantity(catalogListingModel.getInTransitQuantity() + inTransitQty);
|
687 |
catalogListingModel.setInTransitQuantity(catalogListingModel.getInTransitQuantity() + inTransitQty);
|
| 678 |
|
688 |
|
| - |
|
689 |
if (plannedDetailMap.get(catalogId) != null) {
|
| - |
|
690 |
|
| - |
|
691 |
int remaining = plannedDetailMap.get(catalogId) - catalogListingModel.getLast15DaysSale()
|
| - |
|
692 |
+ catalogListingModel.getStockInHand() + catalogListingModel.getInTransitQuantity();
|
| - |
|
693 |
LOGGER.info("remaning" + remaining);
|
| - |
|
694 |
|
| - |
|
695 |
if (remaining != 0) {
|
| - |
|
696 |
catalogListingModel.setRemaining(remaining);
|
| - |
|
697 |
} else {
|
| - |
|
698 |
catalogListingModel.setRemaining(0);
|
| - |
|
699 |
}
|
| - |
|
700 |
}
|
| 679 |
}
|
701 |
}
|
| 680 |
|
702 |
|
| 681 |
Map<Integer, CustomRetailer> customRetailersMap = retailerService.getFofoRetailers();
|
703 |
Map<Integer, CustomRetailer> customRetailersMap = retailerService.getFofoRetailers();
|
| 682 |
if (fofoId > 0) {
|
704 |
if (fofoId > 0) {
|
| 683 |
CustomRetailer customRetailer = customRetailersMap.get(fofoId);
|
705 |
CustomRetailer customRetailer = customRetailersMap.get(fofoId);
|