WMS_MAIN/app/model/workbench.js
liufumingren 95067aeb8a feat(wms): 工作台成员、波次范围、库存明细与报表修复等多项更新
- workbench: 工作台成员拆分 wms_workbench_member 表,下线 barcode 字段,新增绑定/移除成员接口

- order: 订单配送新增 wave_scope 波次范围字段与历史回填,自动分配快递排除备注与储位分配限制修复

- storage.transaction.list: 重写为 wms_storage_transaction 逐条明细查询,消除聚合慢查询

- stock.report: 分页默认生效、排序白名单扩充、where.stock_id 数组兼容修复

- storage.entry: quickInbound/commit 新增 noNeedNotice 通知开关

- storage.inventory.list: stock_query 支持数组多关键字并集匹配

- store: 手工单回传通知策略 notify_manual_sync

- docs: 同步接口文档与变更记录、路由表;test: 补充快递排除与储位分配限制测试
2026-09-05 22:43:38 +08:00

96 lines
2.3 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位,绑定后生成)',
},
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;
};