5130-arc_counter #2
|
@ -1,13 +1,12 @@
|
||||||
import con from '../db/connect.js';
|
import con from '../db/connect.js';
|
||||||
import counter from './counter.js';
|
import counter from './counter.js';
|
||||||
|
import t from '../util/translator.js';
|
||||||
|
|
||||||
export default async(rfids, arcId) => {
|
export default async(rfids, arcId) => {
|
||||||
console.logger.info('PRINTING...');
|
try {
|
||||||
console.log([Array.from(rfids), arcId, null]);
|
|
||||||
await con.query(`CALL vn.expeditionPallet_build(JSON_ARRAY(?), ?, ?, @palletId);`, [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 as palletId;`);
|
|
||||||
|
|
||||||
await counter(null, arcId);
|
await counter(null, arcId);
|
||||||
alexm marked this conversation as resolved
Outdated
|
|||||||
if (!palletId)
|
} catch (error) {
|
||||||
console.logger.error({error: 'ERROR_CREATING_PALLET', expeditions: rfids});
|
await con.query(`UPDATE vn.arcRead SET error = ?, counter = NULL WHERE id = ?;`, [t(error.sqlMessage), arcId]);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
alexm marked this conversation as resolved
Outdated
juan
commented
Ficar dins del catch anterior Ficar dins del catch anterior
|
|||||||
|
|
|
@ -16,7 +16,7 @@ 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);
|
|
||||||
alexm marked this conversation as resolved
Outdated
juan
commented
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
|
|||||||
if (!parsed.codes.size) return;
|
if (!parsed.codes.size) return;
|
||||||
rfidbuffer = new Set([...rfidbuffer, ...parsed.codes]);
|
rfidbuffer = new Set([...rfidbuffer, ...parsed.codes]);
|
||||||
rfidbufferExtend = rfidbufferExtend.concat(parsed.extended);
|
rfidbufferExtend = rfidbufferExtend.concat(parsed.extended);
|
||||||
|
@ -37,7 +37,7 @@ export default async(conf, cb) => {
|
||||||
});
|
});
|
||||||
|
|
||||||
function createPallet() {
|
function createPallet() {
|
||||||
clearTimeout(interval); // try remove
|
clearTimeout(interval);
|
||||||
|
|
||||||
newPallet(rfidbuffer, conf.arcId);
|
newPallet(rfidbuffer, conf.arcId);
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
TRUCK_NOT_AVAILABLE: No hay un camión disponible
|
|
@ -0,0 +1,8 @@
|
||||||
|
import yml from 'require-yml';
|
||||||
|
import path from 'path';
|
||||||
|
|
||||||
|
export default function t(expression) {
|
||||||
|
const {pathname: root} = new URL('./locale', import.meta.url);
|
||||||
|
let es = yml(path.join(root, 'es.yml')) || {};
|
||||||
|
return es[expression] || expression;
|
||||||
|
}
|
Loading…
Reference in New Issue
No fa falta seleccionar el id pallet per saber si ha donat error, deuría de ficarse un
try { } catch ...
en la crida avn.expeditionPallet_build
Que traduzca el error tambien