## ADDED Requirements ### Requirement: Migrate consumable and reagent to production material 系统 SHALL 提供迁移脚本,将: - `biz_consumable` → `biz_production_material`(material_type=consumable,字段映射 consumable_code→material_code 等) - `biz_reagent` → `biz_production_material`(material_type=reagent,reagent_code→material_code 等) 保留原表 **id 映射表** 或在新表 `remark`/扩展字段存 `legacy_id` 以便追溯。 对 stock_qty>0 的迁移行生成 **期初批次**(stock_in_no=`INIT-{type}-{code}`)。 #### Scenario: Consumable row migrated with type - **WHEN** 迁移执行 - **THEN** 原 consumable 编码 X 成为 production_material 一行,material_type=consumable ### Requirement: Step and process snapshot compatibility 工艺/步骤子表仍使用 `reagent_code`、`consumable_code` 快照时,解析目录 SHALL 使用 **material_type + code** 查询 `biz_production_material`。 #### Scenario: Resolve reagent code on step load - **WHEN** 步骤含 reagent_code=R001 - **THEN** 关联 material_type=reagent 且 material_code=R001 的目录行(若存在) ### Requirement: Legacy API read-only bridge `GET /consumables`、`GET /reagents` MAY 只读代理到 production_material 对应 type,**不得** 新建/更新旧表。 POST/PUT/DELETE 旧 consumable/reagent API SHALL 返回 410,提示使用 `/production-materials`。 #### Scenario: Legacy create consumable rejected - **WHEN** POST /consumables - **THEN** 410,消息指向生产物料库