insert in DB
This commit is contained in:
parent
d83d73ce49
commit
89e3a1b465
|
@ -22,7 +22,6 @@ function bindShelving(barcode, shelving, level){
|
|||
})
|
||||
console.log(body)
|
||||
})();
|
||||
insertDB.insertDB(barcode, shelving, level);
|
||||
})();
|
||||
}
|
||||
exports.bindShelving = bindShelving;
|
|
@ -1,12 +1,14 @@
|
|||
const insertShelving = require('./insertShelving');
|
||||
const bindShelving = require('./bindShelving');
|
||||
const filter = require('./filter');
|
||||
const insertDB = require('./db/insertDB')
|
||||
|
||||
function bindShelvingTag(barcode, shelving, level){
|
||||
if(filter.filterBarcode(barcode)){
|
||||
if(filter.filterShelving(shelving)){
|
||||
insertShelving.insertShelving(shelving, level);
|
||||
bindShelving.bindShelving(barcode, shelving, level);
|
||||
insertDB.insertDB(barcode, shelving, level);
|
||||
}else{
|
||||
console.log("¡MATRICULA INCORRECTA!")
|
||||
}
|
||||
|
|
|
@ -4,10 +4,11 @@ function insertDB(barcode, shelving, level){
|
|||
con.con.connect(function(err) {
|
||||
if (err) throw err;
|
||||
console.log("Connected!");
|
||||
var sql = `INSERT INTO vn.smartTag (code, shelvingFk, level) VALUES (${barcode}, ${shelving}, ${level})`;
|
||||
var sql = `INSERT INTO vn.smartTag (code, shelvingFk, level) VALUES ('${barcode}', '${shelving}', ${level})`;
|
||||
con.con.query(sql, function (err, result) {
|
||||
if (err) throw err;
|
||||
console.log("1 record inserted");
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
exports.insertDB = insertDB;
|
Reference in New Issue