Search in sources :

Example 16 with GridComponent

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();
}
Also used : GridComponentMultiSearchFilter(com.qcadoo.view.api.components.grid.GridComponentMultiSearchFilter) GridComponent(com.qcadoo.view.api.components.GridComponent) FieldComponent(com.qcadoo.view.api.components.FieldComponent)

Example 17 with GridComponent

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);
}
Also used : GridComponent(com.qcadoo.view.api.components.GridComponent)

Example 18 with GridComponent

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);
}
Also used : RibbonGroup(com.qcadoo.view.api.ribbon.RibbonGroup) WindowComponent(com.qcadoo.view.api.components.WindowComponent) Ribbon(com.qcadoo.view.api.ribbon.Ribbon) GridComponent(com.qcadoo.view.api.components.GridComponent) RibbonActionItem(com.qcadoo.view.api.ribbon.RibbonActionItem)

Example 19 with GridComponent

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);
}
Also used : Entity(com.qcadoo.model.api.Entity) GridComponent(com.qcadoo.view.api.components.GridComponent)

Example 20 with GridComponent

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();
}
Also used : GridComponentMultiSearchFilter(com.qcadoo.view.api.components.grid.GridComponentMultiSearchFilter) FieldComponent(com.qcadoo.view.api.components.FieldComponent) GridComponent(com.qcadoo.view.api.components.GridComponent)

Aggregations

GridComponent (com.qcadoo.view.api.components.GridComponent)260 Entity (com.qcadoo.model.api.Entity)131 FormComponent (com.qcadoo.view.api.components.FormComponent)85 FieldComponent (com.qcadoo.view.api.components.FieldComponent)33 WindowComponent (com.qcadoo.view.api.components.WindowComponent)30 RibbonActionItem (com.qcadoo.view.api.ribbon.RibbonActionItem)29 JSONObject (org.json.JSONObject)28 FilterValueHolder (com.qcadoo.view.api.components.lookup.FilterValueHolder)26 RibbonGroup (com.qcadoo.view.api.ribbon.RibbonGroup)24 ComponentState (com.qcadoo.view.api.ComponentState)23 DataDefinition (com.qcadoo.model.api.DataDefinition)22 ViewDefinitionState (com.qcadoo.view.api.ViewDefinitionState)22 QcadooViewConstants (com.qcadoo.view.constants.QcadooViewConstants)20 CheckBoxComponent (com.qcadoo.view.api.components.CheckBoxComponent)19 Autowired (org.springframework.beans.factory.annotation.Autowired)19 BigDecimal (java.math.BigDecimal)16 Service (org.springframework.stereotype.Service)16 LookupComponent (com.qcadoo.view.api.components.LookupComponent)15 Collectors (java.util.stream.Collectors)15 Lists (com.google.common.collect.Lists)12