use of com.qcadoo.view.api.components.GridComponent in project mes by qcadoo.
the class FinalProductAnalysisGeneratorListeners method calculateTotalQuantity.
public void calculateTotalQuantity(final ViewDefinitionState view, final ComponentState state, final String[] args) {
GridComponent grid = (GridComponent) view.getComponentByReference(QcadooViewConstants.L_GRID);
String query = buildQuery();
Map<String, String> filter = grid.getFilters();
GridComponentMultiSearchFilter multiSearchFilter = grid.getMultiSearchFilter();
String filterQ;
try {
filterQ = GridComponentFilterSQLUtils.addFilters(filter, grid.getColumns(), "productioncounting_finalproductanalysisentry", dataDefinitionService.get(ProductionCountingConstants.PLUGIN_IDENTIFIER, ProductionCountingConstants.MODEL_FINAL_PRODUCT_ANALYSIS_ENTRY));
String multiFilterQ = GridComponentFilterSQLUtils.addMultiSearchFilter(multiSearchFilter, grid.getColumns(), "productioncounting_finalproductanalysisentry", dataDefinitionService.get(ProductionCountingConstants.PLUGIN_IDENTIFIER, ProductionCountingConstants.MODEL_FINAL_PRODUCT_ANALYSIS_ENTRY));
if (!Strings.isNullOrEmpty(multiFilterQ)) {
if (!Strings.isNullOrEmpty(filterQ))
filterQ += " AND ";
filterQ += multiFilterQ;
}
} catch (Exception e) {
filterQ = "";
}
if (!Strings.isNullOrEmpty(filterQ)) {
query = query + " WHERE " + filterQ;
}
Map<String, Object> values = jdbcTemplate.queryForMap(query, Collections.emptyMap());
FieldComponent totalQuantity = (FieldComponent) view.getComponentByReference("totalQuantity");
totalQuantity.setFieldValue(numberService.format(values.get("totalDoneQuantity")));
totalQuantity.requestComponentUpdateState();
}
use of com.qcadoo.view.api.components.GridComponent in project mes by qcadoo.
the class ProductionTrackingDetailsHooks method setFieldComponentsEnabledAndGridsEditable.
private void setFieldComponentsEnabledAndGridsEditable(final ViewDefinitionState view, final boolean isEnabled) {
productionCountingService.setComponentsState(view, L_PRODUCTION_TRACKING_FIELD_NAMES, isEnabled, true);
GridComponent trackingOperationProductInComponentsGrid = (GridComponent) view.getComponentByReference(ProductionTrackingFields.TRACKING_OPERATION_PRODUCT_IN_COMPONENTS);
GridComponent trackingOperationProductOutComponentsGrid = (GridComponent) view.getComponentByReference(ProductionTrackingFields.TRACKING_OPERATION_PRODUCT_OUT_COMPONENTS);
GridComponent stateChangesGrid = (GridComponent) view.getComponentByReference(ProductionTrackingFields.STATE_CHANGES);
String releaseOfMaterials = parameterService.getParameter().getStringField(ParameterFieldsPC.RELEASE_OF_MATERIALS);
if (ReleaseOfMaterials.MANUALLY_TO_ORDER_OR_GROUP.getStringValue().equals(releaseOfMaterials)) {
trackingOperationProductInComponentsGrid.setEnabled(false);
} else {
trackingOperationProductInComponentsGrid.setEnabled(isEnabled);
}
trackingOperationProductOutComponentsGrid.setEnabled(isEnabled);
stateChangesGrid.setEditable(isEnabled);
}
use of com.qcadoo.view.api.components.GridComponent in project mes by qcadoo.
the class ProductionTrackingsForProductGroupedListHooks method updateButtonsState.
public void updateButtonsState(final ViewDefinitionState view) {
GridComponent productionTrackingsForProductGroupedGrid = (GridComponent) view.getComponentByReference(QcadooViewConstants.L_GRID);
WindowComponent window = (WindowComponent) view.getComponentByReference(QcadooViewConstants.L_WINDOW);
Ribbon ribbon = window.getRibbon();
RibbonGroup showProductionTrackingsRibbonGroup = ribbon.getGroupByName(L_SHOW_PRODUCTION_TRACKINGS);
RibbonActionItem showProductionTrackingsForProductRibbonActionItem = showProductionTrackingsRibbonGroup.getItemByName(L_SHOW_PRODUCTION_TRACKINGS_FOR_PRODUCT);
boolean isSelected = !productionTrackingsForProductGroupedGrid.getSelectedEntities().isEmpty();
showProductionTrackingsForProductRibbonActionItem.setEnabled(isSelected);
showProductionTrackingsForProductRibbonActionItem.requestUpdate(true);
}
use of com.qcadoo.view.api.components.GridComponent in project mes by qcadoo.
the class ProductionTrackingsForProductGroupedListListeners method showProductionTrackingsForProduct.
public void showProductionTrackingsForProduct(final ViewDefinitionState view, final ComponentState state, final String[] args) {
GridComponent productionTrackingsForProductGroupedGrid = (GridComponent) view.getComponentByReference(QcadooViewConstants.L_GRID);
if (productionTrackingsForProductGroupedGrid.getSelectedEntities().isEmpty()) {
return;
}
Entity productionTrackingsForProductGrouped = productionTrackingsForProductGroupedGrid.getSelectedEntities().get(0);
StringBuilder orderNumberBuilder = new StringBuilder();
orderNumberBuilder.append("[");
orderNumberBuilder.append(productionTrackingsForProductGrouped.getStringField(ProductionTrackingForProductGroupedDtoFields.ORDER_NUMBER));
orderNumberBuilder.append("]");
StringBuilder productNumberBuilder = new StringBuilder();
String orderNumber = orderNumberBuilder.toString();
productNumberBuilder.append("[");
productNumberBuilder.append(productionTrackingsForProductGrouped.getStringField(ProductionTrackingForProductGroupedDtoFields.PRODUCT_NUMBER));
productNumberBuilder.append("]");
String productNumber = productNumberBuilder.toString();
Map<String, String> filters = Maps.newHashMap();
filters.put("orderNumber", orderNumber);
filters.put("productNumber", productNumber);
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, "ordersTracking.productionTrackingForProduct");
String url = "../page/productionCounting/productionTrackingsForProductList.html";
view.redirectTo(url, false, true, parameters);
}
use of com.qcadoo.view.api.components.GridComponent in project mes by qcadoo.
the class PerformanceAnalysisListeners method calculateTotalTime.
public void calculateTotalTime(final ViewDefinitionState view, final ComponentState state, final String[] args) {
FieldComponent totalTimeBasedOnNorms = (FieldComponent) view.getComponentByReference(PerformanceAnalysisDtoFields.TOTAL_TIME_BASED_ON_NORMS);
FieldComponent totalLaborTime = (FieldComponent) view.getComponentByReference(PerformanceAnalysisDtoFields.TOTAL_LABOR_TIME);
FieldComponent totalDeviationTime = (FieldComponent) view.getComponentByReference(PerformanceAnalysisDtoFields.TOTAL_DEVIATION_TIME);
FieldComponent totalPerformance = (FieldComponent) view.getComponentByReference(PerformanceAnalysisDtoFields.TOTAL_PERFORMANCE);
GridComponent grid = (GridComponent) view.getComponentByReference(QcadooViewConstants.L_GRID);
String query = buildQuery();
Map<String, String> filter = grid.getFilters();
GridComponentMultiSearchFilter multiSearchFilter = grid.getMultiSearchFilter();
String filterQ;
try {
filterQ = GridComponentFilterSQLUtils.addFilters(filter, grid.getColumns(), TABLE_PRODUCTIONCOUNTING_PERFORMANCEANALYSISDTO, dataDefinitionService.get(ProductionCountingConstants.PLUGIN_IDENTIFIER, PerformanceAnalysisDtoFields.MODEL_PERFORMANCE_ANALYSIS_DTO));
filterQ += " AND ";
filterQ += GridComponentFilterSQLUtils.addMultiSearchFilter(multiSearchFilter, grid.getColumns(), TABLE_PRODUCTIONCOUNTING_PERFORMANCEANALYSISDTO, dataDefinitionService.get(ProductionCountingConstants.PLUGIN_IDENTIFIER, PerformanceAnalysisDtoFields.MODEL_PERFORMANCE_ANALYSIS_DTO));
} catch (Exception e) {
filterQ = "";
}
if (StringUtils.isNoneBlank(filterQ)) {
query = query + " WHERE " + filterQ;
}
Map<String, Object> values = jdbcTemplate.queryForMap(query, Collections.emptyMap());
totalTimeBasedOnNorms.setFieldValue(values.get("totaltimebasedonnorms"));
totalLaborTime.setFieldValue(values.get("totallabortime"));
totalDeviationTime.setFieldValue(values.get("totaltimedeviation"));
totalPerformance.setFieldValue(numberService.format(values.get("totalperformance")));
totalTimeBasedOnNorms.requestComponentUpdateState();
totalLaborTime.requestComponentUpdateState();
totalDeviationTime.requestComponentUpdateState();
totalPerformance.requestComponentUpdateState();
}
Aggregations