- 微信开放平台:首次授权时写入系统默认用户须知作为首个协议版本 (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 接口写入的运行时数据文件,未纳入本次提交。
82 lines
2.3 KiB
JavaScript
82 lines
2.3 KiB
JavaScript
'use strict';
|
||
|
||
/**
|
||
* 容器(篮筐)资产登记表 Model。
|
||
*
|
||
* 对应数据库表 `wms_container`,登记仓库的物理容器(篮筐)资产:
|
||
* 容器编号、使用状态、是否损坏、损坏说明、备注等。
|
||
* 同一仓库内容器编号唯一,通过 warehouse_id 做数据隔离维度。
|
||
* 后续散单拣货把购物车商品临时转移到容器时,通过 status 标记占用/空闲。
|
||
* @param {import('egg').Application} app - Egg 应用实例
|
||
*/
|
||
module.exports = app => {
|
||
const { BIGINT, STRING, ENUM } = app.Sequelize;
|
||
|
||
const Container = app.model.define('wms_container', {
|
||
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: '登记人名称快照',
|
||
},
|
||
}, {
|
||
tableName: 'wms_container',
|
||
comment: '容器(篮筐)资产登记表',
|
||
timestamps: true,
|
||
createdAt: 'created_at',
|
||
updatedAt: 'updated_at',
|
||
paranoid: false,
|
||
indexes: [
|
||
{ name: 'uk_warehouse_container_no', unique: true, fields: [ 'warehouse_id', 'container_no' ] },
|
||
{ name: 'idx_warehouse_id', fields: [ 'warehouse_id' ] },
|
||
{ name: 'idx_status', fields: [ 'status' ] },
|
||
{ name: 'idx_is_damaged', fields: [ 'is_damaged' ] },
|
||
],
|
||
});
|
||
|
||
return Container;
|
||
};
|