1234567891011121314151617181920212223242526272829303132333435363738 |
- import datetime
- from unitls.LogerinTxt import app_logger
- from .flightDB import flightDB
- def get_dic(database:flightDB, data):
- try:
- fdb = database
- IDS=fdb.getSingledata("工号",'workerinfo')
- IDSNOW=[]
- try:
- for myrow in data:
- mydics0 = myrow["0"]
- mydics1 = myrow["1"]
- #a= fdb.getSingledata("工号",'workerinfo')
- if str(mydics0["工号"]) in str(IDS) or str(mydics0["工号"]) in IDSNOW:
- fdb.lazyUpdateItem('workerinfo',mydics1,"工号='%s'"%mydics0["工号"])
- else:
- fdb.lazyInsertData('workerinfo',mydics0)
- IDSNOW.append(mydics0["工号"])
- #print(1)
- fdb.FunctionCommit()
- return "ok"
- except Exception as e:
- print(datetime.datetime.now(),'[数据库操作]数据库获取错误!!检查通讯录文件!人员显示功能失效!!')
- print(e)
- app_logger.log_error(e)
- # 需要QT输出警告弹框信息
- fdb.FunctionCommit()
- return "fail"
- except Exception as e:
- app_logger.log_error(e)
- return "fail"
|