Files
zkxw/openspec/changes/production-material-requisition/proposal.md
T
2026-06-13 19:47:22 +08:00

64 lines
4.2 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
## Why
客户希望生产侧物料管理与【质检物料库】采用 **同一套思路**:一个物料库、入库批次、领用→工单登记、月末盘点;批号/厂家不同须靠批次区分,耗材包不再适用。同时,生产侧现有 **试剂、耗材分表分菜单** 造成与质检不一致;客户要求 **融合为统一「生产物料库」**,通过 **物料类型**(试剂 / 耗材)区分,使生产与质检的管理模型对称、思路清晰。
## What Changes
### 统一生产物料库(本期核心架构变更)
- 新建 **`biz_production_material`** 物资目录,字段对齐 `biz_qc_material`,新增 **`material_type`**(`reagent` 试剂 / `consumable` 耗材)
- 新建统一子表(对齐 QC 命名):
- `biz_production_material_stock_batch`
- `biz_production_material_usage`(变动流水,含 manual_in / manual_out / step_save)
- `biz_production_material_stock_check` + `_batch_line` + `_unused_line`
- **一个** 管理页面 **【生产物料库】**(菜单挂在 **【生产基础信息】**,三 Tab:批次列表 / 变动记录 / 库存盘点),筛选器支持按物料类型
- **一个** 菜单 **【我的物料领用记录】**(参照质检「我的物料领用记录」,可按类型筛选)
- 迁移 `biz_consumable`、`biz_reagent` 历史数据 → `biz_production_material`;原表只读保留或废弃写 API
- **下线** 独立菜单「耗材管理」「试剂管理」(合并进生产物料库)
### 领用与生产工单(保留,数据源改为统一库)
- 步骤保存:从 **领用记录** 登记消耗(`parent_usage_id`),不二次扣库
- 【生产工单】步骤可 **保留「试剂」「耗材」两个 Tab**(与工艺步骤结构一致),但均从 **同一领用 API** 拉取,按 `material_type` 过滤
- 登记记录可在 **【我的物料领用记录】** 查看(含类型 Tag、批号)
### 耗材包废弃(保留)
- 移除耗材包 Tab/菜单、工艺库「从耗材包导入」
### 与质检的关系
- **融合范围**:仅生产侧 **试剂 + 耗材** → **生产物料库**
- **仍不合并**:`biz_qc_material`(质检物料库)与 `biz_production_material` **独立**(业务域、权限、菜单分离);**结构对称**,非表合并
## Capabilities
### New Capabilities
- `production-material-library`: 统一物资目录 + material_type、菜单/页面【生产物料库】、旧表迁移与菜单下线
- `production-material-batch-inventory`: 统一批次表、入出库、变动流水(对齐 QC)
- `production-material-stock-check`: 统一库存盘点(Part A + Part B)
- `production-material-unification`: consumable/reagent → production_material 数据迁移、编码映射、下游快照兼容
- `consumable-pack-deprecation`: 耗材包下线
- `production-requisition-stock-log`: 领用关联、领用选项/我的领用/下钻 API
- `production-step-requisition-usage`: 步骤领用登记、step_save 替换规则
- `production-material-requisition-ui`: 生产物料库 UI、我的物料领用、生产工单步骤 UI
### Modified Capabilities
- `production-step-stock-deduction`: supersede 直接扣库
- `material-stock-log-ui`: supersede 为 production-material 统一变动记录 UI 要求
### Superseded(本变更内不再单独实施)
- 原 `consumable-batch-inventory` / `reagent-batch-inventory` 双轨方案
- 原 `consumable-stock-check` / `reagent-stock-check` 双轨方案
- 原「我的耗材领用记录」「我的试剂领用记录」两个菜单 → 合并为「我的物料领用记录」
## Impact
- **数据库**:新建 production_material 系列 6 表;迁移脚本;step 子表 `requisition_usage_id`;隐藏旧菜单
- **后端**:新建 `models/production_material.py`、`crud/production_material*.py`;统一 API 前缀 `/production-materials`;consumable/reagent API 只读或 410
- **前端**:新建 `production-material/index.vue`(参照 `qc-material/index.vue`);`my-production-material-usage`;改造 `StepDetailPanel`;隐藏 consumable/reagent 菜单
- **下游**:工艺/步骤子表仍可按试剂行、耗材行维护标准用量(快照);目录引用逐步改为 material_id 或编码映射