use of com.qcadoo.view.api.components.FieldComponent in project mes by qcadoo.
the class ProductionCountingQuantitySetDetailsListeners method fillUnitFields.
public void fillUnitFields(final ViewDefinitionState view, final ComponentState state, final String[] args) {
Entity product = ((LookupComponent) state).getEntity();
String unit = "";
if (product != null) {
unit = product.getStringField(ProductFields.UNIT);
}
FieldComponent field = (FieldComponent) view.getComponentByReference(L_PRODUCT_UNIT);
field.setFieldValue(unit);
field.requestComponentUpdateState();
}
use of com.qcadoo.view.api.components.FieldComponent in project mes by qcadoo.
the class ProductionTrackingDetailsListeners method clearFields.
public void clearFields(final ViewDefinitionState view, final ComponentState componentState, final String[] args) {
FieldComponent technologyOperationComponentField = (FieldComponent) view.getComponentByReference(ProductionTrackingFields.TECHNOLOGY_OPERATION_COMPONENT);
technologyOperationComponentField.setFieldValue("");
FormComponent form = (FormComponent) view.getComponentByReference(QcadooViewConstants.L_FORM);
if (Objects.isNull(form.getEntityId())) {
return;
}
GridComponent trackingOperationProductInComponentsGrid = (GridComponent) view.getComponentByReference(ProductionTrackingFields.TRACKING_OPERATION_PRODUCT_IN_COMPONENTS);
GridComponent trackingOperationProductOutComponentsGrid = (GridComponent) view.getComponentByReference(ProductionTrackingFields.TRACKING_OPERATION_PRODUCT_OUT_COMPONENTS);
trackingOperationProductInComponentsGrid.setEntities(Lists.newArrayList());
trackingOperationProductOutComponentsGrid.setEntities(Lists.newArrayList());
}
use of com.qcadoo.view.api.components.FieldComponent in project mes by qcadoo.
the class AnomalyDetailsHooks method fillFields.
private void fillFields(final ViewDefinitionState view) {
FormComponent form = (FormComponent) view.getComponentByReference(QcadooViewConstants.L_FORM);
Entity anomaly = form.getEntity().getDataDefinition().get(form.getEntityId());
FieldComponent productionTrackingNumberField = (FieldComponent) view.getComponentByReference("productionTrackingNumber");
FieldComponent createDateField = (FieldComponent) view.getComponentByReference("createDate");
createDateField.setEnabled(false);
FieldComponent orderNumberField = (FieldComponent) view.getComponentByReference("orderNumber");
FieldComponent masterProductNumberField = (FieldComponent) view.getComponentByReference("masterProductNumber");
FieldComponent productionLineNumberField = (FieldComponent) view.getComponentByReference("productionLineNumber");
FieldComponent productNumberField = (FieldComponent) view.getComponentByReference("productNumber");
FieldComponent reasonsField = (FieldComponent) view.getComponentByReference("reasons");
FieldComponent unitField = (FieldComponent) view.getComponentByReference("unit");
FieldComponent locationField = (FieldComponent) view.getComponentByReference("location");
Entity productionTracking = anomaly.getBelongsToField("productionTracking");
productionTrackingNumberField.setFieldValue(productionTracking.getStringField(ProductionTrackingFields.NUMBER));
orderNumberField.setFieldValue(productionTracking.getBelongsToField(ProductionTrackingFields.ORDER).getStringField(OrderFields.NUMBER));
productionLineNumberField.setFieldValue(productionTracking.getBelongsToField(ProductionTrackingFields.ORDER).getBelongsToField(OrderFields.PRODUCTION_LINE).getStringField(ProductionLineFields.NUMBER));
masterProductNumberField.setFieldValue(anomaly.getBelongsToField("masterProduct").getStringField(ProductFields.NUMBER));
productNumberField.setFieldValue(anomaly.getBelongsToField("product").getStringField(ProductFields.NUMBER));
unitField.setFieldValue(anomaly.getBelongsToField("product").getStringField(ProductFields.UNIT));
reasonsField.setFieldValue(anomaly.getHasManyField("anomalyReasons").stream().map(a -> a.getStringField("name")).collect(Collectors.joining(", ")));
if (Objects.nonNull(anomaly.getBelongsToField(AnomalyFields.LOCATION))) {
locationField.setFieldValue(anomaly.getBelongsToField(AnomalyFields.LOCATION).getStringField("number"));
locationField.requestComponentUpdateState();
}
if (anomaly.getStringField(AnomalyFields.STATE).equals("03completed")) {
view.getComponentByReference("anomalyExplanations").setEnabled(false);
}
productionTrackingNumberField.requestComponentUpdateState();
orderNumberField.requestComponentUpdateState();
productionLineNumberField.requestComponentUpdateState();
masterProductNumberField.requestComponentUpdateState();
productNumberField.requestComponentUpdateState();
unitField.requestComponentUpdateState();
reasonsField.requestComponentUpdateState();
}
use of com.qcadoo.view.api.components.FieldComponent in project mes by qcadoo.
the class OrderDetailsHooksPC method setRegisterPieceworkEnabledAndValue.
private void setRegisterPieceworkEnabledAndValue(final ViewDefinitionState view, final boolean isEnabled, final boolean value) {
FieldComponent fieldComponent = (FieldComponent) view.getComponentByReference(OrderFieldsPC.REGISTER_PIECEWORK);
fieldComponent.setEnabled(isEnabled);
fieldComponent.setFieldValue(value);
}
use of com.qcadoo.view.api.components.FieldComponent in project mes by qcadoo.
the class ProdOutResourceAttrValDetailsHooks method onBeforeRender.
public void onBeforeRender(final ViewDefinitionState view) {
setValueBold(view);
setFilters(view);
LookupComponent attributeLookup = (LookupComponent) view.getComponentByReference(ProdOutResourceAttrValFields.ATTRIBUTE);
LookupComponent attributeValueLookup = (LookupComponent) view.getComponentByReference(ProdOutResourceAttrValFields.ATTRIBUTE_VALUE);
FieldComponent valueField = (FieldComponent) view.getComponentByReference(ProdOutResourceAttrValFields.VALUE);
if (Objects.nonNull(attributeLookup.getEntity())) {
Entity attribute = attributeLookup.getEntity();
FieldComponent unitField = (FieldComponent) view.getComponentByReference(L_UNIT);
unitField.setFieldValue(attribute.getStringField(AttributeFields.UNIT));
unitField.requestComponentUpdateState();
if (AttributeDataType.CONTINUOUS.getStringValue().equals(attribute.getStringField(AttributeFields.DATA_TYPE))) {
valueField.setVisible(true);
attributeValueLookup.setVisible(false);
} else {
valueField.setVisible(false);
attributeValueLookup.setVisible(true);
}
} else {
valueField.setVisible(false);
attributeValueLookup.setVisible(false);
}
}
Aggregations