Update insertTickets

This commit is contained in:
alexmorenograu 2021-07-01 08:55:17 +02:00
parent 8d7d26ebd4
commit 3363667e5c
4 changed files with 13 additions and 29 deletions

View File

@ -1,9 +1,7 @@
const con = require('./connect');
function insertTicket(ticket, shelving, level) {
let sql = `UPDATE vn.smartTag
SET ticketFk = ${ticket}
WHERE level=${level} && shelvingFk='${shelving}';`;
function insertTicket(ticket, smartTag) {
let sql = `UPDATE vn.ticketCollection SET smartTagFk = '${smartTag}' WHERE ticketFk = ${ticket}`;
con.con.query(sql, function(err, result) {
if (err) throw err;
});

View File

@ -1,7 +1,7 @@
const con = require('./connect');
function selectCollectionSmartTag(collectionFk, callback) {
let consSql = `SELECT * FROM vn.collectionSmartTag WHERE collectionFk = ${collectionFk};`;
let consSql = `SELECT * FROM vn.collectionSmartTag2 WHERE collectionFk = ${collectionFk};`;
console.log(consSql);
con.con.query(consSql, function(err, result, fields) {
console.log(result);

View File

@ -47,9 +47,8 @@ function insertTicket(consultaSql) {
qrCode: consultaSql[i].ticketFk,
custFeature1: consultaSql[i].clientFk, // Cliente
custFeature2: consultaSql[i].agencyFk, // Agencia de transporte
custFeature3: 0, // Luz LED
custFeature4: '', // consultaSql[i].workerFk, // Trabajador
custFeature5: consultaSql[i].wagon, // Wagon
custFeature3: '', // consultaSql[i].workerFk, // Trabajador
custFeature4: consultaSql[i].wagon, // Wagon
}
]
},
@ -58,7 +57,7 @@ function insertTicket(consultaSql) {
'Authorization': key
}
});
insertTicketDB.insertTicket(consultaSql[i].ticketFk, consultaSql[i].shelvingFk, consultaSql[i].level);
insertTicketDB.insertTicket(consultaSql[i].ticketFk, consultaSql[i].code);
console.log(i, body);
}
})();

View File

@ -16,10 +16,11 @@ function searchTicket(ticket) {// parametro ticketFk
console.log(data);
insertFlash(data);
});
// insertFlash();
}
function insertFlash(consultaSql) {
console.log('CONSULTASQL_TAMAÑO:', consultaSql.length);
// console.log('CONSULTASQL_TAMAÑO:', consultaSql.length);
const dataLogIn = require('../server');
const got = require('got');
(async() => {
@ -28,27 +29,13 @@ function insertFlash(consultaSql) {
let currentUser = info.data.currentUser;
(async() => {
const {body} = await got.post('http://app.etiquetaselectronicas.com:9999/item/batchImportItem', { // eslint-disable-line
const {body} = await got.post('http://app.etiquetaselectronicas.com:9999/led/excuteLed', { // eslint-disable-line
json: {
agencyId: currentUser.agencyId,
merchantId: currentUser.merchantId,
storeId: currentUser.storeId,
unitName: currentUser.unitName,
itemList: [
{
attrCategory: 'verdnatura',
attrName: 'conTicket',
barCode: consultaSql[0].shelvingFk + consultaSql[0].level, // Matricula + nivel
itemTitle: 'Etiqueta Con ticket',
productCode: consultaSql[0].ticketFk, // Ticket
qrCode: consultaSql[0].ticketFk,
custFeature1: consultaSql[0].clientFk, // Cliente
custFeature2: consultaSql[0].agencyFk, // Agencia de transporte
custFeature3: 1, // Luz LED
custFeature4: '', // consultaSql[0].workerFk, // Trabajador
custFeature5: consultaSql[0].wagon, // Wagon
}
]
lightColor: 8,
lightTime: 30,
targetExecution: 1, // consultaSql[0].shelvingFk + consultaSql[0].level + '/Etiqueta Con Ticket',
lightFrequency: 1
},
responseType: 'json',
headers: {