pipe cutter new devs tbt in production
This commit is contained in:
parent
ee302b1e91
commit
f0b4bcfd9e
|
|
@ -209,3 +209,11 @@ class PipeCutterComponent(ModbusComponent):
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.log.error(f"Failed to write value {value} to register 30: {e}")
|
self.log.error(f"Failed to write value {value} to register 30: {e}")
|
||||||
raise
|
raise
|
||||||
|
|
||||||
|
def set_machine_mode(self):
|
||||||
|
try:
|
||||||
|
self.write(register=20, data=1, data_type="16bit_uint")
|
||||||
|
self.log.info(f"Successfully set machine mode to single cycle).")
|
||||||
|
except Exception as e:
|
||||||
|
self.log.error(f"Failed to set machine mode to single cycle: {e}")
|
||||||
|
raise
|
||||||
|
|
@ -210,6 +210,11 @@ try:
|
||||||
self.main_window.barcode_selection_a.triggered.connect(self.set_recipe_mode_barcode)
|
self.main_window.barcode_selection_a.triggered.connect(self.set_recipe_mode_barcode)
|
||||||
self.main_window.ristampa_etichetta_a.triggered.connect(self.reprint_label)
|
self.main_window.ristampa_etichetta_a.triggered.connect(self.reprint_label)
|
||||||
self.main_window.tag_a.triggered.connect(self.tag_write)
|
self.main_window.tag_a.triggered.connect(self.tag_write)
|
||||||
|
if "pipe_cutter" in self.components.keys():
|
||||||
|
self.main_window.cut_a.setVisible(True)
|
||||||
|
self.main_window.cut_a.triggered.connect(self.cut_tube)
|
||||||
|
else:
|
||||||
|
self.main_window.cut_a.setVisible(False)
|
||||||
self.main_window.diagnostics_a.triggered.connect(
|
self.main_window.diagnostics_a.triggered.connect(
|
||||||
lambda checked, selfie=weakref.ref(self): selfie().main_window.open_dialog(Diagnostics(selfie())))
|
lambda checked, selfie=weakref.ref(self): selfie().main_window.open_dialog(Diagnostics(selfie())))
|
||||||
if "--users-management" in sys.argv:
|
if "--users-management" in sys.argv:
|
||||||
|
|
@ -289,6 +294,8 @@ try:
|
||||||
if isinstance(self.main_window.centralWidget().centralWidget.widget, Barcode_Recipe_Selection):
|
if isinstance(self.main_window.centralWidget().centralWidget.widget, Barcode_Recipe_Selection):
|
||||||
barcode_data = self.main_window.centralWidget().centralWidget.widget.barcode_input_l.toPlainText().strip()
|
barcode_data = self.main_window.centralWidget().centralWidget.widget.barcode_input_l.toPlainText().strip()
|
||||||
self.main_window.centralWidget().centralWidget.widget.tag_write(barcode_data)
|
self.main_window.centralWidget().centralWidget.widget.tag_write(barcode_data)
|
||||||
|
def cut_tube(self):
|
||||||
|
self.main_window.centralWidget().cut_tube()
|
||||||
|
|
||||||
@pyqtSlot(str)
|
@pyqtSlot(str)
|
||||||
def load_recipe_from_rfid(self, data):
|
def load_recipe_from_rfid(self, data):
|
||||||
|
|
|
||||||
|
|
@ -68,7 +68,7 @@
|
||||||
<addaction name="table_selection_a"/>
|
<addaction name="table_selection_a"/>
|
||||||
<addaction name="barcode_selection_a"/>
|
<addaction name="barcode_selection_a"/>
|
||||||
<addaction name="tag_a"/>
|
<addaction name="tag_a"/>
|
||||||
<addaction name="actionCalibra_Taglio"/>
|
<addaction name="cut_a"/>
|
||||||
<addaction name="ristampa_etichetta_a"/>
|
<addaction name="ristampa_etichetta_a"/>
|
||||||
<addaction name="separator"/>
|
<addaction name="separator"/>
|
||||||
<addaction name="separator"/>
|
<addaction name="separator"/>
|
||||||
|
|
@ -153,7 +153,7 @@
|
||||||
<string>Scrivi Tag nfc</string>
|
<string>Scrivi Tag nfc</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
<action name="actionCalibra_Taglio">
|
<action name="cut_a">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Calibra Taglio</string>
|
<string>Calibra Taglio</string>
|
||||||
</property>
|
</property>
|
||||||
|
|
|
||||||
|
|
@ -249,6 +249,10 @@ class Test(Widget):
|
||||||
self.recipe_selection_mode = "barcode"
|
self.recipe_selection_mode = "barcode"
|
||||||
self.change_recipe()
|
self.change_recipe()
|
||||||
|
|
||||||
|
def cut_tube(self):
|
||||||
|
self.components["pipe_cutter"].to_calibrate()
|
||||||
|
self.components["pipe_cutter"].start_cutting()
|
||||||
|
|
||||||
def reprint_label(self):
|
def reprint_label(self):
|
||||||
self.print(self.last_label, self.print_step.spec.get("template", "EtichettaR5"))
|
self.print(self.last_label, self.print_step.spec.get("template", "EtichettaR5"))
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,7 @@ class Test_Pipe_Cutter(Test_Test):
|
||||||
self.step=step
|
self.step=step
|
||||||
self.current_cut_length = 0
|
self.current_cut_length = 0
|
||||||
self.get_connection = None
|
self.get_connection = None
|
||||||
|
self.to_calibrate=False
|
||||||
|
|
||||||
gif_path = "config/instruction_images/st-ten-10/pipe.gif"
|
gif_path = "config/instruction_images/st-ten-10/pipe.gif"
|
||||||
self.movie = QMovie(gif_path,QByteArray(), self)
|
self.movie = QMovie(gif_path,QByteArray(), self)
|
||||||
|
|
@ -52,14 +53,20 @@ class Test_Pipe_Cutter(Test_Test):
|
||||||
"""
|
"""
|
||||||
Perform the pipe cutting process when in the 'ready for operation' state (102).
|
Perform the pipe cutting process when in the 'ready for operation' state (102).
|
||||||
"""
|
"""
|
||||||
self.length = self.step.spec["length"]
|
self.components["pipe_cutter"].set_machine_mode()
|
||||||
self.diameter = self.step.spec["diameter"]
|
|
||||||
|
if self.to_calibrate:
|
||||||
|
self.length = 100
|
||||||
|
self.diameter = 21
|
||||||
|
self.to_calibrate=False # resetting flag
|
||||||
|
else:
|
||||||
|
self.length = self.step.spec["length"]
|
||||||
|
self.diameter = self.step.spec["diameter"]
|
||||||
if self.current_status == 102:
|
if self.current_status == 102:
|
||||||
|
|
||||||
try:
|
try:
|
||||||
self.length = int(self.length)*100
|
self.length = int(self.length)*100
|
||||||
self.diameter = int(self.diameter)*100
|
self.diameter = int(self.diameter)*100
|
||||||
print(self.length)
|
|
||||||
self.components["pipe_cutter"].write_od_of_pipe(self.diameter)
|
self.components["pipe_cutter"].write_od_of_pipe(self.diameter)
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
self.components["pipe_cutter"].write_od_of_pipe(self.diameter)
|
self.components["pipe_cutter"].write_od_of_pipe(self.diameter)
|
||||||
|
|
@ -107,8 +114,7 @@ class Test_Pipe_Cutter(Test_Test):
|
||||||
|
|
||||||
self.previus_status = None
|
self.previus_status = None
|
||||||
self.current_status = self.components["pipe_cutter"].read(register=766)
|
self.current_status = self.components["pipe_cutter"].read(register=766)
|
||||||
print(self.current_status)
|
#print(self.current_status)
|
||||||
|
|
||||||
# Status: 102 (ready for operation)
|
# Status: 102 (ready for operation)
|
||||||
if self.current_status == 102:
|
if self.current_status == 102:
|
||||||
if self.previous_status == 103:
|
if self.previous_status == 103:
|
||||||
|
|
@ -116,6 +122,7 @@ class Test_Pipe_Cutter(Test_Test):
|
||||||
self.stop_cutting()
|
self.stop_cutting()
|
||||||
|
|
||||||
# Start cutting if machine is ready
|
# Start cutting if machine is ready
|
||||||
|
|
||||||
self.start_cutting()
|
self.start_cutting()
|
||||||
|
|
||||||
# Status: 103 (running)
|
# Status: 103 (running)
|
||||||
|
|
@ -166,4 +173,8 @@ class Test_Pipe_Cutter(Test_Test):
|
||||||
self.parent_assembly_widget().set_text(text=text, bg_color=bg_color,text_color=text_color)
|
self.parent_assembly_widget().set_text(text=text, bg_color=bg_color,text_color=text_color)
|
||||||
QApplication.processEvents()
|
QApplication.processEvents()
|
||||||
time.sleep(0.3)
|
time.sleep(0.3)
|
||||||
QApplication.processEvents()
|
QApplication.processEvents()
|
||||||
|
|
||||||
|
|
||||||
|
def to_calibrate(self):
|
||||||
|
self.to_calibrate=True
|
||||||
Loading…
Reference in New Issue
Block a user