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

git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Model/trunk/modelWeb@42651 d1611594-4594-4d17-8e1d-87c2c4800839
master
julio 2015-03-31 14:03:07 +00:00
parent 15920c98f4
commit 991a260caf
1 changed files with 39 additions and 56 deletions

View File

@ -167,20 +167,20 @@ public class PuntoVentaServiceImpl implements PuntoVentaService {
String endpointCliente = getEndpointCliente();
Integer xidsvp = puntoVenta.getPuntoventaId();
String nomeEmpresa = puntoVenta.getRazonSocial();
String nomeFilial = puntoVenta.getNumDoCPuntoVenta();
String cnpjEmpresaProtheus = "25634551000138";
String nome = puntoVenta.getNombpuntoventa();
String cgc = puntoVenta.getNumDoCPuntoVenta();
String endereco = puntoVenta.getDireccioncalle() + "," + puntoVenta.getDireccionnumero() == null ? "" : puntoVenta.getDireccionnumero();
String complemen = puntoVenta.getCompl() == null ? "" : puntoVenta.getCompl();
String bairro = puntoVenta.getColonia() == null ? null : puntoVenta.getColonia().getDesccolonia();
String codmun = puntoVenta.getColonia() == null ? null : puntoVenta.getColonia().getCiudad().getCodmunicipio().toString();
codmun = (codmun == null) ? "" : StringUtils.leftPad(codmun, 5, '0');
String est = puntoVenta.getColonia() == null ? null : puntoVenta.getColonia().getCiudad().getEstado().getCveestado();
// O código do país no banco central
// brasil - 01058
String codpais = "01058";
@ -201,9 +201,10 @@ public class PuntoVentaServiceImpl implements PuntoVentaService {
String email = puntoVenta.getDescCorreo();
String fax = puntoVenta.getNumfax();
String inscr = puntoVenta.getNumIEPuntoVenta(); // esse campo é validado na totvs. Tem que ser o mesmo do estado enviado
String nreduz = puntoVenta.getNombpuntoventa();
String tipoCliente = TipoCliente.F.name();
String nreduz = puntoVenta.getRazonSocial() != null ? puntoVenta.getRazonSocial() : puntoVenta.getNombpuntoventa();
String tipoCliente = TipoCliente.F.name();
String tipoPessoa = TipoPessoa.F.name();
if (isCNPJ(cgc)) {
@ -216,17 +217,14 @@ public class PuntoVentaServiceImpl implements PuntoVentaService {
String conta = "1110101001001";// DEVE SER REVISADO COM A GUANABARA
String cnae = "";
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 = "";
Exception respEx = null;
try {
@ -239,29 +237,13 @@ public class PuntoVentaServiceImpl implements PuntoVentaService {
respEx = e;
}
/**
* campo CONTRIB - deve ser passado
- 1 = Sim
- 2 - Não
* campo CONTRIB - deve ser passado - 1 = Sim - 2 - Não
*/
String contrib = "2";// deve ser revisado com a guanabara
/**
* No campo ENTID - deve ser passado:
00-PJ Dir.Priv.;
01-Órg.,Autq.;
02-Autopec
03-Emp.Pub./Soc.Eco.Mis.;
04-Trans.Passg.
05-Ser.Pres.Fin.;
06-Demais Serv.
07-Dema is Ent.;
08-Assoc.Profis.;
09-Combustív.;
10-Pgto n .Espec.
* No campo ENTID - deve ser passado: 00-PJ Dir.Priv.; 01-Órg.,Autq.; 02-Autopec 03-Emp.Pub./Soc.Eco.Mis.; 04-Trans.Passg. 05-Ser.Pres.Fin.; 06-Demais Serv. 07-Dema is Ent.; 08-Assoc.Profis.; 09-Combustív.; 10-Pgto n .Espec.
*/
String entid = "04";
try {
@ -296,6 +278,7 @@ public class PuntoVentaServiceImpl implements PuntoVentaService {
}
return constante.getValorconstante();
}
private String somenteNumeros(String s) {
if (s == null || StringUtils.isBlank(s)) {
return "";
@ -305,9 +288,9 @@ public class PuntoVentaServiceImpl implements PuntoVentaService {
return s.replaceAll("[^0-9]", "");
}
private boolean isCNPJ(String vlr) {
vlr = somenteNumeros(vlr);
return vlr.length() > 11;
}
}