bug #8997
git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Model/trunk/modelWeb@69829 d1611594-4594-4d17-8e1d-87c2c4800839master
parent
eb32b0ba65
commit
64b8ce1d1d
|
@ -18,9 +18,9 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||
import org.springframework.jdbc.datasource.DataSourceUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
//import org.tempuri.IAG;
|
||||
//import org.tempuri.IAGservice;
|
||||
//import org.tempuri.IAGserviceLocator;
|
||||
import org.tempuri.IAG;
|
||||
import org.tempuri.IAGservice;
|
||||
import org.tempuri.IAGserviceLocator;
|
||||
|
||||
import com.rjconsultores.ventaboletos.dao.PuntoVentaDAO;
|
||||
import com.rjconsultores.ventaboletos.dao.UsuarioUbicacionDAO;
|
||||
|
@ -52,12 +52,12 @@ import com.rjconsultores.ws.utileria.Atributos.TipoFornecedor;
|
|||
import com.rjconsultores.ws.utileria.Atributos.TipoPessoa;
|
||||
import com.rjconsultores.ws.utileria.RetornoTotvs;
|
||||
import com.rjconsultores.ws.utileria.RetornoTotvs.TipoRetorno;
|
||||
//import com.rjconsultores.wsag.Constantes;
|
||||
//import com.rjconsultores.wsag.dao.DaoAG;
|
||||
//
|
||||
//import AGIntf.TCliente;
|
||||
//import AGIntf.TFornecedor;
|
||||
//import AGIntf.TServicosCliente;
|
||||
import com.rjconsultores.wsag.Constantes;
|
||||
import com.rjconsultores.wsag.dao.DaoAG;
|
||||
|
||||
import AGIntf.TCliente;
|
||||
import AGIntf.TFornecedor;
|
||||
import AGIntf.TServicosCliente;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -194,166 +194,166 @@ public class PuntoVentaServiceImpl implements PuntoVentaService {
|
|||
}
|
||||
|
||||
private void integrarFornecedorAG(PuntoVenta entidad) {
|
||||
// try {
|
||||
// IAGservice service = new IAGserviceLocator();
|
||||
// IAG iag = service.getIAGPort(new URL(DaoAG.getInstance().obterConstante(Constantes.URL_WS_AG)));
|
||||
// TFornecedor fornecedor = null;
|
||||
// String strFornecedor = "";
|
||||
// try{
|
||||
// strFornecedor = iag.getCodigoFornecedorWithIDWS(entidad.getNumPuntoVenta().toString());
|
||||
// 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 (Exception e) {
|
||||
// wslog.error(e.getMessage(), e);
|
||||
// }
|
||||
try {
|
||||
IAGservice service = new IAGserviceLocator();
|
||||
IAG iag = service.getIAGPort(new URL(DaoAG.getInstance().obterConstante(Constantes.URL_WS_AG)));
|
||||
TFornecedor fornecedor = null;
|
||||
String strFornecedor = "";
|
||||
try{
|
||||
strFornecedor = iag.getCodigoFornecedorWithIDWS(entidad.getNumPuntoVenta().toString());
|
||||
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 (Exception e) {
|
||||
wslog.error(e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
private void integrarClienteAG(PuntoVenta entidad) {
|
||||
//
|
||||
// try {
|
||||
//
|
||||
// IAGservice service = new IAGserviceLocator();
|
||||
// IAG iag = service.getIAGPort(new URL(DaoAG.getInstance().obterConstante(Constantes.URL_WS_AG)));
|
||||
// TCliente cli = null;
|
||||
// String cliStr = "";
|
||||
// try {
|
||||
// cliStr = iag.getClienteWithIDWS(entidad.getNumPuntoVenta().toString());
|
||||
// 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 (Exception e) {
|
||||
// wslog.error(e.getMessage(), e);
|
||||
// }
|
||||
|
||||
try {
|
||||
|
||||
IAGservice service = new IAGserviceLocator();
|
||||
IAG iag = service.getIAGPort(new URL(DaoAG.getInstance().obterConstante(Constantes.URL_WS_AG)));
|
||||
TCliente cli = null;
|
||||
String cliStr = "";
|
||||
try {
|
||||
cliStr = iag.getClienteWithIDWS(entidad.getNumPuntoVenta().toString());
|
||||
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 (Exception e) {
|
||||
wslog.error(e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
private Connection getConnection() {
|
||||
|
|
Loading…
Reference in New Issue