修复备卡位 13 自动续做:卡位 API 解析与会话同步
兼容 workDll 返回值即卡位编号的语义,启动卡位轮询时同步主进程 mode,并修正续做失败时的 phase 时序。
This commit is contained in:
@@ -287,9 +287,12 @@ export function registerIpcHandlers(): void {
|
||||
return ok()
|
||||
})
|
||||
|
||||
tracedHandle('poll:card-position-start', async () => {
|
||||
tracedHandle('poll:card-position-start', async (_e, sessionMode?: 'distributing' | 'usbCopying') => {
|
||||
try {
|
||||
assertReady()
|
||||
if (sessionMode === 'distributing' || sessionMode === 'usbCopying') {
|
||||
mainAppState.mode = sessionMode
|
||||
}
|
||||
const dll = await loadDllModule()
|
||||
if (!dll.isCardPositionApiAvailable()) {
|
||||
return fail(CS_FAIL, '当前 DLL 不支持卡位查询,无法自动续做')
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import path from 'path'
|
||||
import koffi from 'koffi'
|
||||
import log from 'electron-log'
|
||||
import { normalizeCardPositionQuery } from '@shared/card-position'
|
||||
import { CS_OK, JOB_ID_BUF_SIZE, LOG_FATAL_FLAG } from '../constants'
|
||||
import { emitTrace, isTraceEnabled } from '../utils/trace-bridge'
|
||||
import { getNativeDir } from './native-path'
|
||||
@@ -396,9 +397,9 @@ export function dllGetPrinterCardPosition(): { queryCode: number; position: numb
|
||||
return traceCall('SAPI_GetPrinterCardPosition', undefined, () => {
|
||||
loadLibrary()
|
||||
if (!SAPI_GetPrinterCardPosition) throw new Error('CARD_POSITION_API_UNAVAILABLE')
|
||||
const position = [0]
|
||||
const queryCode = SAPI_GetPrinterCardPosition!(position) as number
|
||||
return { queryCode, position: position[0] }
|
||||
const out = [0]
|
||||
const ret = SAPI_GetPrinterCardPosition!(out) as number
|
||||
return normalizeCardPositionQuery(ret, out[0])
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user