use of com.qcadoo.model.api.search.SearchCriterion in project mes by qcadoo.
the class ChangeoverNormsSearchServiceImpl method getProductionLineRestrictions.
private SearchCriterion getProductionLineRestrictions(final Long productionLineId) {
SearchCriterion matchProductionLine = eq(LineChangeoverNormsFields.PRODUCTION_LINE + DOT_ID, productionLineId);
SearchCriterion productionLineIsNull = isNull(LineChangeoverNormsFields.PRODUCTION_LINE);
return or(matchProductionLine, productionLineIsNull);
}
use of com.qcadoo.model.api.search.SearchCriterion in project mes by qcadoo.
the class MasterOrderValidators method checkIfEachOrderHasNumberStartingWithMasterOrderNumber.
private boolean checkIfEachOrderHasNumberStartingWithMasterOrderNumber(final Entity masterOrder) {
String newMasterOrderNumber = masterOrder.getStringField(MasterOrderFields.NUMBER);
SearchCriterion criteria = not(like(OrderFields.NUMBER, newMasterOrderNumber + "%"));
Collection<String> unsupportedOrderNumbers = masterOrderOrdersDataProvider.findBelongingOrderNumbers(masterOrder, criteria);
if (unsupportedOrderNumbers.isEmpty()) {
return true;
}
addUnsupportedOrdersError(masterOrder, MasterOrderFields.NUMBER, "masterOrders.order.number.alreadyExistsOrderWithWrongNumber", unsupportedOrderNumbers);
return false;
}
use of com.qcadoo.model.api.search.SearchCriterion in project mes by qcadoo.
the class MasterOrderOrdersDataProvider method sumBelongingOrdersPlannedQuantities.
public BigDecimal sumBelongingOrdersPlannedQuantities(final Entity masterOrder, final Entity product) {
SearchProjection quantitiesSumProjection = list().add(alias(sum(OrderFields.PLANNED_QUANTITY), QUANTITIES_SUM_ALIAS)).add(rowCount());
SearchCriterion productCriterion = belongsTo(OrderFields.PRODUCT, product);
List<Entity> quantitiesSumProjectionResults = findBelongingOrders(masterOrder, quantitiesSumProjection, productCriterion, SearchOrders.desc(QUANTITIES_SUM_ALIAS));
for (Entity entity : quantitiesSumProjectionResults) {
return entity.getDecimalField(QUANTITIES_SUM_ALIAS);
}
return BigDecimal.ZERO;
}
use of com.qcadoo.model.api.search.SearchCriterion in project mes by qcadoo.
the class MasterOrderOrdersDataProvider method sumBelongingOrdersDoneQuantities.
public BigDecimal sumBelongingOrdersDoneQuantities(final Entity masterOrder, final Entity product) {
SearchProjection quantitiesSumProjection = list().add(alias(sum(OrderFields.DONE_QUANTITY), QUANTITIES_SUM_ALIAS)).add(rowCount());
SearchCriterion productCriterion = belongsTo(OrderFields.PRODUCT, product);
List<Entity> quantitiesSumProjectionResults = findBelongingOrders(masterOrder, quantitiesSumProjection, productCriterion, SearchOrders.desc(QUANTITIES_SUM_ALIAS));
for (Entity entity : quantitiesSumProjectionResults) {
return entity.getDecimalField(QUANTITIES_SUM_ALIAS);
}
return BigDecimal.ZERO;
}
use of com.qcadoo.model.api.search.SearchCriterion in project mes by qcadoo.
the class DispositionOrderPdfService method getDataForStorageLocation.
private String getDataForStorageLocation(Entity position) {
Entity storageLocation = position.getBelongsToField(PositionFields.STORAGE_LOCATION);
Entity locationFrom = position.getBelongsToField(PositionFields.DOCUMENT).getBelongsToField(DocumentFields.LOCATION_FROM);
if (storageLocation == null && locationFrom != null) {
DataDefinition storageLocationDD = dataDefinitionService.get(MaterialFlowResourcesConstants.PLUGIN_IDENTIFIER, MaterialFlowResourcesConstants.MODEL_STORAGE_LOCATION);
SearchCriterion criterionLocation = SearchRestrictions.belongsTo(StorageLocationFields.LOCATION, locationFrom);
SearchCriterion criterionProduct = SearchRestrictions.belongsTo(StorageLocationFields.PRODUCT, position.getBelongsToField(PositionFields.PRODUCT));
storageLocation = storageLocationDD.find().add(SearchRestrictions.and(criterionLocation, criterionProduct)).uniqueResult();
}
return storageLocation == null ? "" : storageLocation.getStringField(StorageLocationFields.NUMBER);
}
Aggregations