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);
}
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);
}
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;
}
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);
}
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;
}
Aggregations