Subversion Repositories SmartDukaan

Rev

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

Rev 27040 Rev 27042
Line 636... Line 636...
636
				logger.info("Could not find Feature_s for {}", ffdr.getCatalogId());
636
				logger.info("Could not find Feature_s for {}", ffdr.getCatalogId());
637
			}
637
			}
638
			ffdr.setBrand(doc.getJSONArray("brand_ss").getString(0));
638
			ffdr.setBrand(doc.getJSONArray("brand_ss").getString(0));
639
			if (doc.has("_childDocuments_")) {
639
			if (doc.has("_childDocuments_")) {
640
				String modelColorClass = "grey";
640
				String modelColorClass = "grey";
-
 
641
				FofoAvailabilityInfo fdiAnyColour = null;
641
				for (int j = 0; j < doc.getJSONArray("_childDocuments_").length(); j++) {
642
				for (int j = 0; j < doc.getJSONArray("_childDocuments_").length(); j++) {
642
					JSONObject childItem = doc.getJSONArray("_childDocuments_").getJSONObject(j);
643
					JSONObject childItem = doc.getJSONArray("_childDocuments_").getJSONObject(j);
643
					int itemId = childItem.getInt("itemId_i");
644
					int itemId = childItem.getInt("itemId_i");
644
					float sellingPrice = (float) childItem.getDouble("sellingPrice_f");
645
					float sellingPrice = (float) childItem.getDouble("sellingPrice_f");
645
					if (fofoAvailabilityInfoMap.containsKey(itemId)) {
646
					if (fofoAvailabilityInfoMap.containsKey(itemId)) {
Line 649... Line 650...
649
						}
650
						}
650
					} else {
651
					} else {
651
						FofoAvailabilityInfo fdi = new FofoAvailabilityInfo();
652
						FofoAvailabilityInfo fdi = new FofoAvailabilityInfo();
652
						SaholicCIS currentAvailability = itemAvailabilityMap.get(itemId);
653
						SaholicCIS currentAvailability = itemAvailabilityMap.get(itemId);
653
						SaholicPOItem poItemAvailability = poItemAvailabilityMap.get(itemId); 
654
						SaholicPOItem poItemAvailability = poItemAvailabilityMap.get(itemId); 
654
						String poColor = "red";
655
						String poColor = "grey";
655
						boolean active = false;
656
						boolean active = false;
656
						if(currentAvailability != null && currentAvailability.getNetavailability() > 0) {
657
						if(currentAvailability != null && currentAvailability.getNetavailability() > 0) {
657
							poColor = "green";
658
							poColor = "green";
658
							modelColorClass = "green";
659
							modelColorClass = "green";
659
						} else if (poItemAvailability != null && poItemAvailability.getUnfulfilledQty() > 0) {
660
						} else if (poItemAvailability != null && poItemAvailability.getUnfulfilledQty() > 0) {
660
							if(currentAvailability != null 
661
							if(currentAvailability != null 
661
							&& poItemAvailability.getUnfulfilledQty() + currentAvailability.getNetavailability() <= 0) {
662
							&& poItemAvailability.getUnfulfilledQty() + currentAvailability.getNetavailability() <= 0) {
662
								poColor = "red";
663
								poColor = "grey";
663
							} else {
664
							} else {
664
								poColor = "yellow";
665
								poColor = "yellow";
665
								if(modelColorClass!="green") {
666
								if(modelColorClass!="green") {
666
									modelColorClass = poColor;
667
									modelColorClass = poColor;
667
								}
668
								}
Line 671... Line 672...
671
						fdi.setSellingPrice(sellingPrice);
672
						fdi.setSellingPrice(sellingPrice);
672
						fdi.setActive(active);
673
						fdi.setActive(active);
673
						fdi.setMrp(childItem.getDouble("mrp_f"));
674
						fdi.setMrp(childItem.getDouble("mrp_f"));
674
						fdi.setMop((float) childItem.getDouble("mop_f"));
675
						fdi.setMop((float) childItem.getDouble("mop_f"));
675
						fdi.setColor(childItem.has("color_s") ? childItem.getString("color_s") : "");
676
						fdi.setColor(childItem.has("color_s") ? childItem.getString("color_s") : "");
-
 
677
						if (fdi.getColor().equalsIgnoreCase("any colour")) {
-
 
678
							fdiAnyColour = fdi; 
-
 
679
						}
676
						fdi.setTagId(childItem.getInt("tagId_i"));
680
						fdi.setTagId(childItem.getInt("tagId_i"));
677
						fdi.setItem_id(itemId);
681
						fdi.setItem_id(itemId);
678
						Float cashBack = schemeService.getItemSchemeCashBack().get(itemId);
682
						Float cashBack = schemeService.getItemSchemeCashBack().get(itemId);
679
						cashBack = cashBack == null ? 0 : cashBack;
683
						cashBack = cashBack == null ? 0 : cashBack;
680
						fdi.setCashback(cashBack);
684
						fdi.setCashback(cashBack);
Line 692... Line 696...
692
						fdi.setQuantityStep(1);
696
						fdi.setQuantityStep(1);
693
						fdi.setMaxQuantity(Math.min(fdi.getAvailability(), 100));
697
						fdi.setMaxQuantity(Math.min(fdi.getAvailability(), 100));
694
						fofoAvailabilityInfoMap.put(itemId, fdi);
698
						fofoAvailabilityInfoMap.put(itemId, fdi);
695
					}
699
					}
696
				}
700
				}
-
 
701
				if(fdiAnyColour != null) {
-
 
702
					fdiAnyColour.setColorClass(modelColorClass);
-
 
703
				}
697
			}
704
			}
698
			if (fofoAvailabilityInfoMap.values().size() > 0) {
705
			if (fofoAvailabilityInfoMap.values().size() > 0) {
699
				List<FofoAvailabilityInfo> availabilityList = fofoAvailabilityInfoMap.values()
706
				List<FofoAvailabilityInfo> availabilityList = fofoAvailabilityInfoMap.values()
700
				.stream().sorted(Comparator.comparing(FofoAvailabilityInfo::getAvailability).reversed()).collect(Collectors.toList());
707
				.stream().sorted(Comparator.comparing(FofoAvailabilityInfo::getAvailability).reversed()).collect(Collectors.toList());
701
				ffdr.setItems(availabilityList);
708
				ffdr.setItems(availabilityList);