From 65e90ce8a0d9a32c526a7467861da7666a6e1aee Mon Sep 17 00:00:00 2001 From: fujinliang Date: Tue, 30 Sep 2025 17:51:45 +0800 Subject: [PATCH] 35-50KG --- Config/drop-35.ini | 290 ++++++++++++++++++++++++-------------------- MainRecources_rc.py | 26 ++-- Seting.ini | 4 +- main.py | 73 ++++++++--- resources_rc.py | 2 +- ui_MainWin.py | 2 +- 6 files changed, 231 insertions(+), 166 deletions(-) diff --git a/Config/drop-35.ini b/Config/drop-35.ini index be17653..e9d3cff 100644 --- a/Config/drop-35.ini +++ b/Config/drop-35.ini @@ -35,8 +35,8 @@ status = 10 linetype = 4 [DropPoints1] -x = 1052.553 -y = -395.692 +x = 1018.237 +y = -433.424 z = -1202.361 u = -148.482 v = 1.0 @@ -48,8 +48,8 @@ status = 9 linetype = 0 [DropPoints2] -x = 1052.553 -y = 704.308 +x = 1018.237 +y = 666.576 z = -1202.361 u = -148.482 v = 2.0 @@ -61,8 +61,8 @@ status = 9 linetype = 0 [DropPoints3] -x = 1052.553 -y = 179.308 +x = 1018.237 +y = 116.576 z = -1202.361 u = -148.482 v = 3.0 @@ -74,10 +74,10 @@ status = 9 linetype = 0 [DropPoints4] -x = 1792.553 -y = -185.692 +x = 1688.237 +y = -433.424 z = -1202.361 -u = -58.482 +u = 31.518 v = 4.0 w = 0.0 id = 1 @@ -87,10 +87,10 @@ status = 9 linetype = 0 [DropPoints5] -x = 1792.553 -y = 544.308 +x = 1688.237 +y = 666.576 z = -1202.361 -u = -238.482 +u = 31.518 v = 5.0 w = 0.0 id = 1 @@ -100,9 +100,9 @@ status = 9 linetype = 0 [DropPoints6] -x = 1582.553 -y = -395.692 -z = -1052.361 +x = 1688.237 +y = 116.576 +z = -1202.361 u = 31.518 v = 6.0 w = 0.0 @@ -113,10 +113,10 @@ status = 9 linetype = 0 [DropPoints7] -x = 1582.553 -y = 704.308 +x = 818.237 +y = -233.424 z = -1052.361 -u = 31.518 +u = -58.482 v = 7.0 w = 0.0 id = 1 @@ -126,10 +126,10 @@ status = 9 linetype = 0 [DropPoints8] -x = 1582.553 -y = 179.308 +x = 1818.237 +y = -233.424 z = -1052.361 -u = 31.518 +u = -58.482 v = 8.0 w = 0.0 id = 1 @@ -139,8 +139,8 @@ status = 9 linetype = 0 [DropPoints9] -x = 842.553 -y = -185.692 +x = 1318.237 +y = -233.424 z = -1052.361 u = -58.482 v = 9.0 @@ -152,8 +152,8 @@ status = 9 linetype = 0 [DropPoints10] -x = 842.553 -y = 544.308 +x = 818.237 +y = 456.576 z = -1052.361 u = -238.482 v = 10.0 @@ -165,10 +165,10 @@ status = 9 linetype = 0 [DropPoints11] -x = 1052.553 -y = -395.692 -z = -902.361 -u = -148.482 +x = 1818.237 +y = 456.576 +z = -1052.361 +u = -238.482 v = 11.0 w = 0.0 id = 1 @@ -178,10 +178,10 @@ status = 9 linetype = 0 [DropPoints12] -x = 1052.553 -y = 704.308 -z = -902.361 -u = -148.482 +x = 1318.237 +y = 456.576 +z = -1052.361 +u = -238.482 v = 12.0 w = 0.0 id = 1 @@ -191,8 +191,8 @@ status = 9 linetype = 0 [DropPoints13] -x = 1052.553 -y = 179.308 +x = 1018.237 +y = -433.424 z = -902.361 u = -148.482 v = 13.0 @@ -204,10 +204,10 @@ status = 9 linetype = 0 [DropPoints14] -x = 1792.553 -y = -185.692 +x = 1018.237 +y = 666.576 z = -902.361 -u = -58.482 +u = -148.482 v = 14.0 w = 0.0 id = 1 @@ -217,10 +217,10 @@ status = 9 linetype = 0 [DropPoints15] -x = 1792.553 -y = 544.308 +x = 1018.237 +y = 116.576 z = -902.361 -u = -238.482 +u = -148.482 v = 15.0 w = 0.0 id = 1 @@ -230,9 +230,9 @@ status = 9 linetype = 0 [DropPoints16] -x = 1582.553 -y = -395.692 -z = -752.361 +x = 1688.237 +y = -433.424 +z = -902.361 u = 31.518 v = 16.0 w = 0.0 @@ -243,9 +243,9 @@ status = 9 linetype = 0 [DropPoints17] -x = 1582.553 -y = 704.308 -z = -752.361 +x = 1688.237 +y = 666.576 +z = -902.361 u = 31.518 v = 17.0 w = 0.0 @@ -256,9 +256,9 @@ status = 9 linetype = 0 [DropPoints18] -x = 1582.553 -y = 179.308 -z = -752.361 +x = 1688.237 +y = 116.576 +z = -902.361 u = 31.518 v = 18.0 w = 0.0 @@ -269,8 +269,8 @@ status = 9 linetype = 0 [DropPoints19] -x = 842.553 -y = -185.692 +x = 818.237 +y = -233.424 z = -752.361 u = -58.482 v = 19.0 @@ -282,10 +282,10 @@ status = 9 linetype = 0 [DropPoints20] -x = 842.553 -y = 544.308 +x = 1818.237 +y = -233.424 z = -752.361 -u = -238.482 +u = -58.482 v = 20.0 w = 0.0 id = 1 @@ -295,10 +295,10 @@ status = 9 linetype = 0 [DropPoints21] -x = 1052.553 -y = -395.692 -z = -602.361 -u = -148.482 +x = 1318.237 +y = -233.424 +z = -752.361 +u = -58.482 v = 21.0 w = 0.0 id = 1 @@ -308,10 +308,10 @@ status = 9 linetype = 0 [DropPoints22] -x = 1052.553 -y = 704.308 -z = -602.361 -u = -148.482 +x = 818.237 +y = 416.576 +z = -752.361 +u = -238.482 v = 22.0 w = 0.0 id = 1 @@ -321,10 +321,10 @@ status = 9 linetype = 0 [DropPoints23] -x = 1052.553 -y = 179.308 -z = -602.361 -u = -148.482 +x = 1818.237 +y = 416.576 +z = -752.361 +u = -238.482 v = 23.0 w = 0.0 id = 1 @@ -334,10 +334,10 @@ status = 9 linetype = 0 [DropPoints24] -x = 1792.553 -y = -185.692 -z = -602.361 -u = -58.482 +x = 1318.237 +y = 416.576 +z = -752.361 +u = -238.482 v = 24.0 w = 0.0 id = 1 @@ -347,10 +347,10 @@ status = 9 linetype = 0 [DropPoints25] -x = 1792.553 -y = 544.308 +x = 1018.237 +y = -433.424 z = -602.361 -u = -238.482 +u = -148.482 v = 25.0 w = 0.0 id = 1 @@ -360,10 +360,10 @@ status = 9 linetype = 0 [DropPoints26] -x = 1582.553 -y = -395.692 -z = -452.361 -u = 31.518 +x = 1018.237 +y = 666.576 +z = -602.361 +u = -148.482 v = 26.0 w = 0.0 id = 1 @@ -373,10 +373,10 @@ status = 9 linetype = 0 [DropPoints27] -x = 1582.553 -y = 704.308 -z = -452.361 -u = 31.518 +x = 1018.237 +y = 116.576 +z = -602.361 +u = -148.482 v = 27.0 w = 0.0 id = 1 @@ -386,9 +386,9 @@ status = 9 linetype = 0 [DropPoints28] -x = 1582.553 -y = 179.308 -z = -452.361 +x = 1688.237 +y = -433.424 +z = -602.361 u = 31.518 v = 28.0 w = 0.0 @@ -399,10 +399,10 @@ status = 9 linetype = 0 [DropPoints29] -x = 842.553 -y = -185.692 -z = -452.361 -u = -58.482 +x = 1688.237 +y = 666.576 +z = -602.361 +u = 31.518 v = 29.0 w = 0.0 id = 1 @@ -412,10 +412,10 @@ status = 9 linetype = 0 [DropPoints30] -x = 842.553 -y = 544.308 -z = -452.361 -u = -238.482 +x = 1688.237 +y = 116.576 +z = -602.361 +u = 31.518 v = 30.0 w = 0.0 id = 1 @@ -425,10 +425,10 @@ status = 9 linetype = 0 [DropPoints31] -x = 1052.553 -y = -395.692 -z = -302.361 -u = -148.482 +x = 818.237 +y = -233.424 +z = -452.361 +u = -58.482 v = 31.0 w = 0.0 id = 1 @@ -438,10 +438,10 @@ status = 9 linetype = 0 [DropPoints32] -x = 1052.553 -y = 704.308 -z = -302.361 -u = -148.482 +x = 1818.237 +y = -233.424 +z = -452.361 +u = -58.482 v = 32.0 w = 0.0 id = 1 @@ -451,10 +451,10 @@ status = 9 linetype = 0 [DropPoints33] -x = 1052.553 -y = 179.308 -z = -302.361 -u = -148.482 +x = 1318.237 +y = -233.424 +z = -452.361 +u = -58.482 v = 33.0 w = 0.0 id = 1 @@ -464,10 +464,10 @@ status = 9 linetype = 0 [DropPoints34] -x = 1792.553 -y = -185.692 -z = -302.361 -u = -58.482 +x = 818.237 +y = 416.576 +z = -452.361 +u = -238.482 v = 34.0 w = 0.0 id = 1 @@ -477,9 +477,9 @@ status = 9 linetype = 0 [DropPoints35] -x = 1792.553 -y = 544.308 -z = -302.361 +x = 1818.237 +y = 416.576 +z = -452.361 u = -238.482 v = 35.0 w = 0.0 @@ -490,10 +490,10 @@ status = 9 linetype = 0 [DropPoints36] -x = 1582.553 -y = -395.692 -z = -202.361 -u = 31.518 +x = 1318.237 +y = 416.576 +z = -452.361 +u = -238.482 v = 36.0 w = 0.0 id = 1 @@ -503,10 +503,10 @@ status = 9 linetype = 0 [DropPoints37] -x = 1582.553 -y = 704.308 -z = -202.361 -u = 31.518 +x = 1018.237 +y = -433.424 +z = -250.361 +u = -148.482 v = 37.0 w = 0.0 id = 1 @@ -516,10 +516,10 @@ status = 9 linetype = 0 [DropPoints38] -x = 1582.553 -y = 179.308 -z = -202.361 -u = 31.518 +x = 1018.237 +y = 666.576 +z = -250.361 +u = -148.482 v = 38.0 w = 0.0 id = 1 @@ -529,10 +529,10 @@ status = 9 linetype = 0 [DropPoints39] -x = 842.553 -y = -185.692 -z = -202.361 -u = -58.482 +x = 1018.237 +y = 116.576 +z = -250.361 +u = -148.482 v = 39.0 w = 0.0 id = 1 @@ -542,10 +542,10 @@ status = 9 linetype = 0 [DropPoints40] -x = 842.553 -y = 544.308 -z = -202.361 -u = -238.482 +x = 1688.237 +y = -433.424 +z = -250.361 +u = 31.518 v = 40.0 w = 0.0 id = 1 @@ -554,3 +554,29 @@ lineid = 1 status = 9 linetype = 0 +[DropPoints41] +x = 1688.237 +y = 666.576 +z = -250.361 +u = 31.518 +v = 41.0 +w = 0.0 +id = 37 +order = 42 +lineid = 1 +status = 9 +linetype = 0 + +[DropPoints42] +x = 1688.237 +y = 116.576 +z = -250.361 +u = 31.518 +v = 42.0 +w = 0.0 +id = 38 +order = 43 +lineid = 1 +status = 9 +linetype = 0 + diff --git a/MainRecources_rc.py b/MainRecources_rc.py index ec7c396..dbac2c7 100644 --- a/MainRecources_rc.py +++ b/MainRecources_rc.py @@ -102112,31 +102112,31 @@ qt_resource_struct = b"\ \x00\x00\x00\x0e\x00\x02\x00\x00\x00\x0d\x00\x00\x00\x03\ \x00\x00\x00\x00\x00\x00\x00\x00\ \x00\x00\x00\xb2\x00\x00\x00\x00\x00\x01\x00\x03/R\ -\x00\x00\x01\x99\x8e\x16\x01I\ +\x00\x00\x01\x99\x99\xa8;\xfb\ \x00\x00\x00\x1e\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\ -\x00\x00\x01\x99\x8e\x16\x01R\ +\x00\x00\x01\x99\x99\xa8<\x03\ \x00\x00\x008\x00\x00\x00\x00\x00\x01\x00\x00\x05\x9a\ -\x00\x00\x01\x99\x8e\x16\x01N\ +\x00\x00\x01\x99\x99\xa8<\x00\ \x00\x00\x00~\x00\x00\x00\x00\x00\x01\x00\x03\x13\xe9\ -\x00\x00\x01\x99\x8e\x16\x01O\ +\x00\x00\x01\x99\x99\xa8<\x01\ \x00\x00\x00\xe4\x00\x00\x00\x00\x00\x01\x00\x0ff\xaf\ -\x00\x00\x01\x99\x8e\x16\x01I\ +\x00\x00\x01\x99\x99\xa8;\xfb\ \x00\x00\x01\xbc\x00\x00\x00\x00\x00\x01\x00\x18\xcf\xe2\ -\x00\x00\x01\x99\x8e\x16\x01O\ +\x00\x00\x01\x99\x99\xa8<\x01\ \x00\x00\x01\x88\x00\x00\x00\x00\x00\x01\x00\x16\xd0\xa3\ -\x00\x00\x01\x99\x8e\x16\x01N\ +\x00\x00\x01\x99\x99\xa8<\x00\ \x00\x00\x01\xa6\x00\x00\x00\x00\x00\x01\x00\x16\xd7X\ -\x00\x00\x01\x99\x8e\x16\x01Q\ +\x00\x00\x01\x99\x99\xa8<\x03\ \x00\x00\x01\x16\x00\x00\x00\x00\x00\x01\x00\x0f\xd3\xa7\ -\x00\x00\x01\x99\x8e\x16\x01L\ +\x00\x00\x01\x99\x99\xa8;\xff\ \x00\x00\x00\x92\x00\x00\x00\x00\x00\x01\x00\x03\x1eU\ -\x00\x00\x01\x99\x8e\x16\x01P\ +\x00\x00\x01\x99\x99\xa8<\x01\ \x00\x00\x00\xc2\x00\x00\x00\x00\x00\x01\x00\x0f\x5c\xad\ -\x00\x00\x01\x99\x8e\x16\x01O\ +\x00\x00\x01\x99\x99\xa8<\x00\ \x00\x00\x01\xd6\x00\x00\x00\x00\x00\x01\x00\x18\xd4\xc0\ -\x00\x00\x01\x99\x8e\x16\x01O\ +\x00\x00\x01\x99\x99\xa8<\x01\ \x00\x00\x01P\x00\x00\x00\x00\x00\x01\x00\x16\xbe\x07\ -\x00\x00\x01\x99\x8e\x16\x01N\ +\x00\x00\x01\x99\x99\xa8<\x00\ " def qInitResources(): diff --git a/Seting.ini b/Seting.ini index 4a030c7..c40b7bc 100644 --- a/Seting.ini +++ b/Seting.ini @@ -47,8 +47,8 @@ photo_v5 = 0.0 photo_w5 = 1.0 linecount = 2 remain_linename = 1 -remain_dropweight_kg = 50 -remain_count = 18 +remain_dropweight_kg = 35 +remain_count = 1 maduo_count = 30 io_take_addr = 8 io_zip_addr = 11 diff --git a/main.py b/main.py index d3cba91..00304ea 100644 --- a/main.py +++ b/main.py @@ -65,6 +65,7 @@ class MainWindow(QMainWindow, Ui_MainWindow): self.last_status_printed = None self.last_pause_printed = None self.cur_pushbutton_num = None + self.drop_weight_index=0 self.pushbutton_num_style = """ QPushButton { background-color: #101F3F;color:#ffffff } """ @@ -603,7 +604,9 @@ class MainWindow(QMainWindow, Ui_MainWindow): background-color: #888888; } """) + self.label_showDetection.setScaledContents(True) + self.comboBox_dropWeight.wheelEvent=lambda e:None if self.label_showDetection.size().width() < 100 or self.label_showDetection.size().height() < 100: self.label_showDetection.setMinimumSize(541, 321) @@ -913,7 +916,7 @@ class MainWindow(QMainWindow, Ui_MainWindow): def send_startFeed_button_click(self): if self.feeding.feedStatus != FeedStatus.FNone: - self.show_infomessage_box("正在执行") + self.show_infomessage_box("已启动,无需重复启动") return # 触发自动运行 if self.robotClient.status_model.curMode != 7: @@ -935,20 +938,25 @@ class MainWindow(QMainWindow, Ui_MainWindow): if msg_box_person.clickedButton() == cancel_button: return log.log_message(logging.INFO, '第一层确认生产') - - has_person = False + #region 人员检测,暂无 + # has_person = False # has_person, _ = self.detection_person.get_person() # TODO - if has_person: # TODO + # if has_person: # TODO # self.feeding.pause = True # self.send_pause_command(True) # # self.show_messagebox_of_person() - msg_box_person.setText("检测到安全区域后人是否继续生产?") - result = msg_box_person.exec() - if msg_box_person.clickedButton() == cancel_button: - return - log.log_message(logging.ERROR, '人员进入安全区') + # msg_box_person.setText("检测到安全区域后人是否继续生产?") + # result = msg_box_person.exec() + # if msg_box_person.clickedButton() == cancel_button: + # return + # log.log_message(logging.ERROR, '人员进入安全区') #QSlide控件默认的最大值为99 + msg_box_person.setText(f"确认当前码垛重量是 {self.remain_drop_weight}KG!!") + result = msg_box_person.exec() + if msg_box_person.clickedButton() == cancel_button: + return + num = self.horizontalSlider_feedingNum.maximum() # if num==99: # num = 30 #默认是30包 @@ -961,8 +969,12 @@ class MainWindow(QMainWindow, Ui_MainWindow): return self.label_button_status.setText("运行中...") - self.drop_position_manager=DropPositionManager(Constant.dropLine_set_file_35) - self.relay_controller.set_drop_35(True) + if self.remain_drop_weight == '35': + self.drop_position_manager=DropPositionManager(Constant.dropLine_set_file_35) + self.relay_controller.set_drop_35(True) + else: + self.drop_position_manager=DropPositionManager(Constant.dropLine_set_file) + self.relay_controller.set_drop_35(False) #注意码垛数和码垛总数 # num=25 #先默认30包码垛 self.command_quene.put( @@ -1540,7 +1552,7 @@ class MainWindow(QMainWindow, Ui_MainWindow): self.comboBox_dropWeight.addItem(weight_text, userData) # 连接槽函数 - self.comboBox_dropWeight.currentIndexChanged.connect(self.on_drop_weight_changed) + self.comboBox_dropWeight.activated.connect(self.on_drop_weight_changed) # 设置初始化选中的重量 if self.remain_drop_weight: @@ -1549,14 +1561,25 @@ class MainWindow(QMainWindow, Ui_MainWindow): selected_index = self.comboBox_dropWeight.findData(selected_value) if selected_index >= 0: self.comboBox_dropWeight.setCurrentIndex(selected_index) + self.drop_weight_index=selected_index # 初始化重量提示标签 - self.weight_label_info.setText(f"Tips: 当前选择的码垛重量为 {self.remain_drop_weight}kg") + self.weight_label_info.setText(f"当前码垛重量 {self.remain_drop_weight}kg") """9/29 重量下拉框选中项变化时, 更新self.remain_drop_weight""" def on_drop_weight_changed(self, index): + #提示 + msgBox = QMessageBox(self) + msgBox.setText("修改码垛重量会从第1包开始,是否继续?") + msgBox.setStandardButtons(QMessageBox.Yes | QMessageBox.No) + result = msgBox.exec() + if result != QMessageBox.StandardButton.Yes: + self.comboBox_dropWeight.setCurrentIndex(self.drop_weight_index) + return + else: + self.drop_weight_index=index # 默认的重量为 50 kg - default_weight = 50 + default_weight = '50' if index < 0: # 没有选中项时(如下拉框为空) self.remain_drop_weight = default_weight @@ -1576,8 +1599,22 @@ class MainWindow(QMainWindow, Ui_MainWindow): self.remain_drop_weight = default_weight # 更新上方的码垛重量提示Tips: - self.weight_label_info.setText(f"Tips: 当前选择的码垛重量为 {selected_text}") + self.weight_label_info.setText(f"当前码垛重量 {selected_text}") + self.remain_Count=0 + if self.feeding.feedConfig: + self.feeding.feedConfig.remain_count = 0 + + self.label_remain_num.setText('0') + #35KG + if self.remain_drop_weight=='35': + self.label_maxNum.setText('42') + self.horizontalSlider_feedingNum.setMaximum(42) + self.maduo_Count=42 + else: + self.label_maxNum.setText('30') + self.horizontalSlider_feedingNum.setMaximum(30) + self.maduo_Count=30 def updateUI_label_status(self): if self.robotClient.status_model.isMoving==1: @@ -2104,6 +2141,8 @@ class MainWindow(QMainWindow, Ui_MainWindow): if self.feeding.feedConfig: self.configReader.set('Robot_Feed', 'remain_linename', str(self.feeding.feedConfig.feedLine.id)) self.configReader.set('Robot_Feed', 'remain_count', str(self.feeding.feedConfig.remain_count)) + else: + self.configReader.set('Robot_Feed', 'remain_count', str(self.remain_Count)) if self.cur_pushbutton_num: self.configReader.set('Robot_Feed', 'maduo_count', self.cur_pushbutton_num.text()) @@ -2111,8 +2150,8 @@ class MainWindow(QMainWindow, Ui_MainWindow): self.configReader.set("Robot_Feed", "remain_dropweight_kg", str(self.remain_drop_weight)) self.configReader.write(open(Constant.set_ini, 'w', encoding='utf-8')) - except: - log.log_message(logging.ERROR, Constant.str_sys_log_feedNum) + except Exception as ex: + log.log_message(logging.ERROR, Constant.str_sys_log_feedNum + str(ex)) class MyApplication(QApplication): diff --git a/resources_rc.py b/resources_rc.py index 4eb583e..285fd1c 100644 --- a/resources_rc.py +++ b/resources_rc.py @@ -4260,7 +4260,7 @@ qt_resource_struct = b"\ \x00\x00\x00\x0a\x00\x02\x00\x00\x00\x01\x00\x00\x00\x03\ \x00\x00\x00\x00\x00\x00\x00\x00\ \x00\x00\x00\x1a\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\ -\x00\x00\x01\x99\x8e\x16\x01P\ +\x00\x00\x01\x99\x99\xa8<\x01\ " def qInitResources(): diff --git a/ui_MainWin.py b/ui_MainWin.py index 9e2d8cf..62276c9 100644 --- a/ui_MainWin.py +++ b/ui_MainWin.py @@ -3346,7 +3346,7 @@ class Ui_MainWindow(object): weight_h_layout = QHBoxLayout() # weight_h_layout.setSpacing(10) self.weight_label = QLabel(self.frame_20) - self.weight_label.setText("选择码垛重量:") + self.weight_label.setText("选择料袋重量:") self.weight_label.setStyleSheet("color: white;") weight_h_layout.addWidget(self.weight_label)