use of com.qcadoo.view.api.components.GridComponent in project mes by qcadoo.
the class PerformanceAnalysisListeners method showDetails.
public void showDetails(final ViewDefinitionState view, final ComponentState state, final String[] args) {
GridComponent performanceAnalysisGrid = (GridComponent) view.getComponentByReference(QcadooViewConstants.L_GRID);
Entity analysis = performanceAnalysisGrid.getSelectedEntities().get(0);
Map<String, String> filters = Maps.newHashMap();
filters.put(PerformanceAnalysisDetailsDtoFields.PRODUCTION_LINE_NUMBER, "[" + analysis.getStringField(PerformanceAnalysisDetailsDtoFields.PRODUCTION_LINE_NUMBER) + "]");
String staffName = analysis.getStringField(PerformanceAnalysisDetailsDtoFields.STAFF_NAME);
if (!Objects.isNull(staffName)) {
filters.put(PerformanceAnalysisDetailsDtoFields.STAFF_NAME, "[" + staffName + "]");
} else {
filters.put(PerformanceAnalysisDetailsDtoFields.STAFF_NAME, ISNULL);
}
String shiftName = analysis.getStringField(PerformanceAnalysisDetailsDtoFields.SHIFT_NAME);
if (!Objects.isNull(shiftName)) {
filters.put(PerformanceAnalysisDetailsDtoFields.SHIFT_NAME, "[" + shiftName + "]");
} else {
filters.put(PerformanceAnalysisDetailsDtoFields.SHIFT_NAME, ISNULL);
}
Date timeRangeFrom = analysis.getDateField(PerformanceAnalysisDetailsDtoFields.TIME_RANGE_FROM);
if (!Objects.isNull(timeRangeFrom)) {
filters.put(PerformanceAnalysisDetailsDtoFields.TIME_RANGE_FROM, DateUtils.toDateString(timeRangeFrom));
} else {
filters.put(PerformanceAnalysisDetailsDtoFields.TIME_RANGE_FROM, ISNULL);
}
Date timeRangeTo = analysis.getDateField(PerformanceAnalysisDetailsDtoFields.TIME_RANGE_TO);
if (!Objects.isNull(timeRangeTo)) {
filters.put(PerformanceAnalysisDetailsDtoFields.TIME_RANGE_TO, DateUtils.toDateString(timeRangeTo));
} else {
filters.put(PerformanceAnalysisDetailsDtoFields.TIME_RANGE_TO, ISNULL);
}
Map<String, Object> gridOptions = Maps.newHashMap();
gridOptions.put(L_FILTERS, filters);
Map<String, Object> parameters = Maps.newHashMap();
parameters.put(L_GRID_OPTIONS, gridOptions);
parameters.put(L_WINDOW_ACTIVE_MENU, "analysis.performanceAnalysis");
String url = "../page/productionCounting/performanceAnalysisDetails.html";
view.redirectTo(url, false, true, parameters);
}
use of com.qcadoo.view.api.components.GridComponent in project mes by qcadoo.
the class ProductionBalanceDetailsListeners method addAllRelatedOrders.
public final void addAllRelatedOrders(final ViewDefinitionState view, final ComponentState state, final String[] args) {
GridComponent ordersGrid = (GridComponent) view.getComponentByReference(ProductionBalanceFields.ORDERS);
FormComponent form = (FormComponent) view.getComponentByReference(QcadooViewConstants.L_FORM);
Entity balance = form.getPersistedEntityWithIncludedFormValues();
List<Entity> orders = Lists.newArrayList(balance.getHasManyField(ProductionBalanceFields.ORDERS));
for (Entity entity : ordersGrid.getSelectedEntities()) {
Entity root = entity.getBelongsToField("root");
if (root == null) {
root = entity;
}
orders.add(root);
List<Entity> children = entity.getDataDefinition().find().add(SearchRestrictions.belongsTo("root", OrdersConstants.PLUGIN_IDENTIFIER, OrdersConstants.MODEL_ORDER, root.getId())).list().getEntities();
orders.addAll(children);
}
balance.setField(ProductionBalanceFields.ORDERS, orders);
balance = balance.getDataDefinition().save(balance);
form.setEntity(balance);
}
use of com.qcadoo.view.api.components.GridComponent 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.GridComponent in project mes by qcadoo.
the class ProductionTrackingDetailsListeners method addToAnomaliesList.
public void addToAnomaliesList(final ViewDefinitionState view, final ComponentState state, final String[] args) {
GridComponent trackingOperationProductInComponentsGrid = (GridComponent) view.getComponentByReference(ProductionTrackingFields.TRACKING_OPERATION_PRODUCT_IN_COMPONENTS);
if (!trackingOperationProductInComponentsGrid.getSelectedEntitiesIds().isEmpty()) {
FormComponent productionTrackingForm = (FormComponent) view.getComponentByReference(QcadooViewConstants.L_FORM);
Long productionTrackingId = productionTrackingForm.getEntityId();
Map<String, Object> parameters = Maps.newHashMap();
parameters.put("form.productionTrackingId", productionTrackingId);
parameters.put("form.selectedTOPICs", trackingOperationProductInComponentsGrid.getSelectedEntitiesIds().stream().map(String::valueOf).collect(Collectors.joining(",")));
parameters.put("form.performAndAccept", Boolean.FALSE);
String url = "/productionCounting/anomalyProductionTrackingDetails.html";
view.openModal(url, parameters);
}
}
use of com.qcadoo.view.api.components.GridComponent in project mes by qcadoo.
the class DivisionDetailsHooksPL method fillCriteriaModifiers.
public void fillCriteriaModifiers(final ViewDefinitionState viewDefinitionState) {
GridComponent workstations = (GridComponent) viewDefinitionState.getComponentByReference("workstations");
FormComponent form = (FormComponent) viewDefinitionState.getComponentByReference(QcadooViewConstants.L_FORM);
if (form.getEntityId() != null) {
FilterValueHolder filter = workstations.getFilterValue();
filter.put("division", form.getEntityId());
workstations.setFilterValue(filter);
}
workstations.reloadEntities();
}
Aggregations