ferrari label wip

This commit is contained in:
neo 2024-09-11 15:52:01 +02:00
parent 6eb3c0608f
commit 8b22158d0a
5 changed files with 40 additions and 9 deletions

View File

@ -25,6 +25,6 @@
^FH\^FDLA,{PART}{SN5}{MO}{YY}^FS
^FT237,104^A0I,23,23^FH\^CI28^FD{PART}^FS^CI27
^FT237,46^A0I,23,23^FH\^CI28^FDN:{SN5}^FS^CI27
^FT237,19^A0I,23,23^FH\^CI28^FD{DD}/{MM}/{YY}^FS^CI27
^FT237,19^A0I,23,23^FH\^CI28^FD{DD}/{MO}/{YY}^FS^CI27
^PQ1,0,1,Y
^XZ

View File

@ -38,7 +38,7 @@ description_field: descrizione
[label_printer]
platform: windows
printer: zd420
printer: Zebra_Technologies_ZTC_ZD421-203dpi_ZPL
[recipes_defaults]
tester_discharge_enable: yes

View File

@ -108,7 +108,7 @@ class ArchiveSynchronizer(Component):
"recipe": record.test_data.get("recipe", {}).get("name", None),
"result": "OK" if record.result else "KO",
"serial": record.id,
"time": record.time.isoformat(),
"time": record.timenow.isoformat(),
"user": record.user.username,
}, timeout=5, verify=False)
if r.status_code != 200:
@ -132,7 +132,7 @@ class ArchiveSynchronizer(Component):
if self.gcs_bucket is None:
return False
for path in record.test_data["vision"]["0"]["files"]:
dt = record.time
dt = record.timenow
# path_in = f"{self.images_path}/{dt.strftime('%Y')}/{dt.strftime('%m')}/{os.path.basename(path)}"
path_in = path
path_out = f"{self.machine_id}/{dt.strftime('%Y')}/{dt.strftime('%m')}/{os.path.basename(path)}"

View File

@ -1,14 +1,45 @@
import time
from datetime import datetime
from PyQt5.QtWidgets import QApplication
from fiona.model import Object
from src.components.os_label_printer import *
from src.lib.helpers import ConfigReader
config={"printer":{"platform":"auto","printer":"zd421t"}}
system_id = "ST-TEN-1"
printer=Os_Label_Printer(config=config,name="printer")
config = ConfigReader(system_id=system_id)
printer=Os_Label_Printer(config=config,name="label_printer")
START_SN=1
STOP_SN=5
STOP_SN=6
timenow = datetime.now()
app = QApplication(sys.argv)
for sn in range(START_SN,STOP_SN):
print(f"PRINTING LABEL # {sn}")
context = {
# RECIPE DATA
"PART": "000825276",
# SERIAL DEFINITION
"SN": str(sn),
"SN4": f"{sn:0>4}",
"SN5": f"{sn:0>5}",
"SN6": f"{sn:0>6}",
# TIME DEFINITION
"DATETIME": timenow.strftime("%d/%m/%Y %H:%M:%S"),
"DATE": timenow.strftime("%d/%m/%Y"),
"TIME": timenow.strftime("%H:%M:%S"),
"YYYY": timenow.strftime("%Y"),
"YY": timenow.strftime("%y"),
"MO": timenow.strftime("%m"),
"DD": timenow.strftime("%d"),
"HH": timenow.strftime("%H"),
"MI": timenow.strftime("%M"),
"SS": timenow.strftime("%S"),
"JJJ": timenow.strftime("%j"),
}
printer.print_label("ferrari_30x16_203.prn",context)
time.sleep(1)

View File

@ -106,7 +106,7 @@ class Archive(Widget):
for archived in list(ArchiveDbModel.select()):
exportable = {
# "id": archived.id,
"time": archived.time,
"time": archived.timenow,
"user": archived.user,
"result": archived.result,
"overridden": archived.overridden,