Adjusted Precalculation check texts

This commit is contained in:
Anja Guenther 2025-09-27 20:17:23 +02:00
parent 931f5d6713
commit 0c42fb502e

View file

@ -61,7 +61,7 @@ public class PreCalculationCheckService {
var destinations = destinationRepository.getByPremiseId(premiseId);
if (destinations == null || destinations.isEmpty()) {
throw new PremiseValidationError("No destination for calculation. At least one destination is required.");
throw new PremiseValidationError("No destination defined yet, please add at least one destination.");
}
@ -75,17 +75,17 @@ public class PreCalculationCheckService {
if (routes.isEmpty() && destination.getD2d() == false)
throw new PremiseValidationError("No route found for destination " + node.getName() + ". Cannot use standard routing.");
throw new PremiseValidationError("No standard route available for destination " + node.getName() + ". Please use individual rate or contact your administrator.");
if (routes.stream().noneMatch(Route::getSelected) && destination.getD2d() == false)
throw new PremiseValidationError("No route selected for destination " + node.getName());
if (destination.getD2d() && (destination.getRateD2d() == null || destination.getRateD2d().compareTo(BigDecimal.ZERO) == 0)) {
throw new PremiseValidationError("Door-2-door rate not set or set to zero.");
throw new PremiseValidationError("Door-2-door rate not entered or zero.");
}
if (destination.getD2d() && (destination.getLeadTimeD2d() == null || destination.getLeadTimeD2d() == 0)) {
throw new PremiseValidationError("Door-2-door rate not set or set to zero.");
throw new PremiseValidationError("Door-2-door lead time not entered or zero.");
}
}
@ -98,36 +98,36 @@ public class PreCalculationCheckService {
throw new PremiseValidationError("In destination " + node.getName() + ": annual quantity must be greater than zero.");
if (destination.getD2d() == null)
throw new PremiseValidationError("In destination " + node.getName() + ": D2D not set.");
throw new PremiseValidationError("In destination " + node.getName() + ": Door-2-Door flag is missing. Please contact administrator.");
if (destination.getD2d() == true) {
if (destination.getRateD2d() == null || destination.getRateD2d().compareTo(BigDecimal.ZERO) == 0) {
throw new PremiseValidationError("In destination " + node.getName() + ": D2D Rate not set or set to zero.");
throw new PremiseValidationError("In destination " + node.getName() + ": Door-2-door rate not entered or zero.");
}
if (destination.getLeadTimeD2d() == null || destination.getLeadTimeD2d() == 0) {
throw new PremiseValidationError("In destination " + node.getName() + ": D2D lead time not set or set to zero.");
throw new PremiseValidationError("In destination " + node.getName() + ": Door-2-Door lead time not entered or zero.");
}
}
if (destination.getCountryId() == null || destination.getCountryId() == 0) {
throw new PremiseValidationError("In destination " + node.getName() + ": destination country ID not set. Please contact administrator");
throw new PremiseValidationError("In destination " + node.getName() + ": destination country ID not set. Please contact your administrator.");
}
if (destination.getGeoLat() == null || destination.getGeoLng() == null) {
throw new PremiseValidationError("In destination " + node.getName() + ": destination geo location not set. Please contact administrator");
throw new PremiseValidationError("In destination " + node.getName() + ": destination geo location not set. Please contact your administrator.");
}
if (destination.getDisposalCost() != null && destination.getDisposalCost().compareTo(BigDecimal.ZERO) == 0) {
throw new PremiseValidationError("In destination " + node.getName() + ": disposal cost set to zero.");
throw new PremiseValidationError("In destination " + node.getName() + ": disposal costs entered as zero.");
}
if (destination.getHandlingCost() != null && destination.getHandlingCost().compareTo(BigDecimal.ZERO) == 0) {
throw new PremiseValidationError("In destination " + node.getName() + ": handling cost set to zero.");
throw new PremiseValidationError("In destination " + node.getName() + ": handling costs entered as zero.");
}
if (destination.getRepackingCost() != null && destination.getRepackingCost().compareTo(BigDecimal.ZERO) == 0) {
throw new PremiseValidationError("In destination " + node.getName() + ": repackaging cost set to zero.");
throw new PremiseValidationError("In destination " + node.getName() + ": repackaging costs enstered as zero.");
}
}
@ -135,22 +135,22 @@ public class PreCalculationCheckService {
private void supplierCheck(Premise premise) {
if (premise.getSupplierNodeId() == null && premise.getUserSupplierNodeId() == null)
throw new PremiseValidationError("Supplier node is not set");
throw new PremiseValidationError("Supplier node not set. Please contact administrator");
}
private void priceCheck(Premise premise) {
if (premise.getMaterialCost() == null || premise.getMaterialCost().compareTo(BigDecimal.ZERO) == 0) {
throw new PremiseValidationError("MEK_A is not set or set to zero");
throw new PremiseValidationError("MEK_A not entered or zero.");
}
if (premise.getOverseaShare() == null || premise.getOverseaShare().compareTo(BigDecimal.ZERO) == 0) {
throw new PremiseValidationError("Oversea share is not set or set to zero");
if (premise.getOverseaShare() == null) {
throw new PremiseValidationError("Oversea share not entered.");
}
if (premise.getFcaEnabled() == null) {
throw new PremiseValidationError("FCA fee is not set");
throw new PremiseValidationError("FCA fee not set. Please contact administrator");
}
}
@ -158,11 +158,11 @@ public class PreCalculationCheckService {
private void packagingCheck(Premise premise) {
if (premise.getHuMixable() == null) {
throw new PremiseValidationError("Mixable not set.");
throw new PremiseValidationError("Mixable not set. Please contact administrator");
}
if (premise.getHuStackable() == null) {
throw new PremiseValidationError("Stackable not set.");
throw new PremiseValidationError("Stackable not set. Please contact administrator");
}
if (premise.getHuStackable() == false && premise.getHuMixable() == true) {
@ -170,31 +170,31 @@ public class PreCalculationCheckService {
}
if (premise.getIndividualHuLength() == null || premise.getIndividualHuLength() == 0) {
throw new PremiseValidationError("Packaging length is not set or set to zero");
throw new PremiseValidationError("Packaging length not entered or zero.");
}
if (premise.getIndividualHuWidth() == null || premise.getIndividualHuWidth() == 0) {
throw new PremiseValidationError("Packaging width is not set or set to zero");
throw new PremiseValidationError("Packaging width not entered or zero.");
}
if (premise.getIndividualHuHeight() == null || premise.getIndividualHuHeight() == 0) {
throw new PremiseValidationError("Packaging height is not set or set to zero");
throw new PremiseValidationError("Packaging height not entered or zero.");
}
if (premise.getIndividualHuWeight() == null || premise.getIndividualHuWeight() == 0) {
throw new PremiseValidationError("Packaging weight is not set or set to zero");
throw new PremiseValidationError("Packaging weight not entered or zero");
}
if (premise.getHuUnitCount() == null || premise.getHuUnitCount() == 0) {
throw new PremiseValidationError("Packaging unit count is not set or set to zero");
throw new PremiseValidationError("Packaging unit count not entered or zero.");
}
if (premise.getHuDisplayedWeightUnit() == null) {
throw new PremiseValidationError("Packaging weight unit is not set");
throw new PremiseValidationError("Packaging weight unit not set. Please contact administrator");
}
if (premise.getHuDisplayedDimensionUnit() == null) {
throw new PremiseValidationError("Packaging dimension unit is not set");
throw new PremiseValidationError("Packaging dimension unit not set. Please contact administrator");
}
var hu = dimensionTransformer.toDimensionEntity(premise).withTolerance(DIMENSION_TOLERANCE);
@ -203,16 +203,16 @@ public class PreCalculationCheckService {
Optional<Integer> feuLoad = propertyService.getProperty(SystemPropertyMappingId.TEU_LOAD);
if (teuLoad.isEmpty() || feuLoad.isEmpty())
throw new PremiseValidationError("There is a system property misconfiguration. Please contact administrator");
throw new PremiseValidationError("System properties not properly configured. Please contact your administrator.");
if (WeightUnit.KG.convertFromG(hu.getWeight()) > teuLoad.get() && hu.getWeight() > feuLoad.get())
throw new PremiseValidationError("The handling unit is too heavy. Configured maximum is " + Math.max(teuLoad.get(), feuLoad.get()) + " kg. ");
throw new PremiseValidationError("HU weight exceeds maximum container weight load (" + Math.max(teuLoad.get(), feuLoad.get()) + " kg). Review entered weight and selected weight unit [g, kg, t].");
var teuFitsXY = (hu.getLength() < ContainerType.TEU.getLength() && hu.getWidth() < ContainerType.TEU.getWidth());
var teuFitsYX = (hu.getWidth() < ContainerType.TEU.getLength() && hu.getLength() < ContainerType.TEU.getWidth());
if (!teuFitsYX && !teuFitsXY) {
throw new PremiseValidationError("The handling unit is too big. Has to fit into twenty food equivalent (minus " + DIMENSION_TOLERANCE + " tolerance) container.");
throw new PremiseValidationError("HU dimensions too large. Review entered length, width, height and selected dimension unit [mm, cm, m].");
}
}
@ -222,7 +222,7 @@ public class PreCalculationCheckService {
throw new PremiseValidationError("Invalid HS code.");
if (premise.getTariffRate() == null) {
throw new PremiseValidationError("Tariff Rate not set.");
throw new PremiseValidationError("Tariff rate not entered.");
}
}