fixes bug#al-1726

dev: Celio
qua:

git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Model/trunk/modelWeb@115202 d1611594-4594-4d17-8e1d-87c2c4800839
master
fabio 2022-11-07 15:05:28 +00:00
parent 478749e967
commit c529ac8732
2 changed files with 11 additions and 7 deletions

View File

@ -10,7 +10,7 @@ import com.rjconsultores.ventaboletos.vo.integracao.FechamentoCntCorrenteVO;
public interface SapService extends GenericService<FechamentoCntcorrente, Long> { public interface SapService extends GenericService<FechamentoCntcorrente, Long> {
public int remessa(List<FechamentoCntCorrenteVO> fechamentos) throws Exception ; public int remessa(List<FechamentoCntCorrenteVO> fechamentos, boolean processoManual) throws Exception ;
public List<FechamentoCntCorrenteVO> obtenerTodosParaRemessa(Empresa empresa, Date dataDe, Date dataAte, String status); public List<FechamentoCntCorrenteVO> obtenerTodosParaRemessa(Empresa empresa, Date dataDe, Date dataAte, String status);

View File

@ -74,7 +74,7 @@ public class SapServiceImpl implements SapService{
} }
@Override @Override
public int remessa(List<FechamentoCntCorrenteVO> fechamentos) throws Exception { public int remessa(List<FechamentoCntCorrenteVO> fechamentos, boolean processoManual) throws Exception {
try { try {
int contador = 0; int contador = 0;
IntegracaoSapRest integracaoSapRest = IntegracaoSapRest.getInstance(); IntegracaoSapRest integracaoSapRest = IntegracaoSapRest.getInstance();
@ -88,17 +88,21 @@ public class SapServiceImpl implements SapService{
if(integrado == null) { if(integrado == null) {
atualizaFechamento(fechamentoCntcorrente.getFechamentocntcorrenteId(), StatusIntegracaoSap.NAO_ENVIADO.ordinal()); atualizaFechamento(fechamentoCntcorrente.getFechamentocntcorrenteId(), StatusIntegracaoSap.NAO_ENVIADO.ordinal());
log.error("Erro no envio/retorno da requisicao para integracao SAP do fechamentoID: "+fechamentoCntcorrente.getFechamentocntcorrenteId()); log.error("Erro no envio/retorno da requisicao para integracao SAP do fechamentoID: "+fechamentoCntcorrente.getFechamentocntcorrenteId());
if(processoManual) {
throw new RuntimeException("Erro no envio/retorno da requisicao para integracao SAP do fechamentoID: "+fechamentoCntcorrente.getFechamentocntcorrenteId()); throw new RuntimeException("Erro no envio/retorno da requisicao para integracao SAP do fechamentoID: "+fechamentoCntcorrente.getFechamentocntcorrenteId());
}
}else if(integrado.getString("Integration").equals("S")) { }else if(integrado.getString("Integration").equals("S")) {
atualizaFechamento(fechamentoCntcorrente.getFechamentocntcorrenteId(), StatusIntegracaoSap.INTEGRADO.ordinal()); atualizaFechamento(fechamentoCntcorrente.getFechamentocntcorrenteId(), StatusIntegracaoSap.INTEGRADO.ordinal());
contador++; contador++;
}else if(integrado.getString("Integration").equals("E")) { }else if(integrado.getString("Integration").equals("E")) {
atualizaFechamento(fechamentoCntcorrente.getFechamentocntcorrenteId(), StatusIntegracaoSap.RECUSADO.ordinal()); atualizaFechamento(fechamentoCntcorrente.getFechamentocntcorrenteId(), StatusIntegracaoSap.RECUSADO.ordinal());
log.warn("Retorno enviado pelo SAP: \r\n"+integrado.getString("Message")); log.warn("Retorno enviado pelo SAP: \r\n"+integrado.getString("Message"));
if(processoManual) {
throw new RuntimeException("Fechamento: "+fechamentoCntcorrente.getFechamentocntcorrenteId()+"\r\nRetorno enviado pelo SAP: \r\n"+integrado.getString("Message")); throw new RuntimeException("Fechamento: "+fechamentoCntcorrente.getFechamentocntcorrenteId()+"\r\nRetorno enviado pelo SAP: \r\n"+integrado.getString("Message"));
} }
} }
} }
}
return contador; return contador;
}catch(RuntimeException re){ }catch(RuntimeException re){
@ -130,7 +134,7 @@ public class SapServiceImpl implements SapService{
log.info("IntegracaoSap: Registro a enviar:"+listaPendente.size()); log.info("IntegracaoSap: Registro a enviar:"+listaPendente.size());
try { try {
remessa(listaPendente); remessa(listaPendente, false);
} catch (Exception e) { } catch (Exception e) {
throw e; throw e;
} }