优化提交预检、废卡按钮置灰与等待超时提示
This commit is contained in:
@@ -80,6 +80,15 @@ export function startJobPoll(id: string): void {
|
||||
const cancelled = r.jobState === 6
|
||||
const finished = r.jobState === 100
|
||||
const terminal = failed || cancelled
|
||||
// 失败当刻立即取打印机错误串(与 USB 收集轮询对齐),避免渲染层事后取到通用/过期文案
|
||||
let errorMessage = ''
|
||||
if (failed) {
|
||||
try {
|
||||
errorMessage = dll.dllGetPrinterErrorStr(-1) || ''
|
||||
} catch (e) {
|
||||
log.warn('GetPrinterErrorStr on job failed failed', e)
|
||||
}
|
||||
}
|
||||
const tick = {
|
||||
jobId,
|
||||
queryErrorCode: r.queryErrorCode,
|
||||
@@ -88,7 +97,8 @@ export function startJobPoll(id: string): void {
|
||||
terminal,
|
||||
failed,
|
||||
cancelled,
|
||||
finished
|
||||
finished,
|
||||
errorMessage
|
||||
}
|
||||
emitTrace('[poll] job:poll-tick', tick)
|
||||
send('job:poll-tick', tick)
|
||||
|
||||
@@ -44,6 +44,8 @@ let SAPI_PrinterMovetoreject: any = null
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
let SAPI_PrinterMovetousbreader: any = null
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
let SAPI_PrinterMovetohopper: any = null
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
let SAPI_GetPrinterCardPosition: any = null
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
let SAPI_PrinterCheckstatus: any = null
|
||||
@@ -55,6 +57,7 @@ let hasCheckstatusApi = false
|
||||
let hasCancelApi = false
|
||||
let hasUploadApi = false
|
||||
let hasUsbReaderApi = false
|
||||
let hasHopperApi = false
|
||||
let loggedCancelMissing = false
|
||||
let loggedRejectMissing = false
|
||||
|
||||
@@ -206,6 +209,7 @@ function loadLibrary(): void {
|
||||
cancel: hasCancelApi,
|
||||
reject: hasRejectApi,
|
||||
usbReader: hasUsbReaderApi,
|
||||
hopper: hasHopperApi,
|
||||
cardPosition: hasCardPositionApi,
|
||||
checkstatus: hasCheckstatusApi
|
||||
})
|
||||
@@ -231,6 +235,11 @@ export function isUsbReaderApiAvailable(): boolean {
|
||||
return hasUsbReaderApi
|
||||
}
|
||||
|
||||
export function isHopperApiAvailable(): boolean {
|
||||
loadLibrary()
|
||||
return hasHopperApi
|
||||
}
|
||||
|
||||
export function isCardPositionApiAvailable(): boolean {
|
||||
loadLibrary()
|
||||
return hasCardPositionApi
|
||||
|
||||
Reference in New Issue
Block a user