13 Commits

Author SHA1 Message Date
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