refactoring
This commit is contained in:
parent
423b84cc1c
commit
adba40861c
|
@ -1,20 +1,18 @@
|
|||
const insert = require('./methods/bindTicketShelving');
|
||||
// const insert = require('./methods/bindTicketShelving');
|
||||
const filter = require('./utilities/filter');
|
||||
const select = require('./db/selectDB');
|
||||
|
||||
var barcode = "A0A3B820690F";
|
||||
var shelving = "BCD";///introducida por el usuario
|
||||
var collectionFk = '274286';
|
||||
// let barcode = 'A0A3B820690F';
|
||||
let shelving = 'BCD';// /introducida por el usuario
|
||||
let collectionFk = '274286';
|
||||
|
||||
function ticketCollection(collectionFk){//parametro collectionFk
|
||||
select.select(collectionFk, function(err,data){
|
||||
if(filter.isShelving(shelving)){
|
||||
//insert.insertTicket(data, shelving,)
|
||||
}
|
||||
else{
|
||||
console.log("¡MATRICULA INCORRECTA!")
|
||||
}
|
||||
function ticketCollection(collectionFk) {// parametro collectionFk
|
||||
select.select(collectionFk, function(err, data) {
|
||||
if (filter.isShelving(shelving)) {
|
||||
// insert.insertTicket(data, shelving,)
|
||||
} else
|
||||
console.log('¡MATRICULA INCORRECTA!');
|
||||
});
|
||||
}
|
||||
|
||||
ticketCollection(collectionFk);
|
||||
ticketCollection(collectionFk);
|
||||
|
|
|
@ -5,14 +5,14 @@ const port = 9999;
|
|||
|
||||
app.get('/', async(req, res) => {
|
||||
(async() => {
|
||||
const { body } = await got.get('http://app.etiquetaselectronicas.com:9999/user/getErpPublicKey', {
|
||||
const {body} = await got.get('http://app.etiquetaselectronicas.com:9999/user/getErpPublicKey', {
|
||||
});
|
||||
let body2=JSON.parse(body)
|
||||
console.log(body2.data)
|
||||
let body2 = JSON.parse(body);
|
||||
console.log(body2.data);
|
||||
res.end(body);
|
||||
})();
|
||||
})();
|
||||
});
|
||||
|
||||
app.listen(port, () => {
|
||||
console.log(`Example app listening at http://localhost:${port}`)
|
||||
});
|
||||
console.log(`Example app listening at http://localhost:${port}`);
|
||||
});
|
||||
|
|
|
@ -7,7 +7,7 @@ const port = 9999;
|
|||
|
||||
app.get('/', async(req, res) => {
|
||||
(async() => {
|
||||
const { body } = await got.post('http://app.etiquetaselectronicas.com:9999/user/login', {
|
||||
const {body} = await got.post('http://app.etiquetaselectronicas.com:9999/user/login', {
|
||||
json: {
|
||||
account: config.user,
|
||||
loginType: 3,
|
||||
|
@ -15,11 +15,11 @@ app.get('/', async(req, res) => {
|
|||
},
|
||||
responseType: 'json'
|
||||
});
|
||||
console.log(body)
|
||||
console.log(body);
|
||||
res.end(JSON.stringify(body));
|
||||
})();
|
||||
});
|
||||
|
||||
app.listen(port, () => {
|
||||
console.log(`Example app listening at http://localhost:${port}`)
|
||||
});
|
||||
console.log(`Example app listening at http://localhost:${port}`);
|
||||
});
|
||||
|
|
|
@ -1,59 +1,58 @@
|
|||
const express = require('express');
|
||||
const got = require('got');
|
||||
const config = require('./config');
|
||||
const encrypt = require('./encrypted');
|
||||
const app = express();
|
||||
const port = 9999;
|
||||
|
||||
app.get('/', async(req, res) => {
|
||||
(async() => {
|
||||
const info = await config.info
|
||||
let key = info.data.token
|
||||
const info = await config.info;
|
||||
let key = info.data.token;
|
||||
let currentUser = info.data.currentUser;
|
||||
|
||||
(async() => {
|
||||
const { body } = await got.post('http://app.etiquetaselectronicas.com:9999/item/batchImportItem', {
|
||||
const {body} = await got.post('http://app.etiquetaselectronicas.com:9999/item/batchImportItem', {
|
||||
json: {
|
||||
agencyId: currentUser.agencyId,
|
||||
merchantId: currentUser.merchantId,
|
||||
storeId: currentUser.storeId,
|
||||
unitName: currentUser.unitName,
|
||||
itemList: [{
|
||||
attrCategory: "default",
|
||||
attrName: "default",
|
||||
barCode: "1000012345",
|
||||
itemTitle: "Australian apple",
|
||||
originalPrice: "600",
|
||||
price: "6300",
|
||||
productArea: "Britain",
|
||||
productCode: "4151512414155",
|
||||
productSku: "200001275",
|
||||
},
|
||||
{
|
||||
attrCategory: "default",
|
||||
attrName: "default",
|
||||
barCode: "5141415414312",
|
||||
itemTitle: "Cavendish banana",
|
||||
originalPrice: "10",
|
||||
price: "8",
|
||||
productArea: "Brasil",
|
||||
productCode: "4151512414156",
|
||||
productSku: "20001536",
|
||||
promotionText: "sale"
|
||||
}
|
||||
attrCategory: 'default',
|
||||
attrName: 'default',
|
||||
barCode: '1000012345',
|
||||
itemTitle: 'Australian apple',
|
||||
originalPrice: '600',
|
||||
price: '6300',
|
||||
productArea: 'Britain',
|
||||
productCode: '4151512414155',
|
||||
productSku: '200001275',
|
||||
},
|
||||
{
|
||||
attrCategory: 'default',
|
||||
attrName: 'default',
|
||||
barCode: '5141415414312',
|
||||
itemTitle: 'Cavendish banana',
|
||||
originalPrice: '10',
|
||||
price: '8',
|
||||
productArea: 'Brasil',
|
||||
productCode: '4151512414156',
|
||||
productSku: '20001536',
|
||||
promotionText: 'sale'
|
||||
}
|
||||
]
|
||||
},
|
||||
responseType: 'json',
|
||||
headers: {
|
||||
"Authorization": key
|
||||
'Authorization': key
|
||||
}
|
||||
})
|
||||
console.log(body)
|
||||
res.end(JSON.stringify(body))
|
||||
});
|
||||
console.log(body);
|
||||
res.end(JSON.stringify(body));
|
||||
})();
|
||||
})();
|
||||
});
|
||||
|
||||
app.listen(port, () => {
|
||||
console.log(`Example app listening at http://localhost:${port}`)
|
||||
});
|
||||
console.log(`Example app listening at http://localhost:${port}`);
|
||||
});
|
||||
|
|
|
@ -1,35 +1,34 @@
|
|||
const express = require('express');
|
||||
const got = require('got');
|
||||
const config = require('./config');
|
||||
const encrypt = require('./encrypted');
|
||||
const app = express();
|
||||
const port = 9999;
|
||||
|
||||
app.get('/', async(req, res) => {
|
||||
(async() => {
|
||||
const info = await config.info
|
||||
const info = await config.info;
|
||||
let key = info.data.token;
|
||||
|
||||
(async() => {
|
||||
const { body } = await got.delete('http://app.etiquetaselectronicas.com:9999/item/batchDeleteItem', {
|
||||
const {body} = await got.delete('http://app.etiquetaselectronicas.com:9999/item/batchDeleteItem', {
|
||||
json: {
|
||||
storeId: config.storeId,
|
||||
list: [
|
||||
"2000123456",
|
||||
"5141415414312"
|
||||
'2000123456',
|
||||
'5141415414312'
|
||||
]
|
||||
},
|
||||
responseType: 'json',
|
||||
headers: {
|
||||
"Authorization": key
|
||||
'Authorization': key
|
||||
}
|
||||
})
|
||||
console.log(body)
|
||||
res.end(JSON.stringify(body))
|
||||
});
|
||||
console.log(body);
|
||||
res.end(JSON.stringify(body));
|
||||
})();
|
||||
})();
|
||||
});
|
||||
|
||||
app.listen(port, () => {
|
||||
console.log(`Example app listening at http://localhost:${port}`)
|
||||
});
|
||||
console.log(`Example app listening at http://localhost:${port}`);
|
||||
});
|
||||
|
|
|
@ -1,40 +1,39 @@
|
|||
const express = require('express');
|
||||
const got = require('got');
|
||||
const config = require('./config');
|
||||
const encrypt = require('./encrypted');
|
||||
const app = express();
|
||||
const port = 9999;
|
||||
|
||||
app.get('/', async(req, res) => {
|
||||
(async() => {
|
||||
const info = await config.info
|
||||
const info = await config.info;
|
||||
let key = info.data.token;
|
||||
|
||||
(async() => {
|
||||
const { body } = await got.post('http://app.etiquetaselectronicas.com:9999/bind/batchBind', {
|
||||
const {body} = await got.post('http://app.etiquetaselectronicas.com:9999/bind/batchBind', {
|
||||
json: {
|
||||
storeId: config.storeId,
|
||||
tagItemBinds: [{
|
||||
eslBarcode: "A0A3B8207222",
|
||||
itemBarcode: "100001234"
|
||||
},
|
||||
{
|
||||
eslBarcode: "A0A3B820690F",
|
||||
itemBarcode: "5141415414312"
|
||||
}
|
||||
eslBarcode: 'A0A3B8207222',
|
||||
itemBarcode: '100001234'
|
||||
},
|
||||
{
|
||||
eslBarcode: 'A0A3B820690F',
|
||||
itemBarcode: '5141415414312'
|
||||
}
|
||||
]
|
||||
},
|
||||
responseType: 'json',
|
||||
headers: {
|
||||
"Authorization": key
|
||||
'Authorization': key
|
||||
}
|
||||
})
|
||||
console.log(body)
|
||||
res.end(JSON.stringify(body))
|
||||
});
|
||||
console.log(body);
|
||||
res.end(JSON.stringify(body));
|
||||
})();
|
||||
})();
|
||||
});
|
||||
|
||||
app.listen(port, () => {
|
||||
console.log(`Example app listening at http://localhost:${port}`)
|
||||
});
|
||||
console.log(`Example app listening at http://localhost:${port}`);
|
||||
});
|
||||
|
|
|
@ -1,17 +1,16 @@
|
|||
const crypto = require('crypto');
|
||||
const got = require('got');
|
||||
const config = require('./config');
|
||||
|
||||
const encryptPassword = async(password) => {
|
||||
const { body } = await got.get('http://app.etiquetaselectronicas.com:9999/user/getErpPublicKey', {
|
||||
});
|
||||
const publicKey=`-----BEGIN PUBLIC KEY-----\n${JSON.parse(body).data}\n-----END PUBLIC KEY-----`;
|
||||
const externKey = {
|
||||
key: publicKey,
|
||||
padding: crypto.constants.RSA_PKCS1_PADDING
|
||||
};
|
||||
let buffer = Buffer.from(password);
|
||||
return crypto.publicEncrypt(externKey, buffer).toString("base64");
|
||||
const encryptPassword = async password => {
|
||||
const {body} = await got.get('http://app.etiquetaselectronicas.com:9999/user/getErpPublicKey', {
|
||||
});
|
||||
const publicKey = `-----BEGIN PUBLIC KEY-----\n${JSON.parse(body).data}\n-----END PUBLIC KEY-----`;
|
||||
const externKey = {
|
||||
key: publicKey,
|
||||
padding: crypto.constants.RSA_PKCS1_PADDING
|
||||
};
|
||||
let buffer = Buffer.from(password);
|
||||
return crypto.publicEncrypt(externKey, buffer).toString('base64');
|
||||
};
|
||||
|
||||
exports.encryptPassword = encryptPassword;
|
||||
exports.encryptPassword = encryptPassword;
|
||||
|
|
|
@ -6,95 +6,92 @@ const express = require('express');
|
|||
const router = express.Router();
|
||||
|
||||
router.get('/', async(req, res) => {
|
||||
///DATOS INTRODUCIDOS POR EL USUARIO////
|
||||
var barcode = "A0A3B8224DBF"; //valido = "A0A3B82"+ 4 CARACTERES HEXADECIMALES (0-F)
|
||||
var shelving = "ABC"; //valido = 3 CARACTERES LETRAS (A-Z)
|
||||
var level = "4";
|
||||
//////////////////////////////////////
|
||||
// DATOS INTRODUCIDOS POR EL USUARIO
|
||||
let barcode = 'A0A3B8224DBF'; // valido = "A0A3B82"+ 4 CARACTERES HEXADECIMALES (0-F)
|
||||
let shelving = 'ABC'; // valido = 3 CARACTERES LETRAS (A-Z)
|
||||
let level = '4';
|
||||
// ////////////////////////////////////
|
||||
|
||||
const result = bindShelvingTag(barcode, shelving, level);
|
||||
if(result == 'INVALID_PLATE'){
|
||||
res.json({message: 'MATRICULA INCORRECTA'})
|
||||
}else if (result == 'INVALID_TAG_CODE'){
|
||||
res.json({message: 'CODIGO DE ETIQUETA INCORRECTO'})
|
||||
}else{
|
||||
if (result == 'INVALID_PLATE')
|
||||
res.json({message: 'MATRICULA INCORRECTA'});
|
||||
else if (result == 'INVALID_TAG_CODE')
|
||||
res.json({message: 'CODIGO DE ETIQUETA INCORRECTO'});
|
||||
else
|
||||
res.json({message: 'SUCCESS'});
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
module.exports = router;
|
||||
|
||||
function bindShelvingTag(barcode, shelving, level){
|
||||
if(filter.isBarcode(barcode)){
|
||||
if(filter.isShelving(shelving)){
|
||||
function bindShelvingTag(barcode, shelving, level) {
|
||||
if (filter.isBarcode(barcode)) {
|
||||
if (filter.isShelving(shelving)) {
|
||||
let shelvingId = shelving + level;
|
||||
insertShelving(shelvingId);
|
||||
bindShelving(barcode, shelvingId);
|
||||
insertDB.insertDB(barcode, shelving, level);
|
||||
}else{
|
||||
//console.log("¡MATRICULA INCORRECTA!");
|
||||
} else {
|
||||
// console.log("¡MATRICULA INCORRECTA!");
|
||||
return 'INVALID_PLATE';
|
||||
|
||||
}
|
||||
}else{
|
||||
//console.log("¡CODIGO DE ETIQUETA INCORRECTO!")
|
||||
} else {
|
||||
// console.log("¡CODIGO DE ETIQUETA INCORRECTO!")
|
||||
return 'INVALID_TAG_CODE';
|
||||
}
|
||||
}
|
||||
|
||||
function insertShelving(shelvingId){
|
||||
(async() => {
|
||||
const info = await config.info
|
||||
let key = info.data.token
|
||||
let currentUser = info.data.currentUser;
|
||||
(async() => {
|
||||
const { body } = await got.post('http://app.etiquetaselectronicas.com:9999/item/batchImportItem', {
|
||||
json: {
|
||||
agencyId: currentUser.agencyId,
|
||||
merchantId: currentUser.merchantId,
|
||||
storeId: currentUser.storeId,
|
||||
unitName: currentUser.unitName,
|
||||
itemList: [
|
||||
{
|
||||
attrCategory: "verdnatura",
|
||||
attrName: "sinTicket",
|
||||
barCode: shelvingId,//Matricula + nivel
|
||||
itemTitle: "Etiqueta Sin ticket",
|
||||
}
|
||||
]
|
||||
},
|
||||
responseType: 'json',
|
||||
headers: {
|
||||
"Authorization": key
|
||||
}
|
||||
})
|
||||
//console.log("CARRO: ",body)
|
||||
})();
|
||||
})();
|
||||
}
|
||||
|
||||
function bindShelving(barcode, shelvingId){
|
||||
function insertShelving(shelvingId) {
|
||||
(async() => {
|
||||
const info = await config.info
|
||||
const info = await config.info;
|
||||
let key = info.data.token;
|
||||
let currentUser = info.data.currentUser;
|
||||
(async() => {
|
||||
const { body } = await got.post('http://app.etiquetaselectronicas.com:9999/bind/batchBind', {
|
||||
const {body} = await got.post('http://app.etiquetaselectronicas.com:9999/item/batchImportItem', {
|
||||
json: {
|
||||
storeId: config.storeId,
|
||||
tagItemBinds: [{
|
||||
eslBarcode: barcode,
|
||||
itemBarcode: shelvingId
|
||||
agencyId: currentUser.agencyId,
|
||||
merchantId: currentUser.merchantId,
|
||||
storeId: currentUser.storeId,
|
||||
unitName: currentUser.unitName,
|
||||
itemList: [
|
||||
{
|
||||
attrCategory: 'verdnatura',
|
||||
attrName: 'sinTicket',
|
||||
barCode: shelvingId, // Matricula + nivel
|
||||
itemTitle: 'Etiqueta Sin ticket',
|
||||
}
|
||||
]
|
||||
},
|
||||
responseType: 'json',
|
||||
headers: {
|
||||
"Authorization": key
|
||||
'Authorization': key
|
||||
}
|
||||
})
|
||||
//console.log("ETIQUETA: ",body)
|
||||
});
|
||||
// console.log("CARRO: ",body)
|
||||
})();
|
||||
})();
|
||||
}
|
||||
exports.bindShelving = bindShelving;
|
||||
|
||||
function bindShelving(barcode, shelvingId) {
|
||||
(async() => {
|
||||
const info = await config.info;
|
||||
let key = info.data.token;
|
||||
(async() => {
|
||||
const {body} = await got.post('http://app.etiquetaselectronicas.com:9999/bind/batchBind', {
|
||||
json: {
|
||||
storeId: config.storeId,
|
||||
tagItemBinds: [{
|
||||
eslBarcode: barcode,
|
||||
itemBarcode: shelvingId
|
||||
}
|
||||
]
|
||||
},
|
||||
responseType: 'json',
|
||||
headers: {
|
||||
'Authorization': key
|
||||
}
|
||||
});
|
||||
// console.log("ETIQUETA: ",body)
|
||||
})();
|
||||
})();
|
||||
}
|
||||
exports.bindShelving = bindShelving;
|
||||
|
|
|
@ -1,46 +1,45 @@
|
|||
const express = require('express');
|
||||
const router = express.Router();
|
||||
const filter = require('../utilities/filter');
|
||||
// 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';
|
||||
// var shelving = "BCD";///introducida por el usuario O en leida de la bbdd?
|
||||
// var collectionFk = '273449';
|
||||
const collectionFk = req.params.collectionFk;
|
||||
ticketCollection(collectionFk);
|
||||
res.json({message: 'SUCCESS'})
|
||||
res.json({message: 'SUCCESS'});
|
||||
});
|
||||
|
||||
module.exports = router;
|
||||
|
||||
function ticketCollection(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
|
||||
var shelving = ['ABC','DFG','HIJ']
|
||||
//if(filter.isShelving(shelving)){
|
||||
insertTicket(data, shelving, max)
|
||||
//}else{
|
||||
//console.log("¡MATRICULA INCORRECTA!")
|
||||
//}
|
||||
function ticketCollection(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'];
|
||||
// if(filter.isShelving(shelving)){
|
||||
insertTicket(data, shelving, max);
|
||||
// }else{
|
||||
// console.log("¡MATRICULA INCORRECTA!")
|
||||
// }
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function insertTicket(consultaSql, shelving, max){
|
||||
function insertTicket(consultaSql, shelving, max) {
|
||||
const config = require('../config');
|
||||
const got = require('got');
|
||||
(async() => {
|
||||
const info = await config.info
|
||||
let key = info.data.token
|
||||
const info = await config.info;
|
||||
let key = info.data.token;
|
||||
let currentUser = info.data.currentUser;
|
||||
|
||||
(async() => {
|
||||
for(var i=0;i<consultaSql.length;i++){
|
||||
for(var j=0;j<consultaSql[i].Level.toString().length;j++){
|
||||
const { body } = await got.post('http://app.etiquetaselectronicas.com:9999/item/batchImportItem', {
|
||||
for (let i = 0; i < consultaSql.length; i++) {
|
||||
for (let j = 0; j < consultaSql[i].Level.toString().length; j++) {
|
||||
const {body} = await got.post('http://app.etiquetaselectronicas.com:9999/item/batchImportItem', {
|
||||
json: {
|
||||
agencyId: currentUser.agencyId,
|
||||
merchantId: currentUser.merchantId,
|
||||
|
@ -48,23 +47,23 @@ function insertTicket(consultaSql, shelving, max){
|
|||
unitName: currentUser.unitName,
|
||||
itemList: [
|
||||
{
|
||||
attrCategory: "verdnatura",
|
||||
attrName: "conTicket",
|
||||
barCode: shelving[consultaSql[i].Wagon-1] + consultaSql[i].Level.toString().charAt(j),//Matricula + nivel
|
||||
itemTitle: "Etiqueta Con ticket",
|
||||
productCode: consultaSql[i].Ticket, //Ticket
|
||||
custFeature1: consultaSql[i].Client, //Client
|
||||
custFeature2: consultaSql[i].Agency //Agencia de transporte
|
||||
attrCategory: 'verdnatura',
|
||||
attrName: 'conTicket',
|
||||
barCode: shelving[consultaSql[i].Wagon - 1] + consultaSql[i].Level.toString().charAt(j), // Matricula + nivel
|
||||
itemTitle: 'Etiqueta Con ticket',
|
||||
productCode: consultaSql[i].Ticket, // Ticket
|
||||
custFeature1: consultaSql[i].Client, // Client
|
||||
custFeature2: consultaSql[i].Agency // Agencia de transporte
|
||||
}
|
||||
]
|
||||
},
|
||||
responseType: 'json',
|
||||
headers: {
|
||||
"Authorization": key
|
||||
'Authorization': key
|
||||
}
|
||||
})
|
||||
});
|
||||
return true;
|
||||
//console.log(body,consultaSql[i].Ticket,shelving[consultaSql[i].Wagon-1],consultaSql[i].Level.toString().charAt(j))
|
||||
// console.log(body,consultaSql[i].Ticket,shelving[consultaSql[i].Wagon-1],consultaSql[i].Level.toString().charAt(j))
|
||||
}
|
||||
}
|
||||
})();
|
||||
|
|
|
@ -1,41 +1,41 @@
|
|||
function insertTicket(consultaSql, shelving, max){
|
||||
function insertTicket(consultaSql, shelving, max) {
|
||||
const config = require('../config');
|
||||
const got = require('got');
|
||||
(async() => {
|
||||
const info = await config.info
|
||||
let key = info.data.token
|
||||
const info = await config.info;
|
||||
let key = info.data.token;
|
||||
let currentUser = info.data.currentUser;
|
||||
|
||||
(async() => {
|
||||
for(var i=0;i<consultaSql.length;i++){
|
||||
//for(var j=0;j<max;j++){
|
||||
for(var j=0;j<consultaSql[i].Level.toString().length;j++){
|
||||
const { body } = await got.post('http://app.etiquetaselectronicas.com:9999/item/batchImportItem', {
|
||||
json: {
|
||||
agencyId: currentUser.agencyId,
|
||||
merchantId: currentUser.merchantId,
|
||||
storeId: currentUser.storeId,
|
||||
unitName: currentUser.unitName,
|
||||
itemList: [
|
||||
{
|
||||
attrCategory: "verdnatura",
|
||||
attrName: "conTicket",
|
||||
barCode: shelving + consultaSql[i].Level.toString().charAt(j),//Matricula + nivel
|
||||
itemTitle: "Etiqueta Con ticket",
|
||||
productCode: consultaSql[i].Ticket, //Ticket
|
||||
custFeature1: consultaSql[i].Client, //Client
|
||||
custFeature2: consultaSql[i].Agency //Agencia de transporte
|
||||
}
|
||||
]
|
||||
},
|
||||
responseType: 'json',
|
||||
headers: {
|
||||
"Authorization": key
|
||||
}
|
||||
})
|
||||
console.log(body)
|
||||
}
|
||||
//}
|
||||
for (let i = 0; i < consultaSql.length; i++) {
|
||||
// for(var j=0;j<max;j++){
|
||||
for (let j = 0; j < consultaSql[i].Level.toString().length; j++) {
|
||||
const {body} = await got.post('http://app.etiquetaselectronicas.com:9999/item/batchImportItem', {
|
||||
json: {
|
||||
agencyId: currentUser.agencyId,
|
||||
merchantId: currentUser.merchantId,
|
||||
storeId: currentUser.storeId,
|
||||
unitName: currentUser.unitName,
|
||||
itemList: [
|
||||
{
|
||||
attrCategory: 'verdnatura',
|
||||
attrName: 'conTicket',
|
||||
barCode: shelving + consultaSql[i].Level.toString().charAt(j), // Matricula + nivel
|
||||
itemTitle: 'Etiqueta Con ticket',
|
||||
productCode: consultaSql[i].Ticket, // Ticket
|
||||
custFeature1: consultaSql[i].Client, // Client
|
||||
custFeature2: consultaSql[i].Agency // Agencia de transporte
|
||||
}
|
||||
]
|
||||
},
|
||||
responseType: 'json',
|
||||
headers: {
|
||||
'Authorization': key
|
||||
}
|
||||
});
|
||||
console.log(body);
|
||||
}
|
||||
// }
|
||||
}
|
||||
})();
|
||||
})();
|
||||
|
|
|
@ -128,6 +128,15 @@
|
|||
"@types/node": "*"
|
||||
}
|
||||
},
|
||||
"accepts": {
|
||||
"version": "1.3.7",
|
||||
"resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.7.tgz",
|
||||
"integrity": "sha512-Il80Qs2WjYlJIBNzNkK6KYqlVMTbZLXgHx2oT0pU/fjRHyEp+PEfEPY0R3WCwAGVOtauxh1hOxNgIf5bv7dQpA==",
|
||||
"requires": {
|
||||
"mime-types": "~2.1.24",
|
||||
"negotiator": "0.6.2"
|
||||
}
|
||||
},
|
||||
"acorn": {
|
||||
"version": "7.4.1",
|
||||
"resolved": "https://registry.npmjs.org/acorn/-/acorn-7.4.1.tgz",
|
||||
|
@ -175,6 +184,11 @@
|
|||
"sprintf-js": "~1.0.2"
|
||||
}
|
||||
},
|
||||
"array-flatten": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz",
|
||||
"integrity": "sha1-ml9pkFGx5wczKPKgCJaLZOopVdI="
|
||||
},
|
||||
"astral-regex": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/astral-regex/-/astral-regex-2.0.0.tgz",
|
||||
|
@ -190,6 +204,23 @@
|
|||
"resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-9.0.0.tgz",
|
||||
"integrity": "sha512-t/OYhhJ2SD+YGBQcjY8GzzDHEk9f3nerxjtfa6tlMXfe7frs/WozhvCNoGvpM0P3bNf3Gq5ZRMlGr5f3r4/N8A=="
|
||||
},
|
||||
"body-parser": {
|
||||
"version": "1.19.0",
|
||||
"resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.19.0.tgz",
|
||||
"integrity": "sha512-dhEPs72UPbDnAQJ9ZKMNTP6ptJaionhP5cBb541nXPlW60Jepo9RV/a4fX4XWW9CuFNK22krhrj1+rgzifNCsw==",
|
||||
"requires": {
|
||||
"bytes": "3.1.0",
|
||||
"content-type": "~1.0.4",
|
||||
"debug": "2.6.9",
|
||||
"depd": "~1.1.2",
|
||||
"http-errors": "1.7.2",
|
||||
"iconv-lite": "0.4.24",
|
||||
"on-finished": "~2.3.0",
|
||||
"qs": "6.7.0",
|
||||
"raw-body": "2.4.0",
|
||||
"type-is": "~1.6.17"
|
||||
}
|
||||
},
|
||||
"brace-expansion": {
|
||||
"version": "1.1.11",
|
||||
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
|
||||
|
@ -199,6 +230,11 @@
|
|||
"concat-map": "0.0.1"
|
||||
}
|
||||
},
|
||||
"bytes": {
|
||||
"version": "3.1.0",
|
||||
"resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.0.tgz",
|
||||
"integrity": "sha512-zauLjrfCG+xvoyaqLoV8bLVXXNGC4JqlxFCutSDWA6fJrTo2ZuvLYTqZ7aHBLZSMOopbzwv8f+wZcVzfVTI2Dg=="
|
||||
},
|
||||
"cacheable-lookup": {
|
||||
"version": "5.0.4",
|
||||
"resolved": "https://registry.npmjs.org/cacheable-lookup/-/cacheable-lookup-5.0.4.tgz",
|
||||
|
@ -294,6 +330,29 @@
|
|||
"resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
|
||||
"integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s="
|
||||
},
|
||||
"content-disposition": {
|
||||
"version": "0.5.3",
|
||||
"resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.3.tgz",
|
||||
"integrity": "sha512-ExO0774ikEObIAEV9kDo50o+79VCUdEB6n6lzKgGwupcVeRlhrj3qGAfwq8G6uBJjkqLrhT0qEYFcWng8z1z0g==",
|
||||
"requires": {
|
||||
"safe-buffer": "5.1.2"
|
||||
}
|
||||
},
|
||||
"content-type": {
|
||||
"version": "1.0.4",
|
||||
"resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz",
|
||||
"integrity": "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA=="
|
||||
},
|
||||
"cookie": {
|
||||
"version": "0.4.0",
|
||||
"resolved": "https://registry.npmjs.org/cookie/-/cookie-0.4.0.tgz",
|
||||
"integrity": "sha512-+Hp8fLp57wnUSt0tY0tHEXh4voZRDnoIrZPqlo3DPiI4y9lwg/jqx+1Om94/W6ZaPDOUbnjOt/99w66zk+l1Xg=="
|
||||
},
|
||||
"cookie-signature": {
|
||||
"version": "1.0.6",
|
||||
"resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz",
|
||||
"integrity": "sha1-4wOogrNCzD7oylE6eZmXNNqzriw="
|
||||
},
|
||||
"core-util-is": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz",
|
||||
|
@ -309,6 +368,14 @@
|
|||
"which": "^2.0.1"
|
||||
}
|
||||
},
|
||||
"debug": {
|
||||
"version": "2.6.9",
|
||||
"resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
|
||||
"integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
|
||||
"requires": {
|
||||
"ms": "2.0.0"
|
||||
}
|
||||
},
|
||||
"decompress-response": {
|
||||
"version": "6.0.0",
|
||||
"resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-6.0.0.tgz",
|
||||
|
@ -334,6 +401,16 @@
|
|||
"resolved": "https://registry.npmjs.org/defer-to-connect/-/defer-to-connect-2.0.1.tgz",
|
||||
"integrity": "sha512-4tvttepXG1VaYGrRibk5EwJd1t4udunSOVMdLSAL6mId1ix438oPwPZMALY41FCijukO1L0twNcGsdzS7dHgDg=="
|
||||
},
|
||||
"depd": {
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz",
|
||||
"integrity": "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak="
|
||||
},
|
||||
"destroy": {
|
||||
"version": "1.0.4",
|
||||
"resolved": "https://registry.npmjs.org/destroy/-/destroy-1.0.4.tgz",
|
||||
"integrity": "sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA="
|
||||
},
|
||||
"doctrine": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz",
|
||||
|
@ -342,11 +419,21 @@
|
|||
"esutils": "^2.0.2"
|
||||
}
|
||||
},
|
||||
"ee-first": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz",
|
||||
"integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0="
|
||||
},
|
||||
"emoji-regex": {
|
||||
"version": "8.0.0",
|
||||
"resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz",
|
||||
"integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A=="
|
||||
},
|
||||
"encodeurl": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz",
|
||||
"integrity": "sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k="
|
||||
},
|
||||
"end-of-stream": {
|
||||
"version": "1.4.4",
|
||||
"resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz",
|
||||
|
@ -363,6 +450,11 @@
|
|||
"ansi-colors": "^4.1.1"
|
||||
}
|
||||
},
|
||||
"escape-html": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz",
|
||||
"integrity": "sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg="
|
||||
},
|
||||
"escape-string-regexp": {
|
||||
"version": "1.0.5",
|
||||
"resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz",
|
||||
|
@ -427,6 +519,11 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"eslint-config-google": {
|
||||
"version": "0.14.0",
|
||||
"resolved": "https://registry.npmjs.org/eslint-config-google/-/eslint-config-google-0.14.0.tgz",
|
||||
"integrity": "sha512-WsbX4WbjuMvTdeVL6+J3rK1RGhCTqjsFjX7UMSMgZiyxxaNLkoJENbrGExzERFeoTpGw3F3FypTiWAP9ZXzkEw=="
|
||||
},
|
||||
"eslint-scope": {
|
||||
"version": "5.1.1",
|
||||
"resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz",
|
||||
|
@ -518,6 +615,48 @@
|
|||
"resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz",
|
||||
"integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g=="
|
||||
},
|
||||
"etag": {
|
||||
"version": "1.8.1",
|
||||
"resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz",
|
||||
"integrity": "sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc="
|
||||
},
|
||||
"express": {
|
||||
"version": "4.17.1",
|
||||
"resolved": "https://registry.npmjs.org/express/-/express-4.17.1.tgz",
|
||||
"integrity": "sha512-mHJ9O79RqluphRrcw2X/GTh3k9tVv8YcoyY4Kkh4WDMUYKRZUq0h1o0w2rrrxBqM7VoeUVqgb27xlEMXTnYt4g==",
|
||||
"requires": {
|
||||
"accepts": "~1.3.7",
|
||||
"array-flatten": "1.1.1",
|
||||
"body-parser": "1.19.0",
|
||||
"content-disposition": "0.5.3",
|
||||
"content-type": "~1.0.4",
|
||||
"cookie": "0.4.0",
|
||||
"cookie-signature": "1.0.6",
|
||||
"debug": "2.6.9",
|
||||
"depd": "~1.1.2",
|
||||
"encodeurl": "~1.0.2",
|
||||
"escape-html": "~1.0.3",
|
||||
"etag": "~1.8.1",
|
||||
"finalhandler": "~1.1.2",
|
||||
"fresh": "0.5.2",
|
||||
"merge-descriptors": "1.0.1",
|
||||
"methods": "~1.1.2",
|
||||
"on-finished": "~2.3.0",
|
||||
"parseurl": "~1.3.3",
|
||||
"path-to-regexp": "0.1.7",
|
||||
"proxy-addr": "~2.0.5",
|
||||
"qs": "6.7.0",
|
||||
"range-parser": "~1.2.1",
|
||||
"safe-buffer": "5.1.2",
|
||||
"send": "0.17.1",
|
||||
"serve-static": "1.14.1",
|
||||
"setprototypeof": "1.1.1",
|
||||
"statuses": "~1.5.0",
|
||||
"type-is": "~1.6.18",
|
||||
"utils-merge": "1.0.1",
|
||||
"vary": "~1.1.2"
|
||||
}
|
||||
},
|
||||
"fast-deep-equal": {
|
||||
"version": "3.1.3",
|
||||
"resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz",
|
||||
|
@ -541,6 +680,20 @@
|
|||
"flat-cache": "^3.0.4"
|
||||
}
|
||||
},
|
||||
"finalhandler": {
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.1.2.tgz",
|
||||
"integrity": "sha512-aAWcW57uxVNrQZqFXjITpW3sIUQmHGG3qSb9mUah9MgMC4NeWhNOlNjXEYq3HjRAvL6arUviZGGJsBg6z0zsWA==",
|
||||
"requires": {
|
||||
"debug": "2.6.9",
|
||||
"encodeurl": "~1.0.2",
|
||||
"escape-html": "~1.0.3",
|
||||
"on-finished": "~2.3.0",
|
||||
"parseurl": "~1.3.3",
|
||||
"statuses": "~1.5.0",
|
||||
"unpipe": "~1.0.0"
|
||||
}
|
||||
},
|
||||
"flat-cache": {
|
||||
"version": "3.0.4",
|
||||
"resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.0.4.tgz",
|
||||
|
@ -555,6 +708,16 @@
|
|||
"resolved": "https://registry.npmjs.org/flatted/-/flatted-3.1.1.tgz",
|
||||
"integrity": "sha512-zAoAQiudy+r5SvnSw3KJy5os/oRJYHzrzja/tBDqrZtNhUw8bt6y8OBzMWcjWr+8liV8Eb6yOhw8WZ7VFZ5ZzA=="
|
||||
},
|
||||
"forwarded": {
|
||||
"version": "0.1.2",
|
||||
"resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.1.2.tgz",
|
||||
"integrity": "sha1-mMI9qxF1ZXuMBXPozszZGw/xjIQ="
|
||||
},
|
||||
"fresh": {
|
||||
"version": "0.5.2",
|
||||
"resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz",
|
||||
"integrity": "sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac="
|
||||
},
|
||||
"fs.realpath": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz",
|
||||
|
@ -637,6 +800,18 @@
|
|||
"resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-4.1.0.tgz",
|
||||
"integrity": "sha512-carPklcUh7ROWRK7Cv27RPtdhYhUsela/ue5/jKzjegVvXDqM2ILE9Q2BGn9JZJh1g87cp56su/FgQSzcWS8cQ=="
|
||||
},
|
||||
"http-errors": {
|
||||
"version": "1.7.2",
|
||||
"resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.7.2.tgz",
|
||||
"integrity": "sha512-uUQBt3H/cSIVfch6i1EuPNy/YsRSOUBXTVfZ+yR7Zjez3qjBz6i9+i4zjNaoqcoFVI4lQJ5plg63TvGfRSDCRg==",
|
||||
"requires": {
|
||||
"depd": "~1.1.2",
|
||||
"inherits": "2.0.3",
|
||||
"setprototypeof": "1.1.1",
|
||||
"statuses": ">= 1.5.0 < 2",
|
||||
"toidentifier": "1.0.0"
|
||||
}
|
||||
},
|
||||
"http2-wrapper": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/http2-wrapper/-/http2-wrapper-1.0.3.tgz",
|
||||
|
@ -646,6 +821,14 @@
|
|||
"resolve-alpn": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"iconv-lite": {
|
||||
"version": "0.4.24",
|
||||
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz",
|
||||
"integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==",
|
||||
"requires": {
|
||||
"safer-buffer": ">= 2.1.2 < 3"
|
||||
}
|
||||
},
|
||||
"ignore": {
|
||||
"version": "4.0.6",
|
||||
"resolved": "https://registry.npmjs.org/ignore/-/ignore-4.0.6.tgz",
|
||||
|
@ -679,6 +862,11 @@
|
|||
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz",
|
||||
"integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4="
|
||||
},
|
||||
"ipaddr.js": {
|
||||
"version": "1.9.1",
|
||||
"resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz",
|
||||
"integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g=="
|
||||
},
|
||||
"is-extglob": {
|
||||
"version": "2.1.1",
|
||||
"resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz",
|
||||
|
@ -771,6 +959,39 @@
|
|||
"yallist": "^4.0.0"
|
||||
}
|
||||
},
|
||||
"media-typer": {
|
||||
"version": "0.3.0",
|
||||
"resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz",
|
||||
"integrity": "sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g="
|
||||
},
|
||||
"merge-descriptors": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz",
|
||||
"integrity": "sha1-sAqqVW3YtEVoFQ7J0blT8/kMu2E="
|
||||
},
|
||||
"methods": {
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz",
|
||||
"integrity": "sha1-VSmk1nZUE07cxSZmVoNbD4Ua/O4="
|
||||
},
|
||||
"mime": {
|
||||
"version": "1.6.0",
|
||||
"resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz",
|
||||
"integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg=="
|
||||
},
|
||||
"mime-db": {
|
||||
"version": "1.46.0",
|
||||
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.46.0.tgz",
|
||||
"integrity": "sha512-svXaP8UQRZ5K7or+ZmfNhg2xX3yKDMUzqadsSqi4NCH/KomcH75MAMYAGVlvXn4+b/xOPhS3I2uHKRUzvjY7BQ=="
|
||||
},
|
||||
"mime-types": {
|
||||
"version": "2.1.29",
|
||||
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.29.tgz",
|
||||
"integrity": "sha512-Y/jMt/S5sR9OaqteJtslsFZKWOIIqMACsJSiHghlCAyhf7jfVYjKBmLiX8OgpWeW+fjJ2b+Az69aPFPkUOY6xQ==",
|
||||
"requires": {
|
||||
"mime-db": "1.46.0"
|
||||
}
|
||||
},
|
||||
"mimic-response": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-1.0.1.tgz",
|
||||
|
@ -784,6 +1005,11 @@
|
|||
"brace-expansion": "^1.1.7"
|
||||
}
|
||||
},
|
||||
"ms": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
|
||||
"integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g="
|
||||
},
|
||||
"mysql": {
|
||||
"version": "2.18.1",
|
||||
"resolved": "https://registry.npmjs.org/mysql/-/mysql-2.18.1.tgz",
|
||||
|
@ -800,11 +1026,24 @@
|
|||
"resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz",
|
||||
"integrity": "sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc="
|
||||
},
|
||||
"negotiator": {
|
||||
"version": "0.6.2",
|
||||
"resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.2.tgz",
|
||||
"integrity": "sha512-hZXc7K2e+PgeI1eDBe/10Ard4ekbfrrqG8Ep+8Jmf4JID2bNg7NvCPOZN+kfF574pFQI7mum2AUqDidoKqcTOw=="
|
||||
},
|
||||
"normalize-url": {
|
||||
"version": "4.5.0",
|
||||
"resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-4.5.0.tgz",
|
||||
"integrity": "sha512-2s47yzUxdexf1OhyRi4Em83iQk0aPvwTddtFz4hnSSw9dCEsLEGf6SwIO8ss/19S9iBb5sJaOuTvTGDeZI00BQ=="
|
||||
},
|
||||
"on-finished": {
|
||||
"version": "2.3.0",
|
||||
"resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz",
|
||||
"integrity": "sha1-IPEzZIGwg811M3mSoWlxqi2QaUc=",
|
||||
"requires": {
|
||||
"ee-first": "1.1.1"
|
||||
}
|
||||
},
|
||||
"once": {
|
||||
"version": "1.4.0",
|
||||
"resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
|
||||
|
@ -839,6 +1078,11 @@
|
|||
"callsites": "^3.0.0"
|
||||
}
|
||||
},
|
||||
"parseurl": {
|
||||
"version": "1.3.3",
|
||||
"resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz",
|
||||
"integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ=="
|
||||
},
|
||||
"path-is-absolute": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz",
|
||||
|
@ -849,6 +1093,11 @@
|
|||
"resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz",
|
||||
"integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q=="
|
||||
},
|
||||
"path-to-regexp": {
|
||||
"version": "0.1.7",
|
||||
"resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz",
|
||||
"integrity": "sha1-32BBeABfUi8V60SQ5yR6G/qmf4w="
|
||||
},
|
||||
"prelude-ls": {
|
||||
"version": "1.2.1",
|
||||
"resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz",
|
||||
|
@ -864,6 +1113,15 @@
|
|||
"resolved": "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz",
|
||||
"integrity": "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA=="
|
||||
},
|
||||
"proxy-addr": {
|
||||
"version": "2.0.6",
|
||||
"resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.6.tgz",
|
||||
"integrity": "sha512-dh/frvCBVmSsDYzw6n926jv974gddhkFPfiN8hPOi30Wax25QZyZEGveluCgliBnqmuM+UJmBErbAUFIoDbjOw==",
|
||||
"requires": {
|
||||
"forwarded": "~0.1.2",
|
||||
"ipaddr.js": "1.9.1"
|
||||
}
|
||||
},
|
||||
"pump": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz",
|
||||
|
@ -878,11 +1136,32 @@
|
|||
"resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz",
|
||||
"integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A=="
|
||||
},
|
||||
"qs": {
|
||||
"version": "6.7.0",
|
||||
"resolved": "https://registry.npmjs.org/qs/-/qs-6.7.0.tgz",
|
||||
"integrity": "sha512-VCdBRNFTX1fyE7Nb6FYoURo/SPe62QCaAyzJvUjwRaIsc+NePBEniHlvxFmmX56+HZphIGtV0XeCirBtpDrTyQ=="
|
||||
},
|
||||
"quick-lru": {
|
||||
"version": "5.1.1",
|
||||
"resolved": "https://registry.npmjs.org/quick-lru/-/quick-lru-5.1.1.tgz",
|
||||
"integrity": "sha512-WuyALRjWPDGtt/wzJiadO5AXY+8hZ80hVpe6MyivgraREW751X3SbhRvG3eLKOYN+8VEvqLcf3wdnt44Z4S4SA=="
|
||||
},
|
||||
"range-parser": {
|
||||
"version": "1.2.1",
|
||||
"resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz",
|
||||
"integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg=="
|
||||
},
|
||||
"raw-body": {
|
||||
"version": "2.4.0",
|
||||
"resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.4.0.tgz",
|
||||
"integrity": "sha512-4Oz8DUIwdvoa5qMJelxipzi/iJIi40O5cGV1wNYp5hvZP8ZN0T+jiNkL0QepXs+EsQ9XJ8ipEDoiH70ySUJP3Q==",
|
||||
"requires": {
|
||||
"bytes": "3.1.0",
|
||||
"http-errors": "1.7.2",
|
||||
"iconv-lite": "0.4.24",
|
||||
"unpipe": "1.0.0"
|
||||
}
|
||||
},
|
||||
"readable-stream": {
|
||||
"version": "2.3.7",
|
||||
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz",
|
||||
|
@ -938,6 +1217,11 @@
|
|||
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
|
||||
"integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g=="
|
||||
},
|
||||
"safer-buffer": {
|
||||
"version": "2.1.2",
|
||||
"resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
|
||||
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="
|
||||
},
|
||||
"semver": {
|
||||
"version": "7.3.4",
|
||||
"resolved": "https://registry.npmjs.org/semver/-/semver-7.3.4.tgz",
|
||||
|
@ -946,6 +1230,49 @@
|
|||
"lru-cache": "^6.0.0"
|
||||
}
|
||||
},
|
||||
"send": {
|
||||
"version": "0.17.1",
|
||||
"resolved": "https://registry.npmjs.org/send/-/send-0.17.1.tgz",
|
||||
"integrity": "sha512-BsVKsiGcQMFwT8UxypobUKyv7irCNRHk1T0G680vk88yf6LBByGcZJOTJCrTP2xVN6yI+XjPJcNuE3V4fT9sAg==",
|
||||
"requires": {
|
||||
"debug": "2.6.9",
|
||||
"depd": "~1.1.2",
|
||||
"destroy": "~1.0.4",
|
||||
"encodeurl": "~1.0.2",
|
||||
"escape-html": "~1.0.3",
|
||||
"etag": "~1.8.1",
|
||||
"fresh": "0.5.2",
|
||||
"http-errors": "~1.7.2",
|
||||
"mime": "1.6.0",
|
||||
"ms": "2.1.1",
|
||||
"on-finished": "~2.3.0",
|
||||
"range-parser": "~1.2.1",
|
||||
"statuses": "~1.5.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"ms": {
|
||||
"version": "2.1.1",
|
||||
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz",
|
||||
"integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg=="
|
||||
}
|
||||
}
|
||||
},
|
||||
"serve-static": {
|
||||
"version": "1.14.1",
|
||||
"resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.14.1.tgz",
|
||||
"integrity": "sha512-JMrvUwE54emCYWlTI+hGrGv5I8dEwmco/00EvkzIIsR7MqrHonbD9pO2MOfFnpFntl7ecpZs+3mW+XbQZu9QCg==",
|
||||
"requires": {
|
||||
"encodeurl": "~1.0.2",
|
||||
"escape-html": "~1.0.3",
|
||||
"parseurl": "~1.3.3",
|
||||
"send": "0.17.1"
|
||||
}
|
||||
},
|
||||
"setprototypeof": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.1.tgz",
|
||||
"integrity": "sha512-JvdAWfbXeIGaZ9cILp38HntZSFSo3mWg6xGcJJsd+d4aRMOqauag1C63dJfDw7OaMYwEbHMOxEZ1lqVRYP2OAw=="
|
||||
},
|
||||
"shebang-command": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz",
|
||||
|
@ -1002,6 +1329,11 @@
|
|||
"resolved": "https://registry.npmjs.org/sqlstring/-/sqlstring-2.3.1.tgz",
|
||||
"integrity": "sha1-R1OT/56RR5rqYtyvDKPRSYOn+0A="
|
||||
},
|
||||
"statuses": {
|
||||
"version": "1.5.0",
|
||||
"resolved": "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz",
|
||||
"integrity": "sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow="
|
||||
},
|
||||
"string-width": {
|
||||
"version": "4.2.2",
|
||||
"resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.2.tgz",
|
||||
|
@ -1075,6 +1407,11 @@
|
|||
"resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz",
|
||||
"integrity": "sha1-f17oI66AUgfACvLfSoTsP8+lcLQ="
|
||||
},
|
||||
"toidentifier": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.0.tgz",
|
||||
"integrity": "sha512-yaOH/Pk/VEhBWWTlhI+qXxDFXlejDGcQipMlyxda9nthulaxLZUNcUqFxokp0vcYnvteJln5FNQDRrxj3YcbVw=="
|
||||
},
|
||||
"type-check": {
|
||||
"version": "0.4.0",
|
||||
"resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz",
|
||||
|
@ -1088,6 +1425,20 @@
|
|||
"resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.8.1.tgz",
|
||||
"integrity": "sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA=="
|
||||
},
|
||||
"type-is": {
|
||||
"version": "1.6.18",
|
||||
"resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz",
|
||||
"integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==",
|
||||
"requires": {
|
||||
"media-typer": "0.3.0",
|
||||
"mime-types": "~2.1.24"
|
||||
}
|
||||
},
|
||||
"unpipe": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz",
|
||||
"integrity": "sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw="
|
||||
},
|
||||
"uri-js": {
|
||||
"version": "4.4.1",
|
||||
"resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz",
|
||||
|
@ -1101,11 +1452,21 @@
|
|||
"resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",
|
||||
"integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8="
|
||||
},
|
||||
"utils-merge": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz",
|
||||
"integrity": "sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM="
|
||||
},
|
||||
"v8-compile-cache": {
|
||||
"version": "2.3.0",
|
||||
"resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.3.0.tgz",
|
||||
"integrity": "sha512-l8lCEmLcLYZh4nbunNZvQCJc5pv7+RCwa8q/LdUx8u7lsWvPDKmpodJAJNwkAhJC//dFY48KuIEmjtd4RViDrA=="
|
||||
},
|
||||
"vary": {
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz",
|
||||
"integrity": "sha1-IpnwLG3tMNSllhsLn3RSShj2NPw="
|
||||
},
|
||||
"which": {
|
||||
"version": "2.0.2",
|
||||
"resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz",
|
||||
|
|
|
@ -11,6 +11,8 @@
|
|||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"eslint": "^7.22.0",
|
||||
"eslint-config-google": "^0.14.0",
|
||||
"express": "^4.17.1",
|
||||
"got": "^11.8.2",
|
||||
"mysql": "^2.18.1"
|
||||
}
|
||||
|
|
|
@ -5,7 +5,6 @@ const port = 9999;
|
|||
app.use('/bindShelving', require('./methods/bindShelvingTag'));
|
||||
app.use('/insertTicket', require('./methods/bindTicketShelving'));
|
||||
|
||||
|
||||
app.listen(port, () => {
|
||||
console.log(`Example app listening at http://localhost:${port}`)
|
||||
console.log(`Example app listening at http://localhost:${port}`);
|
||||
});
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
const crypto = require('crypto');
|
||||
const got = require('got');
|
||||
const config = require('../config');
|
||||
// const config = require('../config');
|
||||
|
||||
const encryptPassword = async(password) => {
|
||||
const { body } = await got.get('http://app.etiquetaselectronicas.com:9999/user/getErpPublicKey', {
|
||||
});
|
||||
const publicKey=`-----BEGIN PUBLIC KEY-----\n${JSON.parse(body).data}\n-----END PUBLIC KEY-----`;
|
||||
const externKey = {
|
||||
key: publicKey,
|
||||
padding: crypto.constants.RSA_PKCS1_PADDING
|
||||
};
|
||||
let buffer = Buffer.from(password);
|
||||
return crypto.publicEncrypt(externKey, buffer).toString("base64");
|
||||
const encryptPassword = async password => {
|
||||
const {body} = await got.get('http://app.etiquetaselectronicas.com:9999/user/getErpPublicKey', {
|
||||
});
|
||||
const publicKey = `-----BEGIN PUBLIC KEY-----\n${JSON.parse(body).data}\n-----END PUBLIC KEY-----`;
|
||||
const externKey = {
|
||||
key: publicKey,
|
||||
padding: crypto.constants.RSA_PKCS1_PADDING
|
||||
};
|
||||
let buffer = Buffer.from(password);
|
||||
return crypto.publicEncrypt(externKey, buffer).toString('base64');
|
||||
};
|
||||
|
||||
exports.encryptPassword = encryptPassword;
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
function isBarcode(toFilter){
|
||||
const exp = /^A0A3B82[A-F0-9][A-F0-9][A-F0-9][A-F0-9][A-F0-9]$/
|
||||
return exp.test(toFilter)
|
||||
function isBarcode(toFilter) {
|
||||
const exp = /^A0A3B82[A-F0-9][A-F0-9][A-F0-9][A-F0-9][A-F0-9]$/;
|
||||
return exp.test(toFilter);
|
||||
}
|
||||
function isShelving(toFilter){
|
||||
const exp = /^[A-Z][A-Z][A-Z]$/
|
||||
return exp.test(toFilter)
|
||||
function isShelving(toFilter) {
|
||||
const exp = /^[A-Z][A-Z][A-Z]$/;
|
||||
return exp.test(toFilter);
|
||||
}
|
||||
exports.isBarcode = isBarcode;
|
||||
exports.isShelving = isShelving;
|
||||
exports.isShelving = isShelving;
|
||||
|
|
Reference in New Issue