updateEidteItem.py 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. from unitls.LogerinTxt import app_logger
  2. from unitls.StaticDataclass import get_dic
  3. from .flightDB import flightDB
  4. def updateEidteItem(fdb:flightDB,text,flightid,displayMode,flighttype,selectedtime):
  5. try:
  6. rowlistLabel = get_dic('rowlistLabel')
  7. if displayMode =="A":
  8. if flighttype =="短停接" or flighttype =="航后" or flighttype =="特后前接" or flighttype =="停场":
  9. flightid_new=flightid+"-1"+"-A"
  10. elif flighttype =="短停送" or flighttype =="航前" or flighttype =="特后前送":
  11. flightid_new = flightid + "-2" + "-A"
  12. elif displayMode =="B":
  13. if flighttype =="短停" or flighttype =="航后" or flighttype =="特后前" or flighttype =="停场":
  14. flightid_new=flightid+"-1"+"-B"
  15. flightids_in_peopleSchedule=fdb.getSingledata("编号","peopleSchedule{}".format(selectedtime))
  16. newdic = {}
  17. if str(flightid_new) not in str(flightids_in_peopleSchedule):
  18. newdic={"编号":flightid_new,"航班编号":flightid,"显示模式":displayMode}
  19. for i in rowlistLabel.keys():
  20. if i == -1:
  21. if text !="清空项目12345678987654321":
  22. newdic[rowlistLabel[i]]=text
  23. else:
  24. newdic[rowlistLabel[i]] = ""
  25. else:
  26. newdic[rowlistLabel[i]] = ""
  27. fdb.insertData("peopleSchedule{}".format(selectedtime),newdic)
  28. else:
  29. if text != "清空项目12345678987654321":
  30. newdic[rowlistLabel[int(-1)]]="'%s'"%text
  31. else:
  32. newdic[rowlistLabel[int(-1)]]="''"
  33. fdb.upDateItem("peopleSchedule{}".format(selectedtime),newdic,"编号='%s'"%flightid_new)
  34. except Exception as e:
  35. app_logger.log_error(e)