From 9c0759048361c60c5a02d74bbec6074ad385f8a8 Mon Sep 17 00:00:00 2001 From: dmunozv Date: Fri, 19 Jun 2026 15:57:20 -0400 Subject: [PATCH] cambios para visualizar data enviada --- src/services/envioDte.js | 16 +++------------- src/services/envioEstado.js | 4 ++-- src/services/envioGuia.js | 7 +------ src/utils/utils.js | 3 ++- 4 files changed, 8 insertions(+), 22 deletions(-) diff --git a/src/services/envioDte.js b/src/services/envioDte.js index e1e4e39..c8fbf4f 100644 --- a/src/services/envioDte.js +++ b/src/services/envioDte.js @@ -57,20 +57,17 @@ const envioDte = async () => { include: [PedidosHeader] }); - // console.log(JSON.stringify(dataEstados, null, 2)) const skuShipping = dataInfracommerce.skuShipping; for (const element of dataEstados) { const omsId = `${element.pedidos_header.IdOrdenOMS_ph}`; const url = dataInfracommerce.urlDte.replace(':oms_id', omsId); - // console.log(url); const urlDoc = element.pedidos_header.UrlDoc_ph; const pedido = element.pedido; let fechaRegistro = element.pedidos_header.FECREG_PH; fechaRegistro = moment(fechaRegistro).format("YYYY-MM-DD HH:mm:ss"); - console.log(pedido) const dataLvta = await Lvta.findOne({ where: { // NROPED_LV: { [Op.gt]: 0 }, @@ -85,8 +82,6 @@ const envioDte = async () => { }] }); - // console.log(JSON.stringify(dataLvta, null, 2)) - // return; let res; // for (const elementLvta of dataLvta) { @@ -152,17 +147,12 @@ const envioDte = async () => { }; } - - // console.log(JSON.stringify(payload, null, 2)) - // return - res = await sendRequestInfracommerce(payload, url); console.log(payload) - console.log(res) - + res = await sendRequestInfracommerce(payload, url); + // console.log(payload) Logger.info({ message: `Payload enviado: ${JSON.stringify(payload, null, 2)}`, proceso: 'cron' }); Logger.info({ message: `Respuesta del documento ${NRODOC_LV}: ${JSON.stringify(res, null, 2)}`, proceso: 'cron' }); - // console.log(JSON.stringify(res, null, 2)) // if (res) { @@ -176,7 +166,7 @@ const envioDte = async () => { // } // } // } - + if (res) { if (res.status) { if (res.status == "error") { diff --git a/src/services/envioEstado.js b/src/services/envioEstado.js index 90d35ca..6bafecd 100644 --- a/src/services/envioEstado.js +++ b/src/services/envioEstado.js @@ -132,14 +132,14 @@ const envioEstados = async () => { }, }); - console.log(element.pedido, JSON.stringify(dataEstado, null, 2)) + // console.log(element.pedido, JSON.stringify(dataEstado, null, 2)) if (dataEstado.pedido) { if ((dataEstado.estado < estadoSial)) { if (estadoSial == 3 || estadoSial == 4 || estadoSial == 5) { const res = await sendRequestInfracommerce(payload, url); - console.log(res) + // console.log(res) Logger.info({ message: `Estado de la orden ${omsId}: ${estadoEnvioUrbano}, resInfracommerce: ${JSON.stringify(res, null, 2)}`, proceso: 'cron' }); } diff --git a/src/services/envioGuia.js b/src/services/envioGuia.js index f1743bb..c0e2bdc 100644 --- a/src/services/envioGuia.js +++ b/src/services/envioGuia.js @@ -15,7 +15,6 @@ const enviarGuias = async (idGuia) => { const url = dataUrbano.url; const idContrato = dataUrbano.id_contrato; const linea = dataUrbano.linea; - // console.log(url, idContrato); const guias = await ParametrosGuia.findAll({ where: { @@ -122,7 +121,7 @@ const enviarGuias = async (idGuia) => { tipo_empaque: '', }; - + guias.forEach(async entry => { entry.set({ estado: 1 @@ -132,8 +131,6 @@ const enviarGuias = async (idGuia) => { const payload = dataGuia; - console.log(JSON.stringify(payload, null, 2)) - try { const res = await sendData(url, null, payload); await guardarRespuesta(idGuia, 1, res, payload); @@ -155,8 +152,6 @@ const guardarRespuesta = async (idGuia, estado = 1, respuesta, payloadRequest) = let dataRespuesta; if (respuesta.error >= 0) { - console.log("aca") - console.log(respuesta) dataRespuesta = { numeroguia: respuesta.guia, id: idGuia, diff --git a/src/utils/utils.js b/src/utils/utils.js index 0ed7e05..5e68bf9 100644 --- a/src/utils/utils.js +++ b/src/utils/utils.js @@ -42,7 +42,7 @@ const sendRequestInfracommerce = async (payload, url) => { // const url = dataEnvioEstados.url.replace(':oms_id', omsId); const { AppKey, AppToken } = dataInfracommerce; - console.log(AppKey, AppToken) + // console.log(AppKey, AppToken) try { const headers = { @@ -58,6 +58,7 @@ const sendRequestInfracommerce = async (payload, url) => { body: JSON.stringify(payload), }); + console.log(response) if (!response.ok) { const res = await response.json(); const data = JSON.stringify(res, null, 2);