Skip to content
Snippets Groups Projects
Commit fbc797c2 authored by TERRU Theo's avatar TERRU Theo
Browse files

Lien entre sql et machine

parent 800f51c3
Branches
No related tags found
No related merge requests found
......@@ -194,6 +194,7 @@ class BLE_MACHINE_SEND_ORDER(RxCharacteristic):
data = unformalize_data_list(format(bytearray(value).decode()))
commande = mysql_get_composition_for_machine(data)
print(commande)
prepare_commande(commande)
def main():
global mainloop
......
......@@ -96,7 +96,9 @@ def mysql_get_composition_for_machine(commande: tuple):
cursor = connection.cursor()
for k in commande:
cursor.execute("SELECT machine.id_bec FROM ingredient INNER JOIN machine ON ingredient.id_bec = machine.id_bec WHERE ingredient.id_ingredient = %s", (k[1],))
bec=cursor.fetchone()[0]
data_requete = cursor.fetchall()
if len(data_requete)>0:
bec=data_requete[0][0]
data.append((bec, int(k[2])))
cursor.close()
connection.close()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment