This repository has been archived on 2024-10-02. You can view files and clone it, but cannot push or open issues or pull requests.
smart-tag/utilities/inserts.js

47 lines
1.5 KiB
JavaScript
Raw Normal View History

2021-03-11 14:41:03 +00:00
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)
})();
})();
}
function filter(toFilter, type){
if(type=="barcode"){
exp = /A0A3B82[A-F0-9][A-F0-9][A-F0-9][A-F0-9][A-F0-9]/
}
if(type=="shelving"){
exp = /[A-F][A-F][A-F]/
}
return exp.test(toFilter)
}
exports.insertShelving = insertShelving;
exports.filter = filter;