liufumingren f8aa4c4899 feat(工作台): 成员扫码登入、面单摄像头与虚拟通道
- 工作台成员扫码登入:workstation_login_records 记录谁在什么时候登入/下线了哪台工作台,
  超时(团购 1h / 散单 30min)由 schedule/workstation_idle_offline 自动下线;
  运单查询的 packers 取当时的登入成员
- 面单摄像头识别:workstation_cameras.is_label_camera + service/label_scan 下发本机该跑的识别配置,
  设备端(桌面端 LabelScan 工作线程)按配置做面单识别并上报
- 虚拟通道 CAM-<工作台id>:工作台没接扫码枪时,面单摄像头那一路顶替扫码枪上报,records 规则按 ws_type 区分
- 桌面端:新增 LabelScanMonitor/LabelScanWorker/ScanDeviceKind 与面单预览页,扫描通道支持改名,静默窗口 5s

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-10-29 17:19:24 +08:00

159 lines
4.5 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/**
* 视频接入:NVR / 摄像头 / 工作台 —— 类型定义
*
* 后端返回的字段名同时存在驼峰与下划线(Sequelize 的 toJSON 习惯),
* 页面只用驼峰字段,下划线字段忽略即可。
*/
/** NVR 录像机 */
export interface Nvr {
id: number;
userId?: number | null;
name: string;
host: string;
port: number;
username: string;
serialNumber?: string | null;
deviceModel?: string | null;
channelCount: number;
lastSyncAt?: string | null;
lastError?: string | null;
status: number;
remark?: string | null;
createdAt?: string;
updatedAt?: string;
}
/** 摄像头(NVR 通道) */
export interface Camera {
id: number;
nvrId: number;
channelNo: number;
name: string;
/** 设备上的通道名(可能为空) */
channelName?: string | null;
type: 'analog' | 'digital' | string;
ip?: string | null;
port?: number | null;
enabled: number;
status: number;
remark?: string | null;
nvr?: {
id: number;
name: string;
host: string;
port: number;
serialNumber?: string | null;
userId?: number | null;
} | null;
/** 已被哪个工作台绑定(null = 可绑);来自 /cameras/options */
boundWorkstation?: { id: number; code?: string; name?: string } | null;
}
/** 工作台 */
export interface Workstation {
id: number;
userId?: number | null;
code: string;
name: string;
/** 1 散单工作台 2 团购工作台 */
wsType?: number;
/** 录制范围:触发点之前秒数(团购=扫码前,散单=任务结束前) */
recordBeforeSec?: number;
/** 录制范围:触发点之后秒数 */
recordAfterSec?: number;
/** 最大录制时长(秒),默认 240 */
recordMaxSec?: number;
/** 最后活跃时间(扫码上报 / 有人登录时刷新) */
lastActiveAt?: string | null;
/** 多少秒不活跃自动下线所有成员(团购 3600 / 散单 1800) */
idleTimeoutSec?: number;
status: number;
remark?: string | null;
/** 合成画布(默认 1920×1080) */
canvasWidth?: number;
canvasHeight?: number;
cameraCount?: number;
scanChannelCount?: number;
createdAt?: string;
updatedAt?: string;
/** Sequelize 实际输出的下划线时间字段 */
created_at?: string;
updated_at?: string;
}
/** 工作台-摄像头绑定 */
export interface WorkstationCameraLink {
id: number;
workstationId: number;
cameraId: number;
sortNo: number;
remark?: string | null;
/** 合成画面里的矩形(像素,相对画布) */
x?: number;
y?: number;
width?: number;
height?: number;
/** 0 主码流 1 子码流 */
streamType?: number;
zIndex?: number;
/** 1 = 面单摄像头(散单/团购都能设,一台工作台最多一路) */
isLabelCamera?: number;
camera?: (Camera & { displayName?: string }) | null;
}
/** 工作台-扫码通道绑定 */
export interface WorkstationScanChannelLink {
id: number;
workstationId: number;
scannerId: number;
channelId: string;
channelName?: string | null;
sortNo: number;
remark?: string | null;
scanner?: { id: number; sn: string; name?: string | null; status?: number } | null;
/** true = 面单摄像头自动占用的虚拟通道(`CAM-<工作台id>`),服务端维护,不能人工解绑 */
virtual?: boolean;
}
/** 工作台详情 */
export interface WorkstationDetail extends Workstation {
cameras: WorkstationCameraLink[];
scanChannels: WorkstationScanChannelLink[];
}
/** 可绑定的扫码通道(来自中控上报) */
export interface AvailableScanChannel {
id: number;
scannerId: number;
channelId: string;
channelName?: string | null;
scanner?: { id: number; sn: string; name?: string | null; status?: number } | null;
/** 已被哪个工作台绑定(null = 可绑) */
boundWorkstation?: { id: number; code?: string; name?: string } | null;
}
/**
* 工作台成员登录记录(`workstation_login_records`)
*
* `status = 1` 在线、`0` 已下线;`name` 是登录当时记下的名字
* (主体成员 = 成员姓名/工号,非成员 = 用户昵称)。
*/
export interface WorkstationMember {
id: number;
subjectId: number;
workstationId: number;
userId: number;
memberId?: number | null;
name: string;
/** 1 扫码登录(预留扩展) */
type?: number;
loginAt: string;
logoutAt?: string | null;
status: number;
/** manual / offline_all / reset_code(旧)/ idle_timeout / relogin / workstation_deleted */
logoutReason?: string | null;
loginIp?: string | null;
user?: { id: number; username?: string | null; nickname?: string | null } | null;
}