updateEidteItem.py 1.8 KB

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