Update readmes and imporve UI
This commit is contained in:
@@ -648,6 +648,133 @@ async def calculate_customer_rfm(customer_id: UUID) -> dict:
|
||||
}
|
||||
```
|
||||
|
||||
### Alert Events
|
||||
|
||||
The Orders service also publishes procurement-related alerts through the alert processor.
|
||||
|
||||
**Exchange**: `events.exchange`
|
||||
**Domain**: `procurement`
|
||||
|
||||
#### 1. POs Pending Approval Alert
|
||||
**Event Type**: `procurement.pos_pending_approval`
|
||||
**Severity**: urgent (>€10,000), high (>€5,000 or critical POs), medium (otherwise)
|
||||
**Trigger**: New purchase orders created and awaiting approval
|
||||
|
||||
```json
|
||||
{
|
||||
"event_type": "procurement.pos_pending_approval",
|
||||
"severity": "high",
|
||||
"metadata": {
|
||||
"tenant_id": "uuid",
|
||||
"pos_count": 3,
|
||||
"total_amount": 6500.00,
|
||||
"critical_count": 1,
|
||||
"pos": [
|
||||
{
|
||||
"po_id": "uuid",
|
||||
"po_number": "PO-001",
|
||||
"supplier_id": "uuid",
|
||||
"total_amount": 3000.00,
|
||||
"auto_approved": false
|
||||
}
|
||||
],
|
||||
"action_required": true,
|
||||
"action_url": "/app/comprar"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
#### 2. Approval Reminder Alert
|
||||
**Event Type**: `procurement.approval_reminder`
|
||||
**Severity**: high (>36 hours pending), medium (otherwise)
|
||||
**Trigger**: PO not approved within threshold time
|
||||
|
||||
```json
|
||||
{
|
||||
"event_type": "procurement.approval_reminder",
|
||||
"severity": "high",
|
||||
"metadata": {
|
||||
"tenant_id": "uuid",
|
||||
"po_id": "uuid",
|
||||
"po_number": "PO-001",
|
||||
"supplier_name": "Supplier ABC",
|
||||
"total_amount": 3000.00,
|
||||
"hours_pending": 40,
|
||||
"created_at": "2025-12-18T10:00:00Z",
|
||||
"action_required": true,
|
||||
"action_url": "/app/comprar?po=uuid"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
#### 3. Critical PO Escalation Alert
|
||||
**Event Type**: `procurement.critical_po_escalation`
|
||||
**Severity**: urgent
|
||||
**Trigger**: Critical/urgent PO not approved in time
|
||||
|
||||
```json
|
||||
{
|
||||
"event_type": "procurement.critical_po_escalation",
|
||||
"severity": "urgent",
|
||||
"metadata": {
|
||||
"tenant_id": "uuid",
|
||||
"po_id": "uuid",
|
||||
"po_number": "PO-001",
|
||||
"supplier_name": "Supplier ABC",
|
||||
"total_amount": 5000.00,
|
||||
"priority": "urgent",
|
||||
"required_delivery_date": "2025-12-22",
|
||||
"hours_pending": 48,
|
||||
"escalated": true,
|
||||
"action_required": true,
|
||||
"action_url": "/app/comprar?po=uuid"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
#### 4. Auto-Approval Summary (Notification)
|
||||
**Event Type**: `procurement.auto_approval_summary`
|
||||
**Type**: Notification (not alert)
|
||||
**Trigger**: Daily summary of auto-approved POs
|
||||
|
||||
```json
|
||||
{
|
||||
"event_type": "procurement.auto_approval_summary",
|
||||
"metadata": {
|
||||
"tenant_id": "uuid",
|
||||
"auto_approved_count": 5,
|
||||
"total_auto_approved_amount": 8500.00,
|
||||
"manual_approval_count": 2,
|
||||
"summary_date": "2025-12-19",
|
||||
"auto_approved_pos": [...],
|
||||
"pending_approval_pos": [...],
|
||||
"action_url": "/app/comprar"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
#### 5. PO Approved Confirmation (Notification)
|
||||
**Event Type**: `procurement.po_approved_confirmation`
|
||||
**Type**: Notification (not alert)
|
||||
**Trigger**: Purchase order approved
|
||||
|
||||
```json
|
||||
{
|
||||
"event_type": "procurement.po_approved_confirmation",
|
||||
"metadata": {
|
||||
"tenant_id": "uuid",
|
||||
"po_id": "uuid",
|
||||
"po_number": "PO-001",
|
||||
"supplier_name": "Supplier ABC",
|
||||
"total_amount": 3000.00,
|
||||
"approved_by": "user@example.com",
|
||||
"auto_approved": false,
|
||||
"approved_at": "2025-12-19T14:30:00Z",
|
||||
"action_url": "/app/comprar?po=uuid"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Consumed Events
|
||||
- **From Production**: Batch completion updates order fulfillment status
|
||||
- **From Inventory**: Stock availability affects order confirmation
|
||||
|
||||
Reference in New Issue
Block a user