fix:sample/plate 之前的开发

This commit is contained in:
彭帅
2026-05-28 11:56:17 +08:00
parent fc36bc83e3
commit 8b65de36b8
367 changed files with 57752 additions and 947 deletions

View File

@@ -0,0 +1,43 @@
# 04 Germplasm / Seed - seed_lot_transaction 表录入说明
来源:`docs/architecture/04-germplasm-seed-data-flow.md`
## 录入目标
`seed_lot_transaction` 记录 seed lot 之间的库存流转,例如入库、出库、转移、分装、合并或消耗。它表达 from seed lot 到 to seed lot 的数量变化。
## 上下游关系
| 类型 | 内容 |
| --- | --- |
| 表 | `seed_lot_transaction` |
| Java 实体 | `SeedLotTransactionEntity` |
| 前置依赖 | `from_seed_lot``to_seed_lot` |
| 下游引用 | 库存追踪、库存数量更新 |
| API | `/brapi/v2/seedlots/transactions``/brapi/v2/seedlots/{seedLotDbId}/transactions` |
## 字段录入
| 字段 | 业务意义 | 录入方式 | 校验规则 |
| --- | --- | --- | --- |
| `id` | transaction 主键 | 系统生成;导入可指定 | 必填、唯一 |
| `auth_user_id` | 数据所属用户 | 登录上下文自动写入 | 不允许前端手填 |
| `from_seed_lot_id` | 来源 seed lot | SeedLot 选择器 | 入库场景可为空,若填需存在 |
| `to_seed_lot_id` | 目标 seed lot | SeedLot 选择器 | 出库/消耗场景可为空,若填需存在 |
| `amount` | 流转数量 | 数字输入 | 必填,正数 |
| `units` | 数量单位 | 下拉/文本 | 必填,应与批次单位一致或可换算 |
| `timestamp` | 流转时间 | 日期时间选择器 | 默认当前时间 |
| `description` | 流转说明 | 多行文本 | 可选 |
## 页面与交互
- 在 SeedLot 详情页 Transactions Tab 展示相关流转。
- 新增交易后应更新 from/to seed lot 的 amount 和 last_updated。
- 支持按时间、from/to seed lot、program、location 查询。
## 关键校验
1. `from_seed_lot_id``to_seed_lot_id` 至少填写一个。
2. `from_seed_lot_id` 不能等于 `to_seed_lot_id`
3. 出库或转移时,来源批次数量不能被扣成负数。
4. transaction 是业务动作痕迹,原则上不允许随意物理删除。