public static ArrayList<bConsulta2> getMediaHoras2(String dt1, String dt2, Integer gmp, String arg_prod) throws SQLException, ClassNotFoundException {
        ArrayList<bConsulta2> sts = new ArrayList<bConsulta2>();
        Connection conPol = conMgr.getConnection("PD");
        ResultSet rs;
        if (conPol == null) {
            throw new SQLException("Numero Maximo de Conexoes Atingida!");
        }
        try {
            String strQl =
                    "	SELECT "
                    + "	date_trunc('hour',datah)::text as dia,"
                    + "	cod_posto,"
                    + "	count(distinct(serial)) as cont,"
                    + "	tb_operador.str_nome,"
                    + "	tb_gmp.obs"
                    + "	FROM "
                    + "	tb_gmp, "
                    + "	tb_operador, "
                    + "	tb_registro"
                    + "	WHERE"
                    + "	tb_gmp.cod_gmp = tb_registro.cod_gmp "
                    + "	AND  tb_registro.cod_cr = tb_operador.cod_cr"
                    + "	and tb_registro.cod_gmp = ? "
                    + "	and date_trunc('day',  datah) >=  TO_timestamp(?,'dd/MM/YYYY')"
                    + "	and date_trunc('day',  datah) <=  TO_timestamp(?,'dd/MM/YYYY')"
                    + "	AND cod_prod = ?"
                    + "	group by dia,cod_posto, tb_gmp.obs,tb_operador.str_nome"
                    + "	union ("
                    + "	SELECT "
                    + "	date_trunc('hour',datah)::text as dia,"
                    + "	-1 as cod_posto,"
                    + "	count(distinct(serial)) as cont,"
                    + "	 'NOK'::text as str_nome,"
                    + "	tb_gmp.obs"
                    + "	FROM "
                    + "	tb_gmp, "
                    + "	tb_registro"
                    + "	WHERE"
                    + "	cod_status > 0 and"
                    + "	tb_gmp.cod_gmp = tb_registro.cod_gmp "
                    + "	and tb_registro.cod_gmp = ? "
                    + "	and date_trunc('day',  datah) >=  TO_timestamp(?,'dd/MM/YYYY')"
                    + "	and date_trunc('day',  datah) <=  TO_timestamp(?,'dd/MM/YYYY')"
                    + "	AND cod_prod = ?"
                    + "	group by dia, tb_gmp.obs)"
                    + "	ORDER BY dia,cod_posto;";


            call = conPol.prepareCall(strQl);
            call.setInt(1, gmp);
            call.setString(2, dt1);
            call.setString(3, dt2);
            call.setString(4, arg_prod);

            call.setInt(5, gmp);
            call.setString(6, dt1);
            call.setString(7, dt2);
            call.setString(8, arg_prod);

            rs = call.executeQuery();

            while (rs.next()) {
                bConsulta2 reg = new bConsulta2();
                reg.setData_in(rs.getString("dia"));
                reg.setPosto(String.valueOf(rs.getInt("cod_posto")));
                reg.setCont(rs.getInt("cont"));
                reg.setStr_nome(rs.getString("str_nome"));
                reg.setObs(rs.getString("obs"));
                sts.add(reg);
            }
        } finally {
            if (conPol != null) {
                conMgr.freeConnection("PD", conPol);
            }
        }
        return sts;
    }