ดึงรายงานสรุป Stock ของ Warehouse หนึ่ง ณ ขณะที่เรียก API
Endpoint นี้คืนข้อมูลสรุป (Aggregate) เพียง response เดียว ไม่ใช้ Pagination — เหมาะสำหรับ Dashboard ที่ต้องการภาพรวม Stock Value และ Out-of-stock ทันที
Endpoint นี้เหมาะสำหรับ:
read:reports
Access Token ต้องได้รับ Scope read:reports มิฉะนั้นระบบจะปฏิเสธคำขอ
GET /api/partner/v1/reports/inventory-summary
Authorization: Bearer <access_token>
| Parameter | Type | Required | Description |
|---|---|---|---|
| warehouse_id | string (UUID) | Yes | Warehouse ที่ต้องการดึงรายงาน ต้องอยู่ใน Branch ที่ Token's allowed_branch_ids อนุญาต |
curl -X GET \
"https://<host>/api/partner/v1/reports/inventory-summary?warehouse_id=1c5e4054-faef-4fb4-b95b-3baeefc2bcb9" \
-H "Authorization: Bearer <access_token>"
{
"data": {
"warehouse_id": "1c5e4054-faef-4fb4-b95b-3baeefc2bcb9",
"warehouse_name": "Main Storage",
"branch_id": "b1f85720-71cf-420e-a584-e36b75d3fd20",
"total_skus": 24,
"total_quantity_on_hand": "226",
"total_quantity_available": "216",
"total_stock_value": "60997.3",
"out_of_stock_count": 18
}
}
| Field | Type | Description |
|---|---|---|
| warehouse_id | string (UUID) | Warehouse ที่รายงาน |
| warehouse_name | string | ชื่อ Warehouse |
| branch_id | string (UUID) | สาขาของ Warehouse นี้ |
| total_skus | number | จำนวน SKU ทั้งหมดที่ติดตาม Stock ใน Warehouse นี้ |
| total_quantity_on_hand | string (decimal) | จำนวน Stock รวมทุก SKU |
| total_quantity_available | string (decimal) | จำนวน Stock ที่พร้อมใช้รวมทุก SKU (on_hand − reserved) |
| total_stock_value | string (decimal) | มูลค่า Stock รวมทุก SKU (ต้นทุนเฉลี่ย × จำนวน) |
| out_of_stock_count | number | จำนวน SKU ที่มี quantity_on_hand ≤ 0 |
404 Not Found
{
"error": "not_found",
"message": "Warehouse not found"
}
สาเหตุ:
warehouse_id ไม่ถูกต้องallowed_branch_ids)