|
@@ -22,22 +22,22 @@ import mcpu_communication as mcn
|
|
|
from led import Led
|
|
|
|
|
|
# db参数
|
|
|
-# db_ip = "192.168.1.233"
|
|
|
-db_ip = "127.0.0.1"
|
|
|
+db_ip = "192.168.1.233"
|
|
|
+# db_ip = "127.0.0.1"
|
|
|
db_port = 3306
|
|
|
db_name = "ct_project"
|
|
|
-# db_user = "zx"
|
|
|
-# db_password = "zx123456"
|
|
|
-db_user = "root"
|
|
|
-db_password = "123456"
|
|
|
+db_user = "zx"
|
|
|
+db_password = "zx123456"
|
|
|
+# db_user = "root"
|
|
|
+# db_password = "123456"
|
|
|
# mq参数
|
|
|
-# mq_ip = "192.168.1.233"
|
|
|
-mq_ip = "127.0.0.1"
|
|
|
+mq_ip = "192.168.1.233"
|
|
|
+# mq_ip = "127.0.0.1"
|
|
|
mq_port = 5672
|
|
|
-# mq_user = "zx"
|
|
|
-# mq_password = "zx123456"
|
|
|
-mq_user = "wk"
|
|
|
-mq_password = "123456"
|
|
|
+mq_user = "zx"
|
|
|
+mq_password = "zx123456"
|
|
|
+# mq_user = "wk"
|
|
|
+# mq_password = "123456"
|
|
|
|
|
|
statu_ex_keys = [
|
|
|
["statu_ex", "in_mcpu_1_statu_port"],
|
|
@@ -55,18 +55,18 @@ statu_ex_keys = [
|
|
|
]
|
|
|
|
|
|
mcpu_keys = [
|
|
|
- ["in", 1, "192.168.2.25", 40000],
|
|
|
- ["in", 2, "192.168.2.25", 40001],
|
|
|
- # ["in", 3, "192.168.1.132", 40005],
|
|
|
- # ["in", 4, "192.168.1.133", 40005],
|
|
|
- # ["in", 5, "192.168.1.134", 40005],
|
|
|
- # ["in", 6, "192.168.2.25", 40002],
|
|
|
- ["out", 1, "192.168.2.25", 40005]
|
|
|
- # ["out", 2, "192.168.1.130", 40005],
|
|
|
- # ["out", 3, "192.168.1.130", 40005],
|
|
|
- # ["out", 4, "192.168.1.130", 40005],
|
|
|
- # ["out", 5, "192.168.1.130", 40005],
|
|
|
- # ["out", 6, "192.168.1.130", 40005]
|
|
|
+ ["in", 1, "192.168.1.120", 40005],
|
|
|
+ ["in", 2, "192.168.1.121", 40005],
|
|
|
+ ["in", 3, "192.168.1.122", 40005],
|
|
|
+ ["in", 4, "192.168.1.123", 40005],
|
|
|
+ ["in", 5, "192.168.1.124", 40005],
|
|
|
+ ["in", 6, "192.168.1.125", 40005],
|
|
|
+ ["out", 1, "192.168.1.130", 40005],
|
|
|
+ ["out", 2, "192.168.1.131", 40005],
|
|
|
+ ["out", 3, "192.168.1.132", 40005],
|
|
|
+ ["out", 4, "192.168.1.133", 40005],
|
|
|
+ ["out", 5, "192.168.1.134", 40005],
|
|
|
+ ["out", 6, "192.168.1.135", 40005]
|
|
|
]
|
|
|
|
|
|
|
|
@@ -142,6 +142,7 @@ class MainWindow(QMainWindow, threading.Thread):
|
|
|
if g_mcpu.GetMcpuConnectStatus(key) is True or iomsg.timeout() is False:
|
|
|
btn.setText(btn.text()[:10] + "正常")
|
|
|
btn.setStyleSheet(self.getBackGroundColor("green"))
|
|
|
+
|
|
|
btn.setToolTip(str(iomsg.statu))
|
|
|
else:
|
|
|
btn.setText(btn.text()[:10] + "断连")
|
|
@@ -149,23 +150,27 @@ class MainWindow(QMainWindow, threading.Thread):
|
|
|
btn.setStyleSheet(self.getBackGroundColor("gray"))
|
|
|
|
|
|
def drawUnitProcess(self):
|
|
|
+ return
|
|
|
if g_space.command_queue_dict is not False and g_space.command_queue_dict is not None:
|
|
|
# if self.command_queue_dict != g_space.command_queue_dict
|
|
|
|
|
|
- # for Aindex in range(self.ui.A_verticalLayout.count()):
|
|
|
- # item = self.ui.A_verticalLayout.itemAt(Aindex)
|
|
|
- # self.ui.A_verticalLayout.removeItem(item)
|
|
|
- # sip.delete(item.widget())
|
|
|
- #
|
|
|
- # for Bindex in range(self.ui.B_verticalLayout.count()):
|
|
|
- # wid = self.ui.B_verticalLayout.itemAt(Bindex).widget()
|
|
|
- # self.ui.B_verticalLayout.removeWidget(wid)
|
|
|
- # sip.delete(wid)
|
|
|
- #
|
|
|
- # for Cindex in range(self.ui.C_verticalLayout.count()):
|
|
|
- # wid = self.ui.C_verticalLayout.itemAt(Cindex).widget()
|
|
|
- # self.ui.C_verticalLayout.removeWidget(wid)
|
|
|
- # sip.delete(wid)
|
|
|
+ for Aindex in range(self.ui.A_verticalLayout.count()):
|
|
|
+ item = self.ui.A_verticalLayout.itemAt(Aindex)
|
|
|
+ if item is not None:
|
|
|
+ self.ui.A_verticalLayout.removeItem(item)
|
|
|
+ sip.delete(item.widget())
|
|
|
+
|
|
|
+ for Bindex in range(self.ui.B_verticalLayout.count()):
|
|
|
+ wid = self.ui.B_verticalLayout.itemAt(Bindex).widget()
|
|
|
+ if item is not None:
|
|
|
+ self.ui.B_verticalLayout.removeWidget(wid)
|
|
|
+ sip.delete(wid)
|
|
|
+
|
|
|
+ for Cindex in range(self.ui.C_verticalLayout.count()):
|
|
|
+ wid = self.ui.C_verticalLayout.itemAt(Cindex).widget()
|
|
|
+ if item is not None:
|
|
|
+ self.ui.C_verticalLayout.removeWidget(wid)
|
|
|
+ sip.delete(wid)
|
|
|
|
|
|
for dict in g_space.command_queue_dict:
|
|
|
btn = QPBtn()
|
|
@@ -173,7 +178,7 @@ class MainWindow(QMainWindow, threading.Thread):
|
|
|
# tf.Parse(dict["measure_info"],measure)
|
|
|
a = 1.50
|
|
|
str = "%s任务-------车牌号:%s 车高:%f" % (
|
|
|
- "存车" if dict["type"] is 1 else "取车", dict["car_number"], a)
|
|
|
+ "存车" if dict["type"] == 1 else "取车", dict["car_number"], a)
|
|
|
color = ""
|
|
|
if dict["statu"] == 1:
|
|
|
color = self.getBackGroundColor("green")
|
|
@@ -195,7 +200,7 @@ class MainWindow(QMainWindow, threading.Thread):
|
|
|
# "orange" if dict["type"] is 1 else "blue") + color)
|
|
|
# continue
|
|
|
btn.setStyleSheet('border:3px groove %s;border-radius:10px;padding:2px 4px;' % (
|
|
|
- "orange" if dict["type"] is 1 else "blue") + color)
|
|
|
+ "orange" if dict["type"] == 1 else "blue") + color)
|
|
|
btn.setObjectName(dict["car_number"])
|
|
|
btn.setMinimumHeight(80)
|
|
|
font = QFont()
|
|
@@ -359,12 +364,10 @@ class MainWindow(QMainWindow, threading.Thread):
|
|
|
action.triggered.connect(partial(self.manual_open_door, mcpu_key_list))
|
|
|
action = menu.addAction('手动关门')
|
|
|
action.triggered.connect(partial(self.manual_close_door, mcpu_key_list))
|
|
|
- if mcpu_key_list[0] == 'in':
|
|
|
- action = menu.addAction('半自动开门')
|
|
|
- action.triggered.connect(partial(self.automatic_open_door, mcpu_key_list))
|
|
|
- elif mcpu_key_list[0] == 'out':
|
|
|
- action = menu.addAction('半自动关门')
|
|
|
- action.triggered.connect(partial(self.automatic_close_door, mcpu_key_list))
|
|
|
+ action = menu.addAction('恢复半自动')
|
|
|
+ action.triggered.connect(partial(self.automatic_door, mcpu_key_list))
|
|
|
+ action = menu.addAction('恢复全自动')
|
|
|
+ action.triggered.connect(partial(self.fully_automatic_door, mcpu_key_list))
|
|
|
menu.exec_(QCursor.pos())
|
|
|
|
|
|
def manual_open_door(self,mcpu_key_list):
|
|
@@ -387,23 +390,26 @@ class MainWindow(QMainWindow, threading.Thread):
|
|
|
int(mcpu_key_list[2]) - 1, dispatch_direction)
|
|
|
key = mcpu_key_list[0] + ":mcpu_" + mcpu_key_list[2]
|
|
|
g_mcpu.publish(key, msg)
|
|
|
- def automatic_open_door(self,mcpu_key_list):
|
|
|
+ def automatic_door(self,mcpu_key_list):
|
|
|
dispatch_direction = 0
|
|
|
+ ProcessControl = 0
|
|
|
if mcpu_key_list[0] == 'in':
|
|
|
+ ProcessControl = 3
|
|
|
dispatch_direction = 1
|
|
|
elif mcpu_key_list[0] == 'out':
|
|
|
+ ProcessControl = 4
|
|
|
dispatch_direction = 2
|
|
|
- msg = b'{ "TerminalID": %d, "DispatchDirection": %d, "ProcessControl": 4, "OutPutDo": { "Do0": 0, "Do1": 0, "Do2": 0, "Do3": 0, "Do4": 0, "Do5": 0, "Do6": 0, "Do7": 0 }}' % (
|
|
|
- int(mcpu_key_list[2]) - 1, dispatch_direction)
|
|
|
+ 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 }}' % (
|
|
|
+ int(mcpu_key_list[2]) - 1, dispatch_direction,ProcessControl)
|
|
|
key = mcpu_key_list[0] + ":mcpu_" + mcpu_key_list[2]
|
|
|
g_mcpu.publish(key, msg)
|
|
|
- def automatic_close_door(self,mcpu_key_list):
|
|
|
+ def fully_automatic_door(self,mcpu_key_list):
|
|
|
dispatch_direction = 0
|
|
|
if mcpu_key_list[0] == 'in':
|
|
|
dispatch_direction = 1
|
|
|
elif mcpu_key_list[0] == 'out':
|
|
|
dispatch_direction = 2
|
|
|
- msg = b'{ "TerminalID": %d, "DispatchDirection": %d, "ProcessControl": 3, "OutPutDo": { "Do0": 0, "Do1": 0, "Do2": 0, "Do3": 0, "Do4": 0, "Do5": 0, "Do6": 0, "Do7": 0 }}' % (
|
|
|
+ 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 }}' % (
|
|
|
int(mcpu_key_list[2]) - 1, dispatch_direction)
|
|
|
key = mcpu_key_list[0] + ":mcpu_" + mcpu_key_list[2]
|
|
|
g_mcpu.publish(key, msg)
|