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-87c2c4800839master
parent
14bebcc175
commit
a903a30c2e
|
@ -30,6 +30,7 @@ import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
|
|||
import com.rjconsultores.ws.totvs.service.TotvsService;
|
||||
import com.rjconsultores.ws.utileria.Atributos.CodPaisBanco;
|
||||
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.TipoEntidade;
|
||||
import com.rjconsultores.ws.utileria.Atributos.TipoFornecedor;
|
||||
|
@ -164,9 +165,43 @@ public class PuntoVentaServiceImpl implements PuntoVentaService {
|
|||
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 {
|
||||
if (ApplicationProperties.getInstance().integracionTotvs()) {
|
||||
|
||||
boolean clienteValido = validaCanalVenta(puntoVenta.getTipoPuntoVenta().getTipoptovtaId());
|
||||
boolean fornecedorValido = (puntoVenta.getTipoPuntoVenta().getTipoptovtaId() == 13);
|
||||
|
||||
if (fornecedorValido)
|
||||
clienteValido = true;
|
||||
|
||||
String endpointFornecedor = getEndpointFornecedor();
|
||||
String endpointCliente = getEndpointCliente();
|
||||
|
||||
|
@ -189,8 +224,6 @@ public class PuntoVentaServiceImpl implements PuntoVentaService {
|
|||
|
||||
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 ddd = null;
|
||||
try {
|
||||
|
@ -207,6 +240,8 @@ public class PuntoVentaServiceImpl implements PuntoVentaService {
|
|||
|
||||
String nreduz = puntoVenta.getRazonSocial() != null ? puntoVenta.getRazonSocial() : puntoVenta.getNombpuntoventa();
|
||||
|
||||
String simpnac = ContribuinteSimplesNacional.NAO.getValor();
|
||||
|
||||
String tppessoa = TipoFornecedor.OS.name();
|
||||
String tppessoaCliente = TipoCliente.F.name();
|
||||
|
||||
|
@ -219,16 +254,12 @@ public class PuntoVentaServiceImpl implements PuntoVentaService {
|
|||
String obs = puntoVenta.getComentarios();
|
||||
obs = StringUtils.isBlank(obs) ? "sem obs." : obs;
|
||||
|
||||
String conta = "1110101001001";// DEVE SER REVISADO COM A GUANABARA
|
||||
String conta = "1110101001001"; // DEVE SER REVISADO COM A GUANABARA
|
||||
String cnae = "";
|
||||
|
||||
String inscrm = "ISENTO";// DEVE SER REVISADO COM A GUANABARA
|
||||
String inscrm = "ISENTO"; // DEVE SER REVISADO COM A GUANABARA
|
||||
String naturez = "";
|
||||
|
||||
// 1 = SIM
|
||||
// 2 = Não
|
||||
String simpnac = "1";// deve ser revisado com a guanabara
|
||||
|
||||
String fator = "";
|
||||
|
||||
String agencia = puntoVenta.getAgenciaId() == null ? "" : puntoVenta.getAgenciaId().getNumagencia();
|
||||
|
@ -247,6 +278,7 @@ public class PuntoVentaServiceImpl implements PuntoVentaService {
|
|||
|
||||
Exception respEx = null;
|
||||
|
||||
if (clienteValido) {
|
||||
try {
|
||||
log.info(" ------------- INICIO INTEGRACION FORNECEDOR TOTVS ------------- ");
|
||||
|
||||
|
@ -257,12 +289,18 @@ public class PuntoVentaServiceImpl implements PuntoVentaService {
|
|||
log.error("", 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 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 {
|
||||
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,
|
||||
endereco, entid, fator, fax, inscr, inscrm, naturez, nome, nreduz, obs, pais, tppessoaCliente, tel, tipoPessoa, est, xidsvp);
|
||||
} catch (Exception e) {
|
||||
|
@ -273,7 +311,7 @@ public class PuntoVentaServiceImpl implements PuntoVentaService {
|
|||
if (respEx != null) {
|
||||
throw new IntegracionException("integracion.totvs");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue