Subversion Repositories SmartDukaan

Rev

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

Rev 25101 Rev 25102
Line 1079... Line 1079...
1079
	}
1079
	}
1080
 
1080
 
1081
	private void validateMopPrice(Map<Integer, PriceModel> itemIdMopPriceMap,
1081
	private void validateMopPrice(Map<Integer, PriceModel> itemIdMopPriceMap,
1082
			Map<Integer, CustomFofoOrderItem> itemIdCustomFofoLineItemMap) throws ProfitMandiBusinessException {
1082
			Map<Integer, CustomFofoOrderItem> itemIdCustomFofoLineItemMap) throws ProfitMandiBusinessException {
1083
		Map<Integer, Float> invalidMopItemIdPriceMap = new HashMap<>();
1083
		Map<Integer, Float> invalidMopItemIdPriceMap = new HashMap<>();
1084
		Map<Integer, Float> invalidDiscountAmountMap = new HashMap<>();
-
 
1085
		for (Map.Entry<Integer, PriceModel> entry : itemIdMopPriceMap.entrySet()) {
1084
		for (Map.Entry<Integer, PriceModel> entry : itemIdMopPriceMap.entrySet()) {
1086
			CustomFofoOrderItem customFofoOrderItem = itemIdCustomFofoLineItemMap.get(entry.getKey());
1085
			CustomFofoOrderItem customFofoOrderItem = itemIdCustomFofoLineItemMap.get(entry.getKey());
1087
			if (entry.getValue().getPrice() < Float.MAX_VALUE
-
 
1088
					&& customFofoOrderItem.getSellingPrice() < entry.getValue().getPrice()) {
1086
			if (customFofoOrderItem.getSellingPrice() < entry.getValue().getPrice()) {
1089
				invalidMopItemIdPriceMap.put(entry.getKey(), customFofoOrderItem.getSellingPrice());
1087
				invalidMopItemIdPriceMap.put(entry.getKey(), customFofoOrderItem.getSellingPrice());
1090
			}
1088
			}
1091
			if (entry.getValue().isMop()
-
 
1092
					&& customFofoOrderItem.getDiscountAmount() > entry.getValue().getMaxDiscountAmount()) {
-
 
1093
				invalidDiscountAmountMap.put(entry.getKey(), customFofoOrderItem.getDiscountAmount());
-
 
1094
			}
-
 
1095
		}
1089
		}
1096
 
1090
 
1097
		if (!invalidMopItemIdPriceMap.isEmpty()) {
1091
		if (!invalidMopItemIdPriceMap.isEmpty()) {
1098
			LOGGER.error("Invalid itemIds selling prices{} should be greater than mop prices {}",
1092
			LOGGER.error("Invalid itemIds selling prices{} should be greater than mop prices {}",
1099
					invalidMopItemIdPriceMap, itemIdMopPriceMap);
1093
					invalidMopItemIdPriceMap, itemIdMopPriceMap);
1100
			throw new ProfitMandiBusinessException("invalidMopItemIdPrice", invalidMopItemIdPriceMap, "FFORDR_1010");
1094
			throw new ProfitMandiBusinessException("invalidMopItemIdPrice", invalidMopItemIdPriceMap, "FFORDR_1010");
1101
		}
1095
		}
1102
 
1096
 
1103
		if (!invalidDiscountAmountMap.isEmpty()) {
-
 
1104
			LOGGER.error("Invalid itemIds discount amounts {} should be less than maxDiscount prices {}",
-
 
1105
					invalidDiscountAmountMap, itemIdMopPriceMap);
-
 
1106
			throw new ProfitMandiBusinessException("invalidMopItemIdPrice", invalidDiscountAmountMap, "FFORDR_1011");
-
 
1107
		}
-
 
1108
	}
1097
	}
1109
 
1098
 
1110
	private void updateInventoryItemsAndScanRecord(Set<InventoryItem> inventoryItems, int fofoId,
1099
	private void updateInventoryItemsAndScanRecord(Set<InventoryItem> inventoryItems, int fofoId,
1111
			Map<Integer, Integer> inventoryItemQuantityUsed, int fofoOrderId) {
1100
			Map<Integer, Integer> inventoryItemQuantityUsed, int fofoOrderId) {
1112
		for (InventoryItem inventoryItem : inventoryItems) {
1101
		for (InventoryItem inventoryItem : inventoryItems) {