Search in sources :

Example 1 with FilterValueHolder

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

the class TechnologyDetailsListenersPFTD method setWorkstationsLookup.

public void setWorkstationsLookup(final ViewDefinitionState view, final ComponentState componentState, final String[] args) {
    if (!(componentState instanceof GridComponent)) {
        return;
    }
    GridComponent grid = (GridComponent) componentState;
    if (grid.getSelectedEntities().isEmpty()) {
        return;
    }
    LookupComponent workstationLookup = (LookupComponent) view.getComponentByReference("workstationsForTOClookup");
    Entity productionLine = grid.getSelectedEntities().get(0).getBelongsToField("productionLine");
    FilterValueHolder filter = workstationLookup.getFilterValue();
    if (Objects.nonNull(productionLine)) {
        filter.put(OperationFields.PRODUCTION_LINE, productionLine.getId());
    } else {
        filter.remove(OperationFields.PRODUCTION_LINE);
    }
    workstationLookup.setFilterValue(filter);
}
Also used : FilterValueHolder(com.qcadoo.view.api.components.lookup.FilterValueHolder) Entity(com.qcadoo.model.api.Entity) LookupComponent(com.qcadoo.view.api.components.LookupComponent) GridComponent(com.qcadoo.view.api.components.GridComponent)

Example 2 with FilterValueHolder

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

the class OperationDetailsHooks method setProductionLineCriteriaModifiers.

private void setProductionLineCriteriaModifiers(final ViewDefinitionState view) {
    LookupComponent productionLineLookup = (LookupComponent) view.getComponentByReference(OperationFields.PRODUCTION_LINE);
    LookupComponent divisionLookup = (LookupComponent) view.getComponentByReference(OperationFields.DIVISION);
    Entity division = divisionLookup.getEntity();
    FilterValueHolder filter = productionLineLookup.getFilterValue();
    if (division != null) {
        filter.put(OperationFields.DIVISION, division.getId());
    } else {
        filter.remove(OperationFields.DIVISION);
    }
    productionLineLookup.setFilterValue(filter);
}
Also used : FilterValueHolder(com.qcadoo.view.api.components.lookup.FilterValueHolder) Entity(com.qcadoo.model.api.Entity) LookupComponent(com.qcadoo.view.api.components.LookupComponent)

Example 3 with FilterValueHolder

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

the class TOCDetailsHooks method setProductionLineCriteriaModifiers.

private void setProductionLineCriteriaModifiers(final ViewDefinitionState view) {
    LookupComponent productionLineLookup = (LookupComponent) view.getComponentByReference(TechnologyOperationComponentFields.PRODUCTION_LINE);
    LookupComponent divisionLookup = (LookupComponent) view.getComponentByReference(TechnologyOperationComponentFields.DIVISION);
    Entity division = divisionLookup.getEntity();
    FilterValueHolder filter = productionLineLookup.getFilterValue();
    if (division != null) {
        filter.put(TechnologyOperationComponentFields.DIVISION, division.getId());
    } else {
        filter.remove(TechnologyOperationComponentFields.DIVISION);
    }
    productionLineLookup.setFilterValue(filter);
}
Also used : FilterValueHolder(com.qcadoo.view.api.components.lookup.FilterValueHolder) Entity(com.qcadoo.model.api.Entity)

Example 4 with FilterValueHolder

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

the class WarehouseIssueDetailHooks method setCriteriaModifierParameters.

public void setCriteriaModifierParameters(final ViewDefinitionState view, final Entity order) {
    LookupComponent technologyOperationComponentLookup = (LookupComponent) view.getComponentByReference(WarehouseIssueFields.TECHNOLOGY_OPERATION_COMPONENT);
    LookupComponent divisionLookup = (LookupComponent) view.getComponentByReference(WarehouseIssueFields.DIVISION);
    if (Objects.nonNull(order)) {
        Entity technology = order.getBelongsToField(OrderFields.TECHNOLOGY);
        if (Objects.nonNull(technology)) {
            FilterValueHolder filterValueHolder = technologyOperationComponentLookup.getFilterValue();
            filterValueHolder.put(OrderFields.TECHNOLOGY, technology.getId());
            technologyOperationComponentLookup.setFilterValue(filterValueHolder);
            FilterValueHolder divisionFilterValueHolder = divisionLookup.getFilterValue();
            divisionFilterValueHolder.put(OrderFields.TECHNOLOGY, technology.getId());
            divisionLookup.setFilterValue(divisionFilterValueHolder);
        }
    }
}
Also used : FilterValueHolder(com.qcadoo.view.api.components.lookup.FilterValueHolder) Entity(com.qcadoo.model.api.Entity) LookupComponent(com.qcadoo.view.api.components.LookupComponent)

Example 5 with FilterValueHolder

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

the class TechnologyProductionLineDetailsHooks method onBeforeRender.

public void onBeforeRender(final ViewDefinitionState view) {
    FormComponent form = (FormComponent) view.getComponentByReference(QcadooViewConstants.L_FORM);
    LookupComponent productionLineLookup = (LookupComponent) view.getComponentByReference(TechnologyProductionLineFields.PRODUCTION_LINE);
    Entity entity = form.getEntity();
    Entity technology = entity.getBelongsToField(TechnologyProductionLineFields.TECHNOLOGY);
    Entity division = technology.getBelongsToField(TechnologyFieldsPFTD.DIVISION);
    FilterValueHolder filterValueHolder = productionLineLookup.getFilterValue();
    Long technologyId = technology.getId();
    if (Objects.isNull(technologyId)) {
        filterValueHolder.remove(TechnologyProductionLineCriteriaModifiers.L_TECHNOLOGY_ID);
    } else {
        filterValueHolder.put(TechnologyProductionLineCriteriaModifiers.L_TECHNOLOGY_ID, technologyId);
    }
    if (Objects.nonNull(division)) {
        filterValueHolder.put(TechnologyProductionLineCriteriaModifiers.L_DIVISION_ID, division.getId());
    } else if (filterValueHolder.has(TechnologyProductionLineCriteriaModifiers.L_DIVISION_ID)) {
        filterValueHolder.remove(TechnologyProductionLineCriteriaModifiers.L_DIVISION_ID);
    }
    productionLineLookup.setFilterValue(filterValueHolder);
}
Also used : FilterValueHolder(com.qcadoo.view.api.components.lookup.FilterValueHolder) FormComponent(com.qcadoo.view.api.components.FormComponent) 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