valdevir 2016-09-29 19:45:51 +00:00
parent 18225ddf73
commit 4e5438b3cd
1 changed files with 33 additions and 29 deletions

View File

@ -338,7 +338,6 @@ public class EditarPuntoVentaController extends MyGenericForwardComposer {
private Radio radIndPermisoTasaEmbarqueSi;
private Radio radIndPermisoTasaEmbarqueNo;
private Radio radIndPermisoTasaEmbarqueVtaManualSi;
private Radio radIndPermisoTasaEmbarqueVtaManualNo;
private Checkbox checkPtoVtaEmpresaIndTerceirizada;
private Checkbox checkPtoVtaEmpresaIndBloqueada;
private Checkbox checkPtoVtaEmpresaIndMostrarCaja;
@ -352,8 +351,7 @@ public class EditarPuntoVentaController extends MyGenericForwardComposer {
private Checkbox checkTF;
private Checkbox checkBOL;
private MyTextbox txtNumIEPuntoVenta;
private Datebox fecIntegracion;
private Textbox logResult;
private Datebox fecIntegracion;;
private boolean integracionTotvs;
private Timebox txtTempoParaImpressao;
private Checkbox ckValidarTempoParaImpressao;
@ -759,6 +757,7 @@ public class EditarPuntoVentaController extends MyGenericForwardComposer {
}
}
@SuppressWarnings("unused")
private String readFile(String fileName) throws IOException {
BufferedReader br = new BufferedReader(new FileReader(fileName));
try {
@ -870,6 +869,7 @@ public class EditarPuntoVentaController extends MyGenericForwardComposer {
txtNomeBanco.setValue(banco.getCodigo());
}
@SuppressWarnings("rawtypes")
public void onSelect$cmbEmpresaPtoVta() {
Empresa empresa = (Empresa) cmbEmpresaPtoVta.getSelectedItem().getValue();
@ -963,7 +963,7 @@ public class EditarPuntoVentaController extends MyGenericForwardComposer {
public void onClick$btnIntegracao(Event ev) throws InterruptedException {
Connection myConn = null;
GeradorTitulosIntegracion gerador;
// GeradorTitulosIntegracion gerador;
try {
myConn = dataSource.getConnection();
Date dateInicio = fecIntegracion.getValue();
@ -1327,6 +1327,9 @@ public class EditarPuntoVentaController extends MyGenericForwardComposer {
if (cmbBanco.getSelectedItem() == null) {
puntoVenta.setAgenciaId(null);
} else {
if (puntoVenta.getAgenciaId() == null) {
puntoVenta.setAgenciaId(new PtovtaAgencia());
}
puntoVenta.getAgenciaId().setInstiFinanceiraId((InstiFinanceira) cmbBanco.getSelectedItem().getValue());
if (cmbPessoa.getSelectedItem() != null) {
puntoVenta.getAgenciaId().setPessoa((String) cmbPessoa.getSelectedItem().getValue());
@ -1361,10 +1364,7 @@ public class EditarPuntoVentaController extends MyGenericForwardComposer {
}
}
if (!validaCadastroFechamentoContaCorrente(lsEmpresas)) {
Messagebox.show(
Labels.getLabel("editarPuntoVentaController.ParamPtoVtaObrigatorio"),
Labels.getLabel("editarPuntoVentaController.window.title"),
Messagebox.OK, Messagebox.EXCLAMATION);
exibeMsgErroFechCtaCorrente();
return;
}
puntoVenta.setLsPtovtaUsuarioBancario(lsPto2);
@ -1381,18 +1381,13 @@ public class EditarPuntoVentaController extends MyGenericForwardComposer {
}
if (puntoVenta.getPuntoventaId() == null) {
puntoVentaService.suscribir(puntoVenta);
puntoVenta = puntoVentaService.suscribir(puntoVenta);
puntoVentaList.addItemNovo(puntoVenta);
for (Object object : fechamentoParamptovtaList.getListData()) {
FechamentoParamptovta fechamentoParamptovta = (FechamentoParamptovta) object;
fechamentoParamptovta.setPuntoventa(puntoVenta);
fechamentoParamptovtaService.suscribir(fechamentoParamptovta);
}
} else {
puntoVentaService.actualizacion(puntoVenta);
puntoVentaList.updateItem(puntoVenta);
}
gravaFechamentoCtaCorrente();
Messagebox.show(
Labels.getLabel("editarPuntoVentaController.MSG.suscribirOK"),
Labels.getLabel("editarPuntoVentaController.window.title"),
@ -1410,6 +1405,7 @@ public class EditarPuntoVentaController extends MyGenericForwardComposer {
Messagebox.OK, Messagebox.ERROR);
} catch (IntegracionException ex) {
gravaFechamentoCtaCorrente();
log.error("editarPuntoVentaController: ", ex);
Messagebox.show(
ex.getMessage(),
@ -1425,6 +1421,26 @@ public class EditarPuntoVentaController extends MyGenericForwardComposer {
}
}
private void gravaFechamentoCtaCorrente() {
List<FechamentoParamptovta> params = fechamentoParamptovtaService.buscaParametrosPorPuntoventa(puntoVenta);
for (int i = 0; i < params.size(); i++) {
FechamentoParamptovta fechamentoParamptovta = (FechamentoParamptovta) params.get(i);
fechamentoParamptovtaService.borrar(fechamentoParamptovta);
}
for (Object object : fechamentoParamptovtaList.getListData()) {
FechamentoParamptovta fechamentoParamptovta = (FechamentoParamptovta) object;
fechamentoParamptovta.setPuntoventa(puntoVenta);
fechamentoParamptovtaService.suscribir(fechamentoParamptovta);
}
}
private void exibeMsgErroFechCtaCorrente() throws InterruptedException {
Messagebox.show(
Labels.getLabel("editarPuntoVentaController.ParamPtoVtaObrigatorio"),
Labels.getLabel("editarPuntoVentaController.window.title"),
Messagebox.OK, Messagebox.EXCLAMATION);
}
private boolean validaCadastroFechamentoContaCorrente(List<Empresa> empresas) {
List<Object> list = Arrays.asList(fechamentoParamptovtaList.getData());
try {
@ -2631,13 +2647,7 @@ public class EditarPuntoVentaController extends MyGenericForwardComposer {
if (resp == Messagebox.YES) {
FechamentoParamptovta fpp = (FechamentoParamptovta) fechamentoParamptovtaList.getSelected();
if (puntoVenta != null && puntoVenta.getPuntoventaId() != null) {
fechamentoParamptovtaService.borrar(fpp);
List<FechamentoParamptovta> params = fechamentoParamptovtaService.buscaParametrosPorPuntoventa(puntoVenta);
fechamentoParamptovtaList.setData(params);
} else {
fechamentoParamptovtaList.removeItem(fpp);
}
fechamentoParamptovtaList.removeItem(fpp);
}
}
} catch (Exception ex) {
@ -2689,13 +2699,7 @@ public class EditarPuntoVentaController extends MyGenericForwardComposer {
boolean validado = validaFechamentoParamptovta(fechamentoParamptovta);
if (validado) {
if (puntoVenta != null && puntoVenta.getPuntoventaId() != null) {
fechamentoParamptovtaService.suscribir(fechamentoParamptovta);
List<FechamentoParamptovta> params = fechamentoParamptovtaService.buscaParametrosPorPuntoventa(puntoVenta);
fechamentoParamptovtaList.setData(params);
} else {
fechamentoParamptovtaList.addItemNovo(fechamentoParamptovta);
}
fechamentoParamptovtaList.addItemNovo(fechamentoParamptovta);
resetDadosFechamentoParamptovta();
} else {