浏览代码

server with jwt 18.0 分离版本

maohu 3 周之前
当前提交
f0d5f6169f
共有 100 个文件被更改,包括 12386 次插入0 次删除
  1. 二进制
      2.ico
  2. 15 0
      Functions/DButilsFunction/GetPglistInDatabase.py
  3. 206 0
      Functions/DButilsFunction/Getworkload.py
  4. 102 0
      Functions/DButilsFunction/MM_GJJH_LIST.py
  5. 20 0
      Functions/DButilsFunction/ManChangeCosttime.py
  6. 66 0
      Functions/DButilsFunction/TaskListInsert.py
  7. 29 0
      Functions/DButilsFunction/UpdateNoteItem.py
  8. 29 0
      Functions/DButilsFunction/UpdatePeopleScheduleFromOnline.py
  9. 74 0
      Functions/DButilsFunction/__init__.py
  10. 257 0
      Functions/DButilsFunction/bakupdata.py
  11. 23 0
      Functions/DButilsFunction/calledChecked.py
  12. 20 0
      Functions/DButilsFunction/callon.py
  13. 38 0
      Functions/DButilsFunction/calltry.py
  14. 11 0
      Functions/DButilsFunction/changepassword.py
  15. 31 0
      Functions/DButilsFunction/checkCalllist.py
  16. 482 0
      Functions/DButilsFunction/checkFlightAlert.py
  17. 36 0
      Functions/DButilsFunction/checkLoadSingal.py
  18. 26 0
      Functions/DButilsFunction/checkPglist.py
  19. 216 0
      Functions/DButilsFunction/checkTFUairplane.py
  20. 366 0
      Functions/DButilsFunction/checkWorkerlaod.py
  21. 364 0
      Functions/DButilsFunction/checkWorkerlaod_new.py
  22. 125 0
      Functions/DButilsFunction/checkflightplan.py
  23. 190 0
      Functions/DButilsFunction/checkworkload_New.py
  24. 25 0
      Functions/DButilsFunction/createWorkloadtables.py
  25. 17 0
      Functions/DButilsFunction/createWorkloadtablesFromPg.py
  26. 16 0
      Functions/DButilsFunction/dealLogs.py
  27. 24 0
      Functions/DButilsFunction/deleteFlight.py
  28. 89 0
      Functions/DButilsFunction/dingding.py
  29. 39 0
      Functions/DButilsFunction/dingdingDelete_flight.py
  30. 75 0
      Functions/DButilsFunction/dingdingFlightsts.py
  31. 30 0
      Functions/DButilsFunction/dingdinginfoget.py
  32. 280 0
      Functions/DButilsFunction/flightDB.py
  33. 113 0
      Functions/DButilsFunction/flightplanInsert.py
  34. 101 0
      Functions/DButilsFunction/flightsearchInsert.py
  35. 17 0
      Functions/DButilsFunction/getFlightData.py
  36. 9 0
      Functions/DButilsFunction/getRiskData.py
  37. 11 0
      Functions/DButilsFunction/getSortFlightdata.py
  38. 18 0
      Functions/DButilsFunction/getWorkjobInfo.py
  39. 38 0
      Functions/DButilsFunction/get_dic.py
  40. 70 0
      Functions/DButilsFunction/get_empNos.py
  41. 13 0
      Functions/DButilsFunction/get_empNos_phoone.py
  42. 22 0
      Functions/DButilsFunction/getphonelist.py
  43. 29 0
      Functions/DButilsFunction/handoverStsChange.py
  44. 27 0
      Functions/DButilsFunction/infoConfirm.py
  45. 27 0
      Functions/DButilsFunction/infoConfirm2.py
  46. 27 0
      Functions/DButilsFunction/infoConfirm3.py
  47. 95 0
      Functions/DButilsFunction/initFlightDatabase.py
  48. 19 0
      Functions/DButilsFunction/insertCalllist.py
  49. 14 0
      Functions/DButilsFunction/insertLogs.py
  50. 14 0
      Functions/DButilsFunction/insertLogs2.py
  51. 541 0
      Functions/DButilsFunction/insertTaskDataToTable.py
  52. 38 0
      Functions/DButilsFunction/insertWorkjob.py
  53. 29 0
      Functions/DButilsFunction/judge_bc.py
  54. 28 0
      Functions/DButilsFunction/maintainAuthCheck.py
  55. 62 0
      Functions/DButilsFunction/manAddFlight.py
  56. 63 0
      Functions/DButilsFunction/manChangests.py
  57. 26 0
      Functions/DButilsFunction/mandealAllLogs.py
  58. 119 0
      Functions/DButilsFunction/mapDispaly.py
  59. 76 0
      Functions/DButilsFunction/postgresql_backup.py
  60. 66 0
      Functions/DButilsFunction/postgresql_local.py
  61. 63 0
      Functions/DButilsFunction/qtPeopleLoad.py
  62. 7 0
      Functions/DButilsFunction/saveRisktable.py
  63. 16 0
      Functions/DButilsFunction/selftaxiLogs.py
  64. 336 0
      Functions/DButilsFunction/sortFlighttime.py
  65. 87 0
      Functions/DButilsFunction/sortFlighttime2.py
  66. 469 0
      Functions/DButilsFunction/tableWidgetDispaly.py
  67. 393 0
      Functions/DButilsFunction/tableWidgetDispaly2.py
  68. 380 0
      Functions/DButilsFunction/tableWidgetDispaly2_66.py
  69. 18 0
      Functions/DButilsFunction/tableWidgetDispalyRead.py
  70. 18 0
      Functions/DButilsFunction/tableWidgetDispalyRead2.py
  71. 555 0
      Functions/DButilsFunction/tableWidgetDispaly_66.py
  72. 33 0
      Functions/DButilsFunction/tableWidgetDisplayChange.py
  73. 20 0
      Functions/DButilsFunction/tableWidgetLOGDispaly.py
  74. 86 0
      Functions/DButilsFunction/taskAtuoCheck.py
  75. 52 0
      Functions/DButilsFunction/updateDragDropItem.py
  76. 38 0
      Functions/DButilsFunction/updateEidteItem.py
  77. 19 0
      Functions/DButilsFunction/updateRiskdb.py
  78. 34 0
      Functions/DButilsFunction/updateStopFlight.py
  79. 19 0
      Functions/DButilsFunction/updateTaskAuto.py
  80. 27 0
      Functions/DButilsFunction/update_Pglist.py
  81. 40 0
      Functions/DButilsFunction/waringMessageID.py
  82. 729 0
      Functions/DataComputer.py
  83. 0 0
      Functions/__init__.py
  84. 282 0
      Functions/flaskDBUtils4PG.py
  85. 179 0
      Functions/ipFind.py
  86. 56 0
      Functions/ipcall.py
  87. 19 0
      Functions/openPdf.py
  88. 59 0
      Functions/serverFind.py
  89. 510 0
      Functions/utils.py
  90. 1854 0
      ServerWithJWT.py
  91. 2 0
      _init_.py
  92. 71 0
      apiFunction.py
  93. 73 0
      config.ini
  94. 108 0
      scheduleCenter.py
  95. 4 0
      static/css/bootstrap.min.css
  96. 105 0
      static/css/dashboard.css
  97. 455 0
      static/css/dataTables.css
  98. 97 0
      static/css/moveitem.css
  99. 40 0
      static/css/signin.css
  100. 二进制
      static/fonts/glyphicons-halflings-regular.eot

二进制
2.ico


+ 15 - 0
Functions/DButilsFunction/GetPglistInDatabase.py

@@ -0,0 +1,15 @@
+from unitls.LogerinTxt import app_logger
+from .flightDB import flightDB
+
+
+def GetPglistInDatabase(fdb:flightDB,bcinfos):
+    res=[]
+    try:
+        datas=fdb.queryTabel('pglist%s'%bcinfos["date"], '*', "班次= '%s'"%bcinfos["bc"])
+        if datas:
+            for data in datas:
+                res.append(data[0])
+        return res
+    except Exception as e:
+        app_logger.log_error(e)
+        return res

+ 206 - 0
Functions/DButilsFunction/Getworkload.py

@@ -0,0 +1,206 @@
+import datetime
+
+from unitls.LogerinTxt import app_logger
+from .flightDB import flightDB
+from unitls import baseFunction
+
+
+def sort_and_renumber_dict(nested_dict, sort_key, secondary_key=None, reverse=False,secondary_reverse=False):
+    # 1. 将原始字典的值转换为列表
+    items_list = list(nested_dict.values())
+
+    # 2. 按双条件排序
+    if secondary_key:
+        sorted_list = sorted(
+            items_list,
+            key=lambda x: (x[sort_key], x[secondary_key]),
+            reverse=secondary_reverse
+        )
+    else:
+        sorted_list = sorted(items_list, key=lambda x: x[sort_key], reverse=reverse)
+
+    # 3. 创建新字典,使用连续整数作为键
+    new_dict = {}
+    for new_key, item in enumerate(sorted_list):
+        new_dict[new_key] = item
+    return new_dict
+
+
+
+def Getworkload(fdb:flightDB,workload: flightDB,names):
+    res={}
+    flighttypedic={"TR":"短停","AF":"航后","AP":"航前","TAF":"特后前","":"未显示"}
+    dic={"FX":"放行","WX":"维修员","":"未分配"}
+    nowDay = datetime.date.today().strftime("%Y%m%d")
+    nowDay_1 = (datetime.date.today() - datetime.timedelta(days=1)).strftime("%Y%m%d")
+    nowDay_2 = (datetime.date.today() + datetime.timedelta(days=1)).strftime("%Y%m%d")
+    a_str = nowDay + " 09:00:00"
+    b_str = nowDay + " 20:30:00"
+    a = datetime.datetime.strptime(a_str, "%Y%m%d %H:%M:%S")
+    b = datetime.datetime.strptime(b_str, "%Y%m%d %H:%M:%S")
+    nowtime = datetime.datetime.now()
+    if a < nowtime < b:
+        date = [nowDay]
+        bcdate = nowDay
+        bc="A"
+    elif b <= nowtime:
+        date = [nowDay, nowDay_2]
+        bcdate = nowDay
+        bc = "B"
+    else:
+        date = [nowDay_1, nowDay]
+        bcdate = nowDay_1
+        bc = "B"
+    allworkloaddatas=[]
+    allpeopleschedule=[]
+    allflightinfo=[]
+    try:
+        if names:
+            lastBchandoverinfos=[]
+            if len(date) == 1:
+                daytime=(datetime.datetime.strptime(date[0],'%Y%m%d')-datetime.timedelta(days=4)).strftime('%Y%m%d')
+                lastBchandoverinfos = workload.queryTabel("workload%s"%daytime,"*","(备3 ='交班' and 备4 !='N') or 备4 ='Y'") #上个班的交接情况
+            for day in date:
+                daily_data = workload.sort_queryTable("*","workload%s"%day,  "备2 != '1'",'结束时间','ASC')
+                if daily_data:  # 确保有数据返回
+                    allworkloaddatas.extend(daily_data)
+                peopleschedule= fdb.queryTabel("peopleschedule%s"%day,"*","显示模式='A' and ('放行' !='' or '勤务1' !='' or '勤务2' !='' or '工1' !='' or '工2' !='' or '工3' !='')")
+                if peopleschedule:  # 确保有数据返回
+                    allpeopleschedule.extend(peopleschedule)
+                flightinfo=  fdb.queryTabel("taskflightinfo%s"%day,"*","航班编号 !=''")
+                if flightinfo:  # 确保有数据返回
+                    allflightinfo.extend(flightinfo)
+            if allworkloaddatas !=[]:
+                allpeopleionfos=fdb.queryTabel("pglist%s"%bcdate,"*","班次='%s'"%bc)
+                sqinfos=fdb.queryTabel('workerinfo',"*","姓名!=''")
+                num = 0
+                for name in names:
+                    signalpeopleinfo= baseFunction.TuplefindInList1(allpeopleionfos , name , 0)
+                    singlepeopledata= baseFunction.TuplefindInList11(allworkloaddatas , name , 11)#所有工时内容
+                    hbsinglepeopledata= baseFunction.TuplefindInList8(singlepeopledata , 'Y' , 17)#非人工的工作内容
+                    rgsinglepeopledata= baseFunction.TuplefindInList11(singlepeopledata , 'Y' , 17)#人工修正工作内容
+                    notfinshsinglepeopledata= baseFunction.TuplefindInList8(hbsinglepeopledata , '完工' , 12) #未完工的内容
+                    singlesqinfo= baseFunction.TuplefindInList1(sqinfos , name , 1)
+                    preinfos= baseFunction.TuplefindInList111(allpeopleschedule , name)
+                    workrole=dic[signalpeopleinfo[0][2]]
+                    noteinfo=signalpeopleinfo[0][4]
+                    handoverSts=""
+                    handoverids=""
+                    if len(date) == 1:
+                        handoverinfos= baseFunction.TuplefindInList33(lastBchandoverinfos , name , 11 , 0)
+                        if handoverinfos:
+                            handoverSts="Y"
+                            handoverids=",".join(handoverinfos)
+                    sq = singlesqinfo[0][8].replace("*","") if singlesqinfo else ""
+                    zgzl=len(hbsinglepeopledata)#总工作量
+                    wwcgz=len(notfinshsinglepeopledata) #当前未完成工作量
+                    zys = baseFunction.TuplefindInList9(singlepeopledata , 9) #总用时
+                    zgs = baseFunction.TuplefindInList9(singlepeopledata , 10) #总的标准工时
+                    rggs = baseFunction.TuplefindInList9(rgsinglepeopledata , 10) #人工标准工时
+                    xzgs = baseFunction.TuplefindInList9(rgsinglepeopledata , 10) #修正工作时间的总长
+                    dqgz = "无"
+                    if notfinshsinglepeopledata:
+                        for i in notfinshsinglepeopledata:
+                          dqgz = i[4][-8:-3]+"-"+i[5][-8:-3]+"/"+i[6]+i[8][:2] if dqgz == "无" else dqgz+"\n"+ i[4][-8:-3]+"-"+i[5][-8:-3]+"/"+i[6]+i[8][:2]
+
+                    xzxq = "无"
+                    if rgsinglepeopledata:
+                        for i in rgsinglepeopledata:
+                            xzxq ="修正详情:"+"\n"+ i[18]+"/"+i[10] if xzxq == "无" else xzxq+"\n"+i[18]+"/"+i[10]
+                    res[num]={
+                        '0':num+1,
+                        '1':handoverSts,
+                        '2':name,
+                        '3':handoverids,
+                        '4':workrole,
+                        '5':'',
+                        '6':sq,
+                        '7':'',
+                        '8':f'{zgzl}({wwcgz})',
+                        '9':'',
+                        '10':wwcgz,
+                        '11':'',
+                        '12':zgzl,
+                        '13':'',
+                        '14':f'{zgs}({rggs})',
+                        '15':'',
+                        '16':dqgz,
+                        '17':'',
+                        '18':xzgs,
+                        '19':'',
+                        '20':xzxq,
+                        '21':noteinfo,
+                        '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':'',
+                    }
+                    num1 = 28
+                    if hbsinglepeopledata:
+                        for i in singlepeopledata:
+                            res[num][str(num1)] = i[5][-8:-3]+"\n"+i[8][:2]+"/"+i[6]
+                            num1 += 1
+                    if preinfos:
+                        for i in preinfos:
+                            isok=False
+                            preflightinfos= baseFunction.TuplefindInList1(allflightinfo , i[1 ] , 0)[0 ]
+                            if i[0][-3] == "1" and preflightinfos[3] == "TR" and preflightinfos[8] != "":
+                                endtime=(datetime.datetime.strptime(preflightinfos[8], "%Y-%m-%d %H:%M:%S")+ datetime.timedelta(minutes=10)).strftime("%H:%M")
+                                flighttyep="短停接"
+                                bay=preflightinfos[10]
+                                isok = True
+                            elif i[0][-3] == "1" and preflightinfos[3] == "AF" and preflightinfos[8] != "":
+                                endtime=(datetime.datetime.strptime(preflightinfos[8], "%Y-%m-%d %H:%M:%S")+ datetime.timedelta(minutes=120)).strftime("%H:%M")
+                                flighttyep="航后"
+                                bay=preflightinfos[10]
+                                isok = True
+                            elif i[0][-3] == "1" and preflightinfos[3] == "TAF" and preflightinfos[8] != "":
+                                endtime=(datetime.datetime.strptime(preflightinfos[8], "%Y-%m-%d %H:%M:%S")+ datetime.timedelta(minutes=60)).strftime("%H:%M")
+                                flighttyep="特后前"
+                                bay=preflightinfos[10]
+                                isok = True
+                            elif i[0][-3] == "2" and preflightinfos[3] != "AF" and preflightinfos[5] != "":
+                                endtime=(datetime.datetime.strptime(preflightinfos[5], "%Y-%m-%d %H:%M:%S")+ datetime.timedelta(minutes=60)).strftime("%H:%M")
+                                flighttyep="%s送"%flighttypedic[preflightinfos[3]]
+                                if preflightinfos[3] !="AP":
+                                    bay=preflightinfos[10]
+                                else:
+                                    bay=preflightinfos[11]
+                                isok = True
+                            if isok:
+                                res[num][str(num1)] = endtime+"\n"+"预排"+flighttyep+"/"+bay
+                                num1 += 1
+                    num += 1
+        res = sort_and_renumber_dict(
+            res,
+            sort_key="4",  # 第一排序条件:
+            secondary_key="1",  # 第二排序条件:
+            reverse=False,  # 第一升序
+            secondary_reverse=True  # 第二降序
+        )
+        return res
+    except Exception as e:
+        app_logger.log_error(e)
+        return res

+ 102 - 0
Functions/DButilsFunction/MM_GJJH_LIST.py

@@ -0,0 +1,102 @@
+import datetime
+
+from .dingding import dingding_alert1 , dingding_alert11
+from .flightDB import flightDB
+
+
+def MM_GJJH_LIST(fdb:flightDB,team,data):
+    GJlist1 = {}
+    GJlist2 = {}
+    if data !=[]:
+        now=datetime.datetime.now()
+        nowDay_str2 = datetime.date.today().strftime("%Y-%m-%d")
+        a_str = nowDay_str2 + " 17:00:00"
+        time1 = datetime.datetime.strptime(a_str, "%Y-%m-%d %H:%M:%S")
+        if time1 < now :
+            nowDay = datetime.datetime.now().strftime("%Y%m%d")
+            pglist = fdb.queryTabel("pglist%s"%nowDay,"姓名","班次 = 'A'")
+        else:
+            nowDay = (datetime.date.today() - datetime.timedelta(days=1)).strftime("%Y%m%d")
+            pglist = fdb.queryTabel("pglist%s" % nowDay, "姓名", "班次 = 'B'")
+        for row in data:
+            phone=fdb.queryTabel("workerinfo","电话","姓名='%s'"%str(row["zlynam"]))
+            if len(phone) != 0 and len(phone[0][0]) == 12:
+                phonenumber=phone[0][0][1:]
+                if str(row["zlynam"]) in str(pglist) and str(row["zlynam"]) in GJlist1.keys():
+                    maktx=GJlist1[row["zlynam"]]["工具名"]+","+row["maktx"]
+                    zzbh = GJlist1[row["zlynam"]]["编号"] + "," + row["zzbh"]
+                    zjcmeng = GJlist1[row["zlynam"]]["数量"] + "," + row["zjcmeng"]
+                    a={"工具名":maktx,"编号":zzbh,"数量":zjcmeng,"phonenumber":phonenumber}
+                    GJlist1[row["zlynam"]]=a
+                elif str(row["zlynam"]) in str(pglist) and str(row["zlynam"]) not in GJlist1.keys():
+                    maktx =row["maktx"]
+                    zzbh = row["zzbh"]
+                    zjcmeng = row["zjcmeng"]
+                    a={"工具名":maktx,"编号":zzbh,"数量":zjcmeng,"phonenumber":phonenumber}
+                    GJlist1[row["zlynam"]] = a
+            else:
+                if str(row["zlynam"]) in str(pglist) and str(row["zlynam"]) in GJlist2.keys():
+                    maktx = GJlist2[row["zlynam"]]["工具名"] + "," + row["maktx"]
+                    zzbh = GJlist2[row["zlynam"]]["编号"] + "," + row["zzbh"]
+                    zjcmeng = GJlist2[row["zlynam"]]["数量"] + "," + row["zjcmeng"]
+                    a = {"工具名": maktx, "编号": zzbh, "数量": zjcmeng}
+                    GJlist2[row["zlynam"]] = a
+                elif str(row["zlynam"]) in str(pglist) and str(row["zlynam"]) not in GJlist2.keys():
+                    maktx = row["maktx"]
+                    zzbh = row["zzbh"]
+                    zjcmeng = row["zjcmeng"]
+                    a = {"工具名": maktx, "编号": zzbh, "数量": zjcmeng}
+                    GJlist2[row["zlynam"]] = a
+        if GJlist1:
+            msg = "经查询您有以下工具未归还,请注意核实工具归还或交接情况:"
+            times=5
+            telphone=list()
+            for i in GJlist1:
+                msg =msg+"\n"+"【"+str(i)+"】" + "\n[工具名]:" + str(GJlist1[i]["工具名"]) + "\n[数量]:" + str(GJlist1[i]["数量"]) + "\n[编号]:" + str(GJlist1[i]["编号"])
+                telphone.append(str(GJlist1[i]["phonenumber"]))
+                #telphone.append("17729693827")
+                times+=1
+                if times % 5 == 0:
+                    if team == "test":
+                        dingding_alert1(telphone,msg)
+                    elif str(team)=="1":
+                        dingding_alert11(telphone, msg)
+                    elif str(team)=="2":
+                        dingding_alert1(telphone, msg)
+                    elif str(team)=="3":
+                        dingding_alert1(telphone, msg)
+                    elif str(team)=="4":
+                        dingding_alert1(telphone, msg)
+                    msg = "经查询您有以下工具未归还,请注意核实工具归还或交接情况:"
+                    telphone = list()
+            if msg !="经查询您有以下工具未归还,请注意核实工具归还或交接情况:":
+                if team == "test":
+                    dingding_alert1(telphone, msg)
+                elif str(team) == "1":
+                    #print(telphone, msg)
+                    #dingding_alert1(telphone, msg)
+                    dingding_alert11(telphone, msg)
+                elif str(team) == "2":
+                    dingding_alert1(telphone, msg)
+                elif str(team) == "3":
+                    dingding_alert1(telphone, msg)
+                elif str(team) == "4":
+                    dingding_alert1(telphone, msg)
+        if GJlist2:
+            msg="经查询您有以下工具未归还,请注意核实工具归还或交接情况:"
+            a=list()
+            for i in GJlist2:
+                msg =msg+"\n"+"【"+str(i)+"】" + "\n[工具名]:" + str(GJlist2[i]["工具名"]) + "\n[数量]:" + str(GJlist2[i]["数量"]) + "\n[编号]:" + str(GJlist2[i]["编号"])
+            if team == "test":
+                dingding_alert1(a, msg)
+            elif str(team) == "1":
+                #print("联系不上的", msg)
+                #dingding_alert1(a, msg)
+                dingding_alert11("", msg)
+            elif str(team) == "2":
+                dingding_alert1(a, msg)
+            elif str(team) == "3":
+                dingding_alert1(a, msg)
+            elif str(team) == "4":
+                dingding_alert1(a, msg)
+    return

+ 20 - 0
Functions/DButilsFunction/ManChangeCosttime.py

@@ -0,0 +1,20 @@
+from unitls.LogerinTxt import app_logger
+from unitls.StaticDataclass import get_dic
+from .flightDB import flightDB
+
+
+def ManCahangeWorkload(workload:flightDB,data):
+    try:
+        fullkeys=get_dic('newWorkloadLabel')
+        newdic = {"编号": data["id"], '人员': data["people"], '标准工时': data["costtime"],"备4":"Y","备5": data["info"]}
+        for key in fullkeys:
+            if key in newdic:
+                continue
+            else:
+                newdic[key] = ""
+        workload.insertData("Workload%s" % data["day"], newdic)
+        return "ok"
+    except Exception as e:
+        app_logger.log_error(e)
+        return "error"
+

+ 66 - 0
Functions/DButilsFunction/TaskListInsert.py

@@ -0,0 +1,66 @@
+import datetime
+
+import unitls.baseFunction as baseFunction
+from unitls.LogerinTxt import app_logger
+from unitls.StaticDataclass import get_dic
+from .flightDB import flightDB
+
+
+def TaskListInsert(database: flightDB, datatime: str, jsonData):
+    nowDayStr = datatime
+    flightinfo_flight_ids_arr = []
+    flightinfo_flight_ids = database.queryTabel('TaskList{}'.format(nowDayStr), '*', "TASKID !=''")#确认一下要不要取整张表
+    if len(flightinfo_flight_ids) != 0:
+        for i in flightinfo_flight_ids:
+            flightinfo_flight_ids_arr.append(i[0])
+    flight_id_now = []
+    keys = get_dic('TaskListLabel')
+    if jsonData != "" and jsonData != None and jsonData != {} and len(jsonData) != 0:
+        for row in jsonData:
+            flight_id_now.append(row["TASKID"])
+            if str(row["TASKID"]) not in str(flightinfo_flight_ids_arr):
+                newDic={}
+                for key in keys:
+                    if key in row.keys():
+                        newDic[key] = str(row[key])
+                    else:
+                        if key != "STA":
+                            newDic[key] = ""
+                        elif row["TASKTYPE"] == "航前":
+                            newDic[key] = datetime.datetime.strptime(row["STARTDATE_PL"],"%Y-%m-%d %H:%M:%S") + datetime.timedelta(hours=2)
+                        else:
+                            newDic[key] = datetime.datetime.strptime(row["STARTDATE_PL"],"%Y-%m-%d %H:%M:%S") + datetime.timedelta(minutes=15)
+
+                database.lazyInsertData('TaskList{}'.format(nowDayStr), newDic)
+            elif str(row["TASKID"]) in str(flightinfo_flight_ids_arr):
+                for key in keys:
+                    if key in row.keys():
+                        b = baseFunction.TuplefindInList3(flightinfo_flight_ids , row[ "TASKID" ] , 0 , keys.index(key))
+                        if b != row[key]:
+                            newdic = {"%s"%key: "'%s'" % row[key]}
+                            database.lazyUpdateItem('TaskList{}'.format(nowDayStr), newdic,"TASKID='%s'" % row["TASKID"])
+                    else:
+                        if key != "STA":
+                            newdata = ""
+                        elif row["TASKTYPE"] == "航前":
+                            newdata = datetime.datetime.strptime(row["STARTDATE_PL"],"%Y-%m-%d %H:%M:%S") + datetime.timedelta(hours=2)
+                        else:
+                            newdata = datetime.datetime.strptime(row["STARTDATE_PL"],"%Y-%m-%d %H:%M:%S") + datetime.timedelta(minutes=15)
+
+                        newdic = {"%s"%key: "'%s'"%newdata}
+                        database.lazyUpdateItem('TaskList{}'.format(nowDayStr), newdic,"TASKID='%s'" % row["TASKID"])
+
+        database.FunctionCommit()
+    else:
+        print(datetime.datetime.now(), "[数据库操作]TaskList航班数据为空")
+        app_logger.log_error("[数据库操作]TaskList航班数据为空")
+        pass
+    if jsonData !="" and jsonData !=None and jsonData != {} and len(flight_id_now) != 0 and len(jsonData)!=0:
+        flightinfo_flight_ids = database.queryTabel('TaskList{}'.format(nowDayStr),'*',"TASKID !=''")
+        if len(flightinfo_flight_ids) != 0:
+            for iii in flightinfo_flight_ids:
+                if str(iii[0]) not in flight_id_now :
+                    database.deleteSingledata("TaskList{}".format(nowDayStr), "TASKID='%s'" % str(iii[0]) )
+        database.FunctionCommit()
+
+

+ 29 - 0
Functions/DButilsFunction/UpdateNoteItem.py

@@ -0,0 +1,29 @@
+import datetime
+
+from unitls.LogerinTxt import app_logger
+from .flightDB import flightDB
+
+
+def UpdateNoteItem(fdb:flightDB,text,name):
+    try:
+        nowDay = datetime.date.today().strftime("%Y%m%d")
+        nowDay_1 = (datetime.date.today() - datetime.timedelta(days=1)).strftime("%Y%m%d")
+        a_str = nowDay + " 09:00:00"
+        b_str = nowDay + " 20:30:00"
+        a = datetime.datetime.strptime(a_str, "%Y%m%d %H:%M:%S")
+        b = datetime.datetime.strptime(b_str, "%Y%m%d %H:%M:%S")
+        nowtime = datetime.datetime.now()
+        if a < nowtime < b:
+            bcdate = nowDay
+        elif b <= nowtime:
+            bcdate = nowDay
+        else:
+            bcdate = nowDay_1
+        if text != "清空项目12345678987654321":
+            newdic={'备注':"'%s'"%text}
+        else:
+            newdic={'备注':"''"}
+
+        fdb.upDateItem("pglist{}".format(bcdate),newdic,"姓名='%s'"%name)
+    except Exception as e:
+        app_logger.log_error(e)

+ 29 - 0
Functions/DButilsFunction/UpdatePeopleScheduleFromOnline.py

@@ -0,0 +1,29 @@
+from unitls.LogerinTxt import app_logger
+
+from .flightDB import flightDB
+
+
+def UpdatePeopleScheduleFromOnline(localdatabase:flightDB,onlinedatabase:flightDB):
+    sts=False
+    dydict={"放行":"放行", "工1":"勤务1", "工2":"勤务2","工3":"工1","工4":"工2","班组长":"工3","备注":"附加消息"}
+    try:
+        needupdate=onlinedatabase.queryTabel('change_log_onlineflight','*',"状态 ='未同步'")
+        if needupdate:
+            for singledata in needupdate:
+                res = localdatabase.getSingledata("编号", "peopleSchedule%s" % singledata[7])
+                if singledata[1] in str(res) :
+                    localdatabase.upDateItem("peopleSchedule%s" % singledata[7] , {"%s" % dydict[singledata[2]] : "'%s'" % singledata[4] } ,"编号='%s'" % singledata[1])
+                else:
+                    dic = {"编号" : singledata[1], "航班编号" : singledata[1][:-4], "显示模式" : "A", "%s" % dydict[singledata[2]]:"%s" % singledata[4] }
+                    for key in dydict.values() :
+                        if key not in dic.keys() :
+                            dic[key] = ''
+                    localdatabase.insertData("peopleSchedule%s" % singledata[7] , dic)
+                newdic = {"航班编号" : "%s" % singledata[1], "提示信息": "" , "信息状态" : "","警告信息" : f"【{singledata[1]}】收到云端在线编辑变更:{singledata[2]}由{singledata[3]}变更为{singledata[4]},变更人:{singledata[6]},请进行识别和处理!" ,"产生时间" : "%s" % singledata[5] , "处理人" : "" , "处理时间" : "" , "变更字段" : "人员安排云端编辑写入" , "显示对象" : "" , "提示内容" : "" }
+                localdatabase.insertData("logs", newdic)
+                onlinedatabase.upDateItem("change_log_onlineflight" , {"状态" : "'已同步'" } , "taskid='%s'" % singledata[1])
+                sts=True
+        return sts
+    except Exception as e:
+        app_logger.log_error(e)
+        return sts

+ 74 - 0
Functions/DButilsFunction/__init__.py

@@ -0,0 +1,74 @@
+from .GetPglistInDatabase import GetPglistInDatabase
+from .Getworkload import Getworkload
+from .MM_GJJH_LIST import MM_GJJH_LIST
+from .ManChangeCosttime import ManCahangeWorkload
+from .TaskListInsert import TaskListInsert
+from .UpdateNoteItem import UpdateNoteItem
+from .UpdatePeopleScheduleFromOnline import UpdatePeopleScheduleFromOnline
+from .bakupdata import bakupdata
+from .calledChecked import calledChecked
+from .callon import callon
+from .calltry import calltry
+from .changepassword import changepassword
+from .checkCalllist import checkCalllist
+from .checkFlightAlert import checkFlightAlert
+from .checkLoadSingal import checkLoadSingal
+from .checkPglist import checkPglist
+from .checkTFUairplane import checkTFUairplane
+from .checkWorkerlaod import checkWorkerlaod
+from .checkflightplan import checkFlightplan
+from .checkworkload_New import checkWorkerlaod_new
+from .createWorkloadtables import createWorkloadtables
+from .createWorkloadtablesFromPg import createWorkloadtablesFromPg
+from .dealLogs import dealLogs
+from .deleteFlight import deleteFlight
+from .dingdingDelete_flight import dingdingDelete_flight
+from .dingdingFlightsts import dingdingFlightsts
+from .dingdinginfoget import dingdinginfoget
+from .flightDB import flightDB
+from .flightplanInsert import FlightPlanInsert
+from .flightsearchInsert import FlightSearchInsert
+from .getRiskData import getRiskData
+from .getWorkjobInfo import getWorkjobInfo
+from .get_dic import get_dic
+from .get_empNos import get_empNos
+from .get_empNos_phoone import get_empNos_phoone
+from .getphonelist import getphonelist
+from .handoverStsChange import HandoverStsChange
+from .infoConfirm import infoConfirm
+from .infoConfirm2 import infoConfirm2
+from .infoConfirm3 import infoConfirm3
+from .initFlightDatabase import initFlightDatabase
+from .insertCalllist import insertCalllist
+from .insertLogs import insertLogs
+from .insertLogs2 import insertLogs2
+from .insertTaskDataToTable import insertTaskDataToTable
+from .insertWorkjob import insertWorkjob
+from .judge_bc import judge_bc
+from .maintainAuthCheck import maintainAuthCheck
+from .manAddFlight import manAddFlight
+from .manChangests import manChangests
+from .mandealAllLogs import mandealAllLogs
+from .mapDispaly import mapDispaly
+from .postgresql_backup import postgresql_bakup
+from .postgresql_local import postgresql_local
+from .qtPeopleLoad import qtPeopleLoad
+from .saveRisktable import saveRisktable
+from .selftaxiLogs import selftaxiLogs
+from .sortFlighttime import sortFlighttime
+from .sortFlighttime2 import sortFlighttime2
+# from .tableWidgetDispaly2 import tableWidgetDispaly2
+from .tableWidgetDispaly2_66 import tableWidgetDispaly2
+from .tableWidgetDispalyRead import tableWidgetDispalyRead
+# from .tableWidgetDispaly import tableWidgetDispaly
+from .tableWidgetDispalyRead2 import tableWidgetDispalyRead2
+from .tableWidgetDispaly_66 import tableWidgetDispaly
+from .tableWidgetDisplayChange import tableWidgetDisplayChange
+from .tableWidgetLOGDispaly import tableWidgetLOGDispaly
+from .taskAtuoCheck import taskAtuoCheck
+from .updateDragDropItem import updateDragDropItem
+from .updateEidteItem import updateEidteItem
+from .updateRiskdb import updateRiskdb
+from .updateStopFlight import updateStopFlight
+from .updateTaskAuto import updateTaskAuto
+from .update_Pglist import update_Pglist

+ 257 - 0
Functions/DButilsFunction/bakupdata.py

@@ -0,0 +1,257 @@
+import datetime
+from openpyxl import Workbook
+from unitls.LogerinTxt import app_logger
+from unitls.StaticDataclass import get_dic
+from unitls.baseFunction import TuplefindInList1
+from .flightDB import flightDB
+from .getSortFlightdata import getSortFlightdata
+
+
+def bakupdata(fdb :flightDB):
+    try:
+        # print("5分钟间隔自动备份")
+        nowDay = str(datetime.date.today().strftime("%Y%m%d"))
+        nowDay_1 = str((datetime.date.today() - datetime.timedelta(days=1)).strftime("%Y%m%d"))
+        aaa ={nowDay :"今天" ,nowDay_1 :"昨天"}
+        tableWidgetDispalydatas ={}
+        wb = Workbook()
+        for selectedtime in [nowDay ,nowDay_1]:
+            wb.create_sheet(title="%s " %selectedtime, index=0)
+            ws = wb.active
+            ws.title = "%s " %selectedtime
+            ws= wb["%s " %selectedtime]
+            ws.cell(1, 1).value = "序号"
+            ws.cell(1, 2).value = "类型"
+            ws.cell(1, 3).value = "航班号"
+            ws.cell(1, 4).value = "机型"
+            ws.cell(1, 5).value = "发动机"
+            ws.cell(1, 6).value = "机号"
+            ws.cell(1, 7).value = "计达"
+            ws.cell(1, 8).value = "预达"
+            ws.cell(1, 9).value = "计飞"
+            ws.cell(1, 10).value = "机位"
+            ws.cell(1, 11).value = "放行"
+            ws.cell(1, 12).value = "工1"
+            ws.cell(1, 13).value = "工2"
+            ws.cell(1, 14).value = "工3"
+            ws.cell(1, 15).value = "工4"
+            ws.cell(1, 16).value = "工5"
+            ws.cell(1, 17).value = "送1"
+            ws.cell(1, 18).value = "送2"
+            ws.cell(1, 19).value = "备注"
+            ws.cell(1, 20).value = "接机到位"
+            ws.cell(1, 21).value = "二送到位"
+            ws.cell(1, 22).value = "放行情况"
+            ws.cell(1, 23).value = "销子夹板"
+            tableWidgetDispalydata = {}
+            sorttable = getSortFlightdata(fdb, selectedtime, "sortFlight2")
+            nowDayStr = selectedtime
+            '''
+            col_dic = {"0": "序号", "1": "机号", "2": "机型", "3": "发动机", "4": "航班号", "5": "计达", "6": "预达", "7": "计飞", "8": "机位",
+                       "9": "类型", "10": "放行", "11": "勤务1", "12": "勤务2", "13": "工1", "14": "工2", "15": "工3", "16": "到位",
+                       "18": "放行","19": "销夹", "17": "二送", "20": "随机", "21": "随机到位", "22": "保留", "23": "工作包", "24": "返航备降", "25": "维修人员",
+                       "26": "二送人员", "27": "放行", "28": "航班编号", "29": "任务编号", "30": "TATD", "31": "类型","32":"附加消息"}
+
+            col_dic = {"0": "序号", "1": "机号", "2": "机型", "3": "发动机", "4": "航班号", "5": "计达", "6": "预达", "7": "计飞", "8": "机位",
+                       "9": "类型", "10": "放行", "11": "勤务1", "12": "勤务2", "13": "工1", "14": "工2", "15": "工3", "16": "到位",
+                       "18": "放行","19": "销夹", "17": "二送","20":"附加消息","21": "送机1", "22": "送机2"}
+            '''
+            rowNum = 0
+
+            datas = fdb.queryTabel('TaskFlightinfo{}'.format(nowDayStr), '*', "航班编号!=''")
+            taskType = get_dic('taskType')
+            
+            for row in sorttable:
+                TaskFlightinfo=TuplefindInList1(datas,row[1],0)[0]
+                flightstsdata = fdb.queryTabel('flightsts{}'.format(nowDayStr), '*', "航班编号='{}'".format(row[1]))[0] if len \
+                    (fdb.queryTabel('flightsts{}'.format(nowDayStr), '*', "航班编号='{}'".format(row[1]))) != 0 else ["", ""
+                                                                                                                 ,"", "", "" ,"", "", ""
+                                                                                                                 ,"", "", "" ,"", "", ""]
+                jjdw = "√" if flightstsdata[3] != "" else ""
+                FX = "√" if flightstsdata[4] != "" else ""
+                XJ = "√" if flightstsdata[5] != "" else ""
+                ESDW = "√" if flightstsdata[7] != "" else ""
+
+                flighttype =taskType[TaskFlightinfo[3]] if "3U" in str(TaskFlightinfo[21]) or "CSC"  in str(TaskFlightinfo[21]) else "外 " +str(taskType[TaskFlightinfo[3]])
+
+                if TaskFlightinfo[4] != "" and (TaskFlightinfo[8] == "" or TaskFlightinfo[30] == ""):  # 如果sta不为空,且eta或flying为空,显示sta
+                    a = TaskFlightinfo[4][-8:-3].replace(":","")
+                else:
+                    a = ""
+                if TaskFlightinfo[6] != "":  # 当ata不为空显示ata,eta不为空显示eta否则为空
+                    b = TaskFlightinfo[6][-8:-3].replace(":","")
+                elif TaskFlightinfo[8] != "":
+                    b = TaskFlightinfo[8][-8:-3].replace(":","")
+                else:
+                    b = ''
+                if TaskFlightinfo[7] != "":
+                    c =TaskFlightinfo[7][-8:-3].replace(":","")
+                elif TaskFlightinfo[5] != "":
+                    c =TaskFlightinfo[5][-8:-3].replace(":","")
+                else:
+                    c = ''
+
+                fx = ""
+                g1 = ""
+                g2 = ""
+                g3 = ""
+                g4 = ""
+                g5 = ""
+                fj1 = ""
+                s1 = ""
+                s2 = ""
+                fj2 = ""
+                fj =""
+                peopleSchedules = fdb.queryTabel('peopleSchedule{}'.format(nowDayStr), '*',
+                                                 "航班编号='{}'".format(row[1])) if \
+                    len(fdb.queryTabel('peopleSchedule{}'.format(nowDayStr), '*',
+                                       "航班编号='{}'".format(row[1]))) != 0 else [
+                    ("000", "", "", "", "", "", "", "", "", "")]
+                # print(peopleSchedules)
+                for i in peopleSchedules:
+                    if i[0][-3] == "1":
+                        fx = i[3]
+                        g1 = i[4]
+                        g2 = i[5]
+                        g3 = i[6]
+                        g4 = i[7]
+                        g5 = i[8]
+                        fj1 = i[9]
+                    elif i[0][-3] == "2":
+                        s1 = i[7]
+                        s2 = i[8]
+                        fj2 = i[9]
+                    fj = fj1 + fj2
+
+                if taskType[TaskFlightinfo[3]] == "航后":
+                    ws.cell(rowNum + 2, 1).value = rowNum + 1
+                    ws.cell(rowNum + 2, 2).value = flighttype
+                    ws.cell(rowNum + 2, 3).value = TaskFlightinfo[21]
+                    ws.cell(rowNum + 2, 4).value = TaskFlightinfo[26]
+                    ws.cell(rowNum + 2, 5).value = TaskFlightinfo[25]
+                    ws.cell(rowNum + 2, 6).value = TaskFlightinfo[1]
+                    ws.cell(rowNum + 2, 7).value = a
+                    ws.cell(rowNum + 2, 8).value = b
+                    ws.cell(rowNum + 2, 9).value = ""
+                    ws.cell(rowNum + 2, 10).value = TaskFlightinfo[10]
+                    ws.cell(rowNum + 2, 11).value = fx
+                    ws.cell(rowNum + 2, 12).value = g1
+                    ws.cell(rowNum + 2, 13).value = g2
+                    ws.cell(rowNum + 2, 14).value = g3
+                    ws.cell(rowNum + 2, 15).value = g4
+                    ws.cell(rowNum + 2, 16).value = g5
+                    ws.cell(rowNum + 2, 17).value = s1
+                    ws.cell(rowNum + 2, 18).value = s2
+                    ws.cell(rowNum + 2, 19).value = fj
+                    ws.cell(rowNum + 2, 20).value = jjdw
+                    ws.cell(rowNum + 2, 21).value = ""
+                    ws.cell(rowNum + 2, 22).value = ""
+                    ws.cell(rowNum + 2, 23).value = ""
+                    rowNum += 1
+                elif taskType[TaskFlightinfo[3]] == "停场":
+                    ws.cell(rowNum + 2, 1).value = rowNum + 1
+                    ws.cell(rowNum + 2, 2).value = flighttype
+                    ws.cell(rowNum + 2, 3).value = ""
+                    ws.cell(rowNum + 2, 4).value = TaskFlightinfo[26]
+                    ws.cell(rowNum + 2, 5).value = TaskFlightinfo[25]
+                    ws.cell(rowNum + 2, 6).value = TaskFlightinfo[1]
+                    ws.cell(rowNum + 2, 7).value = ""
+                    ws.cell(rowNum + 2, 8).value = ""
+                    ws.cell(rowNum + 2, 9).value = ""
+                    ws.cell(rowNum + 2, 10).value = TaskFlightinfo[10]
+                    ws.cell(rowNum + 2, 11).value = fx
+                    ws.cell(rowNum + 2, 12).value = g1
+                    ws.cell(rowNum + 2, 13).value = g2
+                    ws.cell(rowNum + 2, 14).value = g3
+                    ws.cell(rowNum + 2, 15).value = g4
+                    ws.cell(rowNum + 2, 16).value = g5
+                    ws.cell(rowNum + 2, 17).value = s1
+                    ws.cell(rowNum + 2, 18).value = s2
+                    ws.cell(rowNum + 2, 19).value = fj
+                    ws.cell(rowNum + 2, 20).value = ""
+                    ws.cell(rowNum + 2, 21).value = ""
+                    ws.cell(rowNum + 2, 22).value = ""
+                    ws.cell(rowNum + 2, 23).value = ""
+                    rowNum += 1
+                elif taskType[TaskFlightinfo[3]] == "航前":
+                    ws.cell(rowNum + 2, 1).value = rowNum + 1
+                    ws.cell(rowNum + 2, 2).value = flighttype
+                    ws.cell(rowNum + 2, 3).value = TaskFlightinfo[21]
+                    ws.cell(rowNum + 2, 4).value = TaskFlightinfo[26]
+                    ws.cell(rowNum + 2, 5).value = TaskFlightinfo[25]
+                    ws.cell(rowNum + 2, 6).value = TaskFlightinfo[1]
+                    ws.cell(rowNum + 2, 7).value = ""
+                    ws.cell(rowNum + 2, 8).value = ""
+                    ws.cell(rowNum + 2, 9).value = c
+                    ws.cell(rowNum + 2, 10).value = TaskFlightinfo[11]
+                    ws.cell(rowNum + 2, 11).value = fx
+                    ws.cell(rowNum + 2, 12).value = g1
+                    ws.cell(rowNum + 2, 13).value = g2
+                    ws.cell(rowNum + 2, 14).value = g3
+                    ws.cell(rowNum + 2, 15).value = g4
+                    ws.cell(rowNum + 2, 16).value = g5
+                    ws.cell(rowNum + 2, 17).value = s1
+                    ws.cell(rowNum + 2, 18).value = s2
+                    ws.cell(rowNum + 2, 19).value = fj
+                    ws.cell(rowNum + 2, 20).value = jjdw
+                    ws.cell(rowNum + 2, 21).value = ""
+                    ws.cell(rowNum + 2, 22).value = FX
+                    ws.cell(rowNum + 2, 23).value = XJ
+                    rowNum += 1
+                elif row[3] == "短停接":
+                    ws.cell(rowNum + 2, 1).value = rowNum + 1
+                    ws.cell(rowNum + 2, 2).value = flighttype
+                    ws.cell(rowNum + 2, 3).value = TaskFlightinfo[21]
+                    ws.cell(rowNum + 2, 4).value = TaskFlightinfo[26]
+                    ws.cell(rowNum + 2, 5).value = TaskFlightinfo[25]
+                    ws.cell(rowNum + 2, 6).value = TaskFlightinfo[1]
+                    ws.cell(rowNum + 2, 7).value = a
+                    ws.cell(rowNum + 2, 8).value = b
+                    ws.cell(rowNum + 2, 9).value = c
+                    ws.cell(rowNum + 2, 10).value = TaskFlightinfo[10]
+                    ws.cell(rowNum + 2, 11).value = fx
+                    ws.cell(rowNum + 2, 12).value = g1
+                    ws.cell(rowNum + 2, 13).value = g2
+                    ws.cell(rowNum + 2, 14).value = g3
+                    ws.cell(rowNum + 2, 15).value = g4
+                    ws.cell(rowNum + 2, 16).value = g5
+                    ws.cell(rowNum + 2, 17).value = s1
+                    ws.cell(rowNum + 2, 18).value = s2
+                    ws.cell(rowNum + 2, 19).value = fj
+                    ws.cell(rowNum + 2, 20).value = jjdw
+                    ws.cell(rowNum + 2, 21).value = ESDW
+                    ws.cell(rowNum + 2, 22).value = FX
+                    ws.cell(rowNum + 2, 23).value = ""
+                    rowNum += 1
+                elif row[3] == "特后前接":
+                    ws.cell(rowNum + 2, 1).value = rowNum + 1
+                    ws.cell(rowNum + 2, 2).value = flighttype
+                    ws.cell(rowNum + 2, 3).value = TaskFlightinfo[21]
+                    ws.cell(rowNum + 2, 4).value = TaskFlightinfo[26]
+                    ws.cell(rowNum + 2, 5).value = TaskFlightinfo[25]
+                    ws.cell(rowNum + 2, 6).value = TaskFlightinfo[1]
+                    ws.cell(rowNum + 2, 7).value = a
+                    ws.cell(rowNum + 2, 8).value = b
+                    ws.cell(rowNum + 2, 9).value = c
+                    ws.cell(rowNum + 2, 10).value = TaskFlightinfo[10]
+                    ws.cell(rowNum + 2, 11).value = fx
+                    ws.cell(rowNum + 2, 12).value = g1
+                    ws.cell(rowNum + 2, 13).value = g2
+                    ws.cell(rowNum + 2, 14).value = g3
+                    ws.cell(rowNum + 2, 15).value = g4
+                    ws.cell(rowNum + 2, 16).value = g5
+                    ws.cell(rowNum + 2, 17).value = s1
+                    ws.cell(rowNum + 2, 18).value = s2
+                    ws.cell(rowNum + 2, 19).value = fj
+                    ws.cell(rowNum + 2, 20).value = jjdw
+                    ws.cell(rowNum + 2, 20).value = jjdw
+                    ws.cell(rowNum + 2, 21).value = ESDW
+                    ws.cell(rowNum + 2, 22).value = FX
+                    ws.cell(rowNum + 2, 23).value = ""
+                    rowNum += 1
+        wb.save('D:/flightinfo/bakup/航班运行备份数据(勿动).xlsx')
+        # wb.save('航班运行备份数据.xlsx')
+        res = "ok"
+        return res
+    except Exception as e:
+        app_logger.log_error(e)

+ 23 - 0
Functions/DButilsFunction/calledChecked.py

@@ -0,0 +1,23 @@
+import datetime
+
+from unitls.LogerinTxt import app_logger
+from .flightDB import flightDB
+
+
+def calledChecked(fdb: flightDB):
+    try:
+        now=datetime.datetime.now()
+        now_5 = now - datetime.timedelta(minutes=8)
+        callist = fdb.queryTabel("Calllist", "*", "接通时间 ='' and (创建时间<'%s' or CAST(拨号次数 AS integer)>3)"%now_5)
+        if len(callist) != 0:
+            for i in callist:
+                if len(fdb.queryTabel("logs", "航班编号", "航班编号 ='%s' and 处理时间=''"%i[0])) == 0:
+                    newdic = {"航班编号": "%s" %i[0], "警告信息": "%s %s超过自动联系超过8min或连续拨号超过3次无响应,请人工处理!!"%(i[4],i[3]), "信息状态": "", "提示信息": "",
+                              "产生时间": "%s" % now, "处理人": "", "处理时间": "", "变更字段": "无法联系", "显示对象": "", "提示内容": ""}
+                    fdb.lazyInsertData('logs', newdic)
+                newdic1={"接通时间":"'%s推送人工处理'"%now}
+                fdb.lazyUpdateItem("Calllist",newdic1,"航班编号='%s'"%i[0])
+            fdb.FunctionCommit()
+    except Exception as e:
+        fdb.FunctionCommit()
+        app_logger.log_error(e)

+ 20 - 0
Functions/DButilsFunction/callon.py

@@ -0,0 +1,20 @@
+import datetime
+
+from unitls.LogerinTxt import app_logger
+from .flightDB import flightDB
+
+
+def callon(fdb:flightDB,phonenum):
+    try:
+        now = datetime.datetime.now()
+        now1=datetime.datetime.now()- datetime.timedelta(seconds=5)
+        if phonenum !="" and phonenum !=None:
+            calllist = fdb.sort_queryTable2("航班编号", "Calllist", "电话 ='%s' and 接通时间 =''"%phonenum, "拨号次数", "ASC", "创建时间", "ASC")
+            if len(calllist) != 0:
+                lasttime = fdb.sort_queryTable("接通时间", "Calllist", "接通时间 !='' and 接通时间 not like '%人工%'", "接通时间", "desc")
+                #print("lasttime", lasttime[0][0])
+                if len(lasttime) == 0 or(len(lasttime) != 0 and now1 > datetime.datetime.strptime(lasttime[0][0][:19],"%Y-%m-%d %H:%M:%S")):
+                    newdic = {"接通时间": "'%s'" % now}
+                    fdb.upDateItem("Calllist", newdic, "航班编号='%s'" % calllist[0][0])
+    except Exception as e:
+        app_logger.log_error(e)

+ 38 - 0
Functions/DButilsFunction/calltry.py

@@ -0,0 +1,38 @@
+import datetime
+
+import requests
+
+from unitls.LogerinTxt import app_logger
+from .flightDB import flightDB
+
+
+def calltry(fdb:flightDB,ip,token):
+    try:
+        #print("calltry")
+        #print(ip,token)
+        calllist=fdb.sort_queryTable2("*","Calllist","接通时间 ='' and 拨号次数<4","拨号次数","ASC","创建时间","ASC")
+        if len(calllist) != 0:
+            phone_num=calllist[0][1]
+            calltime=int((fdb.queryTabel("Calllist","拨号次数","航班编号='%s'"%calllist[0][0]))[0][0])+1
+            newdic={"拨号次数":"%s"%calltime}
+            fdb.upDateItem("Calllist",newdic,"航班编号='%s'"%calllist[0][0])
+            try:
+                data = {"PHB_AutoDialNumber": phone_num,
+                        "ReturnPage": "/contacts.htm",
+                        "AutoDialSubmit": "submit",
+                        "PHB_AutoDialLine": "1"
+                        }
+                header = {
+                    "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9",
+                    "Connection": "keep-alive",
+                    "Cookie": token
+                }
+                requests.post(url="http://%s/contacts.htm" % ip, data=data, headers=header)
+                return phone_num
+            except Exception as e:
+                app_logger.log_error(e)
+                print(datetime.datetime.now(),"[数据中心]拨号失败")
+                return "fail"
+    except Exception as e:
+        app_logger.log_error(e)
+        return "fail"

+ 11 - 0
Functions/DButilsFunction/changepassword.py

@@ -0,0 +1,11 @@
+from unitls.LogerinTxt import app_logger
+from .flightDB import flightDB
+
+
+def changepassword(loginTabledb:flightDB,user,old,new):
+    try:
+        newdic={"密码":"'%s'"%new}
+        loginTabledb.upDateItem("logintable",newdic,"登录名='%s' and 密码='%s'"%(user,old))
+        loginTabledb.close()
+    except Exception as e:
+        app_logger.log_error(e)

+ 31 - 0
Functions/DButilsFunction/checkCalllist.py

@@ -0,0 +1,31 @@
+import datetime
+
+from unitls.LogerinTxt import app_logger
+from .flightDB import flightDB
+
+
+def checkCalllist(fdb:flightDB,time):
+    try:
+        selectedtime_time = str(time) + " 00:00:00"
+        now = datetime.datetime.strptime(selectedtime_time, "%Y%m%d %H:%M:%S")
+        tom = (now + datetime.timedelta(days=2)).strftime("%Y-%m-%d %H:%M:%S")
+        yesterday = (now - datetime.timedelta(days=1)).strftime("%Y-%m-%d %H:%M:%S")
+        calllists=fdb.sort_queryTable2("*","Calllist","创建时间 <'%s' and 创建时间 >'%s'"%(tom,yesterday),"创建时间","desc","接通时间","desc")
+        num = 0
+        res = {}
+        if len(calllists) != 0:
+            for i in calllists:
+                calllist={}
+                calllist["序号"]=num
+                calllist["电话"] = i[1]
+                calllist["工号"] = i[2]
+                calllist["姓名"] = i[3]
+                calllist["航班号"] = i[4]
+                calllist["拨号次数"] = str(i[6])
+                calllist["创建时间"] = i[7]
+                calllist["接通时间"] = i[8]
+                res[num] = calllist
+                num += 1
+        return res
+    except Exception as e:
+        app_logger.log_error(e)

+ 482 - 0
Functions/DButilsFunction/checkFlightAlert.py

@@ -0,0 +1,482 @@
+import datetime
+
+import unitls.baseFunction as baseFunction
+from unitls.LogerinTxt import app_logger
+from unitls.StaticDataclass import get_dic
+from unitls.settings import MesgTime
+from .flightDB import flightDB
+
+APZBZ, JJZBZ, ESZBZ, APGR, JJGR, ESGR,APPG,JJPG,ESPG=MesgTime()
+
+def WarningInsert(database, taskid, mesg, types):
+    newdic = {"航班编号": "%s" % taskid, "警告信息": mesg, "信息状态": "",
+              "提示信息": "", "产生时间": "%s" % datetime.datetime.now(), "处理人": "", "处理时间": "", "变更字段": types, "显示对象": "", "提示内容": ""}
+    database.lazyInsertData('logs', newdic)
+
+def noteInsert(database, taskid, mesg, types):
+    newdic = {"航班编号": "%s" % taskid, "警告信息": '', "信息状态": "",
+              "提示信息": mesg, "产生时间": "%s" % datetime.datetime.now(), "处理人": "", "处理时间": "", "变更字段": types, "显示对象": "", "提示内容": ""}
+    database.lazyInsertData('logs', newdic)
+
+def judgeFunction(datas,key,numb): #numb 警告时间间隔
+        now=datetime.datetime.now()
+        time_str = baseFunction.TuplefindInList3(datas, key, 8, 5) #变更字段为key的最近的一次时间
+        if time_str == "":
+            time1 = now - datetime.timedelta(minutes=numb)
+        else:
+            time1 = datetime.datetime.strptime(time_str.split(".")[0], "%Y-%m-%d %H:%M:%S") + datetime.timedelta(minutes=numb)
+        if now > time1:
+            return True
+        else:
+            return False
+def getpeopleinfo(names,data,data1):
+    res = []
+    success = []
+    fail = []
+    names = names.replace("√","")
+    names_list = names.split(",")
+    for name in names_list:
+        worknum = baseFunction.TuplefindInList3(data, name, 0, 1) if data else ""
+        if worknum == "":
+            worknum=baseFunction.TuplefindInList3(data1, name, 0, 1)
+        if worknum != "":
+            res.append(worknum)
+            success.append(name)
+        else:
+            fail.append(name)
+    #int("success",success)
+    #print("fail",fail)
+    #print("res",res)
+    return {"success":success,"fail":fail,"worknums":res}
+def checkFlightAlert(database:flightDB, singlePeopleNotice):
+    try:
+        nowDay = datetime.datetime.now().strftime("%Y%m%d")
+        nowDay_1 = (datetime.date.today() - datetime.timedelta(days=1)).strftime("%Y%m%d")
+        nowDay_2 = (datetime.date.today() + datetime.timedelta(days=1)).strftime("%Y%m%d")
+
+        now = datetime.datetime.now()
+        now_20=(datetime.datetime.now()+ datetime.timedelta(minutes=120)).strftime("%Y%m%d")
+        if now_20 == nowDay:
+            day=[nowDay,nowDay_1]
+        else:
+            day = [nowDay,nowDay_1,nowDay_2]
+        for nowDayStr in day:
+            flightcheck=database.queryTabel("sortFlight{}".format(nowDayStr),"航班编号","CAST(级别 AS integer) = 1" )
+            flightcheck2 = database.queryTabel("sortFlight{}".format(nowDayStr), "航班编号", "CAST(级别 AS integer) != 4")
+            datas=database.queryTabel("TaskFlightinfo{}".format(nowDayStr),"*","航班编号 !=''")
+            flightsts=database.queryTabel("flightsts{}".format(nowDayStr),"*","航班编号 !=''")
+            logs=database.queryTabel("logs","*","处理时间= '' and 警告信息 !=''")
+            logsall=database.queryTabel("logs","*","警告信息 !=''")
+            logsall1=database.sort_queryTable("*","logs", "提示信息 !=''", "产生时间", "desc")  #所有提示信息
+            peopleschedule=database.queryTabel("peopleSchedule{}".format(nowDayStr),"*","航班编号 !=''")
+            peoplesinfo_today=database.queryTabel("pglist{}".format(nowDay),"*","姓名!=''")
+            peoplesinfo_yes=database.queryTabel("pglist{}".format(nowDay_1),"*","姓名!=''")
+
+            if datas and flightcheck:
+                for i in flightcheck:
+                    data=baseFunction.TuplefindInList1(datas, i[0], 0)
+                    if data and data[0][3] != "停场":
+                        a = data[0][1]
+                        b = get_dic("taskType")[data[0][3]]
+                        std=data[0][5]
+                        singlelogs=baseFunction.TuplefindInList33(logs,i[0],1,8)#未处理的警告信息
+
+                        singlelogstext=baseFunction.TuplefindInList33(logs,i[0],1,2)#未处理的警告信息
+                        singlelogsall=baseFunction.TuplefindInList33(logsall, i[0], 1, 2) #所有警告信息
+                        singlelogsall1=baseFunction.TuplefindInList11(logsall1, i[0], 1) #所有和这个id相关的提示信息
+                        jjdw=baseFunction.TuplefindInList3(flightsts,i[0],0,3)
+                        fx=baseFunction.TuplefindInList3(flightsts,i[0],0,4)
+                        eta=data[0][8]
+                        flying=data[0][30]
+                        BAY_A=data[0][10]#进港机位
+                        wxry=data[0][12]
+                        fxry=data[0][13]
+                        ecsj=data[0][19]
+                        fj=baseFunction.TuplefindInList3(peopleschedule, i[0], 1, 9)
+                        #航前90min 检查到位情况,推送准备组,推送个人没2min,直到点击到位
+                        #起飞前40min 检查放行情况,推送个人,3min间隔,起飞前30min推送准备组,直到放行点击
+                        #起飞前50min 检查销子夹板取下情况,推送个人,3min间隔,起飞前40min推送准备组,直到上报销子夹板
+                        if b == "航前":
+                            c = baseFunction.TuplefindInList3(datas, i[0], 0, 11)
+                        else:
+                            c = baseFunction.TuplefindInList3(datas, i[0], 0, 10)
+                        try:
+                            if b == "航前" and std != "":
+                                STD_90 = datetime.datetime.strptime(std, "%Y-%m-%d %H:%M:%S") - datetime.timedelta(minutes=90)
+                                STD_50 = datetime.datetime.strptime(std, "%Y-%m-%d %H:%M:%S") - datetime.timedelta(minutes=50)
+                                STD_40 = datetime.datetime.strptime(std, "%Y-%m-%d %H:%M:%S") - datetime.timedelta(minutes=40)
+                                STD_30 = datetime.datetime.strptime(std, "%Y-%m-%d %H:%M:%S") - datetime.timedelta(minutes=30)
+                                if STD_90 < now and "已到位" not in str(jjdw) and "到位警告" not in str(singlelogs):
+                                    WarningInsert(database,i[0],"请确认%s/%s/%s到位情况!"%(a,b,c),"到位警告")
+                                if STD_90 < now and "已到位" not in str(jjdw) and judgeFunction(singlelogsall1,"到位个人提示推送",2) and singlePeopleNotice and "【交班航班】" not in fj:
+                                    print(datetime.datetime.now(),"航前推送个人到位信息")  ###要加维修人员是否为空
+                                    getpeopleinfo(wxry,peoplesinfo_today,peoplesinfo_yes)
+                                    noteInsert(database,i[0],"%s/%s/%s航前推送个人到位信息"%(a,b,c),"到位个人提示推送")
+
+                                if STD_30 < now and "已放行" not in str(fx) and "放行警告" not in str(singlelogs):
+                                    WarningInsert(database,i[0],"请确认%s/%s/%s放行情况!"%(a,b,c),"放行警告")
+                                if STD_40 < now and "已放行" not in str(fx) and judgeFunction(singlelogsall1,"放行个人提示推送",3) and singlePeopleNotice and "【交班航班】" not in fj:
+                                    print(datetime.datetime.now(),"航前推送放行确认信息")
+                                    getpeopleinfo(fxry, peoplesinfo_today, peoplesinfo_yes)
+                                    noteInsert(database,i[0],"%s/%s/%s航前推送放行确认信息"%(a,b,c),"放行个人提示推送")
+
+                                if STD_40 < now and "已取下" not in str(baseFunction.TuplefindInList3(flightsts,i[0],0,5)) and "销夹警告" not in str(singlelogs):
+                                    WarningInsert(database,i[0],"请确认%s/%s/%s销夹取下情况!"%(a,b,c), "销夹警告")
+                                if STD_50 < now and "已取下" not in str(baseFunction.TuplefindInList3(flightsts,i[0],0,5)) and judgeFunction(singlelogsall1,"销夹个人提示推送",3) and singlePeopleNotice and "【交班航班】" not in fj:
+                                    print(datetime.datetime.now(),"航前推送销夹取下信息")
+                                    noteInsert(database,i[0],"%s/%s/%s航前推送销夹取下信息"%(a,b,c),"销夹个人提示推送")
+                            # 航后15min 检查到位情况,推送准备组,推送个人每2min,直到点击到位
+                            elif b == "航后" and eta != "" and flying != "":
+                                ETA_15_str = eta
+                                ETA_15 = datetime.datetime.strptime(ETA_15_str, "%Y-%m-%d %H:%M:%S") - datetime.timedelta(minutes= 15)
+                                ETA_40 = datetime.datetime.strptime(ETA_15_str, "%Y-%m-%d %H:%M:%S") - datetime.timedelta(minutes= 55)
+                                ETA = datetime.datetime.strptime(eta, "%Y-%m-%d %H:%M:%S")
+                                NXTSTD = datetime.datetime.strptime(data[0][32], "%Y-%m-%d %H:%M:%S") if data[0][32] != "" else ""
+                                if NXTSTD != "" and abs((NXTSTD-ETA).total_seconds()) < 3 * 3600 and "特后前保障提示" not in str(singlelogsall):
+                                    WarningInsert(database, i[0], "%s/%s/%s预计落地和预计起飞时间相差小于3H,请结合手册判断是否符合特后前签署条件,如需签署特后前注意通报72!"%(a, b, c), "特后前保障提示")
+
+                                if ETA_15 < now and "已到位" not in str(jjdw) and "到位警告" not in str(singlelogs):
+                                    WarningInsert(database, i[0], "请确认%s/%s/%s到位情况!"%(a, b, c), "到位警告")
+                                if ETA_15 < now and "已到位" not in str(jjdw) and judgeFunction(singlelogsall1,"到位个人提示推送",2) and singlePeopleNotice and "【交班航班】" not in fj:
+                                    print(datetime.datetime.now(),"航后推送个人到位信息")
+                                    getpeopleinfo(wxry,peoplesinfo_today,peoplesinfo_yes)
+                                    noteInsert(database,i[0],"%s/%s/%s航后推送个人到位信息"%(a,b,c),"到位个人提示推送")
+
+                                if ETA_40 < now and BAY_A == "" and "机位未出提醒" not in str(singlelogsall):
+                                    WarningInsert(database,i[0],"[机位未出提醒]请确认%s/%s机位情况!"%(a,b),"机位警告")
+                                elif BAY_A != "" and "机位未出提醒" in str(singlelogstext):
+                                    mesg="[机位未出提醒]请确认%s/%s机位情况!"%(a,b)
+                                    newdic = {"处理人": "'系统确认状态'", "处理时间": "'%s'" % now}
+                                    database.lazyUpdateItem('logs', newdic, "航班编号='%s' and 警告信息='%s'" % (i[0],mesg))
+
+                            # 短停15min 检查到位情况,推送准备组,推送个人每2min,直到点击到位
+                            # 短停落地30min,且满足距离起飞时间小于50min检查放行情况,推送个人,3min间隔,落地30min,且满足距离起飞时间小于40min,推送准备组,直到点击放行
+                            # 短停落地25min,且满足距离起飞时间小于25min,推送个人,2min间隔,落地30min,且满足距离起飞时间小于25min,推送准备组,直到点击二送到位
+
+                            elif b == "短停" and eta != "" and flying != "" and std != "":
+                                ETA_15_str=eta
+                                ETA_15 = datetime.datetime.strptime(ETA_15_str, "%Y-%m-%d %H:%M:%S") - datetime.timedelta(minutes=15)
+                                ETA_40 = datetime.datetime.strptime(ETA_15_str, "%Y-%m-%d %H:%M:%S") - datetime.timedelta(minutes=55)
+                                ATA = baseFunction.TuplefindInList3(datas, i[0], 0, 6)
+                                if ATA != "":
+                                    ATA_time_25 = datetime.datetime.strptime(ATA, "%Y-%m-%d %H:%M:%S") + datetime.timedelta(minutes=25)
+                                    ATA_time_30 = datetime.datetime.strptime(ATA, "%Y-%m-%d %H:%M:%S") + datetime.timedelta(minutes=30)
+                                    ATA_time_3H = datetime.datetime.strptime(ATA, "%Y-%m-%d %H:%M:%S")+datetime.timedelta(minutes=180)
+                                else:
+                                    ATA_time_30 = ""
+                                    ATA_time_25 = ""
+                                    ATA_time_3H = ""
+                                TD = std
+                                TD_time_50 = datetime.datetime.strptime(TD, "%Y-%m-%d %H:%M:%S")- datetime.timedelta(minutes=50)
+                                TD_time_40 = datetime.datetime.strptime(TD, "%Y-%m-%d %H:%M:%S")- datetime.timedelta(minutes=40)
+                                TD_time_25 = datetime.datetime.strptime(TD, "%Y-%m-%d %H:%M:%S")- datetime.timedelta(minutes=25)
+                                TD_time_120 = datetime.datetime.strptime(TD, "%Y-%m-%d %H:%M:%S") - datetime.timedelta(minutes=120)
+                                TD_time = datetime.datetime.strptime(TD, "%Y-%m-%d %H:%M:%S")
+                                if ETA_15 < now and "已到位" not in str(jjdw) and  "到位警告" not in str(singlelogs):
+                                    WarningInsert(database,i[0],"请确认%s/%s/%s到位情况!"%(a,b,c),"到位警告")
+                                if ETA_15 < now and "已到位" not in str(jjdw) and judgeFunction(singlelogsall1,"到位个人提示推送",2) and singlePeopleNotice and "【交班航班】" not in fj:
+                                    print(datetime.datetime.now(),"短停推送个人到位信息")
+                                    getpeopleinfo(wxry,peoplesinfo_today,peoplesinfo_yes)
+                                    noteInsert(database,i[0],"%s/%s/%s短停推送个人到位信息"%(a,b,c),"到位个人提示推送")
+
+
+                                if ATA_time_30 != "" and ATA_time_30 < now and TD_time_40 < now and "已放行" not in str(fx) and "放行警告" not in str(singlelogs):
+                                    WarningInsert(database,i[0],"请确认%s/%s/%s放行情况!"%(a,b,c), "放行警告")
+                                if ATA_time_30 != "" and ATA_time_30 < now and TD_time_50 < now and "已放行" not in str(fx) and judgeFunction(singlelogsall1,"放行个人提示推送",3) and singlePeopleNotice and "【交班航班】" not in fj:
+                                    print(datetime.datetime.now(),"短停放行个人提示推送")
+                                    getpeopleinfo(fxry,peoplesinfo_today,peoplesinfo_yes)
+                                    noteInsert(database,i[0],"%s/%s/%s短停放行个人提示推送"%(a,b,c),"放行个人提示推送")
+
+                                if ATA_time_30 != "" and ATA_time_30 < now and TD_time_25 < now and "已到位" not in str(baseFunction.TuplefindInList3(flightsts,i[0],0,7)) and "二送警告" not in str(singlelogs):
+                                    WarningInsert(database,i[0],"请确认%s/%s/%s二送到位情况!"%(a,b,c), "二送警告")
+                                if ATA_time_25 != "" and ATA_time_25 < now and TD_time_25 < now and "已到位" not in str(baseFunction.TuplefindInList3(flightsts,i[0],0,7)) and judgeFunction(singlelogsall1,"二送到位个人提示推送",2) and singlePeopleNotice and "【交班航班】" not in fj:
+                                    print(datetime.datetime.now(),"短停二送到位个人提示推送")
+                                    getpeopleinfo(ecsj,peoplesinfo_today,peoplesinfo_yes)
+                                    noteInsert(database,i[0],"%s/%s/%s短停二送到位个人提示推送"%(a,b,c),"二送到位个人提示推送")
+
+                                if ATA_time_3H !="" and ATA_time_3H < TD_time and TD_time_120 < now and "长短停到位提示" not in str(baseFunction.TuplefindInList33(logsall, i[0], 1, 8)):
+                                    WarningInsert(database,i[0],"请确认安排%s/%s/%s长短停上电人员!" % (a, b, c),"长短停到位提示")
+                                if ATA_time_3H !="" and ATA_time_3H < TD_time and "长短停值守提示" not in str(baseFunction.TuplefindInList33(logsall, i[0], 1, 8)):
+                                    WarningInsert(database,i[0],"请注意安排%s %s长短停值守,如无需则忽略!" % (a,c),"长短停值守提示")
+                                if ETA_40 < now and BAY_A == "" and "机位未出提醒" not in str(singlelogsall):
+                                    WarningInsert(database,i[0],"[机位未出提醒]请确认%s/%s机位情况!"%(a,b),"机位警告")
+                                elif BAY_A != "" and "机位未出提醒" in str(singlelogstext):
+                                    mesg="[机位未出提醒]请确认%s/%s机位情况!"%(a,b)
+                                    newdic = {"处理人": "'系统确认状态'", "处理时间": "'%s'" % now}
+                                    database.lazyUpdateItem('logs', newdic, "航班编号='%s' and 警告信息='%s'" % (i[0],mesg))
+
+                            # 特后前15min 检查到位情况,推送准备组,推送个人每2min,直到点击到位
+                            # 特后前落地30min,且满足距离起飞时间小于50min检查放行情况,推送个人,3min间隔,落地30min,且满足距离起飞时间小于40min,推送准备组,直到点击放行
+                            # 特后前落地25min,且满足距离起飞时间小于25min,推送个人,2min间隔,落地30min,且满足距离起飞时间小于25min,推送准备组,直到点击二送到位
+
+                            elif b!="短停" and b!="航后" and b!="航前" and b!="未显示" and  eta != ""and std != "":
+                                ETA_15_str =  eta
+                                ETA_15 = datetime.datetime.strptime(ETA_15_str, "%Y-%m-%d %H:%M:%S") - datetime.timedelta(minutes = 15)
+                                ETA_40 = datetime.datetime.strptime(ETA_15_str, "%Y-%m-%d %H:%M:%S") - datetime.timedelta(minutes = 55)
+                                ATA =  baseFunction.TuplefindInList3(datas, i[0], 0, 6)
+
+                                if ATA!= "":
+                                    ATA_time_25 = datetime.datetime.strptime(ATA, "%Y-%m-%d %H:%M:%S") + datetime.timedelta(minutes=25)
+                                    ATA_time_30 = datetime.datetime.strptime(ATA, "%Y-%m-%d %H:%M:%S") + datetime.timedelta(minutes=30)
+                                else:
+                                    ATA_time_25=""
+                                    ATA_time_30 = ""
+                                TD =  std
+                                TD_time_50 = datetime.datetime.strptime(TD, "%Y-%m-%d %H:%M:%S")- datetime.timedelta(minutes=50)
+                                TD_time_40 = datetime.datetime.strptime(TD, "%Y-%m-%d %H:%M:%S")  - datetime.timedelta(minutes=40)
+                                TD_time_25 = datetime.datetime.strptime(TD, "%Y-%m-%d %H:%M:%S")  - datetime.timedelta(minutes=25)
+
+                                if ETA_15 < now and "已到位" not in str(jjdw) and "到位警告" not in str(singlelogs):
+                                    WarningInsert(database,i[0],"请确认%s/%s/%s到位情况!"%(a,b,c),"到位警告")
+                                if ETA_15 < now and "已到位" not in str(jjdw)  and judgeFunction(singlelogsall1,"到位个人提示推送",2) and singlePeopleNotice and "【交班航班】" not in fj:
+                                    print(datetime.datetime.now(),"短停推送个人到位信息")
+                                    getpeopleinfo(wxry,peoplesinfo_today,peoplesinfo_yes)
+                                    noteInsert(database,i[0],"%s/%s/%s短停推送个人到位信息"%(a,b,c),"到位个人提示推送")
+
+                                if ATA_time_30 != "" and ATA_time_30 < now and TD_time_40 < now and "已放行" not in str(fx) and  "放行警告" not in str(singlelogs):
+                                    WarningInsert(database,i[0],"请确认%s/%s/%s放行情况!"%(a,b,c),"放行警告")
+                                if ATA_time_30 != "" and ATA_time_30 < now and TD_time_50 < now and "已放行" not in str(fx) and judgeFunction(singlelogsall1,"放行个人提示推送",3) and singlePeopleNotice and "【交班航班】" not in fj:
+                                    print(datetime.datetime.now(),"短停放行个人提示推送")
+                                    getpeopleinfo(fxry,peoplesinfo_today,peoplesinfo_yes)
+                                    noteInsert(database,i[0],"%s/%s/%s短停放行个人提示推送"%(a,b,c),"放行个人提示推送")
+
+
+                                if ATA_time_30 != "" and ATA_time_30 < now and TD_time_25 < now and "已到位" not in str(baseFunction.TuplefindInList3(flightsts,i[0],0,7)) and  "二送警告" not in str(singlelogs):
+                                    WarningInsert(database,i[0],"请确认%s/%s/%s二送到位情况!"%(a,b,c), "二送警告")
+                                if ATA_time_25 != "" and ATA_time_25 < now and TD_time_25 < now and "已到位" not in str(baseFunction.TuplefindInList3(flightsts,i[0],0,7)) and judgeFunction(singlelogsall1,"二送到位个人提示推送",2) and singlePeopleNotice and "【交班航班】" not in fj:
+                                    print(datetime.datetime.now(),"短停二送到位个人提示推送")
+                                    getpeopleinfo(ecsj,peoplesinfo_today,peoplesinfo_yes)
+                                    noteInsert(database,i[0],"%s/%s/%s短停二送到位个人提示推送"%(a,b,c),"二送到位个人提示推送")
+
+                                if ETA_40 < now and BAY_A == "" and "机位未出提醒" not in str(singlelogsall):
+                                    WarningInsert(database,i[0],"[机位未出提醒]请确认%s/%s机位情况!"%(a,b),"机位警告")
+                                elif BAY_A != "" and "机位未出提醒" in str(singlelogstext):
+                                    mesg="[机位未出提醒]请确认%s/%s机位情况!"%(a,b)
+                                    newdic = {"处理人": "'系统确认状态'", "处理时间": "'%s'" % now}
+                                    database.lazyUpdateItem('logs', newdic, "航班编号='%s' and 警告信息='%s'" % (i[0],mesg))
+                        except Exception as e:
+                            app_logger.log_error(e)
+                            pass
+
+                        try:
+                            #航前 起飞前 100min,没有确认任务,推送准备组, 二送起飞前40min没有确认任务推送准备组  105 和 45 min  2min 个人推送一次?
+                            #短停 特后前 预计到达前40min没有确认任务推送准备组,短停特后前 预计起飞前40min没有确认任务推送准备组  45min 2min 个人推送一次?
+                            #航后 预计到达前40min没有确认任务推送准备组  45min 2min 个人推送一次?
+                            if b == "航前":
+                                bztime=datetime.datetime.strptime(std, "%Y-%m-%d %H:%M:%S")-datetime.timedelta(minutes=APZBZ)
+                                esbztime=datetime.datetime.strptime(std, "%Y-%m-%d %H:%M:%S")-datetime.timedelta(minutes=ESZBZ)
+                                bztztime=datetime.datetime.strptime(std, "%Y-%m-%d %H:%M:%S")-datetime.timedelta(minutes=APGR)
+                                estzbztime=datetime.datetime.strptime(std, "%Y-%m-%d %H:%M:%S")-datetime.timedelta(minutes=ESGR)
+                                pgtime = datetime.datetime.strptime(std, "%Y-%m-%d %H:%M:%S")-datetime.timedelta(minutes=APPG)
+                                espgtime = datetime.datetime.strptime(std, "%Y-%m-%d %H:%M:%S")-datetime.timedelta(minutes=ESPG)
+
+                            elif b == "短停" and std != '':
+                                bztime=datetime.datetime.strptime(eta, "%Y-%m-%d %H:%M:%S")-datetime.timedelta(minutes=JJZBZ)#40
+                                esbztime = datetime.datetime.strptime(std, "%Y-%m-%d %H:%M:%S") - datetime.timedelta(minutes=ESZBZ)#40
+                                bztztime=datetime.datetime.strptime(eta, "%Y-%m-%d %H:%M:%S")-datetime.timedelta(minutes=JJGR)
+                                estzbztime = datetime.datetime.strptime(std, "%Y-%m-%d %H:%M:%S") - datetime.timedelta(minutes=ESGR)#45通知
+                                pgtime = datetime.datetime.strptime(eta, "%Y-%m-%d %H:%M:%S")-datetime.timedelta(minutes=JJPG)
+                                espgtime=datetime.datetime.strptime(std, "%Y-%m-%d %H:%M:%S")-datetime.timedelta(minutes=ESPG)
+                            elif b == "特后前":
+                                bztime=datetime.datetime.strptime(eta, "%Y-%m-%d %H:%M:%S")-datetime.timedelta(minutes=JJZBZ)
+                                esbztime = datetime.datetime.strptime(std, "%Y-%m-%d %H:%M:%S") - datetime.timedelta(minutes=ESZBZ)
+                                bztztime=datetime.datetime.strptime(eta, "%Y-%m-%d %H:%M:%S")-datetime.timedelta(minutes=JJGR)
+                                estzbztime = datetime.datetime.strptime(std, "%Y-%m-%d %H:%M:%S") - datetime.timedelta(minutes=ESGR)
+                                pgtime = datetime.datetime.strptime(eta, "%Y-%m-%d %H:%M:%S")-datetime.timedelta(minutes=JJPG)
+                                espgtime=datetime.datetime.strptime(std, "%Y-%m-%d %H:%M:%S")-datetime.timedelta(minutes=ESPG)
+                            else:
+                                bztime=datetime.datetime.strptime(eta, "%Y-%m-%d %H:%M:%S")-datetime.timedelta(minutes=JJZBZ)
+                                esbztime=""
+                                bztztime=datetime.datetime.strptime(eta, "%Y-%m-%d %H:%M:%S")-datetime.timedelta(minutes=JJGR)
+                                estzbztime=""
+                                pgtime = datetime.datetime.strptime(eta, "%Y-%m-%d %H:%M:%S")-datetime.timedelta(minutes=JJPG)
+                                espgtime=""
+                        except Exception as e:
+                            app_logger.log_error(e)
+                            pass
+                        try:
+                            if (wxry != "" or fxry != "") and bztztime < now and judgeFunction(singlelogsall1,"航前或接机任务接送通知",2) and singlePeopleNotice and "【交班航班】" not in fj:
+                                peoples = ""
+                                res = wxry.split(",") + fxry.split(",")
+                                for l in res:
+                                    if "√" not in l:
+                                        peoples=peoples+","+l if peoples != "" else l
+
+                                if peoples != "":
+                                    getpeopleinfo(peoples,peoplesinfo_today,peoplesinfo_yes)
+                                    print(datetime.datetime.now(),"航前或接机任务接送通知")
+                                    noteInsert(database,i[0],"%s/%s/%s航前或接机任务接送通知"%(a,b,c),"航前或接机任务接送通知")
+                        except Exception as e:
+                            app_logger.log_error(e)
+                            pass
+                        try:
+
+                            if (wxry != "" or fxry != "") and bztime < now:
+                                res = wxry.split(",")+fxry.split(",")
+                                for l in res:
+                                    if "√" not in l:
+                                        mesg = "请确认%s/%s/%s/%s任务接收情况!" % (a, b, c, l)
+                                        if mesg not in str(singlelogsall):
+                                            WarningInsert(database, i[0], mesg, "任务接收监控")
+                                    else:
+                                        mesg = "请确认%s/%s/%s/%s任务接收情况!" % (a, b, c, l.replace("√",""))
+                                        if mesg in str(singlelogstext):
+                                            newdic = {"处理人": "'系统确认状态'", "处理时间": "'%s'" % now}
+                                            database.lazyUpdateItem('logs', newdic, "航班编号='%s' and 警告信息='%s'" % (i[0],mesg))
+                        except Exception as e:
+                            app_logger.log_error(e)
+                            pass
+
+                        try:
+
+                            if ecsj != "" and estzbztime != "" and estzbztime < now and judgeFunction(singlelogsall1,"航前或接机任务接送通知",2) and singlePeopleNotice and "【交班航班】" not in fj:
+                                peoples = ""
+                                res = ecsj.split(",")
+                                for l in res:
+                                    if "√" not in l:
+                                        peoples = peoples + "," + l if peoples != "" else l
+                                if peoples != "":
+                                    getpeopleinfo(peoples, peoplesinfo_today, peoplesinfo_yes)
+                                    print(datetime.datetime.now(), "二送任务接送通知")
+                                    noteInsert(database, i[0], "%s/%s/%s二送任务接送通知" % (a, b, c), "二送任务接送通知")
+                        except Exception as e:
+                            app_logger.log_error(e)
+                            pass
+                        try:
+                            if ecsj != "" and esbztime != "" and esbztime < now: #and "任务执行情况" not in str(singlelogsall):
+                                res = ecsj.split(",")
+                                for l in res:
+                                    if "√" not in l:
+                                        mesg = "请确认%s/%s/%s/%s二送任务接收情况!" % (a, b, c, l)
+                                        if mesg not in str(singlelogsall):
+                                            WarningInsert(database, i[0], mesg, "任务接收监控")
+                                    else:
+                                        mesg = "请确认%s/%s/%s/%s二送任务接收情况!" % (a, b, c, l.replace("√",""))
+                                        if mesg in str(singlelogstext):
+                                            newdic = {"处理人": "'系统确认状态'", "处理时间": "'%s'" % now}
+                                            database.lazyUpdateItem('logs', newdic, "航班编号='%s' and 警告信息='%s'" % (i[0],mesg))
+                        except Exception as e:
+                            app_logger.log_error(e)
+                            pass
+                        try:
+                            if "System" not in str(i[0]) and wxry == "" and pgtime < now:
+                                mesg = "请及时安排%s/%s/%s保障人员并派工!" % (a, b, c)
+                                if mesg not in str(singlelogsall):
+                                    WarningInsert(database, i[0], mesg, "任务安排监控")
+                            elif wxry != "":
+                                mesg = "请及时安排%s/%s/%s保障人员并派工!" % (a, b, c)
+                                if mesg in str(singlelogstext):
+                                    newdic = {"处理人": "'系统确认状态'", "处理时间": "'%s'" % now}
+                                    database.lazyUpdateItem('logs', newdic, "航班编号='%s' and 警告信息='%s'" % (i[0],mesg))
+                        except Exception as e:
+                            app_logger.log_error(e)
+                            pass
+                        try:
+                            if "System" not in str(i[0]) and fxry == "" and pgtime < now:
+                                mesg = "请及时安排%s/%s/%s放行人员并派工!" % (a, b, c)
+                                if mesg not in str(singlelogsall):
+                                    WarningInsert(database, i[0], mesg, "任务安排监控")
+                            elif fxry != "":
+                                mesg = "请及时安排%s/%s/%s放行人员并派工!" % (a, b, c)
+                                if mesg in str(singlelogstext):
+                                    newdic = {"处理人": "'系统确认状态'", "处理时间": "'%s'" % now}
+                                    database.lazyUpdateItem('logs', newdic, "航班编号='%s' and 警告信息='%s'" % (i[0],mesg))
+                        except Exception as e:
+                            app_logger.log_error(e)
+                            pass
+                        try:
+                            if "System" not in str(i[0]) and ecsj == "" and b != "航前" and espgtime != "" and espgtime < now:
+                                mesg = "请及时安排%s/%s/%s二送保障人员并派工!" % (a, b, c)
+                                if mesg not in str(singlelogsall):
+                                    WarningInsert(database, i[0], mesg, "任务安排监控")
+                            elif ecsj != "" and b != "航前" :
+                                mesg = "请及时安排%s/%s/%s二送保障人员并派工!" % (a, b, c)
+                                if mesg in str(singlelogstext):
+                                    newdic = {"处理人": "'系统确认状态'", "处理时间": "'%s'" % now}
+                                    database.lazyUpdateItem('logs', newdic, "航班编号='%s' and 警告信息='%s'" % (i[0],mesg))
+                        except Exception as e:
+                            app_logger.log_error(e)
+                            pass
+
+
+
+                for i in flightcheck2:
+                    data2 = baseFunction.TuplefindInList1(datas, i[0], 0)
+                    if data2 and data2[0][3] != "停场":
+                        a = data2[0][1]
+                        b = get_dic("taskType")[data2[0][3]]
+                        std= data2[0][5]
+                        fj=baseFunction.TuplefindInList3(peopleschedule, i[0], 1, 9)
+                        sjry_str = data2[0][15]
+                        flightno = data2[0][21]
+                        singlelogsall=baseFunction.TuplefindInList33(logsall, i[0], 1, 2) #所有警告信息
+                        singlelogs=baseFunction.TuplefindInList33(logs, i[0], 1, 2) #未确认所有警告信息
+                        sjdw=baseFunction.TuplefindInList3(flightsts, i[0], 0, 6)
+                        if b == "航前":
+                            c = data2[0][11]
+                        else:
+                            c = data2[0][10]
+                        try:
+                            if b=="航前" and std != "":
+                                STD = std
+                                STD_120 = datetime.datetime.strptime(STD, "%Y-%m-%d %H:%M:%S") - datetime.timedelta(minutes= 120)
+                                STD_60 = datetime.datetime.strptime(STD, "%Y-%m-%d %H:%M:%S") - datetime.timedelta(minutes= 60)
+
+                                if "随机离港" in str(fj) and "随机2H提醒" not in str(singlelogsall) and STD_120 < now:
+                                    sjry = sjry_str.split(" ")[1]
+                                    WarningInsert(database, i[0], "[随机2H提醒]%s/%s/%s/%s"% (a, flightno, c, sjry),"随机2H提醒")
+                                if "随机离港" in str(fj) and "随机到位确认" not in str(singlelogs) and STD_60 < now and "已到位" not in str(sjdw):
+                                    sjry = sjry_str.split("随机离港 ")[1]
+                                    WarningInsert(database, i[0], "[随机到位确认]%s/%s/%s/%s"% (a, flightno, c, sjry),"随机到位警告")
+
+                            elif b=="短停" and std != "":
+                                TD = std
+                                TD_time_120 = datetime.datetime.strptime(TD, "%Y-%m-%d %H:%M:%S") - datetime.timedelta(minutes=120)
+                                TD_time_60 = datetime.datetime.strptime(TD, "%Y-%m-%d %H:%M:%S") - datetime.timedelta(minutes=60)
+                                if "随机离港" in str(fj) and "随机2H提醒" not in str(singlelogsall) and TD_time_120 < now and sjry_str != "":
+                                    sjry = sjry_str.split(" ")[1]
+                                    WarningInsert(database,i[0],"[随机2H提醒]%s/%s/%s/%s"%(a,flightno,c,sjry),"随机2H提醒")
+                                if "随机离港" in str(fj) and "随机到位确认" not in str(singlelogs) and TD_time_60 < now and "已到位" not in str(sjdw):
+                                    sjry = sjry_str.split(" ")[1]
+                                    WarningInsert(database,i[0], "[随机到位确认]%s/%s/%s/%s"%(a,flightno,c,sjry),"随机到位警告")
+
+
+                            elif b != "短停" and b != "航后" and b != "航前" and b != "未显示" and b != "停场" :
+                                TD_time_120= datetime.datetime.strptime(std, "%Y-%m-%d %H:%M:%S") - datetime.timedelta(minutes=120)
+                                TD_time_60 = datetime.datetime.strptime(std, "%Y-%m-%d %H:%M:%S") - datetime.timedelta(minutes=60)
+                                if "随机离港" in str(fj) and "随机2H提醒" not in str(singlelogsall) and TD_time_120 < now:
+                                    sjry=sjry_str.split(" ")[1]
+                                    WarningInsert(database,i[0],"[随机2H提醒]%s/%s/%s/%s"%(a,flightno,c,sjry),"随机2H提醒")
+                                if "随机离港" in str(fj) and "随机到位确认" not in str(singlelogs) and TD_time_60 < now and "已到位" not in str(sjdw):
+                                    sjry=sjry_str.split("随机离港 ")[1]
+                                    WarningInsert(database,i[0],"[随机到位确认]%s/%s/%s/%s"%(a,flightno,c,sjry),"随机到位警告")
+                        except Exception as e:
+                            app_logger.log_error(e)
+                            pass
+
+                database.FunctionCommit()
+
+            waringIDs=database.queryTabel('logs',"*","变更字段 like '%警告%' and 处理时间 =''")
+            flightstsids=database.getSingledata("航班编号",'flightsts{}'.format(nowDayStr))
+            for waringID in waringIDs:
+                if str(waringID[1]) in str(flightstsids):
+                    waringIDstsNow=database.queryTabel('flightsts{}'.format(nowDayStr),"*","航班编号 ='%s'"%waringID[1])
+                    if waringID[8] == "到位警告" and waringIDstsNow[0][3] == "已到位":
+                        newdic = {"处理人": "'系统确认状态'", "处理时间": "'%s'" % now}
+                        database.lazyUpdateItem('logs', newdic, "编号='%s'" % waringID[0])
+                    if waringID[8] == "放行警告" and waringIDstsNow[0][4] == "已放行":
+                        newdic = {"处理人": "'系统确认状态'", "处理时间": "'%s'" % now}
+                        database.lazyUpdateItem('logs', newdic, "编号='%s'" % waringID[0])
+                    if waringID[8] == "二送警告" and waringIDstsNow[0][7] == "已到位":
+                        newdic = {"处理人": "'系统确认状态'", "处理时间": "'%s'" % now}
+                        database.lazyUpdateItem('logs', newdic, "编号='%s'" % waringID[0])
+                    if waringID[8] == "销夹警告" and waringIDstsNow[0][5] == "已取下":
+                        newdic = {"处理人": "'系统确认状态'", "处理时间": "'%s'" % now}
+                        database.lazyUpdateItem('logs', newdic, "编号='%s'" % waringID[0])
+                    if waringID[8] == "随机到位警告" and waringIDstsNow[0][6] == "已到位":
+                        newdic = {"处理人": "'系统确认状态'", "处理时间": "'%s'" % now}
+                        database.lazyUpdateItem('logs', newdic, "编号='%s'" % waringID[0])
+        database.FunctionCommit()
+    except Exception as e:
+        database.FunctionCommit()
+        app_logger.log_error(e)

+ 36 - 0
Functions/DButilsFunction/checkLoadSingal.py

@@ -0,0 +1,36 @@
+from unitls.LogerinTxt import app_logger
+from .flightDB import flightDB
+
+
+def checkLoadSingal(wdb:flightDB,worknum,time,time2):
+    try:
+        table="workload"+str(worknum)
+        #peopleLabel = ["序号", "保障日期", "类型", "机号", "机位", "开始时间", "结束时间"]
+        LoadSingals={}
+        res = wdb.sort_queryTable2("*", table, "保障日期='%s' or 保障日期='%s'"%(time,time2), "保障日期", "desc", "结束时间", "ASC")
+        j=0
+        if len(res) != 0:
+            for i in res:
+                LoadSingal = {}
+                LoadSingal["序号"]=j
+                LoadSingal["保障日期"] = i[6][0:10]
+                if i[0][-1]=="1" and (i[7]=="特后前" or i[7]=="短停"):
+                    LoadSingal["类型"] = i[7]+"接机"
+                elif i[0][-1]=="2" and (i[7]=="特后前" or i[7]=="短停"):
+                    LoadSingal["类型"] = i[7] + "送机"
+                else:
+                    LoadSingal["类型"] = i[7]
+                LoadSingal["机号"] = i[1]
+                LoadSingal["机位"] = i[2]
+                LoadSingal["开始时间"] = i[4]
+                LoadSingal["结束时间"] = i[5]
+                LoadSingals[j]=LoadSingal
+                j += 1
+        #print(LoadSingals)
+
+        return {"status":'ok',"data":LoadSingals}
+
+    except Exception as e:
+        app_logger.log_error(e)
+
+        return {"status":'error:{}'.format(e)}

+ 26 - 0
Functions/DButilsFunction/checkPglist.py

@@ -0,0 +1,26 @@
+import datetime
+
+from unitls.LogerinTxt import app_logger
+from .flightDB import flightDB
+
+
+def checkPglist(fdb:flightDB,name,selectedtime,bc):
+    try:
+        list=["1","2","3","4","5","6","7","8","9","10","11","12"]
+        if name != "清空项目12345678987654321" and str(name) not in list:
+            time2=datetime.datetime.strptime(selectedtime,"%Y%m%d")
+            time1=str((time2 - datetime.timedelta(days=1)).strftime("%Y%m%d"))
+            check=fdb.queryTabel("pglist{}".format(selectedtime), "工号", "班次='%s' and 姓名='%s'" % (bc,name))
+            check2 = fdb.queryTabel("pglist{}".format(time1), "工号", "班次='%s' and 姓名='%s'" % (bc, name))
+            if len(check) == 0 and len(check2) == 0:
+                res="NO"
+            else:
+                res="YES"
+        elif str(name) in list:
+            res = "YES"
+        else:
+            res = "YES"
+        return res
+    except Exception as e:
+        app_logger.log_error(e)
+        return "NO"

+ 216 - 0
Functions/DButilsFunction/checkTFUairplane.py

@@ -0,0 +1,216 @@
+import datetime
+
+import unitls.baseFunction as baseFunction
+from unitls.LogerinTxt import app_logger
+from .flightDB import flightDB
+
+
+def checkTFUairplane(database:flightDB):
+    try:
+        code = {"接机已到位提示","已放行提示","二送已到位提示"}
+        code2num = {"接机已到位提示":8,"已放行提示":9,"二送已到位提示":12}
+        code2 = {"接机已到位提示", "已放行提示"}
+        code22num = {"接机已到位提示":8, "已放行提示":9}
+        #需要建立昨日初始化
+        nowDay = datetime.datetime.now().strftime("%Y%m%d")
+        nowDay_1 = (datetime.date.today() - datetime.timedelta(days=1)).strftime("%Y%m%d")
+        now = datetime.datetime.now()
+        now11=str(now).split(".")[0]
+        day = [nowDay, nowDay_1]
+        for nowDayStr in day:
+            AFinsky_arr = []
+            AFongroud_arr = []
+            TRinsky_arr = []
+            TRongroud_arr = []
+            THQinsky_arr = []
+            THQongroud_arr = []
+            APongroud_arr = []
+            flightsts_flight_ids_arr=[]
+            AFinsky=database.queryTabel('TaskFlightinfo{}'.format(nowDayStr),'航班编号',"航班类型='AF' and 非航前预计到达!='' and 非航前实际到达=''and 上段起飞时间!=''")
+            AFongroud=database.queryTabel('TaskFlightinfo{}'.format(nowDayStr),'航班编号',"航班类型='AF' and 非航前实际到达!=''")
+            TRinsky=database.queryTabel('TaskFlightinfo{}'.format(nowDayStr),'航班编号',"航班类型='TR' and 非航前预计到达!='' and 非航前实际到达='' and 上段起飞时间!=''")
+            TRongroud = database.queryTabel('TaskFlightinfo{}'.format(nowDayStr), '航班编号', "航班类型='TR' and 非航前实际到达!='' and 实际起飞 ='' ")
+            THQinsky = database.queryTabel('TaskFlightinfo{}'.format(nowDayStr), '航班编号',"航班类型='TAF' and 非航前预计到达!='' and 非航前实际到达=''and 上段起飞时间!=''")
+            THQongroud=database.queryTabel('TaskFlightinfo{}'.format(nowDayStr), '航班编号', "航班类型='TAF'  and 非航前实际到达!='' and 实际起飞 =''")
+            APongroud=database.queryTabel('TaskFlightinfo{}'.format(nowDayStr), '航班编号', "航班类型='AP' and 实际起飞 =''")
+
+
+            ##################################
+            #缺个未显示的航班筛选
+            if len(AFinsky) != 0:
+                for i in AFinsky:
+                    AFinsky_arr.append(i[0])
+            if len(AFongroud) != 0:
+                for i in AFongroud:
+                    AFongroud_arr.append(i[0])
+            if len(TRinsky) != 0:
+                for i in TRinsky:
+                    TRinsky_arr.append(i[0])
+            if len(TRongroud) != 0:
+                for i in TRongroud:
+                    TRongroud_arr.append(i[0])
+            if len(THQinsky) != 0:
+                for i in THQinsky:
+                    THQinsky_arr.append(i[0])
+            if len(THQongroud) != 0:
+                for i in THQongroud:
+                    THQongroud_arr.append(i[0])
+            if len(APongroud) != 0:
+                for i in APongroud:
+                    APongroud_arr.append(i[0])
+            flightsts_flight_ids=database.queryTabel('flightsts{}'.format(nowDayStr),'*',"航班编号 != ''")
+            flightinfo_flight_ids = database.queryTabel('TaskFlightinfo{}'.format(nowDayStr), '*', "航班编号 != ''")
+            if len(flightsts_flight_ids) != 0:
+                for flightstskey in flightsts_flight_ids:
+                    newdic={"天府飞机":"''"}
+                    database.lazyUpdateItem('flightsts{}'.format(nowDayStr),newdic,"航班编号='%s'"%flightstskey[0])
+                    if flightstskey[0] not in flightinfo_flight_ids:
+                        flightsts_flight_ids_arr.append(flightstskey[0])
+                    else:
+                        database.deleteSingledata('flightsts{}'.format(nowDayStr),"航班编号='%s'"%flightstskey[0])
+
+            for AFinsky_arr_key in AFinsky_arr:
+                if AFinsky_arr_key in flightsts_flight_ids_arr:
+                    newdic = {"天府飞机":"'空中航后'"}
+                    database.lazyUpdateItem('flightsts{}'.format(nowDayStr),newdic,"航班编号='%s'"%AFinsky_arr_key)
+                else:
+                    newdic={"航班编号":"%s"%AFinsky_arr_key,"接机到位":"","放行":"","销子夹板":"","随机到位":"","二送到位":"","接机已到位提示":"","已放行提示":"","销子夹板已提示":"","随机已到位提示":"","二送已到位提示":"","天府飞机":'空中航后',"机号":"","机位":""}
+                    database.lazyInsertData('flightsts{}'.format(nowDayStr),newdic)
+            for AFongroud_arr_key in AFongroud_arr:
+                if AFongroud_arr_key in flightsts_flight_ids_arr:
+                    newdic = {"天府飞机": "'地面航后'"}
+                    database.lazyUpdateItem('flightsts{}'.format(nowDayStr),newdic,"航班编号='%s'"%AFongroud_arr_key)
+                else:
+                    newdic = {"航班编号": "%s" % AFongroud_arr_key, "接机到位": "", "放行": "", "销子夹板": "", "随机到位": "", "二送到位": "",
+                              "接机已到位提示": "", "已放行提示": "", "销子夹板已提示": "", "随机已到位提示": "", "二送已到位提示": "", "天府飞机": '地面航后',"机号":"","机位":""}
+                    database.lazyInsertData('flightsts{}'.format(nowDayStr),newdic)
+
+            for TRinsky_arr_key in TRinsky_arr:
+                if TRinsky_arr_key in flightsts_flight_ids_arr:
+                    newdic = {"天府飞机": "'空中短停'"}
+                    database.lazyUpdateItem('flightsts{}'.format(nowDayStr),newdic,"航班编号='%s'"%TRinsky_arr_key)
+                else:
+                    newdic = {"航班编号": "%s" % TRinsky_arr_key, "接机到位": "", "放行": "", "销子夹板": "", "随机到位": "", "二送到位": "",
+                              "接机已到位提示": "", "已放行提示": "", "销子夹板已提示": "", "随机已到位提示": "", "二送已到位提示": "", "天府飞机": '空中短停',"机号":"","机位":""}
+                    database.lazyInsertData('flightsts{}'.format(nowDayStr),newdic)
+
+            for TRongroud_arr_key in TRongroud_arr:
+                if TRongroud_arr_key in flightsts_flight_ids_arr:
+                    newdic = {"天府飞机": "'地面短停'"}
+                    database.lazyUpdateItem('flightsts{}'.format(nowDayStr),newdic,"航班编号='%s'"%TRongroud_arr_key)
+                else:
+                    newdic = {"航班编号": "%s" % TRongroud_arr_key, "接机到位": "", "放行": "", "销子夹板": "", "随机到位": "", "二送到位": "",
+                              "接机已到位提示": "", "已放行提示": "", "销子夹板已提示": "", "随机已到位提示": "", "二送已到位提示": "", "天府飞机": '地面短停',"机号":"","机位":""}
+                    database.lazyInsertData('flightsts{}'.format(nowDayStr),newdic)
+
+            for THQinsky_arr_key in THQinsky_arr:
+                if THQinsky_arr_key in flightsts_flight_ids_arr:
+                    newdic = {"天府飞机": "'空中特后前'"}
+                    database.lazyUpdateItem('flightsts{}'.format(nowDayStr),newdic,"航班编号='%s'"%THQinsky_arr_key)
+                else:
+                    newdic = {"航班编号": "%s" % THQinsky_arr_key, "接机到位": "", "放行": "", "销子夹板": "", "随机到位": "", "二送到位": "",
+                              "接机已到位提示": "", "已放行提示": "", "销子夹板已提示": "", "随机已到位提示": "", "二送已到位提示": "", "天府飞机": '空中特后前',"机号":"","机位":""}
+                    database.lazyInsertData('flightsts{}'.format(nowDayStr),newdic)
+
+            for THQongroud_arr_key in THQongroud_arr:
+                if THQongroud_arr_key in flightsts_flight_ids_arr:
+                    newdic = {"天府飞机": "'地面特后前'"}
+                    database.lazyUpdateItem('flightsts{}'.format(nowDayStr),newdic,"航班编号='%s'"%THQongroud_arr_key)
+                else:
+                    newdic = {"航班编号": "%s" % THQongroud_arr_key, "接机到位": "", "放行": "", "销子夹板": "", "随机到位": "", "二送到位": "",
+                              "接机已到位提示": "", "已放行提示": "", "销子夹板已提示": "", "随机已到位提示": "", "二送已到位提示": "", "天府飞机": '地面特后前',"机号":"","机位":""}
+                    database.lazyInsertData('flightsts{}'.format(nowDayStr),newdic)
+
+            for APongroud_arr_key in APongroud_arr:
+                #print(APongroud_arr_key)
+                if APongroud_arr_key in flightsts_flight_ids_arr:
+                    newdic = {"天府飞机":"'地面航前'"}
+                    database.lazyUpdateItem('flightsts{}'.format(nowDayStr),newdic,"航班编号='%s'"%APongroud_arr_key)
+                else:
+                    newdic = {"航班编号": "%s" % APongroud_arr_key, "接机到位": "", "放行": "", "销子夹板": "", "随机到位": "", "二送到位": "",
+                              "接机已到位提示": "", "已放行提示": "", "销子夹板已提示": "", "随机已到位提示": "", "二送已到位提示": "", "天府飞机": '地面航前',"机号":"","机位":""}
+                    database.lazyInsertData('flightsts{}'.format(nowDayStr),newdic)
+
+            for flightstskey in flightinfo_flight_ids:
+                acno_str = baseFunction.TuplefindInList3(flightinfo_flight_ids , flightstskey[0 ] , 0 , 1)
+                if baseFunction.TuplefindInList3(flightinfo_flight_ids, flightstskey[0 ], 0, 3) != "AP":
+                    bay_str = baseFunction.TuplefindInList3(flightinfo_flight_ids , flightstskey[0 ] , 0 , 11)
+                else:
+                    bay_str = baseFunction.TuplefindInList3(flightinfo_flight_ids , flightstskey[0 ] , 0 , 10)
+                if bay_str != baseFunction.TuplefindInList3(flightsts_flight_ids, flightstskey[0 ], 0, 2) or acno_str != baseFunction.TuplefindInList3(flightsts_flight_ids, flightstskey[0 ], 0, 1):
+                    newdic = {"机位":"'%s'"%bay_str, "机号":"'%s'"%acno_str}
+                    database.lazyUpdateItem('flightsts{}'.format(nowDayStr), newdic, "航班编号='%s'" % flightstskey[0])
+                worksts_str= baseFunction.TuplefindInList3(flightinfo_flight_ids , flightstskey[0 ] , 0 , 14)
+                worksts = int(worksts_str) if worksts_str != "" else 0
+                a= baseFunction.TuplefindInList3(flightsts_flight_ids , flightstskey[0 ] , 0 , 2) if baseFunction.TuplefindInList3(flightsts_flight_ids , flightstskey[0 ] , 0 , 2) != "" else "未显示机号"
+
+                if worksts >= 7 and str(flightstskey[0]) in str(flightsts_flight_ids_arr):
+                    if baseFunction.TuplefindInList3(flightsts_flight_ids, flightstskey[0 ], 0, 3) != "已到位" or baseFunction.TuplefindInList3(flightsts_flight_ids, flightstskey[0 ], 0, 4) != "已放行":
+                        newdic={"接机到位":"'已到位'", "放行": "'已放行'"}
+                        database.lazyUpdateItem('flightsts{}'.format(nowDayStr), newdic, "航班编号='%s'" % flightstskey[0])
+                    for i in code2:
+                        if "1" not in baseFunction.TuplefindInList3(flightsts_flight_ids, flightstskey[0 ], 0, code22num[i ]):
+                            newdic={"航班编号":"%s"% flightstskey[0],"警告信息":"","信息状态":"","提示信息":"AMRO:%s%s!%s"%(a,i,now11),"产生时间":"%s"%now,"处理人":"","处理时间":"","变更字段":"","显示对象":"","提示内容":""}
+                            database.lazyInsertData('logs', newdic)
+                            newdic = {"%s"%i: 1}
+                            database.lazyUpdateItem('flightsts{}'.format(nowDayStr), newdic, "航班编号='%s'" % flightstskey[0])
+                elif worksts >= 4 and str(flightstskey[0]) in str(flightsts_flight_ids_arr):
+                    if baseFunction.TuplefindInList3(flightsts_flight_ids, flightstskey[0 ], 0, 3) != "已到位" :
+                        newdic = {"接机到位": "'已到位'"}
+                        database.lazyUpdateItem('flightsts{}'.format(nowDayStr), newdic, "航班编号='%s'" % flightstskey[0])
+                    if "1" not in baseFunction.TuplefindInList3(flightsts_flight_ids, flightstskey[0 ], 0, 8):
+                        newdic={"航班编号":"%s"% flightstskey[0],"警告信息":"","信息状态":"","提示信息":"AMRO:%s接机已到位提示!%s"%(a,now11),"产生时间":"%s"%now,"处理人":"","处理时间":"","变更字段":"","显示对象":"","提示内容":""}
+                        database.lazyInsertData('logs', newdic)
+                        newdic = {"接机已到位提示": 1}
+                        database.lazyUpdateItem('flightsts{}'.format(nowDayStr), newdic, "航班编号='%s'"% flightstskey[0])
+                    if "1" in baseFunction.TuplefindInList3(flightsts_flight_ids, flightstskey[0 ], 0, 9) and "人工" not in baseFunction.TuplefindInList3(flightsts_flight_ids, flightstskey[0 ], 0, 4):
+                        newdic = {"放行": "''"}
+                        database.lazyUpdateItem('flightsts{}'.format(nowDayStr), newdic, "航班编号='%s'" % flightstskey[0])
+                        newdic={"航班编号":"%s"% flightstskey[0],"警告信息":"","信息状态":"","提示信息":"AMRO:%s放行退回至到位!%s"%(a,now11),"产生时间":"%s"%now,"处理人":"","处理时间":"","变更字段":"","显示对象":"","提示内容":""}
+                        database.lazyInsertData('logs', newdic)
+                        newdic = {"已放行提示": 0}
+                        database.lazyUpdateItem('flightsts{}'.format(nowDayStr), newdic, "航班编号='%s'"% flightstskey[0])
+                elif  str(flightstskey[0]) in str(flightsts_flight_ids_arr):
+                    if "1" in baseFunction.TuplefindInList3(flightsts_flight_ids, flightstskey[0 ], 0, 8) and "人工" not in baseFunction.TuplefindInList3(flightsts_flight_ids, flightstskey[0 ], 0, 3):
+                        newdic = {"接机到位": "''"}
+                        database.lazyUpdateItem('flightsts{}'.format(nowDayStr), newdic, "航班编号='%s'" % flightstskey[0])
+                        newdic={"航班编号":"%s"% flightstskey[0],"警告信息":"","信息状态":"","提示信息":"AMRO:%s状态退回至初始状态!%s"%(a,now11),"产生时间":"%s"%now,"处理人":"","处理时间":"","变更字段":"","显示对象":"","提示内容":""}
+                        database.lazyInsertData('logs', newdic)
+                        newdic = {"接机已到位提示": 0}
+                        database.lazyUpdateItem('flightsts{}'.format(nowDayStr), newdic, "航班编号='%s'"% flightstskey[0])
+                    if "1" in baseFunction.TuplefindInList3(flightsts_flight_ids, flightstskey[0 ], 0, 9) and "人工" not in baseFunction.TuplefindInList3(flightsts_flight_ids, flightstskey[0 ], 0, 4):
+                        newdic = {"放行": "''"}
+                        database.lazyUpdateItem('flightsts{}'.format(nowDayStr), newdic, "航班编号='%s'" % flightstskey[0])
+                        newdic={"航班编号":"%s"% flightstskey[0],"警告信息":"","信息状态":"","提示信息":"AMRO:%s状态退回至初始状态!%s"%(a,now11),"产生时间":"%s"%now,"处理人":"","处理时间":"","变更字段":"","显示对象":"","提示内容":""}
+                        database.lazyInsertData('logs', newdic)
+                        newdic = {"已放行提示": 0}
+                        database.lazyUpdateItem('flightsts{}'.format(nowDayStr), newdic, "航班编号='%s'"% flightstskey[0])
+
+                ECSJ_worksts_str = baseFunction.TuplefindInList3(flightinfo_flight_ids , flightstskey[0 ] , 0 , 20)
+                ECSJ_worksts_STR = ECSJ_worksts_str if len(ECSJ_worksts_str) != 0 else 0
+                ECSJ_worksts = int(ECSJ_worksts_STR) if ECSJ_worksts_STR != "" else 0
+                if ECSJ_worksts >= 15 and str(flightstskey[0]) in str(flightsts_flight_ids_arr):
+                    if baseFunction.TuplefindInList3(flightsts_flight_ids, flightstskey[0 ], 0, 7) != "已到位" :
+                        #newdic = {"接机到位": "'已到位'", "放行": "'已放行'", "二送到位": "'已到位'"}
+                        newdic = {"二送到位": "'已到位'"}
+                        database.lazyUpdateItem('flightsts{}'.format(nowDayStr), newdic, "航班编号='%s'" % flightstskey[0])
+                    if"1" not in baseFunction.TuplefindInList3(flightsts_flight_ids, flightstskey[0 ], 0, 12):
+                        newdic={"航班编号":"%s"% flightstskey[0],"警告信息":"","信息状态":"","提示信息":"AMRO:%s二送已到位提示!%s"%(a,now11),"产生时间":"%s"%now,"处理人":"","处理时间":"","变更字段":"","显示对象":"","提示内容":""}
+                        database.lazyInsertData('logs', newdic)
+                        newdic = {"二送已到位提示": 1}
+                        database.lazyUpdateItem('flightsts{}'.format(nowDayStr), newdic, "航班编号='%s'" % flightstskey[0])
+                elif str(flightstskey[0]) in str(flightsts_flight_ids_arr) and "人工" not in baseFunction.TuplefindInList3(flightsts_flight_ids, flightstskey[0 ], 0, 7):
+                    if baseFunction.TuplefindInList3(flightsts_flight_ids, flightstskey[0 ], 0, 7) != "" :
+                        #newdic = {"接机到位": "'已到位'", "放行": "'已放行'", "二送到位": "'已到位'"}
+                        newdic = {"二送到位": "''"}
+                        database.lazyUpdateItem('flightsts{}'.format(nowDayStr), newdic, "航班编号='%s'" % flightstskey[0])
+                    if "1" in baseFunction.TuplefindInList3(flightsts_flight_ids, flightstskey[0 ], 0, 12):
+                        newdic={"航班编号":"%s"% flightstskey[0],"警告信息":"","信息状态":"","提示信息":"AMRO:%s二送到位取消到位!%s"%(a,now11),"产生时间":"%s"%now,"处理人":"","处理时间":"","变更字段":"","显示对象":"","提示内容":""}
+                        database.lazyInsertData('logs', newdic)
+                        newdic = {"二送已到位提示": 0}
+                        database.lazyUpdateItem('flightsts{}'.format(nowDayStr), newdic, "航班编号='%s'" % flightstskey[0])
+        database.FunctionCommit()
+
+    except Exception as e:
+        app_logger.log_error(e)
+        database.FunctionCommit()

+ 366 - 0
Functions/DButilsFunction/checkWorkerlaod.py

@@ -0,0 +1,366 @@
+import datetime
+
+import unitls.baseFunction as baseFunction
+from unitls.LogerinTxt import app_logger
+from unitls.StaticDataclass import get_dic
+from .flightDB import flightDB
+
+
+def checkWorkerlaod(database:flightDB, workload:flightDB,nowDayStr1,nowDay_11):
+    try:
+        #需要初始化表格
+
+        nowDay = datetime.datetime.now().strftime("%Y%m%d")
+        nowDay_1 = (datetime.date.today() - datetime.timedelta(days=1)).strftime("%Y%m%d")
+        day=[nowDay_1,nowDay]
+
+
+
+        nowDayStr_search = datetime.date.today().strftime("%Y-%m-%d %H:%M:%S")
+        #nowDayStr_search=datetime.datetime.strptime(str("2023-06-11 00:00:00"),"%Y-%m-%d %H:%M:%S")
+        yesterday_search = (datetime.date.today() - datetime.timedelta(days=1)).strftime("%Y-%m-%d %H:%M:%S")
+
+        workernames_arr=[]
+        workernames1=database.queryTabel('pglist%s'%nowDayStr1,"*","姓名!=''")
+        workernames2=database.queryTabel('pglist%s' % nowDay_11, "*", "姓名!=''")
+        if workernames1 and len(workernames1) != 0:
+            for i in workernames1:
+                workernames_arr.append(i[0])
+        if workernames2 and len(workernames2) != 0:
+            for i in workernames2:
+                workernames_arr.append(i[0])
+
+        for worker in workernames_arr:
+            if workernames1 and len(workernames1)!= 0:
+                worker_number = baseFunction.TuplefindInList3(workernames1 , worker , 0 , 1)
+            else:
+                worker_number = baseFunction.TuplefindInList3(workernames2 , worker , 0 , 1)
+            # worker_number = a if len(a) !=0 else ""
+            single_worker_load_ids = workload.queryTabel('workload%s' % worker_number, "*", "编号!=''")
+            single_worker_load_ids_arr = []
+            if single_worker_load_ids and len(single_worker_load_ids) != 0:
+                for l in single_worker_load_ids:
+                    single_worker_load_ids_arr.append(l[0])
+
+            for nowDayStr in day:
+                worker_laod_ids=database.queryTabel('TaskFlightinfo{}'.format(nowDayStr), '*', "维修人员 like '%{}%'".format(worker))
+                worker_laod_ids_arr = []
+                if worker_laod_ids and len(worker_laod_ids)!= 0:
+                    for j in worker_laod_ids:
+                        worker_laod_ids_arr.append(j[0])
+
+                if worker_laod_ids_arr and len(worker_laod_ids_arr) != 0:
+                    for k in worker_laod_ids_arr:
+                        TYPE = get_dic('taskType')[ baseFunction.TuplefindInList3(worker_laod_ids , k , 0 , 3) ]
+                        acno = baseFunction.TuplefindInList3(worker_laod_ids , k , 0 , 1)
+                        bay = baseFunction.TuplefindInList3(worker_laod_ids , k , 0 , 10)
+                        bay1= baseFunction.TuplefindInList3(worker_laod_ids , k , 0 , 11)
+                        flight_id = k
+                        flight_id_1=str(str(flight_id))+str("-1")  #接机保障标志
+                        flight_id_2 = str(str(flight_id)) + str("-2")  # 接机保障标志
+                        flight_date = baseFunction.TuplefindInList3(worker_laod_ids , k , 0 , 2)
+                        if TYPE == "短停" and baseFunction.TuplefindInList3(worker_laod_ids, k, 0, 8) != "":
+                            eta_str= baseFunction.TuplefindInList3(worker_laod_ids , k , 0 , 8)
+                            starttime = datetime.datetime.strptime(eta_str, "%Y-%m-%d %H:%M:%S") - datetime.timedelta(minutes=15)
+                            endtime= baseFunction.TuplefindInList3(worker_laod_ids , k , 0 , 6)
+                            if flight_id_1 in single_worker_load_ids_arr:
+                                newdic = {"机号": "'%s'"%acno, "机位": "'%s'"%bay, "开始时间": "'%s'"%starttime, "结束时间": "'%s'"%endtime,"航班类型": "'%s'"%TYPE}
+                                workload.lazyUpdateItem('workload%s'%worker_number,newdic,"编号='{}'".format(flight_id_1))
+                            else:
+                                newdic = {"编号":"%s"%flight_id_1,"机号": "%s" % acno, "机位": "%s" % bay, "航班编号": "%s" % flight_id, "开始时间": "%s" % starttime,
+                                          "结束时间": "%s" % endtime, "保障日期": "%s" % flight_date, "航班类型": "%s" % TYPE,"人员状态":""}
+                                workload.lazyInsertData('workload%s'%worker_number, newdic)
+
+                        elif TYPE == '航前'  and baseFunction.TuplefindInList3(worker_laod_ids, k, 0, 5) != "":
+                            endtime_ap = baseFunction.TuplefindInList3(worker_laod_ids , k , 0 , 7)
+                            STD_ap= baseFunction.TuplefindInList3(worker_laod_ids , k , 0 , 5)
+                            starttime_ap = datetime.datetime.strptime(STD_ap, "%Y-%m-%d %H:%M:%S")-datetime.timedelta(minutes=90)
+
+                            if flight_id_1 in single_worker_load_ids_arr:
+                                newdic = {"机号": "'%s'"%acno, "机位": "'%s'"%bay1, "开始时间": "'%s'"%starttime_ap, "结束时间": "'%s'"%endtime_ap,  "航班类型": "'%s'"%TYPE}
+                                workload.lazyUpdateItem('workload%s'%worker_number,newdic,"编号='%s'"%flight_id_1)
+                            else:
+                                newdic = {"编号":"%s"%flight_id_1,"机号": "%s" % acno, "机位": "%s"%bay1, "航班编号": "%s" % flight_id, "开始时间": "%s" % starttime_ap,
+                                          "结束时间": "%s" % endtime_ap, "保障日期": "%s" % flight_date, "航班类型": "%s" % TYPE,"人员状态":""}
+                                workload.lazyInsertData('workload%s'%worker_number, newdic)
+
+                        elif TYPE == '航后'  and baseFunction.TuplefindInList3(worker_laod_ids, k, 0, 8) != "":
+                            eta_str = baseFunction.TuplefindInList3(worker_laod_ids , k , 0 , 8)
+                            starttime = datetime.datetime.strptime(eta_str, "%Y-%m-%d %H:%M:%S") - datetime.timedelta(minutes=15)
+
+                            if str(baseFunction.TuplefindInList3(worker_laod_ids, k, 0, 14)) == "8":
+                                endtime = baseFunction.TuplefindInList3(worker_laod_ids , k , 0 , 17)
+                            else:
+                                endtime=""
+
+                            if flight_id_1 in single_worker_load_ids_arr:
+                                newdic = {"机号": "'%s'" % acno, "机位": "'%s'" % bay, "开始时间": "'%s'" % starttime,
+                                          "结束时间": "'%s'" % endtime, "航班类型": "'%s'" % TYPE}
+                                workload.lazyUpdateItem('workload%s' % worker_number, newdic, "编号='{}'".format(flight_id_1))
+
+                            else:
+                                newdic = {"编号": "%s" % flight_id_1, "机号": "%s" % acno, "机位": "%s" % bay,
+                                          "航班编号": "%s" % flight_id, "开始时间": "%s" % starttime,
+                                          "结束时间": "%s" % endtime, "保障日期": "%s" % flight_date, "航班类型": "%s" % TYPE, "人员状态": ""}
+                                workload.lazyInsertData('workload%s' % worker_number, newdic)
+
+                        elif TYPE == "特后前" and baseFunction.TuplefindInList3(worker_laod_ids, k, 0, 8) != "":
+                            eta_str= baseFunction.TuplefindInList3(worker_laod_ids , k , 0 , 8)
+                            starttime = datetime.datetime.strptime(eta_str, "%Y-%m-%d %H:%M:%S") - datetime.timedelta(minutes=15)
+                            if baseFunction.TuplefindInList3(worker_laod_ids, k, 0, 7) != "" :
+                                endtime_str = baseFunction.TuplefindInList3(worker_laod_ids , k , 0 , 7)
+                                endtime = datetime.datetime.strptime(endtime_str, "%Y-%m-%d %H:%M:%S")
+
+                            else:
+                                endtime = ""
+
+                            if flight_id_1 in single_worker_load_ids_arr:
+                                newdic = {"机号": "'%s'"%acno, "机位": "'%s'"%bay, "开始时间": "'%s'"%starttime, "结束时间": "'%s'"%endtime,"航班类型": "'%s'"%TYPE}
+                                workload.lazyUpdateItem('workload%s'%worker_number,newdic,"编号='{}'".format(flight_id_1))
+
+                            else:
+                                newdic = {"编号":"%s"%flight_id_1,"机号": "%s" % acno, "机位": "%s" % bay, "航班编号": "%s" % flight_id, "开始时间": "%s" % starttime,
+                                          "结束时间": "%s" % endtime, "保障日期": "%s" % flight_date, "航班类型": "%s" % TYPE,"人员状态":""}
+                                workload.lazyInsertData('workload%s'%worker_number, newdic)
+
+
+
+                #if len(database.queryTabel('pglist%s' % nowDayStr1, '工号', "姓名 ='%s'" % worker)) != 0:
+                #    worker_number = database.queryTabel('pglist%s' % nowDayStr1, '工号', "姓名 ='%s'" % worker)[0]
+                #else:
+                #    worker_number = database.queryTabel('pglist%s' % nowDay_11, '工号', "姓名 ='%s'" % worker)[0]
+                single_worker_load_ids = workload.getSingledata('编号', 'workload%s' % worker_number)
+                single_worker_load_ids_arr = []
+                if single_worker_load_ids and  len(single_worker_load_ids) != 0:
+                    for l in single_worker_load_ids:
+                        single_worker_load_ids_arr.append(l[0])
+
+
+                FX_laod_ids = database.queryTabel('TaskFlightinfo{}'.format(nowDayStr), '航班编号', "放行人员 like '%{}%'".format(worker))
+                FX_laod_ids_arr = []
+                if FX_laod_ids and len(FX_laod_ids) != 0:
+                    for j in FX_laod_ids:
+                        FX_laod_ids_arr.append(j[0])
+
+                if FX_laod_ids_arr and len(FX_laod_ids_arr) != 0:
+                    for k in FX_laod_ids_arr:
+                        TYPE = get_dic('taskType')[ baseFunction.TuplefindInList3(worker_laod_ids , k , 0 , 3) ]
+                        acno = baseFunction.TuplefindInList3(worker_laod_ids , k , 0 , 1)
+                        bay = baseFunction.TuplefindInList3(worker_laod_ids , k , 0 , 10)
+                        bay1= baseFunction.TuplefindInList3(worker_laod_ids , k , 0 , 11)
+                        flight_id = k
+                        flight_id_1=str(str(flight_id))+str("-1")  #接机保障标志
+                        flight_id_2 = str(str(flight_id)) + str("-2")  # 接机保障标志
+                        flight_date = baseFunction.TuplefindInList3(worker_laod_ids , k , 0 , 2)
+
+
+                        if TYPE == "短停" and baseFunction.TuplefindInList3(worker_laod_ids, k, 0, 8) != "":
+                            eta_str= baseFunction.TuplefindInList3(worker_laod_ids , k , 0 , 8)
+                            starttime = datetime.datetime.strptime(eta_str, "%Y-%m-%d %H:%M:%S") - datetime.timedelta(minutes=15)
+                            if int(baseFunction.TuplefindInList3(worker_laod_ids, k, 0, 14)) >= 7:
+                                endtime = baseFunction.TuplefindInList3(worker_laod_ids , k , 0 , 15)
+                            else:
+                                endtime = ""
+
+
+                            if flight_id_1 in single_worker_load_ids_arr:
+                                if workload.queryTabel('workload%s' % worker_number, '结束时间', "编号 ='%s'"%flight_id_1)[0][0] =="":
+                                    newdic = {"机号": "'%s'"%acno, "机位": "'%s'"%bay, "开始时间": "'%s'"%starttime, "结束时间": "'%s'"%endtime,"航班类型": "'%s'"%TYPE}
+                                    workload.lazyUpdateItem('workload%s'%worker_number,newdic,"编号='{}'".format(flight_id_1))
+
+                            else:
+                                newdic = {"编号":"%s"%flight_id_1,"机号": "%s" % acno, "机位": "%s" % bay, "航班编号": "%s" % flight_id, "开始时间": "%s" % starttime,
+                                          "结束时间": "%s" % endtime, "保障日期": "%s" % flight_date, "航班类型": "%s" % TYPE,"人员状态":""}
+                                workload.lazyInsertData('workload%s'%worker_number, newdic)
+
+                        elif TYPE == '航前'  and baseFunction.TuplefindInList3(worker_laod_ids, k, 0, 5) != "":
+                            if int(baseFunction.TuplefindInList3(worker_laod_ids, k, 0, 14)) >= 7:
+                                endtime_ap = baseFunction.TuplefindInList3(worker_laod_ids , k , 0 , 15)
+                            else:
+                                endtime_ap = ""
+                            STD_ap= baseFunction.TuplefindInList3(worker_laod_ids , k , 0 , 5)
+                            starttime_ap = datetime.datetime.strptime(STD_ap, "%Y-%m-%d %H:%M:%S")-datetime.timedelta(minutes=90)
+
+                            if flight_id_1 in single_worker_load_ids_arr:
+                                if workload.queryTabel('workload%s' % worker_number, '结束时间', "编号 ='%s'" % flight_id_1)[0][0] == "":
+                                    newdic = {"机号": "'%s'"%acno, "机位": "'%s'"%bay1, "开始时间": "'%s'"%starttime_ap, "结束时间": "'%s'"%endtime_ap,  "航班类型": "'%s'"%TYPE}
+                                    workload.lazyUpdateItem('workload%s'%worker_number,newdic,"编号='%s'"%flight_id_1)
+                            else:
+                                newdic = {"编号":"%s"%flight_id_1,"机号": "%s" % acno, "机位": "%s"%bay1, "航班编号": "%s" % flight_id, "开始时间": "%s" % starttime_ap,
+                                          "结束时间": "%s" % endtime_ap, "保障日期": "%s" % flight_date, "航班类型": "%s" % TYPE,"人员状态":""}
+                                workload.lazyInsertData('workload%s'%worker_number, newdic)
+                        elif TYPE == '航后'  and baseFunction.TuplefindInList3(worker_laod_ids, k, 0, 8) != "":
+                            eta_str = baseFunction.TuplefindInList3(worker_laod_ids , k , 0 , 8)
+                            starttime = datetime.datetime.strptime(eta_str, "%Y-%m-%d %H:%M:%S") - datetime.timedelta(minutes=15)
+                            if int(baseFunction.TuplefindInList3(worker_laod_ids, k, 0, 14)) >= 8:
+                                endtime = baseFunction.TuplefindInList3(worker_laod_ids , k , 0 , 15)
+                            else:
+                                endtime=""
+
+                            if flight_id_1 in single_worker_load_ids_arr:
+                                if workload.queryTabel('workload%s' % worker_number, '结束时间', "编号 ='%s'" % flight_id_1)[0][0] == "":
+                                    newdic = {"机号": "'%s'" % acno, "机位": "'%s'" % bay, "开始时间": "'%s'" % starttime,
+                                              "结束时间": "'%s'" % endtime, "航班类型": "'%s'" % TYPE}
+                                    workload.lazyUpdateItem('workload%s' % worker_number, newdic, "编号='{}'".format(flight_id_1))
+
+                            else:
+                                newdic = {"编号": "%s" % flight_id_1, "机号": "%s" % acno, "机位": "%s" % bay,
+                                          "航班编号": "%s" % flight_id, "开始时间": "%s" % starttime,
+                                          "结束时间": "%s" % endtime, "保障日期": "%s" % flight_date, "航班类型": "%s" % TYPE, "人员状态": ""}
+                                workload.lazyInsertData('workload%s' % worker_number, newdic)
+                        elif TYPE == "特后前" and baseFunction.TuplefindInList3(worker_laod_ids, k, 0, 8) != "":
+                            eta_str= baseFunction.TuplefindInList3(worker_laod_ids , k , 0 , 8)
+                            starttime = datetime.datetime.strptime(eta_str, "%Y-%m-%d %H:%M:%S") - datetime.timedelta(minutes=15)
+                            if baseFunction.TuplefindInList3(worker_laod_ids, k, 0, 7) != "":
+                                #print(flight_date)
+                                #print(endtime_str)
+                                endtime_str =  baseFunction.TuplefindInList3(worker_laod_ids , k , 0 , 7)
+                                endtime = datetime.datetime.strptime(endtime_str, "%Y-%m-%d %H:%M:%S")
+                            else:
+                                endtime = ""
+                            if flight_id_1 in single_worker_load_ids_arr:
+                                newdic = {"机号": "'%s'"%acno, "机位": "'%s'"%bay, "开始时间": "'%s'"%starttime, "结束时间": "'%s'"%endtime,"航班类型": "'%s'"%TYPE}
+                                workload.lazyUpdateItem('workload%s'%worker_number,newdic,"编号='{}'".format(flight_id_1))
+
+                            else:
+                                newdic = {"编号":"%s"%flight_id_1,"机号": "%s" % acno, "机位": "%s" % bay, "航班编号": "%s" % flight_id, "开始时间": "%s" % starttime,
+                                          "结束时间": "%s" % endtime, "保障日期": "%s" % flight_date, "航班类型": "%s" % TYPE,"人员状态":""}
+                                workload.lazyInsertData('workload%s'%worker_number, newdic)
+
+
+                #if len(database.queryTabel('pglist%s' % nowDayStr1, '工号', "姓名 ='%s'" % worker)) != 0:
+                #    worker_number = database.queryTabel('pglist%s' % nowDayStr1, '工号', "姓名 ='%s'" % worker)[0]
+                #else:
+                #    worker_number = database.queryTabel('pglist%s' % nowDay_11, '工号', "姓名 ='%s'" % worker)[0]
+                single_worker_load_ids = workload.getSingledata('编号', 'workload%s' % worker_number)
+                single_worker_load_ids_arr = []
+                if single_worker_load_ids and len(single_worker_load_ids) != 0:
+                    for l in single_worker_load_ids:
+                        single_worker_load_ids_arr.append(l[0])
+
+                ECCJ_laod_ids = database.queryTabel('TaskFlightinfo{}'.format(nowDayStr), '航班编号', "二次送机 like '%{}%'".format(worker))
+                ECSJ_laod_ids_arr = []
+                if ECCJ_laod_ids and len(ECCJ_laod_ids) != 0:
+                    for j in ECCJ_laod_ids:
+                        ECSJ_laod_ids_arr.append(j[0])
+
+                if ECSJ_laod_ids_arr and  len(ECSJ_laod_ids_arr) != 0:
+                    for k in ECSJ_laod_ids_arr:
+                        TYPE = get_dic('taskType')[ baseFunction.TuplefindInList3(worker_laod_ids , k , 0 , 3) ]
+                        acno = baseFunction.TuplefindInList3(worker_laod_ids , k , 0 , 1)
+                        bay = baseFunction.TuplefindInList3(worker_laod_ids , k , 0 , 10)
+                        bay1= baseFunction.TuplefindInList3(worker_laod_ids , k , 0 , 11)
+                        flight_id = k
+                        flight_id_1=str(str(flight_id))+str("-1")  #接机保障标志
+                        flight_id_2 = str(str(flight_id)) + str("-2")  # 接机保障标志
+                        flight_date = baseFunction.TuplefindInList3(worker_laod_ids , k , 0 , 2)
+
+                        if TYPE == "短停" and baseFunction.TuplefindInList3(worker_laod_ids, k, 0, 5) != "":
+                            if baseFunction.TuplefindInList3(worker_laod_ids, k, 0, 7) == "" :
+                                starttime_str =  baseFunction.TuplefindInList3(worker_laod_ids , k , 0 , 5)
+                                starttime = datetime.datetime.strptime(starttime_str, "%Y-%m-%d %H:%M:%S")-datetime.timedelta(minutes=25)
+                                if flight_id_2 in single_worker_load_ids_arr:
+                                    newdic = {"机号": "'%s'" % acno, "机位": "'%s'" % bay, "开始时间": "'%s'" % starttime, "航班类型": "'%s'" % TYPE}
+                                    workload.lazyUpdateItem('workload%s' % worker_number, newdic, "编号='{}'".format(flight_id_2))
+
+                                else:
+                                    newdic = {"编号": "%s" % flight_id_2, "机号": "%s" % acno, "机位": "%s" % bay,
+                                              "航班编号": "%s" % flight_id, "开始时间": "%s" % starttime,
+                                              "结束时间": "" , "保障日期": "%s" % flight_date, "航班类型": "%s" % TYPE,
+                                              "人员状态": ""}
+                                    workload.lazyInsertData('workload%s' % worker_number, newdic)
+                            if baseFunction.TuplefindInList3(worker_laod_ids, k, 0, 7) != "" :
+                                endtime_str = baseFunction.TuplefindInList3(worker_laod_ids , k , 0 , 7)
+                                endtime = datetime.datetime.strptime(endtime_str, "%Y-%m-%d %H:%M:%S")
+                                starttime = datetime.datetime.strptime(endtime_str, "%Y-%m-%d %H:%M:%S")- datetime.timedelta(minutes=25)
+
+                                if flight_id_2 in single_worker_load_ids_arr:
+                                    if workload.queryTabel('workload%s' % worker_number, "开始时间", "编号='{}'".format(flight_id_2))[0][0] != "":
+                                        newdic = {"机号": "'%s'" % acno, "机位": "'%s'" % bay, "结束时间": "'%s'" % endtime, "航班类型": "'%s'" % TYPE}
+                                        workload.lazyUpdateItem('workload%s' % worker_number, newdic, "编号='{}'".format(flight_id_2))
+                                    else:
+                                        newdic = {"机号": "'%s'" % acno, "机位": "'%s'" % bay,"开始时间": "'%s'" % starttime, "结束时间": "'%s'" % endtime, "航班类型": "'%s'" % TYPE}
+                                        workload.lazyUpdateItem('workload%s' % worker_number, newdic, "编号='{}'".format(flight_id_2))
+                                else:
+                                    newdic = {"编号": "%s" % flight_id_2, "机号": "%s" % acno, "机位": "%s" % bay,
+                                              "航班编号": "%s" % flight_id, "开始时间": "%s" % starttime,
+                                              "结束时间": "%s"%endtime, "保障日期": "%s" % flight_date, "航班类型": "%s" % TYPE,
+                                              "人员状态": ""}
+                                    workload.lazyInsertData('workload%s' % worker_number, newdic)
+                        if TYPE == "特后前" and baseFunction.TuplefindInList3(worker_laod_ids, k, 0, 5) != "":
+                            if baseFunction.TuplefindInList3(worker_laod_ids, k, 0, 7) == "":
+                                starttime_str = baseFunction.TuplefindInList3(worker_laod_ids , k , 0 , 5)
+                                starttime = datetime.datetime.strptime(starttime_str, "%Y-%m-%d %H:%M:%S")-datetime.timedelta(minutes=25)
+                                if flight_id_2 in single_worker_load_ids_arr:
+                                    newdic = {"机号": "'%s'" % acno, "机位": "'%s'" % bay, "开始时间": "'%s'" % starttime, "航班类型": "'%s'" % TYPE}
+                                    workload.lazyUpdateItem('workload%s' % worker_number, newdic, "编号='{}'".format(flight_id_2))
+
+                                else:
+                                    newdic = {"编号": "%s" % flight_id_2, "机号": "%s" % acno, "机位": "%s" % bay,
+                                              "航班编号": "%s" % flight_id, "开始时间": "%s" % starttime,
+                                              "结束时间": "" , "保障日期": "%s" % flight_date, "航班类型": "%s" % TYPE,
+                                              "人员状态": ""}
+                                    workload.lazyInsertData('workload%s' % worker_number, newdic)
+                            if baseFunction.TuplefindInList3(worker_laod_ids, k, 0, 7) != "":
+                                endtime_str = baseFunction.TuplefindInList3(worker_laod_ids , k , 0 , 7)
+                                endtime = datetime.datetime.strptime(endtime_str, "%Y-%m-%d %H:%M:%S")
+                                starttime = datetime.datetime.strptime(endtime_str, "%Y-%m-%d %H:%M:%S") - datetime.timedelta(minutes=25)
+
+                                if flight_id_2 in single_worker_load_ids_arr:
+                                    if workload.queryTabel('workload%s' % worker_number, "开始时间", "编号='{}'".format(flight_id_2))[0][0] != "":
+                                        newdic = {"机号": "'%s'" % acno, "机位": "'%s'" % bay, "结束时间": "'%s'" % endtime, "航班类型": "'%s'" % TYPE}
+                                        workload.lazyUpdateItem('workload%s' % worker_number, newdic, "编号='{}'".format(flight_id_2))
+                                    else:
+                                        newdic = {"机号": "'%s'" % acno, "机位": "'%s'" % bay,"开始时间": "'%s'" % starttime, "结束时间": "'%s'" % endtime, "航班类型": "'%s'" % TYPE}
+                                        workload.lazyUpdateItem('workload%s' % worker_number, newdic, "编号='{}'".format(flight_id_2))
+                                else:
+                                    newdic = {"编号": "%s" % flight_id_2, "机号": "%s" % acno, "机位": "%s" % bay,
+                                              "航班编号": "%s" % flight_id, "开始时间": "%s" % starttime,
+                                              "结束时间": "%s"%endtime, "保障日期": "%s" % flight_date, "航班类型": "%s" % TYPE,
+                                              "人员状态": ""}
+                                    workload.lazyInsertData('workload%s' % worker_number, newdic)
+
+
+
+            single_worker_load_twoday_ids = workload.queryTabel('workload%s' % worker_number, '编号',"保障日期='{}'or 保障日期='{}'".format(nowDayStr_search,yesterday_search))
+            single_worker_load_twoday_ids_arr = []
+            if single_worker_load_twoday_ids and len(single_worker_load_twoday_ids) != 0:
+                for ll in single_worker_load_twoday_ids:
+                    single_worker_load_twoday_ids_arr.append(ll[0])
+
+            worker_laod_ids = database.queryTabel('TaskFlightinfo{}'.format(nowDay), '航班编号',"维修人员 like '%{}%'".format(worker))
+            worker_laod_ids_twoday_arr = []  # 两天的量
+            if worker_laod_ids and len(worker_laod_ids) != 0:
+                for j in worker_laod_ids:
+                    worker_laod_ids_twoday_arr.append(j[0])
+            worker_laod_ids_yesterday = database.queryTabel('TaskFlightinfo{}'.format(nowDay_1), '航班编号',"维修人员 like '%{}%'".format(worker))
+            if worker_laod_ids_yesterday and len(worker_laod_ids_yesterday) != 0:
+                for m in worker_laod_ids_yesterday:
+                    worker_laod_ids_twoday_arr.append(m[0])
+
+            FX_laod_ids = database.queryTabel('TaskFlightinfo{}'.format(nowDay), '航班编号', "放行人员 like '%{}%'".format(worker))
+            if FX_laod_ids and len(FX_laod_ids) != 0:
+                for j in FX_laod_ids:
+                    worker_laod_ids_twoday_arr.append(j[0])
+
+            FX_laod_ids_yesterday = database.queryTabel('TaskFlightinfo{}'.format(nowDay_1), '航班编号',"放行人员 like '%{}%'".format(worker))
+            if FX_laod_ids_yesterday and len(FX_laod_ids_yesterday) != 0:
+                for m in FX_laod_ids_yesterday:
+                    worker_laod_ids_twoday_arr.append(m[0])
+
+            ECSJ_laod_ids = database.queryTabel('TaskFlightinfo{}'.format(nowDay), '航班编号', "二次送机 like '%{}%'".format(worker))
+            if ECSJ_laod_ids and len(ECSJ_laod_ids) != 0:
+                for j in ECSJ_laod_ids:
+                    worker_laod_ids_twoday_arr.append(j[0])
+            #暂无昨日table,待完善后启用两日查询
+            ECCJ_laod_ids_yesterday = database.queryTabel('TaskFlightinfo{}'.format(nowDay_1), '航班编号',"二次送机 like '%{}%'".format(worker))
+            if ECCJ_laod_ids_yesterday and len(ECCJ_laod_ids_yesterday) != 0:
+                for m in ECCJ_laod_ids_yesterday:
+                    worker_laod_ids_twoday_arr.append(m[0])
+
+            for kk in single_worker_load_twoday_ids_arr:
+                if str(str(kk)[:-2]) not in str(worker_laod_ids_twoday_arr):
+                    workload.deleteSingledata('workload%s' % worker_number, "编号='{}'".format(kk))
+        workload.FunctionCommit()
+    except Exception as e:
+        app_logger.log_error(e)

+ 364 - 0
Functions/DButilsFunction/checkWorkerlaod_new.py

@@ -0,0 +1,364 @@
+import datetime
+
+import unitls.baseFunction as baseFunction
+from unitls.LogerinTxt import app_logger
+from unitls.StaticDataclass import get_dic
+from .flightDB import flightDB
+
+
+def checkWorkerlaod(database:flightDB, workload:flightDB,nowDayStr1,nowDay_11):
+    try:
+        #需要初始化表格
+
+        nowDay = datetime.datetime.now().strftime("%Y%m%d")
+        nowDay_1 = (datetime.date.today() - datetime.timedelta(days=1)).strftime("%Y%m%d")
+        day=[nowDay_1,nowDay]
+
+        nowDayStr_search = datetime.date.today().strftime("%Y-%m-%d %H:%M:%S")
+        #nowDayStr_search=datetime.datetime.strptime(str("2023-06-11 00:00:00"),"%Y-%m-%d %H:%M:%S")
+        yesterday_search = (datetime.date.today() - datetime.timedelta(days=1)).strftime("%Y-%m-%d %H:%M:%S")
+
+        workernames_arr=[]
+        workernames1=database.queryTabel('pglist%s'%nowDayStr1,"*","姓名!=''")
+        workernames2=database.queryTabel('pglist%s' % nowDay_11, "*", "姓名!=''")
+        if workernames1 and len(workernames1) != 0:
+            for i in workernames1:
+                workernames_arr.append(i[0])
+        if workernames2 and len(workernames2) != 0:
+            for i in workernames2:
+                workernames_arr.append(i[0])
+
+        for worker in workernames_arr:
+            if workernames1 and len(workernames1)!= 0:
+                worker_number = baseFunction.TuplefindInList3(workernames1 , worker , 0 , 1)
+            else:
+                worker_number = baseFunction.TuplefindInList3(workernames2 , worker , 0 , 1)
+            # worker_number = a if len(a) !=0 else ""
+            single_worker_load_ids = workload.queryTabel('workload%s' % worker_number, "*", "编号!=''")
+            single_worker_load_ids_arr = []
+            if single_worker_load_ids and len(single_worker_load_ids) != 0:
+                for l in single_worker_load_ids:
+                    single_worker_load_ids_arr.append(l[0])
+
+            for nowDayStr in day:
+                worker_laod_ids=database.queryTabel('TaskFlightinfo{}'.format(nowDayStr), '*', "维修人员 like '%{}%'".format(worker))
+                worker_laod_ids_arr = []
+                if worker_laod_ids and len(worker_laod_ids)!= 0:
+                    for j in worker_laod_ids:
+                        worker_laod_ids_arr.append(j[0])
+
+                if worker_laod_ids_arr and len(worker_laod_ids_arr) != 0:
+                    for k in worker_laod_ids_arr:
+                        TYPE = get_dic('taskType')[ baseFunction.TuplefindInList3(worker_laod_ids , k , 0 , 3) ]
+                        acno = baseFunction.TuplefindInList3(worker_laod_ids , k , 0 , 1)
+                        bay = baseFunction.TuplefindInList3(worker_laod_ids , k , 0 , 10)
+                        bay1= baseFunction.TuplefindInList3(worker_laod_ids , k , 0 , 11)
+                        flight_id = k
+                        flight_id_1=str(str(flight_id))+str("-1")  #接机保障标志
+                        flight_id_2 = str(str(flight_id)) + str("-2")  # 接机保障标志
+                        flight_date = baseFunction.TuplefindInList3(worker_laod_ids , k , 0 , 2)
+                        if TYPE == "短停" and baseFunction.TuplefindInList3(worker_laod_ids, k, 0, 8) != "":
+                            eta_str= baseFunction.TuplefindInList3(worker_laod_ids , k , 0 , 8)
+                            starttime = datetime.datetime.strptime(eta_str, "%Y-%m-%d %H:%M:%S") - datetime.timedelta(minutes=15)
+                            endtime= baseFunction.TuplefindInList3(worker_laod_ids , k , 0 , 6)
+                            if flight_id_1 in single_worker_load_ids_arr:
+                                newdic = {"机号": "'%s'"%acno, "机位": "'%s'"%bay, "开始时间": "'%s'"%starttime, "结束时间": "'%s'"%endtime,"航班类型": "'%s'"%TYPE}
+                                workload.lazyUpdateItem('workload%s'%worker_number,newdic,"编号='{}'".format(flight_id_1))
+                            else:
+                                newdic = {"编号":"%s"%flight_id_1,"机号": "%s" % acno, "机位": "%s" % bay, "航班编号": "%s" % flight_id, "开始时间": "%s" % starttime,
+                                          "结束时间": "%s" % endtime, "保障日期": "%s" % flight_date, "航班类型": "%s" % TYPE,"人员状态":""}
+                                workload.lazyInsertData('workload%s'%worker_number, newdic)
+
+                        elif TYPE == '航前'  and baseFunction.TuplefindInList3(worker_laod_ids, k, 0, 5) != "":
+                            endtime_ap = baseFunction.TuplefindInList3(worker_laod_ids , k , 0 , 7)
+                            STD_ap= baseFunction.TuplefindInList3(worker_laod_ids , k , 0 , 5)
+                            starttime_ap = datetime.datetime.strptime(STD_ap, "%Y-%m-%d %H:%M:%S")-datetime.timedelta(minutes=90)
+
+                            if flight_id_1 in single_worker_load_ids_arr:
+                                newdic = {"机号": "'%s'"%acno, "机位": "'%s'"%bay1, "开始时间": "'%s'"%starttime_ap, "结束时间": "'%s'"%endtime_ap,  "航班类型": "'%s'"%TYPE}
+                                workload.lazyUpdateItem('workload%s'%worker_number,newdic,"编号='%s'"%flight_id_1)
+                            else:
+                                newdic = {"编号":"%s"%flight_id_1,"机号": "%s" % acno, "机位": "%s"%bay1, "航班编号": "%s" % flight_id, "开始时间": "%s" % starttime_ap,
+                                          "结束时间": "%s" % endtime_ap, "保障日期": "%s" % flight_date, "航班类型": "%s" % TYPE,"人员状态":""}
+                                workload.lazyInsertData('workload%s'%worker_number, newdic)
+
+                        elif TYPE == '航后'  and baseFunction.TuplefindInList3(worker_laod_ids, k, 0, 8) != "":
+                            eta_str = baseFunction.TuplefindInList3(worker_laod_ids , k , 0 , 8)
+                            starttime = datetime.datetime.strptime(eta_str, "%Y-%m-%d %H:%M:%S") - datetime.timedelta(minutes=15)
+
+                            if str(baseFunction.TuplefindInList3(worker_laod_ids, k, 0, 14)) == "8":
+                                endtime = baseFunction.TuplefindInList3(worker_laod_ids , k , 0 , 17)
+                            else:
+                                endtime=""
+
+                            if flight_id_1 in single_worker_load_ids_arr:
+                                newdic = {"机号": "'%s'" % acno, "机位": "'%s'" % bay, "开始时间": "'%s'" % starttime,
+                                          "结束时间": "'%s'" % endtime, "航班类型": "'%s'" % TYPE}
+                                workload.lazyUpdateItem('workload%s' % worker_number, newdic, "编号='{}'".format(flight_id_1))
+
+                            else:
+                                newdic = {"编号": "%s" % flight_id_1, "机号": "%s" % acno, "机位": "%s" % bay,
+                                          "航班编号": "%s" % flight_id, "开始时间": "%s" % starttime,
+                                          "结束时间": "%s" % endtime, "保障日期": "%s" % flight_date, "航班类型": "%s" % TYPE, "人员状态": ""}
+                                workload.lazyInsertData('workload%s' % worker_number, newdic)
+
+                        elif TYPE == "特后前" and baseFunction.TuplefindInList3(worker_laod_ids, k, 0, 8) != "":
+                            eta_str= baseFunction.TuplefindInList3(worker_laod_ids , k , 0 , 8)
+                            starttime = datetime.datetime.strptime(eta_str, "%Y-%m-%d %H:%M:%S") - datetime.timedelta(minutes=15)
+                            if baseFunction.TuplefindInList3(worker_laod_ids, k, 0, 7) != "" :
+                                endtime_str = baseFunction.TuplefindInList3(worker_laod_ids , k , 0 , 7)
+                                endtime = datetime.datetime.strptime(endtime_str, "%Y-%m-%d %H:%M:%S")
+
+                            else:
+                                endtime = ""
+
+                            if flight_id_1 in single_worker_load_ids_arr:
+                                newdic = {"机号": "'%s'"%acno, "机位": "'%s'"%bay, "开始时间": "'%s'"%starttime, "结束时间": "'%s'"%endtime,"航班类型": "'%s'"%TYPE}
+                                workload.lazyUpdateItem('workload%s'%worker_number,newdic,"编号='{}'".format(flight_id_1))
+
+                            else:
+                                newdic = {"编号":"%s"%flight_id_1,"机号": "%s" % acno, "机位": "%s" % bay, "航班编号": "%s" % flight_id, "开始时间": "%s" % starttime,
+                                          "结束时间": "%s" % endtime, "保障日期": "%s" % flight_date, "航班类型": "%s" % TYPE,"人员状态":""}
+                                workload.lazyInsertData('workload%s'%worker_number, newdic)
+
+
+
+                #if len(database.queryTabel('pglist%s' % nowDayStr1, '工号', "姓名 ='%s'" % worker)) != 0:
+                #    worker_number = database.queryTabel('pglist%s' % nowDayStr1, '工号', "姓名 ='%s'" % worker)[0]
+                #else:
+                #    worker_number = database.queryTabel('pglist%s' % nowDay_11, '工号', "姓名 ='%s'" % worker)[0]
+                single_worker_load_ids = workload.getSingledata('编号', 'workload%s' % worker_number)
+                single_worker_load_ids_arr = []
+                if single_worker_load_ids and  len(single_worker_load_ids) != 0:
+                    for l in single_worker_load_ids:
+                        single_worker_load_ids_arr.append(l[0])
+
+
+                FX_laod_ids = database.queryTabel('TaskFlightinfo{}'.format(nowDayStr), '航班编号', "放行人员 like '%{}%'".format(worker))
+                FX_laod_ids_arr = []
+                if FX_laod_ids and len(FX_laod_ids) != 0:
+                    for j in FX_laod_ids:
+                        FX_laod_ids_arr.append(j[0])
+
+                if FX_laod_ids_arr and len(FX_laod_ids_arr) != 0:
+                    for k in FX_laod_ids_arr:
+                        TYPE = get_dic('taskType')[ baseFunction.TuplefindInList3(worker_laod_ids , k , 0 , 3) ]
+                        acno = baseFunction.TuplefindInList3(worker_laod_ids , k , 0 , 1)
+                        bay = baseFunction.TuplefindInList3(worker_laod_ids , k , 0 , 10)
+                        bay1= baseFunction.TuplefindInList3(worker_laod_ids , k , 0 , 11)
+                        flight_id = k
+                        flight_id_1=str(str(flight_id))+str("-1")  #接机保障标志
+                        flight_id_2 = str(str(flight_id)) + str("-2")  # 接机保障标志
+                        flight_date = baseFunction.TuplefindInList3(worker_laod_ids , k , 0 , 2)
+
+
+                        if TYPE == "短停" and baseFunction.TuplefindInList3(worker_laod_ids, k, 0, 8) != "":
+                            eta_str= baseFunction.TuplefindInList3(worker_laod_ids , k , 0 , 8)
+                            starttime = datetime.datetime.strptime(eta_str, "%Y-%m-%d %H:%M:%S") - datetime.timedelta(minutes=15)
+                            if int(baseFunction.TuplefindInList3(worker_laod_ids, k, 0, 14)) >= 7:
+                                endtime = baseFunction.TuplefindInList3(worker_laod_ids , k , 0 , 15)
+                            else:
+                                endtime = ""
+
+
+                            if flight_id_1 in single_worker_load_ids_arr:
+                                if workload.queryTabel('workload%s' % worker_number, '结束时间', "编号 ='%s'"%flight_id_1)[0][0] =="":
+                                    newdic = {"机号": "'%s'"%acno, "机位": "'%s'"%bay, "开始时间": "'%s'"%starttime, "结束时间": "'%s'"%endtime,"航班类型": "'%s'"%TYPE}
+                                    workload.lazyUpdateItem('workload%s'%worker_number,newdic,"编号='{}'".format(flight_id_1))
+
+                            else:
+                                newdic = {"编号":"%s"%flight_id_1,"机号": "%s" % acno, "机位": "%s" % bay, "航班编号": "%s" % flight_id, "开始时间": "%s" % starttime,
+                                          "结束时间": "%s" % endtime, "保障日期": "%s" % flight_date, "航班类型": "%s" % TYPE,"人员状态":""}
+                                workload.lazyInsertData('workload%s'%worker_number, newdic)
+
+                        elif TYPE == '航前'  and baseFunction.TuplefindInList3(worker_laod_ids, k, 0, 5) != "":
+                            if int(baseFunction.TuplefindInList3(worker_laod_ids, k, 0, 14)) >= 7:
+                                endtime_ap = baseFunction.TuplefindInList3(worker_laod_ids , k , 0 , 15)
+                            else:
+                                endtime_ap = ""
+                            STD_ap= baseFunction.TuplefindInList3(worker_laod_ids , k , 0 , 5)
+                            starttime_ap = datetime.datetime.strptime(STD_ap, "%Y-%m-%d %H:%M:%S")-datetime.timedelta(minutes=90)
+
+                            if flight_id_1 in single_worker_load_ids_arr:
+                                if workload.queryTabel('workload%s' % worker_number, '结束时间', "编号 ='%s'" % flight_id_1)[0][0] == "":
+                                    newdic = {"机号": "'%s'"%acno, "机位": "'%s'"%bay1, "开始时间": "'%s'"%starttime_ap, "结束时间": "'%s'"%endtime_ap,  "航班类型": "'%s'"%TYPE}
+                                    workload.lazyUpdateItem('workload%s'%worker_number,newdic,"编号='%s'"%flight_id_1)
+                            else:
+                                newdic = {"编号":"%s"%flight_id_1,"机号": "%s" % acno, "机位": "%s"%bay1, "航班编号": "%s" % flight_id, "开始时间": "%s" % starttime_ap,
+                                          "结束时间": "%s" % endtime_ap, "保障日期": "%s" % flight_date, "航班类型": "%s" % TYPE,"人员状态":""}
+                                workload.lazyInsertData('workload%s'%worker_number, newdic)
+                        elif TYPE == '航后'  and baseFunction.TuplefindInList3(worker_laod_ids, k, 0, 8) != "":
+                            eta_str = baseFunction.TuplefindInList3(worker_laod_ids , k , 0 , 8)
+                            starttime = datetime.datetime.strptime(eta_str, "%Y-%m-%d %H:%M:%S") - datetime.timedelta(minutes=15)
+                            if int(baseFunction.TuplefindInList3(worker_laod_ids, k, 0, 14)) >= 8:
+                                endtime = baseFunction.TuplefindInList3(worker_laod_ids , k , 0 , 15)
+                            else:
+                                endtime=""
+
+                            if flight_id_1 in single_worker_load_ids_arr:
+                                if workload.queryTabel('workload%s' % worker_number, '结束时间', "编号 ='%s'" % flight_id_1)[0][0] == "":
+                                    newdic = {"机号": "'%s'" % acno, "机位": "'%s'" % bay, "开始时间": "'%s'" % starttime,
+                                              "结束时间": "'%s'" % endtime, "航班类型": "'%s'" % TYPE}
+                                    workload.lazyUpdateItem('workload%s' % worker_number, newdic, "编号='{}'".format(flight_id_1))
+
+                            else:
+                                newdic = {"编号": "%s" % flight_id_1, "机号": "%s" % acno, "机位": "%s" % bay,
+                                          "航班编号": "%s" % flight_id, "开始时间": "%s" % starttime,
+                                          "结束时间": "%s" % endtime, "保障日期": "%s" % flight_date, "航班类型": "%s" % TYPE, "人员状态": ""}
+                                workload.lazyInsertData('workload%s' % worker_number, newdic)
+                        elif TYPE == "特后前" and baseFunction.TuplefindInList3(worker_laod_ids, k, 0, 8) != "":
+                            eta_str= baseFunction.TuplefindInList3(worker_laod_ids , k , 0 , 8)
+                            starttime = datetime.datetime.strptime(eta_str, "%Y-%m-%d %H:%M:%S") - datetime.timedelta(minutes=15)
+                            if baseFunction.TuplefindInList3(worker_laod_ids, k, 0, 7) != "":
+                                #print(flight_date)
+                                #print(endtime_str)
+                                endtime_str =  baseFunction.TuplefindInList3(worker_laod_ids , k , 0 , 7)
+                                endtime = datetime.datetime.strptime(endtime_str, "%Y-%m-%d %H:%M:%S")
+                            else:
+                                endtime = ""
+                            if flight_id_1 in single_worker_load_ids_arr:
+                                newdic = {"机号": "'%s'"%acno, "机位": "'%s'"%bay, "开始时间": "'%s'"%starttime, "结束时间": "'%s'"%endtime,"航班类型": "'%s'"%TYPE}
+                                workload.lazyUpdateItem('workload%s'%worker_number,newdic,"编号='{}'".format(flight_id_1))
+
+                            else:
+                                newdic = {"编号":"%s"%flight_id_1,"机号": "%s" % acno, "机位": "%s" % bay, "航班编号": "%s" % flight_id, "开始时间": "%s" % starttime,
+                                          "结束时间": "%s" % endtime, "保障日期": "%s" % flight_date, "航班类型": "%s" % TYPE,"人员状态":""}
+                                workload.lazyInsertData('workload%s'%worker_number, newdic)
+
+
+                #if len(database.queryTabel('pglist%s' % nowDayStr1, '工号', "姓名 ='%s'" % worker)) != 0:
+                #    worker_number = database.queryTabel('pglist%s' % nowDayStr1, '工号', "姓名 ='%s'" % worker)[0]
+                #else:
+                #    worker_number = database.queryTabel('pglist%s' % nowDay_11, '工号', "姓名 ='%s'" % worker)[0]
+                single_worker_load_ids = workload.getSingledata('编号', 'workload%s' % worker_number)
+                single_worker_load_ids_arr = []
+                if single_worker_load_ids and len(single_worker_load_ids) != 0:
+                    for l in single_worker_load_ids:
+                        single_worker_load_ids_arr.append(l[0])
+
+                ECCJ_laod_ids = database.queryTabel('TaskFlightinfo{}'.format(nowDayStr), '航班编号', "二次送机 like '%{}%'".format(worker))
+                ECSJ_laod_ids_arr = []
+                if ECCJ_laod_ids and len(ECCJ_laod_ids) != 0:
+                    for j in ECCJ_laod_ids:
+                        ECSJ_laod_ids_arr.append(j[0])
+
+                if ECSJ_laod_ids_arr and  len(ECSJ_laod_ids_arr) != 0:
+                    for k in ECSJ_laod_ids_arr:
+                        TYPE = get_dic('taskType')[ baseFunction.TuplefindInList3(worker_laod_ids , k , 0 , 3) ]
+                        acno = baseFunction.TuplefindInList3(worker_laod_ids , k , 0 , 1)
+                        bay = baseFunction.TuplefindInList3(worker_laod_ids , k , 0 , 10)
+                        bay1= baseFunction.TuplefindInList3(worker_laod_ids , k , 0 , 11)
+                        flight_id = k
+                        flight_id_1=str(str(flight_id))+str("-1")  #接机保障标志
+                        flight_id_2 = str(str(flight_id)) + str("-2")  # 接机保障标志
+                        flight_date = baseFunction.TuplefindInList3(worker_laod_ids , k , 0 , 2)
+
+                        if TYPE == "短停" and baseFunction.TuplefindInList3(worker_laod_ids, k, 0, 5) != "":
+                            if baseFunction.TuplefindInList3(worker_laod_ids, k, 0, 7) == "" :
+                                starttime_str =  baseFunction.TuplefindInList3(worker_laod_ids , k , 0 , 5)
+                                starttime = datetime.datetime.strptime(starttime_str, "%Y-%m-%d %H:%M:%S")-datetime.timedelta(minutes=25)
+                                if flight_id_2 in single_worker_load_ids_arr:
+                                    newdic = {"机号": "'%s'" % acno, "机位": "'%s'" % bay, "开始时间": "'%s'" % starttime, "航班类型": "'%s'" % TYPE}
+                                    workload.lazyUpdateItem('workload%s' % worker_number, newdic, "编号='{}'".format(flight_id_2))
+
+                                else:
+                                    newdic = {"编号": "%s" % flight_id_2, "机号": "%s" % acno, "机位": "%s" % bay,
+                                              "航班编号": "%s" % flight_id, "开始时间": "%s" % starttime,
+                                              "结束时间": "" , "保障日期": "%s" % flight_date, "航班类型": "%s" % TYPE,
+                                              "人员状态": ""}
+                                    workload.lazyInsertData('workload%s' % worker_number, newdic)
+                            if baseFunction.TuplefindInList3(worker_laod_ids, k, 0, 7) != "" :
+                                endtime_str = baseFunction.TuplefindInList3(worker_laod_ids , k , 0 , 7)
+                                endtime = datetime.datetime.strptime(endtime_str, "%Y-%m-%d %H:%M:%S")
+                                starttime = datetime.datetime.strptime(endtime_str, "%Y-%m-%d %H:%M:%S")- datetime.timedelta(minutes=25)
+
+                                if flight_id_2 in single_worker_load_ids_arr:
+                                    if workload.queryTabel('workload%s' % worker_number, "开始时间", "编号='{}'".format(flight_id_2))[0][0] != "":
+                                        newdic = {"机号": "'%s'" % acno, "机位": "'%s'" % bay, "结束时间": "'%s'" % endtime, "航班类型": "'%s'" % TYPE}
+                                        workload.lazyUpdateItem('workload%s' % worker_number, newdic, "编号='{}'".format(flight_id_2))
+                                    else:
+                                        newdic = {"机号": "'%s'" % acno, "机位": "'%s'" % bay,"开始时间": "'%s'" % starttime, "结束时间": "'%s'" % endtime, "航班类型": "'%s'" % TYPE}
+                                        workload.lazyUpdateItem('workload%s' % worker_number, newdic, "编号='{}'".format(flight_id_2))
+                                else:
+                                    newdic = {"编号": "%s" % flight_id_2, "机号": "%s" % acno, "机位": "%s" % bay,
+                                              "航班编号": "%s" % flight_id, "开始时间": "%s" % starttime,
+                                              "结束时间": "%s"%endtime, "保障日期": "%s" % flight_date, "航班类型": "%s" % TYPE,
+                                              "人员状态": ""}
+                                    workload.lazyInsertData('workload%s' % worker_number, newdic)
+                        if TYPE == "特后前" and baseFunction.TuplefindInList3(worker_laod_ids, k, 0, 5) != "":
+                            if baseFunction.TuplefindInList3(worker_laod_ids, k, 0, 7) == "":
+                                starttime_str = baseFunction.TuplefindInList3(worker_laod_ids , k , 0 , 5)
+                                starttime = datetime.datetime.strptime(starttime_str, "%Y-%m-%d %H:%M:%S")-datetime.timedelta(minutes=25)
+                                if flight_id_2 in single_worker_load_ids_arr:
+                                    newdic = {"机号": "'%s'" % acno, "机位": "'%s'" % bay, "开始时间": "'%s'" % starttime, "航班类型": "'%s'" % TYPE}
+                                    workload.lazyUpdateItem('workload%s' % worker_number, newdic, "编号='{}'".format(flight_id_2))
+
+                                else:
+                                    newdic = {"编号": "%s" % flight_id_2, "机号": "%s" % acno, "机位": "%s" % bay,
+                                              "航班编号": "%s" % flight_id, "开始时间": "%s" % starttime,
+                                              "结束时间": "" , "保障日期": "%s" % flight_date, "航班类型": "%s" % TYPE,
+                                              "人员状态": ""}
+                                    workload.lazyInsertData('workload%s' % worker_number, newdic)
+                            if baseFunction.TuplefindInList3(worker_laod_ids, k, 0, 7) != "":
+                                endtime_str = baseFunction.TuplefindInList3(worker_laod_ids , k , 0 , 7)
+                                endtime = datetime.datetime.strptime(endtime_str, "%Y-%m-%d %H:%M:%S")
+                                starttime = datetime.datetime.strptime(endtime_str, "%Y-%m-%d %H:%M:%S") - datetime.timedelta(minutes=25)
+
+                                if flight_id_2 in single_worker_load_ids_arr:
+                                    if workload.queryTabel('workload%s' % worker_number, "开始时间", "编号='{}'".format(flight_id_2))[0][0] != "":
+                                        newdic = {"机号": "'%s'" % acno, "机位": "'%s'" % bay, "结束时间": "'%s'" % endtime, "航班类型": "'%s'" % TYPE}
+                                        workload.lazyUpdateItem('workload%s' % worker_number, newdic, "编号='{}'".format(flight_id_2))
+                                    else:
+                                        newdic = {"机号": "'%s'" % acno, "机位": "'%s'" % bay,"开始时间": "'%s'" % starttime, "结束时间": "'%s'" % endtime, "航班类型": "'%s'" % TYPE}
+                                        workload.lazyUpdateItem('workload%s' % worker_number, newdic, "编号='{}'".format(flight_id_2))
+                                else:
+                                    newdic = {"编号": "%s" % flight_id_2, "机号": "%s" % acno, "机位": "%s" % bay,
+                                              "航班编号": "%s" % flight_id, "开始时间": "%s" % starttime,
+                                              "结束时间": "%s"%endtime, "保障日期": "%s" % flight_date, "航班类型": "%s" % TYPE,
+                                              "人员状态": ""}
+                                    workload.lazyInsertData('workload%s' % worker_number, newdic)
+
+
+
+            single_worker_load_twoday_ids = workload.queryTabel('workload%s' % worker_number, '编号',"保障日期='{}'or 保障日期='{}'".format(nowDayStr_search,yesterday_search))
+            single_worker_load_twoday_ids_arr = []
+            if single_worker_load_twoday_ids and len(single_worker_load_twoday_ids) != 0:
+                for ll in single_worker_load_twoday_ids:
+                    single_worker_load_twoday_ids_arr.append(ll[0])
+
+            worker_laod_ids = database.queryTabel('TaskFlightinfo{}'.format(nowDay), '航班编号',"维修人员 like '%{}%'".format(worker))
+            worker_laod_ids_twoday_arr = []  # 两天的量
+            if worker_laod_ids and len(worker_laod_ids) != 0:
+                for j in worker_laod_ids:
+                    worker_laod_ids_twoday_arr.append(j[0])
+            worker_laod_ids_yesterday = database.queryTabel('TaskFlightinfo{}'.format(nowDay_1), '航班编号',"维修人员 like '%{}%'".format(worker))
+            if worker_laod_ids_yesterday and len(worker_laod_ids_yesterday) != 0:
+                for m in worker_laod_ids_yesterday:
+                    worker_laod_ids_twoday_arr.append(m[0])
+
+            FX_laod_ids = database.queryTabel('TaskFlightinfo{}'.format(nowDay), '航班编号', "放行人员 like '%{}%'".format(worker))
+            if FX_laod_ids and len(FX_laod_ids) != 0:
+                for j in FX_laod_ids:
+                    worker_laod_ids_twoday_arr.append(j[0])
+
+            FX_laod_ids_yesterday = database.queryTabel('TaskFlightinfo{}'.format(nowDay_1), '航班编号',"放行人员 like '%{}%'".format(worker))
+            if FX_laod_ids_yesterday and len(FX_laod_ids_yesterday) != 0:
+                for m in FX_laod_ids_yesterday:
+                    worker_laod_ids_twoday_arr.append(m[0])
+
+            ECSJ_laod_ids = database.queryTabel('TaskFlightinfo{}'.format(nowDay), '航班编号', "二次送机 like '%{}%'".format(worker))
+            if ECSJ_laod_ids and len(ECSJ_laod_ids) != 0:
+                for j in ECSJ_laod_ids:
+                    worker_laod_ids_twoday_arr.append(j[0])
+            #暂无昨日table,待完善后启用两日查询
+            ECCJ_laod_ids_yesterday = database.queryTabel('TaskFlightinfo{}'.format(nowDay_1), '航班编号',"二次送机 like '%{}%'".format(worker))
+            if ECCJ_laod_ids_yesterday and len(ECCJ_laod_ids_yesterday) != 0:
+                for m in ECCJ_laod_ids_yesterday:
+                    worker_laod_ids_twoday_arr.append(m[0])
+
+            for kk in single_worker_load_twoday_ids_arr:
+                if str(str(kk)[:-2]) not in str(worker_laod_ids_twoday_arr):
+                    workload.deleteSingledata('workload%s' % worker_number, "编号='{}'".format(kk))
+        workload.FunctionCommit()
+    except Exception as e:
+        app_logger.log_error(e)

+ 125 - 0
Functions/DButilsFunction/checkflightplan.py

@@ -0,0 +1,125 @@
+import datetime
+import unitls.baseFunction as baseFunction
+from unitls.LogerinTxt import app_logger
+from unitls.StaticDataclass import get_dic
+from .flightDB import flightDB
+from .initFlightDatabase import initFlightDatabase
+
+
+def waringinsert(database,text,taskid,col):
+    try:
+        newDic = {"警告信息": text,"航班编号":taskid, "信息状态": "", "提示信息": "", "产生时间": "%s" % datetime.datetime.now(),
+               "处理人": "", "处理时间": "","变更字段": col, "显示对象": "", "提示内容": ""}
+        database.lazyInsertData('logs', newDic)
+    except Exception as e:
+        app_logger.log_error(f"警告信息插入错误,插入信息{text},{taskid},{col},错误信息见下一条")
+        app_logger.log_error(e)
+def checkFlightplan(database:flightDB,wokload:flightDB):
+    updatedic = {2: 11, 4: 13,5:14,6: 16,7: 17, 8: 9,10: 7, 11: 8, 15: 18, 16: 18,21: 12, 25: 3, 26: 2, 33 : 20} #taskinfo :flightplan
+    try:
+        print(datetime.datetime.now(),'[数据库操作]开始校验航班')
+        nowDay = datetime.datetime.now().strftime("%Y%m%d")
+        nowDay_1 = (datetime.date.today() - datetime.timedelta(days=1)).strftime("%Y%m%d")
+        nowDay_2 = (datetime.date.today() + datetime.timedelta(days=1)).strftime("%Y%m%d")
+        now_20 = (datetime.datetime.now() + datetime.timedelta(hours=5)).strftime("%Y%m%d")
+        initFlightDatabase(database, wokload, now_20)
+        initFlightDatabase(database, wokload, nowDay_1)
+        initFlightDatabase(database, wokload, nowDay_2)
+        initFlightDatabase(database, wokload, nowDay)
+
+        if now_20 == nowDay:
+            day = [nowDay, nowDay_1]
+        else:
+            day = [nowDay, nowDay_1, nowDay_2]
+        for nowDayStr in day:
+            flightplan_flight_ids = database.queryTabel('flightplaninfo{}'.format(nowDayStr),"*","备1 ='1' and flgCs =''")
+            TaskFlightinfo_flight_ids = database.queryTabel('TaskFlightinfo{}'.format(nowDayStr), '备4,备5', "航班编号!=''")
+            TaskFlightinfo_ids = database.queryTabel('TaskFlightinfo{}'.format(nowDayStr), '航班编号', "航班编号!=''")
+
+            flight_id_now = []
+            if flightplan_flight_ids and len(flightplan_flight_ids) != 0:
+                for sortkey in flightplan_flight_ids:
+                    if str(sortkey[0]) not in str(TaskFlightinfo_flight_ids):
+                        flight_id_now.append(f"System{sortkey[0]}")
+                        TaskflightinfoLabel=get_dic("TaskflightinfoLabel")
+                        if f"System{sortkey[0]}" not in str(TaskFlightinfo_ids):
+                            peopleSchedule_ids = database.queryTabel('peopleSchedule{}'.format(nowDayStr) , '编号,附加消息', "航班编号 ='%s'"%f"System{sortkey[0]}")
+                            newdic={"航班编号":f"System{sortkey[0]}","进出港城市":sortkey[5]+"-"+sortkey[6],"航班来源":"飞机排班","机号":sortkey[1].replace("B",""),"取消标志":0}
+                            if sortkey[6] == "天府":
+                                newdic["航班类型"] = "AF"
+                            else:
+                                newdic["航班类型"] = "AP"
+
+                            for key,value in updatedic.items():
+                                newdic[TaskflightinfoLabel[key]]= sortkey[value]
+                            for key in TaskflightinfoLabel:
+                                if key not in newdic.keys():
+                                    newdic[key]=""
+                            database.lazyInsertData('TaskFlightinfo{}'.format(nowDayStr), newdic)
+                            if sortkey[6] == "天府":
+                                if  f"System{sortkey[0]}-1-A" not in str(peopleSchedule_ids):
+                                    newdic={"编号":f"System{sortkey[0]}-1-A","航班编号":f"System{sortkey[0]}","显示模式":"A","放行":"","勤务1":"","勤务2":"","工1":"","工2":"","工3":"","附加消息":"AMRO航班缺失,无法派工,航班信息来源于飞机排班,请核实航班类型和保障时间"}
+                                    database.lazyInsertData('peopleSchedule{}'.format(nowDayStr), newdic)
+                                else:
+                                    fj = peopleSchedule_ids[0][1]
+                                    if "AMRO航班缺失,无法派工,航班信息来源于飞机排班,请核实航班类型和保障时间" not in fj:
+                                        newdic={"附加消息":"'%s'"%(fj+";AMRO航班缺失,无法派工,航班信息来源于飞机排班,请核实航班类型和保障时间")}
+                                    else:
+                                        newdic={"附加消息":"'AMRO航班缺失,无法派工,航班信息来源于飞机排班,请核实航班类型和保障时间'"}
+                                    database.lazyUpdateItem('peopleSchedule{}'.format(nowDayStr), newdic,"编号='%s'"%f"System{sortkey[0]}-1-A")
+                            elif sortkey[5] == "天府":
+                                if  f"System{sortkey[0]}-2-A" not in str(peopleSchedule_ids):
+                                    newdic={"编号":f"System{sortkey[0]}-2-A","航班编号":f"System{sortkey[0]}","显示模式":"A","放行":"","勤务1":"","勤务2":"","工1":"","工2":"","工3":"","附加消息":"AMRO航班缺失,无法派工,航班信息来源于飞机排班,请核实航班类型和保障时间"}
+                                    database.lazyInsertData('peopleSchedule{}'.format(nowDayStr), newdic)
+                                else:
+                                    fj = peopleSchedule_ids[0][1]
+                                    if "AMRO航班缺失,无法派工,航班信息来源于飞机排班,请核实航班类型和保障时间" not in fj:
+                                        newdic={"附加消息":"'%s'"%(fj+";AMRO航班缺失,无法派工,航班信息来源于飞机排班,请核实航班类型和保障时间")}
+                                    else:
+                                        newdic={"附加消息":"'AMRO航班缺失,无法派工,航班信息来源于飞机排班,请核实航班类型和保障时间'"}
+                                    database.lazyUpdateItem('peopleSchedule{}'.format(nowDayStr), newdic,"编号='%s'"%f"System{sortkey[0]}-2-A")
+
+                            waringinsert(database,f"{sortkey[1]}/{sortkey[12]}在Amro任务派工模块无显示,已读取飞机排班系统信息显示,航班将无法派工,请核对航班、随机等信息并加强监控!",f"System{sortkey[0]}","航班缺失警告")
+                        else:
+                            TaskFlightinfos = database.queryTabel('TaskFlightinfo{}'.format(nowDayStr), '*' ,"航班编号='%s'"%f"System{sortkey[0]}")[0]
+                            for key,value in updatedic.items():
+                                if TaskFlightinfos[key] != sortkey[value]:
+                                    newdic={TaskflightinfoLabel[key]:"'%s'"%sortkey[value]}
+                                    database.lazyUpdateItem('TaskFlightinfo{}'.format(nowDayStr),newdic,"航班编号='%s'"%f"System{sortkey[0]}")
+                                if (sortkey[5]+sortkey[6]) !=TaskFlightinfos[23]:
+                                    newdic={TaskflightinfoLabel[23]:"'%s'"%(sortkey[5]+"-"+sortkey[6])}
+                                    database.lazyUpdateItem('TaskFlightinfo{}'.format(nowDayStr),newdic,"航班编号='%s'"%f"System{sortkey[0]}")
+                                if sortkey[1].replace("B","") != TaskFlightinfos[1]:
+                                    newdic={"机号":"'%s'"%sortkey[1].replace("B","")}
+                                    database.lazyUpdateItem('TaskFlightinfo{}'.format(nowDayStr),newdic,"航班编号='%s'"%f"System{sortkey[0]}")
+                                if sortkey[6] == "天府" and TaskFlightinfos[3] != "AF":
+                                    newdic={"航班类型":"'AF'"}
+                                    database.lazyUpdateItem('TaskFlightinfo{}'.format(nowDayStr), newdic,"航班编号='%s'" % f"System{sortkey[ 0 ]}")
+                                elif sortkey[5] == "天府" and TaskFlightinfos[3] != "AP":
+                                    newdic={"航班类型":"'AP'"}
+                                    database.lazyUpdateItem('TaskFlightinfo{}'.format(nowDayStr), newdic,"航班编号='%s'" % f"System{sortkey[ 0 ]}")
+                    elif str(sortkey[0]) in str(TaskFlightinfo_flight_ids) and f"System{sortkey[0]}" in str(TaskFlightinfo_ids):
+                        database.deleteSingledata('TaskFlightinfo{}'.format(nowDayStr),"航班编号='%s'"%f"System{sortkey[0]}")
+                        waringinsert(database,f"{sortkey[1]}/{sortkey[12]}在Amro任务派工模块中恢复显示,如未派工请前往派工!飞机排班显示航班将在5min中后自动删除,做好人员安排信息备份!",f"System{sortkey[0]}","航班缺失恢复警告")
+            database.FunctionCommit()
+            flightinfo_flight_ids = database.queryTabel('TaskFlightinfo{}'.format(nowDayStr), '*',"航班来源 ='飞机排班'")
+            if len(flightinfo_flight_ids) != 0 :
+                for iii in flightinfo_flight_ids:
+                    datas = baseFunction.TuplefindInList1(flightinfo_flight_ids , iii[0], 0)[0]
+                    if str(iii[0]) not in flight_id_now:
+                        cancelid = datas[35] if datas[35] else 0
+                        newcancelid = int(cancelid) + 1
+                        if int(newcancelid) < 3:
+                            newdic = {"取消标志" : "'%s'" % newcancelid}
+                            database.lazyUpdateItem('TaskFlightinfo{}'.format(nowDayStr) , newdic ,"航班编号='%s'" % iii[0])
+                        else:
+                            database.deleteSingledata("TaskFlightinfo{}".format(nowDayStr),"航班编号='%s'" %f"{iii[0]}")
+                            #waringinsert(database,f"{datas[1]}/{datas[12]}Sytem航班删除!",f"System{datas[0]}","Sytem航班自动删除")
+                        database.FunctionCommit()
+    except Exception as e:
+        #print(e)
+        database.FunctionCommit()
+        app_logger.log_error(e)
+        app_logger.log_error("飞机排班系统校验航班失败")
+
+    print(datetime.datetime.now(),'[数据库操作]结束校验航班')

+ 190 - 0
Functions/DButilsFunction/checkworkload_New.py

@@ -0,0 +1,190 @@
+import datetime
+
+import unitls.baseFunction as baseFunction
+from unitls.LogerinTxt import app_logger
+from unitls.StaticDataclass import get_dic
+from .flightDB import flightDB
+
+newWorkloadLabel=get_dic("newWorkloadLabel")
+startimeReDic={"WXJJ":25,"WXAP":100,"WXAF":0,"WXTAF":0,"FXAP":100,"FXAF":0,"FXTAF":0,"FXTR":0,"WXES":35}
+endtimeReDic={"WXJJ":10,"WXAP":10,"WXAF":120,"WXTAF":60,"FXAP":10,"FXAF":120,"FXTAF":60,"FXTR":30,"WXES":10}
+standvalueReDic={"WXJJ":0.3,"WXES":0.4,"WXAP":0.6,"WXAF":1,"WXTAF":0.8,"FXAP":0.9,"FXAF":1.2,"FXTAF":1,"FXTR":0.3}
+
+#注意,在航后接机,特后前接机需要移除放行,否则会平摊过多分值
+
+
+def Computer(workload,ids ,start ,end ,bay ,peoples,flightdate,taskid,flighttype,day,workloadinfos,time1,time2,standtime,type,jbry,fx=None):#TIME1 到位时间  TIME2 离开时间 standtime 标准工时,type保障类型
+    fxpeople=fx.replace("√","") if fx else ""
+    typedic={"接机勤务":"-1-","送机勤务":"-2-","航前放行":"-3-","航后放行":"-3-","特后前放行":"-3-","短停放行":"-3-","航前维修":"-4-","航后维修":"-5-","特后前维修":"-6-"}
+    startime = datetime.datetime.strptime(start, "%Y-%m-%d %H:%M:%S")-datetime.timedelta(minutes=time1+1)
+    if end != "":
+        endtime = datetime.datetime.strptime(end, "%Y-%m-%d %H:%M:%S")+datetime.timedelta(minutes=time2)
+        if endtime < datetime.datetime.now():
+            flightsts = "完工"
+            endtime_str = '[实]' + endtime.strftime("%Y-%m-%d %H:%M:%S")
+        elif startime > datetime.datetime.now():
+            flightsts = "未开始"
+            endtime_str = '[预]' + endtime.strftime("%Y-%m-%d %H:%M:%S")
+        else:
+            flightsts = "进行中"
+            endtime_str = '[预]' + endtime.strftime("%Y-%m-%d %H:%M:%S")
+    else:
+        endtime =datetime.datetime.strptime(start, "%Y-%m-%d %H:%M:%S")+datetime.timedelta(minutes=time2)
+        endtime_str='[预]'+endtime.strftime("%Y-%m-%d %H:%M:%S")
+        if startime < datetime.datetime.now():
+            flightsts = "进行中"
+        else:
+            flightsts = "未开始"
+
+    costtime = (endtime - startime).total_seconds() / 60
+    standardcost = (costtime / (time1+time2)) * standtime
+    peopleslist=peoples.replace("√","").replace(fxpeople,"").split(",")
+    for people in peopleslist:
+        single_standardcost = round(standardcost/len(peopleslist),2)
+        jb = ""
+        if jbry != "":
+            if people in jbry:
+                jb1 = datetime.datetime.strptime(day+" 09:10:00","%Y%m%d %H:%M:%S")
+                limit = datetime.datetime.strptime(day+" 11:10:00","%Y%m%d %H:%M:%S")
+                jb2 = datetime.datetime.strptime(day+" 20:40:00","%Y%m%d %H:%M:%S")
+                if startime < jb1:
+                    endtime = jb1 + datetime.timedelta(minutes=25)
+                    endtime_str = '[实]' + endtime.strftime("%Y-%m-%d %H:%M:%S")
+                    flightsts = "完工"
+                    jb = "交班"
+                elif limit < startime < jb2:
+                    endtime = jb2+datetime.timedelta(minutes=25)
+                    endtime_str = '[实]' + endtime.strftime("%Y-%m-%d %H:%M:%S")
+                    flightsts = "完工"
+                    jb = "交班"
+            else:
+                jb1 = datetime.datetime.strptime(day + " 09:10:00", "%Y%m%d %H:%M:%S")
+                limit = datetime.datetime.strptime(day+" 11:10:00","%Y%m%d %H:%M:%S")
+                jb2 = datetime.datetime.strptime(day + " 20:40:00", "%Y%m%d %H:%M:%S")
+                if startime < jb1:
+                    startime = jb1
+                    jb = "接班"
+                elif limit < startime < jb2:
+                    startime = jb2
+                    jb = "接班"
+                if endtime <= startime:
+                    endtime = startime+datetime.timedelta(minutes=30)
+                    if datetime.datetime.now() >= endtime:
+                        flightsts = "完工"
+                    else:
+                        flightsts = "进行中"
+
+
+        id = taskid+typedic[type]+people
+        if id not in ids and id not in nowids:
+            nowids.append(id)
+            #print(nowids)
+            newdic = {"编号":id,"任务编号":taskid,"航班日期":flightdate,"首次时间":startime,"开始时间":startime,"结束时间":endtime_str,
+                    "机位":bay,"类型":type,"总用时":costtime,"标准工时":single_standardcost,"人员":people,"航班状态":flightsts,'备1':flighttype,"备3": jb}
+            for i in newWorkloadLabel:
+                if i not in newdic.keys():
+                    newdic[i] = ""
+            workload.lazyInsertData('workload%s'%day, newdic)
+        else:
+            oldflightsts= baseFunction.TuplefindInList3(workloadinfos , id , 0 , 12)
+            if oldflightsts != "完工":
+                newdic = {"开始时间":"'%s'"%startime,"结束时间":"'%s'"%endtime_str,"总用时":"'%s'"%costtime,
+                        "标准工时":"'%s'"%single_standardcost,"航班状态":"'%s'"%flightsts,"备3":"'%s'"%jb}
+                workload.lazyUpdateItem('workload%s'%day, newdic, "编号='{}'".format(id))
+
+
+def checkWorkerlaod_new(database:flightDB, workload:flightDB,nowDayStr1,nowDay_11):
+    global nowids
+    nowids = []
+    if nowDayStr1 == nowDay_11:
+        checkdays = [nowDayStr1]
+    else:
+        checkdays = [nowDayStr1, nowDay_11]
+    try:
+        for day in checkdays:
+            flightinfos=database.queryTabel('TaskFlightinfo{}'.format(day), '*', "维修人员 !='' or 放行人员 !='' or 二次送机 !=''")
+            workloadinfos=workload.queryTabel('workload{}'.format(day), '*', "编号 !=''")
+            workload_ids_arr=[]
+            if workloadinfos and len(workloadinfos) != 0:
+                for workloadinfo in workloadinfos:
+                    workload_ids_arr.append(workloadinfo[0])
+            workloadAllidsnow=[]
+            if flightinfos and len(flightinfos) != 0:
+                for flightinfo in flightinfos:
+                    if flightinfo[12] and flightinfo[3] == "TR" and flightinfo[8]:  #如果是短停\航后 特后前,且接机人员不是空
+                        peopleslist = flightinfo[12].replace("√", "").split(",")
+                        for people in peopleslist:
+                            workloadAllidsnow.append((flightinfo[0]+"-1-"+people))
+                        Computer(workload,workload_ids_arr,flightinfo[8],flightinfo[6],flightinfo[10],flightinfo[12],flightinfo[2],flightinfo[0],
+                                 flightinfo[3],day,workloadinfos,startimeReDic['WXJJ'],endtimeReDic['WXJJ'],standvalueReDic['WXJJ'],"接机勤务",flightinfo[37])
+                    elif flightinfo[12] and flightinfo[3] == "AP" and flightinfo[5]:
+                        peopleslist = flightinfo[12].replace("√", "").split(",")
+                        for people in peopleslist:
+                            workloadAllidsnow.append((flightinfo[0]+"-4-"+people))
+                        Computer(workload,workload_ids_arr,flightinfo[5],flightinfo[7],flightinfo[11],flightinfo[12],flightinfo[2],flightinfo[0],
+                                 flightinfo[3],day,workloadinfos,startimeReDic['WXAP'],endtimeReDic['WXAP'],standvalueReDic['WXAP'],"航前维修",flightinfo[37])
+                    elif flightinfo[12] and flightinfo[3] == "AF" and flightinfo[8]:
+                        peopleslist = flightinfo[12].replace("√", "").split(",")
+                        for people in peopleslist:
+                            workloadAllidsnow.append((flightinfo[0]+"-5-"+people))
+                        Computer(workload,workload_ids_arr,flightinfo[8],flightinfo[6],flightinfo[10],flightinfo[12],flightinfo[2],flightinfo[0],
+                                 flightinfo[3],day,workloadinfos,startimeReDic['WXAF'],endtimeReDic['WXAF'],standvalueReDic['WXAF'],"航后维修",flightinfo[37],flightinfo[13])
+
+                    elif flightinfo[12] != "" and flightinfo[3] == "TAF" and flightinfo[8]:
+                        peopleslist = flightinfo[12].replace("√", "").split(",")
+                        for people in peopleslist:
+                            workloadAllidsnow.append((flightinfo[0]+"-6-"+people))
+                        Computer(workload,workload_ids_arr,flightinfo[8],flightinfo[6],flightinfo[10],flightinfo[12],flightinfo[2],flightinfo[0],
+                                 flightinfo[3],day,workloadinfos,startimeReDic['WXTAF'],endtimeReDic['WXTAF'],standvalueReDic['WXTAF'],"特后前维修",flightinfo[37],flightinfo[13])
+
+                    if flightinfo[13] != "" and flightinfo[3] == "TR" and flightinfo[8]: #放行计算
+                        peopleslist = flightinfo[13].replace("√", "").split(",")
+                        for people in peopleslist:
+                            workloadAllidsnow.append((flightinfo[0]+"-3-"+people))
+                        Computer(workload,workload_ids_arr,flightinfo[8],flightinfo[6],flightinfo[10],flightinfo[13],flightinfo[2],flightinfo[0],
+                                 flightinfo[3],day,workloadinfos,startimeReDic['FXTR'],endtimeReDic['FXTR'],standvalueReDic['FXTR'],"短停放行",flightinfo[37])
+                    elif flightinfo[13] != "" and flightinfo[3] == "AP" and flightinfo[5]:
+                        peopleslist = flightinfo[13].replace("√", "").split(",")
+                        for people in peopleslist:
+                            workloadAllidsnow.append((flightinfo[0]+"-3-"+people))
+                        Computer(workload,workload_ids_arr,flightinfo[5],flightinfo[7],flightinfo[11],flightinfo[13],flightinfo[2],flightinfo[0],
+                                 flightinfo[3],day,workloadinfos,startimeReDic['FXAP'],endtimeReDic['FXAP'],standvalueReDic['FXAP'],"航前放行",flightinfo[37])
+                    elif flightinfo[13] != "" and flightinfo[3] == "TAF" and flightinfo[8]:
+                        peopleslist = flightinfo[13].replace("√", "").split(",")
+                        for people in peopleslist:
+                            workloadAllidsnow.append((flightinfo[0]+"-3-"+people))
+                        Computer(workload,workload_ids_arr,flightinfo[8],flightinfo[6],flightinfo[10],flightinfo[13],flightinfo[2],flightinfo[0],
+                                 flightinfo[3],day,workloadinfos,startimeReDic['FXTAF'],endtimeReDic['FXTAF'],standvalueReDic['FXTAF'],"特后前放行",flightinfo[37])
+                    elif flightinfo[13] != "" and flightinfo[3] == "AF" and flightinfo[8]:
+                        peopleslist = flightinfo[13].replace("√", "").split(",")
+                        for people in peopleslist:
+                            workloadAllidsnow.append((flightinfo[0]+"-3-"+people))
+                        Computer(workload,workload_ids_arr,flightinfo[8],flightinfo[6],flightinfo[10],flightinfo[13],flightinfo[2],flightinfo[0],
+                                 flightinfo[3],day,workloadinfos,startimeReDic['FXAF'],endtimeReDic['FXAF'],standvalueReDic['FXAF'],"航后放行",flightinfo[37])
+
+                    if flightinfo[19] != "" and flightinfo[3] != "AF" and flightinfo[5]:
+                        peopleslist = flightinfo[19].replace("√", "").split(",")
+                        for people in peopleslist:
+                            workloadAllidsnow.append((flightinfo[0]+"-2-"+people))
+                        Computer(workload,workload_ids_arr,flightinfo[5],flightinfo[7],flightinfo[11] if flightinfo[3] == "AP" else flightinfo[10],flightinfo[19],
+                                 flightinfo[2],flightinfo[0],flightinfo[3],day,workloadinfos,startimeReDic['WXES'],endtimeReDic['WXES'],standvalueReDic['WXES'],"送机勤务",flightinfo[37])
+
+                workload.FunctionCommit()
+            Cancelresult = [x for x in workload_ids_arr if x not in workloadAllidsnow]
+            for x in Cancelresult:
+                taskid = x.split("-")[0]
+                JBRY= baseFunction.TuplefindInList3(flightinfos , taskid , 0 , 37)
+                people= baseFunction.TuplefindInList3(workloadinfos , x , 0 , 11)
+                if people not in JBRY and "人工" not in x:
+                    newdic={"备2":"'1'"}
+                    workload.lazyUpdateItem('workload%s' % day,  newdic, "编号='{}'".format(x))
+                else:
+                    newdic = {"备2": "'0'"}
+                    workload.lazyUpdateItem('workload%s' % day, newdic, "编号='{}'".format(x))
+            workload.FunctionCommit()
+    except Exception as e:
+        app_logger.log_error(e)
+        app_logger.log_error(flightinfo)
+
+
+

+ 25 - 0
Functions/DButilsFunction/createWorkloadtables.py

@@ -0,0 +1,25 @@
+import datetime
+
+from unitls.LogerinTxt import app_logger
+from unitls.StaticDataclass import get_dic
+from .flightDB import flightDB
+
+
+def createWorkloadtables(fdb:flightDB, workLoad:flightDB):
+    try:
+        workloadDic = {}
+        primaryKey = 'INTEGER PRIMARY KEY AUTOINCREMENT  NOT NULL'
+        primaryKey2 = 'TEXT UNIQUE NOT NULL'
+        #print(len(fdb.getAlldata("workerinfo")))
+        if len(fdb.getAlldata("workerinfo")) != 0:
+            for workloadkey in list(get_dic('workloadLabel'))[1:]:
+                workloadDic[workloadkey]= 'text not null'
+            worknumbs=fdb.getSingledata("工号","workerinfo")
+            for worknumbskey in worknumbs:
+                if str(worknumbskey[0]) != "*":
+                    workLoad.initTable('workload%s'%str(worknumbskey[0]),"编号",primaryKey2, workloadDic)
+        else:
+            print(datetime.datetime.now(),"[数据库操作]人员信息为空,无法创建人员工作量数据库!请先上传人员信息")
+                #需要QT输出警告弹框信息
+    except Exception as e:
+        app_logger.log_error(e)

+ 17 - 0
Functions/DButilsFunction/createWorkloadtablesFromPg.py

@@ -0,0 +1,17 @@
+from unitls.LogerinTxt import app_logger
+from unitls.StaticDataclass import get_dic
+from .flightDB import flightDB
+
+
+def createWorkloadtablesFromPg(fdb: flightDB, workLoad: flightDB,selectedtime):
+    try:
+        workloadDic = {}
+        primaryKey2 = 'text UNIQUE NOT NULL'
+        pglist=fdb.getAlldata("pglist{}".format(selectedtime))
+        if len(pglist) != 0:
+            for workloadkey in list(get_dic('workloadLabel'))[1:]:
+                workloadDic[workloadkey] = 'text not null'
+            for row in pglist:
+                workLoad.initTable('workload%s'%str(row[1]),"编号", primaryKey2, workloadDic)
+    except Exception as e:
+        app_logger.log_error(e)

+ 16 - 0
Functions/DButilsFunction/dealLogs.py

@@ -0,0 +1,16 @@
+import datetime
+
+from unitls.LogerinTxt import app_logger
+from .flightDB import flightDB
+
+
+def dealLogs(database:flightDB,name:str,number:str):
+    try:
+        now=datetime.datetime.now()
+        nowDay = datetime.datetime.now()
+        nowDayStr = nowDay.strftime("%Y%m%d")
+        id=number
+        newdic={"处理人":"'%s'"%name,"处理时间":"'%s'"%now}
+        database.upDateItem('logs',newdic,"编号='%s'"%id)
+    except Exception as e:
+        app_logger.log_error(e)

+ 24 - 0
Functions/DButilsFunction/deleteFlight.py

@@ -0,0 +1,24 @@
+from unitls.settings import DBServer , flightDB4
+from .flightDB import flightDB
+from .sortFlighttime import sortFlighttime
+from .sortFlighttime2 import sortFlighttime2
+
+host, port, user1, password,online_host, online_port, online_user,online_password = DBServer()
+databaseflightDB4=flightDB4()
+
+def deleteFlight(fdb:flightDB,flightid,time):
+    fdb.deleteTable("TaskFlightinfo%s"%time,"航班编号='%s'"%flightid)
+    res={"返回值":"ok"}
+    sortFlighttime(flightDB(host=host,
+                    port=port,
+                    user=user1,
+                    password=password,
+                    database=databaseflightDB4
+                   ))
+    sortFlighttime2(flightDB(host=host,
+                    port=port,
+                    user=user1,
+                    password=password,
+                    database=databaseflightDB4
+                   ))
+    return res

+ 89 - 0
Functions/DButilsFunction/dingding.py

@@ -0,0 +1,89 @@
+import base64
+import hashlib
+import hmac
+import json
+import time
+import urllib.parse
+
+import requests
+
+
+def dingding_alert1(phone:list,msg):
+    dingding_webhook="https://oapi.dingtalk.com/robot/send?access_token=9c78c711f14ba3345d6dc492dc5ca8118c421516d611b5de46854fb8e158565f"
+    timestamp = str(round(time.time() * 1000))
+    secret = 'SEC09f744f81b55c8a18f0d77a3ab60bf4e1ec3f16b85f025e6a4f75ddff00a8fd4'
+    secret_enc = secret.encode('utf-8')
+    string_to_sign = '{}\n{}'.format(timestamp, secret)
+    string_to_sign_enc = string_to_sign.encode('utf-8')
+    hmac_code = hmac.new(secret_enc, string_to_sign_enc, digestmod=hashlib.sha256).digest()
+    sign = urllib.parse.quote_plus(base64.b64encode(hmac_code))
+    dingding_url = dingding_webhook + '&timestamp=' + timestamp + "&sign=" + sign
+    if phone:
+        header = {
+            "Content-Type": "application/json"
+        }
+        data = {
+            "at": {
+                "atMobiles": phone,
+            },
+            "text": {
+                "content": msg
+            },
+            "msgtype": "text"
+        }
+    else:
+        header = {
+            "Content-Type": "application/json"
+        }
+        data = {
+            "at": {
+                "isAtAll": True
+            },
+            "text": {
+                "content": msg
+            },
+            "msgtype": "text"
+        }
+
+
+    res = requests.post(url=dingding_url, data=json.dumps(data), headers=header)
+
+
+def dingding_alert11(phone:list,msg):
+    dingding_webhook="https://oapi.dingtalk.com/robot/send?access_token=c3be52d9ae7307dd7ceb0b677f569c47de2ff81b20fe30c328c75fbd9ab81383"
+    timestamp = str(round(time.time() * 1000))
+    secret = 'SEC14f583c6f735044be3f9f6fdc53edb7cf0b7d56d9b63c4b78bcafa9880814f9e'
+    secret_enc = secret.encode('utf-8')
+    string_to_sign = '{}\n{}'.format(timestamp, secret)
+    string_to_sign_enc = string_to_sign.encode('utf-8')
+    hmac_code = hmac.new(secret_enc, string_to_sign_enc, digestmod=hashlib.sha256).digest()
+    sign = urllib.parse.quote_plus(base64.b64encode(hmac_code))
+    dingding_url = dingding_webhook + '&timestamp=' + timestamp + "&sign=" + sign
+    if phone:
+        header = {
+            "Content-Type": "application/json"
+        }
+        data = {
+            "at": {
+                "atMobiles": phone,
+            },
+            "text": {
+                "content": msg
+            },
+            "msgtype": "text"
+        }
+    else:
+        header = {
+            "Content-Type": "application/json"
+        }
+        data = {
+            "at": {
+                "isAtAll": True
+            },
+            "text": {
+                "content": msg
+            },
+            "msgtype": "text"
+        }
+
+    res = requests.post(url=dingding_url, data=json.dumps(data), headers=header)

+ 39 - 0
Functions/DButilsFunction/dingdingDelete_flight.py

@@ -0,0 +1,39 @@
+import datetime
+import json
+
+import requests
+
+import unitls.baseFunction as baseFunction
+from unitls.LogerinTxt import app_logger
+from unitls.StaticDataclass import get_dic
+from .flightDB import flightDB
+
+
+def dingdingDelete_flight(database:flightDB):
+    try:
+        dmac={}
+        # 需要建立昨日初始化
+        nowDay = datetime.datetime.now().strftime("%Y%m%d")
+        nowDay_1 = (datetime.date.today() - datetime.timedelta(days=1)).strftime("%Y%m%d")
+        day = [nowDay_1,nowDay]
+        for nowDayStr in day:
+            tfac_ids=database.queryTabel('sortFlight{}'.format(nowDayStr),"航班编号","CAST(级别 AS integer)=1")
+            datas=database.queryTabel('TaskFlightinfo{}'.format(nowDayStr),"*","航班编号!=''")
+            if len(tfac_ids) != 0:
+                for i in tfac_ids:
+                    acno= baseFunction.TuplefindInList3(datas , i[0 ] , 0 , 1)
+                    type=get_dic("taskType")[ baseFunction.TuplefindInList3(datas , i[0 ] , 0 , 3) ]
+                    if acno in dmac.keys() and type !="航前":
+                        dmac[acno]=i[0]
+                    elif acno not in dmac.keys():
+                        dmac[acno] = i[0]
+        try:
+            res = requests.post(url="http://124.223.185.200:888/delete_flight/", data=json.dumps(dmac),timeout=5)  # 自己服务器
+            #flightsts = res.json()
+            #print(flightsts)
+        except Exception as e:
+            app_logger.log_error(e)
+            pass
+            #QT输出弹窗警告,服务器链接失效
+    except Exception as e:
+        app_logger.log_error(e)

+ 75 - 0
Functions/DButilsFunction/dingdingFlightsts.py

@@ -0,0 +1,75 @@
+import datetime
+
+import requests
+
+import unitls.baseFunction as baseFunction
+from unitls.LogerinTxt import app_logger
+from .flightDB import flightDB
+
+
+def dingdingFlightsts(database:flightDB):
+    try:
+        flightsts = {}
+        sever_code={"JJDW":"接机到位","FX":"放行","SJDW":"随机到位","XJ":"销子夹板","ESDW":"二送到位"}
+        sever_code1 = {"JJDW": "已到位", "FX": "已放行", "SJDW": "已到位", "XJ": "已取下", "ESDW": "已到位"}
+        code2 = {"JJDW": "接机已到位", "FX": "已放行", "SJDW": "随机已到位", "XJ": "销子夹板已取下", "ESDW": "二送已到位"}
+        code3 = {"JJDW": "接机已到位提示", "FX": "已放行提示", "SJDW": "随机已到位提示", "XJ": "销子夹板已提示", "ESDW": "二送已到位提示"}
+        code4 = {"JJDW": 8, "FX": 9, "SJDW": 11, "XJ": 10, "ESDW": 12}
+        try:
+            #'''
+            resfwq = requests.get(url="http://124.223.185.200:888/search_status/", timeout=10)  # 自己服务器
+            if resfwq.json() != "":
+                flightsts = resfwq.json()
+                #print(flightsts)
+            '''
+            #测试数据
+            flightsts={'325F': {'JH': '325F', 'JWH': '', 'JJDW': 0, 'FX': 0, 'SJDW': 0, 'XJ': 1, 'ESDW': 0, 'YW': ' 325F 销夹'}}
+            '''
+        except Exception as e:
+            app_logger.log_error(e)
+            pass
+            # QT输出弹窗警告,服务器链接失效
+
+        nowDay = datetime.datetime.now().strftime("%Y%m%d")
+        nowDay_1 = (datetime.date.today() - datetime.timedelta(days=1)).strftime("%Y%m%d")
+        now = datetime.datetime.now()
+        now11=str(now).split(".")[0]
+        day = [nowDay_1, nowDay]
+        tfac_acs=[]
+        for nowDayStr in day:
+            dmacs = database.queryTabel('sortFlight{}'.format(nowDayStr),"航班编号","CAST(级别 AS integer)=1")
+            datas = database.queryTabel('flightsts{}'.format(nowDayStr), "*", "航班编号!=''")
+            if dmacs:
+                for i in dmacs:
+                    dmac = baseFunction.TuplefindInList3(datas , i[0 ] , 0 , 1)
+                    if str(dmac) not in str(tfac_acs):
+                        tfac_acs.append(dmac)
+
+        if len(tfac_acs) != 0:
+            tfudatas=database.queryTabel('flightsts{}'.format(nowDay), "*", "天府飞机 != ''")
+            for i in tfac_acs:
+                #print(i[0])
+                if i in flightsts.keys():
+                    for j,k in sever_code.items():
+                        if flightsts[i][j] == 1:
+                            newdic={"%s"%k:"'%s'"%sever_code1[j]}
+                            #print(newdic)
+                            database.lazyUpdateItem('flightsts{}'.format(nowDay),newdic,"机号='%s' and 天府飞机!=''"%i)
+                            newdic={}
+                            sts = baseFunction.TuplefindInList3(tfudatas , i , 1 , code4[j ])
+                            taskid = baseFunction.TuplefindInList3(tfudatas , i , 1 , 0)
+                            a=sts if sts != "" else "0"
+                            b=taskid if taskid != "" else "未显示机号"
+                            if a !="1":
+                                newdic={"%s"%code3[j]:1}
+                                database.lazyUpdateItem('flightsts{}'.format(nowDay), newdic, "机号='%s' and 天府飞机!=''" % i)
+                                newdic={"航班编号":"%s"%b,"警告信息":"","信息状态":"","提示信息":"钉钉:%s%s!%s"%(i,code2[j],now11),"产生时间":"%s"%now,"处理人":"","处理时间":"","变更字段":"","显示对象":"","提示内容":""}
+                                database.lazyInsertData('logs',newdic)
+            database.FunctionCommit()
+
+            #########################################
+            #引入钉钉显示
+            ########################################
+    except Exception as e:
+        app_logger.log_error(e)
+        database.FunctionCommit()

+ 30 - 0
Functions/DButilsFunction/dingdinginfoget.py

@@ -0,0 +1,30 @@
+import datetime
+
+import requests
+
+from unitls.LogerinTxt import app_logger
+from .flightDB import flightDB
+
+
+def dingdinginfoget(database:flightDB):
+    try:
+        infos={}
+        try:
+            resfwq = requests.get(url="http://124.223.185.200:4567/get_deal_info/", timeout=10)  # 自己服务器
+            if resfwq.json() != "":
+                infos = resfwq.json()
+        except Exception as e:
+            app_logger.log_error(e)
+            pass
+        #print("infos",infos)
+        if infos !={}:
+            now = datetime.datetime.now()
+            for i in infos.keys():
+                info=str(infos[i]["info"].split("信息上报")[0])+str(now.strftime("%Y-%m-%d %H:%M:%S"))+"上报信息,鼠标停留查看详情"
+                newdic = {"航班编号": "%s" % i, "警告信息": "%s"%info, "信息状态": "", "提示信息": "",
+                          "产生时间": "%s" % now, "处理人": "", "处理时间": "", "变更字段": "", "显示对象": "", "提示内容": "%s"%infos[i]["info"]}
+                database.lazyInsertData('logs', newdic)
+            database.FunctionCommit()
+    except Exception as e:
+        app_logger.log_error(e)
+        database.FunctionCommit()

+ 280 - 0
Functions/DButilsFunction/flightDB.py

@@ -0,0 +1,280 @@
+import traceback
+
+import psycopg2
+
+from unitls.LogerinTxt import app_logger
+
+
+class flightDB():
+    def __init__(self, host, port, user, password, database):
+
+        self.conn = psycopg2.connect(
+            host=host,
+            port=port,
+            user=user,
+            password=password,
+            database=database
+        )
+        self.c = self.conn.cursor()
+
+    def initTable(self, tableName:str,primarykey:str,primarykeyStr:str,keyDict:dict):
+        try:
+            keyStr = ''
+            num = 1
+            for key in keyDict:
+                if num !=len(keyDict):
+                    keyStr += '{} {},\n'.format(key,keyDict[key])
+                else:
+                    keyStr += '{} {}'.format(key, keyDict[key])
+                num +=1
+
+            curStr ="""
+                            create table if not exists {} (
+                            {} {} ,
+                            {}
+                            )
+                            """.format(tableName, primarykey, primarykeyStr,keyStr)
+            #print(curStr)
+            self.c.execute(curStr)
+
+            self.conn.commit()
+        except Exception as e:
+            app_logger.log_error(curStr)
+            app_logger.log_error(e)
+            print(traceback.format_exc())
+
+
+    def insertData(self, tableName:str, data:dict, *args):
+        try:
+            #curStr1 = 'insert into {} '.format(tableName)
+            num = 1
+            curStr2 = ''
+            for key in data:
+                if num != len(data):
+                    curStr2+='{},'.format(key)
+                else:
+                    curStr2+='{}'.format(key)
+                num+=1
+            curStr3 = ''
+            num = 1
+            for key in data:
+                if num != len(data):
+                    curStr3+="'{}',".format(data[key])
+                else:
+                    curStr3+="'{}'".format(data[key])
+                num+=1
+            curStr = """
+                    insert into {} ({})
+                    values ({})
+                    """.format(tableName, curStr2, curStr3)
+            #print(curStr)
+            self.c.execute(curStr)
+
+            if args==():
+                self.conn.commit()
+            return "ok"
+        except Exception as e:
+            app_logger.log_error(curStr)
+            app_logger.log_error(e)
+            print(traceback.format_exc())
+            return "fail"
+
+    def lazyInsertData(self,tableName:str, data:dict):
+        self.insertData(tableName, data, 'lazy')
+    def lazydeleteTable(self,tablename:str):
+        try:
+            curStr = """delete from {}""".format(tablename)
+            self.c.execute(curStr)
+        except Exception as e:
+            app_logger.log_error(curStr)
+            app_logger.log_error(e)
+    def lazyInsertData2(self,tableName:str, curStr2, curStr3):
+        try:
+            curStr = """insert into {} ({})values {}""".format(tableName, curStr2, curStr3)
+            self.c.execute(curStr)
+        except Exception as e:
+            app_logger.log_error(curStr)
+            app_logger.log_error(e)
+    def lazyInsertData3(self,curStr1, curStr2, curStr3):
+        try:
+            curStr = """insert into display  (ID, A, B)values (%s,'%s','%s')"""%(curStr1, curStr2, curStr3)
+            self.c.execute(curStr)
+        except Exception  as e:
+            app_logger.log_error(curStr)
+            app_logger.log_error(e)
+
+    def FunctionCommit(self):
+        self.conn.commit()
+
+    def FunctionRollback(self):
+        self.conn.rollback()
+
+    def deleteTable(self, tablename:str, *condition:str):
+        try:
+            if condition !=():
+                curStr = """
+                        delete from {} where {}
+                        """.format(tablename, condition[0])
+            else:
+                curStr = """
+                        delete from {}
+                        """.format(tablename)
+            self.c.execute(curStr)
+            self.conn.commit()
+            return "ok"
+        except Exception as e:
+            app_logger.log_error(curStr)
+            app_logger.log_error(e)
+            print(traceback.format_exc())
+            return "fail"
+
+
+    def copyTable(self, oldtablename:str, newTablename:str):
+        try:
+            curStr = """
+                    drop table {}
+                    """.format(newTablename)
+            self.c.execute(curStr)
+            self.conn.commit()
+        except Exception as e:
+            app_logger.log_error(curStr)
+            app_logger.log_error(e)
+            print(traceback.format_exc())
+
+    def sortTable(self, tablename:str, tableKey:str, fn):
+        try:
+            curStr = """
+                    select * from {} order by {} {}
+                    """.format(tablename, tableKey, fn)
+            #print(curStr)
+            self.c.execute(curStr)
+            return self.c.fetchall()
+        except Exception as e:
+            app_logger.log_error(curStr)
+            app_logger.log_error(e)
+            print(traceback.format_exc())
+
+    def sort_queryTable(self, findkey:str,tablename:str, condition:str,tableKey:str, fn):
+        try:
+            curStr = """
+                    select {} from {} where {} order by {} {}
+                    """.format(findkey,tablename, condition,tableKey, fn)
+            #print(curStr)
+            self.c.execute(curStr)
+            return self.c.fetchall()
+        except Exception as e:
+            app_logger.log_error(curStr)
+            app_logger.log_error(e)
+            print(traceback.format_exc())
+    def sort_queryTable2(self, findkey:str,tablename:str, condition:str,tableKey:str, fn,tableKey1:str, fn1):
+        try:
+            curStr = """
+                    select {} from {} where {} order by {} {},{} {}
+                    """.format(findkey,tablename, condition,tableKey, fn,tableKey1, fn1)
+            #print(curStr)
+            self.c.execute(curStr)
+            return self.c.fetchall()
+        except Exception as e:
+            app_logger.log_error(curStr)
+            app_logger.log_error(e)
+            print(traceback.format_exc())
+
+    def queryTabel(self, tablename: str, key: str, condition: str):
+        try:
+            # 检查表是否存在
+            curStr1 = """
+                SELECT EXISTS (
+                  SELECT * FROM pg_catalog.pg_tables
+                  WHERE tablename = %s AND schemaname = 'public'
+                );
+            """
+            self.c.execute(curStr1, (tablename.lower(),))
+            table_exists = self.c.fetchone()[0]
+
+            if table_exists:
+                # 防止SQL注入,使用参数化查询
+                curStr = f"SELECT {key} FROM {tablename} WHERE {condition}"
+                self.c.execute(curStr)
+                return self.c.fetchall()
+            else:
+                print(f"表 '{tablename}' 不存在")
+                return []  # 返回空列表而不是None,便于统一处理
+        except Exception as e:
+            app_logger.log_error(e)
+            print(traceback.format_exc())
+            self.conn.rollback()
+            return []
+
+
+
+
+    def getAlldata(self, tablename:str):
+        try:
+            curStr = """select * from {}""".format(tablename)
+            self.c.execute(curStr)
+            return self.c.fetchall()
+        except Exception as e:
+            app_logger.log_error(curStr)
+            app_logger.log_error(e)
+            print(traceback.format_exc())
+
+    def upDateItem(self, tablename:str, dateDic:dict, condition:str, *args):
+        try:
+            setStr = ''
+            for key in dateDic:
+                if tablename == 'display':
+                    setStr += '{}={},'.format(key, str(dateDic[key]).replace("'","''"))
+                else:
+                    setStr += '{}={},'.format(key, dateDic[key])
+            if tablename == 'display':
+                setStr = setStr[:-1].replace('"',"'")
+            else:
+                setStr = setStr[:-1]
+            curStr = """
+                    update {} set {} where {}
+                    """.format(tablename, setStr, condition)
+            #print(curStr)
+            if setStr !="":
+                self.c.execute(curStr)
+            if args == ():
+                self.conn.commit()
+        except Exception as e:
+            app_logger.log_error(curStr)
+            app_logger.log_error(e)
+            print(traceback.format_exc())
+
+
+    def lazyUpdateItem(self,tablename:str, dateDic:dict, condition:str):
+        self.upDateItem(tablename,dateDic,condition,'lazy')
+
+    def getSingledata(self,findkey:str,tablename:str):
+        try:
+            curStr = """
+                    select {} from {}
+                    """.format(findkey,tablename)
+            self.c.execute(curStr)
+            return self.c.fetchall()
+        except Exception as e:
+            app_logger.log_error(curStr)
+            app_logger.log_error(e)
+            print(traceback.format_exc())
+
+    def deleteSingledata(self,tablename:str,findkey:str):
+        try:
+            curStr = """
+                    delete from {} where {}
+                    """.format(tablename,findkey)
+            self.c.execute(curStr)
+            #print(curStr)
+            self.conn.commit()
+        except Exception as e:
+            app_logger.log_error(curStr)
+            app_logger.log_error(e)
+            print(traceback.format_exc())
+
+    def close(self):
+        try:
+            self.conn.close()
+        except Exception as e:
+            app_logger.log_error(e)
+            print(traceback.format_exc())

+ 113 - 0
Functions/DButilsFunction/flightplanInsert.py

@@ -0,0 +1,113 @@
+import datetime
+
+import unitls.baseFunction as baseFunction
+from unitls.LogerinTxt import app_logger
+from unitls.StaticDataclass import get_dic
+from .flightDB import flightDB
+
+
+def FlightPlanInsert(database: flightDB, datatime: str, jsonData):
+    nowDayStr = datatime
+    now = datetime.datetime.now()
+    insertdatestr = datatime + " 00:00:00"
+    insertdate = datetime.datetime.strptime(insertdatestr, "%Y%m%d %H:%M:%S").strftime("%Y-%m-%d %H:%M:%S")
+    nowDay = datetime.datetime.now().strftime("%Y%m%d")
+    nowDay_1 = (datetime.date.today() - datetime.timedelta(days=1)).strftime("%Y%m%d")
+    nowDay_2 = (datetime.date.today() + datetime.timedelta(days=1)).strftime("%Y%m%d")
+    nowDay_str2 = datetime.date.today().strftime("%Y-%m-%d")
+    a_str = nowDay_str2 + " 20:30:00"
+    c_str = nowDay_str2 + " 09:00:00"
+    time1 = datetime.datetime.strptime(a_str, "%Y-%m-%d %H:%M:%S")
+    time3 = datetime.datetime.strptime(c_str, "%Y-%m-%d %H:%M:%S")
+
+    if now < time3:
+        days = [nowDay, nowDay_1]
+    elif time3 < now < time1:
+        days = [nowDay]
+    else:
+        days = [nowDay, nowDay_2]
+    if nowDayStr in days:
+        keys=get_dic('flightplanflightinfoLabel')
+        flightinfo_flight_ids_arr = []
+        flightinfo_flight_ids = database.queryTabel('flightplaninfo{}'.format(nowDayStr), '*', "flightId !=''")#确认一下要不要取整张表
+        if len(flightinfo_flight_ids) != 0:
+            for i in flightinfo_flight_ids:
+                flightinfo_flight_ids_arr.append(i[0])
+        flight_id_now = []
+        if jsonData !="" and  jsonData !=None and jsonData != {} and len(jsonData)!=0 :
+            try:
+                for row in jsonData:
+                    targets = ["321","320","319","737","C919","C909","ARJ21"]
+                    ac_type = row.get("acType" , "")
+                    if (row.get("arrAirportAbbr","") == "天府" or row.get("depAirportAbbr","") == "天府") and any(target in ac_type for target in targets) and not ("备降" == str(row.get("flgVr", "")) and bool(row.get("fplAirport1Abbr", ""))):
+                        flight_id_now.append(row["flightId"])
+                        if str(row["flightId"]) not in str(flightinfo_flight_ids_arr) and str(insertdate) == row["flightDate"]:
+                            newDic={}
+                            for key in keys:
+
+                                if key in row.keys() and row[key]:
+                                    if key == "acReg" :
+                                        newDic[key] = str(row[key].replace("B", ""))
+                                    else:
+                                        newDic[key] = str(row[key])
+                                else:
+                                    newDic[key] = ""
+                            if (row["arrAirportAbbr"] == "天府" and datetime.datetime.strptime(row["sta"], "%Y-%m-%d %H:%M:%S") <= (datetime.datetime.now() + datetime.timedelta(hours=11))) or \
+                                    (row["depAirportAbbr"] == "天府" and datetime.datetime.strptime(row["std"], "%Y-%m-%d %H:%M:%S") <= (datetime.datetime.now() + datetime.timedelta(hours=12))):
+                                newDic["备1"] = "1"
+                            database.lazyInsertData('flightplaninfo{}'.format(nowDayStr), newDic)
+                        elif str(row["flightId"]) in str(flightinfo_flight_ids_arr):
+                            for key in keys:
+                                if key in row.keys():
+                                    b = baseFunction.TuplefindInList3(flightinfo_flight_ids, row["flightId"], 0, keys.index(key))
+                                    if key == "acReg" :
+                                        row[key]= str(row[ key ].replace("B" , ""))
+                                    if b != row[key] and row[key]:
+                                        newdic = {"%s"%key: "'%s'" % row[key]}
+                                        database.lazyUpdateItem('flightplaninfo{}'.format(nowDayStr), newdic,"flightId='%s'" % row["flightId"])
+                                elif key != "备1":
+                                    newdic = {"%s"%key: "''"}
+                                    database.lazyUpdateItem('flightplaninfo{}'.format(nowDayStr), newdic,"flightId='%s'" % row["flightId"])
+                            if (row["arrAirportAbbr"] == "天府" and datetime.datetime.strptime(row["sta"], "%Y-%m-%d %H:%M:%S") <= (datetime.datetime.now() + datetime.timedelta(hours=11))) or \
+                                    (row["depAirportAbbr"] == "天府" and datetime.datetime.strptime(row["std"], "%Y-%m-%d %H:%M:%S") <= (datetime.datetime.now() + datetime.timedelta(hours=12))):
+                                newdic = {"备1": "'1'"}
+                                #database.lazyUpdateItem('flightplaninfo{}'.format(nowDayStr), newdic,"flightId='%s'" % row["flightId"])
+
+                            else:
+                                newdic = {"备1": "''"}
+                            database.lazyUpdateItem('flightplaninfo{}'.format(nowDayStr), newdic,"flightId='%s'" % row[ "flightId" ])
+
+                database.FunctionCommit()
+            except Exception as e:
+                database.FunctionCommit()
+                app_logger.log_error(e)
+                app_logger.log_error(row)
+                pass
+        else:
+            print(datetime.datetime.now(), "[数据库操作]flightplaninfo航班数据为空")
+            app_logger.log_error("[数据库操作]flightplaninfo航班数据为空")
+            pass
+        if jsonData !="" and jsonData !=None and jsonData != {} and len(flight_id_now) != 0 and len(jsonData)!=0:
+            flightinfo_flight_ids = database.queryTabel('flightplaninfo{}'.format(nowDayStr),'*',"flightId !=''")
+            if len(flightinfo_flight_ids) != 0:
+                for iii in flightinfo_flight_ids:
+                    if str(iii[0]) not in flight_id_now:
+                        database.deleteSingledata("flightplaninfo{}".format(nowDayStr), "flightId='%s'" % str(iii[0]) )
+            database.FunctionCommit()
+        '''
+        flightinfo_flight_ids = database.sort_queryTable2("*",'flightplaninfo{}'.format(nowDayStr), "flightId !=''","ACNO","ASC","STD","ASC")
+        flightinfo_flight_ids2 = database.queryTabel('TaskFlightinfo{}'.format(nowDayStr),"*", "备5 !='' and 备4 =''")
+        flightinfo_flight_ids_check = flightinfo_flight_ids2 if flightinfo_flight_ids2 != None else ""
+        if len(flightinfo_flight_ids) != 0:
+            last_acno = ""
+            for row in flightinfo_flight_ids:
+                if row[0] in str(flightinfo_flight_ids_check) or  (last_acno != row[2] and row[4] == "天府"):
+                    newDic2 = {"backup3": "'AP'", "backup4": "'航前'"}
+                    database.lazyUpdateItem('flightplaninfo{}'.format(nowDayStr), newDic2, "flightId='%s'" % row[0])
+                else:
+                    newDic2 = {"backup3": "'%s'" % row[12], "backup4": "'%s'" % tasktype[row[12]]}
+                    database.lazyUpdateItem('flightplaninfo{}'.format(nowDayStr), newDic2, "flightId='%s'" % row[0])
+
+                last_acno = row[2]
+            database.FunctionCommit()
+        #'''

+ 101 - 0
Functions/DButilsFunction/flightsearchInsert.py

@@ -0,0 +1,101 @@
+import datetime
+
+import unitls.baseFunction as baseFunction
+from unitls.LogerinTxt import app_logger
+from unitls.StaticDataclass import get_dic
+from .flightDB import flightDB
+
+
+def FlightSearchInsert(database: flightDB, datatime: str, jsonData):
+    tasktype=get_dic('taskType')
+    nowDayStr = datatime
+    now = datetime.datetime.now()
+    insertdatestr = datatime + " 00:00:00"
+    insertdate = datetime.datetime.strptime(insertdatestr, "%Y%m%d %H:%M:%S").strftime("%Y-%m-%d %H:%M:%S")
+    nowDay = datetime.datetime.now().strftime("%Y%m%d")
+    nowDay_1 = (datetime.date.today() - datetime.timedelta(days=1)).strftime("%Y%m%d")
+    nowDay_2 = (datetime.date.today() + datetime.timedelta(days=1)).strftime("%Y%m%d")
+    nowDay_str2 = datetime.date.today().strftime("%Y-%m-%d")
+    a_str = nowDay_str2 + " 20:30:00"
+    c_str = nowDay_str2 + " 09:00:00"
+    time1 = datetime.datetime.strptime(a_str, "%Y-%m-%d %H:%M:%S")
+    time3 = datetime.datetime.strptime(c_str, "%Y-%m-%d %H:%M:%S")
+
+    if now < time3:
+        days = [nowDay, nowDay_1]
+    elif time3 < now < time1:
+        days = [nowDay]
+    else:
+        days = [nowDay, nowDay_2]
+    if nowDayStr in days:
+        keys=get_dic('flightsearchLabel')
+        flightinfo_flight_ids_arr = []
+        flightinfo_flight_ids = database.queryTabel('FlightSearch{}'.format(nowDayStr), '*', "FLIGHT_ID !=''")#确认一下要不要取整张表
+        if len(flightinfo_flight_ids) != 0:
+            for i in flightinfo_flight_ids:
+                flightinfo_flight_ids_arr.append(i[0])
+        flight_id_now = []
+        if jsonData !="" and  jsonData !=None and jsonData != {} and len(jsonData)!=0 :
+            last_acno=""
+            try:
+                for row in jsonData:
+                    flight_id_now.append(row["FLIGHT_ID"])
+                    if str(row["FLIGHT_ID"]) not in str(flightinfo_flight_ids_arr) and str(insertdate) == row["FLIGHT_DATE"]:
+                        newDic={}
+                        for key in keys:
+                            if key in row.keys():
+                                newDic[key] = str(row[key])
+                            else:
+                                newDic[key] = ""
+                        database.lazyInsertData('FlightSearch{}'.format(nowDayStr), newDic)
+                    elif str(row["FLIGHT_ID"]) in str(flightinfo_flight_ids_arr):
+                        for key in keys:
+                            if key in row.keys():
+                                b = baseFunction.TuplefindInList3(flightinfo_flight_ids , row[ "FLIGHT_ID" ] , 0 , keys.index(key))
+                                if b != row[key]:
+                                    newdic = {"%s"%key: "'%s'" % row[key]}
+                                    database.lazyUpdateItem('FlightSearch{}'.format(nowDayStr), newdic,"FLIGHT_ID='%s'" % row["FLIGHT_ID"])
+                            else:
+                                newdic = {"%s"%key: "''"}
+                                database.lazyUpdateItem('FlightSearch{}'.format(nowDayStr), newdic,"FLIGHT_ID='%s'" % row["FLIGHT_ID"])
+                    if last_acno != row["ACNO"] and row["DEP_CH"] == "天府":
+                        newDic2 = {"backup1": "'AP'","backup2": "'航前'"}
+                        database.lazyUpdateItem('FlightSearch{}'.format(nowDayStr), newDic2, "FLIGHT_ID='%s'" % row["FLIGHT_ID"])
+                    else:
+                        newDic2 = {"backup1": "'%s'"%row["TASKTYPE"] if "TASKTYPE" in row else "'未显示'","backup2": "'%s'"%tasktype[row["TASKTYPE"]] if "TASKTYPE" in row else "'未显示'"}
+                        database.lazyUpdateItem('FlightSearch{}'.format(nowDayStr), newDic2,"FLIGHT_ID='%s'" % row["FLIGHT_ID"])
+                    last_acno = row["ACNO"]
+                database.FunctionCommit()
+            except Exception as e:
+                database.FunctionCommit()
+                app_logger.log_error(e)
+                app_logger.log_error(row)
+                pass
+        else:
+            print(datetime.datetime.now(), "[数据库操作]FlightSearch航班数据为空")
+            app_logger.log_error("[数据库操作]FlightSearch航班数据为空")
+            pass
+        if jsonData !="" and jsonData !=None and jsonData != {} and len(flight_id_now) != 0 and len(jsonData)!=0:
+            flightinfo_flight_ids = database.queryTabel('FlightSearch{}'.format(nowDayStr),'*',"FLIGHT_ID !=''")
+            if len(flightinfo_flight_ids) != 0:
+                for iii in flightinfo_flight_ids:
+                    if str(iii[0]) not in flight_id_now :
+                        database.deleteSingledata("FlightSearch{}".format(nowDayStr), "FLIGHT_ID='%s'" % str(iii[0]) )
+            database.FunctionCommit()
+        '''
+        flightinfo_flight_ids = database.sort_queryTable2("*",'FlightSearch{}'.format(nowDayStr), "FLIGHT_ID !=''","ACNO","ASC","STD","ASC")
+        flightinfo_flight_ids2 = database.queryTabel('TaskFlightinfo{}'.format(nowDayStr),"*", "备5 !='' and 备4 =''")
+        flightinfo_flight_ids_check = flightinfo_flight_ids2 if flightinfo_flight_ids2 != None else ""
+        if len(flightinfo_flight_ids) != 0:
+            last_acno = ""
+            for row in flightinfo_flight_ids:
+                if row[0] in str(flightinfo_flight_ids_check) or  (last_acno != row[2] and row[4] == "天府"):
+                    newDic2 = {"backup3": "'AP'", "backup4": "'航前'"}
+                    database.lazyUpdateItem('FlightSearch{}'.format(nowDayStr), newDic2, "FLIGHT_ID='%s'" % row[0])
+                else:
+                    newDic2 = {"backup3": "'%s'" % row[12], "backup4": "'%s'" % tasktype[row[12]]}
+                    database.lazyUpdateItem('FlightSearch{}'.format(nowDayStr), newDic2, "FLIGHT_ID='%s'" % row[0])
+
+                last_acno = row[2]
+            database.FunctionCommit()
+        #'''

+ 17 - 0
Functions/DButilsFunction/getFlightData.py

@@ -0,0 +1,17 @@
+import datetime
+
+from unitls.LogerinTxt import app_logger
+from .flightDB import flightDB
+
+
+def getFlightData(database:flightDB,*args):
+    try:
+        nowDay = datetime.datetime.now()
+        nowDayStr = nowDay.strftime("%Y%m%d")
+        if args!=():
+            flightData = database.getAlldata('TaskFlightinfo{}'.format(args[0]))
+        else:
+            flightData = database.getAlldata('TaskFlightinfo{}'.format(nowDayStr))
+        return flightData
+    except Exception as e:
+        app_logger.log_error(e)

+ 9 - 0
Functions/DButilsFunction/getRiskData.py

@@ -0,0 +1,9 @@
+from .flightDB import flightDB
+def getRiskData(fdb:flightDB,bay,time,acno,actype):
+    res = fdb.queryTabel("RiskTable","提示内容","状态='生效' and 触发条件1 ='%s' and 触发条件2 ='%s' "%(bay,time))
+    res1 = fdb.queryTabel("RiskTable","提示内容","状态='生效' and 触发条件3 ='%s' and 触发条件2 ='%s' " % (acno,time))
+    res2 = fdb.queryTabel("RiskTable","提示内容","状态='生效' and 触发条件4 ='%s' and 触发条件2 ='%s' " % (actype,time))#触发条件4是机型
+    tips = "\n      [机位风险]:"+res[0][0] if res !=None and res !=[] and len(res) !=0 else ""
+    tips = tips + "\n      [机号风险]:"+res1[0][0] if res1 !=None and res1 !=[] and len(res1) !=0 else tips
+    tips = tips + "\n      [机型风险]:"+res2[0][0] if res2 !=None and res2 !=[] and len(res2) !=0 else tips
+    return tips

+ 11 - 0
Functions/DButilsFunction/getSortFlightdata.py

@@ -0,0 +1,11 @@
+from unitls.LogerinTxt import app_logger
+from .flightDB import flightDB
+
+
+def getSortFlightdata(fdb:flightDB, datatime:str,tablename:str):
+    try:
+        nowDayStr = datatime
+        sortData = fdb.sortTable('{}{}'.format(tablename,nowDayStr), '级别,保障时间','asc')
+        return sortData
+    except Exception as e:
+        app_logger.log_error(e)

+ 18 - 0
Functions/DButilsFunction/getWorkjobInfo.py

@@ -0,0 +1,18 @@
+from unitls.LogerinTxt import app_logger
+from .flightDB import flightDB
+
+
+def getWorkjobInfo(database:flightDB,taskid):
+    try:
+        res={}
+        infos=database.queryTabel('workjob','*',"任务编号 ='%s'"%taskid)
+        if len(infos) != 0:
+            res["taskids"]=infos[0][1]
+            res["acno"] = infos[0][8]
+            res["taskType"] = infos[0][10]
+            res["actype"] = infos[0][9]
+            res["startDate"] = infos[0][2]
+            res["endDate"] = infos[0][3]
+        return res
+    except Exception as e:
+        app_logger.log_error(e)

+ 38 - 0
Functions/DButilsFunction/get_dic.py

@@ -0,0 +1,38 @@
+
+import datetime
+
+from unitls.LogerinTxt import app_logger
+from .flightDB import flightDB
+
+
+def get_dic(database:flightDB, data):
+
+    try:
+        fdb = database
+        IDS=fdb.getSingledata("工号",'workerinfo')
+        IDSNOW=[]
+        try:
+            for myrow in data:
+                mydics0 = myrow["0"]
+                mydics1 = myrow["1"]
+                #a= fdb.getSingledata("工号",'workerinfo')
+                if str(mydics0["工号"]) in str(IDS) or str(mydics0["工号"]) in IDSNOW:
+                    fdb.lazyUpdateItem('workerinfo',mydics1,"工号='%s'"%mydics0["工号"])
+                else:
+                    fdb.lazyInsertData('workerinfo',mydics0)
+                    IDSNOW.append(mydics0["工号"])
+                #print(1)
+            fdb.FunctionCommit()
+            return "ok"
+        except Exception as e:
+            print(datetime.datetime.now(),'[数据库操作]数据库获取错误!!检查通讯录文件!人员显示功能失效!!')
+            print(e)
+            app_logger.log_error(e)
+            # 需要QT输出警告弹框信息
+            fdb.FunctionCommit()
+            return "fail"
+
+    except Exception as e:
+        app_logger.log_error(e)
+        return "fail"
+

+ 70 - 0
Functions/DButilsFunction/get_empNos.py

@@ -0,0 +1,70 @@
+from unitls.LogerinTxt import app_logger
+from .flightDB import flightDB
+from .judge_bc import judge_bc
+
+
+def get_empNos(database:flightDB,dict:dict):
+    try:
+        date=judge_bc()["date"]
+        date_str=judge_bc()["date"][0:4]+"-"+judge_bc()["date"][4:6]+"-"+judge_bc()["date"][6:]
+        bc = judge_bc()["bc"]
+        faillist=[]
+        WXempNos = ""
+        FXempNos = ""
+        WX = ""
+        FX = ""
+        wxkey = ["工1", "工2", "工3", "工4"]
+        for i in wxkey:
+            if dict[i] != "":
+                aa = []
+                if bc == "A":
+                    aa = database.queryTabel("pglist{}".format(date), "工号", "班次='A' and 姓名='%s'" % dict[i])
+                elif bc == "B":
+                    aa = database.queryTabel("pglist{}".format(date), "工号", "班次='B' and 姓名='%s'" % dict[i])
+                if len(aa) != 0 and WXempNos == "":
+                    if aa[0][0] !="":
+                        WXempNos = str(aa[0][0])
+                    else:
+                       faillist.append(dict[i])
+                elif len(aa) != 0 and WXempNos != "":
+                    if aa[0][0] != "":
+                        WXempNos =WXempNos+","+str(aa[0][0])
+                    else:
+                        faillist.append(dict[i])
+                else:
+                    faillist.append(dict[i])
+                if dict[i] != "" and WX == "":
+                    WX=dict[i]
+                elif dict[i] != "" and WX != "":
+                    WX=WX+","+dict[i]
+
+
+        if dict["放行"] != "":
+            aa = []
+            if bc == "A":
+                aa=database.queryTabel("pglist{}".format(date),"工号","班次='A' and 姓名='%s'"%dict["放行"])
+            elif bc == "B":
+                aa=database.queryTabel("pglist{}".format(date),"工号","班次='B' and 姓名='%s'"%dict["放行"])
+            if len(aa) != 0 and FXempNos == "":
+                if aa[0][0] != "":
+                    FXempNos = str(aa[0][0])
+                else:
+                    faillist.append(dict["放行"])
+            elif len(aa) != 0 and FXempNos != "":
+                if aa[0][0] != "":
+                    FXempNos = FXempNos + "," + str(aa[0][0])
+                else:
+                    faillist.append(dict["放行"])
+            elif len(aa) == 0:
+                faillist.append(dict["放行"])
+            FX=dict["放行"]
+        if (WXempNos != "" or FXempNos != "") and faillist=="":
+            dict1 = {"code": "ok", "WXempNos": WXempNos, "FXempNos": FXempNos, "ESempNos": WXempNos, "faillist":faillist,"date":date_str,"bc":bc,"WX":WX,"FX":FX,"ES":WX}
+        elif (WXempNos != "" or FXempNos != "") and faillist !="":
+            dict1 = {"code": "justok", "WXempNos": WXempNos, "FXempNos": FXempNos, "ESempNos": WXempNos, "faillist":faillist,"date":date_str,"bc":bc,"WX":WX,"FX":FX,"ES":WX}
+        else:
+            dict1 = { "code" : "fail" , "WXempNos" : "" , "FXempNos" : "" , "ESempNos" : "" , "faillist" : faillist , "date" : date_str , "bc" : bc , "WX" : WX , "FX" : FX , "ES" : WX }
+        return dict1
+    except Exception as e:
+        app_logger.log_error(e)
+        return {"code":"error:{}".format(e)}

+ 13 - 0
Functions/DButilsFunction/get_empNos_phoone.py

@@ -0,0 +1,13 @@
+from unitls.LogerinTxt import app_logger
+from .flightDB import flightDB
+
+
+def get_empNos_phoone(database:flightDB,name):
+    try:
+        infos={}
+        info=database.queryTabel('workerinfo',"*","姓名='%s'"%name)
+        if len(info) != 0:
+            infos={"工号":'%s'%info[0][0],"电话":"%s"%info[0][5]}
+        return infos
+    except Exception as e:
+        app_logger.log_error(e)

+ 22 - 0
Functions/DButilsFunction/getphonelist.py

@@ -0,0 +1,22 @@
+from unitls.LogerinTxt import app_logger
+from .flightDB import flightDB
+
+
+def getphonelist(fdb:flightDB):
+    try:
+        phonelists=fdb.getAlldata("workerinfo")
+        num = 0
+        res={}
+        if len(phonelists) != 0:
+            for i in phonelists:
+                phonelist = {}
+                phonelist["序号"]=num
+                phonelist["姓名"] = i[1]
+                phonelist["部门"] = i[2]
+                phonelist["电话"] = i[5]
+                phonelist["name"] = i[11]
+                res[num]=phonelist
+                num+=1
+        return res
+    except Exception as e:
+        app_logger.log_error(e)

+ 29 - 0
Functions/DButilsFunction/handoverStsChange.py

@@ -0,0 +1,29 @@
+import time
+
+from unitls.LogerinTxt import app_logger
+from unitls.StaticDataclass import get_dic
+from .flightDB import flightDB
+
+
+def HandoverStsChange(database:flightDB,data):
+    try:
+        if data["type"] != "Y": #新增
+            timestr=int(time.time()*1000)
+            newdic = {"备4": "Y","编号":f"人工交班标记-{timestr}-{data['name']}",'人员':data["name"]}
+            fullkeys=get_dic('newWorkloadLabel')
+            for key in fullkeys:
+                if key in newdic:
+                    continue
+                else:
+                    newdic[key]=""
+            database.insertData("Workload%s"%data["date"],newdic)
+
+        else:
+            newdic={"备4":"'N'"}
+            for id in data["ids"].split(","):
+                database.lazyUpdateItem('workload%s'%data["date"], newdic,"编号='%s'" % id)
+            database.FunctionCommit()
+        return "ok"
+    except Exception as e:
+        app_logger.log_error(e)
+        return "error"

+ 27 - 0
Functions/DButilsFunction/infoConfirm.py

@@ -0,0 +1,27 @@
+from unitls.LogerinTxt import app_logger
+from .flightDB import flightDB
+
+
+def infoConfirm(fdb:flightDB,flighttype,flightid,displayMode,selectedtime):
+    try:
+        peopleSchedule_sts2en={3:"放行",4:"勤务1",5:"勤务2",6:"工1",7:"工2",8:"工3"}
+        if displayMode =="A":
+            if flighttype =="短停接" or flighttype =="航后" or flighttype =="特后前接" or flighttype =="停场":
+                flightid_new=flightid+"-1"+"-A"
+            elif flighttype =="短停送" or flighttype =="航前" or flighttype =="特后前送":
+                flightid_new = flightid + "-2" + "-A"
+        elif displayMode =="B":
+            if flighttype =="短停接" or flighttype =="航后" or flighttype =="特后前接" or flighttype =="停场":
+                flightid_new=flightid+"-1"+"-B"
+            elif flighttype =="短停送" or flighttype =="航前" or flighttype =="特后前送":
+                flightid_new = flightid + "-2" + "-B"
+        peopleSchedule_sts=fdb.queryTabel("peopleSchedule{}".format(selectedtime),"*","编号='%s'"%flightid_new)
+        newdic={}
+        if len(peopleSchedule_sts) != 0:
+            for i in range(3,8):
+                if "√" not in peopleSchedule_sts[0][i] and peopleSchedule_sts[0][i] !="":
+                    newitem=peopleSchedule_sts[0][i]+"√"
+                    newdic[peopleSchedule_sts2en[i]]="'%s'"%newitem
+            fdb.upDateItem("peopleSchedule{}".format(selectedtime),newdic,"编号='%s'"%flightid_new)
+    except Exception as e:
+        app_logger.log_error(e)

+ 27 - 0
Functions/DButilsFunction/infoConfirm2.py

@@ -0,0 +1,27 @@
+from unitls.LogerinTxt import app_logger
+from .flightDB import flightDB
+
+
+def infoConfirm2(fdb:flightDB,flighttype,flightid,displayMode,selectedtime):
+    try:
+        peopleSchedule_sts2en={3:"放行",4:"勤务1",5:"勤务2",6:"工1",7:"工2",8:"工3"}
+        if displayMode =="A":
+            if flighttype =="短停接" or flighttype =="航后" or flighttype =="特后前接" or flighttype =="停场":
+                flightid_new=flightid+"-1"+"-A"
+            elif flighttype =="短停送" or flighttype =="航前" or flighttype =="特后前送":
+                flightid_new = flightid + "-2" + "-A"
+        elif displayMode =="B":
+            if flighttype =="短停接" or flighttype =="航后" or flighttype =="特后前接" or flighttype =="停场":
+                flightid_new=flightid+"-1"+"-B"
+            elif flighttype =="短停送" or flighttype =="航前" or flighttype =="特后前送":
+                flightid_new = flightid + "-2" + "-B"
+        peopleSchedule_sts=fdb.queryTabel("peopleSchedule{}".format(selectedtime),"*","编号='%s'"%flightid_new)
+        newdic={}
+        if len(peopleSchedule_sts) != 0:
+            for i in range(3,8):
+                if "!" not in peopleSchedule_sts[0][i] and peopleSchedule_sts[0][i] !="":
+                    newitem="!"+peopleSchedule_sts[0][i]
+                    newdic[peopleSchedule_sts2en[i]]="'%s'"%newitem
+            fdb.upDateItem("peopleSchedule{}".format(selectedtime),newdic,"编号='%s'"%flightid_new)
+    except Exception as e:
+        app_logger.log_error(e)

+ 27 - 0
Functions/DButilsFunction/infoConfirm3.py

@@ -0,0 +1,27 @@
+from unitls.LogerinTxt import app_logger
+from .flightDB import flightDB
+
+
+def infoConfirm3(fdb:flightDB,flighttype,flightid,displayMode,selectedtime):
+    try:
+        peopleSchedule_sts2en={3:"放行",4:"勤务1",5:"勤务2",6:"工1",7:"工2",8:"工3"}
+        if displayMode =="A":
+            if flighttype =="短停接" or flighttype =="航后" or flighttype =="特后前接" or flighttype =="停场":
+                flightid_new=flightid+"-1"+"-A"
+            elif flighttype =="短停送" or flighttype =="航前" or flighttype =="特后前送":
+                flightid_new = flightid + "-2" + "-A"
+        elif displayMode =="B":
+            if flighttype =="短停接" or flighttype =="航后" or flighttype =="特后前接" or flighttype =="停场":
+                flightid_new=flightid+"-1"+"-B"
+            elif flighttype =="短停送" or flighttype =="航前" or flighttype =="特后前送":
+                flightid_new = flightid + "-2" + "-B"
+        peopleSchedule_sts=fdb.queryTabel("peopleSchedule{}".format(selectedtime),"*","编号='%s'"%flightid_new)
+        newdic={}
+        if len(peopleSchedule_sts) != 0:
+            for i in range(3,8):
+                if "*" not in peopleSchedule_sts[0][i] and peopleSchedule_sts[0][i] !="":
+                    newitem=peopleSchedule_sts[0][i]+"*"
+                    newdic[peopleSchedule_sts2en[i]]="'%s'"%newitem
+            fdb.upDateItem("peopleSchedule{}".format(selectedtime),newdic,"编号='%s'"%flightid_new)
+    except Exception as e:
+        app_logger.log_error(e)

+ 95 - 0
Functions/DButilsFunction/initFlightDatabase.py

@@ -0,0 +1,95 @@
+from Functions.DButilsFunction import flightDB
+from unitls.LogerinTxt import app_logger
+from unitls.StaticDataclass import get_dic
+
+def initFlightDatabase(database:flightDB,workLoad:flightDB, datatime:str):
+    try:
+        fdb = database
+        sortDic={}
+        logsDic = {}
+        workerinfoDic = {}
+        authorityDic = {}
+        flightstsDic = {}
+        TaskFlightinfoDic={}
+        pglistDic={}
+        peopleScheduleDic={}
+        taskDic={}
+        CalllistDic={}
+        workjobDic = {}
+        displayDic={}
+        riskDic={}
+        flighsearchDic = {}
+        tasklistDic = {}
+        workloadDic = {}
+        flightplanflightinfoDic = {}
+        primaryKey = 'SERIAL PRIMARY KEY'
+        primaryKey3 ='TEXT PRIMARY KEY NOT NULL'
+
+
+        for sortkey in list(get_dic("sortLabel"))[1:]:
+            sortDic[sortkey]= 'text not null'
+        for logskey in list(get_dic("logsLabel"))[1:]:
+            logsDic[logskey]= 'text not null'
+        for workerinfokey in list(get_dic("workerinfoLabel"))[1:]:
+            workerinfoDic[workerinfokey]= 'text not null'
+        for authoritykey in list(get_dic("authorityLabel"))[1:]:
+            authorityDic[authoritykey]= 'text not null'
+        for flightstskey in list(get_dic('flightstsLabel'))[1:]:
+            flightstsDic[flightstskey]= 'text not null'
+        for flightstskey in list(get_dic('TaskflightinfoLabel'))[1:]:
+            TaskFlightinfoDic[flightstskey]= 'text not null'
+        for pglistkey in list(get_dic("pglistLabel"))[1:]:
+            pglistDic[pglistkey] = 'text not null'
+        for peopleScheduleKey in list(get_dic("peopleScheduleLabel"))[1:]:
+            peopleScheduleDic[peopleScheduleKey] = 'text not null'
+        for CalllistKey in list(get_dic("CalllistLabel"))[1:]:
+            if CalllistKey == '拨号次数':
+                CalllistDic[CalllistKey] = 'int'
+            else:
+                CalllistDic[CalllistKey] = 'text not null'
+        for taskkey in list(get_dic("taskLabel"))[1:]:
+            taskDic[taskkey]= 'text not null'
+        for workjobkey in list(get_dic("workjobkeyLabel"))[1:]:
+            workjobDic[workjobkey]= 'text not null'
+        for displaykey in list(get_dic("displayLabel"))[1:]:
+            displayDic[displaykey]= 'text not null'
+        for riskkey in list(get_dic("RiskLabel"))[1:]:
+            riskDic[riskkey]= 'text not null'
+        for flightkey in list(get_dic("flightsearchLabel"))[1:]:
+            flighsearchDic[flightkey]= 'text not null'
+        for tasklistkey in list(get_dic("TaskListLabel"))[1:]:
+            tasklistDic[tasklistkey]= 'text not null'
+        for workloadkey in list(get_dic("newWorkloadLabel"))[1:]:
+            workloadDic[workloadkey] = 'text not null'
+        for flightplankey in list(get_dic("flightplanflightinfoLabel"))[1:]:
+            flightplanflightinfoDic[flightplankey] = 'text not null'
+
+        nowDayStr = datatime
+        fdb.initTable('pglist{}'.format(nowDayStr),"姓名", primaryKey3,pglistDic)
+        fdb.initTable('sortFlight2{}'.format(nowDayStr), "编号", primaryKey3, sortDic)
+        fdb.initTable('sortFlight{}'.format(nowDayStr), "编号",primaryKey3, sortDic)
+        fdb.initTable('logs', "编号",primaryKey, logsDic)
+        fdb.initTable('taskAuto', "编号", primaryKey3, taskDic)
+        fdb.initTable('workerinfo',"工号", primaryKey3, workerinfoDic)
+        fdb.initTable('authority',"编号", primaryKey, authorityDic)
+        fdb.initTable('flightsts{}'.format(nowDayStr),"航班编号", primaryKey3, flightstsDic)
+        fdb.initTable('TaskFlightinfo{}'.format(nowDayStr), "航班编号", primaryKey3, TaskFlightinfoDic)
+        fdb.initTable('FlightSearch{}'.format(nowDayStr), "FLIGHT_ID", primaryKey3, flighsearchDic)
+        fdb.initTable('peopleSchedule{}'.format(nowDayStr), "编号", primaryKey3, peopleScheduleDic)
+        fdb.initTable('Calllist', "航班编号", primaryKey3, CalllistDic)
+        fdb.initTable('workjob', "任务编号", primaryKey3, workjobDic)
+        fdb.initTable('display', "ID", primaryKey3, displayDic)
+        fdb.initTable('RiskTable', "风险编号", primaryKey3, riskDic)
+        fdb.initTable('TaskList{}'.format(nowDayStr), "TASKID", primaryKey3, tasklistDic)
+        fdb.initTable('flightplaninfo{}'.format(nowDayStr), "flightId", primaryKey3, flightplanflightinfoDic)
+        workLoad.initTable('Workload{}'.format(nowDayStr), "编号", primaryKey3, workloadDic)
+
+
+        if len(fdb.getSingledata("A",'display')) == 0:
+            fdb.insertData('display', {'ID': 1, 'A': '{}','B': '{}'})
+            fdb.insertData('display', {'ID': 2, 'A': '{}','B': '{}'})
+            fdb.insertData('display', {'ID': 3, 'A': '{}','B': '{}'})
+
+
+    except Exception as e:
+        app_logger.log_error(e)

+ 19 - 0
Functions/DButilsFunction/insertCalllist.py

@@ -0,0 +1,19 @@
+import datetime
+
+from unitls.LogerinTxt import app_logger
+from .flightDB import flightDB
+
+
+def insertCalllist(fdb:flightDB,data):
+    try:
+        #CalllistLabel1 = ["航班编号", "电话", "工号", "姓名", "航班号", "附加消息", "拨号次数", "创建时间", "接通时间"]
+        now = datetime.datetime.now()
+        data["创建时间"]=now
+        data["接通时间"] = ''
+        fdb.insertData('Calllist',data)
+        #print("test")
+        res={"返回值":"ok"}
+        return res
+    except Exception as e:
+        app_logger.log_error(e)
+        return {"返回值":"error:{}".format(e)}

+ 14 - 0
Functions/DButilsFunction/insertLogs.py

@@ -0,0 +1,14 @@
+import datetime
+
+from unitls.LogerinTxt import app_logger
+from .flightDB import flightDB
+
+
+def insertLogs(database:flightDB,TEXT:str,user:str,time):
+    try:
+        now = datetime.datetime.now()
+        newdic = {"航班编号": "人工%s" % user, "警告信息":TEXT, "信息状态": "",
+                  "提示信息": time,"产生时间": "%s" % now, "处理人": "", "处理时间": "", "变更字段": "人工待办","显示对象":"","提示内容":""}   #需要确定显示对象,可以考虑传参
+        database.insertData("logs", newdic)
+    except Exception as e:
+        app_logger.log_error(e)

+ 14 - 0
Functions/DButilsFunction/insertLogs2.py

@@ -0,0 +1,14 @@
+import datetime
+
+from unitls.LogerinTxt import app_logger
+from .flightDB import flightDB
+
+
+def insertLogs2(database:flightDB,TEXT:str,user:str,time):
+    try:
+        now = datetime.datetime.now()
+        newdic = {"航班编号": "人工%s" % user, "警告信息":"", "信息状态": "",
+                  "提示信息": TEXT,"产生时间": "%s" % now, "处理人": user, "处理时间": time, "变更字段": "操作日志","显示对象":"","提示内容":""}   #需要确定显示对象,可以考虑传参
+        database.insertData("logs", newdic)
+    except Exception as e:
+        app_logger.log_error(e)

+ 541 - 0
Functions/DButilsFunction/insertTaskDataToTable.py

@@ -0,0 +1,541 @@
+import datetime
+import re
+
+import unitls.baseFunction as baseFunction
+from unitls.LogerinTxt import app_logger
+from unitls.StaticDataclass import get_dic
+from unitls.settings import NO_TPIS
+from .flightDB import flightDB
+
+no_tips_acno=NO_TPIS()
+
+
+def waringinsert(database,text,taskid,col):
+    try:
+        newDic = {"警告信息": text,"航班编号":taskid, "信息状态": "", "提示信息": "", "产生时间": "%s" % datetime.datetime.now(),
+               "处理人": "", "处理时间": "","变更字段": col, "显示对象": "", "提示内容": ""}
+        database.lazyInsertData('logs', newDic)
+    except Exception as e:
+        app_logger.log_error(f"警告信息插入错误,插入信息{text},{taskid},{col},错误信息见下一条")
+        app_logger.log_error(e)
+def noteinsert(database,text,taskid,col):
+    try:
+        newDic = {"警告信息": '',"航班编号":taskid, "信息状态": "", "提示信息": text, "产生时间": "%s" % datetime.datetime.now(),
+               "处理人": "", "处理时间": "","变更字段": col, "显示对象": "", "提示内容": ""}
+        database.lazyInsertData('logs', newDic)
+    except Exception as e:
+        app_logger.log_error(f"提示信息插入错误,插入信息{text},{taskid},{col},错误信息见下一条")
+        app_logger.log_error(e)
+def checkTASKTYPE(row,en2zh,database,flightdate,LOGsdeactive,headerLabelKey,headerLabel,nowDayStr):
+    try:
+        newDic = {}
+        for col in row:
+            if col in headerLabelKey:
+                if col != "FJ_TASKIDS" and col != "LAST_AF_ATA" and col != "LAST_TAF_ATA" and col != 'FNO':
+                    newDic[en2zh[col]] = row[col]
+                elif col == "FJ_TASKIDS" :
+                    newDic[en2zh[col]] = ",".join(row[col])
+                elif col == 'FNO':
+                    newDic[en2zh[col]] = row[col].replace("|","-").replace("---","")
+                else:
+                    if row["CARRIER"] == '3U':
+                        newDic[en2zh[col]] = row[col][0]['ATA']
+                    else:
+                        newDic[en2zh[col]] = ''
+        if row["TASKTYPE"] == "" and LOGsdeactive != 0:
+            waringinsert(database,"[%s]机号%s航班号%s,航班类型显示为空白,请查看派工模块并及时调整任务类型!!" %(flightdate, row["ACNO"], row["FNO"]),row["TASKID"], en2zh["TASKTYPE"])
+
+
+        newDic['航班编号'] = str(row['TASKID'])
+        newDic['取消标志'] = "0"
+        newDic['航班来源'] = "AMRO"
+        for key in headerLabel:
+            if key not in newDic.keys():
+                newDic[key] = ''
+
+        database.lazyInsertData('TaskFlightinfo{}'.format(nowDayStr), newDic)
+    except Exception as e:
+        app_logger.log_error(f"航班类型监测并写入数据错误,详细错误信息见下条")
+        app_logger.log_error(e)
+
+def judgeWaringsts(bztime,oldbztime): #只抑制警告,不抑制note
+    now = datetime.datetime.now()
+    starttime = now-datetime.timedelta(hours=12)
+    endtime = now+datetime.timedelta(hours=4)   #最多4+2小时的
+    if (starttime < datetime.datetime.strptime(bztime, "%Y-%m-%d %H:%M:%S") < endtime) or (starttime < datetime.datetime.strptime(oldbztime, "%Y-%m-%d %H:%M:%S") < endtime ):  #当现在距离这个航班的预计保障时间相差5h或者过了一1h之内就不抑制
+        return 0
+    else:
+        return 1
+
+
+
+def insertTaskDataToTable(database: flightDB, datatime: str, jsonData,jsonData2):
+    flightst_code = {"4": "接机已到位提示", "7": "已放行提示", "11": "二送已到位提示"}
+    bglist = ["ACNO", "FNO", "ETA", "BAY_B", "TASKTYPE", "BL", "SJ_DEP"]  # 需要播报的变更列表,应该与显示的相结合
+    AFbglist = ["ACNO", "FNO", "ETA", "BAY_B", "BL"]
+    APbglist = ["ACNO", "FNO", "SJ_DEP"]
+    TRbglist = ["ACNO", "FNO", "ETA", "BAY_B", "BL", "SJ_DEP"]
+
+
+
+    nowDayStr = datatime
+    now = datetime.datetime.now()
+    insertdatestr = datatime + " 00:00:00"
+    insertdate = datetime.datetime.strptime(insertdatestr, "%Y%m%d %H:%M:%S").strftime("%Y-%m-%d %H:%M:%S")
+    nowDay = datetime.datetime.now().strftime("%Y%m%d")
+    nowDay_1 = (datetime.date.today() - datetime.timedelta(days=1)).strftime("%Y%m%d")
+    nowDay_2 = (datetime.date.today() + datetime.timedelta(days=1)).strftime("%Y%m%d")
+    nowDay_str2 = datetime.date.today().strftime("%Y-%m-%d")
+    a_str = nowDay_str2 + " 20:30:00"
+    b_str = nowDay_str2 + " 22:00:00"
+    c_str = nowDay_str2 + " 09:00:00"
+    time1 = datetime.datetime.strptime(a_str, "%Y-%m-%d %H:%M:%S")
+    time2 = datetime.datetime.strptime(b_str, "%Y-%m-%d %H:%M:%S")
+    time3 = datetime.datetime.strptime(c_str, "%Y-%m-%d %H:%M:%S")
+    if now < time3:
+        days = [nowDay, nowDay_1]
+    elif time3 < now < time1:
+        days = [nowDay]
+    else:
+        days = [nowDay, nowDay_2]
+    try:
+        if nowDayStr in days:
+            #获取静态参数
+            en2zh=get_dic("TaskflightinfoLabel2en")
+            headerLabelKey = get_dic("headerLabelKey")
+            headerLabel = get_dic("TaskflightinfoLabel")
+            taskType=get_dic("taskType")
+            header2num=get_dic("header2num")
+            taskSTS=get_dic("taskSTS")
+            ecsjtaskSTS=get_dic("ecsjtaskSTS")
+            zydy_simple=get_dic("zydy_simple")
+            ########################################
+            flightinfo_flight_ids_arr = []
+            flightinfo_flight_ids = database.queryTabel('TaskFlightinfo{}'.format(nowDayStr), '*', "航班来源='AMRO'")#确认一下要不要取整张表
+            if len(flightinfo_flight_ids) != 0:
+                for i in flightinfo_flight_ids:
+                    flightinfo_flight_ids_arr.append(i[0])
+
+            flight_id_now = []
+            for i in [jsonData,jsonData2]:
+                if jsonData != "" and jsonData2 !="" and jsonData2 !=None and jsonData !=None and jsonData != {} and  jsonData2 != {} and len(jsonData)!=0 and len(jsonData2)!=0:
+                    for row in i:
+                        bztime=row["STARTDATE_PL"] if 'STARTDATE_PL' in row and row["STARTDATE_PL"] != "" else datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
+                        flightinfos=baseFunction.TuplefindInList1(flightinfo_flight_ids, row["TASKID"], 0)
+                        oldbztime=flightinfos[0][36] if flightinfos else bztime
+                        LOGsdeactive = judgeWaringsts(bztime,oldbztime)
+                        flight_id_now.append(row["TASKID"])
+                        now11=str(now).split(".")[0]
+                        flightdate=str(row["FLIGHTDATE"]).split(" ")[0][5:10]
+                        if str(row["TASKID"]) not in str(flightinfo_flight_ids_arr) and str(insertdate)==row["FLIGHTDATE"]:
+                            checkTASKTYPE(row,en2zh,database,flightdate,LOGsdeactive,headerLabelKey,headerLabel,nowDayStr)
+                            ####这里需要一个检查返航的,目前还没有确定返航字段
+                            if len(flightinfo_flight_ids_arr) != 0 and LOGsdeactive == 0:
+                                #app_logger.log_error("bztime")
+                                #app_logger.log_error(bztime)
+                                #app_logger.log_error(oldbztime)
+                                #app_logger.log_error(f'{flightdate},{row["ACNO"]},{row["TASKID"]}')
+                                a = taskType[row["TASKTYPE"]] if row["TASKTYPE"] != "" else "未显示"
+                                waringinsert(database, "有新增航班,[%s]机号:%s航班号:%s航班类型:%s,请注意核对FOC!!!" % (flightdate, row["ACNO"], row["TASKID"], a),  row["TASKID"], "全部新增")
+                        elif str(row["TASKID"]) in str(flightinfo_flight_ids_arr) and str(row["TASKID"]) != "":
+                            #检测到航班信息,清零取消监测
+                            newdic = {"取消标志": "'0'"}
+                            database.lazyUpdateItem('TaskFlightinfo{}'.format(nowDayStr), newdic,"航班编号='%s'" % row["TASKID"])
+                            acno=flightinfos[0][1]
+                            if acno == row["ACNO"]:
+                                old_tasktype = flightinfos[0][3]
+                                sjry = flightinfos[0][15]
+                                for col in headerLabelKey:
+                                    b = flightinfos[0][header2num[col]]
+                                    if col =='TASKTYPE' and 'TASKTYPE' in row and row[col] != b:
+                                        if LOGsdeactive == 0:
+                                            waringinsert(database, "[%s]机号:%s航班类型由%s变更为%s,请注意核对FOC!!!" % (flightdate,row["ACNO"],taskType[b],taskType[row["TASKTYPE"]] ),row["TASKID"], en2zh[col])
+                                            if "BAY_A" in row and "BAY_B" in row and row["BAY_A"] != row["BAY_B"] and (row[col] == "TR" or row[col] == "TAF"):
+                                                mesg="[%s]%s %s航班进港机位为%s,出港机位为%s,短停进出港机位不一致,请注意核对AMRO机位信息,按需修改,注意核对工作人员派送机位信息!!!" % (flightdate,row["ACNO"], row["FNO"],row["BAY_A"], row["BAY_B"])
+                                                if mesg not in str(database.queryTabel('logs', "警告信息", "航班编号='%s'" % row["TASKID"])):
+                                                   waringinsert(database, mesg, row["TASKID"], "机位不一致警告")
+                                        else:
+                                            noteinsert(database, "[%s]机号:%s航班类型由%s变更为%s,请注意核对FOC!!!" % (flightdate,row["ACNO"],taskType[b],taskType[row["TASKTYPE"]] ),row["TASKID"], en2zh[col])
+
+                                        newdic = {"航班类型": "'%s'" % row["TASKTYPE"]}
+                                        database.lazyUpdateItem('TaskFlightinfo{}'.format(nowDayStr), newdic,"航班编号='%s'" % row["TASKID"])
+                                    elif 'TASKSTS' in row and col == 'TASKSTS' and row[col] != b:
+                                        noteinsert(database, "[%s]机号:%s维修状态由%s变更为%s!%s" % (flightdate,row["ACNO"],taskSTS[b], taskSTS[row["TASKSTS"]],now11),row["TASKID"], en2zh[col])
+                                        if row[col] in flightst_code.keys():
+                                            newdic={"%s"%flightst_code[row[col]]:"1"}
+                                            database.lazyUpdateItem('flightsts{}'.format(nowDayStr),newdic,"航班编号='%s'"%row["TASKID"])
+                                        if row['TASKTYPE'] != "AP" and row['TASKSTS'] != "" and int(row['TASKSTS']) >= 7 and ("ATA" not in row or row["ATA"] == '' or datetime.datetime.strptime(row['ATA'],"%Y-%m-%d %H:%M:%S")+datetime.timedelta(minutes=15) >= datetime.datetime.now()):
+                                            waringinsert(database, "[%s]机号:%s放行节点上报过早,请确认是否误上报并确认放行情况!!" % (flightdate,row["FNO"]), row["TASKID"], "放行节点早报")
+
+                                        newdic = {"维修状态": "'%s'" % row[col]}
+                                        database.lazyUpdateItem('TaskFlightinfo{}'.format(nowDayStr), newdic, "航班编号='%s'" % row["TASKID"])
+                                    elif col == 'TASKSTS_ECSJ' and 'TASKSTS_ECSJ' in row and row[col] != b:
+                                        noteinsert(database, "[%s]机号:%s二送状态由%s变更为%s!%s" % (flightdate,row["ACNO"],ecsjtaskSTS[b], ecsjtaskSTS[row["TASKSTS_ECSJ"]],now11),row["TASKID"], en2zh[col])
+                                        newdic = {"二送状态": "'%s'" % row[col]}
+                                        database.lazyUpdateItem('TaskFlightinfo{}'.format(nowDayStr), newdic, "航班编号='%s'" % row["TASKID"])
+                                    ####需要判断返航备降的字段,暂缺
+                                    elif col == 'ETA' and "ETA" in row and row[col] != b and row["TASKTYPE"] != "AP":
+                                        if b == "" and LOGsdeactive == 0 and "FLYING" in row and row["FLYING"] != "" :  #新航班有预计到达,且上段已经实际起飞
+                                            waringinsert(database, "[%s]机号:%s%s由%s变更为%s!" % (flightdate,row["ACNO"], zydy_simple[col], b, row[col][-8:-3]),row["TASKID"], en2zh[col])
+
+                                        elif b != "" and LOGsdeactive == 0 and "ATD" in row and row["ATD"] != "" : #预计到达发生变更,且上段已经实际起飞
+                                            ETA_P = datetime.datetime.strptime(b, "%Y-%m-%d %H:%M:%S") + datetime.timedelta(minutes=10)
+                                            ETA_N = datetime.datetime.strptime(b, "%Y-%m-%d %H:%M:%S") - datetime.timedelta(minutes=5)
+                                            ETAnew = datetime.datetime.strptime(str(row[col]), "%Y-%m-%d %H:%M:%S")
+                                            if (ETAnew < ETA_N or ETAnew > ETA_P ) and ETAnew > now:
+                                                waringinsert(database, "[%s]机号:%s%s由%s变更为%s!" % (flightdate,row["ACNO"], zydy_simple[col], b[-8:-3], row[col][-8:-3]),row["TASKID"], en2zh[col])
+                                        else:
+                                            noteinsert(database, "[%s]机号:%s%s由%s变更为%s!" % (flightdate,row["ACNO"], zydy_simple[col], b, row[col][-8:-3]),row["TASKID"], en2zh[col])
+                                        newdic = {"非航前预计到达": "'%s'" % row[col]}
+                                        database.lazyUpdateItem('TaskFlightinfo{}'.format(nowDayStr), newdic, "航班编号='%s'" % row["TASKID"])
+                                    elif col == "FLYING" and "FLYING" in row and old_tasktype != "AP" and row[col] != b and "新航班播报" not in str(database.queryTabel('logs', "变更字段", "航班编号='%s'" %row["TASKID"])):
+                                        FJtask = ",有工作包" if row["FJ_TASKIDS"] != [] else ""
+                                        BLstr = ",有保留" if "BL" in row and row["BL"] != "" else ""
+                                        bay_str=row["BAY_B"] if "BAY_B" in row else ""
+                                        waringinsert(database, "[%s]新航班:%s%s%s %s%s%s!" % (flightdate,row["ACNO"],taskType[old_tasktype],bay_str, row["ETA"][-8:-3],BLstr,FJtask),row["TASKID"], "新航班播报")
+
+                                        newdic = {"上段起飞时间": "'%s'" % row[col]}
+                                        database.lazyUpdateItem('TaskFlightinfo{}'.format(nowDayStr), newdic, "航班编号='%s'" % row["TASKID"])
+                                        now_1= (datetime.datetime.now() - datetime.timedelta(minutes=0.5)).strftime("%Y-%m-%d %H:%M:%S")
+                                        waringsts = database.queryTabel('logs', "编号","航班编号 ='%s' and 变更字段='非航前预计到达' and 产生时间>'%s'" %(row["TASKID"],now_1))
+                                        if len(waringsts) != 0:
+                                            newdic = {"处理人": "'系统抑制'", "处理时间": "'%s'" % now}
+                                            database.lazyUpdateItem('logs', newdic, "编号='%s'" % waringsts[0][0])
+                                    elif col == 'STD' and "ETD" not in row and "STD" in row and row[col] != b:
+                                        if LOGsdeactive == 0 and "ATD" not in row:
+                                            waringinsert(database, "[%s]机号:%s%s由%s变更为%s!" % (flightdate,row["ACNO"], zydy_simple[col], b, row[col]),row["TASKID"], en2zh[col])
+                                        else:
+                                            noteinsert(database, "[%s]机号:%s%s由%s变更为%s!" % (flightdate,row["ACNO"], zydy_simple[col], b, row[col]),row["TASKID"], en2zh[col])
+                                        newdic = {"航前预计起飞": "'%s'" % row[col]}
+                                        database.lazyUpdateItem('TaskFlightinfo{}'.format(nowDayStr), newdic, "航班编号='%s'" % row["TASKID"])
+                                    elif col == 'STD' and "STD" in row and "ETD" in row and "ATD" not in row and row["ETD"] != b :
+                                        if LOGsdeactive == 0 and ("CSC" in flightinfos[0][21] or "3U" in flightinfos[0][21] or ("CSC" not in flightinfos[0][21] and "3U" not in flightinfos[0][21] and datetime.datetime.strptime(row["ETD"], "%Y-%m-%d %H:%M:%S") > datetime.datetime.now())):
+                                            waringinsert(database, "[%s]机号:%s%s由%s变更为%s!" % (flightdate,row["ACNO"], zydy_simple[col], b, row["ETD"]),row["TASKID"], en2zh[col])
+                                        else:
+                                            noteinsert(database, "[%s]机号:%s%s由%s变更为%s!" % (flightdate,row["ACNO"], zydy_simple[col], b, row["ETD"]),row["TASKID"], en2zh[col])
+                                        newdic = {"航前预计起飞": "'%s'" % row["ETD"]}
+                                        database.lazyUpdateItem('TaskFlightinfo{}'.format(nowDayStr), newdic, "航班编号='%s'" % row["TASKID"])
+                                    elif col == 'FJ_TASKIDS' and "FJ_TASKIDS" in row and ",".join(row[col]) != b:
+                                        if row['TASKTYPE'] != "AF" and row['TASKTYPE'] != "AP" and LOGsdeactive == 0:
+                                            mesg = "[%s]机号:%s航班号:%s有新增工作包!" % (flightdate,row["ACNO"],row['FNO'])
+                                            if mesg not in str(database.queryTabel('logs', "警告信息", "航班编号='%s'" % row["TASKID"])):
+                                                waringinsert(database,mesg,row["TASKID"], en2zh[col])
+                                        newdic = {"工作包": "'%s'" % ",".join(row[col])}
+                                        database.lazyUpdateItem('TaskFlightinfo{}'.format(nowDayStr), newdic, "航班编号='%s'" % row["TASKID"])
+                                    elif col == 'BAY_A' and "BAY_A" in row:
+                                        if b != row[col]:
+                                            if (row["TASKTYPE"] == "TR" or row["TASKTYPE"] == "AF" or row["TASKTYPE"] == "TAF") and LOGsdeactive == 0:
+                                                waringinsert(database, "[%s]%s机位由%s变更为%s" % (flightdate, row["ACNO"], b, row[col]),row["TASKID"], "进港机位变更")
+                                            else:
+                                                noteinsert(database, "[%s]%s机位由%s变更为%s" % (flightdate, row["ACNO"], b, row[col]),row["TASKID"], "进港机位变更")
+                                            newDic2={"%s"%en2zh[col]:"'%s'"%row[col]}
+                                            database.lazyUpdateItem('TaskFlightinfo{}'.format(nowDayStr), newDic2, "航班编号='%s'" %row["TASKID"])
+                                        if (row["TASKTYPE"] == "TR" or row["TASKTYPE"] == "TAF") and "BAY_B" not in row:
+                                            newDic2 = {"航前离港机位": "'%s'" % row[col]}
+                                            database.lazyUpdateItem('TaskFlightinfo{}'.format(nowDayStr), newDic2,"航班编号='%s'" % row["TASKID"])
+                                    elif col == 'BAY_B' and "BAY_B" in row:
+                                        if b != row[col]:
+                                            if (row["TASKTYPE"] == "AP" or ((row["TASKTYPE"] == "TR" or row["TASKTYPE"] == "TAF") and("BAY_A" not in row or row["BAY_A"] != row["BAY_B"]))) and LOGsdeactive == 0:
+                                                waringinsert(database,  "[%s]%s机位由%s变更为%s" % (flightdate, row["ACNO"], b, row[col]),row["TASKID"], "出港机位变更")
+                                            else:
+                                                noteinsert(database,  "[%s]%s机位由%s变更为%s" % (flightdate, row["ACNO"], b, row[col]),row["TASKID"], "出港机位变更")
+                                            newDic2 = {"%s"%en2zh[col]: "'%s'" % row[col]}
+                                            database.lazyUpdateItem('TaskFlightinfo{}'.format(nowDayStr), newDic2,"航班编号='%s'" % row["TASKID"])
+                                            if (row["TASKTYPE"] == "TR" or row["TASKTYPE"] == "TAF") and "BAY_A" in row and (row["BAY_A"] != row["BAY_B"]):
+                                                newDic2 = {"非航前进港机位": "'%s'" % row[col]}
+                                                database.lazyUpdateItem('TaskFlightinfo{}'.format(nowDayStr), newDic2,"航班编号='%s'" %row["TASKID"])
+                                        if (row["TASKTYPE"] == "TR" or row["TASKTYPE"] == "TAF") and ("BAY_A" not in row.keys()):
+                                            newDic2 = {"非航前进港机位": "'%s'" % row[col]}
+                                            database.lazyUpdateItem('TaskFlightinfo{}'.format(nowDayStr), newDic2,"航班编号='%s'" % row["TASKID"])
+                                    elif col == "SJ_DEP" and "SJ_DEP" in row and "SJ_ARR" not in row:
+                                        if row["SJ_DEP"] != "":
+                                            SJ = "随机"+row["SJ_DEP"].replace("已安排","").replace("已登机","")+";"
+                                        else:
+                                            SJ = ""
+                                        new_a = row["TASKID"] + "-2" + "-A"
+                                        fj = database.queryTabel('peopleSchedule{}'.format(nowDayStr), "附加消息", "编号='%s'" % str(new_a))
+                                        if sjry != SJ:
+                                            newDic2={"%s"%en2zh[col]:"'%s'" % SJ}
+                                            database.lazyUpdateItem('TaskFlightinfo{}'.format(nowDayStr), newDic2, "航班编号='%s'" % row["TASKID"])
+                                            if fj and len(fj) != 0 and ((sjry != "" and sjry not in str(fj) and SJ not in str(fj) and SJ != "") or sjry == ""):
+                                                new_fj=SJ + fj[0][0]
+                                                newDic2 = {"附加消息": "'%s'" % new_fj}
+                                                database.lazyUpdateItem('peopleSchedule{}'.format(nowDayStr), newDic2,"编号='%s'" % str(new_a))
+                                                waringinsert(database, "[%s]%s随机由%s变更为%s" % (flightdate, row["ACNO"], sjry, SJ),row["TASKID"],"随机人员变更")
+                                            elif fj and len(fj)!=0 and sjry in str(fj) and SJ != sjry:
+                                                new_fj=fj[0][0].replace("%s"% sjry,"%s"% SJ)
+                                                newDic2 = {"附加消息": "'%s'" % new_fj}
+                                                database.lazyUpdateItem('peopleSchedule{}'.format(nowDayStr), newDic2,"编号='%s'" % str(new_a))
+                                                waringinsert(database, "[%s]%s随机由%s变更为%s" % (flightdate, row["ACNO"], sjry, SJ),row["TASKID"],"随机人员变更")
+                                        else:
+                                            if fj == None or len(fj) == 0:
+                                                newDic2 = {"编号":new_a,"航班编号":row["TASKID"],"显示模式":"A","放行":"","勤务1":"","勤务2":"","工1":"","工2":"","工3":"","附加消息":"%s" % SJ}
+                                                database.lazyInsertData('peopleSchedule{}'.format(nowDayStr), newDic2)
+                                            elif SJ not in str(fj):
+                                                new_fj = SJ + fj[0][0]
+                                                newDic2 = {"附加消息": "'%s'" % new_fj}
+                                                database.lazyUpdateItem('peopleSchedule{}'.format(nowDayStr), newDic2,"编号='%s'" % str(new_a))
+                                    elif col == "SJ_ARR" and "SJ_ARR" in row and "SJ_DEP" not in row:
+                                        if row["SJ_ARR"] != "":
+                                            SJ="随机"+row["SJ_ARR"].replace("已安排","").replace("已登机","")+";"
+                                        else:
+                                            SJ = ""
+                                        new_a = row["TASKID"] + "-1" + "-A"
+                                        fj = database.queryTabel('peopleSchedule{}'.format(nowDayStr), "附加消息","编号='%s'" % str(new_a))
+                                        if sjry != SJ:
+                                            newDic2={"%s"%en2zh[col]:"'%s'" %SJ}
+                                            database.lazyUpdateItem('TaskFlightinfo{}'.format(nowDayStr), newDic2, "航班编号='%s'" % row["TASKID"])
+                                            if fj and len(fj)!=0 and ((sjry!="" and sjry not in str(fj) and SJ not in str(fj) and SJ !="") or sjry == ""):
+                                                new_fj=SJ + fj[0][0]
+                                                newDic2 = {"附加消息": "'%s'" % new_fj}
+                                                database.lazyUpdateItem('peopleSchedule{}'.format(nowDayStr), newDic2,"编号='%s'" % str(new_a))
+                                                waringinsert(database, "[%s]%s随机由%s变更为%s" % (flightdate, row["ACNO"], sjry, SJ),row["TASKID"],"随机人员变更")
+                                            elif fj and   len(fj)!=0 and sjry in str(fj) and SJ != sjry:
+                                                new_fj=fj[0][0].replace("%s"%sjry,"%s"%SJ)
+                                                newDic2 = {"附加消息": "'%s'" % new_fj}
+                                                database.lazyUpdateItem('peopleSchedule{}'.format(nowDayStr), newDic2,"编号='%s'" % str(new_a))
+                                                waringinsert(database, "[%s]%s随机由%s变更为%s" % (flightdate, row["ACNO"], sjry, SJ),row["TASKID"],"随机人员变更")
+                                        else:
+                                            if fj == None or len(fj)==0:
+                                                newDic2 = {"编号":new_a,"航班编号":row["TASKID"],"显示模式":"A","放行":"","勤务1":"","勤务2":"","工1":"","工2":"","工3":"","附加消息":"%s" % SJ}
+                                                database.lazyInsertData('peopleSchedule{}'.format(nowDayStr), newDic2)
+                                            elif SJ not in str(fj):
+                                                new_fj=SJ+ fj[0][0]
+                                                newDic2 = {"附加消息": "'%s'" % new_fj}
+                                                database.lazyUpdateItem('peopleSchedule{}'.format(nowDayStr), newDic2,"编号='%s'" % str(new_a))
+
+                                    elif (col == "SJ_DEP" and "SJ_ARR" in row and "SJ_DEP" in row) or (col == "SJ_ARR" and "SJ_DEP" in row and "SJ_ARR" in row):
+                                        if row["SJ_DEP"] != "" and row["SJ_ARR"] == "":
+                                            SJ_DEP="随机"+row["SJ_DEP"].replace("已安排","").replace("已登机","")+";"
+                                            SJ_ARR=""
+                                            SJ = str(SJ_DEP)
+                                        elif row["SJ_DEP"] == "" and row["SJ_ARR"] != "":
+                                            SJ_ARR = "随机" + row["SJ_ARR"].replace("已安排","").replace("已登机","")+";"
+                                            SJ_DEP = ""
+                                            SJ = str(SJ_ARR)
+                                        elif row["SJ_DEP"] == "" and row["SJ_ARR"] == "":
+                                            SJ_DEP = ""
+                                            SJ_ARR = ""
+                                            SJ = ""
+                                        else:
+                                            SJ_ARR = "随机" + row["SJ_ARR"].replace("已安排","").replace("已登机","")+";"
+                                            SJ_DEP = "随机" + row["SJ_DEP"].replace("已安排","").replace("已登机","")+";"
+                                            SJ=str(SJ_ARR)+"-"+str(SJ_DEP)
+                                        new_a = row["TASKID"] + "-1" + "-A"
+                                        new_b = row["TASKID"] + "-2" + "-A"
+                                        fj = database.queryTabel('peopleSchedule{}'.format(nowDayStr), "附加消息","编号='%s'" % str(new_a))
+                                        fj2 = database.queryTabel('peopleSchedule{}'.format(nowDayStr), "附加消息","编号='%s'" % str(new_b))
+
+
+                                        if "离港" in sjry and "进港" not in sjry:
+                                            sjry_ARR = ""
+                                            sjry_DEP = sjry
+                                        elif "进港" in sjry and "离港" not in sjry:
+                                            sjry_ARR = sjry
+                                            sjry_DEP = ""
+                                        elif "进港" not in sjry and "离港" not in sjry:
+                                            sjry_ARR = ""
+                                            sjry_DEP = ""
+                                        else:
+                                            sjry_ARR=sjry.split("-")[0]
+                                            sjry_DEP = sjry.split("-")[1]
+
+                                        if sjry != SJ:
+                                            newDic2={"随机":"'%s'" %SJ}
+                                            database.lazyUpdateItem('TaskFlightinfo{}'.format(nowDayStr), newDic2, "航班编号='%s'" % row["TASKID"])
+                                            waringinsert(database, "[%s]%s随机由%s变更为%s" % (flightdate, row["ACNO"], sjry, SJ),row["TASKID"],"随机人员变更")
+                                            if fj and len(fj)!=0 and ((sjry_ARR !="" and str(sjry_ARR) not in str(fj) and str(SJ_ARR) not in str(fj) and sjry_ARR !=SJ_ARR)or(sjry_ARR =="" and str(SJ_ARR) not in str(fj) and sjry_ARR !=SJ_ARR)):
+                                                new_fj=SJ_ARR+fj[0][0]
+                                                newDic2 = {"附加消息": "'%s'" % new_fj}
+                                                database.lazyUpdateItem('peopleSchedule{}'.format(nowDayStr), newDic2,"编号='%s'" % str(new_a))
+                                            elif fj and  len(fj)!=0 and sjry_ARR !="" and str(sjry_ARR) in str(fj) and sjry_ARR != SJ_ARR:
+                                                new_fj=fj[0][0].replace("%s"%(sjry_ARR),"%s"%(SJ_ARR))
+                                                newDic2 = {"附加消息": "'%s'" % new_fj}
+                                                database.lazyUpdateItem('peopleSchedule{}'.format(nowDayStr), newDic2,"编号='%s'" % str(new_a))
+                                            if fj2 and len(fj2)!=0 and ((sjry_DEP !="" and str(sjry_DEP) not in str(fj2) and str(SJ_DEP) not in str(fj2) and sjry_DEP !=SJ_DEP)or(sjry_DEP =="" and str(SJ_DEP) not in str(fj2) and sjry_DEP !=SJ_DEP)):
+
+                                                new_fj2 = SJ_DEP+fj2[0][0]
+                                                newDic2 = {"附加消息": "'%s'" % new_fj2}
+                                                database.lazyUpdateItem('peopleSchedule{}'.format(nowDayStr), newDic2,"编号='%s'" % str(new_b))
+                                            elif fj2 and  len(fj2)!=0 and sjry_DEP !="" and sjry_DEP in str(fj2) and sjry_DEP != SJ_DEP:
+                                                new_fj2=fj2[0][0].replace("%s"%(sjry_DEP),"%s"%(SJ_DEP))
+                                                newDic2 = {"附加消息": "'%s'" % new_fj2}
+                                                database.lazyUpdateItem('peopleSchedule{}'.format(nowDayStr), newDic2,"编号='%s'" % str(new_b))
+                                        else:
+                                            if fj==None or len(fj)==0:
+                                                newDic2 = {"编号":new_a,"航班编号":row["TASKID"],"显示模式":"A","放行":"","勤务1":"","勤务2":"","工1":"","工2":"","工3":"","附加消息":"%s" %SJ_ARR}
+                                                database.lazyInsertData('peopleSchedule{}'.format(nowDayStr), newDic2)
+                                            elif fj2==None or len(fj2)==0:
+                                                newDic2 = {"编号":new_b,"航班编号":row["TASKID"],"显示模式":"A","放行":"","勤务1":"","勤务2":"","工1":"","工2":"","工3":"","附加消息":"%s" %SJ_DEP}
+                                                database.lazyInsertData('peopleSchedule{}'.format(nowDayStr), newDic2)
+                                            elif str(SJ_ARR) not in str(fj) or str(str(SJ_DEP)) not in str(fj2):
+                                                new_fj=SJ_ARR+fj[0][0]
+                                                newDic2 = {"附加消息": "'%s'" % new_fj}
+                                                database.lazyUpdateItem('peopleSchedule{}'.format(nowDayStr), newDic2,"编号='%s'" % str(new_a))
+                                                new_fj2 = SJ_DEP + fj2[0][0]
+                                                newDic2 = {"附加消息": "'%s'" % new_fj2}
+                                    elif col == 'REMARK_BUSINESS' and "REMARK_BUSINESS" in row and row[col] != b:
+                                        if "返航" in row["REMARK_BUSINESS"]:
+                                            if row["TASKTYPE"] != "AP":
+                                                new_a = row["TASKID"] + "-1" + "-A"
+                                            else:
+                                                new_a = row["TASKID"] + "-2" + "-A"
+                                            fj = database.queryTabel('peopleSchedule{}'.format(nowDayStr), "附加消息","编号='%s'" % str(new_a))
+                                            if fj == None or len(fj) == 0:
+                                                newDic2 = {"编号": new_a, "航班编号": row["TASKID"], "显示模式": "A", "放行": "","勤务1": "", "勤务2": "", "工1": "", "工2": "", "工3": "","附加消息": "返航航班;"}
+                                                database.lazyInsertData('peopleSchedule{}'.format(nowDayStr), newDic2)
+                                            elif "返航航班;" not in str(fj):
+                                                new_fj=fj[0][0]+"返航航班;"
+                                                newDic2 = {"附加消息": "'%s'" % new_fj}
+                                                database.lazyUpdateItem('peopleSchedule{}'.format(nowDayStr), newDic2, "编号='%s'" % str(new_a))
+                                            waringinsert(database, "%s/%s判断为返航航班,请核对FOC" % (row["ACNO"],row["FNO"]),row["TASKID"],"返航警告")
+                                        elif "备降天府" in row["REMARK_BUSINESS"]:
+                                            new_a = row["TASKID"] + "-1" + "-A"
+                                            fj = database.queryTabel('peopleSchedule{}'.format(nowDayStr), "附加消息","编号='%s'" % str(new_a))
+                                            if fj == None or len(fj) == 0:
+                                                newDic2 = {"编号": new_a, "航班编号": row["TASKID"], "显示模式": "A", "放行": "","勤务1": "", "勤务2": "", "工1": "", "工2": "", "工3": "","附加消息": "备降航班;"}
+                                                database.lazyInsertData('peopleSchedule{}'.format(nowDayStr), newDic2)
+                                            elif "备降航班;" not in str(fj):
+                                                new_fj=fj[0][0]+"备降航班;"
+                                                newDic2 = {"附加消息": "'%s'" % new_fj}
+                                                database.lazyUpdateItem('peopleSchedule{}'.format(nowDayStr), newDic2, "编号='%s'" % str(new_a))
+                                            waringinsert(database, "%s/%s判断为备降航班,请核对FOC" % (row["ACNO"],row["FNO"]),row["TASKID"],"备降警告")
+                                        newdic = {"%s"% en2zh[col]: "'%s'" %row[col]}
+                                        database.lazyUpdateItem('TaskFlightinfo{}'.format(nowDayStr), newdic, "航班编号='%s'" % row["TASKID"])
+                                    elif col == "WX" and "WX" in row and row[col] != "" and row[col] != b:
+                                        noteinsert(database, "[%s]机号:%s%s由%s变更为%s!%s" % (flightdate,row["ACNO"], zydy_simple[col],b, row[col],now11),row["TASKID"], en2zh[col])
+                                        newdic = {"%s"% en2zh[col]: "'%s'" %row[col]}
+                                        database.lazyUpdateItem('TaskFlightinfo{}'.format(nowDayStr), newdic, "航班编号='%s'" % row["TASKID"])
+                                    elif col == "FX" and "FX" in row and row[col] != "" and row[col] != b:
+                                        noteinsert(database, "[%s]机号:%s%s由%s变更为%s!%s" % (flightdate,row["ACNO"], zydy_simple[col],b, row[col],now11),row["TASKID"], en2zh[col])
+                                        newdic = {"%s"% en2zh[col]: "'%s'" %row[col]}
+                                        database.lazyUpdateItem('TaskFlightinfo{}'.format(nowDayStr), newdic, "航班编号='%s'" % row["TASKID"])
+                                    elif col == "ECSJ" and "ECSJ" in row and row[col] != "" and row[col] != b:
+                                        noteinsert(database, "[%s]机号:%s%s由%s变更为%s!%s" % (flightdate,row["ACNO"], zydy_simple[col],b, row[col],now11),row["TASKID"], en2zh[col])
+                                        newdic = {"%s"% en2zh[col]: "'%s'" %row[col]}
+                                        database.lazyUpdateItem('TaskFlightinfo{}'.format(nowDayStr), newdic, "航班编号='%s'" % row["TASKID"])
+                                    elif col== 'HIGHALT' and 'HIGHALT' in row and row[col] != b:
+                                        if LOGsdeactive == 0 and row[col] == 'Y' and "A319" in row["ACTYPE"]:
+                                            waringinsert(database, "[%s]%s-%s航线变更为高高原航线,注意工作单签署" % (flightdate,row["ACNO"],row["FNO"]),row["TASKID"], en2zh[col])
+                                        elif LOGsdeactive == 0 and row[col] != 'Y' and "A319" in row["ACTYPE"]:
+                                            waringinsert(database, "[%s]%s-%s航线变更为非高高原航线,注意工作单签署" % (flightdate,row["ACNO"],row["FNO"]),row["TASKID"], en2zh[col])
+                                        newdic = {"%s"% en2zh[col]: "'%s'" %row[col]}
+                                        database.lazyUpdateItem('TaskFlightinfo{}'.format(nowDayStr), newdic, "航班编号='%s'" % row["TASKID"])
+                                    elif col not in ["TASKID","FJ_TASKIDS","SJ_DEP","SJ_ARR","STD","WX","FX","ECSJ","BAY_A","BAY_B"]:
+                                        if col not in row:
+                                            row[col] = ''
+                                        elif col in ["LAST_AF_ATA","LAST_TAF_ATA"] :
+                                            if row["CARRIER"] == '3U':
+                                                row[col] = row[col][0]["ATA"]
+                                            else:
+                                                row[col] = ''
+                                        elif col == "FNO":
+                                            row[col] = row[col].replace("|","-").replace("---","")
+                                        if row[col] != b:
+                                            if old_tasktype == "AP" and col in APbglist and LOGsdeactive == 0:
+                                                waringinsert(database, "[%s]机号:%s%s由%s变更为%s!" % (flightdate,row["ACNO"], zydy_simple[col],b, row[col]),row["TASKID"], en2zh[col])
+                                            elif old_tasktype == "AF" and col in AFbglist and LOGsdeactive == 0:
+                                                waringinsert(database, "[%s]机号:%s%s由%s变更为%s!" % (flightdate,row["ACNO"], zydy_simple[col],b, row[col]),row["TASKID"], en2zh[col])
+                                            elif (old_tasktype =="TR" or old_tasktype=="TAF" ) and col in TRbglist and LOGsdeactive == 0:
+                                                waringinsert(database, "[%s]机号:%s%s由%s变更为%s!" % (flightdate,row["ACNO"], zydy_simple[col],b, row[col]),row["TASKID"], en2zh[col])
+                                            else:    #限制提示信息输出位置
+                                                if col not in ["TASKSTS_TIME",'ISSHIFTEX',"FLIGHTID1","FLIGHTID2",'ACGGY']:
+                                                    noteinsert(database, "[%s]机号:%s%s由%s变更为%s!%s" % (flightdate,row["ACNO"], zydy_simple[col],b, row[col],now11),row["TASKID"], en2zh[col])
+
+                                            newdic = {"%s" % en2zh[col]: "'%s'" % row[col]}
+                                            database.lazyUpdateItem('TaskFlightinfo{}'.format(nowDayStr), newdic, "航班编号='%s'" % row["TASKID"])
+                                #database.FunctionCommit()
+                                if "SJ_DEP" not in row and "SJ_ARR" not in row and sjry != "":
+                                    #if sjry != "":
+                                    newDic2 = {"随机": "''"}
+                                    database.lazyUpdateItem('TaskFlightinfo{}'.format(nowDayStr), newDic2,"航班编号='%s'" % row["TASKID"])
+                                    waringinsert(database, "[%s]%s %s取消,请核对FOC" % (flightdate, row["ACNO"], sjry),row["TASKID"], "随机人员")
+                                    new_a = row["TASKID"] + "-1" + "-A"
+                                    new_b = row["TASKID"] + "-2" + "-A"
+                                    fj = database.queryTabel('peopleSchedule{}'.format(nowDayStr), "附加消息","编号='%s'" % str(new_a))
+                                    fj2 = database.queryTabel('peopleSchedule{}'.format(nowDayStr), "附加消息","编号='%s'" % str(new_b))
+                                    if fj and len(fj)!=0 and len(fj[0])!=0:
+                                        new_fj=re.sub(r"随机.*港.*?[;]","",fj[0][0])
+                                        newDic = {"附加消息": "'%s'" % new_fj}
+                                        database.lazyUpdateItem('peopleSchedule{}'.format(nowDayStr), newDic,"编号='%s'" % str(new_a))
+                                    if fj2 and len(fj2)!=0 and len(fj2[0])!=0:
+                                        new_fj2=re.sub(r"随机.*港.*?[;]", "",fj2[0][0])
+                                        newDic2 = {"附加消息": "'%s'" % new_fj2}
+                                        database.lazyUpdateItem('peopleSchedule{}'.format(nowDayStr), newDic2,"编号='%s'" % str(new_b))
+
+                                if row["ACNO"] in no_tips_acno and row["TASKTYPE"] == "AP":
+                                    new_b = row["TASKID"] + "-2" + "-A"
+                                    fj2 = database.queryTabel('peopleSchedule{}'.format(nowDayStr), "附加消息","编号='%s'" % str(new_b))
+                                    if fj2 == None or len(fj2)==0:
+                                        newDic2 = {"编号":new_b,"航班编号":row["TASKID"],"显示模式":"A","放行":"","勤务1":"","勤务2":"","工1":"","工2":"","工3":"","附加消息":"【工具提示】无TPIS,带胎压表;"}
+                                        database.lazyInsertData('peopleSchedule{}'.format(nowDayStr), newDic2)
+                                    elif "【工具提示】无TPIS,带胎压表" not in str(fj2):
+                                        new_fj = "【工具提示】无TPIS,带胎压表;" + fj2[0][0]
+                                        newDic2 = {"附加消息": "'%s'" % new_fj}
+                                        database.lazyUpdateItem('peopleSchedule{}'.format(nowDayStr), newDic2,"编号='%s'" % str(new_b))
+
+
+                            else:
+                                if LOGsdeactive == 0:
+                                    waringinsert(database, "[%s]%s航班机号由%s变更为%s,请注意核对FOC!!!" % (flightdate,row["TASKID"], acno, row["ACNO"]),row["TASKID"], "机号")
+
+                                newdic = {"机号": "'%s'" % row["ACNO"]}
+                                database.lazyUpdateItem('TaskFlightinfo{}'.format(nowDayStr), newdic, "航班编号='%s'" % row["TASKID"])
+                    database.FunctionCommit()
+                else:
+                    print(datetime.datetime.now(), "[数据库操作]TaskFlightinfo航班数据为空")
+                    app_logger.log_error("[数据库操作]TaskFlightinfo航班数据为空")
+                    pass
+            if jsonData != "" and jsonData2 !="" and jsonData2 != None and jsonData != None and jsonData != {} and  jsonData2 != {} and len(flight_id_now) != 0 and len(jsonData)!=0 and len(jsonData2)!=0:
+                flightinfo_flight_ids = database.queryTabel('TaskFlightinfo{}'.format(nowDayStr),'*',"航班来源='AMRO'")
+                if len(flightinfo_flight_ids) != 0:
+                    for iii in flightinfo_flight_ids:
+                        datas=baseFunction.TuplefindInList1(flightinfo_flight_ids, iii[0], 0)[0]
+                        now=datetime.datetime.now()
+                        now_15=datetime.datetime.now()-datetime.timedelta(hours=15)
+                        if str(iii[0]) not in flight_id_now and datetime.datetime.strptime(datas[36] if datas[36] else now, "%Y-%m-%d %H:%M:%S") >= now_15 :
+                            cancelid=datas[35]
+                            newcancelid=int(cancelid)+1
+                            if int(newcancelid) < 3:
+                                newdic={"取消标志":"'%s'"%newcancelid}
+                                database.lazyUpdateItem('TaskFlightinfo{}'.format(nowDayStr), newdic, "航班编号='%s'" %iii[0])
+                            else:
+                                c = datas[2][5:10]
+                                a = datas[1]
+                                bb = datas[21]
+                                database.deleteSingledata("TaskFlightinfo{}".format(nowDayStr), "航班编号='%s'" % str(iii[0]) )
+                                if nowDayStr == nowDay:
+                                    waringinsert(database, "[%s]%s,%s航班已取消,注意核对FOC!!!"% (c,a,bb),iii[0], "全部取消")
+            database.FunctionCommit()
+
+            selectdaystr = str(datatime)[0:4] + "-" + str(datatime)[4:6] + "-" + str(datatime)[6:] + " 00:00:00"
+            nowDayStr_search = datetime.datetime.strptime(selectdaystr, "%Y-%m-%d %H:%M:%S")
+            starttime=(nowDayStr_search - datetime.timedelta(days=7)).strftime("%Y-%m-%d %H:%M:%S")
+            endtime = (nowDayStr_search + datetime.timedelta(days=7)).strftime("%Y-%m-%d %H:%M:%S")
+            tasknuminworjoblist=database.getSingledata("任务编号",'workjob')
+            tasknums=database.queryTabel('TaskFlightinfo{}'.format(nowDayStr),'*', "工作包 !=''")
+            if len(tasknums) != 0:
+                for i in tasknums:
+                    if i[0] not in str(tasknuminworjoblist):
+                        workjoblist=i[18]
+                        #print(workjoblist)
+                        newdic3={"任务编号":"%s"%i[0],"工作包编号":"%s"%workjoblist,"查询开始时间":"%s"%starttime,"查询结束时间":"%s"%endtime,"开始时间":"","基地":"","项目描述":"","工作步骤":"","机号":"%s"%i[1],"机型":"%s"%i[26],"航班类型":"%s"%taskType[i[3]]}
+                        database.lazyInsertData('workjob', newdic3)
+                        #返回一个数值去查询
+                    if i[0] in str(tasknuminworjoblist):
+                        if i[18] != database.queryTabel('workjob','工作包编号', "任务编号 ='%s'"%i[0])[0][0]:
+                            newdic = {"工作包编号": "'%s'" % i[18],"开始时间":"''","基地":"''","项目描述":"''","工作步骤":"''"}
+                            database.lazyUpdateItem('workjob', newdic, "任务编号='%s'" % i[0])
+            database.FunctionCommit()
+    except Exception as e:
+        app_logger.log_error(e)
+
+
+
+
+
+
+
+
+
+

+ 38 - 0
Functions/DButilsFunction/insertWorkjob.py

@@ -0,0 +1,38 @@
+
+from unitls.LogerinTxt import app_logger
+from .flightDB import flightDB
+
+
+def insertWorkjob(database:flightDB,workjobdata,taskid):
+    try:
+        A=["MDTITLE_C","WORKSTEP","BASE_CODE","PLANSTD"]
+        num=1
+        MDTITLE_C=""
+        WORKSTEP=""
+        PLANSTD=""
+        BASE_CODE_now=""
+        if len(workjobdata) != 0:
+            for row in workjobdata:
+                MDTITLE_C_now=row["MDTITLE_C"]  if "MDTITLE_C" in row.keys() else ""
+                WORKSTEP_now = row["WORKSTEP"] if "WORKSTEP" in row.keys() else ""
+                BASE_CODE_now = row["BASE_CODE"] if "BASE_CODE" in row.keys() else ""
+                PLANSTD_now = row["PLANSTD"] if "PLANSTD" in row.keys() else ""
+                if MDTITLE_C !="":
+                    MDTITLE_C=MDTITLE_C+"\n------------------------------------------------\n"+"工作包%s内容:"%num+"\n"+MDTITLE_C_now
+                    WORKSTEP=WORKSTEP+"\n------------------------------------------------\n"+"工作包%s步骤:"%num+"\n"+WORKSTEP_now
+                    PLANSTD=PLANSTD+"\n------------------------------------------------\n"+"工作包%s计划开始时间:"%num+"\n"+PLANSTD_now
+                else:
+                    MDTITLE_C ="工作包%s内容:" % num + "\n" + MDTITLE_C_now
+                    WORKSTEP ="工作包%s步骤:" % num + "\n" + WORKSTEP_now
+                    PLANSTD ="工作包%s计划开始时间:" % num + "\n" + PLANSTD_now
+                num+=1
+            newdic={"基地":"'%s'"%BASE_CODE_now,"开始时间":"'%s'"%PLANSTD,"项目描述":"'%s'"%MDTITLE_C.replace("\"","*").replace("#","*").replace("\\",";").replace("\'","*").replace("/","、"),"工作步骤":"'%s'"%WORKSTEP.replace("\'","*").replace("\\",";").replace("/","、").replace("\"","*").replace("#","*")}
+            database.lazyUpdateItem('workjob', newdic, "任务编号='%s'" %taskid)
+        res={"返回值":"ok"}
+        database.FunctionCommit()
+        return res
+    except Exception as e:
+        app_logger.log_error(e)
+        res = {"返回值": "fail"}
+        database.FunctionCommit()
+        return res

+ 29 - 0
Functions/DButilsFunction/judge_bc.py

@@ -0,0 +1,29 @@
+import datetime
+
+from unitls.LogerinTxt import app_logger
+
+
+def judge_bc():
+    try:
+        nowDay = datetime.date.today().strftime("%Y%m%d")
+        nowDay_1 = (datetime.date.today() - datetime.timedelta(days=1)).strftime("%Y%m%d")
+        #nowDay_2 = (datetime.date.today() + datetime.timedelta(days=1)).strftime("%Y%m%d")
+        nowDay_str2 = datetime.date.today().strftime("%Y-%m-%d")
+        a_str = nowDay_str2 + " 09:00:00"
+        b_str = nowDay_str2 + " 20:30:00"
+        a = datetime.datetime.strptime(a_str, "%Y-%m-%d %H:%M:%S")
+        b = datetime.datetime.strptime(b_str, "%Y-%m-%d %H:%M:%S")
+        nowtime = datetime.datetime.now()
+        if a < nowtime < b:
+            date=nowDay
+            bc="A"
+        elif b <= nowtime:
+            date = nowDay
+            bc = "B"
+        else:
+            date = nowDay_1
+            bc = "B"
+        dic={"date":"%s"%date,"bc":"%s"%bc}
+        return dic
+    except Exception as e:
+        app_logger.log_error(e)

+ 28 - 0
Functions/DButilsFunction/maintainAuthCheck.py

@@ -0,0 +1,28 @@
+from unitls.LogerinTxt import app_logger
+from .flightDB import flightDB
+
+
+def maintainAuthCheck(fdb:flightDB,name,flighttype):
+    try:
+        list = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12"]
+        notpasspeople=[]
+        sts=False
+        if name != "清空项目12345678987654321" and str(name) not in list:
+            names = name.split(",")
+            for people in names:
+                search = fdb.queryTabel("workerinfo","姓名","姓名 = '{}' and 南航授权 like '%{}%'".format(people,flighttype))
+                if search or len(search) !=0:
+                    sts = True
+                else:
+                    sts = False
+                    notpasspeople.append(people)
+
+            if sts:
+                return { "返回值" : "ok" }
+            else:
+                return {"返回值" : "notpass","未通过人员":notpasspeople}
+        else:
+            return  {"返回值": "ok"}
+    except Exception as e:
+        app_logger.log_error(e)
+        return {"返回值": "fail"}

+ 62 - 0
Functions/DButilsFunction/manAddFlight.py

@@ -0,0 +1,62 @@
+from unitls.settings import DBServer, flightDB4
+host, port, user1, password,online_host, online_port, online_user,online_password = DBServer()
+databaseflightDB4=flightDB4()
+from .flightDB import flightDB
+import datetime
+from .sortFlighttime import sortFlighttime
+from .sortFlighttime2 import sortFlighttime2
+def manAddFlight(fdb:flightDB,flighttype,acno,eng,actype,flightno,flightdate,bay,eta,etd,user):
+    tasktype={"短停":"TR", "特后前":"TAF", "航前":"AP", "航后":"AF"}
+    starttime = flightdate + " 00:00:00"
+    flightdate1 = datetime.datetime.strptime(starttime, "%Y-%m-%d %H:%M:%S")
+    flightdate2 =flightdate.replace("-", "")
+    flightids=fdb.getSingledata("航班编号","TaskFlightinfo%s"%flightdate2)
+    ETD2=etd
+    flightid = "MAN" + str(acno) + str(flightno)+str(flightdate2)
+    if flightid not in str(flightids):
+        if flighttype =="航前":
+            newdic={"航班编号": "%s" % flightid,"机号":acno,"航班日期":flightdate1,"航班类型":tasktype[flighttype],"非航前计划到达":"","航前预计起飞":ETD2,"非航前实际到达":"",
+                "实际起飞":"","非航前预计到达":"","预飞预达":"","非航前进港机位":"","航前离港机位":bay,"维修人员":"","放行人员":"","维修状态":"",
+                "随机":"","保留":"","维修状态时间":"","工作包":"","二次送机":"","二送状态":"",
+                "进出港航班号":flightno,"附加工作状态":"","进出港城市":"","APU型号":"","发动机":eng,"机型":actype,"机型综合信息":"","详细机型":"",
+                "高高原":"","上段起飞时间":datetime.datetime.now(),"后续类型":"","后续预计起飞":"","航班来源":"人工添加","备降返航":"",
+                "取消标志":"","备1":"","备2":"","备3":"","备4":"","备5":"","备6":"","备7":"","备8":"","备9":"","备10":""}
+        elif flighttype =="短停" or flighttype =="特后前":
+            newdic={"航班编号": "%s" % flightid,"机号":acno,"航班日期":flightdate1,"航班类型":tasktype[flighttype],"非航前计划到达":"","航前预计起飞":ETD2,"非航前实际到达":eta,
+                "实际起飞":"","非航前预计到达":eta,"预飞预达":"","非航前进港机位":bay,"航前离港机位":"","维修人员":"","放行人员":"","维修状态":"",
+                "随机":"","保留":"","维修状态时间":"","工作包":"","二次送机":"","二送状态":"",
+                "进出港航班号":flightno,"附加工作状态":"","进出港城市":"","APU型号":"","发动机":eng,"机型":actype,"机型综合信息":"","详细机型":"",
+                "高高原":"","上段起飞时间":datetime.datetime.now(),"后续类型":"","后续预计起飞":"","航班来源":"人工添加","备降返航":"",
+                "取消标志":"","备1":"","备2":"","备3":"","备4":"","备5":"","备6":"","备7":"","备8":"","备9":"","备10":""}
+
+
+        else:
+            newdic={"航班编号": "%s" % flightid,"机号":acno,"航班日期":flightdate1,"航班类型":tasktype[flighttype],"非航前计划到达":"","航前预计起飞":"","非航前实际到达":eta,
+                "实际起飞":"","非航前预计到达":eta,"预飞预达":"","非航前进港机位":bay,"航前离港机位":"","维修人员":"","放行人员":"","维修状态":"",
+                "随机":"","保留":"","维修状态时间":"","工作包":"","二次送机":"","二送状态":"",
+                "进出港航班号":flightno,"附加工作状态":"","进出港城市":"","APU型号":"","发动机":eng,"机型":actype,"机型综合信息":"","详细机型":"",
+                "高高原":"","上段起飞时间":datetime.datetime.now(),"后续类型":"","后续预计起飞":"","航班来源":"人工添加","备降返航":"",
+                "取消标志":"","备1":"","备2":"","备3":"","备4":"","备5":"","备6":"","备7":"","备8":"","备9":"","备10":""}
+        fdb.insertData("TaskFlightinfo%s"%flightdate2,newdic)
+    else:
+        if flighttype =="航前":
+            newdic={"航班编号":"'%s'"%flightid,"机号":"'%s'"%acno,"发动机":"'%s'"%eng, "机型":"'%s'"%actype, "进出港航班号":"'%s'"%flightno, "航班日期":"'%s'"%flightdate1,"航班类型":"'%s'"%tasktype[flighttype], "航前预计起飞":"'%s'"%etd, "航前离港机位":"'%s'"%bay}
+        elif flighttype =="短停" or flighttype =="特后前":
+            newdic = {"航班编号": "'%s'" % flightid, "机号":"'%s'"% acno, "发动机":"'%s'"% eng, "机型":"'%s'"% actype, "进出港航班号":"'%s'"% flightno , "航班日期":"'%s'"% flightdate1, "航班类型":"'%s'"% tasktype[flighttype],"非航前预计到达":"'%s'"% eta,"非航前实际到达": "'%s'"% eta, "上段起飞时间": "'%s'"% eta, "航前预计起飞":"'%s'"% ETD2, "非航前进港机位":"'%s'"% bay}
+        else:
+            newdic = {"航班编号": "'%s'" % flightid,"机号":"'%s'"% acno, "发动机":"'%s'"% eng, "机型":"'%s'"% actype, "进出港航班号":"'%s'"% flightno, "航班日期":"'%s'"% flightdate1, "航班类型":"'%s'"% tasktype[flighttype], "非航前预计到达":"'%s'"% eta,"上段起飞时间": "'%s'"% eta, "非航前进港机位":"'%s'"% bay}
+        fdb.upDateItem("TaskFlightinfo%s"%flightdate2,newdic,"航班编号='%s'"%flightid)
+    sortFlighttime(flightDB(host=host,
+                    port=port,
+                    user=user1,
+                    password=password,
+                    database=databaseflightDB4
+                   ))
+    sortFlighttime2(flightDB(host=host,
+                    port=port,
+                    user=user1,
+                    password=password,
+                    database=databaseflightDB4
+                   ))
+    res={"返回值":"ok"}
+    return res

+ 63 - 0
Functions/DButilsFunction/manChangests.py

@@ -0,0 +1,63 @@
+import datetime
+
+from unitls.LogerinTxt import app_logger
+from .flightDB import flightDB
+
+
+def manChangests(database:flightDB,flight_id:str,changests_id:str,selectedtime,username):
+    try:
+        nowDayStr = selectedtime
+        now = datetime.datetime.now()
+        now11=str(now).split(".")[0]
+        code = {"接机到位": "人工已到位", "放行": "人工已放行", "随机到位": "人工已到位", "销子夹板": "人工已取下", "二送到位": "人工已到位"}
+        code2 = {"接机到位": "接机已到位提示", "放行": "已放行提示", "随机到位": "随机已到位提示", "销子夹板": "销子夹板已提示", "二送到位": "二送已到位提示"}
+        flightsts_search=database.queryTabel("flightsts{}".format(nowDayStr),"%s"%changests_id,"航班编号 = '%s'"%flight_id)
+        waringsts=database.queryTabel("logs","*","航班编号='%s' and 处理时间 =''"%flight_id)
+        if len(flightsts_search) != 0:
+            if flightsts_search[0][0] != "":
+                newdic={"%s"%changests_id:"''","%s"%code2[changests_id]:"''"}
+                database.upDateItem("flightsts{}".format(nowDayStr),newdic,"航班编号='%s'"%flight_id)
+                a =database.queryTabel('flightsts{}'.format(nowDayStr), "机号", "航班编号='%s'" % flight_id)[0][0] if len(database.queryTabel('flightsts{}'.format(nowDayStr), "机号", "航班编号='%s'" % flight_id)) != 0 else "未显示机号"
+                newdic = {"航班编号": "%s" % flight_id, "警告信息": "", "信息状态": "",
+                          "提示信息": "人工处理:%s取消%s状态!%s" % (a,changests_id,now11),
+                          "产生时间": "%s" % now, "处理人": "%s"%username, "处理时间": "%s" % now, "变更字段": "","显示对象":"","提示内容":""}
+                database.insertData('logs', newdic)
+
+            else:
+                newdic={"%s"%changests_id:"'%s'"%code[changests_id],"%s"%code2[changests_id]:"'1'"}
+                database.upDateItem("flightsts{}".format(nowDayStr),newdic,"航班编号 = '%s'"%flight_id)
+                a = database.queryTabel('flightsts{}'.format(nowDayStr), "机号", "航班编号='%s'" % flight_id)[0][0] if len(database.queryTabel('flightsts{}'.format(nowDayStr), "机号", "航班编号='%s'" % flight_id)) != 0 else "未显示机号"
+                newdic = {"航班编号": "%s" % flight_id, "警告信息": "", "信息状态": "",
+                          "提示信息": "人工处理:%s确认%s已完成!%s" % (a, changests_id,now11),
+                          "产生时间": "%s" % now, "处理人": "%s"%username, "处理时间": "%s" % now, "变更字段": "","显示对象":"","提示内容":""}
+                database.insertData('logs', newdic)
+        else:
+            newdic = {"航班编号": "%s" % flight_id, "%s"%changests_id:"%s"%code[changests_id],"%s"%code2[changests_id]:"1"}
+            for i in ["航班编号","接机到位","放行","销子夹板","随机到位","二送到位","接机已到位提示","已放行提示","销子夹板已提示","随机已到位提示","二送已到位提示","天府飞机","机号","机位"]:
+                if i not in newdic.keys():
+                    newdic[i]=''
+
+            database.insertData('flightsts{}'.format(nowDayStr), newdic)
+            newdic = {"航班编号": "%s" % flight_id, "警告信息": "", "信息状态": "","提示信息": "人工处理[首次新建]:%s确认%s已完成!%s" % (flight_id, changests_id, now11),
+                      "产生时间": "%s" % now, "处理人": "%s" % username, "处理时间": "%s" % now, "变更字段": "", "显示对象": "","提示内容": ""}
+            database.insertData('logs', newdic)
+
+        if len(waringsts) != 0:
+                for i in waringsts:
+                    if changests_id == "接机到位" and i[8]=="到位警告":
+                        newdic = {"处理人": "'%s'" % username, "处理时间": "'%s'" % now}
+                        database.upDateItem('logs', newdic, "编号='%s'" % i[0])
+                    elif changests_id == "放行" and i[8]=="放行警告":
+                        newdic = {"处理人": "'%s'" % username, "处理时间": "'%s'" % now}
+                        database.upDateItem('logs', newdic, "编号='%s'" % i[0])
+                    elif changests_id == "二送到位" and i[8]=="二送警告":
+                        newdic = {"处理人": "'%s'" % username, "处理时间": "'%s'" % now}
+                        database.upDateItem('logs', newdic, "编号='%s'" % i[0])
+                    elif changests_id == "销子夹板" and i[8]=="销夹警告":
+                        newdic = {"处理人": "'%s'" % username, "处理时间": "'%s'" % now}
+                        database.upDateItem('logs', newdic, "编号='%s'" % i[0])
+                    elif changests_id == "随机到位" and i[8] == "随机到位警告":
+                        newdic = {"处理人": "'%s'" % username, "处理时间": "'%s'" % now}
+                        database.upDateItem('logs', newdic, "编号='%s'" % i[0])
+    except Exception as e:
+        app_logger.log_error(e)

+ 26 - 0
Functions/DButilsFunction/mandealAllLogs.py

@@ -0,0 +1,26 @@
+import datetime
+
+from unitls.LogerinTxt import app_logger
+from .flightDB import flightDB
+
+
+def mandealAllLogs(database:flightDB,name:str,mode):
+    try:
+        if mode =="norm":
+            now=datetime.datetime.now()
+            clear=database.queryTabel('logs',"编号","警告信息 !='' and 处理时间 ='' and 变更字段 !='人工待办' and 变更字段 !='准备组任务' ")
+            newdic = {"处理人": "'%s'" % name, "处理时间": "'%s'" % now,"信息状态":"'人工一键处理'"}
+            if len(clear) != 0:
+                for i in clear:
+                    database.lazyUpdateItem('logs',newdic,"编号='%s'"%i[0])
+        elif mode == "super":
+            now = datetime.datetime.now()
+            clear = database.queryTabel('logs', "编号", "警告信息 !='' and 处理时间 ='' and 变更字段 !='人工待办'")
+            newdic = {"处理人": "'%s'" % name, "处理时间": "'%s'" % now, "信息状态": "'人工一键处理'"}
+            if len(clear) != 0:
+                for i in clear:
+                    database.lazyUpdateItem('logs', newdic, "编号='%s'" % i[0])
+        database.FunctionCommit()
+    except Exception as e:
+        app_logger.log_error(e)
+        database.FunctionCommit()

+ 119 - 0
Functions/DButilsFunction/mapDispaly.py

@@ -0,0 +1,119 @@
+import unitls.baseFunction as baseFunction
+from unitls.LogerinTxt import app_logger
+from unitls.StaticDataclass import get_dic
+from .flightDB import flightDB
+
+
+def mapDispaly(fdb:flightDB,selectedtime):
+    try:
+        mapDispalydata = {}
+        nowDayStr = selectedtime
+        sortdatas= fdb.queryTabel('sortFlight{}'.format(nowDayStr), '*', "航班编号!=''")
+        sorttable= baseFunction.TuplefindInList2(sortdatas , "1" , "3" , 5)
+        #sorttable1 = fdb.queryTabel("sortFlight{}".format(nowDayStr),"*","CAST(级别 AS integer)='1' or CAST(级别 AS integer)='3'")
+        #{机位:[机号,机型,发动机,航班类型,航班号,ta,td,进港机场,出港机场,状态,放行,维修人员,二送人员,保留,工作包,TASKID,flightid,color,备注]}
+
+        datas = fdb.queryTabel('TaskFlightinfo{}'.format(nowDayStr), '*', "航班编号!=''")
+        for row in sorttable:
+            # print(row)
+            otheroneSts = []
+            flightinfodata = baseFunction.TuplefindInList1(datas , row[1 ] , 0)[0 ]
+            if flightinfodata[3] == "TR":
+                iddd=row[1]+"-1"
+                iddddd = row[1] + "-2"
+                jfjSts= baseFunction.TuplefindInList3(sortdatas , iddd , 0 , 5)
+                sfjSts = baseFunction.TuplefindInList3(sortdatas , iddddd , 0 , 5)
+                #jfjSts= fdb.queryTabel("sortFlight{}".format(nowDayStr),"级别","编号='%s'"%iddd)[0][0]
+                #sfjSts = fdb.queryTabel("sortFlight{}".format(nowDayStr), "级别", "编号='%s'" % iddddd)[0][0]
+               # print(otheroneSts)
+
+            if (flightinfodata[3] =="AP" and flightinfodata[11] !="") or (flightinfodata[3] !="AP" and flightinfodata[10] !=""):
+                if flightinfodata[3] == "AP" and flightinfodata[11] != "":
+                    bay=flightinfodata[11]
+                    color="#99CCCC"
+                elif flightinfodata[3] == "AF" and flightinfodata[10] != "" and row[5]=="3":
+                    bay = flightinfodata[10]
+                    color = "#0095d9"
+                elif flightinfodata[3] == "停场" and flightinfodata[10] != "" and row[5]=="3":
+                    bay = flightinfodata[10]
+                    color = "#0095d9"
+                elif flightinfodata[3] == "AF" and flightinfodata[10] != "" and row[5]=="1":
+                    bay = "Y"+flightinfodata[10]
+                    color = "#f6ad49"
+                elif flightinfodata[3] == "TAF" and flightinfodata[10] != "" and flightinfodata[6] == "":
+                    bay = "Y"+flightinfodata[10]
+                    color = "#f6ad49"
+                elif flightinfodata[3] == "TAF" and flightinfodata[10] != "" and flightinfodata[6] != "":
+                    bay = flightinfodata[10]
+                    color = "#4c6cb3"
+                elif flightinfodata[3] == "TR" and flightinfodata[10] != "" and jfjSts=="1":
+                    bay = "Y"+flightinfodata[10]
+                    color = "#f6ad49"
+                elif flightinfodata[3] == "TR" and flightinfodata[10] != "" and jfjSts=="4" and sfjSts=="1":
+                    bay = flightinfodata[10]
+                    color = "#69b076"
+
+                acno=flightinfodata[1]
+                airpalneType=flightinfodata[26]
+                EngType=flightinfodata[25]
+                flightType = get_dic('taskType')[flightinfodata[3]]
+                flightNos = flightinfodata[21]
+                DEP_CH=flightinfodata[23].split("</br>")[0] #进港机场
+                DEP_CH1=flightinfodata[23].split("</br>")[1] #出港机场
+                flightsts = ""#flightinfodata[10]TASKINFO没有这个节点
+                wx=flightinfodata[12]
+                fx = flightinfodata[13]
+                es = flightinfodata[19]
+                flightid=flightinfodata[0]
+                message=""#flightinfodata[32]
+
+                e = "" #保留
+                F = ""#工作包
+                g = "" #taskid
+                ta = ""
+                td=""
+                if flightinfodata[16] != "":
+                    e = "有保留"
+                if flightinfodata[18] != "":
+                    F = "有工作包"
+                if flightinfodata[0] != "":
+                    g = flightinfodata[0]
+                if "-" not in flightinfodata[9].split('</br>')[0]:
+                    ta = flightinfodata[9].split('</br>')[0]
+                if "-" not in flightinfodata[9].split('</br>')[1]:
+                    td = flightinfodata[9].split('</br>')[1]
+                if "CZ" in str(flightNos) or "OQ" in str(flightNos):
+                    nanhang="1"
+                elif "3U" not in str(flightNos) or "CSC" not in str(flightNos):
+                    nanhang = "0"
+                else:
+                    nanhang = "3"
+
+                try:
+                    mapDispalydata[bay] = {"机号":acno,
+                                            "机型":airpalneType,
+                                            "发动机":EngType,
+                                            "航班类型":flightType,
+                                            "航班号":flightNos,
+                                            "到达":ta,
+                                            "起飞":td,
+                                            "进港机场":DEP_CH,
+                                            "出港机场":DEP_CH1,
+                                            "状态":flightsts,
+                                            "放行":fx,
+                                            "维修人员":wx,
+                                            "二送人员":es,
+                                            "保留":e,
+                                            "工作包":F,
+                                            "TASKID":g,
+                                            "flightid":flightid,
+                                            "color":color,
+                                            "备注":message,
+                                            "南航":nanhang
+                                            }
+                except Exception as e:
+                    app_logger.log_error(e)
+                    pass
+        return mapDispalydata
+    except Exception as e:
+        app_logger.log_error(e)

+ 76 - 0
Functions/DButilsFunction/postgresql_backup.py

@@ -0,0 +1,76 @@
+import datetime
+
+from unitls.LogerinTxt import app_logger
+from unitls.StaticDataclass import get_dic
+from .flightDB import flightDB
+
+
+def postgresql_bakup(bakcup:flightDB,main:flightDB,type):
+    print(datetime.datetime.now(), "[主从同步]开始同步数据库")
+    logintoken_dic=['id','username','token']
+    loginsts_dic=['id','sts']
+    logintable_dic=['id',"登录名","密码","权限","使用人"]
+    today = datetime.datetime.now().strftime('%Y%m%d')
+    yesterday=(datetime.datetime.now() - datetime.timedelta(days=1)).strftime('%Y%m%d')
+    tomorrow=(datetime.datetime.now() + datetime.timedelta(days=1)).strftime('%Y%m%d')
+    table_colmuns={"peopleschedule%s"%today:get_dic('peopleScheduleLabel'),"peopleschedule%s"%yesterday:get_dic('peopleScheduleLabel'),"peopleschedule%s"%tomorrow:get_dic('peopleScheduleLabel'),
+                   'risktable':get_dic('RiskLabel'),'workerinfo':get_dic('workerinfoLabel'),'pglist%s'%today:get_dic('pglistLabel'),'pglist%s'%yesterday:get_dic('pglistLabel'),
+                   'logs':get_dic('logsLabel'),'taskauto':get_dic('taskLabel'),'calllist':get_dic('CalllistLabel'),
+                   'flightsts%s'%today:get_dic('flightstsLabel'),'flightsts%s'%yesterday:get_dic('flightstsLabel'),
+                   'logintoken':logintoken_dic,'loginsts':loginsts_dic,'logintable':logintable_dic,
+                   "TaskFlightinfo%s"%today:get_dic('TaskflightinfoLabel'),"TaskFlightinfo%s"%yesterday:get_dic('TaskflightinfoLabel'),"TaskFlightinfo%s"%tomorrow:get_dic('TaskflightinfoLabel'),
+                   "flightsearch%s"%today:get_dic('flightsearchLabel'),"flightsearch%s"%yesterday:get_dic('flightsearchLabel'),"flightsearch%s"%tomorrow:get_dic('flightsearchLabel'),
+                   "sortFlight%s"%today:get_dic('sortLabel'),"sortFlight%s"%yesterday:get_dic('sortLabel'),"sortFlight%s"%tomorrow:get_dic('sortLabel'),"display":get_dic('displayLabel'),
+                   "sortFlight2%s"%today:get_dic('sortLabel'),"sortFlight2%s"%yesterday:get_dic('sortLabel'),"sortFlight2%s"%tomorrow:get_dic('sortLabel'),
+                   }
+    if type == 1:
+        dbtables=["peopleschedule%s"%today,"peopleschedule%s"%yesterday,"peopleschedule%s"%tomorrow,'risktable',
+                  'workerinfo','pglist%s'%today,'pglist%s'%yesterday,'taskauto','calllist',
+                  'flightsts%s'%today,'flightsts%s'%yesterday,
+                  "TaskFlightinfo%s"%today,"TaskFlightinfo%s"%yesterday,"TaskFlightinfo%s"%tomorrow,
+                  "flightsearch%s"%today,"flightsearch%s"%yesterday,"flightsearch%s"%tomorrow,
+                  "sortFlight%s"%today,"sortFlight%s"%yesterday,"sortFlight%s"%tomorrow,
+                  "sortFlight2%s"%today,"sortFlight2%s"%yesterday,"sortFlight2%s"%tomorrow,
+                  "display"]#logs太大无法同步
+    elif type == 2:
+        dbtables=['logintable']
+    elif type == 3:
+        dbtables=['logintoken','loginsts']
+    try:
+        tablesok=""
+        tablenum=0
+        for dbtable in dbtables:
+            try:
+                if type == 1:
+                    Dic = {}
+                    primaryKey2 = 'text'
+                    for key in list(table_colmuns[dbtable])[1:]:
+                        Dic[key] = 'text'
+                    main.initTable(dbtable, table_colmuns[dbtable][0], primaryKey2, Dic)
+                all_source_data=bakcup.getAlldata(dbtable)
+                if len(all_source_data)!=0:
+                    main.lazydeleteTable(dbtable)
+                    if dbtable=="display":
+                        dispaly_res=main.getSingledata("A", 'display')
+                        if dispaly_res == None or len(dispaly_res) == 0:
+                            main.insertData('display', {'ID': 1, 'A': '{}', 'B': '{}'})
+                            main.insertData('display', {'ID': 2, 'A': '{}', 'B': '{}'})
+                            main.insertData('display', {'ID': 3, 'A': '{}', 'B': '{}'})
+                        for row in all_source_data:
+                            newdic = {"A": '"{}"'.format(row[1]),"B": '"{}"'.format(row[2])}
+                            main.lazyUpdateItem(dbtable, newdic, "ID = '%s'"%row[0])
+                        #online.FunctionCommit()
+                    else:
+                        for row in all_source_data:
+                            main.lazyInsertData2(dbtable,', '.join(table_colmuns[dbtable]),row)
+                    main.FunctionCommit()
+                tablesok=tablesok+dbtable+"/"
+                tablenum+=1
+            except Exception as e:
+                app_logger.log_error(e)
+                continue
+        print(datetime.datetime.now(), "[主从同步]完成数据库同步(%s[%s])"%(tablesok,tablenum))
+        return "ok"
+    except Exception as e:
+        app_logger.log_error(e)
+        return "fail"

+ 66 - 0
Functions/DButilsFunction/postgresql_local.py

@@ -0,0 +1,66 @@
+import datetime
+
+from unitls.LogerinTxt import app_logger
+from unitls.StaticDataclass import get_dic
+from .flightDB import flightDB
+
+
+def postgresql_local(local:flightDB,host_online, port_online, user_online, password_online, database_online):
+    print(datetime.datetime.now(), "[同步中心]开始同步数据库")
+
+    today = datetime.datetime.now().strftime('%Y%m%d')
+    yesterday=(datetime.datetime.now() - datetime.timedelta(days=1)).strftime('%Y%m%d')
+    tomorrow=(datetime.datetime.now() + datetime.timedelta(days=1)).strftime('%Y%m%d')
+    online=flightDB(host_online, port_online, user_online, password_online, database_online)
+    '''
+    table_colmuns={"flightinfo%s"%today:flightinfoLabel,"flightinfo%s"%yesterday:flightinfoLabel,"flightinfo%s"%tomorrow:flightinfoLabel,
+                   "peopleschedule%s"%today:peopleScheduleLabel,"peopleschedule%s"%yesterday:peopleScheduleLabel,"peopleschedule%s"%tomorrow:peopleScheduleLabel,
+                   "sortFlight%s"%today:sortLabel,"sortFlight%s"%yesterday:sortLabel,"sortFlight%s"%tomorrow:sortLabel,
+                   "display":displayLabel}
+    '''
+    table_colmuns={"TaskFlightinfo%s"%today:get_dic("TaskflightinfoLabel"),"TaskFlightinfo%s"%yesterday:get_dic("TaskflightinfoLabel"),"TaskFlightinfo%s"%tomorrow:get_dic("TaskflightinfoLabel"),
+                   "peopleschedule%s"%today:get_dic('peopleScheduleLabel'),"peopleschedule%s"%yesterday:get_dic('peopleScheduleLabel'),"peopleschedule%s"%tomorrow:get_dic('peopleScheduleLabel'),
+                   "sortFlight%s"%today:get_dic('sortLabel'),"sortFlight%s"%yesterday:get_dic("sortLabel"),"sortFlight%s"%tomorrow:get_dic("sortLabel"),
+                   "display":get_dic("displayLabel"),"flightsearch%s"%today:get_dic("flightsearchLabel"),"flightsearch%s"%yesterday:get_dic("flightsearchLabel"),"flightsearch%s"%tomorrow:get_dic("flightsearchLabel"),}
+    dbtables=["TaskFlightinfo%s"%today,"TaskFlightinfo%s"%yesterday,"TaskFlightinfo%s"%tomorrow,
+              "peopleschedule%s"%today,"peopleschedule%s"%yesterday,"peopleschedule%s"%tomorrow,
+              "flightsearch%s"%today,"flightsearch%s"%yesterday,"flightsearch%s"%tomorrow,
+              "sortFlight%s"%today,"sortFlight%s"%yesterday,"sortFlight%s"%tomorrow,"display"]
+    try:
+        tablesok=""
+        tablenum=0
+        for dbtable in dbtables:
+            try:
+                Dic = {}
+                primaryKey2 = 'text'
+                for key in list(table_colmuns[dbtable])[1:]:
+                    Dic[key] = 'text'
+                online.initTable(dbtable, table_colmuns[dbtable][0], primaryKey2, Dic)
+                all_source_data=local.getAlldata(dbtable)
+                if len(all_source_data)!=0:
+
+                    online.lazydeleteTable(dbtable)
+                    if dbtable=="display":
+                        dispaly_res=online.getSingledata("A", 'display')
+                        if dispaly_res == None or len(dispaly_res) == 0:
+                            online.insertData('display', {'ID': 1, 'A': '{}', 'B': '{}'})
+                            online.insertData('display', {'ID': 2, 'A': '{}', 'B': '{}'})
+                            online.insertData('display', {'ID': 3, 'A': '{}', 'B': '{}'})
+                        for row in all_source_data:
+                            newdic = {"A": '"{}"'.format(row[1]),"B": '"{}"'.format(row[2])}
+                            online.lazyUpdateItem(dbtable, newdic, "ID = '%s'"%row[0])
+                        #online.FunctionCommit()
+                    else:
+                        for row in all_source_data:
+                            online.lazyInsertData2(dbtable,', '.join(table_colmuns[dbtable]),row)
+                    online.FunctionCommit()
+                tablesok=tablesok+dbtable+"/"
+                tablenum+=1
+            except Exception as e:
+                app_logger.log_error(e)
+                continue
+        print(datetime.datetime.now(), "[同步中心]完成数据库同步(%s[%s])"%(tablesok,tablenum))
+        return "ok"
+    except Exception as e:
+        app_logger.log_error(e)
+        return "fail"

+ 63 - 0
Functions/DButilsFunction/qtPeopleLoad.py

@@ -0,0 +1,63 @@
+import datetime
+
+import unitls.baseFunction as baseFunction
+from unitls.LogerinTxt import app_logger
+from .flightDB import flightDB
+
+
+def qtPeopleLoad(fdb:flightDB,workLoad:flightDB,bc:str,nowDaystr:str):
+    try:
+        qtPeopleLoad={}
+        aa=[]
+        selectdaystr = str(nowDaystr)[0:4] + "-" + str(nowDaystr)[4:6] + "-" + str(nowDaystr)[6:] + " 00:00:00"
+        selectday = datetime.datetime.strptime(selectdaystr, "%Y-%m-%d %H:%M:%S")
+        selectday_2 = datetime.datetime.strptime(selectdaystr, "%Y-%m-%d %H:%M:%S") + datetime.timedelta(days=1)
+        nowDay = datetime.date.today().strftime("%Y%m%d")
+        nowDay_1 = (datetime.date.today() - datetime.timedelta(days=1)).strftime("%Y%m%d")
+        nowDay_2 = (datetime.date.today() + datetime.timedelta(days=1)).strftime("%Y%m%d")
+        nowtime = datetime.datetime.now()
+        nowDay_str2 = datetime.date.today().strftime("%Y-%m-%d")
+        a_str = nowDay_str2 + " 00:00:00"
+        b_str = nowDay_str2 + " 17:00:00"
+        a = datetime.datetime.strptime(a_str, "%Y-%m-%d %H:%M:%S")
+        b = datetime.datetime.strptime(b_str, "%Y-%m-%d %H:%M:%S")
+        nowDayStr_search = datetime.date.today().strftime("%Y-%m-%d %H:%M:%S")
+        tomorrow_search = (datetime.date.today() + datetime.timedelta(days=1)).strftime("%Y-%m-%d %H:%M:%S")
+        yesterday_search = (datetime.date.today() - datetime.timedelta(days=1)).strftime("%Y-%m-%d %H:%M:%S")
+        if bc == "A":
+            pglist_str = fdb.queryTabel("pglist{}".format(nowDaystr), "*", "班次='%s'" % bc)
+        elif bc == "B" and nowDaystr == nowDay and a < nowtime < b:
+            pglist_str = fdb.queryTabel("pglist{}".format(nowDay_1), "*", "班次='%s'" % bc)
+        elif bc == "B" and nowDaystr == nowDay and b < nowtime:
+            pglist_str = fdb.queryTabel("pglist{}".format(nowDay), "*", "班次='%s'" % bc)
+        elif bc == "B" and nowDaystr == nowDay_1:
+            pglist_str = fdb.queryTabel("pglist{}".format(nowDay_1), "*", "班次='%s'" % bc)
+        elif bc == "B" and nowDaystr < nowDay_1:
+            pglist_str = fdb.queryTabel("pglist{}".format(nowDaystr), "*", "班次='%s'" % bc)
+        else:
+            pglist_str = []
+
+        diplaylist = pglist_str
+        allpeopleinfos=fdb.queryTabel('workerinfo', "*", "姓名!=''")
+        rowNum = 0
+        JS = ""
+        for row in diplaylist:
+            singleinfo= baseFunction.TuplefindInList3(allpeopleinfos , row[0 ] , 1 , 8).replace("*" , "")
+            sq=singleinfo if singleinfo else "未录入"
+            if row[2] == "WX":
+                JS = "维修员"
+            elif row[2] == "FX":
+                JS ="放行"
+            col={"序号":rowNum,"姓名":row[0],"角色":JS,"授权":sq}
+            aa.append(col)
+            rowNum += 1
+        if len(aa) != 0:
+            aa.sort(key=lambda x: (x["角色"], x['授权']))
+            rowNum1=0
+            for i in aa:
+                i["序号"]=rowNum1
+                qtPeopleLoad[rowNum1]=i
+                rowNum1 += 1
+        return qtPeopleLoad
+    except Exception as e:
+        app_logger.log_error(e)

+ 7 - 0
Functions/DButilsFunction/saveRisktable.py

@@ -0,0 +1,7 @@
+from .flightDB import flightDB
+def saveRisktable(database:flightDB):
+    fdb = database
+    res=fdb.getAlldata("RiskTable")
+    if res == None:
+        res =[]
+    return res

+ 16 - 0
Functions/DButilsFunction/selftaxiLogs.py

@@ -0,0 +1,16 @@
+import datetime
+
+from unitls.LogerinTxt import app_logger
+from .flightDB import flightDB
+
+
+def selftaxiLogs(database:flightDB,TEXT:str,flightid:str):
+    try:
+        now = datetime.datetime.now()
+        noteid=database.queryTabel("logs","*","航班编号='%s' and 警告信息='%s'"%(flightid,TEXT))
+        if len(noteid) == 0:
+            newdic = {"航班编号":flightid, "警告信息":TEXT, "信息状态": "",
+                      "提示信息": "","产生时间": "%s" % now, "处理人": "", "处理时间": "", "变更字段": "自滑提示","显示对象":"","提示内容":""}
+            database.insertData("logs", newdic)
+    except Exception as e:
+        app_logger.log_error(e)

+ 336 - 0
Functions/DButilsFunction/sortFlighttime.py

@@ -0,0 +1,336 @@
+import datetime
+
+from unitls.LogerinTxt import app_logger
+from .flightDB import flightDB
+from .initFlightDatabase import initFlightDatabase
+
+
+def updateData(database:flightDB, id,taskid,time,flighttype,flight_date_str,classstr,nowDayStr):
+    try:
+        newdic = {"编号": "'%s'" % id, "航班编号": "'%s'" % taskid, "保障时间": "'%s'" % time, "航班类型": "'%s'"%flighttype,
+                  "航班日期": "'%s'" % flight_date_str, "级别": "%s"%classstr}
+        database.lazyUpdateItem("sortFlight{}".format(nowDayStr), newdic, "编号='%s'" % id)
+    except Exception as e:
+        #print(e)
+        app_logger.log_error(e)
+
+def insertData(database:flightDB, id,taskid,time,flighttype,flight_date_str,classstr,nowDayStr):
+    if id not in lazyinsert:
+        try:
+            newdic = {"编号": "%s" % id, "航班编号": "%s" % taskid, "保障时间": "%s" % time, "航班类型": "%s"%flighttype,
+                      "航班日期": '%s' % flight_date_str, "级别": classstr}
+            database.lazyInsertData("sortFlight{}".format(nowDayStr), newdic)
+            lazyinsert.append(id)
+        except Exception as e:
+            #print(e)
+            app_logger.log_error(e)
+    else:
+        updateData(database, id, taskid, time, flighttype, flight_date_str, classstr, nowDayStr)
+
+
+def checkData(database,taskid,sendtime,flighttype,flight_date_str,sort_flight_ids_arr,nowDayStr,classstr):
+    if flighttype == "航前":
+        ii = str(taskid) + "-2"  # 送
+        iii = str(taskid) + "-1"  # 接
+    elif flighttype == "航后":
+        ii = str(taskid) + "-1"
+        iii = str(taskid) + "-2"
+    else:
+        ii = str(taskid) + "-1"
+        iii = ""
+    if ii in str(sort_flight_ids_arr):
+        updateData(database, ii, taskid, sendtime, flighttype, flight_date_str, classstr, nowDayStr)
+    else:
+        insertData(database, ii, taskid, sendtime, flighttype, flight_date_str, classstr, nowDayStr)
+    if iii and iii in str(sort_flight_ids_arr):
+        database.deleteSingledata('sortFlight{}'.format(nowDayStr), "编号='%s'" % iii)
+        sort_flight_ids_arr.remove(iii)
+
+def sortFlighttime(database:flightDB,wokload:flightDB):
+    global lazyinsert
+    lazyinsert = []
+    try:
+        print(datetime.datetime.now(),'[数据库操作]开始排序')
+        nowDay = datetime.datetime.now().strftime("%Y%m%d")
+        nowDay_1 = (datetime.date.today() - datetime.timedelta(days=1)).strftime("%Y%m%d")
+        nowDay_2 = (datetime.date.today() + datetime.timedelta(days=1)).strftime("%Y%m%d")
+        now = datetime.datetime.now()
+        #now_20 = (datetime.datetime.now() + datetime.timedelta(minutes=200)).strftime("%Y%m%d")
+        now_20 = (datetime.datetime.now() + datetime.timedelta(hours=5)).strftime("%Y%m%d")
+        initFlightDatabase(database, wokload, now_20)
+        initFlightDatabase(database, wokload, nowDay_1)
+        initFlightDatabase(database, wokload, nowDay_2)
+        initFlightDatabase(database, wokload, nowDay)
+
+        if now_20 == nowDay:
+            day = [nowDay, nowDay_1]
+        else:
+            day = [nowDay, nowDay_1, nowDay_2]
+        for nowDayStr in day:
+            sort_flight_ids_arr = []
+            sort_flight_ids = database.queryTabel('sortFlight{}'.format(nowDayStr),"*","编号 !=''")
+            flightinfo_flight_ids = database.queryTabel('TaskFlightinfo{}'.format(nowDayStr), '*', "航班编号!=''")
+
+            if sort_flight_ids and len(sort_flight_ids) != 0:
+                for sortkey in sort_flight_ids:
+                    sort_flight_id=sortkey[1]
+                    #sort_flight_id = baseFunction.TuplefindInList3(sort_flight_ids, sortkey[0],0,1)
+                    if str(sort_flight_id) in str(flightinfo_flight_ids):
+                        sort_flight_ids_arr.append(sortkey[0])
+                    else:
+                        database.deleteSingledata('sortFlight{}'.format(nowDayStr),"编号='%s'"%sortkey[0])
+
+            for i in flightinfo_flight_ids:
+                flight_date_str = i[2]
+                if i[3] == "AP" and "MAN" not in str(i[0]):
+                    if i[7] == "" and i[5] != "": #flying 空 and std 不空
+                        sendtime = datetime.datetime.strptime(i[5], "%Y-%m-%d %H:%M:%S") - datetime.timedelta(minutes=90)
+                        checkData(database,i[0],sendtime,"航前",flight_date_str,sort_flight_ids_arr,nowDayStr,1)
+                    elif i[7] != "":
+                        sendtime = datetime.datetime.strptime(i[7], "%Y-%m-%d %H:%M:%S")
+                        checkData(database,i[0],sendtime,"航前",flight_date_str,sort_flight_ids_arr,nowDayStr,4)
+                elif i[3] == "AP" and "MAN" in str(i[0]):
+                        sendtime = datetime.datetime.strptime(i[5], "%Y-%m-%d %H:%M:%S") - datetime.timedelta(minutes=90)
+                        sendtime2 = datetime.datetime.strptime(i[5], "%Y-%m-%d %H:%M:%S")
+                        if now < sendtime2:
+                            checkData(database,i[0],sendtime,"航前",flight_date_str,sort_flight_ids_arr,nowDayStr,1)
+                        else:
+                            checkData(database,i[0],sendtime2,"航前",flight_date_str,sort_flight_ids_arr,nowDayStr,4)
+                elif i[3] == "停场":
+                    receivetime = datetime.datetime.strptime(i[6], "%Y-%m-%d %H:%M:%S")
+                    checkData(database, i[0], receivetime, "停场", flight_date_str, sort_flight_ids_arr, nowDayStr, 3)
+
+                elif i[3] == "AF" and "MAN" not in str(i[0]):
+                    if i[6]=="" and i[8] !="" and i[30] != "":
+                        receivetime = datetime.datetime.strptime(i[8], "%Y-%m-%d %H:%M:%S") - datetime.timedelta(minutes=15)
+                        checkData(database, i[0], receivetime, "航后", flight_date_str, sort_flight_ids_arr, nowDayStr, 1)
+                    elif i[6]=="" and i[8] =="" and i[30] != "":
+                        receivetime = datetime.datetime.strptime(i[4], "%Y-%m-%d %H:%M:%S") - datetime.timedelta(minutes=15)
+                        checkData(database, i[0], receivetime, "航后", flight_date_str, sort_flight_ids_arr, nowDayStr, 1)
+
+                    elif i[6] == "" and i[30] == "" and i[8] == "" and i[4] != "":
+                        receivetime = datetime.datetime.strptime(i[4], "%Y-%m-%d %H:%M:%S") - datetime.timedelta(minutes=15)
+                        checkData(database,i[0],receivetime,"航后",flight_date_str,sort_flight_ids_arr,nowDayStr,2)
+
+                    elif i[6] !="":
+                        receivetime = datetime.datetime.strptime(i[6], "%Y-%m-%d %H:%M:%S")
+                        checkData(database, i[0], receivetime, "航后", flight_date_str, sort_flight_ids_arr, nowDayStr, 3)
+                    elif i[6] =="" and i[30] == "" and i[8] != "":
+                        receivetime = datetime.datetime.strptime(i[8], "%Y-%m-%d %H:%M:%S") - datetime.timedelta(minutes=15)
+                        checkData(database, i[0], receivetime, "航后", flight_date_str, sort_flight_ids_arr, nowDayStr, 2)
+
+                elif i[3] == "AF" and "MAN" in str(i[0]):
+                        receivetime = datetime.datetime.strptime(i[8], "%Y-%m-%d %H:%M:%S") - datetime.timedelta(minutes=15)
+                        receivetime2= datetime.datetime.strptime(i[8], "%Y-%m-%d %H:%M:%S")
+                        if now < receivetime2:
+                            checkData(database, i[0], receivetime, "航后", flight_date_str, sort_flight_ids_arr, nowDayStr, 1)
+                        else:
+                            checkData(database, i[0], receivetime2, "航后", flight_date_str, sort_flight_ids_arr, nowDayStr, 3)
+
+                elif i[3] == "TR" and "MAN" not in str(i[0]):
+                    if i[6] == "" and i[8] != "" and i[30] != "":
+                        receivetime = datetime.datetime.strptime(i[8], "%Y-%m-%d %H:%M:%S") - datetime.timedelta(minutes=15)
+                        ii=str(i[0])+ "-1"
+                        if ii in str(sort_flight_ids_arr):
+                            updateData(database,ii,i[0],receivetime,"短停接",flight_date_str,1,nowDayStr)
+                        else:
+                            insertData(database,ii,i[0],receivetime,"短停接",flight_date_str,1,nowDayStr)
+                    elif i[6] =="" and i[8] == "" and i[30] != "":
+                        receivetime = datetime.datetime.strptime(i[4], "%Y-%m-%d %H:%M:%S") - datetime.timedelta(minutes=15)
+                        ii=str(i[0])+ "-1"
+                        if ii in str(sort_flight_ids_arr):
+                            updateData(database,ii,i[0],receivetime,"短停接",flight_date_str,1,nowDayStr)
+                        else:
+                            insertData(database,ii,i[0],receivetime,"短停接",flight_date_str,1,nowDayStr)
+                    elif i[6] =="" and i[30] =="" and i[8] == "" and i[4] !="":
+                        receivetime = datetime.datetime.strptime(i[4], "%Y-%m-%d %H:%M:%S") - datetime.timedelta(minutes=15)
+                        ii=str(i[0])+ "-1"
+                        if ii in str(sort_flight_ids_arr):
+                            updateData(database,ii,i[0],receivetime,"短停接",flight_date_str,2,nowDayStr)
+                        else:
+                            insertData(database,ii,i[0],receivetime,"短停接",flight_date_str,2,nowDayStr)
+                    elif i[6] =="" and i[30] =="" and i[8] !="":
+                        receivetime = datetime.datetime.strptime(i[8], "%Y-%m-%d %H:%M:%S") - datetime.timedelta(minutes=15)
+                        ii=str(i[0])+ "-1"
+                        if ii in str(sort_flight_ids_arr):
+                            updateData(database,ii,i[0],receivetime,"短停接",flight_date_str,2,nowDayStr)
+                        else:
+                            insertData(database,ii,i[0],receivetime,"短停接",flight_date_str,2,nowDayStr)
+
+                    elif i[6] !="":
+                        receivetime = datetime.datetime.strptime(i[6], "%Y-%m-%d %H:%M:%S")
+                        ii=str(i[0])+ "-1"
+                        if ii in str(sort_flight_ids_arr):
+                            updateData(database,ii,i[0],receivetime,"短停接",flight_date_str,4,nowDayStr)
+                        else:
+                            insertData(database,ii,i[0],receivetime,"短停接",flight_date_str,4,nowDayStr)
+
+                elif i[3] == "TR" and "MAN" in str(i[0]):
+                        receivetime = datetime.datetime.strptime(i[8], "%Y-%m-%d %H:%M:%S") - datetime.timedelta(minutes=15)
+                        receivetime2 = datetime.datetime.strptime(i[8], "%Y-%m-%d %H:%M:%S")
+                        if now < receivetime2:
+                            ii=str(i[0])+ "-1"
+                            if ii in str(sort_flight_ids_arr):
+                                updateData(database,ii,i[0],receivetime,"短停接",flight_date_str,1,nowDayStr)
+                            else:
+                                insertData(database,ii,i[0],receivetime,"短停接",flight_date_str,1,nowDayStr)
+                        else:
+                            ii=str(i[0])+ "-1"
+                            if ii in str(sort_flight_ids_arr):
+                                updateData(database,ii,i[0],receivetime2,"短停接",flight_date_str,4,nowDayStr)
+                            else:
+                                insertData(database,ii,i[0],receivetime2,"短停接",flight_date_str,4,nowDayStr)
+
+                elif i[3] == "TAF" and "MAN" not in str(i[0]):
+                    if i[6] == "" and i[8] != "" and i[30] != "":
+                        receivetime = datetime.datetime.strptime(i[8], "%Y-%m-%d %H:%M:%S") - datetime.timedelta(minutes=15)
+                        ii = str(i[0]) + "-1"
+                        if ii in str(sort_flight_ids_arr):
+                            updateData(database, ii, i[0], receivetime, "特后前接", flight_date_str, 1, nowDayStr)
+                        else:
+                            insertData(database, ii, i[0], receivetime, "特后前接", flight_date_str, 1, nowDayStr)
+                    elif i[6] == "" and i[8] == "" and i[30] != "":
+                        receivetime = datetime.datetime.strptime(i[4], "%Y-%m-%d %H:%M:%S") - datetime.timedelta(minutes=15)
+                        ii = str(i[0]) + "-1"
+                        if ii in str(sort_flight_ids_arr):
+                            updateData(database, ii, i[0], receivetime, "特后前接", flight_date_str, 1, nowDayStr)
+                        else:
+                            insertData(database, ii, i[0], receivetime, "特后前接", flight_date_str, 1, nowDayStr)
+                    elif i[6] == "" and i[30] == "" and i[8] == "" and i[4] != "":
+                        receivetime = datetime.datetime.strptime(i[4], "%Y-%m-%d %H:%M:%S") - datetime.timedelta(minutes=15)
+                        ii = str(i[0]) + "-1"
+                        if ii in str(sort_flight_ids_arr):
+                            updateData(database, ii, i[0], receivetime, "特后前接", flight_date_str, 2, nowDayStr)
+                        else:
+                            insertData(database, ii, i[0], receivetime, "特后前接", flight_date_str, 2, nowDayStr)
+                    elif i[6] == "" and i[30] == "" and i[8] != "":
+                        receivetime = datetime.datetime.strptime(i[8], "%Y-%m-%d %H:%M:%S") - datetime.timedelta(minutes=15)
+                        ii = str(i[0]) + "-1"
+                        if ii in str(sort_flight_ids_arr):
+                            updateData(database, ii, i[0], receivetime, "特后前接", flight_date_str, 2, nowDayStr)
+                        else:
+                            insertData(database, ii, i[0], receivetime, "特后前接", flight_date_str, 2, nowDayStr)
+
+                    elif i[6] != "":
+                        receivetime = datetime.datetime.strptime(i[6], "%Y-%m-%d %H:%M:%S")
+                        ii = str(i[0]) + "-1"
+                        if ii in str(sort_flight_ids_arr):
+                            updateData(database, ii, i[0], receivetime, "特后前接", flight_date_str, 4, nowDayStr)
+                        else:
+                            insertData(database, ii, i[0], receivetime, "特后前接", flight_date_str, 4, nowDayStr)
+
+                elif i[3] == "TAF" and "MAN" in str(i[0]):
+                    receivetime = datetime.datetime.strptime(i[8], "%Y-%m-%d %H:%M:%S") - datetime.timedelta(minutes=15)
+                    receivetime2 = datetime.datetime.strptime(i[8], "%Y-%m-%d %H:%M:%S")
+                    if now < receivetime2:
+                        ii = str(i[0]) + "-1"
+                        if ii in str(sort_flight_ids_arr):
+                            updateData(database, ii, i[0], receivetime, "特后前接", flight_date_str, 1, nowDayStr)
+                        else:
+                            insertData(database, ii, i[0], receivetime, "特后前接", flight_date_str, 1, nowDayStr)
+                    else:
+                        ii = str(i[0]) + "-1"
+                        if ii in str(sort_flight_ids_arr):
+                            updateData(database, ii, i[0], receivetime2, "特后前接", flight_date_str, 4, nowDayStr)
+                        else:
+                            insertData(database, ii, i[0], receivetime2, "特后前接", flight_date_str, 4, nowDayStr)
+
+
+                if i[3] == "TR" and "MAN" not in str(i[0]):
+                    if i[7] != "":
+                        receivetime = datetime.datetime.strptime(i[7], "%Y-%m-%d %H:%M:%S")- datetime.timedelta(minutes=25)
+                        ii=str(i[0])+ "-2"
+                        if ii in str(sort_flight_ids_arr):
+                            updateData(database,ii,i[0],receivetime,"短停送",flight_date_str,4,nowDayStr)
+                        else:
+                            insertData(database,ii,i[0],receivetime,"短停送",flight_date_str,4,nowDayStr)
+                    elif i[6] != "" and i[5] != "":
+                        receivetime = datetime.datetime.strptime(i[5], "%Y-%m-%d %H:%M:%S")- datetime.timedelta(minutes=25)
+                        ii = str(i[0]) + "-2"
+                        if ii in str(sort_flight_ids_arr):
+                            updateData(database, ii, i[0], receivetime, "短停送", flight_date_str, 1, nowDayStr)
+                        else:
+                            insertData(database,  ii, i[0], receivetime, "短停送", flight_date_str, 1, nowDayStr)
+                    elif i[5] != "":
+                        receivetime = datetime.datetime.strptime(i[5], "%Y-%m-%d %H:%M:%S")- datetime.timedelta(minutes=25)
+                        ii = str(i[0]) + "-2"
+                        if ii in str(sort_flight_ids_arr):
+                            updateData(database, ii, i[0], receivetime, "短停送", flight_date_str, 2, nowDayStr)
+                        else:
+                            insertData(database,  ii, i[0], receivetime, "短停送", flight_date_str, 2, nowDayStr)
+
+                elif i[3] == "TR" and "MAN" in str(i[0]):
+                        receivetime1 = datetime.datetime.strptime(i[8], "%Y-%m-%d %H:%M:%S")
+                        receivetime = datetime.datetime.strptime(i[5], "%Y-%m-%d %H:%M:%S") - datetime.timedelta(minutes=25)
+                        receivetime2 = datetime.datetime.strptime(i[5],"%Y-%m-%d %H:%M:%S")  #std
+                        if now < receivetime1:
+                            ii = str(i[0]) + "-2"
+                            if ii in str(sort_flight_ids_arr):
+                                updateData(database, ii, i[0], receivetime, "短停送", flight_date_str, 2, nowDayStr)
+                            else:
+                                insertData(database, ii, i[0], receivetime, "短停送", flight_date_str, 2, nowDayStr)
+                        elif receivetime1 < now < receivetime2:
+                            ii = str(i[0]) + "-2"
+                            if ii in str(sort_flight_ids_arr):
+                                updateData(database, ii, i[0], receivetime, "短停送", flight_date_str, 1, nowDayStr)
+                            else:
+                                insertData(database, ii, i[0], receivetime, "短停送", flight_date_str, 1, nowDayStr)
+                        else:
+                            ii=str(i[0])+ "-2"
+                            if ii in str(sort_flight_ids_arr):
+                                updateData(database, ii, i[0], receivetime2, "短停送", flight_date_str, 4, nowDayStr)
+                            else:
+                                insertData(database, ii, i[0], receivetime2, "短停送", flight_date_str, 4, nowDayStr)
+
+                elif i[3] == "TAF" and "MAN" not in str(i[0]):
+                    if i[7] != "":
+                        receivetime = datetime.datetime.strptime(i[5], "%Y-%m-%d %H:%M:%S")- datetime.timedelta(minutes=25)
+                        ii=str(i[0])+ "-2"
+                        if ii in str(sort_flight_ids_arr):
+                            updateData(database,ii,i[0],receivetime,"特后前送",flight_date_str,4,nowDayStr)
+                        else:
+                            insertData(database,ii,i[0],receivetime,"特后前送",flight_date_str,4,nowDayStr)
+                    elif i[7] == "" and i[6] !="" and i[5] !="":
+                        receivetime = datetime.datetime.strptime(i[5], "%Y-%m-%d %H:%M:%S")- datetime.timedelta(minutes=25)
+                        ii = str(i[0]) + "-2"
+                        if ii in str(sort_flight_ids_arr):
+                            updateData(database, ii, i[0], receivetime, "特后前送", flight_date_str, 1, nowDayStr)
+                        else:
+                            insertData(database,  ii, i[0], receivetime, "特后前送", flight_date_str, 1, nowDayStr)
+                    elif i[7] == "" and i[6] =="" and i[5] !="":
+                        receivetime = datetime.datetime.strptime(i[5], "%Y-%m-%d %H:%M:%S")- datetime.timedelta(minutes=25)
+                        ii = str(i[0]) + "-2"
+                        if ii in str(sort_flight_ids_arr):
+                            updateData(database, ii, i[0], receivetime, "特后前送", flight_date_str, 2, nowDayStr)
+                        else:
+                            insertData(database,  ii, i[0], receivetime, "特后前送", flight_date_str, 2, nowDayStr)
+                elif i[3] == "TAF" and "MAN" in str(i[0]):
+                    receivetime1 = datetime.datetime.strptime(i[8], "%Y-%m-%d %H:%M:%S")
+                    receivetime = datetime.datetime.strptime(i[5], "%Y-%m-%d %H:%M:%S") - datetime.timedelta(minutes=25)
+                    receivetime2 = datetime.datetime.strptime(i[5],"%Y-%m-%d %H:%M:%S")  #std
+                    if now < receivetime1:
+                        ii = str(i[0]) + "-2"
+                        if ii in str(sort_flight_ids_arr):
+                            updateData(database, ii, i[0], receivetime, "特后前送", flight_date_str, 2, nowDayStr)
+                        else:
+                            insertData(database, ii, i[0], receivetime, "特后前送", flight_date_str, 2, nowDayStr)
+                    elif receivetime1 < now < receivetime2:
+                        ii = str(i[0]) + "-2"
+                        if ii in str(sort_flight_ids_arr):
+                            updateData(database, ii, i[0], receivetime, "特后前送", flight_date_str, 1, nowDayStr)
+                        else:
+                            insertData(database, ii, i[0], receivetime, "特后前送", flight_date_str, 1, nowDayStr)
+                    else:
+                        ii = str(i[0]) + "-2"
+                        if ii in str(sort_flight_ids_arr):
+                            updateData(database, ii, i[0], receivetime2, "特后前送", flight_date_str, 4, nowDayStr)
+                        else:
+                            insertData(database, ii, i[0], receivetime2, "特后前送", flight_date_str, 4, nowDayStr)
+        database.FunctionCommit()
+    except Exception as e:
+        #print(e)
+        database.FunctionCommit()
+        app_logger.log_error(e)
+        app_logger.log_error("排序失败,可能缺失航班")
+
+    print(datetime.datetime.now(),'[数据库操作]结束排序')

+ 87 - 0
Functions/DButilsFunction/sortFlighttime2.py

@@ -0,0 +1,87 @@
+import datetime
+
+from unitls.LogerinTxt import app_logger
+from .flightDB import flightDB
+from .initFlightDatabase import initFlightDatabase
+
+
+def getSortFlightdata(fdb:flightDB, datatime:str,tablename:str):
+    try:
+        nowDayStr = datatime
+        sortData = fdb.sortTable('{}{}'.format(tablename,nowDayStr), '级别,保障时间','asc')
+        return sortData
+    except Exception as e:
+        app_logger.log_error(e)
+def sortFlighttime2(database:flightDB,wokload:flightDB):
+    try:
+        sortLabel = ["编号", "航班编号", "保障时间", "航班类型", "航班日期", "级别"]
+        nowDay = datetime.datetime.now().strftime("%Y%m%d")
+        nowDay_1 = (datetime.date.today() - datetime.timedelta(days=1)).strftime("%Y%m%d")
+        nowDay_2 = (datetime.date.today() + datetime.timedelta(days=1)).strftime("%Y%m%d")
+        now = datetime.datetime.now()
+        #now_20 = (datetime.datetime.now() + datetime.timedelta(minutes=200)).strftime("%Y%m%d")
+        now_20 = (datetime.datetime.now() + datetime.timedelta(hours=5)).strftime("%Y%m%d")
+        initFlightDatabase(database,  wokload, now_20)
+        initFlightDatabase(database,  wokload, nowDay_1)
+        initFlightDatabase(database,  wokload, nowDay_2)
+        initFlightDatabase(database,  wokload, nowDay)
+
+        if now_20 == nowDay:
+            day = [nowDay, nowDay_1]
+        else:
+            day = [nowDay, nowDay_1, nowDay_2]
+
+        for selectedtime in day:
+            sort2NOs_arr=[]
+            sort2NOs = database.getSingledata("编号","sortFlight2{}".format(selectedtime))
+            sortNOs = database.getSingledata("编号", "sortFlight{}".format(selectedtime))
+            if sort2NOs !=None and len(sort2NOs)!=0:
+                for i in sort2NOs:
+                    if str(i) in str(sortNOs):
+                        sort2NOs_arr.append(i[0])
+                    else:
+                        database.deleteSingledata("sortFlight2{}".format(selectedtime),"编号 = '%s'"%i[0])
+
+            sorttable = getSortFlightdata(database, selectedtime,"sortFlight")
+            for row in sorttable:
+                if row[3] == "短停接" or row[3] == "特后前接":
+                    if str(row[5]) == "4":
+                        find_id = row[1] + "-2"
+                        for row2 in sorttable:
+                            if row2[0] == find_id and row2[5] == "4":
+                                jb = row[5]
+                            elif row2[0] == find_id:
+                                jb = "1"
+                    else:
+                        jb = row[5]
+                    newdic = {}
+                    newdic2={}
+                    for col in range(0,6):
+                        if col == 0:
+                            newdic[sortLabel[col]]=row[col]
+                        elif col != 5:
+                            newdic[sortLabel[col]]=row[col]
+                            newdic2[sortLabel[col]]="'%s'"%row[col]
+                        else:
+                            newdic[sortLabel[5]]=jb
+                            newdic2[sortLabel[5]] = "'%s'"%jb
+                    if str(row[0]) not in str(sort2NOs_arr):
+                        database.lazyInsertData('sortFlight2{}'.format(selectedtime),newdic)
+                    else:
+                        database.lazyUpdateItem('sortFlight2{}'.format(selectedtime),newdic2,"编号 = '%s'"%row[0])
+                elif row[3] != "短停送" and row[3] != "特后前送":
+                    newdic = {}
+                    newdic2 = {}
+                    for col in range(0,6):
+                        if col == 0:
+                            newdic[sortLabel[col]]=row[col]
+                        else:
+                            newdic[sortLabel[col]]=row[col]
+                            newdic2[sortLabel[col]] = "'%s'"%row[col]
+                    if str(row[0]) not in str(sort2NOs_arr):
+                        database.lazyInsertData('sortFlight2{}'.format(selectedtime), newdic)
+                    else:
+                        database.lazyUpdateItem('sortFlight2{}'.format(selectedtime), newdic2, "编号 = '%s'" % row[0])
+        database.FunctionCommit()
+    except Exception as e:
+        app_logger.log_error(e)

+ 469 - 0
Functions/DButilsFunction/tableWidgetDispaly.py

@@ -0,0 +1,469 @@
+import concurrent.futures
+
+from unitls.LogerinTxt import app_logger
+from unitls.baseFunction import TuplefindInList
+from .flightDB import flightDB
+from .getSortFlightdata import getSortFlightdata
+from .waringMessageID import waringMessageID
+
+
+def tableWidgetDispaly(fdb:flightDB,selectedtime,date):#1,昨天。2今天3明天4其他
+    try:
+        #t1 = datetime.datetime.now()
+        tableWidgetDispalydata = {}
+        nowDayStr = selectedtime
+        sorttable = getSortFlightdata(fdb, selectedtime, "sortFlight")
+        #t2 = datetime.datetime.now()
+        #print(f'【航班刷新】【数据库1】:{t2 - t1}')
+        TaskFlightinfoAlldata = fdb.getAlldata('TaskFlightinfo{}'.format(nowDayStr))
+        #t3 = datetime.datetime.now()
+        #print(f'【航班刷新】【数据库2】:{t3 - t2}')
+        #flightInfoDataAll = fdb.getAlldata('flightinfo{}'.format(nowDayStr))
+        #t4 = datetime.datetime.now()
+        #print(f'【航班刷新】【数据库3】:{t4 - t3}')
+        flightStsDataAll = fdb.getAlldata('flightsts{}'.format(nowDayStr))
+        #t5 = datetime.datetime.now()
+        #print(f'【航班刷新】【数据库4】:{t5 - t4}')
+        peopleScheduleDataAll = fdb.getAlldata("peopleSchedule{}".format(nowDayStr))
+        #t6 = datetime.datetime.now()
+        #print(f'【航班刷新】【数据库5】:{t6 - t5}')
+        workjobDataAll = fdb.getAlldata('workjob')
+        #t7 = datetime.datetime.now()
+        #print(f'【航班刷新】【数据库6】:{t7 - t6}')
+        #print(f'【航班刷新】【数据库ALL】:{t7 - t1}')
+        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,flightInfoDataAll, flightStsDataAll,peopleScheduleDataAll,waringMessageIDs))
+            all_task.append(executor.submit(functionDisaplay, sorttable[i],i, TaskFlightinfoAlldata,workjobDataAll, flightStsDataAll,peopleScheduleDataAll,waringMessageIDs))
+
+        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):
+    #print("kaishi")
+    TaskFlightinfo = TuplefindInList(TaskFlightinfoAlldata,row[1])
+    #print(TaskFlightinfo)
+    # print(row)
+
+    e = ""
+    F = ""
+    g = ""
+
+    if TaskFlightinfo != None and TaskFlightinfo[16] != "":
+        e = "保留"
+    if TaskFlightinfo != None :
+        takinfo = TuplefindInList(workjobDataAll, TaskFlightinfo[21])
+        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 =""
+    if TaskFlightinfo != None and TaskFlightinfo[21] != "":
+        g = TaskFlightinfo[21]
+    #print("tttt:{}".format(g))
+    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]
+    # print(row[1])
+    # print(fdb.queryTabel('flightinfo{}'.format(nowDayStr), '*', "航班编号='{}'".format(row[1])))
+    #flightinfodata = TuplefindInList(flightInfoDataAll,row[1])
+    #flightinfodata = fdb.queryTabel('flightinfo{}'.format(nowDayStr), '*', "航班编号='{}'".format(row[1]))[0]
+    flightstsdata = TuplefindInList(flightStsDataAll, row[1]) if TuplefindInList(flightStsDataAll, row[1]) != None else ["", "","", "", "", "","", "", "", "","", "", "", ""]
+    # flightstsdata = fdb.queryTabel('flightsts{}'.format(nowDayStr), '*', "航班编号='{}'".format(row[1]))[0] if \
+    #     len(fdb.queryTabel('flightsts{}'.format(nowDayStr), '*', "航班编号='{}'".format(row[1]))) != 0 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>天府","")
+    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 = ''
+    d = TaskFlightinfo[15] if "随机" in str(TaskFlightinfo[15]) else ""
+
+    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[1]
+        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[1]
+        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[1]
+        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 ="--"
+    if TaskFlightinfo[3] == "AF":
+        item_dic = {"0": rowNum,
+                    "1": TaskFlightinfo[1],
+                    "2": TaskFlightinfo[26],
+                    "3": TaskFlightinfo[25],
+                    "4": TaskFlightinfo[21],
+                    "5": a,
+                    "6": b,
+                    "7": "--",
+                    "8": JWA,
+                    "9": row[3],
+                    "10": fx,
+                    "11": qw1,
+                    "12": qw2,
+                    "13": g1,
+                    "14": g2,
+                    "15": g3,
+                    "16": jjdw,
+                    "17": "--",
+                    "18": "--",
+                    "19": d,
+                    "20": "--",
+                    "21": e,
+                    "22": F,
+                    "23": postion,
+                    "24": wx_people,  # flightinfodata[22],
+                    "25": fx_people,  # flightinfodata[23],
+                    "26": row[1],
+                    "27": g,
+                    "28": ta_td,
+                    "29": type31,
+                    "30": 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 = {"0": rowNum,
+                    "1": TaskFlightinfo[1],
+                    "2": TaskFlightinfo[26],
+                    "3": TaskFlightinfo[25],
+                    "4": "--",
+                    "5": a,
+                    "6": "--",
+                    "7": "--",
+                    "8": TaskFlightinfo[10],
+                    "9": row[3],
+                    "10": fx,
+                    "11": qw1,
+                    "12": qw2,
+                    "13": g1,
+                    "14": g2,
+                    "15": g3,
+                    "16": "--",
+                    "17": "--",
+                    "18": "--",
+                    "19": "--",
+                    "20": "--",
+                    "21": "--",
+                    "22": "--",
+                    "23": "--",
+                    "24": "--",  # flightinfodata[22],
+                    "25": "--",  # flightinfodata[23],
+                    "26": row[1],
+                    "27": "TSK",
+                    "28": "--",
+                    "29": "--",
+                    "30": 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 = {"0": rowNum,
+                    "1": TaskFlightinfo[1],
+                    "2": TaskFlightinfo[26],
+                    "3": TaskFlightinfo[25],
+                    "4": TaskFlightinfo[21],
+                    "5": "",
+                    "6": "",
+                    "7": c,
+                    "8": JWB,
+                    "9": row[3],
+                    "10": fx,
+                    "11": qw1,
+                    "12": qw2,
+                    "13": g1,
+                    "14": g2,
+                    "15": g3,
+                    "16": jjdw,
+                    "17": FX,
+                    "18": XJ,
+                    "19": d,
+                    "20": SJDW,
+                    "21": e,
+                    "22": F,
+                    "23": postion,
+                    "24": wx_people,  # flightinfodata[22],
+                    "25": fx_people,  # flightinfodata[23],
+                    "26": row[1],
+                    "27": g,
+                    "28": ta_td,
+                    "29": type31,
+                    "30": 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 = {"0": rowNum,
+                    "1": TaskFlightinfo[1],
+                    "2": TaskFlightinfo[26],
+                    "3": TaskFlightinfo[25],
+                    "4": TaskFlightinfo[21],
+                    "5": a,
+                    "6": b,
+                    "7": c,
+                    "8": JWA,
+                    "9": row[3],
+                    "10": fx,
+                    "11": qw1,
+                    "12": qw2,
+                    "13": g1,
+                    "14": g2,
+                    "15": g3,
+                    "16": jjdw,
+                    "17": FX,
+                    "18": "--",
+                    "19": d,
+                    "20": SJDW,
+                    "21": e,
+                    "22": F,
+                    "23": postion,
+                    "24": wx_people,  # flightinfodata[22],
+                    "25": fx_people,  # flightinfodata[23],
+                    "26": row[1],
+                    "27": g,
+                    "28": ta_td,
+                    "29": type31,
+                    "30": 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 = {"0": rowNum,
+                    "1": TaskFlightinfo[1],
+                    "2": TaskFlightinfo[26],
+                    "3": TaskFlightinfo[25],
+                    "4": TaskFlightinfo[21],
+                    "5": a,
+                    "6": b,
+                    "7": c,
+                    "8": JWA,
+                    "9": row[3],
+                    "10": fx,
+                    "11": qw1,
+                    "12": qw2,
+                    "13": g1,
+                    "14": g2,
+                    "15": g3,
+                    "16": ESDW,
+                    "17": FX,
+                    "18": "--",
+                    "19": d,
+                    "20": SJDW,
+                    "21": e,
+                    "22": F,
+                    "23": postion,
+                    "24": ecsj_people,  # flightinfodata[22],
+                    "25": fx_people,  # flightinfodata[23],
+                    "26": row[1],
+                    "27": g,
+                    "28": ta_td,
+                    "29": type31,
+                    "30": 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 = {"0": rowNum,
+                    "1": TaskFlightinfo[1],
+                    "2": TaskFlightinfo[26],
+                    "3": TaskFlightinfo[25],
+                    "4": TaskFlightinfo[21],
+                    "5": a,
+                    "6": b,
+                    "7": c,
+                    "8": JWA,
+                    "9": row[3],
+                    "10": fx,
+                    "11": qw1,
+                    "12": qw2,
+                    "13": g1,
+                    "14": g2,
+                    "15": g3,
+                    "16": jjdw,
+                    "17": FX,
+                    "18": "--",
+                    "19": d,
+                    "20": SJDW,
+                    "21": e,
+                    "22": F,
+                    "23": postion,
+                    "24": wx_people,  # flightinfodata[22],
+                    "25": fx_people,  # flightinfodata[23],
+                    "26": row[1],
+                    "27": g,
+                    "28": ta_td,
+                    "29": type31,
+                    "30": 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编号
+                    }
+    #tableWidgetDispalydata[rowNum] = item_dic
+    #rowNum += 1
+    # print(rowNum)
+    # print(item_dic)
+    # print({rowNum:item_dic})
+    return {rowNum:item_dic}

+ 393 - 0
Functions/DButilsFunction/tableWidgetDispaly2.py

@@ -0,0 +1,393 @@
+import concurrent.futures
+
+from unitls.LogerinTxt import app_logger
+from unitls.StaticDataclass import get_dic
+from unitls.baseFunction import TuplefindInList
+from .flightDB import flightDB
+from .getSortFlightdata import getSortFlightdata
+from .waringMessageID import waringMessageID
+
+
+def tableWidgetDispaly2(fdb:flightDB,selectedtime,date):#1,昨天。2今天3明天4其他
+    try:
+        tableWidgetDispalydata = {}
+        sorttable = getSortFlightdata(fdb,selectedtime,"sortFlight2")
+        nowDayStr = selectedtime
+        TaskFlightinfoAll = fdb.getAlldata('TaskFlightinfo{}'.format(nowDayStr))
+        flightstsdataAll = fdb.getAlldata('flightsts{}'.format(nowDayStr))
+        waringMessageIDs = waringMessageID(fdb)
+        peopleScheduleAll = fdb.getAlldata("peopleSchedule{}".format(nowDayStr))
+        executor = concurrent.futures.ThreadPoolExecutor()
+        all_task = []
+        taskType=get_dic('taskType')
+        for i in range(len(sorttable)):
+            all_task.append(executor.submit(functionDisplay2, sorttable[i], i, TaskFlightinfoAll, flightstsdataAll, waringMessageIDs,peopleScheduleAll,taskType))
+
+        for future in concurrent.futures.as_completed(all_task):
+            data = future.result()
+
+            tableWidgetDispalydata.update(data)
+        newdic = {"B": '"{}"'.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'")
+        return tableWidgetDispalydata
+    except Exception as e:
+        app_logger.log_error(e)
+
+
+def functionDisplay2(row, rowNum, TaskFlightinfoAll,flightstsdataAll,waringMessageIDs,peopleScheduleAll,taskType):
+
+    TaskFlightinfo = TuplefindInList(TaskFlightinfoAll,row[1])
+
+    #TaskFlightinfo = fdb.queryTabel('TaskFlightinfo{}'.format(nowDayStr), '*', "航班编号='{}'".format(row[1]))
+    e = ""
+    F = ""
+    g = ""
+
+    if TaskFlightinfo != None:
+        JWA = TaskFlightinfo[10]
+        JWB = TaskFlightinfo[11]
+        if JWB!="" and JWA =="":
+            JWA=JWB
+        if JWA!="" and JWB =="":
+            JWB=JWA
+        if TaskFlightinfo[16] != "":
+            e = "保留"
+        if TaskFlightinfo[18] != "":
+            F = "工作包"
+        if TaskFlightinfo[21] != "":
+            g = TaskFlightinfo[21]
+    else:
+        JWA =  ""
+        JWB =  ""
+    wx_people = ""
+    fx_people = ""
+    ecsj_people = ""
+    ta_td = ""
+    type31 = ""
+    # print(TaskFlightinfo)
+    if TaskFlightinfo != None:
+        wx_people = TaskFlightinfo[12]
+        fx_people = TaskFlightinfo[13]
+        ecsj_people = TaskFlightinfo[19]
+        ta_td = TaskFlightinfo[9]
+        type31 = TaskFlightinfo[3]
+
+    #flightinfodata = fdb.queryTabel('flightinfo{}'.format(nowDayStr), '*', "航班编号='{}'".format(row[1]))[0]
+    # print(flightinfodataAll)
+    # print(row[0])
+    #flightinfodata = TuplefindInList(flightinfodataAll, row[1])
+    # print(flightinfodata)
+    # flightstsdata = fdb.queryTabel('flightsts{}'.format(nowDayStr), '*', "航班编号='{}'".format(row[1]))[0] if \
+    #     len(fdb.queryTabel('flightsts{}'.format(nowDayStr), '*', "航班编号='{}'".format(row[1]))) != 0 else ["", "",
+    #                                                                                                      "", "", "", "",
+    #                                                                                                      "", "", "", "",
+    #                                                                                                      "", "", "", ""]
+    flightstsdata = TuplefindInList(flightstsdataAll,row[0])if TuplefindInList(flightstsdataAll,row[0])!=None else ["", "","", "", "", "","", "", "", "","", "", "", ""]
+    jjdw = "√" if flightstsdata[3] != "" else ""
+    FX = "√" if flightstsdata[4] != "" else ""
+    XJ = "√" if flightstsdata[5] != "" else ""
+    ESDW = "√" if flightstsdata[7] != "" else ""
+    SJDW = "√" if flightstsdata[6] != "" 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>天府","")
+    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 = ''
+    d = TaskFlightinfo[15] if "随机" in str(TaskFlightinfo[15]) else ""
+
+    QColorList = ['black', 'white', '#F3ECD9', '#BAD1D1', '#DDE2E3', '#647277', 'red', 'blue']
+    # waringMessageIDs = waringMessageID(fdb)
+    if str(row[1]) in str(waringMessageIDs["全部警告"]):
+        color_code = QColorList[6]
+        color_code1 = QColorList[1]
+        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] + "-B"
+    #peopleSchedule = fdb.queryTabel("peopleSchedule{}".format(nowDayStr), "*", "编号='%s'" % findid)
+    peopleSchedule = TuplefindInList(peopleScheduleAll, findid)
+    if peopleSchedule != None:
+        fx = peopleSchedule[3]
+        qw1 = peopleSchedule[4]
+        qw2 = peopleSchedule[5]
+        g1 = peopleSchedule[6]
+        g2 = peopleSchedule[7]
+        g3 = peopleSchedule[8]
+        fj = peopleSchedule[9]
+    else:
+        fx = ""
+        qw1 = ""
+        qw2 = ""
+        g1 = ""
+        g2 = ""
+        g3 = ""
+        fj = ""
+
+    if TaskFlightinfo[3] == "AF":
+        item_dic = {"0": rowNum,
+                    "1": TaskFlightinfo[1],
+                    "2": TaskFlightinfo[26],
+                    "3": TaskFlightinfo[25],
+                    "4": TaskFlightinfo[21],
+                    "5": a,
+                    "6": b,
+                    "7": "--",
+                    "8": JWA,
+                    "9": taskType[TaskFlightinfo[3]],
+                    "10": fx,
+                    "11": qw1,
+                    "12": qw2,
+                    "13": g1,
+                    "14": g2,
+                    "15": g3,
+                    "16": jjdw,
+                    "17": "--",
+                    "18": "--",
+                    "19": "--",
+                    "20": d,
+                    "21": "--",
+                    "22": e,
+                    "23": F,
+                    "24": postion,
+                    "25": wx_people,  # flightinfodata[22],
+                    "26": "",
+                    "27": fx_people,  # flightinfodata[23],
+                    "28": row[1],
+                    "29": g,
+                    "30": ta_td,
+                    "31": type31,
+                    "32": fj,
+                    "99": color_code,
+                    "101": color_code1,
+                    "102": color_code2,
+                    "103": color_code3,
+                    "109": row[5]
+                    }
+        # tableWidgetDispalydata[rowNum] = item_dic
+        # rowNum += 1
+        return {rowNum: item_dic}
+    elif TaskFlightinfo[3] == "停场":
+        item_dic = {"0": rowNum,
+                    "1": TaskFlightinfo[1],
+                    "2": TaskFlightinfo[26],
+                    "3": TaskFlightinfo[25],
+                    "4": "--",
+                    "5": a,
+                    "6": "--",
+                    "7": "--",
+                    "8": JWA,
+                    "9": taskType[TaskFlightinfo[3]],
+                    "10": fx,
+                    "11": qw1,
+                    "12": qw2,
+                    "13": g1,
+                    "14": g2,
+                    "15": g3,
+                    "16": "--",
+                    "17": "--",
+                    "18": "--",
+                    "19": "--",
+                    "20": "--",
+                    "21": "--",
+                    "22": "--",
+                    "23": "--",
+                    "24": "--",  # flightinfodata[22],
+                    "25": "--",  # flightinfodata[23],
+                    "26": "--",
+                    "27": "--",
+                    "28": row[1],
+                    "29": "TSK",
+                    "30": "--",
+                    "31": "--",
+                    "32": fj,
+                    "99": color_code,
+                    "101": color_code1,
+                    "102": color_code2,
+                    "103": color_code3,
+                    "109": row[5]
+
+                    }
+        # tableWidgetDispalydata[rowNum] = item_dic
+        # rowNum += 1
+        return {rowNum: item_dic}
+    elif TaskFlightinfo[3] == "AP":
+        item_dic = {"0": rowNum,
+                    "1": TaskFlightinfo[1],
+                    "2": TaskFlightinfo[26],
+                    "3": TaskFlightinfo[25],
+                    "4": TaskFlightinfo[21],
+                    "5": "",
+                    "6": "",
+                    "7": c,
+                    "8": JWB,
+                    "9": taskType[TaskFlightinfo[3]],
+                    "10": fx,
+                    "11": qw1,
+                    "12": qw2,
+                    "13": g1,
+                    "14": g2,
+                    "15": g3,
+                    "16": jjdw,
+                    "18": FX,
+                    "19": XJ,
+                    "17": "--",
+                    "20": d,
+                    "21": SJDW,
+                    "22": e,
+                    "23": F,
+                    "24": postion,
+                    "25": wx_people,  # flightinfodata[22],
+                    "26": "",
+                    "27": fx_people,  # flightinfodata[23],
+                    "28": row[1],
+                    "29": g,
+                    "30": ta_td,
+                    "31": type31,
+                    "32": fj,
+                    "99": color_code,
+                    "101": color_code1,
+                    "102": color_code2,
+                    "103": color_code3,
+                    "109": row[5]
+                    }
+        # tableWidgetDispalydata[rowNum] = item_dic
+        # rowNum += 1
+        return {rowNum: item_dic}
+    elif row[3] == "短停接":
+        item_dic = {"0": rowNum,
+                    "1": TaskFlightinfo[1],
+                    "2": TaskFlightinfo[26],
+                    "3": TaskFlightinfo[25],
+                    "4": TaskFlightinfo[21],
+                    "5": a,
+                    "6": b,
+                    "7": c,
+                    "8": JWA,
+                    "9": taskType[TaskFlightinfo[3]],
+                    "10": fx,
+                    "11": qw1,
+                    "12": qw2,
+                    "13": g1,
+                    "14": g2,
+                    "15": g3,
+                    "16": jjdw,
+                    "18": FX,
+                    "19": "--",
+                    "17": ESDW,
+                    "20": d,
+                    "21": SJDW,
+                    "22": e,
+                    "23": F,
+                    "24": postion,
+                    "25": wx_people,  # flightinfodata[22],
+                    "26": ecsj_people,
+                    "27": fx_people,  # flightinfodata[23],
+                    "28": row[1],
+                    "29": g,
+                    "30": ta_td,
+                    "31": type31,
+                    "32": fj,
+                    "99": color_code,
+                    "101": color_code1,
+                    "102": color_code2,
+                    "103": color_code3,
+                    "109": row[5]
+                    }
+        # tableWidgetDispalydata[rowNum] = item_dic
+        # rowNum += 1
+        return {rowNum: item_dic}
+    elif row[3] == "特后前接":
+        item_dic = {"0": rowNum,
+                    "1": TaskFlightinfo[1],
+                    "2": TaskFlightinfo[26],
+                    "3": TaskFlightinfo[25],
+                    "4": TaskFlightinfo[21],
+                    "5": a,
+                    "6": b,
+                    "7": c,
+                    "8": JWA,
+                    "9": taskType[TaskFlightinfo[3]],
+                    "10": fx,
+                    "11": qw1,
+                    "12": qw2,
+                    "13": g1,
+                    "14": g2,
+                    "15": g3,
+                    "16": jjdw,
+                    "18": FX,
+                    "19": "--",
+                    "17": "--",
+                    "20": d,
+                    "21": SJDW,
+                    "22": e,
+                    "23": F,
+                    "24": postion,
+                    "25": wx_people,  # flightinfodata[22],
+                    "26": "",
+                    "27": fx_people,  # flightinfodata[23],
+                    "28": row[1],
+                    "29": g,
+                    "30": ta_td,
+                    "31": type31,
+                    "32": fj,
+                    "99": color_code,
+                    "101": color_code1,
+                    "102": color_code2,
+                    "103": color_code3,
+                    "109": row[5]
+                    }
+        #tableWidgetDispalydata[rowNum] = item_dic
+        #rowNum += 1
+        return {rowNum:item_dic}
+
+

+ 380 - 0
Functions/DButilsFunction/tableWidgetDispaly2_66.py

@@ -0,0 +1,380 @@
+import concurrent.futures
+
+from unitls.LogerinTxt import app_logger
+from unitls.StaticDataclass import get_dic
+from unitls.baseFunction import TuplefindInList , TuplefindInList3
+from .flightDB import flightDB
+from .getSortFlightdata import getSortFlightdata
+from .waringMessageID import waringMessageID
+
+
+def tableWidgetDispaly2(fdb:flightDB,selectedtime,date):#1,昨天。2今天3明天4其他
+    try:
+        tableWidgetDispalydata = {}
+        sorttable = getSortFlightdata(fdb,selectedtime,"sortFlight2")
+        nowDayStr = selectedtime
+        TaskFlightinfoAll = fdb.getAlldata('TaskFlightinfo{}'.format(nowDayStr))
+        waringMessageIDs = waringMessageID(fdb)
+        peopleScheduleAll = fdb.getAlldata("peopleSchedule{}".format(nowDayStr))
+        tasklistall = fdb.getAlldata('TaskList{}'.format(nowDayStr))
+        executor = concurrent.futures.ThreadPoolExecutor()
+        all_task = []
+        taskType=get_dic('taskType')
+        for i in range(len(sorttable)):
+            all_task.append(executor.submit(functionDisplay2, sorttable[i], i, TaskFlightinfoAll, waringMessageIDs,peopleScheduleAll,taskType,tasklistall))
+
+        for future in concurrent.futures.as_completed(all_task):
+            data = future.result()
+
+            tableWidgetDispalydata.update(data)
+        newdic = {"B": '"{}"'.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'")
+        return tableWidgetDispalydata
+    except Exception as e:
+        app_logger.log_error(e)
+
+
+def functionDisplay2(row, rowNum, TaskFlightinfoAll,waringMessageIDs,peopleScheduleAll,taskType,TaskListAll):
+
+    TaskFlightinfo = TuplefindInList(TaskFlightinfoAll,row[1])
+    jjdq="--"
+    hbdq="--"
+    esdq="--"
+    tasksts=""
+    if '3U' in TaskFlightinfo[21] or 'CSC' in TaskFlightinfo[21]:
+        tasksts = TuplefindInList3(TaskListAll, TaskFlightinfo[0], 0, 8)
+        if TaskFlightinfo[3] == "AP":
+            hbdq = "√" if 'P-PRE-FLIGHT' in str(tasksts)  else ""
+            esdq = "√" if  'DEPARTURE-SERVICE' in str(tasksts) else ""
+        elif TaskFlightinfo[3] == "TR" :
+            jjdq = "√" if 'ARRIVAL-SERVICE' in str(tasksts) else ""
+            hbdq = "√" if 'P-TRANSIT' in str(tasksts) else ""
+            esdq = "√" if 'DEPARTURE-SERVICE' in str(tasksts) else ""
+        elif TaskFlightinfo[3] == "AF":
+            jjdq = "√" if 'ARRIVAL-SERVICE' in str(tasksts) else ""
+            hbdq = "√" if 'P-POST-FLIGHT' in str(tasksts) else ""
+
+
+    if TaskFlightinfo != None:
+        JWA = TaskFlightinfo[10]
+        JWB = TaskFlightinfo[11]
+        if JWB!="" and JWA =="":
+            JWA=JWB
+        if JWA!="" and JWB =="":
+            JWB=JWA
+    else:
+        JWA =  ""
+        JWB =  ""
+    wx_people = ""
+    fx_people = ""
+    ecsj_people = ""
+    type31 = ""
+    # print(TaskFlightinfo)
+    if TaskFlightinfo != None:
+        wx_people = TaskFlightinfo[12]
+        fx_people = TaskFlightinfo[13]
+        ecsj_people = TaskFlightinfo[19]
+        type31 = TaskFlightinfo[3]
+
+    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>天府","")
+    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(fdb)
+    if str(row[1]) in str(waringMessageIDs["全部警告"]):
+        color_code = QColorList[6]
+        color_code1 = QColorList[0]
+        color_code2 = QColorList[1]
+        color_code3 = QColorList[0]
+    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] + "-B"
+    #peopleSchedule = fdb.queryTabel("peopleSchedule{}".format(nowDayStr), "*", "编号='%s'" % findid)
+    peopleSchedule = TuplefindInList(peopleScheduleAll, findid)
+    if peopleSchedule != None:
+        fx = peopleSchedule[3]
+        qw1 = peopleSchedule[4]
+        qw2 = peopleSchedule[5]
+        g1 = peopleSchedule[6]
+        g2 = peopleSchedule[7]
+        g3 = peopleSchedule[8]
+        fj = peopleSchedule[9]
+    else:
+        fx = ""
+        qw1 = ""
+        qw2 = ""
+        g1 = ""
+        g2 = ""
+        g3 = ""
+        fj = ""
+
+    if TaskFlightinfo[3] == "AF":
+        item_dic = {"0": rowNum,
+                    "1": TaskFlightinfo[1],
+                    "2": TaskFlightinfo[26],
+                    "3": TaskFlightinfo[25],
+                    "4": TaskFlightinfo[21],
+                    "5": a,
+                    "6": b,
+                    "7": "--",
+                    "8": JWA,
+                    "9": taskType[TaskFlightinfo[3]],
+                    "10": fx,
+                    "11": qw1,
+                    "12": qw2,
+                    "13": g1,
+                    "14": g2,
+                    "15": g3,
+                    "19": "",
+                    "16": jjdq,
+                    "18": esdq,
+                    "17": hbdq,
+                    "20": "",
+                    "21": "",
+                    "22": "",
+                    "23": "",
+                    "24": postion,
+                    "25": wx_people,  # flightinfodata[22],
+                    "26": "",
+                    "27": fx_people,  # flightinfodata[23],
+                    "28": row[1],
+                    "29": tasksts,
+                    "30": "",
+                    "31": type31,
+                    "32": fj,
+                    "99": color_code,
+                    "101": color_code1,
+                    "102": color_code2,
+                    "103": color_code3,
+                    "109": row[5]
+                    }
+        # tableWidgetDispalydata[rowNum] = item_dic
+        # rowNum += 1
+        return {rowNum: item_dic}
+    elif TaskFlightinfo[3] == "停场":
+        item_dic = {"0": rowNum,
+                    "1": TaskFlightinfo[1],
+                    "2": TaskFlightinfo[26],
+                    "3": TaskFlightinfo[25],
+                    "4": "--",
+                    "5": a,
+                    "6": "--",
+                    "7": "--",
+                    "8": JWA,
+                    "9": taskType[TaskFlightinfo[3]],
+                    "10": fx,
+                    "11": qw1,
+                    "12": qw2,
+                    "13": g1,
+                    "14": g2,
+                    "15": g3,
+                    "16": "--",
+                    "17": "--",
+                    "18": "--",
+                    "19": "--",
+                    "20": "--",
+                    "21": "--",
+                    "22": "--",
+                    "23": "--",
+                    "24": "--",  # flightinfodata[22],
+                    "25": "--",  # flightinfodata[23],
+                    "26": "--",
+                    "27": "--",
+                    "28": row[1],
+                    "29": tasksts,
+                    "30": "--",
+                    "31": "--",
+                    "32": fj,
+                    "99": color_code,
+                    "101": color_code1,
+                    "102": color_code2,
+                    "103": color_code3,
+                    "109": row[5]
+
+                    }
+        # tableWidgetDispalydata[rowNum] = item_dic
+        # rowNum += 1
+        return {rowNum: item_dic}
+    elif TaskFlightinfo[3] == "AP":
+        item_dic = {"0": rowNum,
+                    "1": TaskFlightinfo[1],
+                    "2": TaskFlightinfo[26],
+                    "3": TaskFlightinfo[25],
+                    "4": TaskFlightinfo[21],
+                    "5": "",
+                    "6": "",
+                    "7": c,
+                    "8": JWB,
+                    "9": taskType[TaskFlightinfo[3]],
+                    "10": fx,
+                    "11": qw1,
+                    "12": qw2,
+                    "13": g1,
+                    "14": g2,
+                    "15": g3,
+                    "19": "",
+                    "16": jjdq,
+                    "18": esdq,
+                    "17": hbdq,
+                    "20": "",
+                    "21": "",
+                    "22": "",
+                    "23": "",
+                    "24": postion,
+                    "25": wx_people,  # flightinfodata[22],
+                    "26": "",
+                    "27": fx_people,  # flightinfodata[23],
+                    "28": row[1],
+                    "29": tasksts,
+                    "30": "",
+                    "31": type31,
+                    "32": fj,
+                    "99": color_code,
+                    "101": color_code1,
+                    "102": color_code2,
+                    "103": color_code3,
+                    "109": row[5]
+                    }
+        # tableWidgetDispalydata[rowNum] = item_dic
+        # rowNum += 1
+        return {rowNum: item_dic}
+    elif row[3] == "短停接":
+        item_dic = {"0": rowNum,
+                    "1": TaskFlightinfo[1],
+                    "2": TaskFlightinfo[26],
+                    "3": TaskFlightinfo[25],
+                    "4": TaskFlightinfo[21],
+                    "5": a,
+                    "6": b,
+                    "7": c,
+                    "8": JWA,
+                    "9": taskType[TaskFlightinfo[3]],
+                    "10": fx,
+                    "11": qw1,
+                    "12": qw2,
+                    "13": g1,
+                    "14": g2,
+                    "15": g3,
+                    "19": "",
+                    "16": jjdq,
+                    "18": esdq,
+                    "17": hbdq,
+                    "20": "",
+                    "21": "",
+                    "22": "",
+                    "23": "",
+                    "24": postion,
+                    "25": wx_people,  # flightinfodata[22],
+                    "26": ecsj_people,
+                    "27": fx_people,  # flightinfodata[23],
+                    "28": row[1],
+                    "29": tasksts,
+                    "30": "",
+                    "31": type31,
+                    "32": fj,
+                    "99": color_code,
+                    "101": color_code1,
+                    "102": color_code2,
+                    "103": color_code3,
+                    "109": row[5]
+                    }
+        # tableWidgetDispalydata[rowNum] = item_dic
+        # rowNum += 1
+        return {rowNum: item_dic}
+    elif row[3] == "特后前接":
+        item_dic = {"0": rowNum,
+                    "1": TaskFlightinfo[1],
+                    "2": TaskFlightinfo[26],
+                    "3": TaskFlightinfo[25],
+                    "4": TaskFlightinfo[21],
+                    "5": a,
+                    "6": b,
+                    "7": c,
+                    "8": JWA,
+                    "9": taskType[TaskFlightinfo[3]],
+                    "10": fx,
+                    "11": qw1,
+                    "12": qw2,
+                    "13": g1,
+                    "14": g2,
+                    "15": g3,
+                    "19": "",
+                    "16": jjdq,
+                    "18": esdq,
+                    "17": hbdq,
+                    "20": "",
+                    "21": "",
+                    "22": "",
+                    "23": "",
+                    "24": postion,
+                    "25": wx_people,  # flightinfodata[22],
+                    "26": "",
+                    "27": fx_people,  # flightinfodata[23],
+                    "28": row[1],
+                    "29": tasksts,
+                    "30": "",
+                    "31": type31,
+                    "32": fj,
+                    "99": color_code,
+                    "101": color_code1,
+                    "102": color_code2,
+                    "103": color_code3,
+                    "109": row[5]
+                    }
+        #tableWidgetDispalydata[rowNum] = item_dic
+        #rowNum += 1
+        return {rowNum:item_dic}
+
+

+ 18 - 0
Functions/DButilsFunction/tableWidgetDispalyRead.py

@@ -0,0 +1,18 @@
+from .flightDB import flightDB
+
+
+def tableWidgetDispalyRead(fdb:flightDB,date):
+    if date == "1":
+        tableWidgetDispalydata1 = fdb.queryTabel("display", "A", "ID = '1'")[0][0] if len(
+            fdb.queryTabel("display", "A", "ID = '1'")) != 0 else {}
+    if date == "2":
+        tableWidgetDispalydata1 = fdb.queryTabel("display", "A", "ID = '2'")[0][0] if len(
+            fdb.queryTabel("display", "A", "ID = '2'")) != 0 else {}
+    if date == "3":
+        tableWidgetDispalydata1 = fdb.queryTabel("display", "A", "ID = '3'")[0][0] if len(
+            fdb.queryTabel("display", "A", "ID = '3'")) != 0 else {}
+    if "\'" in tableWidgetDispalydata1:
+        tableWidgetDispalydata1 = tableWidgetDispalydata1.replace("\'", '"')
+        tableWidgetDispalydata1 = tableWidgetDispalydata1.replace("'", '"')
+        tableWidgetDispalydata1 = eval(tableWidgetDispalydata1)
+    return tableWidgetDispalydata1

+ 18 - 0
Functions/DButilsFunction/tableWidgetDispalyRead2.py

@@ -0,0 +1,18 @@
+from .flightDB import flightDB
+
+
+def tableWidgetDispalyRead2(fdb:flightDB,date):
+    if date == "1":
+        tableWidgetDispalydata1 = fdb.queryTabel("display", "B", "ID = '1'")[0][0] if len(
+            fdb.queryTabel("display", "B", "ID = '1'")) != 0 else {}
+    if date == "2":
+        tableWidgetDispalydata1 = fdb.queryTabel("display", "B", "ID = '2'")[0][0] if len(
+            fdb.queryTabel("display", "B", "ID = '2'")) != 0 else {}
+    if date == "3":
+        tableWidgetDispalydata1 = fdb.queryTabel("display", "B", "ID = '3'")[0][0] if len(
+            fdb.queryTabel("display", "B", "ID = '3'")) != 0 else {}
+    if "\'" in tableWidgetDispalydata1:
+        tableWidgetDispalydata1 = tableWidgetDispalydata1.replace("\'", '"')
+        tableWidgetDispalydata1 = tableWidgetDispalydata1.replace("'", '"')
+        tableWidgetDispalydata1 = eval(tableWidgetDispalydata1)
+    return tableWidgetDispalydata1

+ 555 - 0
Functions/DButilsFunction/tableWidgetDispaly_66.py

@@ -0,0 +1,555 @@
+import concurrent.futures
+
+from unitls.LogerinTxt import app_logger
+from unitls.baseFunction import TuplefindInList , TuplefindInList11 , TuplefindInList3
+from .flightDB import flightDB
+from .getSortFlightdata import getSortFlightdata
+from .waringMessageID import waringMessageID
+
+
+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')
+        flightplan= fdb.getAlldata("flightplaninfo{}".format(nowDayStr))
+        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,flightplan))
+
+        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,flightplan):
+    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]
+        bayofflightplan_A = "飞机排班系统机位:" + TuplefindInList3(flightplan, TaskFlightinfo[39].replace("PBCZ", ""), 0, 7)
+        bayofflightplan_B = "飞机排班系统机位:" + TuplefindInList3(flightplan, TaskFlightinfo[40].replace("PBCZ", ""), 0, 8)
+        bayofflightplan_C = "飞机排班系统机位:N/A"
+        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,
+                    "88": bayofflightplan_A,
+                    "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,
+                    "88": bayofflightplan_C,
+                    "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,
+                    "88": bayofflightplan_B,
+                    "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,
+                    "88": bayofflightplan_A,
+                    "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,
+                    "88": bayofflightplan_B,
+                    "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,
+                    "88": bayofflightplan_A,
+                    "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}

+ 33 - 0
Functions/DButilsFunction/tableWidgetDisplayChange.py

@@ -0,0 +1,33 @@
+import datetime
+
+from unitls.LogerinTxt import app_logger
+from .flightDB import flightDB
+
+
+def tableWidgetDisplayChange(fdb:flightDB,selectedtime):
+    try:
+        log=fdb.queryTabel('logs',"*","警告信息 !='' and 处理时间 =''")
+        tableWidgetDisplayChangedata={}
+        now = datetime.datetime.now()
+        rowNum=0
+        if len(log) != 0:
+            for i in log:
+                timedeadline=""
+                if i[8] =="人工待办" and i[4] !=""  and i[7] =="":
+                    timedeadline = datetime.datetime.strptime(i[4], "%Y-%m-%d %H:%M")
+                    #print(timedeadline)
+                    if timedeadline <= now:
+                        tableWidgetDisplayChangedata[rowNum]=i
+                        rowNum +=1
+                elif  i[8] =="准备组任务" and i[4] !=""  and i[7] =="":
+                    timedeadline = datetime.datetime.strptime(i[4], "%Y-%m-%d %H:%M:%S")
+                    #print(timedeadline)
+                    if timedeadline <= now:
+                        tableWidgetDisplayChangedata[rowNum]=i
+                        rowNum +=1
+                elif i[8] !="人工待办" and i[8] !="人工待办":
+                    tableWidgetDisplayChangedata[rowNum] = i
+                    rowNum += 1
+        return tableWidgetDisplayChangedata
+    except Exception as e:
+        app_logger.log_error(e)

+ 20 - 0
Functions/DButilsFunction/tableWidgetLOGDispaly.py

@@ -0,0 +1,20 @@
+import datetime
+
+from unitls.LogerinTxt import app_logger
+from .flightDB import flightDB
+
+
+def tableWidgetLOGDispaly(fdb:flightDB,selectedtime):
+    try:
+        selectdaystr = str(selectedtime)[0:4] + "-" + str(selectedtime)[4:6] + "-" + str(selectedtime)[6:] + " 00:00:00"
+        selectday = datetime.datetime.strptime(selectdaystr, "%Y-%m-%d %H:%M:%S")
+        yesterday = (selectday - datetime.timedelta(days=1)).strftime("%Y-%m-%d %H:%M:%S")
+        log_str = fdb.sort_queryTable("编号", 'logs', "提示信息 !='' and 变更字段 !='人工待办' and 产生时间 >'%s'" % yesterday,"产生时间", "desc")
+        log_len = 999 if len(log_str) > 1000 else len(log_str)
+        tableWidgetLOGDispalydata={}
+        for i in range(0,log_len):
+            a = fdb.queryTabel('logs', "*", "编号='%s'" % log_str[i][0])[0]
+            tableWidgetLOGDispalydata[i]=a[4]
+        return tableWidgetLOGDispalydata
+    except Exception as e:
+        app_logger.log_error(e)

+ 86 - 0
Functions/DButilsFunction/taskAtuoCheck.py

@@ -0,0 +1,86 @@
+import datetime
+
+from unitls.LogerinTxt import app_logger
+from .flightDB import flightDB
+
+
+def taskAtuoCheck(fdb:flightDB,time):
+    try:
+        now = datetime.datetime.now()
+        tomorrow=(datetime.date.today() + datetime.timedelta(days=1)).strftime("%Y-%m-%d %H:%M:%S")
+        #print(tomorrow)
+        if time =="1":
+            print(datetime.datetime.now(),"[数据库操作]准备组任务首次登录检查验证")
+            log_str = fdb.queryTabel('logs',"编号","处理时间='' and 变更字段='准备组任务'")
+            if  len(log_str) == 0:
+                getTaskAuto=fdb.getAlldata('taskAuto')
+                if len(getTaskAuto) != 0:
+                    #print(getTaskAuto)
+                    for i in getTaskAuto:
+                        #print(i)
+                        if i[1] !="None":
+
+                            time1=str(datetime.date.today())+ " "+i[1]
+                            time11 = datetime.datetime.strptime(time1, "%Y-%m-%d %H:%M:%S")
+                            time2 = str(datetime.date.today()+ datetime.timedelta(days=1)) + " " + i[1]
+                            time22 = datetime.datetime.strptime(time2, "%Y-%m-%d %H:%M:%S")
+
+                            newdic = {"航班编号": '', "警告信息": i[2], "信息状态": "",
+                                      "提示信息": "%s" % time11, "产生时间": "%s" % now, "处理人": "", "处理时间": "", "变更字段": "准备组任务", "显示对象": "",
+                                      "提示内容": i[3]}
+                            fdb.lazyInsertData("logs", newdic)
+                            newdic2 = {"航班编号": '', "警告信息": i[2], "信息状态": "",
+                                      "提示信息":  "%s" % time22, "产生时间": "%s" % now, "处理人": "", "处理时间": "", "变更字段": "准备组任务", "显示对象": "",
+                                      "提示内容": i[3]}
+                            fdb.lazyInsertData("logs", newdic2)
+        if time =="2":
+            print(datetime.datetime.now(),"[数据库操作]准备组任务登录持续验证")
+            log_str2 = fdb.queryTabel('logs', "编号", "提示信息 >'%s' and 处理时间='' and 变更字段='准备组任务'" % tomorrow)
+            if len(log_str2) == 0:
+                getTaskAuto = fdb.getAlldata('taskAuto')
+                if len(getTaskAuto) != 0:
+                    #print(getTaskAuto)
+                    for i in getTaskAuto:
+                        #print(i)
+                        if i[1] != "None":
+                            time2 = str(datetime.date.today() + datetime.timedelta(days=1)) + " " + i[1]
+                            time22 = datetime.datetime.strptime(time2, "%Y-%m-%d %H:%M:%S")
+                            newdic2 = {"航班编号": '', "警告信息": i[2], "信息状态": "",
+                                       "提示信息": "%s" % time22, "产生时间": "%s" % now, "处理人": "", "处理时间": "", "变更字段": "准备组任务",
+                                       "显示对象": "",
+                                       "提示内容": i[3]}
+                            fdb.lazyInsertData("logs", newdic2)
+        if time =="3":
+            print(datetime.datetime.now(),"[数据库操作]更新准备组任务抑制前序任务")
+            log_str3 = fdb.queryTabel('logs', "编号", "处理时间='' and 变更字段='准备组任务'")
+            #print(log_str3)
+            if len(log_str3) != 0:
+                for i in log_str3:
+                    newdic = {"处理人": "'更新准备组任务系统抑制'", "处理时间": "'%s'" % now}
+                    fdb.lazyUpdateItem('logs', newdic, "编号='%s'" % i[0])
+
+            getTaskAuto = fdb.getAlldata('taskAuto')
+            if len(getTaskAuto) != 0:
+                #print(getTaskAuto)
+                for i in getTaskAuto:
+                    #print(i)
+                    if i[1] != "None":
+                        time1 = str(datetime.date.today()) + " " + i[1]
+                        time11 = datetime.datetime.strptime(time1, "%Y-%m-%d %H:%M:%S")
+                        time2 = str(datetime.date.today() + datetime.timedelta(days=1)) + " " + i[1]
+                        time22 = datetime.datetime.strptime(time2, "%Y-%m-%d %H:%M:%S")
+
+                        newdic = {"航班编号": '', "警告信息": i[2], "信息状态": "",
+                                  "提示信息": "%s" % time11, "产生时间": "%s" % now, "处理人": "", "处理时间": "", "变更字段": "准备组任务",
+                                  "显示对象": "",
+                                  "提示内容": i[3]}
+                        fdb.lazyInsertData("logs", newdic)
+                        newdic2 = {"航班编号": '', "警告信息": i[2], "信息状态": "",
+                                   "提示信息": "%s" % time22, "产生时间": "%s" % now, "处理人": "", "处理时间": "", "变更字段": "准备组任务",
+                                   "显示对象": "",
+                                   "提示内容": i[3]}
+                        fdb.lazyInsertData("logs", newdic2)
+        fdb.FunctionCommit()
+    except Exception as e:
+        fdb.FunctionCommit()
+        app_logger.log_error(e)

+ 52 - 0
Functions/DButilsFunction/updateDragDropItem.py

@@ -0,0 +1,52 @@
+import datetime
+
+from unitls.LogerinTxt import app_logger
+from unitls.StaticDataclass import get_dic
+from .flightDB import flightDB
+
+
+def updateDragDropItem(fdb:flightDB,column,text,flightid,displayMode,flighttype,selectedtime):
+    try:
+        rowlistLabel=get_dic('rowlistLabelA') if displayMode =="A" else get_dic('rowlistLabel')
+        flightid_new=""
+        if displayMode =="A":
+            if flighttype =="短停接" or flighttype =="航后" or flighttype =="特后前接" or flighttype =="停场":
+                flightid_new=flightid+"-1"+"-A"
+                flightid_other=flightid+"-2"+"-A"
+            elif flighttype =="短停送" or flighttype =="航前" or flighttype =="特后前送":
+                flightid_new = flightid + "-2" + "-A"
+                flightid_other=flightid+"-1"+"-A"
+        elif displayMode =="B":
+            if flighttype =="短停" or flighttype =="航后" or flighttype =="特后前" or flighttype =="停场":
+                flightid_new=flightid+"-1"+"-B"
+            elif flighttype =="航前":
+                flightid_new = flightid + "-2" + "-B"
+        nowDay = datetime.datetime.now().strftime("%Y%m%d")
+        flightids_in_peopleSchedule=fdb.getSingledata("编号","peopleSchedule{}".format(selectedtime))
+        newdic = {}
+        if str(flightid_new) not in str(flightids_in_peopleSchedule) and str(flightid_new) !="":
+            newdic={"编号":flightid_new,"航班编号":flightid,"显示模式":displayMode}
+            for i in rowlistLabel.keys():
+                if i == int(column):
+                    if text != "清空项目12345678987654321":
+                        newdic[rowlistLabel[i]] = text
+                    else:
+                        newdic[rowlistLabel[i]] = ""
+                else:
+                    newdic[rowlistLabel[i]] = ""
+            fdb.insertData("peopleSchedule{}".format(selectedtime),newdic)
+            if flighttype[-1] in ["接","送"] and column =="31":
+                newdic["编号"]=flightid_other
+                fdb.insertData("peopleSchedule{}".format(selectedtime),newdic)
+        else:
+            if text != "清空项目12345678987654321":
+                newdic[rowlistLabel[int(column)]]="'%s'"%text
+            else:
+                newdic[rowlistLabel[int(column)]]="''"
+            fdb.upDateItem("peopleSchedule{}".format(selectedtime),newdic,"编号='%s'"%flightid_new)
+            if flighttype[-1] in ["接","送"] and column =="31":
+                fdb.upDateItem("peopleSchedule{}".format(selectedtime),newdic,"编号='%s'"%flightid_other)
+        return "ok"
+    except Exception as e:
+        app_logger.log_error(e)
+        return "fail"

+ 38 - 0
Functions/DButilsFunction/updateEidteItem.py

@@ -0,0 +1,38 @@
+from unitls.LogerinTxt import app_logger
+from unitls.StaticDataclass import get_dic
+from .flightDB import flightDB
+
+
+def updateEidteItem(fdb:flightDB,text,flightid,displayMode,flighttype,selectedtime):
+    try:
+        rowlistLabel = get_dic('rowlistLabel')
+        if displayMode =="A":
+            if flighttype =="短停接" or flighttype =="航后" or flighttype =="特后前接" or flighttype =="停场":
+                flightid_new=flightid+"-1"+"-A"
+            elif flighttype =="短停送" or flighttype =="航前" or flighttype =="特后前送":
+                flightid_new = flightid + "-2" + "-A"
+        elif displayMode =="B":
+            if flighttype =="短停" or flighttype =="航后" or flighttype =="特后前" or flighttype =="停场":
+                flightid_new=flightid+"-1"+"-B"
+        flightids_in_peopleSchedule=fdb.getSingledata("编号","peopleSchedule{}".format(selectedtime))
+        newdic = {}
+        if str(flightid_new) not in str(flightids_in_peopleSchedule):
+            newdic={"编号":flightid_new,"航班编号":flightid,"显示模式":displayMode}
+            for i in rowlistLabel.keys():
+                if i == -1:
+                    if text !="清空项目12345678987654321":
+                        newdic[rowlistLabel[i]]=text
+                    else:
+                        newdic[rowlistLabel[i]] = ""
+                else:
+                    newdic[rowlistLabel[i]] = ""
+            fdb.insertData("peopleSchedule{}".format(selectedtime),newdic)
+        else:
+            if text != "清空项目12345678987654321":
+                newdic[rowlistLabel[int(-1)]]="'%s'"%text
+            else:
+                newdic[rowlistLabel[int(-1)]]="''"
+
+            fdb.upDateItem("peopleSchedule{}".format(selectedtime),newdic,"编号='%s'"%flightid_new)
+    except Exception as e:
+        app_logger.log_error(e)

+ 19 - 0
Functions/DButilsFunction/updateRiskdb.py

@@ -0,0 +1,19 @@
+import datetime
+
+from unitls.LogerinTxt import app_logger
+from .flightDB import flightDB
+
+
+def updateRiskdb(database:flightDB, data):   #创建准备组提示数据库
+    fdb = database
+    fdb.deleteTable("RiskTable")
+    try:
+        for myrow in data:
+            fdb.lazyInsertData('RiskTable',myrow)
+        fdb.FunctionCommit()
+        return "ok"
+    except Exception as e:
+        app_logger.log_error(e)
+        print(datetime.datetime.now(),'[数据库操作]数据库获取错误!!检查模板文件!风险提示功能失效!!')
+        fdb.FunctionCommit()
+        return "fail"

+ 34 - 0
Functions/DButilsFunction/updateStopFlight.py

@@ -0,0 +1,34 @@
+import datetime
+
+from unitls.LogerinTxt import app_logger
+from .flightDB import flightDB
+from .sortFlighttime import sortFlighttime
+from .sortFlighttime2 import sortFlighttime2
+
+
+def updateStopFlight(database:flightDB,workLoad:flightDB, data):
+
+    fdb = database
+    try:
+        if data["day"]:
+            flightids=fdb.queryTabel("TaskFlightinfo%s"%data["day"],"航班编号","航班类型 ='停场'")
+            if len(flightids) != 0:
+                for i in flightids:
+                    fdb.deleteSingledata("TaskFlightinfo%s"%data["day"],"航班编号='%s'"%i[0])
+
+            for myrow in data['data']:
+                fdb.lazyInsertData("TaskFlightinfo%s"%data["day"],myrow)
+            fdb.FunctionCommit()
+        sortFlighttime(database,workLoad)
+        sortFlighttime2(database,workLoad)
+        print(datetime.datetime.now(), '[数据库操作]停场航班导入成功!')
+        res ="ok"
+        return res
+    except Exception as e:
+        print(datetime.datetime.now(),'[数据库操作]停场航班导入失败!!检查模板文件!')
+        app_logger.log_error(e)
+        # 需要QT输出警告弹框信息
+        res = "fail"
+        fdb.FunctionCommit()
+        return res
+#新增内容

+ 19 - 0
Functions/DButilsFunction/updateTaskAuto.py

@@ -0,0 +1,19 @@
+import datetime
+
+from unitls.LogerinTxt import app_logger
+from .flightDB import flightDB
+
+
+def updateTaskAuto(database:flightDB, data):   #创建准备组提示数据库
+    fdb = database
+    fdb.deleteTable("taskAuto")
+    try:
+        for myrow in data:
+            fdb.lazyInsertData('taskAuto',myrow)
+        fdb.FunctionCommit()
+        return "ok"
+    except Exception as e:
+        app_logger.log_error(e)
+        print(datetime.datetime.now(),'[数据库操作]数据库获取错误!!检查模板文件!准备组任务提示功能失效!!')
+        fdb.FunctionCommit()
+        return "fail"

+ 27 - 0
Functions/DButilsFunction/update_Pglist.py

@@ -0,0 +1,27 @@
+from unitls.LogerinTxt import app_logger
+from unitls.StaticDataclass import get_dic
+from .flightDB import flightDB
+
+
+def update_Pglist(database:flightDB,datatime: str,bc:str,jsonData):
+    try:
+        nowDayStr = datatime
+        newdic={}
+        database.deleteSingledata("pglist{}".format(nowDayStr), "班次='%s'" % bc)
+        names=[]
+        pglistLabel2en=get_dic('pglistLabel2en')
+        pglistLabel=get_dic('pglistLabel')
+        for row in jsonData:
+            if "SHIFT" in row.keys() and row["SHIFT"] == bc and row["NAME"] not in names:
+                for col in row:
+                    if col in pglistLabel2en.keys():
+                        newdic[pglistLabel2en[col]]=row[col]
+                for col in pglistLabel:
+                    if col not in newdic.keys():
+                        newdic[col] = ''
+                database.lazyInsertData("pglist{}".format(nowDayStr),newdic)
+                names = row["NAME"]
+        database.FunctionCommit()
+    except Exception as e:
+        database.FunctionCommit()
+        app_logger.log_error(e)

+ 40 - 0
Functions/DButilsFunction/waringMessageID.py

@@ -0,0 +1,40 @@
+from unitls.LogerinTxt import app_logger
+from .flightDB import flightDB
+
+
+def waringMessageID(database:flightDB):
+    try:
+        waringMessageID1_arr=[]
+        waringMessageID2_arr = []
+        waringMessageID3_arr = []
+        waringMessageID4_arr = []
+        waringMessageID5_arr = []
+        waringMessageID6_arr = []
+        waringMessageID0_arr = []
+        waringMessageID_arrs={}
+        waringMessageIDs=database.queryTabel('logs',"*","警告信息 !='' and 处理时间 =''")
+        if len(waringMessageIDs) != 0:
+            for i in waringMessageIDs:
+                waringMessageID0_arr.append(i[1])
+                if i[8] == "到位警告":
+                    waringMessageID1_arr.append(i[1])
+                elif i[8] == "二送警告":
+                    waringMessageID2_arr.append(i[1])
+                elif i[8] == "非航前预计到达":
+                    waringMessageID3_arr.append(i[1])
+                elif i[8] == "非航前进港机位":
+                    waringMessageID4_arr.append(i[1])
+                elif i[8] == "非航前预计起飞":
+                    waringMessageID5_arr.append(i[1])
+                else:
+                    waringMessageID6_arr.append(i[1])
+        waringMessageID_arrs["到位警告"]=waringMessageID1_arr
+        waringMessageID_arrs["二送警告"] = waringMessageID2_arr
+        waringMessageID_arrs["ETA"] = waringMessageID3_arr
+        waringMessageID_arrs["BAY_2"] = waringMessageID4_arr
+        waringMessageID_arrs["TD"] = waringMessageID5_arr
+        waringMessageID_arrs["通用警告"] = waringMessageID6_arr
+        waringMessageID_arrs["全部警告"] = waringMessageID0_arr
+        return waringMessageID_arrs
+    except Exception as e:
+        app_logger.log_error(e)

+ 729 - 0
Functions/DataComputer.py

@@ -0,0 +1,729 @@
+
+import datetime
+import math
+import traceback
+
+import psycopg2
+from unitls.settings import DBServer , flightDB4 , databasefileDB
+
+dataListLabel = ['序号', '类型', '时间', '数据1', '数据2', '唯一序列', '备1', '备2', '备3', '备4', '备5', '备6']
+
+dbhost, dbport, dbuser, dbpassword,online_host, online_port, online_user, online_password = DBServer()
+host=dbhost
+port=dbport
+user1=dbuser
+password=dbpassword
+flightDatedb = flightDB4()
+databasefileDB = databasefileDB()
+
+class flightDB():
+
+    def __init__(self, host, port, user, password, database):
+
+        self.conn = psycopg2.connect(
+            host=host,
+            port=port,
+            user=user,
+            password=password,
+            database=database
+        )
+        self.c = self.conn.cursor()
+
+    def initTable(self, tableName: str, primarykey: str, primarykeyStr: str, keyDict: dict):
+        try:
+            keyStr = ''
+            num = 1
+            for key in keyDict:
+                if num != len(keyDict):
+                    keyStr += '{} {},\n'.format(key, keyDict[key])
+                else:
+                    keyStr += '{} {}'.format(key, keyDict[key])
+                num += 1
+
+            curStr = """
+                            create table if not exists {} (
+                            {} {} ,
+                            {}
+                            )
+                            """.format(tableName, primarykey, primarykeyStr, keyStr)
+            # print(curStr)
+            self.c.execute(curStr)
+            self.conn.commit()
+        except Exception:
+            print(traceback.format_exc())
+            #print(curStr)
+
+    def insertData(self, tableName: str, data: dict, *args):
+        try:
+            # curStr1 = 'insert into {} '.format(tableName)
+            num = 1
+            curStr2 = ''
+            for key in data:
+                if num != len(data):
+                    curStr2 += '{},'.format(key)
+                else:
+                    curStr2 += '{}'.format(key)
+                num += 1
+            curStr3 = ''
+            num = 1
+            for key in data:
+                if num != len(data):
+                    curStr3 += "'{}',".format(data[key])
+                else:
+                    curStr3 += "'{}'".format(data[key])
+                num += 1
+            curStr = """
+                    insert into {} ({})
+                    values ({})
+                    """.format(tableName, curStr2, curStr3)
+            #print(curStr)
+            self.c.execute(curStr)
+
+            if args == ():
+                self.conn.commit()
+        except Exception:
+            print(traceback.format_exc())
+    def lazyInsertData(self, tableName: str, data: dict):
+        self.insertData(tableName, data, 'lazy')
+
+    def FunctionCommit(self):
+        try:
+            self.conn.commit()
+        except Exception:
+            print(traceback.format_exc())
+
+
+    def FunctionRollback(self):
+        self.conn.rollback()
+
+    def deleteTable(self, tablename: str, *condition: str):
+        try:
+            # print(condition)
+            if condition != ():
+                curStr = """
+                           delete from {} where {}
+                           """.format(tablename, condition[0])
+            else:
+                curStr = """
+                           delete from {}
+                           """.format(tablename)
+            # print(curStr)
+            self.c.execute(curStr)
+            self.conn.commit()
+        except Exception:
+            print(traceback.format_exc())
+    def lazydeleteTable(self, tablename: str, *condition: str):
+        try:
+            # print(condition)
+            if condition != ():
+                curStr = """
+                           delete from {} where {}
+                           """.format(tablename, condition[0])
+            else:
+                curStr = """
+                           delete from {}
+                           """.format(tablename)
+            # print(curStr)
+            self.c.execute(curStr)
+        except Exception:
+            print(traceback.format_exc())
+
+    def deleteTable2(self, tablename: str):
+        try:
+            # print(condition)
+
+            curStr = """
+                    DROP TABLE IF EXISTS {};
+                    """.format(tablename)
+            # print(curStr)
+            self.c.execute(curStr)
+            self.conn.commit()
+        except Exception:
+            print(traceback.format_exc())
+
+    def sort_queryTable(self, findkey: str, tablename: str, condition: str, tableKey: str, fn):
+        try:
+            curStr = """
+                    select {} from {} where {} order by {} {}
+                    """.format(findkey, tablename, condition, tableKey, fn)
+            # print(curStr)
+            self.c.execute(curStr)
+            return self.c.fetchall()
+        except Exception:
+            print(traceback.format_exc())
+
+    def sortTable(self, tablename: str, tableKey: str, fn):
+        try:
+            curStr = """
+                    select * from {} order by {} {}
+                    """.format(tablename, tableKey, fn)
+            # print(curStr)
+            self.c.execute(curStr)
+            return self.c.fetchall()
+        except Exception:
+            print(traceback.format_exc())
+
+    def sort_queryTable2(self, findkey: str, tablename: str, condition: str, tableKey: str, fn, tableKey1: str, fn1):
+        try:
+            curStr = """
+                    select {} from {} where {} order by {} {},{} {}
+                    """.format(findkey, tablename, condition, tableKey, fn, tableKey1, fn1)
+            # print(curStr)
+            self.c.execute(curStr)
+            return self.c.fetchall()
+        except Exception:
+            print(traceback.format_exc())
+
+    def getAlldata(self, tablename: str):
+        try:
+            curStr = """select * from {}""".format(tablename)
+            self.c.execute(curStr)
+            return self.c.fetchall()
+        except Exception:
+            print(traceback.format_exc())
+
+    def queryTabel(self, tablename: str, key: str, condition: str):
+        # print(tablename,key,condition)
+        try:
+            curStr1 = """
+                    SELECT EXISTS (
+                      SELECT * FROM pg_catalog.pg_tables
+                      WHERE tablename = '{}' AND schemaname = 'public'
+                    );
+            """.format(tablename.lower())
+            self.c.execute(curStr1)
+            result = self.c.fetchall()[0][0]
+            if result:
+                curStr = """
+                        select {} from {} where {}
+                        """.format(key, 'public.' + tablename, condition)
+                # print(key,tablename,condition)
+                # print(curStr)
+                self.c.execute(curStr)
+
+                return self.c.fetchall()
+            else:
+                # print('{} 不存在'.format(tablename))
+                return None
+        except Exception:
+            # print(curStr)
+            print(traceback.format_exc())
+
+    def upDateItem(self, tablename: str, dateDic: dict, condition: str, *args):
+        try:
+            setStr = ''
+            for key in dateDic:
+                setStr += "{}={},".format(key, dateDic[key])
+            setStr = setStr[:-1]
+            curStr = """
+                    update {} set {} where {}
+                    """.format(tablename, setStr, condition)
+            print(curStr)
+            if setStr != "":
+                self.c.execute(curStr)
+            if args == ():
+                self.conn.commit()
+        except Exception:
+            print(traceback.format_exc())
+
+    def lazyUpdateItem(self, tablename: str, dateDic: dict, condition: str):
+        try:
+            self.upDateItem(tablename, dateDic, condition, 'lazy')
+        except Exception:
+            print(traceback.format_exc())
+            pass
+
+    def getSingledata(self, findkey: str, tablename: str):
+        try:
+            curStr = """
+                    select {} from {}
+                    """.format(findkey, tablename)
+            # print(curStr)
+            result = self.c.execute(curStr)
+            return result.fetchall()
+        except Exception:
+            print(traceback.format_exc())
+
+    def deleteSingledata(self, tablename: str, findkey: str):
+        try:
+            curStr = """
+                    delete from {} where {}
+                    """.format(tablename, findkey)
+            self.c.execute(curStr)
+            # print(curStr)
+            self.conn.commit()
+        except Exception:
+            print(traceback.format_exc())
+
+    def funcExecute(self, string):
+        self.c.execute(string)
+        return self.c.fetchall()
+
+    def close(self):
+        try:
+            self.conn.close()
+        except Exception:
+            print(traceback.format_exc())
+
+def TuplefindInDataList(lists: list, type,data, numb):  # 返回列表
+    res_list = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]
+    res_list.append(data)
+    res = ','.join(str(x) for x in res_list)
+    if lists and len(lists) !=0:
+        try:
+            for l in lists:
+                if type == l[numb]:
+                    lst = [int(x) for x in l[3].split(',')][1:]
+                    lst.append(data)
+                    res= ','.join(str(x) for x in lst)
+                    break
+            return res
+        except:
+            return res
+    else:
+        return res
+def TuplefindInDataList2(lists: list, type,data, numb, type2, numb2):  # 返回列表
+    res_list = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]
+    res_list.append(data)
+    res = ','.join(str(x) for x in res_list)
+    if len(lists) !=0:
+        try:
+            for l in lists:
+                if type == l[numb] and type2 == l[numb2]:
+                    lst = [int(x) for x in l[3].split(',')][1:]
+                    lst.append(data)
+                    res= ','.join(str(x) for x in lst)
+                    break
+            return res
+        except:
+            return res
+    else:
+        return res
+def mytask():
+    finishdeTask=""
+    nowDay = datetime.datetime.now().strftime("%Y%m%d").replace("-","")
+    nowDay_1 = (datetime.date.today() - datetime.timedelta(days=1)).strftime("%Y%m%d").replace("-","")
+    nowDay_2 = (datetime.date.today() - datetime.timedelta(days=2)).strftime("%Y%m%d").replace("-", "")
+    initFlightDatabase1(nowDay)
+    initFlightDatabase1(nowDay_1)
+    initFlightDatabase1(nowDay_2)
+
+    alldata=DataDBUtilsgetData("sortFlight%s" % nowDay, "*", "编号 != ''")
+    Yalldata=DataDBUtilsgetData("sortFlight%s" % nowDay_1, "*", "编号 != ''")
+    alldata_task=DataDBUtilsgetData("TaskFlightinfo%s" % nowDay, "*", "航班编号 != '' and 取消标志 = '0' ")
+    Yalldata_task=DataDBUtilsgetData("TaskFlightinfo%s" % nowDay_1, "*", "航班编号 != '' and  取消标志 = '0' ")
+    try:
+        mytask1 = function1(alldata_task,Yalldata_task)
+        finishdeTask=finishdeTask+"task1/"
+    except:
+        mytask1=[]
+        pass
+
+    try:
+        mytask2 = function2(alldata,Yalldata)
+        finishdeTask=finishdeTask+"task2/"
+    except:
+        mytask2 = []
+        pass
+
+    now = datetime.datetime.now()
+    startTime = now.replace(hour=0, minute=0, second=0, microsecond=0)
+    ystartTime = (now - datetime.timedelta(days=1)).replace(hour=0, minute=0, second=0, microsecond=0)
+    tstartTime = (now + datetime.timedelta(days=1)).replace(hour=0, minute=0, second=0, microsecond=0)
+
+    taskMainData=getData_online("taskMain", "*", "'%s' < 任务开始时间 and 任务开始时间 <'%s'"%(startTime,tstartTime))
+    YtaskMainData = getData_online("taskMain", "*", "'%s' < 任务开始时间 and 任务开始时间 <'%s'" % (ystartTime, startTime))
+
+    try:
+        mytask3 = function4(taskMainData,YtaskMainData)
+        finishdeTask=finishdeTask+"task3/"
+    except  Exception as e:
+        print(e)
+        mytask3=[]
+        pass
+
+    try:
+        mytask4 = function5()
+        finishdeTask=finishdeTask+"task4/"
+    except  Exception as e:
+        print(e)
+        pass
+    try:
+        mytask5 = function7()
+        finishdeTask=finishdeTask+"task5/"
+    except  Exception as e:
+        print(e)
+        pass
+    try:
+        mytask6 = function9()
+        finishdeTask=finishdeTask+"task6/"
+    except  Exception as e:
+        print(e)
+        pass
+
+    nowday=datetime.date.today()
+    nowday_1 = datetime.date.today() - datetime.timedelta(days=1)
+    dy={0:"每日短停",1:"每日航前",2:"每日航后",3:"每日特后前",4:"每日停场",5:"每日短停",6:"每日航前",7:"每日航后",8:"每日特后前",9:"每日停场",10:"每日外委",11:"每日外委",12:"每日总数",13:"每日总数",14:"每日川航",15:"每日川航",16:"已执行",17:"已执行"}
+    fdb = flightDB(host=online_host,
+                   port=online_port,
+                   user=online_user,
+                   password=online_password,
+                   database=databasefileDB
+                   )
+    try:
+        olddata_1=fdb.getAlldata("dataList{}".format(nowDay_1))
+    except:
+        olddata_1=[]
+    try:
+        olddata_2=fdb.getAlldata("dataList{}".format(nowDay_2))
+    except:
+        olddata_2=[]
+
+    fdb.lazydeleteTable("dataList{}".format(nowDay_1),"1=1")
+    fdb.lazydeleteTable("dataList{}".format(nowDay), "1=1")
+    try:
+        for ii in range(0,len(mytask1)):  ##每日航班分布
+            if ii in [5,6,7,8,9,11,13,15,17]:
+                res_data_1=TuplefindInDataList(olddata_2,dy[ii],mytask1[ii],1)
+                newdic={"类型":dy[ii],"时间":nowday_1,"数据1":res_data_1,"数据2":"",'唯一序列':"",'备1':"",'备2':"",'备3':"",'备4':"",'备5':"",'备6':""}
+                fdb.lazyInsertData("dataList{}".format(nowDay_1), newdic)
+            else:
+                res_data=TuplefindInDataList(olddata_1,dy[ii],mytask1[ii],1)
+                newdic = {"类型": dy[ii], "时间": nowday, "数据1": res_data, "数据2": "", '唯一序列': "", '备1': "", '备2': "",'备3': "", '备4': "", '备5': "", '备6': ""}
+                fdb.lazyInsertData("dataList{}".format(nowDay), newdic)
+
+        for ii in mytask2[0].keys():##每刻航班分布
+            for iii in mytask2[0][ii].keys():
+                res_data = TuplefindInDataList2(olddata_1, '每刻%s'%iii,mytask2[0][ii][iii],1, ii,2)
+                newdic={"类型":'每刻%s'%iii,"时间":ii,"数据1":res_data,"数据2":"",'唯一序列':"",'备1':"",'备2':"",'备3':"",'备4':"",'备5':"",'备6':""}
+                fdb.lazyInsertData("dataList{}".format(nowDay), newdic)
+
+        for iiii in mytask2[1].keys():
+            for iiiii in mytask2[1][iiii].keys():
+                res_data = TuplefindInDataList2(olddata_2, '每刻%s'%iiiii, mytask2[1][iiii][iiiii],1, iiii,2)
+                newdic={"类型":'每刻%s'%iiiii,"时间":iiii,"数据1":res_data,"数据2":"",'唯一序列':"",'备1':"",'备2':"",'备3':"",'备4':"",'备5':"",'备6':""}
+                fdb.lazyInsertData("dataList{}".format(nowDay_1), newdic)
+
+         #每日任务分布
+
+        res_data_1 = TuplefindInDataList(olddata_1, '任务分布', mytask3[1], 1)
+        res_data_2 = TuplefindInDataList(olddata_1, '任务分布', mytask3[0], 1)
+        newdic={"类型":'任务分布',"时间":nowday,"数据1":res_data_1,"数据2":res_data_2,'唯一序列':"",'备1':"",'备2':"",'备3':"",'备4':"",'备5':"",'备6':""}
+        fdb.lazyInsertData("dataList{}".format(nowDay), newdic)
+        res_data_1 = TuplefindInDataList(olddata_2, '任务分布', mytask3[3], 1)
+        res_data_2 = TuplefindInDataList(olddata_2, '任务分布', mytask3[2], 1)
+        newdic = {"类型": '任务分布', "时间": nowday_1, "数据1": res_data_1, "数据2": res_data_2, '唯一序列': "", '备1': "", '备2': "",'备3': "", '备4': "", '备5': "", '备6': ""}
+        fdb.lazyInsertData("dataList{}".format(nowDay_1), newdic)
+
+        #随机任务
+        res_data_1 = TuplefindInDataList(olddata_1, '随机任务', mytask4[0], 1)
+        res_data_2 = TuplefindInDataList(olddata_1, '随机任务', mytask4[1], 1)
+        newdic={"类型":'随机任务',"时间":nowday,"数据1":res_data_1,"数据2":res_data_2,'唯一序列':"",'备1':"",'备2':"",'备3':"",'备4':"",'备5':"",'备6':""}
+        fdb.lazyInsertData("dataList{}".format(nowDay), newdic)
+
+        res_data_1 = TuplefindInDataList(olddata_2, '随机任务', mytask4[2], 1)
+        res_data_2 = TuplefindInDataList(olddata_2, '随机任务', mytask4[3], 1)
+        newdic = {"类型": '随机任务', "时间": nowday_1, "数据1":res_data_1,"数据2":res_data_2, '唯一序列': "", '备1': "", '备2': "",'备3': "", '备4': "", '备5': "", '备6': ""}
+        fdb.lazyInsertData("dataList{}".format(nowDay_1), newdic)
+
+        #航材工具配送
+
+        for i in mytask5[0].keys():
+            newdic={"类型":'%s配送'%mytask5[0][i]["类型"],"时间":mytask5[0][i]['配送发起时间'],"数据1":mytask5[0][i]['机位'],"数据2":mytask5[0][i]['耗时'],'唯一序列':mytask5[0][i]['任务号'],'备1':mytask5[0][i]['任务级别'],'备2':"",'备3':"",'备4':"",'备5':"",'备6':""}
+            fdb.lazyInsertData("dataList{}".format(nowDay), newdic)
+        for i in mytask5[1].keys():
+            newdic={"类型":'%s配送'%mytask5[1][i]["类型"],"时间":mytask5[1][i]['配送发起时间'],"数据1":mytask5[1][i]['机位'],"数据2":mytask5[1][i]['耗时'],'唯一序列':mytask5[1][i]['任务号'],'备1':mytask5[1][i]['任务级别'],'备2':"",'备3':"",'备4':"",'备5':"",'备6':""}
+            fdb.lazyInsertData("dataList{}".format(nowDay_1), newdic)
+        #二拖
+        for i in mytask6[0].keys():
+            newdic={"类型":'二拖任务',"时间":mytask6[0][i]['创建时间'],"数据1":"","数据2":mytask6[0][i]['耗时'],'唯一序列':mytask6[0][i]['任务号'],'备1':"",'备2':"",'备3':"",'备4':"",'备5':"",'备6':""}
+            fdb.lazyInsertData("dataList{}".format(nowDay), newdic)
+        for i in mytask6[1].keys():
+            newdic={"类型":'二拖任务',"时间":mytask6[1][i]['创建时间'],"数据1":"","数据2":mytask6[1][i]['耗时'],'唯一序列':mytask6[1][i]['任务号'],'备1':"",'备2':"",'备3':"",'备4':"",'备5':"",'备6':""}
+            fdb.lazyInsertData("dataList{}".format(nowDay_1), newdic)
+        fdb.FunctionCommit()
+        fdb.close()
+        #t3 = datetime.datetime.now()
+        #print(t3 - t2)
+        print(datetime.datetime.now(), "[计算中心]统计分析写入完毕(%s)"%finishdeTask)
+        return "ok"
+    except Exception as e:
+        print(traceback.format_exc())
+        fdb.close()
+        return "fail"
+
+def TuplefindInList(lists: list, args, numb):  # 返回列表
+    res = []
+    try:
+        for l in lists:
+            if args == l[numb]:
+                res.append(l)
+        return res
+    except:
+        return res
+def CountAllList(lists: list):  # 返回列表
+    res = 0
+    try:
+        for l in lists:
+            res+=1
+        return res
+    except:
+        return res
+
+def CountInList(lists: list, args, numb):  # 返回列表
+    res = 0
+    try:
+        for l in lists:
+            if args in l[numb]:
+                res+=1
+        return res
+    except:
+        return res
+def CountInListor(lists: list, args, args1,numb):  # 返回列表
+    res = 0
+    try:
+        for l in lists:
+            if args not in l[numb] and args1 not in l[numb]:
+                if l[3] == 'TR' or l[3] == 'TAF':
+                    res+=2
+                else:
+                    res+=1
+        return res
+    except:
+        return res
+def CountInListNot(lists: list, args, numb):  # 返回列表
+    res = 0
+    try:
+        for l in lists:
+            if l[numb] != args:
+                res+=1
+        return res
+    except:
+        return res
+
+def CountFinshed(lists: list):  # 返回列表
+    res = 0
+    try:
+        for l in lists:
+            if l[3] != "停场" and (l[5] == "3" or l[5] == "4"):
+                res+=1
+        return res
+    except:
+        return res
+
+def function1(alldata,Yalldata):   #查询每日航班的分布
+    resTR=CountInList(alldata, "TR", 3)*2
+    resPEF=CountInList(alldata, "AP", 3)
+    resPOF=CountInList(alldata, "AF", 3)
+    resTAF=CountInList(alldata, "TAF", 3)*2
+    resST=CountInList(alldata, "停场", 3)
+    resAll=resTR+resPEF+resPOF+resTAF
+    resfinsh=CountFinshed(alldata)
+    YresTR=CountInList(Yalldata, "TR", 3)*2
+    YresPEF=CountInList(Yalldata, "AP", 3)
+    YresPOF=CountInList(Yalldata, "AF", 3)
+    YresTAF=CountInList(Yalldata, "TAF", 3)*2
+    YresST=CountInList(Yalldata, "停场", 3)
+    YreAll=YresTR+YresPEF+YresPOF+YresTAF
+    ww=CountInListor(alldata, "3U",'CSC', 21)
+    yww=CountInListor(Yalldata, "3U",'CSC', 21)
+    ch=resAll-ww
+    Ych=YreAll-yww
+    Yresfinsh=CountFinshed(Yalldata)
+
+    return (resTR,resPEF,resPOF,resTAF,resST,YresTR,YresPEF,YresPOF,YresTAF,YresST,ww,yww,resAll,YreAll,ch,Ych,resfinsh,Yresfinsh)
+def function2(alldata,Yalldata): #实时任务分布
+    now=datetime.datetime.now()
+    startTime = now.replace(hour=0,minute=0, second=0, microsecond=0)
+    ystartTime = (now - datetime.timedelta(days=1)).replace(hour=0, minute=0, second=0, microsecond=0)
+    res=function3(startTime,alldata)
+    yres = function3(ystartTime, Yalldata)
+    return(res,yres)
+
+def function4(taskMainData,YtaskMainData):#任务分布
+    resALL=len(taskMainData) if taskMainData != None else 0
+    resFinish=CountInListNot(taskMainData,"",20)
+    yresALL=len(YtaskMainData) if YtaskMainData != None else 0
+    yresFinish=CountInListNot(YtaskMainData,"",20)
+    return(resALL, resFinish,yresALL,yresFinish)
+
+
+def function3(startTime,res):
+
+    list=[]
+    ress={}
+    aa=30#准备时间
+    bb=15#收尾时间
+    if len(res) !=0 and res !=None:
+        for i in res:
+            #print(i)
+            if i[3]== "航前":
+                a=("航前",datetime.datetime.strptime(i[2], "%Y-%m-%d %H:%M:%S") - datetime.timedelta(minutes=5)- datetime.timedelta(minutes=aa),datetime.datetime.strptime(i[2], "%Y-%m-%d %H:%M:%S")+ datetime.timedelta(minutes=90)+ datetime.timedelta(minutes=bb),i[5])
+            elif i[3]== "短停接":
+                a = ("短停接", datetime.datetime.strptime(i[2], "%Y-%m-%d %H:%M:%S") - datetime.timedelta(minutes=5)- datetime.timedelta(minutes=aa), datetime.datetime.strptime(i[2], "%Y-%m-%d %H:%M:%S") + datetime.timedelta(minutes=15)+ datetime.timedelta(minutes=bb),i[5])
+            elif i[3]== "特后前接":
+                a = ("特后前接", datetime.datetime.strptime(i[2], "%Y-%m-%d %H:%M:%S") - datetime.timedelta(minutes=5)- datetime.timedelta(minutes=aa), datetime.datetime.strptime(i[2], "%Y-%m-%d %H:%M:%S") + datetime.timedelta(minutes=15)+ datetime.timedelta(minutes=bb),i[5])
+            elif i[3]== "短停送":
+                a = ("短停送", datetime.datetime.strptime(i[2], "%Y-%m-%d %H:%M:%S") - datetime.timedelta(minutes=5)- datetime.timedelta(minutes=aa), datetime.datetime.strptime(i[2], "%Y-%m-%d %H:%M:%S") + datetime.timedelta(minutes=25)+ datetime.timedelta(minutes=bb),i[5])
+            elif i[3]== "特后前送":
+                a = ("特后前送", datetime.datetime.strptime(i[2], "%Y-%m-%d %H:%M:%S") - datetime.timedelta(minutes=5)- datetime.timedelta(minutes=aa), datetime.datetime.strptime(i[2], "%Y-%m-%d %H:%M:%S") + datetime.timedelta(minutes=25)+ datetime.timedelta(minutes=bb),i[5])
+            else:
+                a = ("航后", datetime.datetime.strptime(i[2], "%Y-%m-%d %H:%M:%S") - datetime.timedelta(minutes=5)- datetime.timedelta(minutes=aa), datetime.datetime.strptime(i[2], "%Y-%m-%d %H:%M:%S") + datetime.timedelta(minutes=120)+ datetime.timedelta(minutes=bb),i[5])
+            list.append(a)
+
+    for j in range(0,66): #1980 /间隔
+        judgeTime=startTime + datetime.timedelta(minutes=30*j)
+        tr=0
+        prf=0
+        pof=0
+        taf=0
+        ytr = 0   #预测
+        yprf = 0
+        ypof = 0
+        ytaf = 0
+        if list !=[]:
+            for ii in list:
+                if ii[1] < judgeTime < ii[2] and ii[3] != "2" and judgeTime < datetime.datetime.now():
+                    if ii[0]== "航前":
+                        prf+=1
+                    elif ii[0]== "短停接":
+                        tr+=1
+                    elif ii[0]== "特后前接":
+                        taf+=1
+                    elif ii[0]== "短停送":
+                        tr+=1
+                    elif ii[0]== "特后前送":
+                        taf+=1
+                    else:
+                        pof+=1
+                if ii[1] < judgeTime < ii[2]:
+                    if ii[0] == "航前":
+                        yprf += 1
+                    elif ii[0] == "短停接":
+                        ytr+=1
+                    elif ii[0] == "特后前接":
+                        ytaf+=1
+                    elif ii[0]== "短停送":
+                        ytr+=1
+                    elif ii[0]== "特后前送":
+                        ytaf+=1
+                    else:
+                        ypof+=1
+        ress["%s"%judgeTime]={"航前":prf,"短停":tr,"特后前":taf,"航后":pof,"合计":prf+tr+taf+pof,"预计航前":yprf,"预计短停":ytr,"预计特后前":ytaf,"预计航后":ypof,"预计合计":yprf+ytr+ytaf+ypof}
+    return ress
+
+def function5():#随机任务
+    now = datetime.datetime.now()
+    nowDay = datetime.date.today().strftime("%Y%m%d")
+    nowDay_1 = (datetime.date.today() - datetime.timedelta(days=1)).strftime("%Y%m%d")
+
+    peopleSchedule=DataDBUtilsgetData("peopleSchedule%s" % nowDay, "*", "附加消息 like '%随机离港%'")
+    ypeopleSchedule = DataDBUtilsgetData("peopleSchedule%s" % nowDay_1, "*", "附加消息 like '%随机离港%'")
+    res=function6(peopleSchedule,nowDay)
+    yres = function6(ypeopleSchedule, nowDay_1)
+    return(res,len(peopleSchedule),yres,len(ypeopleSchedule))
+def function6(res,day):
+    a=0
+    if res != None and len(res) !=0:
+        for i in res:
+            check=DataDBUtilsgetData("sortFlight%s" % day, "级别", "编号 ='%s'" % (i[1] + "-2"))
+            if check !=None and len(check) != 0 and check[0][0] == "4":
+                a+=1
+    return a
+
+def function7():#航材工具
+    now = datetime.datetime.now()
+    startTime = now.replace(hour=0, minute=0, second=0, microsecond=0)
+    ystartTime = (now - datetime.timedelta(days=1)).replace(hour=0, minute=0, second=0, microsecond=0)
+    tstartTime = (now + datetime.timedelta(days=1)).replace(hour=0, minute=0, second=0, microsecond=0)
+    resALL=getData_online("sendtasklist",'*',"'%s' < 配送发起时间 and 配送发起时间 <'%s'"%(startTime,tstartTime))
+    yresALL = getData_online("sendtasklist", '*', "'%s' < 配送发起时间 and 配送发起时间 <'%s'" % (ystartTime, startTime))
+    res=function8(resALL)
+    yres = function8(yresALL)
+    return(res,yres)
+    #
+def function8(res):
+    ress={}
+    if res !=None and len(res) !=0:
+        for i in res:
+            if i[23] != "" and i[6] != "":
+                costtime= math.ceil((datetime.datetime.strptime(i[23].split(".")[0], "%Y-%m-%d %H:%M:%S") - datetime.datetime.strptime(i[6].split(".")[0], "%Y-%m-%d %H:%M:%S")).total_seconds()/60)
+            else:
+                costtime=""
+
+            ress[i[16]]={"类型":i[2],"机位":i[17],"配送发起时间":i[4].split(".")[0],"耗时":costtime,"任务级别":i[13],"任务号":i[16]}
+
+    return ress
+def function9():#二拖
+    now = datetime.datetime.now()
+    startTime = now.replace(hour=0, minute=0, second=0, microsecond=0)
+    ystartTime = (now - datetime.timedelta(days=1)).replace(hour=0, minute=0, second=0, microsecond=0)
+    tstartTime = (now + datetime.timedelta(days=1)).replace(hour=0, minute=0, second=0, microsecond=0)
+
+    resALL = getData_online("towbarmain", '*', "'%s' < 创建时间 and 创建时间 <'%s'" % (startTime, tstartTime))
+    yresALL = getData_online("towbarmain", '*', "'%s' < 创建时间 and 创建时间 <'%s'" % (ystartTime, startTime))
+    res=function10(resALL)
+    yres = function10(yresALL)
+    return(res,yres)
+def function10(res):
+    ress={}
+    if res and res !=None and len(res) !=0:
+        for i in res:
+            if i[11] !="" and i[9] !="":
+                costtime= math.ceil((datetime.datetime.strptime(i[11].split(".")[0], "%Y-%m-%d %H:%M:%S")- datetime.datetime.strptime(i[9].split(".")[0], "%Y-%m-%d %H:%M:%S")).total_seconds()/60)
+            else:
+                costtime=""
+            ress[i[12]]={"创建时间":i[8].split(".")[0],"耗时":costtime,"任务号":i[12]}
+    return ress
+
+
+def initFlightDatabase1(datatime):
+    database = flightDB(host=online_host,
+                        port=online_port,
+                        user=user1,
+                        password=online_password,
+                        database=databasefileDB
+                        )
+    try:
+        dataListDic = {}
+        primaryKey = 'SERIAL PRIMARY KEY'
+        for key8 in list(dataListLabel)[1:]:
+            dataListDic[key8] = 'text not null'
+        database.initTable('dataList{}'.format(datatime), "序号", primaryKey, dataListDic)
+        database.close()
+    except Exception:
+        database.close()
+        print(traceback.format_exc())
+
+def getData_online(tablename, data, key):
+    fdb = flightDB(host=online_host,
+                   port=online_port,
+                   user=user1,
+                   password=password,
+                   database=databasefileDB
+                   )
+    try:
+        res = fdb.queryTabel(tablename, data, key)
+        fdb.close()
+        return res
+    except Exception:
+        fdb.close()
+        print(traceback.format_exc())
+        return []
+
+def DataDBUtilsgetData(tablename,data,key):
+    fdb = flightDB(host=host,
+                   port=port,
+                   user=user1,
+                   password=password,
+                   database=flightDatedb,
+                   )
+    try:
+        res = fdb.queryTabel(tablename, data, key)
+        fdb.close()
+        return res
+    except Exception:
+        fdb.close()
+        print(traceback.format_exc())
+        return []
+

+ 0 - 0
Functions/__init__.py


+ 282 - 0
Functions/flaskDBUtils4PG.py

@@ -0,0 +1,282 @@
+import datetime
+import time
+from .DButilsFunction import flightDB
+
+loginsts = 'loginsts'
+logintoken = 'logintoken'
+infolog = 'infolog'
+IpPhoneip='IpPhoneip'
+callingPhone='callingPhone'
+vin="vin"
+
+
+class flaskDB(flightDB) :
+    def __init__(self , host , port , user , password , database) :
+        super(flaskDB , self).__init__(host = host , port = port , user = user , password = password ,
+                                       database = database)
+        # self._dir = './DATABASE'
+        # self.conn = sqlite3.connect(os.path.join(self._dir,DBName))
+        # self.c = self.conn.cursor()
+
+    def insertManyData(self , sql: str , data_list: list) :
+        self.c.executemany(sql , data_list)
+        self.conn.commit()
+
+
+def initIpPhoneip(db: flaskDB) :
+    db.initTable(IpPhoneip , 'ID' , 'INTEGER PRIMARY KEY NOT NULL' , { 'ip' : 'text' , 'token' : 'text' })
+    result = db.getAlldata(IpPhoneip)
+    if result == [ ] :
+        db.insertData('IpPhoneip' , { 'ID' : 1 , 'ip' : 'None' , 'token' : 'None' })
+
+
+def initVin(db: flaskDB) :
+    db.initTable(vin , 'ID' , 'INTEGER PRIMARY KEY NOT NULL' , { 'VINA' : 'text' , 'VINB' : 'text' })
+    result = db.getAlldata(vin)
+    if result == [ ] :
+        db.insertData('vin' , { 'ID' : 1 , 'VINA' : '%s' % time.time() , 'VINB' : '%s' % time.time() })
+        db.insertData('vin' , { 'ID' : 2 , 'VINA' : '%s' % time.time() , 'VINB' : '%s' % time.time() })
+        db.insertData('vin' , { 'ID' : 3 , 'VINA' : '%s' % time.time() , 'VINB' : '%s' % time.time() })
+
+
+def initcallingPhone(db: flaskDB) :
+    db.initTable(callingPhone , 'ID' , 'INTEGER PRIMARY KEY NOT NULL' , { 'phonenumber' : 'text' , 'time' : 'text' })
+    result = db.getAlldata(callingPhone)
+    if result == [ ] :
+        db.insertData('callingPhone' , { 'ID' : 1 , 'phonenumber' : 'None' , 'time' : 'None' })
+
+
+def initLoginsts(db: flaskDB) :
+    db.initTable(loginsts , 'ID' , 'INTEGER PRIMARY KEY NOT NULL' , { 'sts' : 'int' })
+    result = db.getAlldata(loginsts)
+    if len(result) != 2 :
+        try:
+            db.insertData('loginsts' , { 'ID' : 1 , 'sts' : 0 })
+        except:
+            pass
+        try:
+            db.insertData('loginsts' , { 'ID' : 2 , 'sts' : 0 })
+        except:
+            pass
+
+
+def initLoginToken(db: flaskDB) :
+    db.initTable(logintoken , 'ID' , 'INTEGER PRIMARY KEY NOT NULL' , { 'username' : 'text' , 'token' : 'text' })
+    result = db.getAlldata(logintoken)
+    if len(result) != 2 :
+        try:
+            db.insertData(logintoken , { 'ID' : 1 , 'username' : 'None' , 'token' : 'None' })
+        except:
+            pass
+        try:
+            db.insertData(logintoken , { 'ID' : 2 , 'username' : 'None' , 'token' : 'None' })
+        except:
+             pass
+
+
+def initInfolog(db: flaskDB) :
+    db.initTable(infolog , 'ID' , 'SERIAL PRIMARY KEY' , { 'datatime' : 'text' , 'sts' : 'text' })
+
+
+def checkLogin(db: flaskDB) :
+    initLoginsts(db)
+    result = db.queryTabel(loginsts , 'sts' , 'ID=1')
+    if result[0][0] == 1 :
+        # print('已登录')
+        return 1
+    else :
+        return 0
+
+
+def checkLoginflightplan(db: flaskDB) :
+    initLoginsts(db)
+    result = db.queryTabel(loginsts , 'sts' , 'ID=2')
+    if result[ 0 ][ 0 ] == 1 :
+        # print('已登录')
+        return 1
+    else :
+        return 0
+
+
+def logout(db: flaskDB) :
+    initLoginsts(db)
+    initLoginToken(db)
+    db.upDateItem(loginsts , { 'sts' : 0 } , 'ID=1')
+    db.upDateItem(logintoken , { 'username' : "'None'" , 'token' : "'None'" } , 'ID=1')
+
+
+def logoutflightplan(db: flaskDB) : #飞机排班掉线会直接摧毁amro登录
+    initLoginsts(db)
+    initLoginToken(db)
+    db.upDateItem(loginsts , { 'sts' : 0 } , 'ID=2')
+    db.upDateItem(loginsts , { 'sts' : 0 } , 'ID=1')
+    db.upDateItem(logintoken , { 'username' : "'None'" , 'token' : "'None'" } , 'ID=1')
+    db.upDateItem(logintoken , { 'username' : "'None'" , 'token' : "'None'" } , 'ID=2')
+
+
+def setIpPhone(db: flaskDB , ip , token) :
+    initIpPhoneip(db)
+    db.upDateItem(IpPhoneip , { 'ip' : "'%s'" % ip , 'token' : "'{}'".format(token) } , 'ID=1')
+
+
+def callingphoneUpdate(db: flaskDB , phonenumber , time) :
+    initcallingPhone(db)
+    db.upDateItem(callingPhone , { 'phonenumber' : "'%s'" % phonenumber , 'time' : "'%s'" % time } , 'ID=1')
+
+
+def getPhoneNum(db: flaskDB) :
+    initcallingPhone(db)
+    res = db.queryTabel(callingPhone , "phonenumber" , "ID = '1'")[ 0 ][ 0 ]
+    return res
+
+
+def getVin(db: flaskDB , mode , num) :
+    initVin(db)
+
+    if num == 1 :  # 昨天
+        res = db.queryTabel(vin , "VIN%s" % mode , "ID = '1'")[ 0 ][ 0 ]
+    elif num == 2 :  # 今天
+        res = db.queryTabel(vin , "VIN%s" % mode , "ID = '2'")[ 0 ][ 0 ]
+    elif num == 3 :  # 明天
+        res = db.queryTabel(vin , "VIN%s" % mode , "ID = '3'")[ 0 ][ 0 ]
+    return res
+
+
+def getallVin(db: flaskDB) :
+    initVin(db)
+    res = [ ]
+    for mode in [ "A" , "B" ] :
+        for num in [ 1 , 2 , 3 ] :
+            res.append(db.queryTabel(vin , "VIN%s" % mode , "ID = '%s'" % num)[ 0 ][ 0 ])
+    return res
+
+
+def updateVin(db: flaskDB , mode , num) :
+    initVin(db)
+    Vin = time.time()
+    if num == 1 :
+        db.upDateItem(vin , { 'VIN%s' % mode : "'%s'" % Vin } , 'ID=1')
+    elif num == 2 :
+        db.upDateItem(vin , { 'VIN%s' % mode : "'%s'" % Vin } , 'ID=2')
+    elif num == 3 :
+        db.upDateItem(vin , { 'VIN%s' % mode : "'%s'" % Vin } , 'ID=3')
+    return Vin
+
+
+def updateALlVin(db: flaskDB) :
+    initVin(db)
+    Vin = time.time()
+    for mode in [ "A" , "B" ] :
+        for num in [ 1 , 2 , 3 ] :
+            db.upDateItem(vin , { 'VIN%s' % mode : "'%s'" % Vin } , 'ID=%s' % num)
+
+
+def getIpPhoneip(db: flaskDB) :
+    initIpPhoneip(db)
+    res1 = { "ip" : "" , "token" : "" }
+    res = db.queryTabel(IpPhoneip , "*" , "ID = '1'")
+    if res[ 0 ][ 2 ] != None :
+        res1 = { "ip" : "%s" % res[ 0 ][ 1 ] , "token" : "%s" % res[ 0 ][ 2 ] }
+        return res1
+    else :
+        return res1
+
+
+def login(db: flaskDB , user , token , x_access_token) :
+    initLoginsts(db)
+    initLoginToken(db)
+    db.upDateItem(loginsts, { 'sts' : 1 } , 'ID=1')
+    db.upDateItem(loginsts, { 'sts' : 1 } , 'ID=2')
+    db.upDateItem(logintoken, { 'username' : user , 'token' : "'{}'".format(token) } , 'ID=1')
+    db.upDateItem(logintoken, { 'username' : user , 'token' : "'{}'".format(x_access_token) } , 'ID=2')
+
+
+def getToken(db: flaskDB) :
+    initLoginToken(db)
+    result = db.getAlldata(logintoken)
+    # print(result)
+    return result[ 0 ][ 2 ] , result[ 1 ][ 2 ]
+
+
+def insertinfolog(db: flaskDB , datatime , sts) :
+    initInfolog(db)
+    db.insertData(infolog , { 'datatime' : "{}".format(datatime) , 'sts' : "{}".format(sts) })
+
+
+def updatecheck(db: flaskDB) :
+    now = datetime.datetime.now()
+    testtime = (now - datetime.timedelta(minutes = 6)).strftime("%Y%m%d %H:%M:%S")
+    log_str = db.queryTabel(infolog , "ID" , "datatime >'%s' and sts = '200'" % testtime)
+    if log_str == [ ] :
+        updatests = "0"
+    else :
+        updatests = "1"
+    return updatests
+
+
+def clearinfolog(db: flaskDB) :
+    initInfolog(db)
+    now = datetime.datetime.now()
+    passtime = (now - datetime.timedelta(days = 1)).strftime("%Y%m%d %H:%M:%S")
+    log_str = db.queryTabel(infolog , "ID" , "datatime <'%s'" % passtime)
+    if log_str != [ ] :
+        for i in log_str :
+            db.deleteSingledata(infolog , "ID='%s'" % i[ 0 ])
+
+
+def getinfolog(db: flaskDB) :
+    initLoginsts(db)
+    result = db.getAlldata(infolog)
+    # print(result)
+    return result
+
+
+def testInsertMany(db: flaskDB) :
+    initInfolog(db)
+    sql = "insert into infolog (datatime, sts) values (?, ?);"
+    data_list = [ ]
+    for i in range(1000) :
+        nowDay = datetime.datetime.now()
+        nowDayStr = nowDay.strftime("%Y%m%d")
+        nowStr = nowDay.strftime("%Y%m%d %H:%M:%S")
+        data_list.append((nowStr , '200'))
+    time1 = time.time()
+    db.insertManyData(sql , data_list)
+    # print("插入多条数据:{}".format(time.time()-time1))
+
+
+def testInsert(db: flaskDB) :
+    for i in range(1000) :
+        nowDay = datetime.datetime.now()
+        nowDayStr = nowDay.strftime("%Y%m%d")
+        nowStr = nowDay.strftime("%Y%m%d %H:%M:%S")
+        insertinfolog(db , nowStr , '200')
+
+
+if __name__ == '__main__' :
+    flaskDB = flaskDB(host = '192.168.2.65' ,
+                      port = '9527' ,
+
+                      # host='101.42.5.211', #测试服务器
+                      # port='5444',
+
+                      user = 'user1' ,
+                      password = 'a123456s' ,
+                      database = "flaskDatabase"
+                      )
+    initLoginsts(flaskDB)
+    # flaskDB.insertData('loginsts', {'ID':1,'sts':1})
+    # checkLogin(flaskDB)
+    # login(flaskDB, '022673', '7de7ce62-e02f-4f9e-bcec-03b9084e890d')
+    # checkLogin(flaskDB)
+    # logout(flaskDB)
+    #
+    # getToken(flaskDB)
+
+    testInsertMany(flaskDB)
+
+    time1 = time.time()
+    testInsert(flaskDB)
+    print('插入时间:{}'.format(time.time() - time1))
+
+

+ 179 - 0
Functions/ipFind.py

@@ -0,0 +1,179 @@
+import ipaddress
+import re
+import subprocess
+
+
+# 执行windows命令
+def exec_command(commands) -> list:
+    """执行windows命令"""
+    if not commands:
+        return list()
+    # 子进程的标准输出设置为管道对象
+    if isinstance(commands, str):
+        commands = [commands]
+    return_list = []
+    for i in commands:
+        p = subprocess.Popen(i, shell=True, stdout=subprocess.PIPE, universal_newlines=True)
+        p.wait()
+        res = "".join(p.stdout.readlines())
+        return_list.append(res)
+    return return_list
+
+
+def get_net_card():
+    """
+    功能:通过ipconfig返回的文本解析网卡名字、ip、掩码、网关等信息
+    注释:简单做了注释
+    测试:在window10 专业版测试通过(可以检测到以太网两个(包含手机、网线)、wifi一个)
+    测试反馈:如果使用发现其余问题可以反馈到 sunnylishaoxu@163.com,非常感谢
+    说明一:
+       默认网关. . . . . . . . . . . . . : fe80::10b1:1865:86e8:ad10%41
+                                           172.20.10.1
+    """
+    net_card_data = list()
+    res = exec_command("ipconfig")
+    temp_dict = dict(flag=True)
+    gateway_error = False
+
+    for x in res[0].splitlines():
+
+
+        try:
+            # 匹配IP正则
+            pattern = re.compile(r'((2(5[0-5]|[0-4]\d))|[0-1]?\d{1,2})(\.((2(5[0-5]|[0-4]\d))|[0-1]?\d{1,2})){3}')
+            # 测试发现有的网关会默认在下一行,情况见说明一,所以这边检查到默认网关,发现没有匹配到,则从下一行找
+            if gateway_error:
+                temp_dict['gateway1'] = pattern.search(x).group()
+                gateway_error = False
+                #print("当前网卡 %s 获取第二行网关信息 %s" % (temp_dict['card_name'], temp_dict['gateway1']))
+                continue
+            # 如果发现新的适配器,则重置上一个网卡是否可用的状态
+            if "适配器" in x:
+                temp_dict = dict(flag=True)
+                temp_dict['card_name'] = x.split(" ", 1)[1][:-1]
+                #print("当前网卡 %s" % (temp_dict['card_name']))
+                continue
+            if "IPv4 地址" in x:
+                temp_dict['ip'] = pattern.search(x).group()
+                #print("当前网卡 %s 获取IP信息 %s" % (temp_dict['card_name'], temp_dict['ip']))
+                continue
+            elif "子网掩码" in x:
+                temp_dict['mask'] = pattern.search(x).group()
+                #print("当前网卡 %s 获取子网掩码信息 %s" % (temp_dict['card_name'], temp_dict['mask']))
+                continue
+            # 测试发现有的网关会默认在下一行,情况见说明一,所以这边做了异常处理
+            elif "默认网关" in x:
+                try:
+                    temp_dict['gateway1'] = pattern.search(x).group()
+                    #print("当前网卡 %s 获取默认网关信息 %s" % (temp_dict['card_name'], temp_dict['gateway1']))
+                except:
+                    gateway_error = True
+                    #print("当前网卡 %s 解析当前行默认网关信息错误" % (temp_dict['card_name']))
+
+                # 如果检查到网关,代表当前适配器信息已经获取完毕 重置网关状态与适配器信息字典
+                if temp_dict.get("gateway1"):
+                    net_card_data.append(temp_dict)
+                    #print("当前网卡 %s 当前适配器信息获取完毕 %s \n\n" % (temp_dict['card_name'], temp_dict))
+
+                    temp_dict = dict(flag=True)
+                    continue
+            # 发现媒体已断开则更改当前适配器状态
+            elif "媒体已断开" in x:
+                #print("当前网卡 %s 已断开 跳过\n\n" % (temp_dict['card_name']))
+                temp_dict['flag'] = False
+                continue
+            # 判断媒体状态正常,IP、子网掩码、网关都正常后,保持起来
+            if temp_dict.get("flag") and temp_dict.get("ip") and temp_dict.get("mask") and temp_dict.get("gateway1"):
+                #print("当前网卡 %s 当前适配器信息获取完毕 %s \n\n" % (temp_dict['card_name'], temp_dict))
+                net_card_data.append(temp_dict)
+                # 重置网关状态与适配器信息字典
+                temp_dict = dict(flag=True)
+                continue
+        except Exception as e:
+            # print(e)
+            # print(x)
+            pass
+    # for i in net_card_data:
+    #     print("%s:%s" % (i.get("card_name"), i))
+    return net_card_data
+
+
+# 子网掩码地址转长度
+def netmask_to_bit_length(netmask):
+    """
+    >>> netmask_to_bit_length('255.255.255.0')
+    24
+    >>>
+    """
+    # 分割字符串格式的子网掩码为四段列表
+    # 计算二进制字符串中 '1' 的个数
+    # 转换各段子网掩码为二进制, 计算十进制
+    return sum([bin(int(i)).count('1') for i in netmask.split('.')])
+
+# 子网掩码长度转地址
+def bit_length_to_netmask(mask_int):
+    """
+    >>> bit_length_to_netmask(24)
+    '255.255.255.0'
+    >>>
+    """
+    bin_array = ["1"] * mask_int + ["0"] * (32 - mask_int)
+    tmpmask = [''.join(bin_array[i * 8:i * 8 + 8]) for i in range(4)]
+    tmpmask = [str(int(netmask, 2)) for netmask in tmpmask]
+    return '.'.join(tmpmask)
+
+
+def getStartIP(gateway:str,mask:str):
+    gatewayList = gateway.split('.')
+    maskList = mask.split('.')
+    newStartIP=''
+    for i in range(4):
+        bgate = list(bin(int(gatewayList[i])).replace('0b','').zfill(8))
+        bmask = list(bin(int(maskList[i])).replace('0b','').zfill(8))
+        # print('gate:{}'.format(bgate))
+        # print('mask:{}'.format(bmask))
+        ngate = [0, 0, 0, 0, 0, 0, 0, 0]
+        for n in range(8):
+
+
+            if bmask[n]=='0':
+                ngate[n]=0
+            else:
+                ngate[n]=bgate[n]
+        # print("newGate:{}".format(ngate))
+        nbgate = ''
+        for item in ngate:
+            nbgate+=str(item)
+        # print(nbgate)
+        # print('formate gate:{}'.format(int(nbgate, 2)))
+        newStartIP += str(int(nbgate, 2))
+        newStartIP += '.'
+    # print(gatewayList)
+    # print(newStartIP[:-1])
+    return newStartIP[:-1]
+
+def ipFind():
+    res = get_net_card()
+    #print(res)
+    allNetIP = []
+    for i in res:
+        ip = i['gateway1']
+        ipl = ip.split('.')
+
+        mask = i['mask']
+        print(mask)
+        newip = getStartIP(ip, mask)
+        masklen = netmask_to_bit_length(mask)
+        net = ipaddress.ip_network('{}/{}'.format(newip, masklen))
+
+        for x in net.hosts():
+
+            allNetIP.append(str(x))
+
+    return allNetIP
+
+
+
+if __name__ == '__main__':
+    allNetIP = ipFind()
+    print(allNetIP)

+ 56 - 0
Functions/ipcall.py

@@ -0,0 +1,56 @@
+from selenium import webdriver
+from selenium.webdriver.chrome.options import Options
+
+
+class searchinfo(object):
+    def __init__(self):
+        self.token1 = None
+
+    def start(self,ip):
+        self.token1=self.login(ip)
+        return self.token1
+
+    def login(self,ip):
+        try:
+            #return "test" + str(datetime.datetime.now())
+            chrome_options = Options()
+            chrome_options.add_argument("--headless")
+            chrome_options.add_experimental_option("detach",True)
+            chrome_options.add_argument("window-size=1920x1080")
+            chrome_options.add_argument("--start-maximized")
+            chrome_options.add_argument('--disable-gpu')  # 如果不加这个选项,有时定位会出现问题
+            browser = webdriver.Chrome(
+                executable_path=r'D:\flightinfo\Google\Chrome\Application\chromedriver.exe',
+                options=chrome_options)
+            browser.set_window_size(width=2000,height=300)
+            browser.get("http://%s/"%ip)
+            browser.find_element_by_id("username").send_keys("adminadmin")
+            browser.find_element_by_id("password").send_keys("adminadmin")
+            browser.find_element_by_id("logonButton").click()
+            # print(browser.get_cookies())
+            for cookie in browser.get_cookies():
+                #print(str(browser.get_cookies()))
+                if "keepOnLine" not in str(browser.get_cookies()):
+                    browser.get("http://%s/" % ip)
+                    browser.switch_to.frame("title_top")
+                    browser.find_element_by_id("enableSessionTimeout").click()
+                if "keepOnLine" in cookie.values() and cookie["value"] == "false":
+                    browser.get("http://%s/" % ip)
+                    browser.switch_to.frame("title_top")
+                    browser.find_element_by_id("enableSessionTimeout").click()
+            for cookie in browser.get_cookies():
+                #print(str(browser.get_cookies()))
+                if "auth" in cookie.values():
+                    return "auth=" + cookie["value"] + ";CUR_LANG=cn;" + "CTCPgSz=10;" + "keepOnLine=true"
+                else:
+                    return "fail"
+        except Exception:
+            return "fail"
+
+        #print(str(browser.get_cookies()))
+
+
+if __name__ == '__main__':
+    fl = searchinfo()
+
+

+ 19 - 0
Functions/openPdf.py

@@ -0,0 +1,19 @@
+
+import os
+import subprocess
+import sys
+import tempfile
+
+
+def open_with_system_viewer(pdf_data):
+    with tempfile.NamedTemporaryFile(suffix='.pdf', delete=False) as f:
+        f.write(pdf_data)
+        temp_path = f.name
+
+    # 打开系统默认阅读器
+    if sys.platform.startswith('darwin'):  # macOS
+        subprocess.call(('open', temp_path))
+    elif os.name == 'nt':  # Windows
+        os.startfile(temp_path)
+    elif os.name == 'posix':  # Linux
+        subprocess.call(('xdg-open', temp_path))

+ 59 - 0
Functions/serverFind.py

@@ -0,0 +1,59 @@
+import random
+import time
+from concurrent.futures import ThreadPoolExecutor
+
+import requests
+
+from .ipFind import ipFind  # 假设ipFind是一个从本地模块导入的函数
+
+
+def task(i):
+    """发送HTTP请求检查服务器状态的任务函数"""
+    sleep_seconds = random.randint(1, 3)
+    # 可选:取消注释以显示线程执行信息
+    # print('线程名称:{},参数:{},睡眠时间:{}'.format(threading.current_thread().name, i, sleep_seconds))
+    try:
+        # 随机延迟,减少请求风暴
+        time.sleep(sleep_seconds)
+        # 发送请求并设置合理的超时时间
+        r = requests.get(f'http://{i}:5001/findserver', timeout=3).text
+    except requests.exceptions.ConnectTimeout:
+        # 连接超时处理
+        r = '0'
+    except requests.exceptions.ReadTimeout:
+        # 读取超时处理
+        r = '0'
+    except requests.exceptions.ConnectionError:
+        # 连接错误处理
+        r = '0'
+    except Exception as e:
+        # 其他异常处理
+        #print(f"请求处理异常: {e}")
+        r = '0'
+    return [i, r]
+
+
+def findServer():
+    """查找可用服务器的主函数"""
+    time1 = time.time()
+    # 创建线程池,设置合理的最大工作线程数
+    with ThreadPoolExecutor(max_workers=500) as pool:
+        # 获取所有IP地址
+        allIP = ipFind()
+        # 使用线程池并行执行任务
+        result = list(pool.map(task, allIP))
+
+    print(f'耗时:{time.time() - time1}')
+
+    # 筛选可用服务器
+    serverList = []
+    for item in result:
+        if item[1] == '1':
+            serverList.append(item)
+
+    return serverList
+
+
+if __name__ == '__main__':
+    l = findServer()
+    print("可用服务器列表:", l)

+ 510 - 0
Functions/utils.py

@@ -0,0 +1,510 @@
+import datetime
+import json
+import time
+
+import requests
+from selenium import webdriver
+from selenium.webdriver import ActionChains
+from selenium.webdriver.chrome.options import Options
+from selenium.webdriver.common.by import By
+from selenium.webdriver.support import expected_conditions as EC
+from selenium.webdriver.support.wait import WebDriverWait
+
+
+class flight_list(object):
+
+    def __init__(self):
+
+        self.flightplanurl = r"http://172.30.142.253"
+        self.url = r"http://me.sichuanair.com/login.shtml"
+        self.login_url = "https://login.sichuanair.com/idp/AuthnEngine?currentAuth=urn_oasis_names_tc_SAML_2.0_ac_classes_BAMUsernamePassword"
+        self.flight_list_url = "https://me.sichuanair.com/api/v1/plugins/LM_FLIGHT_LIST"
+        self.flight_list_third_url = "https://me.sichuanair.com/api/v1/plugins/LM_FLIGHT_THIRD_LIST"
+        self.task_flight_list_url="https://me.sichuanair.com/api/v1/plugins/LM_TASK_ASSIGNMENT_LIST"
+        self.LM_FJ_TASK_PG="https://me.sichuanair.com/api/v1/plugins/LM_FJ_TASK_PG"
+        self.task_filght_third_list_url="https://cscsupplier.sichuanair.com/api/v1/plugins/LM_TASK_ASSIGNMENT_THIRD_LIST"
+        self.LM_TSK_DINGDONG_url ="https://cscsupplier.sichuanair.com/api/v1/plugins/LM_TSK_DINGDONG"
+        self.LM_TSK_SURE_PG_url="https://cscsupplier.sichuanair.com/api/v1/plugins/LM_TSK_SURE_PG"
+        self.LM_TSK_EMP_PGLIST_url="https://cscsupplier.sichuanair.com/api/v1/plugins/LM_TSK_EMP_PGLIST"
+        self.MM_GJJH_LIST="https://cscsupplier.sichuanair.com/api/v1/plugins/MM_GJJH_LIST"
+        self.LM_TSK_HANDOVER_url="https://cscsupplier.sichuanair.com/api/v1/plugins/LM_TSK_HANDOVER"
+        self.LM_FLIGHT_SEARCH_LIST='https://cscsupplier.sichuanair.com/api/v1/plugins/LM_FLIGHT_SEARCH_LIST'
+        self.LM_TASK_ARCHIVE_LIST='https://cscsupplier.sichuanair.com/api/v1/plugins/LM_TASK_ARCHIVE_LIST'
+        self.jobcard='https://cscsupplier.sichuanair.com'
+
+        self.token = None
+        self.flightplantoken = None  #飞机排班token
+        #amro状态
+        self.amro_status = 0
+        self.flight_list_json = None
+        self.flight_list_third_json = None
+
+
+    def start(self, username, password):
+        try:
+            self.token = self.login(username, password)
+        except Exception:
+            pass
+        try:
+            self.flightplantoken = self.loginflight(username, password)
+        except Exception:
+            print("飞机排班系统登录失败")
+            pass
+
+        return self.token, self.flightplantoken
+
+    def login(self, username, password):
+        try:
+
+            options = webdriver.EdgeOptions()
+            options.use_chromium = True
+            #options.add_experimental_option('excludeSwitches', ['enable-logging'])
+            #options.add_argument("headless")
+            #options.add_argument("disable-gpu")
+            #options.add_argument('start-maximized')
+            #options.add_argument('window-size=1920x1080')
+            self.driver = webdriver.Edge(options=options)
+            self.actions = ActionChains(self.driver)
+        except:
+            chrome_options = Options()
+            chrome_options.add_argument("--headless")
+            chrome_options.add_argument("window-size=1920x1080")
+            chrome_options.add_argument("--start-maximized")
+            chrome_options.add_argument('--disable-gpu')  # 如果不加这个选项,有时定位会出现问题
+            self.driver = webdriver.Chrome(executable_path=r'D:\flightinfo\Google\Chrome\Application\chromedriver.exe',
+                                           # executable_path=path
+                                           options=chrome_options)
+
+            self.actions = ActionChains(self.driver)
+
+
+        self.driver.get(self.url)
+        WebDriverWait(self.driver, 10).until(EC.presence_of_element_located((By.ID, 'singleSubmit')))
+        loginbtn = self.driver.find_element('id', 'singleSubmit')
+        time.sleep(0.5)
+        self.actions.click(loginbtn)
+        self.actions.perform()
+        WebDriverWait(self.driver, 10).until(EC.presence_of_element_located((By.NAME, "j_username"))).send_keys(
+            username)
+        time.sleep(0.5)
+        self.driver.find_element('name', "j_password").send_keys(password)
+        #time.sleep(0.5)
+        time.sleep(0.5)
+        self.driver.find_element_by_xpath("//button[@type='button']").click()
+        time.sleep(1)
+        for cookie in self.driver.get_cookies():
+            if "_amro_sk" in cookie.values():
+                self.amro_status = 1
+                self.driver.quit()
+                return "_amro_sk=" +cookie["value"]
+            else:
+                pass
+        self.driver.quit()
+    def loginflight(self , username , password) :#飞机排班
+        try :
+
+            options = webdriver.EdgeOptions()
+            options.use_chromium = True
+            # options.add_experimental_option('excludeSwitches', ['enable-logging'])
+            # options.add_argument("headless")
+            # options.add_argument("disable-gpu")
+            # options.add_argument('start-maximized')
+            # options.add_argument('window-size=1920x1080')
+            self.driver = webdriver.Edge(options = options)
+            self.actions = ActionChains(self.driver)
+        except :
+            chrome_options = Options()
+            chrome_options.add_argument("--headless")
+            chrome_options.add_argument("window-size=1920x1080")
+            chrome_options.add_argument("--start-maximized")
+            chrome_options.add_argument('--disable-gpu')  # 如果不加这个选项,有时定位会出现问题
+            self.driver = webdriver.Chrome(executable_path = r'D:\flightinfo\Google\Chrome\Application\chromedriver.exe' ,
+                                           # executable_path=path
+                                           options = chrome_options)
+
+            self.actions = ActionChains(self.driver)
+
+        self.driver.get(self.flightplanurl)
+        WebDriverWait(self.driver , 10).until(EC.presence_of_element_located((By.NAME , "j_username"))).send_keys(
+            username)
+        time.sleep(0.5)
+        self.driver.find_element('name' , "j_password").send_keys(password)
+        # time.sleep(0.5)
+        time.sleep(0.5)
+        self.driver.find_element_by_xpath("//button[@type='button']").click()
+        time.sleep(1)
+        for cookie in self.driver.get_cookies() :
+            if "X-Access-Token" in cookie.values() :
+                self.amro_status = 1
+                self.driver.quit()
+                return cookie["value"]
+            else :
+                pass
+        self.driver.quit()
+    def get_cookie(self):
+        if self.token!=None:
+            return self.token
+        else:
+            return None
+
+    def checkCookieSts(self,cookie):
+        url = "https://me.sichuanair.com/api/v1/plugins/PROCESS_CLAIM_TASK_PRO_LIST"
+        data = {
+            'user_id': '',
+            'userId': '',
+            'accountType': 'ARCHIVE',
+            'page': '1',
+            'rows': '11'
+        }
+        header = {"Accept": "application/json, text/javascript, */*; q=0.01",
+                  "Cookie": cookie}
+        result = requests.post(url, data, headers=header).json()
+
+        #print(result['code'], result['msg'], result['data'])
+        return result['code']
+
+    def checkCookieStsFLIGHTplan(self,cookie):
+        url = "http://172.30.142.253/platform/api/act/act/task/execute/count"
+        params = {"_t": int(datetime.datetime.now().timestamp())}
+        header = {
+                "Content-Type" : "application/json;charset=UTF-8" ,  # 明确请求体为 JSON 格式
+                "Accept" : "application/json, text/plain, */*" ,
+                "User-Agent" : "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/139.0.0.0 Safari/537.36 Edg/139.0.0.0" ,
+                "X-Access-Token": cookie}
+        result = requests.get(url, params, headers=header).json()
+
+        #print(result['code'])
+        return result['code']
+
+
+    def checkWorkjob(self,taskids,acno,taskType,actype,startDate,endDate,cookie):
+        data = {"taskids": taskids,
+                "acno": acno,
+                "taskType": taskType,
+                "actype": actype,
+                "startDate": startDate,
+                "endDate": endDate
+                }
+        header = {"Accept": "application/json, text/javascript, */*; q=0.01",
+                  "Cookie": cookie}
+        try:
+            self.LM_FJ_TASK_PG_json = requests.post(url=self.LM_FJ_TASK_PG, data=data, headers=header).json()
+        except Exception:
+            self.LM_FJ_TASK_PG_json = None
+        return  self.LM_FJ_TASK_PG_json
+
+    def request_jobcard(self, cookie, filename):  # 需要自动逻辑白班夜班
+        one_year_later = datetime.datetime.now() + datetime.timedelta(days=365)
+        timestamp = int(one_year_later.timestamp()*1000)
+        header = {
+            "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7",
+            "Cookie": cookie}
+        try:
+            task_jobcard_json = requests.get(url=f'https://cscsupplier.sichuanair.com{filename}?_cache_timestamp={timestamp}',headers=header).content
+        except Exception:
+            task_jobcard_json = None
+        return task_jobcard_json
+
+    def request_MM_GJJH_LIST(self,cookie):
+        yesterday=(datetime.date.today() - datetime.timedelta(days=1)).strftime("%Y-%m-%d")
+        today = datetime.date.today().strftime("%Y-%m-%d")
+        data={"mfrpn":"",
+            "zjcdats": yesterday,
+            "zjcdate": today,
+            "zwgh": "Y",
+            "zlynam":"",
+            "zbmtxt":"",
+            "zkstxt":"",
+            "zfdtxt":"",
+            "zlgort": "TF20",
+            "zghnam":"",
+            "ghrbm":"",
+            "ghrks":"",
+            "ghrfd":"",
+            "zghkcd":"",
+            "sort": "ZBMTXT",
+            "order": "asc"
+            }
+        header = {"Accept": "application/json, text/javascript, */*; q=0.01",
+                  "Cookie": cookie}
+        try:
+            self.MM_GJJH_LIST_json = requests.post(url=self.MM_GJJH_LIST, data=data, headers=header).json()
+        except Exception:
+            self.MM_GJJH_LIST_json = None
+        return self.MM_GJJH_LIST_json
+    def request_flight_from_flightplan(self,startday,endday,token) : #从飞机排班获取
+        url = "http://172.30.142.253/platform/api/dynamic/tfltschedule/selectByCondition"
+        headers = {
+            "Content-Type" : "application/json;charset=UTF-8" ,
+            "Accept" : "application/json, text/plain, */*" ,
+            "User-Agent" : "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/139.0.0.0 Safari/537.36 Edg/139.0.0.0" ,
+            "X-Access-Token" : token
+        }
+        payload = {
+            "flightDateStart": startday,
+            "flightDateEnd" : endday,
+            "haveDelay" : 0
+        }
+
+        try:
+            response = requests.post(url = url,headers = headers,data = json.dumps(payload),timeout = 10)
+            response.raise_for_status()
+            response_data = response.json()
+            return response_data
+
+        except requests.exceptions.Timeout :
+            print("请求超时!请检查网络连接或接口响应速度。")
+        except requests.exceptions.ConnectionError :
+            print("连接失败!请检查接口 URL 是否正确,或目标服务器是否可达。")
+        except requests.exceptions.HTTPError as e :
+            print(f"请求失败(状态码异常):{e}")
+            print(f"服务器返回内容:{response.text}")  # 打印原始响应,辅助排查问题
+        except json.JSONDecodeError :
+            print("响应解析失败!服务器返回的不是合法 JSON 格式。")
+            print(f"原始响应内容:{response.text}")
+        except Exception as e :
+            print(f"请求过程中发生未知错误:{str(e)}")
+
+    def request_task_filght_list(self, flightDate:str,cookie):   #需要自动逻辑白班夜班
+        data = {"airportCode": "ZUTF",
+                "ddate": flightDate,
+                "notView":"",
+                "baseCode": "TF01",
+                "actype1":"(A319|A320|A321)",
+                "aclocArea1": "()",
+                "tasktype1": "()",
+                "shift":"",
+                "tasktype":"",
+                "actype": "A319,A320,A321",
+                "aclocArea":"",
+                "isshiftex":"",
+                "repush":"",
+                "page": "1",
+                "rows": "500"
+                }
+        header = {"Accept": "application/json, text/javascript, */*; q=0.01",
+                  "Cookie": cookie}
+        try:
+            self.task_flight_list_json = requests.post(url=self.task_flight_list_url, data=data, headers=header).json()
+        except Exception:
+            self.task_flight_list_json = None
+        #with open('./temp/task_flight_list_json/fl{}.json'.format(int(time.time())), 'w') as f:
+            #json.dump(self.task_flight_list_json, f, indent=4)
+
+        return self.task_flight_list_json
+
+
+    def request_task_filght_third_list(self, flightDate:str, cookie):   #需要自动逻辑白班夜班
+        data = {"airportCode": "ZUTF",
+                "ddate": flightDate,
+                "notView":"",
+                "baseCode": "TF01",
+                "isThird": "Y",
+                "actype1":"",
+                "aclocArea1": "()",
+                "tasktype1": "()",
+                "shift":"",
+                "tasktype":"",
+                "actype": "(A319|A320|A321|B737NG|B737MAX|C919)",
+                "aclocArea":"",
+                "isshiftex":"",
+                "repush":"",
+                "page": "1",
+                "rows": "500"
+                }
+        header = {"Accept": "application/json, text/javascript, */*; q=0.01",
+                  "Cookie": cookie}
+        try:
+            self.task_filght_third_list = requests.post(url=self.task_filght_third_list_url, data=data, headers=header).json()
+        except Exception:
+            self.task_filght_third_list = None
+        #with open('./temp/task_filght_third_list/fl{}.json'.format(int(time.time())), 'w') as f:
+        #    json.dump(self.task_filght_third_list, f, indent=4)
+        return self.task_filght_third_list
+
+    def request_LM_TASK_ARCHIVE_LIST(self, flightDate:str, cookie):   #需要自动逻辑白班夜班
+        startdatePlStart=flightDate+" 00:00:00"
+        flightDate2=(datetime.datetime.strptime(flightDate, "%Y%m%d")+datetime.timedelta(days=1)).strftime("%Y%m%d")
+        startdatePlEnd=flightDate2+" 09:00:00"
+        data = {"startdatePlStart": startdatePlStart,
+                "startdatePlEnd": startdatePlEnd,
+                "airportCode":'ZUTF',
+                "taskTypeDefault": "LM",
+                "actype1": '(A319|A320|A321)',
+                "actype": "A319,A320,A321",
+                "baseCode": "TF01",
+                "page":"1",
+                "rows": "500"
+                }
+        header = {"Accept": "application/json, text/javascript, */*; q=0.01","Cookie": cookie}
+        try:
+            self.task_LM_TASK_ARCHIVE_LIST = requests.post(url=self.LM_TASK_ARCHIVE_LIST, data=data, headers=header).json()
+        except Exception:
+            self.task_LM_TASK_ARCHIVE_LIST = None
+        #with open('./temp/task_LM_FLIGHT_SEARCH_LIST/fl{}.json'.format(int(time.time())), 'w') as f:
+        #    json.dump(self.task_LM_FLIGHT_SEARCH_LIST, f, indent=4)
+        return self.task_LM_TASK_ARCHIVE_LIST
+
+    def request_LM_FLIGHT_SEARCH_LIST(self, flightDate:str, cookie):   #需要自动逻辑白班夜班
+        data = {"base4code": "ZUTF",
+                "flightDate": flightDate,
+                "flightDate1":flightDate,
+                "jcType": "",
+                "actype1": '(A319|A320|A321)',
+                "dep_4code": "",
+                "arr_4code": "",
+                "acno":'',
+                "actype": "A319,A320,A321",
+                "flightNo":"",
+                "notView":"",
+                "page":"1",
+                "onlyAf":"",
+                "rows": "500"
+                }
+        header = {"Accept": "application/json, text/javascript, */*; q=0.01","Cookie": cookie}
+        try:
+            self.task_LM_FLIGHT_SEARCH_LIST = requests.post(url=self.LM_FLIGHT_SEARCH_LIST, data=data, headers=header).json()
+        except Exception:
+            self.task_LM_FLIGHT_SEARCH_LIST = None
+        #with open('./temp/task_LM_FLIGHT_SEARCH_LIST/fl{}.json'.format(int(time.time())), 'w') as f:
+        #    json.dump(self.task_LM_FLIGHT_SEARCH_LIST, f, indent=4)
+        return self.task_LM_FLIGHT_SEARCH_LIST
+
+    def request_filght_list(self, flightDate:str, cookie):
+        data = {"base4code": "ZUTF",
+                "flightDate": flightDate,#2023-06-02
+                "tasktype": "",
+                "notView": "",
+                "jcType": "",
+                "actype1": "(A319|A320|A321)",
+                "actype": "A319,A320,A321",
+                "acno": "",
+                "dep_4code": "",
+                "arr_4code": "",
+                "flightNo": "",
+                "repush": ""
+
+                }
+        header = {"Accept": "application/json, text/javascript, */*; q=0.01",
+                  "Cookie": cookie}
+        try:
+            self.flight_list_json = requests.post(url=self.flight_list_url, data=data, headers=header).json()
+        except Exception:
+            self.flight_list_json = None
+        #with open('./temp/filght_list/fl{}.json'.format(int(time.time())), 'w') as f:
+        #    json.dump(self.flight_list_json, f, indent=4)
+        return self.flight_list_json
+
+
+    def request_LM_TSK_HANDOVER(self,dict:dict,cookie):
+        data = {
+                "taskids": dict["taskid"],
+                "tasksts": dict["sts"],  # 必须,可能需要修改,不知道影响不
+                "FunctionCode": "LM_TSK_HANDOVER"
+                }
+        header = {"Accept": "application/json, text/javascript, */*; q=0.01",
+                  "Cookie": cookie}
+        try:
+            self.LM_TSK_HANDOVER = requests.post(url=self.LM_TSK_HANDOVER_url, data=data, headers=header).json()
+            #print(self.LM_TSK_HANDOVER)
+        except Exception:
+            self.LM_TSK_HANDOVER = None
+        return self.LM_TSK_HANDOVER
+
+    def request_LM_TSK_DINGDONG(self,dict:dict,cookie):
+        data = {"tasksts": "1",  # 必须
+                "taskid": "{}".format(dict["taskid"]),
+                "acno": dict["acno"],
+                "actype": dict["actype"],
+                "tasktype": dict["tasktype"],
+                "tatd": dict["tatd"],
+                "msgInfo": dict["msgInfo"],
+                "bay": dict["bay"],
+                "wxemp": dict["wxemp"],  # 必须dict["wxemp"]
+                "fxemp": dict["fxemp"],
+                "wx": dict["wx"],
+                "fx": dict["fx"],
+                "ecsj": dict["ecsj"],
+                "ecsjEmp": "",
+                "FunctionCode": "LM_TSK_DINGDONG"
+                }
+        header = {"Accept": "application/json, text/javascript, */*; q=0.01",
+                  "Cookie": cookie}
+        try:
+            self.LM_TSK_DINGDONG = requests.post(url=self.LM_TSK_DINGDONG_url, data=data, headers=header).json()
+        except Exception:
+            self.LM_TSK_DINGDONG = None
+        return self.LM_TSK_DINGDONG
+    def request_flight_third_list(self, flightDate: str, cookie):
+        data = {"base4code": "ZUTF",
+                "flightDate": flightDate,
+                "flightDateStart": flightDate,
+                "tasktype": "",
+                "notView": "",
+                "isThird":"Y",
+                "actype1": "(21N|319|320|321|32N|332|738|73G|A21N|A319|A319|A320|A321|A32N|A738|A73G|AZZZ|B737|C919|ARJ21)",
+                "actype": "B737NG,B737MAX,A319,A320,A321,C919,ARJ21"
+                #"actype": "A319%2CA320%2CA321%2CB737MAX%2CB737NG"
+                }
+        header = {"Accept": "application/json, text/javascript, */*; q=0.01",
+                  "Cookie": cookie}
+        try:
+            self.flight_third_list = requests.post(url=self.flight_list_third_url, data=data, headers=header).json()
+        except Exception:
+            self.flight_third_list = None
+        #with open('./temp/filght_list/fl{}.json'.format(int(time.time())), 'w') as f:
+        #    json.dump(self.flight_third_list, f, indent=4)
+        return self.flight_third_list
+
+    def request_LM_TSK_SURE_PG(self,dict:dict,cookie):
+        empNos = dict["empNos"]
+        taskid = dict["taskid"]
+        type = dict["type"]
+        shiftDate = dict["shiftDate"]
+        shift = dict["shift"]
+
+        data = {"empNos": empNos,
+                "taskid": taskid,
+                "type": type,                 #ECSJ 二次送机  WX  FX
+                "shiftDate": shiftDate,                   #夜班航前需要前一天
+                "shift": shift,
+                "FunctionCode": "LM_TSK_SURE_PG"
+                }
+        header = {"Accept": "application/json, text/javascript, */*; q=0.01",
+                  "Cookie": cookie}
+        try:
+            #print(data)
+            self.LM_TSK_SURE_PG = requests.post(url=self.LM_TSK_SURE_PG_url, data=data, headers=header).json()
+            #print(self.LM_TSK_SURE_PG )
+        except Exception:
+            self.LM_TSK_SURE_PG = None
+        return self.LM_TSK_SURE_PG
+
+    def request_LM_TSK_EMP_PGLIST(self,taskid:str,shiftDate:str,shift:str,cookie):
+        data = {"flightDate": shiftDate,
+                "shift": shift,
+                "type": "WX",
+                "taskid":taskid,
+                "wx": "wx",
+                "baseCode": "TF01",       #EMP_NO,NAME,MAINLY_ROLE
+                "deptNo": "",
+                "fx": "fx",
+                }
+        header = {"Accept": "application/json, text/javascript, */*; q=0.01",
+                  "Cookie": cookie}
+        try:
+            self.LM_TSK_EMP_PGLIST = requests.post(url=self.LM_TSK_EMP_PGLIST_url, data=data, headers=header).json()
+        except Exception:
+            self.LM_TSK_EMP_PGLIST = None
+        #with open('./temp/LM_TSK_EMP_PGLIST/fl{}.json'.format(int(time.time())), 'w') as f:
+        #    json.dump(self.LM_TSK_EMP_PGLIST, f, indent=4)
+        return self.LM_TSK_EMP_PGLIST
+
+
+
+if __name__ == '__main__':
+    fl = flight_list()
+    #fl.start()
+    nowDay = datetime.datetime.now().replace(microsecond=0)
+    nowDayStr = nowDay.strftime("%Y-%m-%d")
+

+ 1854 - 0
ServerWithJWT.py

@@ -0,0 +1,1854 @@
+import concurrent.futures
+import datetime
+import os
+import random
+import socket
+import time
+import traceback
+from datetime import timedelta
+
+import requests
+from flask import Flask , render_template
+from flask import request , jsonify
+from flask_jwt_extended import JWTManager , create_refresh_token
+from flask_jwt_extended import jwt_required , get_jwt_identity , create_access_token
+from waitress import serve
+
+from Functions import utils , DataComputer as DataComputer , ipcall , flaskDBUtils4PG as flaskDBUtils
+from Functions.DButilsFunction import flightDB , judge_bc as Judge_bc , initFlightDatabase as InitFlightDatabase , \
+    insertTaskDataToTable , sortFlighttime , sortFlighttime2 , checkTFUairplane , \
+    createWorkloadtablesFromPg as CreateWorkloadtablesFromPg , \
+    checkFlightAlert , dingdingDelete_flight , dingdingFlightsts , dingdinginfoget , calledChecked as CalledChecked , \
+    infoConfirm as InfoConfirm , infoConfirm3 as InfoConfirm3 , infoConfirm2 as InfoConfirm2 , \
+    maintainAuthCheck as MaintainAuthCheck , \
+    checkLoadSingal as CheckLoadSingal , changepassword as Changepassword , postgresql_local , \
+    mapDispaly as MapDispaly , \
+    checkPglist as CheckPglist , updateEidteItem as UpdateEidteItem , updateDragDropItem as UpdateDragDropItem , \
+    qtPeopleLoad as QtPeopleLoad , tableWidgetDispaly as TableWidgetDispaly , \
+    tableWidgetDispaly2 as TableWidgetDispaly2 , \
+    tableWidgetDispalyRead2 as TableWidgetDispalyRead2 , tableWidgetDispalyRead as TableWidgetDispalyRead , \
+    bakupdata as Bakupdata , getphonelist as Getphonelist , MM_GJJH_LIST as mM_GJJH_LIST , \
+    checkCalllist as CheckCalllist , \
+    tableWidgetLOGDispaly as TableWidgetLOGDispaly , tableWidgetDisplayChange as TableWidgetDisplayChange , \
+    manAddFlight as ManAddFlight , get_dic as Get_dic , manChangests as ManChangests , insertLogs as InsertLogs , \
+    insertLogs2 as InsertLogs2 , \
+    selftaxiLogs as SelftaxiLogs , taskAtuoCheck as TaskAtuoCheck , deleteFlight as DeleteFlight , \
+    get_empNos as Get_empNos , updateTaskAuto as UpdateTaskAuto , insertCalllist as InsertCalllist , \
+    insertWorkjob as InsertWorkjob , \
+    getRiskData as GetRiskData , saveRisktable as SaveRisktable , updateRiskdb as UpdateRiskdb , \
+    updateStopFlight as UpdateStopFlight , \
+    dealLogs as DealLogs , update_Pglist as Update_Pglist , getWorkjobInfo as GetWorkjobInfo , \
+    mandealAllLogs as MandealAllLogs , \
+    calltry as Calltry , callon as Callon , get_empNos_phoone as Get_empNos_phoone , FlightSearchInsert , \
+    TaskListInsert , checkWorkerlaod_new , \
+    GetPglistInDatabase , Getworkload , HandoverStsChange , ManCahangeWorkload , UpdateNoteItem , postgresql_bakup , \
+    UpdatePeopleScheduleFromOnline , FlightPlanInsert , checkFlightplan
+from unitls.LogerinTxt import app_logger
+from unitls.StaticDataclass import initialize_file , write_status_to_file
+from unitls.settings import DBServer, flightDB4 , DataTransferMode , Server_Class , Main_Sever , databasefileDB , \
+    Oline_flight
+
+#requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
+
+'''
+200 OK:请求成功,常用于GET和POST请求。
+
+201 Created:请求成功并创建了新资源。
+
+301 Moved Permanently:资源已永久移动到新位置。
+
+302 Found:资源临时移动。
+
+400 Bad Request:请求语法错误,服务器无法理解。
+
+401 Unauthorized:请求需要身份验证。
+
+403 Forbidden:服务器拒绝执行请求。
+
+404 Not Found:服务器无法找到请求的资源。
+
+500 Internal Server Error:服务器内部错误,无法完成请求。
+
+503 Service Unavailable:服务器因超载或维护暂时无法处理请求。
+'''
+
+#初始化Flask应用
+app = Flask(__name__)
+app.config['initialized'] = False
+app.config['JWT_SECRET_KEY'] = 'your-secret-key'  # 设置JWT密钥
+# 设置普通JWT过期时间
+app.config["JWT_ACCESS_TOKEN_EXPIRES"] = timedelta(hours=1)
+# 设置刷新JWT过期时间
+app.config["JWT_REFRESH_TOKEN_EXPIRES"] = timedelta(days=30)
+app.config["SECRET_KEY"] = "Can't not guess it ."
+jwt = JWTManager(app)
+dir = os.getcwd()
+
+dbhost, dbport, dbuser, dbpassword,online_host, online_port, online_user, online_password = DBServer()
+mainseverip, maindatabase=Main_Sever()
+backupactive = False #备用服务器激活标注
+database="flaskDatabase"
+databaseDB4 = flightDB4()
+databaseWorkLoad = 'workLoad'
+databaseLoginDB = 'loginDB'
+databasefileDB=databasefileDB()
+SameDatabase,HighRefreh,Online_flight_sts=Oline_flight()
+flightDataTransfer,displayDataTransfer=DataTransferMode()
+ServerClas = Server_Class()
+severVersion = "18.0.0"
+displayVersion = "18.0.0"
+print(f"当前客户端版本:{severVersion}/白板版本:{displayVersion}")
+print(f"当前服务器为:【{ServerClas}】")
+print(f"当前服务器航班数据传输模式为:【{flightDataTransfer}】")
+print(f"当前服务器显示计算请求模式为:【{displayDataTransfer}】")
+print(f"在线编辑模式:【{Online_flight_sts}】")
+print(f"一期二期服务器是否统一:【{SameDatabase}】")
+print(f"在线编辑高刷模式:【{HighRefreh}】")
+VinA1="328"
+VinA2="328"
+VinA3="328"
+VinB1="328"
+VinB2="328"
+VinB3="328"
+
+# 获取本地IP地址
+def get_local_ip():
+    try:
+        s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
+        s.connect(("8.8.8.8", 80))  # 连接到Google DNS服务器
+        ip = s.getsockname()[0]
+        s.close()
+        return ip
+    except:
+        return socket.gethostbyname(socket.gethostname())
+
+def check_a_availability():
+    """检查A服务器的可用性"""
+    try:
+        ip = "http://" + mainseverip + ":5001/static/health"
+        response = requests.get(ip, timeout=5)
+        return response.status_code != 200  #看是否连接成功
+    except Exception as e:
+        return True  #出问题了
+
+# 健康检查接口
+@app.route('/static/health')
+def health_check():
+    try:
+        # 检查数据库连接
+        db = flaskDBUtils.flaskDB(host=dbhost,port=dbport,user=dbuser,password=dbpassword,database=database)
+        db.close()
+        return jsonify({"status": "ok", "msg":{"timestamp": datetime.datetime.now().isoformat()}}), 200
+    except Exception as e:
+        return jsonify({"status": "error", "msg": str(e)}), 500
+
+#userdatabase
+import sqlite3
+def create_user_table():
+    conn = sqlite3.connect('users.db')
+    c = conn.cursor()
+    cur_str = """
+        CREATE TABLE IF NOT EXISTS users (ID INTEGER PRIMARY KEY AUTOINCREMENT, 
+        username TEXT NOT NULL, 
+        password TEXT NOT NULL, 
+        roles TEXT NOT NULL )
+    """
+    c.execute(cur_str)
+    conn.commit()
+    conn.close()
+    print("Table created successfully")
+def insert_user(username, password, roles):
+    conn = sqlite3.connect('users.db')
+    c = conn.cursor()
+    result = query_user(username)
+    if not result:
+        cur_str="""
+        INSERT INTO users (username, password, roles) VALUES ("{}", "{}", "{}")""".format(username, password, roles)
+        c.execute(cur_str)
+        conn.commit()
+        print("User ({}) inserted successfully".format(username))
+    else:
+        print("User {} already exists".format(username))
+    conn.close()
+
+def query_user(username):
+    conn = sqlite3.connect('users.db')
+    c = conn.cursor()
+    cur_str="""
+    SELECT * FROM users WHERE username = "{}" """.format(username)
+    result = c.execute(cur_str).fetchall()
+    return result
+
+def verify_user(username, password):
+    result = query_user(username)
+    if not result:
+        print("User ({}) doesn't exist".format(username))
+        return False
+    else:
+        if result[0][2] == password:
+            return True
+        else:
+            return False
+
+def returnTrue(message, data):
+    return jsonify(msg=message, data=data)
+
+#用户注册与登录
+@app.route('/register', methods=['POST'])
+def register():
+    data = request.get_json()
+    print(data)
+    username = data.get('username')
+    password = data.get('password')
+
+    insert_user(username, password, 'general')
+
+
+
+    return jsonify({'msg': 'User created successfully'}), 201
+
+
+@app.route('/getAccessToken', methods=['POST'])
+def get_access_token():
+    data = request.get_json()
+    username = data.get('username')
+    password = data.get('password')
+
+
+    if verify_user(username, password):
+        access_token = create_access_token(identity=username)
+        refresh_token = create_refresh_token(identity=username)
+        return jsonify(access_token=access_token, refresh_token=refresh_token, msg="Login {} success".format(username)), 200
+
+    return jsonify({'msg': 'Invalid credentials'}), 401
+
+@app.route('/loginTable', methods=['POST'])
+def loginTable():
+    data = request.get_json()
+    username = data.get('username')
+    password = data.get('password')
+    remote_addr = request.remote_addr
+    res1={"返回值":""}
+    #t1 = datetime.datetime.now()
+    loginTabledb = flightDB(host=dbhost,port=dbport,user=dbuser,password=dbpassword,database=databaseLoginDB)
+    #t2 = datetime.datetime.now()
+    #print(f'登录时间:{t2 - t1}')
+    res=loginTabledb.queryTabel('logintable', '*', "登录名='{}' and 密码='{}'".format(username,password))
+    loginTabledb.close()
+    if res !=[]:
+        access_token = create_access_token(identity=username)
+        refresh_token = create_refresh_token(identity=username)
+        res1["返回值"]=res[0]
+        return jsonify(data=res1, access_token=access_token, refresh_token=refresh_token), 200
+    print(datetime.datetime.now(),"[%s]%s尝试登录" %(remote_addr,username))
+    #t3 = datetime.datetime.now()
+    #print(f'处理时间:{t3-t2}')
+    return jsonify(msg=(datetime.datetime.now(),"[%s]%s尝试登录失败" %(remote_addr,username)), data=res1), 401
+
+@app.route('/static/remoteCheck', methods=['POST']) #操作系统版本验证
+def remoteCheck():
+    data = request.get_json()
+    checknumber = data.get('checknumber')
+    if checknumber ==severVersion:
+        res={"返回值":"ok"}
+    else:
+        res={"返回值":severVersion}
+    res['msg']="check server version"
+    return jsonify(res)
+@app.route('/static/remoteCheck2', methods=['POST']) #电子白板系统版本验证
+def remoteCheck2():
+    data = request.get_json()
+    checknumber = data.get('checknumber')
+    if checknumber ==displayVersion:
+        res={"返回值": "ok"}
+    else:
+        res={"返回值": displayVersion}
+    res['msg']="check display version"
+    return jsonify(res)
+
+@app.route('/bakupdata')
+def bakupdata():
+    remote_addr = request.remote_addr
+    fdb = flightDB(host=dbhost,port=dbport,user=dbuser,password=dbpassword,database=databaseDB4)
+    Bakupdata(fdb)
+    fdb.close()
+    print(datetime.datetime.now(), "[%s]5分钟间隔自动备份"%remote_addr)
+    return jsonify(status="ok")
+
+@app.route('/postgresql')
+def postgresql():
+    try:
+        if flightDataTransfer == 1:
+            local = flightDB(host=dbhost,port=dbport,user=dbuser,password=dbpassword,database=databaseDB4)
+            try:
+                postgresql_local(local,online_host,online_port,online_user,online_password,databaseDB4)
+            except:
+                local.close()
+                print(datetime.datetime.now(), "[远端链接失败]云端数据库服务器")
+                return jsonify(status="fail")
+            local.close()
+        if displayDataTransfer == 1:
+            res= DataComputer.mytask()
+            if res == "ok":
+                url = "https://"+online_host+":7162/computerDispalydata"
+                #url = "https://192.168.2.87:5070/computerDispalydata"
+                try:
+                    ress=requests.get(url, verify=False)
+                    ress.raise_for_status()  # 检查HTTP状态码是否为成功
+                    data = ress.json()
+                    #ress=requests.post(url, cert=('D:\\flightinfo\\DATABASE\\sichuanair.com.pem','D:\\flightinfo\\DATABASE\\sichuanair.com.key')).json()
+                    if data == "ok":
+                    #if data.get("result") == "ok":
+                        print(datetime.datetime.now(), "远端显示中心计算请求成功")
+                    else:
+                        print(datetime.datetime.now(), "[返回为fail]远端显示中心计算请求失败")
+                except Exception as e:
+                    print(e)
+                    print(datetime.datetime.now(), "[请求被拒绝]远端显示中心计算请求失败")
+        return jsonify(status="ok", msg=("远端显示中心计算请求成功"))
+    except:
+        print(traceback.format_exc())
+        return jsonify(status="fail", msg=("[返回为fail]远端显示中心计算请求失败"))
+
+def tableWidgetDispalyN(selectedtime,date):
+    #t1 = datetime.datetime.now()
+    fdb = flightDB(host=dbhost,port=dbport,user=dbuser,password=dbpassword,database=databaseDB4)
+    #t2 = datetime.datetime.now()
+    #print(f'航班刷新登录时间:{t2 - t1}')
+    res=TableWidgetDispaly(fdb,selectedtime,date)
+    fdb.close()
+    #print(datetime.datetime.now(),res)
+    remote_addr = request.remote_addr
+    print(datetime.datetime.now(),"[%s]A模式航班信息刷新请求[%s]"%(remote_addr,date))
+    #t3 = datetime.datetime.now()
+    #print(f'航班刷新处理时间:{t3 - t2}')
+    return res
+def tableWidgetDispaly2N(selectedtime,date):
+    fdb = flightDB(host=dbhost,port=dbport,user=dbuser,password=dbpassword,database=databaseDB4)
+    res=TableWidgetDispaly2(fdb,selectedtime,date)
+    fdb.close()
+    remote_addr = request.remote_addr
+    print(datetime.datetime.now(),"[%s]B模式航班信息刷新请求[%s]"%(remote_addr,date))
+    return res
+def updatetimer():
+
+    db = flaskDBUtils.flaskDB(host = dbhost , port = dbport , user = dbuser , password = dbpassword ,database = database)
+    try:
+        today = datetime.datetime.now().strftime("%Y%m%d")
+        tomorrow = (datetime.datetime.now() + datetime.timedelta(days=1)).strftime("%Y%m%d")
+        yesterday = (datetime.datetime.now() - datetime.timedelta(days=1)).strftime("%Y%m%d")
+        dict={"1":yesterday,"2":today, "3":tomorrow}
+        for key,value in dict.items():
+            tableWidgetDispalyN(value,key)
+            tableWidgetDispaly2N(value,key)
+        flaskDBUtils.updateALlVin(db)
+        #print(VinA1 , VinA2 , VinA3 , VinB1 , VinB2 , VinB3)
+    except Exception as e:
+        print(traceback.format_exc())
+        db.close()
+
+
+def task_function(taskname, paramaDict):
+    #ts = time.time()
+    #print('开始请求:{}'.format(taskname))
+    time.sleep(random.randint(10,100)/100)
+    if taskname == "taskflightdata":
+        result = fl.request_task_filght_list(paramaDict['nowDayStr'], paramaDict['token'])
+    elif taskname == "Thirdtaskflightdata":
+        result = fl.request_task_filght_third_list(paramaDict['nowDayStr'], paramaDict['token'])
+    elif taskname == "flightsearch":
+        result = fl.request_LM_FLIGHT_SEARCH_LIST(paramaDict['nowDayStr'], paramaDict['token'])
+    elif taskname == "flightsearch_1":
+        result = fl.request_LM_FLIGHT_SEARCH_LIST(paramaDict['nowDay_1'], paramaDict['token'])
+    elif taskname == "TaskList":
+        result = fl.request_LM_TASK_ARCHIVE_LIST(paramaDict['nowDayStr'], paramaDict['token'])
+    elif taskname == "TaskList_1":
+        result = fl.request_LM_TASK_ARCHIVE_LIST(paramaDict['nowDay_1'], paramaDict['token'])
+    elif taskname == "FlightplanInfo":
+        result = fl.request_flight_from_flightplan(paramaDict['nowDay_1'],paramaDict['nowDayStr'], paramaDict['token'])
+    else:
+        result = {'code': 404}
+    #print("{} 请求耗时:{}".format(taskname, time.time()-ts))
+    return result
+
+@app.route('/getFlightData2', methods=['POST'])
+async def getFlightData2():
+    data = request.get_json()
+    type = data.get('type')
+    global singlePeopleNotice,loaclseverip
+    db = flaskDBUtils.flaskDB(host=dbhost, port=dbport, user=dbuser, password=dbpassword, database=database)
+    fdb = flightDB(host=dbhost, port=dbport, user=dbuser, password=dbpassword, database=databaseDB4)
+    workLoad = flightDB(host=dbhost, port=dbport, user=dbuser, password=dbpassword, database=databaseWorkLoad)
+    if Online_flight_sts == "1":
+        onlinefileDB = flightDB(host=online_host, port=dbport, user=dbuser, password=dbpassword, database=databasefileDB)
+    if (mainseverip and mainseverip == loaclseverip) or mainseverip == "" or (mainseverip and mainseverip != loaclseverip and check_a_availability()):
+        try:
+            #print(type)
+            ts = time.time()
+            taskname_queue = ["taskflightdata","Thirdtaskflightdata","flightsearch","TaskList","FlightplanInfo","flightsearch_1","TaskList_1"] #FlightplanInfo 飞机排班系统的航班嘻嘻你
+            taskparama_queue = []
+            date_time = Judge_bc()["date"]
+            nowDay = datetime.datetime.now()
+            nowDayStr = nowDay.strftime("%Y%m%d")
+            now_130 = (datetime.datetime.now() + datetime.timedelta(minutes=300)).strftime("%Y%m%d")
+            nowStr = nowDay.strftime("%Y%m%d %H:%M:%S")
+            print(datetime.datetime.now(), "[判断:%s,当前:%s,+130:%s]" % (date_time, nowDayStr, now_130))
+            if date_time == nowDayStr and now_130 == nowDayStr:  # 当班次判断为09:00-1900时,只查当日   1900取决于300min不取决于班次判断
+                nowDay_1 =nowDayStr
+                nowday_11=nowDayStr
+                searchDay=f"{nowDayStr[:4]}-{nowDayStr[4:6]}-{nowDayStr[6:]}"
+                start=nowDay.strftime('%Y-%m-%d 00:00:00')
+                end= nowDay.strftime('%Y-%m-%d 00:00:00')
+
+            elif date_time == nowDayStr and now_130 != nowDayStr:  # 当班次判断为1900-2400时,今日和明日
+                nowDay_1 = (datetime.date.today() + datetime.timedelta(days=1)).strftime("%Y%m%d")
+                nowday_11=nowDayStr
+                searchDay=f"{nowDayStr[:4]}-{nowDayStr[4:6]}-{nowDayStr[6:]}"
+                start=nowDay.strftime('%Y-%m-%d 00:00:00')
+                end= (datetime.date.today() + datetime.timedelta(days=1)).strftime('%Y-%m-%d 00:00:00')
+            else:                                             #当班次判断为000-0900时,查昨日和今日
+                nowDay_1 = date_time
+                nowday_11= nowDayStr
+                searchDay=f"{date_time[:4]}-{date_time[4:6]}-{date_time[6:]}"
+                start=f"{date_time[:4]}-{date_time[4:6]}-{date_time[6:]} 00:00:00"
+                end=nowDay.strftime('%Y-%m-%d 00:00:00')
+            print('nowDay_1:{},nowday_11:{},searchDay:{}'.format(nowDay_1,nowday_11,searchDay))
+            if type == "A":
+                if str(flaskDBUtils.checkLogin(db)) == '1':
+                    token,x_access_token = flaskDBUtils.getToken(db)
+                    #print('db-token:{}'.format(token))
+                    print(datetime.datetime.now(), "A动态获取获取[%s/%s]" % (nowDayStr, nowDay_1))
+                    taskparama_queue.append({'nowDayStr':searchDay, 'token': token})
+                    taskparama_queue.append({'nowDayStr':searchDay, 'token': token})
+                    taskparama_queue.append({'nowDayStr':nowday_11, 'token': token})
+                    taskparama_queue.append({'nowDayStr':nowday_11, 'token': token})
+                    taskparama_queue.append({'nowDayStr':end,'nowDay_1': start, 'token': x_access_token})
+                    taskparama_queue.append({'nowDay_1': nowDay_1, 'token': token})
+                    taskparama_queue.append({'nowDay_1': nowDay_1, 'token': token})
+                    flaskDBUtils.clearinfolog(db)
+                    with concurrent.futures.ThreadPoolExecutor() as executor:
+                        if nowday_11 == nowDay_1: #如果两个日期相同,只查一次避免相同
+                            results = executor.map(task_function, taskname_queue[:5], taskparama_queue[:5])
+                        else:
+                            results = executor.map(task_function, taskname_queue, taskparama_queue)
+                    resultsList = []
+                    for result in results:
+                        resultsList.append(result)
+                    taskflightdata= resultsList[0]
+                    Thirdtaskflightdata= resultsList[1]
+                    flightsearchdata= resultsList[2]
+                    tasklistdata= resultsList[3]
+                    infoFromflightplan= resultsList[4] #飞机排班数据
+                    #print(infoFromflightplan)
+                    if nowday_11 != nowDay_1:  ##如果两个日期相同,就没有另外一天的数据
+                        flightsearchdata_1= resultsList[5]
+                        tasklistdata_1= resultsList[6]
+
+                    if taskflightdata['code'] and taskflightdata['code'] != 200:
+                        flaskDBUtils.logout(db)
+                        flaskDBUtils.insertinfolog(db, nowStr, str(taskflightdata['code']))
+                        InitFlightDatabase(fdb,workLoad, nowDayStr)
+                        InitFlightDatabase(fdb,workLoad, nowDay_1)
+                        sortFlighttime(fdb,workLoad)
+                        sortFlighttime2(fdb,workLoad)
+                        checkTFUairplane(fdb)
+                        checkWorkerlaod_new(fdb,workLoad,nowDayStr,nowDay_1)
+                        checkFlightAlert(fdb, singlePeopleNotice)
+                        dingdingDelete_flight(fdb)
+                        dingdingFlightsts(fdb)
+                        dingdinginfoget(fdb)
+                        CalledChecked(fdb)
+                        if Online_flight_sts == "1" and  SameDatabase == "0":
+                            res = UpdatePeopleScheduleFromOnline(fdb, onlinefileDB)
+                            if res:
+                                updatetimer()
+                        else:
+                            updatetimer()
+                        print(datetime.datetime.now(), "A静态刷新")
+                        code=str(taskflightdata['code'])
+                    else:
+                        #ts2 = time.time()
+                        InitFlightDatabase(fdb,workLoad, nowDayStr)
+                        InitFlightDatabase(fdb,workLoad, nowDay_1)
+                        insertTaskDataToTable(fdb, nowDayStr, taskflightdata['data'], Thirdtaskflightdata['data'])
+                        FlightSearchInsert(fdb, nowDayStr, flightsearchdata['data'])
+                        TaskListInsert(fdb, nowDayStr, tasklistdata['data'])
+                        if infoFromflightplan['code'] and infoFromflightplan['code'] == 200:
+                            FlightPlanInsert(fdb, nowDayStr, infoFromflightplan['result'])
+                        if nowday_11 != nowDay_1:  ##如果两个日期相同,就没有另外一天的数据,无需写入
+                            insertTaskDataToTable(fdb, nowDay_1, taskflightdata['data'], Thirdtaskflightdata['data'])
+                            FlightSearchInsert(fdb, nowDay_1, flightsearchdata_1['data'])
+                            TaskListInsert(fdb, nowDay_1, tasklistdata_1['data'])
+                            if infoFromflightplan['code'] and infoFromflightplan['code'] == 200:
+                                FlightPlanInsert(fdb, nowDay_1, infoFromflightplan['result'])
+                        checkFlightplan(fdb,workLoad)
+                        sortFlighttime(fdb,workLoad)
+                        sortFlighttime2(fdb,workLoad)
+                        checkTFUairplane(fdb)
+                        checkWorkerlaod_new(fdb,workLoad,nowDayStr,nowDay_1)
+                        checkFlightAlert(fdb, singlePeopleNotice)
+                        dingdingDelete_flight(fdb)
+                        dingdingFlightsts(fdb)
+                        dingdinginfoget(fdb)
+                        CalledChecked(fdb)
+                        flaskDBUtils.insertinfolog(db,nowStr,str(taskflightdata['code']))
+                        if Online_flight_sts == "1":
+                            if SameDatabase == "0":
+                                UpdatePeopleScheduleFromOnline(fdb , onlinefileDB)
+                        updatetimer()
+                        print(datetime.datetime.now(), "A动态刷新")
+                        #print('数据库耗时:{}'.format(time.time()-ts2))
+                        code = str(taskflightdata['code'])+";刷新用时:"+str(time.time()-ts)
+                else:
+                    code = '未登录'
+            else: #type==B
+                InitFlightDatabase(fdb,workLoad, nowDayStr)
+                InitFlightDatabase(fdb,workLoad, nowDay_1)
+                sortFlighttime(fdb,workLoad)
+                sortFlighttime2(fdb,workLoad)
+                checkTFUairplane(fdb)
+                checkWorkerlaod_new(fdb,workLoad,nowDayStr,nowDay_1)
+                checkFlightAlert(fdb, singlePeopleNotice)
+                dingdingDelete_flight(fdb)
+                dingdingFlightsts(fdb)
+                dingdinginfoget(fdb)
+                CalledChecked(fdb)
+                if Online_flight_sts == "1" and SameDatabase == "0":
+                    res=UpdatePeopleScheduleFromOnline(fdb, onlinefileDB)
+                    if res:
+                        updatetimer()
+                else:
+                    updatetimer()
+                print(datetime.datetime.now(),"B静态刷新")
+                code = "200"
+            if mainseverip and mainseverip != loaclseverip and type == "B":
+                print(datetime.datetime.now(), '[系统警告]主服务器通讯失败,备份服务器工作中')
+                main_fdb=flightDB(host=maindatabase, port=dbport, user=dbuser, password=dbpassword, database=databaseDB4)
+                main_db = flaskDBUtils.flaskDB(host=maindatabase, port=dbport, user=dbuser, password=dbpassword, database=database)
+                main_loginTabledb = flightDB(host=maindatabase, port=dbport, user=dbuser, password=dbpassword, database=databaseLoginDB)
+                loginTabledb = flightDB(host=dbhost, port=dbport, user=dbuser, password=dbpassword, database=databaseLoginDB)
+                try:
+                    postgresql_bakup(fdb, main_fdb,1)
+                    postgresql_bakup(db, main_db,3)
+                    postgresql_bakup(loginTabledb, main_loginTabledb,2)
+                    main_fdb.close()
+                    main_db.close()
+                    main_loginTabledb.close()
+                except Exception as e:
+                    main_fdb.close()
+                    main_db.close()
+                    main_loginTabledb.close()
+                    print(datetime.datetime.now(), '[系统警告]向主数据传输失败')
+            fdb.close()
+            workLoad.close()
+            db.close()
+            if Online_flight_sts == "1":
+                onlinefileDB.close()
+            return jsonify(code=code, msg='正常刷新')
+        except Exception as e:
+            fdb.close()
+            workLoad.close()
+            db.close()
+            if Online_flight_sts == "1":
+                onlinefileDB.close()
+            app_logger.log_error(e)
+            return jsonify(code='未登录', msg=str(e))
+
+    else:
+        #需要加入数据库同步
+        if type == "B":
+            print(datetime.datetime.now(), '[主从备份]非主服务器,该服务器仅同步')
+            main_fdb=flightDB(host=maindatabase, port=dbport, user=dbuser, password=dbpassword, database=databaseDB4)
+            main_db = flaskDBUtils.flaskDB(host=maindatabase, port=dbport, user=dbuser, password=dbpassword, database=database)
+            main_loginTabledb = flightDB(host=maindatabase, port=dbport, user=dbuser, password=dbpassword, database=databaseLoginDB)
+            loginTabledb = flightDB(host=dbhost, port=dbport, user=dbuser, password=dbpassword, database=databaseLoginDB)
+            try:
+                postgresql_bakup(main_fdb,fdb,1)
+                postgresql_bakup(main_db, db, 3)
+                postgresql_bakup(main_loginTabledb, loginTabledb, 2)
+                db.close()
+                fdb.close()
+                workLoad.close()
+                main_fdb.close()
+                main_db.close()
+                main_loginTabledb.close()
+                return '200'
+            except Exception as e:
+                print(e)
+                db.close()
+                fdb.close()
+                workLoad.close()
+                main_fdb.close()
+                main_db.close()
+                main_loginTabledb.close()
+                print(datetime.datetime.now(), '[系统警告]从主数据备份失败')
+                return '200'
+        else:
+            return "200"
+
+
+@app.route('/static/linktest')
+def linktest():
+
+   return jsonify(status="ok", msg="linktest")
+@app.route('/checkLogin')
+def checkLogin():
+    db = flaskDBUtils.flaskDB(host=dbhost,port=dbport,user=dbuser,password=dbpassword,database=database)
+    cookie,x_access_token = flaskDBUtils.getToken(db)
+    if str(flaskDBUtils.checkLogin(db)) == '1':
+        logincode = fl.checkCookieSts(cookie)
+        if logincode and logincode != 200:
+            flaskDBUtils.logout(db)
+            time.sleep(0.1)
+    if str(flaskDBUtils.checkLoginflightplan(db)) == '1':
+        flightplanlogincode = fl.checkCookieStsFLIGHTplan(x_access_token)
+        if flightplanlogincode and flightplanlogincode != 200:
+            flaskDBUtils.logoutflightplan(db)
+
+            time.sleep(0.1)
+    #db.close()
+
+    return jsonify(code=str(flaskDBUtils.checkLogin(db)), msg=str("飞机排班为:"+flaskDBUtils.checkLoginflightplan(db)))
+@app.route('/table')
+def table():
+    flaskDB = flaskDBUtils.flaskDB(host=dbhost,port=dbport,user=dbuser,password=dbpassword,database=database)
+    result = flaskDBUtils.getinfolog(flaskDB)
+    flaskDB.close()
+    dl = []
+    if result !=None:
+        for i in result:
+            dl.append([i[0], i[1], i[2]])
+        data = {
+            "data":dl,
+            'msg':"get table data"
+        }
+        #print(data)
+        #print('get table data')
+        return jsonify(data)
+
+@app.route("/map/<selectedtime>")
+def index(selectedtime):
+    return render_template("map.html", selectedtime=selectedtime)
+@app.route("/map/getSelectInf/<selectedtime>", methods=['POST','GET'])
+def getSelectInf(selectedtime):
+    if request.method == 'POST':
+        result = request.form
+        fdb = flightDB(host=dbhost,port=dbport,user=dbuser,password=dbpassword,database=databaseDB4)
+        res = MapDispaly(fdb, selectedtime)
+        data = res[result['bay']]
+        fdb.close()
+        return render_template('table.html', data=data)
+    return 'err'
+#------------------------------------------------------------------------------------------------
+
+
+@app.route('/changeSinglepoepleNotice', methods=['POST'])
+@jwt_required()
+def changeSinglepoepleNotice():
+    global singlePeopleNotice
+    data = request.get_json()
+    boolsts = data.get('boolsts')
+    singlePeopleNotice = str(boolsts) == "1"
+    write_status_to_file(singlePeopleNotice,'D:\\flightinfo\\DATABASE\\singlepoeple_notice.txt')
+    return jsonify({"status": "success", "new_value": singlePeopleNotice, "msg":"changeSinglepoepleNotice"})
+
+@app.route('/getSinglepoepleNotice')
+@jwt_required()
+def getSinglepoepleNotice():
+    global singlePeopleNotice
+    return jsonify({"singlepoepleNotice": singlePeopleNotice, "msg":"getSinglepoepleNotice"})
+
+#受保护的路由
+@app.route('/protected', methods=['GET'])
+@jwt_required()
+def protected():
+    current_user_id = get_jwt_identity()
+    return jsonify({'msg': f'Hello user {current_user_id}'}), 200
+
+@app.route('/findserver')
+def findserver():
+    return jsonify(msg=ServerClas)
+
+
+
+@app.route('/static/remoteCookielogin',methods=["POST"])
+@jwt_required()
+def remoteCookielogin():
+    remote_addr = request.remote_addr
+    data = request.get_json()
+    username = data.get('username')
+    cookie = data.get('cookie')
+    cookie2 = data.get('cookie2')
+    db = flaskDBUtils.flaskDB(host=dbhost,port=dbport,user=dbuser,password=dbpassword,database=database)
+    user = username
+    token = "{}".format(cookie)
+    token2 = "{}".format(cookie2)
+
+    flaskDBUtils.login(db, user, token, token2)
+    db.close()
+    if token != None:
+        print(datetime.datetime.now(),"[%s]远程登录已获取Token"%remote_addr)
+        return jsonify(msg=(datetime.datetime.now(),"[%s]远程登录已获取Token"%remote_addr), status = "ok")
+    else:
+        return jsonify(status="fail", msg=(datetime.datetime.now(),"[%s]远程登录获取Token失败!"%remote_addr))
+
+@app.route('/static/remotelogin',methods=["POST"])
+@jwt_required()
+def remotelogin():
+    remote_addr = request.remote_addr
+    data = request.get_json()
+    username = data.get('username')
+    password = data.get('password')
+    db = flaskDBUtils.flaskDB(host=dbhost,port=dbport,user=dbuser,password=dbpassword,database=database)
+    user = username
+    pwd =password
+    #print(user, pwd)
+    token,x_access_token = fl.start(user, pwd)
+    flaskDBUtils.login(db, user, token,x_access_token)
+    if token != None:
+        print(datetime.datetime.now(),"[%s]远程登录已获取Token"%remote_addr)
+        return jsonify(msg=(datetime.datetime.now(),"[%s]远程登录已获取Token"%remote_addr), status = "ok")
+    else:
+        return jsonify(status="fail", msg=(datetime.datetime.now(),"[%s]远程登录获取Token失败!"%remote_addr))
+
+@app.route('/static/remotelogout')
+@jwt_required()
+def remotelogout():
+    remote_addr = request.remote_addr
+    db = flaskDBUtils.flaskDB(host=dbhost,port=dbport,user=dbuser,password=dbpassword,database=database)
+    flaskDBUtils.logout(db)
+    db.close()
+    print(datetime.datetime.now(), "[%s]远程注销服务器AMRO账号"%remote_addr)
+    return jsonify(stauts="ok", msg=("[%s]远程注销服务器AMRO账号"%remote_addr))
+
+@app.route('/static/checkjobcard', methods=['GET', 'POST'])
+@jwt_required()
+def checkjobcard():
+    remote_addr = request.remote_addr
+    if request.method == 'GET':
+        file_path = request.args.get('path')
+    else:
+        file_path = request.form.get('path')
+    try:
+        res= fl.request_jobcard("_udid=80c6089a041646db9c1d9f1a2bc1381a", file_path)
+        print(datetime.datetime.now(), "[%s]调取电签工卡查询" % remote_addr)
+    except Exception as e:
+        app_logger.log_error(e)
+        res = ""
+    return jsonify(msg=res)
+
+@app.route('/static/VinCheck', methods=['POST'])
+@jwt_required()
+def VinCheck():
+    data = request.get_json()
+    vinLcoal = data.get('vinLcoal')
+    mode = data.get('mode')
+    num = data.get('num')
+    if int(num) !=4:
+        db = flaskDBUtils.flaskDB(host=dbhost,port=dbport,user=dbuser,password=dbpassword,database=database)
+        vinOnline = flaskDBUtils.getVin(db,mode,int(num))
+        db.close()
+        if vinLcoal == vinOnline:
+            a = "检验一致"
+            res = {"返回值":"ok"}
+        else:
+            a = "服务器有更新"
+            res = {"返回值": "update"}
+    else:
+        a = "非昨天、今天、明天无需获取"
+        res = {"返回值": "ok"}
+    remote_addr = request.remote_addr
+    res['msg'] = ("[%s]刷新识别码监测:%s" % (remote_addr,a))
+    print(datetime.datetime.now(), "[%s]刷新识别码监测:%s" % (remote_addr,a))
+    return jsonify(res)
+
+
+
+@app.route('/static/setIpPhone', methods=['POST'])
+@jwt_required()
+def setIpPhone():
+    data = request.get_json()
+    ip = data.get('ip')
+    remote_addr = request.remote_addr
+    db = flaskDBUtils.flaskDB(host=dbhost,port=dbport,user=dbuser,password=dbpassword,database=database)
+    token=si.start(ip)
+    if token != "fail":
+        res={"返回值":"ok"}
+        flaskDBUtils.setIpPhone(db, ip, token)
+        print(datetime.datetime.now(), "[%s]自动网页电话登录成功[%s,%s]" % (remote_addr,ip, token))
+        res['msg'] = ("[%s]自动网页电话登录成功[%s,%s]" % (remote_addr,ip, token))
+    else:
+        res={"返回值":"fail"}
+        flaskDBUtils.setIpPhone(db, ip, None)
+        print(datetime.datetime.now(), "[%s]自动网页电话登录失败[%s]" % (remote_addr,ip))
+        res['msg']=("[%s]自动网页电话登录失败[%s]" % (remote_addr,ip))
+    db.close()
+    return jsonify(res)
+
+
+@app.route('/static/maintainAuthCheck', methods=['POST'])
+@jwt_required()
+def maintainAuthCheck():
+    data = request.get_json()
+    name = data.get('name')
+    flighttype = data.get('flighttype')
+    remote_addr = request.remote_addr
+    fdb = flightDB(host=dbhost,port=dbport,user=dbuser,password=dbpassword,database=databaseDB4)
+    res=MaintainAuthCheck(fdb,name,flighttype)
+    fdb.close()
+    print(datetime.datetime.now(), "[%s]维修权限验证"%remote_addr)
+    res['msg'] = ("[%s]维修权限验证"%remote_addr)
+    return jsonify(res)
+
+
+@app.route('/static/getPglist', methods=['POST'])
+@jwt_required()
+def getPglist():
+    data = request.get_json()
+    bcstr = data.get('bcstr')
+    try:
+        remote_addr = request.remote_addr
+        #print('获取派工数据')
+        bc=bcstr
+        #bc = "B"  #需要获取
+        db = flaskDBUtils.flaskDB(host=dbhost,port=dbport,user=dbuser,password=dbpassword,database=database)
+        token,x_access_token  = flaskDBUtils.getToken(db)
+        db.close()
+        #token = utils.flight_list.get_cookie()
+        nowDay = datetime.datetime.now()
+        nowDayStr = nowDay.strftime("%Y%m%d")
+        nowDayStr2 = nowDay.strftime("%Y-%m-%d")
+        # (self, taskid:str, shiftDate:str, shift:str, cookie):
+        fdb = flightDB(host=dbhost,port=dbport,user=dbuser,password=dbpassword,database=databaseDB4)
+        taskids=fdb.queryTabel("TaskFlightinfo{}".format(nowDayStr),"航班编号","进出港航班号 like '%3U%'")
+        if taskids[0][0] != "":
+            Pglistdata=fl.request_LM_TSK_EMP_PGLIST(taskids[0][0],nowDayStr2,bc,token)
+            Update_Pglist(fdb,nowDayStr,bc,Pglistdata['data'])
+            fdb.close()
+            print(datetime.datetime.now(),"[%s]获取派工人员清单请求"%remote_addr)
+            return jsonify(code=Pglistdata['code'], msg=(datetime.datetime.now(),"[%s]获取派工人员清单请求"%remote_addr))
+        else:
+            return jsonify(code='404', msg="获取派工失败"), 404
+    except Exception as e:
+        app_logger.log_error("获取派工失败")
+        app_logger.log_error(e)
+        return jsonify(code='404', msg="获取派工失败"), 500
+@app.route('/static/getPglistInDatabase')
+@jwt_required()
+def getPglistInDatabase():
+    fdb = flightDB(host=dbhost,port=dbport,user=dbuser,password=dbpassword,database=databaseDB4)
+    try:
+        res = Judge_bc()
+        ress = GetPglistInDatabase(fdb,res)
+        fdb.close()
+        return jsonify({"返回值":ress, "msg":"get PglistInDatabase success"})
+    except Exception as e:
+        fdb.close()
+        app_logger.log_error(e)
+        return jsonify({"返回值":[], "msg":"get PglistInDatabase fail"})
+
+@app.route('/static/getworkload',methods=["POST"])
+@jwt_required()
+def getworkload():
+    data = request.get_json()
+    names = data.get('names')
+    fdb = flightDB(host=dbhost,port=dbport,user=dbuser,password=dbpassword,database=databaseDB4)
+    workLoad = flightDB(host=dbhost, port=dbport, user=dbuser, password=dbpassword, database=databaseWorkLoad)
+    try:
+        res=Getworkload(fdb,workLoad,names)
+        return jsonify(data=res, msg="get workload success")
+    except Exception as e:
+        fdb.close()
+        workLoad.close()
+        app_logger.log_error(e)
+        return jsonify(data={}, msg="get workload fail")
+@app.route('/static/manchangecosttime',methods=["POST"])
+@jwt_required()
+def manchangecosttime():
+    remote_addr = request.remote_addr
+    data = request.get_json()["data"]
+    workLoad = flightDB(host=dbhost, port=dbport, user=dbuser, password=dbpassword, database=databaseWorkLoad)
+    res=ManCahangeWorkload(workLoad,data)
+    workLoad.close()
+    return jsonify({"返回值":res, "msg":"manchangecosttime workload success"})
+
+@app.route('/static/handoverflight',methods=["POST"])
+@jwt_required()
+def handoverflight():
+    remote_addr = request.remote_addr
+    data = request.get_json()["data"]
+    workLoad = flightDB(host=dbhost, port=dbport, user=dbuser, password=dbpassword, database=databaseWorkLoad)
+    res=HandoverStsChange(workLoad,data)
+    workLoad.close()
+    return jsonify({"返回值":res, "msg":"handoverflight workload success"})
+@app.route('/static/handoverflightAMRO',methods=["POST"])
+@jwt_required()
+def handoverflightAMRO():
+    remote_addr = request.remote_addr
+    data = request.get_json()["data"]
+    db = flaskDBUtils.flaskDB(host=dbhost,port=dbport,user=dbuser,password=dbpassword,database=database)
+    token,x_access_token = flaskDBUtils.getToken(db)
+    #token = utils.flight_list.get_cookie()
+
+    Pglistdata=fl.request_LM_TSK_HANDOVER(data,token)
+    if Pglistdata['code'] == 200:
+        res = {"返回值": "ok"}
+    else:
+        res = {"返回值": "fail"}
+    print(datetime.datetime.now(),"[%s]使用AMRO工作交接功能"%remote_addr)
+    res['msg'] = (datetime.datetime.now(),"[%s]使用AMRO工作交接功能"%remote_addr)
+    return jsonify(res)
+
+@app.route('/static/MM_GJJH_LIST', methods=["POST"])
+@jwt_required()
+def MM_GJJH_LIST():
+    remote_addr = request.remote_addr
+    data = request.get_json()
+    team = data.get('team')
+    db = flaskDBUtils.flaskDB(host=dbhost,port=dbport,user=dbuser,password=dbpassword,database=database)
+    token,x_access_token  = flaskDBUtils.getToken(db)
+    db.close()
+    Pglistdata=fl.request_MM_GJJH_LIST(token)
+    fdb = flightDB(host=dbhost,port=dbport,user=dbuser,password=dbpassword,database=databaseDB4)
+    mM_GJJH_LIST(fdb,team,Pglistdata['data'])
+    fdb.close()
+    print(datetime.datetime.now(),"[%s]%s工具接还查询"%(remote_addr,team))
+    return jsonify(code=str(Pglistdata['code']), msg=(datetime.datetime.now(),"[%s]%s工具接还查询"%(remote_addr,team)))
+
+@app.route('/static/checkWorkjob', methods=["POST"])
+@jwt_required()
+def checkWorkjob():
+    remote_addr = request.remote_addr
+    data = request.get_json()
+    taskid = data.get('taskid')
+    res = {"返回值": "fail"}
+    db = flaskDBUtils.flaskDB(host=dbhost,port=dbport,user=dbuser,password=dbpassword,database=database)
+    token,x_access_token  = flaskDBUtils.getToken(db)
+    db.close()
+    fdb = flightDB(host=dbhost,port=dbport,user=dbuser,password=dbpassword,database=databaseDB4)
+    getinfos=GetWorkjobInfo(fdb,taskid)
+    if getinfos !={}:
+        getworkjob = fl.checkWorkjob(getinfos["taskids"], getinfos["acno"], getinfos["taskType"], getinfos["actype"], getinfos["startDate"], getinfos["endDate"], token)
+        res=InsertWorkjob(fdb,getworkjob["data"],taskid)
+        print(datetime.datetime.now(), "[%s]获取%s工作包请求"%(remote_addr,getinfos["acno"]))
+    fdb.close()
+    res['msg'] = ("[%s]获取%s工作包请求"%(remote_addr,getinfos["acno"]))
+    return jsonify(res)
+
+@app.route('/static/mandealAllLogs', methods=["POST"])
+@jwt_required()
+def mandealAllLogs():
+    remote_addr = request.remote_addr
+    data = request.get_json()
+    mode = data.get('mode')
+    user = data.get('user')
+    fdb = flightDB(host=dbhost,port=dbport,user=dbuser,password=dbpassword,database=databaseDB4)
+    MandealAllLogs(fdb, user,mode)
+    fdb.close()
+    print(datetime.datetime.now(),"[%s]%s人工处理所有待办"%(remote_addr,user))
+    return jsonify(status="ok", msg=(datetime.datetime.now(),"[%s]%s人工处理所有待办"%(remote_addr,user)))
+
+@app.route('/static/calltry')
+@jwt_required()
+def calltry():
+    remote_addr = request.remote_addr
+    db = flaskDBUtils.flaskDB(host=dbhost,port=dbport,user=dbuser,password=dbpassword,database=database)
+    phoneip=flaskDBUtils.getIpPhoneip(db)
+    db.close()
+    ip=phoneip["ip"]
+    token = phoneip["token"]
+    db.close()
+    #print("客户端点击尝试拨打请求获取的IP:%s"%phoneip)
+    if ip !="" and token!="":
+        fdb = flightDB(host=dbhost,port=dbport,user=dbuser,password=dbpassword,database=databaseDB4)
+        A=Calltry(fdb, ip,token)
+        fdb.close()
+        if A != "fail":
+            res = {"返回值": "ok"}
+            print(datetime.datetime.now(),"[%s]尝试自动拨打请求%s"%(remote_addr,A))
+            res['msg'] = (datetime.datetime.now(),"[%s]尝试自动拨打请求%s"%(remote_addr,A))
+        else:
+            res = { "返回值" : "fail" , "msg":"auto call fail"}
+    else:
+        res = {"返回值": "fail", "msg":"auto call fail"}
+    return jsonify(res)
+
+@app.route('/static/manAddFlight', methods=["POST"])
+@jwt_required()
+def manAddFlight():
+    data = request.get_json()
+    flighttype = data.get('flighttype')
+    acno = data.get('acno')
+    eng = data.get('eng')
+    actype = data.get('actype')
+    flightno = data.get('flightno')
+    flightdate = data.get('flightdate')
+    bay = data.get('bay')
+    eta = data.get('eta')
+    etd = data.get('etd')
+    user = data.get('user')
+    fdb = flightDB(host=dbhost,port=dbport,user=dbuser,password=dbpassword,database=databaseDB4)
+    res=ManAddFlight(fdb,flighttype,acno,eng,actype,flightno,flightdate,bay,eta,etd,user)
+    print(datetime.datetime.now(),"%s人工添加航班%s"%(user,flightno))
+    fdb.close()
+    res['msg'] = (datetime.datetime.now(),"%s人工添加航班%s"%(user,flightno))
+    return jsonify(res)
+
+@app.route('/static/getphonelist')
+@jwt_required()
+def getphonelist():
+    fdb = flightDB(host=dbhost,port=dbport,user=dbuser,password=dbpassword,database=databaseDB4)
+    res=Getphonelist(fdb)
+    remote_addr = request.remote_addr
+    fdb.close()
+    print(datetime.datetime.now(),"[%s]客户端获取通讯录名单"%remote_addr)
+    return jsonify(data=res, msg=(datetime.datetime.now(),"[%s]客户端获取通讯录名单"%remote_addr))
+
+@app.route('/static/deleteFlight', methods=['POST'])
+@jwt_required()
+def deleteFlight():
+    remote_addr = request.remote_addr
+    data = request.get_json()
+    flightid = data.get('flightid')
+    user = data.get('user')
+    time = data.get('time')
+    fdb = flightDB(host=dbhost,port=dbport,user=dbuser,password=dbpassword,database=databaseDB4)
+    res=DeleteFlight(fdb,flightid,time)
+    fdb.close()
+    print(datetime.datetime.now(),"[%s]%s删除航班操作(%s)"%(remote_addr,user,flightid))
+    res['msg'] = (datetime.datetime.now(),"[%s]%s删除航班操作(%s)"%(remote_addr,user,flightid))
+    return jsonify(res)
+
+@app.route('/static/called/')
+@jwt_required()
+def calledChecked():
+    remote_addr = request.remote_addr
+    fdb = flightDB(host=dbhost,port=dbport,user=dbuser,password=dbpassword,database=databaseDB4)
+    CalledChecked(fdb)
+    fdb.close()
+    res = {"返回值": "ok"}
+    print(datetime.datetime.now(),"[%s]通话建立情况检查请求"%remote_addr)
+    res['msg']=(datetime.datetime.now(),"[%s]通话建立情况检查请求"%remote_addr)
+    return res
+
+@app.route('/static/dingdong',methods=["POST"])
+@jwt_required()
+def dingdong():
+    remote_addr = request.remote_addr
+    data = request.get_json()["data"]
+    db = flaskDBUtils.flaskDB(host=dbhost,port=dbport,user=dbuser,password=dbpassword,database=database)
+    token,x_access_token =flaskDBUtils.getToken(db)
+    db.close()
+    LM_TSK_DINGDONG=fl.request_LM_TSK_DINGDONG(data,token)
+    #print(data)
+    if LM_TSK_DINGDONG['code'] and LM_TSK_DINGDONG['code'] == 200:
+        res = {"返回值": "ok", "msg": (datetime.datetime.now(),"[%s]使用叮咚消息success"%remote_addr)}
+    else:
+        res = {"返回值": "fail", "msg": (datetime.datetime.now(),"[%s]使用叮咚消息fail"%remote_addr)}
+    print(datetime.datetime.now(),"[%s]使用叮咚消息"%remote_addr)
+    return jsonify(res)
+
+@app.route('/static/LM_TSK_SURE_PG',methods=["POST"])
+@jwt_required()
+def LM_TSK_SURE_PG():
+    remote_addr = request.remote_addr
+    data = request.get_json()["data"]
+    db = flaskDBUtils.flaskDB(host=dbhost,port=dbport,user=dbuser,password=dbpassword,database=database)
+    token,x_access_token = flaskDBUtils.getToken(db)
+    db.close()
+    LM_TSK_SURE_PG=fl.request_LM_TSK_SURE_PG(data,token)
+    #print(data)
+    if LM_TSK_SURE_PG['code'] and LM_TSK_SURE_PG['code'] == 200:
+        res = {"返回值": "ok", "msg":(datetime.datetime.now(),"[%s]使用派工success"%remote_addr)}
+    else:
+        res = {"返回值": "fail", "msg":(datetime.datetime.now(),"[%s]使用派工fail"%remote_addr)}
+    print(datetime.datetime.now(),"[%s]使用派工"%remote_addr)
+    return jsonify(res)
+
+@app.route('/static/insertCalllist',methods=["POST"])
+@jwt_required()
+def insertCalllist():
+    remote_addr = request.remote_addr
+    data = request.get_json()["data"]
+    fdb = flightDB(host=dbhost,port=dbport,user=dbuser,password=dbpassword,database=databaseDB4)
+    res=InsertCalllist(fdb, data)
+    fdb.close()
+    print(datetime.datetime.now(),"[%s]录入拨号数据库"%remote_addr)
+    #print(datetime.datetime.now(),data)
+    res['msg']=(datetime.datetime.now(),"[%s]录入拨号数据库"%remote_addr)
+    return jsonify(res)
+
+@app.route('/static/get_empNos_phoone', methods=['POST'])
+@jwt_required()
+def get_empNos_phoone():
+    remote_addr = request.remote_addr
+    data = request.get_json()
+    name = data.get("name")
+    fdb = flightDB(host=dbhost,port=dbport,user=dbuser,password=dbpassword,database=databaseDB4)
+    res=Get_empNos_phoone(fdb, name)
+    fdb.close()
+    print(datetime.datetime.now(),"[%s]获取员工号和电话号码"%remote_addr)
+    #print(datetime.datetime.now(),data)
+    return res
+
+@app.route('/static/get_empNos',methods=["POST"])
+@jwt_required()
+def get_empNos():
+    remote_addr = request.remote_addr
+    data = request.get_json()["data"]
+    fdb = flightDB(host=dbhost,port=dbport,user=dbuser,password=dbpassword,database=databaseDB4)
+    res=Get_empNos(fdb, data)
+    fdb.close()
+    print(datetime.datetime.now(),"[%s]获取员工号"%remote_addr)
+    #print(datetime.datetime.now(),data)
+    res['msg'] = (datetime.datetime.now(),"[%s]获取员工号"%remote_addr)
+    return res
+
+@app.route('/static/updatecheck')
+@jwt_required()
+def updatecheck():
+    try:
+        remote_addr = request.remote_addr
+        flaskDB =flaskDBUtils.flaskDB(host=dbhost,port=dbport,user=dbuser,password=dbpassword,database=database)
+        updatests=flaskDBUtils.updatecheck(flaskDB)
+        res = {"返回值":updatests}
+        flaskDB.close()
+        #print(res)
+        print(datetime.datetime.now(),"[%s]客户端自动检查更新请求"%remote_addr)
+        res['msg'] = (datetime.datetime.now(),"[%s]客户端自动检查更新请求"%remote_addr)
+        return jsonify(res)
+    except:
+        return jsonify({"返回值": "0", 'msg':(datetime.datetime.now(),"[%s]客户端自动检查更新请求fail"%remote_addr)})
+
+@app.route('/static/calling', methods=['POST'])  #呼出通话建立
+@jwt_required()
+def calling():
+    remote_addr = request.remote_addr
+    data = request.get_json()
+    phonenum0 = data.get("phonenum0")
+    #print(phonenum0)
+    flaskDB = flaskDBUtils.flaskDB(host=dbhost,port=dbport,user=dbuser,password=dbpassword,database=database)
+    now=datetime.datetime.now()
+    a=flaskDBUtils.callingphoneUpdate(flaskDB,phonenum0,now)
+    res = {"返回值":"ok"}
+    flaskDB.close()
+    #print(res)
+    print(datetime.datetime.now(),"[%s]%s自动电话通话正在呼出"%(remote_addr,phonenum0))
+    res['msg'] = (datetime.datetime.now(),"[%s]%s自动电话通话正在呼出"%(remote_addr,phonenum0))
+    return jsonify(res)
+
+@app.route('/static/calldown')  #通话结束
+@jwt_required()
+def calldown():
+    remote_addr = request.remote_addr
+    flaskDB = flaskDBUtils.flaskDB(host=dbhost,port=dbport,user=dbuser,password=dbpassword,database=database)
+    now=datetime.datetime.now()
+    a=flaskDBUtils.callingphoneUpdate(flaskDB,None,now)
+    res = {"返回值":"ok"}
+    flaskDB.close()
+    #print(res)
+    print(datetime.datetime.now(),"[%s]自动电话缓存恢复初始值"%remote_addr)
+    res['msg'] =(datetime.datetime.now(),"[%s]自动电话缓存恢复初始值"%remote_addr)
+    return jsonify(res)
+
+@app.route('/static/callon')  #呼出通话建立
+@jwt_required()
+def callon():
+    remote_addr = request.remote_addr
+    flaskDB = flaskDBUtils.flaskDB(host=dbhost,port=dbport,user=dbuser,password=dbpassword,database=database)
+    phonenum=flaskDBUtils.getPhoneNum(flaskDB)
+    flaskDB.close()
+    if phonenum != None:
+        fdb = flightDB(host=dbhost,port=dbport,user=dbuser,password=dbpassword,database=databaseDB4)
+        Callon(fdb,phonenum)
+        fdb.close()
+        #print(res)
+        print(datetime.datetime.now(),"[%s]%s自动电话通话建立写入"%(remote_addr,phonenum))
+        return jsonify({"返回值": "ok", "msg":(datetime.datetime.now(),"[%s]%s自动电话通话建立写入"%(remote_addr,phonenum))})
+    res = {"返回值": "ok", "msg":"phonenum=None"}
+    return jsonify(res)
+
+@app.route('/static/initFlightDatabase', methods=["POST"])
+@jwt_required()
+def initFlightDatabase():
+    data = request.get_json()
+    selectedtime = data.get("selectedtime")
+    remote_addr = request.remote_addr
+    fdb = flightDB(host=dbhost,port=dbport,user=dbuser,password=dbpassword,database=databaseDB4)
+    workLoad = flightDB(host=dbhost, port=dbport, user=dbuser, password=dbpassword, database=databaseWorkLoad)
+    InitFlightDatabase(fdb,workLoad,selectedtime)
+    fdb.close()
+    workLoad.close()
+    res = {"返回值": "ok"}
+    print(datetime.datetime.now(),"[%s]初始化航班信息数据库"%remote_addr)
+    res['msg'] = (datetime.datetime.now(),"[%s]初始化航班信息数据库"%remote_addr)
+    return jsonify(res)
+
+@app.route('/static/selftaxiLogs', methods=["POST"])
+@jwt_required()
+def selftaxiLogs():
+    data = request.get_json()
+    text = data.get("text")
+    flightid = data.get("flightid")
+    fdb = flightDB(host=dbhost,port=dbport,user=dbuser,password=dbpassword,database=databaseDB4)
+    SelftaxiLogs(fdb,text,flightid)
+    fdb.close()
+    res = {"返回值": "ok"}
+    res['msg'] = "selftaxiLogs"
+    return jsonify(res)
+
+@app.route('/static/checkCalllist', methods=["POST"])
+@jwt_required()
+def checkCalllist():
+    data = request.get_json()
+    time = data.get("time")
+    fdb = flightDB(host=dbhost,port=dbport,user=dbuser,password=dbpassword,database=databaseDB4)
+    res=CheckCalllist(fdb,time)
+    fdb.close()
+
+    return jsonify(data=res, msg="checkCalllist")
+
+@app.route('/static/insertLogs', methods=["POST"])
+@jwt_required()
+def insertLogs():
+    data = request.get_json()
+    time = data.get("time")
+    text = data.get("text")
+    name = data.get("name")
+    remote_addr = request.remote_addr
+    fdb = flightDB(host=dbhost,port=dbport,user=dbuser,password=dbpassword,database=databaseDB4)
+    InsertLogs(fdb,text,name,time)
+    fdb.close()
+    res = {"返回值": "ok"}
+    print(datetime.datetime.now(),"[%s]%s插入日志信息"%(remote_addr,name))
+    res['msg'] = (datetime.datetime.now(),"[%s]%s插入日志信息"%(remote_addr,name))
+    return jsonify(res)
+@app.route('/static/insertLogs2', methods=["POST"])
+@jwt_required()
+def insertLogs2():
+    data = request.get_json()
+    time = data.get("time")
+    name = data.get("name")
+    text = data.get("text")
+    remote_addr = request.remote_addr
+    fdb = flightDB(host=dbhost,port=dbport,user=dbuser,password=dbpassword,database=databaseDB4)
+    InsertLogs2(fdb,text,name,time)
+    fdb.close()
+    res = {"返回值": "ok"}
+    print(datetime.datetime.now(),"[%s]%s插入日志信息"%(remote_addr,name))
+    res['msg'] = (datetime.datetime.now(),"[%s]%s插入日志信息"%(remote_addr,name))
+    return jsonify(res)
+
+@app.route('/static/checkLoadSingal', methods=["POST"])
+@jwt_required()
+def checkLoadSingal():
+    data = request.get_json()
+    time1 = data.get("time1")
+    time2 = data.get("time2")
+    worknum = data.get("worknum")
+    remote_addr = request.remote_addr
+    wdb = flightDB(host=dbhost,port=dbport,user=dbuser,password=dbpassword,database=databaseWorkLoad)
+    res=CheckLoadSingal(wdb,worknum,time1,time2)
+    wdb.close()
+    print(datetime.datetime.now(),"[%s]查询个人工作量请求"%remote_addr)
+    res['msg'] = (datetime.datetime.now(),"[%s]查询个人工作量请求"%remote_addr)
+    return jsonify(res)
+
+@app.route('/static/authorityCheck', methods=["POST"])
+@jwt_required()
+def authorityCheck():
+    remote_addr = request.remote_addr
+    data = request.get_json()
+    username = data.get("username")
+    res1={"返回值":""}
+    loginTabledb = flightDB(host=dbhost,port=dbport,user=dbuser,password=dbpassword,database=databaseLoginDB)
+    res=loginTabledb.queryTabel('logintable', '*', "登录名='{}'".format(username))
+    loginTabledb.close()
+    if res !=[]:
+        res1["返回值"]=res[0]
+    print(datetime.datetime.now(),"[%s]%s验证权限请求" %(remote_addr,username))
+    res1['msg']=(datetime.datetime.now(),"[%s]%s验证权限请求" %(remote_addr,username))
+    return jsonify(res1)
+
+
+@app.route('/static/loginDbget', methods=["POST"])
+@jwt_required()
+def loginDbget():
+    data = request.get_json()
+    username = data.get("username")
+    remote_addr = request.remote_addr
+    res1= {}
+    loginTabledb = flightDB(host=dbhost,port=dbport,user=dbuser,password=dbpassword,database=databaseLoginDB)
+    res=loginTabledb.getAlldata('logintable')
+    loginTabledb.close()
+    if res !=[] and username in str(res):
+        for i in res:
+            res2={}
+            res2["登录名"] = i[1]
+            res2["权限"] = i[3]
+            res2["使用人"] = i[4]
+            res1[i[1]] = res2
+    print(datetime.datetime.now(),"[%s]%s权限修改信息获取" % (remote_addr,username))
+
+    return jsonify(data=res1, msg=(datetime.datetime.now(),"[%s]%s权限修改信息获取" % (remote_addr,username)))
+
+@app.route('/static/changePassword',methods=["POST"])
+@jwt_required()
+def changePassword():
+    remote_addr = request.remote_addr
+    data = request.get_json()["data"]
+    loginTabledb = flightDB(host=dbhost,port=dbport,user=dbuser,password=dbpassword,database=databaseLoginDB)
+    Changepassword(loginTabledb,data["登录名"], data["旧密码"], data["新密码"])
+    loginTabledb.close()
+    res1 = {"返回值": "ok"}
+    print(datetime.datetime.now(),"[%s]%s更改密码请求" % (remote_addr,data["登录名"]))
+    res1['msg'] = (datetime.datetime.now(),"[%s]%s更改密码请求" % (remote_addr,data["登录名"]))
+    return jsonify(res1)
+
+@app.route('/static/addUserWidget',methods=["POST"])
+@jwt_required()
+def addUserWidget():
+    remote_addr = request.remote_addr
+    res1={"返回值":""}
+    data = request.get_json()["data"]
+    loginTabledb = flightDB(host=dbhost,port=dbport,user=dbuser,password=dbpassword,database=databaseLoginDB)
+    res=loginTabledb.queryTabel('logintable', '*', "登录名='%s'"%data["登录名"])
+    if res:
+        res=loginTabledb.insertData('logintable', data)
+        if res == "ok":
+            res1["返回值"] = "1"
+        else:
+            res1["返回值"] = "0"
+    else:
+        res1["返回值"] = "2"
+    loginTabledb.close()
+    print(datetime.datetime.now(),"[%s]创建新用户:%s请求" % (remote_addr,data["登录名"]))
+    res1['msg'] = (datetime.datetime.now(),"[%s]创建新用户:%s请求" % (remote_addr,data["登录名"]))
+    return jsonify(res1)
+
+@app.route('/static/changeAuth',methods=["POST"])
+@jwt_required()
+def changeAuth():
+    remote_addr = request.remote_addr
+    res1={"返回值":""}
+    data = request.get_json()["data"]
+    loginTabledb = flightDB(host=dbhost,port=dbport,user=dbuser,password=dbpassword,database=databaseLoginDB)
+    res=loginTabledb.queryTabel('logintable', '*', "登录名='%s'"%str(data["登录名"]).replace("'",""))
+    if res != []:
+        loginTabledb.upDateItem('logintable',data,"登录名='%s'"%str(data["登录名"]).replace("'",""))
+        res1["返回值"]="1"
+    else:
+        res1["返回值"] = "2"
+    loginTabledb.close()
+    print(datetime.datetime.now(),"[%s]权限变更写入:%s请求" % (remote_addr,data["登录名"]))
+    res1['msg'] = (datetime.datetime.now(),"[%s]权限变更写入:%s请求" % (remote_addr,data["登录名"]))
+    return jsonify(res1)
+
+@app.route('/static/infoConfirm',methods=["POST"])
+@jwt_required()
+def infoConfirm():
+    remote_addr = request.remote_addr
+    data = request.get_json()
+    type, flightid, displaymode, selectedtime = data['type'], data['flightid'], data['displaymode'], data['selectedtime']
+    fdb = flightDB(host=dbhost,port=dbport,user=dbuser,password=dbpassword,database=databaseDB4)
+    InfoConfirm(fdb,type,flightid,displaymode,selectedtime)
+    fdb.close()
+    res = {"返回值": "ok"}
+    print(datetime.datetime.now(), "[%s]确认通知操作"%remote_addr)
+    res['msg'] = ("[%s]确认通知操作"%remote_addr)
+    return jsonify(res)
+
+@app.route('/static/infoConfirm3',methods=["POST"])
+@jwt_required()
+def infoConfirm3():
+    remote_addr = request.remote_addr
+    data = request.get_json()
+    type,flightid,displaymode,selectedtime = data['type'], data['flightid'], data['displaymode'], data['selectedtime']
+    fdb = flightDB(host=dbhost,port=dbport,user=dbuser,password=dbpassword,database=databaseDB4)
+    InfoConfirm3(fdb,type,flightid,displaymode,selectedtime)
+    fdb.close()
+    res = {"返回值": "ok"}
+    print(datetime.datetime.now(),"[%s]确认自滑推送操作"%remote_addr)
+    res['msg'] = (datetime.datetime.now(),"[%s]确认自滑推送操作"%remote_addr)
+    return jsonify(res)
+
+@app.route('/static/infoConfirm2',methods=["POST"])
+@jwt_required()
+def infoConfirm2():
+    remote_addr = request.remote_addr
+    data = request.get_json()
+    type, flightid, displaymode, selectedtime = data['type'], data['flightid'], data['displaymode'], data['selectedtime']
+    fdb = flightDB(host=dbhost,port=dbport,user=dbuser,password=dbpassword,database=databaseDB4)
+    InfoConfirm2(fdb,type,flightid,displaymode,selectedtime)
+    fdb.close()
+    res = {"返回值": "ok"}
+    print(datetime.datetime.now(),"[%s]确认推送操作"%remote_addr)
+    res['msg'] = (datetime.datetime.now(),"[%s]确认推送操作"%remote_addr)
+    return jsonify(res)
+
+@app.route('/static/manChangests',methods=["POST"])
+@jwt_required()
+def manChangests():
+    remote_addr = request.remote_addr
+    data = request.get_json()
+    text, type, selectedtime, username = data['text'], data['type'], data['selectedtime'], data['username']
+    fdb = flightDB(host=dbhost,port=dbport,user=dbuser,password=dbpassword,database=databaseDB4)
+    ManChangests(fdb,text,type,selectedtime,username)
+    fdb.close()
+    res = {"返回值": "ok"}
+    print(datetime.datetime.now(),"[%s][%s]%s人工改变航班状态"%(remote_addr,username,text))
+    res['msg'] = (datetime.datetime.now(),"[%s][%s]%s人工改变航班状态"%(remote_addr,username,text))
+    return jsonify(res)
+
+@app.route('/static/updateDragDropItem',methods=["POST"])
+@jwt_required()
+def updateDragDropItem():
+    #t1 = datetime.datetime.now()
+    remote_addr = request.remote_addr
+    data = request.get_json()
+    column, text, flightid, displayMode, flighttype, selectedtime = data['column'], data['text'], data['flightid'], data['displaymode'], data['flighttype'], data['selectedtime']
+    fdb = flightDB(host=dbhost,port=dbport,user=dbuser,password=dbpassword,database=databaseDB4)
+    #print(fdb,column,text,flightid,displayMode,flighttype,selectedtime)
+    #t2 = datetime.datetime.now()
+    #print(f'编辑登录时间:{t2 - t1}')
+    res = UpdateDragDropItem(fdb,column,text,flightid,displayMode,flighttype,selectedtime)
+    fdb.close()
+    res1={"返回值":res}
+    print(datetime.datetime.now(),"[%s]拖拽更新请求"%remote_addr)
+    #t3 = datetime.datetime.now()
+    #print(f'编辑处理时间:{t3 - t2}')
+    res1['msg'] = (datetime.datetime.now(),"[%s]拖拽更新请求"%remote_addr)
+    return jsonify(res1)
+
+@app.route('/static/updateEidteItem',methods=["POST"])
+@jwt_required()
+def updateEidteItem():
+    remote_addr = request.remote_addr
+    data = request.get_json()
+    text, flightid, displayMode, flighttype, selectedtime = data['text'], data['flightid'], data['displaymode'], data['flighttype'], data['selectedtime']
+    fdb = flightDB(host=dbhost,port=dbport,user=dbuser,password=dbpassword,database=databaseDB4)
+    #print(fdb,column,text,flightid,displayMode,flighttype,selectedtime)
+    UpdateEidteItem(fdb,text,flightid,displayMode,flighttype,selectedtime)
+    fdb.close()
+    res1={"返回值":"OK"}
+    print(datetime.datetime.now(),"[%s]附加消息请求"%remote_addr)
+    res1['msg'] = (datetime.datetime.now(),"[%s]附加消息请求"%remote_addr)
+    return jsonify(res1)
+
+@app.route('/static/updateNoteItem',methods=["POST"])
+@jwt_required()
+def updateNoteItem():
+    try:
+        remote_addr = request.remote_addr
+        data = request.get_json()
+        text, name = data['text'], data['name']
+        fdb = flightDB(host=dbhost,port=dbport,user=dbuser,password=dbpassword,database=databaseDB4)
+        UpdateNoteItem(fdb,text,name)
+        fdb.close()
+        res1={"返回值":"OK"}
+        print(datetime.datetime.now(),"[%s]排班辅助备注修改"%remote_addr)
+        return jsonify(res1)
+    except Exception as e:
+        res1={"返回值":"fail"}
+        res1['msg'] = "error:"+str(e)
+        print("有bug,请联系管理员")
+        app_logger.log_error(e)
+        return jsonify(res1)
+
+@app.route('/static/checkPglist',methods=["POST"])
+@jwt_required()
+def checkPglist():
+    remote_addr = request.remote_addr
+    data = request.get_json()
+    name, selectedtime, bc = data['name'], data['selectedtime'], data['bc']
+    fdb = flightDB(host=dbhost,port=dbport,user=dbuser,password=dbpassword,database=databaseDB4)
+    #print(fdb,column,text,flightid,displayMode,flighttype,selectedtime)
+    res = CheckPglist(fdb,name,selectedtime,bc)
+    fdb.close()
+    #print(res)
+    if res == "YES":
+        res1 = {"返回值": "OK"}
+        print(datetime.datetime.now(), "[%s]人工录入派工核查成功"%remote_addr)
+    else:
+        res1 = {"返回值": "fail"}
+        print(datetime.datetime.now(), "[%s]人工录入派工核查失败"%remote_addr)
+    return jsonify(res1)
+
+@app.route('/static/tableWidgetLOGDispaly', methods=["POST"])
+@jwt_required()
+def tableWidgetLOGDispaly():
+    data = request.get_json()
+    selectedtime = data['selectedtime']
+    fdb = flightDB(host=dbhost,port=dbport,user=dbuser,password=dbpassword,database=databaseDB4)
+    res=TableWidgetLOGDispaly(fdb,selectedtime)
+    fdb.close()
+    remote_addr = request.remote_addr
+    print(datetime.datetime.now(),"[%s]日志刷新请求"%remote_addr)
+    return jsonify(data=res)
+
+@app.route('/static/qtPeopleLoad',methods=["POST"])
+@jwt_required()
+def qtPeopleLoad():
+    data = request.get_json()
+    selectedtime, bc = data['selectedtime'], data['bc']
+    fdb = flightDB(host=dbhost,port=dbport,user=dbuser,password=dbpassword,database=databaseDB4)
+    workLoad = flightDB(host=dbhost,port=dbport,user=dbuser,password=dbpassword,database=databaseWorkLoad)
+    res=QtPeopleLoad(fdb,workLoad,bc,selectedtime)
+    workLoad.close()
+    fdb.close()
+    remote_addr = request.remote_addr
+    print(datetime.datetime.now(),"[%s]人员工作状态刷新请求"%remote_addr)
+    return jsonify(data=res)
+
+@app.route('/static/getVin',methods=["POST"])
+@jwt_required()
+def getVin():
+    data = request.get_json()
+    mode, num = data['mode'], data['num']
+    db = flaskDBUtils.flaskDB(host=dbhost,port=dbport,user=dbuser,password=dbpassword,database=database)
+    vin=flaskDBUtils.getVin(db,mode,int(num)) # 刷新航班
+    db.close()
+    res = {"返回值": "%s"%vin}
+    remote_addr = request.remote_addr
+    print(datetime.datetime.now(), "[%s]获取在线Vin码"%remote_addr)
+    return jsonify(res)
+
+@app.route('/static/updateVin',methods=["POST"])
+@jwt_required()
+def updateVin():
+    data = request.get_json()
+    mode, num = data['mode'], data['num']
+    db = flaskDBUtils.flaskDB(host=dbhost,port=dbport,user=dbuser,password=dbpassword,database=database)
+    vin=flaskDBUtils.updateVin(db,mode,int(num))  # 刷新航班
+    db.close()
+    res = {"返回值": "%s"%vin}
+    remote_addr = request.remote_addr
+    print(datetime.datetime.now(), "[%s]更新在线Vin码"%remote_addr)
+    return jsonify(res)
+
+@app.route('/static/tableWidgetDispalyRead',methods=["POST"])
+@jwt_required()
+def tableWidgetDispalyRead():
+    data = request.get_json()
+    date = data['date']
+    fdb = flightDB(host=dbhost,port=dbport,user=dbuser,password=dbpassword,database=databaseDB4)
+    res=TableWidgetDispalyRead(fdb,date)
+    fdb.close()
+    #print(datetime.datetime.now(),res)
+    remote_addr = request.remote_addr
+    print(datetime.datetime.now(),"[%s]A模式只读航班信息刷新请求"%remote_addr)
+    # res['msg'] = (datetime.datetime.now(),"[%s]A模式只读航班信息刷新请求"%remote_addr)
+    return jsonify(data=res)
+
+@app.route('/static/tableWidgetDispalyRead2',methods=["POST"])
+@jwt_required()
+def tableWidgetDispalyRead2():
+    data = request.get_json()
+    date = data['date']
+    fdb = flightDB(host=dbhost,port=dbport,user=dbuser,password=dbpassword,database=databaseDB4)
+    res=TableWidgetDispalyRead2(fdb,date)
+    fdb.close()
+    #print(datetime.datetime.now(),res)
+    remote_addr = request.remote_addr
+    print(datetime.datetime.now(),"[%s]B模式只读航班信息刷新请求"%remote_addr)
+    return jsonify(data=res)
+
+@app.route('/static/tableWidgetDispaly',methods=["POST"])
+@jwt_required()
+def tableWidgetDispaly():
+    #t1 = datetime.datetime.now()
+    data = request.get_json()
+    selectedtime, date = data['selectedtime'], data['date']
+    fdb = flightDB(host=dbhost,port=dbport,user=dbuser,password=dbpassword,database=databaseDB4)
+    #t2 = datetime.datetime.now()
+    #print(f'航班刷新登录时间:{t2 - t1}')
+    res=TableWidgetDispaly(fdb,selectedtime,date)
+    fdb.close()
+    #print(datetime.datetime.now(),res)
+    remote_addr = request.remote_addr
+    print(datetime.datetime.now(),"[%s]A模式航班信息刷新请求[%s]"%(remote_addr,date))
+    #t3 = datetime.datetime.now()
+    #print(f'航班刷新处理时间:{t3 - t2}')
+    return jsonify(data=res)
+
+@app.route('/static/tableWidgetDispaly11',methods=["POST"])
+@jwt_required()
+def tableWidgetDispaly11():
+    data = request.get_json()
+    selectedtime = data['selectedtime']
+    remote_addr = request.remote_addr
+    fdb = flightDB(host=dbhost,port=dbport,user=dbuser,password=dbpassword,database=databaseDB4)
+    res=TableWidgetDispaly(fdb,selectedtime,"4")
+    fdb.close()
+    #print(datetime.datetime.now(),res)
+    print(datetime.datetime.now(),"[%s]文件存储1航班信息刷新请求"%remote_addr)
+    return jsonify(data=res)
+
+@app.route('/static/tableWidgetDispaly22',methods=["POST"])
+@jwt_required()
+def tableWidgetDispaly22():
+    data = request.get_json()
+    selectedtime = data['selectedtime']
+    remote_addr = request.remote_addr
+    fdb = flightDB(host=dbhost,port=dbport,user=dbuser,password=dbpassword,database=databaseDB4)
+    res=TableWidgetDispaly2(fdb,selectedtime,"4")
+    fdb.close()
+    print(datetime.datetime.now(),"[%s]文件存储2航班信息刷新请求"%remote_addr)
+    return jsonify(data=res)
+
+@app.route('/static/tableWidgetDispaly2',methods=["POST"])
+@jwt_required()
+def tableWidgetDispaly2():
+    data = request.get_json()
+    selectedtime, date = data['selectedtime'], data['date']
+    fdb = flightDB(host=dbhost,port=dbport,user=dbuser,password=dbpassword,database=databaseDB4)
+    res=TableWidgetDispaly2(fdb,selectedtime,date)
+    fdb.close()
+    remote_addr = request.remote_addr
+    print(datetime.datetime.now(),"[%s]B模式航班信息刷新请求[%s]"%(remote_addr,date))
+    return jsonify(data=res)
+
+@app.route('/static/mapDispaly',methods=["POST"])
+@jwt_required()
+def mapDispaly():
+    data = request.get_json()
+    selectedtime = data['selectedtime']
+    fdb = flightDB(host=dbhost,port=dbport,user=dbuser,password=dbpassword,database=databaseDB4)
+    res = MapDispaly(fdb, selectedtime)
+    fdb.close()
+    #print(datetime.datetime.now(),'获取的机位数据:{}'.format(res))
+    remote_addr = request.remote_addr
+    print(datetime.datetime.now(),"[%s]地图显示刷新请求"%remote_addr)
+    return jsonify(data=res)
+
+@app.route('/static/judge_bc')
+@jwt_required()
+def judge_bc():
+    remote_addr = request.remote_addr
+    fdb = flightDB(host=dbhost,port=dbport,user=dbuser,password=dbpassword,database=databaseDB4)
+    aa=Judge_bc()
+    fdb.close()
+    print(datetime.datetime.now(),"[%s]判断班次请求"%remote_addr)
+    return jsonify(data=aa)
+
+@app.route('/static/dealLogs',methods=["POST"])
+@jwt_required()
+def dealLogs():
+    data = request.get_json()
+    user, id = data['user'], data['id']
+    remote_addr = request.remote_addr
+    fdb = flightDB(host=dbhost,port=dbport,user=dbuser,password=dbpassword,database=databaseDB4)
+    DealLogs(fdb,user,id)
+    fdb.close()
+    res = {"返回值": "ok"}
+    print(datetime.datetime.now(),"[%s]%s处理待办信息" % (remote_addr,user))
+    return jsonify(res)
+
+@app.route('/static/checkLogs',methods=["POST"])
+@jwt_required()
+def checkLogs():
+    try:
+        remote_addr = request.remote_addr
+        data = request.get_json()
+        start, end = data['start'], data['end']
+        fdb = flightDB(host=dbhost,port=dbport,user=dbuser,password=dbpassword,database=databaseDB4)
+        res=fdb.sort_queryTable("*",'logs',"产生时间<'%s' and 产生时间>'%s'"%(end,start),"产生时间","desc")
+        fdb.close()
+        print(datetime.datetime.now(),"[%s]查询全部日志请求"%remote_addr)
+        return jsonify(data=res)
+    except:
+        return jsonify(data={})
+
+@app.route('/static/tableWidgetDisplayChange',methods=["POST"])
+@jwt_required()
+def tableWidgetDisplayChange():
+    data = request.get_json()
+    selectedtime = data['selectedtime']
+    fdb = flightDB(host=dbhost,port=dbport,user=dbuser,password=dbpassword,database=databaseDB4)
+    res=TableWidgetDisplayChange(fdb,selectedtime)
+    fdb.close()
+    remote_addr = request.remote_addr
+    print(datetime.datetime.now(),"[%s]待办信息刷新请求"%remote_addr)
+    return jsonify(data=res, msg=(datetime.datetime.now(),"[%s]待办信息刷新请求"%remote_addr))
+
+@app.route('/static/get_dic',methods=["POST"])
+@jwt_required()
+def get_dic():
+    try:
+        remote_addr = request.remote_addr
+        data = request.get_json()['data']
+
+        fdb = flightDB(host = dbhost , port = dbport , user = dbuser , password = dbpassword , database = databaseDB4)
+        ress = Get_dic(fdb , data)
+        fdb.close()
+        res = {"返回值": ress}
+        print(datetime.datetime.now(),"[%s]获取人员信息EXCEL表格"%remote_addr)
+        res['msg'] = (datetime.datetime.now(),"[%s]获取人员信息EXCEL表格"%remote_addr)
+        return jsonify(res)
+    except:
+        fdb.close()
+        print(datetime.datetime.now(), "[%s]获取人员信息EXCEL表格失败" % remote_addr)
+        res={ "返回值" : "fail" }
+        return jsonify(res)
+
+
+@app.route('/static/updateStopFlight',methods=["POST"])
+@jwt_required()
+def updateStopFlight():
+    try:
+        remote_addr = request.remote_addr
+        data = request.get_json()['data']
+        fdb = flightDB(host=dbhost,port=dbport,user=dbuser,password=dbpassword,database=databaseDB4)
+        workLoad = flightDB(host=dbhost, port=dbport, user=dbuser, password=dbpassword, database=databaseWorkLoad)
+        ress=UpdateStopFlight(fdb,workLoad,data)
+        fdb.close()
+        workLoad.close()
+        res = { "返回值" : ress}
+        print(datetime.datetime.now(),"[%s]上传停场航班EXCEL数据"%remote_addr)
+        return jsonify(res)
+    except:
+        fdb.close()
+        workLoad.close()
+        print(datetime.datetime.now(), "[%s]上传停场航班EXCEL数据失败" % remote_addr)
+        return jsonify({"返回值": "fail", "msg":(datetime.datetime.now(), "[%s]上传停场航班EXCEL数据失败" % remote_addr)})
+
+@app.route('/static/updateTaskAuto',methods=["POST"])
+@jwt_required()
+def updateTaskAuto():
+    try:
+        remote_addr = request.remote_addr
+        data = request.get_json()['data']
+        fdb = flightDB(host=dbhost,port=dbport,user=dbuser,password=dbpassword,database=databaseDB4)
+        ress=UpdateTaskAuto(fdb,data)
+        fdb.close()
+        res = {"返回值":ress}
+        print(datetime.datetime.now(),"[%s]获取准备组任务EXCEL表格"%remote_addr)
+        res['msg'] = (datetime.datetime.now(),"[%s]获取准备组任务EXCEL表格"%remote_addr)
+        return jsonify(res)
+    except:
+        print(datetime.datetime.now(), "[%s]获取准备组任务EXCEL表格失败" % remote_addr)
+        return jsonify({"返回值":"fail","msg":("[%s]获取准备组任务EXCEL表格失败" % remote_addr)})
+
+@app.route('/static/saveRisktable')
+@jwt_required()
+def saveRisktable():
+    remote_addr = request.remote_addr
+    fdb = flightDB(host=dbhost,port=dbport,user=dbuser,password=dbpassword,database=databaseDB4)
+    res=SaveRisktable(fdb)
+    fdb.close()
+    print(datetime.datetime.now(),"[%s]导出风险数据库"%remote_addr)
+    return {"返回值":res, "msg":(datetime.datetime.now(),"[%s]导出风险数据库"%remote_addr)}
+
+@app.route('/static/getRiskData',methods=["POST"])
+@jwt_required()
+def getRiskData():
+    remote_addr = request.remote_addr
+    data = request.get_json()
+    bay, time, acno, actype = data['bay'], data['time'], data['acno'], data['actype']
+    fdb = flightDB(host=dbhost,port=dbport,user=dbuser,password=dbpassword,database=databaseDB4)
+    res=GetRiskData(fdb,bay,time,acno,actype)
+    fdb.close()
+    print(datetime.datetime.now(),"[%s]导出风险数据库"%remote_addr)
+    return {"返回值":res, "msg":(datetime.datetime.now(),"[%s]导出风险数据库"%remote_addr)}
+
+@app.route('/static/updateRiskdb',methods=["POST"])
+@jwt_required()
+def updateRiskdb():
+    try:
+        remote_addr = request.remote_addr
+        data = request.get_json()["data"]
+        fdb = flightDB(host=dbhost,port=dbport,user=dbuser,password=dbpassword,database=databaseDB4)
+        ress=UpdateRiskdb(fdb,data)
+        fdb.close()
+        res = {"返回值": ress}
+        print(datetime.datetime.now(),"[%s]获取风险数据库EXCEL表格"%remote_addr)
+        res['msg'] = (datetime.datetime.now(),"[%s]获取风险数据库EXCEL表格"%remote_addr)
+        return jsonify(res)
+    except:
+        fdb.close()
+        print(datetime.datetime.now(), "[%s]获取风险数据库EXCEL表格失败" % remote_addr)
+        return jsonify({"返回值": "fail", "msg":("[%s]获取风险数据库EXCEL表格失败" % remote_addr)})
+
+@app.route('/static/taskAtuoCheck',methods=["POST"])
+@jwt_required()
+def taskAtuoCheck():
+    remote_addr = request.remote_addr
+    data = request.get_json()
+    time = data['time']
+    fdb = flightDB(host=dbhost,port=dbport,user=dbuser,password=dbpassword,database=databaseDB4)
+    TaskAtuoCheck(fdb,time)
+    fdb.close()
+    res = {"返回值": "ok"}
+    print(datetime.datetime.now(),"[%s]确认准备组任务待办信息情况"%remote_addr)
+    res['msg'] = (datetime.datetime.now(),"[%s]确认准备组任务待办信息情况"%remote_addr)
+    return jsonify(res)
+
+@app.route('/static/createWorkloadtablesFromPg',methods=["POST"])
+@jwt_required()
+def createWorkloadtablesFromPg():
+    remote_addr = request.remote_addr
+    data = request.get_json()
+    selectedtime = data['selectedtime']
+    fdb = flightDB(host=dbhost,port=dbport,user=dbuser,password=dbpassword,database=databaseDB4)
+    workLoad = flightDB(host=dbhost,port=dbport,user=dbuser,password=dbpassword,database=databaseWorkLoad)
+    CreateWorkloadtablesFromPg(fdb,workLoad,selectedtime)
+    fdb.close()
+    workLoad.close()
+    res={"返回值":"ok"}
+    print(datetime.datetime.now(),"[%s]通过派工信息创建人员工作统计表"%remote_addr)
+    res['msg'] = (datetime.datetime.now(),"[%s]通过派工信息创建人员工作统计表"%remote_addr)
+    return jsonify(res)
+
+
+#--------------------------------------------------------------------------------------------------------
+
+@app.route('/getdict', methods=['GET'])
+@jwt_required()
+def getdict():
+    data = {
+        'data':['1','2','3','4','5','6','7','8','9'],
+        'data2':'data2_data2'
+    }
+    return returnTrue('this is message', data), 200
+
+
+
+
+#令牌刷新机制
+@app.route('/refresh', methods=['POST'])
+@jwt_required(refresh=True)
+def refresh():
+    current_user_id = get_jwt_identity()
+    new_access_token = create_access_token(identity=current_user_id)
+    return jsonify(access_token=new_access_token, msg='Refresh access_token success'), 200
+
+
+
+#用户角色与权限管理
+@app.route('/admin', methods=['GET'])
+@jwt_required()
+def admin():
+    current_user_id = get_jwt_identity()
+    user = query_user(current_user_id)
+    if user[0][3] != 'admin':
+        return jsonify({'message': 'Access denied'}), 403
+    return jsonify({'message': 'Hello admin'}), 200
+
+#'''
+@app.before_first_request
+def init():
+    if not app.config['initialized']:
+        print('####  Flask Start... ####')
+        global fl,si,singlePeopleNotice,loaclseverip
+        fl = utils.flight_list()
+        si = ipcall.searchinfo()
+        loaclseverip = get_local_ip()
+        print(f"当前服务器IP:{loaclseverip}")
+        singlePeopleNotice = initialize_file('D:\\flightinfo\\DATABASE\\singlepoeple_notice.txt',False)
+        app.config['initialized'] = True
+
+#if __name__ == '__main__':
+#    app.run(debug=True, host='0.0.0.0', port=5001)
+if __name__ == '__main__':
+    serve(app, host='0.0.0.0',port=5001, threads=32)
+    #serve(app, host='0.0.0.0',port=5001, threads=64)

+ 2 - 0
_init_.py

@@ -0,0 +1,2 @@
+from . import Functions
+from . import unitls

+ 71 - 0
apiFunction.py

@@ -0,0 +1,71 @@
+import json
+import requests
+
+
+class api_fucntion:
+    def __init__(self):
+        self.url = 'http://localhost:5001'
+        self.headers = {'Content-Type': 'application/json'}
+        #self.headers_with_token = {'Content-Type': 'application/x-www-form-urlencoded', 'Authorization': ''}
+        self.access_token = None
+        self.refresh_token = None
+
+    def headers_with_token(self, token):
+        return {'Content-Type': 'application/json', 'Authorization': token}
+
+    def get_access_token(self, username, password):
+        data = {'username': username, 'password': password}
+        response = requests.post(self.url + '/loginTable', headers=self.headers, data=json.dumps(data))
+        print(response.json())
+        if response.status_code == 200:
+            self.access_token = 'Bearer '+response.json()['access_token']
+            self.refresh_token = 'Bearer '+response.json()['refresh_token']
+        return response.json()['data']
+
+    def refresh_access_token(self):
+        response = requests.post(self.url + '/refresh', headers=self.headers_with_token(self.refresh_token))
+        self.access_token = 'Bearer '+response.json()['access_token']
+        if response.status_code == 200:
+            print('Successfully refreshed access token')
+            return True
+        else:
+            print('Failed to refresh access token')
+            return False
+
+    def request_get(self, uri, **kwargs):
+        response = requests.get(self.url + uri, headers=self.headers_with_token(self.access_token))
+        data = response.json()
+        print(type(data))
+        if response.status_code == 401 and data['msg'] == 'Token has expired':
+            if self.refresh_access_token():
+                response = requests.get(self.url + uri, headers=self.headers_with_token(self.access_token))
+                data = response.json()
+            else:
+                data['msg'] = 'Failed to refresh access token'
+        return data
+
+    def request_post(self, uri, **kwargs):
+        response = requests.post(self.url + uri, headers=self.headers_with_token(self.access_token), data=json.dumps(kwargs))
+        data = response.json()
+        if response.status_code == 401 and data['msg'] == 'Token has expired':
+            if self.refresh_access_token():
+                response = requests.post(self.url + uri, headers=self.headers_with_token(self.access_token), data=json.dumps(kwargs))
+                data = response.json()
+            else:
+                data['msg'] = 'Failed to refresh access token'
+        return data
+
+api_fc = api_fucntion()
+
+if __name__ == '__main__':
+    # access_token, refresh_token = login('jy', '123456')
+    # time.sleep(11)
+    # getdict(access_token)
+    # refreshing_token(refresh_token)
+    Api_fc = api_fucntion()
+
+    Api_fc.get_access_token('admin', 'admin123')
+    # Api_fc.request_post('/changeSinglepoepleNotice', boolsts='1')
+    Api_fc.request_get('/getSinglepoepleNotice')
+
+

+ 73 - 0
config.ini

@@ -0,0 +1,73 @@
+#QT_SEVER_CONFIG#
+#=====================#
+[DBserver]
+local_host =  192.168.2.25
+local_port = 9527
+#online_host = 192.168.2.4
+online_host = 192.168.2.49
+#online_host = 222.209.89.138
+online_port =9527
+flightdb4 = flightDB
+UserLoginDatabase = UserLoginDatabase
+databasefileDB=fileDB
+loginDB=loginDB
+
+#=====================#
+#log savepath#
+[FilePath]
+save_url = D:/managecenter
+
+#=====================#
+[DataTransferMode]
+flightDataTransfer=0
+displayDataTransfer=0
+
+#=====================#
+[Server_Class]
+Class=测试服务器,非管理员通知勿用
+
+#=====================#
+[Online_flight]
+#是否开启在线编辑同步
+Online_flight_sts=0
+#当不是同一个数据库,需要本地从云端获取写入peopleschule  主服务器设置,备用设置0
+SameDatabase=0
+#在线编辑状态,将提高刷新频率,主服务器设置,备用设置0,只在SameDatabase为1下启用
+HighRefreh=0
+
+
+#=====================#
+[Main_Sever]
+MainSever=192.168.2.25
+MainDatabase=192.168.2.25
+
+#======================-#
+#####====请勿随意修改===####
+#无胎压传感器的飞机,用英文“,”分割#
+[NO_TPIS]
+ACNO=8185,8186,8182,8665,8798
+
+#=====================#
+#####====请勿随意修改===####
+[Mesg_Time]
+ #航前未确认任务准备组警告时间100
+APZBZ=100
+#接机保障未确认任务准备组警告时间40
+JJZBZ=30
+#送机保障未确认任务准备组警告时间40
+ESZBZ=40
+
+#航前未确认任务个人警告时间105
+APGR=105
+#接机保障未确认任务个人警告时间45
+JJGR=45
+#送机保障未确认任务个人警告时间45
+ESGR=45
+
+ #航前未派工准备组警告时间120
+APPG=120
+#接机保障未派工准备组警告时间45
+JJPG=45
+#送机保障未派工准备组警告时间55,航前不判断
+ESPG=55
+

+ 108 - 0
scheduleCenter.py

@@ -0,0 +1,108 @@
+import datetime
+import json
+from concurrent.futures import ThreadPoolExecutor as ConcurrentThreadPoolExecutor
+import requests
+from apscheduler.events import EVENT_JOB_EXECUTED , EVENT_JOB_ERROR
+from apscheduler.executors.pool import ThreadPoolExecutor , ProcessPoolExecutor
+from apscheduler.schedulers.background import BlockingScheduler
+
+# 配置执行器
+executors = {
+    'default': ThreadPoolExecutor(20),  # 默认线程池,20个线程
+    'processpool': ProcessPoolExecutor(5)  # 进程池,5个进程
+}
+
+# 配置任务默认参数
+job_defaults = {
+    'coalesce': False,  # 任务积压时是否合并执行
+    'max_instances': 3,  # 最大并发实例数
+    'misfire_grace_time': 60  # 任务误点容忍时间(秒)
+}
+
+# 创建调度器并配置执行器
+scheduler = BlockingScheduler(
+    executors=executors,
+    job_defaults=job_defaults,
+    timezone='Asia/Shanghai'
+)
+def my_listener(event):
+    if event.exception:
+        print(f"【{datetime.datetime.now()}】多线程异常,错误信息{event.exception}")
+    else:
+        print(f"【{datetime.datetime.now()}】多线程任务执行正常:{event}")
+
+
+
+url = 'http://localhost:5001'
+headers = {'Content-Type': 'application/json'}
+num = 1
+# 添加任务到不同执行器
+
+# 定义A和B请求的处理函数(单独抽离)
+def handle_flight_data_request(req_type):
+    try:
+        response = requests.post(url + '/getFlightData2',data=json.dumps({'type': req_type}),headers=headers)
+        response_json = response.json()
+        print(f"【{datetime.datetime.now()}】{req_type}刷新;结果:{response_json}")
+    except Exception as e:
+        print(f"【{datetime.datetime.now()}】{req_type} 请求执行异常: {str(e)}")
+
+def getflightdata():
+    #print('getflightdata time:{}'.format(datetime.datetime.now()))
+    global num
+    """IO密集型任务,使用默认线程池"""
+    response = requests.get(url+'/checkLogin', headers=headers)
+    print(f"【{datetime.datetime.now()}】检查账号登录情况;结果为:{response.json()['code']}{response.json()['msg']}")
+    if response.json()['code'] == "0":
+        print(f"【{datetime.datetime.now()}】AMRO未登录")
+    else:
+        with ConcurrentThreadPoolExecutor(max_workers = 2) as executor :
+            if num > 2 :
+                # 异步执行A请求
+                executor.submit(handle_flight_data_request, 'A')
+                print(f"【{datetime.datetime.now()}】A刷新请求;")
+                num = 1
+            else:
+                # 异步执行B请求
+                executor.submit(handle_flight_data_request, 'B')
+                print(f"【{datetime.datetime.now()}】B刷新请求;")
+                num += 1
+        '''
+        if num >2:
+            getFlightDataA = requests.post(url+'/getFlightData2', data=json.dumps({'type':'A'}),headers=headers)
+            # result = getFlightDataA.json()
+            print(f"【{datetime.datetime.now()}】A 请求刷新;结果:{getFlightDataA.json()}")
+            num = 1
+        else:
+            getFlightDataB = requests.post(url+'/getFlightData2', data=json.dumps({'type':'B'}),headers=headers)
+            print(f"【{datetime.datetime.now()}】B 请求刷新;结果:{getFlightDataB.json()}")
+            num += 1
+'''
+def getTable():
+    response = requests.get(url+'/table', headers=headers)
+    print(f"【{datetime.datetime.now()}】最近一次刷新为:{response.json()['data'][-1]}")
+    #print(result)
+
+def postgresqlCheck():
+    #print('postgresqlCheck time:{}'.format(datetime.datetime.now()))
+    response = requests.get(url+'/postgresql', headers=headers)
+    print(f"【{datetime.datetime.now()}】云端计算请求:{response.json()}")
+    #print(result)
+
+def backupdata():
+    #print('backupdata time:{}'.format(datetime.datetime.now()))
+    response = requests.get(url+'/bakupdata', headers=headers)
+    print(f"【{datetime.datetime.now()}】5min备份请求:{response.json()}")
+
+def cpu_bound_job():
+    """CPU密集型任务,使用进程池"""
+    pass
+
+scheduler.add_job(getflightdata, 'interval', seconds=30)
+scheduler.add_job(getTable, 'interval', seconds=60)
+scheduler.add_job(postgresqlCheck, 'interval', seconds=60)
+scheduler.add_job(backupdata, 'interval', minutes=5)
+# scheduler.add_job(cpu_bound_job, 'interval', seconds=30, executor='processpool')
+print('开启定时任务')
+scheduler.add_listener(my_listener, EVENT_JOB_EXECUTED | EVENT_JOB_ERROR)
+scheduler.start()

文件差异内容过多而无法显示
+ 4 - 0
static/css/bootstrap.min.css


+ 105 - 0
static/css/dashboard.css

@@ -0,0 +1,105 @@
+/*
+ * Base structure
+ */
+
+/* Move down content because we have a fixed navbar that is 50px tall */
+body {
+  padding-top: 50px;
+}
+
+
+/*
+ * Global add-ons
+ */
+
+.sub-header {
+  padding-bottom: 10px;
+  border-bottom: 1px solid #eee;
+}
+
+/*
+ * Top navigation
+ * Hide default border to remove 1px line.
+ */
+.navbar-fixed-top {
+  border: 0;
+}
+
+/*
+ * Sidebar
+ */
+
+/* Hide for mobile, show later */
+.sidebar {
+  display: none;
+}
+@media (min-width: 768px) {
+  .sidebar {
+    position: fixed;
+    top: 51px;
+    bottom: 0;
+    left: 0;
+    z-index: 1000;
+    display: block;
+    padding: 20px;
+    overflow-x: hidden;
+    overflow-y: auto; /* Scrollable contents if viewport is shorter than content. */
+    background-color: #f5f5f5;
+    border-right: 1px solid #eee;
+  }
+}
+
+/* Sidebar navigation */
+.nav-sidebar {
+  margin-right: -21px; /* 20px padding + 1px border */
+  margin-bottom: 20px;
+  margin-left: -20px;
+}
+.nav-sidebar > li > a {
+  padding-right: 20px;
+  padding-left: 20px;
+}
+.nav-sidebar > .active > a,
+.nav-sidebar > .active > a:hover,
+.nav-sidebar > .active > a:focus {
+  color: #fff;
+  background-color: #428bca;
+}
+
+
+/*
+ * Main content
+ */
+
+.main {
+  padding: 20px;
+}
+@media (min-width: 768px) {
+  .main {
+    padding-right: 40px;
+    padding-left: 40px;
+  }
+}
+.main .page-header {
+  margin-top: 0;
+}
+
+
+/*
+ * Placeholder dashboard ideas
+ */
+
+.placeholders {
+  margin-bottom: 30px;
+  text-align: center;
+}
+.placeholders h4 {
+  margin-bottom: 0;
+}
+.placeholder {
+  margin-bottom: 20px;
+}
+.placeholder img {
+  display: inline-block;
+  border-radius: 50%;
+}

+ 455 - 0
static/css/dataTables.css

@@ -0,0 +1,455 @@
+/*
+ * Table styles
+ */
+table.dataTable {
+  width: 100%;
+  margin: 0 auto;
+  clear: both;
+  border-collapse: separate;
+  border-spacing: 0;
+  /*
+   * Header and footer styles
+   */
+  /*
+   * Body styles
+   */
+}
+table.dataTable thead th,
+table.dataTable tfoot th {
+  font-weight: bold;
+}
+table.dataTable thead th,
+table.dataTable thead td {
+  padding: 10px 18px;
+  border-bottom: 1px solid #111;
+}
+table.dataTable thead th:active,
+table.dataTable thead td:active {
+  outline: none;
+}
+table.dataTable tfoot th,
+table.dataTable tfoot td {
+  padding: 10px 18px 6px 18px;
+  border-top: 1px solid #111;
+}
+table.dataTable thead .sorting,
+table.dataTable thead .sorting_asc,
+table.dataTable thead .sorting_desc,
+table.dataTable thead .sorting_asc_disabled,
+table.dataTable thead .sorting_desc_disabled {
+  cursor: pointer;
+  *cursor: hand;
+}
+table.dataTable thead .sorting,
+table.dataTable thead .sorting_asc,
+table.dataTable thead .sorting_desc,
+table.dataTable thead .sorting_asc_disabled,
+table.dataTable thead .sorting_desc_disabled {
+  background-repeat: no-repeat;
+  background-position: center right;
+}
+table.dataTable thead .sorting {
+  background-image: url("../images/sort_both.png");
+}
+table.dataTable thead .sorting_asc {
+  background-image: url("../images/sort_asc.png");
+}
+table.dataTable thead .sorting_desc {
+  background-image: url("../images/sort_desc.png");
+}
+table.dataTable thead .sorting_asc_disabled {
+  background-image: url("../images/sort_asc_disabled.png");
+}
+table.dataTable thead .sorting_desc_disabled {
+  background-image: url("../images/sort_desc_disabled.png");
+}
+table.dataTable tbody tr {
+  background-color: #ffffff;
+}
+table.dataTable tbody tr.selected {
+  background-color: #B0BED9;
+}
+table.dataTable tbody th,
+table.dataTable tbody td {
+  padding: 8px 10px;
+}
+table.dataTable.row-border tbody th, table.dataTable.row-border tbody td, table.dataTable.display tbody th, table.dataTable.display tbody td {
+  border-top: 1px solid #ddd;
+}
+table.dataTable.row-border tbody tr:first-child th,
+table.dataTable.row-border tbody tr:first-child td, table.dataTable.display tbody tr:first-child th,
+table.dataTable.display tbody tr:first-child td {
+  border-top: none;
+}
+table.dataTable.cell-border tbody th, table.dataTable.cell-border tbody td {
+  border-top: 1px solid #ddd;
+  border-right: 1px solid #ddd;
+}
+table.dataTable.cell-border tbody tr th:first-child,
+table.dataTable.cell-border tbody tr td:first-child {
+  border-left: 1px solid #ddd;
+}
+table.dataTable.cell-border tbody tr:first-child th,
+table.dataTable.cell-border tbody tr:first-child td {
+  border-top: none;
+}
+table.dataTable.stripe tbody tr.odd, table.dataTable.display tbody tr.odd {
+  background-color: #f9f9f9;
+}
+table.dataTable.stripe tbody tr.odd.selected, table.dataTable.display tbody tr.odd.selected {
+  background-color: #acbad4;
+}
+table.dataTable.hover tbody tr:hover, table.dataTable.display tbody tr:hover {
+  background-color: #f6f6f6;
+}
+table.dataTable.hover tbody tr:hover.selected, table.dataTable.display tbody tr:hover.selected {
+  background-color: #aab7d1;
+}
+table.dataTable.order-column tbody tr > .sorting_1,
+table.dataTable.order-column tbody tr > .sorting_2,
+table.dataTable.order-column tbody tr > .sorting_3, table.dataTable.display tbody tr > .sorting_1,
+table.dataTable.display tbody tr > .sorting_2,
+table.dataTable.display tbody tr > .sorting_3 {
+  background-color: #fafafa;
+}
+table.dataTable.order-column tbody tr.selected > .sorting_1,
+table.dataTable.order-column tbody tr.selected > .sorting_2,
+table.dataTable.order-column tbody tr.selected > .sorting_3, table.dataTable.display tbody tr.selected > .sorting_1,
+table.dataTable.display tbody tr.selected > .sorting_2,
+table.dataTable.display tbody tr.selected > .sorting_3 {
+  background-color: #acbad5;
+}
+table.dataTable.display tbody tr.odd > .sorting_1, table.dataTable.order-column.stripe tbody tr.odd > .sorting_1 {
+  background-color: #f1f1f1;
+}
+table.dataTable.display tbody tr.odd > .sorting_2, table.dataTable.order-column.stripe tbody tr.odd > .sorting_2 {
+  background-color: #f3f3f3;
+}
+table.dataTable.display tbody tr.odd > .sorting_3, table.dataTable.order-column.stripe tbody tr.odd > .sorting_3 {
+  background-color: whitesmoke;
+}
+table.dataTable.display tbody tr.odd.selected > .sorting_1, table.dataTable.order-column.stripe tbody tr.odd.selected > .sorting_1 {
+  background-color: #a6b4cd;
+}
+table.dataTable.display tbody tr.odd.selected > .sorting_2, table.dataTable.order-column.stripe tbody tr.odd.selected > .sorting_2 {
+  background-color: #a8b5cf;
+}
+table.dataTable.display tbody tr.odd.selected > .sorting_3, table.dataTable.order-column.stripe tbody tr.odd.selected > .sorting_3 {
+  background-color: #a9b7d1;
+}
+table.dataTable.display tbody tr.even > .sorting_1, table.dataTable.order-column.stripe tbody tr.even > .sorting_1 {
+  background-color: #fafafa;
+}
+table.dataTable.display tbody tr.even > .sorting_2, table.dataTable.order-column.stripe tbody tr.even > .sorting_2 {
+  background-color: #fcfcfc;
+}
+table.dataTable.display tbody tr.even > .sorting_3, table.dataTable.order-column.stripe tbody tr.even > .sorting_3 {
+  background-color: #fefefe;
+}
+table.dataTable.display tbody tr.even.selected > .sorting_1, table.dataTable.order-column.stripe tbody tr.even.selected > .sorting_1 {
+  background-color: #acbad5;
+}
+table.dataTable.display tbody tr.even.selected > .sorting_2, table.dataTable.order-column.stripe tbody tr.even.selected > .sorting_2 {
+  background-color: #aebcd6;
+}
+table.dataTable.display tbody tr.even.selected > .sorting_3, table.dataTable.order-column.stripe tbody tr.even.selected > .sorting_3 {
+  background-color: #afbdd8;
+}
+table.dataTable.display tbody tr:hover > .sorting_1, table.dataTable.order-column.hover tbody tr:hover > .sorting_1 {
+  background-color: #eaeaea;
+}
+table.dataTable.display tbody tr:hover > .sorting_2, table.dataTable.order-column.hover tbody tr:hover > .sorting_2 {
+  background-color: #ececec;
+}
+table.dataTable.display tbody tr:hover > .sorting_3, table.dataTable.order-column.hover tbody tr:hover > .sorting_3 {
+  background-color: #efefef;
+}
+table.dataTable.display tbody tr:hover.selected > .sorting_1, table.dataTable.order-column.hover tbody tr:hover.selected > .sorting_1 {
+  background-color: #a2aec7;
+}
+table.dataTable.display tbody tr:hover.selected > .sorting_2, table.dataTable.order-column.hover tbody tr:hover.selected > .sorting_2 {
+  background-color: #a3b0c9;
+}
+table.dataTable.display tbody tr:hover.selected > .sorting_3, table.dataTable.order-column.hover tbody tr:hover.selected > .sorting_3 {
+  background-color: #a5b2cb;
+}
+table.dataTable.no-footer {
+  border-bottom: 1px solid #111;
+}
+table.dataTable.nowrap th, table.dataTable.nowrap td {
+  white-space: nowrap;
+}
+table.dataTable.compact thead th,
+table.dataTable.compact thead td {
+  padding: 4px 17px 4px 4px;
+}
+table.dataTable.compact tfoot th,
+table.dataTable.compact tfoot td {
+  padding: 4px;
+}
+table.dataTable.compact tbody th,
+table.dataTable.compact tbody td {
+  padding: 4px;
+}
+table.dataTable th.dt-left,
+table.dataTable td.dt-left {
+  text-align: left;
+}
+table.dataTable th.dt-center,
+table.dataTable td.dt-center,
+table.dataTable td.dataTables_empty {
+  text-align: center;
+}
+table.dataTable th.dt-right,
+table.dataTable td.dt-right {
+  text-align: right;
+}
+table.dataTable th.dt-justify,
+table.dataTable td.dt-justify {
+  text-align: justify;
+}
+table.dataTable th.dt-nowrap,
+table.dataTable td.dt-nowrap {
+  white-space: nowrap;
+}
+table.dataTable thead th.dt-head-left,
+table.dataTable thead td.dt-head-left,
+table.dataTable tfoot th.dt-head-left,
+table.dataTable tfoot td.dt-head-left {
+  text-align: left;
+}
+table.dataTable thead th.dt-head-center,
+table.dataTable thead td.dt-head-center,
+table.dataTable tfoot th.dt-head-center,
+table.dataTable tfoot td.dt-head-center {
+  text-align: center;
+}
+table.dataTable thead th.dt-head-right,
+table.dataTable thead td.dt-head-right,
+table.dataTable tfoot th.dt-head-right,
+table.dataTable tfoot td.dt-head-right {
+  text-align: right;
+}
+table.dataTable thead th.dt-head-justify,
+table.dataTable thead td.dt-head-justify,
+table.dataTable tfoot th.dt-head-justify,
+table.dataTable tfoot td.dt-head-justify {
+  text-align: justify;
+}
+table.dataTable thead th.dt-head-nowrap,
+table.dataTable thead td.dt-head-nowrap,
+table.dataTable tfoot th.dt-head-nowrap,
+table.dataTable tfoot td.dt-head-nowrap {
+  white-space: nowrap;
+}
+table.dataTable tbody th.dt-body-left,
+table.dataTable tbody td.dt-body-left {
+  text-align: left;
+}
+table.dataTable tbody th.dt-body-center,
+table.dataTable tbody td.dt-body-center {
+  text-align: center;
+}
+table.dataTable tbody th.dt-body-right,
+table.dataTable tbody td.dt-body-right {
+  text-align: right;
+}
+table.dataTable tbody th.dt-body-justify,
+table.dataTable tbody td.dt-body-justify {
+  text-align: justify;
+}
+table.dataTable tbody th.dt-body-nowrap,
+table.dataTable tbody td.dt-body-nowrap {
+  white-space: nowrap;
+}
+
+table.dataTable,
+table.dataTable th,
+table.dataTable td {
+  -webkit-box-sizing: content-box;
+  box-sizing: content-box;
+}
+
+/*
+ * Control feature layout
+ */
+.dataTables_wrapper {
+  position: relative;
+  clear: both;
+  *zoom: 1;
+  zoom: 1;
+}
+.dataTables_wrapper .dataTables_length {
+  float: left;
+}
+.dataTables_wrapper .dataTables_filter {
+  float: right;
+  text-align: right;
+}
+.dataTables_wrapper .dataTables_filter input {
+  margin-left: 0.5em;
+}
+.dataTables_wrapper .dataTables_info {
+  clear: both;
+  float: left;
+  padding-top: 0.755em;
+}
+.dataTables_wrapper .dataTables_paginate {
+  float: right;
+  text-align: right;
+  padding-top: 0.25em;
+}
+.dataTables_wrapper .dataTables_paginate .paginate_button {
+  box-sizing: border-box;
+  display: inline-block;
+  min-width: 1.5em;
+  padding: 0.5em 1em;
+  margin-left: 2px;
+  text-align: center;
+  text-decoration: none !important;
+  cursor: pointer;
+  *cursor: hand;
+  color: #333 !important;
+  border: 1px solid transparent;
+  border-radius: 2px;
+}
+.dataTables_wrapper .dataTables_paginate .paginate_button.current, .dataTables_wrapper .dataTables_paginate .paginate_button.current:hover {
+  color: #333 !important;
+  border: 1px solid #979797;
+  background-color: white;
+  background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, white), color-stop(100%, #dcdcdc));
+  /* Chrome,Safari4+ */
+  background: -webkit-linear-gradient(top, white 0%, #dcdcdc 100%);
+  /* Chrome10+,Safari5.1+ */
+  background: -moz-linear-gradient(top, white 0%, #dcdcdc 100%);
+  /* FF3.6+ */
+  background: -ms-linear-gradient(top, white 0%, #dcdcdc 100%);
+  /* IE10+ */
+  background: -o-linear-gradient(top, white 0%, #dcdcdc 100%);
+  /* Opera 11.10+ */
+  background: linear-gradient(to bottom, white 0%, #dcdcdc 100%);
+  /* W3C */
+}
+.dataTables_wrapper .dataTables_paginate .paginate_button.disabled, .dataTables_wrapper .dataTables_paginate .paginate_button.disabled:hover, .dataTables_wrapper .dataTables_paginate .paginate_button.disabled:active {
+  cursor: default;
+  color: #666 !important;
+  border: 1px solid transparent;
+  background: transparent;
+  box-shadow: none;
+}
+.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
+  color: white !important;
+  border: 1px solid #111;
+  background-color: #585858;
+  background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #585858), color-stop(100%, #111));
+  /* Chrome,Safari4+ */
+  background: -webkit-linear-gradient(top, #585858 0%, #111 100%);
+  /* Chrome10+,Safari5.1+ */
+  background: -moz-linear-gradient(top, #585858 0%, #111 100%);
+  /* FF3.6+ */
+  background: -ms-linear-gradient(top, #585858 0%, #111 100%);
+  /* IE10+ */
+  background: -o-linear-gradient(top, #585858 0%, #111 100%);
+  /* Opera 11.10+ */
+  background: linear-gradient(to bottom, #585858 0%, #111 100%);
+  /* W3C */
+}
+.dataTables_wrapper .dataTables_paginate .paginate_button:active {
+  outline: none;
+  background-color: #2b2b2b;
+  background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #2b2b2b), color-stop(100%, #0c0c0c));
+  /* Chrome,Safari4+ */
+  background: -webkit-linear-gradient(top, #2b2b2b 0%, #0c0c0c 100%);
+  /* Chrome10+,Safari5.1+ */
+  background: -moz-linear-gradient(top, #2b2b2b 0%, #0c0c0c 100%);
+  /* FF3.6+ */
+  background: -ms-linear-gradient(top, #2b2b2b 0%, #0c0c0c 100%);
+  /* IE10+ */
+  background: -o-linear-gradient(top, #2b2b2b 0%, #0c0c0c 100%);
+  /* Opera 11.10+ */
+  background: linear-gradient(to bottom, #2b2b2b 0%, #0c0c0c 100%);
+  /* W3C */
+  box-shadow: inset 0 0 3px #111;
+}
+.dataTables_wrapper .dataTables_paginate .ellipsis {
+  padding: 0 1em;
+}
+.dataTables_wrapper .dataTables_processing {
+  position: absolute;
+  top: 50%;
+  left: 50%;
+  width: 100%;
+  height: 40px;
+  margin-left: -50%;
+  margin-top: -25px;
+  padding-top: 20px;
+  text-align: center;
+  font-size: 1.2em;
+  background-color: white;
+  background: -webkit-gradient(linear, left top, right top, color-stop(0%, rgba(255, 255, 255, 0)), color-stop(25%, rgba(255, 255, 255, 0.9)), color-stop(75%, rgba(255, 255, 255, 0.9)), color-stop(100%, rgba(255, 255, 255, 0)));
+  background: -webkit-linear-gradient(left, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.9) 25%, rgba(255, 255, 255, 0.9) 75%, rgba(255, 255, 255, 0) 100%);
+  background: -moz-linear-gradient(left, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.9) 25%, rgba(255, 255, 255, 0.9) 75%, rgba(255, 255, 255, 0) 100%);
+  background: -ms-linear-gradient(left, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.9) 25%, rgba(255, 255, 255, 0.9) 75%, rgba(255, 255, 255, 0) 100%);
+  background: -o-linear-gradient(left, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.9) 25%, rgba(255, 255, 255, 0.9) 75%, rgba(255, 255, 255, 0) 100%);
+  background: linear-gradient(to right, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.9) 25%, rgba(255, 255, 255, 0.9) 75%, rgba(255, 255, 255, 0) 100%);
+}
+.dataTables_wrapper .dataTables_length,
+.dataTables_wrapper .dataTables_filter,
+.dataTables_wrapper .dataTables_info,
+.dataTables_wrapper .dataTables_processing,
+.dataTables_wrapper .dataTables_paginate {
+  color: #333;
+}
+.dataTables_wrapper .dataTables_scroll {
+  clear: both;
+}
+.dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody {
+  *margin-top: -1px;
+  -webkit-overflow-scrolling: touch;
+}
+.dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody > table > thead > tr > th, .dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody > table > thead > tr > td, .dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody > table > tbody > tr > th, .dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody > table > tbody > tr > td {
+  vertical-align: middle;
+}
+.dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody > table > thead > tr > th > div.dataTables_sizing,
+.dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody > table > thead > tr > td > div.dataTables_sizing, .dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody > table > tbody > tr > th > div.dataTables_sizing,
+.dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody > table > tbody > tr > td > div.dataTables_sizing {
+  height: 0;
+  overflow: hidden;
+  margin: 0 !important;
+  padding: 0 !important;
+}
+.dataTables_wrapper.no-footer .dataTables_scrollBody {
+  border-bottom: 1px solid #111;
+}
+.dataTables_wrapper.no-footer div.dataTables_scrollHead > table,
+.dataTables_wrapper.no-footer div.dataTables_scrollBody > table {
+  border-bottom: none;
+}
+.dataTables_wrapper:after {
+  visibility: hidden;
+  display: block;
+  content: "";
+  clear: both;
+  height: 0;
+}
+
+@media screen and (max-width: 767px) {
+  .dataTables_wrapper .dataTables_info,
+  .dataTables_wrapper .dataTables_paginate {
+    float: none;
+    text-align: center;
+  }
+  .dataTables_wrapper .dataTables_paginate {
+    margin-top: 0.5em;
+  }
+}
+@media screen and (max-width: 640px) {
+  .dataTables_wrapper .dataTables_length,
+  .dataTables_wrapper .dataTables_filter {
+    float: none;
+    text-align: center;
+  }
+  .dataTables_wrapper .dataTables_filter {
+    margin-top: 0.5em;
+  }
+}

+ 97 - 0
static/css/moveitem.css

@@ -0,0 +1,97 @@
+body {
+		height: 100%;
+		width: 100%;
+		overflow: hidden;
+	}
+	.moveItem_title {
+		margin: 0;
+		display: inline-block;
+		width: calc(100% - 95px);
+		padding: 10px;
+		cursor: move;
+	}
+	.myMoveItem {
+		width: 560px;
+		height: 380px;
+		background-color: white;
+		box-shadow: 1px 1px 6px rgba(0,0,0,.2);
+		position: absolute;
+		z-index: 20;
+		border-radius: 2px;
+	}
+	.moveItem_oper {
+		position: absolute;
+		right: 10px;
+		display: inline;
+		padding: 10px 0;
+	}
+	.moveItem_header {
+		display: flex;
+		background-color: #F8F8F8;
+	}
+	.moveItem_body {
+		/* height: calc(100% - 179px); */
+		height: calc(100% - 97px);
+		padding: 8px;
+		background-color: #eee;
+		overflow: hidden;
+	}
+	.moveItem_footer {
+		display: flex;
+		padding: 8px;
+	}
+	.moveItem_do {
+		color: #FFF;
+		background-color: #1E9FFF;
+		padding: 4px 15px;
+		border: 0;
+		cursor: pointer;
+		position: absolute;
+		right: 73px;
+	}
+	.moveItem_do:hover {
+		color: #6698FF;
+		background-color: transparent;
+		border: 1px solid #6698FF;
+		padding: 3px 14px;
+	}
+	.moveItem_cancel {
+		color: #FFF;
+		background-color: rgba(0, 0, 0, .2);
+		padding: 4px 15px;
+		border: 0;
+		cursor: pointer;
+		position: absolute;
+		right: 10px;
+	}
+	.moveItem_cancel:hover {
+		color: rgba(0, 0, 0, .3);
+		background-color: transparent;
+		border: 1px solid rgba(0, 0, 0, .3);
+		padding: 3px 14px;
+	}
+	.moveItem_resize {
+		cursor: se-resize;
+		position: absolute;
+		right: -2px;
+		bottom: -2px;
+		height: 10px;
+		width: 10px;
+	}
+	.moveItem_fullScreen, .moveItem_normalScreen, .moveItem_close {
+		background-color: transparent;
+		border: 0;
+		cursor: pointer;
+	}
+	.moveItem_close:hover {
+		color: red;
+	}
+	.moveItem_fullScreen:hover, .moveItem_normalScreen:hover {
+		color: #3280fc;
+	}
+	.moveItem_fullScreen {
+		right: 40px;
+	}
+	.moveItem_normalScreen {
+		display: none;
+	}

+ 40 - 0
static/css/signin.css

@@ -0,0 +1,40 @@
+body {
+  padding-top: 40px;
+  padding-bottom: 40px;
+  background-color: #eee;
+}
+
+.form-signin {
+  max-width: 330px;
+  padding: 15px;
+  margin: 0 auto;
+}
+.form-signin .form-signin-heading,
+.form-signin .checkbox {
+  margin-bottom: 10px;
+}
+.form-signin .checkbox {
+  font-weight: normal;
+}
+.form-signin .form-control {
+  position: relative;
+  height: auto;
+  -webkit-box-sizing: border-box;
+     -moz-box-sizing: border-box;
+          box-sizing: border-box;
+  padding: 10px;
+  font-size: 16px;
+}
+.form-signin .form-control:focus {
+  z-index: 2;
+}
+.form-signin input[type="email"] {
+  margin-bottom: -1px;
+  border-bottom-right-radius: 0;
+  border-bottom-left-radius: 0;
+}
+.form-signin input[type="password"] {
+  margin-bottom: 10px;
+  border-top-left-radius: 0;
+  border-top-right-radius: 0;
+}

二进制
static/fonts/glyphicons-halflings-regular.eot


部分文件因为文件数量过多而无法显示