| Line 53... |
Line 53... |
| 53 |
|
53 |
|
| 54 |
private static final Set<Integer> tagIds = new HashSet<>(Arrays.asList(4));
|
54 |
private static final Set<Integer> tagIds = new HashSet<>(Arrays.asList(4));
|
| 55 |
|
55 |
|
| 56 |
private static final Logger logger = LogManager.getLogger(CartServiceImpl.class);
|
56 |
private static final Logger logger = LogManager.getLogger(CartServiceImpl.class);
|
| 57 |
|
57 |
|
| - |
|
58 |
private static final Map<Integer, List<Integer>> focusedModelVariantMap = new HashMap<>();
|
| - |
|
59 |
|
| 58 |
@Autowired
|
60 |
@Autowired
|
| 59 |
CartRepository cartRepository;
|
61 |
CartRepository cartRepository;
|
| 60 |
|
62 |
|
| 61 |
@Autowired
|
63 |
@Autowired
|
| 62 |
CartLineRepository cartLineRepository;
|
64 |
CartLineRepository cartLineRepository;
|
| Line 362... |
Line 364... |
| 362 |
public List<FocusedShortageModel> focusedModelShortageValidation(int fofoId,
|
364 |
public List<FocusedShortageModel> focusedModelShortageValidation(int fofoId,
|
| 363 |
Map<Integer, Integer> catalogCartQtyMap) throws ProfitMandiBusinessException {
|
365 |
Map<Integer, Integer> catalogCartQtyMap) throws ProfitMandiBusinessException {
|
| 364 |
|
366 |
|
| 365 |
logger.info("fofoId {}", fofoId);
|
367 |
logger.info("fofoId {}", fofoId);
|
| 366 |
|
368 |
|
| - |
|
369 |
focusedModelVariantMap.put(1022771, Arrays.asList(1022771));
|
| - |
|
370 |
focusedModelVariantMap.put(1023025, Arrays.asList(1022975, 1022945));
|
| - |
|
371 |
|
| - |
|
372 |
focusedModelVariantMap.put(1023027, Arrays.asList(1022706));
|
| - |
|
373 |
|
| - |
|
374 |
focusedModelVariantMap.put(1022976, Arrays.asList(1022744));
|
| - |
|
375 |
focusedModelVariantMap.put(1023045, Arrays.asList(1022768));
|
| - |
|
376 |
|
| - |
|
377 |
focusedModelVariantMap.put(1023066, Arrays.asList(1022858));
|
| - |
|
378 |
|
| 367 |
Map<Integer, Long> inStockItemModel = new HashMap<>();
|
379 |
Map<Integer, Long> inStockItemModel = new HashMap<>();
|
| 368 |
Map<Integer, Long> itempendingIndent = new HashMap<>();
|
380 |
Map<Integer, Long> itempendingIndent = new HashMap<>();
|
| 369 |
Map<Integer, Long> grnItemPendingOrders = new HashMap<>();
|
381 |
Map<Integer, Long> grnItemPendingOrders = new HashMap<>();
|
| 370 |
|
382 |
|
| 371 |
Map<Integer, Integer> focusedModelMap = null;
|
383 |
Map<Integer, Integer> focusedModelMap = null;
|
| Line 445... |
Line 457... |
| 445 |
|
457 |
|
| 446 |
long shortQty = Math.min(fm.getValue() - totalStock, warehouseStock);
|
458 |
long shortQty = Math.min(fm.getValue() - totalStock, warehouseStock);
|
| 447 |
logger.info("shortQty {}", shortQty);
|
459 |
logger.info("shortQty {}", shortQty);
|
| 448 |
|
460 |
|
| 449 |
if (shortQty > 0) {
|
461 |
if (shortQty > 0) {
|
| - |
|
462 |
if (focusedModelVariantMap.get(fm.getKey()) != null) {
|
| - |
|
463 |
List<Integer> variantCatalogIds = focusedModelVariantMap.get(fm.getKey());
|
| - |
|
464 |
logger.info("variantCatalogIds {}", variantCatalogIds);
|
| - |
|
465 |
|
| - |
|
466 |
int variantAvailability = 0;
|
| - |
|
467 |
for (Integer vc : variantCatalogIds) {
|
| - |
|
468 |
long variantOverallStock = (inStockItemModel.get(vc) == null ? 0 : inStockItemModel.get(vc))
|
| - |
|
469 |
+ (itempendingIndent.get(vc) == null ? 0 : itempendingIndent.get(vc))
|
| - |
|
470 |
+ (grnItemPendingOrders.get(vc) == null ? 0 : grnItemPendingOrders.get(vc));
|
| - |
|
471 |
logger.info("variantOverallStock {}", variantOverallStock);
|
| - |
|
472 |
|
| - |
|
473 |
// Blocked brands available quantity is discussed to zero
|
| - |
|
474 |
long variantWarehouseStock = catalogItemAailabilityMap.get(vc) == null ? 0
|
| - |
|
475 |
: catalogItemAailabilityMap.get(vc);
|
| - |
|
476 |
logger.info("variantWarehouseStock {}", variantWarehouseStock);
|
| - |
|
477 |
|
| - |
|
478 |
long variantCartValue = catalogCartQtyMap.get(vc) == null ? 0 : catalogCartQtyMap.get(vc);
|
| - |
|
479 |
|
| - |
|
480 |
logger.info("variantCartValue" + variantCartValue);
|
| - |
|
481 |
long variantTotalStock = variantOverallStock + variantCartValue;
|
| - |
|
482 |
logger.info("variantTotalStock" + variantTotalStock);
|
| - |
|
483 |
|
| - |
|
484 |
variantAvailability += (int) variantTotalStock;
|
| - |
|
485 |
|
| - |
|
486 |
}
|
| - |
|
487 |
|
| - |
|
488 |
logger.info("variantAvailability {}", variantAvailability);
|
| - |
|
489 |
|
| - |
|
490 |
shortQty = shortQty - variantAvailability;
|
| - |
|
491 |
|
| - |
|
492 |
}
|
| - |
|
493 |
}
|
| - |
|
494 |
|
| - |
|
495 |
logger.info("shortQty" + shortQty);
|
| - |
|
496 |
|
| - |
|
497 |
if (shortQty > 0) {
|
| 450 |
|
498 |
|
| 451 |
Map<Integer, Integer> requiredItemQty = new HashMap<>();
|
499 |
Map<Integer, Integer> requiredItemQty = new HashMap<>();
|
| 452 |
|
500 |
|
| 453 |
List<Item> it = itemRepository.selectAllByCatalogItemId(fm.getKey());
|
501 |
List<Item> it = itemRepository.selectAllByCatalogItemId(fm.getKey());
|
| 454 |
FocusedShortageModel fms = new FocusedShortageModel();
|
502 |
FocusedShortageModel fms = new FocusedShortageModel();
|