From 4f41e735a96a61f0ceca43366a9bfb750bb6b6d4 Mon Sep 17 00:00:00 2001 From: liufumingren Date: Wed, 5 Aug 2026 22:52:53 +0800 Subject: [PATCH] =?UTF-8?q?feat(pick):=20wavePickTaskDetail=20=E5=93=8D?= =?UTF-8?q?=E5=BA=94=20task=20=E5=AF=B9=E8=B1=A1=E6=96=B0=E5=A2=9E=20wave?= =?UTF-8?q?=5Fno=20=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 从 wms_wave_pick_task_wave JOIN wms_wave_batch 查询波次号,查询失败时降级为空字符串。同步更新 methods/system.json 文档与 changes 记录。 --- app/service/systems/pick.js | 24 +++ methods/changes/system.json | 32 ++++ methods/system.json | 317 +++++++++++++++++++++++++++++++++++- 3 files changed, 371 insertions(+), 2 deletions(-) diff --git a/app/service/systems/pick.js b/app/service/systems/pick.js index 3937e23..de8bc96 100644 --- a/app/service/systems/pick.js +++ b/app/service/systems/pick.js @@ -973,6 +973,29 @@ class PickSystemService extends Service { const warehouseId = Number(taskRow.warehouse_id || 0); const pickMode = Number(taskRow.pick_mode || 0); + + // 查询任务关联的波次号 + let taskWaveNo = ''; + try { + const taskWaveNoRows = await ctx.model.query(` + SELECT + wb.wave_no + FROM wms_wave_pick_task_wave ptw + INNER JOIN wms_wave_batch wb ON wb.wave_id = ptw.wave_id + WHERE ptw.task_id = :taskId + ORDER BY ptw.id ASC + LIMIT 1 + `, { + replacements: { taskId }, + type: ctx.model.QueryTypes.SELECT, + }); + taskWaveNo = Array.isArray(taskWaveNoRows) && taskWaveNoRows.length > 0 + ? String(taskWaveNoRows[0].wave_no || '').trim() + : ''; + } catch (error) { + ctx.logger.warn(`[pick.wavePickTaskDetail] 查询波次号失败,将降级为空: ${error.message}`); + } + const taskOrderColumnSet = await this.getTableColumnSet('wms_wave_pick_task_order'); const taskWaveColumnSet = await this.getTableColumnSet('wms_wave_pick_task_wave'); const boxColumnSet = await this.getTableColumnSet('wms_wave_pick_task_box'); @@ -1312,6 +1335,7 @@ class PickSystemService extends Service { task: { task_id: Number(taskRow.task_id || 0), task_no: String(taskRow.task_no || '').trim(), + wave_no: taskWaveNo, status: Number(taskRow.status || 0), pick_mode: pickMode, start_at: taskRow.start_at || null, diff --git a/methods/changes/system.json b/methods/changes/system.json index 44abf26..bc780e4 100644 --- a/methods/changes/system.json +++ b/methods/changes/system.json @@ -1,4 +1,24 @@ [ + { + "version": "2026.08.05-inbox-group", + "date": "2026-08-05", + "type": "added", + "summary": "站内信模块新增群管理接口:群列表拉取、群禁用/解禁、群信息修改(支持群类型/子类型/货主/快递接口/系统快递编码)、按群查询消息列表。仓库ID由服务端自动注入。express_interfaces输出为数组,systemExpressCode在express类型时必填校验。", + "methods": [ + "inbox.group.list", + "inbox.group.disable", + "inbox.group.update", + "inbox.group.messages" + ], + "notes": [ + "inbox.group.list:按群类型/关键词筛选,分页返回。express_interfaces 存储逗号分隔输出数组。", + "inbox.group.disable:通过群主键ID禁用/解禁(isBlocked=1禁用/0启用)。", + "inbox.group.update:支持修改groupType/subType/storeId/expressInterfaces/systemExpressCode。切换为express类型时systemExpressCode必填且需校验wms_express.code存在,expressInterfaces需校验wms_express_interface.id存在。非express类型忽略express相关字段。", + "inbox.group.messages:按groupId拉取消息列表,支持direction/keyword筛选,仓库隔离,查询命中idx_warehouse_group_created索引。", + "公共:所有方法warehouseId均从ctx.user.store_id自动注入,前端无需传递。" + ], + "module": "inbox" + }, { "version": "2026.08.01-system-01", "date": "2026-08-01", @@ -5299,5 +5319,17 @@ "新增store_ids限定货主ID" ], "module": "storeExpressBindingPolicy" + }, + { + "version": "2026-08-05-wavePickTaskDetail-waveNo", + "date": "2026-08-05", + "summary": "pick.wavePickTaskDetail 响应 task 对象新增 wave_no 字段,从 wms_wave_pick_task_wave 关联 wms_wave_batch 获取波次号", + "methods": [ + "pick.wavePickTaskDetail" + ], + "notes": [ + "task 对象新增 wave_no(string)字段,位于 task_no 之后;查询失败时降级为空字符串。", + "数据来源:wms_wave_pick_task_wave INNER JOIN wms_wave_batch ON wave_id。" + ] } ] diff --git a/methods/system.json b/methods/system.json index 679e87a..00db843 100644 --- a/methods/system.json +++ b/methods/system.json @@ -1,8 +1,8 @@ { "module": "system", "description": "系统接口标准入口,method 对应系统内置方法,全部使用 POST 请求,参数统一放在 body 内", - "version": "0.3.17", - "updatedAt": "2026-08-04", + "version": "0.3.18", + "updatedAt": "2026-08-05", "headers": [ { "name": "platform", @@ -17757,6 +17757,12 @@ "description": "任务编号", "required": false }, + { + "name": "wave_no", + "type": "string", + "description": "波次号,从 wms_wave_pick_task_wave 关联 wms_wave_batch 获取;无关联波次时为空字符串", + "required": false + }, { "name": "status", "type": "number", @@ -32452,6 +32458,313 @@ "message": "warehouseId 无效" } ] + }, + { + "method": "inbox.bindCode", + "description": "生成货主绑群码。传入货主ID和子类型,生成5分钟有效12位随机码存入缓存", + "isNeedAuth": true, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token(从中解析 warehouseId 仓库上下文)" + } + ], + "params": [ + { + "name": "storeId", + "type": "number", + "required": true, + "source": "body", + "description": "货主ID" + }, + { + "name": "subType", + "type": "string", + "required": false, + "source": "body", + "description": "群子类型编码:after_sales(售后) / finance(财务) / receiving(收货)" + } + ], + "response": [ + { + "name": "code", + "type": "string", + "required": true, + "description": "12位绑群随机码,5分钟有效" + } + ], + "errors": [ + { + "code": "400", + "message": "storeId 无效 / 缺少仓库信息" + }, + { + "code": "500", + "message": "货主在仓库无有效合约" + } + ] + }, + { + "method": "inbox.group.list", + "description": "拉取当前仓库的群列表,支持按群类型筛选和关键词搜索,express_interfaces 逗号分隔存储输出为数组", + "isNeedAuth": true, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token(从中解析 warehouseId 仓库上下文)" + } + ], + "params": [ + { + "name": "groupType", + "type": "string", + "required": false, + "source": "body", + "description": "群类型筛选:store(货主) / warehouse(仓库) / express(快递)" + }, + { + "name": "keyword", + "type": "string", + "required": false, + "source": "body", + "description": "群名称模糊搜索" + }, + { + "name": "page", + "type": "number", + "required": false, + "source": "body", + "description": "页码,默认1" + }, + { + "name": "pageSize", + "type": "number", + "required": false, + "source": "body", + "description": "每页条数,默认20,最大100" + } + ], + "response": [ + { + "name": "total", + "type": "number", + "required": true, + "description": "总记录数" + }, + { + "name": "list", + "type": "array", + "required": true, + "description": "群记录列表,含id/group_name/group_id/store_id/group_type/sub_type/is_blocked/express_interfaces(数组)/system_express_code/created_at" + } + ], + "errors": [ + { + "code": "400", + "message": "warehouseId 无效" + } + ] + }, + { + "method": "inbox.group.disable", + "description": "禁用或解禁群,通过群主键ID操作", + "isNeedAuth": true, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token(从中解析 warehouseId 仓库上下文)" + } + ], + "params": [ + { + "name": "id", + "type": "number", + "required": true, + "source": "body", + "description": "群记录主键ID" + }, + { + "name": "isBlocked", + "type": "number", + "required": false, + "source": "body", + "description": "是否禁用:1=禁用 0=启用,默认1" + } + ], + "response": [ + { + "name": "message", + "type": "string", + "required": true, + "description": "操作结果提示:群已禁用 / 群已启用" + } + ], + "errors": [ + { + "code": "400", + "message": "群ID无效 / warehouseId 无效" + }, + { + "code": "500", + "message": "群不存在或无权限操作" + } + ] + }, + { + "method": "inbox.group.update", + "description": "修改群信息:群类型/子类型/货主/快递接口/系统快递编码。切换为express类型时systemExpressCode必填,expressInterfaces仅express类型生效", + "isNeedAuth": true, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token(从中解析 warehouseId 仓库上下文)" + } + ], + "params": [ + { + "name": "id", + "type": "number", + "required": true, + "source": "body", + "description": "群记录主键ID" + }, + { + "name": "groupType", + "type": "string", + "required": false, + "source": "body", + "description": "群类型:store(货主) / warehouse(仓库) / express(快递)" + }, + { + "name": "subType", + "type": "string", + "required": false, + "source": "body", + "description": "群子类型:after_sales(售后) / finance(财务) / receiving(收货)" + }, + { + "name": "storeId", + "type": "number", + "required": false, + "source": "body", + "description": "关联货主ID" + }, + { + "name": "expressInterfaces", + "type": "array", + "required": false, + "source": "body", + "description": "快递接口ID数组,仅groupType=express时生效。空数组表示全部快递类型。需校验wms_express_interface.id存在" + }, + { + "name": "systemExpressCode", + "type": "string", + "required": false, + "source": "body", + "description": "系统快递编码,groupType=express时必填。需校验wms_express.code存在" + } + ], + "response": [ + { + "name": "message", + "type": "string", + "required": true, + "description": "操作结果提示:群信息修改成功" + } + ], + "errors": [ + { + "code": "400", + "message": "群ID无效 / 系统快递编码不能为空(express类型时)" + }, + { + "code": "500", + "message": "群不存在 / 系统快递编码不存在 / 快递接口ID无效" + } + ] + }, + { + "method": "inbox.group.messages", + "description": "按群拉取消息列表,支持方向/关键词筛选,分页返回。warehouseId服务端自动注入,查询命中idx_warehouse_group_created索引", + "isNeedAuth": true, + "isNeedLogin": true, + "headers": [ + { + "name": "Authorization", + "type": "string", + "required": true, + "description": "Bearer token(从中解析 warehouseId 仓库上下文)" + } + ], + "params": [ + { + "name": "groupId", + "type": "string", + "required": true, + "source": "body", + "description": "群ID(必填)" + }, + { + "name": "direction", + "type": "string", + "required": false, + "source": "body", + "description": "消息方向筛选:inbound(入站) / outbound(出站)" + }, + { + "name": "keyword", + "type": "string", + "required": false, + "source": "body", + "description": "关键词搜索(ext_id / content)" + }, + { + "name": "page", + "type": "number", + "required": false, + "source": "body", + "description": "页码,默认1" + }, + { + "name": "pageSize", + "type": "number", + "required": false, + "source": "body", + "description": "每页条数,默认20,最大200" + } + ], + "response": [ + { + "name": "list", + "type": "array", + "required": true, + "description": "消息记录列表" + }, + { + "name": "pagination", + "type": "object", + "required": true, + "description": "分页信息:page/pageSize/total/totalPages/hasPrevious/hasNext" + } + ], + "errors": [ + { + "code": "400", + "message": "groupId 不能为空 / warehouseId 无效" + } + ] } ] },