feat(workbench): 打包开始下发 OSD 前跳转摄像头预设点1,失败仅告警不阻塞

This commit is contained in:
liufumingren 2026-10-13 20:43:02 +08:00
parent 938e46e04c
commit 16134e88c6

View File

@ -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,