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

53 lines
3.4 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
生产侧已统一为【生产物料库】(试剂 + 耗材 + 批次 + 领用 + 工单登记)。业务上还存在 **「配置试剂」**:由多个原试剂与耗材按配方配制而成,需 **追溯每次配制用了哪些子物料**,且配制产物 **先入库存、再领用、再在生产工单步骤中登记消耗**(方案 A,用户已确认)。这与已废弃的「耗材包」(仅模板、无配制实例与库存)不同,需在统一物料库上扩展第三类物料,而非恢复耗材包。
## What Changes
### 配置试剂主数据与配方(BOM)
- `biz_production_material.material_type` 新增 **`configured_reagent`**(配置试剂)
- 数据字典 `production_material_type` 新增「配置试剂」
- 新建 **`biz_production_material_formula`**:配置试剂 → 子物料(`reagent` / `consumable`)+ 标准用量 + 单位
- 生产物料库支持按类型筛选、维护配置试剂目录及配方子表
### 配制单与批次入库(方案 A)
- 新建 **`biz_production_material_prep`**(配制单头)+ **`biz_production_material_prep_line`**(子物料实际消耗行)
- 配制时:每行子物料 **必须** 关联已有 **领用记录**(`parent_usage_id`),记 `prep_consume` 流水(**不二次扣** 子物料 batch 库存)
- 配制完成:配置试剂 **批次入库**(`biz_production_material_stock_batch` + `prep_in` 流水),`stock_qty` / `remaining_qty` 增加
- 支持查看配制单详情及子物料追溯
### 领用与生产工单
- 配置试剂与试剂/耗材相同:**manual_out 领用** → 工单步骤选领用记录 → **step_save**(`parent_usage_id`,不二次扣库)
- 生产工单步骤新增 **「配置试剂」Tab**(或等价独立子表),领用选项 API 增加 `materialType=configured_reagent`
- 【我的物料领用记录】支持配置试剂类型筛选与展示
### 与现网关系
- **复用** `biz_production_material*` 批次、领用、盘点、usage 流水体系
- **不恢复** 耗材包;工艺库引用配置试剂 BOM 为 **二期**(本期 Non-Goal)
## Capabilities
### New Capabilities
- `configured-reagent-catalog`: 配置试剂目录、material_type、字典、配方 BOM CRUD
- `configured-reagent-prep`: 配制单、子物料领用关联、prep_consume / prep_in 库存流水
- `configured-reagent-work-order-usage`: 配置试剂领用、工单步骤登记、我的领用记录扩展
- `configured-reagent-ui`: 生产物料库配方编辑、配制单 UI、工单配置试剂 Tab
### Modified Capabilities
- `production-material-library`: material_type 扩展 `configured_reagent`;筛选与 Tag 展示
- `production-requisition-stock-log`: 领用选项与流水 source_type 扩展 `prep_consume` / `prep_in`
- `production-step-requisition-usage`: 步骤子表与 API 支持配置试剂领用登记
## Impact
- **数据库**:2 张新表(formula、prep + prep_line);字典项;`production_material_usage.source_type` 语义扩展;可选 step 子表 `biz_production_task_step_configured_reagent` 或扩展现有结构
- **后端**:`models/crud/api` 扩展 `production_material*`;新 prep 路由;`register_step_usage_from_requisition` 支持 configured_reagent
- **前端**:`production-material` 页扩展类型与配方弹窗;新配制单 Tab/页;`StepDetailPanel` 配置试剂 Tab;`status-tag-registry` 新类型
- **依赖**:`production-material-requisition` 变更应已落地(统一物料库 + 领用 + step_save)