updateEidteItem.py 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839
  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. nowDay = datetime.datetime.now().strftime("%Y%m%d")
  17. flightids_in_peopleSchedule=fdb.getSingledata("编号","peopleSchedule{}".format(selectedtime))
  18. newdic = {}
  19. if str(flightid_new) not in str(flightids_in_peopleSchedule):
  20. newdic={"编号":flightid_new,"航班编号":flightid,"显示模式":displayMode}
  21. for i in rowlistLabel.keys():
  22. if i == -1:
  23. if text !="清空项目12345678987654321":
  24. newdic[rowlistLabel[i]]=text
  25. else:
  26. newdic[rowlistLabel[i]] = ""
  27. else:
  28. newdic[rowlistLabel[i]] = ""
  29. fdb.insertData("peopleSchedule{}".format(selectedtime),newdic)
  30. else:
  31. if text != "清空项目12345678987654321":
  32. newdic[rowlistLabel[int(-1)]]="'%s'"%text
  33. else:
  34. newdic[rowlistLabel[int(-1)]]="''"
  35. fdb.upDateItem("peopleSchedule{}".format(selectedtime),newdic,"编号='%s'"%flightid_new)
  36. except Exception as e:
  37. app_logger.log_error(e)