leonardo 2016-12-29 16:26:35 +00:00
parent a7a2ac19a5
commit 8da406f4c1
1 changed files with 6 additions and 4 deletions

View File

@ -162,12 +162,13 @@ public class PuntoVentaServiceImpl implements PuntoVentaService {
DaoAG.getInstance().setDBConnection(dataSource.getConnection()); DaoAG.getInstance().setDBConnection(dataSource.getConnection());
IAG iag = service.getIAGPort(new URL(DaoAG.getInstance().obterConstante(Constantes.URL_WS_AG))); IAG iag = service.getIAGPort(new URL(DaoAG.getInstance().obterConstante(Constantes.URL_WS_AG)));
TFornecedor fornecedor = null; TFornecedor fornecedor = null;
String strFornecedor = "";
try{ try{
fornecedor = iag.getObjetoFornecedorPorCNPJCPF(entidad.getNumDoCPuntoVenta()); strFornecedor = iag.getCodigoFornecedorWithIDWS(entidad.getPuntoventaId().toString());
} catch (RemoteException e) { } catch (RemoteException e) {
log.error("", e.toString()); log.error("", e.toString());
} }
if (fornecedor != null){ if (!strFornecedor.isEmpty()){
// retornar msg a informação de registro já cadastrado // retornar msg a informação de registro já cadastrado
entidad.setIndIntegradoAG(false); entidad.setIndIntegradoAG(false);
entidad.setMotivoNaoIntegradoAG("Fornecedor já cadastrado"); entidad.setMotivoNaoIntegradoAG("Fornecedor já cadastrado");
@ -232,12 +233,13 @@ public class PuntoVentaServiceImpl implements PuntoVentaService {
DaoAG.getInstance().setDBConnection(dataSource.getConnection()); DaoAG.getInstance().setDBConnection(dataSource.getConnection());
IAG iag = service.getIAGPort(new URL(DaoAG.getInstance().obterConstante(Constantes.URL_WS_AG))); IAG iag = service.getIAGPort(new URL(DaoAG.getInstance().obterConstante(Constantes.URL_WS_AG)));
TCliente cli = null; TCliente cli = null;
String cliStr = "";
try{ try{
cli = iag.getObjetoClienteCPFCNPJ(entidad.getNumDoCPuntoVenta()); cliStr = iag.getClienteWithIDWS(entidad.getPuntoventaId().toString());
} catch (RemoteException e) { } catch (RemoteException e) {
log.error("", e.toString()); log.error("", e.toString());
} }
if (cli != null){ if (!cliStr.isEmpty()){
// retornar msg a informação de registro já cadastrado // retornar msg a informação de registro já cadastrado
entidad.setIndIntegradoAG(false); entidad.setIndIntegradoAG(false);
entidad.setMotivoNaoIntegradoAG("Cliente já cadastrado"); entidad.setMotivoNaoIntegradoAG("Cliente já cadastrado");