Commit 5b4789ed by Billy Larru

asignar horario de salida al personal

parent c719526b
......@@ -20,5 +20,5 @@ public interface SalidasDAO {
public JSONObject actualizarSalida(String horaSalida) throws Exception;
public JSONArray obtenerSalidasNuevas() throws Exception;
public JSONArray obtenerPersonalNuevoSinSalida() throws Exception;
public JSONObject asignarHorarioSalida(JSONArray listaPersonalNuevo) throws Exception;
public JSONObject asignarHorarioSalida() throws Exception;
}
......@@ -246,7 +246,7 @@ public class SalidasMysqlDAO implements SalidasDAO {
}
public static void main(String[] args) {
SalidasMysqlDAO s = new SalidasMysqlDAO();
// SalidasMysqlDAO s = new SalidasMysqlDAO();
// try {
// JSONObject obj = s.actualizarSalida("17:00");
// System.out.println(obj);
......@@ -254,7 +254,21 @@ public class SalidasMysqlDAO implements SalidasDAO {
// Logger.getLogger(SalidasMysqlDAO.class.getName()).log(Level.SEVERE, null, ex);
// }
System.out.println(s.getFechaAyer());
// System.out.println(s.getFechaAyer());
String query = "SELECT "
+ " p.codper, "
+ " su.salidaLV, "
+ " su.salidaS, "
+ "FROM "
+ " personal p "
+ "INNER JOIN salidas_update su ON p.codcargo=su.codcargo "
+ "WHERE retirado=0 AND p.horaing=su.horaLV "
+ "and p.mining=su.minutoLV and p.horaingsabado=su.sabadoLV AND p.miningsabado=su.sabadoS "
+ "and NOT p.codlocal in('L035','L053','L038') AND NOT pronoe=1 "
+ "AND not p.codcargo in (71,13) and horaing < 19 and "
+ "(nullif(p.salidaLV,'') is null and nullif(p.salidaS, '') is null) ORDER BY p.codper ";
System.out.println(query);
}
@Override
......@@ -301,13 +315,22 @@ public class SalidasMysqlDAO implements SalidasDAO {
}
@Override
public JSONObject asignarHorarioSalida(JSONArray listaPersonalNuevo) throws Exception {
public JSONObject asignarHorarioSalida() throws Exception {
Connection cn = MysqlDAOFactory.obtenerConexion("nuevo");
String query = "update personal p, "
+ " ("
+ " SELECT p.codper, su.salidaLV, su.salidaS FROM personal p INNER JOIN salidas_update su ON p.codcargo=su.codcargo "
+ " WHERE retirado=0 AND p.horaing=su.horaLV and p.mining=su.minutoLV "
+ " and p.horaingsabado=su.sabadoLV AND p.miningsabado=su.sabadoS and NOT p.codlocal in('L035','L053','L038') "
+ " AND NOT pronoe=1 AND not p.codcargo in (71,13) and horaing < 19 and (nullif(p.salidaLV,'') is null and nullif(p.salidaS, '') is null) "
+ " ) as tbl "
+ "SET p.salidaLV=tbl.salidaLV, "
+ " p.salidaS=tbl.salidaS "
+ "where tbl.codper=p.codper";
String query = "UPDATE personal SET salidaLV=?,salidaS=? WHERE codper=?;";
JSONObject jsonArray = EstandarDAO.getInstance().consultar(cn, query);
return jsonArray;
JSONObject resultado = EstandarDAO.getInstance().ejecutar(cn, query);
return resultado;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment