cambios para sap contratos originales y adendums

parent 27585814
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -2,7 +2,6 @@ package mx.com.amx.mx.dda.ws.bo; ...@@ -2,7 +2,6 @@ package mx.com.amx.mx.dda.ws.bo;
import java.util.Properties; import java.util.Properties;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.ws.WebServiceException; import javax.xml.ws.WebServiceException;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
...@@ -16,13 +15,11 @@ import com.americamovil.dda._1.enviaentradamercancia.DTEntradaMercanciaRes; ...@@ -16,13 +15,11 @@ import com.americamovil.dda._1.enviaentradamercancia.DTEntradaMercanciaRes;
import com.americamovil.dda._1.enviaposicionpo.DTCreaPosicionPOReq; import com.americamovil.dda._1.enviaposicionpo.DTCreaPosicionPOReq;
import com.americamovil.dda._1.enviaposicionpo.DTModificaPosicionPO; import com.americamovil.dda._1.enviaposicionpo.DTModificaPosicionPO;
import com.americamovil.dda._1.enviaposicionpo.DTPosicionPORes; import com.americamovil.dda._1.enviaposicionpo.DTPosicionPORes;
import com.americamovil.dda._1.enviaposicionpo.DTPosicionPORes.Respuesta;
import com.americamovil.dda._1.f.enviafactura.DTFactura; import com.americamovil.dda._1.f.enviafactura.DTFactura;
import com.americamovil.dda._1.f.enviafactura.DTFacturasRes; import com.americamovil.dda._1.f.enviafactura.DTFacturasRes;
import com.americamovil.dda._1.m.enviatitulo.DTTitulo; import com.americamovil.dda._1.m.enviatitulo.DTTitulo;
import com.americamovil.dda._1.m.enviapedidocompra.DTPedidoCompra; import com.americamovil.dda._1.m.enviapedidocompra.DTPedidoCompra;
import com.americamovil.dda._1.m.enviapedidocompra.DTPedidoCompraRes; import com.americamovil.dda._1.m.enviapedidocompra.DTPedidoCompraRes;
import com.americamovil.dda._1.m.enviapedidocompra.DTPedidoCompraRes.Resultado;
import mx.com.amx.mx.dda.ws.dto.ParamAgregaPosicionDTO; import mx.com.amx.mx.dda.ws.dto.ParamAgregaPosicionDTO;
import mx.com.amx.mx.dda.ws.dto.ParamEntradaMercanciaDTO; import mx.com.amx.mx.dda.ws.dto.ParamEntradaMercanciaDTO;
...@@ -43,20 +40,17 @@ import mx.com.amx.mx.dda.ws.dto.ResultadoOrdenCompraDTO; ...@@ -43,20 +40,17 @@ import mx.com.amx.mx.dda.ws.dto.ResultadoOrdenCompraDTO;
import mx.com.amx.mx.dda.ws.dto.TransactionFaultDTO; import mx.com.amx.mx.dda.ws.dto.TransactionFaultDTO;
import mx.com.amx.mx.dda.ws.utils.StringManager; import mx.com.amx.mx.dda.ws.utils.StringManager;
public class ContratoWSBO public class ContratoWSBO {
{
private final Logger LOG = Logger.getLogger(this.getClass().getSimpleName()); private final Logger LOG = Logger.getLogger(this.getClass().getSimpleName());
private final String ARCHIVO_PROPIEDADES = "/general.properties"; private final String ARCHIVO_PROPIEDADES = "/general.properties";
Properties env = new Properties(); Properties env = new Properties();
StringManager strManager = new StringManager(); StringManager strManager = new StringManager();
@Autowired @Autowired
@Qualifier("wsContratosSAP") @Qualifier("wsContratosSAP")
private WebServiceTemplate wsContratosSAP; private WebServiceTemplate wsContratosSAP;
private String COMPONENTE; private String COMPONENTE;
private String AMBIENTE; private String AMBIENTE;
private String SERVIDOR; private String SERVIDOR;
...@@ -66,47 +60,37 @@ public class ContratoWSBO ...@@ -66,47 +60,37 @@ public class ContratoWSBO
private String ERROR_INTERNO_SAP; private String ERROR_INTERNO_SAP;
private String ERROR_PROCESO; private String ERROR_PROCESO;
public WebServiceTemplate getWsContratosSAP() { public WebServiceTemplate getWsContratosSAP() {
return wsContratosSAP; return wsContratosSAP;
} }
public void setWsContratosSAP(WebServiceTemplate wsContratosSAP) { public void setWsContratosSAP(WebServiceTemplate wsContratosSAP) {
this.wsContratosSAP = wsContratosSAP; this.wsContratosSAP = wsContratosSAP;
} }
public ContratoWSBO() {
public ContratoWSBO()
{
super(); super();
try try {
{ env.load(this.getClass().getResourceAsStream(ARCHIVO_PROPIEDADES));
env.load( this.getClass().getResourceAsStream( ARCHIVO_PROPIEDADES ) );
AMBIENTE = env.getProperty("ambiente"); AMBIENTE = env.getProperty("ambiente");
SERVIDOR = env.getProperty(AMBIENTE+".servidor.sap.ws"); SERVIDOR = env.getProperty(AMBIENTE + ".servidor.sap.ws");
PUERTO = env.getProperty(AMBIENTE+".puerto.sap.ws"); PUERTO = env.getProperty(AMBIENTE + ".puerto.sap.ws");
COMPONENTE = "DDA_WSB_ClienteSAP::" + this.getClass().getSimpleName(); COMPONENTE = "DDA_WSB_ClienteSAP::" + this.getClass().getSimpleName();
ERROR_COMUNICACION_SAP = env.getProperty("error.comunicacion.sap"); ERROR_COMUNICACION_SAP = env.getProperty("error.comunicacion.sap");
ERROR_INTERNO_SAP = env.getProperty("error.interno.sap"); ERROR_INTERNO_SAP = env.getProperty("error.interno.sap");
ERROR_PROCESO = env.getProperty("error.proceso"); ERROR_PROCESO = env.getProperty("error.proceso");
} } catch (Exception e) {
catch(Exception e) LOG.error(">Constructor[" + this.getClass().getSimpleName() + "] Ocurrio un error : " + e.getMessage());
{
LOG.error(">Constructor["+this.getClass().getSimpleName()+"] Ocurrio un error : " + e.getMessage() );
} }
} }
public ResultadoOrdenCompraDTO crearOrdenCompraWS(ParamOrdenCompraDTO dto) {
public ResultadoOrdenCompraDTO crearOrdenCompraWS(ParamOrdenCompraDTO dto)
{
ResultadoOrdenCompraDTO resultado = new ResultadoOrdenCompraDTO(); ResultadoOrdenCompraDTO resultado = new ResultadoOrdenCompraDTO();
TransactionFaultDTO tf = resultado.getTransFault(); TransactionFaultDTO tf = resultado.getTransFault();
RespSAPOrdenCompraDTO oc = resultado.getOrdenCompra(); RespSAPOrdenCompraDTO oc = resultado.getOrdenCompra();
try try {
{
DTPedidoCompra params = new DTPedidoCompra(); DTPedidoCompra params = new DTPedidoCompra();
...@@ -123,8 +107,7 @@ public class ContratoWSBO ...@@ -123,8 +107,7 @@ public class ContratoWSBO
//--Detalle //--Detalle
int lnuTotalItems = dto.getItems().size(); int lnuTotalItems = dto.getItems().size();
for(int xItem = 0; xItem < lnuTotalItems; xItem++) for (int xItem = 0; xItem < lnuTotalItems; xItem++) {
{
DTPedidoCompra.PedidoCompra.Item item = new DTPedidoCompra.PedidoCompra.Item(); DTPedidoCompra.PedidoCompra.Item item = new DTPedidoCompra.PedidoCompra.Item();
item.setICantidad(dto.getItems().get(xItem).getCantidad()); item.setICantidad(dto.getItems().get(xItem).getCantidad());
...@@ -140,18 +123,16 @@ public class ContratoWSBO ...@@ -140,18 +123,16 @@ public class ContratoWSBO
params.getPedidoCompra().getItem().add(item); params.getPedidoCompra().getItem().add(item);
} }
//--Llamado a WS SAP. Interfaz 8, //--Llamado a WS SAP. Interfaz 8,
DTPedidoCompraRes responseOrdenCompra = new DTPedidoCompraRes(); DTPedidoCompraRes responseOrdenCompra = new DTPedidoCompraRes();
LOG.debug ( " Url Srv. Orden Compra: " + this.getUrlServicio("8") ); LOG.debug(" Url Srv. Orden Compra: " + this.getUrlServicio("8"));
//--REAL CODE //--REAL CODE
responseOrdenCompra = (DTPedidoCompraRes) wsContratosSAP.marshalSendAndReceive( this.getUrlServicio("8") , params ); responseOrdenCompra = (DTPedidoCompraRes) wsContratosSAP.marshalSendAndReceive(this.getUrlServicio("8"), params);
//--TEST //--TEST
//1. //1.
//responseOrdenCompra = null; //responseOrdenCompra = null;
//2. //2.
/* /*
DTPedidoCompraRes.Resultado resTest = new DTPedidoCompraRes.Resultado(); DTPedidoCompraRes.Resultado resTest = new DTPedidoCompraRes.Resultado();
...@@ -160,14 +141,12 @@ public class ContratoWSBO ...@@ -160,14 +141,12 @@ public class ContratoWSBO
resTest.setPONumber("9200000010"); resTest.setPONumber("9200000010");
responseOrdenCompra.setResultado(resTest); responseOrdenCompra.setResultado(resTest);
*/ */
if (responseOrdenCompra != null && responseOrdenCompra.getResultado() != null) {
if( responseOrdenCompra != null && responseOrdenCompra.getResultado() != null)
{
DTPedidoCompraRes.Resultado rSAP = responseOrdenCompra.getResultado(); DTPedidoCompraRes.Resultado rSAP = responseOrdenCompra.getResultado();
LOG.info(" "); LOG.info(" ");
LOG.info(" [INI] Detalle respuesta devuelta por SAP [Orden Compra]:"); LOG.info(" [INI] Detalle respuesta devuelta por SAP [Orden Compra]:");
LOG.info(" <PONumber:["+rSAP.getPONumber()+"], IDMensaje:["+rSAP.getIDMensaje()+"], Descripcion:["+rSAP.getDescripcion()+"]>"); LOG.info(" <PONumber:[" + rSAP.getPONumber() + "], IDMensaje:[" + rSAP.getIDMensaje() + "], Descripcion:[" + rSAP.getDescripcion() + "]>");
LOG.info(" [FIN] Detalle respuesta devuelta por SAP [Orden Compra]:"); LOG.info(" [FIN] Detalle respuesta devuelta por SAP [Orden Compra]:");
LOG.info(" "); LOG.info(" ");
...@@ -175,9 +154,7 @@ public class ContratoWSBO ...@@ -175,9 +154,7 @@ public class ContratoWSBO
oc.setIDMensaje((rSAP.getIDMensaje() != null && rSAP.getIDMensaje().length() > 0) ? rSAP.getIDMensaje() : ""); oc.setIDMensaje((rSAP.getIDMensaje() != null && rSAP.getIDMensaje().length() > 0) ? rSAP.getIDMensaje() : "");
oc.setDescripcion((rSAP.getDescripcion() != null && rSAP.getDescripcion().length() > 0) ? rSAP.getDescripcion() : ""); oc.setDescripcion((rSAP.getDescripcion() != null && rSAP.getDescripcion().length() > 0) ? rSAP.getDescripcion() : "");
resultado.setResultado(true); resultado.setResultado(true);
} } else {
else
{
tf.setInternalCode("DDA-COC-004"); tf.setInternalCode("DDA-COC-004");
tf.setComponent(COMPONENTE); tf.setComponent(COMPONENTE);
tf.setFaultDescription(ERROR_COMUNICACION_SAP); tf.setFaultDescription(ERROR_COMUNICACION_SAP);
...@@ -188,9 +165,7 @@ public class ContratoWSBO ...@@ -188,9 +165,7 @@ public class ContratoWSBO
return resultado; return resultado;
} } catch (WebServiceException c) {
catch(WebServiceException c)
{
tf.setInternalCode("DDA-COC-001"); tf.setInternalCode("DDA-COC-001");
tf.setComponent(COMPONENTE); tf.setComponent(COMPONENTE);
tf.setFaultDescription(ERROR_COMUNICACION_SAP); tf.setFaultDescription(ERROR_COMUNICACION_SAP);
...@@ -198,9 +173,7 @@ public class ContratoWSBO ...@@ -198,9 +173,7 @@ public class ContratoWSBO
tf.setMethod("crearOrdenCompraWS"); tf.setMethod("crearOrdenCompraWS");
resultado.setResultado(false); resultado.setResultado(false);
return resultado; return resultado;
} } catch (SoapFaultClientException se) {
catch(SoapFaultClientException se)
{
tf.setInternalCode("DDA-COC-002"); tf.setInternalCode("DDA-COC-002");
tf.setComponent(COMPONENTE); tf.setComponent(COMPONENTE);
tf.setFaultDescription(ERROR_INTERNO_SAP); tf.setFaultDescription(ERROR_INTERNO_SAP);
...@@ -208,9 +181,7 @@ public class ContratoWSBO ...@@ -208,9 +181,7 @@ public class ContratoWSBO
tf.setMethod("crearOrdenCompraWS"); tf.setMethod("crearOrdenCompraWS");
resultado.setResultado(false); resultado.setResultado(false);
return resultado; return resultado;
} } catch (Exception e) {
catch(Exception e)
{
tf.setInternalCode("DDA-COC-003"); tf.setInternalCode("DDA-COC-003");
tf.setComponent(COMPONENTE); tf.setComponent(COMPONENTE);
tf.setFaultDescription(ERROR_PROCESO); tf.setFaultDescription(ERROR_PROCESO);
...@@ -221,14 +192,11 @@ public class ContratoWSBO ...@@ -221,14 +192,11 @@ public class ContratoWSBO
} }
} }
public ResultadoEnviaTituloDTO enviarTitulosDDAWS(ParamEnviaTituloDTO dto) {
public ResultadoEnviaTituloDTO enviarTitulosDDAWS(ParamEnviaTituloDTO dto)
{
ResultadoEnviaTituloDTO resultado = new ResultadoEnviaTituloDTO(); ResultadoEnviaTituloDTO resultado = new ResultadoEnviaTituloDTO();
TransactionFaultDTO tf = resultado.getTransFault(); TransactionFaultDTO tf = resultado.getTransFault();
try try {
{
DTTitulo params = new DTTitulo(); DTTitulo params = new DTTitulo();
//--Recorrido de titulos enviados //--Recorrido de titulos enviados
...@@ -240,37 +208,31 @@ public class ContratoWSBO ...@@ -240,37 +208,31 @@ public class ContratoWSBO
String lstProgramaID = ""; String lstProgramaID = "";
String lstFechaInicioExposicion = ""; String lstFechaInicioExposicion = "";
for (int xTitulo = 0; xTitulo < lnuTotalTitulosEnviar; xTitulo++) {
lstIdTitulo = (dto.getTitulos().get(xTitulo).getID_TITULO_CNTORIG() != null && dto.getTitulos().get(xTitulo).getID_TITULO_CNTORIG().length() > 0) ? dto.getTitulos().get(xTitulo).getID_TITULO_CNTORIG() : "";
for(int xTitulo = 0; xTitulo < lnuTotalTitulosEnviar; xTitulo++) lstDescripcion = (dto.getTitulos().get(xTitulo).getDESC_TITULO() != null && dto.getTitulos().get(xTitulo).getDESC_TITULO().length() > 0) ? dto.getTitulos().get(xTitulo).getDESC_TITULO() : "";
{ lstProveedor = (dto.getTitulos().get(xTitulo).getID_SAP_ESTUDIO() != null && dto.getTitulos().get(xTitulo).getID_SAP_ESTUDIO().length() > 0) ? dto.getTitulos().get(xTitulo).getID_SAP_ESTUDIO() : "";
lstIdTitulo = (dto.getTitulos().get(xTitulo).getID_TITULO_CNTORIG() != null && dto.getTitulos().get(xTitulo).getID_TITULO_CNTORIG().length() > 0) ? dto.getTitulos().get(xTitulo).getID_TITULO_CNTORIG(): ""; lstProgramaID = (dto.getTitulos().get(xTitulo).getID_BV() != null && dto.getTitulos().get(xTitulo).getID_BV().length() > 0) ? dto.getTitulos().get(xTitulo).getID_BV() : "";
lstDescripcion = (dto.getTitulos().get(xTitulo).getDESC_TITULO() != null && dto.getTitulos().get(xTitulo).getDESC_TITULO().length() > 0) ? dto.getTitulos().get(xTitulo).getDESC_TITULO(): ""; lstFechaInicioExposicion = (dto.getTitulos().get(xTitulo).getFECHA_INICIO() != null && dto.getTitulos().get(xTitulo).getFECHA_INICIO().length() > 0) ? dto.getTitulos().get(xTitulo).getFECHA_INICIO() : "";
lstProveedor = (dto.getTitulos().get(xTitulo).getID_SAP_ESTUDIO() != null && dto.getTitulos().get(xTitulo).getID_SAP_ESTUDIO().length() > 0) ? dto.getTitulos().get(xTitulo).getID_SAP_ESTUDIO(): "";
lstProgramaID = (dto.getTitulos().get(xTitulo).getID_BV() != null && dto.getTitulos().get(xTitulo).getID_BV().length() > 0) ? dto.getTitulos().get(xTitulo).getID_BV(): "";
lstFechaInicioExposicion = (dto.getTitulos().get(xTitulo).getFECHA_INICIO() != null && dto.getTitulos().get(xTitulo).getFECHA_INICIO().length() > 0) ? dto.getTitulos().get(xTitulo).getFECHA_INICIO(): "";
DTTitulo.Registro titulo = new DTTitulo.Registro(); DTTitulo.Registro titulo = new DTTitulo.Registro();
titulo.setIDTitulo(lstIdTitulo); titulo.setIDTitulo(lstIdTitulo);
titulo.setDescripcion(strManager.extraerPrimerosCaracteres(lstDescripcion,75)); titulo.setDescripcion(strManager.extraerPrimerosCaracteres(lstDescripcion, 75));
titulo.setProveedor(strManager.extraerPrimerosCaracteres(lstProveedor,10)); titulo.setProveedor(strManager.extraerPrimerosCaracteres(lstProveedor, 10));
titulo.setProgramaID(strManager.extraerPrimerosCaracteres(lstProgramaID,9)); titulo.setProgramaID(strManager.extraerPrimerosCaracteres(lstProgramaID, 9));
titulo.setFechaInicioExposicion(lstFechaInicioExposicion); titulo.setFechaInicioExposicion(lstFechaInicioExposicion);
params.getRegistro().add(titulo); params.getRegistro().add(titulo);
}//Ends for(int xTitulo = 0; xTitulo < lnuTotalTitulosEnviar; xTitulo++) }//Ends for(int xTitulo = 0; xTitulo < lnuTotalTitulosEnviar; xTitulo++)
//--Llamado al WS de SAP. Interfaz 45 //--Llamado al WS de SAP. Interfaz 45
LOG.debug ( " Url Srv. Envia Titulo DDA a SAP: " + this.getUrlServicio("45") ); LOG.debug(" Url Srv. Envia Titulo DDA a SAP: " + this.getUrlServicio("45"));
wsContratosSAP.marshalSendAndReceive( this.getUrlServicio("45") , params ); wsContratosSAP.marshalSendAndReceive(this.getUrlServicio("45"), params);
resultado.setResultado(true); resultado.setResultado(true);
return resultado; return resultado;
} } catch (WebServiceException c) {
catch(WebServiceException c)
{
tf.setInternalCode("DDA-ETDDA-001"); tf.setInternalCode("DDA-ETDDA-001");
tf.setComponent(COMPONENTE); tf.setComponent(COMPONENTE);
tf.setFaultDescription(ERROR_COMUNICACION_SAP); tf.setFaultDescription(ERROR_COMUNICACION_SAP);
...@@ -278,9 +240,7 @@ public class ContratoWSBO ...@@ -278,9 +240,7 @@ public class ContratoWSBO
tf.setMethod("enviarTitulosDDAWS"); tf.setMethod("enviarTitulosDDAWS");
resultado.setResultado(false); resultado.setResultado(false);
return resultado; return resultado;
} } catch (SoapFaultClientException se) {
catch(SoapFaultClientException se)
{
tf.setInternalCode("DDA-ETDDA-002"); tf.setInternalCode("DDA-ETDDA-002");
tf.setComponent(COMPONENTE); tf.setComponent(COMPONENTE);
tf.setFaultDescription(ERROR_INTERNO_SAP); tf.setFaultDescription(ERROR_INTERNO_SAP);
...@@ -288,9 +248,7 @@ public class ContratoWSBO ...@@ -288,9 +248,7 @@ public class ContratoWSBO
tf.setMethod("enviarTitulosDDAWS"); tf.setMethod("enviarTitulosDDAWS");
resultado.setResultado(false); resultado.setResultado(false);
return resultado; return resultado;
} } catch (Exception e) {
catch(Exception e)
{
tf.setInternalCode("DDA-ETDDA-003"); tf.setInternalCode("DDA-ETDDA-003");
tf.setComponent(COMPONENTE); tf.setComponent(COMPONENTE);
tf.setFaultDescription(ERROR_PROCESO); tf.setFaultDescription(ERROR_PROCESO);
...@@ -301,21 +259,18 @@ public class ContratoWSBO ...@@ -301,21 +259,18 @@ public class ContratoWSBO
} }
} }
public ResultadoModificaPosicionDTO modificaPosicionPedidoWS(ParamModificaPosicionDTO dto) {
public ResultadoModificaPosicionDTO modificaPosicionPedidoWS(ParamModificaPosicionDTO dto)
{
ResultadoModificaPosicionDTO resultado = new ResultadoModificaPosicionDTO(); ResultadoModificaPosicionDTO resultado = new ResultadoModificaPosicionDTO();
TransactionFaultDTO tf = resultado.getTransFault(); TransactionFaultDTO tf = resultado.getTransFault();
RespSAPPosicionDTO pos = resultado.getPosicion(); RespSAPPosicionDTO pos = resultado.getPosicion();
try try {
{
LOG.debug("Parametros recibidos: "); LOG.debug("Parametros recibidos: ");
LOG.debug(" Documento: _" +dto.getDocumento()+"_"); LOG.debug(" Documento: _" + dto.getDocumento() + "_");
LOG.debug(" Item: _" +dto.getItems().size()+"_"); LOG.debug(" Item: _" + dto.getItems().size() + "_");
LOG.debug(" Detalle: "); LOG.debug(" Detalle: ");
LOG.debug(" Cantidad: _"+dto.getItems().get(0).getCantidad()+"_"); LOG.debug(" Cantidad: _" + dto.getItems().get(0).getCantidad() + "_");
LOG.debug(" Posicion: _"+dto.getItems().get(0).getNoPosicion()+"_"); LOG.debug(" Posicion: _" + dto.getItems().get(0).getNoPosicion() + "_");
DTModificaPosicionPO params = new DTModificaPosicionPO(); DTModificaPosicionPO params = new DTModificaPosicionPO();
...@@ -326,8 +281,7 @@ public class ContratoWSBO ...@@ -326,8 +281,7 @@ public class ContratoWSBO
//--Detalle //--Detalle
int lnuTotalPosiciones = dto.getItems().size(); int lnuTotalPosiciones = dto.getItems().size();
for(int xPosicion = 0; xPosicion < lnuTotalPosiciones; xPosicion++) for (int xPosicion = 0; xPosicion < lnuTotalPosiciones; xPosicion++) {
{
DTModificaPosicionPO.Registro.Posicion posicion = new DTModificaPosicionPO.Registro.Posicion(); DTModificaPosicionPO.Registro.Posicion posicion = new DTModificaPosicionPO.Registro.Posicion();
posicion.setCantidad(dto.getItems().get(xPosicion).getCantidad()); posicion.setCantidad(dto.getItems().get(xPosicion).getCantidad());
posicion.setNoPosicion(dto.getItems().get(xPosicion).getNoPosicion()); posicion.setNoPosicion(dto.getItems().get(xPosicion).getNoPosicion());
...@@ -336,16 +290,15 @@ public class ContratoWSBO ...@@ -336,16 +290,15 @@ public class ContratoWSBO
//--Llamado a WS SAP. Interfaz 23. //--Llamado a WS SAP. Interfaz 23.
DTPosicionPORes responseModificaPosicion = new DTPosicionPORes(); DTPosicionPORes responseModificaPosicion = new DTPosicionPORes();
LOG.debug ( " Url Srv. Interfaz 23: " + this.getUrlServicio("23") ); LOG.debug(" Url Srv. Interfaz 23: " + this.getUrlServicio("23"));
responseModificaPosicion = (DTPosicionPORes) wsContratosSAP.marshalSendAndReceive(this.getUrlServicio("23"), params); responseModificaPosicion = (DTPosicionPORes) wsContratosSAP.marshalSendAndReceive(this.getUrlServicio("23"), params);
if(responseModificaPosicion != null && responseModificaPosicion.getRespuesta() != null) if (responseModificaPosicion != null && responseModificaPosicion.getRespuesta() != null) {
{
DTPosicionPORes.Respuesta rSAP = responseModificaPosicion.getRespuesta(); DTPosicionPORes.Respuesta rSAP = responseModificaPosicion.getRespuesta();
LOG.info(" "); LOG.info(" ");
LOG.info(" [INI] Detalle respuesta devuelta por SAP [Modifica Posicion]:"); LOG.info(" [INI] Detalle respuesta devuelta por SAP [Modifica Posicion]:");
LOG.info(" <Documento:["+rSAP.getDocumento()+"], IDMensaje:["+rSAP.getIDMensaje()+"], Mensaje:["+rSAP.getMensaje()+"]>"); LOG.info(" <Documento:[" + rSAP.getDocumento() + "], IDMensaje:[" + rSAP.getIDMensaje() + "], Mensaje:[" + rSAP.getMensaje() + "]>");
LOG.info(" [FIN] Detalle respuesta devuelta por SAP [Modifica Posicion]:"); LOG.info(" [FIN] Detalle respuesta devuelta por SAP [Modifica Posicion]:");
LOG.info(" "); LOG.info(" ");
...@@ -353,9 +306,7 @@ public class ContratoWSBO ...@@ -353,9 +306,7 @@ public class ContratoWSBO
pos.setIDMensaje((rSAP.getIDMensaje() != null && rSAP.getIDMensaje().length() > 0) ? rSAP.getIDMensaje() : ""); pos.setIDMensaje((rSAP.getIDMensaje() != null && rSAP.getIDMensaje().length() > 0) ? rSAP.getIDMensaje() : "");
pos.setMensaje((rSAP.getMensaje() != null && rSAP.getMensaje().length() > 0) ? rSAP.getMensaje() : ""); pos.setMensaje((rSAP.getMensaje() != null && rSAP.getMensaje().length() > 0) ? rSAP.getMensaje() : "");
resultado.setResultado(true); resultado.setResultado(true);
} } else {
else
{
tf.setInternalCode("DDA-MPOS-004"); tf.setInternalCode("DDA-MPOS-004");
tf.setComponent(COMPONENTE); tf.setComponent(COMPONENTE);
tf.setFaultDescription(ERROR_COMUNICACION_SAP); tf.setFaultDescription(ERROR_COMUNICACION_SAP);
...@@ -365,9 +316,7 @@ public class ContratoWSBO ...@@ -365,9 +316,7 @@ public class ContratoWSBO
} }
return resultado; return resultado;
} } catch (WebServiceException c) {
catch(WebServiceException c)
{
tf.setInternalCode("DDA-MPOS-001"); tf.setInternalCode("DDA-MPOS-001");
tf.setComponent(COMPONENTE); tf.setComponent(COMPONENTE);
tf.setFaultDescription(ERROR_COMUNICACION_SAP); tf.setFaultDescription(ERROR_COMUNICACION_SAP);
...@@ -375,9 +324,7 @@ public class ContratoWSBO ...@@ -375,9 +324,7 @@ public class ContratoWSBO
tf.setMethod("modificaPosicionPedidoWS"); tf.setMethod("modificaPosicionPedidoWS");
resultado.setResultado(false); resultado.setResultado(false);
return resultado; return resultado;
} } catch (SoapFaultClientException se) {
catch(SoapFaultClientException se)
{
tf.setInternalCode("DDA-MPOS-002"); tf.setInternalCode("DDA-MPOS-002");
tf.setComponent(COMPONENTE); tf.setComponent(COMPONENTE);
tf.setFaultDescription(ERROR_INTERNO_SAP); tf.setFaultDescription(ERROR_INTERNO_SAP);
...@@ -385,9 +332,7 @@ public class ContratoWSBO ...@@ -385,9 +332,7 @@ public class ContratoWSBO
tf.setMethod("modificaPosicionPedidoWS"); tf.setMethod("modificaPosicionPedidoWS");
resultado.setResultado(false); resultado.setResultado(false);
return resultado; return resultado;
} } catch (Exception e) {
catch(Exception e)
{
tf.setInternalCode("DDA-MPOS-003"); tf.setInternalCode("DDA-MPOS-003");
tf.setComponent(COMPONENTE); tf.setComponent(COMPONENTE);
tf.setFaultDescription(ERROR_PROCESO); tf.setFaultDescription(ERROR_PROCESO);
...@@ -398,18 +343,15 @@ public class ContratoWSBO ...@@ -398,18 +343,15 @@ public class ContratoWSBO
} }
} }
public ResultadoEnviaPosicionDTO agregaPosicionWS(ParamAgregaPosicionDTO dto) {
public ResultadoEnviaPosicionDTO agregaPosicionWS(ParamAgregaPosicionDTO dto)
{
ResultadoEnviaPosicionDTO resultado = new ResultadoEnviaPosicionDTO(); ResultadoEnviaPosicionDTO resultado = new ResultadoEnviaPosicionDTO();
TransactionFaultDTO tf = resultado.getTransFault(); TransactionFaultDTO tf = resultado.getTransFault();
RespSAPPosicionDTO pos = resultado.getPosicion(); RespSAPPosicionDTO pos = resultado.getPosicion();
try try {
{
LOG.debug("Parametros recibidos: "); LOG.debug("Parametros recibidos: ");
LOG.debug(" IdDocumento: _" +dto.getIdDocumento()+"_"); LOG.debug(" IdDocumento: _" + dto.getIdDocumento() + "_");
LOG.debug(" Item: _" +dto.getItems().size()+"_"); LOG.debug(" Item: _" + dto.getItems().size() + "_");
DTCreaPosicionPOReq params = new DTCreaPosicionPOReq(); DTCreaPosicionPOReq params = new DTCreaPosicionPOReq();
...@@ -420,8 +362,7 @@ public class ContratoWSBO ...@@ -420,8 +362,7 @@ public class ContratoWSBO
//--Detalle //--Detalle
int lnuTotalPosiciones = dto.getItems().size(); int lnuTotalPosiciones = dto.getItems().size();
for(int xPosicion = 0; xPosicion < lnuTotalPosiciones; xPosicion++) for (int xPosicion = 0; xPosicion < lnuTotalPosiciones; xPosicion++) {
{
DTCreaPosicionPOReq.PedidoCompra.Item posicion = new DTCreaPosicionPOReq.PedidoCompra.Item(); DTCreaPosicionPOReq.PedidoCompra.Item posicion = new DTCreaPosicionPOReq.PedidoCompra.Item();
posicion.setCantidad(dto.getItems().get(xPosicion).getCantidad()); posicion.setCantidad(dto.getItems().get(xPosicion).getCantidad());
posicion.setCentro(dto.getItems().get(xPosicion).getCentro()); posicion.setCentro(dto.getItems().get(xPosicion).getCentro());
...@@ -436,19 +377,17 @@ public class ContratoWSBO ...@@ -436,19 +377,17 @@ public class ContratoWSBO
params.getPedidoCompra().getItem().add(posicion); params.getPedidoCompra().getItem().add(posicion);
} }
//--Llamado a WS SAP. Interfaz 17. //--Llamado a WS SAP. Interfaz 17.
DTPosicionPORes responseCreaPosicion = new DTPosicionPORes(); DTPosicionPORes responseCreaPosicion = new DTPosicionPORes();
LOG.debug ( " Url Srv. Interfaz 17: " + this.getUrlServicio("17") ); LOG.debug(" Url Srv. Interfaz 17: " + this.getUrlServicio("17"));
responseCreaPosicion = (DTPosicionPORes) wsContratosSAP.marshalSendAndReceive(this.getUrlServicio("17"), params); responseCreaPosicion = (DTPosicionPORes) wsContratosSAP.marshalSendAndReceive(this.getUrlServicio("17"), params);
if(responseCreaPosicion != null && responseCreaPosicion.getRespuesta() != null) if (responseCreaPosicion != null && responseCreaPosicion.getRespuesta() != null) {
{
DTPosicionPORes.Respuesta rSAP = responseCreaPosicion.getRespuesta(); DTPosicionPORes.Respuesta rSAP = responseCreaPosicion.getRespuesta();
LOG.info(" "); LOG.info(" ");
LOG.info(" [INI] Detalle respuesta devuelta por SAP [Crea Posicion]:"); LOG.info(" [INI] Detalle respuesta devuelta por SAP [Crea Posicion]:");
LOG.info(" <Documento:["+rSAP.getDocumento()+"], IDMensaje:["+rSAP.getIDMensaje()+"], Mensaje:["+rSAP.getMensaje()+"]>"); LOG.info(" <Documento:[" + rSAP.getDocumento() + "], IDMensaje:[" + rSAP.getIDMensaje() + "], Mensaje:[" + rSAP.getMensaje() + "]>");
LOG.info(" [FIN] Detalle respuesta devuelta por SAP [Crea Posicion]:"); LOG.info(" [FIN] Detalle respuesta devuelta por SAP [Crea Posicion]:");
LOG.info(" "); LOG.info(" ");
...@@ -456,9 +395,7 @@ public class ContratoWSBO ...@@ -456,9 +395,7 @@ public class ContratoWSBO
pos.setIDMensaje((rSAP.getIDMensaje() != null && rSAP.getIDMensaje().length() > 0) ? rSAP.getIDMensaje() : ""); pos.setIDMensaje((rSAP.getIDMensaje() != null && rSAP.getIDMensaje().length() > 0) ? rSAP.getIDMensaje() : "");
pos.setMensaje((rSAP.getMensaje() != null && rSAP.getMensaje().length() > 0) ? rSAP.getMensaje() : ""); pos.setMensaje((rSAP.getMensaje() != null && rSAP.getMensaje().length() > 0) ? rSAP.getMensaje() : "");
resultado.setResultado(true); resultado.setResultado(true);
} } else {
else
{
tf.setInternalCode("DDA-APOS-004"); tf.setInternalCode("DDA-APOS-004");
tf.setComponent(COMPONENTE); tf.setComponent(COMPONENTE);
tf.setFaultDescription(ERROR_COMUNICACION_SAP); tf.setFaultDescription(ERROR_COMUNICACION_SAP);
...@@ -468,9 +405,7 @@ public class ContratoWSBO ...@@ -468,9 +405,7 @@ public class ContratoWSBO
} }
return resultado; return resultado;
} } catch (WebServiceException c) {
catch(WebServiceException c)
{
tf.setInternalCode("DDA-APOS-001"); tf.setInternalCode("DDA-APOS-001");
tf.setComponent(COMPONENTE); tf.setComponent(COMPONENTE);
tf.setFaultDescription(ERROR_COMUNICACION_SAP); tf.setFaultDescription(ERROR_COMUNICACION_SAP);
...@@ -478,9 +413,7 @@ public class ContratoWSBO ...@@ -478,9 +413,7 @@ public class ContratoWSBO
tf.setMethod("agregaPosicionWS"); tf.setMethod("agregaPosicionWS");
resultado.setResultado(false); resultado.setResultado(false);
return resultado; return resultado;
} } catch (SoapFaultClientException se) {
catch(SoapFaultClientException se)
{
tf.setInternalCode("DDA-APOS-002"); tf.setInternalCode("DDA-APOS-002");
tf.setComponent(COMPONENTE); tf.setComponent(COMPONENTE);
tf.setFaultDescription(ERROR_INTERNO_SAP); tf.setFaultDescription(ERROR_INTERNO_SAP);
...@@ -488,9 +421,7 @@ public class ContratoWSBO ...@@ -488,9 +421,7 @@ public class ContratoWSBO
tf.setMethod("agregaPosicionWS"); tf.setMethod("agregaPosicionWS");
resultado.setResultado(false); resultado.setResultado(false);
return resultado; return resultado;
} } catch (Exception e) {
catch(Exception e)
{
tf.setInternalCode("DDA-APOS-003"); tf.setInternalCode("DDA-APOS-003");
tf.setComponent(COMPONENTE); tf.setComponent(COMPONENTE);
tf.setFaultDescription(ERROR_PROCESO); tf.setFaultDescription(ERROR_PROCESO);
...@@ -501,21 +432,19 @@ public class ContratoWSBO ...@@ -501,21 +432,19 @@ public class ContratoWSBO
} }
} }
public ResultadoEnviaMercanciaDTO enviaMercanciaWS(ParamEntradaMercanciaDTO dto) public ResultadoEnviaMercanciaDTO enviaMercanciaWS(ParamEntradaMercanciaDTO dto) {
{
ResultadoEnviaMercanciaDTO resultado = new ResultadoEnviaMercanciaDTO(); ResultadoEnviaMercanciaDTO resultado = new ResultadoEnviaMercanciaDTO();
TransactionFaultDTO tf = resultado.getTransFault(); TransactionFaultDTO tf = resultado.getTransFault();
RespSAPEnvMercDTO envio = resultado.getEnvioMerc(); RespSAPEnvMercDTO envio = resultado.getEnvioMerc();
try try {
{
LOG.debug("Parametros recibidos: "); LOG.debug("Parametros recibidos: ");
LOG.debug(" fechaContabilidad: _" +dto.getFechaContabilidad()+"_"); LOG.debug(" fechaContabilidad: _" + dto.getFechaContabilidad() + "_");
LOG.debug(" fechaDocto: _" +dto.getFechaDocto()+"_"); LOG.debug(" fechaDocto: _" + dto.getFechaDocto() + "_");
LOG.debug(" numeroPO: _" +dto.getNumeroPO()+"_"); LOG.debug(" numeroPO: _" + dto.getNumeroPO() + "_");
LOG.debug(" texto: _" +dto.getTexto()+"_"); LOG.debug(" texto: _" + dto.getTexto() + "_");
LOG.debug(" actividad: _" +dto.getActividad()+"_"); LOG.debug(" actividad: _" + dto.getActividad() + "_");
LOG.debug(" Item: _" +dto.getItems().size()+"_"); LOG.debug(" Item: _" + dto.getItems().size() + "_");
DTEntradaMercancia params = new DTEntradaMercancia(); DTEntradaMercancia params = new DTEntradaMercancia();
...@@ -528,8 +457,7 @@ public class ContratoWSBO ...@@ -528,8 +457,7 @@ public class ContratoWSBO
//--Detalle //--Detalle
int lnuTotalItems = dto.getItems().size(); int lnuTotalItems = dto.getItems().size();
for(int xItem=0; xItem < lnuTotalItems; xItem++) for (int xItem = 0; xItem < lnuTotalItems; xItem++) {
{
DTEntradaMercancia.Item item = new DTEntradaMercancia.Item(); DTEntradaMercancia.Item item = new DTEntradaMercancia.Item();
item.setCantidad(dto.getItems().get(xItem).getCantidad()); item.setCantidad(dto.getItems().get(xItem).getCantidad());
item.setCentro(dto.getItems().get(xItem).getCentro()); item.setCentro(dto.getItems().get(xItem).getCentro());
...@@ -542,16 +470,15 @@ public class ContratoWSBO ...@@ -542,16 +470,15 @@ public class ContratoWSBO
//--Llamado a WS SAP. Interfaz 32 //--Llamado a WS SAP. Interfaz 32
DTEntradaMercanciaRes responseEnviaMercancia = new DTEntradaMercanciaRes(); DTEntradaMercanciaRes responseEnviaMercancia = new DTEntradaMercanciaRes();
LOG.debug ( " Url Srv. Interfaz 32: " + this.getUrlServicio("32") ); LOG.debug(" Url Srv. Interfaz 32: " + this.getUrlServicio("32"));
responseEnviaMercancia = (DTEntradaMercanciaRes) wsContratosSAP.marshalSendAndReceive(this.getUrlServicio("32"), params); responseEnviaMercancia = (DTEntradaMercanciaRes) wsContratosSAP.marshalSendAndReceive(this.getUrlServicio("32"), params);
if(responseEnviaMercancia != null && responseEnviaMercancia.getRespuesta() != null) if (responseEnviaMercancia != null && responseEnviaMercancia.getRespuesta() != null) {
{
DTEntradaMercanciaRes.Respuesta rSAP = responseEnviaMercancia.getRespuesta(); DTEntradaMercanciaRes.Respuesta rSAP = responseEnviaMercancia.getRespuesta();
LOG.info(" "); LOG.info(" ");
LOG.info(" [INI] Detalle respuesta devuelta por SAP [Envia Mercancia]:"); LOG.info(" [INI] Detalle respuesta devuelta por SAP [Envia Mercancia]:");
LOG.info(" <DocMaterial:["+rSAP.getDocMaterial()+"], EjerDoc:["+rSAP.getEjercDoc()+"], Mensaje:["+rSAP.getMensaje()+"]>"); LOG.info(" <DocMaterial:[" + rSAP.getDocMaterial() + "], EjerDoc:[" + rSAP.getEjercDoc() + "], Mensaje:[" + rSAP.getMensaje() + "]>");
LOG.info(" [FIN] Detalle respuesta devuelta por SAP [Envia Mercancia]:"); LOG.info(" [FIN] Detalle respuesta devuelta por SAP [Envia Mercancia]:");
LOG.info(" "); LOG.info(" ");
...@@ -559,9 +486,7 @@ public class ContratoWSBO ...@@ -559,9 +486,7 @@ public class ContratoWSBO
envio.setEjercDoc((rSAP.getEjercDoc() != null && rSAP.getEjercDoc().length() > 0) ? rSAP.getEjercDoc() : ""); envio.setEjercDoc((rSAP.getEjercDoc() != null && rSAP.getEjercDoc().length() > 0) ? rSAP.getEjercDoc() : "");
envio.setMensaje((rSAP.getMensaje() != null && rSAP.getMensaje().length() > 0) ? rSAP.getMensaje() : ""); envio.setMensaje((rSAP.getMensaje() != null && rSAP.getMensaje().length() > 0) ? rSAP.getMensaje() : "");
resultado.setResultado(true); resultado.setResultado(true);
} } else {
else
{
tf.setInternalCode("DDA-EM-004"); tf.setInternalCode("DDA-EM-004");
tf.setComponent(COMPONENTE); tf.setComponent(COMPONENTE);
tf.setFaultDescription(ERROR_COMUNICACION_SAP); tf.setFaultDescription(ERROR_COMUNICACION_SAP);
...@@ -571,9 +496,7 @@ public class ContratoWSBO ...@@ -571,9 +496,7 @@ public class ContratoWSBO
} }
return resultado; return resultado;
} } catch (WebServiceException c) {
catch(WebServiceException c)
{
tf.setInternalCode("DDA-EM-001"); tf.setInternalCode("DDA-EM-001");
tf.setComponent(COMPONENTE); tf.setComponent(COMPONENTE);
tf.setFaultDescription(ERROR_COMUNICACION_SAP); tf.setFaultDescription(ERROR_COMUNICACION_SAP);
...@@ -581,9 +504,7 @@ public class ContratoWSBO ...@@ -581,9 +504,7 @@ public class ContratoWSBO
tf.setMethod("enviaMercanciaWS"); tf.setMethod("enviaMercanciaWS");
resultado.setResultado(false); resultado.setResultado(false);
return resultado; return resultado;
} } catch (SoapFaultClientException se) {
catch(SoapFaultClientException se)
{
tf.setInternalCode("DDA-EM-002"); tf.setInternalCode("DDA-EM-002");
tf.setComponent(COMPONENTE); tf.setComponent(COMPONENTE);
tf.setFaultDescription(ERROR_INTERNO_SAP); tf.setFaultDescription(ERROR_INTERNO_SAP);
...@@ -591,9 +512,7 @@ public class ContratoWSBO ...@@ -591,9 +512,7 @@ public class ContratoWSBO
tf.setMethod("enviaMercanciaWS"); tf.setMethod("enviaMercanciaWS");
resultado.setResultado(false); resultado.setResultado(false);
return resultado; return resultado;
} } catch (Exception e) {
catch(Exception e)
{
tf.setInternalCode("DDA-EM-003"); tf.setInternalCode("DDA-EM-003");
tf.setComponent(COMPONENTE); tf.setComponent(COMPONENTE);
tf.setFaultDescription(ERROR_PROCESO); tf.setFaultDescription(ERROR_PROCESO);
...@@ -604,26 +523,23 @@ public class ContratoWSBO ...@@ -604,26 +523,23 @@ public class ContratoWSBO
} }
} }
public ResultadoEnviaFacturaDTO enviarFacturaWS(ParamEnviaFacturaDTO dto) {
public ResultadoEnviaFacturaDTO enviarFacturaWS(ParamEnviaFacturaDTO dto)
{
ResultadoEnviaFacturaDTO resultado = new ResultadoEnviaFacturaDTO(); ResultadoEnviaFacturaDTO resultado = new ResultadoEnviaFacturaDTO();
TransactionFaultDTO tf = resultado.getTransFault(); TransactionFaultDTO tf = resultado.getTransFault();
RespSAPEnvFacturaDTO envio = resultado.getEnvioFactura(); RespSAPEnvFacturaDTO envio = resultado.getEnvioFactura();
try try {
{
LOG.debug("Parametros recibidos: "); LOG.debug("Parametros recibidos: ");
LOG.debug(" sociedad: _" +dto.getSociedad()+"_"); LOG.debug(" sociedad: _" + dto.getSociedad() + "_");
LOG.debug(" referencia: _" +dto.getReferencia()+"_"); LOG.debug(" referencia: _" + dto.getReferencia() + "_");
LOG.debug(" indicador: _" +dto.getIndicador()+"_"); LOG.debug(" indicador: _" + dto.getIndicador() + "_");
LOG.debug(" tipoDoc: _" +dto.getTipoDoc()+"_"); LOG.debug(" tipoDoc: _" + dto.getTipoDoc() + "_");
LOG.debug(" fechaContabilizacion: _" +dto.getFechaContabilizacion()+"_"); LOG.debug(" fechaContabilizacion: _" + dto.getFechaContabilizacion() + "_");
LOG.debug(" fechaFactura: _" +dto.getFechaFactura()+"_"); LOG.debug(" fechaFactura: _" + dto.getFechaFactura() + "_");
LOG.debug(" moneda: _" +dto.getMoneda()+"_"); LOG.debug(" moneda: _" + dto.getMoneda() + "_");
LOG.debug(" texto: _" +dto.getTexto()+"_"); LOG.debug(" texto: _" + dto.getTexto() + "_");
LOG.debug(" monto: _" +dto.getMonto()+"_"); LOG.debug(" monto: _" + dto.getMonto() + "_");
LOG.debug(" Item: _" +dto.getItems().size()+"_"); LOG.debug(" Item: _" + dto.getItems().size() + "_");
DTFactura params = new DTFactura(); DTFactura params = new DTFactura();
...@@ -642,8 +558,7 @@ public class ContratoWSBO ...@@ -642,8 +558,7 @@ public class ContratoWSBO
//--Detalle //--Detalle
int lnuTotalItems = dto.getItems().size(); int lnuTotalItems = dto.getItems().size();
for(int xItem=0; xItem < lnuTotalItems; xItem++) for (int xItem = 0; xItem < lnuTotalItems; xItem++) {
{
DTFactura.Factura.Posicion item = new DTFactura.Factura.Posicion(); DTFactura.Factura.Posicion item = new DTFactura.Factura.Posicion();
item.setCantidad(dto.getItems().get(xItem).getCantidad()); item.setCantidad(dto.getItems().get(xItem).getCantidad());
item.setImporte(dto.getItems().get(xItem).getImporte()); item.setImporte(dto.getItems().get(xItem).getImporte());
...@@ -657,16 +572,15 @@ public class ContratoWSBO ...@@ -657,16 +572,15 @@ public class ContratoWSBO
//-- Llamado a WS SAP. Interfaz 14 //-- Llamado a WS SAP. Interfaz 14
DTFacturasRes responseEnviaFactura = new DTFacturasRes(); DTFacturasRes responseEnviaFactura = new DTFacturasRes();
LOG.debug ( " Url Interfaz 14: " + this.getUrlServicio("14") ); LOG.debug(" Url Interfaz 14: " + this.getUrlServicio("14"));
responseEnviaFactura = (DTFacturasRes) wsContratosSAP.marshalSendAndReceive(this.getUrlServicio("14"), params); responseEnviaFactura = (DTFacturasRes) wsContratosSAP.marshalSendAndReceive(this.getUrlServicio("14"), params);
if(responseEnviaFactura != null && responseEnviaFactura.getRespuesta() != null) if (responseEnviaFactura != null && responseEnviaFactura.getRespuesta() != null) {
{
DTFacturasRes.Respuesta rSAP = responseEnviaFactura.getRespuesta(); DTFacturasRes.Respuesta rSAP = responseEnviaFactura.getRespuesta();
LOG.info(" "); LOG.info(" ");
LOG.info(" [INI] Detalle respuesta devuelta por SAP [Envia Factura]:"); LOG.info(" [INI] Detalle respuesta devuelta por SAP [Envia Factura]:");
LOG.info(" <Factura:["+rSAP.getFactura()+"], Status:["+rSAP.getStatus()+"], Mensaje:["+rSAP.getMensaje()+"]>"); LOG.info(" <Factura:[" + rSAP.getFactura() + "], Status:[" + rSAP.getStatus() + "], Mensaje:[" + rSAP.getMensaje() + "]>");
LOG.info(" [FIN] Detalle respuesta devuelta por SAP [Envia Factura]:"); LOG.info(" [FIN] Detalle respuesta devuelta por SAP [Envia Factura]:");
LOG.info(" "); LOG.info(" ");
...@@ -676,8 +590,7 @@ public class ContratoWSBO ...@@ -676,8 +590,7 @@ public class ContratoWSBO
resultado.setResultado(true); resultado.setResultado(true);
}//Ends if(responseEnviaFactura != null && responseEnviaFactura.getRespuesta() != null) }//Ends if(responseEnviaFactura != null && responseEnviaFactura.getRespuesta() != null)
else else {
{
tf.setInternalCode("DDA-EF-004"); tf.setInternalCode("DDA-EF-004");
tf.setComponent(COMPONENTE); tf.setComponent(COMPONENTE);
tf.setFaultDescription(ERROR_COMUNICACION_SAP); tf.setFaultDescription(ERROR_COMUNICACION_SAP);
...@@ -687,9 +600,7 @@ public class ContratoWSBO ...@@ -687,9 +600,7 @@ public class ContratoWSBO
} }
return resultado; return resultado;
} } catch (WebServiceException c) {
catch(WebServiceException c)
{
tf.setInternalCode("DDA-EF-001"); tf.setInternalCode("DDA-EF-001");
tf.setComponent(COMPONENTE); tf.setComponent(COMPONENTE);
tf.setFaultDescription(ERROR_COMUNICACION_SAP); tf.setFaultDescription(ERROR_COMUNICACION_SAP);
...@@ -697,9 +608,7 @@ public class ContratoWSBO ...@@ -697,9 +608,7 @@ public class ContratoWSBO
tf.setMethod("enviarFacturaWS"); tf.setMethod("enviarFacturaWS");
resultado.setResultado(false); resultado.setResultado(false);
return resultado; return resultado;
} } catch (SoapFaultClientException se) {
catch(SoapFaultClientException se)
{
tf.setInternalCode("DDA-EF-002"); tf.setInternalCode("DDA-EF-002");
tf.setComponent(COMPONENTE); tf.setComponent(COMPONENTE);
tf.setFaultDescription(ERROR_INTERNO_SAP); tf.setFaultDescription(ERROR_INTERNO_SAP);
...@@ -707,9 +616,7 @@ public class ContratoWSBO ...@@ -707,9 +616,7 @@ public class ContratoWSBO
tf.setMethod("enviarFacturaWS"); tf.setMethod("enviarFacturaWS");
resultado.setResultado(false); resultado.setResultado(false);
return resultado; return resultado;
} } catch (Exception e) {
catch(Exception e)
{
tf.setInternalCode("DDA-EF-003"); tf.setInternalCode("DDA-EF-003");
tf.setComponent(COMPONENTE); tf.setComponent(COMPONENTE);
tf.setFaultDescription(ERROR_PROCESO); tf.setFaultDescription(ERROR_PROCESO);
...@@ -720,10 +627,8 @@ public class ContratoWSBO ...@@ -720,10 +627,8 @@ public class ContratoWSBO
} }
} }
private String getUrlServicio(String pNumInterfaz) private String getUrlServicio(String pNumInterfaz) {
{ String urlServicio = env.getProperty(AMBIENTE + ".clientws.interface.i" + pNumInterfaz).replaceAll("%servidor%", SERVIDOR).replaceAll("%puerto%", PUERTO);
String urlServicio = env.getProperty(AMBIENTE+".clientws.interface.i"+pNumInterfaz).replaceAll("%servidor%", SERVIDOR).replaceAll("%puerto%", PUERTO);
return urlServicio; return urlServicio;
} }
} }
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -43,5 +43,6 @@ public interface IContratoDAO ...@@ -43,5 +43,6 @@ public interface IContratoDAO
public String obtenerUltimaPosicionRegSinDocMaterial(String pstIdContrato) throws Exception; public String obtenerUltimaPosicionRegSinDocMaterial(String pstIdContrato) throws Exception;
public List<QryMontosAnualesCntDTO> obtenerMontosAnualesPorContrato(String pstIdContrato) throws Exception; public List<QryMontosAnualesCntDTO> obtenerMontosAnualesPorContrato(String pstIdContrato) throws Exception;
public List<ContratoSAPDTO> obtenerMontoAnualReportadoSAP(String pstIdContrato, String pstAnnio) throws Exception; public List<ContratoSAPDTO> obtenerMontoAnualReportadoSAP(String pstIdContrato, String pstAnnio) throws Exception;
public boolean actualizaContratoEstatusSap(String lstIdContrato, String mensaje) throws Exception;
} }
package mx.com.amx.mx.dda.ws.service; package mx.com.amx.mx.dda.ws.service;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.util.ArrayList;
import java.util.List;
import java.util.Properties; import java.util.Properties;
import java.util.regex.Pattern;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.core.env.Environment;
import org.springframework.http.HttpHeaders; import org.springframework.http.HttpHeaders;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
...@@ -30,201 +23,156 @@ import mx.com.amx.mx.dda.ws.dto.ResponseOrdenCompraDTO; ...@@ -30,201 +23,156 @@ import mx.com.amx.mx.dda.ws.dto.ResponseOrdenCompraDTO;
@Controller @Controller
@RequestMapping("contrato") @RequestMapping("contrato")
public class ContratoService public class ContratoService {
{
protected final Logger LOG = Logger.getLogger(this.getClass().getSimpleName()); protected final Logger LOG = Logger.getLogger(this.getClass().getSimpleName());
private final String ARCHIVO_PROPIEDADES = "/general.properties"; private final String ARCHIVO_PROPIEDADES = "/general.properties";
Properties env = new Properties(); Properties env = new Properties();
private String ERROR_PROCESO; private String ERROR_PROCESO;
@Autowired @Autowired
private ContratoBO contratoBO; private ContratoBO contratoBO;
public ContratoService() public ContratoService() {
{
super(); super();
try try {
{ env.load(this.getClass().getResourceAsStream(ARCHIVO_PROPIEDADES));
env.load( this.getClass().getResourceAsStream( ARCHIVO_PROPIEDADES ) );
ERROR_PROCESO = env.getProperty("error.proceso"); ERROR_PROCESO = env.getProperty("error.proceso");
} } catch (Exception e) {
catch(Exception e) LOG.error(">Constructor[" + this.getClass().getSimpleName() + "] Ocurrio un error : " + e.getMessage());
{
LOG.error(">Constructor["+this.getClass().getSimpleName()+"] Ocurrio un error : " + e.getMessage() );
} }
} }
/* --------------------------------------------------------------------------------- Methods */ /* --------------------------------------------------------------------------------- Methods */
@RequestMapping( value = "/registrarSAPSuscripcion" , method=RequestMethod.POST , headers="Accept=application/json; charset=utf-8", produces = "application/json; charset=utf-8" ) @RequestMapping(value = "/registrarSAPSuscripcion", method = RequestMethod.POST, headers = "Accept=application/json; charset=utf-8", produces = "application/json; charset=utf-8")
@ResponseBody @ResponseBody
public ResponseOrdenCompraDTO registrarSAPSuscripcion(@RequestHeader HttpHeaders headers, @RequestBody ParamOrdenCompraDTO dto) public ResponseOrdenCompraDTO registrarSAPSuscripcion(@RequestHeader HttpHeaders headers, @RequestBody ParamOrdenCompraDTO dto) {
{
ResponseOrdenCompraDTO resultado = new ResponseOrdenCompraDTO(); ResponseOrdenCompraDTO resultado = new ResponseOrdenCompraDTO();
try try {
{
resultado = contratoBO.registrarSAPSuscripcion(dto); resultado = contratoBO.registrarSAPSuscripcion(dto);
return resultado; return resultado;
} } catch (Exception e) {
catch(Exception e) LOG.error(" Error al ejecutar el proceso registrar SAP Suscripcion (crear orden de Compra): " + e.getMessage());
{
LOG.error(" Error al ejecutar el proceso registrar SAP Suscripcion (crear orden de Compra): " + e.getMessage() );
resultado.setResultado(false); resultado.setResultado(false);
resultado.setMensaje("DDA-RSS-003: "+ ERROR_PROCESO); resultado.setMensaje("DDA-RSS-003: " + ERROR_PROCESO);
return resultado; return resultado;
} }
} }
@RequestMapping(value = "/registrarSAPEnmiendaSuscripcion", method = RequestMethod.POST, headers = "Accept=application/json; charset=utf-8", produces = "application/json; charset=utf-8")
@RequestMapping( value = "/registrarSAPEnmiendaSuscripcion" , method=RequestMethod.POST , headers="Accept=application/json; charset=utf-8", produces = "application/json; charset=utf-8" )
@ResponseBody @ResponseBody
public ResponseAdendumEnmiendaDTO registrarSAPEnmiendaSuscripcion(@RequestHeader HttpHeaders headers, @RequestBody ParamAdendumEnmiendaDTO dto) public ResponseAdendumEnmiendaDTO registrarSAPEnmiendaSuscripcion(@RequestHeader HttpHeaders headers, @RequestBody ParamAdendumEnmiendaDTO dto) {
{
ResponseAdendumEnmiendaDTO resultado = new ResponseAdendumEnmiendaDTO(); ResponseAdendumEnmiendaDTO resultado = new ResponseAdendumEnmiendaDTO();
try try {
{
resultado = contratoBO.registrarSAPEnmiendaSuscripcion(dto); resultado = contratoBO.registrarSAPEnmiendaSuscripcion(dto);
return resultado; return resultado;
} } catch (Exception e) {
catch(Exception e) LOG.error(" Error al ejecutar el proceso de registrar SAP Enmienda Suscripcion (crear Adendum/Enmienda): " + e.getMessage());
{
LOG.error(" Error al ejecutar el proceso de registrar SAP Enmienda Suscripcion (crear Adendum/Enmienda): " + e.getMessage() );
resultado.setResultado(false); resultado.setResultado(false);
resultado.setMensaje("DDA-RSES-005: "+ ERROR_PROCESO); resultado.setMensaje("DDA-RSES-005: " + ERROR_PROCESO);
return resultado; return resultado;
} }
} }
@RequestMapping(value = "/registrarSAPLicenseFee", method = RequestMethod.POST, headers = "Accept=application/json; charset=utf-8", produces = "application/json; charset=utf-8")
@RequestMapping( value = "/registrarSAPLicenseFee" , method=RequestMethod.POST , headers="Accept=application/json; charset=utf-8", produces = "application/json; charset=utf-8" )
@ResponseBody @ResponseBody
public ResponseOrdenCompraDTO registrarSAPLicenseFee(@RequestHeader HttpHeaders headers, @RequestBody ParamOrdenCompraDTO dto) public ResponseOrdenCompraDTO registrarSAPLicenseFee(@RequestHeader HttpHeaders headers, @RequestBody ParamOrdenCompraDTO dto) {
{
ResponseOrdenCompraDTO resultado = new ResponseOrdenCompraDTO(); ResponseOrdenCompraDTO resultado = new ResponseOrdenCompraDTO();
try try {
{
resultado = contratoBO.registrarSAPLicenseFee(dto); resultado = contratoBO.registrarSAPLicenseFee(dto);
return resultado; return resultado;
} } catch (Exception e) {
catch(Exception e) LOG.error(" Error al ejecutar el proceso registrar SAP License Fee(registro SAP No Amortizable): " + e.getMessage());
{
LOG.error(" Error al ejecutar el proceso registrar SAP License Fee(registro SAP No Amortizable): " + e.getMessage() );
resultado.setResultado(false); resultado.setResultado(false);
resultado.setMensaje("DDA-RSLF-006: "+ ERROR_PROCESO); resultado.setMensaje("DDA-RSLF-006: " + ERROR_PROCESO);
return resultado; return resultado;
} }
} }
@RequestMapping(value = "/registrarSAPEnmiendaLicenseFee", method = RequestMethod.POST, headers = "Accept=application/json; charset=utf-8", produces = "application/json; charset=utf-8")
@RequestMapping( value = "/registrarSAPEnmiendaLicenseFee" , method=RequestMethod.POST , headers="Accept=application/json; charset=utf-8", produces = "application/json; charset=utf-8" )
@ResponseBody @ResponseBody
public ResponseAdendumEnmiendaDTO registrarSAPEnmiendaLicenseFee(@RequestHeader HttpHeaders headers, @RequestBody ParamAdendumEnmiendaDTO dto) public ResponseAdendumEnmiendaDTO registrarSAPEnmiendaLicenseFee(@RequestHeader HttpHeaders headers, @RequestBody ParamAdendumEnmiendaDTO dto) {
{
ResponseAdendumEnmiendaDTO resultado = new ResponseAdendumEnmiendaDTO(); ResponseAdendumEnmiendaDTO resultado = new ResponseAdendumEnmiendaDTO();
try try {
{
resultado = contratoBO.registrarSAPEnmiendaLicenseFee(dto); resultado = contratoBO.registrarSAPEnmiendaLicenseFee(dto);
return resultado; return resultado;
} } catch (Exception e) {
catch(Exception e) LOG.error(" Error al ejecutar el proceso registrar SAP Enmienda License Fee (Adendum/Enmienda No Amortizable): " + e.getMessage());
{
LOG.error(" Error al ejecutar el proceso registrar SAP Enmienda License Fee (Adendum/Enmienda No Amortizable): " + e.getMessage() );
resultado.setResultado(false); resultado.setResultado(false);
resultado.setMensaje("DDA-RSELF-005: "+ ERROR_PROCESO); resultado.setMensaje("DDA-RSELF-005: " + ERROR_PROCESO);
return resultado; return resultado;
} }
} }
@RequestMapping(value = "/registrarSAPEnmiendaTransaccional", method = RequestMethod.POST, headers = "Accept=application/json; charset=utf-8", produces = "application/json; charset=utf-8")
@RequestMapping( value = "/registrarSAPEnmiendaTransaccional" , method=RequestMethod.POST , headers="Accept=application/json; charset=utf-8", produces = "application/json; charset=utf-8" )
@ResponseBody @ResponseBody
public ResponseAdendumEnmiendaDTO registrarSAPEnmiendaTransaccional(@RequestHeader HttpHeaders headers, @RequestBody ParamAdendumEnmiendaDTO dto) public ResponseAdendumEnmiendaDTO registrarSAPEnmiendaTransaccional(@RequestHeader HttpHeaders headers, @RequestBody ParamAdendumEnmiendaDTO dto) {
{
ResponseAdendumEnmiendaDTO resultado = new ResponseAdendumEnmiendaDTO(); ResponseAdendumEnmiendaDTO resultado = new ResponseAdendumEnmiendaDTO();
try try {
{
resultado = contratoBO.registrarSAPEnmiendaTransaccional(dto); resultado = contratoBO.registrarSAPEnmiendaTransaccional(dto);
return resultado; return resultado;
} } catch (Exception e) {
catch(Exception e) LOG.error(" Error al ejecutar el proceso registrar SAP Enmienda Transaccional: " + e.getMessage());
{
LOG.error(" Error al ejecutar el proceso registrar SAP Enmienda Transaccional: " + e.getMessage() );
resultado.setResultado(false); resultado.setResultado(false);
resultado.setMensaje("DDA-RSETR-005: "+ ERROR_PROCESO); resultado.setMensaje("DDA-RSETR-005: " + ERROR_PROCESO);
return resultado; return resultado;
} }
} }
@RequestMapping(value = "/notificarInventarioTitulos", method = RequestMethod.POST, headers = "Accept=application/json; charset=utf-8", produces = "application/json; charset=utf-8")
@RequestMapping( value = "/notificarInventarioTitulos" , method=RequestMethod.POST , headers="Accept=application/json; charset=utf-8", produces = "application/json; charset=utf-8" )
@ResponseBody @ResponseBody
public ResponseNotificarInventarioTitulosDTO notificarInventarioTitulos(@RequestHeader HttpHeaders headers, @RequestBody ParamInventarioTitulosDTO dto) public ResponseNotificarInventarioTitulosDTO notificarInventarioTitulos(@RequestHeader HttpHeaders headers, @RequestBody ParamInventarioTitulosDTO dto) {
{
ResponseNotificarInventarioTitulosDTO resultado = new ResponseNotificarInventarioTitulosDTO(); ResponseNotificarInventarioTitulosDTO resultado = new ResponseNotificarInventarioTitulosDTO();
try try {
{
resultado = contratoBO.notificarInventarioTitulos(dto); resultado = contratoBO.notificarInventarioTitulos(dto);
return resultado; return resultado;
} } catch (Exception e) {
catch(Exception e) LOG.error(" Error al hacer la notificacion de Inventario de Titulos: " + e.getMessage());
{
LOG.error(" Error al hacer la notificacion de Inventario de Titulos: " + e.getMessage() );
resultado.setResultado(false); resultado.setResultado(false);
resultado.setMensaje("DDA-NIT-004: "+ ERROR_PROCESO); resultado.setMensaje("DDA-NIT-004: " + ERROR_PROCESO);
return resultado; return resultado;
} }
} }
@RequestMapping( value = "/registrarSAPTransaccional" , method=RequestMethod.POST , headers="Accept=application/json; charset=utf-8", produces = "application/json; charset=utf-8" ) @RequestMapping(value = "/registrarSAPTransaccional", method = RequestMethod.POST, headers = "Accept=application/json; charset=utf-8", produces = "application/json; charset=utf-8")
@ResponseBody @ResponseBody
public ResponseOrdenCompraDTO registrarSAPTransaccional(@RequestHeader HttpHeaders headers, @RequestBody ParamOrdenCompraDTO dto) public ResponseOrdenCompraDTO registrarSAPTransaccional(@RequestHeader HttpHeaders headers, @RequestBody ParamOrdenCompraDTO dto) {
{
ResponseOrdenCompraDTO resultado = new ResponseOrdenCompraDTO(); ResponseOrdenCompraDTO resultado = new ResponseOrdenCompraDTO();
try try {
{
resultado = contratoBO.registrarSAPTransaccional(dto); resultado = contratoBO.registrarSAPTransaccional(dto);
return resultado; return resultado;
} } catch (Exception e) {
catch(Exception e) LOG.error(" Error al ejecutar el proceso registrar SAP Transaccional: " + e.getMessage());
{
LOG.error(" Error al ejecutar el proceso registrar SAP Transaccional: " + e.getMessage() );
resultado.setResultado(false); resultado.setResultado(false);
resultado.setMensaje("DDA-RST-005: "+ ERROR_PROCESO); resultado.setMensaje("DDA-RST-005: " + ERROR_PROCESO);
return resultado; return resultado;
} }
} }
@RequestMapping(value = "/notificarFactura", method = RequestMethod.POST, headers = "Accept=application/json; charset=utf-8", produces = "application/json; charset=utf-8")
@RequestMapping( value = "/notificarFactura" , method=RequestMethod.POST , headers="Accept=application/json; charset=utf-8", produces = "application/json; charset=utf-8" )
@ResponseBody @ResponseBody
public ResponseNotificarFacturaDTO notificarFactura(@RequestHeader HttpHeaders headers, @RequestBody ParamNotificaFacturaDTO dto) public ResponseNotificarFacturaDTO notificarFactura(@RequestHeader HttpHeaders headers, @RequestBody ParamNotificaFacturaDTO dto) {
{
ResponseNotificarFacturaDTO resultado = new ResponseNotificarFacturaDTO(); ResponseNotificarFacturaDTO resultado = new ResponseNotificarFacturaDTO();
try try {
{
resultado = contratoBO.notificarFactura(dto); resultado = contratoBO.notificarFactura(dto);
return resultado; return resultado;
} } catch (Exception e) {
catch(Exception e) LOG.error(" Error al ejecutar el proceso de notificar Factura: " + e.getMessage());
{
LOG.error(" Error al ejecutar el proceso de notificar Factura: " + e.getMessage() );
resultado.setResultado(false); resultado.setResultado(false);
resultado.setMensaje("DDA-NF-007: "+ ERROR_PROCESO); resultado.setMensaje("DDA-NF-007: " + ERROR_PROCESO);
return resultado; return resultado;
} }
} }
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment