Files
brapi-java/docs/dev/04-germplasm/16-seed_lot.md
2026-05-28 11:56:17 +08:00

47 lines
1.9 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.

# 04 Germplasm / Seed - seed_lot 表录入说明
来源:`docs/architecture/04-germplasm-seed-data-flow.md`
## 录入目标
`seed_lot` 是真实库存批次,描述某一批种子当前数量、单位、库位和项目归属。同一个 germplasm 可以有多个 seed lot。
## 上下游关系
| 类型 | 内容 |
| --- | --- |
| 表 | `seed_lot` |
| Java 实体 | `SeedLotEntity` |
| 前置依赖 | 可选 `location``program` |
| 下游引用 | `seed_lot_content_mixture``seed_lot_transaction` |
| API | `/brapi/v2/seedlots` |
## 字段录入
| 字段 | 业务意义 | 录入方式 | 校验规则 |
| --- | --- | --- | --- |
| `id` | seed lot 主键 | 系统生成;导入可指定 | 必填、唯一 |
| `auth_user_id` | 数据所属用户 | 登录上下文自动写入 | 不允许前端手填 |
| `name` | 批次名称 | 用户录入/自动生成 | 必填,建议同一 program 下唯一 |
| `amount` | 当前库存数量 | 交易自动更新/用户录入初始值 | 非负 |
| `units` | 数量单位 | 下拉/文本 | 建议必填 |
| `created_date` | 创建时间 | 系统写入/导入 | 可选 |
| `last_updated` | 最后更新时间 | 系统更新 | 不建议手填 |
| `description` | 批次说明 | 多行文本 | 可选 |
| `source_collection` | 来源 collection | 文本 | 可选 |
| `storage_location` | 具体库位 | 文本 | 可选 |
| `location_id` | 所在地点/库位 | Location 选择器 | 可选,若填需存在 |
| `program_id` | 所属项目 | Program 选择器 | 可选,若填需存在 |
## 页面与交互
- SeedLot 列表页支持按 program、location、name、库存状态查询。
- 详情页展示 content mixture 和 transactions。
- 创建 seed lot 后建议至少维护一条 `seed_lot_content_mixture`
## 关键校验
1. `amount` 不允许为负。
2. 普通用户不应直接编辑 amount库存变化应通过 `seed_lot_transaction`
3. 删除 seed lot 前检查组成明细和交易引用。