This commit is contained in:
seb
2026-10-31 23:39:12 +01:00
parent 545eb98191
commit ca28f56f3f
2 changed files with 38 additions and 47 deletions

View File

@@ -89,12 +89,23 @@ export const printerjob = {
/**
* POST /api/printerjob/cancel-all
* Cancels all pending/processing jobs, optionally scoped to an agentprinter.
* Falls back to listing and cancelling individual jobs if needed.
* Sends ~JA to clear printer buffer and cancels all queued jobs.
* @param {{ agentprinterId?: number }} [payload]
* → { success: true, cancelledCount: number, jobs: PrinterJob[] }
*/
async cancelAll({ agentprinterId } = {}) {
if (agentprinterId != null) {
try {
await this.createZplJob({
agentprinterId: Number(agentprinterId),
data: '~JA',
copiescount: 1,
});
} catch (e) {
console.warn('Failed to send ~JA to printer:', e);
}
}
try {
return await http('/api/printerjob/cancel-all', {
method: 'POST',