This commit is contained in:
2025-05-01 00:58:07 +02:00
parent cc7a136cf3
commit fd5429ee0d
23 changed files with 190 additions and 57 deletions

View File

@@ -0,0 +1,3 @@
def chi_sono(unit, tool):
print(f'{__name__}: {unit} - {tool}')
return f'{__name__}: {unit} - {tool}'

3
utils/parsers/d2w_d2w.py Normal file
View File

@@ -0,0 +1,3 @@
def chi_sono(unit, tool):
print(f'{__name__}: {unit} - {tool}')
return f'{__name__}: {unit} - {tool}'

View File

@@ -0,0 +1,28 @@
#!.venv/bin/python
from utils.database.connection import connetti_db
import utils.timestamp.date_check as date_check
import logging
logger = logging.getLogger(__name__)
def get_data(cfg, id):
with connetti_db(cfg) as conn:
cur = conn.cursor()
cur.execute(f'select unit_name, tool_name, tool_data from {cfg.dbname}.{cfg.dbrectable} where id = {id}')
unit_name, tool_name, tool_data = cur.fetchone()
cur.close()
conn.close()
return unit_name, tool_name, tool_data
def make_matrix(cfg, id):
UnitName, ToolNameID, ToolData = get_data(cfg, id)
righe = ToolData.splitlines()
matrice_valori = []
for riga in [riga for riga in righe if ';|;' in riga]:
timestamp, batlevel, temperature, rilevazioni = riga.split(';',3)
EventDate, EventTime = timestamp.split(' ')
valori_nodi = rilevazioni.lstrip('|;').rstrip(';').split(';|;') # Toglie '|;' iniziali, toglie eventuali ';' finali, dividi per ';|;'
for num_nodo, valori_nodo in enumerate(valori_nodi, start=1):
valori = valori_nodo.split(';')
matrice_valori.append([UnitName, ToolNameID, num_nodo, date_check.conforma_data(EventDate), EventTime, batlevel, temperature] + valori + ([None] * (19 - len(valori))))
return matrice_valori

View File

@@ -0,0 +1,3 @@
def chi_sono(unit, tool):
print(f'{__name__}: {unit} - {tool}')
return f'{__name__}: {unit} - {tool}'

View File

@@ -0,0 +1,3 @@
def chi_sono(unit, tool):
print(f'{__name__}: {unit} - {tool}')
return f'{__name__}: {unit} - {tool}'

View File

@@ -0,0 +1,3 @@
def chi_sono(unit, tool):
print(f'{__name__}: {unit} - {tool}')
return f'{__name__}: {unit} - {tool}'

View File

@@ -0,0 +1,5 @@
import time
def chi_sono(unit, tool):
print(f'{__name__}: {unit} - {tool}')
time.sleep(20)
return f'{__name__}: {unit} - {tool}'

View File

@@ -1,3 +1,10 @@
def chi_sono(unit, tool):
print(f'g801_mums: {unit} - {tool}')
return f'g801_mums: {unit} - {tool}'
#!.venv/bin/python
from utils.database.loader import load_data
from utils.parsers.data_preparation import make_matrix
import logging
logger = logging.getLogger(__name__)
def main_loader(cfg, id):
matrice_valori = make_matrix(cfg, id)
load_data(cfg, matrice_valori)

View File

@@ -0,0 +1,5 @@
import time
def chi_sono(unit, tool):
print(f'{__name__}: {unit} - {tool}')
time.sleep(20)
return f'{__name__}: {unit} - {tool}'

View File

@@ -1,3 +1,5 @@
import time
def chi_sono(unit, tool):
print(f'g801_mux: {unit} - {tool}')
return f'g801_mux: {unit} - {tool}'
print(f'{__name__}: {unit} - {tool}')
time.sleep(20)
return f'{__name__}: {unit} - {tool}'

View File

@@ -0,0 +1,5 @@
import time
def chi_sono(unit, tool):
print(f'{__name__}: {unit} - {tool}')
time.sleep(20)
return f'{__name__}: {unit} - {tool}'

5
utils/parsers/g802_gd.py Normal file
View File

@@ -0,0 +1,5 @@
import time
def chi_sono(unit, tool):
print(f'{__name__}: {unit} - {tool}')
time.sleep(20)
return f'{__name__}: {unit} - {tool}'

View File

@@ -0,0 +1,5 @@
import time
def chi_sono(unit, tool):
print(f'{__name__}: {unit} - {tool}')
time.sleep(20)
return f'{__name__}: {unit} - {tool}'

View File

@@ -0,0 +1,5 @@
import time
def chi_sono(unit, tool):
print(f'{__name__}: {unit} - {tool}')
time.sleep(20)
return f'{__name__}: {unit} - {tool}'

View File

@@ -0,0 +1,5 @@
import time
def chi_sono(unit, tool):
print(f'{__name__}: {unit} - {tool}')
time.sleep(20)
return f'{__name__}: {unit} - {tool}'

View File

@@ -0,0 +1,5 @@
import time
def chi_sono(unit, tool):
print(f'{__name__}: {unit} - {tool}')
time.sleep(20)
return f'{__name__}: {unit} - {tool}'

5
utils/parsers/gs1_gs1.py Normal file
View File

@@ -0,0 +1,5 @@
import time
def chi_sono(unit, tool):
print(f'{__name__}: {unit} - {tool}')
time.sleep(20)
return f'{__name__}: {unit} - {tool}'

5
utils/parsers/tlp_loc.py Normal file
View File

@@ -0,0 +1,5 @@
import time
def chi_sono(unit, tool):
print(f'{__name__}: {unit} - {tool}')
time.sleep(20)
return f'{__name__}: {unit} - {tool}'

5
utils/parsers/tlp_tlp.py Normal file
View File

@@ -0,0 +1,5 @@
import time
def chi_sono(unit, tool):
print(f'{__name__}: {unit} - {tool}')
time.sleep(20)
return f'{__name__}: {unit} - {tool}'