add worker on tag

This commit is contained in:
alexmorenograu 2021-03-30 08:06:07 +02:00
parent 66ec22d8b3
commit 2d2955a073
5 changed files with 15 additions and 13 deletions

View File

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

View File

@ -1,10 +1,12 @@
const con = require('./connect');
function select(collectionFk, callback) {
let consSql = `SELECT t.id AS Ticket, c.name AS Client, am.name AS Agency, tc.level AS Level, tc.wagon AS Wagon
let consSql = `SELECT t.id AS Ticket, t.clientFk AS Client, am.name AS Agency, tc.level AS Level, tc.wagon AS Wagon, w.code AS Worker
FROM ticketCollection tc
JOIN ticket t ON t.id = tc.ticketFk JOIN client c ON t.clientFk = c.id
JOIN agencyMode am ON am.id = t.agencyModeFk
JOIN ticket t ON t.id = tc.ticketFk
JOIN collection c ON c.id = tc.collectionFk
JOIN worker w ON w.id = c.workerFk
JOIN agencyMode am ON am.id = t.agencyModeFk
WHERE tc.collectionFk = ${collectionFk}
ORDER BY tc.wagon, tc.level`;

View File

@ -1,7 +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, c.name AS Client, am.name AS Agency
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}`;

View File

@ -39,6 +39,7 @@ function insertTicket(consultaSql, shelving) {
(async() => {
for (let i = 0; i < consultaSql.length; i++) {
for (let j = 0; j < consultaSql[i].Level.toString().length; j++) {
console.log('SHELVING: ', shelving[consultaSql[i].Wagon - 1]);
const {body} = await got.post('http://app.etiquetaselectronicas.com:9999/item/batchImportItem', { // eslint-disable-line
json: {
agencyId: currentUser.agencyId,
@ -53,7 +54,9 @@ function insertTicket(consultaSql, shelving) {
itemTitle: 'Etiqueta Con ticket',
productCode: consultaSql[i].Ticket, // Ticket
custFeature1: consultaSql[i].Client, // Client
custFeature2: consultaSql[i].Agency // Agencia de transporte
custFeature2: consultaSql[i].Agency, // Agencia de transporte
custFeature3: 0, // Agencia de transporte
custFeature4: consultaSql[i].Worker, // Agencia de transporte
}
]
},

View File

@ -37,7 +37,7 @@ function insertFlash(consultaSql) {
itemList: [
{
attrCategory: 'verdnatura',
attrName: 'sinTicket',
attrName: 'conTicket',
barCode: consultaSql[i].Shelving + consultaSql[i].Level, // Matricula + nivel
itemTitle: 'Etiqueta Con ticket',
productCode: consultaSql[i].Ticket, // Ticket