WMS_MAIN/database/migrations/20260812160000-create-wms-return-received.js
liufumingren f4ed985556 feat: 新增退回收到模块(returnReceived)
- 新增退回收到登记表 wms_return_received 及模型、建表迁移
- 新增扫码登记/列表/详情/删除接口(systemMethods + systems 分层)
- 退回收到联动:标记运单 is_back、完结拦截工单、订单退回状态、操作记录
- 新增权限 527/528/529 + 菜单 530,授权仓库/客服角色
- 解除拦截不再清除 is_back(由退回收货流程单独管理)
- 同步 API 文档、method 路由速查
2026-08-13 01:58:55 +08:00

88 lines
3.0 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';
/**
* 创建退回收到登记表 wms_return_received。
*
* 字段:仓库隔离 warehouse_id、退回收件运单号 waybill_code、扫描日期 scan_date、
* 扫描人员 scanner_id/scanner_name、运单关联 order_express_id/order_id/store_id(非必填)。
*
* 索引:
* idx_warehouse_waybill_scan_date(30 日幂等查询)
* idx_warehouse_scan_date(仓库+日期隔离查询)
* idx_scanner_id / idx_order_express_id / idx_store_id
*/
module.exports = {
// eslint-disable-next-line no-unused-vars
async up(queryInterface, Sequelize) {
const { BIGINT, STRING, DATE } = Sequelize;
await queryInterface.createTable('wms_return_received', {
id: {
type: BIGINT(20).UNSIGNED,
primaryKey: true,
autoIncrement: true,
allowNull: false,
comment: '主键ID',
},
warehouse_id: {
type: BIGINT(20).UNSIGNED,
allowNull: false,
comment: '仓库ID(数据隔离维度)',
},
waybill_code: {
type: STRING(50),
allowNull: false,
comment: '退回收件运单号(扫描到的退回包裹单号)',
},
scan_date: {
type: DATE,
allowNull: false,
comment: '扫描收到日期',
},
scanner_id: {
type: BIGINT(20).UNSIGNED,
allowNull: false,
comment: '扫描人员工号ID(employees_id)',
},
scanner_name: {
type: STRING(50),
allowNull: false,
comment: '扫描人员工号名称快照(employees_name / real_name)',
},
order_express_id: {
type: BIGINT(20).UNSIGNED,
allowNull: true,
comment: '运单表关联字段,关联 wms_order_express.id;非必填',
},
order_id: {
type: BIGINT(20).UNSIGNED,
allowNull: true,
comment: '订单ID,方便快速匹配;非必填',
},
store_id: {
type: BIGINT(20).UNSIGNED,
allowNull: true,
comment: '货主ID,原单退回时回填,用于查货主备注',
},
remark: {
type: STRING(500),
allowNull: true,
comment: '备注',
},
created_at: { type: DATE, allowNull: false },
updated_at: { type: DATE, allowNull: false },
});
await queryInterface.addIndex('wms_return_received', [ 'warehouse_id', 'waybill_code', 'scan_date' ], { name: 'idx_warehouse_waybill_scan_date' });
await queryInterface.addIndex('wms_return_received', [ 'warehouse_id', 'scan_date' ], { name: 'idx_warehouse_scan_date' });
await queryInterface.addIndex('wms_return_received', [ 'scanner_id' ], { name: 'idx_scanner_id' });
await queryInterface.addIndex('wms_return_received', [ 'order_express_id' ], { name: 'idx_order_express_id' });
await queryInterface.addIndex('wms_return_received', [ 'store_id' ], { name: 'idx_store_id' });
},
// eslint-disable-next-line no-unused-vars
async down(queryInterface, Sequelize) {
await queryInterface.dropTable('wms_return_received');
},
};