use of com.qcadoo.view.api.components.CheckBoxComponent in project mes by qcadoo.
the class ResourcesListHooks method applyFilters.
public void applyFilters(ViewDefinitionState view) {
boolean isShortFilter = ((CheckBoxComponent) view.getComponentByReference(ResourceDtoFields.IS_SHORT_FILTER)).isChecked();
boolean isDeadlineFilter = ((CheckBoxComponent) view.getComponentByReference(ResourceDtoFields.IS_DEADLINE_FILTER)).isChecked();
GridComponent resourcesGrid = (GridComponent) view.getComponentByReference(QcadooViewConstants.L_GRID);
Integer shortExpiryDate = dataDefinitionService.get(MaterialFlowResourcesConstants.PLUGIN_IDENTIFIER, MaterialFlowResourcesConstants.MODEL_DOCUMENT_POSITION_PARAMETERS).find().setMaxResults(1).uniqueResult().getIntegerField(DocumentPositionParametersFields.SHORT_EXPIRY_DATE);
if (isShortFilter) {
if (shortExpiryDate == null) {
resourcesGrid.addMessage("materialFlowResources.resource.missing.parameter.shortExpiryDate.error", ComponentState.MessageType.FAILURE);
} else {
resourcesGrid.setCustomRestriction(searchBuilder -> searchBuilder.add(SearchRestrictions.and(SearchRestrictions.ge(ResourceDtoFields.EXPIRATION_DATE, DateTime.now().withTimeAtStartOfDay().toDate()), SearchRestrictions.le(ResourceDtoFields.EXPIRATION_DATE, DateTime.now().withTimeAtStartOfDay().plusDays(shortExpiryDate).toDate()))));
}
} else if (isDeadlineFilter) {
resourcesGrid.setCustomRestriction(searchBuilder -> searchBuilder.add(SearchRestrictions.lt(ResourceDtoFields.EXPIRATION_DATE, DateTime.now().withTimeAtStartOfDay().toDate())));
}
}
use of com.qcadoo.view.api.components.CheckBoxComponent in project mes by qcadoo.
the class PalletStorageStateListHooks method applyFilters.
public void applyFilters(ViewDefinitionState view) {
boolean isShiftFilter = ((CheckBoxComponent) view.getComponentByReference(PalletStorageStateDtoFields.IS_SHIFT_FILTER)).isChecked();
boolean isFreeFilter = ((CheckBoxComponent) view.getComponentByReference(PalletStorageStateDtoFields.IS_FREE_FILTER)).isChecked();
GridComponent palletGrid = (GridComponent) view.getComponentByReference(QcadooViewConstants.L_GRID);
Integer palletToShift = dataDefinitionService.get(MaterialFlowResourcesConstants.PLUGIN_IDENTIFIER, MaterialFlowResourcesConstants.MODEL_DOCUMENT_POSITION_PARAMETERS).find().setMaxResults(1).uniqueResult().getIntegerField(DocumentPositionParametersItemValues.PALLET_TO_SHIFT);
Integer palletWithFreePlace = dataDefinitionService.get(MaterialFlowResourcesConstants.PLUGIN_IDENTIFIER, MaterialFlowResourcesConstants.MODEL_DOCUMENT_POSITION_PARAMETERS).find().setMaxResults(1).uniqueResult().getIntegerField(DocumentPositionParametersItemValues.PALLET_WITH_FREE_PALECE);
if (isShiftFilter) {
if (palletToShift == null) {
palletGrid.addMessage("materialFlowResources.pallet.missing.parameter.palletToShift.error", ComponentState.MessageType.FAILURE);
} else {
palletGrid.setCustomRestriction(searchBuilder -> searchBuilder.add(SearchRestrictions.lt(PalletStorageStateDtoFields.TOTAL_QUANTITY, BigDecimal.valueOf(palletToShift))));
}
} else if (isFreeFilter) {
if (palletWithFreePlace == null) {
palletGrid.addMessage("materialFlowResources.pallet.missing.parameter.palletWithFreeSpace.error", ComponentState.MessageType.FAILURE);
} else {
palletGrid.setCustomRestriction(searchBuilder -> searchBuilder.add(SearchRestrictions.lt(PalletStorageStateDtoFields.TOTAL_QUANTITY, BigDecimal.valueOf(palletWithFreePlace))));
}
}
}
use of com.qcadoo.view.api.components.CheckBoxComponent in project mes by qcadoo.
the class StorageLocationsMultiAddHooks method onBeforeRender.
public void onBeforeRender(final ViewDefinitionState view) {
FieldComponent number = (FieldComponent) view.getComponentByReference(StorageLocationHelperFields.NUMBER);
number.setRequired(true);
number.requestComponentUpdateState();
FieldComponent prefix = (FieldComponent) view.getComponentByReference(StorageLocationHelperFields.PREFIX);
prefix.setRequired(true);
prefix.requestComponentUpdateState();
FieldComponent location = (FieldComponent) view.getComponentByReference(StorageLocationHelperFields.LOCATION);
location.setRequired(true);
location.requestComponentUpdateState();
FieldComponent numberOf = (FieldComponent) view.getComponentByReference(StorageLocationHelperFields.NUMBER_OF_STORAGE_LOCATIONS);
numberOf.setRequired(true);
numberOf.requestComponentUpdateState();
FieldComponent maximumNumber = (FieldComponent) view.getComponentByReference(StorageLocationFields.MAXIMUM_NUMBER_OF_PALLETS);
CheckBoxComponent isPlace = (CheckBoxComponent) view.getComponentByReference(StorageLocationFields.PLACE_STORAGE_LOCATION);
if (isPlace.isChecked()) {
maximumNumber.setEnabled(true);
} else {
maximumNumber.setEnabled(false);
maximumNumber.setFieldValue(null);
maximumNumber.requestComponentUpdateState();
}
}
use of com.qcadoo.view.api.components.CheckBoxComponent in project mes by qcadoo.
the class PalletStorageStateListListeners method showPalletsWithProductToShift.
public void showPalletsWithProductToShift(final ViewDefinitionState view, final ComponentState state, final String[] args) {
CheckBoxComponent isShiftFilter = (CheckBoxComponent) view.getComponentByReference(PalletStorageStateDtoFields.IS_SHIFT_FILTER);
CheckBoxComponent isFreeFilter = (CheckBoxComponent) view.getComponentByReference(PalletStorageStateDtoFields.IS_FREE_FILTER);
isShiftFilter.setChecked(true);
isFreeFilter.setChecked(false);
isShiftFilter.requestComponentUpdateState();
isFreeFilter.requestComponentUpdateState();
}
use of com.qcadoo.view.api.components.CheckBoxComponent in project mes by qcadoo.
the class PalletStorageStateListListeners method showPallestWithFreeSpace.
public void showPallestWithFreeSpace(final ViewDefinitionState view, final ComponentState state, final String[] args) {
CheckBoxComponent isShiftFilter = (CheckBoxComponent) view.getComponentByReference(PalletStorageStateDtoFields.IS_SHIFT_FILTER);
CheckBoxComponent isFreeFilter = (CheckBoxComponent) view.getComponentByReference(PalletStorageStateDtoFields.IS_FREE_FILTER);
isShiftFilter.setChecked(false);
isFreeFilter.setChecked(true);
isShiftFilter.requestComponentUpdateState();
isFreeFilter.requestComponentUpdateState();
}
Aggregations