use of com.qcadoo.view.api.components.CheckBoxComponent in project mes by qcadoo.
the class ModelCardDetailsListeners method generateModelCard.
@Transactional
public void generateModelCard(final ViewDefinitionState view, final ComponentState state, final String[] args) {
GridComponent productsGrid = (GridComponent) view.getComponentByReference(QcadooViewConstants.L_GRID);
if (productsGrid.getEntities().isEmpty()) {
view.addMessage("productFlowThruDivision.modelCard.generate.failure.noProducts", ComponentState.MessageType.INFO);
return;
}
FormComponent form = (FormComponent) view.getComponentByReference(QcadooViewConstants.L_FORM);
CheckBoxComponent generated = (CheckBoxComponent) view.getComponentByReference(ModelCardFields.GENERATED);
FieldComponent workerField = (FieldComponent) view.getComponentByReference(ModelCardFields.WORKER);
FieldComponent dateField = (FieldComponent) view.getComponentByReference(ModelCardFields.DATE);
workerField.setFieldValue(securityService.getCurrentUserName());
dateField.setFieldValue(DateUtils.toDateTimeString(new Date()));
generated.setChecked(true);
Entity modelCard = form.getEntity();
modelCard = modelCard.getDataDefinition().save(modelCard);
form.setEntity(modelCard);
Entity modelCardWithFileName = fileService.updateReportFileName(modelCard, ModelCardFields.DATE, "productFlowThruDivision.modelCard.report.fileName");
try {
modelCardPdfService.generateDocument(modelCardWithFileName, state.getLocale(), PageSize.A4.rotate());
} catch (IOException | DocumentException e) {
throw new IllegalStateException(e.getMessage(), e);
}
view.addMessage("productFlowThruDivision.modelCard.generate.success", ComponentState.MessageType.SUCCESS);
}
use of com.qcadoo.view.api.components.CheckBoxComponent in project mes by qcadoo.
the class SupplyParametersListenersPFTD method toggleAutomaticReleaseAfterGeneration.
private void toggleAutomaticReleaseAfterGeneration(boolean checked, ViewDefinitionState view) {
CheckBoxComponent automaticReleaseAfterGeneration = (CheckBoxComponent) view.getComponentByReference("automaticReleaseAfterGeneration");
if (checked) {
automaticReleaseAfterGeneration.setEnabled(true);
} else {
automaticReleaseAfterGeneration.setChecked(Boolean.FALSE);
automaticReleaseAfterGeneration.setEnabled(false);
}
automaticReleaseAfterGeneration.requestComponentUpdateState();
}
use of com.qcadoo.view.api.components.CheckBoxComponent in project mes by qcadoo.
the class SupplyParametersHooksPFTD method toggleStateReservation.
private void toggleStateReservation(ViewDefinitionState view) {
CheckBoxComponent warehouseIssuesReserveStatesCheckbox = (CheckBoxComponent) view.getComponentByReference(ParameterFieldsPFTD.WAREHOUSE_ISSUES_RESERVE_STATES);
boolean shouldBeEnabled = draftOrInProgressWarehouseIssuesDoesntExist();
warehouseIssuesReserveStatesCheckbox.setEnabled(shouldBeEnabled);
warehouseIssuesReserveStatesCheckbox.requestComponentUpdateState();
}
use of com.qcadoo.view.api.components.CheckBoxComponent in project mes by qcadoo.
the class AnomalyProductionTrackingDetailsListeners method perform.
@Transactional(propagation = Propagation.REQUIRES_NEW)
private boolean perform(ViewDefinitionState view) {
boolean valid = validate(view);
if (valid) {
createAnomalies(view);
clearQuantitiesInRR(view);
view.addMessage("productionCounting.anomalyProductionTrackingDetails.reasonsCreated", ComponentState.MessageType.SUCCESS);
CheckBoxComponent generated = (CheckBoxComponent) view.getComponentByReference("generated");
generated.setChecked(true);
return true;
} else {
view.addMessage(new ErrorMessage("productionCounting.anomalyReasonDetails.reasonIsRequired", false));
return false;
}
}
use of com.qcadoo.view.api.components.CheckBoxComponent in project mes by qcadoo.
the class ProductionTrackingDetailsHooks method onBeforeRender.
public void onBeforeRender(final ViewDefinitionState view) {
FormComponent productionTrackingForm = (FormComponent) view.getComponentByReference(QcadooViewConstants.L_FORM);
setCriteriaModifierParameters(view);
productionTrackingService.fillProductionLineLookup(view);
if ((view.isViewAfterRedirect() || view.isViewAfterReload()) && !((CheckBoxComponent) view.getComponentByReference(ProductionTrackingFields.ADD_BATCH)).isChecked()) {
FieldComponent batchNumber = (FieldComponent) view.getComponentByReference(ProductionTrackingFields.BATCH_NUMBER);
batchNumber.setEnabled(false);
}
if (Objects.isNull(productionTrackingForm.getEntityId())) {
setStateFieldValueToDraft(view);
} else {
Entity productionTracking = getProductionTrackingFromDB(productionTrackingForm.getEntityId());
initializeProductionTrackingDetailsView(view);
showLastStateChangeFailNotification(productionTrackingForm, productionTracking);
changeFieldComponentsEnabledAndGridsEditable(view);
updateRibbonState(view);
toggleCorrectButton(view, productionTracking);
toggleCorrectionFields(view, productionTracking);
fetchNumberFromDatabase(view, productionTracking);
}
fillBatchOrderedProductLabel(view);
changeStoppagesTabVisible(view);
}
Aggregations