WMS_MAIN/database/migrations/20260917140000-add-extend-props-to-inbox-message.js
liufumingren c2a761ca26 feat(inbox): 新增开门/到货/进场/离场车牌登记与 extend_props 持久化
- functions 新增 openDoor/registerLicensePlate/enter/departure(规则表+权限分组)
- 到货登记表 wms_inbox_arrival_register(含消费字段,离场闭环,货主收货群优先推送)
- 回执 extend_props 持久化落库与定时补发送下发(重推兜底回读)
- 车牌提取正则兼容异体字(粤/粵)
- 售后类型/关键字/函数/回复 v2 模型与迁移
- INBOX V2 HTTP 测试报告与指南
2026-09-17 02:41:43 +08:00

37 lines
1.2 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_inbox_message 增加 extend_props 列(回执扩展属性持久化,幂等)。
*
* 背景:出站回执 notify.reply 的 extend_props(如开门指令等空文案回执的驱动属性)
* 此前只在首推时随报文发出,不落库。手动/定时重推时无法恢复 extend_props,
* 且 content 为空的 extend_props 回执被重推扫描直接跳过。加列后:
* - 首推写库持久化;重推从记录原样带回;
* - 空文案但含 extend_props 的出站记录可被重推。
*/
const TABLE = 'wms_inbox_message';
module.exports = {
up: async (queryInterface, Sequelize) => {
const tables = await queryInterface.showAllTables();
const exists = tables.some(t => (typeof t === 'string' ? t : t.tableName) === TABLE);
if (!exists) return;
const columns = await queryInterface.describeTable(TABLE);
if (columns.extend_props) return;
await queryInterface.addColumn(TABLE, 'extend_props', {
type: Sequelize.JSON,
allowNull: true,
defaultValue: null,
comment: '回执扩展属性(notify.reply 的 extend_props),重推时原样带回',
after: 'ext_data',
});
},
down: async () => {
// 不回退(新列无副作用)
},
};