checkFlightAlert.py 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400
  1. from .flightDB import flightDB
  2. import datetime
  3. from unitls.LogerinTxt import app_logger
  4. import unitls.baseFunction as baseFunction
  5. from unitls.StaticDataclass import get_dic
  6. def WarningInsert(database, taskid, mesg, types):
  7. newdic = {"航班编号": "%s" % taskid, "警告信息": mesg, "信息状态": "",
  8. "提示信息": "", "产生时间": "%s" % datetime.datetime.now(), "处理人": "", "处理时间": "", "变更字段": types, "显示对象": "", "提示内容": ""}
  9. database.lazyInsertData('logs', newdic)
  10. def noteInsert(database, taskid, mesg, types):
  11. newdic = {"航班编号": "%s" % taskid, "警告信息": '', "信息状态": "",
  12. "提示信息": mesg, "产生时间": "%s" % datetime.datetime.now(), "处理人": "", "处理时间": "", "变更字段": types, "显示对象": "", "提示内容": ""}
  13. database.lazyInsertData('logs', newdic)
  14. def judgeFunction(datas,key,numb): #numb 警告时间间隔
  15. now=datetime.datetime.now()
  16. time_str = baseFunction.TuplefindInList3(datas, key, 8, 5) #变更字段为key的最近的一次时间
  17. if time_str == "":
  18. time1 = now - datetime.timedelta(minutes=numb)
  19. else:
  20. time1 = datetime.datetime.strptime(time_str.split(".")[0], "%Y-%m-%d %H:%M:%S") + datetime.timedelta(minutes=numb)
  21. if now > time1:
  22. return True
  23. else:
  24. return False
  25. def getpeopleinfo(names,data,data1):
  26. res = []
  27. success = []
  28. fail = []
  29. names = names.replace("√","")
  30. names_list = names.split(",")
  31. for name in names_list:
  32. worknum = baseFunction.TuplefindInList3(data, name, 0, 1) if data else ""
  33. if worknum == "":
  34. worknum=baseFunction.TuplefindInList3(data1, name, 0, 1)
  35. if worknum != "":
  36. res.append(worknum)
  37. success.append(name)
  38. else:
  39. fail.append(name)
  40. #int("success",success)
  41. #print("fail",fail)
  42. #print("res",res)
  43. return {"success":success,"fail":fail,"worknums":res}
  44. def checkFlightAlert(database:flightDB, singlePeopleNotice):
  45. try:
  46. nowDay = datetime.datetime.now().strftime("%Y%m%d")
  47. nowDay_1 = (datetime.date.today() - datetime.timedelta(days=1)).strftime("%Y%m%d")
  48. nowDay_2 = (datetime.date.today() + datetime.timedelta(days=1)).strftime("%Y%m%d")
  49. now = datetime.datetime.now()
  50. now_20=(datetime.datetime.now()+ datetime.timedelta(minutes=120)).strftime("%Y%m%d")
  51. if now_20 == nowDay:
  52. day=[nowDay,nowDay_1]
  53. else:
  54. day = [nowDay,nowDay_1,nowDay_2]
  55. for nowDayStr in day:
  56. flightcheck=database.queryTabel("sortFlight{}".format(nowDayStr),"航班编号","CAST(级别 AS integer) = 1" )
  57. flightcheck2 = database.queryTabel("sortFlight{}".format(nowDayStr), "航班编号", "CAST(级别 AS integer) != 4")
  58. datas=database.queryTabel("TaskFlightinfo{}".format(nowDayStr),"*","航班编号 !=''")
  59. flightsts=database.queryTabel("flightsts{}".format(nowDayStr),"*","航班编号 !=''")
  60. logs=database.queryTabel("logs","*","处理时间= '' and 警告信息 !=''")
  61. logsall=database.queryTabel("logs","*","警告信息 !=''")
  62. logsall1=database.sort_queryTable("*","logs", "提示信息 !=''", "产生时间", "desc") #所有提示信息
  63. peopleschedule=database.queryTabel("peopleSchedule{}".format(nowDayStr),"*","航班编号 !=''")
  64. peoplesinfo_today=database.queryTabel("pglist{}".format(nowDay),"*","姓名!=''")
  65. peoplesinfo_yes=database.queryTabel("pglist{}".format(nowDay_1),"*","姓名!=''")
  66. if datas and flightcheck:
  67. for i in flightcheck:
  68. data=baseFunction.TuplefindInList1(datas, i[0], 0)
  69. if data and data[0][3] != "停场":
  70. a = data[0][1]
  71. b = get_dic("taskType")[data[0][3]]
  72. std=data[0][5]
  73. singlelogs=baseFunction.TuplefindInList33(logs,i[0],1,8)#未处理的警告信息
  74. singlelogsall=baseFunction.TuplefindInList33(logsall, i[0], 1, 2) #所有警告信息
  75. singlelogsall1=baseFunction.TuplefindInList11(logsall1, i[0], 1) #所有和这个id相关的提示信息
  76. jjdw=baseFunction.TuplefindInList3(flightsts,i[0],0,3)
  77. fx=baseFunction.TuplefindInList3(flightsts,i[0],0,4)
  78. eta=data[0][8]
  79. flying=data[0][30]
  80. BAY_A=data[0][10]#进港机位
  81. wxry=data[0][12]
  82. fxry=data[0][13]
  83. ecsj=data[0][19]
  84. fj=baseFunction.TuplefindInList3(peopleschedule, i[0], 1, 9)
  85. #航前90min 检查到位情况,推送准备组,推送个人没2min,直到点击到位
  86. #起飞前40min 检查放行情况,推送个人,3min间隔,起飞前30min推送准备组,直到放行点击
  87. #起飞前50min 检查销子夹板取下情况,推送个人,3min间隔,起飞前40min推送准备组,直到上报销子夹板
  88. if b == "航前":
  89. c = baseFunction.TuplefindInList3(datas, i[0], 0, 11)
  90. else:
  91. c = baseFunction.TuplefindInList3(datas, i[0], 0, 10)
  92. if b == "航前" and std != "":
  93. STD_90 = datetime.datetime.strptime(std, "%Y-%m-%d %H:%M:%S") - datetime.timedelta(minutes=90)
  94. STD_50 = datetime.datetime.strptime(std, "%Y-%m-%d %H:%M:%S") - datetime.timedelta(minutes=50)
  95. STD_40 = datetime.datetime.strptime(std, "%Y-%m-%d %H:%M:%S") - datetime.timedelta(minutes=40)
  96. STD_30 = datetime.datetime.strptime(std, "%Y-%m-%d %H:%M:%S") - datetime.timedelta(minutes=30)
  97. if STD_90 < now and "已到位" not in str(jjdw) and "到位警告" not in str(singlelogs):
  98. WarningInsert(database,i[0],"请确认%s/%s/%s到位情况!"%(a,b,c),"到位警告")
  99. if STD_90 < now and "已到位" not in str(jjdw) and judgeFunction(singlelogsall1,"到位个人提示推送",2) and singlePeopleNotice and "【交班航班】" not in fj:
  100. print(datetime.datetime.now(),"航前推送个人到位信息") ###要加维修人员是否为空
  101. getpeopleinfo(wxry,peoplesinfo_today,peoplesinfo_yes)
  102. noteInsert(database,i[0],"%s/%s/%s航前推送个人到位信息"%(a,b,c),"到位个人提示推送")
  103. if STD_30 < now and "已放行" not in str(fx) and "放行警告" not in str(singlelogs):
  104. WarningInsert(database,i[0],"请确认%s/%s/%s放行情况!"%(a,b,c),"放行警告")
  105. if STD_40 < now and "已放行" not in str(fx) and judgeFunction(singlelogsall1,"放行个人提示推送",3) and singlePeopleNotice and "【交班航班】" not in fj:
  106. print(datetime.datetime.now(),"航前推送放行确认信息")
  107. getpeopleinfo(fxry, peoplesinfo_today, peoplesinfo_yes)
  108. noteInsert(database,i[0],"%s/%s/%s航前推送放行确认信息"%(a,b,c),"放行个人提示推送")
  109. if STD_40 < now and "已取下" not in str(baseFunction.TuplefindInList3(flightsts,i[0],0,5)) and "销夹警告" not in str(singlelogs):
  110. WarningInsert(database,i[0],"请确认%s/%s/%s销夹取下情况!"%(a,b,c), "销夹警告")
  111. 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:
  112. print(datetime.datetime.now(),"航前推送销夹取下信息")
  113. noteInsert(database,i[0],"%s/%s/%s航前推送销夹取下信息"%(a,b,c),"销夹个人提示推送")
  114. # 航后15min 检查到位情况,推送准备组,推送个人每2min,直到点击到位
  115. elif b == "航后" and eta != "" and flying != "":
  116. ETA_15_str = eta
  117. ETA_15 = datetime.datetime.strptime(ETA_15_str, "%Y-%m-%d %H:%M:%S") - datetime.timedelta(minutes= 15)
  118. ETA_40 = datetime.datetime.strptime(ETA_15_str, "%Y-%m-%d %H:%M:%S") - datetime.timedelta(minutes= 55)
  119. if ETA_15 < now and "已到位" not in str(jjdw) and "到位警告" not in str(singlelogs):
  120. WarningInsert(database, i[0], "请确认%s/%s/%s到位情况!"%(a, b, c), "到位警告")
  121. if ETA_15 < now and "已到位" not in str(jjdw) and judgeFunction(singlelogsall1,"到位个人提示推送",2) and singlePeopleNotice and "【交班航班】" not in fj:
  122. print(datetime.datetime.now(),"航后推送个人到位信息")
  123. getpeopleinfo(wxry,peoplesinfo_today,peoplesinfo_yes)
  124. noteInsert(database,i[0],"%s/%s/%s航后推送个人到位信息"%(a,b,c),"到位个人提示推送")
  125. if ETA_40 < now and BAY_A == "" and "机位未出提醒" not in str(singlelogsall):
  126. WarningInsert(database,i[0],"[机位未出提醒]请确认%s/%s机位情况!"%(a,b),"机位警告")
  127. # 短停15min 检查到位情况,推送准备组,推送个人每2min,直到点击到位
  128. # 短停落地30min,且满足距离起飞时间小于50min检查放行情况,推送个人,3min间隔,落地30min,且满足距离起飞时间小于40min,推送准备组,直到点击放行
  129. # 短停落地25min,且满足距离起飞时间小于25min,推送个人,2min间隔,落地30min,且满足距离起飞时间小于25min,推送准备组,直到点击二送到位
  130. elif b == "短停" and eta != "" and flying != "":
  131. ETA_15_str=eta
  132. ETA_15 = datetime.datetime.strptime(ETA_15_str, "%Y-%m-%d %H:%M:%S") - datetime.timedelta(minutes=15)
  133. ETA_40 = datetime.datetime.strptime(ETA_15_str, "%Y-%m-%d %H:%M:%S") - datetime.timedelta(minutes=55)
  134. ATA = baseFunction.TuplefindInList3(datas, i[0], 0, 6)
  135. if ATA != "":
  136. ATA_time_25 = datetime.datetime.strptime(ATA, "%Y-%m-%d %H:%M:%S") + datetime.timedelta(minutes=25)
  137. ATA_time_30 = datetime.datetime.strptime(ATA, "%Y-%m-%d %H:%M:%S") + datetime.timedelta(minutes=30)
  138. ATA_time_3H = datetime.datetime.strptime(ATA, "%Y-%m-%d %H:%M:%S")+datetime.timedelta(minutes=180)
  139. else:
  140. ATA_time_30 = ""
  141. ATA_time_25 = ""
  142. ATA_time_3H = ""
  143. TD = std
  144. TD_time_50 = datetime.datetime.strptime(TD, "%Y-%m-%d %H:%M:%S")- datetime.timedelta(minutes=50)
  145. TD_time_40 = datetime.datetime.strptime(TD, "%Y-%m-%d %H:%M:%S")- datetime.timedelta(minutes=40)
  146. TD_time_25 = datetime.datetime.strptime(TD, "%Y-%m-%d %H:%M:%S")- datetime.timedelta(minutes=25)
  147. TD_time_120 = datetime.datetime.strptime(TD, "%Y-%m-%d %H:%M:%S") - datetime.timedelta(minutes=120)
  148. TD_time = datetime.datetime.strptime(TD, "%Y-%m-%d %H:%M:%S")
  149. if ETA_15 < now and "已到位" not in str(jjdw) and "到位警告" not in str(singlelogs):
  150. WarningInsert(database,i[0],"请确认%s/%s/%s到位情况!"%(a,b,c),"到位警告")
  151. if ETA_15 < now and "已到位" not in str(jjdw) and judgeFunction(singlelogsall1,"到位个人提示推送",2) and singlePeopleNotice and "【交班航班】" not in fj:
  152. print(datetime.datetime.now(),"短停推送个人到位信息")
  153. getpeopleinfo(wxry,peoplesinfo_today,peoplesinfo_yes)
  154. noteInsert(database,i[0],"%s/%s/%s短停推送个人到位信息"%(a,b,c),"到位个人提示推送")
  155. if ATA_time_30 != "" and ATA_time_30 < now and TD_time_40 < now and "已放行" not in str(fx) and "放行警告" not in str(singlelogs):
  156. WarningInsert(database,i[0],"请确认%s/%s/%s放行情况!"%(a,b,c), "放行警告")
  157. 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:
  158. print(datetime.datetime.now(),"短停放行个人提示推送")
  159. getpeopleinfo(fxry,peoplesinfo_today,peoplesinfo_yes)
  160. noteInsert(database,i[0],"%s/%s/%s短停放行个人提示推送"%(a,b,c),"放行个人提示推送")
  161. 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):
  162. WarningInsert(database,i[0],"请确认%s/%s/%s二送到位情况!"%(a,b,c), "二送警告")
  163. 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:
  164. print(datetime.datetime.now(),"短停二送到位个人提示推送")
  165. getpeopleinfo(ecsj,peoplesinfo_today,peoplesinfo_yes)
  166. noteInsert(database,i[0],"%s/%s/%s短停二送到位个人提示推送"%(a,b,c),"二送到位个人提示推送")
  167. 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)):
  168. WarningInsert(database,i[0],"请确认安排%s/%s/%s长短停上电人员!" % (a, b, c),"长短停到位提示")
  169. if ATA_time_3H !="" and ATA_time_3H < TD_time and "长短停值守提示" not in str(baseFunction.TuplefindInList33(logsall, i[0], 1, 8)):
  170. WarningInsert(database,i[0],"请注意安排%s %s长短停值守,如无需则忽略!" % (a,c),"长短停值守提示")
  171. if ETA_40 < now and BAY_A == "" and "机位未出提醒" not in str(singlelogsall):
  172. WarningInsert(database,i[0],"[机位未出提醒]请确认%s/%s机位情况!"%(a,b),"机位警告")
  173. # 特后前15min 检查到位情况,推送准备组,推送个人每2min,直到点击到位
  174. # 特后前落地30min,且满足距离起飞时间小于50min检查放行情况,推送个人,3min间隔,落地30min,且满足距离起飞时间小于40min,推送准备组,直到点击放行
  175. # 特后前落地25min,且满足距离起飞时间小于25min,推送个人,2min间隔,落地30min,且满足距离起飞时间小于25min,推送准备组,直到点击二送到位
  176. elif b!="短停" and b!="航后" and b!="航前" and b!="未显示" and eta != "":
  177. ETA_15_str = eta
  178. ETA_15 = datetime.datetime.strptime(ETA_15_str, "%Y-%m-%d %H:%M:%S") - datetime.timedelta(minutes = 15)
  179. ETA_40 = datetime.datetime.strptime(ETA_15_str, "%Y-%m-%d %H:%M:%S") - datetime.timedelta(minutes = 55)
  180. ATA = baseFunction.TuplefindInList3(datas, i[0], 0, 6)
  181. if ATA!= "":
  182. ATA_time_25 = datetime.datetime.strptime(ATA, "%Y-%m-%d %H:%M:%S") + datetime.timedelta(minutes=25)
  183. ATA_time_30 = datetime.datetime.strptime(ATA, "%Y-%m-%d %H:%M:%S") + datetime.timedelta(minutes=30)
  184. else:
  185. ATA_time_25=""
  186. ATA_time_30 = ""
  187. TD = std
  188. TD_time_50 = datetime.datetime.strptime(TD, "%Y-%m-%d %H:%M:%S")- datetime.timedelta(minutes=50)
  189. TD_time_40 = datetime.datetime.strptime(TD, "%Y-%m-%d %H:%M:%S") - datetime.timedelta(minutes=40)
  190. TD_time_25 = datetime.datetime.strptime(TD, "%Y-%m-%d %H:%M:%S") - datetime.timedelta(minutes=25)
  191. if ETA_15 < now and "已到位" not in str(jjdw) and "到位警告" not in str(singlelogs):
  192. WarningInsert(database,i[0],"请确认%s/%s/%s到位情况!"%(a,b,c),"到位警告")
  193. if ETA_15 < now and "已到位" not in str(jjdw) and judgeFunction(singlelogsall1,"到位个人提示推送",2) and singlePeopleNotice and "【交班航班】" not in fj:
  194. print(datetime.datetime.now(),"短停推送个人到位信息")
  195. getpeopleinfo(wxry,peoplesinfo_today,peoplesinfo_yes)
  196. noteInsert(database,i[0],"%s/%s/%s短停推送个人到位信息"%(a,b,c),"到位个人提示推送")
  197. if ATA_time_30 != "" and ATA_time_30 < now and TD_time_40 < now and "已放行" not in str(fx) and "放行警告" not in str(singlelogs):
  198. WarningInsert(database,i[0],"请确认%s/%s/%s放行情况!"%(a,b,c),"放行警告")
  199. 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:
  200. print(datetime.datetime.now(),"短停放行个人提示推送")
  201. getpeopleinfo(fxry,peoplesinfo_today,peoplesinfo_yes)
  202. noteInsert(database,i[0],"%s/%s/%s短停放行个人提示推送"%(a,b,c),"放行个人提示推送")
  203. 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):
  204. WarningInsert(database,i[0],"请确认%s/%s/%s二送到位情况!"%(a,b,c), "二送警告")
  205. 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:
  206. print(datetime.datetime.now(),"短停二送到位个人提示推送")
  207. getpeopleinfo(ecsj,peoplesinfo_today,peoplesinfo_yes)
  208. noteInsert(database,i[0],"%s/%s/%s短停二送到位个人提示推送"%(a,b,c),"二送到位个人提示推送")
  209. if ETA_40 < now and BAY_A == "" and "机位未出提醒" not in str(singlelogsall):
  210. WarningInsert(database,i[0],"[机位未出提醒]请确认%s/%s机位情况!"%(a,b),"机位警告")
  211. #航前 起飞前 100min,没有确认任务,推送准备组, 二送起飞前40min没有确认任务推送准备组 105 和 45 min 2min 个人推送一次?
  212. #短停 特后前 预计到达前40min没有确认任务推送准备组,短停特后前 预计起飞前40min没有确认任务推送准备组 45min 2min 个人推送一次?
  213. #航后 预计到达前40min没有确认任务推送准备组 45min 2min 个人推送一次?
  214. if b == "航前":
  215. bztime=datetime.datetime.strptime(std, "%Y-%m-%d %H:%M:%S")-datetime.timedelta(minutes=100)
  216. esbztime=datetime.datetime.strptime(std, "%Y-%m-%d %H:%M:%S")-datetime.timedelta(minutes=40)
  217. bztztime=datetime.datetime.strptime(std, "%Y-%m-%d %H:%M:%S")-datetime.timedelta(minutes=105)
  218. estzbztime=datetime.datetime.strptime(std, "%Y-%m-%d %H:%M:%S")-datetime.timedelta(minutes=45)
  219. elif b == "短停":
  220. bztime=datetime.datetime.strptime(eta, "%Y-%m-%d %H:%M:%S")-datetime.timedelta(minutes=40)#40
  221. esbztime = datetime.datetime.strptime(std, "%Y-%m-%d %H:%M:%S") - datetime.timedelta(minutes=40)#40
  222. bztztime=datetime.datetime.strptime(eta, "%Y-%m-%d %H:%M:%S")-datetime.timedelta(minutes=45)
  223. estzbztime = datetime.datetime.strptime(std, "%Y-%m-%d %H:%M:%S") - datetime.timedelta(minutes=45)#45通知
  224. elif b == "特后前":
  225. bztime=datetime.datetime.strptime(eta, "%Y-%m-%d %H:%M:%S")-datetime.timedelta(minutes=40)
  226. esbztime = datetime.datetime.strptime(std, "%Y-%m-%d %H:%M:%S") - datetime.timedelta(minutes=40)
  227. bztztime=datetime.datetime.strptime(eta, "%Y-%m-%d %H:%M:%S")-datetime.timedelta(minutes=45)
  228. estzbztime = datetime.datetime.strptime(std, "%Y-%m-%d %H:%M:%S") - datetime.timedelta(minutes=45)
  229. else:
  230. bztime=datetime.datetime.strptime(eta, "%Y-%m-%d %H:%M:%S")-datetime.timedelta(minutes=40)
  231. esbztime=""
  232. bztztime=datetime.datetime.strptime(eta, "%Y-%m-%d %H:%M:%S")-datetime.timedelta(minutes=45)
  233. estzbztime=""
  234. if (wxry != "" or fxry != "") and bztztime < now and judgeFunction(singlelogsall1,"航前或接机任务接送通知",2) and singlePeopleNotice and "【交班航班】" not in fj:
  235. peoples = ""
  236. res = wxry.split(",") + fxry.split(",")
  237. for l in res:
  238. if "√" not in l:
  239. peoples=peoples+","+l if peoples != "" else l
  240. if peoples != "":
  241. getpeopleinfo(peoples,peoplesinfo_today,peoplesinfo_yes)
  242. print(datetime.datetime.now(),"航前或接机任务接送通知")
  243. noteInsert(database,i[0],"%s/%s/%s航前或接机任务接送通知"%(a,b,c),"航前或接机任务接送通知")
  244. if (wxry != "" or fxry != "") and bztime < now:
  245. peoples = ""
  246. res=wxry.split(",")+fxry.split(",")
  247. for l in res:
  248. if "√" not in l:
  249. peoples = peoples+"、"+l if peoples != "" else l
  250. if peoples != "":
  251. mesg = "请确认%s/%s/%s/%s人员任务接收情况!" % (a, b, c, peoples)
  252. if mesg not in str(singlelogsall):
  253. WarningInsert(database, i[0], mesg, "任务接收监控")
  254. if ecsj != "" and estzbztime != "" and estzbztime < now and judgeFunction(singlelogsall1,"航前或接机任务接送通知",2) and singlePeopleNotice and "【交班航班】" not in fj:
  255. peoples = ""
  256. res = ecsj.split(",")
  257. for l in res:
  258. if "√" not in l:
  259. peoples = peoples + "," + l if peoples != "" else l
  260. if peoples != "":
  261. getpeopleinfo(peoples, peoplesinfo_today, peoplesinfo_yes)
  262. print(datetime.datetime.now(), "二送任务接送通知")
  263. noteInsert(database, i[0], "%s/%s/%s二送任务接送通知" % (a, b, c), "二送任务接送通知")
  264. if ecsj != "" and esbztime != "" and esbztime < now: #and "任务执行情况" not in str(singlelogsall):
  265. peoples=""
  266. res=ecsj.split(",")
  267. for l in res:
  268. if "√" not in l:
  269. peoples=peoples+"、"+l if peoples != "" else l
  270. if peoples != "":
  271. mesg = "请确认%s/%s/%s/%s人员二送任务接收情况!" % (a, b, c, peoples)
  272. if mesg not in str(singlelogsall):
  273. WarningInsert(database, i[0], mesg, "任务接收监控")
  274. if wxry == "" and bztztime < now:
  275. mesg = "请及时安排%s/%s/%s保障人员并派工!" % (a, b, c)
  276. if mesg not in str(singlelogsall):
  277. WarningInsert(database, i[0], mesg, "任务安排监控")
  278. if fxry == "" and bztztime < now:
  279. mesg = "请及时安排%s/%s/%s放行人员并派工!" % (a, b, c)
  280. if mesg not in str(singlelogsall):
  281. WarningInsert(database, i[0], mesg, "任务安排监控")
  282. if ecsj == "" and b != "航前" and esbztime != "" and estzbztime < now:
  283. mesg = "请及时安排%s/%s/%s二送保障人员并派工!" % (a, b, c)
  284. if mesg not in str(singlelogsall):
  285. WarningInsert(database, i[0], mesg, "任务安排监控")
  286. for i in flightcheck2:
  287. data2 = baseFunction.TuplefindInList1(datas, i[0], 0)
  288. if data2 and data2[0][3] != "停场":
  289. a = data2[0][1]
  290. b = get_dic("taskType")[data2[0][3]]
  291. std= data2[0][5]
  292. fj=baseFunction.TuplefindInList3(peopleschedule, i[0], 1, 9)
  293. sjry_str = data2[0][15]
  294. flightno = data2[0][21]
  295. singlelogsall=baseFunction.TuplefindInList33(logsall, i[0], 1, 2) #所有警告信息
  296. singlelogs=baseFunction.TuplefindInList33(logs, i[0], 1, 2) #未确认所有警告信息
  297. sjdw=baseFunction.TuplefindInList3(flightsts, i[0], 0, 6)
  298. if b =="航前":
  299. c = data2[0][11]
  300. else:
  301. c = data2[0][10]
  302. if b=="航前" and std != "":
  303. STD = std
  304. STD_120 = datetime.datetime.strptime(STD, "%Y-%m-%d %H:%M:%S") - datetime.timedelta(minutes= 120)
  305. STD_60 = datetime.datetime.strptime(STD, "%Y-%m-%d %H:%M:%S") - datetime.timedelta(minutes= 60)
  306. if "随机离港" in str(fj) and "随机2H提醒" not in str(singlelogsall) and STD_120 < now:
  307. sjry = sjry_str.split(" ")[1]
  308. WarningInsert(database, i[0], "[随机2H提醒]%s/%s/%s/%s"% (a, flightno, c, sjry),"随机2H提醒")
  309. if "随机离港" in str(fj) and "随机到位确认" not in str(singlelogs) and STD_60 < now and "已到位" not in str(sjdw):
  310. sjry = sjry_str.split("随机离港 ")[1]
  311. WarningInsert(database, i[0], "[随机到位确认]%s/%s/%s/%s"% (a, flightno, c, sjry),"随机到位警告")
  312. elif b=="短停" :
  313. TD = std
  314. TD_time_120 = datetime.datetime.strptime(TD, "%Y-%m-%d %H:%M:%S") - datetime.timedelta(minutes=120)
  315. TD_time_60 = datetime.datetime.strptime(TD, "%Y-%m-%d %H:%M:%S") - datetime.timedelta(minutes=60)
  316. if "随机离港" in str(fj) and "随机2H提醒" not in str(singlelogsall) and TD_time_120 < now and sjry_str != "":
  317. sjry = sjry_str.split(" ")[1]
  318. WarningInsert(database,i[0],"[随机2H提醒]%s/%s/%s/%s"%(a,flightno,c,sjry),"随机2H提醒")
  319. if "随机离港" in str(fj) and "随机到位确认" not in str(singlelogs) and TD_time_60 < now and "已到位" not in str(sjdw):
  320. sjry = sjry_str.split(" ")[1]
  321. WarningInsert(database,i[0], "[随机到位确认]%s/%s/%s/%s"%(a,flightno,c,sjry),"随机到位警告")
  322. elif b != "短停" and b != "航后" and b != "航前" and b != "未显示" and b != "停场" :
  323. TD_time_120= datetime.datetime.strptime(std, "%Y-%m-%d %H:%M:%S") - datetime.timedelta(minutes=120)
  324. TD_time_60 = datetime.datetime.strptime(std, "%Y-%m-%d %H:%M:%S") - datetime.timedelta(minutes=60)
  325. if "随机离港" in str(fj) and "随机2H提醒" not in str(singlelogsall) and TD_time_120 < now:
  326. sjry=sjry_str.split(" ")[1]
  327. WarningInsert(database,i[0],"[随机2H提醒]%s/%s/%s/%s"%(a,flightno,c,sjry),"随机2H提醒")
  328. if "随机离港" in str(fj) and "随机到位确认" not in str(singlelogs) and TD_time_60 < now and "已到位" not in str(sjdw):
  329. sjry=sjry_str.split("随机离港 ")[1]
  330. WarningInsert(database,i[0],"[随机到位确认]%s/%s/%s/%s"%(a,flightno,c,sjry),"随机到位警告")
  331. database.FunctionCommit()
  332. waringIDs=database.queryTabel('logs',"*","变更字段 like '%警告%' and 处理时间 =''")
  333. flightstsids=database.getSingledata("航班编号",'flightsts{}'.format(nowDayStr))
  334. for waringID in waringIDs:
  335. if str(waringID[1]) in str(flightstsids):
  336. waringIDstsNow=database.queryTabel('flightsts{}'.format(nowDayStr),"*","航班编号 ='%s'"%waringID[1])
  337. if waringID[8] == "到位警告" and waringIDstsNow[0][3] == "已到位":
  338. newdic = {"处理人": "'系统确认状态'", "处理时间": "'%s'" % now}
  339. database.lazyUpdateItem('logs', newdic, "编号='%s'" % waringID[0])
  340. if waringID[8] == "放行警告" and waringIDstsNow[0][4] == "已放行":
  341. newdic = {"处理人": "'系统确认状态'", "处理时间": "'%s'" % now}
  342. database.lazyUpdateItem('logs', newdic, "编号='%s'" % waringID[0])
  343. if waringID[8] == "二送警告" and waringIDstsNow[0][7] == "已到位":
  344. newdic = {"处理人": "'系统确认状态'", "处理时间": "'%s'" % now}
  345. database.lazyUpdateItem('logs', newdic, "编号='%s'" % waringID[0])
  346. if waringID[8] == "销夹警告" and waringIDstsNow[0][5] == "已取下":
  347. newdic = {"处理人": "'系统确认状态'", "处理时间": "'%s'" % now}
  348. database.lazyUpdateItem('logs', newdic, "编号='%s'" % waringID[0])
  349. if waringID[8] == "随机到位警告" and waringIDstsNow[0][6] == "已到位":
  350. newdic = {"处理人": "'系统确认状态'", "处理时间": "'%s'" % now}
  351. database.lazyUpdateItem('logs', newdic, "编号='%s'" % waringID[0])
  352. database.FunctionCommit()
  353. except Exception as e:
  354. database.FunctionCommit()
  355. app_logger.log_error(e)