Search in sources :

Example 1 with PlannedEventType

use of com.qcadoo.mes.cmmsMachineParts.constants.PlannedEventType in project mes by qcadoo.

the class PlannedEventDetailsHooks method actionsButtonProcess.

private void actionsButtonProcess(Entity plannedEvent, ViewDefinitionState view, FieldsForType ftype) {
    WindowComponent window = (WindowComponent) view.getComponentByReference(QcadooViewConstants.L_WINDOW);
    PlannedEventType type = PlannedEventType.from(plannedEvent);
    Ribbon ribbon = window.getRibbon();
    RibbonGroup actionsGroup = ribbon.getGroupByName("actionsGroup");
    RibbonActionItem addActionsItem = actionsGroup.getItemByName("actions");
    if (plannedEvent.getId() == null) {
        addActionsItem.setEnabled(false);
        addActionsItem.requestUpdate(true);
        window.requestRibbonRender();
        return;
    }
    boolean enable = false;
    if (type.compareTo(PlannedEventType.REVIEW) == 0) {
        enable = true;
    } else if (type.compareTo(PlannedEventType.REPAIRS) == 0) {
        enable = true;
    } else if (type.compareTo(PlannedEventType.EXTERNAL_SERVICE) == 0) {
        enable = false;
    } else if (type.compareTo(PlannedEventType.ADDITIONAL_WORK) == 0) {
        enable = true;
    } else if (type.compareTo(PlannedEventType.MANUAL) == 0) {
        enable = true;
    } else if (type.compareTo(PlannedEventType.METER_READING) == 0) {
        enable = false;
    } else if (type.compareTo(PlannedEventType.UDT_REVIEW) == 0) {
        enable = false;
    } else if (type.compareTo(PlannedEventType.AFTER_REVIEW) == 0) {
        enable = false;
    }
    addActionsItem.setEnabled(enable);
    addActionsItem.requestUpdate(true);
    window.requestRibbonRender();
}
Also used : RibbonGroup(com.qcadoo.view.api.ribbon.RibbonGroup) Ribbon(com.qcadoo.view.api.ribbon.Ribbon) PlannedEventType(com.qcadoo.mes.cmmsMachineParts.constants.PlannedEventType) RibbonActionItem(com.qcadoo.view.api.ribbon.RibbonActionItem)

Example 2 with PlannedEventType

use of com.qcadoo.mes.cmmsMachineParts.constants.PlannedEventType in project mes by qcadoo.

the class PlannedEventDetailsHooks method toggleActionsFieldsVisible.

public void toggleActionsFieldsVisible(final ViewDefinitionState view) {
    FormComponent plannedEventForm = (FormComponent) view.getComponentByReference(QcadooViewConstants.L_FORM);
    Entity plannedEvent = plannedEventForm.getPersistedEntityWithIncludedFormValues();
    PlannedEventType type = PlannedEventType.from(plannedEvent);
    FieldsForType fieldsForType = eventFieldsForTypeFactory.createFieldsForType(type);
    if (fieldsForType == null) {
        return;
    }
    toggleAddMultipleActions(view, fieldsForType, plannedEvent);
}
Also used : Entity(com.qcadoo.model.api.Entity) PlannedEventType(com.qcadoo.mes.cmmsMachineParts.constants.PlannedEventType) FieldsForType(com.qcadoo.mes.cmmsMachineParts.plannedEvents.fieldsForType.FieldsForType)

Example 3 with PlannedEventType

use of com.qcadoo.mes.cmmsMachineParts.constants.PlannedEventType in project mes by qcadoo.

the class PlannedEventDetailsHooks method toggleFieldsVisible.

public void toggleFieldsVisible(final ViewDefinitionState view) {
    FormComponent plannedEventForm = (FormComponent) view.getComponentByReference(QcadooViewConstants.L_FORM);
    Entity plannedEvent = plannedEventForm.getPersistedEntityWithIncludedFormValues();
    PlannedEventType type = PlannedEventType.from(plannedEvent);
    FieldsForType fieldsForType = eventFieldsForTypeFactory.createFieldsForType(type);
    if (fieldsForType == null) {
        return;
    }
    hideFields(view, plannedEvent, fieldsForType);
    hideTabs(view, fieldsForType);
    clearGrids(view, fieldsForType);
    setAndLockBasedOn(view, fieldsForType);
    actionsButtonProcess(plannedEvent, view, fieldsForType);
}
Also used : Entity(com.qcadoo.model.api.Entity) PlannedEventType(com.qcadoo.mes.cmmsMachineParts.constants.PlannedEventType) FieldsForType(com.qcadoo.mes.cmmsMachineParts.plannedEvents.fieldsForType.FieldsForType)

Example 4 with PlannedEventType

use of com.qcadoo.mes.cmmsMachineParts.constants.PlannedEventType in project mes by qcadoo.

the class TimeUsageXlsService method updatePartsAndDescription.

private void updatePartsAndDescription(List<TimeUsageDTO> usages, Locale locale) {
    for (TimeUsageDTO usage : usages) {
        if ("planned".equals(usage.getEventType())) {
            PlannedEventType type = PlannedEventType.parseString(usage.getType());
            FieldsForType fields = fieldsForTypeFactory.createFieldsForType(type);
            if (fields.getHiddenTabs().contains(PlannedEventFields.MACHINE_PARTS_TAB)) {
                String notApplicable = translationService.translate("cmmsMachineParts.timeUsageReport.na", locale);
                usage.setParts(notApplicable);
            }
            if (fields.getHiddenTabs().contains(PlannedEventFields.SOLUTION_DESCRIPTION_TAB)) {
                String notApplicable = translationService.translate("cmmsMachineParts.timeUsageReport.na", locale);
                usage.setDescription(notApplicable);
            }
        }
    }
}
Also used : TimeUsageDTO(com.qcadoo.mes.cmmsMachineParts.reports.xls.timeUsage.dto.TimeUsageDTO) PlannedEventType(com.qcadoo.mes.cmmsMachineParts.constants.PlannedEventType) FieldsForType(com.qcadoo.mes.cmmsMachineParts.plannedEvents.fieldsForType.FieldsForType)

Aggregations

PlannedEventType (com.qcadoo.mes.cmmsMachineParts.constants.PlannedEventType)4 FieldsForType (com.qcadoo.mes.cmmsMachineParts.plannedEvents.fieldsForType.FieldsForType)3 Entity (com.qcadoo.model.api.Entity)2 TimeUsageDTO (com.qcadoo.mes.cmmsMachineParts.reports.xls.timeUsage.dto.TimeUsageDTO)1 Ribbon (com.qcadoo.view.api.ribbon.Ribbon)1 RibbonActionItem (com.qcadoo.view.api.ribbon.RibbonActionItem)1 RibbonGroup (com.qcadoo.view.api.ribbon.RibbonGroup)1