private boolean checkCoverageLocations(final Entity materialRequirementCoverage) { List<Entity> coverageLocations = materialRequirementCoverage .getHasManyField(MaterialRequirementCoverageFields.COVERAGE_LOCATIONS); if (coverageLocations.isEmpty()) { materialRequirementCoverage.addGlobalError("orderSupplies.materialRequirementCoverage.emptyCoverageLocations"); return false; } return true; }
public boolean onDelete(final DataDefinition issueDD, final Entity issue) { if (issue.getBooleanField(IssueFields.ISSUED)) { issue.addGlobalError("productFlowThruDivision.issue.canNotRemoveIssuedEntity"); return false; } return true; }
public boolean onDelete(final DataDefinition dataDefinition, final Entity workstation) { if (workstation.getBelongsToField(WorkstationFieldsPL.PRODUCTION_LINE) == null) { return true; } workstation.addGlobalError("productionLines.workstation.onDelete.error"); return false; }
public boolean onDelete(final DataDefinition dataDefinition, final Entity division) { boolean canDelete = division.getManyToManyField(DivisionFieldsPL.PRODUCTION_LINES).isEmpty(); if (!canDelete) { division.addGlobalError("productionLines.division.onDelete.hasProductionLines"); } return canDelete; } }
private void addDocumentErrors(Entity document, List<String> invalidProducts) { String productNumbers = invalidProducts.stream().collect(Collectors.joining(", ")) + " "; Entity locationFrom = document.getBelongsToField(DocumentFields.LOCATION_FROM); String locationNumber = locationFrom == null ? "" : locationFrom.getStringField(LocationFields.NUMBER); document.addGlobalError("materialFlow.error.position.quantity.notEnoughResources", false, productNumbers, locationNumber); } }
public boolean onDelete(final DataDefinition workstationDD, final Entity workstation) { boolean isDeleted = true; List<Entity> operations = workstation.getManyToManyField(WorkstationFieldsT.OPERATIONS); List<Entity> operationComponents = workstation.getManyToManyField(WorkstationFieldsT.OPERATION_COMPONENTS); if (!operations.isEmpty() || !operationComponents.isEmpty()) { workstation.addGlobalError("qcadooView.errorPage.error.dataIntegrityViolationException.objectInUse.explanation"); isDeleted = false; } return isDeleted; }
public boolean onDelete(final DataDefinition eventDD, final Entity event) { if (event.getBelongsToField(PlannedEventFields.MAINTENANCE_EVENT) != null) { event.addGlobalError("cmmsMachineParts.plannedEvent.error.cannotDeleteRelatedPlannedEvent"); return false; } if (!event.getHasManyField(PlannedEventFields.RELATED_EVENTS).isEmpty()) { event.addGlobalError("cmmsMachineParts.plannedEvent.error.cannotDeleteEventWithRelatedEvents"); return false; } return true; } }
public boolean checkIfTechnologyIsPrototypeForOrders(final DataDefinition technologyDD, final Entity technology) { List<Entity> orders = technology.getHasManyField(TechnologyFieldsO.ORDERS_USING_PROTOTYPE); if (!orders.isEmpty()) { technology.addGlobalError("orders.technology.hasOrdersAsPrototype", technology.getStringField(TechnologyFields.NUMBER)); return false; } return true; } }
public boolean onDelete(final DataDefinition dataDefinition, final Entity workstation) { boolean canDelete = workstation.getHasManyField(WorkstationFields.SUBASSEMBLIES).isEmpty(); if (!canDelete) { workstation.addGlobalError("basic.workstation.delete.hasSubassemblies"); } return canDelete; } }
public boolean onDelete(final DataDefinition dataDefinition, final Entity factory) { boolean canDelete = factory.getHasManyField(FactoryFields.DIVISIONS).isEmpty(); if (!canDelete) { factory.addGlobalError("basic.factory.delete.hasDivisions"); } return canDelete; } }
private void checkIfRecordOperationProductComponentsWereFilled(final Entity productionTracking) { boolean usedNotFilled = checkIfUsedQuantitiesWereNotFilled(productionTracking); boolean producedNotFilled = checkIfUsedOrWastesQuantitiesWereNotFilled(productionTracking); if (usedNotFilled && producedNotFilled) { productionTracking.addGlobalError( "productionCounting.productionTracking.messages.error.recordOperationProductComponentsNotFilled"); } }
private boolean deliveryHasLocationSet(Entity deliveredProductMulti) { Entity delivery = deliveredProductMulti.getBelongsToField(DeliveredProductMultiFields.DELIVERY); Entity location = delivery.getBelongsToField(DeliveryFields.LOCATION); if (location == null) { deliveredProductMulti.addGlobalError("deliveries.deliveredProductMultiPosition.error.locationRequired"); return false; } return true; }
public boolean onDelete(final DataDefinition resourceStockDD, final Entity resourceStock) { BigDecimal quantity = resourceStockService.getResourceStockQuantity( resourceStock.getBelongsToField(ResourceStockFields.PRODUCT), resourceStock.getBelongsToField(ResourceStockFields.LOCATION)); if (quantity.compareTo(BigDecimal.ZERO) != 0) { resourceStock.addGlobalError("materialFlowResources.resourceStock.delete.error"); return false; } return true; } }
private boolean checkAddressType(final DataDefinition addressDD, final Entity address) { String addressType = address.getStringField(AddressFields.ADDRESS_TYPE); if (basicService.checkIfIsMainAddressType(addressType)) { if (!checkIfOnlyOneMainAddressExists(addressDD, address, addressType)) { address.addGlobalError("basic.address.error.mainAddressAlreadyExists"); return false; } } return true; }
public boolean checkIfWarehousesAreDifferent(final DataDefinition dataDefinition, final Entity division) { Entity componentsLocation = division.getBelongsToField(DivisionFieldsPFTD.COMPONENTS_LOCATION); Entity componentsOutLocation = division.getBelongsToField(DivisionFieldsPFTD.COMPONENTS_OUTPUT_LOCATION); if (componentsLocation != null && componentsOutLocation != null && componentsLocation.getId().equals(componentsOutLocation.getId())) { division.addGlobalError("technologies.technology.error.componentsLocationsAreSame", false); return false; } return true; } }
public boolean checkComponentsWarehouses(final DataDefinition dataDefinition, final Entity opic) { Entity componentsLocation = opic.getBelongsToField(OperationProductInComponentFieldsPFTD.COMPONENTS_LOCATION); Entity componentsOutputLocation = opic .getBelongsToField(OperationProductInComponentFieldsPFTD.COMPONENTS_OUTPUT_LOCATION); if (componentsLocation != null && componentsOutputLocation != null && componentsLocation.getId().equals(componentsOutputLocation.getId())) { opic.addGlobalError("technologies.technology.error.componentsLocationsAreSame", false); return false; } return true; } }
public boolean checkComponentsWarehouses(final DataDefinition dataDefinition, final Entity pcq) { Entity componentsLocation = pcq.getBelongsToField(ProductionCountingQuantityFieldsPFTD.COMPONENTS_LOCATION); Entity componentsOutputLocation = pcq.getBelongsToField(ProductionCountingQuantityFieldsPFTD.COMPONENTS_OUTPUT_LOCATION); if (componentsLocation != null && componentsOutputLocation != null && componentsLocation.getId().equals(componentsOutputLocation.getId())) { pcq.addGlobalError("technologies.technology.error.componentsLocationsAreSame", false); return false; } return true; } }
private void addPositionErrors(final Entity document, final Entity saved) { if (!saved.isValid()) { document.setNotValid(); saved.getGlobalErrors().forEach(e -> document.addGlobalError(e.getMessage(), e.getAutoClose(), e.getVars())); if (!saved.getErrors().isEmpty()) { document.addGlobalError("materialFlow.document.fillResources.global.error.positionNotValid", false, saved .getBelongsToField(PositionFields.PRODUCT).getStringField(ProductFields.NUMBER)); } } }
public boolean onDelete(final DataDefinition dataDefinition, final Entity division) { if (division.getHasManyField("operations").isEmpty() && division.getHasManyField("technologyOperationComponents").isEmpty()) { return true; } division.addGlobalError("basic.division.onDelete.error"); return false; }
public boolean onDelete(final DataDefinition generatorContextDD, final Entity generatorContext) { if(!generatorContext.getDataDefinition().get(generatorContext.getId()).getHasManyField("technologies").isEmpty()){ generatorContext.addGlobalError("technologiesGenerator.generate.deleteContext.error", false); return false; } return true; } }