Search in sources :

Example 91 with FilterValueHolder

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

the class OperationSkillDetailsHooks method filterSkillLookup.

private void filterSkillLookup(final LookupComponent skillLookup, final Entity operation) {
    FilterValueHolder filterValueHolder = skillLookup.getFilterValue();
    Long operationId = operation.getId();
    if (Objects.isNull(operationId)) {
        filterValueHolder.remove(L_OPERATION_ID);
    } else {
        filterValueHolder.put(L_OPERATION_ID, operationId);
    }
    skillLookup.setFilterValue(filterValueHolder);
}
Also used : FilterValueHolder(com.qcadoo.view.api.components.lookup.FilterValueHolder)

Example 92 with FilterValueHolder

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

the class ProductToProductGroupTechnologyDetailsHooks method setCriteriaModifierParameters.

public void setCriteriaModifierParameters(LookupComponent productFamilyLookup, LookupComponent orderProductLookup) {
    Entity productFamily = productFamilyLookup.getEntity();
    Entity orderProduct = orderProductLookup.getEntity();
    FilterValueHolder filterValueHolder = orderProductLookup.getFilterValue();
    if (productFamily == null) {
        filterValueHolder.remove(OrderProductCriteriaModifiers.L_PRODUCT_FAMILY_ID);
        orderProductLookup.setFieldValue(null);
    } else {
        Long productFamilyId = productFamily.getId();
        filterValueHolder.put(OrderProductCriteriaModifiers.L_PRODUCT_FAMILY_ID, productFamilyId);
        if (orderProduct != null && !productFamilyId.equals(orderProduct.getBelongsToField(ProductFields.PARENT).getId())) {
            orderProductLookup.setFieldValue(null);
        }
    }
    orderProductLookup.setFilterValue(filterValueHolder);
    orderProductLookup.requestComponentUpdateState();
}
Also used : FilterValueHolder(com.qcadoo.view.api.components.lookup.FilterValueHolder) Entity(com.qcadoo.model.api.Entity)

Example 93 with FilterValueHolder

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

the class TOCDetailsHooks method setWorkstationsCriteriaModifiers.

private void setWorkstationsCriteriaModifiers(final ViewDefinitionState view) {
    LookupComponent divisionLookup = (LookupComponent) view.getComponentByReference(TechnologyOperationComponentFields.DIVISION);
    LookupComponent workstationLookup = (LookupComponent) view.getComponentByReference(L_WORKSTATION_LOOKUP);
    GridComponent workstations = (GridComponent) view.getComponentByReference(TechnologyOperationComponentFields.WORKSTATIONS);
    Entity division = divisionLookup.getEntity();
    FilterValueHolder filter = workstationLookup.getFilterValue();
    if (division != null) {
        filter.put(TechnologyOperationComponentFields.DIVISION, division.getId());
        workstations.setEditable(true);
    } else {
        filter.remove(TechnologyOperationComponentFields.DIVISION);
        workstations.setEditable(false);
    }
    workstationLookup.setFilterValue(filter);
}
Also used : FilterValueHolder(com.qcadoo.view.api.components.lookup.FilterValueHolder) Entity(com.qcadoo.model.api.Entity)

Example 94 with FilterValueHolder

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

the class TechnologicalProcessDetailsHooks method onBeforeRender.

public void onBeforeRender(final ViewDefinitionState view) {
    CheckBoxComponent extendedTimeForSizeGroupField = (CheckBoxComponent) view.getComponentByReference(EXTENDED_TIME_FOR_SIZE_GROUP);
    FieldComponent increasePercentField = (FieldComponent) view.getComponentByReference(INCREASE_PERCENT);
    LookupComponent sizeGroupLookup = (LookupComponent) view.getComponentByReference(SIZE_GROUP);
    if (extendedTimeForSizeGroupField.isChecked()) {
        increasePercentField.setEnabled(true);
        increasePercentField.setRequired(true);
        sizeGroupLookup.setEnabled(true);
        sizeGroupLookup.setRequired(true);
    } else {
        increasePercentField.setEnabled(false);
        increasePercentField.setFieldValue(null);
        increasePercentField.setRequired(false);
        sizeGroupLookup.setEnabled(false);
        sizeGroupLookup.setFieldValue(null);
        sizeGroupLookup.setRequired(false);
    }
    increasePercentField.requestComponentUpdateState();
    sizeGroupLookup.requestComponentUpdateState();
    LookupComponent workstationLookup = (LookupComponent) view.getComponentByReference(WORKSTATION);
    LookupComponent workstationTypeLookup = (LookupComponent) view.getComponentByReference(WORKSTATION_TYPE);
    FilterValueHolder filterValueHolder = workstationLookup.getFilterValue();
    if (workstationTypeLookup.getFieldValue() != null) {
        filterValueHolder.put(WorkstationFields.WORKSTATION_TYPE, workstationTypeLookup.getEntity().getId());
    } else {
        filterValueHolder.remove(WorkstationFields.WORKSTATION_TYPE);
    }
    workstationLookup.setFilterValue(filterValueHolder);
    FormComponent form = (FormComponent) view.getComponentByReference(QcadooViewConstants.L_FORM);
    Long technologicalProcessId = form.getEntityId();
    if (Objects.nonNull(technologicalProcessId)) {
        Entity workstationType = workstationTypeLookup.getEntity();
        Entity workstationTypeFromDB = dataDefinitionService.get(TechnologiesConstants.PLUGIN_IDENTIFIER, TechnologiesConstants.MODEL_TECHNOLOGICAL_PROCESS).get(technologicalProcessId).getBelongsToField(WORKSTATION_TYPE);
        if (workstationType == null && workstationTypeFromDB != null || workstationType != null && workstationTypeFromDB == null || workstationType != null && !workstationType.getId().equals(workstationTypeFromDB.getId())) {
            workstationLookup.setFieldValue(null);
            workstationLookup.requestComponentUpdateState();
        }
    }
}
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) FieldComponent(com.qcadoo.view.api.components.FieldComponent) CheckBoxComponent(com.qcadoo.view.api.components.CheckBoxComponent)

Example 95 with FilterValueHolder

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

the class AddProcessesHooks method onBeforeRender.

public void onBeforeRender(final ViewDefinitionState view) {
    Long technologicalProcessListId = ((FormComponent) view.getComponentByReference(QcadooViewConstants.L_FORM)).getEntityId();
    GridComponent technologicalProcesses = (GridComponent) view.getComponentByReference(L_TECHNOLOGICAL_PROCESSES);
    FilterValueHolder gridFilterValueHolder = technologicalProcesses.getFilterValue();
    gridFilterValueHolder.put(TechnologicalProcessListDetailsCriteriaModifiers.L_TECHNOLOGICAL_PROCESS_LIST_ID, technologicalProcessListId);
    technologicalProcesses.setFilterValue(gridFilterValueHolder);
}
Also used : FilterValueHolder(com.qcadoo.view.api.components.lookup.FilterValueHolder) FormComponent(com.qcadoo.view.api.components.FormComponent) GridComponent(com.qcadoo.view.api.components.GridComponent)

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