Z230
This commit is contained in:
@@ -1,17 +1,25 @@
|
||||
import os,shutil,fdb,time
|
||||
import re,datetime,funkce
|
||||
from FunkceWhereIsDropbox import get_dropbox_path,get_medicus_connection
|
||||
|
||||
# Connect to the Firebird database
|
||||
conn = fdb.connect(
|
||||
dsn=r'localhost:u:\medicus 3\data\medicus.fdb', # Database path
|
||||
user='SYSDBA', # Username
|
||||
password="masterkey", # Password,
|
||||
charset="win1250")
|
||||
conn = get_medicus_connection()
|
||||
|
||||
# cesta=r"u:\Dropbox\!!!Days\Downloads Z230\Dokumentace"
|
||||
cesta=r"u:\NextcloudOrdinace\Dokumentace_ke_zpracování"
|
||||
# cestazpracovana=r"u:\Dropbox\!!!Days\Downloads Z230\Dokument"
|
||||
cestazpracovana=r"z:\NextcloudOrdinace\Dokumentace_zpracovaná"
|
||||
#Get cesta to Dropbox on working computer
|
||||
dropbox=get_dropbox_path()
|
||||
# Convert to Windows-style strings (backslashes)
|
||||
cesta = (dropbox / "Ordinace" / "Dokumentace_ke_zpracování").resolve().as_posix().replace('/', '\\')
|
||||
cestazpracovana = (dropbox / "Ordinace" / "Dokumentace_zpracovaná").resolve().as_posix().replace('/', '\\')
|
||||
|
||||
|
||||
print(conn)
|
||||
print(dropbox)
|
||||
print(cesta)
|
||||
print(cestazpracovana)
|
||||
# exit(0)
|
||||
# cesta=r"u:\NextcloudOrdinace\Dokumentace_ke_zpracování"
|
||||
# # cestazpracovana=r"u:\Dropbox\!!!Days\Downloads Z230\Dokument"
|
||||
# cestazpracovana=r"z:\NextcloudOrdinace\Dokumentace_zpracovaná"
|
||||
|
||||
|
||||
def restore_files_for_import(retezec):
|
||||
@@ -169,13 +177,14 @@ BOOKMARKSTEXT
|
||||
pacid=row[1]
|
||||
filename=row[6]
|
||||
|
||||
|
||||
Problem_s_ulozenim=True
|
||||
for attempt in range(3):
|
||||
try:
|
||||
# Replace this with the command that might raise an error
|
||||
if not os.path.exists(os.path.join(cestazpracovana,row[6])):
|
||||
shutil.move(os.path.join(cesta,row[6]), os.path.join(cestazpracovana,row[6]))
|
||||
print("Command succeeded!")
|
||||
Problem_s_ulozenim = False
|
||||
break # Exit the loop if the command succeeds
|
||||
else:
|
||||
now = datetime.datetime.now()
|
||||
@@ -183,6 +192,7 @@ BOOKMARKSTEXT
|
||||
print(os.path.join(cestazpracovana,row[6][:-4]+" "+datetime_string+".pdf"))
|
||||
shutil.move(os.path.join(cesta,row[6]),os.path.join(cestazpracovana,row[6][:-4]+" "+datetime_string+".pdf"))
|
||||
print("Command succeeded!")
|
||||
Problem_s_ulozenim = False
|
||||
break # Exit the loop if the command succeeds
|
||||
except Exception as e:
|
||||
print(f"Attempt {attempt + 1} failed: {e}")
|
||||
@@ -195,10 +205,11 @@ BOOKMARKSTEXT
|
||||
|
||||
if Problem_s_ulozenim:
|
||||
print("Problem s ulozenim",row[6])
|
||||
exit(0)
|
||||
break
|
||||
|
||||
fileid=funkce.zapis_file(vstupconnection=conn, idpac=row[1],
|
||||
cesta=cesta, souborname=row[6], prvnizavorka=row[4],
|
||||
cesta=cestazpracovana, souborname=row[6], prvnizavorka=row[4],
|
||||
soubordate=row[2], souborfiledate=row[7], poznamka=row[5])
|
||||
|
||||
filename=funkce.convert_to1250(filename)
|
||||
|
||||
Reference in New Issue
Block a user