update connection DB
This commit is contained in:
parent
2d2955a073
commit
deb0d40788
|
@ -1,9 +1,7 @@
|
|||
const con = require('./connect');
|
||||
|
||||
function insertDB(barcode, shelving, level) {
|
||||
con.con.connect(function(err) {
|
||||
if (err) throw err;
|
||||
let sql = `IF EXISTS(SELECT * FROM vn.smartTag WHERE code='${barcode}')
|
||||
let sql = `IF EXISTS(SELECT * FROM vn.smartTag WHERE code='${barcode}')
|
||||
THEN
|
||||
UPDATE vn.smartTag
|
||||
SET shelvingFk = '${shelving}', level = ${level}
|
||||
|
@ -13,9 +11,8 @@ function insertDB(barcode, shelving, level) {
|
|||
INTO vn.smartTag (code, shelvingFk, level)
|
||||
VALUES ('${barcode}', '${shelving}', ${level});
|
||||
END IF;`;
|
||||
con.con.query(sql, function(err, result) {
|
||||
if (err) throw err;
|
||||
});
|
||||
con.con.query(sql, function(err, result) {
|
||||
if (err) throw err;
|
||||
});
|
||||
}
|
||||
exports.insertDB = insertDB;
|
||||
|
|
|
@ -2,10 +2,13 @@ const express = require('express');
|
|||
const app = express();
|
||||
const port = 9999;
|
||||
const logIn = require('./methods/logIn');
|
||||
const con = require('./db/connect');
|
||||
|
||||
const dataLogIn = logIn.info;
|
||||
exports.dataLogIn = dataLogIn;
|
||||
|
||||
con.con.connect(function(err) {});
|
||||
|
||||
app.use('/getNumShelving', require('./methods/setCollection'));
|
||||
app.use('/insertTicket', require('./methods/bindTicketShelving'));
|
||||
app.use('/bindShelving', require('./methods/bindShelvingTag'));
|
||||
|
|
Reference in New Issue