FEAT: Add an update query for updating the current station and status in the card if the logs is inserted successfully
This commit is contained in:
parent
0e1d2053a9
commit
13b0a47974
@ -61,7 +61,7 @@ def main_loop():
|
|||||||
global cursor
|
global cursor
|
||||||
if cursor:
|
if cursor:
|
||||||
# Get all files in the source directory
|
# Get all files in the source directory
|
||||||
files = glob.glob(SOURCE_DIR + '*.txt')
|
files = glob.glob(SOURCE_DIR + '**/*.txt', recursive=True)
|
||||||
if files:
|
if files:
|
||||||
for file in files:
|
for file in files:
|
||||||
http_lines, enddate = extract_data_from_file(file)
|
http_lines, enddate = extract_data_from_file(file)
|
||||||
@ -100,7 +100,12 @@ def main_loop():
|
|||||||
|
|
||||||
# Insert data into the database
|
# Insert data into the database
|
||||||
insert_logpass = "INSERT INTO dbo.log_pass (account, cardno, line, sequence, station, machine, status, lastupdate, lastupdatedby) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)"
|
insert_logpass = "INSERT INTO dbo.log_pass (account, cardno, line, sequence, station, machine, status, lastupdate, lastupdatedby) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)"
|
||||||
|
|
||||||
cursor.execute(insert_logpass, ('G5', cardno + '_1', '', '', stage, machine, database_status, log_pass_lastupdate, 'cats'))
|
cursor.execute(insert_logpass, ('G5', cardno + '_1', '', '', stage, machine, database_status, log_pass_lastupdate, 'cats'))
|
||||||
|
|
||||||
|
update_card = "UPDATE dbo.card SET curtstation = ?, status = ? WHERE cardno = ?"
|
||||||
|
cursor.execute(update_card, (stage, database_status, cardno + '_1'))
|
||||||
|
|
||||||
conn.commit()
|
conn.commit()
|
||||||
print('History inserted successfully')
|
print('History inserted successfully')
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user