# SmartFarm V1 正式 ER 关系图 本文档把 `15-v1-data-model-draft.md` 和 `34-v1-database-field-dictionary.md` 的 90 张农业业务表组织为可评审的逻辑 ER 图。字段类型、默认值、索引和迁移顺序仍以 `34` 为唯一物理字典;本文件冻结实体主从关系、基数、归属链和跨域引用。 ## 一、关系实现原则 1. 图中的 `FK` 表示逻辑外键,不表示创建 MySQL `FOREIGN KEY`。 2. 对当前 `www_smartfarm_co` 数据库的只读检查显示物理外键数量为 `0`;V1 延续 CRMEB 现有方式,以索引、Repository 归属校验、事务锁和对账保证完整性。 3. 所有逻辑外键都必须建立与查询方向匹配的索引;不允许用无索引 JSON 代替可查询关系。 4. 交易、库存、账本、事件、审计和状态迁移记录不可物理级联删除。 5. `target_type + target_id` 等多态关系只能使用冻结的目标类型白名单,并由 Repository 逐类型验证。 6. CRMEB 核心表是交易、用户、商户、商品和账户载体;农业表通过一对一扩展、绑定或不可变快照关联,不向核心表散加农业业务字段。 ## 二、商品、供货、活动与库存 ```mermaid erDiagram CRMEB_PRODUCT ||--o| eb_farm_product_agriculture_profile : extends CRMEB_PRODUCT ||--o{ eb_farm_product_material : owns eb_farm_farm ||--o{ eb_farm_product_agriculture_profile : sources CRMEB_MERCHANT ||--o{ eb_farm_cloud_supply : supplies CRMEB_PRODUCT ||--o{ eb_farm_cloud_supply : source_product eb_farm_cloud_supply ||--o{ eb_farm_cloud_supply_delivery : deliveries eb_farm_cloud_supply ||--o{ eb_farm_cloud_supply_inspection : inspections eb_farm_cloud_supply_delivery ||--o{ eb_farm_cloud_supply_inspection : inspected_by_delivery eb_farm_cloud_supply ||--o{ eb_farm_cloud_supply_material : snapshots eb_farm_cloud_supply ||--o{ eb_farm_cloud_supply_return : returns CRMEB_MERCHANT ||--o{ eb_farm_cloud_supply_return : receives_return eb_farm_cloud_supply ||--o{ eb_farm_cloud_supply_acquisition : acquired_by_platform CRMEB_MERCHANT ||--o{ eb_farm_cloud_supply_acquisition : source_merchant CRMEB_PRODUCT ||--o{ eb_farm_cloud_supply_acquisition : target_product eb_farm_cloud_activity ||--o{ eb_farm_cloud_activity_product : contains eb_farm_cloud_activity_product ||--o{ eb_farm_cloud_activity_sku : contains eb_farm_cloud_supply ||--o{ eb_farm_cloud_activity_sku : funds_inventory eb_farm_cloud_activity_sku ||--o{ eb_farm_cloud_user_quota : limits CRMEB_USER ||--o{ eb_farm_cloud_user_quota : owns eb_farm_cloud_activity_sku ||--|| eb_farm_cloud_batch : creates eb_farm_cloud_supply ||--o{ eb_farm_cloud_batch : source eb_farm_cloud_batch ||--o{ eb_farm_cloud_batch_pool_balance : balances eb_farm_cloud_batch ||--o{ eb_farm_cloud_inventory_flow : flows eb_farm_cloud_supply ||--o{ eb_farm_cloud_inventory_flow : supply_flows eb_farm_warehouse ||--o{ eb_farm_cloud_supply_inspection : receives eb_farm_warehouse_location ||--o{ eb_farm_cloud_supply_inspection : located_at eb_farm_warehouse ||--o{ eb_farm_cloud_inventory_flow : warehouse_flows eb_farm_product_agriculture_profile { bigint product_agriculture_profile_id PK int product_id UK bigint farm_id FK string status int version } eb_farm_product_material { bigint product_material_id PK int product_id FK bigint attachment_id string audit_status } eb_farm_cloud_supply { bigint cloud_supply_id PK string supply_no UK int merchant_id FK int product_id FK decimal accepted_qty string status } eb_farm_cloud_supply_delivery { bigint cloud_supply_delivery_id PK bigint supply_id FK decimal dispatch_qty decimal received_qty } eb_farm_cloud_supply_inspection { bigint cloud_supply_inspection_id PK bigint supply_id FK bigint delivery_id FK bigint warehouse_id FK bigint location_id FK } eb_farm_cloud_supply_material { bigint cloud_supply_material_id PK bigint supply_id FK json material_snapshot } eb_farm_cloud_supply_return { bigint cloud_supply_return_id PK string return_no UK bigint supply_id FK int merchant_id FK decimal return_qty decimal restored_source_qty string status } eb_farm_cloud_supply_acquisition { bigint cloud_supply_acquisition_id PK string acquisition_no UK bigint supply_id FK int merchant_id FK int target_product_id FK int target_sku_value_id FK decimal acquisition_qty decimal acquisition_amount string status } eb_farm_cloud_activity { bigint cloud_activity_id PK string activity_no UK string status } eb_farm_cloud_activity_product { bigint cloud_activity_product_id PK bigint activity_id FK int product_id FK } eb_farm_cloud_activity_sku { bigint cloud_activity_sku_id PK bigint activity_product_id FK bigint supply_id FK int source_value_id } eb_farm_cloud_user_quota { bigint cloud_user_quota_id PK bigint activity_sku_id FK int user_id FK } eb_farm_cloud_batch { bigint cloud_batch_id PK string batch_no UK bigint activity_sku_id UK bigint supply_id FK } eb_farm_cloud_batch_pool_balance { bigint cloud_batch_pool_balance_id PK bigint batch_id FK string pool_code } eb_farm_cloud_inventory_flow { bigint cloud_inventory_flow_id PK string flow_no UK bigint supply_id FK bigint batch_id FK } ``` ## 三、首次订单、二次销售与财务 ```mermaid erDiagram CRMEB_ORDER_PRODUCT ||--|| eb_farm_order_binding : declares_policy CRMEB_ORDER_PRODUCT ||--o| eb_farm_cloud_order_item : primary_extension eb_farm_cloud_activity_sku ||--o{ eb_farm_cloud_order_item : purchased_as eb_farm_cloud_batch ||--o{ eb_farm_cloud_order_item : assigned_batch eb_farm_cloud_order_item ||--o{ eb_farm_cloud_freight_order : freight_attempts eb_farm_cloud_freight_order ||--o| eb_farm_cloud_freight_refund : late_or_cancel_refund eb_farm_cloud_order_item ||--o| eb_farm_cloud_pickup : pickup eb_farm_cloud_pickup ||--o{ eb_farm_cloud_pickup_verification : verification_history eb_farm_cloud_order_item ||--o| eb_farm_cloud_holding : holding CRMEB_REFUND_ORDER ||--o{ eb_farm_cloud_primary_refund_impact : impacts eb_farm_cloud_order_item ||--o{ eb_farm_cloud_primary_refund_impact : reversed_by eb_farm_cloud_resale_stock ||--o{ eb_farm_cloud_batch : publishes CRMEB_ORDER_PRODUCT ||--o{ eb_farm_cloud_resale_allocation : secondary_allocations eb_farm_cloud_resale_stock ||--o{ eb_farm_cloud_resale_allocation : allocates eb_farm_cloud_batch ||--o{ eb_farm_cloud_resale_allocation : fefo_source eb_farm_cloud_resale_allocation ||--o{ eb_farm_cloud_resale_refund_allocation : reversed_by CRMEB_REFUND_ORDER ||--o{ eb_farm_cloud_resale_refund_allocation : refund eb_farm_cloud_batch ||--o{ eb_farm_cloud_batch_progress : progress CRMEB_USER ||--o{ eb_farm_cloud_holding : owns eb_farm_cloud_holding ||--o{ eb_farm_cloud_user_ledger : ledgers eb_farm_cloud_batch ||--o{ eb_farm_cloud_user_ledger : batch_ledgers eb_farm_cloud_holding ||--o| eb_farm_cloud_buyback : buyback eb_farm_cloud_user_ledger ||--o{ eb_farm_cloud_ledger_adjustment : adjusted_by CRMEB_MERCHANT ||--o{ eb_farm_merchant_supply_ledger : earns eb_farm_cloud_supply ||--o{ eb_farm_merchant_supply_ledger : source eb_farm_cloud_order_item ||--o{ eb_farm_merchant_supply_ledger : primary_sale eb_farm_merchant_supply_statement ||--o{ eb_farm_merchant_supply_statement_item : contains eb_farm_merchant_supply_ledger ||--o| eb_farm_merchant_supply_statement_item : included_once CRMEB_MERCHANT ||--o{ eb_farm_merchant_supply_statement : statements eb_farm_cloud_user_ledger ||--o| eb_farm_financial_posting : posts eb_farm_merchant_supply_statement ||--o| eb_farm_financial_posting : posts eb_farm_cloud_ledger_adjustment ||--o| eb_farm_financial_posting : posts eb_farm_cloud_buyback ||--o| eb_farm_financial_posting : posts eb_farm_order_binding { bigint binding_id PK int order_product_id UK string business_type string finance_policy } eb_farm_cloud_order_item { bigint cloud_order_item_id PK int order_product_id UK int user_id FK bigint activity_sku_id FK bigint batch_id FK } eb_farm_cloud_freight_order { bigint cloud_freight_order_id PK bigint cloud_order_item_id FK string freight_order_no UK } eb_farm_cloud_freight_refund { bigint cloud_freight_refund_id PK bigint freight_order_id UK string freight_refund_no UK } eb_farm_cloud_pickup { bigint cloud_pickup_id PK bigint cloud_order_item_id FK bigint pickup_point_id FK } eb_farm_cloud_pickup_verification { bigint cloud_pickup_verification_id PK bigint pickup_id FK string verification_no UK bigint reversal_of_id FK } eb_farm_cloud_holding { bigint cloud_holding_id PK bigint cloud_order_item_id UK bigint batch_id FK int user_id FK } eb_farm_cloud_primary_refund_impact { bigint cloud_primary_refund_impact_id PK int refund_order_id FK bigint cloud_order_item_id FK } eb_farm_cloud_resale_stock { bigint cloud_resale_stock_id PK int resale_product_id int resale_sku_value_id } eb_farm_cloud_resale_allocation { bigint cloud_resale_allocation_id PK int secondary_order_product_id FK bigint resale_stock_id FK bigint batch_id FK } eb_farm_cloud_resale_refund_allocation { bigint cloud_resale_refund_allocation_id PK int secondary_refund_order_id FK bigint resale_allocation_id FK } eb_farm_cloud_batch_progress { bigint cloud_batch_progress_id PK bigint batch_id FK int calculation_version } eb_farm_cloud_user_ledger { bigint cloud_user_ledger_id PK bigint holding_id FK bigint batch_id FK bigint posting_id FK } eb_farm_cloud_ledger_adjustment { bigint cloud_ledger_adjustment_id PK bigint ledger_id FK bigint posting_id FK } eb_farm_cloud_buyback { bigint cloud_buyback_id PK bigint holding_id UK bigint ledger_id FK } eb_farm_merchant_supply_ledger { bigint merchant_supply_ledger_id PK bigint supply_id FK bigint cloud_order_item_id FK bigint statement_item_id FK } eb_farm_merchant_supply_statement { bigint merchant_supply_statement_id PK int merchant_id FK bigint posting_id FK } eb_farm_merchant_supply_statement_item { bigint merchant_supply_statement_item_id PK bigint statement_id FK bigint ledger_id UK } eb_farm_financial_posting { bigint financial_posting_id PK string posting_key UK string source_type bigint source_id } ``` ## 四、农场资产、租地与认养权益 ```mermaid erDiagram eb_farm_farm ||--o{ eb_farm_zone : contains eb_farm_zone ||--o{ eb_farm_plot : contains eb_farm_farm ||--o{ eb_farm_warehouse : owns eb_farm_warehouse ||--o{ eb_farm_warehouse_location : contains eb_farm_farm ||--o{ eb_farm_pickup_point : offers eb_farm_zone ||--o{ eb_farm_enclosure : contains eb_farm_adoption_category ||--o{ eb_farm_breed : groups eb_farm_breed ||--o{ eb_farm_animal_asset : classifies eb_farm_breed ||--o{ eb_farm_breeding_batch : classifies eb_farm_enclosure ||--o{ eb_farm_animal_asset : houses eb_farm_enclosure ||--o{ eb_farm_breeding_batch : houses eb_farm_land_plan ||--o{ eb_farm_land_plan_crop : allows eb_farm_crop ||--o{ eb_farm_land_plan_crop : selected eb_farm_farm ||--o{ eb_farm_land_plan : publishes CRMEB_ORDER_PRODUCT ||--o| eb_farm_land_order : land_extension eb_farm_land_plan ||--o{ eb_farm_land_order : ordered eb_farm_land_order ||--o{ eb_farm_plot_occupancy : occupies eb_farm_plot ||--o{ eb_farm_plot_occupancy : calendar eb_farm_farm ||--o{ eb_farm_adoption_plan : publishes eb_farm_breed ||--o{ eb_farm_adoption_plan : offers CRMEB_ORDER_PRODUCT ||--o| eb_farm_adoption_order : adoption_extension eb_farm_adoption_plan ||--o{ eb_farm_adoption_order : ordered eb_farm_adoption_order ||--o{ eb_farm_adoption_allocation : receives eb_farm_animal_asset ||--o{ eb_farm_adoption_allocation : individual eb_farm_breeding_batch ||--o{ eb_farm_adoption_allocation : shared_batch eb_farm_adoption_allocation ||--o{ eb_farm_asset_replacement : replacement_history eb_farm_farm { bigint farm_id PK string farm_no UK } eb_farm_zone { bigint zone_id PK bigint farm_id FK } eb_farm_plot { bigint plot_id PK bigint zone_id FK } eb_farm_warehouse { bigint warehouse_id PK bigint farm_id FK } eb_farm_warehouse_location { bigint warehouse_location_id PK bigint warehouse_id FK } eb_farm_pickup_point { bigint pickup_point_id PK bigint farm_id FK } eb_farm_enclosure { bigint enclosure_id PK bigint zone_id FK } eb_farm_crop { bigint crop_id PK } eb_farm_adoption_category { bigint adoption_category_id PK } eb_farm_breed { bigint breed_id PK bigint adoption_category_id FK } eb_farm_animal_asset { bigint animal_asset_id PK bigint breed_id FK bigint enclosure_id FK } eb_farm_breeding_batch { bigint breeding_batch_id PK bigint breed_id FK bigint enclosure_id FK } eb_farm_land_plan { bigint land_plan_id PK bigint farm_id FK } eb_farm_land_plan_crop { bigint land_plan_crop_id PK bigint land_plan_id FK bigint crop_id FK } eb_farm_land_order { bigint land_order_id PK int order_product_id UK bigint plan_id FK } eb_farm_plot_occupancy { bigint plot_occupancy_id PK bigint plot_id FK bigint land_order_id FK } eb_farm_adoption_plan { bigint adoption_plan_id PK bigint farm_id FK bigint breed_id FK } eb_farm_adoption_order { bigint adoption_order_id PK int order_product_id UK bigint plan_id FK } eb_farm_adoption_allocation { bigint adoption_allocation_id PK bigint adoption_order_id FK bigint animal_asset_id FK bigint breeding_batch_id FK } eb_farm_asset_replacement { bigint asset_replacement_id PK bigint adoption_allocation_id FK } ``` ## 五、生产、产出、履约与溯源 ```mermaid erDiagram eb_farm_production_batch ||--o| eb_farm_production_plant_detail : plant_detail eb_farm_production_batch ||--o| eb_farm_production_livestock_detail : livestock_detail eb_farm_production_batch ||--o{ eb_farm_production_right_link : serves_rights eb_farm_land_order ||--o{ eb_farm_production_right_link : land_right eb_farm_adoption_order ||--o{ eb_farm_production_right_link : adoption_right eb_farm_production_batch ||--o{ eb_farm_task : schedules eb_farm_task ||--o{ eb_farm_task_assignment : assignments eb_farm_production_batch ||--o{ eb_farm_production_event : records eb_farm_production_event ||--o{ eb_farm_production_event_version : versions eb_farm_production_batch ||--o{ eb_farm_output_batch : produces eb_farm_output_batch ||--o{ eb_farm_output_inventory_flow : inventory_flows eb_farm_output_batch ||--o{ eb_farm_output_allocation : allocates eb_farm_production_right_link ||--o{ eb_farm_output_allocation : entitlement eb_farm_fulfillment ||--o{ eb_farm_fulfillment_item : contains eb_farm_output_allocation ||--o{ eb_farm_fulfillment_item : fulfills eb_farm_fulfillment ||--o{ eb_farm_fulfillment_package : packages eb_farm_fulfillment_package ||--o{ eb_farm_fulfillment_package_item : contains eb_farm_fulfillment_item ||--o{ eb_farm_fulfillment_package_item : packed_as eb_farm_fulfillment ||--o{ eb_farm_fulfillment_freight_order : freight_attempts eb_farm_warehouse ||--o{ eb_farm_output_batch : receives_output eb_farm_warehouse_location ||--o{ eb_farm_output_inventory_flow : located_flows eb_farm_trace_archive ||--o{ eb_farm_trace_version : versions eb_farm_trace_archive ||--o{ eb_farm_trace_material : materials eb_farm_trace_archive ||--o{ eb_farm_trace_link : links eb_farm_trace_version ||--o{ eb_farm_trace_link : published_links eb_farm_production_batch ||--o| eb_farm_trace_archive : traced eb_farm_output_batch ||--o| eb_farm_trace_archive : traced eb_farm_production_batch { bigint production_batch_id PK bigint farm_id FK string production_type } eb_farm_production_plant_detail { bigint production_plant_detail_id PK bigint production_batch_id UK bigint crop_id FK } eb_farm_production_livestock_detail { bigint production_livestock_detail_id PK bigint production_batch_id UK bigint breed_id FK } eb_farm_production_right_link { bigint production_right_link_id PK bigint production_batch_id FK string right_type bigint right_id } eb_farm_task { bigint task_id PK bigint production_batch_id FK } eb_farm_task_assignment { bigint task_assignment_id PK bigint task_id FK int service_id FK } eb_farm_production_event { bigint production_event_id PK bigint production_batch_id FK } eb_farm_production_event_version { bigint production_event_version_id PK bigint production_event_id FK } eb_farm_output_batch { bigint output_batch_id PK bigint production_batch_id FK bigint warehouse_id FK } eb_farm_output_inventory_flow { bigint output_inventory_flow_id PK bigint output_batch_id FK bigint location_id FK } eb_farm_output_allocation { bigint output_allocation_id PK bigint output_batch_id FK bigint right_link_id FK } eb_farm_fulfillment { bigint fulfillment_id PK int user_id FK string business_type } eb_farm_fulfillment_item { bigint fulfillment_item_id PK bigint fulfillment_id FK bigint output_allocation_id FK } eb_farm_fulfillment_package { bigint fulfillment_package_id PK bigint fulfillment_id FK } eb_farm_fulfillment_package_item { bigint fulfillment_package_item_id PK bigint package_id FK bigint fulfillment_item_id FK } eb_farm_fulfillment_freight_order { bigint fulfillment_freight_order_id PK bigint fulfillment_id FK } eb_farm_trace_archive { bigint trace_archive_id PK string public_code UK } eb_farm_trace_version { bigint trace_version_id PK bigint archive_id FK } eb_farm_trace_material { bigint trace_material_id PK bigint archive_id FK } eb_farm_trace_link { bigint trace_link_id PK bigint archive_id FK bigint version_id FK string target_type bigint target_id } ``` ## 六、异常、权限、证据与可靠性支撑 ```mermaid erDiagram eb_farm_exception_event ||--o{ eb_farm_exception_impact : impacts eb_farm_exception_event ||--o{ eb_farm_exception_plan_version : plans eb_farm_exception_plan_version ||--o{ eb_farm_exception_execution_step : executes CRMEB_SERVICE ||--o| eb_farm_service_profile : enables_farm CRMEB_SERVICE ||--o{ eb_farm_service_scope : scoped CRMEB_ADMIN ||--o{ eb_farm_admin_scope : scoped CRMEB_SERVICE ||--o{ eb_farm_evidence_attachment : uploads eb_farm_task ||--o{ eb_farm_evidence_attachment : task_evidence eb_farm_domain_outbox ||--o{ eb_farm_event_consume_log : consumed_by eb_farm_async_operation ||--o{ eb_farm_job_run : executed_by eb_farm_financial_posting ||--o{ eb_farm_audit_log : audited eb_farm_exception_event { bigint exception_event_id PK string event_no UK string business_domain bigint current_plan_version_id FK } eb_farm_exception_impact { bigint exception_impact_id PK bigint exception_id FK int impact_version string target_type bigint target_id } eb_farm_exception_plan_version { bigint exception_plan_version_id PK bigint exception_id FK int version_no } eb_farm_exception_execution_step { bigint exception_execution_step_id PK bigint exception_id FK bigint plan_version_id FK string result_key UK } eb_farm_service_profile { bigint profile_id PK int service_id UK int scope_version } eb_farm_service_scope { bigint scope_id PK int service_id FK string scope_type bigint scope_object_id } eb_farm_admin_scope { bigint scope_id PK int admin_id FK int scope_set_version string scope_type bigint scope_object_id } eb_farm_evidence_attachment { bigint attachment_id PK int service_id FK bigint task_id FK string business_type bigint business_id } eb_farm_idempotency_record { bigint idempotency_record_id PK string operation_code string request_id } eb_farm_domain_outbox { bigint domain_outbox_id PK string event_id UK string aggregate_type bigint aggregate_id } eb_farm_event_consume_log { bigint event_consume_log_id PK string event_id FK string consumer_name } eb_farm_job_run { bigint job_run_id PK string job_name string run_key } eb_farm_notification_log { bigint notification_log_id PK string template_code string business_key } eb_farm_audit_log { bigint audit_log_id PK string target_type bigint target_id } eb_farm_state_transition { bigint state_transition_id PK string aggregate_type bigint aggregate_id } eb_farm_async_operation { bigint async_operation_id PK string operation_no UK string target_type bigint target_id } ``` 支撑表中的多态关系不画伪造的单一外键。具体规则如下: | 字段 | 允许目标 | 完整性保证 | | --- | --- | --- | | `order_binding.aggregate_type/id` | cloud order item、land order、adoption order | 创建 CRMEB 明细的同一事务写入并建立唯一绑定 | | `exception_impact.target_type/id` | 订单、库存、持仓、账本、权益、生产、产出、履约 | 影响重算服务按白名单 Repository 校验 | | `trace_link.target_type/id` | 商品/SKU、订单、生产批次、产出批次 | 发布/解除命令校验对象范围与历史引用 | | `evidence_attachment.business_type/id` | 过程记录、产出、验收、异常、履约 | 正式提交事务原子绑定;未绑定附件定时清理 | | `audit_log.target_type/id` | 任一受审计聚合 | 操作码与目标类型白名单;不可变 | | `state_transition.aggregate_type/id` | 任一状态聚合 | 与状态变化和 Outbox 同事务 | | `async_operation.target_type/id` | 导入、导出、重算、修复目标 | 发起者和对象范围校验;结果受控下载 | ## 七、关键归属链 Repository 数据范围必须沿以下确定关系解析,不能信任请求参数中的父级 ID: | 目标对象 | 平台归属链 | 商户/用户/服务端边界 | | --- | --- | --- | | 地块 | plot → zone → farm | 服务人员 scope 匹配 plot/zone/farm | | 栏舍、动物、养殖批次 | asset/batch → enclosure → zone → farm | 服务人员 scope 匹配资产、栏舍或上级农场 | | 生产、任务、过程、产出 | object → production batch → farm/right link | 用户从本人权益反查;服务人员从任务或对象 scope 反查 | | 农业履约 | fulfillment item → output allocation → right link → order | 用户必须为订单本人;仓储人员还需 warehouse/task scope | | 供货 | supply → merchant/product | 商户必须为当前 `mer_id`;平台还需 cloud 域权限 | | 云仓批次、持仓、账本 | batch → activity SKU → supply;holding → user | 用户只读本人 holding/ledger;财务动作另需独立权限 | | 溯源 | archive/link → target → farm/product/order | 公开端只读当前发布版本;后台按目标对象范围 | | 异常 | impact target → 目标归属链 | 先校验异常域,再逐个断言受影响目标 | ## 八、删除、停用与历史 - 主数据被交易、生产、材料或溯源引用后只能停用,不能级联删除。 - 活动、订单、批次、持仓、账本、结单、入账、库存流水、异常计划、审计、状态迁移和事件记录永不物理删除。 - 草稿可软删除时也必须先验证没有下游引用,并保留审计。 - 当前资料、规则或材料修改只影响新交易;历史订单读取自身快照。 - 回退迁移只允许移除尚未产生业务事实的空结构;一旦存在事实,回退改为关闭入口和停任务。 ## 九、完整覆盖校验 | 领域 | 表数 | 表 | | --- | ---: | --- | | 商品、供货、活动、库存 | 15 | product profile/material、activity/product/SKU/quota、supply/delivery/inspection/material/return/acquisition、batch/pool/flow | | 首次订单、二次销售、财务 | 19 | order binding、order item、freight/refund、pickup/verification、holding、primary refund impact、resale stock/allocation/refund/progress、user ledger/adjustment、buyback、merchant ledger/statement/item、posting | | 农场资产、租地、认养 | 20 | farm、zone、plot、warehouse/location、pickup point、enclosure、crop、category、breed、animal、breeding batch、land plan/crop/order/occupancy、adoption plan/order/allocation、replacement | | 生产、产出、履约、溯源 | 20 | production batch、plant/livestock detail、right link、task/assignment、event/version、output/flow/allocation、fulfillment/item/package/package item/freight、trace archive/version/material/link | | 异常与可靠性支撑 | 16 | exception/impact/plan/step、idempotency、outbox、consume log、job run、notification、audit、transition、async operation、service profile/scope、admin scope、evidence attachment | 同一张跨域表可能在关系图中出现多次;物理表唯一计数以 `34` 的 90 个唯一表名为准。发布前使用自动脚本比较 `15`、`34` 与本文件中的 `eb_farm_*` 唯一集合,任何缺表或多表都阻断迁移任务。 ## 十、关联文档 - [15-v1-data-model-draft.md](15-v1-data-model-draft) - [21-v1-code-change-blueprint.md](21-v1-code-change-blueprint) - [31-v1-write-operation-contract-registry.md](31-v1-write-operation-contract-registry) - [33-v1-state-exception-transaction-matrix.md](33-v1-state-exception-transaction-matrix) - [34-v1-database-field-dictionary.md](34-v1-database-field-dictionary)