diff --git a/docs/拣货单模板-148x210-设计与实施.md b/docs/拣货单模板-148x210-设计与实施.md new file mode 100644 index 00000000..d50b9f63 --- /dev/null +++ b/docs/拣货单模板-148x210-设计与实施.md @@ -0,0 +1,169 @@ +# 拣货单模板(148mm × 210mm)设计与实施 + +> 使用场景:`/order/waveOrder` —— **团购波次**、**散单波次** 页面的「批量打印拣货单」。 +> 涉及代码:`GroupWaveBatchListPanel.vue` / `SandanWaveBatchListPanel.vue`(`business-type="PICKING"`) +> → `components/BatchReceivingPrintDialog.vue` → `utils/printPaginate.ts` + +## 一、数据来源与可选字段 + +`openBatchPrintDialog` 组装出的打印数据(`wavePrintDataMap[wave_id]`): + +``` +form = { + ...首个订单(normalizePrintOrder 后), // 含 address / express_code / waybill_code / create_at ... + wave_no, + details: [全部订单(normalizePrintOrder 后)] +} +``` + +`normalizePrintOrder` 会补:`address`(省市区镇+详细地址拼接)、`express_code`(多来源回退)、 +`waybill_code`(= express_code)、`create_at`、`order_create_time`、`print_time`。 + +| 位置 | 可用字段 | +| --- | --- | +| 单据头(顶层) | `wave_no`、`sys_platform_name`、`sys_logistics_name`、`create_at`、`print_time`(自动)、`remark`、`delivery_order_code` 等订单字段(取首单) | +| 明细表(`details` 每行) | `delivery_order_code`、`express_code`/`waybill_code`、`name`(收件人)、`mobile`、`province`、`city`、`area`、`items_total`、`items_weight`、`remark` | + +⚠️ 限制: + +- 表格**没有行号变量**,不要设计「序号」列(会整列为空)。 +- 波次打印的 `details` 是**订单维度**,不是商品维度 —— 无法在模板里输出商品明细。 +- 表格单元格固定 `text-align: center`(渲染代码写死),`textAlign` 只对普通 text 生效。 +- 分隔线/签字线必须是 `type: "shape"` + `shapeType: "line"`;旧模板的 `type: "line"` 不渲染。 +- 分页截止线 = 表格下方**最近的 text 元素 top**(本模板 = 备注行 179mm,表格 top 61、表头 6mm)→ 每页约 18 行。 + +## 二、生产环境原始数据备份(改动前) + +`wms.wms.gztbyc.com` · `wms_print_template` · **id = 16** + +```json +{ + "id": 16, + "template_name": "拣货单", + "platform": "default", + "template_type": "CUSTOM", + "template_url": "NONE", + "template_content": [], + "page_width": 76, + "page_height": 130, + "warehouse_id": null, + "is_default": false, + "status": "ACTIVE", + "create_at": "2026-05-11T14:23:06.000Z", + "update_at": "2026-05-11T14:23:06.000Z", + "business_type": "PICKING", + "delete_at": null, + "editable": false, + "deletable": false, + "isGeneral": true +} +``` + +> 回滚:`page_width=76, page_height=130, template_content=[]` +> 说明:`warehouse_id=null` + `isGeneral=true` → 后端返回 `editable:false`,页面「编辑」按钮隐藏,只能改库/接口。 + +## 三、版式设计(A5 纵向 148×210,页边距 10mm,内容宽 128mm) + +| # | 元素 | top | left | 宽 | 高 | 内容/字段 | +| --- | --- | --- | --- | --- | --- | --- | +| 1 | 标题 18pt 粗 居中 | 6 | 0 | 148 | 10 | 拣 货 单 | +| 2 | 横线 | 17.5 | 10 | 128 | 1 | | +| 3 | 波次号: 10pt | 21 | 10 | 20 | 7 | 静态文字 | +| 4 | 波次号值 13pt 粗 | 21 | 30 | 60 | 7 | `wave_no` | +| 5 | 平台: 10pt | 21 | 92 | 12 | 7 | 静态文字 | +| 6 | 平台值 10pt | 21 | 104 | 34 | 7 | `sys_platform_name` | +| 7 | 物流公司: 10pt | 30 | 10 | 24 | 7 | 静态文字 | +| 8 | 物流公司值 10pt | 30 | 34 | 56 | 7 | `sys_logistics_name` | +| 9 | 创建时间: 10pt | 39 | 10 | 24 | 7 | 静态文字 | +| 10 | 创建时间值 10pt | 39 | 34 | 56 | 7 | `create_at` | +| 11 | 波次号条码(44×10,靠右) | 29 | 94 | 44 | 10 | `wave_no`(Code128) | +| 12 | 横线 | 48 | 10 | 128 | 1 | | +| 13 | 「订单明细」12pt 粗 | 51 | 10 | 60 | 8 | | +| 14 | 表格(订单明细) | 61 | 10 | 128 | 110 | 行高/表头 6mm,9pt | +| 15 | 横线 | 176 | 10 | 128 | 1 | | +| 16 | 备注: 9pt | 179 | 10 | 14 | 6 | 静态文字 | +| 17 | 备注值 9pt 自动换行 | 179 | 24 | 114 | 10 | `remark` | +| 18 | 打印时间: 9pt | 191 | 10 | 24 | 6 | 静态文字 | +| 19 | 打印时间值 9pt | 191 | 34 | 46 | 6 | `print_time`(弹窗自动填) | +| 20 | 拣货人: 9pt | 199 | 10 | 20 | 6 | 静态文字 | +| 21 | 拣货人签字线 | 205 | 10 | 38 | 1 | | +| 22 | 复核人: 9pt | 199 | 68 | 20 | 6 | 静态文字 | +| 23 | 复核人签字线 | 205 | 68 | 34 | 1 | | + +表格列(合计 128mm): + +| 列 | 宽 | 字段 | +| --- | --- | --- | +| 订单号 | 38 | `delivery_order_code` | +| 物流单号 | 44 | `express_code` | +| 收件人 | 20 | `name` | +| 件数 | 12 | `items_total` | +| 省份 | 14 | `province` | + +> 条码元素内容 = `wave_no`(Code128),仅用于手持枪快速定位波次;若仓库不需要扫码,可在编辑器里直接删掉该元素,或改小到 30×8mm。 +> +> 若不想打印条码,也可换成二维码(`type: "qrcode"`,同样取 `wave_no`)。 + +## 四、模板内容 JSON + +见同目录 `拣货单模板-148x210.json`。 + +## 五、写回方式与实测结论 + +### 5.1 接口不可用(生产环境实测 2026-11-19) + +| 试探 | 结果 | +| --- | --- | +| `setting.printTemplate.save` 写 id=16(148×210 + 新内容) | `code:500 保存打印模板失败` | +| `setting.printTemplate.save` 写 id=16(76×130 + `[]`,完全无变化) | `code:500 保存打印模板失败` | +| `setting.printTemplate.save` 写 id=17(原样回存) | `code:200 模板更新成功` | +| `setting.printTemplate.update` / `.get` | `code:500 接口错误: 方法 update/get 不存在` | + +结论:**不是内容校验问题**,而是 `warehouse_id IS NULL` 的「通用预设」被后端保护 +(`isGeneral:true` → `editable:false` / `deletable:false`),接口层面无法写入。 +生产环境只能走**直接改库**。 + +> 若希望生产也能在页面上编辑:把该模板 `warehouse_id` 绑到具体仓库(语义会从「全仓通用」变为「某仓专用」),或另建一条自定义模板。 + +### 5.2 开发库已写入 + +`192.168.11.56:3307` / `wms` / `wms_print_template` id=16: + +```sql +UPDATE wms_print_template +SET page_width = 148, page_height = 210, template_content = '' +WHERE id = 16 AND business_type = 'PICKING' AND JSON_VALID(template_content); +``` + +结果:`affectedRows=1`,回读 `page_width=148`、`page_height=210`、`JSON_VALID=1`、`JSON_LENGTH=23`。 + +### 5.3 生产库待执行(需有库权限) + +```sql +-- 备份 +SELECT id, template_name, page_width, page_height, warehouse_id, template_content +FROM wms_print_template WHERE id = 16; + +-- 写入(template_content 取 docs/拣货单模板-148x210.json 的单行 JSON) +UPDATE wms_print_template +SET page_width = 148, page_height = 210, template_content = '' +WHERE id = 16 AND business_type = 'PICKING' AND warehouse_id IS NULL; + +-- 校验 +SELECT id, template_name, page_width, page_height, + JSON_VALID(template_content) AS valid, JSON_LENGTH(template_content) AS el_cnt +FROM wms_print_template WHERE id = 16; +``` + +回滚: + +```sql +UPDATE wms_print_template +SET page_width = 76, page_height = 130, template_content = '[]' +WHERE id = 16; +``` + +### 5.4 生产环境遗留问题(与本模板无关,建议一并处理) + +生产 id=17「拣货单模板」(148×210,warehouse 1000028)里当前是**备货单版式**(上次迁移时写入), +名称与内容不一致;需要确认是改名成「备货单」还是清空/重写。 diff --git a/docs/拣货单模板-148x210.json b/docs/拣货单模板-148x210.json new file mode 100644 index 00000000..ff43e3c0 --- /dev/null +++ b/docs/拣货单模板-148x210.json @@ -0,0 +1,31 @@ +[ + {"id":"text_title","type":"text","title":"拣货单","name":"拣货单","content":"拣 货 单","top":6,"left":0,"width":148,"height":10,"fontSize":18,"bold":true,"italic":false,"underline":false,"rotate":0,"autoWrap":true,"textAlign":"center","lineHeight":10,"custom":true}, + {"id":"shape_line_top","type":"shape","shapeType":"line","title":"横线","content":"","top":17.5,"left":10,"width":128,"height":1,"lineWeight":1,"lineStyle":"solid"}, + {"id":"text_lb_wave_no","type":"text","title":"波次号","name":"波次号","content":"波次号:","top":21,"left":10,"width":20,"height":7,"fontSize":10,"bold":false,"italic":false,"underline":false,"rotate":0,"autoWrap":false,"textAlign":"left","lineHeight":7,"custom":true}, + {"id":"text_v_wave_no","type":"text","title":"波次号","content":"波次号","top":21,"left":30,"width":60,"height":7,"fontSize":13,"bold":true,"italic":false,"underline":false,"rotate":0,"autoWrap":false,"textAlign":"left","lineHeight":7,"field_code":"wave_no"}, + {"id":"text_lb_platform","type":"text","title":"平台","name":"平台","content":"平台:","top":21,"left":92,"width":12,"height":7,"fontSize":10,"bold":false,"italic":false,"underline":false,"rotate":0,"autoWrap":false,"textAlign":"left","lineHeight":7,"custom":true}, + {"id":"text_v_platform","type":"text","title":"平台","content":"平台","top":21,"left":104,"width":34,"height":7,"fontSize":10,"bold":false,"italic":false,"underline":false,"rotate":0,"autoWrap":false,"textAlign":"left","lineHeight":7,"field_code":"sys_platform_name"}, + {"id":"text_lb_logistics","type":"text","title":"物流公司","name":"物流公司","content":"物流公司:","top":30,"left":10,"width":24,"height":7,"fontSize":10,"bold":false,"italic":false,"underline":false,"rotate":0,"autoWrap":false,"textAlign":"left","lineHeight":7,"custom":true}, + {"id":"text_v_logistics","type":"text","title":"物流公司","content":"物流公司","top":30,"left":34,"width":56,"height":7,"fontSize":10,"bold":false,"italic":false,"underline":false,"rotate":0,"autoWrap":false,"textAlign":"left","lineHeight":7,"field_code":"sys_logistics_name"}, + {"id":"text_lb_create","type":"text","title":"创建时间","name":"创建时间","content":"创建时间:","top":39,"left":10,"width":24,"height":7,"fontSize":10,"bold":false,"italic":false,"underline":false,"rotate":0,"autoWrap":false,"textAlign":"left","lineHeight":7,"custom":true}, + {"id":"text_v_create","type":"text","title":"创建时间","content":"创建时间","top":39,"left":34,"width":56,"height":7,"fontSize":10,"bold":false,"italic":false,"underline":false,"rotate":0,"autoWrap":false,"textAlign":"left","lineHeight":7,"field_code":"create_at"}, + {"id":"barcode_wave_no","type":"barcode","title":"波次号","content":"波次号","top":29,"left":94,"width":44,"height":10,"fontSize":8,"rotate":0,"field_code":"wave_no"}, + {"id":"shape_line_mid","type":"shape","shapeType":"line","title":"横线","content":"","top":48,"left":10,"width":128,"height":1,"lineWeight":1,"lineStyle":"solid"}, + {"id":"text_section","type":"text","title":"订单明细","name":"订单明细","content":"订单明细","top":51,"left":10,"width":60,"height":8,"fontSize":12,"bold":true,"italic":false,"underline":false,"rotate":0,"autoWrap":false,"textAlign":"left","lineHeight":8,"custom":true}, + {"id":"table_orders","type":"table","name":"table","title":"订单明细","top":61,"left":10,"width":128,"height":110,"rowHeight":6,"headerHeight":6,"rows":[ + {"id":"col_delivery_order_code","type":"text","title":"订单号","content":"订单号","width":38,"height":6,"fontSize":"9","textAlign":"left","bold":false,"field_code":"delivery_order_code"}, + {"id":"col_express_code","type":"text","title":"物流单号","content":"物流单号","width":44,"height":6,"fontSize":"9","textAlign":"left","bold":false,"field_code":"express_code"}, + {"id":"col_receiver","type":"text","title":"收件人","content":"收件人","width":20,"height":6,"fontSize":"9","textAlign":"center","bold":false,"field_code":"name"}, + {"id":"col_items_total","type":"text","title":"件数","content":"件数","width":12,"height":6,"fontSize":"9","textAlign":"center","bold":false,"field_code":"items_total"}, + {"id":"col_province","type":"text","title":"省份","content":"省份","width":14,"height":6,"fontSize":"9","textAlign":"center","bold":false,"field_code":"province"} + ]}, + {"id":"shape_line_bottom","type":"shape","shapeType":"line","title":"横线","content":"","top":176,"left":10,"width":128,"height":1,"lineWeight":1,"lineStyle":"solid"}, + {"id":"text_lb_remark","type":"text","title":"备注","name":"备注","content":"备注:","top":179,"left":10,"width":14,"height":6,"fontSize":9,"bold":false,"italic":false,"underline":false,"rotate":0,"autoWrap":false,"textAlign":"left","lineHeight":6,"custom":true}, + {"id":"text_v_remark","type":"text","title":"备注","content":"备注","top":179,"left":24,"width":114,"height":10,"fontSize":9,"bold":false,"italic":false,"underline":false,"rotate":0,"autoWrap":true,"textAlign":"left","lineHeight":5,"field_code":"remark"}, + {"id":"text_lb_print_time","type":"text","title":"打印时间","name":"打印时间","content":"打印时间:","top":191,"left":10,"width":24,"height":6,"fontSize":9,"bold":false,"italic":false,"underline":false,"rotate":0,"autoWrap":false,"textAlign":"left","lineHeight":6,"custom":true}, + {"id":"text_v_print_time","type":"text","title":"打印时间","content":"打印时间","top":191,"left":34,"width":46,"height":6,"fontSize":9,"bold":false,"italic":false,"underline":false,"rotate":0,"autoWrap":false,"textAlign":"left","lineHeight":6,"field_code":"print_time"}, + {"id":"text_lb_picker","type":"text","title":"拣货人","name":"拣货人","content":"拣货人:","top":199,"left":10,"width":20,"height":6,"fontSize":9,"bold":false,"italic":false,"underline":false,"rotate":0,"autoWrap":false,"textAlign":"left","lineHeight":6,"custom":true}, + {"id":"shape_sign_picker","type":"shape","shapeType":"line","title":"横线","content":"","top":205,"left":10,"width":38,"height":1,"lineWeight":1,"lineStyle":"solid"}, + {"id":"text_lb_checker","type":"text","title":"复核人","name":"复核人","content":"复核人:","top":199,"left":68,"width":20,"height":6,"fontSize":9,"bold":false,"italic":false,"underline":false,"rotate":0,"autoWrap":false,"textAlign":"left","lineHeight":6,"custom":true}, + {"id":"shape_sign_checker","type":"shape","shapeType":"line","title":"横线","content":"","top":205,"left":68,"width":34,"height":1,"lineWeight":1,"lineStyle":"solid"} +] diff --git a/src/api/order.deliveryorder/orderdeliveryOrder.ts b/src/api/order.deliveryorder/orderdeliveryOrder.ts index 30e09acf..973235e3 100644 --- a/src/api/order.deliveryorder/orderdeliveryOrder.ts +++ b/src/api/order.deliveryorder/orderdeliveryOrder.ts @@ -251,6 +251,8 @@ export function orderDeliveryOrderList(data: DeliveryOrderListParams = {}): Prom * total_box_count、pickup_plate_number、prep_remark、prep_duration_seconds、is_urgent(Y/N)、prep_at、 * is_picked_up(Y/N)、picked_up_at、created_at(作业明细创建时间,与订单 create_at 不同)、 * prep_status(none/padding/fin)、prep_operator_id、prep_operator_name、prep_start_at + * - 行内另带出 images(备货留证照片 business_type=b2b_order)与 pickup_images(提货留证照片 b2b_pickup), + * 元素 { id: file_id, url, display_order },无图片时为空数组(两者一次查询后分组输出) * - where 额外支持(仅 B2B 列表开放,普通列表不识别):total_box_count / pickup_plate_number / prep_remark / * prep_duration_seconds / is_picked_up / picked_up_at / created_at / prep_at / is_urgent / * prep_status / prep_operator_id / prep_start_at(支持简写与 {operator,value} 标准结构,prep_at 支持 between) diff --git a/src/api/order.pendingorder/orderpendingOrder.ts b/src/api/order.pendingorder/orderpendingOrder.ts index 6d6b64fb..671c40f3 100644 --- a/src/api/order.pendingorder/orderpendingOrder.ts +++ b/src/api/order.pendingorder/orderpendingOrder.ts @@ -697,8 +697,18 @@ export function orderPendingOrderFinishB2bPrep( export type PendingOrderPickupB2bParams = PendingOrderB2bOrderIdParams & { /** 提货车牌(可选;归一化后写入 wms_order_b2b.pickup_plate_number) */ pickup_plate_number?: string | null; + /** 车牌驼峰别名(与 pickup_plate_number 等价) */ + pickupPlateNumber?: string | null; /** 提货照片 file_id 列表(可选;兼容 pickupFileIds / file_ids / fileIds / pickup_images) */ pickup_file_ids?: PendingOrderB2bImageInput[]; + /** 提货照片 file_id 列表驼峰别名 */ + pickupFileIds?: PendingOrderB2bImageInput[]; + /** 提货照片 file_id 数组简写 */ + file_ids?: number[]; + /** 提货照片 file_id 数组驼峰简写 */ + fileIds?: number[]; + /** 提货照片(与 pickup_file_ids 等价的兼容字段名) */ + pickup_images?: PendingOrderB2bImageInput[]; }; export type PendingOrderPickupB2bResponse = { @@ -835,6 +845,8 @@ export type PendingOrderSetB2bPickupPlateParams = { ids: number[]; /** 提货车牌;空字符串或 null 表示清空 */ pickup_plate_number: string | null; + /** 车牌驼峰别名(与 pickup_plate_number 等价,后端兼容) */ + pickupPlateNumber?: string | null; }; export type PendingOrderSetB2bPickupPlateResponse = { @@ -875,7 +887,11 @@ export type PendingOrderUpdateB2bOrderImagesParams = { /** 订单ID:单订单作业,仅允许传 1 个(单值或单元素数组) */ ids: number[]; /** 备货照片列表(全量覆盖;支持 file_id 或 { file_id, display_order }) */ - images: PendingOrderB2bImageInput[]; + images?: PendingOrderB2bImageInput[]; + /** file_id 数组简写(与 images 等价,后端兼容;与 fileIds 二选一) */ + file_ids?: number[]; + /** file_id 数组驼峰简写(与 file_ids 等价) */ + fileIds?: number[]; }; export type PendingOrderUpdateB2bOrderImagesResponse = { @@ -983,6 +999,10 @@ export type PendingOrderB2bPackingItem = { box_no: string; /** 该商品在该箱的正整数数量 */ quantity: number; + /** 商品明细ID 驼峰别名(与 order_item_id 等价,后端兼容) */ + orderItemId?: number; + /** 箱号驼峰别名(与 box_no 等价) */ + boxNo?: string; }; export type PendingOrderUpdateB2bPackingItemsParams = { diff --git a/src/api/setting.warehouse/settingwarehouse.ts b/src/api/setting.warehouse/settingwarehouse.ts index ff5a64c4..c4c90a58 100644 --- a/src/api/setting.warehouse/settingwarehouse.ts +++ b/src/api/setting.warehouse/settingwarehouse.ts @@ -175,6 +175,12 @@ export type SettingWarehouseSubjectConfig = SettingWarehouseSenderConfig & { * 仅接受布尔/like-flag(true/1/'1'/'true' → true;false/0/'0'/'false' → false),非法值报 400 */ single_weigh_require_pack?: boolean + /** + * B2B 备货完成是否校验逐商品分箱齐套(flag,默认 false 关闭)。开启后分箱数量合计须等于订单商品 plan_qty, + * 且总箱数须等于箱号数;不符时备货完成接口返回 400(data.item_mismatches),事务回滚。 + * 仅接受布尔/like-flag(true/1/'1'/'true' → true;false/0/'0'/'false' → false),非法值报 400 + */ + b2b_packing_quantity_check?: boolean /** 拆包最大录制时长,单位:分钟,默认 5,min 1;超过上限时拆包提交的结束时间自动截断为开始时间+上限 */ return_unpack_max_record_minutes?: number max_wave_quantity?: number @@ -447,6 +453,14 @@ export function normalizeWarehouseSubjectConfig( weighRequirePack === '1' || weighRequirePack === 'true' + // B2B 备货完成是否校验逐商品分箱齐套(flag,默认 false 关闭;同一套 like-flag 口径) + const b2bPackingCheck = base.b2b_packing_quantity_check + base.b2b_packing_quantity_check = + b2bPackingCheck === true || + b2bPackingCheck === 1 || + b2bPackingCheck === '1' || + b2bPackingCheck === 'true' + // 默认库位(库位ID,未配置时为 null) const locIdRaw = base.default_location_id if (locIdRaw === undefined || locIdRaw === null || locIdRaw === '') { diff --git a/src/views/store/shipperSigning/index.vue b/src/views/store/shipperSigning/index.vue index c059bcb9..8d809927 100644 --- a/src/views/store/shipperSigning/index.vue +++ b/src/views/store/shipperSigning/index.vue @@ -51,6 +51,7 @@ :table-size="tableSize" :loading="loading" :pagination="pagination" + :page-sizes="[10, 20, 50, 100, 200]" :show-index="true" :show-selection="true" :show-actions="true" @@ -67,6 +68,11 @@ {{ row.remask || row.counterparty_name }} ({{ row.counterparty_name }}) +