- 微信开放平台:首次授权时写入系统默认用户须知作为首个协议版本 (ctx.service.systems.wechat.ensureDefaultAgreementVersion),含 seed / backfill 两个迁移 - 新增扫描报文接收接口 POST /scan:把「时间 + 条码」追加写入项目根目录 scan_records.xlsx (串行队列 + 原子写,避免并发写坏文件) - 新增 wms_container(容器/笼筐)模型与建表迁移 - 退件收货单 / 退件运单列表:like 查询条件支持字符串数组(多关键词 OR) - 新增 wms_return_unpack.created_at 索引迁移 - package.json:deploy 脚本改名为 depeeloy 注:scan_records.xlsx 是 /scan 接口写入的运行时数据文件,未纳入本次提交。
99 lines
3.2 KiB
JavaScript
99 lines
3.2 KiB
JavaScript
'use strict';
|
||
|
||
/**
|
||
* 创建容器(篮筐)资产登记表 wms_container。
|
||
*
|
||
* 用于登记仓库的物理容器(篮筐)资产:容器编号、使用状态、是否损坏、损坏说明、备注等。
|
||
* 同一仓库内容器编号唯一(uk_warehouse_container_no),通过 warehouse_id 做数据隔离。
|
||
*
|
||
* 后续用途:散单拣货把购物车商品临时转移到容器时,通过 status 标记容器占用/空闲。
|
||
*
|
||
* 字段:
|
||
* warehouse_id 仓库ID(数据隔离维度)
|
||
* container_no 容器编号(篮筐编号)
|
||
* status 使用状态(idle=空闲 in_use=占用)
|
||
* is_damaged 是否损坏(Y=损坏 N=正常)
|
||
* damage_remark 损坏说明
|
||
* remark 备注
|
||
* creator_id / creator_name 登记人
|
||
* created_at / updated_at 审计时间
|
||
*
|
||
* 索引:
|
||
* uk_warehouse_container_no(warehouse_id + container_no 唯一)
|
||
* idx_warehouse_id
|
||
* idx_status
|
||
* idx_is_damaged
|
||
*/
|
||
|
||
const TABLE_NAME = 'wms_container';
|
||
|
||
module.exports = {
|
||
// eslint-disable-next-line no-unused-vars
|
||
async up(queryInterface, Sequelize) {
|
||
const { BIGINT, STRING, ENUM, DATE } = Sequelize;
|
||
await queryInterface.createTable(TABLE_NAME, {
|
||
id: {
|
||
type: BIGINT(20).UNSIGNED,
|
||
primaryKey: true,
|
||
autoIncrement: true,
|
||
allowNull: false,
|
||
comment: '主键ID',
|
||
},
|
||
warehouse_id: {
|
||
type: BIGINT(20).UNSIGNED,
|
||
allowNull: false,
|
||
comment: '仓库ID(数据隔离维度)',
|
||
},
|
||
container_no: {
|
||
type: STRING(50),
|
||
allowNull: false,
|
||
comment: '容器编号(篮筐编号)',
|
||
},
|
||
status: {
|
||
type: ENUM('idle', 'in_use'),
|
||
allowNull: false,
|
||
defaultValue: 'idle',
|
||
comment: '使用状态:idle=空闲 in_use=占用(散单商品临时转移)',
|
||
},
|
||
is_damaged: {
|
||
type: ENUM('Y', 'N'),
|
||
allowNull: false,
|
||
defaultValue: 'N',
|
||
comment: '是否损坏:Y=损坏 N=正常',
|
||
},
|
||
damage_remark: {
|
||
type: STRING(255),
|
||
allowNull: true,
|
||
comment: '损坏说明',
|
||
},
|
||
remark: {
|
||
type: STRING(500),
|
||
allowNull: true,
|
||
comment: '备注',
|
||
},
|
||
creator_id: {
|
||
type: BIGINT(20).UNSIGNED,
|
||
allowNull: false,
|
||
comment: '登记人账户ID',
|
||
},
|
||
creator_name: {
|
||
type: STRING(50),
|
||
allowNull: true,
|
||
comment: '登记人名称快照',
|
||
},
|
||
created_at: { type: DATE, allowNull: false, comment: '创建时间' },
|
||
updated_at: { type: DATE, allowNull: false, comment: '更新时间' },
|
||
});
|
||
|
||
await queryInterface.addIndex(TABLE_NAME, [ 'warehouse_id', 'container_no' ], { unique: true, name: 'uk_warehouse_container_no' });
|
||
await queryInterface.addIndex(TABLE_NAME, [ 'warehouse_id' ], { name: 'idx_warehouse_id' });
|
||
await queryInterface.addIndex(TABLE_NAME, [ 'status' ], { name: 'idx_status' });
|
||
await queryInterface.addIndex(TABLE_NAME, [ 'is_damaged' ], { name: 'idx_is_damaged' });
|
||
},
|
||
|
||
// eslint-disable-next-line no-unused-vars
|
||
async down(queryInterface, Sequelize) {
|
||
await queryInterface.dropTable(TABLE_NAME);
|
||
},
|
||
};
|