flashOn prepare
This commit is contained in:
parent
fb791d4e99
commit
8d7d26ebd4
|
@ -1,11 +1,7 @@
|
|||
const con = require('./connect');
|
||||
|
||||
function select(ticket, callback) {
|
||||
let consSql = `SELECT st.ticketFk AS Ticket, st.shelvingFk AS Shelving, st.level AS Level, t.clientFk AS Client, am.name AS Agency
|
||||
FROM smartTag st JOIN ticket t ON st.ticketFk = t.id JOIN client c ON t.clientFk = c.id
|
||||
JOIN agencyMode am ON am.id = t.agencyModeFk
|
||||
WHERE st.ticketFk = ${ticket}`;
|
||||
|
||||
let consSql = `SELECT * FROM vn.collectionSmartTag WHERE ticketFk = ${ticket}`;
|
||||
con.con.query(consSql, function(err, result, fields) {
|
||||
callback(null, result);
|
||||
});
|
||||
|
|
|
@ -7,6 +7,7 @@ router.get('/:collectionFk', async(req, res) => {
|
|||
const collectionFk = req.params.collectionFk;
|
||||
console.log(collectionFk);
|
||||
ticketShelving(collectionFk);
|
||||
res.json({message: 'SUCCESS'});
|
||||
});
|
||||
module.exports = router;
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@ router.get('/:ticket', async(req, res) => {
|
|||
const ticket = req.params.ticket;
|
||||
console.log(ticket);
|
||||
searchTicket(ticket);
|
||||
res.json({message: 'SUCCESS'});
|
||||
});
|
||||
|
||||
module.exports = router;
|
||||
|
@ -27,35 +28,34 @@ function insertFlash(consultaSql) {
|
|||
let currentUser = info.data.currentUser;
|
||||
|
||||
(async() => {
|
||||
for (let i = 0; i < consultaSql.length; i++) {
|
||||
const {body} = await got.post('http://app.etiquetaselectronicas.com:9999/item/batchImportItem', { // eslint-disable-line
|
||||
json: {
|
||||
agencyId: currentUser.agencyId,
|
||||
merchantId: currentUser.merchantId,
|
||||
storeId: currentUser.storeId,
|
||||
unitName: currentUser.unitName,
|
||||
itemList: [
|
||||
{
|
||||
attrCategory: 'verdnatura',
|
||||
attrName: 'conTicket',
|
||||
barCode: consultaSql[i].shelvingFk + consultaSql[i].level, // Matricula + nivel
|
||||
itemTitle: 'Etiqueta Con ticket',
|
||||
productCode: consultaSql[i].ticketFk, // Ticket
|
||||
custFeature1: consultaSql[i].clientFk, // Cliente
|
||||
custFeature2: consultaSql[i].agencyFk, // Agencia de transporte
|
||||
custFeature3: 1, // Valor luz led
|
||||
custFeature4: consultaSql[i].workerFk, // Trabajador
|
||||
|
||||
}
|
||||
]
|
||||
},
|
||||
responseType: 'json',
|
||||
headers: {
|
||||
'Authorization': key
|
||||
}
|
||||
});
|
||||
console.log(body);
|
||||
}
|
||||
const {body} = await got.post('http://app.etiquetaselectronicas.com:9999/item/batchImportItem', { // 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
|
||||
}
|
||||
]
|
||||
},
|
||||
responseType: 'json',
|
||||
headers: {
|
||||
'Authorization': key
|
||||
}
|
||||
});
|
||||
console.log(body);
|
||||
})();
|
||||
})();
|
||||
}
|
||||
|
|
Reference in New Issue