diff --git a/db/insertSmartTag.js b/db/insertSmartTag.js index da98c2a..cd23c63 100644 --- a/db/insertSmartTag.js +++ b/db/insertSmartTag.js @@ -1,12 +1,9 @@ const con = require('./connect'); -function insertSmartTag(smartTagFk, shelving, level) { +module.exports = function insertSmartTag(smartTagFk, shelving, level) { const sql = `INSERT INTO vn.smartTag (code, shelvingFk, level) VALUES (?, ?, ?) ON DUPLICATE KEY UPDATE shelvingFk = ?, level = ?;`; - con.query(sql, [smartTagFk, shelving, level, shelving, level], function(err, result) { - if (err) console.log(err); - }); -} -exports.insertSmartTag = insertSmartTag; + con.query(sql, [smartTagFk, shelving, level, shelving, level]); +}; diff --git a/db/insertTicket.js b/db/insertTicket.js index 16aa8c1..385b73e 100644 --- a/db/insertTicket.js +++ b/db/insertTicket.js @@ -2,7 +2,7 @@ const con = require('./connect'); function insertTicket(ticket, smartTag) { const sql = `UPDATE vn.ticketCollection SET smartTagFk = ? WHERE ticketFk = ?`; - con.query(sql, smartTag, ticket, function(err, result) { + con.query(sql, [smartTag, ticket], function(err, result) { if (err) throw err; }); } diff --git a/methods/bindShelvingTag.js b/methods/bindShelvingTag.js index b836e1d..f08d672 100644 --- a/methods/bindShelvingTag.js +++ b/methods/bindShelvingTag.js @@ -29,7 +29,7 @@ async function bindShelvingTag(smartTagFk, shelving, level) { if (filter.isSmartTag(smartTagFk)) { if (await filter.isShelving(shelving)) { insertShelving(shelvingId, smartTagFk); // al carry en ESL CLOUD SYSTEM - insertSmartTag.insertSmartTag(smartTagFk, shelving, level); // en vn.smartTag + insertSmartTag(smartTagFk, shelving, level); // en vn.smartTag } else return 'INVALID_PLATE'; } else @@ -41,6 +41,7 @@ async function insertShelving(shelvingId, smartTagFk) { const info = await dataLogIn.dataLogIn; const key = info.data.token; const currentUser = info.data.currentUser; + await got.post('http://app.etiquetaselectronicas.com:9999/item/batchImportItem', { // eslint-disable-line json: { agencyId: currentUser.agencyId,