fixes bug #8607
git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Model/trunk/modelWeb@65456 d1611594-4594-4d17-8e1d-87c2c4800839master
parent
d1ed528cd4
commit
35b7d2efaa
|
@ -151,191 +151,188 @@ public class PuntoVentaServiceImpl implements PuntoVentaService {
|
||||||
}
|
}
|
||||||
entidad = puntoVentaDAO.suscribir(entidad);
|
entidad = puntoVentaDAO.suscribir(entidad);
|
||||||
|
|
||||||
log.debug("iniciando integração com AG");
|
if (ApplicationProperties.getInstance().integracionAGWS()) {
|
||||||
integrarClienteAG(entidad);
|
log.debug("iniciando integração com AG");
|
||||||
if (!entidad.getIndIntegradoAG()){
|
integrarClienteAG(entidad);
|
||||||
throw new IntegracionException(entidad.getMotivoNaoIntegradoAG());
|
if (!entidad.getIndIntegradoAG()){
|
||||||
|
throw new IntegracionException(entidad.getMotivoNaoIntegradoAG());
|
||||||
|
}
|
||||||
|
integrarFornecedorAG(entidad);
|
||||||
|
if (!entidad.getIndIntegradoAG()){
|
||||||
|
throw new IntegracionException(entidad.getMotivoNaoIntegradoAG());
|
||||||
|
}
|
||||||
|
log.debug("fim da integração com AG");
|
||||||
}
|
}
|
||||||
integrarFornecedorAG(entidad);
|
|
||||||
log.debug("fim da integração com AG");
|
|
||||||
if (!entidad.getIndIntegradoAG()){
|
|
||||||
throw new IntegracionException(entidad.getMotivoNaoIntegradoAG());
|
|
||||||
}
|
|
||||||
|
|
||||||
return entidad;
|
return entidad;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void integrarFornecedorAG(PuntoVenta entidad) {
|
private void integrarFornecedorAG(PuntoVenta entidad) {
|
||||||
if (ApplicationProperties.getInstance().integracionAGWS()) {
|
try{
|
||||||
|
IAGservice service = new IAGserviceLocator();
|
||||||
|
DaoAG.getInstance().setDBConnection(dataSource.getConnection());
|
||||||
|
IAG iag = service.getIAGPort(new URL(DaoAG.getInstance().obterConstante(Constantes.URL_WS_AG)));
|
||||||
|
TFornecedor fornecedor = null;
|
||||||
|
String strFornecedor = "";
|
||||||
try{
|
try{
|
||||||
IAGservice service = new IAGserviceLocator();
|
strFornecedor = iag.getCodigoFornecedorWithIDWS(entidad.getNumPuntoVenta().toString());
|
||||||
DaoAG.getInstance().setDBConnection(dataSource.getConnection());
|
wslog.debug("Retorno consulta fornecedor ws: " + strFornecedor);
|
||||||
IAG iag = service.getIAGPort(new URL(DaoAG.getInstance().obterConstante(Constantes.URL_WS_AG)));
|
} catch (RemoteException e) {
|
||||||
TFornecedor fornecedor = null;
|
wslog.error(e.toString());
|
||||||
String strFornecedor = "";
|
entidad.setIndIntegradoAG(false);
|
||||||
try{
|
entidad.setMotivoNaoIntegradoAG("Erro ao conectar com o WS: " + e.toString());
|
||||||
strFornecedor = iag.getCodigoFornecedorWithIDWS(entidad.getNumPuntoVenta().toString());
|
return;
|
||||||
wslog.debug("Retorno consulta fornecedor ws: " + strFornecedor);
|
|
||||||
} catch (RemoteException e) {
|
|
||||||
wslog.error(e.toString());
|
|
||||||
entidad.setIndIntegradoAG(false);
|
|
||||||
entidad.setMotivoNaoIntegradoAG("Erro ao conectar com o WS: " + e.toString());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (!strFornecedor.contains("ERRO")){
|
|
||||||
// retornar msg a informação de registro já cadastrado
|
|
||||||
entidad.setIndIntegradoAG(false);
|
|
||||||
entidad.setMotivoNaoIntegradoAG("Fornecedor já cadastrado");
|
|
||||||
} else {
|
|
||||||
fornecedor = new TFornecedor();
|
|
||||||
fornecedor.setNome(entidad.getRazonSocial());
|
|
||||||
fornecedor.setNomeFantasia(entidad.getNombpuntoventa());
|
|
||||||
fornecedor.setCNPJCPF(entidad.getNumDoCPuntoVenta());
|
|
||||||
fornecedor.setGrupo("");
|
|
||||||
fornecedor.setReceita("");
|
|
||||||
fornecedor.setCodigo("");
|
|
||||||
fornecedor.setCEP(entidad.getCep());
|
|
||||||
fornecedor.setLogradouro(""+entidad.getLogradouro());
|
|
||||||
fornecedor.setBairro(entidad.getBairro());
|
|
||||||
fornecedor.setNumero(""+entidad.getNumero());
|
|
||||||
fornecedor.setComplemento(""+entidad.getComplemento());
|
|
||||||
fornecedor.setUF(entidad.getUF());
|
|
||||||
fornecedor.setCidade(entidad.getCidade());
|
|
||||||
fornecedor.setDDD("");
|
|
||||||
fornecedor.setFone("");
|
|
||||||
fornecedor.setFax("");
|
|
||||||
fornecedor.setEmail("");
|
|
||||||
fornecedor.setContato("");
|
|
||||||
fornecedor.setSite("");
|
|
||||||
fornecedor.setRG("");
|
|
||||||
fornecedor.setIE("");
|
|
||||||
fornecedor.setIM("");
|
|
||||||
fornecedor.setReferencia("");
|
|
||||||
fornecedor.setFinalidadeTED("");
|
|
||||||
fornecedor.setFinalidadeDOC("");
|
|
||||||
fornecedor.setCelular("");
|
|
||||||
fornecedor.setLeiaute("");
|
|
||||||
fornecedor.setBanco("");
|
|
||||||
fornecedor.setBancoNumero("");
|
|
||||||
fornecedor.setAgencia("");
|
|
||||||
fornecedor.setCC("");
|
|
||||||
fornecedor.setDVAg("");
|
|
||||||
fornecedor.setDVCC("");
|
|
||||||
fornecedor.setIDWS(entidad.getNumPuntoVenta());
|
|
||||||
try{
|
|
||||||
String retornoAG = iag.incluiFornecedor(fornecedor);
|
|
||||||
entidad.setIndIntegradoAG(true);
|
|
||||||
wslog.debug(retornoAG);
|
|
||||||
} catch (RemoteException e) {
|
|
||||||
entidad.setIndIntegradoAG(false);
|
|
||||||
entidad.setMotivoNaoIntegradoAG(e.getMessage());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (ServiceException se){
|
|
||||||
wslog.error(se.toString());
|
|
||||||
} catch (MalformedURLException me){
|
|
||||||
wslog.error(me.toString());
|
|
||||||
} catch (SQLException me){
|
|
||||||
wslog.error(me.toString());
|
|
||||||
}
|
}
|
||||||
|
if (!strFornecedor.contains("ERRO")){
|
||||||
|
// retornar msg a informação de registro já cadastrado
|
||||||
|
entidad.setIndIntegradoAG(false);
|
||||||
|
entidad.setMotivoNaoIntegradoAG("Fornecedor já cadastrado");
|
||||||
|
} else {
|
||||||
|
fornecedor = new TFornecedor();
|
||||||
|
fornecedor.setNome(entidad.getRazonSocial());
|
||||||
|
fornecedor.setNomeFantasia(entidad.getNombpuntoventa());
|
||||||
|
fornecedor.setCNPJCPF(entidad.getNumDoCPuntoVenta());
|
||||||
|
fornecedor.setGrupo("");
|
||||||
|
fornecedor.setReceita("");
|
||||||
|
fornecedor.setCodigo("");
|
||||||
|
fornecedor.setCEP(entidad.getCep());
|
||||||
|
fornecedor.setLogradouro(""+entidad.getLogradouro());
|
||||||
|
fornecedor.setBairro(entidad.getBairro());
|
||||||
|
fornecedor.setNumero(""+entidad.getNumero());
|
||||||
|
fornecedor.setComplemento(""+entidad.getComplemento());
|
||||||
|
fornecedor.setUF(entidad.getUF());
|
||||||
|
fornecedor.setCidade(entidad.getCidade());
|
||||||
|
fornecedor.setDDD("");
|
||||||
|
fornecedor.setFone("");
|
||||||
|
fornecedor.setFax("");
|
||||||
|
fornecedor.setEmail("");
|
||||||
|
fornecedor.setContato("");
|
||||||
|
fornecedor.setSite("");
|
||||||
|
fornecedor.setRG("");
|
||||||
|
fornecedor.setIE("");
|
||||||
|
fornecedor.setIM("");
|
||||||
|
fornecedor.setReferencia("");
|
||||||
|
fornecedor.setFinalidadeTED("");
|
||||||
|
fornecedor.setFinalidadeDOC("");
|
||||||
|
fornecedor.setCelular("");
|
||||||
|
fornecedor.setLeiaute("");
|
||||||
|
fornecedor.setBanco("");
|
||||||
|
fornecedor.setBancoNumero("");
|
||||||
|
fornecedor.setAgencia("");
|
||||||
|
fornecedor.setCC("");
|
||||||
|
fornecedor.setDVAg("");
|
||||||
|
fornecedor.setDVCC("");
|
||||||
|
fornecedor.setIDWS(entidad.getNumPuntoVenta());
|
||||||
|
try{
|
||||||
|
String retornoAG = iag.incluiFornecedor(fornecedor);
|
||||||
|
entidad.setIndIntegradoAG(true);
|
||||||
|
wslog.debug(retornoAG);
|
||||||
|
} catch (RemoteException e) {
|
||||||
|
entidad.setIndIntegradoAG(false);
|
||||||
|
entidad.setMotivoNaoIntegradoAG(e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (ServiceException se){
|
||||||
|
wslog.error(se.toString());
|
||||||
|
} catch (MalformedURLException me){
|
||||||
|
wslog.error(me.toString());
|
||||||
|
} catch (SQLException me){
|
||||||
|
wslog.error(me.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void integrarClienteAG(PuntoVenta entidad) {
|
private void integrarClienteAG(PuntoVenta entidad) {
|
||||||
if (ApplicationProperties.getInstance().integracionAGWS()) {
|
try{
|
||||||
|
IAGservice service = new IAGserviceLocator();
|
||||||
|
DaoAG.getInstance().setDBConnection(dataSource.getConnection());
|
||||||
|
IAG iag = service.getIAGPort(new URL(DaoAG.getInstance().obterConstante(Constantes.URL_WS_AG)));
|
||||||
|
TCliente cli = null;
|
||||||
|
String cliStr = "";
|
||||||
try{
|
try{
|
||||||
IAGservice service = new IAGserviceLocator();
|
cliStr = iag.getClienteWithIDWS(entidad.getNumPuntoVenta().toString());
|
||||||
DaoAG.getInstance().setDBConnection(dataSource.getConnection());
|
wslog.debug("Retorno consulta cliente ws: " + cliStr);
|
||||||
IAG iag = service.getIAGPort(new URL(DaoAG.getInstance().obterConstante(Constantes.URL_WS_AG)));
|
} catch (RemoteException e) {
|
||||||
TCliente cli = null;
|
wslog.error(e.toString());
|
||||||
String cliStr = "";
|
entidad.setIndIntegradoAG(false);
|
||||||
try{
|
entidad.setMotivoNaoIntegradoAG("Erro ao conectar com o WS: " + e.toString());
|
||||||
cliStr = iag.getClienteWithIDWS(entidad.getNumPuntoVenta().toString());
|
return;
|
||||||
wslog.debug("Retorno consulta cliente ws: " + cliStr);
|
|
||||||
} catch (RemoteException e) {
|
|
||||||
wslog.error(e.toString());
|
|
||||||
entidad.setIndIntegradoAG(false);
|
|
||||||
entidad.setMotivoNaoIntegradoAG("Erro ao conectar com o WS: " + e.toString());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (!cliStr.contains("ERRO")){
|
|
||||||
// retornar msg a informação de registro já cadastrado
|
|
||||||
entidad.setIndIntegradoAG(false);
|
|
||||||
entidad.setMotivoNaoIntegradoAG("Cliente já cadastrado");
|
|
||||||
} else {
|
|
||||||
cli = new TCliente();
|
|
||||||
cli.setCodigo("");
|
|
||||||
cli.setNome(entidad.getRazonSocial());
|
|
||||||
cli.setNomeFantasia(entidad.getNombpuntoventa());
|
|
||||||
cli.setCnpjcpf(entidad.getNumDoCPuntoVenta());
|
|
||||||
cli.setGrupo("");
|
|
||||||
cli.setAgenteCobrador("");
|
|
||||||
cli.setVencimento(0);
|
|
||||||
cli.setContaContabil("");
|
|
||||||
cli.setCep(entidad.getCep());
|
|
||||||
cli.setLogradouro(""+entidad.getLogradouro());
|
|
||||||
cli.setBairro(entidad.getBairro());
|
|
||||||
cli.setNumero(""+entidad.getNumero());
|
|
||||||
cli.setComplemento(""+entidad.getComplemento());
|
|
||||||
cli.setUf(entidad.getUF());
|
|
||||||
cli.setCidade(entidad.getCidade());
|
|
||||||
cli.setDdd("");
|
|
||||||
cli.setFone("");
|
|
||||||
cli.setDddFax("");
|
|
||||||
cli.setFax("");
|
|
||||||
cli.setIdentificador("");
|
|
||||||
cli.setDddCelular("");
|
|
||||||
cli.setCelular("");
|
|
||||||
cli.setEmail("");
|
|
||||||
cli.setContato("");
|
|
||||||
cli.setSite("");
|
|
||||||
cli.setRg("");
|
|
||||||
cli.setIe("");
|
|
||||||
cli.setReceita("");
|
|
||||||
cli.setRepresentante("");
|
|
||||||
cli.setIM("");
|
|
||||||
cli.setCampoExtra1("");
|
|
||||||
cli.setCampoExtra10("");
|
|
||||||
cli.setCampoExtra2("");
|
|
||||||
cli.setCampoExtra3("");
|
|
||||||
cli.setCampoExtra4("");
|
|
||||||
cli.setCampoExtra5("");
|
|
||||||
cli.setCampoExtra6("");
|
|
||||||
cli.setCampoExtra7("");
|
|
||||||
cli.setCampoExtra8("");
|
|
||||||
cli.setCampoExtra9("");
|
|
||||||
cli.setServicosCliente(new TServicosCliente());
|
|
||||||
cli.setIDWS(entidad.getNumPuntoVenta());
|
|
||||||
cli.getServicosCliente().setServico("");
|
|
||||||
cli.getServicosCliente().setEstabelecimento("");
|
|
||||||
cli.getServicosCliente().setModalidade("");
|
|
||||||
cli.getServicosCliente().setIndexador("");
|
|
||||||
cli.getServicosCliente().setAnoMesPrimeiraCobranca("");
|
|
||||||
cli.getServicosCliente().setAquisicao(Calendar.getInstance());
|
|
||||||
cli.getServicosCliente().setAnoMesReajuste("");
|
|
||||||
cli.getServicosCliente().setObservacao("");
|
|
||||||
cli.getServicosCliente().setDescricaoNota("");
|
|
||||||
cli.getServicosCliente().setComplementoDescricaoNota("");
|
|
||||||
cli.getServicosCliente().setContrato("");
|
|
||||||
cli.getServicosCliente().setDtCancelamento(Calendar.getInstance());
|
|
||||||
cli.getServicosCliente().setObsCancelamento("");
|
|
||||||
cli.getServicosCliente().setCRS_Codigo("");
|
|
||||||
try{
|
|
||||||
String retornoAG = iag.incluiCliente(cli);
|
|
||||||
entidad.setIndIntegradoAG(true);
|
|
||||||
wslog.debug(retornoAG);
|
|
||||||
} catch (RemoteException e) {
|
|
||||||
entidad.setIndIntegradoAG(false);
|
|
||||||
entidad.setMotivoNaoIntegradoAG(e.getMessage());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (ServiceException se){
|
|
||||||
wslog.error(se.toString());
|
|
||||||
} catch (MalformedURLException me){
|
|
||||||
wslog.error(me.toString());
|
|
||||||
} catch (SQLException me){
|
|
||||||
wslog.error(me.toString());
|
|
||||||
}
|
}
|
||||||
|
if (!cliStr.contains("ERRO")){
|
||||||
|
// retornar msg a informação de registro já cadastrado
|
||||||
|
entidad.setIndIntegradoAG(false);
|
||||||
|
entidad.setMotivoNaoIntegradoAG("Cliente já cadastrado");
|
||||||
|
} else {
|
||||||
|
cli = new TCliente();
|
||||||
|
cli.setCodigo("");
|
||||||
|
cli.setNome(entidad.getRazonSocial());
|
||||||
|
cli.setNomeFantasia(entidad.getNombpuntoventa());
|
||||||
|
cli.setCnpjcpf(entidad.getNumDoCPuntoVenta());
|
||||||
|
cli.setGrupo("");
|
||||||
|
cli.setAgenteCobrador("");
|
||||||
|
cli.setVencimento(0);
|
||||||
|
cli.setContaContabil("");
|
||||||
|
cli.setCep(entidad.getCep());
|
||||||
|
cli.setLogradouro(""+entidad.getLogradouro());
|
||||||
|
cli.setBairro(entidad.getBairro());
|
||||||
|
cli.setNumero(""+entidad.getNumero());
|
||||||
|
cli.setComplemento(""+entidad.getComplemento());
|
||||||
|
cli.setUf(entidad.getUF());
|
||||||
|
cli.setCidade(entidad.getCidade());
|
||||||
|
cli.setDdd("");
|
||||||
|
cli.setFone("");
|
||||||
|
cli.setDddFax("");
|
||||||
|
cli.setFax("");
|
||||||
|
cli.setIdentificador("");
|
||||||
|
cli.setDddCelular("");
|
||||||
|
cli.setCelular("");
|
||||||
|
cli.setEmail("");
|
||||||
|
cli.setContato("");
|
||||||
|
cli.setSite("");
|
||||||
|
cli.setRg("");
|
||||||
|
cli.setIe("");
|
||||||
|
cli.setReceita("");
|
||||||
|
cli.setRepresentante("");
|
||||||
|
cli.setIM("");
|
||||||
|
cli.setCampoExtra1("");
|
||||||
|
cli.setCampoExtra10("");
|
||||||
|
cli.setCampoExtra2("");
|
||||||
|
cli.setCampoExtra3("");
|
||||||
|
cli.setCampoExtra4("");
|
||||||
|
cli.setCampoExtra5("");
|
||||||
|
cli.setCampoExtra6("");
|
||||||
|
cli.setCampoExtra7("");
|
||||||
|
cli.setCampoExtra8("");
|
||||||
|
cli.setCampoExtra9("");
|
||||||
|
cli.setServicosCliente(new TServicosCliente());
|
||||||
|
cli.setIDWS(entidad.getNumPuntoVenta());
|
||||||
|
cli.getServicosCliente().setServico("");
|
||||||
|
cli.getServicosCliente().setEstabelecimento("");
|
||||||
|
cli.getServicosCliente().setModalidade("");
|
||||||
|
cli.getServicosCliente().setIndexador("");
|
||||||
|
cli.getServicosCliente().setAnoMesPrimeiraCobranca("");
|
||||||
|
cli.getServicosCliente().setAquisicao(Calendar.getInstance());
|
||||||
|
cli.getServicosCliente().setAnoMesReajuste("");
|
||||||
|
cli.getServicosCliente().setObservacao("");
|
||||||
|
cli.getServicosCliente().setDescricaoNota("");
|
||||||
|
cli.getServicosCliente().setComplementoDescricaoNota("");
|
||||||
|
cli.getServicosCliente().setContrato("");
|
||||||
|
cli.getServicosCliente().setDtCancelamento(Calendar.getInstance());
|
||||||
|
cli.getServicosCliente().setObsCancelamento("");
|
||||||
|
cli.getServicosCliente().setCRS_Codigo("");
|
||||||
|
try{
|
||||||
|
String retornoAG = iag.incluiCliente(cli);
|
||||||
|
entidad.setIndIntegradoAG(true);
|
||||||
|
wslog.debug(retornoAG);
|
||||||
|
} catch (RemoteException e) {
|
||||||
|
entidad.setIndIntegradoAG(false);
|
||||||
|
entidad.setMotivoNaoIntegradoAG(e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (ServiceException se){
|
||||||
|
wslog.error(se.toString());
|
||||||
|
} catch (MalformedURLException me){
|
||||||
|
wslog.error(me.toString());
|
||||||
|
} catch (SQLException me){
|
||||||
|
wslog.error(me.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -392,16 +389,18 @@ public class PuntoVentaServiceImpl implements PuntoVentaService {
|
||||||
}
|
}
|
||||||
entidad = puntoVentaDAO.actualizacion(entidad);
|
entidad = puntoVentaDAO.actualizacion(entidad);
|
||||||
|
|
||||||
log.debug("iniciando integração com AG");
|
if (ApplicationProperties.getInstance().integracionAGWS()) {
|
||||||
integrarClienteAG(entidad);
|
log.debug("iniciando integração com AG");
|
||||||
if (!entidad.getIndIntegradoAG()){
|
integrarClienteAG(entidad);
|
||||||
throw new IntegracionException(entidad.getMotivoNaoIntegradoAG());
|
if (!entidad.getIndIntegradoAG()){
|
||||||
|
throw new IntegracionException(entidad.getMotivoNaoIntegradoAG());
|
||||||
|
}
|
||||||
|
integrarFornecedorAG(entidad);
|
||||||
|
if (!entidad.getIndIntegradoAG()){
|
||||||
|
throw new IntegracionException(entidad.getMotivoNaoIntegradoAG());
|
||||||
|
}
|
||||||
|
log.debug("fim da integração com AG");
|
||||||
}
|
}
|
||||||
integrarFornecedorAG(entidad);
|
|
||||||
if (!entidad.getIndIntegradoAG()){
|
|
||||||
throw new IntegracionException(entidad.getMotivoNaoIntegradoAG());
|
|
||||||
}
|
|
||||||
log.debug("fim da integração com AG");
|
|
||||||
|
|
||||||
if (respEx != null) {
|
if (respEx != null) {
|
||||||
if (respEx instanceof IntegracionException) {
|
if (respEx instanceof IntegracionException) {
|
||||||
|
|
Loading…
Reference in New Issue