|
@@ -36,6 +36,8 @@ class MainWindow(QMainWindow, Ui_MainWindow):
|
|
|
self.scroll_flag_dict = {}
|
|
|
self.command_dict = {}
|
|
|
self.last_command_dict = {}
|
|
|
+ self.pick_wait_weight = {}
|
|
|
+ self.last_pick_wait_weight = {}
|
|
|
self.btn_positions = [(i, j) for i in range(0, show_config['row']) for j in range(show_config['column'])]
|
|
|
# 创建listwidget与label 配置多少个单元生成多少对
|
|
|
|
|
@@ -48,7 +50,7 @@ class MainWindow(QMainWindow, Ui_MainWindow):
|
|
|
|
|
|
self.list_widget_dict[i].setStyleSheet("border:5px solid #c0181f;")
|
|
|
self.list_widget_dict[i].setObjectName(('list_widget_%d' % (i + 1)))
|
|
|
- self.list_widget_thread[i] = threading.Thread(target=self.Scroll,args=(i,))
|
|
|
+ self.list_widget_thread[i] = threading.Thread(target=self.Scroll, args=(i,))
|
|
|
self.list_widget_thread[i].start()
|
|
|
label = QLabel(self.get_unit(i), self)
|
|
|
label.setFont(QFont("黑体", 30, QFont.Bold)) # 设置字体、样式和大小
|
|
@@ -63,15 +65,16 @@ class MainWindow(QMainWindow, Ui_MainWindow):
|
|
|
self.main_gridLayout.addLayout(vboxlayout, *position)
|
|
|
self.main_gridLayout.setVerticalSpacing(40)
|
|
|
self.command_dict[i] = []
|
|
|
+ self.pick_wait_weight[i] = {}
|
|
|
|
|
|
- # 界面刷新定时器
|
|
|
- self.timer = QTimer()
|
|
|
- self.timer.timeout.connect(self.Switch)
|
|
|
- self.timer.start(200)
|
|
|
# 数据库查询线程
|
|
|
self.db_query = threading.Thread(target=self.db_query)
|
|
|
self.db_query_isClose = False
|
|
|
self.db_query.start()
|
|
|
+ # 界面刷新定时器
|
|
|
+ self.timer = QTimer()
|
|
|
+ self.timer.timeout.connect(self.Switch)
|
|
|
+ self.timer.start(200)
|
|
|
|
|
|
# 断开连接的弹窗
|
|
|
self.t_timer = QTimer(self)
|
|
@@ -95,18 +98,23 @@ class MainWindow(QMainWindow, Ui_MainWindow):
|
|
|
def db_query(self):
|
|
|
while self.db_query_isClose is False:
|
|
|
for i in self.unit_list:
|
|
|
- if self.task_type != 0 and i != 40:
|
|
|
- self.last_command_dict[i] = self.db.query_command_all_in_unit_type_and_sort(i, self.task_type)
|
|
|
- elif self.task_type != 0 and i == 40:
|
|
|
- self.last_command_dict[i] = self.db.query_command_top_number_in_type(self.task_type,self.top_number)
|
|
|
- elif self.task_type == 0 and i != 40:
|
|
|
- self.last_command_dict[i] = self.db.query_command_all_in_unit_and_sort(i)
|
|
|
+ self.last_pick_wait_weight[i] = self.db.query_pick_wait_weight_in_unit(i)
|
|
|
+ if i != 40:
|
|
|
+ self.last_command_dict[i] = self.db.query_queue_condition_in_unit(i)
|
|
|
else:
|
|
|
- self.last_command_dict[i] = self.db.query_command_top_number(self.top_number)
|
|
|
+ self.last_command_dict[i] = self.db.query_command_top_number_in_type(self.task_type,
|
|
|
+ self.top_number)
|
|
|
+
|
|
|
+ # elif self.task_type != 0 and i == 40:
|
|
|
+ # self.last_command_dict[i] = self.db.query_command_top_number_in_type(self.task_type,self.top_number)
|
|
|
+ # elif self.task_type == 0 and i != 40:
|
|
|
+ # self.last_command_dict[i] = self.db.query_queue_condition_in_unit(i)
|
|
|
+ # else:
|
|
|
+ # self.last_command_dict[i] = self.db.query_command_top_number(self.top_number)
|
|
|
|
|
|
time.sleep(0.2)
|
|
|
|
|
|
- def get_listWidget_item(self, dict):
|
|
|
+ def get_listWidget_item(self, dict, index):
|
|
|
item = QListWidgetItem()
|
|
|
item.setFont(QFont('微软雅黑', self.font_size, QFont.Bold))
|
|
|
show_str = ""
|
|
@@ -128,35 +136,40 @@ class MainWindow(QMainWindow, Ui_MainWindow):
|
|
|
item.setBackground(QColor(250, 240, 200))
|
|
|
if (dict['statu'] == 0): # 排队
|
|
|
item.setForeground(QColor(80, 80, 80))
|
|
|
- show_str = "%s 排队中" % (dict['car_number'])
|
|
|
+ show_str = "%s %s排队中" % (dict['car_number'], self.get_unit(dict['unit']))
|
|
|
+ if index != 40:
|
|
|
+ show_str = "%s 剩%d分钟" % (dict['car_number'],
|
|
|
+ int((dict['row_number() over(order by queue_time)'] - 1) * 5 *
|
|
|
+ self.pick_wait_weight[index][0]['wait_weight']))
|
|
|
elif (dict['statu'] == 1): # 工作
|
|
|
item.setForeground(QColor('blue'))
|
|
|
- show_str = "%s 取车中" % (dict['car_number'])
|
|
|
+ show_str = "%s %s取车中" % (dict['car_number'], self.get_unit(dict['unit']))
|
|
|
elif (dict['statu'] == 2): # 已完成
|
|
|
item.setForeground(QColor('green'))
|
|
|
- show_str = "%s 出口%d" % (dict['car_number'],dict['export_id'])
|
|
|
+ show_str = "%s %s出口%d" % (dict['car_number'], self.get_unit(dict['unit']), dict['export_id'])
|
|
|
elif (dict['statu'] == 3): # 已完成
|
|
|
item.setForeground(QColor(80, 180, 200))
|
|
|
- show_str = "%s 维护!" % (dict['car_number'])
|
|
|
- show_str = show_str[:len(show_str)-3]+self.get_unit(dict['unit'])+show_str[len(show_str)-3:]
|
|
|
+ show_str = "%s %s维护!" % (dict['car_number'], self.get_unit(dict['unit']))
|
|
|
|
|
|
item.setText(show_str)
|
|
|
return item
|
|
|
|
|
|
def Switch(self):
|
|
|
for i in self.unit_list:
|
|
|
- if (i in self.last_command_dict.keys()) is False or self.last_command_dict[i] is None:
|
|
|
+
|
|
|
+ if (i in self.last_command_dict.keys()) is False or self.last_command_dict[i] is None or \
|
|
|
+ (i in self.last_pick_wait_weight.keys()) is False or self.last_pick_wait_weight[i] is None:
|
|
|
self.show_message_box()
|
|
|
- elif self.command_dict[i] != self.last_command_dict[i]:
|
|
|
+ elif self.command_dict[i] != self.last_command_dict[i] or self.pick_wait_weight[i] != \
|
|
|
+ self.last_pick_wait_weight[i]:
|
|
|
+ self.pick_wait_weight[i] = self.last_pick_wait_weight[i]
|
|
|
self.command_dict[i] = self.last_command_dict[i]
|
|
|
self.list_widget_dict[i].clear()
|
|
|
-
|
|
|
for dict in self.command_dict[i]:
|
|
|
- if dict['statu'] != 4:
|
|
|
- self.list_widget_dict[i].addItem(self.get_listWidget_item(dict))
|
|
|
-
|
|
|
+ if dict['statu'] != 4 and dict['type'] == self.task_type:
|
|
|
+ self.list_widget_dict[i].addItem(self.get_listWidget_item(dict, i))
|
|
|
|
|
|
- def Scroll(self,i):
|
|
|
+ def Scroll(self, i):
|
|
|
while True:
|
|
|
for index in range(self.list_widget_dict[i].count()):
|
|
|
# if self.scroll_flag_dict[i] is True:
|