WMS_MAIN/app/model/pack_task_packer.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

79 lines
1.9 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 } = app.Sequelize;
const PackTaskPacker = app.model.define('pack_task_packer', {
id: {
type: BIGINT(20).UNSIGNED,
primaryKey: true,
autoIncrement: true,
comment: '主键ID',
},
pack_task_id: {
type: BIGINT(20).UNSIGNED,
allowNull: false,
comment: '打包任务ID,关联 wms_pack_task.id',
},
account_id: {
type: BIGINT(20).UNSIGNED,
allowNull: false,
comment: '账号ID,关联 wms_account.id',
},
account_name: {
type: STRING(128),
allowNull: false,
comment: '账号姓名快照',
},
seq: {
type: TINYINT.UNSIGNED,
allowNull: false,
defaultValue: 0,
comment: '排序序号',
},
create_time: {
type: DATE,
allowNull: false,
comment: '创建时间',
},
update_time: {
type: DATE,
allowNull: false,
comment: '更新时间',
},
deleted_at: {
type: DATE,
allowNull: true,
comment: '删除时间',
},
}, {
tableName: 'wms_pack_task_packer',
timestamps: true,
createdAt: 'create_time',
updatedAt: 'update_time',
paranoid: true,
deletedAt: 'deleted_at',
comment: '打包任务-打包人关系表',
indexes: [
{ name: 'uix_pack_task_account', fields: [ 'pack_task_id', 'account_id' ], unique: true },
{ name: 'idx_account_id', fields: [ 'account_id' ] },
{ name: 'idx_pack_task_id', fields: [ 'pack_task_id' ] },
],
});
PackTaskPacker.associate = () => {
app.model.PackTaskPacker.belongsTo(app.model.PackTask, {
foreignKey: 'pack_task_id',
targetKey: 'id',
as: 'packTask',
});
app.model.PackTaskPacker.belongsTo(app.model.Account, {
foreignKey: 'account_id',
targetKey: 'id',
as: 'account',
});
};
return PackTaskPacker;
};