WMS_MAIN/app/lib/callback_functions.js
liufumingren 9af7dcf8fb feat(storeWarehouse): 签约关系接口配置按货主开放接口落库且回调地址统一取配置
- storeWarehouse.store.saveApiConfig:新增 resolveContractApiInterfaceType,
  interface_type_id=3(OPEN_API_WAREHOUSE 仓库开放接口)自动映射为 2(OPEN_API 货主开放接口)落库,
  不再要求当前主体为仓库(货主可维护自身签约关系下的接口配置)
- callback_url 不再取入参(含 callbackUrl 别名),统一写入 config.openapi.defaultCallbackUrl(新增配置项,默认空)
- storeWarehouse.store.listApiConfig:interface_type_id 过滤同步映射(传 3 按 2 查询)
- 文档:methods/system.json 升级 0.3.350、methods/changes/system.json 变更记录、docs/openapi-callback-events.md 回调地址来源说明
- 测试:saveApiConfig 新增 4 条用例(3→2 落库、忽略入参回调地址、默认值未配置、货主主体可保存、缺失类型 404),listApiConfig 新增 1 条过滤映射用例

同时提交工作区其余在制品改动:
- waybill:移除 wms_order_express_trace 模型并新增 drop 迁移,轨迹查询/取号/打印链路调整
- order:订单 SN 编码(order_item_sn / order_item_sn_log / sn_code_rule、has_sn_item 回填迁移),pendingOrder/recheckOrder/wave/base 调整
- express_platform、order_async、order_export、order_storage_allocation、storage.report、stock_store 配套修复
- lib:新增 jd_client,调整 qimen_client、callback_functions 及配套测试

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-11-14 17:14:04 +08:00

39 lines
1.4 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';
/**
* 出站回调 method 注册表(代码注册,管理端多选列表经拉取接口透出)。
*
* method 即出站路由键:wms_api_app.callback_functions 勾选后,
* 出站回调按 warehouse_id + method 自动路由到承接该 method 的应用;
* callback_functions 为空/未勾选 = 不承接任何回调。
*
* 新增出站回调能力时在此登记 method,管理端接口自动可见。
*/
const CALLBACK_FUNCTIONS = [
{
method: 'notify.reply',
name: '站内信通知回执',
description: '站内信/系统通知/回执出站推送(warehouseNotify 与 inbox 回执共用)',
},
{
method: 'waybill.getreceive',
name: '运单揽收状态查询',
description: '按运单号批量查询是否已揽收:请求 { waybill_codes: [...] },'
+ '外部返回 [{ waybill_code, is_galaxy_receive: 1|0 }],回写 wms_order_express.is_galaxy_receive',
},
{
method: 'waybill.getTrace',
name: '运单物流轨迹查询',
description: '按运单号查询物流轨迹(实时回源,不落库):请求 { waybill_codes: [运单号] },'
+ '外部返回 [{ waybillNo, trace: { opTime, outBizCode, memo, opOrgCityName, weight, scanType } }]',
},
];
/** method 合法值集合(供管理端 create/update 校验) */
const CALLBACK_METHOD_SET = new Set(CALLBACK_FUNCTIONS.map(item => item.method));
module.exports = {
CALLBACK_FUNCTIONS,
CALLBACK_METHOD_SET,
};