SPEC-DDD-MILL Rev 0.18.0 · 2026-08-17

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

Department Logic — Sugar Factory Perspectiveตรรกะโดเมน — มุมมองโรงงานน้ำตาล

Documentเอกสาร
SPEC-DDD-MILL
Versionversion (เวอร์ชัน)
0.18.0 · Draftฉบับร่าง
Updatedปรับปรุงล่าสุด
2026-08-17
Parentเอกสารแม่
SPEC-DDD
Perspectiveมุมมอง
Sugar factory (โรงงานน้ำตาล)โรงงานน้ำตาล
Siblingsเอกสารพี่น้อง
SPEC-ERD-MILL · SPEC-PWF-MILL
Admission — invitation-onlyการรับเข้า — เข้าโดยการเชิญ The mill capacity is invitation-only: a factory is admitted only against an operator-issued Invitation with facility eKYC (industry license · สอน. mill registry · capacity), never by open self-sign-up (WF-28, FR-70; PROP-006). Admission is orchestrated by the platform_ops context; federation remains the sole identity writer. capacity โรงงานเป็นเข้าโดยการเชิญ: โรงงานจะได้รับเข้าก็ต่อเมื่อมี Invitation ที่ operator ออก พร้อม eKYC ของโรงงาน (ใบอนุญาตอุตสาหกรรม · ทะเบียนโรงงาน สอน. · กำลังการผลิต) ไม่ใช่การสมัครเองแบบเปิด (WF-28, FR-70; PROP-006) การรับเข้าถูกจัดการโดย context platform_ops ส่วน federation ยังเป็นผู้เขียนตัวตนเพียงผู้เดียว

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

Department logic as it binds the sugar factory — owner of the core department (Delivery & Weighbridge) plus Quality and Settlement. Its event stream is the published language the rest of the platform conforms to. Definitions mirror SPEC-DDD and the graph; this document adds the actor's reading, never divergent rules.

ตรรกะโดเมนที่ผูกพันโรงงานน้ำตาล — เจ้าของหน่วยงานแกนกลาง (Delivery & Weighbridge) รวมทั้ง Quality และ Settlement สายเหตุการณ์ของโรงงานคือ published language ที่ส่วนอื่นของ platform ต้องปฏิบัติตาม นิยามสะท้อน SPEC-DDD และ graph (กราฟ); เอกสารนี้เพิ่มการอ่านของผู้ใช้ ไม่สร้างกฎที่แตกต่าง

2. My contexts2. บริบทของฉัน

ContextบริบทMy slice of itส่วนของฉัน
Delivery & Weighbridge (core)Crushing days, bookings, arrivals, weighing, ticketing, the truck registry, disputes.วันหีบ การจอง รถมาถึง การชั่ง การออกบัตร ทะเบียนรถ ข้อพิพาท
QualityThe government (สอน.) re-note I ingest: per-truck CCS/trash lines auto-matched to deliveries on the %N-### tag, provisional then confirmed. No on-site mill lab.รีโน้ตของรัฐ (สอน.) ที่ฉันนำเข้า: ค่า CCS/สิ่งปนเปื้อนรายคันรถ จับคู่กับการส่งมอบด้วยแท็ก %N-### provisional แล้ว confirmed — ไม่มีแล็บในโรงงาน
SettlementPayment batches and items; strictly event-sourced from Delivery + Quality; never reads their tables.ชุดและรายการจ่าย; event-sourced จาก Delivery + Quality อย่างเคร่งครัด; ไม่อ่านตารางตรง
Strategic Pricing v8.0The confidential ค่าอ้อยกลยุทธ์ I pay ON TOP of the statutory price — stamp checkpoints & rates, strategic agreements, per-delivery accrual, 25/50/75 step release. No edge to Regulation; never a PaymentItem component (NFR-21). Ledger releases post to Books (source_type auto_strategic).ค่าอ้อยกลยุทธ์ที่เป็นความลับที่จ่ายเพิ่มจากราคาตามกฎหมาย — จุดประทับตราและอัตรา ข้อตกลงกลยุทธ์ การสะสมต่อการส่งมอบ จ่ายเป็นงวด 25/50/75 ไม่มีเส้นไป Regulation; ไม่เป็นส่วนของ PaymentItem (NFR-21) การจ่ายแบบ ledger ลง Books (source_type auto_strategic)
Books · Receivables · Cash Management v9.0My full financial system (PROP-010): a seeded mill chart, AR/AP against growers & suppliers, cash/bank reconciliation, monthly + season fiscal periods, and P&L / balance sheet / trial balance / cash flow statements. Every PaymentItem, เงินเกี๊ยว credit, loan and strategic release auto-posts a balanced, idempotent, source-attributed entry (NFR-24). Statements reach a bank only via ConsentGrant scope books; a statement shared to สอน. excludes the strategic 5300 postings (FR-94, NFR-26).ระบบการเงินเต็มของโรงงาน (PROP-010): ผังโรงงานที่ seed มา AR/AP ต่อชาวไร่/ผู้ขาย การกระทบยอดเงินสด/ธนาคาร งวดรายเดือน+รายฤดู และงบกำไรขาดทุน/งบดุล/งบทดลอง/งบกระแสเงินสด ทุก PaymentItem เงินเกี๊ยว สินเชื่อ และการจ่ายกลยุทธ์ลงอัตโนมัติเป็นรายการที่ดุล idempotent ระบุที่มา (NFR-24) งบแบ่งให้ธนาคารผ่าน ConsentGrant scope books; งบที่ให้ สอน. ตัดการลงกลยุทธ์ 5300 ออก (FR-94, NFR-26)

Queue-train contexts — gate_queue + farmer_reliability (spec v0.12.0)context ขบวนคิว — gate_queue + farmer_reliability (spec v0.12.0)

Two contexts land with the queue train (PROP-020 + PROP-024). gate_queue (คิวรับอ้อย) sits between the farmer surfaces and delivery_weighbridge, owning QueueTicket · QueuePolicy · SlotTemplate · TimeSlot — the QueueTicket aggregate precedes the Delivery (its state machine: waiting → called → checked_in → served, with requeue-once-then-expire and QueueFrozen as the A-18 freeze mechanism). farmer_reliability (ความน่าเชื่อถือชาวไร่) owns ReliabilityEvent · ReliabilityScore · BookingPrivilegePolicy · ScoringPolicy — deliberately separate so a mill can run slots without scoring. Events: QueueLaneOpened · QueueLaneReleased · QueueLaneChanged · QueueTicketIssued · QueueCalled · QueueCheckedIn · QueueExpired · QueueCancelled · QueueFrozen (producer gate_queue) and BookingDemoted · BookingNoShow · ReliabilityEventRecorded · BookingPrivilegeChanged (gate_queue / farmer_reliability). Invariants: transactional slot + day drawdown (one transaction, WF-10 pattern); append-only queue log — no silent reorder ever (NFR-38); score recompute byte-identical under the pinned formula (NFR-41); dispute correction ONLY by compensating excused event (R1). Aggregate detail and component lifetimes for these contexts ride the Q5 back-audit.

สอง context มากับขบวนคิว (PROP-020 + PROP-024) gate_queue (คิวรับอ้อย) อยู่ระหว่างช่องทางชาวไร่กับ delivery_weighbridge เป็นเจ้าของ QueueTicket · QueuePolicy · SlotTemplate · TimeSlot — aggregate บัตรคิวมาก่อน Delivery (state machine: waiting → called → checked_in → served พร้อมต่อท้ายหนึ่งครั้งแล้วหมดอายุ และ QueueFrozen เป็นกลไก freeze ตาม A-18) farmer_reliability เป็นเจ้าของ ReliabilityEvent · ReliabilityScore · BookingPrivilegePolicy · ScoringPolicy — ตั้งใจแยก เพื่อให้โรงงานใช้ slot โดยไม่ใช้คะแนนได้ events: QueueLaneOpened · QueueLaneReleased · QueueLaneChanged · QueueTicketIssued · QueueCalled · QueueCheckedIn · QueueExpired · QueueCancelled · QueueFrozen (producer gate_queue) และ BookingDemoted · BookingNoShow · ReliabilityEventRecorded · BookingPrivilegeChanged (gate_queue / farmer_reliability) invariant: หัก slot + วันใน transaction เดียว (แบบ WF-10); log คิว append-only — ห้ามจัดลำดับเงียบ ๆ (NFR-38); คำนวณคะแนนซ้ำตรงทุกไบต์ตามสูตรที่ตรึง (NFR-41); แก้ข้อโต้แย้งด้วยเหตุการณ์ excused ชดเชยเท่านั้น (R1) รายละเอียด aggregate และ lifetime ของ component ไปกับการตรวจย้อนหลัง Q5

The lane model inside gate_queue (spec v0.33.0, PROP-061)แบบจำลองแถวใน gate_queue (spec v0.33.0, PROP-061)

The yard is not one queue: trucks park in several physical lines and the mill releases a whole line at a time, choosing which line goes next. gate_queue therefore gains two entities. QueueLane holds the mill’s lane definitions — a line is truck_class × cane_class × lane_role, mill-named, published and versioned (D-1). QueueLaneInstance holds the lines that actually stand in the yard today: nobody opens a lane — a lane is open because the one before it is full (D-5), so the instance is created implicitly inside the issuing transaction at the booth, and the count of lines is a record of what the day did, never configuration. A truck’s place is the pair (instance, lane_seq_no) — the platform’s first record of that fact, because today nothing writes it down at all (D-2) — and the record must be complete (NFR-112). New events: QueueLaneOpened (implicit, on overflow) · QueueLaneReleased (batch admission; the per-ticket QueueCalled still fires per ticket, so the queue-ticket state machine is unchanged) · QueueLaneChanged (recorded now, effective only when the truck’s current line is called in — the lines squeeze up bumper to bumper, D-3). Invariants: FCFS within a lane and the between-lane order recorded at every release and published as it happens, never promised before the day (NFR-112); allocating instance_no and the ticket’s lane_seq_no in one commit is what keeps the per-lane sequence gap-free; a lane may not be deactivated while it has a live instance. The mill’s own transfer-station trucks are ordinary lanes in the same register (D-4).

ลานไม่ใช่คิวเดียว: รถจอดเป็นหลายแถวจริง และโรงงานปล่อยเข้า ทีละแถวทั้งแถว โดยเลือกว่าแถวไหนไปก่อน gate_queue จึงเพิ่มสอง entity QueueLane เก็บ นิยาม แถวของโรงงาน — แถวคือ ชนิดรถ × ชนิดอ้อย × บทบาท ตั้งชื่อเอง ประกาศ และมีเวอร์ชัน (D-1) ส่วน QueueLaneInstance เก็บแถวที่ ยืนอยู่จริงในลานวันนี้: ไม่มีใครเปิดแถว แถวเปิดเพราะแถวก่อนหน้าเต็ม (D-5) แถวที่เปิดจึงถูกสร้างโดยปริยายภายใน transaction ของการออกบัตรที่ป้อม และจำนวนแถวเป็นบันทึกของสิ่งที่วันนั้นเป็น ไม่ใช่การตั้งค่า ที่ของรถคือคู่ (แถวที่เปิดจริง, lane_seq_no) ซึ่งเป็นการบันทึก ครั้งแรก ของข้อเท็จจริงนั้น เพราะวันนี้ไม่มีอะไรเขียนไว้เลย (D-2) และการบันทึกต้องครบถ้วน (NFR-112) event ใหม่: QueueLaneOpened (โดยปริยายเมื่อแถวเต็ม) · QueueLaneReleased (รับเข้าเป็นชุด โดย QueueCalled รายบัตรยังทำงานเหมือนเดิม state machine ของบัตรคิวจึงไม่เปลี่ยน) · QueueLaneChanged (บันทึกทันที มีผลเมื่อแถวปัจจุบันของรถถูกเรียกเข้า เพราะแถวเบียดชิดกัน D-3) กฎคงที่: ภายในแถวเป็นมาก่อนได้ก่อน ส่วนลำดับระหว่างแถวบันทึกทุกครั้งที่ปล่อยและประกาศตามที่เกิดขึ้น ไม่สัญญาล่วงหน้า (NFR-112) การจอง instance_no พร้อม lane_seq_no ใน commit เดียวคือสิ่งที่ทำให้ลำดับรายแถวไม่มีช่องว่าง และปิดแถวไม่ได้ขณะยังมีแถวเปิดอยู่ ส่วนรถของสถานีขนถ่ายของโรงงานเองเป็นแถวปกติในทะเบียนเดียวกัน (D-4)

Express governance inside gate_queue (spec v0.34.0, PROP-063)การกำกับแถวด่วนใน gate_queue (spec v0.34.0, PROP-063)

The express lane was already in the model; the reason was not. gate_queue gains three entities and one invariant that matters more than any of them. ExpressReason is the mill's published catalogue of why a truck may go out of turn — perishability (a duty, not a favour) · mill_remedy (the mill's own error, and the only category permitted to overrun) · mill_logistics (its own transfer traffic, counted but never privileged) · other (published, highest sign-off) — each with its own cap and its own aggregate boundary: effective-forward, versioned, and unpublishable without a cap. ExpressGrant is the immutable act, and it is not a new state: a grant is a lane change with a governed reason, so it commits inside the same transaction as the QueueLaneChanged it justifies and the increment of the day's count — which is precisely what makes the ceiling enforceable rather than decorative. ExpressFlag lives inside the grant's boundary: a farmer's objection that changes no queue state and is answered at season close. There is no entitlement aggregate, and there will not be one: PROP-034 was abandoned in this change set and the priority-class placeholders retired with it.

แถวด่วนอยู่ในแบบจำลองแล้ว แต่ เหตุผล ยังไม่อยู่ gate_queue จึงได้สาม entity และหนึ่ง invariant ที่สำคัญกว่าทั้งสาม: ExpressReason คือแคตาล็อกเหตุผลที่โรงงานประกาศ — perishability (หน้าที่ ไม่ใช่การเอื้อ) · mill_remedy (ความผิดของโรงงาน และเป็นหมวดเดียวที่เกินเพดานได้) · mill_logistics (รถของโรงงานเอง นับแต่ไม่ได้อภิสิทธิ์) · other (ประกาศ ลงนามสูงสุด) — แต่ละเหตุผลมีเพดานและขอบเขตของตัวเอง มีผลไปข้างหน้า มีเวอร์ชัน และประกาศไม่ได้ถ้าไม่มีเพดาน ExpressGrant คือการกระทำที่แก้ไม่ได้ และ ไม่ใช่สถานะใหม่: การให้สิทธิ์คือการย้ายแถวที่มีเหตุผลกำกับ จึง commit ใน transaction เดียวกับ QueueLaneChanged และการเพิ่มตัวนับของวัน ซึ่งทำให้เพดานบังคับได้จริง ส่วน ExpressFlag อยู่ในขอบเขตของการให้สิทธิ์: คำคัดค้านของชาวไร่ที่ไม่เปลี่ยนสถานะคิวและตอบตอนปิดฤดู ไม่มี aggregate ของสิทธิ์ และจะไม่มี เพราะ PROP-034 ถูกยกเลิกในรอบนี้

On-site tier contexts — on_site_gateway + mill_stations (spec v0.13.0)context ชั้นติดตั้งในโรงงาน — on_site_gateway + mill_stations (spec v0.13.0)

Two contexts land with the on-site train (PROP-021 + PROP-028, one train per both OQ-8s). on_site_gateway (application gateway ในโรงงาน) owns GatewayNode · StationClient · SyncCheckpoint — the factory-LAN hub: customer-side central DB + knowledge-graph slice (cache-not-archive, OQ-2), the single local allocator (G2), sync engine with split authority (G3: gateway owns intake facts, platform owns masters/config — write-write conflicts forbidden by construction). mill_stations (ชุดสถานีโรงงาน) owns CcsMeasurement · IntakeMatchSet · StationJournal — the five station apps as gateway clients and the continuous %N-### auto-match; draft entities collapsed into existing homes (WeighInNote → WeighTicket per OQ-4, coin records → Token/TokenIssuance per PROP-029). Events: GatewayCommissioned · AllocatorEpochAdvanced · StationClientRegistered · SyncCheckpointCommitted · GatewayConfigAcknowledged (producer on_site_gateway), CcsMeasurementRecorded · IntakeMatchResolved · IntakeMatchException (mill_stations) and TokenVoided · TokenReissued (delivery_weighbridge, OQ-3). Invariants: allocation in-transaction on the single-writer WAL store, epoch-stamped (F-2/F-3 — numbers never fork, split-brain structurally impossible); config binds effective-from-acknowledgement, never retroactively; corrections only ever append; immutable facts (weights, CCS) never merge — conflicts are mill-match exceptions; sealed datastore + signed-binary mandate (NFR-46). Aggregate detail and component lifetimes for these contexts ride the Q5 back-audit.

สอง context มากับขบวนติดตั้งในโรงงาน (PROP-021 + PROP-028 ขบวนเดียวตาม OQ-8 ของทั้งคู่) on_site_gateway (application gateway ในโรงงาน) เป็นเจ้าของ GatewayNode · StationClient · SyncCheckpoint — ศูนย์กลางบน LAN โรงงาน: ฐานข้อมูลกลางฝั่งลูกค้า + slice ของ knowledge graph (cache ไม่ใช่คลังถาวร, OQ-2) ผู้จ่ายเลขท้องถิ่นหนึ่งเดียว (G2) และเครื่องยนต์ sync แบบแบ่งอำนาจ (G3: gateway เป็นเจ้าของข้อเท็จจริงการรับอ้อย platform เป็นเจ้าของข้อมูลหลัก/config — การชนแบบเขียน-เขียนถูกห้ามโดยโครงสร้าง) mill_stations (ชุดสถานีโรงงาน) เป็นเจ้าของ CcsMeasurement · IntakeMatchSet · StationJournal — แอปสถานีห้าตัวเป็น client ของ gateway และการจับคู่ %N-### ต่อเนื่อง; entity ในร่างถูกยุบเข้าบ้านเดิม (WeighInNote → WeighTicket ตาม OQ-4, ระเบียนเหรียญ → Token/TokenIssuance ตาม PROP-029) events: GatewayCommissioned · AllocatorEpochAdvanced · StationClientRegistered · SyncCheckpointCommitted · GatewayConfigAcknowledged (producer on_site_gateway), CcsMeasurementRecorded · IntakeMatchResolved · IntakeMatchException (mill_stations) และ TokenVoided · TokenReissued (delivery_weighbridge, OQ-3) invariant: จ่ายเลขใน transaction บนฐานข้อมูลผู้เขียนเดียวแบบ WAL ประทับ epoch (F-2/F-3 — เลขไม่มีวันแตกแขนง split-brain เป็นไปไม่ได้เชิงโครงสร้าง); config มีผลเมื่อยืนยันรับ ไม่ย้อนหลัง; การแก้ไขเพิ่มได้อย่างเดียว; ข้อเท็จจริง immutable (น้ำหนัก, CCS) ไม่ merge — ความขัดแย้งเป็นข้อยกเว้นใน mill-match; ฐานข้อมูลผนึก + ข้อบังคับ binary ลงนาม (NFR-46) รายละเอียด aggregate และ lifetime ของ component ไปกับการตรวจย้อนหลัง Q5

3. Aggregates & invariants that bind me3. แอกกริเกตและกฎคงที่ที่ผูกพันฉัน

AggregateแอกกริเกตInvariants that bind meกฎคงที่ที่ผูกพันฉัน
CrushingDayOne per mill per date; booked_t ≤ crush_capacity_t; burnt share ≤ cap (breach emits BurntCapBreached); closing derives the compliance record.หนึ่งรายการต่อโรงงานต่อวัน; booked_t ≤ crush_capacity_t; สัดส่วนอ้อยเผา ≤ เพดาน (ละเมิดปล่อย BurntCapBreached); การปิดวันสร้างระเบียนกำกับ
Delivery (owns WeighTicket)One open delivery per truck; net > 0; cane type + harvest method confirmed at weigh-in; tickets immutable — re-weighs supersede.รถหนึ่งคันมีการส่งมอบเปิดหนึ่งรายการ; สุทธิ > 0; ยืนยันประเภท + วิธีเก็บเกี่ยวตอนชั่ง; บัตรแก้ไม่ได้ — ชั่งใหม่ออกแทน
QualityTestExactly one valid test per delivery; re-tests supersede; CCS 5–16 plausibility; late results settle provisionally and adjust retroactively.หนึ่งผลที่ใช้ได้ต่อการส่งมอบ; ตรวจซ้ำออกแทน; CCS สมเหตุสมผล 5–16; ผลช้าปิดงวดชั่วคราวแล้วปรับย้อนหลัง
PaymentBatch (owns PaymentItem)Immutable once approved; total = Σ items; one settlement per delivery; every offset references an open credit line.แก้ไม่ได้เมื่ออนุมัติ; ยอด = Σ รายการ; ปิดงวดครั้งเดียวต่อการส่งมอบ; ทุกการหักกลบอ้างวงเงินที่เปิดอยู่
StrategicAgreement (owns CheckpointRate, PremiumAccrual, PremiumRelease) v8.0Counterparty holds an active grower/quota capacity; PremiumAccrual computes off the weigh-ticket net, append-only & idempotent (NFR-22); upfront_pct ∈ {25,50,75}; withheld balance releases on contract-volume fulfilment; renegotiation writes a new revision effective the next day and never revalues a posted accrual (non-retroactive); never a PaymentItem component, no edge to Regulation (NFR-21); multiple concurrent agreements per season allowed.คู่สัญญาถือ capacity grower/quota ที่ active; PremiumAccrual คำนวณจากน้ำหนักสุทธิ append-only และ idempotent (NFR-22); upfront_pct ∈ {25,50,75}; ส่วนที่กันไว้จ่ายเมื่อครบปริมาณ; การเจรจาใหม่เขียนฉบับใหม่มีผลวันถัดไป ไม่ตีมูลค่าการสะสมที่ลงแล้ว (ไม่ย้อนหลัง); ไม่เป็นส่วนของ PaymentItem ไม่มีเส้นไป Regulation (NFR-21); ถือหลายฉบับพร้อมกันต่อฤดูได้

4. Aggregate boundaries & transaction rules4. ขอบเขต aggregate และกติกา transaction

The normative consistency boundaries of this perspective's home contexts (delivery_weighbridge · quality · settlement · strategic_pricing · books · receivables · cash_management), rendered from graph dataModeling.aggregates (v0.4.0, PROP-018). The prose invariants above stay explanatory; the rules here are the transactional contract an implementation must enforce. Column-level persistence for every member entity lives in the sibling SPEC-ERD family (see the Data column).

ขอบเขตความสอดคล้องเชิงบรรทัดฐานของ context ที่ home อยู่มุมมองนี้ (delivery_weighbridge · quality · settlement · strategic_pricing · books · receivables · cash_management) render จาก dataModeling.aggregates ใน graph (v0.4.0, PROP-018) คำอธิบาย invariant ข้างบนคงไว้เพื่อความเข้าใจ; กติกาในส่วนนี้คือสัญญาเชิง transaction ที่ implementation ต้องบังคับใช้ ส่วน persistence ระดับ column ของ entity สมาชิกทุกตัวอยู่ในตระกูล SPEC-ERD พี่น้อง (ดู column ข้อมูล)

delivery_weighbridgequalitysettlementDeliveryการส่งมอบWeighTicketCrushingDayวันหีบTruckรถบรรทุกอ้อยQualityTestผลตรวจ CCSCcsReNoteรีโน้ต CCS (จากภาครัฐ)PaymentBatchงวดจ่ายเงินPaymentItemPaymentInstallmentFinalPriceSettlementการจ่ายส่วนต่างราคาสุดท้าย
Fig. 1 — Consistency boundaries of delivery_weighbridge · quality · settlement: one box per aggregate — title = root, rows = member entities. Everything inside a box commits in one database transaction; everything between boxes flows through domain events.ภาพที่ 1 — ขอบเขตความสอดคล้องของ delivery_weighbridge · quality · settlement: หนึ่งกล่องต่อ aggregate — ชื่อกล่อง = root, รายการในกล่อง = entity สมาชิก ทุกอย่างในกล่อง commit ใน database transaction เดียว; ระหว่างกล่องไหลผ่าน domain event
strategic_pricingbooksreceivablescash_managementStampCheckpointจุดประทับตราCheckpointRateStampEventStrategicAgreementข้อตกลงค่าอ้อยกลยุทธ์PremiumAccrualPremiumReleaseOnwardPremiumSettlementการส่งต่อค่าอ้อยกลยุทธ์สู่ลูกไร่LedgerAccountบัญชีแยกประเภทJournalEntryรายการสมุดรายวันChartTemplateผังบัญชีแม่แบบFiscalPeriodงวดบัญชีFinancialStatementงบการเงินBooksProfileโปรไฟล์สมุดบัญชีInvoiceใบแจ้งหนี้Receiptใบเสร็จรับเงินPaymentVoucherใบสำคัญจ่ายCashAccountบัญชีเงินสด/ธนาคารBankTransactionReconciliation
Fig. 2 — Consistency boundaries of strategic_pricing · books · receivables · cash_management: one box per aggregate — title = root, rows = member entities. Everything inside a box commits in one database transaction; everything between boxes flows through domain events.ภาพที่ 2 — ขอบเขตความสอดคล้องของ strategic_pricing · books · receivables · cash_management: หนึ่งกล่องต่อ aggregate — ชื่อกล่อง = root, รายการในกล่อง = entity สมาชิก ทุกอย่างในกล่อง commit ใน database transaction เดียว; ระหว่างกล่องไหลผ่าน domain event
Aggregate rootMembersสมาชิกContextTransaction ruleกติกา transactionDataข้อมูล
DeliveryDelivery · WeighTicketdelivery_weighbridgeTransitions follow the delivery state machine; weigh-out writes the ticket and the status change in one transaction; net_kg = gross − tare > 0 enforced here. Re-weighs append a superseding ticket.การเปลี่ยนสถานะตาม state machine ของการส่งมอบ; การชั่งออกเขียนบัตรชั่งพร้อมสถานะใน transaction เดียว; ยึด net_kg = gross − tare > 0 ที่นี่ การชั่งใหม่ append บัตรฉบับแทนERD-MILL
QualityTestQualityTestqualityOne valid test per delivery (partial unique); re-tests supersede; provisional → confirmed on re-note match.หนึ่งผลที่ใช้ได้ต่อการส่งมอบ (partial unique); ตรวจซ้ำออกฉบับแทน; provisional → confirmed เมื่อจับคู่ re-noteERD-MILL
CcsReNoteCcsReNotequalityIngested government document — append-only; matching fans out QualityTest updates in follow-up transactions.เอกสารรัฐที่นำเข้า — append-only; การจับคู่กระจายการปรับ QualityTest ใน transaction ตามหลังERD-MILL
CrushingDayCrushingDaydelivery_weighbridgeBooking/weighing increments booked_t / weighed_t under optimistic concurrency in the SAME transaction as the delivery write; booked_t ≤ crush_capacity_t and the burnt-cap ratio hold here; closing derives the nightly compliance record.การจอง/ชั่งเพิ่ม booked_t / weighed_t ภายใต้ optimistic concurrency ใน transaction เดียวกับการเขียน delivery; ยึด booked_t ≤ crush_capacity_t และสัดส่วนเพดานไฟไหม้ที่นี่; การปิดวันสร้างระเบียนกำกับรายคืนERD-MILL
TruckTruckdelivery_weighbridgeFleet registry; plate snapshots (truck_reg_snap) live on Delivery so registry edits never rewrite history.ทะเบียนรถ; snapshot ทะเบียน (truck_reg_snap) อยู่บน Delivery การแก้ทะเบียนจึงไม่เขียนประวัติซ้ำERD-MILL
PaymentBatchPaymentBatch · PaymentItem · PaymentInstallmentsettlementBatch total = Σ items validated at approval; approval freezes batch + items; installments then post per the statutory two-installment schedule (50% next cycle + 50% +30d).ยอดชุด = Σ รายการ ตรวจตอนอนุมัติ; การอนุมัติตรึงชุดและรายการ; จากนั้นงวด post ตามตารางสองงวดตามกฎหมาย (50% รอบถัดไป + 50% +30 วัน)ERD-MILL
FinalPriceSettlementFinalPriceSettlementsettlementSeason-end true-up; payer branch (factory vs Cane & Sugar Fund) fixed at creation; paid transition is terminal.การสรุปราคาปลายฤดู; ฝั่งผู้จ่าย (โรงงานหรือกองทุน) กำหนดตอนสร้าง; สถานะจ่ายแล้วเป็นสถานะสุดท้ายERD-MILL
StampCheckpointStampCheckpoint · CheckpointRate · StampEventstrategic_pricingRates append-only supersede (NFR-22) with non-overlapping volume tiers per tenant+season; stamp events append and match a delivery at weigh-in.อัตรา append-only ออกฉบับแทน (NFR-22) ช่วงปริมาณต่อ tenant+ฤดูไม่ทับกัน; การประทับตรา append และจับคู่การส่งมอบตอนชั่งERD-MILL
StrategicAgreementStrategicAgreement · PremiumAccrual · PremiumReleasestrategic_pricingAccruals are idempotent per delivery (unique agreement+delivery); releases never exceed the accrued withheld balance; renegotiation appends a new revision effective next day — never retroactive (NFR-22). Confidential — no edge to regulation (NFR-21).การสะสม idempotent ต่อการส่งมอบ (unique agreement+delivery); การจ่ายไม่เกินยอดกันไว้สะสม; เจรจาใหม่ append ฉบับใหม่มีผลวันถัดไป — ไม่ย้อนหลัง (NFR-22) เป็นความลับ — ไม่มีเส้นไป regulation (NFR-21)ERD-MILL
StrategicPlanStrategicPlan · PlanScenario · PlanVersionstrategic_pricingOne plan per mill+season. Scenarios are sandbox — never touch live accruals; publish is two-act (author → executive, no self-approval) and freezes the scenario into an immutable version effective-forward (NFR-22).หนึ่งแผนต่อโรงงานต่อฤดู สถานการณ์เป็น sandbox — ไม่แตะ accrual จริง; publish เป็นสอง act (ผู้เขียน → ผู้บริหาร ห้ามอนุมัติตนเอง) freeze เป็นเวอร์ชันที่แก้ไขไม่ได้ มีผลไปข้างหน้า (NFR-22)ERD-MILL
CalcBasisPolicyCalcBasisPolicystrategic_pricingAppend-only supersession; ONE active row per scope key; most-specific wins (mill → farmer_group → tenant/agreement → tier) with the individual agreement at the apex; effective-forward only.supersession แบบ append-only; หนึ่งแถว active ต่อ scope key; เฉพาะเจาะจงที่สุดชนะ โดยข้อตกลงรายคนคือยอดสุด; มีผลไปข้างหน้าเท่านั้นERD-MILL
FarmerGroupFarmerGroupstrategic_pricingStatic per season: rule-assisted candidate list, mill confirms & freezes; never auto re-evaluated; audited manual edits only.คงที่ต่อฤดู: รายชื่อตัวเลือกจากกฎ โรงงานยืนยันและ freeze; ไม่ประเมินซ้ำอัตโนมัติ; แก้ได้เฉพาะด้วยมือแบบ audit ได้ERD-MILL
OnwardPremiumSettlementOnwardPremiumSettlementstrategic_pricingAppend-only relay record — cash on the factory delivery receipt; scheme (mirror/split/flat) fixed per row.ระเบียนส่งต่อแบบ append-only — เงินสดต่อใบรับส่งมอบโรงงาน; scheme (mirror/split/flat) ตรึงต่อแถวERD-CFQ
LedgerAccountLedgerAccountbooksPer-tenant chart row; system_flag accounts are template-seeded and rename-only.แถวผังบัญชีราย tenant; บัญชี system_flag seed จาก template แก้ได้เฉพาะชื่อERD-MILL
JournalEntryJournalEntrybooksEvery entry balances (Σ debit = Σ credit inside lines) — validated before commit; corrections are reversals (reversal_of), never edits; auto-posts are idempotent per source (NFR-24).ทุก entry ดุล (Σ เดบิต = Σ เครดิตใน lines) — ตรวจก่อน commit; การแก้ไขคือการกลับรายการ (reversal_of) ไม่ใช่การแก้; การลงอัตโนมัติ idempotent ต่อแหล่ง (NFR-24)ERD-MILL
ChartTemplateChartTemplatebooksVersioned per capacity; seeding copies rows — tenants never share template state.มี version ต่อ capacity; การ seed คัดลอกแถว — tenant ไม่ใช้สถานะ template ร่วมกันERD-MILL
InvoiceInvoicereceivablesIssue freezes lines and totals; settlement is tracked via Receipt / PaymentVoucher references.การออกใบตรึง lines และยอด; การชำระติดตามผ่านการอ้าง Receipt / PaymentVoucherERD-MILL
ReceiptReceiptreceivablesPosted document — auto-posts its JournalEntry in the same transaction (idempotent).เอกสารที่ post แล้ว — ลง JournalEntry อัตโนมัติใน transaction เดียวกัน (idempotent)ERD-MILL
PaymentVoucherPaymentVoucherreceivablesPosted document — auto-posts its JournalEntry in the same transaction (idempotent).เอกสารที่ post แล้ว — ลง JournalEntry อัตโนมัติใน transaction เดียวกัน (idempotent)ERD-MILL
CashAccountCashAccount · BankTransaction · Reconciliationcash_managementStatement lines append; a reconciliation closes an account-period when difference = 0; the 1—1 ledger mapping is unique.บรรทัด statement append; การกระทบยอดปิดงวดของบัญชีเมื่อ difference = 0; การ map ไป ledger แบบ 1—1 เป็น uniqueERD-MILL
FiscalPeriodFiscalPeriodbooksClose validates no unposted documents then freezes the period; statements snapshot only from closed periods; periods never overlap per owner.การปิดงวดตรวจว่าไม่มีเอกสารค้าง post แล้วตรึงงวด; งบ snapshot จากงวดที่ปิดแล้วเท่านั้น; งวดต่อเจ้าของไม่ทับกันERD-MILL
FinancialStatementFinancialStatementbooksFrozen snapshot; shared to a bank only via ConsentGrant scope books; a statement shared to สอน. excludes strategic postings (FR-94, NFR-26).snapshot ตรึง; แบ่งให้ธนาคารผ่าน ConsentGrant scope books เท่านั้น; งบที่ให้ สอน. ตัดการลงกลยุทธ์ (FR-94, NFR-26)ERD-MILL
BooksProfileBooksProfilebooksOne profile per tenant; edition/view are packaging over the same ledger (NFR-32).หนึ่ง profile ต่อ tenant; รุ่น/มุมมองเป็นการจัดแพ็กเกจบนบัญชีเดียวกัน (NFR-32)ERD-MILL
TruckMergeRequestTruckMergeRequestdelivery_weighbridgev0.20.0 (PROP-025): two-act same-factory merge artifact (WF-66) — surviving and duplicate MUST share mill_id; approval executes atomically (deliveries re-point, duplicate soft-deletes via merged_into_truck_id, master links transfer) in ONE transaction; rejection keeps both rows; initiator can never approve (A-17 policy role).v0.20.0 (PROP-025): เอกสารผสานสองจังหวะภายในโรงงานเดียว (WF-66) — แถวคงอยู่และแถวซ้ำต้อง mill_id เดียวกัน; การอนุมัติดำเนินการ atomic (delivery ชี้ใหม่ แถวซ้ำ soft-delete ผ่าน merged_into_truck_id โอน link ของ master) ใน transaction เดียว; การปฏิเสธเก็บทั้งสองแถว; ผู้เริ่มอนุมัติเองไม่ได้ (บทบาทตาม policy A-17)ERD-MILL
QueueLaneQueueLanegate_queueDefinitions are published, effective-forward and versioned; a lane may not be deactivated while it has a live instance. The register names lines and never counts them (PROP-061 D-5).นิยามประกาศแล้ว มีผลไปข้างหน้า และมีเวอร์ชัน ปิดแถวไม่ได้ขณะยังมีแถวเปิดอยู่ ทะเบียนตั้งชื่อแถว ไม่ใช่นับจำนวน (PROP-061 D-5)
QueueLaneInstanceQueueLaneInstancegate_queueOpened inside the issuing transaction that overflowed the previous instance: instance_no and the ticket’s lane_seq_no commit together, which is what makes the per-lane sequence gap-free and the record complete (FR-322, NFR-112). Identity fixed at open; only depth and closed_at move.สร้างภายใน transaction ของการออกบัตรที่ทำให้แถวเดิมล้น: instance_no และ lane_seq_no commit พร้อมกัน จึงทำให้ลำดับรายแถวไม่มีช่องว่างและบันทึกครบ (FR-322, NFR-112) ตัวตนตรึงตอนเปิด มีเพียง depth และ closed_at ที่เปลี่ยน
ExpressReasonExpressReasongate_queuev0.34.0 (PROP-063): published, effective-forward, versioned, and never publishable without a cap; a reason may not be deactivated while a grant of the current day cites it. One transaction never spans two mills. release: v2v0.34.0 (PROP-063): ประกาศ มีผลไปข้างหน้า มีเวอร์ชัน ประกาศไม่ได้ถ้าไม่มีเพดาน และปิดไม่ได้ขณะมีการให้สิทธิ์ของวันอ้างอยู่ release: v2
ExpressGrantExpressGrant · ExpressFlaggate_queuev0.34.0 (PROP-063): the grant and the flags raised against it are ONE boundary. The grant commits with the lane change it justifies and with the increment of the day's express count, so no release exists without its reason and none slips past the ceiling; the row is never edited — a wrong grant is superseded. release: v2v0.34.0 (PROP-063): การให้สิทธิ์และธงเป็นขอบเขตเดียว commit พร้อมการย้ายแถวและตัวนับของวัน แก้ภายหลังไม่ได้ ที่ผิดให้ออกใหม่ release: v2

5. Component lifetime map5. ผัง lifetime ของ component

The DI registration contract for this perspective's contexts, from graph dataModeling.lifecycles — vocabulary singleton | scoped (per request / unit of work) | transient (.NET, per the PROP-005 ASP.NET Core foundation). Platform-wide conventions (DbContext, repositories, handlers, caches, hosted jobs) are stated once in SPEC-DDD and bind here unless a row below overrides them; the rows list the notable components an implementation must wire per context.

สัญญาการลงทะเบียน DI ของ context ในมุมมองนี้ จาก dataModeling.lifecycles ใน graph — ใช้ศัพท์ singleton | scoped (ต่อคำขอ / unit of work) | transient (.NET ตามรากฐาน ASP.NET Core ของ PROP-005) กติการวมทั้ง platform (DbContext, repository, handler, cache, hosted job) ประกาศครั้งเดียวใน SPEC-DDD และมีผลที่นี่เว้นแต่แถวด้านล่างกำหนดต่าง; แถวในตารางคือ component สำคัญที่ implementation ต้องต่อสายราย context

delivery_weighbridge ส่งมอบและชั่งน้ำหนัก

events producedevent ที่ผลิต DeliveryBooked · TruckArrived · WeightRecorded · DeliveryAccepted · DeliveryRejected · TruckRegistered · CrushingDayOpened · CrushingDayClosed · BurntCapBreached · TruckMergeRequested · TruckMergeExecuted v0.20.0

ComponentKindชนิดLifetimeRationaleเหตุผล
Delivery/CrushingDay repositoriesrepositoryscoped—
BookingServiceapp_servicescopedBooks delivery + increments CrushingDay.booked_t under optimistic concurrency, one transaction.จอง delivery + เพิ่ม booked_t ของ CrushingDay ใต้ optimistic concurrency ใน transaction เดียว
WeighbridgeChannelintegrationsingletonLong-lived device/stream channel per weighbridge; emits into scoped handlers.ช่องทางอุปกรณ์อายุยาวต่อแท่นชั่ง; ส่งเข้า handler แบบ scoped
DeliveryStateGuarddepartment_policysingletonPure delivery state machine transitions.การเปลี่ยนสถานะ delivery แบบ pure
TicketFactoryfactorytransientWT display codes; net_kg = gross − tare > 0.รหัสแสดง WT; net_kg = gross − tare > 0

quality คุณภาพ (CCS)

events producedevent ที่ผลิต QualityRecorded · CcsReNoteIngested · CcsMatched

ComponentKindชนิดLifetimeRationaleเหตุผล
CcsReNoteIngestorapp_servicescopedPaper/Excel re-note intake (WF-05).รับ re-note กระดาษ/Excel (WF-05)
ReNoteAutoMatchercalculatortransientPure %N-### tag matcher (coin · line · slot) → QualityTest updates.ตัวจับคู่แท็ก %N-### แบบ pure (เหรียญคิว · ไลน์ · ช่องเท) → ปรับ QualityTest
QualityRepositoryrepositoryscoped—

settlement การเงิน

events producedevent ที่ผลิต BatchApproved · PaymentPosted · FirstInstallmentPosted · FinalInstallmentPosted · FinalPriceSettled

ComponentKindชนิดLifetimeRationaleเหตุผล
PaymentBatchRepositoryrepositoryscoped—
SettlementCalculatorcalculatortransientbase × net + CCS premium ± cane-type adj − deductions; pure and testable.ฐาน × สุทธิ + พรีเมียม CCS ± ส่วนต่างประเภทอ้อย − การหัก; pure ทดสอบง่าย
InstallmentSchedulercalculatortransientStatutory 50% next-cycle + 50% +30d plan from MillPaymentSchedule.แผนตามกฎหมาย 50% รอบถัดไป + 50% +30 วัน จาก MillPaymentSchedule
BatchApprovalServiceapp_servicescopedFreezes batch; publishes money-events for auto-posting.ตรึงชุดจ่าย; ประกาศ money-event ให้ลงบัญชีอัตโนมัติ

strategic_pricing ค่าอ้อยกลยุทธ์

events producedevent ที่ผลิต StrategicAgreementSigned · CheckpointStamped · PremiumAccrued · PremiumStepReleased · ContractVolumeFulfilled · OnwardPaymentRecorded · StrategicBatchApproved · StrategicBatchPosted · PlanPublished · CalcBasisPolicyActivated · TierThresholdApproaching · SpendEnvelopeExceeded · PlanVersionActivated · PlanAdjustmentCancelled

ComponentKindชนิดLifetimeRationaleเหตุผล
StrategicAgreement/Accrual repositoriesrepositoryscoped—
AccrualPosterapp_servicescopedIdempotent per delivery off the weigh-ticket net (NFR-22).idempotent ต่อการส่งมอบ จากน้ำหนักสุทธิบัตรชั่ง (NFR-22)
TierRateResolvercalculatortransientPer-farmer volume-tier rate at stamp/weigh time.อัตราตามช่วงปริมาณรายชาวไร่ ณ เวลาประทับ/ชั่ง
StepReleasePolicydepartment_policysingleton25/50/75 upfront + withheld release on fulfilment.จ่ายล่วงหน้า 25/50/75 + ปล่อยยอดกันไว้เมื่อครบปริมาณ
RegulatorWallPolicydepartment_policysingletonDeny-all toward regulation/gov capacity reads (NFR-21) — registered once, asserted everywhere.ปฏิเสธทุกการอ่านจากฝั่ง regulation/ฝั่งรัฐ (NFR-21) — ลงทะเบียนครั้งเดียว ใช้ทุกที่
StrategicPlan/Scenario repositoriesrepositoryscoped—
CalcBasisResolvercalculatortransientCascade resolution at accrual (WF-60): agreement/tenant → group → mill default; tier override most specific; agreement at the apex.resolve ตามลำดับชั้นตอน accrue (WF-60): ข้อตกลง/ชาวไร่ → กลุ่ม → ค่าเริ่มต้นโรงงาน; override ราย tier เฉพาะที่สุด; ข้อตกลงคือยอด
PlanEconomicsCalculatorcalculatortransientBreak-even, adequacy and envelope per scenario (FR-145) — pure over the scenario's assumptions.คุ้มทุน ความพอเพียง กรอบวงเงินรายสถานการณ์ (FR-145) — pure จากสมมติฐานของสถานการณ์
SpendForecastServiceapp_servicescopedFour-signal season-spend forecast + alert emission (FR-147); console freshness within minutes (NFR-48).พยากรณ์ค่าใช้จ่ายสี่สัญญาณ + ส่งการเตือน (FR-147); ความสดของ console ภายในไม่กี่นาที (NFR-48)

books สมุดบัญชี

events producedevent ที่ผลิต JournalPosted · StatementShared · ChartSeeded · PeriodClosed · StatementGenerated

ComponentKindชนิดLifetimeRationaleเหตุผล
LedgerDbContext + LedgerAccount/JournalEntry repositoriesrepositoryscoped—
JournalPosterapp_servicescopedBalanced-entry invariant validated pre-commit; reversals only.ตรวจ invariant ยอดดุลก่อน commit; แก้ด้วยการกลับรายการเท่านั้น
AutoPostingMapdomain_servicesingletonsource_type → posting template (auto_settlement · auto_credit · auto_strategic · auto_fund · …); idempotent per source (NFR-24).source_type → template การลงบัญชี; idempotent ต่อแหล่ง (NFR-24)
StatementGeneratorcalculatortransientFrozen snapshot from a closed FiscalPeriod; สอน. share excludes strategic postings (FR-94).snapshot ตรึงจากงวดที่ปิดแล้ว; ฉบับ สอน. ตัดการลงกลยุทธ์ (FR-94)

receivables ลูกหนี้และเจ้าหนี้

events producedevent ที่ผลิต InvoiceIssued · InvoiceSettled · ReceiptPosted · PaymentVoucherPosted

ComponentKindชนิดLifetimeRationaleเหตุผล
Invoice/Receipt/Voucher repositoriesrepositoryscoped—
DocumentNumberFactoryfactorytransient—
ReceivablesAgingCalculatorcalculatortransient—

cash_management เงินสดและธนาคาร

events producedevent ที่ผลิต BankTransactionImported · ReconciliationClosed

ComponentKindชนิดLifetimeRationaleเหตุผล
CashAccountRepositoryrepositoryscoped—
StatementImporterapp_servicescopedAppends BankTransaction rows; dedup on external_ref.append แถว BankTransaction; กันซ้ำด้วย external_ref
ReconciliationMatchercalculatortransient—

6. Events — my side of the streams6. เหตุการณ์ — ฝั่งของฉันในสายข้อมูล

DirectionทิศทางEventsเหตุการณ์
My actions raiseการกระทำของฉันก่อCrushingDayOpened/Closed · TruckRegistered · TruckArrived · WeightRecorded · QualityRecorded · DeliveryAccepted/Rejected · BurntCapBreached · BatchApproved · PaymentPosted · StrategicAgreementSigned · CheckpointStamped · PremiumAccrued · PremiumStepReleased · ContractVolumeFulfilled · ChartSeeded · InvoiceIssued/Settled · ReceiptPosted · PaymentVoucherPosted · BankTransactionImported · ReconciliationClosed · PeriodClosed · StatementGenerated/Shared
My views consumeมุมมองของฉันบริโภคQuotaAllocated · DeliveryBooked · CropOwnershipTransferred (owner at booking) · CanePriceAnnounced · RevenueAccountAnnounced · CcsAuditCompleted (adjustments)

6.x PROP-032 events (v0.15.0)6.x เหตุการณ์ของ PROP-032 (v0.15.0)

Nine events join delivery_weighbridge: LineDowntimeOpened / Revised / Closed (record-first capture; supervisor confirms only extensions), CapacityForecastChanged (the binding schedulability read republishing ≤ 5 s, NFR-50), CapacityRevised (audit-trailed nameplate change), DowntimeSuspected (flow-silence detector — only the human record deducts), MaintenancePlanPublished / MaintenancePlanVersionActivated (single-act publish; whole-season fold; headroom diff to the sugarcane department) and SeasonDatesChanged (MillSeason edit). Aggregate rule: the sweep runs transactionally on the CrushingDay aggregate — one recompute per event, no oscillation.เหตุการณ์เก้าตัวเข้า delivery_weighbridge: LineDowntimeOpened / Revised / Closed (บันทึกก่อน; หัวหน้ากะยืนยันเฉพาะการยืด), CapacityForecastChanged (การอ่านผูกพันของการจัดตาราง เผยแพร่ใหม่ ≤ 5 วินาที, NFR-50), CapacityRevised (แก้ nameplate พร้อม audit trail), DowntimeSuspected (ตัวตรวจจับความเงียบของ flow — เฉพาะบันทึกของคนที่หักจริง), MaintenancePlanPublished / MaintenancePlanVersionActivated (เผยแพร่จังหวะเดียว; รวมทั้งฤดู; diff ที่ว่างไปฝ่ายไร่) และ SeasonDatesChanged (การแก้ MillSeason) กติกา aggregate: sweep วิ่งเป็น transaction บน aggregate CrushingDay — recompute ครั้งเดียวต่อเหตุการณ์ ไม่แกว่ง

6.y PROP-025 events (v0.20.0)6.y เหตุการณ์ของ PROP-025 (v0.20.0)

Two events join delivery_weighbridge: TruckMergeRequested (a clerk composes the same-factory merge; routes to the mill-truck-approvals inbox) and TruckMergeExecuted (management approval executes atomically — deliveries re-point, duplicate soft-deletes, master links transfer; consumed by fleet_intelligence, which re-scores the surviving row). The master-layer link family (MasterTruckLinked / Unlinked / Merged, PlateChangeDeclared / Executed) belongs to fleet_intelligence (PLT) — admin + audit consumers only; no tenant-facing notification ever consumes it (M1). See SPEC-DDD-PLT Section 3.เหตุการณ์สองตัวเข้า delivery_weighbridge: TruckMergeRequested (เสมียนเรียบเรียงการผสานภายในโรงงาน; เข้ากล่อง mill-truck-approvals) และ TruckMergeExecuted (การอนุมัติของผู้บริหารดำเนินการ atomic — delivery ชี้ใหม่ แถวซ้ำ soft-delete โอน link ของ master; fleet_intelligence บริโภคและให้คะแนนแถวที่คงอยู่ใหม่) ตระกูลเหตุการณ์ link ของชั้น master (MasterTruckLinked / Unlinked / Merged, PlateChangeDeclared / Executed) เป็นของ fleet_intelligence (PLT) — ผู้บริโภคเฉพาะ admin + audit; ไม่มีการแจ้งเตือนฝั่ง tenant บริโภคเด็ดขาด (M1) ดู SPEC-DDD-PLT ข้อ 3

7. User stories → department logic7. เรื่องราวผู้ใช้ → ตรรกะโดเมน

User storyเรื่องราวผู้ใช้Department logicตรรกะโดเมนEvents raisedเหตุการณ์ที่เกิด
The mill manager opens tomorrow with a 25% burnt cap.ผู้จัดการเปิดวันพรุ่งนี้ด้วยเพดานอ้อยเผา 25%CrushingDay scheduled → open; bookings draw down capacity; arrivals over the cap are refused at the gate.วันหีบ scheduled → open; การจองตัดยอดกำลัง; รถเกินเพดานถูกปฏิเสธที่ประตูCrushingDayOpened
The operator weighs a disputed load twice.พนักงานชั่งเที่ยวที่มีข้อพิพาทสองครั้งOriginal ticket never edited; supervisor sign-off resolves; both tickets remain in the audit log.บัตรเดิมไม่ถูกแก้; หัวหน้างานอนุมัติการแก้ข้อพิพาท; บัตรทั้งสองอยู่ในบันทึกตรวจสอบWeightRecorded
The lab posts CCS 13.2 for truck 84-2261.แล็บบันทึก CCS 13.2 ให้รถ 84-2261One test per delivery; result flows to the farmer and to สอน. oversight; premium computes at settlement via the ฿/CCS increment.หนึ่งผลต่อการส่งมอบ; ผลไหลถึงชาวไร่และการกำกับของ สอน.; พรีเมียมคำนวณตอนปิดงวดด้วยอัตราบาท/CCSQualityRecorded
Finance approves งวด 3.การเงินอนุมัติงวด 3Batch freezes; items pay base × net + premium ± type-adjustment − deductions; offsets post to Financing.ชุดถูกตรึง; รายการจ่าย ฐาน × สุทธิ + พรีเมียม ± ส่วนต่าง − การหัก; หักกลบส่งเข้าบริบทสินเชื่อBatchApproved · PaymentPosted

8. Two boundaries around the money's destination (PROP-085)8. สองขอบเขตรอบปลายทางของเงิน (PROP-085)

Applied 2026-08-17 as spec v0.73.0. The settlement context gains two aggregate roots and the objects the applied model assumed but never held. PayeeAccount — the destination and its dated life (PayeeAccountEvent) — commit together: the current state and the event that produced it are one transaction, so a verification, a rejection, a withdrawal and a reinstatement can never disagree with the row they describe. QuotaGroup — the group and its dated membership (QuotaGroupMember) — commit together, which is what makes "at most one netting group per account at a time" an invariant rather than a hope. The ranked PayeeAssignment belongs to the ACCOUNT boundary (SPEC-DDD-CFQ), not to either of these: a destination may serve several accounts, and it is the account that decides which destination is its primary.

apply 2026-08-17 เป็น spec v0.73.0 context settlement ได้ราก aggregate สองราก และได้วัตถุที่แบบจำลองที่ apply แล้วสมมติว่ามีแต่ไม่เคยถือไว้ PayeeAccount คือปลายทางกับประวัติที่มีวันที่ commit ด้วยกัน สถานะปัจจุบันและเหตุการณ์ที่ทำให้เกิดอยู่ใน transaction เดียว ส่วน QuotaGroup คือกลุ่มกับสมาชิกภาพที่มีวันที่ commit ด้วยกัน ทำให้กฎหนึ่งกลุ่มหักกลบต่อบัญชีเป็นค่าคงที่ ส่วน PayeeAssignment ที่มีอันดับอยู่ในขอบเขตของบัญชี ไม่ใช่ของสองรากนี้

Eight events enter on this side: PayeeAssigned · PayeeAssignmentSuperseded · PayeeAccountAdded · PayeeAccountVerified · PayeeAccountWithdrawn · PayeeFallbackUsed · QuotaGrouped · MillBankChannelChanged. PayeeFallbackUsed is the one worth naming twice: it is written BEFORE the money moves, because a fallback that is only visible afterwards is indistinguishable from a silent redirection, which NFR-170 forbids outright.

เพิ่มแปดเหตุการณ์ในฝั่งนี้ตามรายการข้างต้น โดย PayeeFallbackUsed ควรระบุซ้ำ เพราะถูกเขียนก่อนเงินเคลื่อน การสำรองที่เห็นได้เฉพาะภายหลังแยกไม่ออกจากการเปลี่ยนเส้นทางแบบเงียบ ซึ่ง NFR-170 ห้ามเด็ดขาด

9. The strategic boundary, widened by the acts that end an agreement (PROP-090)9. ขอบเขตกลยุทธ์ ขยายด้วยการกระทำที่ทำให้ข้อตกลงสิ้นสุด (PROP-090)

Applied 2026-08-17 as spec v0.74.0. The StrategicAgreement boundary gains the three acts that end or move an agreement — AgreementAssignment, WithheldOutcome and AgreementNotice — because a half-committed ending is money owed to nobody. An assignment freezes the accrued tonnage and the withheld balance at the moment the ground moves; an outcome closes exactly one open position per agreement per season; a notice, its response and its closure are timestamped rows, so a release can be shown to have followed a served notice and an elapsed cure period rather than a mood.

apply 2026-08-17 เป็น spec v0.74.0 ขอบเขต StrategicAgreement รับการกระทำสามอย่างที่ทำให้ข้อตกลงสิ้นสุดหรือย้าย คือ AgreementAssignment WithheldOutcome และ AgreementNotice เพราะการสิ้นสุดที่ commit ครึ่งเดียวคือเงินที่เป็นหนี้ต่อผู้ไม่มีตัวตน การโอนตรึงปริมาณที่สะสมและยอดที่หักไว้ ผลลัพธ์ปิดสถานะที่เปิดอยู่หนึ่งรายการต่อข้อตกลงต่อฤดู และการบอกกล่าวพร้อมคำตอบและการปิดเป็นแถวที่มีเวลากำกับ

Two boundaries move beside it. MillStrategicConfig takes in ResolverPolicyVersion, so publishing a version and pointing the config at it is one transaction — an agreement can never be countersigned against a version that was never published (V-25 leg e). And a new root, QuotaHead, holds RelayDeclaration (homed in SPEC-ERD-CFQ): the onward basis is versioned there, a settlement names the version it was paid under, and an acknowledgement records only that this person saw this version on this date.

มีอีกสองขอบเขตขยับข้างกัน MillStrategicConfig รับ ResolverPolicyVersion เข้ามา การเผยแพร่เวอร์ชันและการชี้ config ไปที่มันจึงเป็น transaction เดียว ข้อตกลงจึงถูกลงนามตอบใต้เวอร์ชันที่ไม่เคยเผยแพร่ไม่ได้ และรากใหม่ QuotaHead ถือ RelayDeclaration ซึ่ง home ที่ SPEC-ERD-CFQ

Seven events enter: AgreementAssigned · AgreementEnded · WithheldSettled · ResolverPolicyPublished · NoticeServed · ScopeReleased · RelayDeclarationPublished. The read model strategic_reconciliation declares no writer — it creates no figure and corrects none — and may never hold two factories' strategic rows in one result set (NFR-174).

เพิ่มเจ็ดเหตุการณ์ ได้แก่ AgreementAssigned · AgreementEnded · WithheldSettled · ResolverPolicyPublished · NoticeServed · ScopeReleased · RelayDeclarationPublished ส่วน read model strategic_reconciliation ไม่ประกาศผู้เขียน ไม่สร้างและไม่แก้ตัวเลข และห้ามถือแถวกลยุทธ์ของสองโรงงานไว้ในชุดผลลัพธ์เดียว (NFR-174)

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

PROP-027 accepted (spec v0.10.0, 2026-07-17)รับ PROP-027 แล้ว (spec v0.10.0, 17 ก.ค. 2569) The financing context gains the opt-in fuel-credit service: FuelCredit · FuelStation · MillFuelConfig and three events — FuelCreditRedeemed (producer financing), FuelCreditOffsetPosted (producer settlement) and FuelCreditVoided. Invariants: the note authorizes, the ledger settles (F1 — headroom authoritative server-side); the offset rides the existing FR-17 deduction machine unchanged (F2); the cap is intelligent, discounted in real time by scheduled contract-farming repayments (F3, FR-119). Glossary gains เครดิตน้ำมัน (fuel credit). The graph is canonical; context maps and aggregate figures regenerate on the next render pass. context financing ได้บริการเครดิตน้ำมันแบบ opt-in: FuelCredit · FuelStation · MillFuelConfig และ event สามตัว — FuelCreditRedeemed (producer financing), FuelCreditOffsetPosted (producer settlement) และ FuelCreditVoided invariant: ใบให้สิทธิ บัญชีชำระ (F1 — วงเงินยึดฝั่ง server); การหักกลบอาศัยเครื่องหัก FR-17 เดิมโดยไม่เปลี่ยน (F2); เพดานอัจฉริยะ หักลดแบบ real time ตามยอดชำระ contract farming ตามกำหนด (F3, FR-119) ศัพท์เพิ่ม เครดิตน้ำมัน graph เป็น canonical; แผนที่ context และภาพ aggregate จะ regenerate รอบ render ถัดไป

PROP-023 context digest (v0.16.0) — the books context becomes normativeสรุป context ตาม PROP-023 (v0.16.0) — context books เป็นเชิงบรรทัดฐาน

The books context gains its normative layer: the chart is authored data (books.chartTemplates — seeding copies rows; lock classes DERIVED from posting-map targets, OQ-2), auto-posting is a declarative spec the AutoPostingMap domain service (singleton, lifecycles inventory) resolves at runtime (books.postingMap — one row per event × capacity, named source fields, black-reversal corrections, unmapped-fail per NFR-52), the FiscalPeriod aggregate completes its walk (WF-64 two-act lock · auto-lock timer · season force-lock; reopen voids frozen statements), and FinancialStatement becomes deterministic (full-input snapshots, NFR-51). Aggregate rules unchanged in shape — tightened in content; the invariant remains: balanced, append-only, idempotent, source-attributed (NFR-13/24).

context books ได้ชั้นเชิงบรรทัดฐาน: ผังเป็นข้อมูลที่เขียนไว้ (books.chartTemplates — การ seed คัดลอกแถว; ชั้นการล็อก derive จากเป้า posting map, OQ-2), การลงบัญชีอัตโนมัติเป็น spec แบบ declarative ที่ domain service AutoPostingMap (singleton ตามบัญชี lifecycles) resolve ตอนรัน (books.postingMap — หนึ่งแถวต่อ event × capacity, field ต้นทางตั้งชื่อ, แก้ไขแบบ black reversal, fail เมื่อไม่มีแถวตาม NFR-52), aggregate FiscalPeriod เดินครบเส้นทาง (WF-64 lock สอง act · timer อัตโนมัติ · ปิดฤดูบังคับ lock; reopen ทำงบแช่แข็งเป็นโมฆะ) และ FinancialStatement เป็น deterministic (snapshot แบบ input เต็ม, NFR-51) กฎ aggregate รูปเดิม — เนื้อหาเข้มขึ้น; invariant คงเดิม: สมดุล, append-only, idempotent, ระบุที่มา (NFR-13/24)

PROP-030 applied (spec v0.21.0, 2026-07-23) — the transfer_station contextปรับใช้ PROP-030 แล้ว (spec v0.21.0, 23 ก.ค. 2569) — context transfer_station New bounded context transfer_station (สถานีขนถ่ายอ้อย), owning 10 entities. Model: the station is ONE tenant with THREE faces — intake site toward farmers (station-scale settlement, WF-70), quota holder toward the mill (the mill pays farmers through the station's quota; standard payroll stack + TransportCostPolicy + TransferLossPolicy — OQ-1), haulage principal toward contractors (mill-scale settlement net of the FR-184 threshold + per-kg charge, WF-71). Aggregate sketch: (StationBill + its CraneTokens) — the bill and its load links commit atomically, cut-and-reopen appends a linked bill; (HaulageSettlement + LossClaim) — per-trip settlement and claim commit together; policies and rate cards are effective-dated reference aggregates. Events: CraneTokenIssued/Returned · StationBillCut · StationDaySynced · HaulageSettled · LossClaimRaised · TransportCostPolicyChanged · TransferLossPolicyChanged. HaulageSettled posts into books via the auto-posting map. Full aggregate detail + lifetime map ride the Q5 back-audit. Bounded context ใหม่ transfer_station (สถานีขนถ่ายอ้อย) มี entity 10 ตัว โมเดล: สถานีเป็น tenant เดียวสามหน้า — จุดรับอ้อยต่อชาวไร่ (ชำระตามตาชั่งสถานี, WF-70) เจ้าของโควตาต่อโรงงาน (โรงงานจ่ายชาวไร่ผ่านโควตาสถานี ด้วยลำดับหักมาตรฐาน + TransportCostPolicy + TransferLossPolicy — OQ-1) และผู้ว่าจ้างขนส่งต่อผู้รับเหมา (ชำระตามตาชั่งโรงงาน หักตามเกณฑ์ + อัตราต่อ กก. ของ FR-184, WF-71) โครง aggregate: (StationBill + CraneToken ของบิล) commit พร้อมกัน ตัด-เปิดใหม่เป็นบิลที่ลิงก์กัน; (HaulageSettlement + LossClaim) commit ด้วยกันรายเที่ยว; นโยบายและ rate card เป็น reference aggregate มีผลตามช่วงวัน รายละเอียด aggregate เต็มและผัง lifetime ตามรอบ back-audit ของ Q5
PROP-045 applied (spec v0.22.0, 2026-07-23)ปรับใช้ PROP-045 แล้ว (spec v0.22.0, 23 ก.ค. 2569) The scope-overlap predicate is now DEFINED (OQ-15…18 client-decided): StrategicAgreement gains explicit scope attributes — scope_checkpoint_ids? · scope_field_ids? · scope_date_from? · scope_date_to? · scope_distance_band? (null = unrestricted axis; the delivery-matching set = deliveries matching ALL non-null axes). Overlap = same counterparty + same season + intersecting delivery-matching sets. Default: overlapping agreements are REJECTED at save (str.err.overlap). A mill may enable layering via the new MillStrategicConfig (mill-settings strategic topic, str_config-gated): the shared resolver then picks the matching agreement with the LOWEST cost to the factory; ties still reject. Scope changes are effective-forward only, re-validated on every mutation; accrued rows untouched. Plan-scenario drafts are never checked — the check fires at publish only, with SUPERSEDE (two-act approval; old ends today, new effective next day) as an explicit choice. One resolver serves accrual and analytics (FR-185/FR-186, NFR-58). The strategic_pricing context gains MillStrategicConfig (own aggregate, one active row per mill, effective-forward). predicate การทับซ้อนของ scope ถูกนิยามแล้ว (ลูกค้าตัดสิน OQ-15…18): StrategicAgreement ได้ attribute scope ชัดเจน — scope_checkpoint_ids? · scope_field_ids? · scope_date_from? · scope_date_to? · scope_distance_band? (ค่าว่าง = ไม่จำกัดแกนนั้น; เซตการ match = การส่งมอบที่ตรงทุกแกนที่ไม่ว่าง) การทับซ้อน = คู่สัญญาเดียวกัน + ฤดูเดียวกัน + เซตการ match ตัดกัน ค่าเริ่มต้น: ข้อตกลงทับซ้อนถูกปฏิเสธตอน save (str.err.overlap) โรงงานเปิดการซ้อนชั้นได้ผ่าน MillStrategicConfig ใหม่ (หัวข้อกลยุทธ์ใน mill-settings, ผ่านสิทธิ์ str_config): resolver ที่ใช้ร่วมจะเลือกข้อตกลงที่ match ซึ่งมีต้นทุนต่ำสุดต่อโรงงาน; เสมอกันยังคงปฏิเสธ การเปลี่ยน scope มีผลไปข้างหน้าเท่านั้น ตรวจซ้ำทุก mutation; แถวที่ accrue แล้วไม่แตะ ร่าง scenario ของแผนไม่ถูกตรวจ — ตรวจเฉพาะตอน publish โดยมี SUPERSEDE (อนุมัติสองขั้น; ฉบับเก่าสิ้นสุดวันนี้ ฉบับใหม่มีผลวันถัดไป) เป็นทางเลือกชัดเจน resolver เดียวใช้ทั้ง accrual และงานวิเคราะห์ (FR-185/FR-186, NFR-58) บริบท strategic_pricing ได้ MillStrategicConfig (aggregate ของตัวเอง หนึ่งแถว active ต่อโรงงาน มีผลไปข้างหน้า)
PROP-044 applied (spec v0.23.0, 2026-07-23)ปรับใช้ PROP-044 แล้ว (spec v0.23.0, 23 ก.ค. 2569) The PlanVersion lifecycle is now DEFINED (OQ-22…25 client-decided): status pending | active | superseded | cancelled. Publish creates the version PENDING (effective_from ≥ tomorrow); exactly ONE pending per plan; never edited in place — cancel-and-replace only, two-act each way; re-validated on every referenced mutation and again at activation — a conflict cancels with an alert (PlanAdjustmentCancelled), never a partial activation; at effective_from it activates atomically (PlanVersionActivated), superseded rows close forward-only, posted accruals untouched. A version is always the COMPLETE plan snapshot — slice editing down to the individual farmer agreement is a designer affordance only. Deliveries bucket to the version in force at mill acceptance; retro re-rating never crosses a version boundary (each version's exposure is fixed at publish). Propagation: unilateral rows change with the version, templates reach new agreements only, affected live agreements become a flagged WF-35 renegotiation worklist (FR-187/WF-73). The StrategicPlan aggregate is unchanged in membership; the MaintenancePlan → MaintenancePlanVersion pattern already cites this contract. วงจรชีวิตของ PlanVersion ถูกนิยามแล้ว (ลูกค้าตัดสิน OQ-22…25): สถานะ pending | active | superseded | cancelled การ publish สร้างเวอร์ชันสถานะ PENDING (effective_from ≥ พรุ่งนี้); pending ทีละหนึ่งฉบับต่อแผน; ห้ามแก้ในที่ — ยกเลิกแล้วแทนที่เท่านั้น สอง act ทั้งสองทาง; validate ซ้ำทุก mutation ที่อ้างถึงและซ้ำตอน activate — ความขัดแย้งยกเลิกพร้อม alert (PlanAdjustmentCancelled) ไม่มี activation บางส่วน; ถึง effective_from จึง activate แบบ atomic (PlanVersionActivated) แถวที่ถูกแทนปิดแบบไปข้างหน้า accrual ที่ post แล้วไม่ถูกแตะ เวอร์ชันคือ snapshot ทั้งแผนเสมอ — การแก้รายส่วนลึกถึงข้อตกลงรายชาวไร่เป็นเพียงความสะดวกของเครื่องมือ การส่งมอบจัดเข้าเวอร์ชันที่มีผล ณ การรับมอบที่โรงงาน; การ re-rate ย้อนหลังไม่ข้ามขอบเวอร์ชัน (ความเสี่ยงของแต่ละเวอร์ชันตรึงตอน publish) การส่งผลต่อ: แถวฝ่ายเดียวเปลี่ยนตามเวอร์ชัน แม่แบบถึงข้อตกลงใหม่เท่านั้น ข้อตกลง live ที่กระทบเข้า worklist เจรจาใหม่ WF-35 (FR-187/WF-73) aggregate StrategicPlan สมาชิกไม่เปลี่ยน; pattern MaintenancePlan → MaintenancePlanVersion อ้างสัญญานี้อยู่แล้ว

Checkpoint-evidence context — checkpoint_evidence (PROP-043, spec v0.24.0, applied 2026-07-24)context หลักฐานจุดตรวจ — checkpoint_evidence (PROP-043, spec v0.24.0 ปรับใช้ 24 ก.ค. 2569)

The new checkpoint_evidence context (หลักฐานจุดตรวจ) owns CheckpointRegistration · EvidencePhoto · TripTrace — the platform's furthest-forward evidence-capture plane, realized by the dedicated checkpoint app (surface checkpoint, mill-employed checkpoint_staff) on enrolled handheld print terminals. It WRAPS strategic_pricing's StampEvent (the accrual trigger; accrual buckets at mill acceptance, PROP-044 OQ-23) and speaks six new events: CheckpointRegistered · CheckpointTicketPrinted · RegistrationMatched · RegistrationExpired · RouteAbandonSuspected (advisory, D-8/I-3) · TamperSuspected (voids arming, C-2). Evidence contract C-1…C-6 governs completeness, location integrity + geofenced operation, the A-59 signed payload, device binding (StationClient), offline queue-and-sync and PDPA (OQ-27: 12-month retention; OQ-32: trip status only, trace purged at weigh-out). The strategic wall holds: zero strategic figures on any checkpoint screen or ticket (PROP-042); in-bound strategic cost renders only behind the NFR-21 wall on mill-str-cost.

context ใหม่ checkpoint_evidence (หลักฐานจุดตรวจ) เป็นเจ้าของ CheckpointRegistration · EvidencePhoto · TripTrace — ระนาบเก็บหลักฐานที่อยู่หน้าสุดของ platform ทำงานผ่านแอป checkpoint เฉพาะ (surface checkpoint, role checkpoint_staff พนักงานโรงงาน) บนเครื่องพกพาพร้อมเครื่องพิมพ์ที่ลงทะเบียนแล้ว มันห่อ StampEvent ของ strategic_pricing (trigger ของ accrual; accrual นับที่การรับ ณ โรงงาน ตาม PROP-044 OQ-23) และสื่อสารด้วย event ใหม่หกตัว สัญญาหลักฐาน C-1…C-6 ปกครองความครบถ้วน ความถูกต้องของตำแหน่ง + การทำงานใน geofence, payload ลงลายเซ็นตาม A-59, การผูกอุปกรณ์ (StationClient), การ sync แบบ offline และ PDPA (OQ-27: เก็บ 12 เดือน; OQ-32: เห็นเฉพาะสถานะเที่ยว ลบรอยพิกัดเมื่อชั่งออก) กำแพงกลยุทธ์ยังคงอยู่: ไม่มีตัวเลขกลยุทธ์บนหน้าจอหรือตั๋ว (PROP-042); ต้นทุนกลยุทธ์ขาเข้าแสดงเฉพาะหลังกำแพง NFR-21 บน mill-str-cost

11. Revision history11. ประวัติการแก้ไข

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): new Strategic Pricing context (Section 2), the StrategicAgreement aggregate + invariants (ข้อ 3) and STR events (ข้อ 4) — the confidential ค่าอ้อยกลยุทธ์ paid ON TOP of the statutory price; accruals append-only/idempotent, renegotiation non-retroactive, never a PaymentItem component and no edge to Regulation (NFR-21/22).PROP-009 (STR, spec v8.0): บริบทใหม่ Strategic Pricing (ข้อ 2) แอกกริเกต StrategicAgreement + กฎคงที่ (ข้อ 3) และเหตุการณ์ STR (ข้อ 4) — ค่าอ้อยกลยุทธ์ที่เป็นความลับจ่ายเพิ่มจากราคาตามกฎหมาย; การสะสม append-only/idempotent เจรจาใหม่ไม่ย้อนหลัง ไม่เป็นส่วนของ PaymentItem และไม่มีเส้นไป Regulation (NFR-21/22)
1.32026-07-09PROP-010 (GL, spec v9.0): the mill's Books become a full financial system + the Receivables and Cash Management contexts (Section 2) — chart of accounts, AR/AP, cash/bank reconciliation, period close & statements, and the auto-posting map fanning every money-event into balanced, idempotent, source-attributed entries (NFR-24). 9 GL events (Section 4); statements shared to a bank only via ConsentGrant scope books, PROP-009 strategic postings never in a government share (FR-94, NFR-25…26).PROP-010 (GL, spec v9.0): Books ของโรงงานเป็นระบบการเงินเต็ม + บริบท Receivables และ Cash Management (ข้อ 2) — ผังบัญชี AR/AP การกระทบยอด การปิดงวดและงบ และแผนการลงอัตโนมัติที่กระจายทุกเหตุการณ์เงินเป็นรายการดุล (NFR-24) 9 เหตุการณ์ GL (ข้อ 4); แบ่งงบผ่าน ConsentGrant scope books กลยุทธ์ PROP-009 ไม่เข้างบรัฐ (FR-94, NFR-25…26)
1.42026-07-10PROP-012 (settlement & CCS-by-re-note correction, spec v10.0): the mill's Quality slice is re-grounded to the government (สอน.) re-note it ingests and auto-matches on the %N-### tag (no on-site lab); Settlement is the statutory two-installment schedule on the initial price from MillPaymentSchedule with a season-end final-price true-up.PROP-012 (แก้การจ่ายเงินและ CCS จากรีโน้ต, spec v10.0): ส่วน Quality ของโรงงานอิงรีโน้ตของรัฐ (สอน.) ที่นำเข้าและจับคู่ด้วยแท็ก %N-### (ไม่มีแล็บในโรงงาน); Settlement เป็นสองงวดตามกฎหมายบนราคาขั้นต้นจาก MillPaymentSchedule พร้อมสรุปราคาสุดท้ายปลายฤดู
0.1.02026-07-11PROP-014 (spec v0.1.0): semantic versioning restarted at 0.1.0 (was Rev 1.4 · 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.4 · 2026-07-10); ปรับ docnav ตามการแยก gov_cluster — ย้าย GOV ไป docs/gov/ocsb/ เพิ่มพี่น้อง BOARD (กอน.)
0.1.12026-07-12PROP-016 (spec v0.2.1): mill admission presented as invitation-only — named the platform_ops admission gate in the mill context. Editorial/presentation correction; no model change (mill.admission was already invitation since PROP-006).PROP-016 (spec v0.2.1): นำเสนอการรับเข้าโรงงานเป็นเข้าโดยการเชิญ — ระบุด่านการรับเข้า platform_ops ในบริบทของโรงงาน แก้เชิงบรรณาธิการ/การนำเสนอ ไม่แก้โมเดล (mill.admission เป็น invitation ตั้งแต่ PROP-006)
0.2.02026-07-13PROP-018 P2 (spec v0.4.0): aggregate map figures + normative aggregate boundaries & transaction rules (Section 4) and the DI component lifetime map (Section 5) for delivery_weighbridge · quality · settlement · strategic_pricing · books · receivables · cash_management — rendered from the graph's dataModeling block (aggregates · lifecycles).PROP-018 P2 (spec v0.4.0): ภาพผัง aggregate + ขอบเขต aggregate และกติกา transaction เชิงบรรทัดฐาน (ข้อ 4) และผัง lifetime ของ component แบบ DI (ข้อ 5) ของ delivery_weighbridge · quality · settlement · strategic_pricing · books · receivables · cash_management — render จาก block dataModeling ใน graph (aggregates · lifecycles)
0.3.02026-07-17PROP-027 accepted (spec v0.10.0): the financing context gains FuelCredit/FuelStation/MillFuelConfig + 3 events + the fuel-credit glossary term; callout added, figures regenerate next render pass.รับ PROP-027 (spec v0.10.0): context financing ได้ FuelCredit/FuelStation/MillFuelConfig + 3 event + ศัพท์เครดิตน้ำมัน; เพิ่ม callout ภาพ regenerate รอบ render ถัดไป
0.4.02026-07-17PROP-020 + PROP-024 accepted as ONE queue train (spec v0.12.0, 2026-07-17): Section 2 gains the gate_queue + farmer_reliability context digest (8 entities, 10 events, queue-ticket state machine, key invariants); aggregate detail + lifetime maps ride the Q5 back-audit.รับ PROP-020 + PROP-024 เป็นขบวนคิวเดียว (spec v0.12.0, 17 ก.ค. 2569): ข้อ 2 เพิ่มสรุป context gate_queue + farmer_reliability (8 entity, 10 event, state machine บัตรคิว, invariant สำคัญ); รายละเอียด aggregate + lifetime ไปกับการตรวจย้อนหลัง Q5
0.5.02026-07-19PROP-021 + PROP-028 applied as ONE train (spec v0.13.0): Section 2 gains the on_site_gateway + mill_stations context digest (6 entities, 10 events, G1–G3 invariants, F-1…F-6 foundations); aggregate detail and lifetimes ride the Q5 back-audit.ปรับใช้ PROP-021 + PROP-028 เป็นขบวนเดียว (spec v0.13.0): ข้อ 2 เพิ่มสรุป context on_site_gateway + mill_stations (6 entity, 10 event, invariant G1–G3, ฐานราก F-1…F-6); รายละเอียด aggregate และ lifetime ไปกับการตรวจย้อนหลัง Q5
0.6.02026-07-19PROP-022 applied (spec v0.14.0): Section 4 gains the StrategicPlan / CalcBasisPolicy / FarmerGroup aggregate rows; strategic_pricing gains 4 events (PlanPublished · CalcBasisPolicyActivated · TierThresholdApproaching · SpendEnvelopeExceeded; StrategicBatch events now listed too) and 4 lifetime-map components (plan/scenario repositories, CalcBasisResolver, PlanEconomicsCalculator, SpendForecastService); graph canonical. Plan-lifecycle events (PlanVersionActivated / PlanAdjustmentCancelled) ride PROP-044.ปรับใช้ PROP-022 (spec v0.14.0): ข้อ 4 เพิ่มแถว aggregate StrategicPlan / CalcBasisPolicy / FarmerGroup; strategic_pricing เพิ่ม 4 event และ 4 component ในผัง lifetime; graph เป็น canonical event วงจรชีวิตแผนไปกับ PROP-044
0.7.02026-07-20PROP-032 accepted (spec v0.15.0): 9 events + 5 entities join delivery_weighbridge (capacity model depth — downtime capture, binding forecast, flow-silence detection, season maintenance plan, season frame). New Section 6 digest; aggregate detail rides the Q5 back-audit.รับ PROP-032 (spec v0.15.0): เหตุการณ์ 9 ตัว + entity 5 ตัวเข้า delivery_weighbridge (ความลึก model กำลังหีบ — เก็บ downtime พยากรณ์ผูกพัน ตรวจจับความเงียบของ flow แผนซ่อมบำรุงประจำฤดู กรอบฤดู) เพิ่มสรุปข้อ 6; รายละเอียด aggregate ไปกับ back-audit รอบ Q5
0.8.02026-07-22PROP-023 applied (spec v0.16.0): books-context digest added — normative chart data, declarative posting map resolved by the AutoPostingMap service, completed FiscalPeriod lifecycle (WF-64), deterministic statements (NFR-51); black-reversal convention platform-wide (OQ-7).PROP-023 ปรับใช้ (spec v0.16.0): เพิ่มสรุป context books — ข้อมูลผังเชิงบรรทัดฐาน, posting map แบบ declarative ที่ service AutoPostingMap resolve, วงจร FiscalPeriod ครบ (WF-64), งบ deterministic (NFR-51); ธรรมเนียม black reversal ทั้ง platform (OQ-7)
0.9.02026-07-23PROP-025 applied (spec v0.20.0): +TruckMergeRequest aggregate row (two-act WF-66 merge, atomic execution, same-mill invariant); delivery_weighbridge gains TruckMergeRequested / TruckMergeExecuted (new Section 6.y digest). The fleet_intelligence context (M1–M4 invariants, four aggregates, five-event link family) is PLT-owned — see SPEC-DDD-PLT Section 3.ปรับใช้ PROP-025 (spec v0.20.0): +แถว aggregate TruckMergeRequest (การผสานสองจังหวะ WF-66 ดำเนินการ atomic กติกาโรงงานเดียวกัน); delivery_weighbridge เพิ่ม TruckMergeRequested / TruckMergeExecuted (สรุปข้อ 6.y ใหม่) ส่วน context fleet_intelligence (กฎคงที่ M1–M4 สี่ aggregate ตระกูลเหตุการณ์ห้าตัว) เป็นของ PLT — ดู SPEC-DDD-PLT ข้อ 3
0.10.02026-07-23PROP-030 applied (spec v0.21.0): +transfer_station context — station as one tenant with three faces; aggregate sketch (StationBill+CraneToken · HaulageSettlement+LossClaim · effective-dated policies); 8 events; lifetime map rides the Q5 back-audit.ปรับใช้ PROP-030 (spec v0.21.0): เพิ่ม context transfer_station — สถานีเป็น tenant เดียวสามหน้า; โครง aggregate และ event 8 รายการ; ผัง lifetime ตามรอบ back-audit ของ Q5
0.11.02026-07-23PROP-045 applied (spec v0.22.0): scope-overlap predicate defined for strategic_pricing — +MillStrategicConfig entity/aggregate; ONE shared resolver invariant (NFR-58); publish-time-only checking with two-act supersede.ปรับใช้ PROP-045 (spec v0.22.0): นิยาม predicate การทับซ้อนใน strategic_pricing — +MillStrategicConfig; invariant resolver เดียว (NFR-58); ตรวจเฉพาะตอน publish พร้อม supersede สองขั้น
0.12.02026-07-23PROP-044 applied (spec v0.23.0): PlanVersion lifecycle defined — pending | active | superseded | cancelled; one pending, cancel-and-replace, all-or-nothing activation; acceptance-time boundary bucketing, no cross-boundary retro re-rate; renegotiation-worklist propagation; +events PlanVersionActivated / PlanAdjustmentCancelled (strategic_pricing).ปรับใช้ PROP-044 (spec v0.23.0): นิยามวงจรชีวิต PlanVersion — pending | active | superseded | cancelled; pending ทีละหนึ่ง ยกเลิกแล้วแทนที่ activate ทั้งหมดหรือไม่เลย; จัดตามการรับมอบ ไม่ re-rate ข้ามขอบ; ส่งผลต่อผ่าน worklist เจรจา; +event PlanVersionActivated / PlanAdjustmentCancelled (strategic_pricing)
0.13.02026-07-24PROP-043 approved & applied (spec v0.24.0): +checkpoint_evidence context (CheckpointRegistration · EvidencePhoto · TripTrace) wrapping strategic_pricing's StampEvent; 6 events (CheckpointRegistered/TicketPrinted, RegistrationMatched/Expired, RouteAbandonSuspected advisory, TamperSuspected); evidence contract C-1…C-6; scoped amendment on the on_site_gateway HCL posture (checkpoint kits platform-supplied, OQ-26).PROP-043 อนุมัติและปรับใช้ (spec v0.24.0): +context checkpoint_evidence ห่อ StampEvent; event ใหม่ 6 ตัว; สัญญาหลักฐาน C-1…C-6; หมายเหตุแก้ไขจำกัดขอบเขตท่าที HCL (ชุด checkpoint จัดหาโดย platform, OQ-26)
0.14.02026-07-29PROP-061 applied — spec v0.33.0. Section 2 gains the lane model inside gate_queue: QueueLane (definitions — truck class × cane class × role, mill-named, published, versioned) and QueueLaneInstance (the lines that stand in the yard today, opened by overflow inside the issuing transaction, never by an operator — D-5), with the two aggregate boundaries in Section 4 and the three new events QueueLaneOpened · QueueLaneReleased · QueueLaneChanged. The queue-ticket state machine is unchanged — batch release drives the existing per-ticket QueueCalled.apply PROP-061 — spec v0.33.0 ข้อ 2 เพิ่มแบบจำลองแถวใน gate_queue: QueueLane (นิยามแถว) และ QueueLaneInstance (แถวที่ยืนอยู่จริงวันนี้ เปิดเพราะแถวเดิมเต็มภายใน transaction ของการออกบัตร ไม่ใช่เพราะมีคนสั่ง — D-5) พร้อมขอบเขต aggregate สองรายการในข้อ 4 และ event ใหม่สามตัว QueueLaneOpened · QueueLaneReleased · QueueLaneChanged state machine ของบัตรคิวไม่เปลี่ยน — การปล่อยเป็นชุดขับ QueueCalled รายบัตรที่มีอยู่เดิม
0.15.02026-07-29PROP-063 applied — spec v0.34.0. Section 2 gains express governance inside gate_queue: ExpressReason (its own aggregate — published, capped, effective-forward) and ExpressGrant + ExpressFlag (one boundary — the grant commits with the lane change AND the day's count, immutable, superseded when wrong). Events ExpressGranted · ExpressFlagged; no new state — a grant IS a governed lane change. PROP-034 abandoned in the same change set: there is no entitlement aggregate and no purchasable priority anywhere in the department.apply PROP-063 — spec v0.34.0 ข้อ 2 เพิ่มการกำกับแถวด่วนใน gate_queue: ExpressReason และ ExpressGrant + ExpressFlag ไม่มีสถานะใหม่ และยกเลิก PROP-034
0.16.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.16.12026-08-03PROP-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
0.17.02026-08-17Two boundaries around the money’s destination — spec v0.73.0 (PROP-085 approved & applied 17 Aug 2026). New aggregate roots PayeeAccount (with PayeeAccountEvent) and QuotaGroup (with QuotaGroupMember) in the settlement context, plus eight events. New Section 8.สองขอบเขตรอบปลายทางของเงิน — spec v0.73.0 (PROP-085 อนุมัติและ apply 17 ส.ค. 2569) เพิ่มราก aggregate PayeeAccount และ QuotaGroup ใน context settlement พร้อมแปดเหตุการณ์ เพิ่มข้อ 8
0.18.02026-08-17The strategic boundary, widened — spec v0.74.0 (PROP-090 approved & applied 17 Aug 2026). StrategicAgreement takes in AgreementAssignment, WithheldOutcome and AgreementNotice; MillStrategicConfig takes in ResolverPolicyVersion; a new QuotaHead root holds RelayDeclaration. Seven events and the writerless read model strategic_reconciliation. New Section 9.ขอบเขตกลยุทธ์ขยาย — spec v0.74.0 (PROP-090 อนุมัติและ apply 17 ส.ค. 2569) StrategicAgreement รับ AgreementAssignment WithheldOutcome และ AgreementNotice เข้ามา MillStrategicConfig รับ ResolverPolicyVersion และรากใหม่ QuotaHead ถือ RelayDeclaration เพิ่มเจ็ดเหตุการณ์และ read model strategic_reconciliation ที่ไม่มีผู้เขียน เพิ่มข้อ 9