tableWidgetDispaly2.py 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391
  1. from unitls.baseFunction import TuplefindInList,TuplefindInList11
  2. from .flightDB import flightDB
  3. from unitls.LogerinTxt import app_logger
  4. from .getSortFlightdata import getSortFlightdata
  5. from .waringMessageID import waringMessageID
  6. import concurrent.futures
  7. from unitls.StaticDataclass import get_dic
  8. def tableWidgetDispaly2(fdb:flightDB,selectedtime,date):#1,昨天。2今天3明天4其他
  9. try:
  10. tableWidgetDispalydata = {}
  11. sorttable = getSortFlightdata(fdb,selectedtime,"sortFlight2")
  12. nowDayStr = selectedtime
  13. TaskFlightinfoAll = fdb.getAlldata('TaskFlightinfo{}'.format(nowDayStr))
  14. flightstsdataAll = fdb.getAlldata('flightsts{}'.format(nowDayStr))
  15. waringMessageIDs = waringMessageID(fdb)
  16. peopleScheduleAll = fdb.getAlldata("peopleSchedule{}".format(nowDayStr))
  17. executor = concurrent.futures.ThreadPoolExecutor()
  18. all_task = []
  19. taskType=get_dic('taskType')
  20. for i in range(len(sorttable)):
  21. all_task.append(executor.submit(functionDisplay2, sorttable[i], i, TaskFlightinfoAll, flightstsdataAll, waringMessageIDs,peopleScheduleAll,taskType))
  22. for future in concurrent.futures.as_completed(all_task):
  23. data = future.result()
  24. tableWidgetDispalydata.update(data)
  25. newdic = {"B": '"{}"'.format(tableWidgetDispalydata)}
  26. if date == "1":
  27. fdb.upDateItem("display", newdic, "ID = '1'")
  28. elif date == "2":
  29. fdb.upDateItem("display", newdic, "ID = '2'")
  30. elif date == "3":
  31. fdb.upDateItem("display", newdic, "ID = '3'")
  32. return tableWidgetDispalydata
  33. except Exception as e:
  34. app_logger.log_error(e)
  35. def functionDisplay2(row, rowNum, TaskFlightinfoAll,flightstsdataAll,waringMessageIDs,peopleScheduleAll,taskType):
  36. TaskFlightinfo = TuplefindInList(TaskFlightinfoAll,row[1])
  37. #TaskFlightinfo = fdb.queryTabel('TaskFlightinfo{}'.format(nowDayStr), '*', "航班编号='{}'".format(row[1]))
  38. e = ""
  39. F = ""
  40. g = ""
  41. if TaskFlightinfo != None:
  42. JWA = TaskFlightinfo[10]
  43. JWB = TaskFlightinfo[11]
  44. if JWB!="" and JWA =="":
  45. JWA=JWB
  46. if JWA!="" and JWB =="":
  47. JWB=JWA
  48. if TaskFlightinfo[16] != "":
  49. e = "保留"
  50. if TaskFlightinfo[18] != "":
  51. F = "工作包"
  52. if TaskFlightinfo[21] != "":
  53. g = TaskFlightinfo[21]
  54. else:
  55. JWA = ""
  56. JWB = ""
  57. wx_people = ""
  58. fx_people = ""
  59. ecsj_people = ""
  60. ta_td = ""
  61. type31 = ""
  62. # print(TaskFlightinfo)
  63. if TaskFlightinfo != None:
  64. wx_people = TaskFlightinfo[12]
  65. fx_people = TaskFlightinfo[13]
  66. ecsj_people = TaskFlightinfo[19]
  67. ta_td = TaskFlightinfo[9]
  68. type31 = TaskFlightinfo[3]
  69. #flightinfodata = fdb.queryTabel('flightinfo{}'.format(nowDayStr), '*', "航班编号='{}'".format(row[1]))[0]
  70. # print(flightinfodataAll)
  71. # print(row[0])
  72. #flightinfodata = TuplefindInList(flightinfodataAll, row[1])
  73. # print(flightinfodata)
  74. # flightstsdata = fdb.queryTabel('flightsts{}'.format(nowDayStr), '*', "航班编号='{}'".format(row[1]))[0] if \
  75. # len(fdb.queryTabel('flightsts{}'.format(nowDayStr), '*', "航班编号='{}'".format(row[1]))) != 0 else ["", "",
  76. # "", "", "", "",
  77. # "", "", "", "",
  78. # "", "", "", ""]
  79. flightstsdata = TuplefindInList(flightstsdataAll,row[0])if TuplefindInList(flightstsdataAll,row[0])!=None else ["", "","", "", "", "","", "", "", "","", "", "", ""]
  80. jjdw = "√" if flightstsdata[3] != "" else ""
  81. FX = "√" if flightstsdata[4] != "" else ""
  82. XJ = "√" if flightstsdata[5] != "" else ""
  83. ESDW = "√" if flightstsdata[7] != "" else ""
  84. SJDW = "√" if flightstsdata[6] != "" else ""
  85. if TaskFlightinfo[3] == "AF":
  86. postion = str(TaskFlightinfo[23]).split("</br>")[0]
  87. elif TaskFlightinfo[3] == "TR" or TaskFlightinfo[3] == "TAF":
  88. postion = str(TaskFlightinfo[23]).replace("</br>天府","")
  89. elif "</br>" in str(TaskFlightinfo[23]):
  90. postion = str(TaskFlightinfo[23]).split("</br>")[1]
  91. else:
  92. postion ="无信息"
  93. if TaskFlightinfo[4] != "" and (TaskFlightinfo[8] == "" or TaskFlightinfo[30] == ""): #如果sta不为空,且eta或flying为空,显示sta
  94. a = TaskFlightinfo[4][-8:-3]
  95. else:
  96. a=""
  97. if TaskFlightinfo[6] != "" : #当ata不为空显示ata,eta不为空显示eta否则为空
  98. b = TaskFlightinfo[6][-8:-3]
  99. elif TaskFlightinfo[8] != "":
  100. b = TaskFlightinfo[8][-8:-3]
  101. else:
  102. b = ''
  103. if TaskFlightinfo[7] != "" :
  104. c = '[实]' + TaskFlightinfo[7][-8:-3]
  105. elif TaskFlightinfo[5] != "":
  106. c = '[预]' + TaskFlightinfo[5][-8:-3]
  107. else:
  108. c = ''
  109. d = TaskFlightinfo[15] if "随机" in str(TaskFlightinfo[15]) else ""
  110. QColorList = ['black', 'white', '#F3ECD9', '#BAD1D1', '#DDE2E3', '#647277', 'red', 'blue']
  111. # waringMessageIDs = waringMessageID(fdb)
  112. if str(row[1]) in str(waringMessageIDs["全部警告"]):
  113. color_code = QColorList[6]
  114. color_code1 = QColorList[1]
  115. color_code2 = QColorList[1]
  116. color_code3 = QColorList[1]
  117. elif row[5] == "4":
  118. color_code = QColorList[5]
  119. color_code1 = QColorList[1]
  120. color_code2 = QColorList[1]
  121. color_code3 = QColorList[1]
  122. elif row[5] == "3":
  123. color_code = QColorList[3]
  124. color_code1 = QColorList[0]
  125. color_code2 = QColorList[0]
  126. color_code3 = QColorList[0]
  127. elif row[5] == "2":
  128. color_code = QColorList[2]
  129. color_code1 = QColorList[0]
  130. color_code2 = QColorList[0]
  131. color_code3 = QColorList[0]
  132. elif row[5] == "1":
  133. if (rowNum + 2) % 2 == 0:
  134. color_code = QColorList[4]
  135. else:
  136. color_code = QColorList[1]
  137. color_code1 = QColorList[0]
  138. color_code2 = QColorList[6]
  139. color_code3 = QColorList[7]
  140. findid = row[0] + "-B"
  141. #peopleSchedule = fdb.queryTabel("peopleSchedule{}".format(nowDayStr), "*", "编号='%s'" % findid)
  142. peopleSchedule = TuplefindInList(peopleScheduleAll, findid)
  143. if peopleSchedule != None:
  144. fx = peopleSchedule[3]
  145. qw1 = peopleSchedule[4]
  146. qw2 = peopleSchedule[5]
  147. g1 = peopleSchedule[6]
  148. g2 = peopleSchedule[7]
  149. g3 = peopleSchedule[8]
  150. fj = peopleSchedule[9]
  151. else:
  152. fx = ""
  153. qw1 = ""
  154. qw2 = ""
  155. g1 = ""
  156. g2 = ""
  157. g3 = ""
  158. fj = ""
  159. if TaskFlightinfo[3] == "AF":
  160. item_dic = {"0": rowNum,
  161. "1": TaskFlightinfo[1],
  162. "2": TaskFlightinfo[26],
  163. "3": TaskFlightinfo[25],
  164. "4": TaskFlightinfo[21],
  165. "5": a,
  166. "6": b,
  167. "7": "--",
  168. "8": JWA,
  169. "9": taskType[TaskFlightinfo[3]],
  170. "10": fx,
  171. "11": qw1,
  172. "12": qw2,
  173. "13": g1,
  174. "14": g2,
  175. "15": g3,
  176. "16": jjdw,
  177. "17": "--",
  178. "18": "--",
  179. "19": "--",
  180. "20": d,
  181. "21": "--",
  182. "22": e,
  183. "23": F,
  184. "24": postion,
  185. "25": wx_people, # flightinfodata[22],
  186. "26": "",
  187. "27": fx_people, # flightinfodata[23],
  188. "28": row[1],
  189. "29": g,
  190. "30": ta_td,
  191. "31": type31,
  192. "32": fj,
  193. "99": color_code,
  194. "101": color_code1,
  195. "102": color_code2,
  196. "103": color_code3,
  197. "109": row[5]
  198. }
  199. # tableWidgetDispalydata[rowNum] = item_dic
  200. # rowNum += 1
  201. return {rowNum: item_dic}
  202. elif TaskFlightinfo[3] == "停场":
  203. item_dic = {"0": rowNum,
  204. "1": TaskFlightinfo[1],
  205. "2": TaskFlightinfo[26],
  206. "3": TaskFlightinfo[25],
  207. "4": "--",
  208. "5": a,
  209. "6": "--",
  210. "7": "--",
  211. "8": JWA,
  212. "9": taskType[TaskFlightinfo[3]],
  213. "10": fx,
  214. "11": qw1,
  215. "12": qw2,
  216. "13": g1,
  217. "14": g2,
  218. "15": g3,
  219. "16": "--",
  220. "17": "--",
  221. "18": "--",
  222. "19": "--",
  223. "20": "--",
  224. "21": "--",
  225. "22": "--",
  226. "23": "--",
  227. "24": "--", # flightinfodata[22],
  228. "25": "--", # flightinfodata[23],
  229. "26": "--",
  230. "27": "--",
  231. "28": row[1],
  232. "29": "TSK",
  233. "30": "--",
  234. "31": "--",
  235. "32": fj,
  236. "99": color_code,
  237. "101": color_code1,
  238. "102": color_code2,
  239. "103": color_code3,
  240. "109": row[5]
  241. }
  242. # tableWidgetDispalydata[rowNum] = item_dic
  243. # rowNum += 1
  244. return {rowNum: item_dic}
  245. elif TaskFlightinfo[3] == "AP":
  246. item_dic = {"0": rowNum,
  247. "1": TaskFlightinfo[1],
  248. "2": TaskFlightinfo[26],
  249. "3": TaskFlightinfo[25],
  250. "4": TaskFlightinfo[21],
  251. "5": "",
  252. "6": "",
  253. "7": c,
  254. "8": JWB,
  255. "9": taskType[TaskFlightinfo[3]],
  256. "10": fx,
  257. "11": qw1,
  258. "12": qw2,
  259. "13": g1,
  260. "14": g2,
  261. "15": g3,
  262. "16": jjdw,
  263. "18": FX,
  264. "19": XJ,
  265. "17": "--",
  266. "20": d,
  267. "21": SJDW,
  268. "22": e,
  269. "23": F,
  270. "24": postion,
  271. "25": wx_people, # flightinfodata[22],
  272. "26": "",
  273. "27": fx_people, # flightinfodata[23],
  274. "28": row[1],
  275. "29": g,
  276. "30": ta_td,
  277. "31": type31,
  278. "32": fj,
  279. "99": color_code,
  280. "101": color_code1,
  281. "102": color_code2,
  282. "103": color_code3,
  283. "109": row[5]
  284. }
  285. # tableWidgetDispalydata[rowNum] = item_dic
  286. # rowNum += 1
  287. return {rowNum: item_dic}
  288. elif row[3] == "短停接":
  289. item_dic = {"0": rowNum,
  290. "1": TaskFlightinfo[1],
  291. "2": TaskFlightinfo[26],
  292. "3": TaskFlightinfo[25],
  293. "4": TaskFlightinfo[21],
  294. "5": a,
  295. "6": b,
  296. "7": c,
  297. "8": JWA,
  298. "9": taskType[TaskFlightinfo[3]],
  299. "10": fx,
  300. "11": qw1,
  301. "12": qw2,
  302. "13": g1,
  303. "14": g2,
  304. "15": g3,
  305. "16": jjdw,
  306. "18": FX,
  307. "19": "--",
  308. "17": ESDW,
  309. "20": d,
  310. "21": SJDW,
  311. "22": e,
  312. "23": F,
  313. "24": postion,
  314. "25": wx_people, # flightinfodata[22],
  315. "26": ecsj_people,
  316. "27": fx_people, # flightinfodata[23],
  317. "28": row[1],
  318. "29": g,
  319. "30": ta_td,
  320. "31": type31,
  321. "32": fj,
  322. "99": color_code,
  323. "101": color_code1,
  324. "102": color_code2,
  325. "103": color_code3,
  326. "109": row[5]
  327. }
  328. # tableWidgetDispalydata[rowNum] = item_dic
  329. # rowNum += 1
  330. return {rowNum: item_dic}
  331. elif row[3] == "特后前接":
  332. item_dic = {"0": rowNum,
  333. "1": TaskFlightinfo[1],
  334. "2": TaskFlightinfo[26],
  335. "3": TaskFlightinfo[25],
  336. "4": TaskFlightinfo[21],
  337. "5": a,
  338. "6": b,
  339. "7": c,
  340. "8": JWA,
  341. "9": taskType[TaskFlightinfo[3]],
  342. "10": fx,
  343. "11": qw1,
  344. "12": qw2,
  345. "13": g1,
  346. "14": g2,
  347. "15": g3,
  348. "16": jjdw,
  349. "18": FX,
  350. "19": "--",
  351. "17": "--",
  352. "20": d,
  353. "21": SJDW,
  354. "22": e,
  355. "23": F,
  356. "24": postion,
  357. "25": wx_people, # flightinfodata[22],
  358. "26": "",
  359. "27": fx_people, # flightinfodata[23],
  360. "28": row[1],
  361. "29": g,
  362. "30": ta_td,
  363. "31": type31,
  364. "32": fj,
  365. "99": color_code,
  366. "101": color_code1,
  367. "102": color_code2,
  368. "103": color_code3,
  369. "109": row[5]
  370. }
  371. #tableWidgetDispalydata[rowNum] = item_dic
  372. #rowNum += 1
  373. return {rowNum:item_dic}