|
@@ -13,7 +13,7 @@ import threading
|
|
import time
|
|
import time
|
|
import traceback
|
|
import traceback
|
|
from functools import partial
|
|
from functools import partial
|
|
-
|
|
|
|
|
|
+from django.core.serializers.json import DjangoJSONEncoder
|
|
import requests
|
|
import requests
|
|
from PyQt5.QtCore import QSize, QDateTime
|
|
from PyQt5.QtCore import QSize, QDateTime
|
|
from PyQt5.QtCore import pyqtSignal, QTimer, Qt
|
|
from PyQt5.QtCore import pyqtSignal, QTimer, Qt
|
|
@@ -48,7 +48,7 @@ class MainWindow(QMainWindow, sui.Ui_MainWindow):
|
|
self.label.setText(self.parking_config['process_title'])
|
|
self.label.setText(self.parking_config['process_title'])
|
|
# 数据存储
|
|
# 数据存储
|
|
# 全矩阵
|
|
# 全矩阵
|
|
- self.btn_positions = [(i, j) for i in range(self.parking_config['row']-1, -1, -1) for j in
|
|
|
|
|
|
+ self.btn_positions = [(i, j) for i in range(self.parking_config['row'] - 1, -1, -1) for j in
|
|
range(self.parking_config['column'])]
|
|
range(self.parking_config['column'])]
|
|
# # 奇数矩阵
|
|
# # 奇数矩阵
|
|
# self.btn_positions1 = [(i, j) for i in range(self.parking_config['row']-1, -1, -1) for j in
|
|
# self.btn_positions1 = [(i, j) for i in range(self.parking_config['row']-1, -1, -1) for j in
|
|
@@ -57,7 +57,6 @@ class MainWindow(QMainWindow, sui.Ui_MainWindow):
|
|
# self.btn_positions2 = [(i, j) for i in range(self.parking_config['row']-1, -1, -1) for j in
|
|
# self.btn_positions2 = [(i, j) for i in range(self.parking_config['row']-1, -1, -1) for j in
|
|
# range(2,self.parking_config['column']+2,2)]
|
|
# range(2,self.parking_config['column']+2,2)]
|
|
|
|
|
|
-
|
|
|
|
self._dispatch_statu = {}
|
|
self._dispatch_statu = {}
|
|
self.unit_space_is_init = False
|
|
self.unit_space_is_init = False
|
|
self.process_is_init = False
|
|
self.process_is_init = False
|
|
@@ -66,7 +65,6 @@ class MainWindow(QMainWindow, sui.Ui_MainWindow):
|
|
self.process_unit_list = self.parking_config['process_unit_list']
|
|
self.process_unit_list = self.parking_config['process_unit_list']
|
|
self.db_unit_list = self.parking_config['db_unit_list']
|
|
self.db_unit_list = self.parking_config['db_unit_list']
|
|
|
|
|
|
-
|
|
|
|
self.label_dict = {}
|
|
self.label_dict = {}
|
|
self.list_widget_dict = {}
|
|
self.list_widget_dict = {}
|
|
|
|
|
|
@@ -104,9 +102,14 @@ class MainWindow(QMainWindow, sui.Ui_MainWindow):
|
|
self.process_comboBox.addItems(list(self.process_unit_list.keys()))
|
|
self.process_comboBox.addItems(list(self.process_unit_list.keys()))
|
|
self.db_comboBox.addItems(list(self.db_unit_list.keys()))
|
|
self.db_comboBox.addItems(list(self.db_unit_list.keys()))
|
|
|
|
|
|
- self.db_unit = self.db_comboBox.currentText()
|
|
|
|
- self.process_unit = self.process_comboBox.currentText()
|
|
|
|
- self.parking_unit = self.unit_comboBox.currentText()
|
|
|
|
|
|
+ self.parking_unit = self.parking_config['init_parking_unit']
|
|
|
|
+ self.process_unit = self.parking_config['init_process_unit']
|
|
|
|
+ self.db_unit = self.parking_config['init_db_unit_list']
|
|
|
|
+
|
|
|
|
+ self.unit_comboBox.setCurrentText(self.parking_unit)
|
|
|
|
+ self.process_comboBox.setCurrentText(self.process_unit)
|
|
|
|
+ self.db_comboBox.setCurrentText(self.db_unit)
|
|
|
|
+
|
|
self.updata_record_btn.clicked.connect(self.updata_record)
|
|
self.updata_record_btn.clicked.connect(self.updata_record)
|
|
|
|
|
|
# 调度状态指示灯
|
|
# 调度状态指示灯
|
|
@@ -147,7 +150,6 @@ class MainWindow(QMainWindow, sui.Ui_MainWindow):
|
|
self.update_unit_btn.clicked.connect(self.update_btn_click)
|
|
self.update_unit_btn.clicked.connect(self.update_btn_click)
|
|
self.update_unit_btn_2.clicked.connect(self.update_process_unit_btn_click)
|
|
self.update_unit_btn_2.clicked.connect(self.update_process_unit_btn_click)
|
|
|
|
|
|
-
|
|
|
|
# 初始化显示库位高度
|
|
# 初始化显示库位高度
|
|
font = QFont()
|
|
font = QFont()
|
|
font.setFamily('宋体')
|
|
font.setFamily('宋体')
|
|
@@ -167,6 +169,14 @@ class MainWindow(QMainWindow, sui.Ui_MainWindow):
|
|
31: {}, 32: {}}
|
|
31: {}, 32: {}}
|
|
|
|
|
|
self.last_command_dict = {}
|
|
self.last_command_dict = {}
|
|
|
|
+ self.unit_label.setText(self.parking_unit)
|
|
|
|
+
|
|
|
|
+ self.pushButton_grade1.setIcon(QIcon(QPixmap("./images/grade1.png")))
|
|
|
|
+ self.pushButton_grade2.setIcon(QIcon(QPixmap("./images/grade2.png")))
|
|
|
|
+ self.pushButton_grade3.setIcon(QIcon(QPixmap("./images/grade3.png")))
|
|
|
|
+ self.pushButton_grade1.setText("车高等级:" + str(self.parking_config['grade1']))
|
|
|
|
+ self.pushButton_grade2.setText("车高等级:" + str(self.parking_config['grade2']))
|
|
|
|
+ self.pushButton_grade3.setText("车高等级:" + str(self.parking_config['grade3']))
|
|
|
|
|
|
# 数据库更新时间
|
|
# 数据库更新时间
|
|
self.db_update_time = time.time() - 3
|
|
self.db_update_time = time.time() - 3
|
|
@@ -224,7 +234,7 @@ class MainWindow(QMainWindow, sui.Ui_MainWindow):
|
|
self.data_lock.acquire()
|
|
self.data_lock.acquire()
|
|
unit = self.parking_unit_list[self.parking_unit]
|
|
unit = self.parking_unit_list[self.parking_unit]
|
|
# 车位管理
|
|
# 车位管理
|
|
- self.parkspace_show(unit, self.parking_config["in_occupy_space"][str(unit)],
|
|
|
|
|
|
+ self.parkspace_show(self.parking_unit, self.parking_config["in_occupy_space"][str(unit)],
|
|
self.parking_config["out_occupy_space"][str(unit)],
|
|
self.parking_config["out_occupy_space"][str(unit)],
|
|
self.parking_config["controlroom_occupy_space"][str(unit)])
|
|
self.parking_config["controlroom_occupy_space"][str(unit)])
|
|
# # 流程监控
|
|
# # 流程监控
|
|
@@ -242,10 +252,10 @@ class MainWindow(QMainWindow, sui.Ui_MainWindow):
|
|
# 当前选中时间内指定单元记录数据
|
|
# 当前选中时间内指定单元记录数据
|
|
if len(self.db_unit) != 1 and self.db_unit_list[self.db_unit] is not None:
|
|
if len(self.db_unit) != 1 and self.db_unit_list[self.db_unit] is not None:
|
|
self.db_unit_park_dict = self.db.query_park_count_in_time_and_unit(self.in_date, self.out_date,
|
|
self.db_unit_park_dict = self.db.query_park_count_in_time_and_unit(self.in_date, self.out_date,
|
|
- self.db_unit_list[self.db_unit])
|
|
|
|
|
|
+ self.db_unit_list[self.db_unit])
|
|
self.db_unit_pick_dict = self.db.query_pick_count_out_time_and_unit(self.in_date, self.out_date,
|
|
self.db_unit_pick_dict = self.db.query_pick_count_out_time_and_unit(self.in_date, self.out_date,
|
|
- self.db_unit_list[
|
|
|
|
- self.db_unit])
|
|
|
|
|
|
+ self.db_unit_list[
|
|
|
|
+ self.db_unit])
|
|
|
|
|
|
# 当前选中时间内指定总单元记录数据
|
|
# 当前选中时间内指定总单元记录数据
|
|
if len(self.db_unit) == 1:
|
|
if len(self.db_unit) == 1:
|
|
@@ -269,7 +279,6 @@ class MainWindow(QMainWindow, sui.Ui_MainWindow):
|
|
else:
|
|
else:
|
|
statu = self._dispatch_statu[key].statu
|
|
statu = self._dispatch_statu[key].statu
|
|
dispatch_node_statu = message.dispatch_node_statu()
|
|
dispatch_node_statu = message.dispatch_node_statu()
|
|
- print(dispatch_node_statu)
|
|
|
|
try:
|
|
try:
|
|
tf.Parse(statu, dispatch_node_statu)
|
|
tf.Parse(statu, dispatch_node_statu)
|
|
except Exception:
|
|
except Exception:
|
|
@@ -289,35 +298,23 @@ class MainWindow(QMainWindow, sui.Ui_MainWindow):
|
|
|
|
|
|
# 车位显示
|
|
# 车位显示
|
|
def parkspace_show(self, unit, in_occupy_space, out_occupy_space, controlroom_occupy_space):
|
|
def parkspace_show(self, unit, in_occupy_space, out_occupy_space, controlroom_occupy_space):
|
|
- self.unit_label.setText(self.get_unit(unit))
|
|
|
|
- self.pushButton_grade1.setIcon(QIcon(QPixmap("./images/grade1.png")))
|
|
|
|
- self.pushButton_grade2.setIcon(QIcon(QPixmap("./images/grade2.png")))
|
|
|
|
- self.pushButton_grade3.setIcon(QIcon(QPixmap("./images/grade3.png")))
|
|
|
|
- self.pushButton_grade1.setText("车高等级:" + str(self.parking_config['grade1']))
|
|
|
|
- self.pushButton_grade2.setText("车高等级:" + str(self.parking_config['grade2']))
|
|
|
|
- self.pushButton_grade3.setText("车高等级:" + str(self.parking_config['grade3']))
|
|
|
|
|
|
|
|
# 绘制车位按钮
|
|
# 绘制车位按钮
|
|
if self.space_dict is None:
|
|
if self.space_dict is None:
|
|
return
|
|
return
|
|
- space_dict = copy.deepcopy(self.space_dict)
|
|
|
|
- is_show_car_number = self.car_number_rbtn_2.isChecked()
|
|
|
|
|
|
|
|
- if self.unit_space_dict != space_dict:
|
|
|
|
|
|
+ is_show_car_number = self.car_number_rbtn_2.isChecked()
|
|
|
|
+ if self.unit_space_dict != self.space_dict:
|
|
|
|
+ self.unit_label.setText(unit)
|
|
print('有修改')
|
|
print('有修改')
|
|
if self.unit_space_is_init == False:
|
|
if self.unit_space_is_init == False:
|
|
- self.unit_space_dict = copy.deepcopy(space_dict)
|
|
|
|
|
|
+ self.unit_space_dict = copy.deepcopy(self.space_dict)
|
|
self.unit_space_is_init = True
|
|
self.unit_space_is_init = True
|
|
|
|
|
|
is_drawIn = False
|
|
is_drawIn = False
|
|
is_drawOut = False
|
|
is_drawOut = False
|
|
is_drawControlRoom = False
|
|
is_drawControlRoom = False
|
|
- # 根据下标奇偶数分成两组
|
|
|
|
- even_space_list = space_dict[::2]
|
|
|
|
- odd_space_list = space_dict[1::2]
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- for park, position in zip(space_dict, self.btn_positions):
|
|
|
|
|
|
+ for park, position in zip(self.space_dict, self.btn_positions):
|
|
btn = QPushButton()
|
|
btn = QPushButton()
|
|
font, text_str, stylesheet, tool_tip = self.get_btn_show(park)
|
|
font, text_str, stylesheet, tool_tip = self.get_btn_show(park)
|
|
btn.setFont(font)
|
|
btn.setFont(font)
|
|
@@ -341,17 +338,20 @@ class MainWindow(QMainWindow, sui.Ui_MainWindow):
|
|
btn.clicked.connect(self.park_btn_left_click)
|
|
btn.clicked.connect(self.park_btn_left_click)
|
|
self.unit_gridLayout.addWidget(btn, *position)
|
|
self.unit_gridLayout.addWidget(btn, *position)
|
|
else:
|
|
else:
|
|
- for park1, park2 in zip(self.unit_space_dict, space_dict):
|
|
|
|
- if park1 != park2:
|
|
|
|
- font, text_str, stylesheet, tool_tip = self.get_btn_show(park2)
|
|
|
|
- results = self.findChild(QPushButton, str(park2["table_id"]))
|
|
|
|
|
|
+ temp1 = copy.deepcopy(self.unit_space_dict)
|
|
|
|
+ temp2 = copy.deepcopy(self.space_dict)
|
|
|
|
+ merged = zip(temp1, temp2)
|
|
|
|
+ for last_space,space in merged:
|
|
|
|
+ if last_space.values() != space.values():
|
|
|
|
+ font, text_str, stylesheet, tool_tip = self.get_btn_show(space)
|
|
|
|
+ results = self.findChild(QPushButton, str(space["table_id"]))
|
|
if results is None:
|
|
if results is None:
|
|
return
|
|
return
|
|
results.setFont(font)
|
|
results.setFont(font)
|
|
results.setText(text_str)
|
|
results.setText(text_str)
|
|
results.setStyleSheet(stylesheet)
|
|
results.setStyleSheet(stylesheet)
|
|
results.setToolTip(tool_tip)
|
|
results.setToolTip(tool_tip)
|
|
- self.unit_space_dict = copy.deepcopy(space_dict)
|
|
|
|
|
|
+ self.unit_space_dict = copy.deepcopy(self.space_dict)
|
|
if self.show_model != is_show_car_number:
|
|
if self.show_model != is_show_car_number:
|
|
self.show_model = is_show_car_number
|
|
self.show_model = is_show_car_number
|
|
for park in self.unit_space_dict:
|
|
for park in self.unit_space_dict:
|
|
@@ -581,9 +581,7 @@ class MainWindow(QMainWindow, sui.Ui_MainWindow):
|
|
def btn_pickUp(self, dict, table_process_mod):
|
|
def btn_pickUp(self, dict, table_process_mod):
|
|
if self.is_input_pwd() is True:
|
|
if self.is_input_pwd() is True:
|
|
table = message.pick_table()
|
|
table = message.pick_table()
|
|
- # table.statu = message.table_statu()
|
|
|
|
table.statu.table_process_mod = table_process_mod
|
|
table.statu.table_process_mod = table_process_mod
|
|
- a = dict['primary_key']
|
|
|
|
table.primary_key = dict["primary_key"]
|
|
table.primary_key = dict["primary_key"]
|
|
self.rabbitmq.publish("command_ex", "user_pick_command_request_port",
|
|
self.rabbitmq.publish("command_ex", "user_pick_command_request_port",
|
|
tf.MessageToString(table, as_utf8=True))
|
|
tf.MessageToString(table, as_utf8=True))
|
|
@@ -780,8 +778,7 @@ class MainWindow(QMainWindow, sui.Ui_MainWindow):
|
|
# elif park["statu"] == 10 and park["remark"] is not None:
|
|
# elif park["statu"] == 10 and park["remark"] is not None:
|
|
# text_str = park["remark"][0:4]
|
|
# text_str = park["remark"][0:4]
|
|
# font.setPointSize(20)
|
|
# font.setPointSize(20)
|
|
- elif (park["statu"] == 2 or park["statu"] == 1 or park["statu"] == 4) and park[
|
|
|
|
- "car_number"] is not None and self.car_number_rbtn_2.isChecked():
|
|
|
|
|
|
+ elif 0 < park["statu"] < 6 and park["car_number"] is not None and self.car_number_rbtn_2.isChecked():
|
|
text_str = park["car_number"]
|
|
text_str = park["car_number"]
|
|
font.setPointSize(20)
|
|
font.setPointSize(20)
|
|
|
|
|
|
@@ -792,8 +789,6 @@ class MainWindow(QMainWindow, sui.Ui_MainWindow):
|
|
background_color = ""
|
|
background_color = ""
|
|
background_image = ""
|
|
background_image = ""
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
# 设置背景图
|
|
# 设置背景图
|
|
if park["height_level"] == self.parking_config['grade1']:
|
|
if park["height_level"] == self.parking_config['grade1']:
|
|
background_image = "background-image: url(./images/grade1.png);"
|
|
background_image = "background-image: url(./images/grade1.png);"
|
|
@@ -829,7 +824,7 @@ class MainWindow(QMainWindow, sui.Ui_MainWindow):
|
|
for key in park.keys():
|
|
for key in park.keys():
|
|
if park[key] is None:
|
|
if park[key] is None:
|
|
park[key] = ''
|
|
park[key] = ''
|
|
- tool_tip = json.dumps(park)
|
|
|
|
|
|
+ tool_tip = json.dumps(park, cls=DjangoJSONEncoder)
|
|
return font, text_str, stylesheet, tool_tip
|
|
return font, text_str, stylesheet, tool_tip
|
|
|
|
|
|
# 显示车辆图片
|
|
# 显示车辆图片
|
|
@@ -936,7 +931,7 @@ class MainWindow(QMainWindow, sui.Ui_MainWindow):
|
|
if self.is_pwd is False:
|
|
if self.is_pwd is False:
|
|
# 组装显示信息
|
|
# 组装显示信息
|
|
# 实例取车窗口,并以模态窗口形式显示
|
|
# 实例取车窗口,并以模态窗口形式显示
|
|
- pickup_window = PickupWindow(tipstr)
|
|
|
|
|
|
+ pickup_window = PickupWindow(tipstr,self.parking_config['passwd'])
|
|
pickup_window.exec_()
|
|
pickup_window.exec_()
|
|
|
|
|
|
res = pickup_window.getResult()
|
|
res = pickup_window.getResult()
|
|
@@ -974,7 +969,7 @@ class MainWindow(QMainWindow, sui.Ui_MainWindow):
|
|
item.setForeground(QColor('red'))
|
|
item.setForeground(QColor('red'))
|
|
show_str = dict['car_number'] + " 故障!"
|
|
show_str = dict['car_number'] + " 故障!"
|
|
show_str = "存 %d入 %d出 %d号车位 %s %s " % (
|
|
show_str = "存 %d入 %d出 %d号车位 %s %s " % (
|
|
- dict["import_id"], dict["export_id"], parkspace.table_id, show_str, str(dict["queue_time"].time()))
|
|
|
|
|
|
+ dict["import_id"], dict["export_id"], parkspace.table_id, show_str, str(dict["queue_time"].time()))
|
|
|
|
|
|
elif dict['type'] == 2: # 取车指令
|
|
elif dict['type'] == 2: # 取车指令
|
|
item.setBackground(QColor(250, 240, 200))
|
|
item.setBackground(QColor(250, 240, 200))
|
|
@@ -991,7 +986,7 @@ class MainWindow(QMainWindow, sui.Ui_MainWindow):
|
|
item.setForeground(QColor('red'))
|
|
item.setForeground(QColor('red'))
|
|
show_str = dict['car_number'] + " 故障!"
|
|
show_str = dict['car_number'] + " 故障!"
|
|
show_str = "取 %d入 %d出 %d号车位 %s %s " % (
|
|
show_str = "取 %d入 %d出 %d号车位 %s %s " % (
|
|
- dict["import_id"], dict["export_id"], parkspace.table_id, show_str, str(dict["queue_time"].time()))
|
|
|
|
|
|
+ dict["import_id"], dict["export_id"], parkspace.table_id, show_str, str(dict["queue_time"].time()))
|
|
item.setText(show_str)
|
|
item.setText(show_str)
|
|
return item
|
|
return item
|
|
|
|
|
|
@@ -1044,6 +1039,10 @@ class MainWindow(QMainWindow, sui.Ui_MainWindow):
|
|
return '号牌特写图'
|
|
return '号牌特写图'
|
|
elif key == 'remark':
|
|
elif key == 'remark':
|
|
return '备注'
|
|
return '备注'
|
|
|
|
+ elif key == 'remark_time':
|
|
|
|
+ return '备注时间'
|
|
|
|
+ elif key == 'apply_end_time':
|
|
|
|
+ return '预约结束时间'
|
|
else:
|
|
else:
|
|
return '未知'
|
|
return '未知'
|
|
|
|
|