@Override
  protected List<Embarque> findData() {
    String hql = "from Embarque e where e.regreso is null";
    List<Embarque> data = ServiceLocator2.getHibernateTemplate().find(hql);
    hql = "from Embarque e where date(e.regreso) between ? and ?";
    data.addAll(
        ServiceLocator2.getHibernateTemplate()
            .find(hql, new Object[] {periodo.getFechaInicial(), periodo.getFechaFinal()}));

    UniqueList<Embarque> unidata =
        new UniqueList<Embarque>(
            GlazedLists.eventList(data), GlazedLists.beanPropertyComparator(Embarque.class, "id"));
    return unidata;
  }
Esempio n. 2
0
 @Override
 protected List<Poliza> findData() {
   System.out.println("Buscando polizas periodo: " + periodo);
   String hql = "from Poliza p " + " where p.clase=? " + "   and date(p.fecha) between ? and ?";
   Object[] params = {getClase(), periodo.getFechaInicial(), periodo.getFechaFinal()};
   return ServiceLocator2.getHibernateTemplate().find(hql, params);
 }
Esempio n. 3
0
 private JComboBox buildLineaControl() {
   final JComboBox box = new JComboBox();
   final EventList source =
       GlazedLists.eventList(
           ServiceLocator2.getHibernateTemplate().find("from Linea l order by l.nombre"));
   final TextFilterator filterator = GlazedLists.textFilterator(new String[] {"nombre"});
   AutoCompleteSupport support = AutoCompleteSupport.install(box, source, filterator);
   support.setFilterMode(TextMatcherEditor.STARTS_WITH);
   support.setCorrectsCase(true);
   return box;
 }
Esempio n. 4
0
  public void cancelar(String uuid) throws Exception {
    String[] uuidList = new String[] {uuid};
    System.out.println("Mandando canclera CFDIS: " + ArrayUtils.toString(uuidList));

    String dirPath = "Z:\\CFDI\\cancelaciones";
    File dir = new File(dirPath);
    Assert.isTrue(dir.exists(), "No existe el directorio para cancelaciones: " + dirPath);
    Assert.isTrue(
        dir.isDirectory(), "La ruta para las cancelaciones no es un directorio " + dirPath);

    CancelaResponse res =
        client.cancelCfdi(
            "PAP830101CR3",
            "yqjvqfofb",
            empresa.getRfc(),
            uuidList,
            empresa.getCertificadoDigitalPfx(),
            pfxPassword);
    String msg = res.getText();
    String aka = res.getAck();
    // String[] uuids=res.getUuids();
    CFDI cfdi = ServiceLocator2.getCFDIManager().buscarPorUUID(uuid);
    Assert.notNull(cfdi, "No eixste el CFDI con UUID:" + uuid);

    try {
      // byte[] d1=Base64.decode(msg.getBytes());
      String xmlFile = StringUtils.remove(cfdi.getXmlFilePath(), "xml");
      byte[] d1 = msg.getBytes();
      File msgFile = new File(dir, xmlFile + "_MSG.xml");
      FileOutputStream out1 = new FileOutputStream(msgFile);
      out1.write(d1);
      out1.close();

      // byte[] d2=Base64.decode(aka.getBytes());
      byte[] d2 = aka.getBytes();
      File akaFile = new File(dir, xmlFile + "_AKA.xml");
      FileOutputStream out2 = new FileOutputStream(akaFile);
      out2.write(d2);
      out2.close();

    } catch (Exception e) {
      e.printStackTrace();
      System.out.println(
          "Error salvando archivos de cancelacion: " + ExceptionUtils.getRootCauseMessage(e));
    }
    cfdi.setCancelacion(new Date());
    ServiceLocator2.getHibernateTemplate().merge(cfdi);
  }