cut description
This commit is contained in:
+1
-1
@@ -1 +1 @@
|
|||||||
,pc-sviluppo1,pcsviluppo1,12.12.2024 11:09,file:///home/pc-sviluppo1/.config/libreoffice/4;
|
,pc-sviluppo1,pcsviluppo1,12.12.2024 11:32,file:///home/pc-sviluppo1/.config/libreoffice/4;
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -13,15 +13,17 @@ data_fine = datetime.datetime.strptime(data_str, "%Y-%m-%d").date()
|
|||||||
tla = 1
|
tla = 1
|
||||||
|
|
||||||
value_insert = []
|
value_insert = []
|
||||||
def insert_records(connection,codice,descrizione,um,prezzo,sc1,sc2,ricarica,listino,codice_alternativo,codice_barre,art,tsa_codice,frn):
|
def insert_records(connection,codice,descrizione,descrizione2,um,prezzo,sc1,sc2,ricarica,listino,codice_alternativo,codice_barre,art,tsa_codice,frn):
|
||||||
try:
|
try:
|
||||||
|
|
||||||
|
print(frn)
|
||||||
|
print(tsa_codice)
|
||||||
cursor_select = connection.cursor()
|
cursor_select = connection.cursor()
|
||||||
result = []
|
result = []
|
||||||
cursor = connection.cursor()
|
cursor = connection.cursor()
|
||||||
if art == False:
|
if art == False:
|
||||||
query_art = "INSERT INTO art (codice, DESCRIZIONE1, TUM_CODICE, codice_alternativo, TSA_CODICE, TUB_CODICE, TCM_CODICE, TGM_CODICE, TIV_CODICE_VENDITE, TIV_CODICE_ACQUISTI, TCA_CODICE, TAQ_CODICE, TS3_CODICE, TP2_CODICE, TIN_CODICE, TAA_CODICE, TNI_CODICE,FRN_CODICE) VALUES (%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s)"
|
query_art = "INSERT INTO art (codice, DESCRIZIONE1,DESCRIZIONE2, TUM_CODICE, codice_alternativo, TSA_CODICE, TUB_CODICE, TCM_CODICE, TGM_CODICE, TIV_CODICE_VENDITE, TIV_CODICE_ACQUISTI, TCA_CODICE, TAQ_CODICE, TS3_CODICE, TP2_CODICE, TIN_CODICE, TAA_CODICE, TNI_CODICE,FRN_CODICE) VALUES (%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s)"
|
||||||
cursor.execute(query_art,(codice, descrizione, um, codice_alternativo, tsa_codice,'0','0','0','22','22','0','0','0','0','0','0','0',frn))
|
cursor.execute(query_art,(codice, descrizione,descrizione2,um, codice_alternativo, tsa_codice,'0','0','0','22','22','0','0','0','0','0','0','0',frn))
|
||||||
|
|
||||||
count = cursor.rowcount
|
count = cursor.rowcount
|
||||||
result.append(count)
|
result.append(count)
|
||||||
|
|||||||
@@ -73,12 +73,21 @@ for index, row in df.iterrows():
|
|||||||
|
|
||||||
|
|
||||||
if math.isnan(row['GRUPPO STATISTICO']):
|
if math.isnan(row['GRUPPO STATISTICO']):
|
||||||
tsa_codice = row['TSA_CODICE']
|
tsa_codice = row['GRUPPO STATISTICO']
|
||||||
else:
|
else:
|
||||||
tsa_codice = int(row['TSA_CODICE'])
|
tsa_codice = int(row['GRUPPO STATISTICO'])
|
||||||
|
|
||||||
frn = row['FORNITORE']
|
frn = str(row['FORNITORE'])
|
||||||
|
|
||||||
|
descrizione2 = ' '
|
||||||
|
## se decrizione supera 40
|
||||||
|
len_descrizione = len(descrizione)
|
||||||
|
if len_descrizione > 40 :
|
||||||
|
descrizione1 = descrizione [: 40]
|
||||||
|
print(descrizione1)
|
||||||
|
descrizione2 = descrizione [40 :]
|
||||||
|
print(descrizione2)
|
||||||
|
descrizione = descrizione1
|
||||||
|
|
||||||
if conn :
|
if conn :
|
||||||
if ricarica1 is not None and not math.isnan(ricarica1):
|
if ricarica1 is not None and not math.isnan(ricarica1):
|
||||||
@@ -122,7 +131,7 @@ for index, row in df.iterrows():
|
|||||||
if not pd.isna(frn):
|
if not pd.isna(frn):
|
||||||
frn = ' '
|
frn = ' '
|
||||||
|
|
||||||
value_insert = insert_records(conn,codice,descrizione,um,prezzo,sc1,sc2,ricarica,listino,codice_alternativo,codice_barre,art,tsa_codice,frn)
|
value_insert = insert_records(conn,codice,descrizione,descrizione2,um,prezzo,sc1,sc2,ricarica,listino,codice_alternativo,codice_barre,art,tsa_codice,frn)
|
||||||
write_excel_insert(value_insert)
|
write_excel_insert(value_insert)
|
||||||
|
|
||||||
if conn :
|
if conn :
|
||||||
|
|||||||
Reference in New Issue
Block a user