u
This commit is contained in:
@@ -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',
|
||||
|
||||
Reference in New Issue
Block a user