node.py 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510
  1. import sys
  2. from itertools import product
  3. import message.message_pb2 as message
  4. from PyQt5 import sip
  5. from PyQt5.QtWidgets import QApplication, QSizePolicy, QLabel, QWidget, QListWidgetItem
  6. import json
  7. import threading
  8. import time
  9. from functools import partial
  10. from PyQt5.QtCore import pyqtSignal, Qt, QTimer, QThread, QSize
  11. from PyQt5.QtGui import QCursor, QFont, QColor, QPixmap
  12. from PyQt5.QtWidgets import QPushButton, QMainWindow, QMenu, QMessageBox
  13. import message.message_pb2 as message
  14. import google.protobuf.text_format as tf
  15. import re
  16. import ui.spaceUi as sui
  17. import db_operation as spmng
  18. import async_communication as cmt
  19. import mcpu_communication as mcn
  20. from led import Led
  21. # mq参数
  22. mq_ip = "192.168.1.233"
  23. # mq_ip = "127.0.0.1"
  24. mq_port = 5672
  25. mq_user = "zx"
  26. mq_password = "zx123456"
  27. # mq_user = "wk"
  28. # mq_password = "123456"
  29. statu_ex_keys = [
  30. ["statu_ex", "in_mcpu_1_statu_port"],
  31. ["statu_ex", "in_mcpu_2_statu_port"],
  32. ["statu_ex", "in_mcpu_3_statu_port"],
  33. ["statu_ex", "in_mcpu_4_statu_port"],
  34. ["statu_ex", "in_mcpu_5_statu_port"],
  35. ["statu_ex", "in_mcpu_6_statu_port"],
  36. ["statu_ex", "out_mcpu_1_statu_port"],
  37. ["statu_ex", "out_mcpu_2_statu_port"],
  38. ["statu_ex", "out_mcpu_3_statu_port"],
  39. ["statu_ex", "out_mcpu_4_statu_port"],
  40. ["statu_ex", "out_mcpu_5_statu_port"],
  41. ["statu_ex", "out_mcpu_6_statu_port"]
  42. ]
  43. class QPBtn(QPushButton):
  44. clickedSignal = pyqtSignal(bool) # 定义带参信号
  45. def __init__(self, parent=None):
  46. super(QPBtn, self).__init__(parent)
  47. def mousePressEvent(self, event): # 重定义该函数,对不同的操作释放不同的信号参数
  48. if event.buttons() == Qt.LeftButton:
  49. self.clickedSignal.emit(True)
  50. elif event.buttons() == Qt.RightButton:
  51. self.clickedSignal.emit(False)
  52. class MainWindow(QMainWindow, sui.Ui_MainWindow):
  53. def __init__(self, parent=None):
  54. super(MainWindow, self).__init__(parent)
  55. self.setupUi(self)
  56. self.isClose = False
  57. self.A_listWidget.setGridSize(QSize(335, 60))
  58. self.A_listWidget.setStyleSheet("border:5px solid #014F84;")
  59. self.B_listWidget.setGridSize(QSize(335, 60))
  60. self.B_listWidget.setStyleSheet("border:5px solid #014F84;")
  61. self.C_listWidget.setGridSize(QSize(335, 60))
  62. self.C_listWidget.setStyleSheet("border:5px solid #014F84;")
  63. self.image_label.setPixmap(QPixmap('log.jpg'))
  64. self.image_label.setScaledContents(True)
  65. self.image_label.setMaximumHeight(140)
  66. self.image_label.setMaximumWidth(600)
  67. self.btn_positions = [(i, j) for i in range(13, -1, -1) for j in range(6)]
  68. self.space_dict = {1: [], 2: [], 3: []}
  69. self.space_is_init = {1: False, 2: False, 3: False}
  70. self.rmq_statu_dict = {}
  71. self.command_dict = {1: [], 2: [], 3: []}
  72. for ex_name,key in statu_ex_keys:
  73. self.rmq_statu_dict[key]={}
  74. self.isInit = False
  75. self.timer = QTimer()
  76. self.timer.timeout.connect(self.Switch)
  77. self.timer.start(200)
  78. def getBackGroundColor(self, color):
  79. if color == "red":
  80. return "background-color:rgb(255,70,70)"
  81. elif color == "gray":
  82. return "background-color:rgb(168,168,168)"
  83. elif color == "green":
  84. return "background-color:rgb(0,180,0)"
  85. elif color == "yellow":
  86. return "background-color:rgb(248,239,71)"
  87. elif color == "pastel":
  88. return "background-color:rgb(241,158,194)"
  89. def getListWidgetItem(self, dict):
  90. item = QListWidgetItem()
  91. item.setFont(QFont('微软雅黑', 20, QFont.Bold))
  92. show_str = ""
  93. if(dict["type"] == 2):
  94. if (dict["statu"] == 0): # 排队
  95. item.setForeground(QColor(80, 80, 80))
  96. show_str = dict["car_number"] + " 排队中,请稍等片刻"
  97. elif (dict["statu"] == 1): # 工作
  98. item.setForeground(QColor('blue'))
  99. show_str = dict["car_number"] + " 取车中,等待取车结束"
  100. elif (dict["statu"] == 2): # 已完成
  101. item.setForeground(QColor('green'))
  102. show_str = dict["car_number"] + " 已完成,请到 %d 号出口取车" % (dict["export_id"])
  103. item.setText(show_str)
  104. return item
  105. def drawLed(self,command_dict):
  106. export = {}
  107. for i in range(1,7):
  108. export[i] = True
  109. for key in self.rmq_statu_dict.keys():
  110. if key.find("out") >= 0:
  111. out_mcpu_statu = message.out_mcpu_statu()
  112. tf.Parse(self.rmq_statu_dict[key], out_mcpu_statu)
  113. if out_mcpu_statu.outside_safety == 2:
  114. export[int(key[9])] = False
  115. t_command_dict = g_space.get_command_dict()
  116. for dict in t_command_dict:
  117. if dict["export_id"] == 1:
  118. export[1] = False
  119. if dict["export_id"] == 2:
  120. export[2] = False
  121. if dict["export_id"] == 3:
  122. export[3] = False
  123. if dict["export_id"] == 4:
  124. export[4] = False
  125. if dict["export_id"] == 5:
  126. export[5] = False
  127. if dict["export_id"] == 6:
  128. export[6] = False
  129. led = Led()
  130. led.setEnabled(False) # 设置为不使能状态,如果需要切换可以设置为True。则可以实现点击切换指示灯颜色的效果
  131. led.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
  132. if export[1] == export[2] == False:
  133. led.setChecked(False) # 设置为选中状态
  134. else:
  135. led.setChecked(True) # 设置为选中状态
  136. self.led_process_Layout.addWidget(led, 0, 1)
  137. led = Led()
  138. led.setEnabled(False) # 设置为不使能状态,如果需要切换可以设置为True。则可以实现点击切换指示灯颜色的效果
  139. led.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
  140. if export[3] == export[4] == False:
  141. led.setChecked(False) # 设置为选中状态
  142. else:
  143. led.setChecked(True) # 设置为选中状态
  144. self.led_process_Layout.addWidget(led, 0, 2)
  145. led = Led()
  146. led.setEnabled(False) # 设置为不使能状态,如果需要切换可以设置为True。则可以实现点击切换指示灯颜色的效果
  147. led.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
  148. if export[5] == export[6] == False:
  149. led.setChecked(False) # 设置为选中状态
  150. else:
  151. led.setChecked(True) # 设置为选中状态
  152. self.led_process_Layout.addWidget(led, 0, 3)
  153. def drawRmqBtn(self, msg, key):
  154. btn = self.findChild(QPushButton, (key.replace("port", "btn")).replace("mcpu", "rmq"))
  155. if msg is None:
  156. btn.setToolTip("None")
  157. btn.setStyleSheet(self.getBackGroundColor("gray"))
  158. btn.setText(btn.text()[:9] + "断连")
  159. return
  160. btn.setToolTip(msg)
  161. if btn.text().find("入口") >= 0:
  162. in_mcpu_statu = message.in_mcpu_statu()
  163. tf.Parse(msg, in_mcpu_statu)
  164. if in_mcpu_statu.is_occupy == 1:
  165. btn.setStyleSheet(self.getBackGroundColor("green"))
  166. btn.setText(btn.text()[:9] + "空闲----" + btn.text()[15:])
  167. else:
  168. btn.setStyleSheet(self.getBackGroundColor("yellow"))
  169. btn.setText(btn.text()[:9] + "占用----" + btn.text()[15:])
  170. # print(btn.text())
  171. if in_mcpu_statu.door_statu == 2:
  172. btn.setText(btn.text()[:-3] + "开到位")
  173. elif in_mcpu_statu.door_statu == 3:
  174. btn.setText(btn.text()[:-3] + "关到位")
  175. elif in_mcpu_statu.door_statu == 4:
  176. btn.setText(btn.text()[:-3] + "开关中")
  177. elif in_mcpu_statu.door_statu == 5:
  178. btn.setText(btn.text()[:-3] + "门故障")
  179. elif btn.text().find("出口") >= 0:
  180. out_mcpu_statu = message.out_mcpu_statu()
  181. tf.Parse(msg, out_mcpu_statu)
  182. if out_mcpu_statu.outside_safety == 1:
  183. btn.setStyleSheet(self.getBackGroundColor("green"))
  184. btn.setText(btn.text()[:9] + "空闲----" + btn.text()[15:])
  185. else:
  186. btn.setStyleSheet(self.getBackGroundColor("yellow"))
  187. btn.setText(btn.text()[:9] + "占用----" + btn.text()[15:])
  188. if out_mcpu_statu.door_statu == 2:
  189. btn.setText(btn.text()[:-3] + "开到位")
  190. elif out_mcpu_statu.door_statu == 3:
  191. btn.setText(btn.text()[:-3] + "关到位")
  192. elif out_mcpu_statu.door_statu == 4:
  193. btn.setText(btn.text()[:-3] + "开关中")
  194. elif out_mcpu_statu.door_statu == 5:
  195. btn.setText(btn.text()[:-3] + "门故障")
  196. def process_btn_click(self, flag):
  197. if flag is False:
  198. sender = self.sender()
  199. tool_tip = sender.toolTip()
  200. dict = json.loads(tool_tip)
  201. menu = QMenu(self)
  202. action = menu.addAction('清除')
  203. action.triggered.connect(partial(self.process_delete, dict))
  204. menu.exec_(QCursor.pos())
  205. def park_btn_click(self, flag):
  206. if flag is False:
  207. sender = self.sender()
  208. tool_tip = sender.toolTip()
  209. dict = json.loads(tool_tip)
  210. menu = QMenu(self)
  211. action = menu.addAction('启用车位')
  212. action.triggered.connect(partial(self.btn_opeSpace, dict, 0))
  213. action = menu.addAction('停用车位')
  214. action.triggered.connect(partial(self.btn_disableSpace, dict, 1))
  215. action = menu.addAction('清除车位')
  216. action.triggered.connect(partial(self.btn_clearSpace, dict))
  217. action = menu.addAction('取出车辆')
  218. action.triggered.connect(partial(self.btn_pickUp, dict))
  219. menu.exec_(QCursor.pos())
  220. def btn_disableSpace(self, dict, statu):
  221. res = g_space.update_space_status(dict["id"],statu)
  222. if res == 0:
  223. QMessageBox.question(None, '提示', '更新车位失败!请检查是否点击错误!',
  224. QMessageBox.Ok) # "退出"代表的是弹出框的标题,"你确认退出.."表示弹出框的内容
  225. def btn_opeSpace(self, dict, statu):
  226. res = g_space.update_space_status(dict["id"],statu)
  227. if res == 0:
  228. QMessageBox.question(None, '提示', '更新车位失败!请检查是否点击错误!',
  229. QMessageBox.Ok) # "退出"代表的是弹出框的标题,"你确认退出.."表示弹出框的内容
  230. def btn_clearSpace(self, dict):
  231. res = g_space.clear_space_data(dict["id"])
  232. if res == 0:
  233. QMessageBox.question(None, '提示', '更新车位失败!请检查是否点击错误!',
  234. QMessageBox.Ok) # "退出"代表的是弹出框的标题,"你确认退出.."表示弹出框的内容
  235. def btn_pickUp(self, dict):
  236. res = g_space.query_vehicle_primary_key(dict["car_number"])
  237. print(res)
  238. if len(res) < 1:
  239. QMessageBox.question(None, '提示', dict["car_number"]+' 未查询到车辆!',
  240. QMessageBox.Ok) # "退出"代表的是弹出框的标题,"你确认退出.."表示弹出框的内容
  241. elif len(res) > 1:
  242. QMessageBox.question(None, '提示', dict["car_number"]+' 查询到多条结果!请检查数据库!',
  243. QMessageBox.Ok) # "退出"代表的是弹出框的标题,"你确认退出.."表示弹出框的内容
  244. elif len(res) == 1:
  245. table = message.pick_table()
  246. table.primary_key = res[0]["primary_key"]
  247. g_rabbitmq.publish("command_ex", "user_command_port", tf.MessageToString(table, as_utf8=True))
  248. QMessageBox.question(None, '提示', '取车消息发送成功!',
  249. QMessageBox.Ok) # "退出"代表的是弹出框的标题,"你确认退出.."表示弹出框的内容
  250. def process_delete(self, dict):
  251. g_space.processDelete(dict)
  252. # def db_callback(self, flag):
  253. # if flag and self.isEnabled() is False:
  254. # self.setWindowTitle("MainWindow---连接正常!")
  255. # self.setEnabled(True)
  256. # elif flag is False and self.isEnabled() is True:
  257. # self.setWindowTitle("MainWindow---连接错误!")
  258. # self.setEnabled(False)
  259. def getParkData(self,park):
  260. text_str = "车位:%d\n楼层:%d" % ((park["id"] - 1) % 78 + 1, park["floor"])
  261. stylesheet = ""
  262. if park["statu"] == 1:
  263. stylesheet = "background-color:rgb(255,130,130)"
  264. elif park["statu"] == 0 and park["car_number"] is not None:
  265. stylesheet = "background-color:rgb(248,239,71)"
  266. tool_tip = '{"id":%d,\n"floor":%d,\n "subID":%d, \n"height":%f, \n"car_number":"%s" ,\n "unit":%d, \n"statu":%d}' % (
  267. park["id"], park["floor"], park["subID"], park["height"], park["car_number"], park["unit"],
  268. park["statu"])
  269. return text_str,stylesheet,tool_tip
  270. def Switch(self):
  271. #绘制车位按钮
  272. space_dict = g_space.get_space_dict()
  273. for unit in self.space_dict.keys():
  274. if self.space_dict[unit] != space_dict[unit]:
  275. if self.space_is_init[unit] == False:
  276. self.space_dict[unit] = space_dict[unit]
  277. self.space_is_init[unit] = True
  278. for unit in self.space_dict.keys():
  279. for park, position in zip(self.space_dict[unit], self.btn_positions):
  280. btn = QPBtn()
  281. text_str, stylesheet, tool_tip = self.getParkData(park)
  282. btn.setText(text_str)
  283. btn.setStyleSheet(stylesheet)
  284. btn.setToolTip(tool_tip)
  285. btn.setObjectName(text_str + str(unit))
  286. btn.clickedSignal.connect(self.park_btn_click)
  287. if unit == 1:
  288. self.A_gridLayout.addWidget(btn, *position)
  289. if unit == 2:
  290. self.B_gridLayout.addWidget(btn, *position)
  291. if unit == 3:
  292. self.C_gridLayout.addWidget(btn, *position)
  293. else:
  294. for park1,park2 in zip(self.space_dict[unit],space_dict[unit]):
  295. if park1 != park2:
  296. text_str, stylesheet, tool_tip = self.getParkData(park2)
  297. results = self.findChild(QPushButton,text_str + str(unit))
  298. results.setText(text_str)
  299. results.setStyleSheet(stylesheet)
  300. results.setToolTip(tool_tip)
  301. self.space_dict[unit] = space_dict[unit]
  302. #绘制出入口状态按钮
  303. for key in self.rmq_statu_dict.keys():
  304. if g_rabbitmq["statu_ex:"+key].timeout() is True:
  305. self.rmq_statu_dict[key] = {}
  306. self.drawRmqBtn(None,key)
  307. elif self.rmq_statu_dict[key] != g_rabbitmq["statu_ex:"+key].statu :
  308. self.rmq_statu_dict[key] = g_rabbitmq["statu_ex:"+key].statu
  309. self.drawRmqBtn(self.rmq_statu_dict[key],key)
  310. # #绘制信号灯
  311. # command_dict = g_space.get_command_dict()
  312. # self.drawLed(command_dict)
  313. #绘制流程界面
  314. command_dict = g_space.get_command_dict()
  315. for key in self.command_dict.keys():
  316. if self.command_dict[key] != command_dict[key]:
  317. self.command_dict[key] = command_dict[key]
  318. if key == 1:
  319. self.A_listWidget.clear()
  320. for dict in self.command_dict[key]:
  321. self.A_listWidget.addItem(self.getListWidgetItem(dict))
  322. elif key == 2:
  323. self.B_listWidget.clear()
  324. for dict in self.command_dict[key]:
  325. self.B_listWidget.addItem(self.getListWidgetItem(dict))
  326. elif key == 3:
  327. self.C_listWidget.clear()
  328. for dict in self.command_dict[key]:
  329. self.C_listWidget.addItem(self.getListWidgetItem(dict))
  330. def closeEvent(self, event):
  331. results = QMessageBox.question(self, '退出', '你确定要退出吗?', QMessageBox.Yes | QMessageBox.No,
  332. QMessageBox.No) # "退出"代表的是弹出框的标题,"你确认退出.."表示弹出框的内容
  333. if results == QMessageBox.Yes:
  334. g_rabbitmq.close()
  335. g_space.close()
  336. self.isClose = True
  337. event.accept() # 接受关闭事件
  338. else:
  339. event.ignore() # 忽略关闭事件
  340. if __name__ == '__main__':
  341. g_rabbitmq = cmt.RabbitAsyncCommunicator(mq_ip, mq_port, mq_user, mq_password)
  342. g_rabbitmq.Init(None, statu_ex_keys)
  343. g_rabbitmq.start()
  344. g_space = spmng.DBOperation()
  345. g_space.start()
  346. app = QApplication(sys.argv)
  347. mainWindow = MainWindow()
  348. mainWindow.showMaximized()
  349. sys.exit(app.exec_())
  350. # self.drawLedSignal.emit()
  351. # self.drawUnitProcessSignal.emit()
  352. # return
  353. # def run(self):
  354. # while self.isClose is not True:
  355. # if g_space.statu is False:
  356. # self.setWindowTitle("MainWindow---连接错误!")
  357. # self.setEnabled(False)
  358. # else:
  359. # self.setWindowTitle("MainWindow---连接正常!")
  360. # self.setEnabled(True)
  361. #
  362. # for list in statu_ex_keys:
  363. # ex_name = list[0]
  364. # key = list[1]
  365. # id = ex_name + ":" + key
  366. # if (id in self.rmq_statu.keys()) is False or self.rmq_statu[id].statu != g_rabbitmq[id].statu or \
  367. # self.rmq_timeout[id] != g_rabbitmq[id].timeout():
  368. # self.rmq_timeout[id] = g_rabbitmq[id].timeout()
  369. # self.rmq_statu[id] = g_rabbitmq[id]
  370. # self.drawLedSignal.emit()
  371. # self.drawUnitProcessSignal.emit()
  372. # self.drawRmqBtnSignal.emit(list)
  373. # time.sleep(0.01)
  374. # for key, statu in g_mcpu.GetAllMcpuConnectStatus().items():
  375. # self.drawMcpuBtnSignal.emit(key)
  376. # time.sleep(0.01)
  377. # time.sleep(0.5)
  378. # 进入程序的主循环,并通过exit函数确保主循环安全结束(该释放资源的一定要释放)
  379. # def mcpu_btn_click(self):
  380. # sender = self.sender()
  381. # mcpu_key_list = sender.objectName().split('_')
  382. # menu = QMenu(self)
  383. # action = menu.addAction('手动开门')
  384. # action.triggered.connect(partial(self.manual_open_door, mcpu_key_list))
  385. # action = menu.addAction('手动关门')
  386. # action.triggered.connect(partial(self.manual_close_door, mcpu_key_list))
  387. # action = menu.addAction('恢复半自动')
  388. # action.triggered.connect(partial(self.automatic_door, mcpu_key_list))
  389. # action = menu.addAction('恢复全自动')
  390. # action.triggered.connect(partial(self.fully_automatic_door, mcpu_key_list))
  391. # menu.exec_(QCursor.pos())
  392. #
  393. # def manual_open_door(self, mcpu_key_list):
  394. # dispatch_direction = 0
  395. # if mcpu_key_list[0] == 'in':
  396. # dispatch_direction = 1
  397. # elif mcpu_key_list[0] == 'out':
  398. # dispatch_direction = 2
  399. # msg = b'{ "TerminalID": %d, "DispatchDirection": %d, "ProcessControl": 2, "OutPutDo": { "Do0": 1, "Do1": 0, "Do2": 0, "Do3": 0, "Do4": 0, "Do5": 0, "Do6": 0, "Do7": 0 }}' % (
  400. # int(mcpu_key_list[2]) - 1, dispatch_direction)
  401. # key = mcpu_key_list[0] + ":mcpu_" + mcpu_key_list[2]
  402. # g_mcpu.publish(key, msg)
  403. # QMessageBox.question(None, '提示', '指令发送成功!',
  404. # QMessageBox.Ok) # "退出"代表的是弹出框的标题,"你确认退出.."表示弹出框的内容
  405. #
  406. # def manual_close_door(self, mcpu_key_list):
  407. # dispatch_direction = 0
  408. # if mcpu_key_list[0] == 'in':
  409. # dispatch_direction = 1
  410. # elif mcpu_key_list[0] == 'out':
  411. # dispatch_direction = 2
  412. # msg = b'{ "TerminalID": %d, "DispatchDirection": %d, "ProcessControl": 2, "OutPutDo": { "Do0": 0, "Do1": 1, "Do2": 0, "Do3": 0, "Do4": 0, "Do5": 0, "Do6": 0, "Do7": 0 }}' % (
  413. # int(mcpu_key_list[2]) - 1, dispatch_direction)
  414. # key = mcpu_key_list[0] + ":mcpu_" + mcpu_key_list[2]
  415. # g_mcpu.publish(key, msg)
  416. # QMessageBox.question(None, '提示', '指令发送成功!',
  417. # QMessageBox.Ok) # "退出"代表的是弹出框的标题,"你确认退出.."表示弹出框的内容
  418. #
  419. # def automatic_door(self, mcpu_key_list):
  420. # dispatch_direction = 0
  421. # ProcessControl = 0
  422. # if mcpu_key_list[0] == 'in':
  423. # ProcessControl = 3
  424. # dispatch_direction = 1
  425. # elif mcpu_key_list[0] == 'out':
  426. # ProcessControl = 4
  427. # dispatch_direction = 2
  428. # msg = b'{ "TerminalID": %d, "DispatchDirection": %d, "ProcessControl": %d, "OutPutDo": { "Do0": 0, "Do1": 0, "Do2": 0, "Do3": 0, "Do4": 0, "Do5": 0, "Do6": 0, "Do7": 0 }}' % (
  429. # int(mcpu_key_list[2]) - 1, dispatch_direction, ProcessControl)
  430. # key = mcpu_key_list[0] + ":mcpu_" + mcpu_key_list[2]
  431. # g_mcpu.publish(key, msg)
  432. # QMessageBox.question(None, '提示', '指令发送成功!',
  433. # QMessageBox.Ok) # "退出"代表的是弹出框的标题,"你确认退出.."表示弹出框的内容
  434. #
  435. # def fully_automatic_door(self, mcpu_key_list):
  436. # dispatch_direction = 0
  437. # if mcpu_key_list[0] == 'in':
  438. # dispatch_direction = 1
  439. # elif mcpu_key_list[0] == 'out':
  440. # dispatch_direction = 2
  441. # msg = b'{ "TerminalID": %d, "DispatchDirection": %d, "ProcessControl": 1, "OutPutDo": { "Do0": 0, "Do1": 0, "Do2": 0, "Do3": 0, "Do4": 0, "Do5": 0, "Do6": 0, "Do7": 0 }}' % (
  442. # int(mcpu_key_list[2]) - 1, dispatch_direction)
  443. # key = mcpu_key_list[0] + ":mcpu_" + mcpu_key_list[2]
  444. # g_mcpu.publish(key, msg)
  445. # QMessageBox.question(None, '提示', '指令发送成功!',
  446. # QMessageBox.Ok) # "退出"代表的是弹出框的标题,"你确认退出.."表示弹出框的内容