diff --git a/.agents/skills/api-technical-specs/SKILL.md b/.agents/skills/api-technical-specs/SKILL.md index 6257d25..5f68fc0 100644 --- a/.agents/skills/api-technical-specs/SKILL.md +++ b/.agents/skills/api-technical-specs/SKILL.md @@ -149,24 +149,10 @@ description: 本技能規範定義了 Star Cloud 系統中所有機台 (IoT) 與 --- -### 3.6 B013: 機台故障與異常狀態上報 (Error/Status Report) -用於接收機台發出的即時硬體狀態代碼(如卡貨、門未關),並自動由雲端後端翻譯為易讀日誌。 - -- **URL**: POST /api/v1/app/machine/error/B013 -- **Authentication**: Bearer Token (Header) -- **Request Body:** - -| 參數 | 類型 | 必填 | 說明 | 範例 | -| :--- | :--- | :--- | :--- | :--- | -| tid | Integer | 否 | 涉及之貨道編號 (Slot No) | 12 | -| error_code | String | 是 | 硬體狀態代碼 (4 位 16 進位) | "0403" | - -- **回應 (Success 202):** - -| 參數 | 類型 | 說明 | 範例 | -| :--- | :--- | :--- | :--- | -| success | Boolean | 請求已接收 | true | -| code | Integer | 200 | 200 | +### 3.6 B013: [DEPRECATED / REMOVED] 機台故障與異常狀態上報 +> [!WARNING] +> **此 REST API 已廢棄並移除**。機台異常上報已全面遷移至 **MQTT** 即時通訊架構。 +> 請參閱 [MQTT 通訊規範 - B013 異常上報](file:///home/mama/projects/star-cloud/.agents/skills/mqtt-communication-specs/SKILL.md#32-異常與錯誤上報-b013) 進行串接。 #### B013 硬體代碼對照表 (由 MachineService 自動翻譯) diff --git a/app/Http/Controllers/Api/V1/App/MachineController.php b/app/Http/Controllers/Api/V1/App/MachineController.php index eb0e62d..08a3b43 100644 --- a/app/Http/Controllers/Api/V1/App/MachineController.php +++ b/app/Http/Controllers/Api/V1/App/MachineController.php @@ -430,23 +430,6 @@ class MachineController extends Controller ]); } - /** - * B013: Report Machine Hardware Error/Status (Asynchronous) - */ - public function reportError(Request $request) - { - $machine = $request->get('machine'); - $data = $request->only(['tid', 'error_code']); - - // 異步分派處理 (Dispatch to queue) - ProcessMachineError::dispatch($machine->serial_no, $data); - - return response()->json([ - 'success' => true, - 'code' => 200, - 'message' => __('Error report accepted'), - ], 202); // 202 Accepted - } /** * B014: Download Machine Settings & Config (Synchronous) diff --git a/config/api-docs.php b/config/api-docs.php index 0112cb5..161f242 100644 --- a/config/api-docs.php +++ b/config/api-docs.php @@ -410,54 +410,6 @@ return [ ], 'notes' => '運作邏輯 (Client-side Logic): GET 執行全量同步,App 應於收到成功回應後,先執行 deleteAll() 再進行 insertAll()。PATCH 執行增量更新,App 僅對記憶體中的既存商品進行欄位值覆蓋 (Patching)。' ], - [ - 'name' => 'B013: 機台故障與異常狀態上報 (Error/Status Report)', - 'slug' => 'b013-error-report', - 'method' => 'POST', - 'path' => '/api/v1/app/machine/error/B013', - 'description' => '用於接收機台發出的即時硬體狀態代碼(如卡貨、門未關)。身份由 Bearer Token 識別,回傳成功代表伺服器已將任務列入異步隊列處理。', - 'headers' => [ - 'Authorization' => 'Bearer ', - 'Content-Type' => 'application/json', - ], - 'parameters' => [ - 'tid' => [ - 'type' => 'integer', - 'required' => false, - 'description' => '涉及到之具體貨道編號 (Slot No)', - 'example' => 12 - ], - 'error_code' => [ - 'type' => 'string', - 'required' => true, - 'description' => '硬體狀態代碼 (4 位 16 進位字串)', - 'example' => '0403' - ], - ], - 'response_parameters' => [ - 'success' => [ - 'type' => 'boolean', - 'description' => '請求是否已成功接收', - 'example' => true - ], - 'code' => [ - 'type' => 'integer', - 'description' => '內部業務狀態碼', - 'example' => 200 - ], - ], - 'request' => [ - 'tid' => 12, - 'error_code' => '0403', - ], - 'response' => [ - 'success' => true, - 'code' => 200, - 'message' => 'Error report accepted' - ], - 'notes' => '硬體代碼對照表見後端 MachineService::ERROR_CODE_MAP 定義。 -0402: 出貨成功, 0403: 貨道卡貨, 0202: 貨道缺貨, 0415: 取貨門異常...等。' - ], [ 'name' => 'B017: 貨道庫存同步 (Slot Synchronization)', 'slug' => 'b017-slot-sync', diff --git a/routes/api.php b/routes/api.php index c110905..936abba 100644 --- a/routes/api.php +++ b/routes/api.php @@ -71,8 +71,6 @@ Route::prefix('v1')->middleware(['throttle:api'])->group(function () { // 統一商品主檔 API (B012 整合版) Route::match(['get', 'patch'], 'machine/products/B012', [App\Http\Controllers\Api\V1\App\MachineController::class, 'getProducts']); - // 機台故障與異常上報 (B013) - Route::post('machine/error/B013', [App\Http\Controllers\Api\V1\App\MachineController::class, 'reportError']); // 遠端指令出貨控制 (B055) Route::get('machine/dispense/B055', [App\Http\Controllers\Api\V1\App\MachineController::class, 'getDispenseQueue']);