mapDispaly.py 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. from .flightDB import flightDB
  2. from unitls.LogerinTxt import app_logger
  3. import unitls.baseFunction as baseFunction
  4. from unitls.StaticDataclass import get_dic
  5. def mapDispaly(fdb:flightDB,selectedtime):
  6. try:
  7. mapDispalydata = {}
  8. nowDayStr = selectedtime
  9. sortdatas= fdb.queryTabel('sortFlight{}'.format(nowDayStr), '*', "航班编号!=''")
  10. sorttable= baseFunction.TuplefindInList2(sortdatas,"1","3",5)
  11. #sorttable1 = fdb.queryTabel("sortFlight{}".format(nowDayStr),"*","CAST(级别 AS integer)='1' or CAST(级别 AS integer)='3'")
  12. #{机位:[机号,机型,发动机,航班类型,航班号,ta,td,进港机场,出港机场,状态,放行,维修人员,二送人员,保留,工作包,TASKID,flightid,color,备注]}
  13. datas = fdb.queryTabel('TaskFlightinfo{}'.format(nowDayStr), '*', "航班编号!=''")
  14. for row in sorttable:
  15. # print(row)
  16. otheroneSts = []
  17. flightinfodata = baseFunction.TuplefindInList1(datas, row[1],0)[0]
  18. if flightinfodata[3] == "TR":
  19. iddd=row[1]+"-1"
  20. iddddd = row[1] + "-2"
  21. jfjSts=baseFunction.TuplefindInList3(sortdatas,iddd,0,5)
  22. sfjSts = baseFunction.TuplefindInList3(sortdatas, iddddd, 0, 5)
  23. #jfjSts= fdb.queryTabel("sortFlight{}".format(nowDayStr),"级别","编号='%s'"%iddd)[0][0]
  24. #sfjSts = fdb.queryTabel("sortFlight{}".format(nowDayStr), "级别", "编号='%s'" % iddddd)[0][0]
  25. # print(otheroneSts)
  26. if (flightinfodata[3] =="AP" and flightinfodata[11] !="") or (flightinfodata[3] !="AP" and flightinfodata[10] !=""):
  27. if flightinfodata[3] == "AP" and flightinfodata[11] != "":
  28. bay=flightinfodata[11]
  29. color="#99CCCC"
  30. elif flightinfodata[3] == "AF" and flightinfodata[10] != "" and row[5]=="3":
  31. bay = flightinfodata[10]
  32. color = "#0095d9"
  33. elif flightinfodata[3] == "停场" and flightinfodata[10] != "" and row[5]=="3":
  34. bay = flightinfodata[10]
  35. color = "#0095d9"
  36. elif flightinfodata[3] == "AF" and flightinfodata[10] != "" and row[5]=="1":
  37. bay = "Y"+flightinfodata[10]
  38. color = "#f6ad49"
  39. elif flightinfodata[3] == "TAF" and flightinfodata[10] != "" and flightinfodata[6] == "":
  40. bay = "Y"+flightinfodata[10]
  41. color = "#f6ad49"
  42. elif flightinfodata[3] == "TAF" and flightinfodata[10] != "" and flightinfodata[6] != "":
  43. bay = flightinfodata[10]
  44. color = "#4c6cb3"
  45. elif flightinfodata[3] == "TR" and flightinfodata[10] != "" and jfjSts=="1":
  46. bay = "Y"+flightinfodata[10]
  47. color = "#f6ad49"
  48. elif flightinfodata[3] == "TR" and flightinfodata[10] != "" and jfjSts=="4" and sfjSts=="1":
  49. bay = flightinfodata[10]
  50. color = "#69b076"
  51. acno=flightinfodata[1]
  52. airpalneType=flightinfodata[26]
  53. EngType=flightinfodata[25]
  54. flightType = get_dic('taskType')[flightinfodata[3]]
  55. flightNos = flightinfodata[21]
  56. DEP_CH=flightinfodata[23].split("</br>")[0] #进港机场
  57. DEP_CH1=flightinfodata[23].split("</br>")[1] #出港机场
  58. flightsts = ""#flightinfodata[10]TASKINFO没有这个节点
  59. wx=flightinfodata[12]
  60. fx = flightinfodata[13]
  61. es = flightinfodata[19]
  62. flightid=flightinfodata[0]
  63. message=""#flightinfodata[32]
  64. e = "" #保留
  65. F = ""#工作包
  66. g = "" #taskid
  67. ta = ""
  68. td=""
  69. if flightinfodata[16] != "":
  70. e = "有保留"
  71. if flightinfodata[18] != "":
  72. F = "有工作包"
  73. if flightinfodata[0] != "":
  74. g = flightinfodata[0]
  75. if "-" not in flightinfodata[9].split('</br>')[0]:
  76. ta = flightinfodata[9].split('</br>')[0]
  77. if "-" not in flightinfodata[9].split('</br>')[1]:
  78. td = flightinfodata[9].split('</br>')[1]
  79. if "CZ" in str(flightNos) or "OQ" in str(flightNos):
  80. nanhang="1"
  81. elif "3U" not in str(flightNos) or "CSC" not in str(flightNos):
  82. nanhang = "0"
  83. else:
  84. nanhang = "3"
  85. try:
  86. mapDispalydata[bay] = {"机号":acno,
  87. "机型":airpalneType,
  88. "发动机":EngType,
  89. "航班类型":flightType,
  90. "航班号":flightNos,
  91. "到达":ta,
  92. "起飞":td,
  93. "进港机场":DEP_CH,
  94. "出港机场":DEP_CH1,
  95. "状态":flightsts,
  96. "放行":fx,
  97. "维修人员":wx,
  98. "二送人员":es,
  99. "保留":e,
  100. "工作包":F,
  101. "TASKID":g,
  102. "flightid":flightid,
  103. "color":color,
  104. "备注":message,
  105. "南航":nanhang
  106. }
  107. except Exception as e:
  108. app_logger.log_error(e)
  109. pass
  110. return mapDispalydata
  111. except Exception as e:
  112. app_logger.log_error(e)