WMS_MAIN/app/model/workbench.js
liufumingren 6939d9600a feat: 拦截链路完善与车绑定修复
- 订单表新增 intercept_time 拦截时间字段(迁移覆盖基表与全部分表),全拦截链路写入拦截时间、解除拦截清空

- 新增自动库内拦截确定定时任务(1h 间隔,扫描 requested+未打印订单,超时自动库内拦截确定)

- 复核链路自动移除波次内未打印拦截订单回池,拦截解除后可重新抓取发货

- 打印解绑车判定排除拦截订单,修复波次含拦截订单时车无法解锁

- 同步 methods 文档与变更记录;含 wave_scope 回填、workbench token 过期等前序迁移
2026-09-07 03:48:43 +08:00

101 lines
2.5 KiB
JavaScript
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.

'use strict';
module.exports = app => {
const { STRING, BIGINT, DATE, TINYINT, ENUM, JSON: JSON_TYPE } = app.Sequelize;
const Workbench = app.model.define('workbench', {
id: {
type: BIGINT(20).UNSIGNED,
primaryKey: true,
autoIncrement: true,
comment: '主键ID',
},
warehouse_id: {
type: BIGINT(20).UNSIGNED,
allowNull: false,
comment: '仓库ID',
},
name: {
type: STRING(100),
allowNull: false,
comment: '工作台名称(用户自定义)',
},
status: {
type: TINYINT,
allowNull: false,
defaultValue: 1,
comment: '状态:0-禁用 1-启用',
},
type: {
type: ENUM('personal', 'group'),
allowNull: false,
defaultValue: 'personal',
comment: '工作台类型:personal-个人工作台 group-团体工作台',
},
remark: {
type: STRING(500),
allowNull: true,
comment: '备注',
},
device_ids: {
type: JSON_TYPE,
allowNull: true,
comment: '设备ID列表,如 [1,2,3],触发打包任务时透传到 wms_pack_task.device_ids',
},
login_code: {
type: STRING(64),
allowNull: true,
comment: '工作台登录码(前缀+随机,64位,全局唯一)',
},
token: {
type: STRING(64),
allowNull: true,
comment: '工作台令牌(随机64位,绑定后生成)',
},
token_updated_at: {
type: DATE,
allowNull: true,
comment: '工作台 token 最后更新时间(无 token 时为 NULL)',
},
created_at: {
type: DATE,
allowNull: false,
comment: '创建时间',
},
updated_at: {
type: DATE,
allowNull: false,
comment: '更新时间',
},
deleted_at: {
type: DATE,
allowNull: true,
comment: '软删除时间',
},
}, {
tableName: 'wms_workbench',
timestamps: true,
createdAt: 'created_at',
updatedAt: 'updated_at',
paranoid: true,
deletedAt: 'deleted_at',
comment: '工作台表',
indexes: [
{ name: 'idx_warehouse_id', fields: [ 'warehouse_id' ] },
{ name: 'uk_login_code', unique: true, fields: [ 'login_code' ] },
{ name: 'idx_token', fields: [ 'token' ] },
{ name: 'idx_deleted_at', fields: [ 'deleted_at' ] },
],
});
Workbench.associate = () => {
app.model.Workbench.hasMany(app.model.WorkbenchMember, {
foreignKey: 'workbench_id',
sourceKey: 'id',
as: 'members',
});
};
return Workbench;
};