Merge remote-tracking branch 'origin/master'

This commit is contained in:
stten7 2025-03-25 10:44:39 +01:00
commit ae3962cf2e
7 changed files with 38 additions and 23 deletions

Binary file not shown.

View File

@ -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

View File

@ -20,7 +20,7 @@ discard_box: absent
#enforce_piece_removal: yes #enforce_piece_removal: yes
[tecna_t3] [tecna_t3]
port: /dev/ttyUSB1 port: /dev/ttyUSB0
model: t3l model: t3l
[label_printer] [label_printer]
@ -34,7 +34,7 @@ risoluzione:203
id: USB-5862,BID#0 id: USB-5862,BID#0
[fixture_rfid] [fixture_rfid]
port: ttyUSB0 #correct way to declare usb in linux port: ttyUSB1 #correct way to declare usb in linux
[recipe] [recipe]
recipe_name_field: codice_ricetta recipe_name_field: codice_ricetta
@ -87,8 +87,8 @@ settling_pressure_min_percent: 5
settling_pressure_max_percent: 5 settling_pressure_max_percent: 5
test_pressure: 5900 test_pressure: 5900
test_time: 10 test_time: 10
test_pressure_qpos: 3.5 #Q+ Upper test leak limit test_pressure_qpos: 4.5 #Q+ Upper test leak limit
test_pressure_qneg: 6.5 #Q- Lower 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_qpos: 1 # Q+ Upper test leak limit (tube-tube)
test_pressure_tt_qneg: 5 # Q- Lower test leak limit (tube-tube) test_pressure_tt_qneg: 5 # Q- Lower test leak limit (tube-tube)
flush_time: 1 flush_time: 1

View File

@ -55,7 +55,6 @@ class Os_Label_Printer(Component):
label_file_contents = f.read() label_file_contents = f.read()
# LABEL PRINT # LABEL PRINT
#label = label.format(**context) #label = label.format(**context)
label_file_contents = label_file_contents.replace("{BCODE}", "{YY}{MO}{DD}{HH}{MI}{SN6}")
for key, val in context.items(): for key, val in context.items():
key = "{" + key + "}" key = "{" + key + "}"
label_file_contents = label_file_contents.replace(key, val) label_file_contents = label_file_contents.replace(key, val)

View File

@ -6,30 +6,27 @@ from PyQt5.QtWidgets import QApplication
from src.components.os_label_printer import * from src.components.os_label_printer import *
from src.lib.helpers import ConfigReader from src.lib.helpers import ConfigReader
SYSTEM_ID = "test-windows" SYSTEM_ID = "test-linux"
START_SN=1 START_SN = 1
STOP_SN=6 STOP_SN = 6
TEMPLATE="f_flag_qr_only.prn" TEMPLATE = "Texa30x16.prn"
PRINTER_NAME="zd421" PRINTER_NAME = "zd421"
PN="055015378" PN = "3918423"
config = ConfigReader(system_id=SYSTEM_ID) 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) 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() timenow = datetime.now()
print(f"PRINTING LABEL # {sn}") print(f"PRINTING LABEL # {sn}")
context = { context = {
# RECIPE DATA
"PART": PN, "PART": PN,
# SERIAL DEFINITION
"SN": str(sn), "SN": str(sn),
"SN4": f"{sn:0>4}", "SN4": f"{sn:0>4}",
"SN5": f"{sn:0>5}", "SN5": f"{sn:0>5}",
"SN6": f"{sn:0>6}", "SN6": f"{sn:0>6}",
# TIME DEFINITION "SN7": f"{sn:0>7}",
"DATETIME": timenow.strftime("%d/%m/%Y %H:%M:%S"), "DATETIME": timenow.strftime("%d/%m/%Y %H:%M:%S"),
"DATE": timenow.strftime("%d/%m/%Y"), "DATE": timenow.strftime("%d/%m/%Y"),
"TIME": timenow.strftime("%H:%M:%S"), "TIME": timenow.strftime("%H:%M:%S"),
@ -41,7 +38,12 @@ for sn in range(START_SN,STOP_SN+1):
"MI": timenow.strftime("%M"), "MI": timenow.strftime("%M"),
"SS": timenow.strftime("%S"), "SS": timenow.strftime("%S"),
"JJJ": timenow.strftime("%j"), "JJJ": timenow.strftime("%j"),
"WW": timenow.strftime("%W"),
"SUPPLY": "10231",
} }
printer.print_label(TEMPLATE,context) formatted_barcode = barcode_format.format(**context)
context['BCODE'] = formatted_barcode
time.sleep(1)
printer.print_label(TEMPLATE, context)
time.sleep(1)

View File

@ -794,6 +794,7 @@ class Test(Widget):
"SN4": f"{archived.id:0>4}", "SN4": f"{archived.id:0>4}",
"SN5": f"{archived.id:0>5}", "SN5": f"{archived.id:0>5}",
"SN6": f"{archived.id:0>6}", "SN6": f"{archived.id:0>6}",
"SN7": f"{archived.id:0>7}",
# TIME DEFINITION # TIME DEFINITION
"DATETIME": archived.time.strftime("%d/%m/%Y %H:%M:%S"), "DATETIME": archived.time.strftime("%d/%m/%Y %H:%M:%S"),
"DATE": archived.time.strftime("%d/%m/%Y"), "DATE": archived.time.strftime("%d/%m/%Y"),
@ -806,6 +807,7 @@ class Test(Widget):
"MI": archived.time.strftime("%M"), "MI": archived.time.strftime("%M"),
"SS": archived.time.strftime("%S"), "SS": archived.time.strftime("%S"),
"JJJ": archived.time.strftime("%j"), "JJJ": archived.time.strftime("%j"),
"WW": archived.time.strftime("%W"),
# EXTRA DATA # EXTRA DATA
"SHIFT": str(get_shift(archived.time)), "SHIFT": str(get_shift(archived.time)),
"STATION": str(self.config.machine_id), "STATION": str(self.config.machine_id),
@ -825,7 +827,8 @@ class Test(Widget):
barcode_format = self.print_step.spec.get("barcode", "-") barcode_format = self.print_step.spec.get("barcode", "-")
self.printed_barcode = barcode_format.format_map(context) 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): for n in range(5):

View File

@ -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.setVisible("show_instructions" in self.parent.config["hardware_config"].keys())
self.show_instruction_b.clicked.connect(self.show_instruction) 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): def show_instruction(self):
dialog=Dialog() dialog=Dialog()