maohu 1 ماه پیش
والد
کامیت
d7f61fbc89

+ 1 - 0
Functions/DButilsFunction/__init__.py

@@ -68,3 +68,4 @@ from .Getworkload import Getworkload
 from .handoverStsChange import HandoverStsChange
 from .ManChangeCosttime import ManCahangeWorkload
 from .UpdateNoteItem import UpdateNoteItem
+from .postgresql_backup import postgresql_bakup

+ 77 - 38
Functions/DButilsFunction/checkFlightAlert.py

@@ -3,7 +3,9 @@ import datetime
 from unitls.LogerinTxt import app_logger
 import unitls.baseFunction as baseFunction
 from unitls.StaticDataclass import get_dic
+from unitls.settings import MesgTime
 
+APZBZ, JJZBZ, ESZBZ, APGR, JJGR, ESGR,APPG,JJPG,ESPG=MesgTime()
 
 def WarningInsert(database, taskid, mesg, types):
     newdic = {"航班编号": "%s" % taskid, "警告信息": mesg, "信息状态": "",
@@ -133,6 +135,10 @@ def checkFlightAlert(database:flightDB, singlePeopleNotice):
 
                             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(singlelogsall):
+                                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,推送准备组,直到点击放行
@@ -185,6 +191,10 @@ def checkFlightAlert(database:flightDB, singlePeopleNotice):
                                 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(singlelogsall):
+                                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,推送准备组,直到点击放行
@@ -231,39 +241,51 @@ def checkFlightAlert(database:flightDB, singlePeopleNotice):
 
                             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(singlelogsall):
+                                mesg="[机位未出提醒]请确认%s/%s机位情况!"%(a,b)
+                                newdic = {"处理人": "'系统确认状态'", "处理时间": "'%s'" % now}
+                                database.lazyUpdateItem('logs', newdic, "航班编号='%s' and 警告信息='%s'" % (i[0],mesg))
 
 
                         #航前 起飞前 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=100)
-                            esbztime=datetime.datetime.strptime(std, "%Y-%m-%d %H:%M:%S")-datetime.timedelta(minutes=40)
-
-                            bztztime=datetime.datetime.strptime(std, "%Y-%m-%d %H:%M:%S")-datetime.timedelta(minutes=105)
-                            estzbztime=datetime.datetime.strptime(std, "%Y-%m-%d %H:%M:%S")-datetime.timedelta(minutes=45)
+                            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 == "短停":
-                            bztime=datetime.datetime.strptime(eta, "%Y-%m-%d %H:%M:%S")-datetime.timedelta(minutes=40)#40
-                            esbztime = datetime.datetime.strptime(std, "%Y-%m-%d %H:%M:%S") - datetime.timedelta(minutes=40)#40
-                            bztztime=datetime.datetime.strptime(eta, "%Y-%m-%d %H:%M:%S")-datetime.timedelta(minutes=45)
-                            estzbztime = datetime.datetime.strptime(std, "%Y-%m-%d %H:%M:%S") - datetime.timedelta(minutes=45)#45通知
+                            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=40)
-                            esbztime = datetime.datetime.strptime(std, "%Y-%m-%d %H:%M:%S") - datetime.timedelta(minutes=40)
-                            bztztime=datetime.datetime.strptime(eta, "%Y-%m-%d %H:%M:%S")-datetime.timedelta(minutes=45)
-                            estzbztime = datetime.datetime.strptime(std, "%Y-%m-%d %H:%M:%S") - datetime.timedelta(minutes=45)
+                            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=40)
+                            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=45)
+                            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=""
                         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(),"航前或接机任务接送通知")
@@ -271,15 +293,17 @@ def checkFlightAlert(database:flightDB, singlePeopleNotice):
 
 
                         if (wxry != "" or fxry != "") and bztime < now:
-                            peoples = ""
-                            res=wxry.split(",")+fxry.split(",")
+                            res = wxry.split(",")+fxry.split(",")
                             for l in res:
                                 if "√" not in l:
-                                    peoples = peoples+"、"+l if peoples != "" else l
-                            if peoples != "":
-                                mesg = "请确认%s/%s/%s/%s人员任务接收情况!" % (a, b, c, peoples)
-                                if mesg not in str(singlelogsall):
-                                    WarningInsert(database, i[0], mesg, "任务接收监控")
+                                    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)
+                                    if mesg in str(singlelogsall):
+                                        newdic = {"处理人": "'系统确认状态'", "处理时间": "'%s'" % now}
+                                        database.lazyUpdateItem('logs', newdic, "航班编号='%s' and 警告信息='%s'" % (i[0],mesg))
 
                         if ecsj != "" and estzbztime != "" and estzbztime < now and judgeFunction(singlelogsall1,"航前或接机任务接送通知",2) and singlePeopleNotice and "【交班航班】" not in fj:
                             peoples = ""
@@ -293,29 +317,47 @@ def checkFlightAlert(database:flightDB, singlePeopleNotice):
                                 noteInsert(database, i[0], "%s/%s/%s二送任务接送通知" % (a, b, c), "二送任务接送通知")
 
                         if ecsj != "" and esbztime != "" and esbztime < now: #and "任务执行情况" not in str(singlelogsall):
-                            peoples=""
-                            res=ecsj.split(",")
+                            res = ecsj.split(",")
                             for l in res:
                                 if "√" not in l:
-                                    peoples=peoples+"、"+l if peoples != "" else l
-                            if peoples != "":
-                                mesg = "请确认%s/%s/%s/%s人员二送任务接收情况!" % (a, b, c, peoples)
-                                if mesg not in str(singlelogsall):
-                                    WarningInsert(database, i[0], mesg, "任务接收监控")
-
-                        if wxry == "" and bztztime < now:
+                                    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)
+                                    if mesg in str(singlelogsall):
+                                        newdic = {"处理人": "'系统确认状态'", "处理时间": "'%s'" % now}
+                                        database.lazyUpdateItem('logs', newdic, "航班编号='%s' and 警告信息='%s'" % (i[0],mesg))
+
+                        if wxry == "" and pgtime < now:
                             mesg = "请及时安排%s/%s/%s保障人员并派工!" % (a, b, c)
                             if mesg not in str(singlelogsall):
                                 WarningInsert(database, i[0], mesg, "任务安排监控")
-                        if fxry == "" and bztztime < now:
+                        elif wxry != "":
+                            mesg = "请及时安排%s/%s/%s保障人员并派工!" % (a, b, c)
+                            if mesg in str(singlelogsall):
+                                newdic = {"处理人": "'系统确认状态'", "处理时间": "'%s'" % now}
+                                database.lazyUpdateItem('logs', newdic, "航班编号='%s' and 警告信息='%s'" % (i[0],mesg))
+                        if 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(singlelogsall):
+                                newdic = {"处理人": "'系统确认状态'", "处理时间": "'%s'" % now}
+                                database.lazyUpdateItem('logs', newdic, "航班编号='%s' and 警告信息='%s'" % (i[0],mesg))
 
-                        if ecsj == "" and b != "航前" and esbztime != "" and estzbztime < now:
+                        if 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(singlelogsall):
+                                newdic = {"处理人": "'系统确认状态'", "处理时间": "'%s'" % now}
+                                database.lazyUpdateItem('logs', newdic, "航班编号='%s' and 警告信息='%s'" % (i[0],mesg))
+
 
 
                 for i in flightcheck2:
@@ -330,7 +372,7 @@ def checkFlightAlert(database:flightDB, singlePeopleNotice):
                         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 =="航前":
+                        if b == "航前":
                             c = data2[0][11]
                         else:
                             c = data2[0][10]
@@ -343,13 +385,10 @@ def checkFlightAlert(database:flightDB, singlePeopleNotice):
                             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=="短停" :
                             TD = std
                             TD_time_120 = datetime.datetime.strptime(TD, "%Y-%m-%d %H:%M:%S") - datetime.timedelta(minutes=120)
@@ -365,7 +404,7 @@ def checkFlightAlert(database:flightDB, singlePeopleNotice):
                         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:
+                            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):

+ 3 - 1
Functions/DButilsFunction/checkworkload_New.py

@@ -9,7 +9,7 @@ endtimeReDic={"WXJJ":10,"WXAP":10,"WXAF":120,"WXTAF":60,"FXAP":10,"FXAF":120,"FX
 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}
 
 #注意,在航后接机,特后前接机需要移除放行,否则会平摊过多分值
-nowids=[]
+
 
 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 ""
@@ -92,6 +92,8 @@ def Computer(workload,ids ,start ,end ,bay ,peoples,flightdate,taskid,flighttype
 
 
 def checkWorkerlaod_new(database:flightDB, workload:flightDB,nowDayStr1,nowDay_11):
+    global nowids
+    nowids = []
     if nowDayStr1 == nowDay_11:
         checkdays = [nowDayStr1]
     else:

+ 17 - 2
Functions/DButilsFunction/insertTaskDataToTable.py

@@ -4,6 +4,8 @@ from unitls.StaticDataclass import get_dic
 from unitls.LogerinTxt import app_logger
 import unitls.baseFunction as baseFunction
 import re
+from unitls.settings import NO_TPIS
+no_tips_acno=NO_TPIS()
 
 
 def waringinsert(database,text,taskid,col):
@@ -49,7 +51,7 @@ def checkTASKTYPE(row,en2zh,database,flightdate,LOGsdeactive,headerLabelKey,head
 
 def judgeWaringsts(bztime,oldbztime): #只抑制警告,不抑制note
     now = datetime.datetime.now()
-    starttime = now-datetime.timedelta(hours=3)
+    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
@@ -444,6 +446,19 @@ def insertTaskDataToTable(database: flightDB, datatime: str, jsonData,jsonData2)
                                         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"], "机号")
@@ -465,7 +480,7 @@ def insertTaskDataToTable(database: flightDB, datatime: str, jsonData,jsonData2)
                         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) < 4:
+                            if int(newcancelid) < 3:
                                 newdic={"取消标志":"'%s'"%newcancelid}
                                 database.lazyUpdateItem('TaskFlightinfo{}'.format(nowDayStr), newdic, "航班编号='%s'" %iii[0])
                             else:

+ 54 - 0
Functions/DButilsFunction/postgresql_backup.py

@@ -0,0 +1,54 @@
+from .flightDB import flightDB
+import datetime
+from unitls.LogerinTxt import app_logger
+from unitls.StaticDataclass import get_dic
+
+
+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}
+    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]#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)
+                    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"

+ 6 - 4
Functions/DButilsFunction/sortFlighttime.py

@@ -3,7 +3,6 @@ import datetime
 from .initFlightDatabase import initFlightDatabase
 import unitls.baseFunction as baseFunction
 from unitls.LogerinTxt import app_logger
-lazyinsert=[]
 
 def updateData(database:flightDB, id,taskid,time,flighttype,flight_date_str,classstr,nowDayStr):
     try:
@@ -47,6 +46,8 @@ def checkData(database,taskid,sendtime,flighttype,flight_date_str,sort_flight_id
         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")
@@ -234,20 +235,20 @@ def sortFlighttime(database:flightDB,wokload:flightDB):
 
                 if i[3] == "TR" 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)
+                        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[7] == "" and i[6] !="" and i[5] !="":
+                    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[7] == "" and i[6] == "" and i[5] != "":
+                    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):
@@ -327,5 +328,6 @@ def sortFlighttime(database:flightDB,wokload:flightDB):
         #print(e)
         database.FunctionCommit()
         app_logger.log_error(e)
+        app_logger.log_error("排序失败,可能缺失航班")
 
     print(datetime.datetime.now(),'[数据库操作]结束排序')

+ 4 - 3
Functions/DButilsFunction/tableWidgetDispaly2_66.py

@@ -106,13 +106,14 @@ def functionDisplay2(row, rowNum, TaskFlightinfoAll,waringMessageIDs,peopleSched
     else:
         c = ''
 
-    QColorList = ['black', 'white', '#F3ECD9', '#BAD1D1', '#DDE2E3', '#647277', 'red', 'blue']
+    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[1]
+        color_code1 = QColorList[0]
         color_code2 = QColorList[1]
-        color_code3 = QColorList[1]
+        color_code3 = QColorList[0]
     elif row[5] == "4":
         color_code = QColorList[5]
         color_code1 = QColorList[1]

+ 7 - 9
Functions/DButilsFunction/tableWidgetDispaly_66.py

@@ -175,24 +175,22 @@ def functionDisaplay(row,rowNum,TaskFlightinfoAlldata, workjobDataAll, flightSts
     else:
         c = ''
 
-    QColorList = ['black', 'white', '#F3ECD9', '#BAD1D1', '#DDE2E3', '#647277', 'red', 'blue']
+    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[1]
+        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"])):
+    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_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"])):
+    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_code1 = QColorList[0]
         color_code2 = QColorList[1]
         color_code3 = QColorList[1]
     elif row[5] == "4":

+ 3 - 16
Functions/DButilsFunction/updateStopFlight.py

@@ -5,13 +5,10 @@ import datetime
 from .sortFlighttime import sortFlighttime
 from .sortFlighttime2 import sortFlighttime2
 import time
-from unitls.settings import DBServer, flightDB4
 from unitls.StaticDataclass import get_dic
-host, port, user1, password,online_host, online_port, online_user,online_password = DBServer()
-databaseflightDB4=flightDB4()
 
 
-def updateStopFlight(database:flightDB, fileName):
+def updateStopFlight(database:flightDB,workLoad:flightDB, fileName):
 
     fdb = database
     textInfo={"机号":2,"非航前进港机位":3,"机型":4,"发动机":5}
@@ -58,18 +55,8 @@ def updateStopFlight(database:flightDB, fileName):
                     #print(mydics0)
                     fdb.lazyInsertData("TaskFlightinfo%s"%day,mydics0)
             fdb.FunctionCommit()
-        sortFlighttime(flightDB(host=host,
-                    port=port,
-                    user=user1,
-                    password=password,
-                    database=databaseflightDB4
-                   ))
-        sortFlighttime2(flightDB(host=host,
-                    port=port,
-                    user=user1,
-                    password=password,
-                    database=databaseflightDB4
-                   ))
+        sortFlighttime(database,workLoad)
+        sortFlighttime2(database,workLoad)
         print(datetime.datetime.now(), '[数据库操作]停场航班导入成功!')
         res = {"返回值": "ok"}
         return res

+ 69 - 17
SeverStart.py

@@ -29,13 +29,14 @@ from Functions.DButilsFunction import flightDB, judge_bc as Judge_bc, initFlight
     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
+    GetPglistInDatabase,Getworkload ,HandoverStsChange,ManCahangeWorkload,UpdateNoteItem,postgresql_bakup
 app = Flask(__name__)
 dir = os.getcwd()
 app.config["SECRET_KEY"] = "Can't not guess it ."
 
 dbhost, dbport, dbuser, dbpassword,online_host, online_port, online_user, online_password = DBServer()
-mainseverip=Main_Sever()
+mainseverip, maindatabase=Main_Sever()
+backupactive = False #备用服务器激活标注
 database="flaskDatabase"
 databaseDB4 = flightDB4()
 databaseWorkLoad = 'workLoad'
@@ -61,6 +62,7 @@ def check_a_availability():
     """检查A服务器的可用性"""
     try:
         ip = "http://" + mainseverip + ":7162/static/health"
+        #ip = "http://" + "192.168.2.65" + ":7162/static/health"
         response = requests.get(ip, timeout=5)
         return response.status_code != 200  #看是否连接成功
     except Exception as e:
@@ -71,7 +73,7 @@ def health_check():
     try:
         # 检查数据库连接
         db = flaskDBUtils.flaskDB(host=dbhost,port=dbport,user=dbuser,password=dbpassword,database=database)
-        cookie = flaskDBUtils.getToken(db)
+        db.close()
         return jsonify({"status": "ok", "timestamp": datetime.datetime.now().isoformat()}), 200
     except Exception as e:
         return jsonify({"status": "error", "message": str(e)}), 500
@@ -193,10 +195,10 @@ def VinCheck(vinLcoal,mode,num):
         vinOnline = flaskDBUtils.getVin(db,mode,int(num))
         db.close()
         if vinLcoal == vinOnline:
-            a="检验一致"
-            res={"返回值":"ok"}
+            a = "检验一致"
+            res = {"返回值":"ok"}
         else:
-            a="服务器有更新"
+            a = "服务器有更新"
             res = {"返回值": "update"}
     else:
         a = "非昨天、今天、明天无需获取"
@@ -318,7 +320,8 @@ async def getFlightData2(type):
     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 (mainseverip and mainseverip == loaclseverip) or mainseverip == "" or (mainseverip and mainseverip != loaclseverip and check_a_availability):
+    print(check_a_availability())
+    if (mainseverip and mainseverip == loaclseverip) or mainseverip == "" or (mainseverip and mainseverip != loaclseverip and check_a_availability()):
         try:
             #print(type)
             ts = time.time()
@@ -386,7 +389,7 @@ async def getFlightData2(type):
                         dingdinginfoget(fdb)
                         CalledChecked(fdb)
                         print(datetime.datetime.now(), "A静态刷新")
-                        return str(taskflightdata['code'])
+                        code=str(taskflightdata['code'])
                     else:
                         #ts2 = time.time()
                         InitFlightDatabase(fdb,workLoad, nowDayStr)
@@ -410,10 +413,10 @@ async def getFlightData2(type):
                         flaskDBUtils.insertinfolog(db,nowStr,str(taskflightdata['code']))
                         print(datetime.datetime.now(), "A动态刷新")
                         #print('数据库耗时:{}'.format(time.time()-ts2))
-                        return str(taskflightdata['code'])+str(time.time()-ts)
+                        code = str(taskflightdata['code'])+str(time.time()-ts)
                 else:
-                    return '未登录'
-            elif type == "B":
+                    code = '未登录'
+            else: #type==B
                 InitFlightDatabase(fdb,workLoad, nowDayStr)
                 InitFlightDatabase(fdb,workLoad, nowDay_1)
                 sortFlighttime(fdb,workLoad)
@@ -426,22 +429,67 @@ async def getFlightData2(type):
                 dingdinginfoget(fdb)
                 CalledChecked(fdb)
                 print(datetime.datetime.now(),"B静态刷新")
-                return "200"
-
+                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()
+            return code
         except Exception as e:
             fdb.close()
             workLoad.close()
             db.close()
             app_logger.log_error(e)
             return '未登录'
-        if mainseverip and mainseverip != loaclseverip:
-            print(datetime.datetime.now(),'[系统警告]主服务器通讯失败,备份服务器工作中')
+
     else:
         #需要加入数据库同步
-        print(datetime.datetime.now(),'[系统警告]非主服务器暂未工作')
+        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 '未登录'
+        else:
+            return "200"
 
 @app.route('/static/getPglist/<bcstr>')
 def getPglist(bcstr):
@@ -1170,11 +1218,15 @@ def updateStopFlight():
         remote_addr = request.remote_addr
         data = json.loads(request.get_data())
         fdb = flightDB(host=dbhost,port=dbport,user=dbuser,password=dbpassword,database=databaseDB4)
-        res=UpdateStopFlight(fdb,data["fileName"])
+        workLoad = flightDB(host=dbhost, port=dbport, user=dbuser, password=dbpassword, database=databaseWorkLoad)
+        res=UpdateStopFlight(fdb,workLoad,data["fileName"])
         fdb.close()
+        workLoad.close()
         print(datetime.datetime.now(),"[%s]上传停场航班EXCEL数据"%remote_addr)
         return res
     except:
+        fdb.close()
+        workLoad.close()
         print(datetime.datetime.now(), "[%s]上传停场航班EXCEL数据失败" % remote_addr)
         return {"返回值": "fail"}
 

+ 31 - 43
templates/index.html

@@ -132,58 +132,46 @@
             num = 1;
             var loginsts;
             $(document).ready(function () {
-              getData();
+              getflightdata();
               inittable();
+              postgresql();
               var table
               var loginsts
-              //var num
-              setInterval("getData()", 30000);
+              setInterval("backupdata()",300000)
+              setInterval("postgresql()",300000)
+              setInterval("getflightdata()",30000)
               setInterval("updatatable()",60000)
 
             });
-
-            function getData(){
-              console.log("开始")
+            function backupdata(){
+              $.get('/bakupdata', function (data) {
+                console.log(data)
+              });
+            }
+            function postgresql(){
+              $.get('/postgresql', function (data) {
+                console.log(data)
+              });
+            }
+            function getflightdata(){
               console.log(num)
-              checkLogin()
-              if (loginsts == '1'){
-                if ( num <100001 ) {
-                  if (num % 10 == 0) {
-                    $.get('/bakupdata', function (data) {
-                      console.log(data)
-                      // if (data!=200){
-                      //   window.location.href = "/login";
-                      // }
-                    });
-                  }//((num+9) % 10 == 0)
-                  if ((num+9) % 10 == 0) {
-                    $.get('/postgresql', function (data) {
-                      console.log(data)
-                    });
-                  }  //让他比上一个晚上1min
-
-                  if ((num+3) % 4 == 1) {
-                    $.get('/getFlightData2/A', function (data) {
-                      console.log(data)
-                    });
-                    num += 1
-                    console.log("结束")
-                    console.log(num)
-                  }
-                  else {
-                    $.get('/getFlightData2/B', function (data) {
-                      console.log(data)
-                    });
-                    num += 1
-                  }
-
-                }
-                else{
-                  num=1
+              if (num % 3 == 0) {
+                checkLogin()
+                if (loginsts == '1') {
+                  $.get('/getFlightData2/A', function (data) {
+                    console.log(data)
+                  });
+                  console.log("A请求")
+                  num += 1
                 }
-
               }
-
+              else{
+                $.get('/getFlightData2/B', function (data) {
+                  console.log(data)
+                });
+                console.log("B请求")
+                num += 1
+              }
             }
 
             function inittable(){

+ 0 - 276
templates/index2.html

@@ -1,276 +0,0 @@
-<!DOCTYPE html>
-<html lang="en">
-  <head>
-    <meta charset="utf-8">
-    <meta http-equiv="X-UA-Compatible" content="IE=edge">
-    <meta name="viewport" content="width=device-width, initial-scale=1">
-    <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
-    <meta name="description" content="">
-    <meta name="author" content="">
-    <link rel="icon" href="../../favicon.ico">
-
-    <title>Dashboard Template for Bootstrap</title>
-
-    <!-- Bootstrap core CSS -->
-    <link href="{{ url_for('static',filename='css/bootstrap.min.css') }}" rel="stylesheet">
-
-
-    <!-- Custom styles for this template -->
-    <link href="{{ url_for('static',filename='css/dashboard.css') }}" rel="stylesheet">
-
-
-  </head>
-
-  <body>
-
-    <nav class="navbar navbar-inverse navbar-fixed-top">
-      <div class="container-fluid">
-        <div class="navbar-header">
-          <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
-            <span class="sr-only">Toggle navigation</span>
-            <span class="icon-bar">111</span>
-            <span class="icon-bar"></span>
-            <span class="icon-bar"></span>
-          </button>
-          <a class="navbar-brand" href="#">Project name</a>
-        </div>
-        <div id="navbar" class="navbar-collapse collapse">
-          <ul class="nav navbar-nav navbar-right">
-            <li><a href="#">Dashboard</a></li>
-            <li><a href="#">Settings</a></li>
-            <li><a href="#">Profile</a></li>
-            <li><a href="#">{{name}}</a></li>
-            <li><a href="/logout">Logout</a> </li>
-          </ul>
-          <form class="navbar-form navbar-right">
-            <input type="text" class="form-control" placeholder="Search...">
-          </form>
-        </div>
-      </div>
-    </nav>
-
-    <div class="container-fluid">
-      <div class="row">
-        <div class="col-sm-3 col-md-2 sidebar">
-          <ul class="nav nav-sidebar">
-            <li class="active"><a href="#">Overview <span class="sr-only">(current)</span></a></li>
-            <li><a href="#">Reports</a></li>
-            <li><a href="#">Analytics</a></li>
-            <li><a href="#">Export</a></li>
-          </ul>
-          <ul class="nav nav-sidebar">
-            <li><a href="">Nav item</a></li>
-            <li><a href="">Nav item again</a></li>
-            <li><a href="">One more nav</a></li>
-            <li><a href="">Another nav item</a></li>
-            <li><a href="">More navigation</a></li>
-          </ul>
-          <ul class="nav nav-sidebar">
-            <li><a href="">Nav item again</a></li>
-            <li><a href="">One more nav</a></li>
-            <li><a href="">Another nav item</a></li>
-          </ul>
-        </div>
-        <div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main">
-          <h1 class="page-header">Dashboard</h1>
-
-          <div class="row placeholders">
-            <div class="col-xs-6 col-sm-3 placeholder">
-              <img src="data:image/gif;base64,R0lGODlhAQABAIAAAHd3dwAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw==" width="200" height="200" class="img-responsive" alt="Generic placeholder thumbnail">
-              <h4>登录状态</h4>
-              <span id="loginsts" class="text-muted">Something else</span>
-            </div>
-            <div class="col-xs-6 col-sm-3 placeholder">
-              <img src="data:image/gif;base64,R0lGODlhAQABAIAAAHd3dwAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw==" width="200" height="200" class="img-responsive" alt="Generic placeholder thumbnail">
-              <h4>Label</h4>
-              <span class="text-muted">Something else</span>
-            </div>
-            <div class="col-xs-6 col-sm-3 placeholder">
-              <img src="data:image/gif;base64,R0lGODlhAQABAIAAAHd3dwAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw==" width="200" height="200" class="img-responsive" alt="Generic placeholder thumbnail">
-              <h4>Label</h4>
-              <span class="text-muted">Something else</span>
-            </div>
-            <div class="col-xs-6 col-sm-3 placeholder">
-              <img src="data:image/gif;base64,R0lGODlhAQABAIAAAHd3dwAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw==" width="200" height="200" class="img-responsive" alt="Generic placeholder thumbnail">
-              <h4>Label</h4>
-              <span class="text-muted">Something else</span>
-            </div>
-          </div>
-
-          <h2 class="sub-header">Section title</h2>
-          <div class="table-responsive">
-            <table class="table table-striped">
-              <thead>
-                <tr>
-                  <th>#</th>
-                  <th>Header</th>
-                  <th>Header</th>
-                  <th>Header</th>
-                  <th>Header</th>
-                </tr>
-              </thead>
-              <tbody>
-                <tr>
-                  <td>1,001</td>
-                  <td>Lorem</td>
-                  <td>ipsum</td>
-                  <td>dolor</td>
-                  <td>sit</td>
-                </tr>
-                <tr>
-                  <td>1,002</td>
-                  <td>amet</td>
-                  <td>consectetur</td>
-                  <td>adipiscing</td>
-                  <td>elit</td>
-                </tr>
-                <tr>
-                  <td>1,003</td>
-                  <td>Integer</td>
-                  <td>nec</td>
-                  <td>odio</td>
-                  <td>Praesent</td>
-                </tr>
-                <tr>
-                  <td>1,003</td>
-                  <td>libero</td>
-                  <td>Sed</td>
-                  <td>cursus</td>
-                  <td>ante</td>
-                </tr>
-                <tr>
-                  <td>1,004</td>
-                  <td>dapibus</td>
-                  <td>diam</td>
-                  <td>Sed</td>
-                  <td>nisi</td>
-                </tr>
-                <tr>
-                  <td>1,005</td>
-                  <td>Nulla</td>
-                  <td>quis</td>
-                  <td>sem</td>
-                  <td>at</td>
-                </tr>
-                <tr>
-                  <td>1,006</td>
-                  <td>nibh</td>
-                  <td>elementum</td>
-                  <td>imperdiet</td>
-                  <td>Duis</td>
-                </tr>
-                <tr>
-                  <td>1,007</td>
-                  <td>sagittis</td>
-                  <td>ipsum</td>
-                  <td>Praesent</td>
-                  <td>mauris</td>
-                </tr>
-                <tr>
-                  <td>1,008</td>
-                  <td>Fusce</td>
-                  <td>nec</td>
-                  <td>tellus</td>
-                  <td>sed</td>
-                </tr>
-                <tr>
-                  <td>1,009</td>
-                  <td>augue</td>
-                  <td>semper</td>
-                  <td>porta</td>
-                  <td>Mauris</td>
-                </tr>
-                <tr>
-                  <td>1,010</td>
-                  <td>massa</td>
-                  <td>Vestibulum</td>
-                  <td>lacinia</td>
-                  <td>arcu</td>
-                </tr>
-                <tr>
-                  <td>1,011</td>
-                  <td>eget</td>
-                  <td>nulla</td>
-                  <td>Class</td>
-                  <td>aptent</td>
-                </tr>
-                <tr>
-                  <td>1,012</td>
-                  <td>taciti</td>
-                  <td>sociosqu</td>
-                  <td>ad</td>
-                  <td>litora</td>
-                </tr>
-                <tr>
-                  <td>1,013</td>
-                  <td>torquent</td>
-                  <td>per</td>
-                  <td>conubia</td>
-                  <td>nostra</td>
-                </tr>
-                <tr>
-                  <td>1,014</td>
-                  <td>per</td>
-                  <td>inceptos</td>
-                  <td>himenaeos</td>
-                  <td>Curabitur</td>
-                </tr>
-                <tr>
-                  <td>1,015</td>
-                  <td>sodales</td>
-                  <td>ligula</td>
-                  <td>in</td>
-                  <td>libero</td>
-                </tr>
-              </tbody>
-            </table>
-          </div>
-        </div>
-      </div>
-    </div>
-
-    <!-- Bootstrap core JavaScript
-    ================================================== -->
-    <!-- Placed at the end of the document so the pages load faster -->
-    <script src="{{ url_for('static',filename='js/jquery.min.js') }}"></script>
-    <script>window.jQuery || document.write('<script src="static/js/jquery.min.js"><\/script>')</script>
-    <script src="{{ url_for('static',filename='js/bootstrap.min.js') }}"></script>
-<!--    <script type="text/javascript">-->
-<!--            $(document).ready(function () {-->
-<!--              getData();-->
-<!--              setInterval("getData()", 60000);-->
-
-<!--            });-->
-<!--            function getData(){-->
-<!--              $.get('/getFlightData', function (data) {-->
-<!--                console.log(data)-->
-<!--                if (data!=200){-->
-<!--                  window.location.href = "/login";-->
-<!--                }-->
-<!--              });-->
-<!--            }-->
-<!--    </script>-->
-  <script>
-    $(document).ready(function (){
-      checkLogin()
-    })
-    function checkLogin(){
-      $.get('/checkLogin', function(data){
-        console.log(data)
-        if (data == '1'){
-          console.log('已登录')
-          $('#loginsts').text('已登录')
-        }
-        else{
-          console.log('未登录')
-          $('#loginsts').text('未登录')
-          var txt1="<a href='/login'>   点击登录</a>";
-          $('#loginsts').append(txt1)
-        }
-      })
-    } {
-
-    }
-  </script>
-  </body>
-</html>

+ 38 - 1
unitls/settings.py

@@ -44,10 +44,21 @@ def Main_Sever():
     config.read(ini_path, encoding='utf-8')
     if config.has_section('Main_Sever'):
         path = config.get('Main_Sever', "MainSever")
+        database = config.get('Main_Sever', "MainDatabase") if config.has_option('Main_Sever', "MainDatabase") else path
     else:
         path = ""
+        database = ""
         print('Not found Main_Sever')
-    return path
+    return path, database
+def NO_TPIS():
+    config = ConfigParser()
+    config.read(ini_path, encoding='utf-8')
+    if config.has_section('NO_TPIS'):
+        ACNO = config.get('NO_TPIS', "ACNO").split(",")
+    else:
+        ACNO = []
+        print('Not found Main_Sever')
+    return ACNO
 def DBServer():
     config = ConfigParser()
     config.read(ini_path, encoding='utf-8')
@@ -71,6 +82,32 @@ def DBServer():
         online_password = None
         print('Not found DBserver')
     return local_host, local_port, local_user, local_password, online_host, online_port, online_user,online_password
+def MesgTime():
+    config = ConfigParser()
+    config.read(ini_path, encoding='utf-8')
+    if config.has_section('Mesg_Time'):
+        APZBZ = int(config.get('Mesg_Time', 'APZBZ'))
+        JJZBZ = int(config.get('Mesg_Time', 'JJZBZ'))
+        ESZBZ = int(config.get('Mesg_Time', 'ESZBZ'))
+        APGR = int(config.get('Mesg_Time', 'APGR'))
+        JJGR = int(config.get('Mesg_Time', 'JJGR'))
+        ESGR = int(config.get('Mesg_Time', 'ESGR'))
+        APPG = int(config.get('Mesg_Time', 'APPG'))
+        JJPG = int(config.get('Mesg_Time', 'JJPG'))
+        ESPG = int(config.get('Mesg_Time', 'ESPG'))
+
+    else:
+        APZBZ = 100
+        JJZBZ = 40
+        ESZBZ = 40
+        APGR = 105
+        JJGR = 45
+        ESGR = 45
+        APPG = 120
+        JJPG = 45
+        ESPG = 55
+        print('Not found Mesg_Time')
+    return APZBZ, JJZBZ, ESZBZ, APGR, JJGR, ESGR,APPG,JJPG,ESPG
 
 def flightDB4():
     config = ConfigParser()