bug#6130
git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Web/trunk/ventaboletos@42915 d1611594-4594-4d17-8e1d-87c2c4800839master
parent
666c749932
commit
438ce8c510
|
@ -6,6 +6,8 @@ package com.rjconsultores.ventaboletos.web.gui.controladores.catalogos;
|
|||
|
||||
import java.io.IOException;
|
||||
import java.math.BigDecimal;
|
||||
import java.sql.Connection;
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
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.UsuarioBancarioService;
|
||||
import com.rjconsultores.ventaboletos.service.UsuarioService;
|
||||
import com.rjconsultores.ventaboletos.utilerias.DateUtil;
|
||||
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
|
||||
import com.rjconsultores.ventaboletos.web.gui.controladores.configuracioneccomerciales.FechamentoParamptovtaListItemRenderer;
|
||||
import com.rjconsultores.ventaboletos.web.utilerias.MyComboboxPuntoVenta;
|
||||
|
@ -790,36 +793,55 @@ public class EditarPuntoVentaController extends MyGenericForwardComposer {
|
|||
return getString;
|
||||
}
|
||||
|
||||
public void onClick$btnIntegracao(Event ev) {
|
||||
public void onClick$btnIntegracao(Event ev) throws InterruptedException {
|
||||
|
||||
Connection myConn = null;
|
||||
|
||||
try {
|
||||
Calendar cal = Calendar.getInstance();
|
||||
cal.setTime(fecFinal.getValue());
|
||||
cal.set(Calendar.HOUR_OF_DAY, 23);
|
||||
cal.set(Calendar.MINUTE, 59);
|
||||
cal.set(Calendar.SECOND, 59);
|
||||
myConn = dataSource.getConnection();
|
||||
myConn.setAutoCommit(false);
|
||||
|
||||
Date dateInicio = fecInicio.getValue();
|
||||
Date dateFim = fecFinal.getValue();
|
||||
|
||||
TotvsService.cadastrarTituloAReceber(puntoVenta.getPuntoventaId(), fecInicio.getValue(), cal.getTime(), dataSource.getConnection());
|
||||
puntoVentaService.getDBSession().close();
|
||||
} catch (WrongValueException e) {
|
||||
log.error("", e);
|
||||
try {
|
||||
Messagebox.show(
|
||||
e.getMessage(),
|
||||
Labels.getLabel("editarPuntoVentaController.window.title"),
|
||||
Messagebox.OK, Messagebox.ERROR);
|
||||
} catch (InterruptedException e1) {
|
||||
log.error("", e1);
|
||||
}
|
||||
dateInicio = DateUtil.inicioFecha(dateInicio);
|
||||
dateFim = DateUtil.fimFecha(dateFim);
|
||||
|
||||
log.info("puntoVentaId="+puntoVenta.getPuntoventaId()+";fecInicio="+dateInicio+";fecFin="+dateFim);
|
||||
|
||||
TotvsService.cadastrarTituloAReceber(puntoVenta.getPuntoventaId(), fecInicio.getValue(), dateFim, myConn);
|
||||
|
||||
myConn.commit();
|
||||
} 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);
|
||||
try {
|
||||
Messagebox.show(
|
||||
e.getMessage(),
|
||||
Labels.getLabel("editarPuntoVentaController.window.title"),
|
||||
Messagebox.OK, Messagebox.ERROR);
|
||||
} catch (InterruptedException e1) {
|
||||
log.error("", e1);
|
||||
|
||||
|
||||
Messagebox.show(
|
||||
e.getMessage(),
|
||||
Labels.getLabel("editarPuntoVentaController.window.title"),
|
||||
Messagebox.OK, Messagebox.ERROR);
|
||||
|
||||
}finally{
|
||||
if (myConn != null){
|
||||
try {
|
||||
myConn.close();
|
||||
} catch (SQLException e) {
|
||||
log.error("Erro ao fechar a conexão",e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue