From 92581b0d81e5e8cc7a5afe120908b22f2daf730f Mon Sep 17 00:00:00 2001 From: alexmorenograu <61759297+alexmorenograu@users.noreply.github.com> Date: Fri, 6 Aug 2021 08:04:22 +0200 Subject: [PATCH] change attrName and itemTitle and update flashOn --- methods/bindShelvingTag.js | 7 ++++--- methods/bindTicketShelving.js | 4 ++-- methods/flashOn.js | 12 +++++------- 3 files changed, 11 insertions(+), 12 deletions(-) diff --git a/methods/bindShelvingTag.js b/methods/bindShelvingTag.js index a27a768..daec711 100644 --- a/methods/bindShelvingTag.js +++ b/methods/bindShelvingTag.js @@ -49,14 +49,14 @@ async function insertShelving(shelvingId, smartTagFk) { json: { agencyId: currentUser.agencyId, merchantId: currentUser.merchantId, - storeId: currentUser.storeId, + storeId: config.storeId, unitName: currentUser.unitName, itemList: [ { attrCategory: 'verdnatura', // Plantilla - attrName: 'sinTicket', // Tipo de Plantilla + attrName: 'withOutTicket', // Tipo de Plantilla barCode: shelvingId, // Matricula + nivel --> Cod.Barras artículo - itemTitle: 'Etiqueta Sin ticket', + itemTitle: 'tagWithOutTicket', qrCode: shelvingId } ] @@ -66,6 +66,7 @@ async function insertShelving(shelvingId, smartTagFk) { 'Authorization': key } }); + console.log(config.storeId); await bindShelving(smartTagFk, shelvingId); console.log('Insert Shelving:', body); })(); diff --git a/methods/bindTicketShelving.js b/methods/bindTicketShelving.js index 6d2b41a..9408aad 100644 --- a/methods/bindTicketShelving.js +++ b/methods/bindTicketShelving.js @@ -40,9 +40,9 @@ function insertTicket(consultaSql) { itemList: [ { attrCategory: 'verdnatura', - attrName: 'conTicket', + attrName: 'withTicket', barCode: consultaSql[i].shelvingFk + consultaSql[i].level, // Matricula + nivel - itemTitle: 'Etiqueta Con ticket', + itemTitle: 'tagWithTicket', productCode: consultaSql[i].ticketFk, // Ticket qrCode: consultaSql[i].ticketFk, custFeature1: consultaSql[i].clientFk, // Cliente diff --git a/methods/flashOn.js b/methods/flashOn.js index b024a2c..4816a94 100644 --- a/methods/flashOn.js +++ b/methods/flashOn.js @@ -1,10 +1,11 @@ const express = require('express'); const router = express.Router(); // eslint-disable-line const select = require('../db/selectTicket'); +const config = require('../config'); router.get('/:ticket', async(req, res) => { const ticket = req.params.ticket; - console.log(ticket); + // console.log(ticket); searchTicket(ticket); res.json({message: 'SUCCESS'}); }); @@ -13,28 +14,25 @@ module.exports = router; function searchTicket(ticket) {// parametro ticketFk select.select(ticket, function(err, data) { - console.log(data); insertFlash(data); }); - // insertFlash(); } -function insertFlash(consultaSql) { +function insertFlash(qrySql) { // console.log('CONSULTASQL_TAMAÑO:', consultaSql.length); const dataLogIn = require('../server'); const got = require('got'); (async() => { const info = await dataLogIn.dataLogIn; let key = info.data.token; - let currentUser = info.data.currentUser; (async() => { const {body} = await got.post('http://app.etiquetaselectronicas.com:9999/led/excuteLed', { // eslint-disable-line json: { - storeId: currentUser.storeId, + storeId: config.storeId, lightColor: 8, lightTime: 30, - targetExecution: 1, // consultaSql[0].shelvingFk + consultaSql[0].level + '/Etiqueta Con Ticket', + targetExecution: qrySql.shelvingFk + '/tagWithTicket', lightFrequency: 1 }, responseType: 'json',