Cane Agency · ERD Seriesสถาบันอ้อย · ชุดเอกสาร ERD
This is the OCSF — fund office (กองทุน) perspective of SPEC-ERD for the ocsf capacity. A new perspective family created by PROP-015 (v0.2.0) — OCSF was previously documented only in the masters (PROP-013). The single source of truth is the graph.
นี่คือมุมมอง สำนักงานกองทุนอ้อยและน้ำตาลทราย (กองทุน) ของ SPEC-ERD สำหรับ capacity ocsf ตระกูลมุมมองใหม่ที่สร้างโดย PROP-015 (v0.2.0) — เดิม OCSF อยู่ในเอกสารหลักเท่านั้น (PROP-013) แหล่งความจริงเดียวคือ graph
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 ที่ปลายเส้นแต่ละด้าน
Normative physical model for the 4 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 ทั้ง 4 รายการที่ 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
| ColumnColumn | Typeชนิด | Null | Defaultค่าตั้งต้น | Key / refKey / อ้างอิง |
|---|---|---|---|---|
| fund_id | uuid | — | uuid_v7() | PK |
| tenant_id | uuid | — | — | FK → tenant |
| season_id | uuid | — | — | FK → season |
| opening_balance | bigint (satang) | — | — | |
| inflow_total | bigint (satang) | — | — | |
| outflow_total | bigint (satang) | — | — | |
| closing_balance | bigint (satang) | — | — | |
| updated_at | timestamptz | — | — |
| ColumnColumn | Typeชนิด | Null | Defaultค่าตั้งต้น | Key / refKey / อ้างอิง |
|---|---|---|---|---|
| rate_id | uuid | — | uuid_v7() | PK |
| season_id | uuid | — | — | FK → season |
| zone_id | text | ✓ | — | |
| basis | text (enum) | — | — | |
| amount_per_unit | bigint (satang) | — | — | |
| effective_from | text | — | — | |
| set_by | uuid | — | — | FK → membership |
| ColumnColumn | Typeชนิด | Null | Defaultค่าตั้งต้น | Key / refKey / อ้างอิง |
|---|---|---|---|---|
| contribution_id | uuid | — | uuid_v7() | PK |
| fund_id | uuid | — | — | FK → cane_sugar_fund |
| payer_tenant_id | uuid | — | — | FK → tenant |
| basis | text (enum) | — | — | |
| base_qty | numeric(14,3) | — | — | |
| rate_id | uuid | — | — | FK → fund_levy_rate |
| amount | bigint (satang) | — | — | |
| period | text | — | — | |
| posted_at | timestamptz | — | — |
| ColumnColumn | Typeชนิด | Null | Defaultค่าตั้งต้น | Key / refKey / อ้างอิง |
|---|---|---|---|---|
| comp_id | uuid | — | uuid_v7() | PK |
| fund_id | uuid | — | — | FK → cane_sugar_fund |
| mill_id | uuid | — | — | FK → mill |
| season_id | uuid | — | — | FK → season |
| zone_id | text | — | — | |
| final_price_settlement_id | uuid | — | — | FK → final_price_settlement |
| amount | bigint (satang) | — | — | |
| status | text (enum) | — | — | |
| due_date | date | — | — | |
| paid_at | timestamptz | ✓ | — |
One row per entity in this perspective. Mutability: mutable · immutable_
หนึ่งแถวต่อ entity ในมุมมองนี้ Mutability: mutable · immutable_
| Entity | Tableตาราง | PK | Unique | Key indexesIndex หลัก | Mutability | PDPA | Profile |
|---|---|---|---|---|---|---|---|
| CaneSugarFund | cane_sugar_fund | fund_id | (tenant_id,season_id) | — | mutable | operational | Section 4ข้อ 4 |
| FundLevyRate | fund_levy_rate | rate_id | (season_id,zone_id,basis,effective_from) | — | append_ | public | Section 4ข้อ 4 |
| FundContribution | fund_contribution | contribution_id | (fund_id,payer_tenant_id,rate_id,period) | (payer_tenant_id) (period) | append_ | operational | Section 4ข้อ 4 |
| FundCompensation | fund_compensation | comp_id | (final_price_settlement_id (partial: not null)) | (mill_id,status,due_date) | immutable_ | operational | Section 4ข้อ 4 |
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 root | Membersสมาชิก | Context | Transaction ruleกติกา transaction |
|---|---|---|---|
| CaneSugarFund | CaneSugarFund · FundContribution · FundCompensation | fund | Contributions and compensations post against the running season balance in one transaction; shortfall flags derive from closing_balance (WF-44); reads statutory facts only (NFR-29).เงินสมทบและเงินชดเชย post เข้ายอดคงเหลือประจำฤดูใน transaction เดียว; ธงขาดสภาพคล่องคำนวณจาก closing_balance (WF-44); อ่านเฉพาะข้อเท็จจริงตามกฎหมาย (NFR-29) |
| FundLevyRate | FundLevyRate | fund | Rates append-only supersede by effective_from; authorized by the Board (FR-111).อัตรา append-only แทนที่ตาม effective_from; อนุมัติโดยบอร์ด กอน. (FR-111) |
| Revฉบับ | Dateวันที่ | Changeการเปลี่ยนแปลง |
|---|---|---|
| 0.2.0 | 2026-07-12 | New OCSF perspective family (PROP-015). Capacity fund→ocsf; content promoted from the SPEC-ERD master (PROP-013). Prototype at apps/ocsf/.ตระกูลมุมมอง OCSF ใหม่ (PROP-015) capacity fund→ocsf; เนื้อหายกจากเอกสารหลัก SPEC-ERD (PROP-013) ต้นแบบที่ apps/ocsf/ |
| 0.3.0 | 2026-07-13 | PROP-018 (spec v0.4.0): comprehensive perspective data modeling — scoped entity-relationship diagrams (Fig. 1–1), column-level persistence profiles for the 4 home entities (Section 4), keys / indexes / mutability & PDPA classes (Section 5) and aggregate consistency boundaries (Section 6) — all rendered from the graph's new dataModeling block.PROP-018 (spec v0.4.0): การ model ข้อมูลรายมุมมองฉบับครบ — แผนภาพความสัมพันธ์ entity เฉพาะมุมมอง (ภาพที่ 1–1), persistence profile ระดับ column ของ entity ที่ home อยู่ฉบับนี้ 4 รายการ (ข้อ 4), key / index / ชั้น mutability และ PDPA (ข้อ 5) และขอบเขตความสอดคล้องของ aggregate (ข้อ 6) ทั้งหมด render จาก block ใหม่ dataModeling ใน graph |
| 0.4.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.4.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 |