WMS_MAIN/app/model/workbench.js
liufumingren 5b3180ff34 feat(workbench): 新增工作台/打包台模块 (workbench/pack_task)
- 新增 model: workbench, pack_task, pack_task_packer

- 新增 systemMethods: workbench (finishPack/sendWeight/操作日志)

- systems/workbench 扩展: 波次订单ID获取、打包操作日志白名单

- 10 条迁移: 建表→扩展→权限→重构
2026-07-27 03:46:37 +08:00

83 lines
2.1 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: '工作台名称(用户自定义)',
},
barcode: {
type: STRING(100),
allowNull: true,
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',
},
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: 'idx_barcode', fields: ['barcode'] },
{ name: 'uk_warehouse_barcode', unique: true, fields: ['warehouse_id', 'barcode', 'deleted_at'] },
{ name: 'idx_deleted_at', fields: ['deleted_at'] },
],
});
return Workbench;
};