diff --git a/package.json b/package.json index 844c3c7..4367db5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "rfidnatura", - "version": "1.0.1", + "version": "1.0.2", "author": "Verdnatura Levante SL", "description": "Print server RFID", "license": "GPL-3.0", diff --git a/worker/worker.js b/worker/worker.js index dad381c..ac4d2cc 100644 --- a/worker/worker.js +++ b/worker/worker.js @@ -85,7 +85,7 @@ async function getRecord() { await conn.beginTransaction(); const [rows] = await conn.query(` SELECT * FROM expedition_PrintOut - WHERE isPrinted = 10 + WHERE isPrinted = 0 LIMIT 1 FOR UPDATE `); if (!rows.length) { @@ -93,7 +93,7 @@ async function getRecord() { return; } const record = rows[0]; - await updateState(conn, record.expeditionFk, 12) + await updateState(conn, record.expeditionFk, 2) await conn.commit(); return record; } catch (error) { @@ -121,16 +121,16 @@ async function processRecord(record) { const isSendResult = await sendZPL(zplData['VerdNatura Label RFID'].zpl, ipAddress); if (isSendResult) { - await updateState(conn, record.expeditionFk, 11) + await updateState(conn, record.expeditionFk, 1) log('success', `(${record.expeditionFk}) Print completed successfully`); } else { - await updateState(conn, record.expeditionFk, 13) + await updateState(conn, record.expeditionFk, 3) log('error', `(${record.expeditionFk}) Print not completed`); } parentPort.postMessage('done'); } catch (error) { log('error', `Unable to process the record ${error}`); - await updateState(conn, record.expeditionFk, 13) + await updateState(conn, record.expeditionFk, 3) parentPort.postMessage('error'); } finally { conn.release();