diff --git a/docs/B2B订单-批量打印拣货单-设计与实施.md b/docs/B2B订单-批量打印拣货单-设计与实施.md index 4d04c514..f06e27a5 100644 --- a/docs/B2B订单-批量打印拣货单-设计与实施.md +++ b/docs/B2B订单-批量打印拣货单-设计与实施.md @@ -132,6 +132,16 @@ FROM wms_print_template WHERE id = 17; 配送B2B(dispatch 分表)本次未在线上取到样本验证;若返回空 items,拣货单只打表头, 控制台会打印 `[B2B拣货单] 获取分箱明细失败` 便于定位。 - 模板下拉框仍会同时列出波次的「拣货单」(id=16),选错时明细列会是空的(列名/字段不同)。 +- **商品条码空白(2026-11-21 生产问题,已在前端兜底)**:`order.getB2bPackingSnapshot` 的 + `items[].item_code`(以及 `item_snapshot.item_code` / `item_snapshot.barcode`)对**部分商品返回空串**, + 实测 11 单 16 个商品里 7 个为空(如「九子白洁面皂」stock_id=158212),而同一商品在 + `order.pendingOrder.detail` 的 `items[]` 里 `item_code` 正常(`6928535128409`)。 + 处理:`use-b2b-picking-print.ts` 新增 `fetchItemDetail` 选项,明细中出现空条码时再打一次订单明细接口, + 按 `order_item_id` → `stock_id` 回填(`resolveB2bItemCode` / `mergeItemCodesFromDetail`)。 + 根治仍需后端:快照接口按 `stock_id` join 商品表取 `item_code`(B2B 备货窗口 `B2bPrepForm` + 的「商品编码」同样只用快照,也存在空白)。 +- `item_code` 实际是**商品编码**(可能形如 `6950893732059#1000`、`MooCola-0002`),真正可扫描的条码在 + `barcodes[]`;模板列名「商品条码」目前绑 `item_code`,如需真条码应改绑新字段。 - 拣货单不含分箱箱号;如需箱号,在 `loadB2bPickingPrintData` 的 details 里补 `boxes` 字段并加到模板表格。 - 模板是**生产库**上的 id=17;若本地 dev 连的是测试库(`192.168.11.56:6060`),需在测试库同法把 PICKING 的自定义模板 改成同一版式(列 `item_code / item_name / plan_qty / pick_locations_text`),否则默认模板匹配不到、预览需手动选模板。 diff --git a/docs/单号字段命名-全量快照-2026-11-21.md b/docs/单号字段命名-全量快照-2026-11-21.md new file mode 100644 index 00000000..6ab855e1 --- /dev/null +++ b/docs/单号字段命名-全量快照-2026-11-21.md @@ -0,0 +1,879 @@ +# 单号字段命名 · 全量快照(2026-11-21) + +> **冻结文件**:本文件记录改名前的完整现状,用于后续对比、排查与回滚。 +> **禁止修改已有条目**;后续如发现遗漏,只在文末「补录」追加,并注明日期与来源。 +> 方案与决策见:`docs/运单号命名-统一方案-讨论稿.md`(与本快照分离)。 + +## 0. 快照信息 + +| 项 | 值 | +|---|---| +| 快照日期 | 2026-11-21 | +| 基线提交 | `7714b646` | +| 工作区状态 | 干净(无未提交改动) | +| 运行环境 | `http://localhost:5174`(本地测试环境) | +| 扫描范围 | `src/views/**`、`src/components/**`、`src/lang/**`、`src/api/**` 注释 | +| 行号说明 | 均为基线提交下的行号,改代码后会漂移 | +| 未覆盖 | 后端返回的导出/打印模板字段、PDA/小程序端、后端接口文档内部命名 | + +### 使用与回滚 + +```powershell +# 对比改名前后差异 +git diff 7714b646 -- src + +# 单文件回滚 +git checkout 7714b646 -- src/views/order/orderManagement/config/order-common-config.ts +``` + +--- + +## 1. 全局字段别名索引 + +### 1.1 运单域 + +| 字段 | 页面出现的文案 | 典型位置 | +|---|---|---| +| `waybill_code` | 运单号 / 快递单号 / 退回运单号 / 退回收件运单号 / 主单号 | 订单详情面板、售后、退件、拆包、打包流水 | +| `waybill_codes` | 运单号 / 快递单号 | 订单列表、订单详情、导出 | +| `waybill_no` | 运单号 / 关联运单号 / 运单号 / 波次号(合并列) | 售后、称重、复核、工单、打印确认 | +| `main_waybill_code` | 主单号 | 快递号列表/详情、按运单转出弹窗 | +| `express_numbers` | 快递单号 / 运单号(B2B 改写) | 订单管理列表 | +| `express_codes` | 运单号(列 prop) | 出库单列表 | +| `express_code` | 快递单号 / 运单号 / 快递公司编码(接口语义) | 订单详情、异常/归档详情、入库单、出库单接口 | +| `tracking_no` | 物流单号 | 波次管理 | +| `tracking_number` | 物流单号 | 收货单 | + +### 1.2 订单 / 平台 / 支付 + +| 字段 | 页面出现的文案 | 典型位置 | +|---|---|---| +| `delivery_order_code` | 发货单号 / 外部订单号 / 发货订单号 / 订单号 / 搜索订单号 | 订单管理、售后、工单、称重、波次 | +| `order_code` | 发货单号 / 订单号 | 异常/归档详情、归档面板 | +| `delivery_no` | 订单号 | 波次管理 | +| `order_no` | 订单号 / 发货单号 / 单号 | 快递号、商品流水、拆包、出入库记录 | +| `order_delivery_no` | 发货订单号 / 关联发货订单号 | 售后、工单 | +| `source_order_codes` | 平台交易单号 / 平台单号 / 平台订单号 / 来源订单号 | 订单、售后、创建订单/售后 | +| `source_order_code` | 平台单号 | 旧订单明细组件 | +| `pre_delivery_order_code` | 前置单号 | 订单列表/详情 | +| `pre_delivery_order_id` | 前置单ID | 订单详情 | +| `pay_no` | 支付单号 | 订单详情 | + +### 1.3 各业务单据 + +| 字段 | 页面出现的文案 | 典型位置 | +|---|---|---| +| `entry_order_code` | 入库单号 | 入库单列表/详情、创建售后 | +| `inbound_order_no` | 入库单号 | 库存、效期预警、收货单内库存 | +| `entry_order_no` | 入库单号 | 售后列表/详情、工单 | +| `purchase_order_code` | 单据编号 | 入库单列表/详情 | +| `receiving_number` | 收货单号 | 收货单、入库单绑定收货单 | +| `receiving_no` | 收货单号 / 关联收货单号 | 售后、工单 | +| `receiving_code` | 收货单号 | 创建售后选单 | +| `stockout_order_code` | 出库单号 | 出库单、创建售后 | +| `order_stockout_no` | 出库单号 / 关联出库单号 | 售后、工单 | +| `unpack_no` | 拆包单号 | 退回拆包、转出弹窗 | +| `check_no` | 盘点单号 | 库存盘点 | +| `after_sale_no` | 售后单号 / 工单号(我的工单页) | 售后、我的工单 | +| `work_order_no` | 工单号 | 站内信消息 | +| `wave_no` | 波次号 / 波次编号 / 抓取波次号(导出) | 订单、波次、打包流水 | +| `task_no` | 任务编号 | 拣货任务 | +| `batch_no` / `batch_number` | 批次号 | 库存、流水、效期、收货明细 | +| `extend_props` | 转单订单号 | 出库单列表 | + +--- + +## 2. 订单管理 + +> 文件:`src/views/order/orderManagement/config/order-common-config.ts`(除特别标注) + +### 2.1 列表列 + +| 页面 / 页签 | 位置 | prop | 文案 | +|---|---|---|---| +| 待审核订单 | `reviewColums:2229` → `2232` | `delivery_order_code` | 发货单号 | +| 待审核订单 | `2233` | `wave_no` | 波次号 | +| 待审核订单 | `2239` | `source_order_codes` | 平台交易单号 | +| 待处理订单 / 待出库订单 | `pendingCloums:2420` → `2423` | `delivery_order_code` | 发货单号 | +| 待处理订单 / 待出库订单 | `2424` | `wave_no` | 波次号 | +| 待处理订单 / 待出库订单 | `2442` | `express_numbers` | **快递单号** | +| 待处理订单 / 待出库订单 | `2452` | `source_order_codes` | 平台交易单号 | +| 待出库订单 | `outboundColumns = pendingCloums`(`2897`) | 同上 | 同上 | +| 委托外仓订单 / 配送异常订单 | `views/order/orderManagement/entrustWarehouse.vue`、`deliveryException.vue` | - | 实测仅显示「发货单号」 | +| 待处理B2B订单 | `2537` | `express_numbers`(改写) | **运单号** | +| 待处理B2B订单 | `2541` | `pre_delivery_order_code` | 前置单号 | +| 配送订单 | `deliveryColumns:2073` → `2076` | `delivery_order_code` | 发货单号 | +| 配送订单 | `2077` | `pre_delivery_order_code` | 前置单号 | +| 配送订单 | `2081` | `wave_no` | 波次号 | +| 配送订单 | `2114` | `waybill_codes` | 运单号 | +| 配送订单 | `2115` | `source_order_codes` | 平台交易单号 | +| 配送B2B订单 | 同 `deliveryColumns` | 同上 | 运单号 / 前置单号 / 发货单号 | +| 订单工作台 | `workbenchColumns:2927` → `2930` | `delivery_order_code` | 发货单号 | +| 订单工作台 | `2949` | `waybill_codes` | 运单号 | +| 待处理异常订单 | `expectionColumns:3021` → `3024` | `delivery_order_code` | 发货单号 | +| 待处理异常订单 | `3039` | `express_numbers` | **运单号** | +| 待处理异常订单 | `3045` | `pre_delivery_order_code` | 前置单号 | +| 归档订单 | `archiveColumns:3149` → `3152` | `order_code` | **发货单号** | +| 归档订单 | `3153` | `delivery_order_code` | **发货单号** | +| 归档订单 | `3154` | `wave_no` | 波次号 | +| 归档面板 | `component/ArchiveOrderPanel.vue:7` | `delivery_order_code` | 发货单号 | +| 归档面板 | `component/ArchiveOrderPanel.vue:8` | `order_code` | 订单号 | +| 配送订单独立页 | `deliveryOrder.vue:292` | `waybill_code` | 运单号 | +| 订单详情-运单面板 | `component/ExpressWaybillPanel.vue:172` | `waybill_code` | 运单号 | +| 订单工作台-订单明细 | `component/WorkbenchOrderDetail.vue:44` | `waybill_code` | 运单号 | +| 按订单转出弹窗 | `component/TransferByOrdersDialog.vue:56` | - | 发货单号 | +| 按订单转出弹窗 | `component/TransferByOrdersDialog.vue:59` | - | 运单号 | +| 按订单转出弹窗 | `component/TransferByOrdersDialog.vue:137` | `waybill_code` | 运单号 | +| 按订单转出弹窗 | `component/TransferByOrdersDialog.vue:143` | `unpack_no` | 拆包单号 | +| 异常跟踪单导入/导出 | `ORDER_EXPORT_ALL_COLUMNS:419` | - | 抓取波次号 | +| 旧订单明细组件 | `component/orderdetail.vue:19` | `source_order_code` | **平台单号** | + +### 2.2 详情面板 + +| 面板 | 位置 | prop | 文案 | +|---|---|---|---| +| 订单详情(完整) | `orderDetailFullSections:1116` → `1122` | `delivery_order_code` | **外部订单号** | +| 订单详情(完整) | `1123` | `pre_delivery_order_code` | 前置单号 | +| 订单详情(完整) | `1124` | `pre_delivery_order_id` | 前置单ID | +| 订单详情(完整) | `1133` | `source_order_codes` | 平台交易单号 | +| 订单详情(完整) | `1145` | `pay_no` | 支付单号 | +| 订单详情(完整) | `1177` | `wave_no` | 波次号 | +| 订单详情(完整) | `1207` | `express_code` | **快递单号** | +| 订单详情(完整) | `1209` | `waybill_codes` | 运单号 | +| 订单详情(精简) | `orderDetailCompactSections:1252` → `1257` | `delivery_order_code` | 外部订单号 | +| 订单详情(精简) | `1264` | `source_order_codes` | 平台交易单号 | +| 订单详情(精简) | `1280` | `wave_no` | 波次号 | +| 订单详情(精简) | `1301` | `waybill_codes` | 运单号 | +| 待审核订单详情 | `reviewOrderDetail:2260` → `2262` | `delivery_order_code` | 发货单号 | +| 待审核订单详情 | `2263` | `pre_delivery_order_code` | 前置单号 | +| 待审核订单详情 | `2276` | `source_order_codes` | 平台交易单号 | +| 待审核订单详情 | `2277` | `pay_no` | 支付单号 | +| 待审核订单详情 | `2302` | `waybill_codes` | 运单号 | +| 待处理订单详情 | `pendingOrderDetail:2696` → `2698` | `delivery_order_code` | 外部订单号 | +| 待处理订单详情 | `2699` | `pre_delivery_order_code` | 前置单号 | +| 待处理订单详情 | `2711` | `source_order_codes` | 平台交易单号 | +| 待处理订单详情 | `2712` | `pay_no` | 支付单号 | +| 待处理订单详情 | `2737` | `waybill_codes` | 运单号 | +| 异常订单详情 | `expectionOrderDetail:3055` → `3057` | `delivery_order_code` | **发货单号** | +| 异常订单详情 | `3057` | `order_code` | **发货单号**(与上一行同名) | +| 异常订单详情 | `3082` | `express_code` | **运单号** | +| 归档订单详情 | `archiveOrderDetail:3172` → `3174` | `delivery_order_code` | **发货单号** | +| 归档订单详情 | `3175` | `order_code` | **发货单号**(与上一行同名) | +| 归档订单详情 | `3192` | `express_code` | **运单号** | + +### 2.3 筛选 / 扫描字段 + +| 常量 / 使用处 | 位置 | 字段 | 文案 | +|---|---|---|---| +| `waveNoScanField` | `1674` | `wave_no` | 波次号 | +| `deliveryOrderCodeScanField` | `1700` | `delivery_order_code` | 发货单号 | +| `pendingOrderQuickSearchScanField` | `1702` | `delivery_order_code` | 发货单号 | +| `orderQuickSearchScanField` | `1704` | `delivery_order_code` | **搜索订单号** | +| `sourceOrderCodesScanField` | `1705` | `source_order_codes` | 平台交易单号 | +| `pendingOrderCodeScanField` | `1706` | `order_code` | 发货单号(当前未被引用) | +| `exceptionOrderCodeScanField` | `1707` | `order_code` | 发货单号(当前未被引用) | +| `waybillCodesScanField` | `1725` | `waybill_codes` | **快递单号** | +| `expressCodeScanField` | `1726` | `express_code` | **快递单号**(与上一行同名不同字段) | +| 待审核筛选覆盖 | `2196` | `delivery_order_code` | 发货单号 | +| 工作台筛选 | `2913` | `delivery_order_code` | 发货单号 | +| 待处理筛选 | `2369` / `2374` | `delivery_order_code` / `waybill_codes` | 发货单号 / 快递单号 | +| 异常筛选 | `2983` / `2988` | `delivery_order_code` / `express_code` | 发货单号 / 快递单号 | +| 归档筛选 | `3117` | `delivery_order_code` | **搜索订单号** | + +### 2.4 表单 / 弹窗 + +| 组件 | 位置 | 字段 | 文案 | +|---|---|---|---| +| 手工录入运单号 | `views/order/shared/form/ManualWaybillForm.vue:38,50` | `waybill_code` | 运单号 / 请输入运单号 | +| 按运单绑定包材 | `component/BindPackageMaterialByWaybillDialog.vue:31,37` | `waybill_code` | 运单号 / 请输入运单号 | +| 订单详情-录入运单 | `component/ExpressWaybillPanel.vue:100` | - | 运单号 | +| 分配子单号 | `form/AllocateSubOrderNumberForm.vue:53` | - | 子单号数量 | +| 批量快速复核 | `form/BatchQuickRecheckForm.vue:52` | `delivery_order_code` | 发货单号 | +| 批量快速复核 | `form/BatchQuickRecheckForm.vue:91,102` | `waybill_no` | 运单号 | +| 转 B2B | `form/ConvertToB2bForm.vue:55,138` | - | 发货单号 | +| 取消 B2B | `form/CancelB2bForm.vue:55,138` | - | 发货单号 | +| 工作台订单列表弹窗 | `component/OrderWorkbenchListDialog.vue:17` | - | 占位:发货单号关键词 | +| 创建订单-选单 | `views/order/shared/createOrderSession/CreatePendingOrderDialog.vue:683` | `delivery_order_code` | 发货单号 | +| 创建订单-来源单号 | 同上 `:684` | `source_order_codes` | **来源订单号** | +| 创建订单-导入别名 | 同上 `:1932` | `source_order_codes` | 别名含「来源订单号」「平台订单号」 | +| 创建订单-必填表头 | 同上 `:1959` | - | `*订单号` | + +### 2.5 快速搜索占位(各页签顶部) + +| 页面 | 位置 | 占位文案 | +|---|---|---| +| 待处理订单 | `pendingOrder.vue:33` | 搜索订单号 | +| 待审核订单 | `reviewOrder.vue:32` | 搜索订单号 | +| 待处理异常订单 | `exceptionOrder.vue:31` | 搜索订单号 | +| 归档订单 | `archiveOrder.vue:31` | 搜索订单号 | +| 委托外仓订单 | `entrustWarehouse.vue:31` | 搜索订单号 | +| 配送异常订单 | `deliveryException.vue:31` | 搜索订单号 | +| 待出库订单 | `outboundOrder.vue:32` | **搜索出库单号** | +| 配送订单 | `deliveryOrder.vue:33` | **搜索配送单号** | + +### 2.6 导出白名单与列表字段名 + +| 位置 | 文案 | +|---|---| +| `ORDER_EXPORT_ALL_COLUMNS:412` | 系统订单号 | +| `:413` | 外部订单号 | +| `:414` | **平台单号** | +| `:416` | 订单号 | +| `:417` | 外部单号 | +| `:419` | 抓取波次号 | +| `:420` | 波次号 | +| `:451` | 运单号 | +| `ORDER_LIST_FIELD_LABELS`(约 `2455`) | `order_code`=发货单号;`pre_delivery_order_code`=前置单号;`waybill_codes`=运单号;`source_order_codes`=平台交易单号;**无 `express_numbers`** | + +--- + +## 3. 波次管理 + +| 页面 / 组件 | 位置 | 字段 | 文案 | +|---|---|---|---| +| 波次筛选 | `config/wave-config.ts:103` | `wave_no` | 波次号 | +| 不符合波次策略-筛选 | `:263` | `delivery_no` | **订单号** | +| 不符合波次策略-筛选 | `:264` | `tracking_no` | **物流单号** | +| 不符合波次策略-列表 | `:429` | `delivery_no` | **订单号** | +| 不符合波次策略-列表 | `:430` | `tracking_no` | **物流单号** | +| 波次策略-列表 | `:515` | `wave_no` | 波次号 | +| 拣货任务-筛选 | `:1224` | `task_no` | 任务编号 | +| 拣货任务-筛选 | `:1228` | `wave_no` | 波次号 | +| 拣货任务-列表 | `:1287` | `task_no` | 任务编号 | +| 拣货任务-列表 | `:1291` | `wave_no` | 波次号 | +| 拣货任务-列表 | `:1299` | `batch_no` | 批次号 | +| 团购波次明细 | `GroupWaveBatchListPanel.vue:485` | - | **订单号** | +| 团购波次明细 | `GroupWaveBatchListPanel.vue:490,494` | - | **物流单号** | +| 拣货任务列表 | `WavePickTaskListPanel.vue:774` | `wave_no` | 波次号 | +| 拣货任务-复制提示 | `WavePickTaskListPanel.vue:232` | - | 点击复制波次号 | +| 波次详情 | `component/WaveBatchDetailPanel.vue:8` | - | **波次编号** | +| 波次打印预览 | `component/WaveBatchPrintPreviewDialog.vue:64` | `__waveNo` | 波次号 | +| 确认打印弹窗 | `component/ConfirmWavePrintDialog.vue:36,41` | `waybill_no` | **面单号** / 扫描或输入面单号后回车 | + +--- + +## 4. 订单复核 + +| 位置 | 字段 | 文案 | +|---|---|---| +| `orderreview/recheck-config.ts:12` | `delivery_order_code` | 发货单号 | +| `:13` | `wave_no` | 波次号 | +| `:80` | `keyword` | 占位:运单号或车号,回车后在侧栏点查询 | +| `:86` | `waybill_no` | 运单号(占位:请输入运单号) | +| `:94` | `wave_no` | 波次号(占位:请输入波次号) | +| `orderreview/index.vue:45` | - | 占位:输入运单号/车号,回车查询 | +| `orderreview/index.vue:812` | `waybill_no` | **运单号 / 波次号** | +| `component/RecheckOrderPanel.vue:36` | - | 占位:输入运单号/车号,回车查询 | +| `component/BatchQuickRecheckDialog.vue:53,64` | `waybill_no` | 运单号 | +| `form/RecheckOrderSingleListForm.vue:26` | - | 占位:运单号/订单号 | +| `form/RecheckOrderSingleListForm.vue:31` | - | 波次号 | +| `form/RecheckOrderSingleListForm.vue:93` | `delivery_order_code` | 发货单号 | +| `form/RecheckOrderSingleListForm.vue:94` | `wave_no` | 波次号 | + +--- + +## 5. 订单称重 + +| 位置 | 字段 | 文案 | +|---|---|---| +| `orderWeighing/config/weighing-config.ts:16` | `waybill_no` | 运单号 | +| `:17` | `delivery_order_code` | **订单号** | +| `:24` | `waybill_no` | 运单号 | +| `:25` | `delivery_order_code` | **订单号** | +| `orderWeighing/ExpressWeighingForm.vue:54,59` | `waybill_code` | 运单号 / 请输入运单号 | +| `orderWeighing/ExpressWeighingForm.vue:87` | - | 运单号 | + +--- + +## 6. 售后 / 工单 / 站内信 + +| 位置 | 字段 | 文案 | +|---|---|---| +| `afterSale/list/afterSale-config.ts:205,207` | `after_sale_no` | 售后单号 / 输入售后单号 | +| `:290,292` | `waybill_no` | 运单号 / 输入运单号 | +| `:298,300` | `order_delivery_no` | 发货订单号 / 输入发货订单号 | +| `:306,308` | `entry_order_no` | 入库单号 | +| `:314,316` | `order_stockout_no` | 出库单号 | +| `:322,324` | `receiving_no` | 收货单号 | +| `:340` | `after_sale_no` | 售后单号 | +| `:349` | `waybill_no` | 运单号 | +| `:350` | `order_delivery_no` | 发货订单号 | +| `:351` | `entry_order_no` | 入库单号 | +| `:352` | `order_stockout_no` | 出库单号 | +| `:353` | `receiving_no` | 收货单号 | +| `afterSale/list/index.vue:144-157` | - | 关联运单号 / 关联发货订单号 / 关联入库单号 / 关联出库单号 / 关联收货单号 | +| `afterSale/detail/index.vue:51` | `after_sale_no` | 售后单号 | +| `:82` | `waybill_no` | 运单号 | +| `:85` | `order_delivery_no` | 发货订单号 | +| `:88` | `entry_order_no` | 入库单号 | +| `:91` | `order_stockout_no` | 出库单号 | +| `:94` | `receiving_no` | 收货单号 | +| `:191,242,273` | `after_sale_no` | 售后单号 | +| `afterSale/detail/AfterSaleDetailDialog.vue:92` | `after_sale_no` | 售后单号 | +| `:115` | `waybill_code` | 运单号 | +| `:134` | `delivery_order_code` | **外部订单号** | +| `:135` | `source_order_codes` | **平台单号** | +| `message/index.vue:131` | `after_sale_no` | **工单号** | +| `message/index.vue:194-198` | - | 关联运单号 / 关联发货订单号 / 关联入库单号 / 关联出库单号 / 关联收货单号 | +| `inbox/message/message-config.ts:106` | `work_order_no` | 工单号 | +| `inbox/message/index.vue:145` | `work_order_no` | 工单号 | +| `message/components/DocSearchPicker.vue:124` | - | 搜索字段名:**单号** | +| `message/components/CreateAfterSaleDialog.vue:100-101` | - | 占位:输入运单号或外部订单号搜索;标签:运单号/订单号 | +| `:105` | `delivery_order_code` | 外部订单号 | +| `:106` | `waybill_code` | 运单号 | +| `:107` | `source_order_codes` | **平台订单号** | +| `:130-131` | `receiving_code` | 收货单号 | +| `:154-155` | `entry_order_code` | 入库单号 | +| `:178-179` | `stockout_order_code` | 出库单号 | + +--- + +## 7. 快递号(运单中心) + +| 位置 | 字段 | 文案 | +|---|---|---| +| `express/waybill/config/template-config.ts:111,112` | `waybill_type` 选项 | 主单号 / 子单号 | +| `:205,210` | `waybill_code` | 运单号 | +| `:214,220` | `main_waybill_code` | 主单号 | +| `:233` | `order_no` | **发货单号**(详情标签:**订单号** `:238`) | +| `:250,254` | `source_order_codes` | 平台交易单号 | +| `:306,310` | `wave_no` | 波次号 | +| `express/waybill/index.vue:243` | - | 运单导出 | +| `express/waybill/index.vue:258,272` | - | 更新揽收状态 | +| `components/TransferByWaybillsDialog.vue:62,107` | `waybill_id` | 运单ID | +| `:65` | - | 运单号 | +| `:70,72` | `main_waybill_code` | 主单号 | +| `:108,110,134,136` | `waybill_code` | **退回运单号** | +| `:114` | `unpack_no` | 拆包单号 | + +--- + +## 8. 退件 / 退回拆包 / 退回登记 + +| 位置 | 字段 | 文案 | +|---|---|---| +| `express/returnwaybill/returnwaybill-config.ts:13,15` | `waybill_code` | 运单号(占位:运单号模糊搜索) | +| `:51` | `waybill_code` | 运单号 | +| `express/returnwaybill/index.vue:32` | - | 占位:运单号(扫码/输入) | +| `:140` | `waybill_code` | 运单号 | +| `:223,228` | `waybillCode` | 运单号 / 请输入运单号 | +| `express/returnReceived/returnReceived-config.ts:13,15` | `waybill_code` | **退回收件运单号**(占位仍为运单号模糊搜索) | +| `:87` | `waybill_code` | **退回收件运单号** | +| `express/returnReceived/index.vue:102,106` | `waybill_code` | **退回运单号** | +| `:135` | `waybill_code` | 运单号(原运单区) | +| `express/returnUnpack/returnUnpack-config.ts:10,12` | `unpack_no` | 拆包单号(已注释) | +| `:18,20` | `waybill_code` | **退回运单号**(占位:运单号模糊搜索) | +| `:79` | `unpack_no` | 拆包单号 | +| `:80` | `waybill_code` | **退回运单号** | +| `:97` | `source_order_codes` | 平台交易单号 | +| `express/returnUnpack/index.vue:157` | `unpack_no` | 拆包单号 | +| `:167,171` | `waybill_code` | 退回运单号 | +| `:209` | `source_order_codes` | 平台交易单号 | +| `:221` | `delivery_order_code / order_no` | **订单号** | +| `:224` | `wave_no` | 波次号 | +| `components/ExportDialog.vue:22,23` | `unpack_no` | 拆包单号 | +| `:26,27` | `waybill_code` | 退回运单号 | +| `express/returnUnpackwork/index.vue:14,19` | - | 运单号 / 占位:运单号 | +| `:149` | `unpack_no` | 拆包单号 | +| `:150,219` | `waybill_code` | 运单号 | +| `:215` | `order_no` | 订单号 | +| `:447,448` | `unpack_no` / `waybill_code` | 拆包单号 / 运单号 | +| `data/returnrecord/components/ReceiveRegisterPanel.vue:22` | `waybill_code` | 占位:**退回运单号(扫码/输入)** | +| `:305` | - | 提示:请先扫描或输入退回收件运单号 | +| `data/returnrecord/returnReceivedTask-config.ts:18,20` | `batch_no` | 批次号(占位:批次号模糊搜索) | +| `:58` | `batch_no` | 批次号 | + +--- + +## 9. 打包流水 / 数据页 + +| 位置 | 字段 | 文案 | +|---|---|---| +| `data/packingflow/packingflow-config.ts:144` | `waybill_code` | 运单号 | +| `:145` | `wave_no` | 波次号 | +| `:214` | - | 占位:运单号/波次号 | +| `:227` | `waybill_code` | 运单号 | +| `:232` | `wave_no` | 波次号 | +| `data/packingflow/index.vue:133` | `wave_no` | 波次号 | +| `:193,202` | `waybill_code` | 运单号 | +| `:569` | - | 提示:未取到运单号,无法按选中导出 | +| `components/VideoListDialog.vue:16` | `waybill_code` | 运单号 | + +--- + +## 10. 入库单 + +| 位置 | 字段 | 文案 | +|---|---|---| +| `storage/entry/entry-config.ts:101` | - | 占位:入库单号/采购单号/供应商 | +| `:105,108` | `entry_order_code` | 入库单号 | +| `:159` | - | 编号 | +| `:233` | `entry_order_code` | 入库单号 | +| `:237` | `purchase_order_code` | **单据编号** | +| `:243` | `receivingBindings` | 绑定收货单 | +| `:249` | **`express_code`** | **运单号** | +| `:264` | `entry_order_code` | 入库单号 | +| `:267` | `purchase_order_code` | 单据编号 | +| `:277` | **`express_code`** | **运单号** | +| `:324` | `id` | 入库单ID | +| `:325,344,358` | `entry_order_code` | 入库单号 | +| `:362` | `purchase_order_code` | 单据编号 | +| `:366` | `express_code` | 运单号 | +| `:651,673,684` | `receiving_number` | 收货单号 | +| `:755` | - | 打印入库单 | +| `storage/entry/index.vue:73` | `receivingBindings` | 提示:点击复制收货单号 | +| `storage/entry/index.vue:350` | - | 文档标签:入库单 | +| `storage/entry/component/ReceivingCompareForm.vue:5` | `entry_order_code` | 入库单号 | +| `:18,21` | - | 收货单 / 请选择或搜索收货单号 | +| `component/ReceivingBindingDetailDialog.vue:22` | `receiving_number` | 收货单号 | +| `:54` | `batch_number` | 批次号 | +| `component/QuickInboundForm.vue:79` | `entry_order_code` | 入库单号 | +| `storage/receiving/index.vue:389` | - | 占位:入库单号 / 采购单号 / 供应商 / 货主 / 仓库 | +| `:406,496` | `entry_order_code` | 入库单号 | +| `storage/receiving/component/Storage.vue:80` | `inbound_order_no` | 入库单号 | + +--- + +## 11. 收货单 + +| 位置 | 字段 | 文案 | +|---|---|---| +| `storage/receiving/receiving-config.ts:154,188` | `receiving_number` | 收货单号 | +| `:173,199` | `tracking_number` | **物流单号** | +| `:219` | - | 占位:收货单号/车牌号/物流单号 | +| `:225` | `receiving_number` | 收货单号 | +| `:318,320` | `tracking_number` | **物流单号** / 请输入物流单号 | +| `:417,424` | `receiving_number` | 收货单号 | +| `:433,651` | `tracking_number` | 物流单号 | +| `:575` | `receiving_number` | 收货单号 | +| `:683,703,712,721` | - | 添加收货单 / 转入库单 / 收货单直入 / 打印收货单 | +| `storage/receiving/index.vue:184` | - | 文档标签:收货单 | +| `:318` | - | 已选收货单 | +| `storage/receiving/component/Details.vue:3` | `receiving_number` | 收货单号 | +| `message/components/CreateAfterSaleDialog.vue:130,131,135` | `receiving_code` | 收货单号 | + +--- + +## 12. 出库单 + +| 位置 | 字段 | 文案 | +|---|---|---| +| `storage/stockout/stockout-config.ts:48` | - | 按钮:**更新快递/运单号** | +| `:56` | - | 打印出库单 | +| `:268` | `stockout_order_code` | 出库单号 | +| `:276` | `extend_props` | **转单订单号** | +| `:279` | **`express_codes`** | **运单号** | +| `:295` | `stockout_order_code` | 出库单号 | +| `:303` | - | 单据类型选项:调拨出库 | +| `:370` | `stockout_order_code` | 出库单号 | +| `:385` | `express_code` | **快递编码** | +| `:398` | `batch_no` | 批次号 | +| `storage/stockout/index.vue:157` | - | 文档标签:出库单 | +| `:493,500` | `waybill_codes` | 运单号 / 支持一单多运单… | +| `:548` | - | 已选出库单 | +| `order/orderManagement/outboundOrder.vue:32` | - | 占位:**搜索出库单号** | +| `afterSale/*` | `order_stockout_no` | 出库单号 / 关联出库单号 | +| `message/components/CreateAfterSaleDialog.vue:178,179,183` | `stockout_order_code` | 出库单号 | + +--- + +## 13. 库存 / 效期 / 出入库记录 / 商品流水 / 盘点 + +| 位置 | 字段 | 文案 | +|---|---|---| +| `storage/inventory/inventory-config.ts:96` | `batch_no` | 批次号 | +| `:97` | `inbound_order_no` | 入库单号 | +| `storage/inventory/index.vue:280` | `batch_no` | 批次号 | +| `storage/inventory/component/panelstockdetail.vue:468` | `batch_no` | 批次号 | +| `stock/stock/component/storage.vue:127` | `inbound_order_no` | 入库单号 | +| `storage/validityperiod/validityperiod-config.ts:21` | `batch_no` | 批次号 | +| `:22` | `inbound_order_no` | 入库单号 | +| `:40,114` | `batch_no` | 批次号 | +| `storage/log/log-config.ts:211` | `order_no` | **单号** | +| `:212` | `batch_no` | 批次号 | +| `:228` | - | 占位:搜索商品编码/名称/单号/批次号/操作人等 | +| `:258,260` | `order_no` | 单号 / 请输入单号 | +| `storage/productflow/productflow-config.ts:73` | `batch_no` | 批次号 | +| `:75` | `order_no` | 订单号 | +| `:77,78` | `receiving_id` / `entry_order_id` | 收货单ID / 入库单ID | +| `:118,121` | `order_no` | 订单号 / 请输入订单号 | +| `:126,129` | `batch_no` | 批次号 / 请输入批次号 | +| `storage/productflow/index.vue:82,89` | `batch_no` / `order_no` | 提示:点击复制批次号 / 点击复制订单号 | +| `storage/productflow/store/index.vue:142,167,169,170` | - | 批次号 / 订单号 / 收货单ID / 入库单ID | +| `storage/productflow/component/ProductflowDetail.vue:25,50,52,53` | - | 批次号 / 订单号 / 收货单ID / 入库单ID | +| `storage/stockcheck/config/template-config.ts:432` | `keyword` | **盘点单号/名称** | +| `:454` | `check_no` | 盘点单号 | +| `:1213` | - | 盘点单信息 | +| `storage/stockcheck/index.vue:341,403` | `check_no` | 盘点单号 | +| `storage/stockcheck/config/components/CheckItemsPanel.vue:472` | `batch_no` | 批次号 | +| `storage/stockcheck/pages/CheckStockPickerDialog.vue:83,118` | `batch_no` | 批次号 | + +--- + +## 14. 跨模块对话框 + +| 组件 | 位置 | 字段 | 文案 | +|---|---|---|---| +| 创建订单 | `CreatePendingOrderDialog.vue:683,684` | `delivery_order_code` / `source_order_codes` | 发货单号 / **来源订单号** | +| 创建售后-选运单 | `CreateAfterSaleDialog.vue:100-107` | `delivery_order_code` / `waybill_code` / `source_order_codes` | 外部订单号 / 运单号 / 平台订单号 | +| 按运单转出 | `TransferByWaybillsDialog.vue:65,70,108,114` | - | 运单号 / 主单号 / 退回运单号 / 拆包单号 | +| 按订单转出 | `TransferByOrdersDialog.vue:56,59,137,143` | - | 发货单号 / 运单号 / 拆包单号 | +| 按运单绑定包材 | `BindPackageMaterialByWaybillDialog.vue:31,37` | `waybill_code` | 运单号 | +| 分配子单号 | `AllocateSubOrderNumberForm.vue:53` | - | 子单号数量 | +| 旧订单明细 | `component/orderdetail.vue:19` | `source_order_code` | 平台单号 | +| 归档面板 | `component/ArchiveOrderPanel.vue:7,8` | `delivery_order_code` / `order_code` | 发货单号 / 订单号 | + +--- + +## 15. 通用组件与文案耦合 + +| 位置 | 内容 | 影响 | +|---|---|---| +| `components/waybill/waybill-column.ts:13` | `WAYBILL_PROP_RE = /^(waybill(_codes?\|_nos?)?\|main_waybill_code\|express_codes\|express_numbers)$/i` | 按 prop 识别运单列 | +| `components/waybill/waybill-column.ts:15` | `WAYBILL_LABEL_RE = /运单号\|快递单号\|面单号\|物流单号/` | **按文案识别**:改名可能影响复制/二维码/轨迹挂载 | +| `components/waybill/waybill-column.ts:20` | `waybillActions?: boolean` | 可显式关闭(如非真实运单号) | +| `components/UpperTable/index.vue:110` | 无 label 时默认「运单号」 | 兜底文案 | +| `components/UpperTable/index.vue:1269` | 提示:点击复制并查看**快递单号二维码** | 与弹窗标题不一致 | +| `components/QR/qrcode.vue:27` | 暂无单号 | 空态 | +| `components/QR/qrcode.vue:49` | 默认标题:**快递单号二维码** | 默认值 | +| `components/waybill/WaybillCodeActions.vue:48` | 传入标题:**运单号二维码** | 与默认标题不一致 | +| `components/waybill/WaybillCodeActions.vue:69,74` | 空态文案 / 默认 label:运单号 | - | +| `components/waybill/WaybillTraceList.vue:78,117` | 缺少运单号,无法查询轨迹 / 运单号:xxx | 轨迹窗 | +| `components/BatchReceivingPrintDialog.vue:582-606` | `express_code` ↔ `waybill_code` 交叉回退 | 打印取值把两者视为同值 | +| `components/BatchReceivingPrintDialog.vue:713-770` | 向 formData 传播 `express_code` / `waybill_code` / `expresses` | 打印表单 | + +--- + +## 16. 国际化文案(未在业务代码引用) + +| 位置 | 文案 | +|---|---| +| `src/lang/zh-CN.ts:169` | `batch_no` = 批次号 | +| `src/lang/zh-CN.ts:182` | `ship_no` = 出库单号 | +| `src/lang/zh-CN.ts:184` | `express_no` = 快递单号 | +| `src/lang/zh-CN.ts`(order 段) | `order_no` = 订单编号 | + +--- + +## 17. 实测页面表头(localhost:5174) + +| 页面 | 实际显示 | +|---|---| +| 订单管理-待审核订单 | 发货单号 / 平台交易单号 | +| 订单管理-待处理订单 | 发货单号 / **快递单号** / 平台交易单号 | +| 订单管理-待处理B2B订单 | 发货单号 / **运单号** / 平台交易单号 / 前置单号 | +| 订单管理-待处理异常订单 | 发货单号 / **快递单号** / 前置单号 | +| 订单管理-待出库订单 | 发货单号 / **快递单号** / 平台交易单号 | +| 订单管理-委托外仓订单 | 发货单号 | +| 订单管理-配送订单 | 发货单号 / 前置单号 / **运单号** / 平台交易单号 | +| 订单管理-配送B2B订单 | 发货单号 / 前置单号 / **运单号** / 平台交易单号 | +| 订单管理-配送异常订单 | 发货单号 | +| 订单管理-归档订单 | 发货单号 | +| 波次管理-不符合波次策略订单 | 订单号 / **物流单号** | +| 波次管理-波次策略 | 订单号 / **物流单号** | +| 入库单 | 入库单号 / **运单号** | +| 出库单 | 出库单号 / 转单订单号 / **运单号** | +| 收货单 | 收货单号 / **物流单号** | +| 售后列表 | 售后单号 / **运单号** / 发货订单号 / 入库单号 / 出库单号 / 收货单号 | +| 快递号 | **运单号 / 主单号** / 发货单号 / 平台交易单号 | +| 订单称重 | **运单号** / 订单号 | +| 出入库记录 | **单号** | +| 打包流水 | **运单号** | +| 商品流水 | 订单号 | +| 站内信消息 | 工单号 | +| 订单复核 | **运单号 / 波次号** | +| 我的工单(列表) | 售后单号 / 运单号 / 发货订单号 / 入库单号 / 出库单号 / 收货单号 | +| 我的工单(详情) | 工单号 / 关联运单号 / 关联发货订单号 / 关联入库单号 / 关联出库单号 / 关联收货单号 | + +--- + +## 18. 冲突索引(排查用) + +| # | 现象 | 位置 | +|---|---|---| +| 1 | 同一运单值,列表叫「快递单号」,B2B 页签叫「运单号」 | `order-common-config.ts:2442` vs `:2537` | +| 2 | 同一运单值,波次叫「物流单号」,订单叫「运单号/快递单号」 | `wave-config.ts:430` | +| 3 | 同一运单值,收货单叫「物流单号」 | `receiving-config.ts:173,199` | +| 4 | 同一运单值,打印扫描叫「面单号」 | `ConfirmWavePrintDialog.vue:36` | +| 5 | 同一运单值,退件列表「退回收件运单号」、详情「退回运单号」 | `returnReceived-config.ts:87` vs `returnReceived/index.vue:102` | +| 6 | 订单详情同面板出现「快递单号」与「运单号」 | `order-common-config.ts:1207,1209` | +| 7 | 异常/归档详情两行都叫「发货单号」 | `:3057-3058`、`:3174-3175` | +| 8 | `express_code` 三套语义:快递单号 / 运单号 / 快递公司编码 | `:1207`、`:3082`、`api/storage.stockout/stockout.ts:156` | +| 9 | 两个筛选同名「快递单号」但字段不同 | `order-common-config.ts:1725,1726` | +| 10 | 同一订单值:发货单号 / 外部订单号 / 发货订单号 / 订单号 / 搜索订单号 | 见第 2 节 | +| 11 | 同一平台单号值:平台交易单号 / 平台单号 / 平台订单号 / 来源订单号 | 见第 1.2、2、6 节 | +| 12 | 售后单号在我的工单详情叫「工单号」,与 `work_order_no` 同名 | `message/index.vue:131` | +| 13 | 二维码标题三套说法 | `QR/qrcode.vue:49`、`WaybillCodeActions.vue:48`、`UpperTable/index.vue:1269` | +| 14 | 订单复核列把运单号与波次号合并 | `orderreview/index.vue:812` | +| 15 | 入库单用 `express_code` 显示「运单号」 | `entry-config.ts:249,277,366` | +| 16 | 出库单列表 prop 为 `express_codes`、文案「运单号」 | `stockout-config.ts:279` | +| 17 | 出入库记录把多种单据统一叫「单号」 | `log-config.ts:211,258` | +| 18 | 导出表头与页面列名不一致(平台单号/外部单号/系统订单号) | `order-common-config.ts:412-420` | + +--- + +## 19. 其他编号类(非单据号,仅登记,避免误改) + +| 位置 | 文案 | 说明 | +|---|---|---| +| `system/setting/account/account-config.ts:2,5` | 工号ID / 手机号 | 人员属性 | +| `system/setting/account/index.vue:241,592` | 工号头像 / 新增工号 | 人员属性 | +| `system/setting/expressinterface/express-interface-config.ts:362` | 电子面单客户号 | 接口配置 | +| `system/setting/basicManagement/newview/pages/WarehouseSettingsForm.vue:274` | 团购波次号前缀 | 编码规则 | +| `system/setting/basicManagement/newview/pages/MiniProgramConfigForm.vue:925` | 营业执照注册号 | 资质 | +| `system/setting/basicManagement/newview/pages/MiniProgramConfigForm.vue:576,628,1493` | 已绑定账号 / 绑定账号 / 微信号别名 | 账号 | +| `system/setting/pickcart/components/InfoPanel.vue:27` | 绑定任务编号 | 设备绑定 | +| `views/mode/config/template-config.ts:171,175` | 编号 | 通用模板字段 | +| `storage/generalreport/config/template-config.ts:285,289` | 编号 | 报表模板字段 | +| `system/setting/basicManagement/newview/config/template-config.ts:399,403` | 编号 | 模板字段 | +| `material/packageMaterial/component/BatchImportDialog.vue:187` | 行号 | 导入预览 | +| `stock/stock/stock-config.ts:429` | 序列号管理 | 商品属性 | +| `stock/*`、`setting/pickcart/index.vue:428`、`stock/pickingShortage/index.vue:88`、`ComboGoodsFormDialog.vue:148` | 序号 | 行号 | +| `dashboard/components/forms/createStore.vue:9`、`createWarehouse.vue:8` | 营业执照号 | 资质 | + +--- + +## 20. 补录(只追加,不改上文) + +| 日期 | 补录内容 | 来源 | +|---|---|---| +| 2026-11-21 | 初版:仅运单域快照(内容已并入本文,原文件已删除) | 代码扫描 + 本地实测 | +| 2026-11-21 | 全量版:补全订单/平台/单据/波次/批次/盘点/编号类;方案拆出至 `运单号命名-统一方案-讨论稿.md` | 代码扫描 + 本地实测 | +| 2026-11-21 | 补录 21~23:生产打印模板字段与模板内单号元素、表单/筛选项、表格单号数据 | 生产环境 `setting.printTemplate.list` + 代码核对 | + +--- + +## 21. 补录(2026-11-21):生产环境打印模板 + +> 抓取地址:`https://wms.wms.gztbyc.com/setting/printTemplate` +> 抓取方式:页面加载时读取 `setting.printTemplate.list` 响应(`presetTree`),非截图推断。 +> 原始结构:`{ flag, code, message, presetTree, timestamp }`(`presetTree` 在响应顶层,不在 `data` 内)。 + +### 21.1 模板清单(共 12 个) + +| 分类(business_type) | 模板名 | 尺寸(mm) | 模板元素数 | +|---|---|---|---| +| STOCK | 商品标签 | 40×30 | 3 | +| STOCK | 商品标签 | 70×20 | 0 | +| STOCK | 商品标签 | 75×129 | 0 | +| STOCK | 商品标签 | 40×30 | 4 | +| RECEIPT | autotest_template_1774432301527 | 100×180 | 0 | +| RECEIPT | 商品标签 | 210×298 | 23 | +| PICKING | B2B订单拣货单 | 148×210 | 27 | +| PICKING | 拣货单 | 148×210 | 28 | +| OUTBOUND | 出库单A5模板 | 148×210 | 35 | +| OUTBOUND | A5 | 148×210 | 18 | +| ENTRY_ORDER | 入库单A5模板 | 148×210 | 24 | +| ENTRY_ORDER | 入库单A4打印模版 | 210×297 | 0 | + +### 21.2 打印字段字典(单号相关,来自 `printItems`) + +| 分类 | 分组 | 字段名 | field_code | 类型/说明 | +|---|---|---|---|---| +| RECEIPT | receipt.group.no | 收货单号 | `receiving_number` | 文本 | +| RECEIPT | receipt.group.no | **快递单号** | `tracking_number` | 文本;描述为「快递单号/物流单号」 | +| RECEIPT | 入库单信息 | 入库单号 | `entry_order_code` | 文本 | +| RECEIPT | 入库单信息 | 采购单号 | `purchase_order_code` | 文本 | +| RECEIPT | 入库单信息 | **运单号** | `express_code` | 文本 | +| RECEIPT | receipt.group.product | 批次号 | `batch_number` | 表格字段 | +| OUTBOUND | outbound.group.order | **出库单号** | `delivery_order_code` | 文本 | +| OUTBOUND | outbound.group.order | 波次号 | `wave_no` | 文本 | +| OUTBOUND | outbound.group.order | **快递单号** | `express_code` | 文本 | +| STOCK | product_base_info | — | `product_name` / `product_barcode` / `product_spec` | 无单号字段 | +| PICKING | — | — | — | **接口未返回 printItems** | +| ENTRY_ORDER | — | — | — | **接口未返回 printItems** | + +补充: +- 模板中实际使用了字典外的字段:`waybill_text`(B2B 拣货单)、`wave_no` / `entry_order_code` / `delivery_order_code` / `express_code`(拣货单、入库单模板)。 +- `waybill_text` 由前端合成:`views/order/orderManagement/utils/use-b2b-picking-print.ts:313`。 + +### 21.3 模板内单号元素(逐模板) + +| 模板 | 元素类型 | 页面文案 | field_code | +|---|---|---|---| +| 收货单(210×298) | qrcode | 收货单号 | `receiving_number` | +| 收货单(210×298) | text | 收货单号 | `receiving_number` | +| B2B订单拣货单 | text | 运单号(静态标签) | 无(纯文本「运单号:」) | +| B2B订单拣货单 | text | 运单号 | `waybill_text` | +| B2B订单拣货单 | barcode | 运单号 | `waybill_text` | +| 拣货单 | text | 波次号(静态标签) | 无(纯文本「波次号:」) | +| 拣货单 | text | 波次号 | `wave_no` | +| 拣货单 | barcode | 波次号 | `wave_no` | +| 拣货单 | text | **订单号** | `delivery_order_code` | +| 拣货单 | text | **物流单号** | `express_code` | +| 出库单A5模板 | text | **发货单号**(静态标签) | 无(纯文本「发货单号:」) | +| 出库单A5模板 | text | **出库单号** | `delivery_order_code` | +| 出库单A5模板 | text | 波次号(静态标签) | 无 | +| 出库单A5模板 | text | 波次号 | `wave_no` | +| 出库单A5模板 | text | 运单号(静态标签) | 无(纯文本「运单号:」) | +| 出库单A5模板 | text | **快递单号** | `express_code` | +| 出库单A5模板 | qrcode | **运单号** | `express_code` | +| A5 | text | 出库单号 | `delivery_order_code` | +| A5 | text | 发货单号(静态标签) | 无 | +| A5 | text | 波次号 | `wave_no` | +| A5 | text | 波次号(静态标签) | 无 | +| A5 | text | 运单号(静态标签) | 无 | +| A5 | text | 快递单号 | `express_code` | +| 入库单A5模板 | text | 入库单号(静态标签) | 无 | +| 入库单A5模板 | text | 入库单号 | `entry_order_code` | +| 入库单A5模板 | qrcode | 入库单号 | `entry_order_code` | + +其余模板(4 个商品标签、autotest、入库单A4)无单号元素。 + +### 21.4 打印模板内表格的单号列 + +| 模板 | 表格行文案 | field_code | +|---|---|---| +| 拣货单(148×210) | 订单号 | `delivery_order_code` | +| 拣货单(148×210) | 物流单号 | `express_code` | + +### 21.5 打印取数映射(代码事实,字段名不可改) + +| 打印场景 | 映射 | 位置 | +|---|---|---| +| 出库单打印:模板「出库单号」 | `delivery_order_code` ← `row.stockout_order_code` | `storage/stockout/index.vue:1266` | +| 出库单打印:模板「快递单号/运单号」 | `express_code` 原样取列表行;`express_codes`/`waybill_codes` ← `normalizeStockoutWaybillCodes` | 同上 `:1277-1287` | +| 出库单打印:回填订单 | `delivery_order_code` 优先 `order.delivery_order_code`,回退 `order.stockout_order_code` | 同上 `:1329` | +| B2B 拣货单:模板「运单号」 | `waybill_text` ← `resolveB2bWaybillText(row)` | `use-b2b-picking-print.ts:313` | +| 收货单打印:`express_code` ↔ `waybill_code` | 两个字段交叉回退取值 | `components/BatchReceivingPrintDialog.vue:582-606` | +| 收货单打印:`expresses[]` | 取 `waybill_code` / `express_code` | 同上 `:592-606` | + +--- + +## 22. 补录(2026-11-21):表单 / 筛选中的单号选项 + +| 位置 | 选项类型 | 选项内容 | +|---|---|---| +| `express/waybill/config/template-config.ts:111,112` | 运单类型下拉 | `主单号`(1/main) / `子单号`(2/child) | +| 打印模板「新建/业务类型」 | 业务类型下拉 | 商品标签(STOCK) / 收货单(RECEIPT) / 拣货单(PICKING) / 出库单(OUTBOUND) / 入库单(ENTRY_ORDER) | +| `order-common-config.ts:410-497` | 订单导出字段勾选 | 系统订单号 / 外部订单号 / **平台单号** / 订单ID / 订单号 / 外部单号 / 抓取波次号 / 波次号 / 波次序号 / 运单号 | +| `CreatePendingOrderDialog.vue:1932` | 创建订单导入表头别名 | 来源订单号 / *来源订单号 / 来源订单号* / source_order_codes / source_order_code / **平台订单号** | +| `CreatePendingOrderDialog.vue:1959` | 创建订单必填表头 | `*订单号` | +| `storage/stockout/stockout-config.ts:303` | 出库单类型 | 调拨出库 | +| `storage/entry/entry-config.ts:129` | 入库单类型 | 调拨入库 | +| `order/waveOrder/config/wave-config.ts` 来源筛选 | 波次来源 | 普通波次 / 后台策略 / PDA策略 | +| `afterSale/list/afterSale-config.ts:205-324` | 售后筛选项 | 售后单号 / 运单号 / 发货订单号 / 入库单号 / 出库单号 / 收货单号 | +| `storage/receiving/receiving-config.ts:219` | 收货单搜索占位 | 收货单号 / 车牌号 / 物流单号 | +| `express/returnUnpack/components/ExportDialog.vue:22-27` | 拆包导出条件 | 拆包单号 / 退回运单号 | +| `storage/stockcheck/config/template-config.ts:432` | 盘点筛选 | 盘点单号/名称 | +| `storage/log/log-config.ts:228` | 出入库记录搜索 | 商品编码/名称/**单号**/批次号/操作人 | +| `inbox`/`message` 选单 | 文档选择器搜索字段 | **单号**(`DocSearchPicker.vue:124`) | + +--- + +## 23. 补录(2026-11-21):表格中的单号数据清单 + +| 页面 / 表格 | 单号列(字段) | +|---|---| +| 订单管理-待审核 | 发货单号(`delivery_order_code`)、波次号(`wave_no`)、平台交易单号(`source_order_codes`) | +| 订单管理-待处理 / 待出库 | 发货单号、波次号、快递单号(`express_numbers`)、平台交易单号 | +| 订单管理-待处理B2B | 发货单号、运单号(`express_numbers` 改写)、前置单号(`pre_delivery_order_code`)、平台交易单号 | +| 订单管理-配送 / 配送B2B | 发货单号、前置单号、运单号(`waybill_codes`)、平台交易单号 | +| 订单管理-异常 | 发货单号、运单号(`express_numbers`)、前置单号 | +| 订单管理-归档 | 发货单号(`order_code`)、发货单号(`delivery_order_code`)、波次号 | +| 订单工作台 | 发货单号、运单号(`waybill_codes`)、波次号 | +| 波次管理-不符合策略 | 订单号(`delivery_no`)、物流单号(`tracking_no`) | +| 波次管理-团购波次明细 | 订单号、物流单号 | +| 波次管理-拣货任务 | 任务编号(`task_no`)、波次号(`wave_no`)、批次号(`batch_no`) | +| 订单复核 | 发货单号、波次号、运单号(`waybill_no`) | +| 订单称重 | 运单号(`waybill_no`)、订单号(`delivery_order_code`) | +| 售后列表 | 售后单号(`after_sale_no`)、运单号(`waybill_no`)、发货订单号(`order_delivery_no`)、入库单号(`entry_order_no`)、出库单号(`order_stockout_no`)、收货单号(`receiving_no`) | +| 快递号 | 运单号(`waybill_code`)、主单号(`main_waybill_code`)、发货单号(`order_no`)、平台交易单号、波次号 | +| 退件记录 | 退回运单号(`waybill_code`) | +| 退回拆包 | 拆包单号(`unpack_no`)、退回运单号(`waybill_code`) | +| 打包流水 | 运单号(`waybill_code`)、波次号(`wave_no`) | +| 入库单 | 入库单号(`entry_order_code`)、单据编号(`purchase_order_code`)、绑定收货单(`receiving_number`)、运单号(`express_code`) | +| 入库绑定收货单 | 收货单号(`receiving_number`) | +| 收货单 | 收货单号(`receiving_number`)、物流单号(`tracking_number`) | +| 出库单 | 出库单号(`stockout_order_code`)、转单订单号(`extend_props`)、运单号(`express_codes`)、批次号(`batch_no`) | +| 库存 / 效期预警 | 批次号(`batch_no`)、入库单号(`inbound_order_no`) | +| 出入库记录 | 单号(`order_no`)、批次号(`batch_no`) | +| 商品流水 | 订单号(`order_no`)、批次号(`batch_no`)、收货单ID(`receiving_id`)、入库单ID(`entry_order_id`) | +| 库存盘点 | 盘点单号(`check_no`)、批次号(`batch_no`) | +| 打印模板-拣货单表格 | 订单号(`delivery_order_code`)、物流单号(`express_code`) | + +--- + +## 24. 补录(2026-11-21):ScanBox 筛选字段专项清单 + +> 本节把所有 **已在 ScanBox 中启用** 的单号类筛选项集中登记,便于改名时一次性核对。 +> 说明:ScanBox 未配置 `placeholder` 时会自动生成「请输入{label}」/「请选择{label}」,改名会连带改占位符(`components/ScanBox/index.vue:173,220`)。 + +### 24.1 已启用为 ScanBox 的单号字段 + +| 模块 | 位置 | 字段 | 当前标签 | 备注 | +|---|---|---|---|---| +| 订单管理 | `order-common-config.ts:1674` | `wave_no` | 波次号 | 全页签通用 | +| 订单管理 | `:1700` | `delivery_order_code` | 发货单号 | 精确 | +| 订单管理 | `:1702` | `delivery_order_code` | 发货单号 | 模糊(待处理/异常) | +| 订单管理 | `:1704` | `delivery_order_code` | **搜索订单号** | 模糊(归档页使用) | +| 订单管理 | `:1705` | `source_order_codes` | 平台交易单号 | 精确 | +| 订单管理 | `:1706` | `order_code` | 发货单号 | 已定义但未被引用 | +| 订单管理 | `:1707` | `order_code` | 发货单号 | 已定义但未被引用 | +| 订单管理 | `:1725` | `waybill_codes` | **快递单号** | 待处理/待出库/工作台 | +| 订单管理 | `:1726` | `express_code` | **快递单号** | 异常页;与上一行同名不同字段 | +| 波次管理 | `wave-config.ts:103` | `wave_no` | 波次号 | - | +| 波次管理 | `:263` | `delivery_no` | **订单号** | 不符合策略 | +| 波次管理 | `:264` | `tracking_no` | **物流单号** | 不符合策略 | +| 波次管理 | `:1224` | `task_no` | 任务编号 | 拣货任务 | +| 波次管理 | `:1228` | `wave_no` | 波次号 | 拣货任务 | +| 订单复核 | `recheck-config.ts:80` | `keyword` | 扫描关键词 | 占位:运单号或车号 | +| 订单复核 | `:86` | `waybill_no` | 运单号 | - | +| 订单复核 | `:94` | `wave_no` | 波次号 | - | +| 订单称重 | `weighing-config.ts:16` | `waybill_no` | 运单号 | - | +| 订单称重 | `:17` | `delivery_order_code` | **订单号** | - | +| 售后列表 | `afterSale-config.ts:205` | `after_sale_no` | 售后单号 | - | +| 售后列表 | `:290` | `waybill_no` | 运单号 | - | +| 售后列表 | `:298` | `order_delivery_no` | 发货订单号 | - | +| 售后列表 | `:306` | `entry_order_no` | 入库单号 | - | +| 售后列表 | `:314` | `order_stockout_no` | 出库单号 | - | +| 售后列表 | `:322` | `receiving_no` | 收货单号 | - | +| 快递号 | `waybill/config/template-config.ts:205` | `waybill_code` | 运单号 | text,like/in | +| 快递号 | `:214` | `main_waybill_code` | 主单号 | text,eq/in | +| 快递号 | `:222` | `waybill_type` | 运单类型 | select;选项 主单号/子单号 | +| 快递号 | `:246` | `order_id` | 订单ID | number(非单号,供对照) | +| 未退登记 | `returnwaybill-config.ts:13` | `waybill_code` | 运单号 | 模糊 | +| 退回收件登记 | `returnReceived-config.ts:13` | `waybill_code` | **退回收件运单号** | 模糊 | +| 退回拆包 | `returnUnpack-config.ts:18` | `waybill_code` | **退回运单号** | 模糊 | +| 退回拆包 | `returnUnpack-config.ts:10-12` | `unpack_no` | 拆包单号 | **已注释,未启用** | +| 退回收件任务 | `returnReceivedTask-config.ts:18` | `batch_no` | 批次号 | 模糊 | +| 打包流水 | `packingflow-config.ts:227` | `waybill_code` | 运单号 | - | +| 打包流水 | `:232` | `wave_no` | 波次号 | - | +| 入库单 | `entry-config.ts:97` | `quickWhere` | 快捷搜索 | 占位:入库单号/采购单号/供应商 | +| 入库单 | `:105` | `entry_order_code` | 入库单号 | - | +| 出库单 | `stockout-config.ts:295` | `stockout_order_code` | 出库单号 | - | +| 收货单 | `receiving-config.ts:215` | `quickWhere` | 快捷搜索 | 占位:收货单号/车牌号/物流单号 | +| 收货单 | `:222` | `receiving_number` | 收货单号 | - | +| 收货单 | `:318` | `tracking_number` | **物流单号** | - | +| 库存 | `inventory-config.ts:96` | `batch_no` | 批次号 | - | +| 库存 | `:97` | `inbound_order_no` | 入库单号 | - | +| 效期预警 | `validityperiod-config.ts:21` | `batch_no` | 批次号 | - | +| 效期预警 | `:22` | `inbound_order_no` | 入库单号 | - | +| 出入库记录 | `log-config.ts:223` | `keyword` | 关键字 | 占位含「单号」 | +| 出入库记录 | `:258` | `order_no` | **单号** | - | +| 商品流水 | `productflow-config.ts:118` | `order_no` | 订单号 | - | +| 商品流水 | `:126` | `batch_no` | 批次号 | - | +| 库存盘点 | `stockcheck/config/template-config.ts:432` | `keyword` | **盘点单号/名称** | 模糊 | +| 模板演示页 | `mode/config/template-config.ts:172` | `code` | 编号 | 非业务单号 | +| 通用报表 | `generalreport/config/template-config.ts:286` | `code` | 编号 | 非业务单号 | + +### 24.2 有单号字段但**未启用**为 ScanBox(不可筛选) + +| 模块 | 字段 | 标签 | 原因 | +|---|---|---|---| +| 快递号 | `order_no` | 发货单号 | `scanBox: null`(接口 orderNo 暂不可用) | +| 快递号 | `source_order_codes` | 平台交易单号 | `scanBox: null` | +| 快递号 | `wave_no` | 波次号 | `scanBox: null` | +| 快递号 | `keyword` | 关键词 | `scanBox: null`(服务端只按运单号搜索) | +| 库存盘点 | `check_no` | 盘点单号 | `scanBox: null`(用 keyword 代替) | +| 站内信消息 | `work_order_no` | 工单号 | 仅列表列,无 ScanBox | +| 订单汇总 | - | - | 无单号筛选项 | + +### 24.3 ScanBox 相关影响提示 + +| 机制 | 说明 | +|---|---| +| 占位符自动生成 | 未显式配置 `placeholder` 时,改名会同步改变输入框占位文字 | +| 过滤条件摘要 | 「存为过滤条件」摘要按当前 `label` 渲染,改名后摘要自动更新 | +| 预设存储 | 预设只存字段 `value` + 条件,不存 `label`,改名不会破坏已保存预设 | +| 同名不同字段 | `waybill_codes` 与 `express_code` 当前都叫「快递单号」,是唯一一处“同标签不同 query” | diff --git a/docs/运单号命名-待确认清单.md b/docs/运单号命名-待确认清单.md new file mode 100644 index 00000000..962a778f --- /dev/null +++ b/docs/运单号命名-待确认清单.md @@ -0,0 +1,322 @@ +# 运单号命名 · 待确认清单 + +> 关联文档: +> - 事实基线:`docs/单号字段命名-全量快照-2026-11-21.md` +> - 方案与影响评估:`docs/运单号命名-统一方案-讨论稿.md` +> +> 用法:按编号回复选项即可(如 `A1=① A2=④`)。**未回复的项按「建议」执行**。 +> 若只想尽快开工,最少确认:**A1、A2、A3、A4、A5、B1、B4**。 + +--- + +## A. 开工前必须确认(阻塞项) + +### A1. 本期改动边界 + +| 选项 | 内容 | 说明 | +|---|---|---| +| ①(建议) | 只改中文展示文案 | 不动 prop、接口字段、打印绑定 | +| ② | 文案 + 抽公共常量(如 `WAYBILL_LABEL`) | 多改组件与映射,需额外回归 | +| ③ | 连字段名/接口一起收敛 | 需后端配合,风险最高 | + +**影响**:②③会触及打印、导出、后端字段,建议拆分批次。 + +--- + +### A2. `express_code` 到底是什么(最高风险) + +| 选项 | 内容 | +|---|---| +| ① | 就是运单号(订单 / 入库 / 打印域都按运单号处理) | +| ② | 是快递公司编码(库存接口注释口径) | +| ③ | 同一字段在不同域含义不同,需后端拆分或改名 | +| ④(建议) | 暂不处理:本期不改该字段的任何文案,等后端确认 | + +**涉及位置**: +- 订单详情「快递单号」(`order-common-config.ts:1207`) +- 异常/归档详情「运单号」(`:3082`、`:3192`) +- 入库单列表/详情「运单号」(`entry-config.ts:249,277,366`) +- 出库单接口注释「快递公司编码」(`api/storage.stockout/stockout.ts:156`) +- 出库/收货打印模板「快递单号 / 运单号」 + +**风险**:如果判断错,会把「快递公司编码」固化显示成「运单号」,并可能对 SF/STO 触发轨迹查询。 + +--- + +### A3. 通用运单统一叫哪个名字 + +| 选项 | 内容 | 说明 | +|---|---|---| +| ①(建议) | **运单号** | 替换「快递单号」,约 18 处列表/筛选/详情 | +| ② | 快递单号 | 与仓库口头习惯一致,但打印/接口多用运单号 | +| ③ | 页面叫运单号、打印叫快递单号 | 双口径,需同步维护两套说明 | + +--- + +### A4. 波次管理的「物流单号」(`tracking_no`) + +| 选项 | 内容 | +|---|---| +| ① | 确认它就是运单号 → 改「运单号」 | +| ② | 不是运单号 → 保留「物流单号」 | +| ③(建议) | 暂不确定 → 保留「物流单号」,补提示「即运单号」 | + +**涉及**:不符合波次策略列表、团购波次明细、波次筛选。 + +--- + +### A5. 收货单的「物流单号」(`tracking_number`) + +| 选项 | 内容 | +|---|---| +| ① | 就是运单号 → 改「运单号」 | +| ②(建议) | 可能含空运/海运单号 → 保留「物流单号」 | +| ③ | 改「物流单号(运单号)」 | + +**注意**:打印字段字典里同一字段叫「快递单号」,若保留物流单号,打印与页面仍不一致(需 C2/C3 处理)。 + +--- + +## B. 文案口径(P1) + +### B1. 退件域是否统一为「退回运单号」 + +| 选项 | 内容 | +|---|---| +| ①(建议) | 是:列表、详情、导出、登记表单全部用「退回运单号」 | +| ② | 列表保留「退回收件运单号」,详情用「退回运单号」 | +| ③ | 保持现状 | + +**涉及**:`returnReceived-config.ts:87`、`returnReceived/index.vue:102`、`returnUnpack*`、退回登记面板。 + +--- + +### B2. 「面单号」是否保留 + +| 选项 | 内容 | +|---|---| +| ①(建议) | 保留:波次确认打印写「面单号(运单号)」 | +| ② | 全部改「运单号」 | +| ③ | 保留「面单号」不动 | + +**涉及**:`ConfirmWavePrintDialog.vue:36,41`、波次页扫码提示。 + +--- + +### B3. 「主单号 / 子单号」是否保留 + +| 选项 | 内容 | +|---|---| +| ①(建议) | 保留:仅运单中心/转出弹窗使用 | +| ② | 改为「运单号(主)/ 运单号(子)」 | +| ③ | 全部改「运单号」 | + +**涉及**:`express/waybill/config/template-config.ts:111-112,214-220`、`TransferByWaybillsDialog.vue:70`、批量转出。 + +--- + +### B4. 发货订单号口径 + +| 选项 | 内容 | +|---|---| +| ①(建议) | 列表/详情统一「发货单号」 | +| ② | 统一「外部订单号」 | +| ③ | 保持现状(发货单号/外部订单号/发货订单号/订单号并存) | + +**涉及**:订单管理各列表、售后、工单、波次、称重、快递号详情。 + +#### B4.1 异常 / 归档详情里两行都叫「发货单号」 + +| 选项 | 内容 | +|---|---| +| ①(建议) | `order_code` 那行改「内部订单号」 | +| ② | 删除重复行,只保留一个 | +| ③ | 保持现状 | + +**位置**:`order-common-config.ts:3057-3058`、`:3174-3175`。 + +--- + +### B5. 平台单号统一叫法 + +| 选项 | 内容 | +|---|---| +| ①(建议) | 平台交易单号 | +| ② | 平台单号 | +| ③ | 平台订单号 | + +**现状**:平台交易单号 / 平台单号 / 平台订单号 / 来源订单号 四种并存。 + +--- + +### B6. 售后单号与工单号 + +| 选项 | 内容 | +|---|---| +| ①(建议) | 按实体区分:`after_sale_no`=售后单号,`work_order_no`=工单号;`/workorder` 详情改「售后单号」 | +| ② | 保持现状(售后单号在我的工单详情叫工单号) | + +--- + +### B7. 两个筛选都叫「快递单号」 + +| 选项 | 内容 | +|---|---| +| ①(建议) | `waybill_codes`=运单号,`express_code`=快递公司编码(依赖 A2 结论) | +| ② | 都叫快递单号,保持现状 | +| ③ | 暂不处理该项 | + +--- + +### B8. 出入库记录的「单号」 + +| 选项 | 内容 | +|---|---| +| ①(建议) | 改「业务单号」 | +| ② | 按单据类型动态显示(入库单号/出库单号/运单号…) | +| ③ | 保持「单号」 | + +**位置**:`storage/log/log-config.ts:211,258`。 + +--- + +### B9. 波次号 / 波次编号 / 抓取波次号 + +| 选项 | 内容 | +|---|---| +| ①(建议) | 页面统一「波次号」;导出保留「抓取波次号」 | +| ② | 全部统一「波次号」 | +| ③ | 保持现状 | + +**位置**:`WaveBatchDetailPanel.vue:8`(波次编号)、订单导出白名单(抓取波次号)。 + +--- + +## C. 导出与打印(需协作,P2) + +### C1. 导出白名单中文是否改 + +| 选项 | 内容 | +|---|---| +| ①(建议) | 本期不动;等后端支持新旧名称别名后再改 | +| ② | 直接改前端,后端同步发版 | +| ③ | 不改,接受页面与导出口径不一致 | + +**原因**:`export_columns` 是中文白名单入参,改字会导致后端不识别。 + +--- + +### C2. 打印模板是否本期修订 + +| 选项 | 内容 | +|---|---| +| ①(建议) | 单独批次:人工修改模板静态文字,先备份 | +| ② | 与前端文案同批上线 | +| ③ | 本期不改,接受打印与页面不一致 | + +**受影响模板(5 个)**:收货单(210×298)、B2B订单拣货单、拣货单、出库单A5模板、A5、入库单A5模板。 + +--- + +### C3. 打印字段字典 `field_name` 是否统一 + +| 选项 | 内容 | +|---|---| +| ①(建议) | 后端排期统一字段名 | +| ② | 不改,打印设计器保留旧名 | +| ③ | 只改前端展示映射(不改后端) | + +**原因**:打印设计器字段名来自后端字段表,前端改 label 不影响。 + +--- + +### C4. PICKING / ENTRY_ORDER 打印字段字典缺失 + +| 选项 | 内容 | +|---|---| +| ①(建议) | 登记为独立缺陷,另行修复 | +| ② | 本次一起修 | +| ③ | 不处理 | + +**现象**:生产 `setting.printTemplate.list` 未返回这两个分类的 `printItems`。 + +--- + +### C5. `waybill_text` 是否加入打印字段字典 + +| 选项 | 内容 | +|---|---| +| ①(建议) | 加入,便于模板维护 | +| ② | 不加入,保持前端合成 | + +--- + +## D. 发布与兼容(P3) + +### D1. 已保存的列设置 / 过滤预设是否处理 + +| 选项 | 内容 | +|---|---| +| ①(建议) | 不处理,改名后回归验证即可 | +| ② | 清洗 localStorage 中的旧 label | +| ③ | 提供“恢复默认”提示 | + +**结论依据**:列设置合并时以代码 label 为准;过滤预设按字段 `value` 存储。 + +--- + +### D2. `src/lang` 中未引用的文案 + +| 选项 | 内容 | +|---|---| +| ①(建议) | 本期不动 | +| ② | 一并清理 `ship_no` / `express_no` / `order_no` | +| ③ | 改为统一术语表的唯一来源 | + +--- + +### D3. 上线顺序 + +| 选项 | 内容 | +|---|---| +| ①(建议) | P1 前端文案 → 回归 → P2 后端导出/打印字典 → P3 模板 → P4 字段名 | +| ② | 前端 + 打印模板同批 | +| ③ | 一次性全改 | + +--- + +## E. 范围确认 + +### E1. 其他单号域本期是否只记录不改 + +| 选项 | 内容 | +|---|---| +| ①(建议) | 是:订单号、平台单号、入库/收货/出库/售后/盘点等仅保留快照,不改 | +| ② | 本期一起改 | +| ③ | 挑选其中几项一起改(请注明) | + +--- + +## 快速回复模板 + +```text +A1=① A2=④ A3=① A4=③ A5=② +B1=① B2=① B3=① B4=① B4.1=① B5=① B6=① B7=① B8=① B9=① +C1=① C2=① C3=① C4=① C5=① +D1=① D2=① D3=① +E1=① +``` + +> 以上为「建议默认值」。全部按此执行时,本期只改文案: +> 通用运单=运单号、退件=退回运单号、面单号保留、主/子单号保留、收货单保留物流单号、 +> `express_code` 暂不动、导出与打印模板不动。 + +--- + +## 确认后的产出 + +收到确认后,将输出: +1. 逐文件逐行改动清单(文件、行号、原文案、新文案); +2. 回归核对表(页面、动作、预期结果); +3. 打印模板修订单(若 C2 选择修订); +4. 后端配合项清单(若 C1/C3 涉及)。 diff --git a/docs/运单号命名-统一方案-讨论稿.md b/docs/运单号命名-统一方案-讨论稿.md new file mode 100644 index 00000000..9df4bb42 --- /dev/null +++ b/docs/运单号命名-统一方案-讨论稿.md @@ -0,0 +1,198 @@ +# 运单号命名统一方案(讨论稿) + +> 关联快照:`docs/单号字段命名-全量快照-2026-11-21.md` +> 状态:讨论稿,未定稿;**本文不含代码改动**。 +> 范围:本期只讨论「运单号」域;订单号、平台单号、各单据号放到后续阶段。 + +## 1. 现状摘要(详见快照) + +- 同一份运单数据,当前有 6 种展示名:`运单号`、`快递单号`、`物流单号`、`面单号`、`主单号`、`退回(收件)运单号`。 +- 底层字段有 9 种写法:`waybill_code`、`waybill_codes`、`waybill_no`、`main_waybill_code`、`express_numbers`、`express_codes`、`express_code`、`tracking_no`、`tracking_number`。 +- 同一个页面内已出现自相矛盾:订单管理「待处理」是快递单号,「待处理B2B」是运单号;订单详情同时有「快递单号(express_code)」与「运单号(waybill_codes)」。 +- `express_code` 在不同模块分别是「快递单号 / 运单号 / 快递公司编码」,语义未统一。 +- `components/waybill/waybill-column.ts` 通过 **label 正则** 识别运单列,文案与功能耦合。 + +## 2. 目标与原则 + +| 目标 | 说明 | +|---|---| +| 一致性 | 同一业务值在列表、详情、筛选、导出、提示语中使用同一个名字 | +| 可辨识 | 不同业务值不能同名(尤其 `express_code` 与 `waybill_codes`) | +| 低风险 | 本期只改**中文展示文案**,不改 prop、不改接口字段、不改数据结构 | +| 可回滚 | 以快照为准逐项核对,出现问题可按文件 `git checkout` 回退 | + +## 3. 候选方案 + +| 方案 | 内容 | 改动量 | 优点 | 风险 | +|---|---|---|---|---| +| A 全量统一 | 所有场景一律叫「运单号」(含面单、物流单号、退回运单号、主单号) | 大(约 25 处+) | 最彻底、认知最统一 | 打印/面单、空运海运、退件业务语义会丢失;父子单关系不直观 | +| B 分层统一(推荐) | 通用场景=运单号;退件域=退回运单号;打印扫描=面单号(运单号);父子=主单号/子单号;收货单暂保留物流单号 | 中(约 18 处) | 兼顾一致性与业务语义;可按域分批上线 | 需要先确认 5 个业务口径 | +| C 只修冲突 | 只改 B2B 快递单号、退回收件运单号、二维码标题、异常/归档详情重复「发货单号」 | 小(约 8 处) | 快速止血 | 只是打补丁,同字段仍多名称 | + +## 4. 推荐方案 B:分场景口径 + +| 场景 | 建议统一名 | 覆盖范围 | 备注 | +|---|---|---|---| +| 通用运单 | **运单号** | 订单管理全部页签、订单详情、工作台、复核、称重、售后、打包流水、快递号、入库单、出库单、所有筛选项 | 替换「快递单号」「运单号/波次号」中的运单部分 | +| 退件域 | **退回运单号** | 退件记录列表/详情、退回拆包列表/详情/导出、退回登记表单 | 列表不再用「退回收件运单号」 | +| 打印扫描 | **面单号(运单号)** | 波次「确认打印」弹窗、页面扫码提示 | 保留行业俗称,同时注明实际值 | +| 父子运单 | **主单号 / 子单号** | 快递号列表、按运单转出弹窗、运单类型筛选 | 不改 | +| 收货单 | **物流单号(暂定)** | 收货单列表、收货表单、筛选 | `tracking_number` 可能为空运/海运单号,待确认后再决定是否并入运单号 | +| `express_code` | **暂不改名** | 订单详情、异常/归档详情、入库单 | 先确认是运单号还是快递公司编码;若是公司编码,改为「快递公司编码」并对该列设置 `waybillActions: false` | + +## 5. 分期计划 + +| 阶段 | 内容 | 前置条件 | +|---|---|---| +| P0 口径确认 | 确认第 8 节 5 个问题,产出最终术语表 | 产品/业务确认 | +| P1 文案统一 | 按方案 B 改通用运单 + 退件域 + 二维码/提示语 | 快照已就位 | +| P2 语义修正 | 处理 `express_code`(改名或关闭运单操作菜单)、收货单物流单号 | 后端/接口语义确认 | +| P3 结构收敛(可选) | 抽 `WAYBILL_LABEL` 等常量;收敛 `express_numbers`/`tracking_no` 字段名 | 需后端配合,风险高,不建议与 P1 同批 | + +## 6. 影响范围(文件级) + +- `src/views/order/orderManagement/config/order-common-config.ts`(列表、详情、筛选、导出白名单) +- `src/views/order/waveOrder/config/wave-config.ts`、`GroupWaveBatchListPanel.vue`、`component/ConfirmWavePrintDialog.vue` +- `src/views/order/orderreview/*`、`src/views/order/orderWeighing/*` +- `src/views/storage/entry/entry-config.ts`、`src/views/storage/stockout/stockout-config.ts`、`src/views/storage/receiving/receiving-config.ts` +- `src/views/express/waybill/*`、`src/views/express/returnwaybill/*`、`src/views/express/returnReceived/*`、`src/views/express/returnUnpack/*`、`src/views/express/returnUnpackwork/*` +- `src/views/afterSale/*`、`src/views/message/*`、`src/views/data/packingflow/*`、`src/views/data/returnrecord/*` +- `src/components/waybill/WaybillCodeActions.vue`、`src/components/QR/qrcode.vue`、`src/components/UpperTable/index.vue` + +## 7. 风险与回归点 + +| 风险 | 说明 | 应对 | +|---|---|---| +| 文案驱动功能失效 | `waybill-column.ts` 用 label 正则匹配;若改成不含「运单号」的词,复制/二维码/轨迹会消失 | 统一后的名称必须包含「运单号」;改完逐页验证三个动作 | +| 误挂操作菜单 | `express_code` 若其实是快递公司编码,标成「运单号」会提供轨迹查询 | P2 前先确认语义;必要时 `waybillActions: false` | +| 筛选同名 | 两个筛选都叫「快递单号」但字段不同 | 统一后分别叫「运单号」「快递公司编码」 | +| 父子单混淆 | 合并成「运单号」后看不出主/子 | 仅运单中心保留主单号/子单号 | +| 国际化遗漏 | `src/lang/zh-CN.ts` 存在未引用的第三套文案 | P1 一并清理或标注废弃 | + +**回归清单** + +- [ ] 订单管理 10 个页签表头 +- [ ] 订单详情(完整/精简) +- [ ] 波次「确认打印」弹窗与扫码提示 +- [ ] 复核、称重、售后、工单 +- [ ] 快递号列表/详情/转出弹窗 +- [ ] 退件记录、退回拆包、退回登记 +- [ ] 入库单、出库单、收货单 +- [ ] 打包流水 +- [ ] 运单列的复制、二维码、轨迹三个动作 +- [ ] 列表导出表头 + +## 8. 待确认问题 + +1. 「快递单号」是否全部并入「运单号」?B2B 与非 B2B 是否同批处理? +2. 波次管理「物流单号」(`tracking_no`)确认就是运单号吗? +3. 收货单「物流单号」(`tracking_number`)在空运/海运场景是否仍是运单号? +4. 波次确认打印保留「面单号」还是直接叫「运单号」? +5. 订单详情/异常/归档/入库单的 `express_code`:是运单号还是快递公司编码? +6. 退件列表是否统一为「退回运单号」(不再用「退回收件运单号」)? +7. 本期是否接受仅改中文文案、不改字段名? + +## 9. 验收标准 + +- 通用运单场景中不再出现「快递单号」作为列名/筛选名(除非确认为不同字段)。 +- 同一页面内不再出现两个同名但不同字段的「单号」列/筛选项。 +- 退件域列表、详情、导出、表单用词完全一致。 +- 运单列的复制、二维码、轨迹功能全部正常。 +- 与快照逐项对比,差异项均在本次方案范围内。 + +--- + +## 10. 影响评估(2026-11-21 补充) + +> 依据:`docs/单号字段命名-全量快照-2026-11-21.md` 第 21~23 节(生产打印模板实测)。 + +### 10.1 影响机制分级 + +| 级别 | 机制 | 影响 | 处理方式 | +|---|---|---|---| +| A 纯展示 | 列表 `label`、详情字段名、表单 `label`、占位符、弹窗标题 | 只影响显示 | 可直接改 | +| B 文案驱动逻辑 | `waybill-column.ts` 按 label 正则识别运单列;`ORDER_LIST_FIELD_LABELS` 按 prop 覆盖 label;`WaybillCodeActions` / `UpperTable` 用 label 拼提示语 | 改错会导致功能消失或提示不一致 | 改后必须验证 | +| C 需后端配合 | 导出白名单中文、打印字段字典 `field_name` | 前端改字后端不识别 / 打印设计器仍显示旧名 | 本期不动,登记 | +| D 用户本地数据 | 列设置 localStorage、ScanBox 过滤预设 | 可能残留旧名 | 验证 + 说明 | +| E 打印取数 | `field_code` 映射(出库单、B2B 拣货单、收货打印) | 改字段名会导致模板取不到值 | **禁止改动** | + +### 10.2 逐项影响清单 + +| # | 改动项 | 影响 | 验证点 | 风险 | +|---|---|---|---|---| +| 1 | 列表列「快递单号」→「运单号」 | `waybill-column.ts` 的 label 正则仍能命中;复制/二维码/轨迹照常挂载 | 订单管理 4 个页签、异常列表 | 低 | +| 2 | 列表列「物流单号」→「运单号」 | 正则可命中;但波次 `tracking_no` 是否真为运单号未确认 | 波次策略 / 不符合策略列表 | 中 | +| 3 | 收货单「物流单号」改名 | `tracking_number` 可能含空运/海运单号;打印字典里叫「快递单号」 | 收货单列表 + 收货打印模板 | 中高 | +| 4 | 退件列表「退回收件运单号」→「退回运单号」 | 纯文案;导出弹窗、详情需同步 | 退件记录列表/详情、导出 | 低 | +| 5 | 异常/归档详情两行同名「发货单号」 | 需区分 `delivery_order_code` 与 `order_code` 的文案,否则用户无法辨识 | 两个详情面板 | 中 | +| 6 | 详情 `express_code` 改「运单号/快递公司编码」 | 先要确认语义;若为快递公司编码,统一叫运单号会固化错误 | 订单详情、异常/归档详情、入库单 | 高 | +| 7 | 筛选 `waybill_codes`「快递单号」→「运单号」 | 过滤预设按字段 `value` 存储,不受 label 影响;摘要文字会自动更新 | 存为过滤条件后刷新页面 | 低 | +| 8 | 筛选 `express_code`「快递单号」→「快递公司编码」 | 只改文案不影响查询;但后端过滤字段语义需确认 | 异常筛选、入库/出库筛选 | 中 | +| 9 | `ORDER_LIST_FIELD_LABELS` 同步 | 该映射用于 `buildPendingStyleColumns` 等标准化;不改会导致同一列在不同页签名称分叉 | 待处理/待出库/B2B 列表 | 中 | +| 10 | `buildPendingB2bColumns` 的 `express_numbers` 改名逻辑 | 统一后变冗余;保留无害,删除需回归两个 B2B 页签 | 待处理B2B、配送B2B | 低 | +| 11 | 二维码标题统一 | 三处需一起改:`QR/qrcode.vue` 默认标题、`WaybillCodeActions` 传入标题、`UpperTable` tooltip | 任意运单列触发二维码 | 低 | +| 12 | 导出字段白名单中文 | `export_columns` 是中文白名单入参,改字后端不识别 → 导出报错/缺列 | 订单导出(含明细/不含明细) | 高(本期不动) | +| 13 | 打印模板静态文字 | 模板内 `title/content` 是设计时写入的固定文本,前端改名**不会**自动更新 | 12 个模板逐个预览 | 中(需人工修模板) | +| 14 | 打印字段字典 `field_name` | 来自后端字段表;不改则打印设计器仍显示「快递单号/运单号/出库单号」 | 打印模板字段面板 | 中(需后端) | +| 15 | 打印取数 `field_code` | 出库单模板「出库单号」绑定 `delivery_order_code`(取数来自 `stockout_order_code`);B2B 拣货单用 `waybill_text` | 出库单打印、B2B 拣货单打印 | **极高(禁止改)** | +| 16 | 列设置 localStorage | 存储里有 label,但合并时以代码 `base.label` 为准;设置中心「所有表格字段」可能显示旧名 | 字段设置弹窗、恢复默认 | 低 | +| 17 | i18n `shipment.express_no` 等 | 业务代码未引用,改/删无运行时影响 | 全局搜索确认 | 低 | + +### 10.3 打印模板专项结论(生产实测) + +1. 生产共 **12 个模板 / 5 类**:商品标签 4、收货单 2、拣货单 2、出库单 2、入库单 2。 +2. **5 个模板含单号元素**:收货单(210×298)、B2B订单拣货单、拣货单、出库单A5、A5、入库单A5。 +3. 打印字段字典本身就不统一: + - 收货域:`tracking_number` 叫「快递单号」(描述为「快递单号/物流单号」),`express_code` 叫「运单号」。 + - 出库域:`delivery_order_code` 叫「出库单号」,`express_code` 叫「快递单号」。 + - 与页面口径冲突:页面出库单号是 `stockout_order_code`;页面 `express_code` 在出库接口里被注释为「快递公司编码」。 +4. **同一模板内已经混用**:出库单A5模板对同一个 `express_code` 同时使用「快递单号」(文本)与「运单号」(二维码);A5 模板静态写「运单号:」,绑定列叫「快递单号」。 +5. **静态文字不会跟随改名**:模板里的「运单号:」「发货单号:」「波次号:」都是纯文本元素(无 `field_code`),只能人工在模板编辑器里改。 +6. **B2B 拣货单依赖合成字段**:`waybill_text` 不在字段字典内,模板不能重新拖拽该字段;改名/改字段都会直接影响该模板。 +7. **PICKING / ENTRY_ORDER 分类未返回 `printItems`**:打印设计器字段面板可能为空,需确认是否为已知问题(与本次改名无关,但会影响模板维护)。 + +### 10.4 用户本地数据评估 + +| 数据 | 存储内容 | 改名后表现 | 结论 | +|---|---|---|---| +| UpperTable 列配置 | `{ prop, label, visible, order, width, fixed }` | 合并时使用代码里的 `base.label`,显示以代码为准;设置中心可能显示旧 label | 低风险,建议改名后清理 `label` 或忽略 | +| `defaultColumns` 快照 | 首次保存时的列快照(含旧 label) | 「恢复默认」写入旧 label,但显示仍以代码 label 为准 | 低风险 | +| ScanBox 过滤预设 | `{ pageKey, name, conditions }`,conditions 以字段 `value` 为键 | 不存 label;摘要按当前 label 渲染 | 无影响 | +| 用户偏好(tab 顺序等) | 与字段名无关 | 无影响 | 无影响 | + +### 10.5 本期改动边界(建议) + +**可以改**: +- `src/views/**`、`src/components/**` 中的 `label`、`detailLabel`、`placeholder`、`title`、提示语、空态文案。 +- `ORDER_LIST_FIELD_LABELS`(必须与列表同步)。 + +**不要改**: +- 任何 `prop`、`field_code`、接口字段名。 +- `ORDER_EXPORT_ALL_COLUMNS` 的中文字符串(等后端支持别名)。 +- 打印模板内的静态文字与绑定字段(单独出「模板修订单」审批后执行)。 +- 打印取数映射(`delivery_order_code ← stockout_order_code`、`waybill_text`、`express_code ↔ waybill_code`)。 + +### 10.6 建议上线顺序 + +1. **P1 前端文案**:通用运单统一 + 退件域 + 二维码/提示语(不动字段)。 +2. **P1.5 回归**:运单列三个动作、筛选预设、列设置、打印预览(确认未被文案影响)。 +3. **P2 后端配合**:导出白名单增加新旧名称别名;打印字段字典 `field_name` 统一。 +4. **P3 打印模板修订**:逐模板改静态文字(生产操作,需审批与备份)。 +5. **P4 字段名收敛(可选)**:仅在 P2 完成后评估。 + +### 10.7 新增待确认问题(打印相关) + +1. 打印模板是否本期同步修订?由谁执行、是否需要生产备份? +2. `express_code` 在收货/出库打印域是否就是运单号?库存接口注释「快递公司编码」是否为历史遗留错误? +3. 打印字段 `tracking_number` 叫「快递单号」、页面叫「物流单号」,统一成哪个? +4. PICKING / ENTRY_ORDER 打印字段字典缺失(`printItems` 为空)是否为已知问题,是否需要补? +5. 导出白名单能否由后端同时接受新旧中文名(灰度期)? +6. `waybill_text` 是否需要加入打印字段字典,供设计器重新拖拽? + +### 10.8 验收标准(补充) + +- 打印预览:出库单、拣货单、B2B拣货单、收货单、入库单的单号位置与取值正常。 +- 导出:含明细/不含明细均能成功,列名与页面一致(或明确记录差异)。 +- 过滤预设:改名前后已保存的预设仍能正确应用。 +- 列设置:已保存的列配置在改名后仍正常显示新名称。 +- 未改动任何 `field_code` / 打印取数映射(用 `git diff` 核对)。 diff --git a/src/views/order/orderManagement/deliveryOrder.vue b/src/views/order/orderManagement/deliveryOrder.vue index 89b1edd3..e2b6ffe5 100644 --- a/src/views/order/orderManagement/deliveryOrder.vue +++ b/src/views/order/orderManagement/deliveryOrder.vue @@ -967,7 +967,9 @@ const { loadB2bPickingPrintData } = useB2bPickingPrint({ getSelectionRows: () => selectionRows.value, - emptySelectionMessage: '请先勾选需要打印拣货单的 B2B 订单' + emptySelectionMessage: '请先勾选需要打印拣货单的 B2B 订单', + // 分箱快照的 item_code 对部分商品为空,用配送订单明细回填商品条码 + fetchItemDetail: (orderId: number) => fetchDeliveryOrderDetail({ id: orderId }) }) /** 行内「操作」列(仅 B2B 页签):备货 / 确认提货 / 设置车牌(分箱在备货窗口内完成) */ diff --git a/src/views/order/orderManagement/pendingOrder.vue b/src/views/order/orderManagement/pendingOrder.vue index 6ef7bc70..5acbe8b6 100644 --- a/src/views/order/orderManagement/pendingOrder.vue +++ b/src/views/order/orderManagement/pendingOrder.vue @@ -1086,7 +1086,9 @@ const { loadB2bPickingPrintData } = useB2bPickingPrint({ getSelectionRows: () => selectionRows.value, - emptySelectionMessage: '请先勾选需要打印拣货单的 B2B 订单' + emptySelectionMessage: '请先勾选需要打印拣货单的 B2B 订单', + // 分箱快照的 item_code 对部分商品为空,用订单明细回填商品条码 + fetchItemDetail: (orderId: number) => orderPendingOrder.detail({ id: orderId }) }) /** 行内「操作」列(仅 B2B 页签):备货 / 确认提货 / 设置车牌(分箱在备货窗口内完成) */ diff --git a/src/views/order/orderManagement/utils/use-b2b-picking-print.ts b/src/views/order/orderManagement/utils/use-b2b-picking-print.ts index b4008893..d18a3bd7 100644 --- a/src/views/order/orderManagement/utils/use-b2b-picking-print.ts +++ b/src/views/order/orderManagement/utils/use-b2b-picking-print.ts @@ -9,6 +9,8 @@ import { orderPendingOrderGetB2bPackingSnapshot } from '@/api/order.pendingorder * - 单据头 = 订单行字段:delivery_order_code / sys_platform_name / sys_logistics_name / create_at / remark * - 明细表 = order.getB2bPackingSnapshot 的 items: * item_code(商品条码)/ item_name / plan_qty(应拣数量)/ pick_locations_text(取货储位文案) + * - ⚠️ 生产实测快照接口的 items[].item_code 对部分商品返回空串(item_snapshot.item_code 也为空), + * 因此当存在空条码时,用订单明细接口(fetchItemDetail)按 order_item_id / stock_id 回填 * - 模板:打印模板设置里的「B2B订单拣货单」(business_type=PICKING,148×210) */ @@ -18,6 +20,12 @@ type UseB2bPickingPrintOptions = { /** 弹窗默认选中的模板名(各环境模板 ID 不同,按名称匹配更稳) */ defaultTemplateName?: string emptySelectionMessage?: string + /** + * 商品条码兜底数据源:`order.getB2bPackingSnapshot` 的 items[].item_code 对部分商品返回空串 + * (实测生产:同款商品在订单明细接口里有 item_code,快照里却是 ""), + * 此时调用订单明细接口(pendingOrder.detail / deliveryOrder.detail)按 order_item_id / stock_id 回填。 + */ + fetchItemDetail?: (orderId: number) => Promise } function isOkCode(res: any) { @@ -34,6 +42,104 @@ function toOrderId(value: unknown): number | null { return Number.isInteger(n) && n > 0 ? n : null } +/** 兼容 `item_snapshot` 返回对象或 JSON 字符串两种形态 */ +function toSnapshotRecord(value: unknown): Record { + if (value && typeof value === 'object') return value as Record + if (typeof value === 'string' && value.trim().startsWith('{')) { + try { + const parsed = JSON.parse(value) + return parsed && typeof parsed === 'object' ? (parsed as Record) : {} + } catch { + return {} + } + } + return {} +} + +/** 条码列表归一化:数组 / JSON 字符串 / 逗号分隔字符串 → string[] */ +function toBarcodeList(value: unknown): string[] { + if (Array.isArray(value)) { + return value + .map((item) => + String(typeof item === 'string' ? item : (item as Record | null)?.barcode ?? '').trim() + ) + .filter(Boolean) + } + const text = String(value ?? '').trim() + if (!text) return [] + if (text.startsWith('[')) { + try { + const parsed = JSON.parse(text) + if (Array.isArray(parsed)) return toBarcodeList(parsed) + } catch { + // 非 JSON:按分隔符处理 + } + } + return text + .split(/[,,;;|、]/) + .map((item) => item.trim()) + .filter(Boolean) +} + +/** + * 商品条码取值(打印模板「商品条码」列绑定的 field_code=item_code): + * item_code → item_snapshot.item_code → item_snapshot.barcode → 首个 barcode + * + * ⚠️ 生产实测 `order.getB2bPackingSnapshot` 的 items[].item_code 与 item_snapshot.item_code + * 对部分商品返回空串(如「九子白洁面皂」),此时需由订单明细接口回填,见 loadB2bPickingPrintData。 + */ +export function resolveB2bItemCode(item: Record | null | undefined): string { + if (!item) return '' + const snapshot = toSnapshotRecord(item.item_snapshot) + const itemBarcodes = toBarcodeList(item.barcodes) + const barcodes = itemBarcodes.length ? itemBarcodes : toBarcodeList(snapshot.barcodes) + const candidates = [item.item_code, snapshot.item_code, item.barcode, snapshot.barcode, barcodes[0]] + for (const candidate of candidates) { + const text = String(candidate ?? '').trim() + if (text) return text + } + return '' +} + +/** + * 订单明细(order.pendingOrder.detail / order.deliveryOrder.detail)→ 回填拣货单明细的商品条码 + * 优先按 order_item_id 匹配,其次按 stock_id 匹配(配送 dispatch 模型可能没有 order_item_id)。 + */ +function mergeItemCodesFromDetail( + details: Array>, + detailRes: any +): Array> { + const data = pickData(detailRes) + const items = Array.isArray(data.items) + ? data.items + : Array.isArray(data.orderItems) + ? data.orderItems + : [] + if (!items.length) return details + + const byOrderItemId = new Map() + const byStockId = new Map() + items.forEach((item: any) => { + const code = resolveB2bItemCode(item) + if (!code) return + const orderItemId = String(item?.order_item_id ?? item?.orderItemId ?? '').trim() + if (orderItemId) byOrderItemId.set(orderItemId, code) + const stockId = String(item?.stock_id ?? '').trim() + if (stockId) byStockId.set(stockId, code) + }) + + return details.map((row) => { + if (String(row.item_code ?? '').trim()) return row + const orderItemId = String(row.order_item_id ?? '').trim() + const stockId = String(row.stock_id ?? '').trim() + const code = + (orderItemId ? byOrderItemId.get(orderItemId) : '') || + (stockId ? byStockId.get(stockId) : '') || + '' + return code ? { ...row, item_code: code } : row + }) +} + /** ISO 时间戳 → YYYY-MM-DD HH:mm:ss(模板直接取字符串,不认 ISO) */ function formatPrintTime(val: unknown): string { if (!val) return '' @@ -155,26 +261,48 @@ export function useB2bPickingPrint(options: UseB2bPickingPrintOptions) { pickingPrintLoading.value = true let details: Array> = [] try { - const res: any = await orderPendingOrderGetB2bPackingSnapshot({ id: orderId }) - if (isOkCode(res)) { - const snapshot = pickData(res) - const items = Array.isArray(snapshot.items) ? snapshot.items : [] - details = items.map((item: any) => { - const itemSnapshot = (item?.item_snapshot ?? {}) as Record - return { - order_item_id: item?.order_item_id ?? '', - item_code: String(item?.item_code ?? itemSnapshot.item_code ?? '').trim(), - item_name: String(item?.item_name ?? itemSnapshot.item_name ?? '').trim(), - plan_qty: Number(item?.plan_qty ?? 0), - packed_quantity: Number(item?.packed_quantity ?? 0), - pick_locations_text: formatB2bPickLocations(item?.pick_locations) - } - }) - } else { - console.warn('[B2B拣货单] 获取分箱明细失败', res) + try { + const res: any = await orderPendingOrderGetB2bPackingSnapshot({ id: orderId }) + if (isOkCode(res)) { + const snapshot = pickData(res) + const items = Array.isArray(snapshot.items) ? snapshot.items : [] + details = items.map((item: any) => { + const itemSnapshot = toSnapshotRecord(item?.item_snapshot) + return { + order_item_id: item?.order_item_id ?? '', + stock_id: Number(item?.stock_id ?? item?.item_id ?? 0) || '', + item_code: resolveB2bItemCode(item), + item_name: String(item?.item_name ?? itemSnapshot.item_name ?? '').trim(), + plan_qty: Number(item?.plan_qty ?? 0), + packed_quantity: Number(item?.packed_quantity ?? 0), + pick_locations_text: formatB2bPickLocations(item?.pick_locations) + } + }) + } else { + console.warn('[B2B拣货单] 获取分箱明细失败', res) + } + } catch (e) { + console.error('[B2B拣货单] 获取分箱明细出错', e) + } + + // 快照接口对部分商品返回 item_code=""(实测生产),用订单明细接口按 order_item_id / stock_id 回填 + if (options.fetchItemDetail && details.some((item) => !String(item.item_code ?? '').trim())) { + try { + const detailRows: any = await options.fetchItemDetail(orderId) + if (isOkCode(detailRows)) { + details = mergeItemCodesFromDetail(details, detailRows) + } else { + console.warn('[B2B拣货单] 订单明细回填商品条码失败', detailRows) + } + } catch (e) { + console.error('[B2B拣货单] 订单明细回填商品条码出错', e) + } + } + + const stillMissing = details.filter((item) => !String(item.item_code ?? '').trim()).length + if (stillMissing) { + console.warn(`[B2B拣货单] 订单 ${orderId} 仍有 ${stillMissing} 个商品取不到商品条码`) } - } catch (e) { - console.error('[B2B拣货单] 获取分箱明细出错', e) } finally { pickingPrintLoading.value = false }