出站回调:
- 新增 warehouse_notify.json 文档(notify.ping/notify.reply),与 warehouse.json 互跳
- 回调体统一 { method, code, data },method 放 query,body 为业务数据
- MD5 签名: sign=MD5(appSecret+timestamp+bodyJson)
- 回调响应: {code:200} 成功,非200/非code:200 视为失败
- docs 页面支持模拟推送调试
搜索增强(searchStock/searchWarehouseStock):
- 直接查 stock_warehouse,不再依赖 stock_store
- 新增字段: gross_weight/box_spec/packing_requirements/prohibited_type
- 管理标识: is_sn_mgmt/is_shelf_life_mgmt/is_batch_mgmt
- 条码关联: wms_stock_barcodes
- 图片: wms_file_reference(business_type=stock)+wms_file,返回数组
- id 修正为 stock_warehouse.id
推送状态完善:
- handleApiMessage 增加 push_status 更新(2成功/3失败)
- 未配回调地址 → push_status=3 + error 原因
- 回调异常 catch 也更新 push_status=3 + 写日志
- 出站日志写入 wms_warehouse_log 表(WN-前缀)
消息列表:
- keyword 兼容 content/keyword,支持数组
- keyword 搜索 content/group_name/user_name 三列
- 支持 where+operator 结构化查询(parseWhereConditions)
- storeId=-1 查询无货主消息; storeId=0→IS NULL
- 日期范围: startDate/endDate
其他:
- silent 动作: AI 识别无需回复时跳过回执
- ai_enabled 灰度开关(群级)
- bindCode 文档修正
- store_name 改用 StoreWarehouse.store_remask
84 lines
2.5 KiB
JavaScript
84 lines
2.5 KiB
JavaScript
'use strict';
|
||
|
||
const TABLE_NAME = 'wms_inbox_block';
|
||
|
||
/**
|
||
* 将屏蔽表从 group_name/user_name 切换为 group_id/user_id + warehouse_id。
|
||
* 群名称和用户名可能变更或含特殊字符,改用稳定ID。
|
||
*/
|
||
module.exports = {
|
||
up: async (queryInterface, Sequelize) => {
|
||
// 1. 新增 warehouse_id(不允许为空,给历史数据默认值 0)
|
||
const cols = await queryInterface.describeTable(TABLE_NAME);
|
||
if (!cols.warehouse_id) {
|
||
await queryInterface.addColumn(TABLE_NAME, 'warehouse_id', {
|
||
type: Sequelize.INTEGER(10),
|
||
allowNull: false,
|
||
defaultValue: 0,
|
||
comment: '仓库ID',
|
||
});
|
||
}
|
||
|
||
// 2. 新增 group_id
|
||
if (!cols.group_id) {
|
||
await queryInterface.addColumn(TABLE_NAME, 'group_id', {
|
||
type: Sequelize.STRING(100),
|
||
allowNull: true,
|
||
comment: '群ID',
|
||
});
|
||
}
|
||
|
||
// 3. 新增 user_id
|
||
if (!cols.user_id) {
|
||
await queryInterface.addColumn(TABLE_NAME, 'user_id', {
|
||
type: Sequelize.STRING(100),
|
||
allowNull: true,
|
||
comment: '用户ID',
|
||
});
|
||
}
|
||
|
||
// 4. 检查是否已有旧列,有则删除
|
||
const colsAfter = await queryInterface.describeTable(TABLE_NAME);
|
||
if (colsAfter.group_name) {
|
||
await queryInterface.removeColumn(TABLE_NAME, 'group_name');
|
||
}
|
||
if (colsAfter.user_name) {
|
||
await queryInterface.removeColumn(TABLE_NAME, 'user_name');
|
||
}
|
||
|
||
// 5. 添加唯一索引
|
||
await queryInterface.addIndex(TABLE_NAME, {
|
||
name: 'uk_warehouse_group_user',
|
||
unique: true,
|
||
fields: [ 'warehouse_id', 'group_id', 'user_id' ],
|
||
});
|
||
},
|
||
|
||
down: async (queryInterface, Sequelize) => {
|
||
// 回滚:恢复旧列
|
||
const cols = await queryInterface.describeTable(TABLE_NAME);
|
||
if (!cols.group_name) {
|
||
await queryInterface.addColumn(TABLE_NAME, 'group_name', {
|
||
type: Sequelize.STRING(100),
|
||
allowNull: true,
|
||
comment: '群名称',
|
||
});
|
||
}
|
||
if (!cols.user_name) {
|
||
await queryInterface.addColumn(TABLE_NAME, 'user_name', {
|
||
type: Sequelize.STRING(100),
|
||
allowNull: true,
|
||
comment: '用户名称',
|
||
});
|
||
}
|
||
|
||
// 删除新列
|
||
if (cols.group_id) await queryInterface.removeColumn(TABLE_NAME, 'group_id');
|
||
if (cols.user_id) await queryInterface.removeColumn(TABLE_NAME, 'user_id');
|
||
if (cols.warehouse_id) await queryInterface.removeColumn(TABLE_NAME, 'warehouse_id');
|
||
|
||
// 删除唯一索引
|
||
await queryInterface.removeIndex(TABLE_NAME, 'uk_warehouse_group_user');
|
||
},
|
||
};
|