Search in sources :

Example 1 with GridComponentMultiSearchFilter

use of com.qcadoo.view.api.components.grid.GridComponentMultiSearchFilter in project mes by qcadoo.

the class BeforeAdditionalActionsAnalysisGeneratorListeners 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_beforeadditionalactionsanalysisentry", dataDefinitionService.get(ProductionCountingConstants.PLUGIN_IDENTIFIER, ProductionCountingConstants.MODEL_BEFORE_ADDITIONAL_ACTIONS_ANALYSIS_ENTRY));
        String multiFilterQ = GridComponentFilterSQLUtils.addMultiSearchFilter(multiSearchFilter, grid.getColumns(), "productioncounting_beforeadditionalactionsanalysisentry", dataDefinitionService.get(ProductionCountingConstants.PLUGIN_IDENTIFIER, ProductionCountingConstants.MODEL_BEFORE_ADDITIONAL_ACTIONS_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 2 with GridComponentMultiSearchFilter

use of com.qcadoo.view.api.components.grid.GridComponentMultiSearchFilter 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 3 with GridComponentMultiSearchFilter

use of com.qcadoo.view.api.components.grid.GridComponentMultiSearchFilter 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)

Example 4 with GridComponentMultiSearchFilter

use of com.qcadoo.view.api.components.grid.GridComponentMultiSearchFilter in project mes by qcadoo.

the class ProductionAnalysisListeners method calculateTotalQuantities.

public void calculateTotalQuantities(final ViewDefinitionState view, final ComponentState state, final String[] args) {
    final FieldComponent totalProducedQuantity = (FieldComponent) view.getComponentByReference("totalProducedQuantity");
    final FieldComponent numberOfWorkers = (FieldComponent) view.getComponentByReference("numberOfWorkers");
    final 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_PRODUCTIONANALYSISDTO, dataDefinitionService.get(ProductionCountingConstants.PLUGIN_IDENTIFIER, MODEL_PRODUCTION_ANALYSIS_DTO));
        filterQ += " AND ";
        filterQ += GridComponentFilterSQLUtils.addMultiSearchFilter(multiSearchFilter, grid.getColumns(), TABLE_PRODUCTIONCOUNTING_PRODUCTIONANALYSISDTO, dataDefinitionService.get(ProductionCountingConstants.PLUGIN_IDENTIFIER, MODEL_PRODUCTION_ANALYSIS_DTO));
    } catch (Exception e) {
        filterQ = "";
    }
    if (StringUtils.isNoneBlank(filterQ)) {
        query = query + " WHERE " + filterQ;
    }
    Map<String, Object> values = jdbcTemplate.queryForMap(query, Collections.emptyMap());
    totalProducedQuantity.setFieldValue(values.get("totalDoneQuantity"));
    numberOfWorkers.setFieldValue(values.get("totalStaffNumber"));
    totalProducedQuantity.requestComponentUpdateState();
    numberOfWorkers.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

FieldComponent (com.qcadoo.view.api.components.FieldComponent)4 GridComponent (com.qcadoo.view.api.components.GridComponent)4 GridComponentMultiSearchFilter (com.qcadoo.view.api.components.grid.GridComponentMultiSearchFilter)4