feat: refs #4452 Changed to normal states
gitea/rfidnatura/pipeline/head This commit looks good Details

This commit is contained in:
Guillermo Bonet 2024-12-17 13:20:11 +01:00
parent 88a04673cc
commit 894f881019
2 changed files with 6 additions and 6 deletions

View File

@ -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",

View File

@ -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();