5130-arc_counter #2

Merged
alexm merged 5 commits from 5130-arc_counter into dev 2023-02-06 08:59:03 +00:00
4 changed files with 12 additions and 9 deletions
Showing only changes of commit 99d6f81671 - Show all commits

View File

@ -3,9 +3,11 @@ import counter from './counter.js';
export default async(rfids, arcId) => {
console.logger.info('PRINTING...');
const palletId = await con.query(`CALL vn.expeditionPallet_build(JSON_ARRAY(?), ?, ?, @palletId);`, [Array.from(codes), arcId, null]);
console.log([Array.from(rfids), arcId, null]);
await con.query(`CALL vn.expeditionPallet_build(JSON_ARRAY(?), ?, ?, @palletId);`, [Array.from(rfids), arcId, null]);
const palletId = await con.query(`SELECT @palletId;`);
alexm marked this conversation as resolved Outdated
Outdated
Review

No fa falta seleccionar el id pallet per saber si ha donat error, deuría de ficarse un try { } catch ... en la crida a vn.expeditionPallet_build

No fa falta seleccionar el id pallet per saber si ha donat error, deuría de ficarse un `try { } catch ...` en la crida a `vn.expeditionPallet_build`
console.log(palletId);
await counter(null, arcId);
if (!palletId)
console.logger.info({error: 'ERROR_CREATING_PALLET', expeditions: rfids});
alexm marked this conversation as resolved Outdated
Outdated
Review

Que traduzca el error tambien

Que traduzca el error tambien
console.logger.error({error: 'ERROR_CREATING_PALLET', expeditions: rfids});
alexm marked this conversation as resolved Outdated
Outdated
Review

Ficar dins del catch anterior

Ficar dins del catch anterior
};

View File

@ -10,7 +10,7 @@ export default async data => {
const jsonResult = JSON.parse(crudeRfid);
let epcHex = jsonResult?.tagInventoryEvent?.epcHex;
if (!epcHex) return;
if (!epcHex) continue;
if (epcHex.search('AABB') == -1) continue;
epcHex = epcHex.replace('AABB', '');
@ -23,8 +23,9 @@ export default async data => {
antenna: jsonResult.tagInventoryEvent.antennaPort
};
const rfidsParsedExtended = [];
rfidsParsedExtended.push(rfidParsed);
rfidsParsed.add(rfidParsed.code);
rfidsParsed.push(rfidParsed);
}
}

View File

@ -1,7 +1,7 @@
import got from 'got';
import rfidParser from './rfidParser.js';
import newPallet from './newPallet.js';
import debug from '../util/streamDebug.js';
import debug from '../util/debugStream.js';
import counter from './counter.js';
let interval;
@ -16,10 +16,11 @@ export default async(conf, cb) => {
stream
.on('data', async value => {
const parsed = await rfidParser(value);
console.log(parsed.codes);
alexm marked this conversation as resolved Outdated
Outdated
Review

Has oblidat llevar este console.log? Plenara el log del servidor de ruido

Has oblidat llevar este console.log? Plenara el log del servidor de ruido
rfidbuffer = new Set([...rfidbuffer, ...parsed.codes]);
rfidbufferExtend = rfidbufferExtend.concat(parsed.extended);
debug(rfidbuffer, rfidbufferExtend);
debug({codes: rfidbuffer, extended: rfidbufferExtend}, conf);
if (rfidbuffer.size) {
clearTimeout(interval);

View File

@ -1,6 +1,5 @@
export default parsed => {
export default (parsed, conf) => {
if (conf.env != 'dev') return;
// TOTAL
console.log('TOTAL BUFFER: ', parsed.codes.size);