updateDragDropItem.py 2.1 KB

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