oms/backend/database/migrations/20261107030000-add-print-history-ids-to-waybill-fetch-records.js
liufumingren 7f8cff808b feat(waybill): 取号时解析并留痕打印记录ID(PrintHistoryIds)
平台 ExpressPrint 响应里有 Data.PrintHistoryIds,元素 { Id, Pid, WaybillCode,
WaybillCodeChild, BatchIndex },其中 Id 即 printHistoryId:重打/作废/查打印记录
(PrintHistory/LoadPrintData)都按它回捞。之前只用了 WaybillCode/printinfo,
这块被丢掉了。

- dgj.fetchWaybillNo 解析为 [{ id, pid, waybill_code, batch_index }]
- waybillGet 写入 waybill_fetch_records.print_history_ids(JSON 数组,多包裹对齐)
- 仅本地留痕,不改回 WMS 的响应契约
- 迁移 20261107030000 加列;单测覆盖真实响应样例与多包裹/缺失字段

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-11-07 06:26:46 +08:00

24 lines
864 B
JavaScript
Raw Permalink 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';
/**
* 取号记录增加「打印记录」(店管家 `PrintHistoryIds`)。
*
* 平台每打印一张面单就新增一条打印历史,`Id` 即 printHistoryId:重打/作废/查打印记录
* (`PrintHistory/LoadPrintData`)都按它回捞,因此取号成功时落库留痕。
* 多包裹时存 JSON 数组,元素形如 `{ id, pid, waybill_code, batch_index }`。
*/
module.exports = {
async up(queryInterface, Sequelize) {
await queryInterface.addColumn('waybill_fetch_records', 'print_history_ids', {
type: Sequelize.TEXT,
allowNull: true,
comment: '打印记录(平台 PrintHistoryIds,JSON 数组:id/pid/waybill_code/batch_index)',
after: 'signature',
});
},
async down(queryInterface) {
await queryInterface.removeColumn('waybill_fetch_records', 'print_history_ids');
},
};