|
@@ -310,8 +310,10 @@ def mytask():
|
|
|
|
|
|
alldata=DataDBUtilsgetData("sortFlight%s" % nowDay, "*", "编号 != ''")
|
|
|
Yalldata=DataDBUtilsgetData("sortFlight%s" % nowDay_1, "*", "编号 != ''")
|
|
|
+ alldata_task=DataDBUtilsgetData("TaskFlightinfo%s" % nowDay, "*", "航班编号 != ''")
|
|
|
+ Yalldata_task=DataDBUtilsgetData("TaskFlightinfo%s" % nowDay_1, "*", "航班编号 != ''")
|
|
|
try:
|
|
|
- mytask1 = function1(alldata,Yalldata)
|
|
|
+ mytask1 = function1(alldata_task,Yalldata_task)
|
|
|
finishdeTask=finishdeTask+"task1/"
|
|
|
except:
|
|
|
mytask1=[]
|
|
@@ -329,30 +331,34 @@ def mytask():
|
|
|
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("taskMain", "*", "'%s' < 任务开始时间 and 任务开始时间 <'%s'"%(startTime,tstartTime))
|
|
|
- YtaskMainData = getData("taskMain", "*", "'%s' < 任务开始时间 and 任务开始时间 <'%s'" % (ystartTime, startTime))
|
|
|
+ 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:
|
|
|
+ except Exception as e:
|
|
|
+ print(e)
|
|
|
mytask3=[]
|
|
|
pass
|
|
|
|
|
|
try:
|
|
|
mytask4 = function5()
|
|
|
finishdeTask=finishdeTask+"task4/"
|
|
|
- except:
|
|
|
+ except Exception as e:
|
|
|
+ print(e)
|
|
|
pass
|
|
|
try:
|
|
|
mytask5 = function7()
|
|
|
finishdeTask=finishdeTask+"task5/"
|
|
|
- except:
|
|
|
+ except Exception as e:
|
|
|
+ print(e)
|
|
|
pass
|
|
|
try:
|
|
|
mytask6 = function9()
|
|
|
finishdeTask=finishdeTask+"task6/"
|
|
|
- except:
|
|
|
+ except Exception as e:
|
|
|
+ print(e)
|
|
|
pass
|
|
|
|
|
|
nowday=datetime.date.today()
|
|
@@ -421,6 +427,7 @@ def mytask():
|
|
|
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)
|
|
@@ -472,6 +479,18 @@ def CountInList(lists: list, args, numb): # 返回列表
|
|
|
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:
|
|
@@ -493,21 +512,21 @@ def CountFinshed(lists: list): # 返回列表
|
|
|
return res
|
|
|
|
|
|
def function1(alldata,Yalldata): #查询每日航班的分布
|
|
|
- resTR=CountInList(alldata, "短停", 3)
|
|
|
- resPEF=CountInList(alldata, "航前", 3)
|
|
|
- resPOF=CountInList(alldata, "航后", 3)
|
|
|
- resTAF=CountInList(alldata, "特后前", 3)
|
|
|
+ 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, "短停", 3)
|
|
|
- YresPEF=CountInList(Yalldata, "航前", 3)
|
|
|
- YresPOF=CountInList(Yalldata, "航后", 3)
|
|
|
- YresTAF=CountInList(Yalldata, "特后前", 3)
|
|
|
+ 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=CountInList(alldata, "PB", 0)
|
|
|
- yww=CountInList(Yalldata, "PB", 0)
|
|
|
+ ww=CountInListor(alldata, "3U",'CSC', 21)
|
|
|
+ yww=CountInListor(Yalldata, "3U",'CSC', 21)
|
|
|
ch=resAll-ww
|
|
|
Ych=YreAll-yww
|
|
|
Yresfinsh=CountFinshed(Yalldata)
|
|
@@ -534,7 +553,7 @@ def function3(startTime,res):
|
|
|
list=[]
|
|
|
ress={}
|
|
|
aa=30#准备时间
|
|
|
- bb=25#收尾时间
|
|
|
+ bb=15#收尾时间
|
|
|
if len(res) !=0 and res !=None:
|
|
|
for i in res:
|
|
|
#print(i)
|
|
@@ -617,8 +636,8 @@ def function7():#航材工具
|
|
|
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("sendTaskList",'*',"'%s' < 配送发起时间 and 配送发起时间 <'%s'"%(startTime,tstartTime))
|
|
|
- yresALL = getData("sendTaskList", '*', "'%s' < 配送发起时间 and 配送发起时间 <'%s'" % (ystartTime, startTime))
|
|
|
+ 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)
|
|
@@ -627,8 +646,8 @@ 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)
|
|
|
+ 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=""
|
|
|
|
|
@@ -641,16 +660,16 @@ def function9():#二拖
|
|
|
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("towbarMain", '*', "'%s' < 创建时间 and 创建时间 <'%s'" % (startTime, tstartTime))
|
|
|
- yresALL = getData("towbarMain", '*', "'%s' < 创建时间 and 创建时间 <'%s'" % (ystartTime, startTime))
|
|
|
+ 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 !=None and len(res) !=0:
|
|
|
+ if res and res !=None and len(res) !=0:
|
|
|
for i in res:
|
|
|
- if i[11] !="":
|
|
|
+ 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=""
|
|
@@ -676,9 +695,9 @@ def initFlightDatabase1(datatime):
|
|
|
database.close()
|
|
|
print(traceback.format_exc())
|
|
|
|
|
|
-def getData(tablename, data, key):
|
|
|
- fdb = flightDB(host=host,
|
|
|
- port=port,
|
|
|
+def getData_online(tablename, data, key):
|
|
|
+ fdb = flightDB(host=online_host,
|
|
|
+ port=online_port,
|
|
|
user=user1,
|
|
|
password=password,
|
|
|
database=databasefileDB
|