新增 POS 庫存查詢 API:實作 InventorySyncController 與相關 Service 邏輯,並更新 API 整合手冊
All checks were successful
ERP-Deploy-Demo / deploy-demo (push) Successful in 1m24s
All checks were successful
ERP-Deploy-Demo / deploy-demo (push) Successful in 1m24s
This commit is contained in:
@@ -73,7 +73,57 @@ Star ERP 系統提供外部整合 API (Integration API) 供電商前台、POS
|
||||
|
||||
---
|
||||
|
||||
## 2. 訂單資料寫入與扣庫 (Create Order)
|
||||
## 2. 門市庫存查詢 (Query Inventory)
|
||||
|
||||
此 API 用於讓外部系統(如 POS)依據特定的「倉庫代碼」,查詢該倉庫目前所有商品的庫存餘額。
|
||||
**注意**:此 API 會回傳該倉庫內的所有商品數量,不論該商品是否已綁定外部 POS ID。
|
||||
|
||||
- **Endpoint**: `/inventory/{warehouse_code}`
|
||||
- **Method**: `GET`
|
||||
|
||||
### URL 路徑參數
|
||||
|
||||
| 參數名稱 | 類型 | 必填 | 說明 |
|
||||
| :--- | :--- | :---: | :--- |
|
||||
| `warehouse_code` | String | **是** | 要查詢的倉庫代碼 (例如:`STORE-001`) |
|
||||
|
||||
### Response
|
||||
|
||||
**Success (HTTP 200)**
|
||||
回傳該倉庫內所有的商品目前庫存總數。若商品未建置 `external_pos_id`,該欄位將顯示為 `null`。
|
||||
```json
|
||||
{
|
||||
"status": "success",
|
||||
"warehouse_code": "STORE-001",
|
||||
"data": [
|
||||
{
|
||||
"external_pos_id": "POS-ITEM-001",
|
||||
"product_code": "PROD-A001",
|
||||
"product_name": "特級冷壓初榨橄欖油 500ml",
|
||||
"quantity": 15
|
||||
},
|
||||
{
|
||||
"external_pos_id": null,
|
||||
"product_code": "MAT-001",
|
||||
"product_name": "未包裝干貝醬原料",
|
||||
"quantity": 2.5
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
**Error: Warehouse Not Found (HTTP 404)**
|
||||
當傳入系統中不存在的倉庫代碼時發生。
|
||||
```json
|
||||
{
|
||||
"status": "error",
|
||||
"message": "Warehouse with code 'STORE-999' not found."
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 3. 訂單資料寫入與扣庫 (Create Order)
|
||||
|
||||
此 API 用於讓第三方系統(如 POS 結帳後)將「已成交」的訂單推送到 ERP。
|
||||
**重要提醒**:寫入訂單的同時,ERP 會自動且**強制**扣除對應倉庫的庫存(允許扣至負數,以利後續盤點或補單)。
|
||||
|
||||
Reference in New Issue
Block a user