fix bugs
gitea/vn-rfid/pipeline/head This commit looks good
Details
gitea/vn-rfid/pipeline/head This commit looks good
Details
This commit is contained in:
parent
ebbc27b56d
commit
99d6f81671
|
@ -3,9 +3,11 @@ import counter from './counter.js';
|
||||||
|
|
||||||
export default async(rfids, arcId) => {
|
export default async(rfids, arcId) => {
|
||||||
console.logger.info('PRINTING...');
|
console.logger.info('PRINTING...');
|
||||||
|
console.log([Array.from(rfids), arcId, null]);
|
||||||
const palletId = await con.query(`CALL vn.expeditionPallet_build(JSON_ARRAY(?), ?, ?, @palletId);`, [Array.from(codes), arcId, null]);
|
await con.query(`CALL vn.expeditionPallet_build(JSON_ARRAY(?), ?, ?, @palletId);`, [Array.from(rfids), arcId, null]);
|
||||||
|
const palletId = await con.query(`SELECT @palletId;`);
|
||||||
|
console.log(palletId);
|
||||||
await counter(null, arcId);
|
await counter(null, arcId);
|
||||||
if (!palletId)
|
if (!palletId)
|
||||||
console.logger.info({error: 'ERROR_CREATING_PALLET', expeditions: rfids});
|
console.logger.error({error: 'ERROR_CREATING_PALLET', expeditions: rfids});
|
||||||
};
|
};
|
||||||
|
|
|
@ -10,7 +10,7 @@ export default async data => {
|
||||||
const jsonResult = JSON.parse(crudeRfid);
|
const jsonResult = JSON.parse(crudeRfid);
|
||||||
let epcHex = jsonResult?.tagInventoryEvent?.epcHex;
|
let epcHex = jsonResult?.tagInventoryEvent?.epcHex;
|
||||||
|
|
||||||
if (!epcHex) return;
|
if (!epcHex) continue;
|
||||||
if (epcHex.search('AABB') == -1) continue;
|
if (epcHex.search('AABB') == -1) continue;
|
||||||
|
|
||||||
epcHex = epcHex.replace('AABB', '');
|
epcHex = epcHex.replace('AABB', '');
|
||||||
|
@ -23,8 +23,9 @@ export default async data => {
|
||||||
antenna: jsonResult.tagInventoryEvent.antennaPort
|
antenna: jsonResult.tagInventoryEvent.antennaPort
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const rfidsParsedExtended = [];
|
||||||
|
rfidsParsedExtended.push(rfidParsed);
|
||||||
rfidsParsed.add(rfidParsed.code);
|
rfidsParsed.add(rfidParsed.code);
|
||||||
rfidsParsed.push(rfidParsed);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import got from 'got';
|
import got from 'got';
|
||||||
import rfidParser from './rfidParser.js';
|
import rfidParser from './rfidParser.js';
|
||||||
import newPallet from './newPallet.js';
|
import newPallet from './newPallet.js';
|
||||||
import debug from '../util/streamDebug.js';
|
import debug from '../util/debugStream.js';
|
||||||
import counter from './counter.js';
|
import counter from './counter.js';
|
||||||
|
|
||||||
let interval;
|
let interval;
|
||||||
|
@ -16,10 +16,11 @@ export default async(conf, cb) => {
|
||||||
stream
|
stream
|
||||||
.on('data', async value => {
|
.on('data', async value => {
|
||||||
const parsed = await rfidParser(value);
|
const parsed = await rfidParser(value);
|
||||||
|
console.log(parsed.codes);
|
||||||
rfidbuffer = new Set([...rfidbuffer, ...parsed.codes]);
|
rfidbuffer = new Set([...rfidbuffer, ...parsed.codes]);
|
||||||
rfidbufferExtend = rfidbufferExtend.concat(parsed.extended);
|
rfidbufferExtend = rfidbufferExtend.concat(parsed.extended);
|
||||||
|
|
||||||
debug(rfidbuffer, rfidbufferExtend);
|
debug({codes: rfidbuffer, extended: rfidbufferExtend}, conf);
|
||||||
|
|
||||||
if (rfidbuffer.size) {
|
if (rfidbuffer.size) {
|
||||||
clearTimeout(interval);
|
clearTimeout(interval);
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
export default parsed => {
|
export default (parsed, conf) => {
|
||||||
if (conf.env != 'dev') return;
|
if (conf.env != 'dev') return;
|
||||||
|
|
||||||
// TOTAL
|
// TOTAL
|
||||||
console.log('TOTAL BUFFER: ', parsed.codes.size);
|
console.log('TOTAL BUFFER: ', parsed.codes.size);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue