This commit is contained in:
alexmorenograu 2021-03-18 16:24:51 +01:00
parent 8e9f736cde
commit cf3b5f5e03
1 changed files with 9 additions and 4 deletions

View File

@ -5,6 +5,7 @@ const select = require('../db/selectDB');
router.get('/:collectionShelving', async(req, res) => {
const collectionShelving = req.params.collectionShelving.split(',');
console.log(collectionShelving);
let collectionFk = 273449;
ticketShelving(collectionShelving, collectionFk);
res.json({message: 'SUCCESS'});
@ -14,12 +15,15 @@ module.exports = router;
function ticketShelving(collectionShelving, collectionFk) {// parametro collectionFk
select.select(collectionFk, function(err, data) {
// aqui iria una función para pedir el numero de shelvings correspondientes
insertTicket(data, collectionShelving, max);
console.log(data);
insertTicket(data, collectionShelving);
});
}
function insertTicket(consultaSql, shelving, max) {
function insertTicket(consultaSql, shelving) {
console.log(shelving);
console.log('CONSULTASQL:', consultaSql);
console.log('CONSULTASQL_TAMNAÑO:', consultaSql.length);
const dataLogIn = require('../server');
const got = require('got');
(async() => {
@ -29,6 +33,7 @@ function insertTicket(consultaSql, shelving, max) {
(async() => {
for (let i = 0; i < consultaSql.length; i++) {
console.log(i);
for (let j = 0; j < consultaSql[i].Level.toString().length; j++) {
const {body} = await got.post('http://app.etiquetaselectronicas.com:9999/item/batchImportItem', { // eslint-disable-line
json: {
@ -53,7 +58,7 @@ function insertTicket(consultaSql, shelving, max) {
'Authorization': key
}
});
return true;
console.log(body);
}
}
})();