# 機台開櫃(同步等待版本) **機台開櫃(單一櫃或多櫃),等待實際開門結果後才回傳** #### 網址 {domain}/smart-daily/machine/open-lane-sync #### 認證方式 Authoriztion : Bearer Token #### Method POST #### 傳入參數 |欄位名稱|必填|型態|欄位|備註| | ------------ | :-----------: |:-----------: |------------ |------------ | |slave_id|Y|string|機台號|| |lanes|Y|array|門櫃編號|| #### 回傳參數 |Name|Type|說明| | ------------ | ------------ |------------ | |command_id | string| 此次指令ID | |command_result | array| 櫃門開啟結果資訊| |command_result.slave_id | string| 機台號| |command_result.lane_id | int| 門櫃編號 | |command_result.command_status | bool| 指令是否正確發送出去| |command_result.open_status | int| 開門狀態:-1(等待中/超時未回應)、0(開門失敗)、1(開門成功)| #### 注意事項 - 此 API 會等待 MQTT 回應,最多等待 10 秒 - 每 0.5 秒輪詢一次資料庫檢查開門結果 - 若超過 10 秒未收到回應,`open_status` 會保持 -1(等待中) - 與 `/machine/open-lane` 差異:此版本會等待實際開門結果才回傳,無需再呼叫 `/machine/all-door-status` #### Request Authoriztion ```json { Bearer Token : "token string..." } ``` #### Json Example Request Json ```json { "body": { "slave_id": "A1", "lanes": [1, 3] } } ``` Response Json Success ```json { "status": true, "message": "成功", "data": { "command_id": "5FDDBCD6588E8F7376130DFD2CD90CA6", "command_result": [ { "slave_id": "A1", "lane_id": 1, "command_status": true, "open_status": 1 }, { "slave_id": "A1", "lane_id": 3, "command_status": true, "open_status": 1 } ] } } ``` Response Json Success (部分超時) ```json { "status": true, "message": "成功", "data": { "command_id": "5FDDBCD6588E8F7376130DFD2CD90CA6", "command_result": [ { "slave_id": "A1", "lane_id": 1, "command_status": true, "open_status": 1 }, { "slave_id": "A1", "lane_id": 3, "command_status": true, "open_status": -1 } ] } } ``` Response Json Error ```json { "status": false, "message": "No data Found", "errors": "" } ``` #### open_status 狀態說明 |狀態值|說明| | ------------ | ------------ | |-1|等待中 / 超時未回應(超過 10 秒)| |0|開門失敗(設備回報失敗)| |1|開門成功(設備回報成功)|