diff --git a/config/label_designs/TEXA/TEXA30X16.nlbl b/config/label_designs/TEXA/TEXA30X16.nlbl new file mode 100644 index 0000000..ac1d884 Binary files /dev/null and b/config/label_designs/TEXA/TEXA30X16.nlbl differ diff --git a/config/label_templates/203/Texa30x16.prn b/config/label_templates/203/Texa30x16.prn new file mode 100644 index 0000000..42d7e3b --- /dev/null +++ b/config/label_templates/203/Texa30x16.prn @@ -0,0 +1,11 @@ +CT~~CD,~CC^~CT~ +^XA~TA000~JSN^LT0^MNW^MTT^PON^PMN^LH0,0^JMA^PR4,4~SD15^JUS^LRN^CI0^XZ +^XA +^MMT +^PW240 +^LL0128 +^LS0 +^FT6,35^A0N,17,17^FH\^FDF{SUPPLY}C{PART}D{YY}{WW}S{SN7}^FS +^BY70,70^FT71,131^BXN,5,200,0,0,1,~ +^FH\^FD{BCODE}^FS +^PQ1,0,1,Y^XZ diff --git a/config/machine_settings/st-ten-13.ini b/config/machine_settings/st-ten-13.ini index f00d44f..f2eece2 100644 --- a/config/machine_settings/st-ten-13.ini +++ b/config/machine_settings/st-ten-13.ini @@ -20,7 +20,7 @@ discard_box: absent #enforce_piece_removal: yes [tecna_t3] -port: /dev/ttyUSB1 +port: /dev/ttyUSB0 model: t3l [label_printer] @@ -34,7 +34,7 @@ risoluzione:203 id: USB-5862,BID#0 [fixture_rfid] -port: ttyUSB0 #correct way to declare usb in linux +port: ttyUSB1 #correct way to declare usb in linux [recipe] recipe_name_field: codice_ricetta @@ -87,8 +87,8 @@ settling_pressure_min_percent: 5 settling_pressure_max_percent: 5 test_pressure: 5900 test_time: 10 -test_pressure_qpos: 3.5 #Q+ Upper test leak limit -test_pressure_qneg: 6.5 #Q- Lower test leak limit +test_pressure_qpos: 4.5 #Q+ Upper test leak limit +test_pressure_qneg: 7.3 #Q- Lower test leak limit test_pressure_tt_qpos: 1 # Q+ Upper test leak limit (tube-tube) test_pressure_tt_qneg: 5 # Q- Lower test leak limit (tube-tube) flush_time: 1 diff --git a/src/components/os_label_printer.py b/src/components/os_label_printer.py index 0226428..f754f7c 100644 --- a/src/components/os_label_printer.py +++ b/src/components/os_label_printer.py @@ -55,7 +55,6 @@ class Os_Label_Printer(Component): label_file_contents = f.read() # LABEL PRINT #label = label.format(**context) - label_file_contents = label_file_contents.replace("{BCODE}", "{YY}{MO}{DD}{HH}{MI}{SN6}") for key, val in context.items(): key = "{" + key + "}" label_file_contents = label_file_contents.replace(key, val) diff --git a/src/scripts/print_labels.py b/src/scripts/print_labels.py index 3d4ff4a..3f44460 100644 --- a/src/scripts/print_labels.py +++ b/src/scripts/print_labels.py @@ -6,30 +6,27 @@ from PyQt5.QtWidgets import QApplication from src.components.os_label_printer import * from src.lib.helpers import ConfigReader -SYSTEM_ID = "test-windows" -START_SN=1 -STOP_SN=6 -TEMPLATE="f_flag_qr_only.prn" -PRINTER_NAME="zd421" -PN="055015378" +SYSTEM_ID = "test-linux" +START_SN = 1 +STOP_SN = 6 +TEMPLATE = "Texa30x16.prn" +PRINTER_NAME = "zd421" +PN = "3918423" config = ConfigReader(system_id=SYSTEM_ID) -printer=Os_Label_Printer(config=config,name="label_printer") +printer = Os_Label_Printer(config=config, name="label_printer") +barcode_format = "F{SUPPLY}C{PART}D{YY}{WW}S{SN7}" - -# timenow = datetime.now() app = QApplication(sys.argv) -for sn in range(START_SN,STOP_SN+1): +for sn in range(START_SN, STOP_SN + 1): timenow = datetime.now() print(f"PRINTING LABEL # {sn}") context = { - # RECIPE DATA "PART": PN, - # SERIAL DEFINITION "SN": str(sn), "SN4": f"{sn:0>4}", "SN5": f"{sn:0>5}", "SN6": f"{sn:0>6}", - # TIME DEFINITION + "SN7": f"{sn:0>7}", "DATETIME": timenow.strftime("%d/%m/%Y %H:%M:%S"), "DATE": timenow.strftime("%d/%m/%Y"), "TIME": timenow.strftime("%H:%M:%S"), @@ -41,7 +38,12 @@ for sn in range(START_SN,STOP_SN+1): "MI": timenow.strftime("%M"), "SS": timenow.strftime("%S"), "JJJ": timenow.strftime("%j"), + "WW": timenow.strftime("%W"), + "SUPPLY": "10231", } - printer.print_label(TEMPLATE,context) - - time.sleep(1) \ No newline at end of file + formatted_barcode = barcode_format.format(**context) + context['BCODE'] = formatted_barcode + + printer.print_label(TEMPLATE, context) + + time.sleep(1) diff --git a/src/ui/test/test.py b/src/ui/test/test.py index f0f6e62..4dcb552 100755 --- a/src/ui/test/test.py +++ b/src/ui/test/test.py @@ -794,6 +794,7 @@ class Test(Widget): "SN4": f"{archived.id:0>4}", "SN5": f"{archived.id:0>5}", "SN6": f"{archived.id:0>6}", + "SN7": f"{archived.id:0>7}", # TIME DEFINITION "DATETIME": archived.time.strftime("%d/%m/%Y %H:%M:%S"), "DATE": archived.time.strftime("%d/%m/%Y"), @@ -806,6 +807,7 @@ class Test(Widget): "MI": archived.time.strftime("%M"), "SS": archived.time.strftime("%S"), "JJJ": archived.time.strftime("%j"), + "WW": archived.time.strftime("%W"), # EXTRA DATA "SHIFT": str(get_shift(archived.time)), "STATION": str(self.config.machine_id), @@ -825,7 +827,8 @@ class Test(Widget): barcode_format = self.print_step.spec.get("barcode", "-") self.printed_barcode = barcode_format.format_map(context) - self.archived.barcode = self.printed_barcode + if self.archived is not None: + self.archived.barcode = self.printed_barcode for n in range(5): diff --git a/src/ui/test_leak/test_leak.py b/src/ui/test_leak/test_leak.py index c26b3f3..1c37eb1 100644 --- a/src/ui/test_leak/test_leak.py +++ b/src/ui/test_leak/test_leak.py @@ -26,7 +26,7 @@ class Test_Leak(Test_Test): self.show_instruction_b.setVisible("show_instructions" in self.parent.config["hardware_config"].keys()) self.show_instruction_b.clicked.connect(self.show_instruction) - self.components[self.tester_component].tecna_error_signal.connect(self.handle_modbus_error) + #self.components[self.tester_component].tecna_error_signal.connect(self.handle_modbus_error) def show_instruction(self): dialog=Dialog()