update binShelving and bindShelvingTag

This commit is contained in:
llopis15 2021-03-11 16:39:10 +01:00
parent 35cbbdfa94
commit 4a4269ca05
3 changed files with 82 additions and 44 deletions

View File

@ -1,50 +1,27 @@
const insert = require('./utilities/inserts');
function smartTag(barcode, shelving, level){
const got = require('got');
function bindShelving(barcode, shelving, level){
const config = require('./config');
const got = require('got');
(async() => {
insert.insertShelving(shelving, level);
const info = await config.info
let key = info.data.token;
(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: shelving + level
}
]
},
responseType: 'json',
headers: {
"Authorization": key
}
})
console.log(body)
})();
})();
const { body } = await got.post('http://app.etiquetaselectronicas.com:9999/bind/batchBind', {
json: {
storeId: config.storeId,
tagItemBinds: [{
eslBarcode: barcode,
itemBarcode: shelving + level
}
]
},
responseType: 'json',
headers: {
"Authorization": key
}
})
console.log(body)
})();
})();
}
///DATOS INTRODUCIDOS POR EL USUARIO////
var barcode = "A0A3B820690F"; //valido = "A0A3B82"+ 4 CARACTERES HEXADECIMALES (0-F)
var shelving = "BCD"; //valido = 3 CARACTERES LETRAS (A-Z)
var level = "1";
//////////////////////////////////////
if(insert.filter(barcode,"barcode")){
if(insert.filter(shelving,"shelving")){
smartTag(barcode, shelving, level);
}
else{
console.log("¡MATRICULA INCORRECTA!")
}
}
else{
console.log("¡CODIGO DE ETIQUETA INCORRECTO!")
}
exports.bindShelving = bindShelving;

27
bindShelvingTag.js Normal file
View File

@ -0,0 +1,27 @@
const insertShelving = require('./insertShelving');
const bindShelving = require('./bindShelving');
function smartTag(barcode, shelving, level){
insertShelving.insertShelving(shelving, level);
bindShelving.bindShelving(barcode, shelving, level);
}
///DATOS INTRODUCIDOS POR EL USUARIO////
var barcode = "A0A3B820690F"; //valido = "A0A3B82"+ 4 CARACTERES HEXADECIMALES (0-F)
var shelving = "BCD"; //valido = 3 CARACTERES LETRAS (A-Z)
var level = "1";
smartTag(barcode, shelving, level);
//////////////////////////////////////
/*if(insert.filter(barcode,"barcode")){
if(insert.filter(shelving,"shelving")){
smartTag(barcode, shelving, level);
}
else{
console.log("¡MATRICULA INCORRECTA!")
}
}
else{
console.log("¡CODIGO DE ETIQUETA INCORRECTO!")
}
*/

34
insertShelving.js Normal file
View File

@ -0,0 +1,34 @@
function insertShelving(shelving, level){
const config = require('./config');
const got = require('got');
(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: shelving + level,//Matricula + nivel
itemTitle: "Etiqueta Sin ticket",
}
]
},
responseType: 'json',
headers: {
"Authorization": key
}
})
console.log(body)
})();
})();
}
exports.insertShelving = insertShelving;