示例#1
0
文件: ot.java 项目: CriVasquez/SWAMRV
  public void actualizarOTSERVICIO(int idot, String patente, int id_servicio)
      throws SQLException, DocumentException, FileNotFoundException {
    try {
      System.out.println("INICIO del Stored Procedure de insercion Conductor");
      OracleCallableStatement cs =
          (OracleCallableStatement)
              Conexion.con.prepareCall("begin registrarOTSERVICIO(?,?,?); end;");
      System.out.println("AQUI YA LLAME AL STORED PROCEDURE");
      cs.setInt(1, idot);
      cs.setString(2, patente);
      cs.setInt(3, id_servicio);

      cs.executeUpdate();

      System.out.println("\nOTSERVICIO succesfully inserted");
      Conexion.con.commit();
      System.out.println("TERMINO del Stored Procedure de insercion OTSERVICIO");
      GeneratePDF gpdf = new GeneratePDF();

      // Obtencion datos personal de la orden_trabajo
      String query =
          "select ot.fecha_inicio as fechainicio, mec.nombre as mecnombre, mec.apellido_paterno as mecapepa, mec.apellido_materno as mecamema, adm.nombre as adnombre, adm.apellido_paterno as adapepa, adm.apellido_materno as adamema, ot.id_ot as idot, ot.patente as patente from orden_trabajo ot, mecanico mec, administrador adm where ot.id_ot = "
              + idot
              + " and ot.patente = '"
              + patente
              + "' and ot.rut_mecanico = mec.rut_mecanico and ot.rut_administrador = adm.rut_administrador";
      ResultSet rs = Conexion.ejecutarQuery(query);

      String query2 =
          "select s.id_servicio, s.nombre from orden_trabajo_servicio ots, servicio s where ots.id_ot = "
              + idot
              + " and ots.patente = '"
              + patente
              + "' and ots.id_servicio = s.id_servicio";
      ResultSet rs2 = Conexion.ejecutarQuery(query2);
      // Creacion de PDF
      gpdf.crearDocumento("ORDEN DE TRABAJO N°" + idot + "-PATENTE-" + patente);
      // Asignacion de contenido PDF a la clase GeneratePDF
      gpdf.ContenidoDocumento(
          "SOPRAF S.A. SOFTWARE AMRV",
          "O  R  D  E  N     D  E     T  R  A  B  A  J  O",
          "S  E  R  V  I  C  I  O  S",
          rs,
          rs2);

    } catch (SQLException ex) {
      ex.printStackTrace();
    }
  }
示例#2
0
文件: ot.java 项目: CriVasquez/SWAMRV
  public void RegistrarRepuestoOT(
      int NUM_ORDEN,
      String PATENTE,
      int ID_REPUESTO,
      String RUT_ENCARGADO,
      String OBSERVACIONES,
      int CANTIDAD)
      throws SQLException {
    try {
      System.out.println("INICIO del Stored Procedure de insercion OTREPUESTO");
      OracleCallableStatement cs =
          (OracleCallableStatement)
              Conexion.con.prepareCall("begin registrarOTREP(?,?,?,?,?,?); end;");
      System.out.println("AQUI YA LLAME AL STORED PROCEDURE");
      System.out.println(
          "AQUI YA RECIBI PARAMETROS DESDE RETIROREPUESTOS: "
              + NUM_ORDEN
              + " , "
              + PATENTE
              + " , "
              + ID_REPUESTO
              + " , "
              + OBSERVACIONES
              + " , "
              + CANTIDAD
              + " , "
              + RUT_ENCARGADO);
      cs.setInt(1, NUM_ORDEN);
      cs.setString(2, PATENTE);
      cs.setInt(3, ID_REPUESTO);
      cs.setString(4, RUT_ENCARGADO);
      cs.setString(5, OBSERVACIONES);
      cs.setInt(6, CANTIDAD);

      cs.executeUpdate();
      System.out.println("\nSuccesfully inserted");
      Conexion.con.commit();
      System.out.println("TERMINO del Stored Procedure de insercion OTREPUESTO");
      JOptionPane.showMessageDialog(
          null,
          "Datos Ingresados Satisfactoriamente",
          "Mensajero",
          JOptionPane.INFORMATION_MESSAGE);
    } catch (SQLException ex) {
      ex.printStackTrace();
      JOptionPane.showMessageDialog(null, ex, "Error", JOptionPane.ERROR_MESSAGE);
    }
  }
示例#3
0
文件: ot.java 项目: CriVasquez/SWAMRV
  public void registrarOT(ot ordentrabajo) throws SQLException {
    try {
      System.out.println("INICIO del Stored Procedure de insercion OT");

      OracleCallableStatement cs =
          (OracleCallableStatement)
              Conexion.con.prepareCall("begin registrarOT(?,?,?,?,?,?,?); end;");
      System.out.println("AQUI YA LLAME AL STORED PROCEDURE");
      cs.setInt(1, ordentrabajo.getID_OT());
      cs.setString(2, ordentrabajo.getPATENTE());
      cs.setString(3, ordentrabajo.getRUT_ADMINISTRADOR());
      cs.setString(4, ordentrabajo.getRUT_MECANICO());
      cs.setDate(5, ordentrabajo.getFECHA_INICIO());
      cs.setDate(6, ordentrabajo.getFECHA_TERMINO());
      cs.setString(7, ordentrabajo.getTIPOTRABAJO());

      cs.executeUpdate();

      System.out.println("\nOT succesfully inserted");
      Conexion.con.commit();
      System.out.println("TERMINO del Stored Procedure de insercion OT");
    } catch (SQLException ex) {
      ex.printStackTrace();
    }
  }