feat(waybill): 运单导出新增 where.ids 入参,支持按勾选运单ID导出快递号

This commit is contained in:
liufumingren 2026-08-16 15:53:10 +08:00
parent e72274f222
commit 2e417f1c27
3 changed files with 35 additions and 2 deletions

View File

@ -673,7 +673,7 @@ class WaybillService extends MainService {
* 复用 list 的筛选逻辑,分批查询,支持进度回调。
*
* @param {Object} options 导出参数。
* @param {Object} [options.where={}] 筛选条件(同 list)。
* @param {Object} [options.where={}] 筛选条件(同 list,另支持 ids:运单ID数组,精确过滤)。
* @param {Object} [options.sort={}] 排序参数(同 list)。
* @param {string[]} [options.exportFields] 需要导出的字段列表,不传则导出全部字段。
* @param {Function} [options.onProgress] 进度回调,接收 `{ status, progress, currentCount, totalCount, message, result }`。
@ -711,6 +711,17 @@ class WaybillService extends MainService {
// 构建查询条件(同 list)
const queryWhere = { warehouse_id: warehouseId };
// 指定运单ID列表(勾选导出,按 wms_order_express.id 精确过滤)
const idsExport = val(where.ids);
if (Array.isArray(idsExport) && idsExport.length > 0) {
const idList = idsExport
.map(id => Number(id))
.filter(id => Number.isFinite(id) && id > 0);
if (idList.length > 0) {
queryWhere.id = { [Op.in]: idList };
}
}
// 主单号查询
const mainWaybillCodeExport = val(where.mainWaybillCode);
if (mainWaybillCodeExport && String(mainWaybillCodeExport).trim()) {

View File

@ -1,4 +1,19 @@
[
{
"version": "2026.08.16-waybill-export-ids",
"date": "2026-08-16",
"type": "enhanced",
"summary": "waybill.warehouse.export 新增 where.ids 入参:支持按运单ID列表(勾选)导出快递号,与仓库隔离条件叠加过滤",
"methods": [
"waybill.warehouse.export"
],
"notes": [
"app/service/systems/waybill.js export:新增 where.ids 处理,数组值经 Number 转换并过滤非法值后生成 id IN (...) 条件,与 warehouse_id 隔离条件叠加,不影响其他筛选字段",
"入口层 systemMethods/waybill/warehouse.js export 原样透传 where,无需改动",
"同步更新 methods/system.json 中 waybill.warehouse.export 的 where.ids 参数文档"
],
"module": "waybill.warehouse"
},
{
"version": "2026.08.15-packing-setEndTime-cap",
"date": "2026-08-15",

View File

@ -31611,7 +31611,7 @@
"type": "object",
"required": false,
"source": "body",
"description": "筛选条件对象,同 waybill.warehouse.list 的 where 参数"
"description": "筛选条件对象,同 waybill.warehouse.list 的 where 参数,另支持 ids(运单ID数组,勾选导出)"
},
{
"name": "where.waybillCode",
@ -31627,6 +31627,13 @@
"source": "body.where",
"description": "主单号(精确匹配)"
},
{
"name": "where.ids",
"type": "array",
"required": false,
"source": "body.where",
"description": "运单ID列表(勾选导出,按 wms_order_express.id 精确过滤)"
},
{
"name": "where.orderId",
"type": "number",