update
This commit is contained in:
parent
dd7cb95502
commit
c91d44438e
|
@ -43,7 +43,7 @@ Sub test_full20()
|
|||
login.Show
|
||||
If Not login.proceed Then Exit Sub
|
||||
|
||||
If Not x.ADOp_OpenCon(0, PostgreSQLODBC, "10.56.60.254", False, login.tbU.text, login.tbP.text, "Port=5432;Database=ubm") Then
|
||||
If Not x.ADOp_OpenCon(0, PostgreSQLODBC, "usmidsap02", False, login.tbU.text, login.tbP.text, "Port=5432;Database=ubm") Then
|
||||
MsgBox ("not able to connect to CMS" & vbCrLf & x.ADOo_errstring)
|
||||
Exit Sub
|
||||
End If
|
||||
|
@ -251,7 +251,7 @@ Sub price_load_plcore()
|
|||
login.Show
|
||||
If Not login.proceed Then Exit Sub
|
||||
|
||||
If Not x.ADOp_Exec(0, sql, 1, True, PostgreSQLODBC, "10.56.60.254", False, login.tbU, login.tbP, "Port=5432;Database=ubm") Then
|
||||
If Not x.ADOp_Exec(0, sql, 1, True, PostgreSQLODBC, "usmidsap02", False, login.tbU, login.tbP, "Port=5432;Database=ubm") Then
|
||||
MsgBox (x.ADOo_errstring)
|
||||
Exit Sub
|
||||
End If
|
||||
|
@ -553,7 +553,7 @@ Sub build_price_level(plev As String)
|
|||
|
||||
'---------------------get price list------------------------------------------------------------------------
|
||||
If pricelevel.chbNURSERY Then
|
||||
pln = x.ADOp_SelectS(0, "SELECT * FROM rlarp.plcore_build_pretty('" & plev & "', '^N')", False, 2000, True, PostgreSQLODBC, "usmidsap01", False, login.tbU.text, login.tbP.text, "Port=5432;Database=ubm")
|
||||
pln = x.ADOp_SelectS(0, "SELECT * FROM rlarp.plcore_build_pretty('" & plev & "', '^N')", False, 2000, True, PostgreSQLODBC, "usmidsap02", False, login.tbU.text, login.tbP.text, "Port=5432;Database=ubm")
|
||||
If pln(0, 0) <> "Product" Then
|
||||
MsgBox (pln(0, 0))
|
||||
Exit Sub
|
||||
|
@ -567,7 +567,7 @@ Sub build_price_level(plev As String)
|
|||
End If
|
||||
|
||||
If pricelevel.chbFIBER Then
|
||||
plf = x.ADOp_SelectS(0, "SELECT * FROM rlarp.plcore_build_pretty('" & plev & "','^F')", False, 2000, True, PostgreSQLODBC, "usmidsap01", False, login.tbU.text, login.tbP.text, "Port=5432;Database=ubm")
|
||||
plf = x.ADOp_SelectS(0, "SELECT * FROM rlarp.plcore_build_pretty('" & plev & "','^F')", False, 2000, True, PostgreSQLODBC, "usmidsap02", False, login.tbU.text, login.tbP.text, "Port=5432;Database=ubm")
|
||||
If plf(0, 0) <> "Product" Then
|
||||
MsgBox (plf(0, 0))
|
||||
Exit Sub
|
||||
|
@ -584,7 +584,7 @@ Sub build_price_level(plev As String)
|
|||
End If
|
||||
End If
|
||||
|
||||
pl = x.ADOp_SelectS(0, "SELECT * FROM rlarp.plcore_build_pretty('" & plev & "','" & segment_regex & "')", False, 2000, True, PostgreSQLODBC, "usmidsap01", False, login.tbU.text, login.tbP.text, "Port=5432;Database=ubm")
|
||||
pl = x.ADOp_SelectS(0, "SELECT * FROM rlarp.plcore_build_pretty('" & plev & "','" & segment_regex & "')", False, 2000, True, PostgreSQLODBC, "usmidsap02", False, login.tbU.text, login.tbP.text, "Port=5432;Database=ubm")
|
||||
If pl(0, 0) <> "Product" Then
|
||||
MsgBox (pl(0, 0))
|
||||
Exit Sub
|
||||
|
@ -644,7 +644,7 @@ Sub build_price_level(plev As String)
|
|||
'--------------------get full code list-----------------------------
|
||||
If pricelevel.chbFULLCODE Then
|
||||
'---------------------get full code list--------------------------------------------------------------------
|
||||
fc = x.ADOp_SelectS(0, "SELECT * FROM rlarp.plcore_build_fullcode_cust('" & plev & "', '" & effdate & "'::date)", False, 20000, True, PostgreSQLODBC, "10.56.60.254", False, login.tbU.text, login.tbP.text, "Port=5432;Database=ubm")
|
||||
fc = x.ADOp_SelectS(0, "SELECT * FROM rlarp.plcore_build_fullcode_cust('" & plev & "', '" & effdate & "'::date)", False, 20000, True, PostgreSQLODBC, "usmidsap02", False, login.tbU.text, login.tbP.text, "Port=5432;Database=ubm")
|
||||
If fc(0, 0) <> "Currency" Then
|
||||
MsgBox (fc(0, 0))
|
||||
Exit Sub
|
||||
|
|
|
@ -23,7 +23,7 @@ conn = psycopg2.connect(
|
|||
cursor = conn.cursor()
|
||||
|
||||
# Execute SQL query to retrieve table data
|
||||
cursor.execute("SELECT dba, plevel FROM rlarp.cust WHERE status = 'A' AND COALESCE(plevel,'') <> '' AND plevel !~ 'XXX'")
|
||||
cursor.execute("SELECT DISTINCT dba, plevel, folder FROM rlarp.cust WHERE status = 'A' AND COALESCE(plevel,'') <> '' AND plevel !~ 'XXX'")
|
||||
# cursor.execute("SELECT dba, plevel FROM rlarp.cust WHERE status = 'A' AND plevel IN ('C.EEX','C.XEX','U.AGB.DI','U.AGB.GM','U.BGC.DI')")
|
||||
|
||||
# Fetch all rows from the result set
|
||||
|
@ -33,22 +33,23 @@ rows = cursor.fetchall()
|
|||
for row in rows:
|
||||
customer_name = row[0]
|
||||
price_level = row[1]
|
||||
folder = row[2]
|
||||
|
||||
print(customer_name)
|
||||
print(price_level)
|
||||
|
||||
# Create a directory with the customer name
|
||||
customer_directory = '/mnt/c/Users/ptrowbridge/Downloads/2023-08-16/'
|
||||
customer_directory = '/mnt/c/Users/ptrowbridge/Downloads/2023-09-13/'
|
||||
#os.makedirs(customer_directory, exist_ok=True)
|
||||
|
||||
# Copy contents from the pre-existing folder based on price level
|
||||
source_directory = '/mnt/c/Users/ptrowbridge/Downloads/2023-08-16/Levels/' + price_level
|
||||
source_directory = '/mnt/c/Users/ptrowbridge/Downloads/2023-09-13/Levels/' + price_level
|
||||
if os.path.exists(source_directory):
|
||||
for file in os.listdir(source_directory):
|
||||
# shutil.copy2(os.path.join(source_directory, file), customer_directory)
|
||||
source_file = os.path.join(source_directory, file)
|
||||
print("source file: " + source_file)
|
||||
destination_file = os.path.join(customer_directory, customer_name + " - " + file)
|
||||
destination_file = os.path.join(customer_directory, customer_name + " - " + folder + " - " + file)
|
||||
print("destination file : " + destination_file)
|
||||
shutil.copy(source_file, destination_file)
|
||||
else:
|
||||
|
|
Loading…
Reference in New Issue