update 余料继续
This commit is contained in:
101
main.py
101
main.py
@ -38,7 +38,7 @@ class MainWindow(QMainWindow, Ui_MainWindow):
|
||||
def __init__(self):
|
||||
super(MainWindow, self).__init__()
|
||||
self.setupUi(self)
|
||||
|
||||
self.setWindowFlags(Qt.WindowType.FramelessWindowHint)
|
||||
self.init_qss()
|
||||
self.init_UI()
|
||||
self.init_Run()
|
||||
@ -171,6 +171,8 @@ class MainWindow(QMainWindow, Ui_MainWindow):
|
||||
self.pushButton_leftmenu_position.clicked.connect(lambda _, index=1: self.send_click_change_stackView(index))
|
||||
self.pushButton_leftmenu_baseSeting.clicked.connect(lambda _, index=2: self.send_click_change_stackView(index))
|
||||
self.pushButton_leftmenu_posDebug.clicked.connect(lambda _, index=3: self.send_click_change_stackView(index))
|
||||
self.pushButton_exit.clicked.connect(self.send_exit_button_click)
|
||||
|
||||
|
||||
int_validator = QIntValidator(0, 100, self.lineEdit_num)
|
||||
self.lineEdit_num.setValidator(int_validator)
|
||||
@ -206,11 +208,13 @@ class MainWindow(QMainWindow, Ui_MainWindow):
|
||||
(int(self.configReader.get('Robot_Feed', 'photo_x3')),
|
||||
int(self.configReader.get('Robot_Feed', 'photo_y3')),int(self.configReader.get('Robot_Feed', 'photo_z3')))
|
||||
]
|
||||
#TODO
|
||||
#dropDelay_time = int(self.configReader.get('Robot_Feed', 'dropDelay_time'))
|
||||
self.robotClient = RobotClient(ip, port, photo_locs, self.command_position_quene, self.status_address)
|
||||
self.feeding = Feeding(self.robotClient, self.detection) # 临时
|
||||
self.last_time = time.time()
|
||||
|
||||
self.remain_lineName = self.configReader.get('Robot_Feed', 'remain_lineName')
|
||||
self.remain_Count = int(self.configReader.get('Robot_Feed', 'remain_Count'))
|
||||
try:
|
||||
self.robotClient.CreatConnect()
|
||||
except:
|
||||
@ -425,7 +429,7 @@ class MainWindow(QMainWindow, Ui_MainWindow):
|
||||
|
||||
|
||||
name = self.configReader.get(line_str, 'Name', fallback='未命名')
|
||||
self.feedLine_dict[f'{Constant.feedLine_set_section}{i + 1}'] = FeedLine(name, safe_position,
|
||||
self.feedLine_dict[f'{Constant.feedLine_set_section}{i + 1}'] = FeedLine(i+1,name, safe_position,
|
||||
photo_position, mid_position,
|
||||
broken_position1,broken_position2,dropBag_position,zipBag_poistion,feed_position)
|
||||
self.init_seting_frame()
|
||||
@ -475,7 +479,35 @@ class MainWindow(QMainWindow, Ui_MainWindow):
|
||||
self.robot_connect_threading = Thread(target=self.robotClient.run)
|
||||
self.main_threading.start()
|
||||
self.robot_connect_threading.start()
|
||||
|
||||
self.check_continue()
|
||||
pass
|
||||
def check_continue(self):
|
||||
if self.remain_Count!=0:
|
||||
for key in self.feedLine_dict.keys():
|
||||
feed_line = self.feedLine_dict[key]
|
||||
if f'FeedLine{self.remain_lineName}' == key:
|
||||
#提示
|
||||
remain_messageBox = QMessageBox()
|
||||
remain_messageBox.setIcon(QMessageBox.Icon.Warning)
|
||||
remain_messageBox.setText(f'还有{self.remain_Count}袋未投料,是否继续?')
|
||||
remain_messageBox.setStandardButtons(QMessageBox.StandardButton.Ok | QMessageBox.StandardButton.Cancel)
|
||||
result = remain_messageBox.exec()
|
||||
if result == QMessageBox.StandardButton.Cancel:
|
||||
return
|
||||
self.configReader.read(Constant.feedLine_set_file, encoding='utf-8')
|
||||
line_name = self.configReader.get(key, 'name')
|
||||
current_index = self.comboBox_lineIndex.findText(line_name)
|
||||
self.comboBox_lineIndex.setCurrentIndex(current_index)
|
||||
|
||||
#self.horizontalSlider_feedingNum.setMaximum(self.remain_Count)
|
||||
self.horizontalSlider_feedingNum.setMaximum(self.remain_Count)
|
||||
self.label_maxNum.setText(str(self.remain_Count))
|
||||
self.horizontalSlider_feedingNum.setValue(0)
|
||||
|
||||
self.send_startFeed_button_click()
|
||||
else:
|
||||
return
|
||||
|
||||
def send_startFeed_button_click(self):
|
||||
# 触发自动运行
|
||||
@ -484,7 +516,37 @@ class MainWindow(QMainWindow, Ui_MainWindow):
|
||||
log.log_message(logging.INFO, Constant.str_sys_switch_tool)
|
||||
self.send_start_tool_command()
|
||||
log.log_message(logging.INFO, Constant.str_sys_start_tool)
|
||||
|
||||
msg_box_person = QMessageBox()
|
||||
msg_box_person.setIcon(QMessageBox.Icon.Information)
|
||||
msg_box_person.setText("是否确认生产区域安全继续生产?")
|
||||
msg_box_person.setWindowTitle("提示")
|
||||
msg_box_person.setStandardButtons(QMessageBox.StandardButton.Ok | QMessageBox.StandardButton.Cancel)
|
||||
|
||||
result = msg_box_person.exec()
|
||||
|
||||
if result == QMessageBox.StandardButton.Cancel:
|
||||
return
|
||||
log.log_message(logging.INFO, '第一层确认生产')
|
||||
|
||||
|
||||
has_person, _ = self.detection_person.get_person()
|
||||
if has_person:
|
||||
# self.feeding.pause = True
|
||||
# self.send_pause_command(True)
|
||||
#
|
||||
# self.show_messagebox_of_person()
|
||||
msg_box_person.setText("检测到安全区域后人是否继续生产?")
|
||||
result = msg_box_person.exec()
|
||||
if result == QMessageBox.StandardButton.Cancel:
|
||||
return
|
||||
log.log_message(logging.ERROR, '人员进入安全区')
|
||||
|
||||
|
||||
|
||||
|
||||
num = self.horizontalSlider_feedingNum.maximum()
|
||||
|
||||
line_head = self.comboBox_lineIndex.currentData()
|
||||
self.command_quene.put(FeedCommand(FeedingConfig(num, self.feedLine_dict[line_head])))
|
||||
self.stackedWidget_num.setCurrentIndex(1)
|
||||
@ -815,6 +877,13 @@ class MainWindow(QMainWindow, Ui_MainWindow):
|
||||
self.horizontalSlider_feedingNum.setValue(
|
||||
self.horizontalSlider_feedingNum.maximum() - self.feeding.feedConfig.num)
|
||||
self.label_remain_num.setText(str(self.feeding.feedConfig.num))
|
||||
try:
|
||||
self.configReader.read(Constant.set_ini)
|
||||
self.configReader.set('Robot_Feed', 'remain_linename', str(self.feeding.feedConfig.feedLine.id))
|
||||
self.configReader.set('Robot_Feed', 'remain_count', str(self.feeding.feedConfig.num))
|
||||
self.configReader.write(open(Constant.set_ini, 'w', encoding='utf-8'))
|
||||
except:
|
||||
log.log_message(logging.ERROR, Constant.str_sys_log_feedNum)
|
||||
else:
|
||||
self.set_run_status_button(False)
|
||||
if self.feeding.feedStatus == FeedStatus.FNone:
|
||||
@ -822,12 +891,7 @@ class MainWindow(QMainWindow, Ui_MainWindow):
|
||||
else:
|
||||
self.stackedWidget_num.setCurrentIndex(1)
|
||||
|
||||
has_person,_ = self.detection_person.get_person()
|
||||
if has_person:
|
||||
self.feeding.pause=True
|
||||
self.send_pause_command(True)
|
||||
self.show_messagebox_of_person()
|
||||
log.log_message(logging.ERROR, '人员进入安全区')
|
||||
|
||||
self.label_date.setText(datetime.now().strftime("%Y-%m-%d"))
|
||||
self.label_time.setText(datetime.now().strftime("%H:%M:%S"))
|
||||
|
||||
@ -995,7 +1059,7 @@ class MainWindow(QMainWindow, Ui_MainWindow):
|
||||
position_instruction.m4 = float(x5)
|
||||
position_instruction.m5 = float(x6)
|
||||
position_instruction.action = move_type.value
|
||||
position_instruction.speed=40
|
||||
position_instruction.speed=Constant.debug_speed
|
||||
instruction_command = CMDInstructRequest()
|
||||
instruction_command.instructions.append(position_instruction)
|
||||
request_command = instruction_command.toString()
|
||||
@ -1218,15 +1282,28 @@ class MainWindow(QMainWindow, Ui_MainWindow):
|
||||
self.lineEdit_y3.setText(str(self.robotClient.photo_locs[2][1]))
|
||||
self.lineEdit_z3.setText(str(self.robotClient.photo_locs[2][2]))
|
||||
pass
|
||||
def updateUI_Base_Set(self):
|
||||
self.lineEdit_speed_run.setText(str(Constant.speed))
|
||||
self.lineEdit_speed_debug.setText(str(Constant.shake_speed))
|
||||
|
||||
def show_infomessage_box(self,message):
|
||||
msg_box = QMessageBox(self)
|
||||
msg_box.setWindowTitle("提示")
|
||||
msg_box.setText(message)
|
||||
msg_box.setIcon(QMessageBox.Information)
|
||||
msg_box.setStandardButtons(QMessageBox.OK)
|
||||
msg_box.setIcon(QMessageBox.Icon.Information)
|
||||
msg_box.setStandardButtons(QMessageBox.StandardButton.Ok)
|
||||
def send_click_change_stackView(self,index):
|
||||
self.stackedWidget_view.setCurrentIndex(index)
|
||||
if index == 0:
|
||||
self.updateUI_Select_Line()
|
||||
if index == 1:
|
||||
self.updateUI_Photo_Set()
|
||||
if index == 2:
|
||||
self.updateUI_Base_Set()
|
||||
|
||||
def send_exit_button_click(self):
|
||||
QApplication.quit()
|
||||
sys.exit(app.exec())
|
||||
|
||||
def send_click_sysmeuExpand(self):
|
||||
self.frame_sys_seting.setVisible(not self.frame_sys_seting.isVisible())
|
||||
|
||||
Reference in New Issue
Block a user