This commit is contained in:
Guillermo Bonet 2022-11-10 18:25:21 +01:00
parent f57ad11409
commit 11f960b7a5
3 changed files with 10 additions and 6 deletions

View File

@ -5,7 +5,7 @@ async function main() {
await printServer.start();
process.on('SIGINT', async function() {
console.log('Got SIGINT.');
console.log(`\nBye ( ◕ ‿ ◕ )っ`);
try {
await printServer.stop();
} catch (err) {

View File

@ -88,7 +88,8 @@ class PrintServer {
if (!printJob) return;
jobId = printJob.id;
this.method = printJob.method;
await conn.query(updateQuery, ['printing', null, jobId]);
await conn.commit();
} catch (err) {
@ -102,9 +103,10 @@ class PrintServer {
for (const row of res[0])
args[row.name] = row.value;
try {
let methodPath = this.method.replace('{id}', args.param);
const response = await axios({
method: 'get',
url: `${conf.salix.url}/api/Tickets/${args.param}/collection-label?access_token=${this.token}`,
url: `${conf.salix.url}/api/${methodPath}?access_token=${this.token}`,
responseType: 'arraybuffer',
headers: {
'Content-Type': 'application/json',

View File

@ -2,12 +2,14 @@ SELECT pq.id,
r.name report,
p.name printer,
pqa.name arg,
pqa.value
pqa.value,
r.method
FROM printQueue pq
JOIN report r ON r.id = pq.reportFk
JOIN printQueueArgs pqa ON pqa.printQueueFk = pq.id
LEFT JOIN printer p ON p.id = pq.printerFk
WHERE r.name = ?
AND statusCode = 'queued'
ORDER BY priorityFk ASC
AND pq.statusCode = 'queued'
AND NOT r.method IS NULL
ORDER BY pq.priorityFk ASC
LIMIT 1