Totvs - WS Fornecedor / WS Cliente / WS Pedido Compra (bug #6127)

git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Model/trunk/modelWeb@42707 d1611594-4594-4d17-8e1d-87c2c4800839
master
julio 2015-04-01 21:45:05 +00:00
parent 14bebcc175
commit a903a30c2e
2 changed files with 1213 additions and 30 deletions

View File

@ -30,6 +30,7 @@ import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
import com.rjconsultores.ws.totvs.service.TotvsService; import com.rjconsultores.ws.totvs.service.TotvsService;
import com.rjconsultores.ws.utileria.Atributos.CodPaisBanco; import com.rjconsultores.ws.utileria.Atributos.CodPaisBanco;
import com.rjconsultores.ws.utileria.Atributos.ContribuinteICMS; import com.rjconsultores.ws.utileria.Atributos.ContribuinteICMS;
import com.rjconsultores.ws.utileria.Atributos.ContribuinteSimplesNacional;
import com.rjconsultores.ws.utileria.Atributos.TipoCliente; import com.rjconsultores.ws.utileria.Atributos.TipoCliente;
import com.rjconsultores.ws.utileria.Atributos.TipoEntidade; import com.rjconsultores.ws.utileria.Atributos.TipoEntidade;
import com.rjconsultores.ws.utileria.Atributos.TipoFornecedor; import com.rjconsultores.ws.utileria.Atributos.TipoFornecedor;
@ -164,9 +165,43 @@ public class PuntoVentaServiceImpl implements PuntoVentaService {
return puntosVenta; return puntosVenta;
} }
private boolean validaCanalVenta(Short tipoptovtaId) {
boolean resp = false;
switch (tipoptovtaId) {
// PROPRIAS
case 11:
resp = true;
break;
// FRANQUEADAS
case 12:
resp = true;
break;
// COBRADOR
case 15:
resp = true;
break;
// MOTORISTA
case 14:
resp = true;
break;
default:
break;
}
return resp;
}
private void integracionTotvs(PuntoVenta puntoVenta) throws IntegracionException { private void integracionTotvs(PuntoVenta puntoVenta) throws IntegracionException {
if (ApplicationProperties.getInstance().integracionTotvs()) { if (ApplicationProperties.getInstance().integracionTotvs()) {
boolean clienteValido = validaCanalVenta(puntoVenta.getTipoPuntoVenta().getTipoptovtaId());
boolean fornecedorValido = (puntoVenta.getTipoPuntoVenta().getTipoptovtaId() == 13);
if (fornecedorValido)
clienteValido = true;
String endpointFornecedor = getEndpointFornecedor(); String endpointFornecedor = getEndpointFornecedor();
String endpointCliente = getEndpointCliente(); String endpointCliente = getEndpointCliente();
@ -189,8 +224,6 @@ public class PuntoVentaServiceImpl implements PuntoVentaService {
String cep = puntoVenta.getColonia() == null ? null : puntoVenta.getColonia().getCodpostal(); String cep = puntoVenta.getColonia() == null ? null : puntoVenta.getColonia().getCodpostal();
String pais = puntoVenta.getColonia() == null ? null : puntoVenta.getColonia().getCiudad().getEstado().getPais().getNombpais();
String tel = puntoVenta.getNumtelefonouno(); String tel = puntoVenta.getNumtelefonouno();
String ddd = null; String ddd = null;
try { try {
@ -207,6 +240,8 @@ public class PuntoVentaServiceImpl implements PuntoVentaService {
String nreduz = puntoVenta.getRazonSocial() != null ? puntoVenta.getRazonSocial() : puntoVenta.getNombpuntoventa(); String nreduz = puntoVenta.getRazonSocial() != null ? puntoVenta.getRazonSocial() : puntoVenta.getNombpuntoventa();
String simpnac = ContribuinteSimplesNacional.NAO.getValor();
String tppessoa = TipoFornecedor.OS.name(); String tppessoa = TipoFornecedor.OS.name();
String tppessoaCliente = TipoCliente.F.name(); String tppessoaCliente = TipoCliente.F.name();
@ -225,10 +260,6 @@ public class PuntoVentaServiceImpl implements PuntoVentaService {
String inscrm = "ISENTO"; // DEVE SER REVISADO COM A GUANABARA String inscrm = "ISENTO"; // DEVE SER REVISADO COM A GUANABARA
String naturez = ""; String naturez = "";
// 1 = SIM
// 2 = Não
String simpnac = "1";// deve ser revisado com a guanabara
String fator = ""; String fator = "";
String agencia = puntoVenta.getAgenciaId() == null ? "" : puntoVenta.getAgenciaId().getNumagencia(); String agencia = puntoVenta.getAgenciaId() == null ? "" : puntoVenta.getAgenciaId().getNumagencia();
@ -247,6 +278,7 @@ public class PuntoVentaServiceImpl implements PuntoVentaService {
Exception respEx = null; Exception respEx = null;
if (clienteValido) {
try { try {
log.info(" ------------- INICIO INTEGRACION FORNECEDOR TOTVS ------------- "); log.info(" ------------- INICIO INTEGRACION FORNECEDOR TOTVS ------------- ");
@ -257,12 +289,18 @@ public class PuntoVentaServiceImpl implements PuntoVentaService {
log.error("", e); log.error("", e);
respEx = e; respEx = e;
} }
}
String contrib = ContribuinteICMS.NAO.getValor();// deve ser revisado com a guanabara String contrib = ContribuinteICMS.NAO.getValor();
String entid = TipoEntidade.TRANSPORTE_PASSAGEIRO.getValor(); String entid = TipoEntidade.TRANSPORTE_PASSAGEIRO.getValor();
String pais = puntoVenta.getColonia() == null ? null : puntoVenta.getColonia().getCiudad().getEstado().getPais().getNombpais();
pais = "";// segundo mateus, passar em branco, segundo orientação do mateus da totvs
if (fornecedorValido) {
try { try {
log.info(" ------------- INICIO INTEGRACION CLIENTE TOTVS ------------- "); log.info(" ------------- INICIO INTEGRACION CLIENTE TOTVS ------------- ");
pais = "";// segundo mateus, passar em branco, segundo orientação do mateus da totvs
TotvsService.cadastrarCliente(endpointCliente, bairro, cep, cgc, codmun, codpais, complemen, conta, contrib, ddd, email, cnpjEmpresaProtheus, TotvsService.cadastrarCliente(endpointCliente, bairro, cep, cgc, codmun, codpais, complemen, conta, contrib, ddd, email, cnpjEmpresaProtheus,
endereco, entid, fator, fax, inscr, inscrm, naturez, nome, nreduz, obs, pais, tppessoaCliente, tel, tipoPessoa, est, xidsvp); endereco, entid, fator, fax, inscr, inscrm, naturez, nome, nreduz, obs, pais, tppessoaCliente, tel, tipoPessoa, est, xidsvp);
} catch (Exception e) { } catch (Exception e) {
@ -273,7 +311,7 @@ public class PuntoVentaServiceImpl implements PuntoVentaService {
if (respEx != null) { if (respEx != null) {
throw new IntegracionException("integracion.totvs"); throw new IntegracionException("integracion.totvs");
} }
}
} }
} }

File diff suppressed because it is too large Load Diff