diff --git a/app/model/order_delivery_table_schema.js b/app/model/order_delivery_table_schema.js index 0de44c4..01fd489 100644 --- a/app/model/order_delivery_table_schema.js +++ b/app/model/order_delivery_table_schema.js @@ -610,6 +610,15 @@ function buildIndexOptions(warehouseId, type) { dispatchLaneIndex, ...inheritedIndexes, ...buildListSortIndexes(warehouseId, modelType), + // 大屏面板计数索引:面板 count 不携带 warehouse_id 条件(分表名已隐含仓库), + // 列表排序索引的前缀 warehouse_id+dispatch_lane 无法使用;且全表 dispatch_lane + // 仅有 m4 一个值,无选择性。以 delivery_time 作为前导列做范围裁剪(一个业务日 + // 窗口约 1.6 万行 vs 全表 106 万行),outbound_status 作为第二列由 ICP 在索引 + // 内过滤(所有阶段卡片均带 outbound_status='fin')。 + { + name: `idx_dispatch_${warehouseId}_panel_fulfillment`, + fields: [ 'delivery_time', 'outbound_status' ], + }, ]; } diff --git a/test/app/model/order_delivery_dispatch_factory.test.js b/test/app/model/order_delivery_dispatch_factory.test.js index 6913d75..490f812 100644 --- a/test/app/model/order_delivery_dispatch_factory.test.js +++ b/test/app/model/order_delivery_dispatch_factory.test.js @@ -186,6 +186,7 @@ describe('test/app/model/order_delivery_dispatch_factory.test.js dispatch 模式 ...baseIndexes.slice(3).filter(line => !/_list_updated_at|_list_delivery_time/.test(line)), 'KEY `idx_dispatch_100000_list_updated_at` (`warehouse_id`,`dispatch_lane`,`updated_at`,`id`)', 'KEY `idx_dispatch_100000_list_delivery_time` (`warehouse_id`,`dispatch_lane`,`delivery_time`,`id`)', + 'KEY `idx_dispatch_100000_panel_fulfillment` (`delivery_time`,`outbound_status`)', ]; const expectedDispatchIndexOptions = [ baseIndexOptions[0], @@ -204,6 +205,10 @@ describe('test/app/model/order_delivery_dispatch_factory.test.js dispatch 模式 name: 'idx_dispatch_100000_list_delivery_time', fields: [ 'warehouse_id', 'dispatch_lane', 'delivery_time', 'id' ], }, + { + name: 'idx_dispatch_100000_panel_fulfillment', + fields: [ 'delivery_time', 'outbound_status' ], + }, ]; assert.equal(baseColumns.length, Object.keys(orderDeliveryModel.rawAttributes).length);