liufumingren
|
b7feed7e76
|
perf(order): 补复核时间统计索引,消除大屏复核数全表扫描
大屏「今日复核数」(warehouse_panel.queryFulfillment)固定按 recheck_time 区间 + status 过滤 + dispatch_lane IN ('m4','m5') 做 count,而 dispatch 分表上 recheck_time 无任何索引:EXPLAIN 为 type=ALL / rows=1,400,782,生产 7 天出现 138 次、平均 35.8s(同形状的 delivery_time 版本命中 idx_dispatch_1000028_panel_fulfillment 走 range,可直接对比)。
索引形态:current/outsourced 为 (recheck_time,status);dispatch 为 (recheck_time,status,dispatch_lane),比 current 版本多带 dispatch_lane 以便 count(*) 完全走索引不回表,并由 isPanelRecheckIndexName 保证 dispatch 不继承 current 版本。历史表不参与大屏统计,不建该索引。
依据:抽样 20 万行 recheck_time 非空 97.9%、status<>cancel 98.8%,时间窗口是唯一有效过滤条件。索引仍由模型定义在分表首次访问时懒创建。
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
2026-11-17 01:47:26 +08:00 |
|
liufumingren
|
4f8f453c36
|
perf(order): 订单分表补报表时间窗与归档时间索引
1. 发货单分表(current/dispatch/outsourced)补 (create_at,status,delete_at) 索引:工作台热销商品排行等报表固定按 create_at 区间 + status/delete_at 过滤订单再关联明细汇总,缺索引时优化器只能全扫明细表并逐行回表核对窗口,生产 wms_order_delivery_1000028_dispatch(140 万行/4.4GB)实测单次 38.9s。历史表按 archive_time 检索,沿用已有 idx_{warehouseId}_history_archive_time,不补建该索引。
2. 订单明细历史分表补 archive_time 索引:history 分表独有归档时间列,原先只有 created_at 索引,按归档时间检索会全表扫描。
3. 同步更新分表工厂索引用例:改为按集合断言(前 3 位继承 / create_at 同名继承 / 不继承 current 版列表索引 / history 仅 archive_time),修正此前因 logistics_code 与 is_b2b 列表索引新增而过期的期望值。
索引由模型定义在分表首次访问时懒创建(不改动存量表结构),按低峰发布。
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
2026-11-17 01:45:11 +08:00 |
|
liufumingren
|
b1ac685b84
|
feat(model): dispatch 表增加大屏面板计数索引 idx_dispatch_{wh}_panel_fulfillment(delivery_time+outbound_status)
|
2026-10-13 00:25:16 +08:00 |
|
liufumingren
|
a667f1401e
|
feat(inbox): 推送失败自动重发改为仓库级开关与重发时间范围(默认关闭)
仓库设置新增嵌套配置 `subject_config.inbox_push_retry = { enabled, window_minutes }`,
结构与「收货未入库提醒」(receiving_pending_inbound_notice)保持一致:
- `enabled`:默认 false —— 未配置、配置缺失或无法读取时一律**关闭**,需在仓库设置中显式开启
- `window_minutes`:重发时间范围,单位**分钟**,1-1440,默认 30(仅开关开启时生效)
改动:
- app/model/store.js:新增 DEFAULT_INBOX_PUSH_RETRY 与 normalizeInboxPushRetry(非法结构/非法 JSON
回退默认;enabled 非布尔值、window_minutes 越界抛「subject_config.inbox_push_retry.window_minutes
必须是 1-1440 的整数(分钟)」),由 normalizeSubjectConfig 统一调用
- app/service/systems/setting/warehouse.js:WAREHOUSE_SETTING_FIELDS 新增 key=inbox_push_retry
(type=object + item_keys=[enabled, window_minutes]),供仓库设置页经 getFieldMeta 动态渲染
- app/service/inbox/message.js:retryFailedByWarehouse 逐仓读仓库设置(缺省关闭、按仓库配置的窗口
调用 retryFailed);retryFailed 新增 warehouseId 过滤;readPushRetryConfig 读嵌套结构并兜底
enabled=false / 30 分钟
- app/schedule/retry_inbox_push.js:注释同步为「仅处理显式开启的仓库、缺省 30 分钟」
- config/config.default.js:兜底失败时间窗 2 小时 → 30 分钟;pushRetryEnabled 保留为全局应急总闸
(默认 true,关闭后所有仓库都不重发)
单测:test/inbox/retry_inbox_push.test.js + test/app/model/store.test.js 共 40 passing,覆盖默认关闭、
非法结构回退、flag 真值归一化、窗口 1-1440 越界、仓库开关与自定义窗口、复用原记录等场景。
|
2026-09-16 15:04:25 +08:00 |
|
liufumingren
|
a59793daf2
|
perf(order): 订单分表补列表排序索引,修复配送列表 2 秒慢查询
原因:生产 wms_order_delivery_1000028_dispatch(59.4 万行 / data 1.13GB)没有任何
索引覆盖列表接口的固定形态
WHERE warehouse_id = ? [AND dispatch_lane = ?] ORDER BY updated_at DESC, id DESC LIMIT 20
导致主查询全表扫 + filesort(实测 1.9s);与之并行执行的同条件 COUNT(*) 因
dispatch_lane 不在索引中需逐行回表(实测 1.5s),单请求合计约 2 秒。
新增 order_delivery_table_schema.buildListSortIndexes():
- current / history / outsourced:(warehouse_id, updated_at, id) 与 (warehouse_id, delivery_time, id)
(updated_at 为前端实际排序字段,delivery_time 为 deliveryOrder 模块默认排序字段)
- dispatch:把恒定条件列 dispatch_lane 放进前缀
(warehouse_id, dispatch_lane, updated_at, id) 与 (warehouse_id, dispatch_lane, delivery_time, id);
缺少该列时 COUNT(*) 仍会退回回表(实测 1.2s),且 dispatch 分支会剔除从 current
继承来的同名后缀索引,避免同一张表维护两份功能重叠的索引
- 索引统一追加在索引数组末尾,保持既有索引下标顺序不变
验证(开发库,同一张 59.4 万行同规模表 + 应用日志中的真实 SQL):
- 主查询 1511ms(Using filesort)→ 1.0ms(Backward index scan)
- COUNT(*) 1217ms(Using where 回表)→ 197ms(Using index)
生产建议低峰期先手工建同名索引,避免部署后首个请求在建索引期间阻塞。
|
2026-09-15 16:03:29 +08:00 |
|
liufumingren
|
c5150bc35b
|
feat: 配送表新增 dispath_time 迁移时间字段
- 新增迁移 20260907120000:为全部配送分表 wms_order_delivery_{wh}_dispatch 幂等新增 dispath_time(datetime, nullable),不触基表/当前分表/history/outsourced
- 配送表模型 schema dispatch 分支同步新增 dispath_time,drift 同步保持一致
- 订单迁移链路 buildDispatchRow 写入 dispath_time=new Date() 记录进入配送表时间
|
2026-09-07 16:43:35 +08:00 |
|
liufumingren
|
66ea0c4c36
|
feat(storeWarehouse): 新增开始自动分配时间 allocate_start_time,支持跨天自动分配窗口,截单时间下限放开到 00:00,开始时间等于截单时间时保存拒绝
|
2026-09-03 17:00:46 +08:00 |
|
liufumingren
|
7854057244
|
chore: ESLint auto-fix formatting (JSDoc, spacing, quotes, line endings)
|
2026-07-04 23:30:32 +08:00 |
|
liufumingren
|
77435aeb79
|
1
|
2026-06-23 18:48:33 +08:00 |
|
liufumingren
|
150e2977d4
|
修改快递接口配置,拼多多取号,未完成
|
2026-05-22 08:39:07 +08:00 |
|
liufumingren
|
9845a239e2
|
1
|
2026-05-16 02:44:53 +08:00 |
|
liufumingren
|
736ad34351
|
打印台管理变更
|
2026-05-14 15:57:51 +08:00 |
|
liufumingren
|
61c530c0cc
|
1
|
2026-05-14 04:00:07 +08:00 |
|
liufumingren
|
d711ba9c21
|
0506更新
Co-authored-by: Copilot <copilot@github.com>
|
2026-05-06 17:53:54 +08:00 |
|
liufumingren
|
0ffe290a21
|
chore: commit all current workspace changes
|
2026-04-27 16:09:26 +08:00 |
|
liufumingren
|
622869787a
|
feat: sync workspace changes
|
2026-04-17 19:21:57 +08:00 |
|