Skip to content

feat(core): v0.5 P2 performance review generation and auto scoring - #62

Merged
marchtian merged 1 commit into
mainfrom
claude/project-thread-q1rpdg
Oct 24, 2026
Merged

marchtian merged 1 commit into
mainfrom
claude/project-thread-q1rpdg

Conversation

@marchtian

@marchtian marchtian commented Oct 24, 2026 •

Copy link
Copy Markdown
Collaborator

Requested by 田騏 · project thread

Closes #51 (overview #49).

改了什么

对象(02 §4.7、§5.7)

  • srm_performance_review 绩效考评单:review_no(PR{YYYY}{00000})、供应商、周期、期间与起止日期、OTD / 批次合格率 / PPM / 订单响应及时率、五维得分(含 hse_score)与总分、等级、审定人、申诉;supplier + period 唯一索引;状态机 calculating → scoring → reviewing → published ⇄ appealed,开放状态可作废。新增两个字段:delivery_count(本期交付行数)、data_incomplete(07 R7「数据不全」)。
  • srm_performance_score 评分明细(master_detail,controlled_by_parent):指标、权重快照、原始值、得分、评分人、说明、已评分。
  • 等级选项值改为 grade_a…grade_d:平台要求选项值至少两个字符,设计里的 a/b/c/d 过不了 validate;02 里考评单和供应商的 grade 同步改了(供应商的 grade 还没建)。

flow srm_performance_generate(03 §10 第 1–2 步)

  • 每月 1–7 日 03:00 运行(追赶式:1 日漏跑后几天补上;同一供应商同一期间已有考评单就跳过,跑两遍不重复建)。可传 asOf 补跑更早的月份。
  • 活跃供应商 = 合格或冻结(冻结期间仍在交付,连续 D 级要能累计,P4 依赖这一点);按所供品类中最高的物资类别取周期 perf_cycle(A 月度 / B 季度 / C 年度),每期第一个月生成上一期;flow 里的 CYCLE 与参数由测试核对一致。
  • 启用指标权重合计不是 100% 时不生成,通知采购总监。
  • 自动算分:按本期包含的月份取交付记录,口径同 srm_delivery_metrics(OTD = 准时行 ÷ 交付行;合格率 = 合格行 ÷ 已检行,让步接收算不合格;PPM = Σ不良 ÷ Σ实收 × 10⁶);每条自动指标按满分值 / 零分值线性计分,数字都在指标库里。没有数据的项不给分并写明原因,考评单标「数据不全」。算完转 scoring。
  • 中途失败留下的 calculating 考评单,下次运行时删掉重建;单家失败不影响其他供应商。

权限 / 界面:内部岗位只读(04 §2.3),srm_admin 可删(删后可补跑,字段对管理员 FLS 只读);视图:全部 / 待评分 / 数据不全;导航「绩效与风险 › 考评单」;英文词条齐全。

平台缺口:CEL 不能对列表求和,flow 也没有汇总节点,所以 Σ不良数、Σ实收数、权重合计用 loop + assignment 逐行累加。登记为 07 §6.3 PF15;按立卡门规则没有新开卡,而是在已关闭的「汇总 / 分组节点」卡 objectstack#14500 上以 objectstack-fleet[bot] 的身份补了一条数据点评论。

性能(07 R9):进程内 sqlite 实测 200 家供应商 × 6 行交付记录,一次生成约 7.4 秒,× 30 行约 8.6 秒,重跑(全部跳过)约 0.6 秒,暂不需要拆分。压测默认不跑:SRM_LOAD_TEST=1 pnpm vitest run test/performance-generate-load.test.ts。

怎么验证的

  • test/performance-review.test.ts(14 条):A / B / C 三种周期与期间、冻结供应商纳入、潜在和没有品类的跳过、每条启用指标一行且权重快照;重跑不重复、非季初 / 年初只生成月度;OTD / 合格率 / PPM 数值与线性得分;季度跨三个月汇总;无交付记录标数据不全且不给零分;导入样例表格后与数据集 srm_delivery_metrics 逐家比对一致;权重不足 100% 时不生成并通知采购总监;残留的 calculating 考评单被重建;唯一索引;内部只读、管理员删除并级联删除明细。
  • 权限快照更新(各岗位对考评单 / 明细为 R)。
  • pnpm validate、lint --strict、typecheck、i18n:check --strict、test(204 通过)、build,以及 governance/scripts/build.py --check(核心与三个扩展包)都在本地通过。已合入 main 上的 feat(core): v0.5 R1 risk events and the blacklist register #59(风险事件)。

🤖 Generated with Claude Code

https://claude.ai/code/session_01A56prixkxJr4M3yuAoM4qi

- srm_performance_review (PR{YYYY}{00000}, supplier + period unique, state machine per 02 §5.7, grade values grade_a..grade_d) and srm_performance_score (master_detail, weight snapshot)
- srm_performance_generate: schedule days 1-7 03:00, catch-up and idempotent; cycle by the supplier's highest material class (perf_cycle, CYCLE checked against the parameter by test); active = qualified or frozen; refuses and notifies the procurement director when active weights are not 100%; rebuilds a review a failed run left in calculating; asOf input for back-runs
- auto scoring: OTD, lot acceptance rate and PPM from the period's delivery records (same basis as srm_delivery_metrics), linear KPI scores from full/zero values; no data -> item unscored and review flagged data_incomplete (07 R7)
- views all / awaiting scores / data incomplete; nav; internal read-only, srm_admin deletes
- sums by loop accumulation (07 §6.3 PF15, data point on objectstack#14500); 200 suppliers x 30 lines ~8.6 s (07 R9, opt-in load test)
- design docs 02 / 03 / 05 / 07 and params synced; tests

Closes #51

Claude-Session: https://claude.ai/code/session_01A56prixkxJr4M3yuAoM4qi
Co-authored-by: Claude <noreply@anthropic.com>
@marchtian marchtian self-assigned this Oct 24, 2026
@marchtian
marchtian merged commit d83e2c0 into main Oct 24, 2026
2 checks passed
marchtian pushed a commit that referenced this pull request Oct 26, 2026
- 07 §1: v0.5 delivered (PR #58, #59, #62–#64, #66–#70); gate 1 run through on
  2026-10-26, waiting for confirmation.
- 07 §2.1: steps 2, 7 and 9 worded to match the permission matrix (04 §2), the
  performance result application (03 §10 step 6) and PR #70.
- 07 §2.3: gate-1 results (script, import idempotency, migration rehearsal,
  approval matrix, list performance; usability left to the pilot).
- README: v0.5 row, 17 templates, next step.

Claude-Session: https://claude.ai/code/session_01GE6xU6aD3pdp51u4NzEoKg
Co-authored-by: Claude <noreply@anthropic.com>
marchtian added a commit that referenced this pull request Oct 26, 2026
…#71)

- 07 §1: v0.5 delivered (PR #58, #59, #62–#64, #66–#70); gate 1 run through on
  2026-10-26, waiting for confirmation.
- 07 §2.1: steps 2, 7 and 9 worded to match the permission matrix (04 §2), the
  performance result application (03 §10 step 6) and PR #70.
- 07 §2.3: gate-1 results (script, import idempotency, migration rehearsal,
  approval matrix, list performance; usability left to the pilot).
- README: v0.5 row, 17 templates, next step.

Claude-Session: https://claude.ai/code/session_01GE6xU6aD3pdp51u4NzEoKg

Co-authored-by: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

v0.5 P2:考评单生成与自动算分

2 participants