251206:1400 version 1.5.1
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
|
||||
---
|
||||
title: 'Functional Requirements: Document Numbering Management'
|
||||
version: 1.6.0
|
||||
version: 1.5.1
|
||||
status: draft
|
||||
owner: Nattanin Peancharoen
|
||||
last_updated: 2025-12-02
|
||||
@@ -35,16 +35,16 @@ related:
|
||||
|
||||
### Counter Key Components
|
||||
|
||||
| Component | Required? | Description | Database Source | Default if NULL |
|
||||
|-----------|-----------|-------------|-----------------|-----------------|
|
||||
| `project_id` | ✅ Yes | ID โครงการ | Derived from user context or organization | - |
|
||||
| `originator_organization_id` | ✅ Yes | ID องค์กรผู้ส่ง | `correspondences.originator_id` | - |
|
||||
| `recipient_organization_id` | Depends on type | ID องค์กรผู้รับหลัก (TO) | `correspondence_recipients` where `recipient_type = 'TO'` | NULL for RFA |
|
||||
| `correspondence_type_id` | ✅ Yes | ID ประเภทเอกสาร | `correspondence_types.id` | - |
|
||||
| `sub_type_id` | TRANSMITTAL only | ID ประเภทย่อย | `correspondence_sub_types.id` | 0 |
|
||||
| `rfa_type_id` | RFA only | ID ประเภท RFA | `rfa_types.id` | 0 |
|
||||
| `discipline_id` | RFA only | ID สาขางาน | `disciplines.id` | 0 |
|
||||
| `current_year` | ✅ Yes | ปี ค.ศ. | System year (ปัจจุบัน) | - |
|
||||
| Component | Required? | Description | Database Source | Default if NULL |
|
||||
| ---------------------------- | ---------------- | ------------------- | --------------------------------------------------------- | --------------- |
|
||||
| `project_id` | ✅ Yes | ID โครงการ | Derived from user context or organization | - |
|
||||
| `originator_organization_id` | ✅ Yes | ID องค์กรผู้ส่ง | `correspondences.originator_id` | - |
|
||||
| `recipient_organization_id` | Depends on type | ID องค์กรผู้รับหลัก (TO) | `correspondence_recipients` where `recipient_type = 'TO'` | NULL for RFA |
|
||||
| `correspondence_type_id` | ✅ Yes | ID ประเภทเอกสาร | `correspondence_types.id` | - |
|
||||
| `sub_type_id` | TRANSMITTAL only | ID ประเภทย่อย | `correspondence_sub_types.id` | 0 |
|
||||
| `rfa_type_id` | RFA only | ID ประเภท RFA | `rfa_types.id` | 0 |
|
||||
| `discipline_id` | RFA only | ID สาขางาน | `disciplines.id` | 0 |
|
||||
| `current_year` | ✅ Yes | ปี ค.ศ. | System year (ปัจจุบัน) | - |
|
||||
|
||||
### Counter Key แยกตามประเภทเอกสาร
|
||||
|
||||
@@ -228,19 +228,19 @@ Drawing Numbering ยังไม่ได้กำหนด Template เนื
|
||||
|
||||
## 3.11.4. Supported Token Types
|
||||
|
||||
| Token | Description | Example | Database Source |
|
||||
|-------|-------------|---------|-----------------|
|
||||
| `{PROJECT}` | รหัสโครงการ | `LCBP3`, `LCBP3-C2` | `projects.project_code` |
|
||||
| `{ORIGINATOR}` | รหัสองค์กรผู้ส่ง | `คคง.`, `ผรม.1` | `organizations.organization_code` via `correspondences.originator_id` |
|
||||
| `{RECIPIENT}` | รหัสองค์กรผู้รับหลัก (TO) | `สคฉ.3`, `กทท.` | `organizations.organization_code` via `correspondence_recipients` where `recipient_type = 'TO'` |
|
||||
| `{CORR_TYPE}` | รหัสประเภทเอกสาร | `RFA`, `TRANSMITTAL`, `LETTER` | `correspondence_types.type_code` |
|
||||
| `{SUB_TYPE}` | หมายเลขประเภทย่อย | `11`, `12`, `21` | `correspondence_sub_types.sub_type_number` |
|
||||
| `{RFA_TYPE}` | รหัสประเภท RFA | `SDW`, `RPT`, `MAT` | `rfa_types.type_code` |
|
||||
| `{DISCIPLINE}` | รหัสสาขาวิชา | `STR`, `TER`, `GEO` | `disciplines.discipline_code` |
|
||||
| `{SEQ:n}` | Running number (n = จำนวนหลัก) | `0001`, `0029`, `0985` | Based on `document_number_counters.last_number + 1` |
|
||||
| `{YEAR:B.E.}` | ปี พ.ศ. | `2568` | `document_number_counters.current_year + 543` |
|
||||
| `{YEAR:A.D.}` | ปี ค.ศ. | `2025` | `document_number_counters.current_year` |
|
||||
| `{REV}` | Revision Code | `A`, `B`, `AA` | `correspondence_revisions.revision_label` |
|
||||
| Token | Description | Example | Database Source |
|
||||
| -------------- | ---------------------------- | ------------------------------ | ----------------------------------------------------------------------------------------------- |
|
||||
| `{PROJECT}` | รหัสโครงการ | `LCBP3`, `LCBP3-C2` | `projects.project_code` |
|
||||
| `{ORIGINATOR}` | รหัสองค์กรผู้ส่ง | `คคง.`, `ผรม.1` | `organizations.organization_code` via `correspondences.originator_id` |
|
||||
| `{RECIPIENT}` | รหัสองค์กรผู้รับหลัก (TO) | `สคฉ.3`, `กทท.` | `organizations.organization_code` via `correspondence_recipients` where `recipient_type = 'TO'` |
|
||||
| `{CORR_TYPE}` | รหัสประเภทเอกสาร | `RFA`, `TRANSMITTAL`, `LETTER` | `correspondence_types.type_code` |
|
||||
| `{SUB_TYPE}` | หมายเลขประเภทย่อย | `11`, `12`, `21` | `correspondence_sub_types.sub_type_number` |
|
||||
| `{RFA_TYPE}` | รหัสประเภท RFA | `SDW`, `RPT`, `MAT` | `rfa_types.type_code` |
|
||||
| `{DISCIPLINE}` | รหัสสาขาวิชา | `STR`, `TER`, `GEO` | `disciplines.discipline_code` |
|
||||
| `{SEQ:n}` | Running number (n = จำนวนหลัก) | `0001`, `0029`, `0985` | Based on `document_number_counters.last_number + 1` |
|
||||
| `{YEAR:B.E.}` | ปี พ.ศ. | `2568` | `document_number_counters.current_year + 543` |
|
||||
| `{YEAR:A.D.}` | ปี ค.ศ. | `2025` | `document_number_counters.current_year` |
|
||||
| `{REV}` | Revision Code | `A`, `B`, `AA` | `correspondence_revisions.revision_label` |
|
||||
|
||||
### Token Usage Notes
|
||||
|
||||
@@ -309,12 +309,12 @@ Drawing Numbering ยังไม่ได้กำหนด Template เนื
|
||||
|
||||
ระบบ**ต้อง**จัดการ error scenarios ต่อไปนี้:
|
||||
|
||||
| Scenario | Strategy | Max Retries | Expected Response |
|
||||
|----------|----------|-------------|-------------------|
|
||||
| Redis Unavailable | Fallback to DB Lock | 0 | Continue (degraded performance) |
|
||||
| Lock Timeout | Exponential Backoff | 5 | HTTP 503 after final retry |
|
||||
| Version Conflict | Immediate Retry | 2 | HTTP 409 after final retry |
|
||||
| DB Connection Error | Exponential Backoff | 3 | HTTP 500 after final retry |
|
||||
| Scenario | Strategy | Max Retries | Expected Response |
|
||||
| ------------------- | ------------------- | ----------- | ------------------------------- |
|
||||
| Redis Unavailable | Fallback to DB Lock | 0 | Continue (degraded performance) |
|
||||
| Lock Timeout | Exponential Backoff | 5 | HTTP 503 after final retry |
|
||||
| Version Conflict | Immediate Retry | 2 | HTTP 409 after final retry |
|
||||
| DB Connection Error | Exponential Backoff | 3 | HTTP 500 after final retry |
|
||||
|
||||
**Implementation Details:** ดู [Implementation Guide - Section 2.5](file:///e:/np-dms/lcbp3/specs/03-implementation/document-numbering.md#25-main-service-with-retry-logic)
|
||||
|
||||
@@ -390,20 +390,20 @@ Drawing Numbering ยังไม่ได้กำหนด Template เนื
|
||||
|
||||
**SLA Targets:**
|
||||
|
||||
| Metric | Target | Notes |
|
||||
|--------|--------|-------|
|
||||
| 95th percentile | ≤ 2 วินาที | ตั้งแต่ request ถึง response |
|
||||
| 99th percentile | ≤ 5 วินาที | รวม retry attempts |
|
||||
| Normal operation | ≤ 500ms | ไม่มี retry |
|
||||
| Metric | Target | Notes |
|
||||
| ---------------- | -------- | ------------------------ |
|
||||
| 95th percentile | ≤ 2 วินาที | ตั้งแต่ request ถึง response |
|
||||
| 99th percentile | ≤ 5 วินาที | รวม retry attempts |
|
||||
| Normal operation | ≤ 500ms | ไม่มี retry |
|
||||
|
||||
### 3.11.9.2. Throughput
|
||||
|
||||
**Capacity Targets:**
|
||||
|
||||
| Load Level | Target | Notes |
|
||||
|------------|--------|-------|
|
||||
| Normal load | ≥ 50 req/s | ใช้งานปกติ |
|
||||
| Peak load | ≥ 100 req/s | ช่วงเร่งงาน |
|
||||
| Load Level | Target | Notes |
|
||||
| ----------- | ----------- | --------- |
|
||||
| Normal load | ≥ 50 req/s | ใช้งานปกติ |
|
||||
| Peak load | ≥ 100 req/s | ช่วงเร่งงาน |
|
||||
|
||||
### 3.11.9.3. Availability
|
||||
|
||||
@@ -437,13 +437,13 @@ Drawing Numbering ยังไม่ได้กำหนด Template เนื
|
||||
|
||||
ระบบ**ต้อง**alert สำหรับ conditions ต่อไปนี้:
|
||||
|
||||
| Severity | Condition | Action |
|
||||
|----------|-----------|--------|
|
||||
| Severity | Condition | Action |
|
||||
| ---------- | ---------------------------- | ----------------- |
|
||||
| 🔴 Critical | Redis unavailable > 1 minute | PagerDuty + Slack |
|
||||
| 🔴 Critical | Lock failures > 10% in 5 min | PagerDuty + Slack |
|
||||
| 🟡 Warning | Lock failures > 5% in 5 min | Slack |
|
||||
| 🟡 Warning | Avg lock wait time > 1 sec | Slack |
|
||||
| 🟡 Warning | Retry count > 100/hour | Slack |
|
||||
| 🟡 Warning | Lock failures > 5% in 5 min | Slack |
|
||||
| 🟡 Warning | Avg lock wait time > 1 sec | Slack |
|
||||
| 🟡 Warning | Retry count > 100/hour | Slack |
|
||||
|
||||
### 3.11.10.3. Dashboard
|
||||
|
||||
|
||||
@@ -68,17 +68,11 @@ related:
|
||||
|
||||
### **4.7. Master Data Management**
|
||||
|
||||
| Master Data | Manager | Scope |
|
||||
| :-------------------------------------- | :------------------------------ | :--------------------------------- |
|
||||
| Document Type (Correspondence, RFA) | **Superadmin** | Global |
|
||||
| Document Status (Draft, Approved, etc.) | **Superadmin** | Global |
|
||||
| Master Data | Manager | Scope |
|
||||
| :-------------------------------------- | :------------------------------ | :------------------------------ |
|
||||
| Document Type (Correspondence, RFA) | **Superadmin** | Global |
|
||||
| Document Status (Draft, Approved, etc.) | **Superadmin** | Global |
|
||||
| Shop Drawing Category | **Project Manager** | Project (สร้างใหม่ได้ภายในโครงการ) |
|
||||
| Tags | **Org Admin / Project Manager** | Organization / Project |
|
||||
| Custom Roles | **Superadmin / Org Admin** | Global / Organization |
|
||||
| Document Numbering Formats | **Superadmin / Admin** | Global / Organization |
|
||||
|
||||
## 🔐 4.1 การจัดการผู้ใช้ (User Management)
|
||||
|
||||
## 🔐 4.2 การจัดการบทบาท (Role Management)
|
||||
|
||||
## 🔐 4.3 การจัดการสิทธิ์ (Permission Management)
|
||||
| Tags | **Org Admin / Project Manager** | Organization / Project |
|
||||
| Custom Roles | **Superadmin / Org Admin** | Global / Organization |
|
||||
| Document Numbering Formats | **Superadmin / Admin** | Global / Organization |
|
||||
|
||||
Reference in New Issue
Block a user