feat(model): dispatch 表增加大屏面板计数索引 idx_dispatch_{wh}_panel_fulfillment(delivery_time+outbound_status)

This commit is contained in:
liufumingren 2026-10-13 00:25:16 +08:00
parent eb4ce994ba
commit b1ac685b84
2 changed files with 14 additions and 0 deletions

View File

@ -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' ],
},
];
}

View File

@ -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);