WMS_MAIN/app/lib/callback_functions.js
liufumingren 89e4cd22c0 feat(waybill): 运单物流轨迹表与 waybill.getTrace 批量更新
- 新增 wms_order_express_trace(1 运单 : N 轨迹):express_id 关联主表,
  冗余 waybill_code / order_id,warehouse_id 隔离,raw_data 存原始报文;
  uk_express_op_scan(express_id, op_time, scan_type) 幂等;字符集与主表一致
- 新增出站回调 waybill.getTrace(注册到 callback_functions,管理端可勾选):
  入参与 waybill.getreceive 一致({ request: { waybill_codes: [...] } },单批 10 单,
  signMode=simple);响应 [{ waybillNo, trace: {...} }],兼容 trace 数组与 {code,data} 包装
- 新增 waybill.warehouse.updateTrace / updateTraceTaskProgress:
  复用导出任务的异步任务ID与进度模式(前缀 waybill_trace_),
  支持 waybillCodes 或与 waybill.warehouse.list 一致的 where 条件圈选(上限 5000);
  轨迹按 (express_id, op_time, scan_type) upsert,未匹配运单计入 not_found
- 文档:methods/system.json(0.3.325)、变更记录、设计文档 2.2.1/3.9、出站回调说明 3.7

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-11-11 19:53:29 +08:00

40 lines
1.5 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 } }],'
+ '落库 wms_order_express_trace(按 express_id + op_time + scan_type 幂等)',
},
];
/** method 合法值集合(供管理端 create/update 校验) */
const CALLBACK_METHOD_SET = new Set(CALLBACK_FUNCTIONS.map(item => item.method));
module.exports = {
CALLBACK_FUNCTIONS,
CALLBACK_METHOD_SET,
};