Files
dpb/backend/app/api/v1/module_bre/propagation/model.py
T
34047007@qq.com b95053c52c init: 初始化 dpb 桃育种系统代码库
前后端 + 后端 FastAPI 全量源码、部署脚本与文档。
2026-08-06 00:17:49 +08:00

63 lines
2.8 KiB
Python

"""克隆扩繁(苗圃)批次 数据模型"""
from datetime import date
from sqlalchemy import Date, ForeignKey, Index, Integer, String
from sqlalchemy.orm import Mapped, mapped_column
from app.core.base_model import MappedBase, ModelMixin, UserMixin
class PropagationModel(ModelMixin, UserMixin, MappedBase):
"""克隆扩繁批次(规格 §3.8;入选株→克隆种质→扩繁→新树闭环)。
A2 产出物为无性系(produced_clone_id→bre_clone),沿用原 clone 不新建;
A3 砧木为砧木字典(rootstock_id→bre_rootstock),不再直连种质。
"""
__tablename__ = "bre_propagation"
batch_code: Mapped[str] = mapped_column(String(64), nullable=False, comment="扩繁批次编号")
scion_source_type: Mapped[str | None] = mapped_column(
String(16), nullable=True, comment="接穗来源类型(germplasm/tree)", default=None
)
scion_source_id: Mapped[int | None] = mapped_column(
Integer, nullable=True, comment="接穗来源ID(按类型对应种质或单株)", default=None
)
produced_clone_id: Mapped[int | None] = mapped_column(
Integer, ForeignKey("bre_clone.id"), index=True, nullable=True, comment="产出的无性系(沿用原clone)", default=None
)
rootstock_id: Mapped[int | None] = mapped_column(
Integer, ForeignKey("bre_rootstock.id"), index=True, nullable=True, comment="砧木(砧木字典)", default=None
)
method: Mapped[str | None] = mapped_column(String(16), nullable=True, comment="繁殖方法(嫁接/扦插/压条)", default=None)
graft_date: Mapped[date | None] = mapped_column(Date, nullable=True, comment="嫁接日期", default=None)
nursery_site_id: Mapped[int | None] = mapped_column(
Integer, ForeignKey("bre_site.id"), index=True, nullable=True, comment="育苗基地(试验基地)", default=None
)
operator_id: Mapped[int | None] = mapped_column(
Integer, ForeignKey("bre_personnel.id"), index=True, nullable=True, comment="操作人(育种人员)", default=None
)
scion_count: Mapped[int | None] = mapped_column(Integer, nullable=True, comment="接穗数量", default=None)
grafted_count: Mapped[int | None] = mapped_column(Integer, nullable=True, comment="嫁接数量", default=None)
survival_count: Mapped[int | None] = mapped_column(Integer, nullable=True, comment="成活数量", default=None)
destination: Mapped[str | None] = mapped_column(String(32), nullable=True, comment="去向(定植/试验/外送)", default=None)
remark: Mapped[str | None] = mapped_column(String(512), nullable=True, comment="备注", default=None)
__table_args__ = (
Index("ix_bre_propagation_created_deleted", "created_time", "is_deleted"),
Index("uq_bre_propagation_batch", "batch_code", unique=True),
)