From 16134e88c64e935f9bc8319ac33a01a14cabbff8 Mon Sep 17 00:00:00 2001 From: liufumingren Date: Tue, 13 Oct 2026 20:43:02 +0800 Subject: [PATCH] =?UTF-8?q?feat(workbench):=20=E6=89=93=E5=8C=85=E5=BC=80?= =?UTF-8?q?=E5=A7=8B=E4=B8=8B=E5=8F=91=20OSD=20=E5=89=8D=E8=B7=B3=E8=BD=AC?= =?UTF-8?q?=E6=91=84=E5=83=8F=E5=A4=B4=E9=A2=84=E8=AE=BE=E7=82=B91?= =?UTF-8?q?=EF=BC=8C=E5=A4=B1=E8=B4=A5=E4=BB=85=E5=91=8A=E8=AD=A6=E4=B8=8D?= =?UTF-8?q?=E9=98=BB=E5=A1=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/service/systems/workbench.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/app/service/systems/workbench.js b/app/service/systems/workbench.js index fe45b98..9c1f0c3 100644 --- a/app/service/systems/workbench.js +++ b/app/service/systems/workbench.js @@ -53,6 +53,8 @@ const OSD_CACHE_KEY_PREFIX = 'osd_'; const OSD_CACHE_TTL_SECONDS = 3600; /** @type {string} 打包任务结束(空闲态)时的摄像头 OSD 叠加文字 */ const OSD_IDLE_TEXT = '无任务'; +/** @type {number} 打包开始(下发 OSD)时工作台摄像头跳转的预置点编号 */ +const PACK_PRESET_GOTO_ID = 1; class WorkbenchService extends Service { /** @@ -1210,6 +1212,8 @@ class WorkbenchService extends Service { const OsdClient = require('../../lib/osd_client'); const osdClient = new OsdClient(ctx); + const PtzClient = require('../../lib/ptz_client'); + const ptzClient = new PtzClient(ctx); try { await Promise.all(cameraIds.map(async cameraId => { @@ -1220,6 +1224,21 @@ class WorkbenchService extends Service { }); if (!camera || !camera.ip) return; + // 打包开始:先跳转预设点1(机位复位),失败仅告警,不影响 OSD 下发 + try { + const presetResult = await ptzClient.presetGoto({ + camera, + warehouseId, + presetId: PACK_PRESET_GOTO_ID, + }); + if (!presetResult.success) { + ctx.logger.warn('[Workbench._packOrder] 预设点跳转失败 cameraId=%d presetId=%d error=%s', + cameraId, PACK_PRESET_GOTO_ID, presetResult.error || '打印服务返回异常'); + } + } catch (presetErr) { + ctx.logger.warn('[Workbench._packOrder] 预设点跳转异常 cameraId=%d err=%s', cameraId, presetErr.message); + } + const result = await osdClient.setOsd({ camera, warehouseId,