SPEC-ERD-CFQ Rev 0.11.0 · 2026-08-17

Cane Agency · Specification · Perspective documentสถาบันอ้อย · เอกสารข้อกำหนด · เอกสารรายมุมมอง

Data Model — Quota Farmer Perspectivemodel ข้อมูล — มุมมองหัวหน้าโควต้า

Documentเอกสาร
SPEC-ERD-CFQ
Versionversion (เวอร์ชัน)
0.11.0 · Draftฉบับร่าง
Updatedปรับปรุงล่าสุด
2026-08-17
Parentเอกสารแม่
SPEC-ERD
Perspectiveมุมมอง
Quota farmer (หัวหน้าโควต้า)หัวหน้าโควต้า
Siblingsเอกสารพี่น้อง
SPEC-DDD-CFQ · SPEC-PWF-CFQ

1. Purpose1. วัตถุประสงค์

This document reads the platform data model from the quota farmer’s side — the head of a sub-farmer network who holds the mill quota, runs the credit book (เงินเกี๊ยว) and operates the crop-transfer desk. Every definition mirrors SPEC-ERD and the graph; this document adds the network operator’s reading, never divergent attributes.

เอกสารนี้อ่าน model ข้อมูลจากฝั่งหัวหน้าโควต้า — หัวหน้าเครือข่ายลูกไร่ผู้ถือโควตาโรงงาน บริหารสมุดสินเชื่อ (เงินเกี๊ยว) และดูแลโต๊ะโอนสิทธิ์อ้อย ทุกนิยามสะท้อน SPEC-ERD และ graph (กราฟ); เอกสารนี้เพิ่มการอ่านของผู้บริหารเครือข่าย ไม่สร้างแอตทริบิวต์ที่แตกต่าง

2. Entity map2. แผนที่ entity

Relationความเกี่ยวข้องEntitiesEntity
Ownsเป็นเจ้าของFarmer · Quota · CropTransfer · CreditLine · CreditItem · Repayment · OnwardPremiumSettlement v8.0
Sharesใช้ร่วมTenant · Person · Membership · Field · Crop · Season · Delivery · PaymentItem · Truck · FarmActivity · YieldEstimate · StrategicAgreement · PremiumAccrual · PremiumRelease · LedgerAccount · JournalEntry · ChartTemplate · Invoice · Receipt · PaymentVoucher · CashAccount · BankTransaction · Reconciliation · FiscalPeriod · FinancialStatement v9.0 · BooksProfile v12.0
Contextsบริบทquota_planning · financing · strategic_pricing v8.0 · books · receivables · cash_management v9.0
WorkflowsWorkflowWF-01 · WF-02 · WF-06 · WF-08 · WF-31 · WF-34 · WF-35 v8.0 · WF-36 · WF-37 · WF-38 · WF-39 · WF-40 · WF-41 v9.0

3. Entity relationship diagram3. แผนภาพความสัมพันธ์ entity

Scoped view of the platform model from this perspective, rendered from the graph (entities · relationships · dataModeling, v0.4.0). Solid boxes are entities documented at full depth in this family — bold = primary key, gold = foreign key. Dashed boxes are shared entities; the label names their home document. Cardinalities read at each line end.

มุมมองเฉพาะด้านของ model ทั้ง platform render จาก graph (entities · relationships · dataModeling, v0.4.0) กล่องเส้นทึบคือ entity ที่บันทึกเชิงลึกในเอกสารตระกูลนี้ — ตัวหนา = primary key, สีทอง = foreign key กล่องเส้นประคือ entity ที่ใช้ร่วม โดยป้ายระบุเอกสาร home; อ่าน cardinality ที่ปลายเส้นแต่ละด้าน

11..*11..*0..*11..*10..10..*10..*10..*0..111..*10..*10..*10..* Tenanttenant · FEDPersonบุคคล · FEDFarmerชาวไร่farmer_id PKfarmer_kindregistration_statustenant_id FKquota_farmer_id? FKnamecitizen_id_hash?statusMembershipสมาชิกภาพ · FEDQuotaโควตาquota_id PKfarmer_id FKseason_id FKmill_id FKcommitted_tdelivered_tCropTransferการโอนสิทธิ์อ้อยtransfer_id PKcrop_id FKfrom_farmer_id? FKto_farmer_id FKtransfer_kindprice_per_rai?area_rai_snaptotal_amount?settle_method?+2 more…Seasonฤดูหีบ · FEDMillโรงงานน้ำตาล · MILLCropอ้อยรายฤดู · CFC
Fig. 1 — The quota farmer’s network plane — Farmer registry rows attach to federation tenants; Quota binds farmer × season × mill; CropTransfer moves crop ownership along the chain (incl. outright purchase บาท/ไร่).ภาพที่ 1 — ระนาบเครือข่ายของหัวหน้าโควต้า — แถวทะเบียน Farmer เกาะกับ tenant ของ federation; Quota ผูกชาวไร่ × ฤดู × โรงงาน; CropTransfer ย้ายกรรมสิทธิ์อ้อยตามสาย (รวมการซื้อขาด บาท/ไร่)
10..10..*11..*10..*10..*0..10..10..* CreditLineวงเงินเกี๊ยวcredit_id PKlender_tenant_id FKborrower_farmer_id FKseason_id FKupstream_credit_id? FKfunding_account_id? FKlimit_amtstatusStrategicAgreementข้อตกลงค่าอ้อยกลยุทธ์ · MILLCreditItemรายการสินเชื่อ/ปัจจัยการผลิตcredit_item_id PKcredit_id FKitem_typedescriptionqtyunitamountfinancing_modework_order_id? FKdisbursed_atRepaymentการชำระคืนrepayment_id PKcredit_id FKpayment_item_id? FKamountmethodposted_atPaymentItemรายการจ่ายต่อการส่งมอบ · MILLOnwardPremiumSettlementการส่งต่อค่าอ้อยกลยุทธ์สู่ลูกไร่relay_id PKfrom_quota_tenant_id FKto_cane_tenant_id FKsource_agreement_id? FKdelivery_id? FKdelivery_receipt_refnet_t?schemeamount+3 more…Deliveryการส่งมอบ · MILL
Fig. 2 — The financing plane the quota farmer owns — a CreditLine with append-only items and repayments offsetting settlement PaymentItems; OnwardPremiumSettlement relays the confidential strategic premium onward to cane farmers.ภาพที่ 2 — ระนาบเงินเกี๊ยวที่หัวหน้าโควต้าเป็นเจ้าของ — CreditLine พร้อมรายการเบิกและการชำระแบบ append-only หักกลบกับ PaymentItem ของการปิดงวด; OnwardPremiumSettlement ส่งต่อพรีเมียมกลยุทธ์ (ความลับ) ถึงลูกไร่

4. Owned entities — the quota farmer’s reading4. Entity ที่เป็นเจ้าของ — การอ่านของหัวหน้าโควต้า

EntityEntityWhat it means to the quota farmerความหมายต่อหัวหน้าโควต้าRules that biteกฎที่มีผล
Farmer ชาวไร่My network — sub-farmers (incl. virtual farmers I created), each with kind and registration status.เครือข่ายของฉัน — ลูกไร่ (รวมลูกไร่ virtual ที่ฉันสร้าง) พร้อมชนิดและสถานะลงทะเบียนDepth 1, no cycles; a virtual farmer belongs to exactly one network, cannot log in, lend, or receive direct mill payments; conversion keeps farmer_id.ลึก 1 ชั้น ไม่มีวงวน; ลูกไร่ virtual สังกัดเครือข่ายเดียว เข้าสู่ระบบ ให้กู้ หรือรับเงินตรงไม่ได้; แปลงเป็นบัญชีจริงคง farmer_id
Quota โควตาMy committed tonnes per season per mill, drawn down by network deliveries.ตันผูกพันของฉันรายฤดูรายโรงงาน ถูกหักโดยการส่งมอบของเครือข่ายUnique per (farmer, season, mill); delivered_t ≤ committed_t × 1.05.ไม่ซ้ำต่อชุด (ชาวไร่, ฤดู, โรงงาน); delivered_t ≤ committed_t × 1.05
CropTransfer สมุดโอนสิทธิ์The deed desk — reassignments and outright purchases (ขายเหมาไร่, ฿/rai × area snapshot).โต๊ะโอนสิทธิ์ — การมอบหมายใหม่และการซื้อเหมา (ขายเหมาไร่ บาท/ไร่ × พื้นที่ ณ เวลาโอน)Append-only; allowed in planned/growing/harvesting; cross-network needs two-side confirmation; open credit settled or carried by the seller.ต่อท้ายเท่านั้น; ทำได้ใน planned/growing/harvesting; ข้ามเครือข่ายต้องยืนยันสองฝ่าย; หนี้ค้างต้องเคลียร์หรือผู้ขายรับภาระ
CreditLine · CreditItem เงินเกี๊ยวThe credit book: lines I extend to sub-farmers (incl. virtual debt ledgers) and the factory pass-through line funding them.สมุดสินเชื่อ: วงเงินที่ให้ลูกไร่ (รวมบัญชีลูกหนี้ virtual) และวงเงินส่งผ่านจากโรงงานที่มาสนับสนุนDisbursed ≤ limit; downstream total ≤ upstream limit (upstream_credit_id); crop_purchase items post when a transfer settles via ledger.เบิกจ่าย ≤ เพดาน; ยอดปลายทาง ≤ เพดานต้นทาง (upstream_credit_id); รายการ crop_purchase บันทึกเมื่อการโอนชำระผ่านบัญชี
Repayment การชำระคืนHow the book closes — settlement offsets flow in from network payment items.วิธีปิดสมุด — การหักกลบไหลเข้าจากรายการจ่ายของเครือข่ายNever exceeds outstanding; append-only; write-offs are records, not edits.ไม่เกินยอดคงค้าง; ต่อท้ายเท่านั้น; ตัดหนี้สูญเป็นระเบียนใหม่ ไม่ใช่แก้ไข

5. Shared entities — the view from this side5. Entity ที่ใช้ร่วม — มุมมองจากฝั่งนี้

EntityEntityOwnerเจ้าของWhat the quota farmer reads / writesหัวหน้าโควต้าอ่าน / เขียนอะไร
Field · Crop · FarmActivity · YieldEstimateCFCReads the network crop board and yield roll-up for quota planning and credit sizing; sees financed-vs-applied on activities linked to my credit items.อ่านกระดานอ้อยเครือข่ายและผลผลิตรวมเพื่อวางแผนโควตาและวงเงิน; เห็นเบิกเทียบใช้จริงเฉพาะกิจกรรมที่เชื่อมรายการสินเชื่อของฉัน
Delivery · PaymentItemMILLReads network deliveries and split payments; a virtual farmer’s share pays through my split until conversion.อ่านการส่งมอบและการแบ่งจ่ายของเครือข่าย; ส่วนของลูกไร่ virtual จ่ายผ่านการแบ่งของฉันจนกว่าจะแปลงเป็นบัญชีจริง
TruckMILLRegisters and assigns the haulage fleet serving the network; transport service is already a เงินเกี๊ยว item type.ลงทะเบียนและจัดรถให้เครือข่าย; ค่าขนส่งเป็นชนิดรายการเงินเกี๊ยวอยู่แล้ว
Tenant · User · SeasonplatformplatformA quota group (a co-op) is a tenant holding the quota capacity, with officers — the legacy tenant_type value was quota_org; seasons frame every quota and credit line.องค์กรโควตา (สหกรณ์) เป็น tenant quota_org มีเจ้าหน้าที่; ฤดูกาลเป็นกรอบของโควตาและวงเงินทุกฉบับ

6. Cross-perspective contracts6. สัญญาข้ามมุมมอง

7. Quota Farmer depth7. รายละเอียดเชิงลึกของหัวหน้าโควต้า

Three readings the master states only in aggregate. None adds a divergent attribute; where a promotion to a first-class entity is proposed, it is flagged (PROP-017 Q1) and today satisfied with existing entities.

สามการอ่านที่เอกสารหลักระบุไว้แบบรวม ไม่มีอันใดเพิ่มแอตทริบิวต์ที่แตกต่าง; จุดที่เสนอให้ยกเป็น entity ระดับต้นถูกทำเครื่องหมายไว้ (PROP-017 Q1) และตอนนี้ทำได้ด้วย entity ที่มีอยู่

Readingการอ่านModelled withแทนด้วยRules that biteกฎที่มีผล
Quota sub-allocationการจัดสรรโควตาย่อยMy one Quota per (season, mill) + the Farmer network + each crop’s YieldEstimate — a planning target per sub-farmer, not a second commitment.Quota หนึ่งต่อ (ฤดู, โรงงาน) + เครือข่าย Farmer + YieldEstimate ของแต่ละอ้อย — เป็นเป้าหมายการวางแผนรายลูกไร่ ไม่ใช่ข้อผูกพันที่สองSum of sub-farmer targets is advisory; the binding cap stays delivered_t ≤ committed_t × 1.05 at the Quota. PROP-017 Q1 — promote to QuotaSubAllocation?ผลรวมเป้าของลูกไร่เป็นคำแนะนำ; เพดานที่ผูกคือ delivered_t ≤ committed_t × 1.05 ที่ Quota PROP-017 Q1 — ยกเป็น QuotaSubAllocation ไหม?
Organization (co-op) variantแบบองค์กร (สหกรณ์)One organization Tenant (quota_org tenant) = one org Farmer record; officers are Persons with role-scoped Memberships; members are the Farmer network.Tenant องค์กรหนึ่ง (tenant quota_org) = ระเบียน Farmer องค์กรหนึ่ง; เจ้าหน้าที่เป็น Person ที่มี Membership ตาม role; สมาชิกคือเครือข่าย FarmerOfficer authority is role-scoped & logged (quota_officer / finance_officer / field_agent); the org holds the aggregate Quota, sub-allocates to members.อำนาจเจ้าหน้าที่จำกัดตาม role และถูกบันทึก; องค์กรถือ Quota รวม จัดสรรย่อยให้สมาชิก
Representative-mill destinationโรงงานตัวแทนปลายทางQuota.mill_id may point at a representative mill (Mill.onboard_status = representative, PROP-006) not yet on the platform.Quota.mill_id ชี้ไปที่โรงงานตัวแทน (Mill.onboard_status = representative, PROP-006) ที่ยังไม่เข้า platformA delivery destination only until the mill claims its tenant; claiming preserves mill_id and every quota/delivery link (WF-29, FR-73).เป็นแค่ปลายทางส่งมอบจนกว่าโรงงานจะ claim tenant; การ claim คง mill_id และทุกลิงก์โควตา/ส่งมอบ (WF-29, FR-73)

8. Persistence profile — home entities8. Persistence profile — entity ที่ home อยู่ฉบับนี้

Normative physical model for the 7 entities homed in this document, rendered from the graph's dataModeling block. Types derive from typeConventions (first rule wins): money = bigint satang · weights = integer kg · tonnage = numeric(12,3) · timestamps = timestamptz UTC · ids = uuid v7. Every FK is indexed by convention (ON DELETE RESTRICT); listed indexes are additional. Enum value sets live in the graph's entity and state-machine notes.

Model เชิงกายภาพที่เป็นบรรทัดฐานของ entity ทั้ง 7 รายการที่ home อยู่ในเอกสารนี้ render จาก block dataModeling ใน graph ชนิดข้อมูลอนุมานจาก typeConventions (กติกาแรกที่เข้าเป็นผล): เงิน = bigint สตางค์ · น้ำหนัก = integer กก. · ตัน = numeric(12,3) · เวลา = timestamptz UTC · id = uuid v7 ทุก FK มี index ตามข้อตกลง (ON DELETE RESTRICT); index ที่ระบุคือส่วนเพิ่ม ชุดค่า enum อยู่ในหมายเหตุ entity และ state machine ของ graph

Farmer ชาวไร่ mutable personal

v0.54.0 (PROP-078)  ·  name RETIRED — a Farmer is the grower PROFILE of a Tenant and is not a human, so it holds no human name; the parts, the prefix and the nickname live on Person, once (FR-437, OQ-1).

table farmer  ·  aggregate Farmer  ·  code FRM-######  ·  unique (citizen_id_hash (partial: not null))  ·  index (tenant_id) · (quota_farmer_id) · (farmer_kind,status)

ColumnColumnTypeชนิดNullDefaultค่าตั้งต้นKey / refKey / อ้างอิง
farmer_iduuid—uuid_v7()PK
farmer_kindtext (enum)——
registration_statustext (enum)——
tenant_iduuid——FK → tenant
quota_farmer_iduuid✓—FK → farmer
citizen_id_hashchar(64)✓—
statustext (enum)——

CropTransfer การโอนสิทธิ์อ้อย append_only operational

table crop_transfer  ·  aggregate Crop  ·  code CTR-########  ·  index (crop_id,effective_at) · (to_farmer_id)

ColumnColumnTypeชนิดNullDefaultค่าตั้งต้นKey / refKey / อ้างอิง
transfer_iduuid—uuid_v7()PK
crop_iduuid——FK → crop
from_farmer_iduuid✓—FK → farmer
to_farmer_iduuid——FK → farmer
transfer_kindtext (enum)——
price_per_raibigint (satang)✓—
area_rai_snapnumeric(10,2)——
total_amountbigint (satang)✓—
settle_methodtext (enum)✓—
effective_attimestamptz——
recorded_byuuid——FK → membership

Quota โควตา mutable operational

table quota  ·  aggregate Quota  ·  code QTA-######  ·  unique (farmer_id,season_id,mill_id)  ·  index (mill_id,season_id)

ColumnColumnTypeชนิดNullDefaultค่าตั้งต้นKey / refKey / อ้างอิง
quota_iduuid—uuid_v7()PK
farmer_iduuid——FK → farmer
season_iduuid——FK → season
mill_iduuid——FK → mill
committed_tnumeric(12,3) (t)——
delivered_tnumeric(12,3) (t)——

CreditLine วงเงินเกี๊ยว mutable operational

table credit_line  ·  aggregate CreditLine  ·  code CRD-######  ·  index (borrower_farmer_id,season_id) · (lender_tenant_id,status) · (upstream_credit_id) · (funding_account_id)

ColumnColumnTypeชนิดNullDefaultค่าตั้งต้นKey / refKey / อ้างอิง
credit_iduuid—uuid_v7()PK
lender_tenant_iduuid——FK → tenant
borrower_farmer_iduuid——FK → farmer
season_iduuid——FK → season
upstream_credit_iduuid✓—FK → credit_line
funding_account_iduuid✓—FK → loan_account
limit_amtbigint (satang)——
statustext (enum)——

CreditItem รายการสินเชื่อ/ปัจจัยการผลิต append_only operational

table credit_item  ·  aggregate CreditLine  ·  code CI-########  ·  index (credit_id) · (work_order_id)

ColumnColumnTypeชนิดNullDefaultค่าตั้งต้นKey / refKey / อ้างอิง
credit_item_iduuid—uuid_v7()PK
credit_iduuid——FK → credit_line
item_typetext (enum)——
descriptiontext——
qtynumeric(10,2)——
unittext——
amountbigint (satang)——
financing_modetext (enum)——
work_order_iduuid✓—FK → work_order
disbursed_attimestamptz——

Repayment การชำระคืน append_only operational

table repayment  ·  aggregate CreditLine  ·  code RPY-########  ·  index (credit_id,posted_at) · (payment_item_id)

ColumnColumnTypeชนิดNullDefaultค่าตั้งต้นKey / refKey / อ้างอิง
repayment_iduuid—uuid_v7()PK
credit_iduuid——FK → credit_line
payment_item_iduuid✓—FK → payment_item
amountbigint (satang)——
methodtext (enum)——
posted_attimestamptz——

OnwardPremiumSettlement การส่งต่อค่าอ้อยกลยุทธ์สู่ลูกไร่ append_only confidential_wall

table onward_premium_settlement  ·  aggregate OnwardPremiumSettlement  ·  code OPM-########  ·  index (from_quota_tenant_id,paid_at) · (to_cane_tenant_id) · (delivery_id)

ColumnColumnTypeชนิดNullDefaultค่าตั้งต้นKey / refKey / อ้างอิง
relay_iduuid—uuid_v7()PK
from_quota_tenant_iduuid——FK → tenant
to_cane_tenant_iduuid——FK → tenant
source_agreement_iduuid✓—FK → strategic_agreement
delivery_iduuid✓—FK → delivery
delivery_receipt_reftext——
net_tnumeric(12,3) (t)✓—
schemetext (enum)——
amountbigint (satang)——
methodtext (enum)——
paid_attimestamptz——
recorded_byuuid——FK → membership

9. Keys, indexes & mutability9. Key, index และ mutability

One row per entity in this perspective. Mutability: mutable · immutable_after_state (frozen once a terminal/approved state is reached) · append_only (corrections supersede or reverse, never edit) · reference (catalogue). PDPA class: personal · consent_gated · confidential_wall · operational · public. Entities homed in a sibling document link to their full profile.

หนึ่งแถวต่อ entity ในมุมมองนี้ Mutability: mutable · immutable_after_state (ตรึงเมื่อถึงสถานะอนุมัติ/สุดท้าย) · append_only (การแก้คือออกฉบับแทนหรือกลับรายการ ไม่แก้ของเดิม) · reference (บัญชีอ้างอิง) ชั้น PDPA: personal · consent_gated · confidential_wall · operational · public Entity ที่ home อยู่เอกสารพี่น้อง link ไป profile ฉบับเต็ม

EntityTableตารางPKUniqueKey indexesIndex หลักMutabilityPDPAProfile
Farmerfarmerfarmer_id(citizen_id_hash (partial: not null))(tenant_id) (quota_farmer_id) (farmer_kind,status)mutablepersonalSection 8ข้อ 8
CropTransfercrop_transfertransfer_id—(crop_id,effective_at) (to_farmer_id)append_onlyoperationalSection 8ข้อ 8
Quotaquotaquota_id(farmer_id,season_id,mill_id)(mill_id,season_id)mutableoperationalSection 8ข้อ 8
CreditLinecredit_linecredit_id—(borrower_farmer_id,season_id) (lender_tenant_id,status) (upstream_credit_id) (funding_account_id)mutableoperationalSection 8ข้อ 8
CreditItemcredit_itemcredit_item_id—(credit_id) (work_order_id)append_onlyoperationalSection 8ข้อ 8
Repaymentrepaymentrepayment_id—(credit_id,posted_at) (payment_item_id)append_onlyoperationalSection 8ข้อ 8
OnwardPremiumSettlementonward_premium_settlementrelay_id—(from_quota_tenant_id,paid_at) (to_cane_tenant_id) (delivery_id)append_onlyconfidential_wallSection 8ข้อ 8

10. Consistency boundaries10. ขอบเขตความสอดคล้อง (aggregate)

Transaction boundaries touching this perspective, from graph dataModeling.aggregates. Inside a boundary the stated invariants commit atomically in one database transaction; across boundaries effects flow through domain events (eventual consistency). Repository and unit-of-work lifetimes for these aggregates are specified in the sibling SPEC-DDD document (scoped per request — see the component lifetime map).

ขอบเขต transaction ที่เกี่ยวกับมุมมองนี้ จาก dataModeling.aggregates ใน graph ภายในขอบเขต invariant ที่ระบุ commit แบบ atomic ใน database transaction เดียว; ข้ามขอบเขตผลไหลผ่าน domain event (eventual consistency) lifetime ของ repository และ unit of work ของ aggregate เหล่านี้กำหนดในเอกสาร SPEC-DDD พี่น้อง (scoped ต่อคำขอ — ดูผัง lifetime ของ component)

Aggregate rootMembersสมาชิกContextTransaction ruleกติกา transaction
FarmerFarmerfederationRegistry root; quota_farmer_id links the sub-farmer chain — re-parenting is a single-row change guarded by chain validation.root ทะเบียน; quota_farmer_id เชื่อมสายลูกไร่ — การย้ายสายเป็นการแก้รายแถวภายใต้การตรวจสาย
CropCrop · FarmActivity · YieldEstimate · CropTransferland_crop_registryOwnership transfer appends a CropTransfer and updates owner_farmer_id in one transaction; activities and estimates append without touching crop state.การโอนกรรมสิทธิ์ append CropTransfer และแก้ owner_farmer_id ใน transaction เดียว; กิจกรรมและการประมาณผลผลิต append โดยไม่แตะสถานะอ้อย
QuotaQuotaquota_planningdelivered_t is updated EVENTUALLY from delivery events — never inside the delivery transaction; committed_t changes only via the quota holder.delivered_t ปรับแบบ eventual จาก delivery event — ไม่อยู่ใน transaction ของการส่งมอบ; committed_t แก้ได้โดยผู้ถือโควตาเท่านั้น
CreditLineCreditLine · CreditItem · RepaymentfinancingA disbursement (CreditItem) validates Σ items ≤ limit_amt inside the transaction; repayment offsets post against the line atomically with their PaymentItem reference.การเบิก (CreditItem) ตรวจ Σ รายการ ≤ limit_amt ใน transaction; การหักชำระ post เข้าวงเงินพร้อมการอ้าง PaymentItem แบบ atomic
OnwardPremiumSettlementOnwardPremiumSettlementstrategic_pricingAppend-only relay record — cash on the factory delivery receipt; scheme (mirror/split/flat) fixed per row.ระเบียนส่งต่อแบบ append-only — เงินสดต่อใบรับส่งมอบโรงงาน; scheme (mirror/split/flat) ตรึงต่อแถว

11. The partnership, program & alias extension (PROP-048)11. ส่วนขยายความร่วมมือ โปรแกรม และ alias (PROP-048)

Spec v0.26.0 gives the quota farmer the field_partnership context and the two derived records that price a field. Everything here is the quota farmer own reading: the alias mapping lives on this side and nowhere else, and no record in this section is ever readable by a mill except through the enrollment-scoped, aliased read model (FR-230, NFR-70).

spec v0.26.0 มอบ context field_partnership และ record ที่คำนวณสองรายการซึ่งใช้ตีมูลค่าแปลงให้หัวหน้าโควต้า ทุกอย่างในข้อนี้เป็นการอ่านของหัวหน้าโควต้าเอง: ตารางเทียบ alias อยู่ฝั่งนี้และไม่มีที่อื่น และไม่มี record ใดในข้อนี้ที่โรงงานอ่านได้ ยกเว้นผ่าน read model แบบ alias ที่จำกัดตามการเข้าร่วม (FR-230, NFR-70)

EntityEntityAttributesattributeRules that biteกฎที่มีผล
ProductivityPartnership · PartnershipLinePPS: partnership_id · provider_tenant_id · recipient_tenant_id · season_id · field_ids? · status · proposed_by · proposed_at · accepted_at? · closed_at? · note? ·|· PPL: line_id · partnership_id · line_kind · provider_tenant_id · description · qty? · unit? · price_basis · amount? · settlement_route · credit_line_id? · status · agreed_at?PPS: partnership_id · provider_tenant_id · recipient_tenant_id · season_id · field_ids? · status · proposed_by · proposed_at · accepted_at? · closed_at? · note? ·|· PPL: line_id · partnership_id · line_kind · provider_tenant_id · description · qty? · unit? · price_basis · amount? · settlement_route · credit_line_id? · status · agreed_at?ONE object per (provider, recipient, season); each LINE names its own provider, which is what makes the record symmetric (P-5). Two-act — active only on the counterparty acceptance; a steward may accept for a virtual farmer (FR-24). line_kind: input | service | equipment | financing | advisory. settlement_route: credit_line | deduct_at_settlement | cash | in_kind. No new money rail: a financing line references an existing CreditLine, an in-kind cane share routes through CropTransfer.หนึ่งวัตถุต่อหนึ่ง (ผู้ให้ ผู้รับ ฤดู); แต่ละรายการระบุผู้ให้ของตนเอง ซึ่งทำให้ record นี้สมมาตร (P-5) ทำงานสองจังหวะ — มีผลเมื่อคู่สัญญาตอบรับ ผู้ดูแลตอบรับแทนลูกไร่ virtual ได้ (FR-24) ชนิดรายการ: ปัจจัยการผลิต | บริการ | เครื่องจักร | สินเชื่อ | ที่ปรึกษา ช่องทางชำระ: วงเงินสินเชื่อ | หักตอนจ่ายเงิน | เงินสด | สิ่งของ ไม่มีรางเงินใหม่: รายการสินเชื่ออ้างอิง CreditLine เดิม ส่วนแบ่งอ้อยเดินผ่าน CropTransfer
ProgramEnrollment การเข้าร่วมโปรแกรมenrollment_id · program_id · quota_tenant_id · field_id · crop_id? · alias_id · tenure_id · area_rai_snap · target_yield_t_per_rai · committed_tonnage_t · funding_amount · starts_on · ends_on · statusenrollment_id · program_id · quota_tenant_id · field_id · crop_id? · alias_id · tenure_id · area_rai_snap · target_yield_t_per_rai · committed_tonnage_t · funding_amount · starts_on · ends_on · statusOne enrolled FIELD per row (P-6). area_rai_snap and tenure_id are snapshots taken at enrollment — a mid-season change of hands does not rewrite them (OQ-11). committed_tonnage_t is the only figure the mill measures its own intake against (OQ-3, L-3). Tenure expiring inside the funding horizon fails the condition (T-3).หนึ่งแปลงที่เข้าร่วมต่อหนึ่งแถว (P-6) area_rai_snap และ tenure_id เป็น snapshot ณ วันเข้าร่วม — การเปลี่ยนมือกลางฤดูไม่เขียนทับ (OQ-11) committed_tonnage_t เป็นตัวเลขเดียวที่โรงงานใช้เทียบกับปริมาณที่ตนรับ (OQ-3, L-3) หากสิทธิในที่ดินหมดก่อนสิ้นระยะคืนทุนถือว่าไม่ผ่านเงื่อนไข (T-3)
FieldAlias เอเลียสของแปลงalias_id · field_id · counterparty_tenant_id · alias_code · issued_at · frozen_at?alias_id · field_id · counterparty_tenant_id · alias_code · issued_at · frozen_at?One per (field, counterparty) and the mapping lives ONLY here. Stable across seasons, independent across counterparties, non-reversible without the mapping, not re-issued on a change of grower, frozen permanently when a grower leaves the network. No event or payload reveals it (W-5, NFR-72, closes L-2).หนึ่ง alias ต่อหนึ่ง (แปลง คู่สัญญา) และตารางเทียบอยู่ที่นี่เท่านั้น คงที่ข้ามฤดู เป็นอิสระระหว่างคู่สัญญา ย้อนกลับไม่ได้หากไม่มีตารางเทียบ ไม่ออกใหม่เมื่อเปลี่ยนผู้ปลูก และตรึงถาวรเมื่อผู้ปลูกออกจากเครือข่าย ไม่มี event หรือ payload ใดเปิดเผยมัน (W-5, NFR-72 ปิดช่องรั่ว L-2)
IdentityDisclosure การเปิดเผยตัวตนdisclosure_id · field_id · requester_tenant_id · relayed_by_tenant_id · purpose · consent_id? · requested_at · decided_at? · outcome · expires_at? · revoked_at?disclosure_id · field_id · requester_tenant_id · relayed_by_tenant_id · purpose · consent_id? · requested_at · decided_at? · outcome · expires_at? · revoked_at?Append-only. outcome ∈ { granted, unavailable } — never "declined", so silence and refusal are indistinguishable downstream (P-9). One field per request, rate-limited, expiring, audited with principal, field, purpose and consent reference (NFR-74). A granted row stands on a ConsentGrant with scope field_identity, never bundled.append-only ผลลัพธ์ ∈ { granted, unavailable } — ไม่มี "ถูกปฏิเสธ" การเงียบและการปฏิเสธจึงแยกไม่ออกที่ปลายทาง (P-9) หนึ่งแปลงต่อหนึ่งคำขอ จำกัดจำนวน มีวันหมดอายุ และบันทึกตรวจสอบพร้อมผู้กระทำ แปลง วัตถุประสงค์ และเลขที่ความยินยอม (NFR-74) แถวที่ได้รับอนุญาตยืนอยู่บน ConsentGrant scope field_identity ซึ่งห้ามผูกรวมกับ scope อื่น
FieldCapabilityProfile · CropValueEstimateFCP: profile_id · field_id · computed_on · method_version · capability_band · machine_class · factor_scores · inputs_snapshot · confidence ·|· CVE: value_id · crop_id · estimate_id · t_expected · ccs_expected · price_basis · price_ref? · gross_value · deduction_estimate · net_to_grower · as_of · expires_on · basis_snapshotFCP: profile_id · field_id · computed_on · method_version · capability_band · machine_class · factor_scores · inputs_snapshot · confidence ·|· CVE: value_id · crop_id · estimate_id · t_expected · ccs_expected · price_basis · price_ref? · gross_value · deduction_estimate · net_to_grower · as_of · expires_on · basis_snapshotDerived, versioned, append-only; every row carries its inputs and method version, so nothing is silently recomputed (NFR-77). An estimate is never a settlement (V-1) and every rendered figure shows its basis (V-2). A crop value is commercial information about its grower: it stays inside the network, reaching a mill only aliased and enrollment-scoped and a bank only by consent (V-3).เป็นค่าที่คำนวณ จัดรุ่น และ append-only; ทุกแถวพา input และรุ่นของวิธีคิดไปด้วย จึงไม่มีการคำนวณใหม่แบบเงียบ (NFR-77) ประมาณการไม่ใช่การจ่ายเงิน (V-1) และทุกตัวเลขที่แสดงต้องบอกที่มา (V-2) มูลค่าอ้อยเป็นข้อมูลเชิงพาณิชย์ของผู้ปลูก: อยู่ในเครือข่าย ถึงโรงงานได้เพียงแบบ alias และจำกัดตามการเข้าร่วม และถึงธนาคารได้ด้วยความยินยอมเท่านั้น (V-3)

Read-only from this side: ContractFarmingProgram (SPEC-ERD-MILL), the field ground-truth records FieldBoundary / TenureRecord / LandRight / SoilAnalysis / CropOutcome (SPEC-ERD-CFC) and Document/DocumentPage (SPEC-ERD-FED). Persistence profiles for the new records ride the PROP-019 Q5 back-audit.

ฝั่งนี้อ่านได้เท่านั้น: ContractFarmingProgram (SPEC-ERD-MILL) record ข้อมูลจริงของแปลง FieldBoundary / TenureRecord / LandRight / SoilAnalysis / CropOutcome (SPEC-ERD-CFC) และ Document/DocumentPage (SPEC-ERD-FED) โปรไฟล์การจัดเก็บของ record ใหม่จะทำในรอบตรวจย้อนหลัง PROP-019 Q5

Applied — PROP-050 · spec v0.28.0apply แล้ว — PROP-050 · spec v0.28.0

PROP-050 (spec v0.28.0) — cost centres to field & crop level: the farmer's plantation ledger. The grower's books gain a cost dimension, not a second book: five columns on every journal line (centre_id · cost_class · alloc_id · qty · qty_unit) over a derived CostCentre register — holding → field → crop cycle → crop, with asset and overhead-pool attachments and no farmer-defined nesting. The CropCycle (one planting plus its ratoons) becomes the unit of return and carries the establishment asset, capitalised at first revenue, amortised on units of production and impaired only with a named cause and a date. Field capture is two decisions and under fifteen seconds, works offline, and opens from four doors into one sheet; the receipt is photographed into the PROP-048 document vault and the phone releases the file only once the cloud confirms durable storage. Eight artifacts S-1…S-8 — crop P&L · cycle statement · field lifetime · consolidated plantation · cost structure with a k-anonymous benchmark · settlement per crop · practice comparison · scenario & replant signal — every one computed from posted lines only and printing its own uncertainty. Capture, evidence and S-1/S-2/S-3/S-4/S-6 sit in the base grower entitlement, free and permanent; S-5/S-7/S-8 form the analytics tier. Owned land carries no imputed rent and family labour is off by default, so the bottom line is named return to land and own labour. FR-267…312 · NFR-87…106 · WF-96…111. PROP-048's CropExpense is withdrawn as a store and becomes a capture form that posts. The lender's side (Rev 0.2). A quota or lead farmer is borrower and lender at once, so two more centre kinds — network and borrower — form a second branch under the same holding, with a seventh cost class network_lending, the 1160/1161 · 2160 · 4210/4220 · 5710/5720/5730 chart rows, AdvanceEarmark (which field the money went to, reachable only through the per-counterparty alias) and the derived BorrowerPosition, reconciling to the control accounts exactly and printing that line on S-9. Artifacts S-9 network lending book · S-10 money-into-fields map · S-11 network book P&L. No allocation rule crosses between the farm branch and the network branch, and a quota or lead farmer never reads a sub-farmer's cost book — he reads what he funded and its delivery outcome, never a margin, a cost structure or a benchmark position (OQ-12).

PROP-050 (spec v0.28.0) — ศูนย์ต้นทุนถึงระดับแปลงและอ้อยรุ่น: สมุดต้นทุนไร่ของชาวไร่ สมุดบัญชีของชาวไร่ได้ มิติต้นทุน ไม่ใช่สมุดเล่มที่สอง: ห้าคอลัมน์บนทุกบรรทัดบัญชี (centre_id · cost_class · alloc_id · qty · qty_unit) บนทะเบียน CostCentre ที่ระบบสร้างเอง — ทั้งไร่ → แปลง → รอบปลูก → อ้อยรุ่น พร้อมส่วนที่มาเกาะคือสินทรัพย์และกองต้นทุน และไม่มีการซ้อนชั้นที่ชาวไร่กำหนดเอง CropCycle (การปลูกหนึ่งครั้งพร้อมอ้อยตอ) เป็นหน่วยของผลตอบแทนและถือสินทรัพย์ต้นทุนก่อตั้ง ซึ่งบันทึกเป็นสินทรัพย์เมื่อมีรายได้ครั้งแรก ตัดจำหน่ายตามหน่วยผลผลิต และด้อยค่าได้เฉพาะเมื่อมีสาเหตุและวันที่ระบุ การบันทึกหน้างานใช้การตัดสินใจสองครั้ง ไม่เกินสิบห้าวินาที ทำงานออฟไลน์ และเปิดได้จากสี่ประตูเข้าสู่แบบเดียวกัน ใบเสร็จถูกถ่ายเก็บเข้าคลังเอกสารของ PROP-048 และโทรศัพท์ปล่อยไฟล์ออกเมื่อคลาวด์ยืนยันแล้วเท่านั้น ชิ้นงานแปดชิ้น S-1…S-8 คำนวณจากบรรทัดที่ลงบัญชีแล้วเท่านั้น และแสดงความไม่แน่นอนของตัวเองทุกชิ้น การบันทึก หลักฐาน และ S-1/S-2/S-3/S-4/S-6 อยู่ในสิทธิพื้นฐานของชาวไร่ ฟรีถาวร ส่วน S-5/S-7/S-8 เป็นรุ่นวิเคราะห์ ที่ดินของตนเองไม่คิดค่าเช่าโดยอนุมาน และแรงงานครอบครัวปิดไว้เป็นค่าตั้งต้น บรรทัดสุดท้ายจึงเรียกว่า ผลตอบแทนต่อที่ดินและแรงงานตนเอง FR-267…312 · NFR-87…106 · WF-96…111 และ CropExpense ของ PROP-048 ถูกถอนออกจากการเป็นที่เก็บข้อมูล กลายเป็นแบบบันทึกที่ลงรายการบัญชี ฝั่งผู้ให้ยืม (Rev 0.2) หัวหน้าโควต้าและหัวตันเป็นทั้งผู้กู้และผู้ให้ยืม จึงมีชนิดศูนย์เพิ่มอีกสอง — network และ borrower — เป็นกิ่งที่สองใต้ศูนย์ระดับไร่เดียวกัน พร้อมประเภทต้นทุนที่เจ็ด network_lending แถวผังบัญชี 1160/1161 · 2160 · 4210/4220 · 5710/5720/5730 AdvanceEarmark (เงินไปลงแปลงไหน เข้าถึงได้ผ่านนามแฝงรายคู่สัญญาเท่านั้น) และ BorrowerPosition ที่กระทบยอดกับบัญชีคุมได้ตรงพอดีและพิมพ์บรรทัดนั้นบน S-9 ชิ้นงาน S-9 สมุดบัญชีเครือข่าย · S-10 แผนที่เงินลงแปลง · S-11 งบกำไรขาดทุนเครือข่าย ไม่มีกฎการปันส่วนใดข้ามระหว่างกิ่งไร่กับกิ่งเครือข่าย และหัวหน้าโควต้าหรือหัวตันไม่เคยอ่านสมุดต้นทุนของลูกไร่ — เขาเห็นสิ่งที่เขาให้ทุนและผลการส่งมอบของมัน ไม่เคยเห็นกำไร โครงสร้างต้นทุน หรือตำแหน่งเทียบกลุ่ม (OQ-12)

12. NetworkInvitation — the invitation object (PROP-070)12. NetworkInvitation — วัตถุคำเชิญ (PROP-070)

Applied 2026-08-06 as spec v0.53.0. The quota farmer could invite a sub-farmer by phone number and the graph produced a proposed Membership — never an artifact anyone could hand over. NetworkInvitation is that artifact, and it is the SECOND cell of A-91: the admission that offers a record and a steward. It is deliberately not a variant of the operator-issued Invitation, which admits a capacity (FR-70).

apply 2026-08-06 เป็น spec v0.53.0 เดิมหัวหน้าโควตาเชิญลูกไร่ด้วยเบอร์โทรได้ และ graph ให้ผลเป็น Membership ที่เสนอไว้ ไม่ใช่สิ่งที่ส่งต่อได้ NetworkInvitation คือสิ่งนั้น และเป็นเซลล์ที่สองของ A-91: การรับเข้าที่ยื่นระเบียนและผู้ดูแล ตั้งใจไม่ให้เป็นชนิดย่อยของ Invitation ของผู้ดำเนินการ ซึ่งรับเข้า capacity (FR-70)

AttributeคุณลักษณะType / valuesชนิดหรือค่าNoteหมายเหตุ
invitation_idNIV-########PKคีย์หลัก
issued_by_tenant_id→ TenantThe steward who issues itผู้ดูแลที่ออกคำเชิญ
issuer_capacityquota | lead | millDecides who is named as steward and what the record holds — never the sequence of acts (FR-433)ตัดสินว่าใครถูกระบุเป็นผู้ดูแลและระเบียนมีอะไร ไม่เคยตัดสินลำดับการกระทำ
target_farmer_id?→ FarmerNull in mode 1. Set in mode 2, where writing the row sets registration_status = invitedว่างในแบบที่ 1 · แบบที่ 2 ตั้ง registration_status = invited
target_phone_e164textPDPA personal; disclosed to nobody but the issuer who typed itPDPA personal ไม่เปิดเผยแก่ใครนอกจากผู้ออกที่พิมพ์เอง
carrierlink | qr | sms | in_personONE token, several carriersโทเคนเดียว หลายพาหะ
token_hashbytea, UNIQUESingle-use, spent on the landing; the token itself is never storedใช้ครั้งเดียว ถูกใช้ที่หน้าเปิด ไม่เก็บตัวโทเคน
expires_attimestamptzFourteen published days; re-issue is unlimited and is a NEW row14 วันตามที่ประกาศ ออกใหม่ไม่จำกัดและเป็นแถวใหม่
statusissued | opened | accepted | declined | expired | revokedAppend-onlyเพิ่มอย่างเดียว
accepted_person_id? · accepted_at?→ Person · timestamptzWritten in the same transaction as the claim (WF-133)เขียนในทรานแซกชันเดียวกับการรับระเบียน

Persistence profile. Table network_invitation, PK invitation_id; unique token_hash plus a partial unique on target_farmer_id where status is issued or opened, which is how "a record is bound to at most one live invitation" becomes a schema fact rather than a screen rule; indexes on the target number, on (issuer, status) and on expires_at for live rows; mutability append_only; PDPA personal; aggregate root NetworkInvitation, deliberately outside every tenant root so issuing or revoking never locks a steward's farmer records. Authority rule 6 is satisfied in this change set.

Profile ทางกายภาพ ตาราง network_invitation · PK invitation_id · unique token_hash และ partial unique บน target_farmer_id เมื่อสถานะเป็น issued หรือ opened ทำให้ "หนึ่งระเบียนมีคำเชิญที่ยังมีชีวิตได้ใบเดียว" เป็นข้อเท็จจริงของโครงสร้าง · ดัชนีบนเบอร์ปลายทาง (ผู้ออก สถานะ) และ expires_at · mutability append_only · PDPA personal · aggregate root NetworkInvitation อยู่นอก root ของ tenant ทุกตัว ครบตามกฎอำนาจข้อ 6 ในชุดการเปลี่ยนแปลงเดียวกัน

13. The quota account — the durable relationship (PROP-085)13. โควตา — ความสัมพันธ์ที่คงอยู่ (PROP-085)

Applied 2026-08-17 as spec v0.73.0 (PROP-085 approved & applied; nine questions client-decided 13 Aug 2026 and four more — OQ-8 · OQ-9 · OQ-10 · OQ-13 — on 17 Aug 2026). One applied unique key is retired and one applied entity is renamed. quota(farmer_id, season_id, mill_id) permitted exactly one row per farmer per factory per season, which forbade the client's stated practice: a quota farmer holds SEVERAL accounts at one factory and more at others, each with its own factory-issued number, dossier, banking details and factory credit. The durable entity is now Quota — the account — and the applied per-season row is renamed QuotaAgreement, keyed (quota_id, season_id). Every applied quota_id foreign key keeps its name and now points at the account (A-105 R-QUOTA).

apply 2026-08-17 เป็น spec v0.73.0 (PROP-085 ลูกค้าตัดสินเก้าข้อเมื่อ 13 ส.ค. 2569 และอีกสี่ข้อเมื่อ 17 ส.ค. 2569) ถอนคีย์ไม่ซ้ำที่ apply แล้วหนึ่งชุด และเปลี่ยนชื่อเอนทิตีหนึ่งตัว คีย์ quota(farmer_id, season_id, mill_id) อนุญาตหนึ่งแถวต่อชาวไร่ต่อโรงงานต่อฤดู ซึ่งห้ามแนวปฏิบัติที่ลูกค้าระบุ คือหัวหน้าโควตาถือหลายบัญชีที่โรงงานเดียวและมีอีกหลายบัญชีที่โรงงานอื่น แต่ละบัญชีมีเลขของโรงงาน ชุดเอกสาร รายละเอียดธนาคาร และสินเชื่อของตัวเอง เอนทิตีที่คงอยู่จึงเป็น Quota คือบัญชี ส่วนแถวรายฤดูที่ apply แล้วเปลี่ยนชื่อเป็น QuotaAgreement คีย์ (quota_id, season_id) foreign key quota_id ทุกตัวคงชื่อเดิมและชี้ไปที่บัญชี

EntityEntityKeys · uniques · indexesคีย์ · ไม่ซ้ำ · ดัชนีMutability · PDPAการแก้ไข · PDPAAggregate · what it holdsAggregate · ถืออะไร
Quota
QTA-########
pk quota_id · fk mill_id, holder_tenant_id, holder_farmer_id, named_holder_person_id, holder_department_id, supersedes_quota_id · unique (mill_id, quota_no) partial WHERE quota_no IS NOT NULL · idx (holder_tenant_id, status), (mill_id, status), (named_holder_citizen_id_hash)mutable · personalQuota — the factory's number as issued (text, leading zeros significant, 4–7 digits today, no width declared), quota_label, the named holder in parts, the address as PROP-047 codes, the contact number, the factory's own contract certificate, quota_kind (own | family | group_member | transfer_station | institution) and status (declared | active | dormant | closed). The row is owned by the ISSUING factory's tenant so a factory may hold an account for a grower who is not on the platform; the holder reads it through the applied X2 mechanism.Quota — เลขของโรงงานตามที่ออกให้ (ข้อความ ศูนย์นำหน้ามีความหมาย วันนี้ 4–7 หลัก ไม่ประกาศความกว้าง) ป้ายชื่อของโรงงาน ชื่อผู้ถือเป็นส่วน ๆ ที่อยู่เป็นรหัสตาม PROP-047 เบอร์ติดต่อ หนังสือรับรองสัญญาของโรงงานเอง ชนิดบัญชี และสถานะ แถวเป็นของ tenant โรงงานผู้ออกเลข ผู้ถืออ่านผ่านกลไก X2
QuotaAgreement
renamedเปลี่ยนชื่อ
pk agreement_id · fk quota_id → Quota, season_id, mill_id · unique (quota_id, season_id) · idx (season_id, mill_id), (mill_id, season_id, status)mutable · operationalOne account's committed and delivered tonnage for ONE season — never the relationship itself. farmer_id is RETIRED (the holder moved up to the account, where it has a dated history); mill_id survives as a stored derived column with a CHECK against the account, because FR-72/FR-73, the season indexes and the read models all name it.ปริมาณตามสัญญาและที่ส่งแล้วของบัญชีหนึ่งในหนึ่งฤดู ไม่ใช่ตัวความสัมพันธ์ ถอน farmer_id เพราะผู้ถือย้ายขึ้นไปอยู่บนบัญชีซึ่งมีประวัติรองรับ ส่วน mill_id คงไว้เป็นคอลัมน์อนุพัทธ์ที่เก็บพร้อม CHECK
QuotaHolderPeriodpk period_id · fk quota_id, holder_tenant_id, recorded_by · unique (quota_id) partial WHERE to_date IS NULL · idx (holder_tenant_id, from_date)append_only · personalWho held the account, and when. cause: opened | claimed | transferred | inherited | corrected | closed, with reason mandatory on every cause except opened. This is what keeps a settled payment attributable to the holder OF THE DAY — a mutable pointer returns the PRESENT holder, silently wrong (the PROP-052 lesson). The regulation's own succession rule has the same shape: season-bounded, evidence-backed, notified (ข้อ 19, ข้อ 20, ข้อ 21, ข้อ 23).ใครถือบัญชีและช่วงใด cause ตามรายการ และ reason บังคับทุกกรณียกเว้น opened นี่คือสิ่งที่ทำให้การจ่ายที่ยุติแล้วยังอ้างถึงผู้ถือในวันนั้นได้ ตัวชี้ที่แก้ได้จะคืนผู้ถือปัจจุบันซึ่งผิดอย่างเงียบ ๆ
QuotaDocumentpk link_id · fk quota_id, document_id → Document, attached_by · unique (quota_id, document_id) · idx (document_id)append_only · consent_gatedA LINK, not a second store: the applied document_vault already holds บัตรประชาชน, บัตรชาวไร่, บัตรสมาคมชาวไร่, หนังสือสัญญา and land documents with encryption, page-level read audit and retention (NFR-75). doc_role names what each is for. The required set is the FACTORY's own (FR-112); the platform declares no minimum.เป็นตัวเชื่อม ไม่ใช่คลังที่สอง คลัง document_vault ที่ apply แล้วเก็บเอกสารเหล่านี้พร้อมการเข้ารหัส บันทึกการอ่านระดับหน้า และการเก็บรักษาอยู่แล้ว ชุดที่บังคับเป็นของโรงงานเอง แพลตฟอร์มไม่ประกาศขั้นต่ำ

Consistency boundary (dataModeling.aggregates): the ACCOUNT is the root — Quota · QuotaAgreement · QuotaHolderPeriod · QuotaDocument · PayeeAssignment commit together, which is where "exactly one open holder period" and "exactly one active assignment per rank" hold. Recording a holder change never locks a settlement run. PayeeAccount and QuotaGroup are separate roots homed in SPEC-ERD-MILL. Requirements FR-446…FR-461, FR-474, FR-475; workflows WF-138…WF-143; check V-21.ขอบเขตความสอดคล้อง บัญชีเป็นราก โดย Quota · QuotaAgreement · QuotaHolderPeriod · QuotaDocument · PayeeAssignment commit ด้วยกัน ซึ่งเป็นที่ที่ค่าคงที่สองข้อยึดอยู่ การบันทึกการเปลี่ยนผู้ถือไม่ล็อกรอบการจ่าย ส่วน PayeeAccount และ QuotaGroup เป็นรากแยกที่ home ใน SPEC-ERD-MILL

14. The onward basis, declared and versioned (PROP-090 RelayDeclaration)14. ฐานการส่งต่อ ประกาศไว้และมีเวอร์ชัน (PROP-090 RelayDeclaration)

Applied 2026-08-17 as spec v0.74.0. OnwardPremiumSettlement recorded what a quota head paid a sub-farmer and deliberately hid the mill's headline terms, so the head may keep a margin. That may be entirely proper — he carries the contract, the volume risk and often the credit — but the platform neither said it was proper nor gave the sub-farmer the one thing that makes it fair: the basis he was promised, in writing, before the season. RelayDeclaration is that record (A-109 R-RELAYHONEST, FR-471).

apply 2026-08-17 เป็น spec v0.74.0 OnwardPremiumSettlement บันทึกสิ่งที่หัวหน้าโควตาจ่ายลูกไร่ และซ่อนเงื่อนไขหลักของโรงงานไว้โดยเจตนา หัวหน้าโควตาจึงเก็บส่วนต่างได้ ซึ่งอาจชอบธรรมเต็มที่ เพราะเขารับสัญญา รับความเสี่ยงเรื่องปริมาณ และมักรับภาระสินเชื่อ แต่แพลตฟอร์มไม่ได้บอกว่าชอบธรรม และไม่ได้ให้สิ่งเดียวที่ทำให้เป็นธรรมแก่ลูกไร่ คือฐานที่ถูกสัญญาไว้เป็นลายลักษณ์อักษรก่อนเริ่มฤดู RelayDeclaration คือระเบียนนั้น (A-109 R-RELAYHONEST FR-471)

EntityEntityKeys · uniques · indexesคีย์ · ไม่ซ้ำ · ดัชนีMutability · PDPA · aggregateการแก้ไข · PDPA · aggregateWhat it holdsถืออะไร
RelayDeclarationpk declaration_id · fk head_tenant_id, sub_farmer_id, season_id, supersedes_id · unique (head_tenant_id, sub_farmer_id, season_id, version_no) · idx (sub_farmer_id, declared_on)append_only · personal · QuotaHeadscheme: mirror | flat_per_tonne | split, with its figure, declared BEFORE the season. Each change is a new version and a settlement names the version it was paid under, so a payment can never be read against terms published after it. acknowledged_at stores that this person saw this version on this date and stores nothing else; acknowledgement_text_ref pins the exact words shown, so the record cannot later be read as a consent it did not collect, and the words travel with the row into any export. The mill's headline terms travel nowhere.scheme ตามรายการ พร้อม figure ประกาศก่อนฤดู การเปลี่ยนแต่ละครั้งเป็นเวอร์ชันใหม่ และการจ่ายระบุเวอร์ชันที่จ่ายใต้มัน การจ่ายจึงถูกอ่านเทียบเงื่อนไขที่ประกาศภายหลังไม่ได้ acknowledged_at เก็บว่าบุคคลนี้เห็นเวอร์ชันนี้ในวันนี้ และไม่เก็บอย่างอื่น ส่วน acknowledgement_text_ref ตรึงถ้อยคำที่แสดงจริง เงื่อนไขหลักของโรงงานไม่เดินทางไปไหน

The platform records and displays; it does not enforce: it shows promised against paid and never auto-debits, withholds or nets a shortfall — enforcement is a contract between the head and his grower, and the platform did not sign it (PROP-049 and legal review). OnwardPremiumSettlement gains declared_scheme_ref, required, naming the VERSION. The draft homed this row in a document called SPEC-ERD-FARM, which does not exist; the onward leg is owned by the quota perspective, so it homes here — recorded in the PROP-090 apply receipt rather than silently changed.แพลตฟอร์มบันทึกและแสดง ไม่บังคับ แสดงที่สัญญาไว้เทียบที่จ่ายจริง และไม่หักเงิน ไม่กันเงิน ไม่หักกลบยอดขาดโดยอัตโนมัติ การบังคับเป็นสัญญาระหว่างหัวหน้าโควตากับลูกไร่ ซึ่งแพลตฟอร์มไม่ได้ลงนาม OnwardPremiumSettlement เพิ่ม declared_scheme_ref แบบบังคับ ซึ่งระบุเวอร์ชัน ร่างระบุบ้านของแถวนี้ว่า SPEC-ERD-FARM ซึ่งไม่มีอยู่จริง ขาส่งต่อเป็นของมุมมองโควตา จึง home ที่นี่ และบันทึกไว้ในใบรับการ apply

15. Related documents15. เอกสารที่เกี่ยวข้อง

16. Revision history16. ประวัติการแก้ไข

RevฉบับDateวันที่Changesการเปลี่ยนแปลง
1.02026-07-07Initial version — PROP-002 Proposal A (spec v3.0)ฉบับแรก — PROP-002 ข้อเสนอ A (spec (สเปก) v3.0)
1.12026-07-08PROP-005 (FED, spec v6.0): perspective re-keyed from customer group to capacity (document code unchanged); identity defers to the federation context (Person · Tenant · TenantCapacity · Membership); every *_tenant_type + *_tenant_id pair collapses to tenant_id.PROP-005 (FED, spec v6.0): มุมมองเปลี่ยนคีย์จากกลุ่มลูกค้าเป็น capacity (รหัสเอกสารคงเดิม); อัตลักษณ์อ้างอิงบริบท federation (Person · Tenant · TenantCapacity · Membership); คู่ *_tenant_type + *_tenant_id ทั้งหมดยุบเป็น tenant_id
1.22026-07-09PROP-009 (STR, spec v8.0): the quota farmer owns OnwardPremiumSettlement (the cash-on-receipt relay to sub-farmers) and shares StrategicAgreement / PremiumAccrual / PremiumRelease with the mill; joins the strategic_pricing context (WF-31 · WF-34 · WF-35). The premium is confidential and never a PaymentItem component (NFR-21).PROP-009 (STR, spec v8.0): หัวหน้าโควต้าเป็นเจ้าของ OnwardPremiumSettlement (การส่งต่อจ่ายสดตามใบส่งมอบสู่ลูกไร่) และใช้ร่วม StrategicAgreement / PremiumAccrual / PremiumRelease กับโรงงาน; เข้าร่วมบริบท strategic_pricing (WF-31 · WF-34 · WF-35) เงินเพิ่มเป็นความลับและไม่เป็นส่วนหนึ่งของ PaymentItem (NFR-21)
1.32026-07-09PROP-010 (GL, spec v9.0): the quota farmer keeps full books — shares LedgerAccount / JournalEntry / ChartTemplate / Invoice / Receipt / PaymentVoucher / CashAccount / BankTransaction / Reconciliation / FiscalPeriod / FinancialStatement; joins books/receivables/cash_management (WF-36…41). Cane receivable from the mill, payables to sub-farmers, เงินเกี๊ยว lent/borrowed and the onward-relay expense auto-post; statements shared to a bank only via ConsentGrant scope books (NFR-24…26).PROP-010 (GL, spec v9.0): หัวหน้าโควต้ามี books เต็มรูปแบบ — ใช้ร่วม LedgerAccount / JournalEntry / ChartTemplate / Invoice / Receipt / PaymentVoucher / CashAccount / BankTransaction / Reconciliation / FiscalPeriod / FinancialStatement; เข้าร่วม books/receivables/cash_management (WF-36…41) ลูกหนี้ค่าอ้อยจากโรงงาน เจ้าหนี้ต่อลูกไร่ เงินเกี๊ยวที่ปล่อย/กู้ และค่าส่งต่อลงอัตโนมัติ; แบ่งงบให้ธนาคารผ่าน ConsentGrant scope books (NFR-24…26)
1.42026-07-10PROP-012 (settlement & CCS-by-re-note correction, spec v10.0): consistent with the master — the quota farmer sees network tonnage instantly at weigh-out and CCS online once the government (สอน.) re-note is ingested & auto-matched; settlement is the statutory two-installment schedule on the initial price with a season-end final-price true-up.PROP-012 (แก้การจ่ายเงินและ CCS จากรีโน้ต, spec v10.0): สอดคล้องกับแม่บท — หัวหน้าโควต้าเห็นน้ำหนักเครือข่ายทันทีตอนชั่งออก และ CCS ออนไลน์เมื่อนำเข้ารีโน้ตของรัฐ (สอน.) และจับคู่อัตโนมัติ; การจ่ายเป็นสองงวดตามกฎหมายบนราคาขั้นต้นพร้อมสรุปราคาสุดท้ายปลายฤดู
1.52026-07-10PROP-011 (GL, spec v12.0): the quota farmer shares BooksProfile — default unified edition + accrual basis, upgradeable to split via the books_split entitlement; packaging over the same ledger (NFR-32).PROP-011 (GL, spec v12.0): หัวหน้าโควต้าใช้ร่วม BooksProfile — ตั้งต้นรุ่น unified เกณฑ์คงค้าง อัปเกรดเป็น split ผ่านสิทธิ์ books_split; เป็นการจัดแพ็กเกจบนบัญชีเดียวกัน (NFR-32)
0.1.02026-07-11PROP-014 (spec v0.1.0): semantic versioning restarted at 0.1.0 (was Rev 1.5 · 2026-07-10); docnav updated for the gov_cluster split — GOV re-homed to docs/gov/ocsb/, new BOARD (กอน.) sibling added.PROP-014 (spec v0.1.0): รีสตาร์ท semantic versioning ที่ 0.1.0 (เดิม Rev 1.5 · 2026-07-10); ปรับ docnav ตามการแยก gov_cluster — ย้าย GOV ไป docs/gov/ocsb/ เพิ่มพี่น้อง BOARD (กอน.)
0.3.02026-07-12PROP-017 (spec v0.3.0): renamed to the canonical Quota Farmer / หัวหน้าโควต้า throughout (retiring “quota farmer”); added Section 6 Quota Farmer depth — quota sub-allocation, the organization (co-op) variant, and the representative-mill destination (Quota.mill_id, PROP-006).PROP-017 (spec v0.3.0): เปลี่ยนชื่อเป็นทางการ Quota Farmer / หัวหน้าโควต้า ทั้งฉบับ (เลิก “quota farmer”); เพิ่ม Section 6 รายละเอียดเชิงลึก — การจัดสรรโควตาย่อย แบบองค์กร (สหกรณ์) และโรงงานตัวแทนปลายทาง (Quota.mill_id, PROP-006)
0.4.02026-07-13PROP-018 (spec v0.4.0): comprehensive perspective data modeling — scoped entity-relationship diagrams (Fig. 1–2), column-level persistence profiles for the 7 home entities (Section 8), keys / indexes / mutability & PDPA classes (Section 9) and aggregate consistency boundaries (Section 10) — all rendered from the graph's new dataModeling block.PROP-018 (spec v0.4.0): การ model ข้อมูลรายมุมมองฉบับครบ — แผนภาพความสัมพันธ์ entity เฉพาะมุมมอง (ภาพที่ 1–2), persistence profile ระดับ column ของ entity ที่ home อยู่ฉบับนี้ 7 รายการ (ข้อ 8), key / index / ชั้น mutability และ PDPA (ข้อ 9) และขอบเขตความสอดคล้องของ aggregate (ข้อ 10) ทั้งหมด render จาก block ใหม่ dataModeling ใน graph
0.5.02026-07-25PROP-048 (spec v0.26.0): new Section 11 — the field_partnership context (ProductivityPartnership · PartnershipLine · ProgramEnrollment · IdentityDisclosure), the FieldAlias mapping that lives only on this side, and the derived FieldCapabilityProfile / CropValueEstimate pair. Wall rules W-1…W-7 and NFR-70…74 bind every read.PROP-048 (spec v0.26.0): เพิ่มข้อ 11 — context field_partnership (ProductivityPartnership · PartnershipLine · ProgramEnrollment · IdentityDisclosure) ตารางเทียบ FieldAlias ที่อยู่ฝั่งนี้เท่านั้น และคู่ค่าที่คำนวณ FieldCapabilityProfile / CropValueEstimate กติกา wall W-1…W-7 และ NFR-70…74 ผูกทุกการอ่าน
0.6.02026-07-27PROP-050 (spec v0.28.0, approved & applied 27 Jul 2026; all 26 OQs client-closed): cost centres to field & crop level — the cost dimension on the ledger, the crop cycle and its establishment asset, declared allocation, evidence in the cloud, the network lending branch, FR-267…312 / NFR-87…106 / WF-96…111PROP-050 (spec v0.28.0 อนุมัติและ apply 27 ก.ค. 2569; ปิดคำถามเปิดครบ 26 ข้อ): ศูนย์ต้นทุนถึงระดับแปลงและอ้อยรุ่น — มิติต้นทุนบนสมุดบัญชี รอบปลูกและสินทรัพย์ต้นทุนก่อตั้ง การปันส่วนที่ประกาศไว้ หลักฐานบนคลาวด์ กิ่งการให้ยืมของเครือข่าย FR-267…312 / NFR-87…106 / WF-96…111
0.7.02026-08-03PROP-073 (spec v0.47.0): one word — Tenant. Party → Tenant, party_id (and every prefixed form) → tenant_id, PartyCapacity/PartyQualification/PartyFounded → Tenant*, party context/switcher → tenant context/switcher, cross-party → cross-tenant, organisation → organization, and ผู้เล่น retired as the Thai gloss (the Latin word tenant instead, R-THAI). Hold list untouched: counterparty · third party · tripartite working group · Person*/person_id; display codes and token claims were held by R-NULL for one release and then MOVED at v0.47.1 on client decision (C-1), because no token has ever been SIGNED — no auth exists in the built ocsb/ocsf prototypes — and the only printed codes were eight fixture strings in apps/ocsf/fund-shell.jsx, swept in the same pass: PTY- → TNT-, TCA- → TCA-, TQL- → TQL-, claim tnt → tnt, claim dep → dep. Carried in the same pass: the PROP-075 rectification — the retired directory noun domain becomes department (A-82 R-ONETREE) and the dangling A-86/A-87/A-88 citations are re-pointed at the ids they were actually given, A-81/A-82/A-83.PROP-073 (spec v0.47.0): คำเดียว — Tenant Party → Tenant, party_id ทุกรูป → tenant_id, PartyCapacity/PartyQualification/PartyFounded → Tenant*, cross-party → cross-tenant และเลิกใช้ ผู้เล่น เป็นคำแทนวัตถุนี้ในภาษาไทย (ใช้คำละติน tenant ตาม R-THAI) รายการห้ามแตะไม่ถูกแตะ: คู่สัญญา · third party · คณะทำงานไตรภาคี · Person*/person_id รอบเดียวกันแก้ค้างจาก PROP-075: domain → department (A-82) และแก้การอ้าง A-86/A-87/A-88 ที่ไม่มีอยู่จริงเป็น A-81/A-82/A-83
0.7.32026-08-03PROP-073 PATCH 1–3 (spec v0.47.1 / v0.47.2 / v0.47.3 as applicable): the identifiers v0.47.0 had held, moved on client decision. PTY-######## → TNT-######## · PCA-######## → TCA-######## · PQL-######## → TQL-######## · token claim pty → tnt · token claim dom → dep (v0.47.1, C-1 — R-NULL had held them as a stored VALUE and a wire format; reversed because no token has ever been signed and the only printed codes were fixture strings). quota_org_officer → quota_officer · lead_org_officer → lead_officer (v0.47.2, C-2 — org is organization abbreviated, not a resemblance). The retired role LABEL swept as a phrase family and quota organization naming the tenant → quota group / กลุ่มโควตา (v0.47.3). All retired forms are in the FR-396 crosswalk and refused in new text by NFR-142.PROP-073 PATCH 1–3 (spec v0.47.1 / v0.47.2 / v0.47.3 ตามที่เกี่ยวข้อง): ตัวระบุที่ v0.47.0 คงไว้ ถูกย้ายตามการตัดสินของลูกค้า PTY- → TNT- · PCA- → TCA- · PQL- → TQL- · claim pty → tnt · claim dom → dep (v0.47.1, C-1) · quota_org_officer → quota_officer · lead_org_officer → lead_officer (v0.47.2, C-2) · ป้ายชื่อบทบาทที่เลิกใช้และ องค์กรโควตา ที่เรียก tenant → กลุ่มโควตา (v0.47.3) ทุกรูปที่เลิกใช้อยู่ในตารางแปลง FR-396
0.8.02026-08-06PROP-070 approved & applied — spec v0.53.0. New entity NetworkInvitation homed here with its physical profile and aggregate root (authority rule 6): single-use token_hash, a partial unique giving a record at most ONE live invitation, PDPA personal, append-only. Farmer.registration_status = invited finally has a producer (FR-417), and the steward set widens to quota · lead · mill (FR-419).PROP-070 อนุมัติและ apply — spec v0.53.0 เอนทิตีใหม่ NetworkInvitation บ้านอยู่ที่นี่ พร้อม profile และ aggregate root: token_hash ใช้ครั้งเดียว · unique บางส่วนให้หนึ่งระเบียนมีคำเชิญที่ยังมีชีวิตได้ใบเดียว · PDPA personal · เพิ่มอย่างเดียว และ Farmer.registration_status = invited มีผู้ผลิตค่าแล้ว
0.9.02026-08-07PROP-078 approved & applied — spec v0.54.0. Farmer.name is RETIRED (OQ-1, decided by the client): a human name on a record that is not a human, inherited from the pre-PROP-005 farmer/user keys. The name parts, the prefix and the nickname live on Person, once — and a steward recording a capacity for an unonboarded man writes them onto the person row FOUNDED with the representative tenant (WF-01 step 4), which the workflow now says in words instead of leaving it to be inferred from a cardinality.PROP-078 อนุมัติและ apply — spec v0.54.0 Farmer.name ยกเลิก (ลูกค้าตัดสิน OQ-1): เป็นชื่อคนบนระเบียนที่ไม่ใช่คน ตกทอดจากคีย์ farmer/user ก่อน PROP-005 ส่วนย่อยของชื่อ คำนำหน้า และชื่อเล่นอยู่บน Person ที่เดียว — และผู้ดูแลที่บันทึก capacity แทนคนที่ยังไม่ได้สมัคร เขียนลงในแถวบุคคลที่ถูกก่อตั้งพร้อม tenant ตัวแทน (WF-01 ขั้นที่ 4) ซึ่งตอนนี้ workflow เขียนไว้เป็นคำ ไม่ปล่อยให้อนุมานจาก cardinality
0.10.02026-08-17The quota account — spec v0.73.0 (PROP-085 approved & applied 17 Aug 2026). The applied unique (farmer_id, season_id, mill_id) is RETIRED and the applied Quota row is renamed QuotaAgreement keyed (quota_id, season_id); the durable factory-issued account enters as Quota with QuotaHolderPeriod and QuotaDocument, all four homed here with physical profiles and one aggregate (authority rule 6). New Section 13.โควตา — spec v0.73.0 (PROP-085 อนุมัติและ apply 17 ส.ค. 2569) ถอนคีย์ไม่ซ้ำ (farmer_id, season_id, mill_id) และเปลี่ยนชื่อแถว Quota เป็น QuotaAgreement คีย์ (quota_id, season_id) บัญชีที่โรงงานออกเลขให้เข้ามาเป็น Quota พร้อม QuotaHolderPeriod และ QuotaDocument ทั้งสี่ home ที่นี่พร้อมโปรไฟล์เชิงกายภาพและหนึ่ง aggregate เพิ่มข้อ 13
0.11.02026-08-17The onward basis, declared and versioned — spec v0.74.0 (PROP-090 approved & applied 17 Aug 2026). RelayDeclaration homes here with its physical profile and the QuotaHead aggregate; OnwardPremiumSettlement gains the required declared_scheme_ref. The draft named a home document that does not exist (SPEC-ERD-FARM); the onward leg belongs to this perspective. New Section 14.ฐานการส่งต่อ ประกาศไว้และมีเวอร์ชัน — spec v0.74.0 (PROP-090 อนุมัติและ apply 17 ส.ค. 2569) RelayDeclaration home ที่นี่พร้อมโปรไฟล์เชิงกายภาพและ aggregate QuotaHead ส่วน OnwardPremiumSettlement เพิ่ม declared_scheme_ref แบบบังคับ ร่างระบุบ้านเป็น SPEC-ERD-FARM ซึ่งไม่มีอยู่ ขาส่งต่อเป็นของมุมมองนี้ เพิ่มข้อ 14