This commit is contained in:
2025-09-22 22:48:55 +02:00
parent fb2b2724ed
commit f9b07795fd
5 changed files with 13 additions and 10 deletions

View File

@@ -49,20 +49,20 @@ class Config:
self.dbnodes = c.get("tables", "nodesTableName") self.dbnodes = c.get("tables", "nodesTableName")
# unit setting # unit setting
self.units_name = [part for part in c.get("unit", "Names").split("|")] self.units_name = list(c.get("unit", "Names").split("|"))
self.units_type = [part for part in c.get("unit", "Types").split("|")] self.units_type = list(c.get("unit", "Types").split("|"))
self.units_alias = {key: value for item in c.get("unit", "Alias").split("|") for key, value in [item.split(":", 1)]} self.units_alias = {key: value for item in c.get("unit", "Alias").split("|") for key, value in [item.split(":", 1)]}
# self.units_header = {key: int(value) for pair in c.get("unit", "Headers").split('|') for key, value in [pair.split(':')]} # self.units_header = {key: int(value) for pair in c.get("unit", "Headers").split('|') for key, value in [pair.split(':')]}
# tool setting # tool setting
self.tools_name = [part for part in c.get("tool", "Names").split("|")] self.tools_name = list(c.get("tool", "Names").split("|"))
self.tools_type = [part for part in c.get("tool", "Types").split("|")] self.tools_type = list(c.get("tool", "Types").split("|"))
self.tools_alias = { self.tools_alias = {
key: key if value == "=" else value for item in c.get("tool", "Alias").split("|") for key, value in [item.split(":", 1)] key: key if value == "=" else value for item in c.get("tool", "Alias").split("|") for key, value in [item.split(":", 1)]
} }
# csv info # csv info
self.csv_infos = [part for part in c.get("csv", "Infos").split("|")] self.csv_infos = list(c.get("csv", "Infos").split("|"))
# TS pini path match # TS pini path match
self.ts_pini_path_match = { self.ts_pini_path_match = {

View File

@@ -37,7 +37,7 @@ class Config:
self.dbnodes = c.get("tables", "nodesTableName") self.dbnodes = c.get("tables", "nodesTableName")
# Tool # Tool
self.elab_status = [part for part in c.get("tool", "elab_status").split("|")] self.elab_status = list(c.get("tool", "elab_status").split("|"))
# Matlab # Matlab
self.matlab_runtime = c.get("matlab", "runtime") self.matlab_runtime = c.get("matlab", "runtime")

View File

@@ -42,7 +42,8 @@ def on_file_received(self: object, file: str) -> None:
tool_type = extract_value(cfg.tools_type, filename, str(lines[0:10])) tool_type = extract_value(cfg.tools_type, filename, str(lines[0:10]))
tool_info = "{}" tool_info = "{}"
# se esiste l'alias in alias_unit_type, allora prende il valore dell'alias... verifica sia lo unit_type completo che i primi 3 caratteri per CO_xxxxx # se esiste l'alias in alias_unit_type, allora prende il valore dell'alias
# verifica sia lo unit_type completo che i primi 3 caratteri per CO_xxxxx
upper_unit_type = unit_type.upper() upper_unit_type = unit_type.upper()
unit_type = cfg.units_alias.get(upper_unit_type) or cfg.units_alias.get(upper_unit_type[:3]) or upper_unit_type unit_type = cfg.units_alias.get(upper_unit_type) or cfg.units_alias.get(upper_unit_type[:3]) or upper_unit_type
upper_tool_type = tool_type.upper() upper_tool_type = tool_type.upper()
@@ -75,7 +76,9 @@ def on_file_received(self: object, file: str) -> None:
try: try:
cur.execute( cur.execute(
f"INSERT INTO {cfg.dbname}.{cfg.dbrectable} (username, filename, unit_name, unit_type, tool_name, tool_type, tool_data, tool_info) VALUES (%s,%s, %s, %s, %s, %s, %s, %s)", f"""INSERT INTO {cfg.dbname}.{cfg.dbrectable}
(username, filename, unit_name, unit_type, tool_name, tool_type, tool_data, tool_info)
VALUES (%s,%s, %s, %s, %s, %s, %s, %s)""",
( (
self.username, self.username,
new_filename, new_filename,

View File

@@ -47,7 +47,6 @@ class FTPConnection:
async def ftp_send_raw_csv_to_customer(cfg: dict, id: int, unit: str, tool: str, pool: object) -> bool: async def ftp_send_raw_csv_to_customer(cfg: dict, id: int, unit: str, tool: str, pool: object) -> bool:
None
return True return True

View File

@@ -46,7 +46,8 @@ def ftp_SITE_ADDU(self: object, line: str) -> None:
# Create a cursor # Create a cursor
cur = conn.cursor() cur = conn.cursor()
cur.execute( cur.execute(
f"INSERT INTO {cfg.dbname}.{cfg.dbusertable} (ftpuser, hash, virtpath, perm) VALUES ('{user}', '{hash}', '{cfg.virtpath + user}', '{cfg.defperm}')" f"""INSERT INTO {cfg.dbname}.{cfg.dbusertable} (ftpuser, hash, virtpath, perm)
VALUES ('{user}', '{hash}', '{cfg.virtpath + user}', '{cfg.defperm}')"""
) )
conn.commit() conn.commit()
conn.close() conn.close()