Search in sources :

Example 61 with FilterValueHolder

use of com.qcadoo.view.api.components.lookup.FilterValueHolder in project mes by qcadoo.

the class DocumentsListPFTD method setCriteriaModifierParameters.

public void setCriteriaModifierParameters(final ViewDefinitionState view) {
    GridComponent documentsGrid = (GridComponent) view.getComponentByReference(QcadooViewConstants.L_GRID);
    FilterValueHolder filterValueHolder = documentsGrid.getFilterValue();
    filterValueHolder.put(DocumentDtoFieldsPFTD.ORDER_NUMBER, 0);
    documentsGrid.setFilterValue(filterValueHolder);
}
Also used : FilterValueHolder(com.qcadoo.view.api.components.lookup.FilterValueHolder) GridComponent(com.qcadoo.view.api.components.GridComponent)

Example 62 with FilterValueHolder

use of com.qcadoo.view.api.components.lookup.FilterValueHolder in project mes by qcadoo.

the class BatchCriteriaModifier method putProductFilterValue.

public void putProductFilterValue(final LookupComponent batchLookup, final Entity product) {
    FilterValueHolder filterValueHolder = batchLookup.getFilterValue();
    if (Objects.nonNull(product)) {
        filterValueHolder.put(BatchCriteriaModifier.PRODUCT_ID_FILTER_VAL_KEY, product.getId());
    } else {
        if (filterValueHolder.has(BatchCriteriaModifier.PRODUCT_ID_FILTER_VAL_KEY)) {
            filterValueHolder.remove(BatchCriteriaModifier.PRODUCT_ID_FILTER_VAL_KEY);
        }
    }
    batchLookup.setFilterValue(filterValueHolder);
}
Also used : FilterValueHolder(com.qcadoo.view.api.components.lookup.FilterValueHolder)

Example 63 with FilterValueHolder

use of com.qcadoo.view.api.components.lookup.FilterValueHolder in project mes by qcadoo.

the class StaffCriteriaModifier method putCrewNumber.

public void putCrewNumber(final LookupComponent lookupComponent, final Entity crew) {
    FilterValueHolder valueHolder = lookupComponent.getFilterValue();
    if (crew != null) {
        valueHolder.put(CREW_FILTER_VALUE, crew.getId());
    } else {
        valueHolder.remove(CREW_FILTER_VALUE);
    }
    lookupComponent.setFilterValue(valueHolder);
}
Also used : FilterValueHolder(com.qcadoo.view.api.components.lookup.FilterValueHolder)

Example 64 with FilterValueHolder

use of com.qcadoo.view.api.components.lookup.FilterValueHolder in project mes by qcadoo.

the class StaffCriteriaModifier method setFilterParameters.

public void setFilterParameters(final LookupComponent staffLookup, Entity assignmentToShift) {
    FilterValueHolder filter = staffLookup.getFilterValue();
    Date startDate = assignmentToShift.getDateField(AssignmentToShiftFields.START_DATE);
    String hql = "select staff.worker.id as workerId from #assignmentToShift_staffAssignmentToShift staff " + " where staff.assignmentToShift.startDate = '" + DateUtils.toDateString(startDate) + "'";
    List<Entity> workersIds = dataDefinitionService.get(AssignmentToShiftConstants.PLUGIN_IDENTIFIER, AssignmentToShiftConstants.MODEL_STAFF_ASSIGNMENT_TO_SHIFT).find(hql).list().getEntities();
    if (!workersIds.isEmpty()) {
        filter.put("workersIds", workersIds.stream().map(id -> id.getLongField("workerId")).collect(Collectors.toList()));
        staffLookup.setFilterValue(filter);
    }
}
Also used : FilterValueHolder(com.qcadoo.view.api.components.lookup.FilterValueHolder) Entity(com.qcadoo.model.api.Entity) Date(java.util.Date)

Example 65 with FilterValueHolder

use of com.qcadoo.view.api.components.lookup.FilterValueHolder in project mes by qcadoo.

the class ProductionCountingQuantityAdvancedDetailsHooks method fillBatchLookupFilter.

private void fillBatchLookupFilter(final ViewDefinitionState view) {
    LookupComponent productLookup = (LookupComponent) view.getComponentByReference(ProductionCountingQuantityFields.PRODUCT);
    LookupComponent batchLookup = (LookupComponent) view.getComponentByReference(L_BATCH_LOOKUP);
    Entity product = productLookup.getEntity();
    FilterValueHolder batchFilterValueHolder = batchLookup.getFilterValue();
    if (Objects.nonNull(product)) {
        batchFilterValueHolder.put(L_PRODUCT_ID, product.getId());
        batchLookup.setFilterValue(batchFilterValueHolder);
    } else {
        if (batchFilterValueHolder.has(L_PRODUCT_ID)) {
            batchFilterValueHolder.remove(L_PRODUCT_ID);
            batchLookup.setFilterValue(batchFilterValueHolder);
        }
    }
}
Also used : FilterValueHolder(com.qcadoo.view.api.components.lookup.FilterValueHolder) Entity(com.qcadoo.model.api.Entity) LookupComponent(com.qcadoo.view.api.components.LookupComponent)

Aggregations

FilterValueHolder (com.qcadoo.view.api.components.lookup.FilterValueHolder)119 LookupComponent (com.qcadoo.view.api.components.LookupComponent)69 Entity (com.qcadoo.model.api.Entity)64 FormComponent (com.qcadoo.view.api.components.FormComponent)45 GridComponent (com.qcadoo.view.api.components.GridComponent)26 FieldComponent (com.qcadoo.view.api.components.FieldComponent)13 Collectors (java.util.stream.Collectors)11 Autowired (org.springframework.beans.factory.annotation.Autowired)11 Service (org.springframework.stereotype.Service)11 DataDefinitionService (com.qcadoo.model.api.DataDefinitionService)10 SearchCriteriaBuilder (com.qcadoo.model.api.search.SearchCriteriaBuilder)10 SearchRestrictions (com.qcadoo.model.api.search.SearchRestrictions)10 Objects (java.util.Objects)10 DataDefinition (com.qcadoo.model.api.DataDefinition)9 JSONObject (org.json.JSONObject)9 UserFieldsMF (com.qcadoo.mes.materialFlow.constants.UserFieldsMF)8 UserLocationFields (com.qcadoo.mes.materialFlow.constants.UserLocationFields)8 EntityList (com.qcadoo.model.api.EntityList)8 SecurityService (com.qcadoo.security.api.SecurityService)8 QcadooSecurityConstants (com.qcadoo.security.constants.QcadooSecurityConstants)8