# Check Light Status API ###### tags: `HH` ### Git repository: http://10.57.232.171:8888/ap5d2/data-mgmt-api ### 1.Dashboard燈號API: http://10.57.232.105:33000/checkLightStatusByDataCollector/<data_collector_id> - 取得方式 - Restful API - Method: GET - 測試機: - http://10.57.232.105:33000/checkLightStatusByDataCollector/A01/ - http://10.57.232.105:33000/checkLightStatusByDataCollector/A03/ - http://10.57.232.105:33000/checkLightStatusByDataCollector/A05/ - http://10.57.232.105:33000/checkLightStatusByDataCollector/A06/ - 正式機: - http://10.160.29.105:33000/checkLightStatusByDataCollector/A01/ - http://10.160.29.105:33000/checkLightStatusByDataCollector/A03/ - http://10.160.29.105:33000/checkLightStatusByDataCollector/A05/ - http://10.160.29.105:33000/checkLightStatusByDataCollector/A06/ - API Response example: ``` { "responseCode": 200, "responseMessage": "OK", "result": { "status": "ping=success; connection=success; machineStatus=全自動; spc_0=10080; timestamp=2019/08/19 18:58:28", "lightColor": "icon_idle" } } ``` - response - lightColor list | 燈號狀態 | Dashboard(lightColor) | |:--------- |:---- | | 生產中/全自動 | green | | 生產中/半自動 | yellow | | Data Collector Ping不到控制器 | gray | | Data Collector 無法連接控制器 | icon_disconnected | | 生產逾時(5分鐘) | icon_idle | - status list <table> <tr> <td><b>Attribute</b></td> <td><b>Dashboard(lightColor)</b></td> </tr> <tr> <td rowspan="2">ping</td> <td >success</td> </tr> <tr> <td >fail</td> </tr> <tr> <td rowspan="2">connection</td> <td >success</td> </tr> <tr> <td >fail</td> </tr> <tr> <td rowspan="3">machineStatus</td> <td >全自動</td> </tr> <tr> <td >半自動</td> </tr> <tr> <td >手動</td> </tr> </table> - 流程圖: ![](https://i.imgur.com/dF0BEin.jpg) - 邏輯: 1. 判斷是否ping得到控制器(呼叫Collect API -> /Check/Ping) - 否, 顯示灰燈 - 是, ->繼續判斷第二步驟 2. 是否有連接到控制器(呼叫Collect API -> /Check/Connect) - 否, 顯示Icon - 是, ->繼續判斷第三步驟 3. 最後查詢目前機器狀態(全自動, 半自動, 手動) - 機器狀態為全自動, 顯示綠燈 - 機器狀態為手動 / 半自動, 顯示黃燈 ### 2.TPM燈號API: http://10.57.232.105:33000/checkNewLightStatusByDataCollector/<data_collector_id> - 取得方式 - Restful API - Method: GET - 正式機: - http://10.160.29.105:33000/checkNewLightStatusByDataCollector/A01/ - http://10.160.29.105:33000/checkNewLightStatusByDataCollector/A03/ - http://10.160.29.105:33000/checkNewLightStatusByDataCollector/A05/ - http://10.160.29.105:33000/checkNewLightStatusByDataCollector/A06/ - API Response example: ``` { "responseCode": 200, "responseMessage": "OK", "result": { "status": "ping=success; connection=success; machineStatus=全自動; spc_0=118748; timestamp=2019-10-17 13:16:16.866", "lightColor": "green", "lightStatus": "run" } } ``` - response - lightColor與lightStatus對應表 | 燈號狀態 | TPM(lightColor) | TPM UI(lightStatus) | |:--------- |:--------- |:---- | | 生產中 | green | run | | Data Collector Ping不到控制器 | red | down | | Data Collector 無法連接控制器 | gray | issued | | 生產逾時(5分鐘) | yellow | idle | - lightColor對應APP UI的位置 ![](https://i.imgur.com/OEAXNCs.jpg) - lightStatus對應APP UI的位置 ![](https://i.imgur.com/SJeCBK4.jpg) - 流程圖與邏輯:與Dashboard燈號API相同 舊版與新版的燈號比較 - lightColor list | 燈號狀態 | Dashboard(lightColor) | TPM(lightColor) | |:--------- |:---- |:---- | | 生產中/全自動 | green | green | | 生產中/半自動 | yellow | green | | Data Collector Ping不到控制器 | gray | red | | Data Collector 無法連接控制器 | icon_disconnected | gray | | 生產逾時(5分鐘) | icon_idle |yellow |