123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542 |
- from unitls.baseFunction import TuplefindInList,TuplefindInList11,TuplefindInList3
- from .flightDB import flightDB
- from unitls.LogerinTxt import app_logger
- from .getSortFlightdata import getSortFlightdata
- from .waringMessageID import waringMessageID
- import concurrent.futures
- def tableWidgetDispaly(fdb:flightDB,selectedtime,date):#1,昨天。2今天3明天4其他
- try:
- tableWidgetDispalydata = {}
- nowDayStr = selectedtime
- sorttable = getSortFlightdata(fdb, selectedtime, "sortFlight")
- TaskFlightinfoAlldata = fdb.getAlldata('TaskFlightinfo{}'.format(nowDayStr))
- flightStsDataAll = fdb.getAlldata('flightsts{}'.format(nowDayStr))
- peopleScheduleDataAll = fdb.getAlldata("peopleSchedule{}".format(nowDayStr))
- workjobDataAll = fdb.getAlldata('workjob')
- tasklistall = fdb.getAlldata('TaskList{}'.format(nowDayStr))
- flightSearchALl= fdb.sort_queryTable2('*','FlightSearch{}'.format(nowDayStr),"FLIGHT_ID !=''",'ACNO','ASC','STD','ASC')
- waringMessageIDs = waringMessageID(fdb)
- executor = concurrent.futures.ThreadPoolExecutor()
- all_task = []
- for i in range(len(sorttable)):
- all_task.append(executor.submit(functionDisaplay, sorttable[i],i, TaskFlightinfoAlldata,workjobDataAll, flightStsDataAll,peopleScheduleDataAll,waringMessageIDs,tasklistall,flightSearchALl))
- for future in concurrent.futures.as_completed(all_task):
- data = future.result()
- tableWidgetDispalydata.update(data)
- #t8 = datetime.datetime.now()
- #print(f'【航班刷新】【处理数据】:{t8 - t7}')
- newdic = {"A": '"{}"'.format(tableWidgetDispalydata)}
- if date == "1":
- fdb.upDateItem("display", newdic, "ID = '1'")
- elif date == "2":
- fdb.upDateItem("display", newdic, "ID = '2'")
- elif date == "3":
- fdb.upDateItem("display", newdic, "ID = '3'")
- #t9 = datetime.datetime.now()
- #print(f'【航班刷新】【保存数据】:{t9 - t8}')
- #print(f'【航班刷新】【总时间】:{t9 - t1}')
- return tableWidgetDispalydata
- except Exception as e:
- #dingding_alert(traceback.format_exc())
- app_logger.log_error(e)
- def functionDisaplay(row,rowNum,TaskFlightinfoAlldata, workjobDataAll, flightStsDataAll,peopleScheduleDataAll, waringMessageID,TaskListAll,flightSearchALl):
- dic=["0","1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20","21","22","23",
- "24","25","26","27","28","29","30","31","32","33","34","35","36","37","38","39","40","41","42","43","44",
- "45","46","47","48","49","50","51","52","53","54","55","56","57","58","59","60","61","62","63","64","65"]
- TaskFlightinfo = TuplefindInList(TaskFlightinfoAlldata,row[1])
- infos="仅支持查询川航航班"
- dq = "--"
- dqxq = "电签工卡不适用"
- if TaskFlightinfo[21] and ('3U' in TaskFlightinfo[21] or 'CSC' in TaskFlightinfo[21]):
- singleflightsearch = TuplefindInList11(flightSearchALl, TaskFlightinfo[1],2)
- for info in singleflightsearch:
- if info[8] != "":
- time1="[实]"+info[8][-8:-3]
- elif info[7] != "":
- time1="[预]"+info[7][-8:-3]
- else:
- time1="[计]"+info[6][-8:-3]
- if info[11] !="":
- time2="[实]"+info[11][-8:-3]
- elif info[10] != "":
- time2="[预]"+info[10][-8:-3]
- else:
- time2="[计]"+info[9][-8:-3]
- mesg=info[4]+time1+"--"+time2+info[5]
- infos = mesg if infos == "仅支持查询川航航班" else infos+"\n"+mesg
- tasksts = TuplefindInList3(TaskListAll, TaskFlightinfo[0], 0, 8)
- if TaskFlightinfo[3] == "AP":
- dq = "√" if 'P-PRE-FLIGHT' in str(tasksts) and 'DEPARTURE-SERVICE' in str(tasksts) else ""
- if 'P-PRE-FLIGHT' in str(tasksts) and 'DEPARTURE-SERVICE' in str(tasksts):
- dqxq="航前工卡√\n送机勤务工卡√"
- elif 'P-PRE-FLIGHT' in str(tasksts):
- dqxq="航前工卡√\n送机勤务工卡X"
- elif 'DEPARTURE-SERVICE' in str(tasksts):
- dqxq="航前工卡X\n送机勤务工卡√"
- else:
- dqxq = "航前工卡X\n送机勤务工卡X"
- elif TaskFlightinfo[3] == "TR" and "接" in row[3]:
- dq = "√" if 'ARRIVAL-SERVICE' in str(tasksts) else ""
- dqxq = "接机勤务工卡√" if 'ARRIVAL-SERVICE' in str(tasksts) else "接机勤务工卡X"
- elif TaskFlightinfo[3] in ["TAF","停场"]:
- dq = "--"
- dqxq= "暂无完成的电签工卡"
- elif TaskFlightinfo[3] == "TR" and "送" in row[3]:
- dq = "√" if 'P-TRANSIT' in str(tasksts) and 'DEPARTURE-SERVICE' in str(tasksts) else ""
- if 'P-TRANSIT' in str(tasksts) and 'DEPARTURE-SERVICE' in str(tasksts):
- dqxq = "短停工卡√\n送机勤务工卡√"
- elif 'P-TRANSIT' in str(tasksts):
- dqxq = "短停工卡√\n送机勤务工卡X"
- elif 'DEPARTURE-SERVICE' in str(tasksts):
- dqxq ="短停工卡X\n送机勤务工卡√"
- else:
- dqxq = "短停工卡X\n送机勤务工卡X"
- elif TaskFlightinfo[3] == "AF":
- dq = "√" if 'P-POST-FLIGHT' in str(tasksts) and 'ARRIVAL-SERVICE' in str(tasksts) else ""
- if 'P-POST-FLIGHT' in str(tasksts) and 'ARRIVAL-SERVICE' in str(tasksts):
- dqxq = "航后工卡√\n接机勤务工卡√"
- elif 'P-POST-FLIGHT' in str(tasksts):
- dqxq = "航后工卡√\n接机勤务工卡X"
- elif 'ARRIVAL-SERVICE' in str(tasksts):
- dqxq = "航后工卡X\n接机勤务工卡√"
- else:
- dqxq = "航后工卡X\n接机勤务工卡X"
- #print(tasksts)
- #print(singleflightsearch)
- e = ""
- F = ""
- if TaskFlightinfo != None and TaskFlightinfo[16] != "":
- e = "保留"
- if TaskFlightinfo != None :
- takinfo = TuplefindInList(workjobDataAll, TaskFlightinfo[0])
- JWA = TaskFlightinfo[10]
- JWB = TaskFlightinfo[11]
- if JWA =="" and JWB !="":
- JWA=JWB
- elif JWB =="" and JWA !="":
- JWB=JWA
- if TaskFlightinfo[18] != "":
- #takinfo = fdb.queryTabel('workjob', '*', "任务编号= '%s'" % TaskFlightinfo[0][21])
- F = "工作包无法正常获取请通过AMRO人工查询"
- if takinfo != None and takinfo[4] != "":
- F = takinfo[4] + "\n<+++++++++++++++++++++++++++++++++++++++++>\n" + takinfo[6] + "\n<+++++++++++++++++++++++++++++++++++++++++>\n" + takinfo[7]
- elif takinfo != None:
- F = "工作包暂未获取请点击右键工作包查询后再查看"
- else:
- JWA =""
- JWB =""
- wx_people = ""
- fx_people = ""
- ecsj_people = ""
- ta_td = ""
- type31 = ""
- if TaskFlightinfo != None:
- wx_people = TaskFlightinfo[12]
- fx_people = TaskFlightinfo[13]
- ecsj_people = TaskFlightinfo[19]
- ta_td = TaskFlightinfo[9]
- type31 = TaskFlightinfo[3]
- flightstsdata = TuplefindInList(flightStsDataAll, row[1]) if TuplefindInList(flightStsDataAll, row[1]) != None else ["", "","", "", "", "","", "", "", "","", "", "", ""]
- jjdw = "√" if flightstsdata[3] != "" else ""
- FX = "√" if flightstsdata[4] != "" else ""
- XJ = "√" if flightstsdata[5] != "" else ""
- ESDW = "√" if flightstsdata[7] != "" else ""
- if TaskFlightinfo[3] == "AF":
- postion = str(TaskFlightinfo[23]).split("</br>")[0]
- elif TaskFlightinfo[3] == "TR" or TaskFlightinfo[3] == "TAF":
- postion = str(TaskFlightinfo[23]).replace("</br>天府","").replace("</br>成都天府","")
- elif "</br>" in str(TaskFlightinfo[23]):
- postion = str(TaskFlightinfo[23]).split("</br>")[1]
- else:
- postion = "无信息"
- if TaskFlightinfo[4] != "" and (TaskFlightinfo[8] == "" or TaskFlightinfo[30] == ""): #如果sta不为空,且eta或flying为空,显示sta
- a = TaskFlightinfo[4][-8:-3]
- else:
- a=""
- if TaskFlightinfo[6] != "" : #当ata不为空显示ata,eta不为空显示eta否则为空
- b = TaskFlightinfo[6][-8:-3]
- elif TaskFlightinfo[8] != "":
- b = TaskFlightinfo[8][-8:-3]
- else:
- b = ''
- if TaskFlightinfo[7] != "" :
- c = '[实]' + TaskFlightinfo[7][-8:-3]
- elif TaskFlightinfo[5] != "":
- c = '[预]' + TaskFlightinfo[5][-8:-3]
- else:
- c = ''
- QColorList = ['black', 'white', '#F3ECD9', '#BAD1D1', '#DDE2E3', '#647277', '#00FFFF', 'blue']
- #QColorList = ['black', 'white', '#F3ECD9', '#BAD1D1', '#DDE2E3', '#647277', 'red', 'blue']
- waringMessageIDs = waringMessageID
- if str(row[1]) in str(waringMessageIDs["通用警告"]):
- color_code = QColorList[6]
- color_code1 = QColorList[0]
- color_code2 = QColorList[1]
- color_code3 = QColorList[1]
- elif row[3] == "短停接" and (str(row[1]) in str(waringMessageIDs["到位警告"]) or str(row[1]) in str(waringMessageIDs["ETA"]) or str(row[1]) in str(waringMessageIDs["BAY_2"])):
- color_code = QColorList[6]
- color_code1 = QColorList[0]
- color_code2 = QColorList[1]
- color_code3 = QColorList[1]
- elif row[3] == "短停送" and (str(row[1]) in str(waringMessageIDs["二送警告"]) or str(row[1]) in str(waringMessageIDs["TD"])):
- color_code = QColorList[6]
- color_code1 = QColorList[0]
- color_code2 = QColorList[1]
- color_code3 = QColorList[1]
- elif row[5] == "4":
- color_code = QColorList[5]
- color_code1 = QColorList[1]
- color_code2 = QColorList[1]
- color_code3 = QColorList[1]
- elif row[5] == "3":
- color_code = QColorList[3]
- color_code1 = QColorList[0]
- color_code2 = QColorList[0]
- color_code3 = QColorList[0]
- elif row[5] == "2":
- color_code = QColorList[2]
- color_code1 = QColorList[0]
- color_code2 = QColorList[0]
- color_code3 = QColorList[0]
- elif row[5] == "1":
- if (rowNum + 2) % 2 == 0:
- color_code = QColorList[4]
- else:
- color_code = QColorList[1]
- color_code1 = QColorList[0]
- color_code2 = QColorList[6]
- color_code3 = QColorList[7]
- findid = row[0] + "-A"
- peopleSchedule = TuplefindInList(peopleScheduleDataAll, findid)
- if peopleSchedule != None:
- fx = peopleSchedule[3]
- qw1 = peopleSchedule[4]
- qw2 = peopleSchedule[5]
- g1 = peopleSchedule[6]
- g2 = peopleSchedule[7]
- g3 = peopleSchedule[8]
- fj = str(peopleSchedule[9])
- else:
- fx = ""
- qw1 = ""
- qw2 = ""
- g1 = ""
- g2 = ""
- g3 = ""
- fj = ""
- if "随机离港" in str(fj):
- SJDW = "√" if flightstsdata[6] != "" else ""
- else:
- SJDW ="--"
- ggy = "【高高原】" if TaskFlightinfo[29] == "Y" else ""
- JBRY = "交班人员:" + TaskFlightinfo[37] if TaskFlightinfo[37] != "" else "无交班人员"
- if TaskFlightinfo[3] == "AF":
- item_dic = {"1": rowNum,
- "3": TaskFlightinfo[1],
- "4": TaskFlightinfo[1]+"\n"+TaskFlightinfo[21],
- "5": TaskFlightinfo[26],
- "6": TaskFlightinfo[26]+"\n"+TaskFlightinfo[25],
- "7": TaskFlightinfo[25],
- "8": JWA,
- "9": TaskFlightinfo[21],
- "11": a,
- "13": b,
- "15": "--",
- "17": TaskFlightinfo[24],
- "18": JWA,
- "19": row[3],
- "21": fx,
- "23": qw1,
- "25": qw2,
- "27": g1,
- "29": g2,
- "31": g3,
- "33": jjdw,
- "35": "--",
- "37": "--",
- "38":dq,
- "62":infos,
- "40":dqxq,
- "41": "--",
- "43": e,
- "45": F,
- "47": postion + ggy,
- "49": wx_people, # flightinfodata[22],
- "50":JBRY,
- "51": fx_people, # flightinfodata[23],
- "53": row[1],
- "55": row[1],
- "57": ta_td,
- "59": type31,
- "61": fj,
- "99": color_code,
- "101": color_code1,
- "102": color_code2,
- "103": color_code3,
- "109": row[5],
- "119": row[2], #保障时间
- "129": row[4],#航日期
- "139": row[0]+"-A",#sor编号
- }
- elif TaskFlightinfo[3] == "停场":
- item_dic = {"1": rowNum,
- "3": TaskFlightinfo[1],
- "4": TaskFlightinfo[1]+"\n"+TaskFlightinfo[21],
- "5": TaskFlightinfo[26],
- "6": TaskFlightinfo[26]+"\n"+TaskFlightinfo[25],
- "7": TaskFlightinfo[25],
- "8": TaskFlightinfo[10],
- "9": "--",
- "11": a,
- "13": "--",
- "15": "--",
- "17": "--",
- "18": TaskFlightinfo[10],
- "19": row[3],
- "21": fx,
- "23": qw1,
- "25": qw2,
- "27": g1,
- "29": g2,
- "31": g3,
- "33": "--",
- "35": "--",
- "37": "--",
- "39": "--",
- "41": "--",
- "43": "--",
- "45": "--",
- "47": "停场",
- "49": "--", # flightinfodata[22],
- "50":JBRY,
- "51": "--", # flightinfodata[23],
- "53": row[1],
- "55": "TSK",
- "57": "--",
- "59": "--",
- "61": fj,
- "99": color_code,
- "101": color_code1,
- "102": color_code2,
- "103": color_code3,
- "109": row[5],
- "119": row[2], #保障时间
- "129": row[4],#航日期
- "139": row[0]+"-A",#sor编号
- }
- elif TaskFlightinfo[3] == "AP":
- item_dic = {"1": rowNum,
- "3": TaskFlightinfo[1],
- "4": TaskFlightinfo[1]+"\n"+TaskFlightinfo[21],
- "5": TaskFlightinfo[26],
- "6": TaskFlightinfo[26]+"\n"+TaskFlightinfo[25],
- "7": TaskFlightinfo[25],
- "8": JWB,
- "9": TaskFlightinfo[21],
- "11": "",
- "13": "",
- "15": c,
- "17": TaskFlightinfo[24],
- "18": JWB,
- "19": row[3],
- "21": fx,
- "23": qw1,
- "25": qw2,
- "27": g1,
- "29": g2,
- "31": g3,
- "33": jjdw,
- "35": FX,
- "37": XJ,
- "38":dq,
- "62":infos,
- "40":dqxq,
- "41": SJDW,
- "43": e,
- "45": F,
- "47": postion + ggy,
- "49": wx_people, # flightinfodata[22],
- "50":JBRY,
- "51": fx_people, # flightinfodata[23],
- "53": row[1],
- "55": row[1],
- "57": ta_td,
- "59": type31,
- "61": fj,
- "99": color_code,
- "101": color_code1,
- "102": color_code2,
- "103": color_code3,
- "109": row[5],
- "119": row[2], #保障时间
- "129": row[4],#航日期
- "139": row[0]+"-A",#sor编号
- }
- elif (TaskFlightinfo[3] == "TR" or TaskFlightinfo[3] == "TAF") and (row[3] == "短停接" or row[3] == "特后前接"):
- item_dic = {"1": rowNum,
- "3": TaskFlightinfo[1],
- "4": TaskFlightinfo[1]+"\n"+TaskFlightinfo[21],
- "5": TaskFlightinfo[26],
- "6": TaskFlightinfo[26]+"\n"+TaskFlightinfo[25],
- "7": TaskFlightinfo[25],
- "8": JWA,
- "9": TaskFlightinfo[21],
- "11": a,
- "13": b,
- "15": c,
- "17": TaskFlightinfo[24],
- "18": JWA,
- "19": row[3],
- "21": fx,
- "23": qw1,
- "25": qw2,
- "27": g1,
- "29": g2,
- "31": g3,
- "33": jjdw,
- "35": FX,
- "37": "--",
- "38":dq,
- "62":infos,
- "40":dqxq,
- "41": SJDW,
- "43": e,
- "45": F,
- "47": postion + ggy,
- "49": wx_people, # flightinfodata[22],
- "50":JBRY,
- "51": fx_people, # flightinfodata[23],
- "53": row[1],
- "55": row[1],
- "57": ta_td,
- "59": type31,
- "61": fj,
- "99": color_code,
- "101": color_code1,
- "102": color_code2,
- "103": color_code3,
- "109": row[5],
- "119": row[2], #保障时间
- "129": row[4],#航日期
- "139": row[0]+"-A",#sor编号
- }
- elif (TaskFlightinfo[3] == "TR" or TaskFlightinfo[3] == "TAF") and (row[3] == "短停送" or row[3] == "特后前送"):
- item_dic = {"1": rowNum,
- "3": TaskFlightinfo[1],
- "4": TaskFlightinfo[1]+"\n"+TaskFlightinfo[21],
- "5": TaskFlightinfo[26],
- "6": TaskFlightinfo[26]+"\n"+TaskFlightinfo[25],
- "7": TaskFlightinfo[25],
- "8": JWA,
- "9": TaskFlightinfo[21],
- "11": a,
- "13": b,
- "15": c,
- "17": TaskFlightinfo[24],
- "18": JWA,
- "19": row[3],
- "21": fx,
- "23": qw1,
- "25": qw2,
- "27": g1,
- "29": g2,
- "31": g3,
- "33": ESDW,
- "35": FX,
- "37": "--",
- "38":dq,
- "62":infos,
- "40":dqxq,
- "41": SJDW,
- "43": e,
- "45": F,
- "47": postion + ggy,
- "49": ecsj_people, # flightinfodata[22],
- "50":JBRY,
- "51": fx_people, # flightinfodata[23],
- "53": row[1],
- "55": row[1],
- "57": ta_td,
- "59": type31,
- "61": fj,
- "99": color_code,
- "101": color_code1,
- "102": color_code2,
- "103": color_code3,
- "109": row[5],
- "119": row[2], #保障时间
- "129": row[4],#航日期
- "139": row[0]+"-A",#sor编号
- }
- else:
- item_dic = {"1": rowNum,
- "3": TaskFlightinfo[1],
- "4": TaskFlightinfo[1]+"\n"+TaskFlightinfo[21],
- "5": TaskFlightinfo[26],
- "6": TaskFlightinfo[26]+"\n"+TaskFlightinfo[25],
- "7": TaskFlightinfo[25],
- "8": JWA,
- "9": TaskFlightinfo[21],
- "11": a,
- "13": b,
- "15": c,
- "17": TaskFlightinfo[24],
- "18": JWA,
- "19": row[3],
- "21": fx,
- "23": qw1,
- "25": qw2,
- "27": g1,
- "29": g2,
- "31": g3,
- "33": jjdw,
- "35": FX,
- "37": "--",
- "38":dq,
- "62":infos,
- "40": dqxq,
- "41": SJDW,
- "43": e,
- "45": F,
- "47": postion + ggy,
- "49": wx_people, # flightinfodata[22],
- "50": JBRY,
- "51": fx_people, # flightinfodata[23],
- "53": row[1],
- "55": row[1],
- "57": ta_td,
- "59": type31,
- "61": fj,
- "99": color_code,
- "101": color_code1,
- "102": color_code2,
- "103": color_code3,
- "109": row[5],
- "119": row[2], #保障时间
- "129": row[4],#航日期
- "139": row[0]+"-A",#sor编号
- }
- for i in dic:
- if i not in item_dic.keys():
- item_dic[i] = ''
- #tableWidgetDispalydata[rowNum] = item_dic
- #rowNum += 1
- # print(rowNum)
- # print(item_dic)
- # print({rowNum:item_dic})
- return {rowNum:item_dic}
|