use of com.qcadoo.mes.productionCounting.states.constants.ProductionTrackingState in project mes by qcadoo.
the class ProductionTrackingServiceImpl method setTimeAndPieceworkComponentsVisible.
@Override
public void setTimeAndPieceworkComponentsVisible(final ViewDefinitionState view, final Entity order) {
String recordingType = order.getStringField(OrderFieldsPC.TYPE_OF_PRODUCTION_RECORDING);
boolean recordingTypeEqualsForEach = TypeOfProductionRecording.FOR_EACH.getStringValue().equals(recordingType);
boolean recordingTypeEqualsBasic = TypeOfProductionRecording.BASIC.getStringValue().equals(recordingType);
LookupComponent tocComponent = (LookupComponent) view.getComponentByReference(ProductionTrackingFields.TECHNOLOGY_OPERATION_COMPONENT);
tocComponent.setVisible(recordingTypeEqualsForEach);
tocComponent.setRequired(recordingTypeEqualsForEach);
boolean registerProductionTime = order.getBooleanField(OrderFieldsPC.REGISTER_PRODUCTION_TIME);
view.getComponentByReference(L_TIME_TAB).setVisible(registerProductionTime && !recordingTypeEqualsBasic);
ProductionTrackingState recordState = getTrackingState(view);
final FormComponent form = (FormComponent) view.getComponentByReference(QcadooViewConstants.L_FORM);
if (form.getEntityId() != null) {
WindowComponent window = (WindowComponent) view.getComponentByReference(QcadooViewConstants.L_WINDOW);
RibbonActionItem calcTotalLaborTimeBtn = window.getRibbon().getGroupByName(L_WORK_TIME_RIBBON_GROUP).getItemByName(L_CALC_LABOR_TOTAL_TIME_RIBBON_BUTTON);
calcTotalLaborTimeBtn.setEnabled(registerProductionTime && !recordingTypeEqualsBasic && ProductionTrackingState.DRAFT.equals(recordState));
calcTotalLaborTimeBtn.requestUpdate(true);
}
boolean registerPiecework = order.getBooleanField(OrderFieldsPC.REGISTER_PIECEWORK);
view.getComponentByReference(L_PIECEWORK_TAB).setVisible(registerPiecework && recordingTypeEqualsForEach);
}
Aggregations