separate collection and wagon

This commit is contained in:
alexmorenograu 2021-03-18 16:12:45 +01:00
parent 42e6c223e9
commit 8e9f736cde
3 changed files with 32 additions and 12 deletions

View File

@ -2,25 +2,20 @@ const express = require('express');
const router = express.Router(); // eslint-disable-line
// const filter = require('../utilities/filter');
const select = require('../db/selectDB');
const maxWagon = require('../db/maxWagon');
router.get('/:collectionFk', async(req, res) => {
// var shelving = "BCD";///introducida por el usuario O en leida de la bbdd?
// var collectionFk = '273449';
const collectionFk = req.params.collectionFk;
ticketCollection(collectionFk);
router.get('/:collectionShelving', async(req, res) => {
const collectionShelving = req.params.collectionShelving.split(',');
let collectionFk = 273449;
ticketShelving(collectionShelving, collectionFk);
res.json({message: 'SUCCESS'});
});
module.exports = router;
function ticketCollection(collectionFk) {// parametro collectionFk
function ticketShelving(collectionShelving, collectionFk) {// parametro collectionFk
select.select(collectionFk, function(err, data) {
maxWagon.maxWagon(collectionFk, function(err, max) {
// aqui iria una función para pedir el numero de shelvings correspondientes
let shelving = ['ABC', 'DFG', 'HIJ'];
insertTicket(data, shelving, max);
});
// aqui iria una función para pedir el numero de shelvings correspondientes
insertTicket(data, collectionShelving, max);
});
}

24
methods/setCollection.js Normal file
View File

@ -0,0 +1,24 @@
const express = require('express');
const router = express.Router(); // eslint-disable-line
const select = require('../db/selectDB');
const maxWagon = require('../db/maxWagon');
router.get('/:collectionFk', async(req, res) => {
// var collectionFk = '273449';
const collectionFk = req.params.collectionFk;
let maxWagon = ticketCollection(collectionFk);
res.json({
message: 'SUCCESS',
maxWagon: maxWagon
});
});
module.exports = router;
function ticketCollection(collectionFk) {// parametro collectionFk
select.select(collectionFk, function(err, data) {
maxWagon.maxWagon(collectionFk, function(err, max) {
return max;
});
});
}

View File

@ -6,6 +6,7 @@ const logIn = require('./methods/logIn');
const dataLogIn = logIn.info;
exports.dataLogIn = dataLogIn;
app.use('/getNumShelving', require('./methods/setCollection'));
app.use('/bindShelving', require('./methods/bindShelvingTag'));
app.use('/insertTicket', require('./methods/bindTicketShelving'));