Fix codice a barre + fix fornitore + fix codice alternativo
This commit is contained in:
34
main.py
34
main.py
@ -1,19 +1,13 @@
|
||||
import pandas as pd
|
||||
import mysql.connector
|
||||
import math
|
||||
import xlsxwriter
|
||||
import tkinter as tk
|
||||
from tkinter import filedialog,messagebox
|
||||
from datetime import datetime
|
||||
from mysql.connector import Error
|
||||
from connection import create_connection
|
||||
from connection import close_connection
|
||||
from search import search_article
|
||||
from update import update_records
|
||||
from insert import insert_records
|
||||
from write import write_excel
|
||||
from write_excel_insert import write_excel_insert
|
||||
from upload import upload_excel
|
||||
from utils.connection import create_connection
|
||||
from utils.connection import close_connection
|
||||
from utils.search import search_article
|
||||
from utils.update import update_records
|
||||
from utils.insert import insert_records
|
||||
from utils.write import write_excel
|
||||
from utils.write_excel_insert import write_excel_insert
|
||||
from utils.upload import upload_excel
|
||||
|
||||
|
||||
host = "62.86.98.170"
|
||||
@ -26,7 +20,7 @@ port = 3307
|
||||
conn = create_connection(host, user, password, database, port)
|
||||
#leggo il file excel
|
||||
file_input = upload_excel()
|
||||
df = pd.read_excel(file_input, usecols='A:O')
|
||||
df = pd.read_excel(file_input, usecols='A:O', dtype={'FORNITORE': str, 'CODICE ALTERNATIVO': str})
|
||||
|
||||
#leggo le colonne del file excel
|
||||
for index, row in df.iterrows():
|
||||
@ -84,9 +78,9 @@ for index, row in df.iterrows():
|
||||
len_descrizione = len(descrizione)
|
||||
if len_descrizione > 40 :
|
||||
descrizione1 = descrizione [: 40]
|
||||
print(descrizione1)
|
||||
#print(descrizione1)
|
||||
descrizione2 = descrizione [40 :]
|
||||
print(descrizione2)
|
||||
#print(descrizione2)
|
||||
descrizione = descrizione1
|
||||
|
||||
if conn :
|
||||
@ -122,13 +116,13 @@ for index, row in df.iterrows():
|
||||
sc2 = ' '
|
||||
if math.isnan(ricarica):
|
||||
ricarica = ' '
|
||||
if not pd.isna(codice_alternativo):
|
||||
if pd.isna(codice_alternativo):
|
||||
codice_alternativo = ' '
|
||||
if not pd.isna(codice_barre):
|
||||
if pd.isna(codice_barre):
|
||||
codice_barre = '0000000000000'
|
||||
if math.isnan(tsa_codice):
|
||||
tsa_codice = '0'
|
||||
if not pd.isna(frn):
|
||||
if pd.isna(frn):
|
||||
frn = ' '
|
||||
|
||||
value_insert = insert_records(conn,codice,descrizione,descrizione2,um,prezzo,sc1,sc2,ricarica,listino,codice_alternativo,codice_barre,art,tsa_codice,frn)
|
||||
|
||||
Reference in New Issue
Block a user