Search in sources :

Example 1 with OrderState

use of com.qcadoo.mes.orders.states.constants.OrderState in project mes by qcadoo.

the class ProductionPerShiftDetailsHooks method onBeforeRender.

public void onBeforeRender(final ViewDefinitionState view) {
    Entity order = getEntityFromLookup(view, ORDER_LOOKUP_REF).get();
    OrderState orderState = OrderState.of(order);
    ProgressType progressType = resolveProgressType(view);
    AwesomeDynamicListComponent progressForDaysADL = (AwesomeDynamicListComponent) view.getComponentByReference(PROGRESS_ADL_REF);
    if (!isViewAlreadyInitialized(view)) {
        fillOrderDateComponents(view, order);
        setupProgressTypeComboBox(view, orderState, progressType);
        setProductAndFillProgressForDays(view, progressForDaysADL, orderState, progressType);
    }
    disableReasonOfCorrection(view, progressType, orderState);
    disableComponents(progressForDaysADL, progressType, orderState);
    changeButtonState(view, progressType, orderState);
    updateAutoFillButtonState(view);
    setupHasBeenCorrectedCheckbox(view);
    checkOrderDates(view, order);
    markViewAsInitialized(view);
    deviationNotify(view);
}
Also used : Entity(com.qcadoo.model.api.Entity) ProgressType(com.qcadoo.mes.productionPerShift.constants.ProgressType) AwesomeDynamicListComponent(com.qcadoo.view.api.components.AwesomeDynamicListComponent) OrderState(com.qcadoo.mes.orders.states.constants.OrderState)

Example 2 with OrderState

use of com.qcadoo.mes.orders.states.constants.OrderState in project mes by qcadoo.

the class ProductionPerShiftDetailsHooks method disableReasonOfCorrection.

public void disableReasonOfCorrection(final ViewDefinitionState view) {
    Entity order = getEntityFromLookup(view, ORDER_LOOKUP_REF).get();
    OrderState orderState = OrderState.of(order);
    disableReasonOfCorrection(view, resolveProgressType(view), orderState);
}
Also used : Entity(com.qcadoo.model.api.Entity) OrderState(com.qcadoo.mes.orders.states.constants.OrderState)

Example 3 with OrderState

use of com.qcadoo.mes.orders.states.constants.OrderState in project mes by qcadoo.

the class OperationalTaskHooksBPC method canEnabled.

private boolean canEnabled(ViewDefinitionState view) {
    FormComponent form = (FormComponent) view.getComponentByReference(QcadooViewConstants.L_FORM);
    Entity operationalTask = form.getEntity();
    Entity order = operationalTask.getBelongsToField(OperationalTaskFields.ORDER);
    if (order == null) {
        return false;
    }
    OrderState orderState = OrderState.of(order);
    return orderState != OrderState.DECLINED && orderState != OrderState.PENDING;
}
Also used : FormComponent(com.qcadoo.view.api.components.FormComponent) Entity(com.qcadoo.model.api.Entity) OrderState(com.qcadoo.mes.orders.states.constants.OrderState)

Example 4 with OrderState

use of com.qcadoo.mes.orders.states.constants.OrderState in project mes by qcadoo.

the class ProductionPerShiftDetailsHooks method setProductAndFillProgressForDays.

public void setProductAndFillProgressForDays(final ViewDefinitionState view) {
    Entity order = getEntityFromLookup(view, "order").get();
    OrderState orderState = OrderState.of(order);
    ProgressType progressType = resolveProgressType(view);
    AwesomeDynamicListComponent progressForDaysADL = (AwesomeDynamicListComponent) view.getComponentByReference(PROGRESS_ADL_REF);
    setProductAndFillProgressForDays(view, progressForDaysADL, orderState, progressType);
}
Also used : Entity(com.qcadoo.model.api.Entity) ProgressType(com.qcadoo.mes.productionPerShift.constants.ProgressType) AwesomeDynamicListComponent(com.qcadoo.view.api.components.AwesomeDynamicListComponent) OrderState(com.qcadoo.mes.orders.states.constants.OrderState)

Example 5 with OrderState

use of com.qcadoo.mes.orders.states.constants.OrderState in project mes by qcadoo.

the class OrderHooks method setDateChanged.

public boolean setDateChanged(final DataDefinition dataDefinition, final FieldDefinition fieldDefinition, final Entity order, final Object fieldOldValue, final Object fieldNewValue) {
    OrderState orderState = OrderState.of(order);
    if (Objects.nonNull(fieldOldValue) && Objects.nonNull(fieldNewValue) && !orderState.equals(OrderState.PENDING)) {
        Date oldDate = DateUtils.parseDate(fieldOldValue);
        Date newDate = DateUtils.parseDate(fieldNewValue);
        if (!oldDate.equals(newDate)) {
            order.setField(OrderFields.DATES_CHANGED, true);
            order.setField(getSourceFieldName(fieldDefinition), fieldOldValue);
        }
    }
    return true;
}
Also used : OrderState(com.qcadoo.mes.orders.states.constants.OrderState) Date(java.util.Date)

Aggregations

OrderState (com.qcadoo.mes.orders.states.constants.OrderState)6 Entity (com.qcadoo.model.api.Entity)5 ProgressType (com.qcadoo.mes.productionPerShift.constants.ProgressType)2 AwesomeDynamicListComponent (com.qcadoo.view.api.components.AwesomeDynamicListComponent)2 Date (java.util.Date)2 DataDefinition (com.qcadoo.model.api.DataDefinition)1 FormComponent (com.qcadoo.view.api.components.FormComponent)1