SRI2024032514-机房端http接口文档.txt 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284
  1. # --- test 获取token ---
  2. service_url = 'http://10.10.61.229:9000'
  3. url = f'{service_url}/token/api'
  4. data = {
  5. 'username': 'admin',
  6. 'password': 'admin',
  7. }
  8. response = requests.post(url=url, json=data)
  9. print(response.headers)
  10. """
  11. {
  12. 'date': 'Thu, 04 Jan 2024 07:19:58 GMT',
  13. 'server': 'uvicorn',
  14. # 登录token
  15. 'authorization': 'eyJhbGciOiJIUzUxMiIsImlhdCI6MTcwNDM1Mjc5OCwiZXhwIjoxNzA0NDM5MTk4fQ.eyJpZCI6IjY1NGUzNmI0NjBmZGE0M2UzOTI2YzNmYiIsInVzZXJuYW1lIjoiYWRtaW4iLCJwYXNzd29yZCI6InBia2RmMjpzaGEyNTY6MTUwMDAwJGxEN1duR0hxJGUyNjhhNzgxOTFhYjdiNDE2ZDcxZjE1MDkxNzJjZWVkZWI3ZTNmNTM1ZGY0MGQ5NmQ4MzZlYmRjNTFmZGRmMzkifQ.IGi0lXezecP5AEjxgQ4lzQ5jyeYwDLoGmD7n29Q_1X6faSo4EKj4Q8A89BiAKBhjGAiNe7FSBFjmqhoZEXacUg',
  16. 'content-length': '107',
  17. 'content-type': 'application/json'
  18. }
  19. """
  20. print(response.json())
  21. """
  22. {
  23. 'code': 0 # 错误码 {0: 无异常}
  24. 'message': 'authorization passed.',
  25. 'uid': '654e36b460fda43e3926c3fb', # 用户id
  26. 'role_name': '超级管理员',
  27. }
  28. """
  29. # --- test 2001 获取全部渣包车状态 ---
  30. url = 'http://10.10.61.229:9000/v5/api'
  31. data = {
  32. 'code': 2001, # 接口号
  33. }
  34. response = requests.post(url=url, json=data, headers={'authorization': token})
  35. print(response.json())
  36. """
  37. {
  38. 'code': 0,
  39. 'data': [
  40. {
  41. 'uuid': 'aabbssff', # 渣包车唯一标识
  42. 'name': '6号车', # 别称
  43. 'status': 1 # 状态 # 1:离线 2:在线空闲 3: 人工驾驶中 4: 远程驾驶中 5: 自动驾驶中
  44. }
  45. ]
  46. }
  47. """
  48. # --- test 2002 指定渣包车点火操作接口 ---
  49. url = 'http://10.10.61.229:9000/v5/api'
  50. data = {
  51. 'code': 2002, # 接口号
  52. 'uuid': 'aassfafe', # 渣包车唯一标识
  53. }
  54. response = requests.post(url=url, json=data, headers={'authorization': token})
  55. print(response.json())
  56. """
  57. {
  58. 'code': 0,
  59. 'data': 'aassfafe'
  60. }
  61. """
  62. # --- test 2003 指定渣包车熄火操作接口 ---
  63. url = 'http://10.10.61.229:9000/v5/api'
  64. data = {
  65. 'code': 2003, # 接口号
  66. 'uuid': 'aassfafe', # 渣包车唯一标识
  67. }
  68. response = requests.post(url=url, json=data, headers={'authorization': token})
  69. print(response.json())
  70. """
  71. {
  72. 'code': 0,
  73. 'data': 'aassfafe'
  74. }
  75. """
  76. # --- test 2004 指定渣包车建立远程操作权限(或是切换)接口 ---
  77. url = 'http://10.10.61.229:9000/v5/api'
  78. data = {
  79. 'code': 2004, # 接口号
  80. 'uuid': 'aassfafe', # 渣包车唯一标识
  81. }
  82. response = requests.post(url=url, json=data, headers={'authorization': token})
  83. print(response.json())
  84. """
  85. {
  86. 'code': 0,
  87. 'data': 'aassfafe'
  88. }
  89. """
  90. # --- test 2005 开始作业接口(基于当前渣包车,选定作业内容) ---
  91. url = 'http://10.10.61.229:9000/v5/api'
  92. data = {
  93. 'code': 2005, # 接口号
  94. 'uuid': 'aassfafe', # 渣包车唯一标识
  95. 'task_type': 'aassfafe', # 作业类型 # 1: 叉包 2: 翻包 3:放包
  96. 'task_plan': [
  97. {'name': 'L20', 'x': '54', 'y': '211'},
  98. {'name': 'CD01端转弯圆心', 'x': '54', 'y': '211'},
  99. {'name': '#6倒渣口', 'x': '54', 'y': '211'},
  100. ], # 路径规划 # name: 包位名称/倒渣口名称/转弯圆心点坐标 x: 坐标值 y: 坐标值
  101. }
  102. response = requests.post(url=url, json=data, headers={'authorization': token})
  103. print(response.json())
  104. """
  105. {
  106. 'code': 0,
  107. 'data': 'aassfafe'
  108. }
  109. """
  110. # --- test 2101 新增渣包车接口 ---
  111. url = 'http://10.10.61.229:9000/v5/api'
  112. data = {
  113. 'code': 2101, # 接口号
  114. 'name': '3号车', # 别称
  115. }
  116. response = requests.post(url=url, json=data, headers={'authorization': token})
  117. print(response.json())
  118. """
  119. {
  120. 'code': 0,
  121. 'data': 'aassfafe'
  122. }
  123. """
  124. # --- test 2102 修改渣包车接口 ---
  125. url = 'http://10.10.61.229:9000/v5/api'
  126. data = {
  127. 'code': 2102, # 接口号
  128. 'uuid': '659765411dd2f1fe6d346b3b', # 渣包车唯一标识
  129. 'name': '6号车', # 别称
  130. }
  131. response = requests.post(url=url, json=data, headers={'authorization': token})
  132. print(response.json())
  133. """
  134. {
  135. 'code': 0,
  136. 'data': {
  137. 'uuid': '659765411dd2f1fe6d346b3b',
  138. 'name': '6号车',
  139. 'update_at': 1704435941
  140. }
  141. }
  142. """
  143. # --- test 2103 删除渣包车接口 ---
  144. url = 'http://10.10.61.229:9000/v5/api'
  145. data = {
  146. 'code': 2103, # 接口号
  147. 'uuid': '659764dd6b8e37c3ce95d849', # 渣包车唯一标识
  148. }
  149. response = requests.post(url=url, json=data, headers={'authorization': token})
  150. print(response.json())
  151. # --- test 3001 任务列表数据获取接口(分页) ---
  152. url = 'http://10.10.61.229:9000/v5/api'
  153. data = {
  154. 'code': 3001, # 接口号
  155. 'page': 1, # 分页
  156. 'size': 10, # 每页条数
  157. }
  158. response = requests.post(url=url, json=data, headers={'authorization': token})
  159. print(response.json())
  160. """
  161. {
  162. 'code': 0,
  163. 'data': [
  164. {
  165. 'uuid': '659765411dd2f1fe6d346b3b', # 任务id
  166. 'vehicle_uuid': '659765411dd2f1fe6d346b3b' # 任务车辆id
  167. }
  168. ],
  169. 'page': 1,
  170. 'size': 10,
  171. 'total': 1 # 总条数
  172. }
  173. """
  174. # --- test 3002 任务暂停接口 ---
  175. url = 'http://10.10.61.229:9000/v5/api'
  176. data = {
  177. 'code': 3002, # 接口号
  178. 'uuid': 'aassfafe', # 任务id
  179. }
  180. response = requests.post(url=url, json=data, headers={'authorization': token})
  181. print(response.json())
  182. """
  183. {
  184. 'code': 0,
  185. 'data': 'aassfafe'
  186. }
  187. """
  188. # --- test 3003 任务取消接口 ---
  189. url = 'http://10.10.61.229:9000/v5/api'
  190. data = {
  191. 'code': 3003, # 接口号
  192. 'uuid': 'aassfafe', # 任务id
  193. }
  194. response = requests.post(url=url, json=data, headers={'authorization': token})
  195. print(response.json())
  196. """
  197. {
  198. 'code': 0,
  199. 'data': 'aassfafe'
  200. }
  201. """
  202. # --- test 4001 获取全部渣包状态数据接口 ---
  203. url = 'http://10.10.61.229:9000/v5/api'
  204. data = {
  205. 'code': 4001, # 接口号
  206. }
  207. response = requests.post(url=url, json=data, headers={'authorization': token})
  208. print(response.json())
  209. """
  210. {
  211. 'code': 0,
  212. 'data': {
  213. '倒渣口-1': 1,
  214. '倒渣口-2': 1,
  215. '倒渣口-3': 1,
  216. '倒渣口-4': 1,
  217. '倒渣口-5': 1,
  218. '倒渣口-6': 1,
  219. '倒渣口-7': 1,
  220. '包位-A-1': 1,
  221. '包位-A-2': 1,
  222. '包位-A-3': 1,
  223. '包位-A-4': 1,
  224. '包位-A-5': 1,
  225. '包位-A-6': 1,
  226. '包位-A-7': 1,
  227. '包位-A-8': 1,
  228. '包位-A-9': 1,
  229. '包位-A-10': 1,
  230. '包位-A-11': 1,
  231. '包位-A-12': 1,
  232. '包位-A-13': 1,
  233. '包位-A-14': 1,
  234. '包位-A-15': 1,
  235. '包位-A-16': 1,
  236. '包位-A-17': 1,
  237. '包位-A-18': 1,
  238. '包位-A-19': 1,
  239. '包位-A-20': 1,
  240. '包位-A-21': 1,
  241. '包位-A-22': 1,
  242. '包位-A-23': 1,
  243. '包位-A-24': 1,
  244. '包位-A-25': 1,
  245. '包位-A-26': 1,
  246. '包位-A-27': 1,
  247. '包位-A-28': 1,
  248. '包位-A-29': 1,
  249. '包位-A-30': 1,
  250. '包位-A-31': 1,
  251. }
  252. }
  253. """
  254. # --- test 5001 获取告警数据列表接口 ---
  255. url = 'http://10.10.61.229:9000/v5/api'
  256. data = {
  257. 'code': 5001, # 接口号
  258. }
  259. response = requests.post(url=url, json=data, headers={'authorization': token})
  260. print(response.json())
  261. """
  262. {
  263. 'code': 0,
  264. 'data': [
  265. {
  266. 'message': '1号车油量低,请及时加油!', # 警告内容
  267. 'create_at': 1704435199 # 警告时间(时间戳)
  268. }
  269. ]
  270. }
  271. """