diff --git a/app/model/order_wave_index.js b/app/model/order_wave_index.js new file mode 100644 index 0000000..c1ba3c1 --- /dev/null +++ b/app/model/order_wave_index.js @@ -0,0 +1,63 @@ +'use strict'; + +/** + * 订单波次顺序定位副表模型。 + * 表结构:database/migrations/20260513113000-create-wms_order_wave_index.js + * @param {import('egg').Application} app Egg 应用实例。 + * @return {import('sequelize').ModelCtor} Sequelize 模型。 + */ +module.exports = app => { + const { BIGINT, INTEGER, DATE } = app.Sequelize; + + const OrderWaveIndex = app.model.define('wms_order_wave_index', { + id: { + type: BIGINT(20).UNSIGNED, + primaryKey: true, + autoIncrement: true, + allowNull: false, + comment: '主键ID', + }, + warehouse_id: { + type: BIGINT(20).UNSIGNED, + allowNull: false, + defaultValue: 0, + comment: '仓库ID', + }, + order_id: { + type: BIGINT(20).UNSIGNED, + allowNull: false, + defaultValue: 0, + comment: '订单ID', + }, + wave_id: { + type: BIGINT(20).UNSIGNED, + allowNull: false, + defaultValue: 0, + comment: '波次ID', + }, + wave_index: { + type: INTEGER(10).UNSIGNED, + allowNull: false, + defaultValue: 0, + comment: '订单在波次中的全局顺序', + }, + platforms_index: { + type: INTEGER(10).UNSIGNED, + allowNull: false, + defaultValue: 0, + comment: '订单在平台分组内顺序', + }, + create_at: { + type: DATE, + allowNull: false, + comment: '创建时间', + }, + }, { + tableName: 'wms_order_wave_index', + timestamps: false, + underscored: true, + comment: '订单波次顺序定位副表', + }); + + return OrderWaveIndex; +}; diff --git a/app/service/systemMethods/order/base.js b/app/service/systemMethods/order/base.js index 64dbe36..076dbce 100644 --- a/app/service/systemMethods/order/base.js +++ b/app/service/systemMethods/order/base.js @@ -938,6 +938,70 @@ class OrderBaseService extends MainService { }); } + /** + * 批量补齐订单列表的波次内序号(wms_order_wave_index.wave_index)。 + * 表无记录或查询异常时降级为 0,不影响列表主流程。 + * @param {Object[]} list 订单列表,每项需含 id(订单ID)。 + * @return {Promise} 补齐 wave_index 后的列表。 + */ + async attachOrderWaveIndex(list = []) { + if (!Array.isArray(list) || list.length === 0) { + return Array.isArray(list) ? list : []; + } + + const orderIds = Array.from(new Set( + list + .map(item => Number(item && item.id)) + .filter(value => Number.isFinite(value) && value > 0) + )); + + if (orderIds.length === 0) { + return list.map(item => ({ ...item, wave_index: 0 })); + } + + const warehouseId = this.getWarehouseId(); + const { ctx } = this; + const waveIndexMap = new Map(); + + if (warehouseId !== null && warehouseId !== undefined && warehouseId !== '' + && ctx.model && typeof ctx.model.query === 'function') { + try { + const rows = await ctx.model.query(` + SELECT order_id, wave_index + FROM wms_order_wave_index + WHERE warehouse_id = :warehouseId + AND order_id IN (:orderIds) + `, { + replacements: { warehouseId, orderIds }, + type: ctx.model.QueryTypes && ctx.model.QueryTypes.SELECT, + }); + + for (const row of (Array.isArray(rows) ? rows : [])) { + const orderId = Number(row && row.order_id || 0); + if (orderId > 0) { + waveIndexMap.set(orderId, Number(row && row.wave_index || 0)); + } + } + } catch (error) { + ctx.logger && ctx.logger.warn && ctx.logger.warn('[order.base.attachOrderWaveIndex] 查询波次序号失败,已降级为 0', { + warehouseId, + orderCount: orderIds.length, + error: error && error.message ? error.message : `${error}`, + }); + } + } + + return list.map(item => { + const orderId = Number(item && item.id); + return { + ...item, + wave_index: Number.isFinite(orderId) && orderId > 0 && waveIndexMap.has(orderId) + ? waveIndexMap.get(orderId) + : 0, + }; + }); + } + /** * 提取订单列表中的运单号虚拟筛选条件。 * @param {Object} whereInput 标准化后的 where 条件。 @@ -1028,6 +1092,106 @@ class OrderBaseService extends MainService { return { where: normalizedWhere, stockQuery }; } + /** + * 提取 wave_index(波次内序号)虚拟筛选条件。 + * 序号存储在 wms_order_wave_index 副表,需先查副表得到订单 ID 集合再注入主查询。 + * 支持 eq / in / gt / lt / ge / le / between / notbetween 等操作符, + * 其中 between 要求 value 为长度为 2 的数组(如 [1, 50])。 + * @param {Object} whereInput 标准化后的 where 条件。 + * @return {{ where: Object, waveIndexCondition: Object|null }} 清洗后的 where 与序号筛选条件。 + */ + extractWaveIndexVirtualFilter(whereInput = {}) { + const normalizedWhere = this.isPlainObject(whereInput) + ? { ...whereInput } + : {}; + const waveIndexCondition = normalizedWhere.wave_index ?? normalizedWhere.waveIndex; + + delete normalizedWhere.wave_index; + delete normalizedWhere.waveIndex; + + // 条件为空时忽略 + if (waveIndexCondition === undefined || waveIndexCondition === null || waveIndexCondition === '') { + return { where: normalizedWhere, waveIndexCondition: null }; + } + + if (this.isPlainObject(waveIndexCondition) + && (waveIndexCondition.value === undefined || waveIndexCondition.value === null || waveIndexCondition.value === '')) { + return { where: normalizedWhere, waveIndexCondition: null }; + } + + // 兼容简写:wave_index 直接传数值时按 eq 处理 + const normalizedCondition = this.isPlainObject(waveIndexCondition) + ? { ...waveIndexCondition } + : { operator: 'eq', value: waveIndexCondition }; + + return { where: normalizedWhere, waveIndexCondition: normalizedCondition }; + } + + /** + * 根据 wave_index 筛选条件查询 wms_order_wave_index 命中的订单ID。 + * @param {Object} waveIndexCondition 序号筛选条件(含 operator/value)。 + * @param {number|string} warehouseId 仓库ID。 + * @return {Promise} 命中的订单ID列表。 + */ + async findOrderIdsByWaveIndexCondition(waveIndexCondition = null, warehouseId = this.getWarehouseId()) { + const contextWarehouseId = this.getWarehouseId(); + + if (contextWarehouseId === null || contextWarehouseId === undefined || contextWarehouseId === '') { + throw new Error('缺少当前用户仓库上下文 store_id'); + } + + if (warehouseId !== null && warehouseId !== undefined && warehouseId !== '' + && String(warehouseId) !== String(contextWarehouseId)) { + throw new Error('订单工作台仓库ID必须来自当前用户上下文 store_id,禁止传入外部仓库ID。'); + } + + if (!waveIndexCondition || !this.isPlainObject(waveIndexCondition)) { + return []; + } + + const orderWaveIndexModel = this.ctx.model && this.ctx.model.OrderWaveIndex; + if (!orderWaveIndexModel || typeof orderWaveIndexModel.findAll !== 'function') { + return []; + } + + const parsed = parseWhereConditions({ + where: { wave_index: waveIndexCondition }, + app: this.app, + }); + + if (!parsed.ok) { + throw new Error(`wave_index 参数解析失败: ${parsed.reason}`); + } + + const { Sequelize } = this.app; + const conditions = Array.isArray(parsed.result.dynamicConditions) + ? parsed.result.dynamicConditions + : []; + + if (conditions.length === 0) { + return []; + } + + const waveIndexWhere = conditions.length > 1 + ? { [Sequelize.Op.and]: conditions } + : conditions[0]; + + const rows = await orderWaveIndexModel.findAll({ + where: { + [Sequelize.Op.and]: [ + waveIndexWhere, + { warehouse_id: contextWarehouseId }, + ], + }, + attributes: [ 'order_id' ], + raw: true, + }); + + return Array.from(new Set((Array.isArray(rows) ? rows : []) + .map(row => Number(row && row.order_id)) + .filter(orderId => Number.isFinite(orderId) && orderId > 0))); + } + /** * 构建 buyer_message_has 虚拟字段的 Sequelize where 条件。 * 覆盖三个留言/备注字段:buyer_message、seller_message、remark。 @@ -1429,7 +1593,8 @@ class OrderBaseService extends MainService { const { where: sanitizedWhere, expressNumbers } = this.extractOrderListExpressVirtualFilter(where); const { where: whereAfterBuyerMessage, buyerMessageHas } = this.extractBuyerMessageHasVirtualFilter(sanitizedWhere); const { where: whereAfterStockQuery, stockQuery } = this.extractStockQueryVirtualFilter(whereAfterBuyerMessage); - const mergedWhere = this.mergeWhereObjects(this.getDefaultWhere(moduleName), whereAfterStockQuery); + const { where: whereAfterWaveIndex, waveIndexCondition } = this.extractWaveIndexVirtualFilter(whereAfterStockQuery); + const mergedWhere = this.mergeWhereObjects(this.getDefaultWhere(moduleName), whereAfterWaveIndex); let queryWhere = this.buildWhere(mergedWhere, contextWarehouseId, { specialFieldMap: { quickWhere: { @@ -1453,6 +1618,11 @@ class OrderBaseService extends MainService { queryWhere = this.appendOrderIdsFilterToWhere(queryWhere, stockOrderIds); } + if (waveIndexCondition) { + const waveIndexOrderIds = await this.findOrderIdsByWaveIndexCondition(waveIndexCondition, contextWarehouseId); + queryWhere = this.appendOrderIdsFilterToWhere(queryWhere, waveIndexOrderIds); + } + const model = await this.getOrderModel(moduleName, contextWarehouseId); const order = this.buildListOrder(requestData.sort, moduleName); const offset = (page - 1) * pageSize; @@ -1511,11 +1681,12 @@ class OrderBaseService extends MainService { })); const normalizedList = await this.attachOrderExpressNumbers(listWithRemark); + const listWithWaveIndex = await this.attachOrderWaveIndex(normalizedList); const totalPages = pageSize > 0 ? Math.ceil(total / pageSize) : 0; return { - list: normalizedList, + list: listWithWaveIndex, pagination: { page, pageSize, diff --git a/app/service/systemMethods/order/recheckOrder.js b/app/service/systemMethods/order/recheckOrder.js index c2a5d82..559c211 100644 --- a/app/service/systemMethods/order/recheckOrder.js +++ b/app/service/systemMethods/order/recheckOrder.js @@ -3323,6 +3323,65 @@ class RecheckOrderService extends OrderBaseService { replacements.pickStatus = pickStatus; } + // 波次内序号筛选(wms_order_wave_index.wave_index) + // 支持 wave_index: { operator: 'between', value: [起, 止] },以及 wave_index_min / wave_index_max + const rawWaveIndexCondition = this.isPlainObject(where.wave_index) ? where.wave_index : null; + if (rawWaveIndexCondition) { + const waveIndexOperator = String(rawWaveIndexCondition.operator || 'eq').toLowerCase(); + const rawWaveIndexValue = rawWaveIndexCondition.value; + if (waveIndexOperator === 'between' && Array.isArray(rawWaveIndexValue) && rawWaveIndexValue.length === 2) { + const betweenStart = Number(rawWaveIndexValue[0]); + const betweenEnd = Number(rawWaveIndexValue[1]); + if (Number.isFinite(betweenStart) && Number.isFinite(betweenEnd)) { + conditions.push('wi.wave_index BETWEEN :waveIndexBetweenStart AND :waveIndexBetweenEnd'); + replacements.waveIndexBetweenStart = betweenStart; + replacements.waveIndexBetweenEnd = betweenEnd; + } + } else if ((waveIndexOperator === 'gte' || waveIndexOperator === 'ge') + && rawWaveIndexValue !== undefined && rawWaveIndexValue !== null && rawWaveIndexValue !== '') { + const gteValue = Number(rawWaveIndexValue); + if (Number.isFinite(gteValue)) { + conditions.push('wi.wave_index >= :waveIndexGte'); + replacements.waveIndexGte = gteValue; + } + } else if ((waveIndexOperator === 'lte' || waveIndexOperator === 'le') + && rawWaveIndexValue !== undefined && rawWaveIndexValue !== null && rawWaveIndexValue !== '') { + const lteValue = Number(rawWaveIndexValue); + if (Number.isFinite(lteValue)) { + conditions.push('wi.wave_index <= :waveIndexLte'); + replacements.waveIndexLte = lteValue; + } + } else if (waveIndexOperator === 'eq' + && rawWaveIndexValue !== undefined && rawWaveIndexValue !== null && rawWaveIndexValue !== '') { + const eqValue = Number(rawWaveIndexValue); + if (Number.isFinite(eqValue)) { + conditions.push('wi.wave_index = :waveIndexEq'); + replacements.waveIndexEq = eqValue; + } + } + } else { + const rawWaveIndexMin = this.isPlainObject(where.wave_index_min) + ? where.wave_index_min.value + : where.wave_index_min; + if (rawWaveIndexMin !== undefined && rawWaveIndexMin !== null && rawWaveIndexMin !== '') { + const waveIndexMin = Number(rawWaveIndexMin); + if (Number.isFinite(waveIndexMin)) { + conditions.push('wi.wave_index >= :waveIndexMin'); + replacements.waveIndexMin = waveIndexMin; + } + } + const rawWaveIndexMax = this.isPlainObject(where.wave_index_max) + ? where.wave_index_max.value + : where.wave_index_max; + if (rawWaveIndexMax !== undefined && rawWaveIndexMax !== null && rawWaveIndexMax !== '') { + const waveIndexMax = Number(rawWaveIndexMax); + if (Number.isFinite(waveIndexMax)) { + conditions.push('wi.wave_index <= :waveIndexMax'); + replacements.waveIndexMax = waveIndexMax; + } + } + } + // stock_query 商品模糊筛选:通过 stock_warehouse / stock_barcodes → order_items → order_id const stockQuery = String(where.stock_query || '').trim(); if (stockQuery) { @@ -3350,6 +3409,11 @@ class RecheckOrderService extends OrderBaseService { ? `WHERE ${conditions.join('\n AND ')}` : ''; + const waveIndexJoin = ` + LEFT JOIN wms_order_wave_index wi + ON wi.warehouse_id = o.warehouse_id + AND wi.order_id = o.id`; + const listSql = ` SELECT o.id AS order_id, @@ -3369,8 +3433,9 @@ class RecheckOrderService extends OrderBaseService { o.status, o.create_at, o.recheck_time, + wi.wave_index, (SELECT oe.waybill_code FROM order_express oe WHERE oe.order_id = o.id AND oe.delete_at IS NULL LIMIT 1) AS waybill_code - FROM ${orderTableName} o + FROM ${orderTableName} o${waveIndexJoin} ${whereClause} ORDER BY o.id ASC LIMIT :limit OFFSET :offset @@ -3378,7 +3443,7 @@ class RecheckOrderService extends OrderBaseService { const countSql = ` SELECT COUNT(1) AS total - FROM ${orderTableName} o + FROM ${orderTableName} o${waveIndexJoin} ${whereClause} `; @@ -3413,6 +3478,7 @@ class RecheckOrderService extends OrderBaseService { items_weight: row?.items_weight != null ? Number(row.items_weight) : null, weight_type: this.formatWeightTypeLabel(row?.weight_type), waybill_code: String(row?.waybill_code || '').trim(), + wave_index: Number(row?.wave_index || 0), status: Number(row?.status || 0), create_at: row?.create_at || null, recheck_time: row?.recheck_time || null, diff --git a/app/service/systemMethods/order/wave.js b/app/service/systemMethods/order/wave.js index cb21d9c..4e87f47 100644 --- a/app/service/systemMethods/order/wave.js +++ b/app/service/systemMethods/order/wave.js @@ -3991,6 +3991,7 @@ class WaveService extends OrderBaseService { province: normalizedOrderRow.province ?? null, sys_platform_name: normalizedOrderRow.sys_platform_name ?? null, item_snapshot: String(itemSnapshot || ''), + wave_index: Number(normalizedOrderRow.wave_index || 0), excluded_reason: normalizedOrderRow.lock_status !== 'none' ? 'locked' : normalizedOrderRow.intercept_status !== 'none' @@ -4086,8 +4087,10 @@ class WaveService extends OrderBaseService { }), ]); - const normalizedList = await this.attachOrderExpressNumbers( - sourceList.map(item => this.normalizeOrderListItem(item)) + const normalizedList = await this.attachOrderWaveIndex( + await this.attachOrderExpressNumbers( + sourceList.map(item => this.normalizeOrderListItem(item)) + ) ); // 回填 item_snapshot diff --git a/app/service/systems/order_export.js b/app/service/systems/order_export.js index 4c66a92..6055795 100644 --- a/app/service/systems/order_export.js +++ b/app/service/systems/order_export.js @@ -28,6 +28,7 @@ const ORDER_EXPORT_COLUMNS = Object.freeze([ { header: '平台单号', key: 'external_order_code', width: 24 }, { header: '订单状态', key: 'status', width: 16 }, { header: '抓取波次号', key: 'wave_no', width: 18 }, + { header: '波次序号', key: 'wave_index', width: 12 }, { header: '货主', key: 'store_id', width: 20 }, { header: '平台', key: 'sys_platform_name', width: 16 }, { header: '店铺昵称', key: 'shop_nick', width: 20 }, @@ -74,6 +75,7 @@ const ORDER_EXPORT_ITEM_COLUMNS = Object.freeze([ { header: '外部单号', key: 'external_order_code', width: 24 }, { header: '订单状态', key: 'status', width: 16 }, { header: '波次号', key: 'wave_no', width: 18 }, + { header: '波次序号', key: 'wave_index', width: 12 }, { header: '货主', key: 'store_id', width: 20 }, { header: '平台', key: 'sys_platform_name', width: 16 }, { header: '店铺昵称', key: 'shop_nick', width: 20 }, @@ -402,6 +404,7 @@ class OrderExportService extends OrderBaseService { external_order_code: this.normalizeExportCellValue(externalOrderCode), status: translateStatus('status', safeOrderRow.status), wave_no: this.normalizeExportCellValue(safeOrderRow.wave_no), + wave_index: this.normalizeExportCellValue(safeOrderRow.wave_index ?? 0), store_id: this.normalizeExportCellValue(storeRemark || safeOrderRow.store_name || safeOrderRow.store_id), sys_platform_name: this.normalizeExportCellValue(safeOrderRow.sys_platform_name), shop_nick: this.normalizeExportCellValue(safeOrderRow.shop_nick), @@ -616,9 +619,10 @@ class OrderExportService extends OrderBaseService { }); const { where: sanitizedWhere, expressNumbers } = this.extractOrderListExpressVirtualFilter(where); const { where: whereAfterBuyerMessage, buyerMessageHas } = this.extractBuyerMessageHasVirtualFilter(sanitizedWhere); + const { where: whereAfterWaveIndex, waveIndexCondition } = this.extractWaveIndexVirtualFilter(whereAfterBuyerMessage); const mergedWhere = this.mergeWhereObjects( target.defaultWhereModuleName ? this.getDefaultWhere(target.defaultWhereModuleName) : {}, - whereAfterBuyerMessage + whereAfterWaveIndex ); let queryWhere = this.buildWhere(mergedWhere, warehouseId, { specialFieldMap: { @@ -638,6 +642,11 @@ class OrderExportService extends OrderBaseService { queryWhere = this.appendConditionToWhere(queryWhere, buyerMessageCondition); } + if (waveIndexCondition) { + const waveIndexOrderIds = await this.findOrderIdsByWaveIndexCondition(waveIndexCondition, warehouseId); + queryWhere = this.appendOrderIdsFilterToWhere(queryWhere, waveIndexOrderIds); + } + const orderModel = await this.getOrderModelByTableType(target.tableType, warehouseId); const pageSize = this.getExportPageSize(); const order = this.buildListOrder(requestData.sort, target.sortModuleName); @@ -683,8 +692,9 @@ class OrderExportService extends OrderBaseService { const normalizedRows = rows.map(row => this.normalizeOrderListItem(this.toPlainRow(row)) ); + const rowsWithWaveIndex = await this.attachOrderWaveIndex(normalizedRows); - const orderIds = normalizedRows.map(r => Number(r.id || 0)).filter(id => id > 0); + const orderIds = rowsWithWaveIndex.map(r => Number(r.id || 0)).filter(id => id > 0); // 批量查询商品明细(wms_order_items) const itemsMap = new Map(); @@ -759,7 +769,7 @@ class OrderExportService extends OrderBaseService { try { const storeIds = [ ...new Set( - normalizedRows + rowsWithWaveIndex .map(r => Number(r.store_id || 0)) .filter(id => id > 0) ), @@ -844,14 +854,14 @@ class OrderExportService extends OrderBaseService { const exportContext = { itemsMap, storeRemarkMap, stockNameMap, barcodeMap, imageUrlMap, expressMap, packageMaterialMap }; - for (const row of normalizedRows) { + for (const row of rowsWithWaveIndex) { const exportRows = this.mapOrderExportRow(row, exportContext, mode); for (const exportRow of exportRows) { worksheet.addRow(exportRow).commit(); } } - currentCount += normalizedRows.length; + currentCount += rowsWithWaveIndex.length; await progressHandler({ status: 'running', diff --git a/methods/changes/system.json b/methods/changes/system.json index 5c0f34b..92e3a32 100644 --- a/methods/changes/system.json +++ b/methods/changes/system.json @@ -1,4 +1,59 @@ [ + { + "version": "2026.08.19-order-list-wave-index-range-filter", + "date": "2026-08-19", + "type": "enhanced", + "summary": "订单列表 where 新增 wave_index 波次内序号范围查询入参:工作台订单列表(经 listByModule 的 9 个列表)与订单导出支持 wave_index 虚拟筛选(eq/in/gt/lt/ge/le/between/notbetween,between 要求 value 为长度 2 的数组);复核散单列表支持 wave_index between 与 wave_index_min/wave_index_max。", + "methods": [ + "order.list", + "order.reviewOrder.list", + "order.pendingOrder.list", + "order.outboundOrder.list", + "order.expectionOrder.list", + "order.entrustOrder.list", + "order.deliveryOrder.list", + "order.deliveryExpectionOrder.list", + "order.archiveOrder.list", + "order.recheckOrder.recheckOrderList", + "order.recheckOrder.queryRecheckOrderSingleList" + ], + "notes": [ + "新增 app/model/order_wave_index.js 模型(wms_order_wave_index,timestamps=false),供副表条件查询", + "app/service/systemMethods/order/base.js 新增 extractWaveIndexVirtualFilter(从 where 提取 wave_index/waveIndex,兼容数值简写按 eq 处理)与 findOrderIdsByWaveIndexCondition(用 parseWhereConditions 解析条件后查副表得 order_id 集合);listByModule 在 stock_query 之后接入,命中为空时主查询结果为空", + "app/service/systems/order_export.js exportOrders 同样接入 wave_index 虚拟筛选,与列表 where 语义一致", + "app/service/systemMethods/order/recheckOrder.js queryRecheckOrderSingleList 新增 wave_index 筛选(between/gte/lte/eq 或 wave_index_min/wave_index_max),countSql 同步 LEFT JOIN wms_order_wave_index 保持总数一致", + "同步更新 methods/system.json 中 order.list 与复核列表 where 参数说明" + ], + "module": "order" + }, + { + "version": "2026.08.19-order-list-wave-index-join", + "date": "2026-08-19", + "type": "enhanced", + "summary": "所有订单列表统一联查 wms_order_wave_index 并输出 wave_index(波次内序号,无记录时降级为 0):覆盖 9 个工作台订单列表(order.list / reviewOrder.list / pendingOrder.list / outboundOrder.list / expectionOrder.list / entrustOrder.list / deliveryOrder.list / deliveryExpectionOrder.list / archiveOrder.list)、复核散单列表与波次策略兜底列表;订单导出(waybill/item 两种模式)新增「波次序号」列。", + "methods": [ + "order.list", + "order.reviewOrder.list", + "order.pendingOrder.list", + "order.outboundOrder.list", + "order.expectionOrder.list", + "order.entrustOrder.list", + "order.deliveryOrder.list", + "order.deliveryExpectionOrder.list", + "order.archiveOrder.list", + "order.recheckOrder.recheckOrderList", + "order.recheckOrder.queryRecheckOrderSingleList", + "order.wave.waveStrategyFallbackOrderList" + ], + "notes": [ + "app/service/systemMethods/order/base.js 新增 attachOrderWaveIndex:按列表行 id 批量查询 wms_order_wave_index(warehouse_id + order_id,命中唯一索引),无记录或查询异常时降级为 0 并告警;listByModule 在 attachOrderExpressNumbers 之后接入,统一覆盖全部工作台订单列表", + "app/service/systemMethods/order/wave.js waveStrategyFallbackOrderList 接入 attachOrderWaveIndex,buildWaveStrategyFallbackOrderListItem 输出 wave_index(默认 0)", + "app/service/systemMethods/order/recheckOrder.js queryRecheckOrderSingleList 列表 SQL 增加 LEFT JOIN wms_order_wave_index(warehouse_id + order_id),响应行新增 wave_index;recheckOrderList 散单分支同源生效", + "app/service/systems/order_export.js exportOrders 接入 attachOrderWaveIndex,ORDER_EXPORT_COLUMNS / ORDER_EXPORT_ITEM_COLUMNS 在波次号后新增「波次序号」列,mapOrderExportRow commonFields 新增 wave_index", + "同步更新 methods/system.json 中上述接口的 response 字段说明" + ], + "module": "order" + }, { "version": "2026.08.19-recheckOrder.confirmIntercept-ids", "date": "2026-08-19", diff --git a/methods/system.json b/methods/system.json index f47531e..bc78520 100644 --- a/methods/system.json +++ b/methods/system.json @@ -1768,7 +1768,7 @@ "type": "object", "required": false, "source": "body", - "description": "统一 where 条件对象;推荐使用 { operator, value, type } 标准结构,历史简写会自动标准化;禁止传入 warehouse_id / warehouseId。支持虚拟字段:buyer_message_has(覆盖 buyer_message/seller_message/remark 三个字段,任一有值即为有留言,value=true/false),express_numbers / waybill_codes(运单号筛选)。" + "description": "统一 where 条件对象;推荐使用 { operator, value, type } 标准结构,历史简写会自动标准化;禁止传入 warehouse_id / warehouseId。支持虚拟字段:buyer_message_has(覆盖 buyer_message/seller_message/remark 三个字段,任一有值即为有留言,value=true/false),express_numbers / waybill_codes(运单号筛选),wave_index(波次内序号筛选,联查 wms_order_wave_index,支持 eq/in/gt/lt/ge/le/between/notbetween,between 要求 value 为长度 2 的数组,如 {\"wave_index\":{\"operator\":\"between\",\"value\":[1,50]}})。" }, { "name": "sort", @@ -1783,7 +1783,7 @@ "name": "list", "type": "array", "required": true, - "description": "订单列表(raw 行数据,字段字典见 docs/order-workbench-list-api.md 中的“订单列表 raw 字段字典”章节),本次新增 store_remark(货主备注)字段。" + "description": "订单列表(raw 行数据,字段字典见 docs/order-workbench-list-api.md 中的“订单列表 raw 字段字典”章节),本次新增 store_remark(货主备注)字段;wave_index(波次内序号,联查 wms_order_wave_index,无记录时为 0)。" }, { "name": "pagination", @@ -2669,7 +2669,7 @@ "name": "list", "type": "array", "required": true, - "description": "订单列表(raw 行数据,字段字典见 docs/order-workbench-list-api.md 中的“订单列表 raw 字段字典”章节),本次新增 store_remark(货主备注)字段。" + "description": "订单列表(raw 行数据,字段字典见 docs/order-workbench-list-api.md 中的“订单列表 raw 字段字典”章节),本次新增 store_remark(货主备注)字段;wave_index(波次内序号,联查 wms_order_wave_index,无记录时为 0)。" }, { "name": "pagination", @@ -2960,7 +2960,7 @@ "name": "list", "type": "array", "required": true, - "description": "订单列表(raw 行数据,字段字典见 docs/order-workbench-list-api.md 中的“订单列表 raw 字段字典”章节),本次新增 store_remark(货主备注)字段。lock_status 字段统一输出为 Y/N:none(含空值)→ 'N',其余值(如 warehouse/store)→ 'Y'。" + "description": "订单列表(raw 行数据,字段字典见 docs/order-workbench-list-api.md 中的“订单列表 raw 字段字典”章节),本次新增 store_remark(货主备注)字段;wave_index(波次内序号,联查 wms_order_wave_index,无记录时为 0)。lock_status 字段统一输出为 Y/N:none(含空值)→ 'N',其余值(如 warehouse/store)→ 'Y'。" }, { "name": "pagination", @@ -6223,7 +6223,7 @@ "type": "object", "required": false, "source": "body", - "description": "筛选条件。散单模式支持 keyword(运单号/订单号模糊搜索)、wave_no(精确匹配)、recheck_status、pick_status;团购模式支持 wave_no(模糊搜索)、wave_type、wave_status" + "description": "筛选条件。散单模式支持 keyword(运单号/订单号模糊搜索)、wave_no(精确匹配)、recheck_status、pick_status、wave_index(波次内序号范围筛选,如 {\"operator\":\"between\",\"value\":[起,止]},或 wave_index_min / wave_index_max);团购模式支持 wave_no(模糊搜索)、wave_type、wave_status" }, { "name": "pagination", @@ -6238,7 +6238,7 @@ "name": "list", "type": "array", "required": true, - "description": "散单模式(list_type=single):订单数组,每项含 order_id、delivery_order_code、order_type、wave_id、wave_no、pick_status、recheck_status、shop_nick、logistics_name、items_count、items_total、status、create_at、pick_time、recheck_time。团购模式(list_type=group):波次汇总数组,每项含 wave_id、wave_no、wave_type、wave_status、total_orders、processed_orders、creator、create_time、update_time、order_count、reviewed_count、unreviewed_count、review_assignment_status(unreviewed/partially_reviewed/reviewed)" + "description": "散单模式(list_type=single):订单数组,每项含 order_id、delivery_order_code、order_type、wave_id、wave_no、pick_status、recheck_status、shop_nick、logistics_name、items_count、items_total、wave_index、status、create_at、pick_time、recheck_time。团购模式(list_type=group):波次汇总数组,每项含 wave_id、wave_no、wave_type、wave_status、total_orders、processed_orders、creator、create_time、update_time、order_count、reviewed_count、unreviewed_count、review_assignment_status(unreviewed/partially_reviewed/reviewed)" }, { "name": "pagination", @@ -6729,7 +6729,7 @@ "type": "object", "required": false, "source": "body", - "description": "筛选条件。支持 keyword(运单号/订单号模糊搜索)、wave_no(精确匹配)、recheck_status、pick_status" + "description": "筛选条件。支持 keyword(运单号/订单号模糊搜索)、wave_no(精确匹配)、recheck_status、pick_status、wave_index(波次内序号范围筛选,如 {\"operator\":\"between\",\"value\":[起,止]},或 wave_index_min / wave_index_max)" }, { "name": "pagination", @@ -6744,7 +6744,7 @@ "name": "list", "type": "array", "required": true, - "description": "散单复核订单列表,每项含 order_id、delivery_order_code、order_type、wave_id、wave_no、pick_status、recheck_status、shop_nick、logistics_name、items_count、items_total、items_weight、weight_type、waybill_code、status、create_at、recheck_time" + "description": "散单复核订单列表,每项含 order_id、delivery_order_code、order_type、wave_id、wave_no、pick_status、recheck_status、shop_nick、logistics_name、items_count、items_total、items_weight、weight_type、waybill_code、wave_index、status、create_at、recheck_time" }, { "name": "pagination", @@ -8517,6 +8517,11 @@ "type": "string", "description": "商品快照,格式示例:苹果*2|香蕉*3" }, + { + "name": "wave_index", + "type": "number", + "description": "波次内序号(联查 wms_order_wave_index,无记录时为 0)" + }, { "name": "excluded_reason", "type": "string", @@ -10385,7 +10390,7 @@ "name": "list", "type": "array", "required": true, - "description": "订单列表(raw 行数据,字段字典见 docs/order-workbench-list-api.md 中的“订单列表 raw 字段字典”章节)" + "description": "订单列表(raw 行数据,字段字典见 docs/order-workbench-list-api.md 中的“订单列表 raw 字段字典”章节);本次新增 wave_index(波次内序号,联查 wms_order_wave_index,无记录时为 0)。" }, { "name": "pagination", @@ -10633,7 +10638,7 @@ "name": "list", "type": "array", "required": true, - "description": "订单列表(raw 行数据,字段字典见 docs/order-workbench-list-api.md 中的“订单列表 raw 字段字典”章节),本次新增 store_remark(货主备注)字段。" + "description": "订单列表(raw 行数据,字段字典见 docs/order-workbench-list-api.md 中的“订单列表 raw 字段字典”章节),本次新增 store_remark(货主备注)字段;wave_index(波次内序号,联查 wms_order_wave_index,无记录时为 0)。" }, { "name": "pagination", @@ -10818,7 +10823,7 @@ "name": "list", "type": "array", "required": true, - "description": "订单列表(raw 行数据,字段字典见 docs/order-workbench-list-api.md 中的“订单列表 raw 字段字典”章节),本次新增 store_remark(货主备注)字段。" + "description": "订单列表(raw 行数据,字段字典见 docs/order-workbench-list-api.md 中的“订单列表 raw 字段字典”章节),本次新增 store_remark(货主备注)字段;wave_index(波次内序号,联查 wms_order_wave_index,无记录时为 0)。" }, { "name": "pagination", @@ -10956,7 +10961,7 @@ "name": "list", "type": "array", "required": true, - "description": "订单列表(raw 行数据,字段字典见 docs/order-workbench-list-api.md 中的“订单列表 raw 字段字典”章节),本次新增 store_remark(货主备注)字段。" + "description": "订单列表(raw 行数据,字段字典见 docs/order-workbench-list-api.md 中的“订单列表 raw 字段字典”章节),本次新增 store_remark(货主备注)字段;wave_index(波次内序号,联查 wms_order_wave_index,无记录时为 0)。" }, { "name": "pagination", @@ -11350,7 +11355,7 @@ "name": "list", "type": "array", "required": true, - "description": "订单列表(raw 行数据,字段字典见 docs/order-workbench-list-api.md 中的“订单列表 raw 字段字典”章节),本次新增 store_remark(货主备注)字段。" + "description": "订单列表(raw 行数据,字段字典见 docs/order-workbench-list-api.md 中的“订单列表 raw 字段字典”章节),本次新增 store_remark(货主备注)字段;wave_index(波次内序号,联查 wms_order_wave_index,无记录时为 0)。" }, { "name": "pagination", @@ -11494,7 +11499,7 @@ "name": "list", "type": "array", "required": true, - "description": "订单列表(raw 行数据,字段字典见 docs/order-workbench-list-api.md 中的“订单列表 raw 字段字典”章节),本次新增 store_remark(货主备注)字段。" + "description": "订单列表(raw 行数据,字段字典见 docs/order-workbench-list-api.md 中的“订单列表 raw 字段字典”章节),本次新增 store_remark(货主备注)字段;wave_index(波次内序号,联查 wms_order_wave_index,无记录时为 0)。" }, { "name": "pagination",