cambios para visualizar data enviada

This commit is contained in:
2026-06-19 15:57:20 -04:00
parent 503ed37d09
commit 9c07590483
4 changed files with 8 additions and 22 deletions

View File

@@ -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") {

View File

@@ -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' });
}

View File

@@ -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,

View File

@@ -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);