Cane Agency · ERD Seriesสถาบันอ้อย · ชุดเอกสาร ERD
This is the Lead Farmer (CFL) entity perspective. The tier owns exactly two entities — LeadMandate and NetworkAllocation, both in the new lead_network context — and amends one, Farmer. Everything else the lead farmer touches he shares with the CFQ and CFC families; nothing was forked. The normative model is the graph (entities, relationships, dataModeling.entities).
นี่คือมุมมอง entity ของ หัวตัน (CFL) ชั้นนี้เป็นเจ้าของ entity สองตัวพอดี — LeadMandate และ NetworkAllocation ทั้งคู่อยู่ใน context ใหม่ lead_network — และแก้ไขอีกหนึ่งตัวคือ Farmer สิ่งอื่นที่หัวตันใช้งาน เขาใช้ร่วมกับตระกูล CFQ และ CFC ไม่มีการแยกสายข้อมูล model เชิงบรรทัดฐานอยู่ใน graph (entities, relationships, dataModeling.entities)
| Attributeattribute | Typeชนิด | Noteหมายเหตุ |
|---|---|---|
| mandate_id | text (pk) | MND-###### code formatรูปรหัส MND-###### |
| quota_farmer_tenant_id | uuid → Tenant | The appointing quota farmerหัวหน้าโควต้าผู้แต่งตั้ง |
| lead_tenant_id | uuid → Tenant | The appointed lead farmerหัวตันที่ได้รับแต่งตั้ง |
| season_id | uuid → Season | Season-scoped; ending never re-keys historyผูกกับฤดู การสิ้นสุดไม่เปลี่ยน key ของประวัติ |
| status | text (enum) | proposed | active | ended | terminated | declinedproposed | active | ended | terminated | declined |
| scope_note? | text | What the mandate covers in plain wordsขอบเขตของคำแต่งตั้งเป็นถ้อยคำธรรมดา |
| max_members? | smallint | Cap on network size, if agreedเพดานจำนวนสมาชิก หากตกลงกัน |
| max_tonnage_t? | numeric(12,3) | Cap on the block, if agreedเพดานปริมาณของก้อน หากตกลงกัน |
| passthrough_kinds | text[] | What may be passed through: credit · inputs · machinery · advisory · harvesting · transportสิ่งที่ส่งต่อได้: สินเชื่อ · ปัจจัยการผลิต · เครื่องจักร · คำแนะนำ · การตัด · การขนส่ง |
| credit_cap_baht? | numeric(12,2) | Second-hop credit ceiling, baht 2-dp per A-43เพดานสินเชื่อช่วงที่สอง บาททศนิยม 2 ตำแหน่งตาม A-43 |
| proposed_by | uuid → Membership | Either side may propose (P-8)ฝ่ายใดฝ่ายหนึ่งเสนอได้ (P-8) |
| proposed_at / activated_at? / ends_on? / terminated_at? | timestamptz / date | Activation is the binding act (P-4)การมีผลคือจังหวะที่ผูกพัน (P-4) |
| termination_reason? / note? | text | Recorded, never inferredบันทึกไว้ ไม่ใช่การอนุมาน |
Two-tier cap. Validated inside this aggregate on every transition: reject if lead_tenant_id belongs to a farmer whose lead_farmer_id is set, and reject if any member of that lead's network already holds an active mandate. This is the whole of P-2 — there is no depth setting anywhere in the model (NFR-81).
เพดานสองชั้น ตรวจสอบภายใน aggregate นี้ทุกการเปลี่ยนสถานะ: ปฏิเสธถ้า lead_tenant_id เป็นของชาวไร่ที่มี lead_farmer_id อยู่แล้ว และปฏิเสธถ้าสมาชิกในเครือข่ายของหัวตันรายนั้นถือคำแต่งตั้งที่ active อยู่ นี่คือทั้งหมดของ P-2 — ไม่มีค่าตั้งค่าความลึกที่ใดใน model (NFR-81)
| Attributeattribute | Typeชนิด | Noteหมายเหตุ |
|---|---|---|
| allocation_id | text (pk) | NAL-####### code formatรูปรหัส NAL-####### |
| season_id | uuid → Season | One planning frame per seasonกรอบการวางแผนหนึ่งชุดต่อฤดู |
| tier | text (enum) | quota_to_lead | quota_to_grower | lead_to_growerquota_to_lead | quota_to_grower | lead_to_grower |
| quota_id | uuid → Quota | Every allocation at every tier resolves to exactly ONE quota anchor — this is what keeps delivery unambiguous when a lead holds several mandatesการจัดสรรทุกชั้นชี้ไปยังจุดยึดโควตาเดียวพอดี — สิ่งนี้ทำให้การส่งมอบไม่กำกวมเมื่อหัวตันถือคำแต่งตั้งหลายฉบับ |
| grantor_tenant_id / grantee_tenant_id | uuid → Tenant | Who allocated to whomใครจัดสรรให้ใคร |
| mandate_id? | text → LeadMandate | Set on lead-tier rows; null on a quota→grower rowมีค่าในแถวชั้นหัวตัน; ว่างในแถว quota→grower |
| allocated_t | numeric(12,3) | Tonnesตัน |
| revision_no | smallint | 1 on issue; +1 per revisionเริ่มที่ 1 และ +1 ต่อการแก้ไขหนึ่งครั้ง |
| effective_from / superseded_at? | date / timestamptz | Append-only: a revision supersedes exactly one earlier rowappend-only: การแก้ไขแทนที่แถวเดิมหนึ่งแถวพอดี |
| reason? | text | MANDATORY on any revisionบังคับเมื่อมีการแก้ไข |
| created_by / created_at | uuid → Membership / timestamptz | Who wrote the figureใครเป็นผู้เขียนตัวเลข |
| Entityentity | Changeการเปลี่ยนแปลง | Ruleกติกา |
|---|---|---|
| Farmer | farmer_kind gains lead_farmer; new lead_farmer_id? | quota_farmer_id keeps naming the quota anchor at BOTH depths, so the money path is unchanged (P-3). CHECK: a farmer with lead_farmer_id set may not be the lead tenant of an active mandate. Access is NEVER gated on these fields (OQ-1).quota_farmer_id ยังระบุจุดยึดโควตาทั้งสองชั้น เส้นทางเงินจึงไม่เปลี่ยน (P-3) CHECK: ชาวไร่ที่มี lead_farmer_id เป็นหัวตันของคำแต่งตั้งที่ active ไม่ได้ และการให้สิทธิ์เข้าถึงไม่ผูกกับ field เหล่านี้เลย (OQ-1) |
| Edgeเส้น | Cardinalityพหุภาพ | Ruleกติกา |
|---|---|---|
| LeadMandate → Tenant | * — 1 | One quota-farmer tenant and one lead tenant per mandate; a lead may hold several concurrent mandates (OQ-4), a quota farmer many leadsหนึ่ง tenant หัวหน้าโควต้าและหนึ่ง tenant หัวตันต่อคำแต่งตั้ง; หัวตันถือหลายฉบับพร้อมกันได้ (OQ-4) หัวหน้าโควต้ามีหัวตันได้หลายราย |
| Farmer → LeadMandate | * — 0..1 | A grower sits in at most one lead network per seasonลูกไร่อยู่ในเครือข่ายหัวตันได้ไม่เกินหนึ่งเครือข่ายต่อฤดู |
| NetworkAllocation → Quota | * — 1 | Exactly one anchor per allocation, at every tierจุดยึดหนึ่งเดียวต่อการจัดสรร ทุกชั้น |
| NetworkAllocation → NetworkAllocation | 1 — 0..1 | A revision supersedes exactly one earlier row by revision_noการแก้ไขแทนที่แถวเดิมหนึ่งแถวตาม revision_no |
| NetworkAllocation → LeadMandate | * — 0..1 | Lead-tier rows cite their mandateแถวชั้นหัวตันอ้างถึงคำแต่งตั้งของตน |
| CreditLine → LeadMandate | * — 0..1 | A second-hop line may cite the mandate that authorized it; the obligation still binds only its two signatories and never moves (P-9)วงเงินช่วงที่สองอ้างถึงคำแต่งตั้งที่อนุญาตได้; ภาระยังผูกเฉพาะสองฝ่ายที่ลงนามและไม่ย้าย (P-9) |
| Tableตาราง | Keys & indexesกุญแจและ index | Mutability · PDPAความเปลี่ยนแปลง · PDPA |
|---|---|---|
| lead_mandate | pk mandate_id · unique (quota_farmer_tenant_id, lead_tenant_id, season_id) · idx (lead_tenant_id, status), (quota_farmer_tenant_id, status), (season_id) | immutable_after_state · confidential_wall — terms are private in both directions (NFR-82)immutable_after_state · confidential_wall — เงื่อนไขเป็นความลับทั้งสองทาง (NFR-82) |
| network_allocation | pk allocation_id · unique (grantor_tenant_id, grantee_tenant_id, season_id, revision_no) · idx (season_id, tier), (grantee_tenant_id, season_id), (quota_id, season_id) | append_only · confidential_wall — a revision is a new row, never an updateappend_only · confidential_wall — การแก้ไขคือแถวใหม่ ไม่ใช่การ update |
| Aggregateaggregate | Transaction ruleกติกาธุรกรรม | Contextcontext |
|---|---|---|
| LeadMandate | Two-act: proposed by either side, active only on the counterparty acceptance. The two-tier cap is validated inside this boundary on every transition. Termination never cascades to debt or history.สองจังหวะ: ฝ่ายใดฝ่ายหนึ่งเสนอ มีผลเมื่ออีกฝ่ายตอบรับ เพดานสองชั้นตรวจสอบภายในขอบเขตนี้ทุกการเปลี่ยนสถานะ การสิ้นสุดไม่ลามไปถึงหนี้หรือประวัติ | lead_network |
| NetworkAllocation | Append-only; a revision writes revision_no + 1 with a mandatory reason and supersedes exactly one earlier row. Exactly one quota anchor per (grantee, season). Over-allocation is signalled, never blocked.append-only; การแก้ไขเขียน revision_no + 1 พร้อมเหตุผลบังคับ และแทนที่แถวเดิมหนึ่งแถว มีจุดยึดโควตาเดียวต่อ (ผู้รับ, ฤดูกาล) การจัดสรรเกินเป็นการแจ้งเตือน ไม่ใช่การปิดกั้น | lead_network |
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)
| Revฉบับ | Dateวันที่ | Changeการเปลี่ยนแปลง |
|---|---|---|
| 0.1.0 | 2026-07-27 | Created by PROP-049 (spec v0.27.0, approved & applied 27 Jul 2026; all 10 open questions client-closed) — the CFL market perspective family opens with six documents. Per the OQ-3 decision the lead farmer gets his own family rather than being folded into CFQ: หัวตัน resembles the quota farmer superficially but differs significantly, and those differences are carried here as follow-on depth work. Rev starts at 0.1.0 per the post-PROP-014 semantic-versioning convention.สร้างโดย PROP-049 (spec v0.27.0 อนุมัติและ apply 27 ก.ค. 2569; ลูกค้าปิดคำถามเปิดครบทั้ง 10 ข้อ) — ตระกูล perspective ฝั่งตลาด CFL เปิดพร้อมเอกสารหกฉบับ ตามคำตัดสิน OQ-3 หัวตันได้ตระกูลของตนเองแทนการฝังไว้ใน CFQ: หัวตันดูคล้ายหัวหน้าโควต้าเพียงผิวเผินแต่ต่างกันอย่างมีนัยสำคัญ และความต่างเหล่านั้นถูกยกมาเป็นงานลงลึกต่อเนื่องในเอกสารชุดนี้ เริ่ม rev ที่ 0.1.0 ตามธรรมเนียม semantic versioning หลัง PROP-014 |
| 0.2.0 | 2026-07-27 | PROP-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.3.0 | 2026-08-03 | PROP-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.3.1 | 2026-08-03 | PROP-073 PATCH 1 (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 (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 |