gleimar 2015-04-08 23:12:13 +00:00
parent 666c749932
commit 438ce8c510
1 changed files with 48 additions and 26 deletions

View File

@ -6,6 +6,8 @@ package com.rjconsultores.ventaboletos.web.gui.controladores.catalogos;
import java.io.IOException; import java.io.IOException;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.sql.Connection;
import java.sql.SQLException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Calendar; import java.util.Calendar;
import java.util.Date; import java.util.Date;
@ -99,6 +101,7 @@ import com.rjconsultores.ventaboletos.service.PuntoVentaService;
import com.rjconsultores.ventaboletos.service.TipoPuntoVentaService; import com.rjconsultores.ventaboletos.service.TipoPuntoVentaService;
import com.rjconsultores.ventaboletos.service.UsuarioBancarioService; import com.rjconsultores.ventaboletos.service.UsuarioBancarioService;
import com.rjconsultores.ventaboletos.service.UsuarioService; import com.rjconsultores.ventaboletos.service.UsuarioService;
import com.rjconsultores.ventaboletos.utilerias.DateUtil;
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
import com.rjconsultores.ventaboletos.web.gui.controladores.configuracioneccomerciales.FechamentoParamptovtaListItemRenderer; import com.rjconsultores.ventaboletos.web.gui.controladores.configuracioneccomerciales.FechamentoParamptovtaListItemRenderer;
import com.rjconsultores.ventaboletos.web.utilerias.MyComboboxPuntoVenta; import com.rjconsultores.ventaboletos.web.utilerias.MyComboboxPuntoVenta;
@ -790,36 +793,55 @@ public class EditarPuntoVentaController extends MyGenericForwardComposer {
return getString; return getString;
} }
public void onClick$btnIntegracao(Event ev) { public void onClick$btnIntegracao(Event ev) throws InterruptedException {
Connection myConn = null;
try { try {
Calendar cal = Calendar.getInstance(); myConn = dataSource.getConnection();
cal.setTime(fecFinal.getValue()); myConn.setAutoCommit(false);
cal.set(Calendar.HOUR_OF_DAY, 23);
cal.set(Calendar.MINUTE, 59);
cal.set(Calendar.SECOND, 59);
Date dateInicio = fecInicio.getValue();
Date dateFim = fecFinal.getValue();
TotvsService.cadastrarTituloAReceber(puntoVenta.getPuntoventaId(), fecInicio.getValue(), cal.getTime(), dataSource.getConnection()); dateInicio = DateUtil.inicioFecha(dateInicio);
puntoVentaService.getDBSession().close(); dateFim = DateUtil.fimFecha(dateFim);
} catch (WrongValueException e) {
log.error("", e); log.info("puntoVentaId="+puntoVenta.getPuntoventaId()+";fecInicio="+dateInicio+";fecFin="+dateFim);
try {
Messagebox.show( TotvsService.cadastrarTituloAReceber(puntoVenta.getPuntoventaId(), fecInicio.getValue(), dateFim, myConn);
e.getMessage(),
Labels.getLabel("editarPuntoVentaController.window.title"), myConn.commit();
Messagebox.OK, Messagebox.ERROR);
} catch (InterruptedException e1) {
log.error("", e1);
}
} catch (Exception e) { } catch (Exception e) {
if (myConn != null) {
try {
myConn.rollback();
} catch (SQLException e1) {
log.error("Erro rollback",e1);
}
}
if (e instanceof WrongValueException){
throw (WrongValueException)e;
}
log.error("", e); log.error("", e);
try {
Messagebox.show(
e.getMessage(), Messagebox.show(
Labels.getLabel("editarPuntoVentaController.window.title"), e.getMessage(),
Messagebox.OK, Messagebox.ERROR); Labels.getLabel("editarPuntoVentaController.window.title"),
} catch (InterruptedException e1) { Messagebox.OK, Messagebox.ERROR);
log.error("", e1);
}finally{
if (myConn != null){
try {
myConn.close();
} catch (SQLException e) {
log.error("Erro ao fechar a conexão",e);
}
} }
} }
} }