from .flightDB import flightDB from unitls.LogerinTxt import app_logger from unitls.StaticDataclass import get_dic def update_Pglist(database:flightDB,datatime: str,bc:str,jsonData): try: nowDayStr = datatime newdic={} database.deleteSingledata("pglist{}".format(nowDayStr), "班次='%s'" % bc) names=[] pglistLabel2en=get_dic('pglistLabel2en') pglistLabel=get_dic('pglistLabel') for row in jsonData: if "SHIFT" in row.keys() and row["SHIFT"] == bc and row["NAME"] not in names: for col in row: if col in pglistLabel2en.keys(): newdic[pglistLabel2en[col]]=row[col] for col in pglistLabel: if col not in newdic.keys(): newdic[col] = '' database.lazyInsertData("pglist{}".format(nowDayStr),newdic) names = row["NAME"] database.FunctionCommit() except Exception as e: database.FunctionCommit() app_logger.log_error(e)