1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161 |
- import concurrent.futures
- import datetime
- import psycopg2
- from pypinyin import pinyin, Style
- import traceback
- import openpyxl
- import msoffcrypto
- import io
- import requests
- import json
- import time
- import hmac
- import hashlib
- import base64
- import urllib.parse
- from openpyxl import Workbook
- from Functions import utils
- from unitls.settings import DBServer, loginDB, flightDB4
- ##
- from Functions.DButilsFunction import flightDB,judge_bc,initFlightDatabase
- from unitls.StaticDataclass import get_dic
- host, port, user, password,online_host, online_port, online_user,online_password = DBServer()
- databaseloginDB=loginDB()
- databaseflightDB4=flightDB4()
- zydy_simple={"FLIGHT_ID":"航班编号","flightIds":"航班编号对","ACNO": "机号", "ACTYPE": "机型", "ENG_TYPE": "发动机", "FLIGHT_NO": "保障航班号",
- "STA": "计划到达", "ETA": "预计到达","DEP_CH":"进港机场","DEP_CH1":"离港机场","ARR_DEP":"进出港航班号","FLIGHT_DATE":"航班日期",
- "TASKTYPE": "航班类型","FLIGHT_STATUS":"航班状态","STD": "预计起飞","ATA": "实际到达","ATD": "实际起飞","TD": "预计起飞",
- "BAY1": "预计机位", "BAY_2": "进港机位", "BAY2": "预计机位", "BAY": "离港机位","WXRY": "维修人员", "FXRY": "放行人员",
- "TASKSTS": "维修状态","ZY_FLIGHT": "重要航班", "SJ": "随机","BL": "保留", "FLG_VR": "备降返航", "TASKSTS_TIME":"维修状态时间",
- "AP": "航前", "TR": "短停", "AF": "航后","TAF": "特航前","":"未显示","短停":"短停","ECSJRY":"二送人员","TASKSTS_ECSJ":"二送状态","FJ":"附加消息","CANCELID":"取消标志"}
- zydy = {"FLIGHT_ID":"航班编号","flightIds":"航班编号对","ACNO": "机号", "ACTYPE": "机型", "ENG_TYPE": "发动机", "FLIGHT_NO": "保障航班号",
- "STA": "非航前计划到达", "ETA": "非航前预计到达","DEP_CH":"进港机场","DEP_CH1":"离港机场","ARR_DEP":"进出港航班号","FLIGHT_DATE":"航班日期",
- "TASKTYPE": "航班类型","FLIGHT_STATUS":"航班状态","STD": "航前预计起飞","ATA": "非航前实际到达","ATD": "航前实际起飞","TD": "非航前预计起飞",
- "BAY1": "非航前预计进港机位", "BAY_2": "非航前进港机位", "BAY2": "航前预计离港机位", "BAY": "航前离港机位","WXRY": "维修人员", "FXRY": "放行人员",
- "TASKSTS": "维修状态","ZY_FLIGHT": "重要航班", "SJ": "随机","BL": "保留", "FLG_VR": "备降返航", "TASKSTS_TIME":"维修状态时间",
- "AP": "航前", "TR": "短停", "AF": "航后","TAF": "特航前","":"未显示","短停":"短停","ECSJRY":"二送人员","TASKSTS_ECSJ":"二送状态","FJ":"附加消息","CANCELID":"取消标志"}
- sortLabel=["编号","航班编号","保障时间","航班类型","航班日期","级别"]
- logsLabel=["编号","航班编号","警告信息","信息状态","提示信息","产生时间","处理人","处理时间","变更字段","显示对象","提示内容"]
- changestsLabel=["航班编号","航班编号对","机号","发动机","机型","保障航班号","进港机场","离港机场","进出港航班号","航班日期","航班状态",
- "航班类型","非航前计划到达","航前预计起飞","非航前实际到达","航前实际起飞","非航前预计到达","非航前预计起飞","非航前预计进港机位",
- "非航前进港机位","航前预计离港机位","航前离港机位","维修人员","放行人员","维修状态","重要航班","随机","保留","备降返航","维修状态时间"]
- workloadLabel=["编号","机号","机位","航班编号","开始时间","结束时间","保障日期","航班类型","人员状态"]
- workerinfoLabel=["工号","姓名","部门","岗位","通行证","电话","年限","川航授权","南航授权","试车授权","星级","籍贯"] #待持续更新
- authorityLabel=["编号","用户名","密码","权限","使用人"]
- taskLabel=["编号","时间","提示内容","详细信息"]
- RiskLabel=["风险编号","状态","提示内容","触发条件1","触发条件2","触发条件3","触发条件4","触发条件5"]
- workjobkeyLabel=["任务编号","工作包编号","查询开始时间","查询结束时间","开始时间","基地","项目描述","工作步骤","机号","机型","航班类型"]
- flightstsLabel=["航班编号","机号","机位","接机到位","放行","销子夹板","随机到位","二送到位","接机已到位提示","已放行提示","销子夹板已提示","随机已到位提示","二送已到位提示","天府飞机"]
- flightinfoLabel=["航班编号","航班编号对","机号","发动机","机型","保障航班号","进港机场","离港机场","进出港航班号","航班日期","航班状态",
- "航班类型","非航前计划到达","航前预计起飞","非航前实际到达","非航前预计到达","航前实际起飞","非航前预计起飞","非航前预计进港机位",
- "非航前进港机位","航前预计离港机位","航前离港机位","维修人员","放行人员","维修状态","重要航班","随机","保留","备降返航","维修状态时间","二送人员","二送状态","附加消息","取消标志"]
- trackLabel=["单号","创建时间","类型","清单","紧急程度","创建人","派送地址","接收人","库管开始","库管派发","领料地址",
- "金熊猫接收","金熊猫到位","配送到位","签收人","备注信息","一","二","三","四","五","六","七","八"]
- enflightifnoLabel=["FLIGHT_ID","flightIds","ACNO","ENG_TYPE","ACTYPE","FLIGHT_NO","DEP_CH","DEP_CH1","ARR_DEP","FLIGHT_DATE","FLIGHT_STATUS",
- "TASKTYPE","STA","STD","ATA","ETA","ATD","TD","BAY1","BAY_2","BAY2","BAY","WXRY","FXRY","TASKSTS","ZY_FLIGHT",
- "SJ","BL","FLG_VR","TASKSTS_TIME","ECSJRY","TASKSTS_ECSJ","FJ","CANCELID"]
- TaskflightinfoLabel=["航班编号","机号","航班日期","航班类型","非航前计划到达","航前预计起飞","非航前实际到达","航前实际起飞","非航前预计到达","预飞预达",
- "非航前进港机位","航前离港机位","维修人员","放行人员","维修状态","随机","保留","维修状态时间","工作包","二次送机","进出港航班号","任务编号"]#重要航班和备降返航有待研究
- TaskflightinfoLabel2en={"ACNO":"机号","FLIGHTDATE":"航班日期","TASKTYPE":"航班类型","STA":"非航前计划到达","STD":"航前预计起飞","ATA":"非航前实际到达","ATD":"航前实际起飞","ETA":"非航前预计到达","TA_TD":"预飞预达",
- "BAY_A":"非航前进港机位","BAY_B":"航前离港机位","WX":"维修人员","FX":"放行人员","TASKSTS":"维修状态","SJ_DEP":"随机","SJ_ARR":"随机",
- "BL":"保留","TASKSTS_TIME":"维修状态时间","FJ_TASKIDS":"工作包","ECSJ":"二次送机","FNO":"进出港航班号","TASKID":"任务编号"}
- #'''"FLIGHTID1":"航班编号","FLIGHTID2":"航班编号",'''
- #displayLabel=["显示类型","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","99","101","102","103","109"]
- displayLabel=["ID","A","B"]
- peopleScheduleLabel=["编号","航班编号","显示模式","放行","勤务1","勤务2","工1","工2","工3","附加消息"]
- CalllistLabel=["航班编号","电话","工号","姓名","航班号","附加消息","拨号次数","创建时间","接通时间"]
- rowlistLabel={10:"放行",11:"勤务1",12:"勤务2",13:"工1",14:"工2",15:"工3",-1:"附加消息"}
- pglistLabel=["姓名","工号","角色","班次"]
- pglistLabel2en={"NAME":"姓名","EMP_NO":"工号","MAINLY_ROLE":"角色","SHIFT":"班次"}
- ecsjtaskSTS={"":"空值","0":"空值",'5':'二送任务待确认', '10':'二送任务已确认', '15':'二送到位',"20":"二送离场"}
- #headerLabel = utils.headerLabel
- #headerLabelKey=utils.headerLabelKey
- headerLabel = flightinfoLabel
- headerLabelKey=enflightifnoLabel
- taskType =get_dic("taskType")
- taskSTS = get_dic("taskSTS")
- flightSTS = get_dic("flightSTS")
- flightSTSDic = get_dic("taskSTS")
- 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,9):
- 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:
- dingding_alert(traceback.format_exc())
- 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,9):
- 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:
- dingding_alert(traceback.format_exc())
- 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,9):
- 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:
- dingding_alert(traceback.format_exc())
- def dingding_alert(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 + '×tamp=' + timestamp + "&sign=" + sign
- header = {
- "Content-Type": "application/json"
- }
- data = {
- "at": {
- "atMobiles":(123,456),
- # "isAtAll": True
- },
- "text": {
- "content": msg
- },
- "msgtype": "text"
- }
- res = requests.post(url=dingding_url, data=json.dumps(data), headers=header)
- 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 + '×tamp=' + 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 + '×tamp=' + 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 maintainAuthCheck(fdb:flightDB,name,flighttype):
- search=fdb.queryTabel("workerinfo","姓名","姓名 = '{}' and 南航授权 like '%{}%'".format(name,flighttype))
- if search ==None or len(search) !=0:
- res = {"返回值":"ok"}
- else:
- res = {"返回值": "fail"}
- return res
- 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 LoadSingals
- except Exception:
- dingding_alert(traceback.format_exc())
- def changepassword(user,old,new):
- try:
- loginTabledb =flightDB(host=host,
- port=port,
- user=user,
- password=password,
- database=databaseloginDB
- )
- newdic={"密码":"'%s'"%new}
- loginTabledb.upDateItem("logintable",newdic,"登录名='%s' and 密码='%s'"%(user,old))
- loginTabledb.close()
- except Exception:
- dingding_alert(traceback.format_exc())
- 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
- # peopleLabel = ["序号", "姓名", "角色", "总量", "当前", "最后时间"]
- rowNum = 0
- JS = ""
- workload = []
- workload_now = ""
- lastone=""
- for row in diplaylist:
- col={}
- if len(fdb.queryTabel('workerinfo', "*", "姓名='%s'" % row[0])) != 0:
- workload = []
- workload_now = []
- if bc == "A":
- workload = workLoad.queryTabel('workload{}'.format(row[1]), "*","开始时间!='' and 保障日期='%s'" % nowDayStr_search)
- workload_now = len(workload) - len(workLoad.queryTabel('workload{}'.format(row[1]), "*","结束时间!='' and 保障日期='%s'" % nowDayStr_search))
- elif bc == "B" and nowDaystr == nowDay and a < nowtime < b: # 选择今天00900之前的夜班
- workload = workLoad.queryTabel('workload{}'.format(row[1]), "*","开始时间!='' and (保障日期='%s' or 保障日期='%s')" % (nowDayStr_search, yesterday_search))
- workload_now = len(workload) - len(workLoad.queryTabel('workload{}'.format(row[1]), "*","结束时间!='' and (保障日期='%s' or 保障日期='%s')" % (nowDayStr_search, yesterday_search)))
- elif bc == "B" and nowDaystr == nowDay and b < nowtime:
- workload = workLoad.queryTabel('workload{}'.format(row[1]), "*","开始时间!='' and (保障日期='%s' or 保障日期='%s')" % (nowDayStr_search, tomorrow_search))
- workload_now = len(workload) - len(workLoad.queryTabel('workload{}'.format(row[1]), "*","结束时间!='' and (保障日期='%s' or 保障日期='%s')" % (nowDayStr_search, tomorrow_search)))
- elif bc == "B" and nowDaystr == nowDay_1: # 选择今天之前的夜班
- workload = workLoad.queryTabel('workload{}'.format(row[1]), "*","开始时间!='' and (保障日期='%s' or 保障日期='%s')" % (nowDayStr_search, yesterday_search))
- workload_now = len(workload) - len(workLoad.queryTabel('workload{}'.format(row[1]), "*","结束时间!='' and (保障日期='%s' or 保障日期='%s')" % (nowDayStr_search, yesterday_search)))
- elif bc == "B" and nowDaystr < nowDay_1: # 选择今天之前的夜班
- workload = workLoad.queryTabel('workload{}'.format(row[1]), "*","开始时间!='' and (保障日期='%s' or 保障日期='%s')" % (selectday, selectday_2))
- workload_now = len(workload) - len(workLoad.queryTabel('workload{}'.format(row[1]), "*", "结束时间!='' and (保障日期='%s' or 保障日期='%s')" % (selectday, selectday_2)))
- time = []
- lastone = ""
- for j in workload:
- time.append(j[4])
- time.append(j[5])
- if len(time) != 0:
- lastone = time[0]
- for i in range(1, len(time) - 1):
- if lastone < time[i]:
- lastone = time[i]
- lastone = lastone[-8:-3]
- if row[2] == "WX":
- JS = "维修员"
- elif row[2] == "FX":
- JS ="放行"
- col={"序号":rowNum,"姓名":row[0],"角色":JS,"总量":str(len(workload)),"当前":str(workload_now),"最后时间":lastone,}
- aa.append(col)
- rowNum += 1
- if len(aa) != 0:
- #aa.sort(key=lambda x:(x["角色"],x['最后时间'],x['当前'],x['总量']))
- aa.sort(key=lambda x: (x["角色"], x['当前'], x['最后时间'], x['总量']))
- #print(aa)
- rowNum1=0
- for i in aa:
- i["序号"]=rowNum1
- qtPeopleLoad[rowNum1]=i
- rowNum1 += 1
- #print(qtPeopleLoad)
- return qtPeopleLoad
- except Exception:
- dingding_alert(traceback.format_exc())
- def updateDragDropItem(fdb:flightDB,column,text,flightid,displayMode,flighttype,selectedtime):
- try:
- flightid_new=""
- 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 =="航前":
- 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)
- else:
- if text != "清空项目12345678987654321":
- newdic[rowlistLabel[int(column)]]="'%s'"%text
- else:
- newdic[rowlistLabel[int(column)]]="''"
- fdb.upDateItem("peopleSchedule{}".format(selectedtime),newdic,"编号='%s'"%flightid_new)
- except Exception:
- dingding_alert(traceback.format_exc())
- def updateEidteItem(fdb:flightDB,text,flightid,displayMode,flighttype,selectedtime):
- try:
- 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"
- 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):
- 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:
- dingding_alert(traceback.format_exc())
- 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:
- dingding_alert(traceback.format_exc())
- def mapDispaly(fdb:flightDB,selectedtime):
- try:
- mapDispalydata = {}
- nowDayStr = selectedtime
- sorttable = fdb.queryTabel("sortFlight{}".format(nowDayStr),"*","CAST(级别 AS integer)='1' or CAST(级别 AS integer)='3'")
- #{机位:[机号,机型,发动机,航班类型,航班号,ta,td,进港机场,出港机场,状态,放行,维修人员,二送人员,保留,工作包,TASKID,flightid,color,备注]}
- for row in sorttable:
- # print(row)
- otheroneSts = []
- flightinfodata = fdb.queryTabel('flightinfo{}'.format(nowDayStr), '*', "航班编号='{}'".format(row[1]))[0]
- if flightinfodata[11] == "短停":
- iddd=row[1]+"-1"
- iddddd = row[1] + "-2"
- jfjSts= fdb.queryTabel("sortFlight{}".format(nowDayStr),"级别","编号='%s'"%iddd)[0][0]
- sfjSts = fdb.queryTabel("sortFlight{}".format(nowDayStr), "级别", "编号='%s'" % iddddd)[0][0]
- # print(otheroneSts)
- if (flightinfodata[11] =="航前" and flightinfodata[21] !="") or (flightinfodata[11] !="航前" and flightinfodata[19] !=""):
- TaskFlightinfo = fdb.queryTabel('TaskFlightinfo{}'.format(nowDayStr), '*', "航班编号='{}'".format(row[1]))
- if flightinfodata[11] == "航前" and flightinfodata[21] != "":
- bay=flightinfodata[21]
- color="#99CCCC"
- elif flightinfodata[11] == "航后" and flightinfodata[19] != "" and row[5]=="3":
- bay = flightinfodata[19]
- color = "#0095d9"
- elif flightinfodata[11] == "停场" and flightinfodata[19] != "" and row[5]=="3":
- bay = flightinfodata[19]
- color = "#0095d9"
- elif flightinfodata[11] == "航后" and flightinfodata[19] != "" and row[5]=="1":
- bay = "Y"+flightinfodata[19]
- color = "#f6ad49"
- elif flightinfodata[11] == "特后前" and flightinfodata[19] != "" and flightinfodata[14] == "":
- bay = "Y"+flightinfodata[19]
- color = "#f6ad49"
- elif flightinfodata[11] == "特后前" and flightinfodata[19] != "" and flightinfodata[14] != "":
- bay = flightinfodata[19]
- color = "#4c6cb3"
- elif flightinfodata[11] == "短停" and flightinfodata[19] != "" and jfjSts=="1":
- bay = "Y"+flightinfodata[19]
- color = "#f6ad49"
- elif flightinfodata[11] == "短停" and flightinfodata[19] != "" and jfjSts=="4" and sfjSts=="1":
- bay = flightinfodata[19]
- color = "#69b076"
- acno=flightinfodata[2]
- airpalneType=flightinfodata[4]
- EngType=flightinfodata[3]
- flightType = flightinfodata[11]
- flightNos = flightinfodata[8]
- DEP_CH=flightinfodata[6] #进港机场
- DEP_CH1=flightinfodata[7] #出港机场
- flightsts = flightinfodata[10]
- wx=flightinfodata[22]
- fx = flightinfodata[23]
- es = flightinfodata[30]
- flightid=flightinfodata[0]
- message=flightinfodata[32]
- e = "" #保留
- F = ""#工作包
- g = "" #taskid
- ta = ""
- td=""
- if len(TaskFlightinfo) != 0:
- if TaskFlightinfo[0][16] != "":
- e = "有保留"
- if TaskFlightinfo[0][18] != "":
- F = "有工作包"
- if TaskFlightinfo[0][21] != "":
- g = TaskFlightinfo[0][21]
- if "-" not in TaskFlightinfo[0][9].split('</br>')[0]:
- ta = TaskFlightinfo[0][9].split('</br>')[0]
- if "-" not in TaskFlightinfo[0][9].split('</br>')[1]:
- td = TaskFlightinfo[0][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"
- 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
- }
- return mapDispalydata
- except Exception:
- dingding_alert(traceback.format_exc())
- 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}
- dbtables=["flightinfo%s"%today,"flightinfo%s"%yesterday,"flightinfo%s"%tomorrow,
- "peopleschedule%s"%today,"peopleschedule%s"%yesterday,"peopleschedule%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 :
- print(traceback.format_exc())
- continue
- print(datetime.datetime.now(), "[同步中心]完成数据库同步(%s[%s])"%(tablesok,tablenum))
- return "ok"
- except Exception:
- print(traceback.format_exc())
- return "fail"
- 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
- for row in sorttable:
- flightinfodata = fdb.queryTabel('flightinfo{}'.format(nowDayStr), '*', "航班编号='{}'".format(row[1]))[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=flightinfodata[11] if "3U" not in str(flightinfodata[8]) and "CSC" not in str(flightinfodata[8]) else "外"+str(flightinfodata[11])
- a = flightinfodata[12][-8:-3] if flightinfodata[12] != "" else ""
- if flightinfodata[12] != "" and flightinfodata[16] == "" and flightinfodata[15] != "":
- a = flightinfodata[15][-8:-3]
- elif flightinfodata[12] != "" and flightinfodata[16] == "" and flightinfodata[15] == "":
- a = flightinfodata[12][-8:-3]
- elif flightinfodata[12] == "" and flightinfodata[16] == "" and flightinfodata[15] == "":
- a = ""
- elif flightinfodata[16] != "":
- a = ""
- a = str(a).split(":")[0] + str(a).split(":")[1] if a != "" else ""
- b = str(flightinfodata[15][-8:-3]).split(":")[0] + str(flightinfodata[15][-8:-3]).split(":")[1] if flightinfodata[15] != "" else ""
- c = flightinfodata[17][-6:] if flightinfodata[17] != "" else ""
- c = str(c).split(":")[0]+ str(c).split(":")[1] if c != "" else ""
- 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 flightinfodata[11] == "航后":
- ws.cell(rowNum+2, 1).value = rowNum+1
- ws.cell(rowNum+2, 2).value = flighttype
- ws.cell(rowNum+2, 3).value = flightinfodata[8]
- ws.cell(rowNum+2, 4).value = flightinfodata[4]
- ws.cell(rowNum+2, 5).value = flightinfodata[3]
- ws.cell(rowNum+2, 6).value = flightinfodata[2]
- 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 = flightinfodata[19]
- 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 flightinfodata[11] == "停场":
- 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 = flightinfodata[4]
- ws.cell(rowNum + 2, 5).value = flightinfodata[3]
- ws.cell(rowNum + 2, 6).value = flightinfodata[2]
- ws.cell(rowNum + 2, 7).value = ""
- ws.cell(rowNum + 2, 8).value = ""
- ws.cell(rowNum + 2, 9).value = ""
- ws.cell(rowNum + 2, 10).value = flightinfodata[19]
- 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 flightinfodata[11] == "航前":
- ws.cell(rowNum + 2, 1).value = rowNum+1
- ws.cell(rowNum + 2, 2).value = flighttype
- ws.cell(rowNum + 2, 3).value = flightinfodata[8]
- ws.cell(rowNum + 2, 4).value = flightinfodata[4]
- ws.cell(rowNum + 2, 5).value = flightinfodata[3]
- ws.cell(rowNum + 2, 6).value = flightinfodata[2]
- 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 = flightinfodata[21]
- 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 = flightinfodata[8]
- ws.cell(rowNum + 2, 4).value = flightinfodata[4]
- ws.cell(rowNum + 2, 5).value = flightinfodata[3]
- ws.cell(rowNum + 2, 6).value = flightinfodata[2]
- 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 = flightinfodata[19]
- 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 = flightinfodata[8]
- ws.cell(rowNum + 2, 4).value = flightinfodata[4]
- ws.cell(rowNum + 2, 5).value = flightinfodata[3]
- ws.cell(rowNum + 2, 6).value = flightinfodata[2]
- 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 = flightinfodata[19]
- 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:
- dingding_alert(traceback.format_exc())
- 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
- 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
- def TuplefindInList(lists: list, args):
- for l in lists:
- if args in l:
- return l
- return None
- def functionDisaplay(row,rowNum,TaskFlightinfoAlldata, workjobDataAll,flightInfoDataAll, 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 flightinfodata[11] == "航后":
- postion = str(flightinfodata[6]) + "-天府"
- elif flightinfodata[11] == "短停" or flightinfodata[11] == "特后前":
- postion = str(flightinfodata[6]) + "-天府-" + str(flightinfodata[7])
- else:
- postion = "天府-" + str(flightinfodata[7])
- a = flightinfodata[12][-8:-3] if flightinfodata[12] != "" else ""
- if flightinfodata[12] != "" and flightinfodata[16] == "" and flightinfodata[15] != "":
- a = flightinfodata[15][-8:-3]
- elif flightinfodata[12] != "" and flightinfodata[16] == "" and flightinfodata[15] == "":
- a = flightinfodata[12][-8:-3]
- elif flightinfodata[12] == "" and flightinfodata[16] == "" and flightinfodata[15] == "":
- a = ""
- elif flightinfodata[16] != "":
- a = ""
- b = flightinfodata[15][-8:-3] if flightinfodata[15] != "" else ""
- c = flightinfodata[17][0:3] + flightinfodata[17][-6:] if flightinfodata[17] != "" else ""
- d = flightinfodata[26].split(">")[1] if ">" in str(flightinfodata[26]) 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"
- #print(peopleScheduleDataAll)
- peopleSchedule = TuplefindInList(peopleScheduleDataAll,findid)
- #peopleSchedule = fdb.queryTabel("peopleSchedule{}".format(nowDayStr), "*", "编号='%s'" % findid)
- #print(peopleSchedule)
- if peopleSchedule != None:
- fx = peopleSchedule[3]
- qw1 = peopleSchedule[4]
- qw2 = peopleSchedule[5]
- g1 = peopleSchedule[6]
- g2 = peopleSchedule[7]
- g3 = peopleSchedule[8]
- if flightinfodata[28] != "" and flightinfodata[28][0] == "R" and "返航航班" not in str(peopleSchedule[9]):
- fj = "返航航班;" + str(peopleSchedule[9])
- elif flightinfodata[28] != "" and flightinfodata[28] == "V" and "备降航班" not in str(peopleSchedule[9]):
- fj = "备降航班;" + str(peopleSchedule[9])
- else:
- fj = str(peopleSchedule[9])
- else:
- fx = ""
- qw1 = ""
- qw2 = ""
- g1 = ""
- g2 = ""
- g3 = ""
- if flightinfodata[28] != "" and flightinfodata[28][0] == "R":
- fj = "返航航班;"
- elif flightinfodata[28] != "" and flightinfodata[28][0] == "V":
- fj = "备降航班;"
- else:
- fj = ""
- if "随机离港" in str(fj):
- SJDW = "√" if flightstsdata[6] != "" else ""
- else:
- SJDW ="--"
- if flightinfodata[11] == "航后":
- item_dic = {"0": rowNum,
- "1": flightinfodata[2],
- "2": flightinfodata[4],
- "3": flightinfodata[3],
- "4": flightinfodata[8],
- "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]
- }
- elif flightinfodata[11] == "停场":
- item_dic = {"0": rowNum,
- "1": flightinfodata[2],
- "2": flightinfodata[4],
- "3": flightinfodata[3],
- "4": "--",
- "5": a,
- "6": "--",
- "7": "--",
- "8": flightinfodata[19],
- "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]
- }
- elif flightinfodata[11] == "航前":
- item_dic = {"0": rowNum,
- "1": flightinfodata[2],
- "2": flightinfodata[4],
- "3": flightinfodata[3],
- "4": flightinfodata[8],
- "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]
- }
- elif (flightinfodata[11] == "短停" or flightinfodata[11] == "特后前") and (row[3] == "短停接" or row[3] == "特后前接"):
- item_dic = {"0": rowNum,
- "1": flightinfodata[2],
- "2": flightinfodata[4],
- "3": flightinfodata[3],
- "4": flightinfodata[8],
- "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]
- }
- elif (flightinfodata[11] == "短停" or flightinfodata[11] == "特后前") and (row[3] == "短停送" or row[3] == "特后前送"):
- item_dic = {"0": rowNum,
- "1": flightinfodata[2],
- "2": flightinfodata[4],
- "3": flightinfodata[3],
- "4": flightinfodata[8],
- "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]
- }
- else:
- item_dic = {"0": rowNum,
- "1": flightinfodata[2],
- "2": flightinfodata[4],
- "3": flightinfodata[3],
- "4": flightinfodata[8],
- "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]
- }
- #tableWidgetDispalydata[rowNum] = item_dic
- #rowNum += 1
- # print(rowNum)
- # print(item_dic)
- # print({rowNum:item_dic})
- return {rowNum:item_dic}
- #########################################
- # 测试导出
- def tableWidgetDispalyAlllogs(fdb: flightDB):
- index2 = {0: "编号", 1: "航班编号", 2: "警告信息", 3: "信息状态", 4: "提示信息", 5: "产生时间", 6: "处理人", 7: "处理时间", 8: "变更字段",9: "显示对象", 10: "提示内容"}
- data = fdb.getAlldata("logs")
- res = {}
- if data != None and len(data) != 0:
- for i in data:
- aa = {}
- for j in index2.keys():
- aa["%s"%j]=i[j]
- res[i[0]]=aa
- return res
- def tableWidgetDispalyCalllogs(fdb: flightDB):
- index2 = {0: "航班编号", 1: "电话", 2: "航班号", 3: "创建时间", 4: "姓名", 5: "接通时间", 6: "附加信息", 7: "工号", 8: "拨号次数"}
- data = fdb.getAlldata("Calllist")
- res = {}
- if data != None and len(data) != 0:
- ii = 0
- for i in data:
- aa = {}
- for j in index2.keys():
- aa["%s"%j]=i[j]
- res[ii]=aa
- ii+=1
- return res
- ########################################
- 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))
- 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:
- #dingding_alert(traceback.format_exc())
- print(traceback.format_exc())
- def functionDisplay2(row, rowNum, TaskFlightinfoAll,flightinfodataAll,flightstsdataAll,waringMessageIDs,peopleScheduleAll):
- 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 flightinfodata[11] == "航后":
- postion = str(flightinfodata[6]) + "-天府"
- elif flightinfodata[11] == "短停" or flightinfodata[11] == "特后前":
- postion = str(flightinfodata[6]) + "-天府-" + str(flightinfodata[7])
- else:
- postion = "天府-" + str(flightinfodata[7])
- a = flightinfodata[12][-8:-3] if flightinfodata[12] != "" else ""
- if flightinfodata[12] != "" and flightinfodata[16] == "" and flightinfodata[15] != "":
- a = flightinfodata[15][-8:-3]
- elif flightinfodata[12] != "" and flightinfodata[16] == "" and flightinfodata[15] == "":
- a = flightinfodata[12][-8:-3]
- elif flightinfodata[12] == "" and flightinfodata[16] == "" and flightinfodata[15] == "":
- a = ""
- elif flightinfodata[16] != "":
- a = ""
- b = flightinfodata[15][-8:-3] if flightinfodata[15] != "" else ""
- c = flightinfodata[17][0:3] + flightinfodata[17][-6:] if flightinfodata[17] != "" else ""
- d = flightinfodata[26].split(">")[1] if ">" in str(flightinfodata[26]) 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 flightinfodata[11] == "航后":
- item_dic = {"0": rowNum,
- "1": flightinfodata[2],
- "2": flightinfodata[4],
- "3": flightinfodata[3],
- "4": flightinfodata[8],
- "5": a,
- "6": b,
- "7": "--",
- "8": JWA,
- "9": flightinfodata[11],
- "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 flightinfodata[11] == "停场":
- item_dic = {"0": rowNum,
- "1": flightinfodata[2],
- "2": flightinfodata[4],
- "3": flightinfodata[3],
- "4": "--",
- "5": a,
- "6": "--",
- "7": "--",
- "8": JWA,
- "9": flightinfodata[11],
- "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 flightinfodata[11] == "航前":
- item_dic = {"0": rowNum,
- "1": flightinfodata[2],
- "2": flightinfodata[4],
- "3": flightinfodata[3],
- "4": flightinfodata[8],
- "5": "",
- "6": "",
- "7": c,
- "8": JWB,
- "9": flightinfodata[11],
- "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": flightinfodata[2],
- "2": flightinfodata[4],
- "3": flightinfodata[3],
- "4": flightinfodata[8],
- "5": a,
- "6": b,
- "7": c,
- "8": JWA,
- "9": flightinfodata[11],
- "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": flightinfodata[2],
- "2": flightinfodata[4],
- "3": flightinfodata[3],
- "4": flightinfodata[8],
- "5": a,
- "6": b,
- "7": c,
- "8": JWA,
- "9": flightinfodata[11],
- "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}
- 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))
- flightinfodataAll = fdb.getAlldata('flightinfo{}'.format(nowDayStr))
- flightstsdataAll = fdb.getAlldata('flightsts{}'.format(nowDayStr))
- waringMessageIDs = waringMessageID(fdb)
- peopleScheduleAll = fdb.getAlldata("peopleSchedule{}".format(nowDayStr))
- '''
- 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":"附加消息"}
- '''
- rowNum = 0
- # functionDisplay2(sorttable[1], 1, TaskFlightinfoAll,
- # flightinfodataAll, flightstsdataAll, waringMessageIDs,
- # peopleScheduleAll)
- executor = concurrent.futures.ThreadPoolExecutor()
- all_task = []
- for i in range(len(sorttable)):
- all_task.append(executor.submit(functionDisplay2, sorttable[i], i, TaskFlightinfoAll,
- flightinfodataAll, flightstsdataAll, waringMessageIDs,
- peopleScheduleAll))
- 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:
- #dingding_alert(traceback.format_exc())
- print(traceback.format_exc())
- def tableWidgetDispalyOld(fdb:flightDB,selectedtime,date):#1,昨天。2今天3明天4其他
- try:
- #print("tableWidgetDispaly")
- #print(selectedtime)
- #ts=datetime.datetime.now()
- tableWidgetDispalydata = {}
- sorttable = getSortFlightdata(fdb, selectedtime, "sortFlight")
- nowDayStr = selectedtime
- rowNum = 0
- for row in sorttable:
- # print(row)
- TaskFlightinfo = fdb.queryTabel('TaskFlightinfo{}'.format(nowDayStr), '*', "航班编号='{}'".format(row[1]))
- e = ""
- F = ""
- g = ""
- if len(TaskFlightinfo) != 0 and TaskFlightinfo[0][16] != "":
- e = "保留"
- if len(TaskFlightinfo) != 0 and TaskFlightinfo[0][18] != "":
- takinfo = fdb.queryTabel('workjob','*',"任务编号= '%s'"%TaskFlightinfo[0][21])
- F = "工作包无法正常获取请通过AMRO人工查询"
- if len(takinfo) != 0 and takinfo[0][4] !="":
- F=takinfo[0][4]+"\n<+++++++++++++++++++++++++++++++++++++++++>\n"+takinfo[0][6]+"\n<+++++++++++++++++++++++++++++++++++++++++>\n"+takinfo[0][7]
- elif len(takinfo) != 0:
- F="工作包暂未获取请点击右键工作包查询后即可随意查看"
- if len(TaskFlightinfo) != 0 and TaskFlightinfo[0][21] != "":
- g = TaskFlightinfo[0][21]
- wx_people = ""
- fx_people = ""
- ecsj_people = ""
- ta_td = ""
- type31 = ""
- if len(TaskFlightinfo) != 0:
- wx_people = TaskFlightinfo[0][12]
- fx_people = TaskFlightinfo[0][13]
- ecsj_people = TaskFlightinfo[0][19]
- ta_td = TaskFlightinfo[0][9]
- type31 = TaskFlightinfo[0][3]
- #print(row[1])
- #print(fdb.queryTabel('flightinfo{}'.format(nowDayStr), '*', "航班编号='{}'".format(row[1])))
- flightinfodata = fdb.queryTabel('flightinfo{}'.format(nowDayStr), '*', "航班编号='{}'".format(row[1]))[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 ""
- SJDW = "√" if flightstsdata[6] != "" else ""
- if flightinfodata[11] == "航后":
- postion=str(flightinfodata[6])+"-天府"
- elif flightinfodata[11] == "短停" or flightinfodata[11] == "特后前":
- postion = str(flightinfodata[6]) + "-天府-"+str(flightinfodata[7])
- else:
- postion = "天府-" + str(flightinfodata[7])
- a = flightinfodata[12][-8:-3] if flightinfodata[12] != "" else ""
- if flightinfodata[12] != "" and flightinfodata[16] == "" and flightinfodata[15] != "":
- a = flightinfodata[15][-8:-3]
- elif flightinfodata[12] != "" and flightinfodata[16] == "" and flightinfodata[15] == "":
- a = flightinfodata[12][-8:-3]
- elif flightinfodata[12] == "" and flightinfodata[16] == "" and flightinfodata[15] == "":
- a = ""
- elif flightinfodata[16] != "":
- a = ""
- b = flightinfodata[15][-8:-3] if flightinfodata[15] != "" else ""
- c = flightinfodata[17][0:3] + flightinfodata[17][-6:] if flightinfodata[17] != "" else ""
- d = flightinfodata[26].split(">")[1] if ">" in str(flightinfodata[26]) 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[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=fdb.queryTabel("peopleSchedule{}".format(nowDayStr),"*","编号='%s'"%findid)
- #print(peopleSchedule)
- if len(peopleSchedule) != 0:
- fx=peopleSchedule[0][3]
- qw1 = peopleSchedule[0][4]
- qw2 = peopleSchedule[0][5]
- g1 = peopleSchedule[0][6]
- g2 = peopleSchedule[0][7]
- g3 = peopleSchedule[0][8]
- if flightinfodata[28] !="" and flightinfodata[28][0] =="R" and "返航航班" not in str(peopleSchedule[0][9]):
- fj = "返航航班;"+str(peopleSchedule[0][9])
- elif flightinfodata[28] !="" and flightinfodata[28][0] == "V" and "备降航班" not in str(peopleSchedule[0][9]):
- fj = "备降航班;" + str(peopleSchedule[0][9])
- else:
- fj = str(peopleSchedule[0][9])
- else:
- fx = ""
- qw1 = ""
- qw2 = ""
- g1 = ""
- g2 = ""
- g3 = ""
- if flightinfodata[28] != "" and flightinfodata[28][0] == "R":
- fj = "返航航班;"
- elif flightinfodata[28] != "" and flightinfodata[28][0] == "V":
- fj = "备降航班;"
- else:
- fj = ""
- if flightinfodata[11] == "航后":
- item_dic = {"0": rowNum,
- "1": flightinfodata[2],
- "2": flightinfodata[4],
- "3": flightinfodata[3],
- "4": flightinfodata[8],
- "5": a,
- "6": b,
- "7": "--",
- "8": flightinfodata[19],
- "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]
- }
- elif flightinfodata[11] == "停场":
- item_dic = {"0": rowNum,
- "1": flightinfodata[2],
- "2": flightinfodata[4],
- "3": flightinfodata[3],
- "4": "--",
- "5": a,
- "6": "--",
- "7": "--",
- "8": flightinfodata[19],
- "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]
- }
- elif flightinfodata[11] == "航前":
- item_dic = {"0": rowNum,
- "1": flightinfodata[2],
- "2": flightinfodata[4],
- "3": flightinfodata[3],
- "4": flightinfodata[8],
- "5": "",
- "6": "",
- "7": c,
- "8": flightinfodata[21],
- "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]
- }
- elif (flightinfodata[11] == "短停" or flightinfodata[11] == "特后前" ) and (row[3] == "短停接" or row[3] == "特后前接"):
- item_dic = {"0": rowNum,
- "1": flightinfodata[2],
- "2": flightinfodata[4],
- "3": flightinfodata[3],
- "4": flightinfodata[8],
- "5": a,
- "6": b,
- "7": c,
- "8": flightinfodata[19],
- "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]
- }
- elif (flightinfodata[11] == "短停" or flightinfodata[11] == "特后前" ) and (row[3] == "短停送" or row[3] == "特后前送"):
- item_dic = {"0": rowNum,
- "1": flightinfodata[2],
- "2": flightinfodata[4],
- "3": flightinfodata[3],
- "4": flightinfodata[8],
- "5": a,
- "6": b,
- "7": c,
- "8": flightinfodata[19],
- "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]
- }
- else:
- item_dic = {"0": rowNum,
- "1": flightinfodata[2],
- "2": flightinfodata[4],
- "3": flightinfodata[3],
- "4": flightinfodata[8],
- "5": a,
- "6": b,
- "7": c,
- "8": flightinfodata[19],
- "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]
- }
- tableWidgetDispalydata[rowNum]=item_dic
- rowNum += 1
- #print(tableWidgetDispalydata)
- #print("耗时%s"%(datetime.datetime.now()-ts)) ###需要传参一个昨天今天明天地结果123
- 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'")
- return tableWidgetDispalydata
- except Exception:
- dingding_alert(traceback.format_exc())
- def tableWidgetDispaly2Old(fdb:flightDB,selectedtime,date):#1,昨天。2今天3明天4其他
- try:
- 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":"附加消息"}
- '''
- rowNum = 0
- for row in sorttable:
- # print(row)
- TaskFlightinfo = fdb.queryTabel('TaskFlightinfo{}'.format(nowDayStr), '*', "航班编号='{}'".format(row[1]))
- e = ""
- F = ""
- g = ""
- if len(TaskFlightinfo) != 0:
- if TaskFlightinfo[0][16] != "":
- e = "保留"
- if TaskFlightinfo[0][18] != "":
- F = "工作包"
- if TaskFlightinfo[0][21] != "":
- g = TaskFlightinfo[0][21]
- wx_people = ""
- fx_people = ""
- ecsj_people = ""
- ta_td = ""
- type31 = ""
- # print(TaskFlightinfo)
- if len(TaskFlightinfo) != 0:
- wx_people = TaskFlightinfo[0][12]
- fx_people = TaskFlightinfo[0][13]
- ecsj_people = TaskFlightinfo[0][19]
- ta_td = TaskFlightinfo[0][9]
- type31 = TaskFlightinfo[0][3]
- flightinfodata = fdb.queryTabel('flightinfo{}'.format(nowDayStr), '*', "航班编号='{}'".format(row[1]))[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 ""
- SJDW = "√" if flightstsdata[6] != "" else ""
- if flightinfodata[11] == "航后":
- postion=str(flightinfodata[6])+"-天府"
- elif flightinfodata[11] == "短停" or flightinfodata[11] == "特后前":
- postion = str(flightinfodata[6]) + "-天府-"+str(flightinfodata[7])
- else:
- postion = "天府-" + str(flightinfodata[7])
- a = flightinfodata[12][-8:-3] if flightinfodata[12] != "" else ""
- if flightinfodata[12] != "" and flightinfodata[16] == "" and flightinfodata[15] != "":
- a = flightinfodata[15][-8:-3]
- elif flightinfodata[12] != "" and flightinfodata[16] == "" and flightinfodata[15] == "":
- a = flightinfodata[12][-8:-3]
- elif flightinfodata[12] == "" and flightinfodata[16] == "" and flightinfodata[15] == "":
- a = ""
- elif flightinfodata[16] != "":
- a = ""
- b = flightinfodata[15][-8:-3] if flightinfodata[15] != "" else ""
- c = flightinfodata[17][0:3] + flightinfodata[17][-6:] if flightinfodata[17] != "" else ""
- d = flightinfodata[26].split(">")[1] if ">" in str(flightinfodata[26]) 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)
- if len(peopleSchedule) != 0:
- fx = peopleSchedule[0][3]
- qw1 = peopleSchedule[0][4]
- qw2 = peopleSchedule[0][5]
- g1 = peopleSchedule[0][6]
- g2 = peopleSchedule[0][7]
- g3 = peopleSchedule[0][8]
- fj = peopleSchedule[0][9]
- else:
- fx = ""
- qw1 = ""
- qw2 = ""
- g1 = ""
- g2 = ""
- g3 = ""
- fj = ""
- if flightinfodata[11] == "航后":
- item_dic = {"0": rowNum,
- "1": flightinfodata[2],
- "2": flightinfodata[4],
- "3": flightinfodata[3],
- "4": flightinfodata[8],
- "5": a,
- "6": b,
- "7": "--",
- "8": flightinfodata[19],
- "9": flightinfodata[11],
- "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
- elif flightinfodata[11] == "停场":
- item_dic = {"0": rowNum,
- "1": flightinfodata[2],
- "2": flightinfodata[4],
- "3": flightinfodata[3],
- "4": "--",
- "5": a,
- "6": "--",
- "7": "--",
- "8": flightinfodata[19],
- "9": flightinfodata[11],
- "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
- elif flightinfodata[11] == "航前":
- item_dic = {"0": rowNum,
- "1": flightinfodata[2],
- "2": flightinfodata[4],
- "3": flightinfodata[3],
- "4": flightinfodata[8],
- "5": "",
- "6": "",
- "7": c,
- "8": flightinfodata[21],
- "9": flightinfodata[11],
- "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
- elif row[3] == "短停接":
- item_dic = {"0": rowNum,
- "1": flightinfodata[2],
- "2": flightinfodata[4],
- "3": flightinfodata[3],
- "4": flightinfodata[8],
- "5": a,
- "6": b,
- "7": c,
- "8": flightinfodata[19],
- "9": flightinfodata[11],
- "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
- elif row[3] == "特后前接":
- item_dic = {"0": rowNum,
- "1": flightinfodata[2],
- "2": flightinfodata[4],
- "3": flightinfodata[3],
- "4": flightinfodata[8],
- "5": a,
- "6": b,
- "7": c,
- "8": flightinfodata[19],
- "9": flightinfodata[11],
- "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
- 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:
- dingding_alert(traceback.format_exc())
- 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:
- dingding_alert(traceback.format_exc())
- 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:
- dingding_alert(traceback.format_exc())
- def deletelogs(fdb:flightDB):
- try:
- now=datetime.datetime.now()
- passtime = (now - datetime.timedelta(days=30)).strftime("%Y-%m-%d %H:%M:%S")
- log_str = fdb.queryTabel('logs',"编号","产生时间 <'%s'" %passtime)
- if len(log_str) != 0:
- for i in log_str:
- fdb.deleteSingledata('logs',"编号='%s'" % i[0])
- except Exception:
- dingding_alert(traceback.format_exc())
- 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:
- dingding_alert(traceback.format_exc())
- 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:
- dingding_alert(traceback.format_exc())
- 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
- 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:
- fdb.FunctionCommit()
- dingding_alert(traceback.format_exc())
- 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:
- dingding_alert(traceback.format_exc())
- 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:
- dingding_alert(traceback.format_exc())
- 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:
- dingding_alert(traceback.format_exc())
- 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)
- 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:
- print(traceback.format_exc())
- dingding_alert(traceback.format_exc())
- def checkFlightAlert(database:flightDB):
- 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")
- selftaxi=["166","166L","166R","167","167L","167R","168","169","170","171","172","173","174","269","270","271","272","273","274","275","287","288","601","602","603","604","605","606","607","607L","607R"]
- 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")
- if database.getSingledata("航班编号", "flightinfo{}".format(nowDayStr)) !=None and len(database.getSingledata("航班编号", "flightinfo{}".format(nowDayStr))) != 0 and len(flightcheck) !=0:
- for i in flightcheck:
- a = database.queryTabel("flightinfo{}".format(nowDayStr), "机号", "航班编号='%s'" % i[0])[0][0]
- b = database.queryTabel("flightinfo{}".format(nowDayStr), "航班类型", "航班编号='%s'" % i[0])[0][0]
- dd = database.queryTabel("flightinfo{}".format(nowDayStr), "航班日期","航班编号='%s'" % i[0])[0][0]
- if b =="航前":
- c = database.queryTabel("flightinfo{}".format(nowDayStr), "航前离港机位", "航班编号='%s'" % i[0])[0][0]
- else:
- c = database.queryTabel("flightinfo{}".format(nowDayStr), "非航前进港机位", "航班编号='%s'" % i[0])[0][0]
- #if c in selftaxi:
- if "航前" in str(database.queryTabel("flightinfo{}".format(nowDayStr),"航班类型","航班编号='%s'"%i[0])) and database.queryTabel("flightinfo{}".format(nowDayStr),"航前预计起飞","航班编号='%s'"%i[0])[0][0] != "":
- STD=database.queryTabel("flightinfo{}".format(nowDayStr),"非航前预计起飞","航班编号='%s'"%i[0])[0][0]
- STD_str = dd.split("-")[0] + "/" + STD.split("]")[1]
- STD_90 = datetime.datetime.strptime(STD_str, "%Y/%m/%d %H:%M") - datetime.timedelta(minutes=90)
- STD_30 = datetime.datetime.strptime(STD_str, "%Y/%m/%d %H:%M") - datetime.timedelta(minutes=30)
- if STD_90 < now and "已到位" not in str(database.queryTabel('flightsts{}'.format(nowDayStr),"接机到位","航班编号='%s'"%i[0])) and \
- "到位警告" not in str(database.queryTabel('logs', "变更字段", "航班编号='%s' and 处理时间=''" % i[0])):
- newdic = {"航班编号": "%s" % i[0], "警告信息": "请确认%s%s%s到位情况!"%(a,b,c), "信息状态": "",
- "提示信息": "","产生时间": "%s" % now, "处理人": "", "处理时间": "", "变更字段": "到位警告","显示对象":"","提示内容":""}
- database.lazyInsertData('logs', newdic)
- if STD_30 < now and "已放行" not in str(database.queryTabel('flightsts{}'.format(nowDayStr),"放行","航班编号='%s'"%i[0])) and \
- "放行警告" not in str(database.queryTabel('logs', "变更字段", "航班编号='%s' and 处理时间=''" % i[0])):
- newdic = {"航班编号": "%s" % i[0], "警告信息": "请确认%s%s%s放行情况!"%(a,b,c), "信息状态": "",
- "提示信息": "","产生时间": "%s" % now, "处理人": "", "处理时间": "", "变更字段": "放行警告","显示对象":"","提示内容":""}
- database.lazyInsertData('logs', newdic)
- if STD_30 < now and "已取下" not in str(database.queryTabel('flightsts{}'.format(nowDayStr),"销子夹板","航班编号='%s'"%i[0])) and \
- "销夹警告" not in str(database.queryTabel('logs', "变更字段", "航班编号='%s' and 处理时间=''" % i[0])):
- newdic = {"航班编号": "%s" % i[0], "警告信息": "请确认%s%s%s销夹取下情况!"%(a,b,c), "信息状态": "",
- "提示信息": "","产生时间": "%s" % now, "处理人": "", "处理时间": "", "变更字段": "销夹警告","显示对象":"","提示内容":""}
- database.lazyInsertData('logs', newdic)
- elif "航后" in str(database.queryTabel("flightinfo{}".format(nowDayStr),"航班类型","航班编号='%s'"%i[0])) and\
- database.queryTabel("flightinfo{}".format(nowDayStr),"非航前预计到达","航班编号='%s'"%i[0])[0][0] != "" and\
- database.queryTabel("flightinfo{}".format(nowDayStr),"航前实际起飞","航班编号='%s'"%i[0])[0][0] != "":
- ETA_15_str = database.queryTabel("flightinfo{}".format(nowDayStr), "非航前预计到达", "航班编号='%s'" % i[0])[0][0]
- ETA_15 = datetime.datetime.strptime(ETA_15_str, "%Y-%m-%d %H:%M:%S") - datetime.timedelta(minutes=15)
- if ETA_15 < now and "已到位" not in database.queryTabel('flightsts{}'.format(nowDayStr),"接机到位","航班编号='%s'"%i[0]) and \
- "到位警告" not in str(database.queryTabel('logs', "变更字段", "航班编号='%s' and 处理时间=''" % i[0])):
- newdic = {"航班编号": "%s" % i[0], "警告信息": "请确认%s%s%s到位情况!"%(a,b,c), "信息状态": "",
- "提示信息": "","产生时间": "%s" % now, "处理人": "", "处理时间": "", "变更字段": "到位警告","显示对象":"","提示内容":""}
- database.lazyInsertData('logs', newdic)
- elif "短停" in str(database.queryTabel("flightinfo{}".format(nowDayStr),"航班类型","航班编号='%s'"%i[0])) and\
- database.queryTabel("flightinfo{}".format(nowDayStr),"非航前预计到达","航班编号='%s'"%i[0])[0][0]!= "" and \
- database.queryTabel("flightinfo{}".format(nowDayStr),"航前实际起飞","航班编号='%s'"%i[0])[0][0]!= "" :
- ETA_15_str=database.queryTabel("flightinfo{}".format(nowDayStr),"非航前预计到达","航班编号='%s'"%i[0])[0][0]
- ETA_15 = datetime.datetime.strptime(ETA_15_str, "%Y-%m-%d %H:%M:%S") - datetime.timedelta(minutes=15)
- ATA = database.queryTabel("flightinfo{}".format(nowDayStr), "非航前实际到达", "航班编号='%s'" % i[0])
- if ATA[0][0] != "":
- ATA_time_30 = datetime.datetime.strptime(ATA[0][0], "%Y-%m-%d %H:%M:%S") + datetime.timedelta(minutes=30)
- ATA_time_3H=datetime.datetime.strptime(ATA[0][0], "%Y-%m-%d %H:%M:%S")+datetime.timedelta(minutes=180)
- else:
- ATA_time_30 = ""
- ATA_time_3H=""
- FlightDate=database.queryTabel("flightinfo{}".format(nowDayStr), "航班日期", "航班编号='%s'" % i[0])[0][0]
- TD = database.queryTabel("flightinfo{}".format(nowDayStr), "非航前预计起飞", "航班编号='%s'" % i[0])[0][0]
- TD_time_str = FlightDate.split("-")[0] + "/" + TD.split("]")[1]
- TD_time_25 = datetime.datetime.strptime(TD_time_str, "%Y/%m/%d %H:%M")- datetime.timedelta(minutes=25)
- TD_time_120 = datetime.datetime.strptime(TD_time_str, "%Y/%m/%d %H:%M") - datetime.timedelta(minutes=120)
- TD_time=datetime.datetime.strptime(TD_time_str, "%Y/%m/%d %H:%M")
- if ETA_15 < now and "已到位" not in str(database.queryTabel('flightsts{}'.format(nowDayStr),"接机到位","航班编号='%s'"%i[0])) and \
- "到位警告" not in str(database.queryTabel('logs', "变更字段", "航班编号='%s' and 处理时间=''" % i[0])):
- newdic = {"航班编号": "%s" % i[0], "警告信息": "请确认%s%s%s到位情况!"%(a,b,c), "信息状态": "",
- "提示信息": "","产生时间": "%s" % now, "处理人": "", "处理时间": "", "变更字段": "到位警告","显示对象":"","提示内容":""}
- database.lazyInsertData('logs', newdic)
- if ATA_time_30 != "" and ATA_time_30 < now and TD_time_25 < now and "已放行" not in str(database.queryTabel('flightsts{}'.format(nowDayStr),"放行","航班编号='%s'"%i[0])) and \
- "放行警告" not in str(database.queryTabel('logs', "变更字段", "航班编号='%s' and 处理时间=''" % i[0])):
- newdic = {"航班编号": "%s" % i[0], "警告信息": "请确认%s%s%s放行情况!"%(a,b,c), "信息状态": "",
- "提示信息": "","产生时间": "%s" % now, "处理人": "", "处理时间": "", "变更字段": "放行警告","显示对象":"","提示内容":""}
- database.lazyInsertData('logs', newdic)
- if ATA_time_30 != "" and ATA_time_30 < now and TD_time_25 < now and "已到位" not in str(database.queryTabel('flightsts{}'.format(nowDayStr),"二送到位","航班编号='%s'"%i[0])) and \
- "二送警告" not in str(database.queryTabel('logs', "变更字段", "航班编号='%s' and 处理时间=''" % i[0])):
- newdic = {"航班编号": "%s" % i[0], "警告信息": "请确认%s%s%s二送到位情况!"%(a,b,c), "信息状态": "",
- "提示信息": "","产生时间": "%s" % now, "处理人": "", "处理时间": "", "变更字段": "二送警告","显示对象":"","提示内容":""}
- database.lazyInsertData('logs', newdic)
- if ATA_time_3H !="" and ATA_time_3H < TD_time and TD_time_120 < now and\
- "长短停到位提示" not in str(database.queryTabel('logs', "变更字段", "航班编号='%s'" % i[0])):
- newdic = {"航班编号": "%s" % i[0], "警告信息": "请确认安排%s%s%s长短停上电人员!" % (a, b, c), "信息状态": "",
- "提示信息": "", "产生时间": "%s" % now, "处理人": "", "处理时间": "", "变更字段": "长短停到位提示","显示对象":"","提示内容":""}
- database.lazyInsertData('logs', newdic)
- if ATA_time_3H !="" and ATA_time_3H < TD_time and\
- "长短停值守提示" not in str(database.queryTabel('logs', "变更字段", "航班编号='%s'" % i[0])):
- newdic = {"航班编号": "%s" % i[0], "警告信息": "请注意安排%s %s长短停值守,如无需则忽略!" % (a,c), "信息状态": "",
- "提示信息": "", "产生时间": "%s" % now, "处理人": "", "处理时间": "", "变更字段": "长短停值守提示","显示对象":"","提示内容":""}
- database.lazyInsertData('logs', newdic)
- elif "短停" not in str(database.queryTabel("flightinfo{}".format(nowDayStr),"航班类型","航班编号='%s'"%i[0])) and \
- "航后" not in str(database.queryTabel("flightinfo{}".format(nowDayStr), "航班类型", "航班编号='%s'" % i[0]))and \
- "航前" not in str(database.queryTabel("flightinfo{}".format(nowDayStr), "航班类型", "航班编号='%s'" % i[0])) and \
- "未显示" not in str(database.queryTabel("flightinfo{}".format(nowDayStr), "航班类型", "航班编号='%s'" % i[0])) and \
- database.queryTabel("flightinfo{}".format(nowDayStr),"非航前预计到达","航班编号='%s'"%i[0])[0][0]!= "":
- ETA_15_str = database.queryTabel("flightinfo{}".format(nowDayStr), "非航前预计到达", "航班编号='%s'" % i[0])[0][0]
- ETA_15 = datetime.datetime.strptime(ETA_15_str, "%Y-%m-%d %H:%M:%S") - datetime.timedelta(minutes=15)
- ATA = database.queryTabel("flightinfo{}".format(nowDayStr), "非航前实际到达", "航班编号='%s'" % i[0])
- if ATA[0][0] != "":
- #print(ATA[0][0])
- ATA_time_30 = datetime.datetime.strptime(ATA[0][0], "%Y-%m-%d %H:%M:%S") + datetime.timedelta(minutes=30)
- else:
- ATA_time_30 = ""
- FlightDate=database.queryTabel("flightinfo{}".format(nowDayStr), "航班日期", "航班编号='%s'" % i[0])[0][0]
- TD = database.queryTabel("flightinfo{}".format(nowDayStr), "非航前预计起飞", "航班编号='%s'" % i[0])[0][0]
- #print(TD)
- #print(FlightDate)
- TD_time_str = FlightDate.split("-")[0] + "/" + TD.split("]")[1]
- TD_time_25 = datetime.datetime.strptime(TD_time_str, "%Y/%m/%d %H:%M")- datetime.timedelta(minutes=25)
- if ETA_15 < now and "已到位" not in str(database.queryTabel('flightsts{}'.format(nowDayStr),"接机到位","航班编号='%s'"%i[0])) and \
- "到位警告" not in str(database.queryTabel('logs', "变更字段", "航班编号='%s' and 处理时间=''" % i[0])):
- newdic = {"航班编号": "%s" % i[0], "警告信息": "请确认%s%s%s到位情况!"%(a,b,c), "信息状态": "",
- "提示信息": "","产生时间": "%s" % now, "处理人": "", "处理时间": "", "变更字段": "到位警告","显示对象":"","提示内容":""}
- database.lazyInsertData('logs', newdic)
- if ATA_time_30 != "" and ATA_time_30 < now and TD_time_25 < now and "已放行" not in str(database.queryTabel('flightsts{}'.format(nowDayStr),"放行","航班编号='%s'"%i[0])) and \
- "放行警告" not in str(database.queryTabel('logs', "变更字段", "航班编号='%s' and 处理时间=''" % i[0])):
- newdic = {"航班编号": "%s" % i[0], "警告信息": "请确认%s%s%s放行情况!"%(a,b,c), "信息状态": "",
- "提示信息": "","产生时间": "%s" % now, "处理人": "", "处理时间": "", "变更字段": "放行警告","显示对象":"","提示内容":""}
- database.lazyInsertData('logs', newdic)
- if ATA_time_30 != "" and ATA_time_30 < now and TD_time_25 < now and "已到位" not in str(database.queryTabel('flightsts{}'.format(nowDayStr),"二送到位","航班编号='%s'"%i[0])) and \
- "二送警告" not in str(database.queryTabel('logs', "变更字段", "航班编号='%s' and 处理时间=''" % i[0])):
- newdic = {"航班编号": "%s" % i[0], "警告信息": "请确认%s%s%s二送到位情况!"%(a,b,c), "信息状态": "",
- "提示信息": "","产生时间": "%s" % now, "处理人": "", "处理时间": "", "变更字段": "二送警告","显示对象":"","提示内容":""}
- database.lazyInsertData('logs', newdic)
- for i in flightcheck2:
- a = database.queryTabel("flightinfo{}".format(nowDayStr), "机号", "航班编号='%s'" % i[0])[0][0]
- b = database.queryTabel("flightinfo{}".format(nowDayStr), "航班类型", "航班编号='%s'" % i[0])[0][0]
- dd = database.queryTabel("flightinfo{}".format(nowDayStr), "航班日期","航班编号='%s'" % i[0])[0][0]
- if b =="航前":
- c = database.queryTabel("flightinfo{}".format(nowDayStr), "航前离港机位", "航班编号='%s'" % i[0])[0][0]
- else:
- c = database.queryTabel("flightinfo{}".format(nowDayStr), "非航前进港机位", "航班编号='%s'" % i[0])[0][0]
- if "航前" in str(database.queryTabel("flightinfo{}".format(nowDayStr),"航班类型","航班编号='%s'"%i[0])) and database.queryTabel("flightinfo{}".format(nowDayStr),"航前预计起飞","航班编号='%s'"%i[0])[0][0] != "":
- STD=database.queryTabel("flightinfo{}".format(nowDayStr),"非航前预计起飞","航班编号='%s'"%i[0])[0][0]
- STD_str = dd.split("-")[0] + "/" + STD.split("]")[1]
- STD_120 = datetime.datetime.strptime(STD_str, "%Y/%m/%d %H:%M") - datetime.timedelta(minutes=120)
- STD_60 = datetime.datetime.strptime(STD_str, "%Y/%m/%d %H:%M") - datetime.timedelta(minutes=60)
- if "随机离港" in str(database.queryTabel("peopleSchedule{}".format(nowDayStr), "附加消息", "航班编号='%s'" % i[0])) and\
- "随机2H提醒" not in str(database.queryTabel("logs", "警告信息", "航班编号='%s'" % i[0])) and STD_120 < now:
- sjry=database.queryTabel('TaskFlightinfo{}'.format(nowDayStr),"随机", "航班编号='%s'" % i[0])[0][0].split(" ")[1]
- flightno = database.queryTabel("flightinfo{}".format(nowDayStr), "离港机场", "航班编号='%s'" % i[0])[0][0]
- newdic = {"航班编号": "%s" % i[0], "警告信息": "[随机2H提醒]%s%s%s%s"%(a,flightno,c,sjry), "信息状态": "",
- "提示信息": "","产生时间": "%s" % now, "处理人": "", "处理时间": "", "变更字段": "随机2H提醒","显示对象":"","提示内容":""}
- database.lazyInsertData('logs', newdic)
- if "随机离港" in str(database.queryTabel("peopleSchedule{}".format(nowDayStr), "附加消息", "航班编号='%s'" % i[0])) and\
- "随机到位确认" not in str(database.queryTabel("logs", "警告信息", "航班编号='%s' and 处理时间=''" % i[0])) and STD_60 < now and\
- "已到位" not in str(database.queryTabel('flightsts{}'.format(nowDayStr),"随机到位","航班编号='%s'"%i[0])):
- flightno = database.queryTabel("flightinfo{}".format(nowDayStr), "离港机场", "航班编号='%s'" % i[0])[0][0]
- sjry=database.queryTabel('TaskFlightinfo{}'.format(nowDayStr),"随机", "航班编号='%s'" % i[0])[0][0].split("随机离港 ")[1]
- newdic = {"航班编号": "%s" % i[0], "警告信息": "[随机到位确认]%s%s%s%s"%(a,flightno,c,sjry), "信息状态": "",
- "提示信息": "","产生时间": "%s" % now, "处理人": "", "处理时间": "", "变更字段": "随机到位警告","显示对象":"","提示内容":""}
- database.lazyInsertData('logs', newdic)
- elif "短停" in str(database.queryTabel("flightinfo{}".format(nowDayStr),"航班类型","航班编号='%s'"%i[0])):
- FlightDate=database.queryTabel("flightinfo{}".format(nowDayStr), "航班日期", "航班编号='%s'" % i[0])[0][0]
- TD = database.queryTabel("flightinfo{}".format(nowDayStr), "非航前预计起飞", "航班编号='%s'" % i[0])[0][0]
- TD_time_str = FlightDate.split("-")[0] + "/" + TD.split("]")[1]
- TD_time_120 = datetime.datetime.strptime(TD_time_str, "%Y/%m/%d %H:%M") - datetime.timedelta(minutes=120)
- TD_time_60 = datetime.datetime.strptime(TD_time_str, "%Y/%m/%d %H:%M") - datetime.timedelta(minutes=60)
- if "随机离港" in str(database.queryTabel("peopleSchedule{}".format(nowDayStr), "附加消息", "航班编号='%s'" % i[0])) and\
- "随机2H提醒" not in str(database.queryTabel("logs", "警告信息", "航班编号='%s'" % i[0])) and TD_time_120 < now:
- flightno = database.queryTabel("flightinfo{}".format(nowDayStr), "离港机场", "航班编号='%s'" % i[0])[0][0]
- sjry=database.queryTabel('TaskFlightinfo{}'.format(nowDayStr),"随机", "航班编号='%s'" % i[0])[0][0].split(" ")[1]
- newdic = {"航班编号": "%s" % i[0], "警告信息": "[随机2H提醒]%s%s%s%s"%(a,flightno,c,sjry), "信息状态": "",
- "提示信息": "","产生时间": "%s" % now, "处理人": "", "处理时间": "", "变更字段": "随机2H提醒","显示对象":"","提示内容":""}
- database.lazyInsertData('logs', newdic)
- if "随机离港" in str(database.queryTabel("peopleSchedule{}".format(nowDayStr), "附加消息", "航班编号='%s'" % i[0])) and\
- "随机到位确认" not in str(database.queryTabel("logs", "警告信息", "航班编号='%s' and 处理时间=''" % i[0])) and TD_time_60 < now and\
- "已到位" not in str(database.queryTabel('flightsts{}'.format(nowDayStr),"随机到位","航班编号='%s'"%i[0])):
- flightno = database.queryTabel("flightinfo{}".format(nowDayStr), "离港机场", "航班编号='%s'" % i[0])[0][0]
- sjry = database.queryTabel('TaskFlightinfo{}'.format(nowDayStr), "随机", "航班编号='%s'" % i[0])[0][0].split("随机离港 ")[1]
- newdic = {"航班编号": "%s" % i[0], "警告信息": "[随机到位确认]%s%s%s%s"%(a,flightno,c,sjry), "信息状态": "",
- "提示信息": "","产生时间": "%s" % now, "处理人": "", "处理时间": "", "变更字段": "随机到位警告","显示对象":"","提示内容":""}
- database.lazyInsertData('logs', newdic)
- elif "短停" not in str(database.queryTabel("flightinfo{}".format(nowDayStr),"航班类型","航班编号='%s'"%i[0])) and \
- "航后" not in str(database.queryTabel("flightinfo{}".format(nowDayStr), "航班类型", "航班编号='%s'" % i[0]))and \
- "航前" not in str(database.queryTabel("flightinfo{}".format(nowDayStr), "航班类型", "航班编号='%s'" % i[0])) and \
- "未显示" not in str(database.queryTabel("flightinfo{}".format(nowDayStr), "航班类型", "航班编号='%s'" % i[0])) and\
- "停场" not in str(database.queryTabel("flightinfo{}".format(nowDayStr), "航班类型", "航班编号='%s'" % i[0])):
- FlightDate=database.queryTabel("flightinfo{}".format(nowDayStr), "航班日期", "航班编号='%s'" % i[0])[0][0]
- TD = database.queryTabel("flightinfo{}".format(nowDayStr), "非航前预计起飞", "航班编号='%s'" % i[0])[0][0]
- TD_time_str = FlightDate.split("-")[0] + "/" + TD.split("]")[1]
- TD_time_120= datetime.datetime.strptime(TD_time_str, "%Y/%m/%d %H:%M") - datetime.timedelta(minutes=120)
- TD_time_60 = datetime.datetime.strptime(TD_time_str, "%Y/%m/%d %H:%M") - datetime.timedelta(minutes=60)
- if "随机离港" in str(database.queryTabel("peopleSchedule{}".format(nowDayStr), "附加消息", "航班编号='%s'" % i[0])) and\
- "随机2H提醒" not in str(database.queryTabel("logs", "警告信息", "航班编号='%s'" % i[0])) and TD_time_120 < now:
- flightno = database.queryTabel("flightinfo{}".format(nowDayStr), "离港机场", "航班编号='%s'" % i[0])[0][0]
- sjry=database.queryTabel('TaskFlightinfo{}'.format(nowDayStr),"随机", "航班编号='%s'" % i[0])[0][0].split(" ")[1]
- newdic = {"航班编号": "%s" % i[0], "警告信息": "[随机2H提醒]%s%s%s%s"%(a,flightno,c,sjry), "信息状态": "",
- "提示信息": "","产生时间": "%s" % now, "处理人": "", "处理时间": "", "变更字段": "随机2H提醒","显示对象":"","提示内容":""}
- database.lazyInsertData('logs', newdic)
- if "随机离港" in str(database.queryTabel("peopleSchedule{}".format(nowDayStr), "附加消息", "航班编号='%s'" % i[0])) and\
- "随机到位确认" not in str(database.queryTabel("logs", "警告信息", "航班编号='%s' and 处理时间=''" % i[0])) and TD_time_60 < now and\
- "已到位" not in str(database.queryTabel('flightsts{}'.format(nowDayStr),"随机到位","航班编号='%s'"%i[0])):
- flightno = database.queryTabel("flightinfo{}".format(nowDayStr), "离港机场", "航班编号='%s'" % i[0])[0][0]
- sjry=database.queryTabel('TaskFlightinfo{}'.format(nowDayStr),"随机", "航班编号='%s'" % i[0])[0][0].split("随机离港 ")[1]
- newdic = {"航班编号": "%s" % i[0], "警告信息": "[随机到位确认]%s%s%s%s"%(a,flightno,c,sjry), "信息状态": "",
- "提示信息": "","产生时间": "%s" % now, "处理人": "", "处理时间": "", "变更字段": "随机到位警告","显示对象":"","提示内容":""}
- database.lazyInsertData('logs', newdic)
- 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:
- database.FunctionCommit()
- print(traceback.format_exc())
- dingding_alert(traceback.format_exc())
- 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(workloadLabel)[1:]:
- workloadDic[workloadkey] = 'text not null'
- for row in pglist:
- workLoad.initTable('workload%s'%str(row[1]),"编号", primaryKey2, workloadDic)
- except Exception:
- dingding_alert(traceback.format_exc())
- 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(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:
- dingding_alert(traceback.format_exc())
- def get_full_pinyin1(word, style=Style.NORMAL, separator=''):
- pinyin_list = pinyin(word, style=style)
- #使用列表推导式获取每个汉字的第一个拼音(不带声调),并使用 separator 连接
- full_pinyin = separator.join([''.join(syllable[0]) for syllable in pinyin_list])
- return full_pinyin
- def get_full_pinyin2(word, style=Style.NORMAL, separator=''):
- return ''.join([word[0][0] for word in pinyin(word, style=Style.NORMAL)])
- def get_dic(database:flightDB, fileName):
- try:
- fdb = database
- decrypted_workbook = io.BytesIO()
- try:
- with open(fileName, 'rb') as file:
- office_file = msoffcrypto.OfficeFile(file)
- office_file.load_key(password='Scal_0177')
- office_file.decrypt(decrypted_workbook)
- workbook = openpyxl.load_workbook(filename=decrypted_workbook)
- mysheet = workbook.active
- myrows = list(mysheet.values)[1:]
- mytitle = list(mysheet.values)[0]
- for myrow in myrows:
- mydics0 = {}
- mydics1 = {}
- for i in range(0, (len(mytitle))):
- a = get_full_pinyin1(str(myrow[0])) + ":" + get_full_pinyin2(str(myrow[0]))
- mydics0[mytitle[i]] = "%s"%myrow[i]
- mydics0[mytitle[11]] = "%s" % a
- if i != 3 and i != 11:
- mydics1[mytitle[i]] = "'%s'" % myrow[i]
- elif i == 11:
- mydics1[mytitle[11]] = "'%s'" % a
- #a= fdb.getSingledata("工号",'workerinfo')
- if str(mydics0["工号"]) in str(fdb.getSingledata("工号",'workerinfo')):
- fdb.lazyUpdateItem('workerinfo',mydics1,"工号='%s'"%mydics0["工号"])
- else:
- fdb.lazyInsertData('workerinfo',mydics0)
- #print(1)
- fdb.FunctionCommit()
- return 1
- except Exception:
- print(datetime.datetime.now(),'[数据库操作]数据库获取错误!!检查通讯录文件!人员显示功能失效!!')
- print(traceback.format_exc())
- dingding_alert(traceback.format_exc())
- # 需要QT输出警告弹框信息
- fdb.FunctionCommit()
- return 0
- except Exception:
- dingding_alert(traceback.format_exc())
- def manAddFlight(fdb:flightDB,flighttype,acno,eng,actype,flightno,flightdate,bay,eta,etd,user):
- starttime = flightdate + " 00:00:00"
- flightdate1 = datetime.datetime.strptime(starttime, "%Y-%m-%d %H:%M:%S")
- flightdate2 =flightdate.replace("-", "")
- flightids=fdb.getSingledata("航班编号","flightinfo%s"%flightdate2)
- ETD2=str("[计]"+etd[6:16]).replace("-", "/")
- flightid = "MAN" + str(acno) + str(flightno)+str(flightdate2)
- if flightid not in str(flightids):
- if flighttype =="航前":
- newdic={"航班编号":"%s"%flightid, "航班编号对":"", "机号":acno, "发动机":eng, "机型":actype, "保障航班号":flightno, "进港机场":"", "离港机场":"", "进出港航班号":flightno, "航班日期":flightdate1, "航班状态":"",
- "航班类型":flighttype, "非航前计划到达":"", "航前预计起飞":etd, "非航前实际到达":"", "非航前预计到达":"", "航前实际起飞":"", "非航前预计起飞":ETD2, "非航前预计进港机位":"",
- "非航前进港机位":"", "航前预计离港机位":"", "航前离港机位":bay, "维修人员":"", "放行人员":"", "维修状态":"", "重要航班":"", "随机":"", "保留":"", "备降返航":"", "维修状态时间":"", "二送人员":"", "二送状态":"",
- "附加消息":"人工添加", "取消标志":""}
- elif flighttype =="短停" or flighttype =="特后前":
- newdic = {"航班编号": "%s" % flightid, "航班编号对": "", "机号": acno, "发动机": eng, "机型": actype, "保障航班号": flightno,
- "进港机场": "", "离港机场": "", "进出港航班号": flightno, "航班日期": flightdate1, "航班状态": "","航班类型": flighttype, "非航前计划到达": "", "航前预计起飞": "", "非航前实际到达": eta, "非航前预计到达": eta, "航前实际起飞": eta,
- "非航前预计起飞": ETD2, "非航前预计进港机位": "","非航前进港机位": bay, "航前预计离港机位": "", "航前离港机位": "", "维修人员": "", "放行人员": "", "维修状态": "", "重要航班": "",
- "随机": "", "保留": "", "备降返航": "", "维修状态时间": "", "二送人员": "", "二送状态": "","附加消息": "人工添加", "取消标志": ""}
- else:
- newdic = {"航班编号": "%s" % flightid, "航班编号对": "", "机号": acno, "发动机": eng, "机型": actype, "保障航班号": flightno,
- "进港机场": "", "离港机场": "", "进出港航班号": flightno, "航班日期": flightdate1, "航班状态": "", "航班类型": flighttype,
- "非航前计划到达": "", "航前预计起飞": "", "非航前实际到达": "", "非航前预计到达": eta, "航前实际起飞": eta,
- "非航前预计起飞": "", "非航前预计进港机位": "", "非航前进港机位": bay, "航前预计离港机位": "", "航前离港机位": "", "维修人员": "", "放行人员": "",
- "维修状态": "", "重要航班": "",
- "随机": "", "保留": "", "备降返航": "", "维修状态时间": "", "二送人员": "", "二送状态": "", "附加消息": "人工添加", "取消标志": ""}
- fdb.insertData("flightinfo%s"%flightdate2,newdic)
- else:
- if flighttype =="航前":
- newdic={"航班编号":"'%s'"%flightid,"机号":"'%s'"%acno, "非航前预计起飞":"'%s'"%ETD2,"发动机":"'%s'"%eng, "机型":"'%s'"%actype, "保障航班号":"'%s'"%flightno,"进出港航班号":"'%s'"%flightno, "航班日期":"'%s'"%flightdate1,"航班类型":"'%s'"%flighttype, "航前预计起飞":"'%s'"%etd, "航前离港机位":"'%s'"%bay}
- elif flighttype =="短停" or flighttype =="特后前":
- newdic = {"航班编号": "'%s'" % flightid, "机号":"'%s'"% acno, "发动机":"'%s'"% eng, "机型":"'%s'"% actype, "保障航班号":"'%s'"% flightno, "进出港航班号":"'%s'"% flightno, "航班日期":"'%s'"% flightdate1, "航班类型":"'%s'"% flighttype,"非航前预计到达":"'%s'"% eta,"非航前实际到达": "'%s'"% eta, "航前实际起飞": "'%s'"% eta, "非航前预计起飞":"'%s'"% ETD2, "非航前进港机位":"'%s'"% bay}
- else:
- newdic = {"航班编号": "'%s'" % flightid,"机号":"'%s'"% acno, "发动机":"'%s'"% eng, "机型":"'%s'"% actype, "保障航班号":"'%s'"% flightno,"进出港航班号":"'%s'"% flightno, "航班日期":"'%s'"% flightdate1, "航班类型":"'%s'"% flighttype, "非航前预计到达":"'%s'"% eta,"航前实际起飞": "'%s'"% eta, "非航前进港机位":"'%s'"% bay}
- fdb.upDateItem("flightinfo%s"%flightdate2,newdic,"航班编号='%s'"%flightid)
- sortFlighttime(flightDB(host=host,
- port=port,
- user=user,
- password=password,
- database=databaseflightDB4
- ))
- sortFlighttime2(flightDB(host=host,
- port=port,
- user=user,
- password=password,
- database=databaseflightDB4
- ))
- res={"返回值":"ok"}
- return res
- def deleteFlight(fdb:flightDB,flightid,time):
- fdb.deleteTable("flightinfo%s"%time,"航班编号='%s'"%flightid)
- res={"返回值":"ok"}
- sortFlighttime(flightDB(host=host,
- port=port,
- user=user,
- password=password,
- database=databaseflightDB4
- ))
- sortFlighttime2(flightDB(host=host,
- port=port,
- user=user,
- password=password,
- database=databaseflightDB4
- ))
- return res
- def updateStopFlight(database:flightDB, fileName):
- fdb = database
- textInfo={"机号":2,"非航前进港机位":3,"机型":4,"发动机":5}
- try:
- workbook = openpyxl.load_workbook(filename=fileName)
- mysheet = workbook.active
- myrows = list(mysheet.values)[2:]
- #print(myrows)
- #print(myrows[1])
- if myrows[0][1] != "" and myrows[0][2] != "" and myrows[0][1] != None and myrows[0][2] != None:
- #print(myrows[0])
- day=str(myrows[0][1]).split("/")[0]+str(myrows[0][1]).split("/")[1]+str(myrows[0][1]).split("/")[2]
- day1 = str(myrows[0][1]).split("/")[0] +"-"+ str(myrows[0][1]).split("/")[1] +"-"+ str(myrows[0][1]).split("/")[2]
- daytime = day1 + " 00:00:00"
- starttime = day1 + " 09:00:00"
- a = datetime.datetime.strptime(daytime, "%Y-%m-%d %H:%M:%S")
- b = datetime.datetime.strptime(starttime, "%Y-%m-%d %H:%M:%S")
- flightids=fdb.queryTabel("flightinfo%s"%day,"航班编号","航班类型 ='停场'")
- if len(flightids) != 0:
- for i in flightids:
- fdb.deleteSingledata("flightinfo%s"%day,"航班编号='%s'"%i[0])
- for myrow in myrows:
- mydics0 = {}
- if myrow[2] != None and myrow[1] != None and myrow[2] != "" and myrow[1] != "":
- now = str(time.time() * 1000000).split(".")[0]
- #print(now)
- flightid = "MAN" + str(now)+str(myrow[2])
- #print(flightid)
- for i in flightinfoLabel:
- if i in textInfo.keys():
- text=myrow[textInfo[i]] if myrow[textInfo[i]] !=None else ""
- mydics0[i] = "%s"%text
- elif i =="航班编号":
- mydics0[i]="%s"%flightid
- elif i =="航班日期":
- mydics0[i]="%s"%a
- elif i =="非航前实际到达":
- mydics0[i]="%s"%b
- elif i =="附加消息":
- mydics0[i]="人工添加"
- elif i =="航班类型":
- mydics0[i]="停场"
- else:
- mydics0[i]=''
- #print(mydics0)
- fdb.lazyInsertData("flightinfo%s"%day,mydics0)
- fdb.FunctionCommit()
- sortFlighttime(flightDB(host=host,
- port=port,
- user=user,
- password=password,
- database=databaseflightDB4
- ))
- sortFlighttime2(flightDB(host=host,
- port=port,
- user=user,
- password=password,
- database=databaseflightDB4
- ))
- print(datetime.datetime.now(), '[数据库操作]停场航班导入成功!')
- res = {"返回值": "ok"}
- return res
- except Exception:
- print(datetime.datetime.now(),'[数据库操作]停场航班导入失败!!检查模板文件!')
- print(traceback.format_exc())
- # 需要QT输出警告弹框信息
- res = {"返回值": "fail"}
- fdb.FunctionCommit()
- return res
- #新增内容
- def updateRiskdb(database:flightDB, fileName): #创建准备组提示数据库
- fdb = database
- fdb.deleteTable("RiskTable")
- try:
- workbook = openpyxl.load_workbook(filename=fileName)
- mysheet = workbook.active
- myrows = list(mysheet.values)[1:]
- mytitle = list(mysheet.values)[0]
- for myrow in myrows:
- mydics0 = {}
- for i in range(0, (len(mytitle))):
- mydics0[mytitle[i]] = "%s"%myrow[i]
- #print(mydics0)
- fdb.lazyInsertData('RiskTable',mydics0)
- fdb.FunctionCommit()
- return 1
- except Exception:
- dingding_alert(traceback.format_exc())
- print(datetime.datetime.now(),'[数据库操作]数据库获取错误!!检查模板文件!风险提示功能失效!!')
- fdb.FunctionCommit()
- return 0
- def saveRisktable(database:flightDB):
- fdb = database
- res=fdb.getAlldata("RiskTable")
- if res == None:
- res =[]
- return res
- def getRiskData(fdb:flightDB,bay,time):
- res = fdb.queryTabel("RiskTable","提示内容","状态='生效' and 触发条件1 ='%s' and 触发条件2 ='%s' "%(bay,time))
- tips= res[0][0] if res !=None and res !=[] and len(res) !=0 else ""
- return tips
- def updateTaskAuto(database:flightDB, fileName): #创建准备组提示数据库
- fdb = database
- fdb.deleteTable("taskAuto")
- try:
- workbook = openpyxl.load_workbook(filename=fileName)
- mysheet = workbook.active
- myrows = list(mysheet.values)[1:]
- mytitle = list(mysheet.values)[0]
- for myrow in myrows:
- mydics0 = {}
- for i in range(0, (len(mytitle))):
- mydics0[mytitle[i]] = "%s"%myrow[i]
- #print(mydics0)
- fdb.lazyInsertData('taskAuto',mydics0)
- fdb.FunctionCommit()
- return 1
- except Exception:
- dingding_alert(traceback.format_exc())
- print(datetime.datetime.now(),'[数据库操作]数据库获取错误!!检查模板文件!准备组任务提示功能失效!!')
- fdb.FunctionCommit()
- return 0
- def insertCalllist(fdb,data):
- try:
- #CalllistLabel1 = ["航班编号", "电话", "工号", "姓名", "航班号", "附加消息", "拨号次数", "创建时间", "接通时间"]
- now = datetime.datetime.now()
- data["创建时间"]=now
- data["接通时间"] = ''
- fdb.insertData('Calllist',data)
- #print("test")
- res={"返回值":"ok"}
- return res
- except Exception:
- print(traceback.format_exc())
- dingding_alert(traceback.format_exc())
- def checkTFUairplane(database:flightDB):
- try:
- code = {"接机已到位提示","已放行提示","二送已到位提示"}
- code2 = {"接机已到位提示", "已放行提示"}
- #需要建立昨日初始化
- 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('flightinfo{}'.format(nowDayStr),'航班编号',"航班类型='航后' and 非航前预计到达!='' and 非航前实际到达=''and 航前实际起飞!=''")
- AFongroud=database.queryTabel('flightinfo{}'.format(nowDayStr),'航班编号',"航班类型='航后' and 非航前实际到达!=''")
- TRinsky=database.queryTabel('flightinfo{}'.format(nowDayStr),'航班编号',"航班类型='短停' and 非航前预计到达!='' and 非航前实际到达='' and 航前实际起飞!=''")
- TRongroud = database.queryTabel('flightinfo{}'.format(nowDayStr), '航班编号', "航班类型='短停' and 非航前实际到达!='' and (非航前预计起飞 like '%预%' or 非航前预计起飞 like '%计%')")
- THQinsky = database.queryTabel('flightinfo{}'.format(nowDayStr), '航班编号',"航班类型='特后前' and 非航前预计到达!='' and 非航前实际到达=''and 航前实际起飞!=''")
- THQongroud=database.queryTabel('flightinfo{}'.format(nowDayStr), '航班编号', "航班类型='特后前' and 非航前实际到达!='' and (非航前预计起飞 like '%预%' or 非航前预计起飞 like '%计%')")
- APongroud=database.queryTabel('flightinfo{}'.format(nowDayStr), '航班编号', "航班类型='航前' 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.getSingledata('航班编号','flightsts{}'.format(nowDayStr))
- flightinfo_flight_ids=database.getSingledata('航班编号','flightinfo{}'.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 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 = database.queryTabel('flightinfo{}'.format(nowDayStr), "机号", "航班编号='{}'".format(flightstskey[0]))
- if "航前" not in database.queryTabel('flightinfo{}'.format(nowDayStr), "航班类型", "航班编号='{}'".format(flightstskey[0])):
- bay_str = database.queryTabel('flightinfo{}'.format(nowDayStr), "航前离港机位", "航班编号='{}'".format(flightstskey[0]))
- else:
- bay_str = database.queryTabel('flightinfo{}'.format(nowDayStr), "非航前进港机位", "航班编号='{}'".format(flightstskey[0]))
- newdic = {"机位":"'%s'"%bay_str[0], "机号":"'%s'"%acno_str[0]}
- database.lazyUpdateItem('flightsts{}'.format(nowDayStr), newdic, "航班编号='%s'" % flightstskey[0])
- worksts_str=database.queryTabel('flightinfo{}'.format(nowDayStr), "维修状态", "航班编号='{}'".format(flightstskey[0]))
- worksts_STR = worksts_str[0][0] if len(worksts_str) != 0 else 0
- worksts = int(worksts_STR) if worksts_STR != "" else 0
- a=database.queryTabel('flightsts{}'.format(nowDayStr),"机号","航班编号='%s'" % flightstskey[0])[0][0] if len(database.queryTabel('flightsts{}'.format(nowDayStr),"机号","航班编号='%s'" % flightstskey[0])) != 0 else "未显示机号"
- if worksts >= 7 and str(flightstskey[0]) in str(flightsts_flight_ids_arr):
- newdic={"接机到位":"'已到位'", "放行": "'已放行'"}
- database.lazyUpdateItem('flightsts{}'.format(nowDayStr), newdic, "航班编号='%s'" % flightstskey[0])
- for i in code2:
- if "0" in database.queryTabel('flightsts{}'.format(nowDayStr),"%s"%i,"航班编号='%s'" % flightstskey[0]):
- 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):
- newdic = {"接机到位": "'已到位'"}
- database.lazyUpdateItem('flightsts{}'.format(nowDayStr), newdic, "航班编号='%s'" % flightstskey[0])
- if "0" in database.queryTabel('flightsts{}'.format(nowDayStr),"接机已到位提示","航班编号='%s'" % flightstskey[0]):
- 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])
- ECSJ_worksts_str = database.queryTabel('flightinfo{}'.format(nowDayStr), "二送状态", "航班编号='{}'".format(flightstskey[0]))
- ECSJ_worksts_STR = ECSJ_worksts_str[0][0] if len(ECSJ_worksts_str) != 0 else 0
- ECSJ_worksts = int(ECSJ_worksts_STR) if ECSJ_worksts_STR != "" else 0
- a = database.queryTabel('flightsts{}'.format(nowDayStr), "机号", "航班编号='%s'" % flightstskey[0])[0][0] if len(database.queryTabel('flightsts{}'.format(nowDayStr), "机号", "航班编号='%s'" % flightstskey[0])) != 0 else "未显示机号"
- if ECSJ_worksts >= 15 and str(flightstskey[0]) in str(flightsts_flight_ids_arr):
- newdic = {"接机到位": "'已到位'", "放行": "'已放行'", "二送到位": "'已到位'"}
- database.lazyUpdateItem('flightsts{}'.format(nowDayStr), newdic, "航班编号='%s'" % flightstskey[0])
- for i in code:
- if "0" in database.queryTabel('flightsts{}'.format(nowDayStr),"%s"%i,"航班编号='%s'" % flightstskey[0]):
- 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])
- database.FunctionCommit()
- except Exception:
- dingding_alert(traceback.format_exc())
- database.FunctionCommit()
- 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")
- if len(tfac_ids) != 0:
- for i in tfac_ids:
- acno=database.queryTabel('flightinfo{}'.format(nowDayStr), "机号", "航班编号='%s'" % i[0])[0][0]
- type=database.queryTabel('flightinfo{}'.format(nowDayStr), "航班类型", "航班编号='%s'" % i[0])[0][0]
- 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:
- dingding_alert(traceback.format_exc())
- pass
- #QT输出弹窗警告,服务器链接失效
- except Exception:
- dingding_alert(traceback.format_exc())
- 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:
- dingding_alert(traceback.format_exc())
- 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:
- dingding_alert(traceback.format_exc())
- database.FunctionCommit()
- 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": "二送已到位提示"}
- try:
- resfwq = requests.get(url="http://124.223.185.200:888/search_status/", timeout=10) # 自己服务器
- if resfwq.json() != "":
- flightsts = resfwq.json()
- #print(flightsts)
- #测试数据
- #flightsts={'30CA':{"JJDW": 1, "FX": 1, "SJDW": 1, "XJ": 1, "ESDW": 1},'300D':{"JJDW": 1, "FX": 1, "SJDW": 1, "XJ": 1, "ESDW": 0}}
- except Exception:
- dingding_alert(traceback.format_exc())
- 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")
- for i in dmacs:
- dmac=database.queryTabel('flightsts{}'.format(nowDayStr), "机号", "航班编号='%s'"%i[0])
- if str(dmac[0]) not in str(tfac_acs):
- tfac_acs.append(dmac[0])
- if len(tfac_acs) != 0:
- for i in tfac_acs:
- #print(i[0])
- if i[0] in flightsts.keys():
- for j,k in sever_code.items():
- if flightsts[i[0]][j] == 1:
- newdic={"%s"%k:"'%s'"%sever_code1[j]}
- #print(newdic)
- database.lazyUpdateItem('flightsts{}'.format(nowDayStr),newdic,"机号='%s' and 天府飞机!=''"%i[0])
- newdic={}
- a=database.queryTabel('flightsts{}'.format(nowDayStr), '%s' % code3[j], "机号='%s' and 天府飞机!=''" % i[0])[0][0] if len(database.queryTabel('flightsts{}'.format(nowDayStr),'%s'%code3[j],"机号='%s' and 天府飞机!=''"%i[0])) != 0 else "0"
- b=database.queryTabel('flightsts{}'.format(nowDayStr), '航班编号', "机号='%s' and 天府飞机!=''" % i[0])[0][0] if len(database.queryTabel('flightsts{}'.format(nowDayStr), '航班编号', "机号='%s' and 天府飞机!=''" % i[0])) != 0 else "未显示机号"
- if a !="1":
- newdic={"%s"%code3[j]:1}
- database.lazyUpdateItem('flightsts{}'.format(nowDayStr), newdic, "机号='%s' and 天府飞机!=''" % i[0])
- newdic={"航班编号":"%s"%b,"警告信息":"","信息状态":"","提示信息":"钉钉:%s%s!%s"%(i[0],code2[j],now11),"产生时间":"%s"%now,"处理人":"","处理时间":"","变更字段":"","显示对象":"","提示内容":""}
- database.lazyInsertData('logs',newdic)
- database.FunctionCommit()
- #########################################
- #引入钉钉显示
- ########################################
- except Exception:
- dingding_alert(traceback.format_exc())
- database.FunctionCommit()
- 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:
- dingding_alert(traceback.format_exc())
- def sortFlighttime2(database: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")
- initFlightDatabase(database, now_20)
- initFlightDatabase(database, nowDay_1)
- initFlightDatabase(database, nowDay_2)
- initFlightDatabase(database, 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:
- dingding_alert(traceback.format_exc())
- def sortFlighttime(database:flightDB):
- try:
- print(datetime.datetime.now(),'[数据库操作]开始排序')
- #yesterday_search = (datetime.date.today() - datetime.timedelta(days=1)).strftime("%Y-%m-%d %H:%M:%S")
- #today_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")
- 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")
- initFlightDatabase(database, now_20)
- initFlightDatabase(database, nowDay_1)
- initFlightDatabase(database, nowDay_2)
- initFlightDatabase(database, nowDay)
- if now_20 == nowDay:
- day = [nowDay, nowDay_1]
- else:
- day = [nowDay, nowDay_1, nowDay_2]
- for nowDayStr in day:
- #nowDayStr = datatime
- sort_flight_ids_arr=[]
- sort_flight_ids = database.getSingledata('编号','sortFlight{}'.format(nowDayStr))
- flightinfo_flight_ids = database.getSingledata('航班编号', 'flightinfo{}'.format(nowDayStr))
- if len(sort_flight_ids) != 0:
- for sortkey in sort_flight_ids:
- sort_flight_id=database.queryTabel('sortFlight{}'.format(nowDayStr),"航班编号","编号='%s'"%sortkey[0])[0]
- 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:
- #print(database.queryTabel("flightinfo{}".format(nowDayStr),"航班类型","航班编号='%s'"%i[0]))
- flight_date_str=database.queryTabel("flightinfo{}".format(nowDayStr),"航班日期","航班编号='%s'"%i[0])[0][0]
- if database.queryTabel("flightinfo{}".format(nowDayStr),"航班类型","航班编号='%s'"%i[0])[0][0] == "航前" and "MAN" not in str(i[0]):
- if database.queryTabel("flightinfo{}".format(nowDayStr),"航前实际起飞","航班编号='%s'"%i[0])[0][0] == "" and database.queryTabel("flightinfo{}".format(nowDayStr),"非航前预计起飞","航班编号='%s'"%i[0])[0][0]!= "":
- time=database.queryTabel("flightinfo{}".format(nowDayStr),"非航前预计起飞","航班编号='%s'"%i[0])[0][0]
- time_str = flight_date_str.split("-")[0] + "/" + time.split("]")[1]
- sendtime = datetime.datetime.strptime(time_str, "%Y/%m/%d %H:%M") - datetime.timedelta(minutes=90)
- ii=str(i[0])+str(-2)
- iii = str(i[0]) + str(-1)
- if ii in str(sort_flight_ids_arr):
- newdic={"编号":"'%s'"%ii,"航班编号":"'%s'"%i[0],"保障时间":"'%s'"%sendtime,"航班类型":"'航前'","航班日期":"'%s'"%flight_date_str,"级别":"1"}
- database.lazyUpdateItem("sortFlight{}".format(nowDayStr),newdic,"编号='%s'"%ii)
- else:
- newdic = {"编号": "%s" % ii, "航班编号": "%s" % i[0],"保障时间": "%s" % sendtime, "航班类型": "航前",
- "航班日期": "%s" % flight_date_str, "级别": 1}
- database.lazyInsertData("sortFlight{}".format(nowDayStr),newdic)
- #print('插入{}'.format(newdic))
- if iii in str(sort_flight_ids_arr):
- database.deleteSingledata('sortFlight{}'.format(nowDayStr), "编号='%s'" % iii)
- elif database.queryTabel("flightinfo{}".format(nowDayStr),"航前实际起飞","航班编号='%s'"%i[0])[0][0] !="":
- time=database.queryTabel("flightinfo{}".format(nowDayStr),"航前实际起飞","航班编号='%s'"%i[0])[0][0]
- sendtime = datetime.datetime.strptime(time, "%Y-%m-%d %H:%M:%S")
- ii=str(i[0])+str(-2)
- iii = str(i[0]) + str(-1)
- if ii in str(sort_flight_ids_arr):
- newdic={"编号":"'%s'"%ii,"航班编号":"'%s'"%i[0],"保障时间":"'%s'"%sendtime,"航班类型":"'航前'","航班日期":"'%s'"%flight_date_str,"级别":"4"}
- database.lazyUpdateItem("sortFlight{}".format(nowDayStr),newdic,"编号='%s'"%ii)
- else:
- newdic = {"编号": "%s" % ii, "航班编号": "%s" % i[0], "保障时间": "%s" % sendtime, "航班类型": "航前",
- "航班日期": "%s" % flight_date_str, "级别": 4}
- database.lazyInsertData("sortFlight{}".format(nowDayStr),newdic)
- if iii in str(sort_flight_ids_arr):
- database.deleteSingledata('sortFlight{}'.format(nowDayStr), "编号='%s'" % iii)
- elif database.queryTabel("flightinfo{}".format(nowDayStr),"航班类型","航班编号='%s'"%i[0])[0][0] == "航前" and "MAN" in str(i[0]):
- time=database.queryTabel("flightinfo{}".format(nowDayStr),"非航前预计起飞","航班编号='%s'"%i[0])[0][0]
- time_str = flight_date_str.split("-")[0] + "/" + time.split("]")[1]
- sendtime = datetime.datetime.strptime(time_str, "%Y/%m/%d %H:%M") - datetime.timedelta(minutes=90)
- sendtime2 = datetime.datetime.strptime(time_str, "%Y/%m/%d %H:%M")
- if now < sendtime2:
- ii=str(i[0])+str(-2)
- iii = str(i[0]) + str(-1)
- if ii in str(sort_flight_ids_arr):
- newdic={"编号":"'%s'"%ii,"航班编号":"'%s'"%i[0],"保障时间":"'%s'"%sendtime,"航班类型":"'航前'","航班日期":"'%s'"%flight_date_str,"级别":"1"}
- database.lazyUpdateItem("sortFlight{}".format(nowDayStr),newdic,"编号='%s'"%ii)
- else:
- newdic = {"编号": "%s" % ii, "航班编号": "%s" % i[0],"保障时间": "%s" % sendtime, "航班类型": "航前",
- "航班日期": "%s" % flight_date_str, "级别": 1}
- database.lazyInsertData("sortFlight{}".format(nowDayStr),newdic)
- #print('插入{}'.format(newdic))
- if iii in str(sort_flight_ids_arr):
- database.deleteSingledata('sortFlight{}'.format(nowDayStr), "编号='%s'" % iii)
- else:
- ii=str(i[0])+str(-2)
- iii = str(i[0]) + str(-1)
- if ii in str(sort_flight_ids_arr):
- newdic={"编号":"'%s'"%ii,"航班编号":"'%s'"%i[0],"保障时间":"'%s'"%sendtime2,"航班类型":"'航前'","航班日期":"'%s'"%flight_date_str,"级别":"4"}
- database.lazyUpdateItem("sortFlight{}".format(nowDayStr),newdic,"编号='%s'"%ii)
- else:
- newdic = {"编号": "%s" % ii, "航班编号": "%s" % i[0], "保障时间": "%s" % sendtime2, "航班类型": "航前",
- "航班日期": "%s" % flight_date_str, "级别": 4}
- database.lazyInsertData("sortFlight{}".format(nowDayStr),newdic)
- if iii in str(sort_flight_ids_arr):
- database.deleteSingledata('sortFlight{}'.format(nowDayStr), "编号='%s'" % iii)
- elif database.queryTabel("flightinfo{}".format(nowDayStr), "航班类型", "航班编号='%s'" % i[0])[0][0] == "停场":
- time = database.queryTabel("flightinfo{}".format(nowDayStr), "非航前实际到达", "航班编号='%s'" % i[0])[0][0]
- receivetime = datetime.datetime.strptime(time, "%Y-%m-%d %H:%M:%S")
- ii = str(i[0]) + str(-1)
- iii = str(i[0]) + str(-2)
- if ii in str(sort_flight_ids_arr):
- newdic = {"编号": "'%s'" % ii, "航班编号": "'%s'" % i[0], "保障时间": "'%s'" % receivetime, "航班类型": "'停场'",
- "航班日期": "'%s'" % flight_date_str, "级别": "3"}
- database.lazyUpdateItem("sortFlight{}".format(nowDayStr), newdic, "编号='%s'" % ii)
- else:
- newdic = {"编号": "%s" % ii, "航班编号": "%s" % i[0], "保障时间": "%s" % receivetime, "航班类型": "停场",
- "航班日期": "%s" % flight_date_str, "级别": 3}
- database.lazyInsertData("sortFlight{}".format(nowDayStr), newdic)
- if iii in str(sort_flight_ids_arr):
- database.deleteSingledata('sortFlight{}'.format(nowDayStr), "编号='%s'" % iii)
- elif database.queryTabel("flightinfo{}".format(nowDayStr),"航班类型","航班编号='%s'"%i[0])[0][0] =="航后" and "MAN" not in str(i[0]):
- if database.queryTabel("flightinfo{}".format(nowDayStr),"非航前实际到达","航班编号='%s'"%i[0])[0][0]=="" and \
- database.queryTabel("flightinfo{}".format(nowDayStr),"非航前预计到达","航班编号='%s'"%i[0])[0][0] !="" and \
- database.queryTabel("flightinfo{}".format(nowDayStr), "航前实际起飞", "航班编号='%s'" % i[0])[0][0] != "":
- time=database.queryTabel("flightinfo{}".format(nowDayStr),"非航前预计到达","航班编号='%s'"%i[0])[0][0]
- receivetime = datetime.datetime.strptime(time, "%Y-%m-%d %H:%M:%S") - datetime.timedelta(minutes=15)
- ii=str(i[0])+str(-1)
- iii = str(i[0]) + str(-2)
- if ii in str(sort_flight_ids_arr):
- newdic={"编号":"'%s'"%ii,"航班编号":"'%s'"%i[0],"保障时间":"'%s'"%receivetime,"航班类型":"'航后'","航班日期":"'%s'"%flight_date_str,"级别":"1"}
- database.lazyUpdateItem("sortFlight{}".format(nowDayStr),newdic,"编号='%s'"%ii)
- else:
- newdic = {"编号": "%s" % ii, "航班编号": "%s" % i[0], "保障时间": "%s" % receivetime, "航班类型": "航后",
- "航班日期": "%s" % flight_date_str, "级别": 1}
- database.lazyInsertData("sortFlight{}".format(nowDayStr),newdic)
- if iii in str(sort_flight_ids_arr):
- database.deleteSingledata('sortFlight{}'.format(nowDayStr), "编号='%s'" % iii)
- elif database.queryTabel("flightinfo{}".format(nowDayStr),"非航前实际到达","航班编号='%s'"%i[0])[0][0]=="" and \
- database.queryTabel("flightinfo{}".format(nowDayStr),"非航前预计到达","航班编号='%s'"%i[0])[0][0] =="" and \
- database.queryTabel("flightinfo{}".format(nowDayStr), "航前实际起飞", "航班编号='%s'" % i[0])[0][0] != "":
- time=database.queryTabel("flightinfo{}".format(nowDayStr),"非航前计划到达","航班编号='%s'"%i[0])[0][0]
- receivetime = datetime.datetime.strptime(time, "%Y-%m-%d %H:%M:%S") - datetime.timedelta(minutes=15)
- ii=str(i[0])+str(-1)
- iii = str(i[0]) + str(-2)
- if ii in str(sort_flight_ids_arr):
- newdic={"编号":"'%s'"%ii,"航班编号":"'%s'"%i[0],"保障时间":"'%s'"%receivetime,"航班类型":"'航后'","航班日期":"'%s'"%flight_date_str,"级别":"1"}
- database.lazyUpdateItem("sortFlight{}".format(nowDayStr),newdic,"编号='%s'"%ii)
- else:
- newdic = {"编号": "%s" % ii, "航班编号": "%s" % i[0], "保障时间": "%s" % receivetime, "航班类型": "航后",
- "航班日期": "%s" % flight_date_str, "级别": 1}
- database.lazyInsertData("sortFlight{}".format(nowDayStr),newdic)
- if iii in str(sort_flight_ids_arr):
- database.deleteSingledata('sortFlight{}'.format(nowDayStr), "编号='%s'" % iii)
- elif database.queryTabel("flightinfo{}".format(nowDayStr),"非航前实际到达","航班编号='%s'"%i[0])[0][0] =="" and \
- database.queryTabel("flightinfo{}".format(nowDayStr),"航前实际起飞","航班编号='%s'"%i[0])[0][0] == "" and \
- database.queryTabel("flightinfo{}".format(nowDayStr), "非航前预计到达", "航班编号='%s'" % i[0])[0][0] == "" and \
- database.queryTabel("flightinfo{}".format(nowDayStr),"非航前计划到达","航班编号='%s'"%i[0])[0][0]!="" :
- time=database.queryTabel("flightinfo{}".format(nowDayStr),"非航前计划到达","航班编号='%s'"%i[0])[0][0]
- receivetime = datetime.datetime.strptime(time, "%Y-%m-%d %H:%M:%S") - datetime.timedelta(minutes=15)
- ii=str(i[0])+str(-1)
- iii = str(i[0]) + str(-2)
- if ii in str(sort_flight_ids_arr):
- newdic={"编号":"'%s'"%ii,"航班编号":"'%s'"%i[0],"保障时间":"'%s'"%receivetime,"航班类型":"'航后'","航班日期":"'%s'"%flight_date_str,"级别":"2"}
- database.lazyUpdateItem("sortFlight{}".format(nowDayStr),newdic,"编号='%s'"%ii)
- else:
- newdic = {"编号": "%s" % ii, "航班编号": "%s" % i[0], "保障时间": "%s" % receivetime, "航班类型": "航后",
- "航班日期": "%s" % flight_date_str, "级别": 2}
- database.lazyInsertData("sortFlight{}".format(nowDayStr),newdic)
- if iii in str(sort_flight_ids_arr):
- database.deleteSingledata('sortFlight{}'.format(nowDayStr), "编号='%s'" % iii)
- elif database.queryTabel("flightinfo{}".format(nowDayStr),"非航前实际到达","航班编号='%s'"%i[0])[0][0] !="":
- time=database.queryTabel("flightinfo{}".format(nowDayStr),"非航前实际到达","航班编号='%s'"%i[0])[0][0]
- receivetime = datetime.datetime.strptime(time, "%Y-%m-%d %H:%M:%S")
- ii=str(i[0])+str(-1)
- iii = str(i[0]) + str(-2)
- if ii in str(sort_flight_ids_arr):
- newdic={"编号":"'%s'"%ii,"航班编号":"'%s'"%i[0],"保障时间":"'%s'"%receivetime,"航班类型":"'航后'","航班日期":"'%s'"%flight_date_str,"级别":"3"}
- database.lazyUpdateItem("sortFlight{}".format(nowDayStr),newdic,"编号='%s'"%ii)
- else:
- newdic = {"编号": "%s" % ii, "航班编号": "%s" % i[0], "保障时间": "%s" % receivetime, "航班类型": "航后",
- "航班日期": "%s" % flight_date_str, "级别": 3}
- database.lazyInsertData("sortFlight{}".format(nowDayStr), newdic)
- if iii in str(sort_flight_ids_arr):
- database.deleteSingledata('sortFlight{}'.format(nowDayStr), "编号='%s'" % iii)
- elif database.queryTabel("flightinfo{}".format(nowDayStr),"非航前实际到达","航班编号='%s'"%i[0])[0][0] =="" and \
- database.queryTabel("flightinfo{}".format(nowDayStr),"航前实际起飞","航班编号='%s'"%i[0])[0][0] == "" and \
- database.queryTabel("flightinfo{}".format(nowDayStr),"非航前预计到达","航班编号='%s'"%i[0])[0][0]!="" :
- time=database.queryTabel("flightinfo{}".format(nowDayStr),"非航前预计到达","航班编号='%s'"%i[0])[0][0]
- receivetime = datetime.datetime.strptime(time, "%Y-%m-%d %H:%M:%S") - datetime.timedelta(minutes=15)
- ii=str(i[0])+str(-1)
- iii = str(i[0]) + str(-2)
- if ii in str(sort_flight_ids_arr):
- newdic={"编号":"'%s'"%ii,"航班编号":"'%s'"%i[0],"保障时间":"'%s'"%receivetime,"航班类型":"'航后'","航班日期":"'%s'"%flight_date_str,"级别":"2"}
- database.lazyUpdateItem("sortFlight{}".format(nowDayStr),newdic,"编号='%s'"%ii)
- else:
- newdic = {"编号": "%s" % ii, "航班编号": "%s" % i[0], "保障时间": "%s" % receivetime, "航班类型": "航后",
- "航班日期": "%s" % flight_date_str, "级别": 2}
- database.lazyInsertData("sortFlight{}".format(nowDayStr),newdic)
- if iii in str(sort_flight_ids_arr):
- database.deleteSingledata('sortFlight{}'.format(nowDayStr), "编号='%s'" % iii)
- elif database.queryTabel("flightinfo{}".format(nowDayStr),"航班类型","航班编号='%s'"%i[0])[0][0] =="航后" and "MAN" in str(i[0]):
- time=database.queryTabel("flightinfo{}".format(nowDayStr),"非航前预计到达","航班编号='%s'"%i[0])[0][0]
- receivetime = datetime.datetime.strptime(time, "%Y-%m-%d %H:%M:%S") - datetime.timedelta(minutes=15)
- receivetime2= datetime.datetime.strptime(time, "%Y-%m-%d %H:%M:%S")
- if now < receivetime2:
- ii=str(i[0])+str(-1)
- iii = str(i[0]) + str(-2)
- if ii in str(sort_flight_ids_arr):
- newdic={"编号":"'%s'"%ii,"航班编号":"'%s'"%i[0],"保障时间":"'%s'"%receivetime,"航班类型":"'航后'","航班日期":"'%s'"%flight_date_str,"级别":"1"}
- database.lazyUpdateItem("sortFlight{}".format(nowDayStr),newdic,"编号='%s'"%ii)
- else:
- newdic = {"编号": "%s" % ii, "航班编号": "%s" % i[0], "保障时间": "%s" % receivetime, "航班类型": "航后",
- "航班日期": "%s" % flight_date_str, "级别": 1}
- database.lazyInsertData("sortFlight{}".format(nowDayStr),newdic)
- if iii in str(sort_flight_ids_arr):
- database.deleteSingledata('sortFlight{}'.format(nowDayStr), "编号='%s'" % iii)
- else:
- ii=str(i[0])+str(-1)
- iii = str(i[0]) + str(-2)
- if ii in str(sort_flight_ids_arr):
- newdic={"编号":"'%s'"%ii,"航班编号":"'%s'"%i[0],"保障时间":"'%s'"%receivetime2,"航班类型":"'航后'","航班日期":"'%s'"%flight_date_str,"级别":"3"}
- database.lazyUpdateItem("sortFlight{}".format(nowDayStr),newdic,"编号='%s'"%ii)
- else:
- newdic = {"编号": "%s" % ii, "航班编号": "%s" % i[0], "保障时间": "%s" % receivetime2, "航班类型": "航后",
- "航班日期": "%s" % flight_date_str, "级别": 3}
- database.lazyInsertData("sortFlight{}".format(nowDayStr), newdic)
- if iii in str(sort_flight_ids_arr):
- database.deleteSingledata('sortFlight{}'.format(nowDayStr), "编号='%s'" % iii)
- elif database.queryTabel("flightinfo{}".format(nowDayStr),"航班类型","航班编号='%s'"%i[0])[0][0] =="短停" and "MAN" not in str(i[0]):
- if database.queryTabel("flightinfo{}".format(nowDayStr),"非航前实际到达","航班编号='%s'"%i[0])[0][0]=="" and \
- database.queryTabel("flightinfo{}".format(nowDayStr),"非航前预计到达","航班编号='%s'"%i[0])[0][0] != "" and \
- database.queryTabel("flightinfo{}".format(nowDayStr), "航前实际起飞", "航班编号='%s'" % i[0])[0][0] != "":
- time=database.queryTabel("flightinfo{}".format(nowDayStr),"非航前预计到达","航班编号='%s'"%i[0])[0][0]
- receivetime = datetime.datetime.strptime(time, "%Y-%m-%d %H:%M:%S") - datetime.timedelta(minutes=15)
- ii=str(i[0])+str(-1)
- if ii in str(sort_flight_ids_arr):
- newdic={"编号":"'%s'"%ii,"航班编号":"'%s'"%i[0],"保障时间":"'%s'"%receivetime,"航班类型":"'短停接'","航班日期":"'%s'"%flight_date_str,"级别":"1"}
- database.lazyUpdateItem("sortFlight{}".format(nowDayStr),newdic,"编号='%s'"%ii)
- else:
- newdic = {"编号": "%s" % ii, "航班编号": "%s" % i[0], "保障时间": "%s" % receivetime, "航班类型": "短停接",
- "航班日期": "%s" % flight_date_str, "级别": 1}
- database.lazyInsertData("sortFlight{}".format(nowDayStr),newdic)
- elif database.queryTabel("flightinfo{}".format(nowDayStr),"非航前实际到达","航班编号='%s'"%i[0])[0][0]=="" and \
- database.queryTabel("flightinfo{}".format(nowDayStr),"非航前预计到达","航班编号='%s'"%i[0])[0][0] == "" and \
- database.queryTabel("flightinfo{}".format(nowDayStr), "航前实际起飞", "航班编号='%s'" % i[0])[0][0] != "":
- time=database.queryTabel("flightinfo{}".format(nowDayStr),"非航前计划到达","航班编号='%s'"%i[0])[0][0]
- receivetime = datetime.datetime.strptime(time, "%Y-%m-%d %H:%M:%S") - datetime.timedelta(minutes=15)
- ii=str(i[0])+str(-1)
- if ii in str(sort_flight_ids_arr):
- newdic={"编号":"'%s'"%ii,"航班编号":"'%s'"%i[0],"保障时间":"'%s'"%receivetime,"航班类型":"'短停接'","航班日期":"'%s'"%flight_date_str,"级别":"1"}
- database.lazyUpdateItem("sortFlight{}".format(nowDayStr),newdic,"编号='%s'"%ii)
- else:
- newdic = {"编号": "%s" % ii, "航班编号": "%s" % i[0], "保障时间": "%s" % receivetime, "航班类型": "短停接",
- "航班日期": "%s" % flight_date_str, "级别": 1}
- database.lazyInsertData("sortFlight{}".format(nowDayStr),newdic)
- elif database.queryTabel("flightinfo{}".format(nowDayStr),"非航前实际到达","航班编号='%s'"%i[0])[0][0] =="" and \
- database.queryTabel("flightinfo{}".format(nowDayStr),"航前实际起飞","航班编号='%s'"%i[0])[0][0] =="" and \
- database.queryTabel("flightinfo{}".format(nowDayStr), "非航前预计到达", "航班编号='%s'" % i[0])[0][0] == "" and \
- database.queryTabel("flightinfo{}".format(nowDayStr),"非航前计划到达","航班编号='%s'"%i[0])[0][0] !="":
- time=database.queryTabel("flightinfo{}".format(nowDayStr),"非航前计划到达","航班编号='%s'"%i[0])[0][0]
- receivetime = datetime.datetime.strptime(time, "%Y-%m-%d %H:%M:%S") - datetime.timedelta(minutes=15)
- ii=str(i[0])+str(-1)
- if ii in str(sort_flight_ids_arr):
- newdic={"编号":"'%s'"%ii,"航班编号":"'%s'"%i[0],"保障时间":"'%s'"%receivetime,"航班类型":"'短停接'","航班日期":"'%s'"%flight_date_str,"级别":"2"}
- database.lazyUpdateItem("sortFlight{}".format(nowDayStr),newdic,"编号='%s'"%ii)
- else:
- newdic = {"编号": "%s" % ii, "航班编号": "%s" % i[0], "保障时间": "%s" % receivetime, "航班类型": "短停接",
- "航班日期": "%s" % flight_date_str, "级别": 2}
- database.lazyInsertData("sortFlight{}".format(nowDayStr),newdic)
- elif database.queryTabel("flightinfo{}".format(nowDayStr),"非航前实际到达","航班编号='%s'"%i[0])[0][0] =="" and \
- database.queryTabel("flightinfo{}".format(nowDayStr),"航前实际起飞","航班编号='%s'"%i[0])[0][0] =="" and\
- database.queryTabel("flightinfo{}".format(nowDayStr),"非航前预计到达","航班编号='%s'"%i[0])[0][0] !="":
- time=database.queryTabel("flightinfo{}".format(nowDayStr),"非航前预计到达","航班编号='%s'"%i[0])[0][0]
- receivetime = datetime.datetime.strptime(time, "%Y-%m-%d %H:%M:%S") - datetime.timedelta(minutes=15)
- ii=str(i[0])+str(-1)
- if ii in str(sort_flight_ids_arr):
- newdic={"编号":"'%s'"%ii,"航班编号":"'%s'"%i[0],"保障时间":"'%s'"%receivetime,"航班类型":"'短停接'","航班日期":"'%s'"%flight_date_str,"级别":"2"}
- database.lazyUpdateItem("sortFlight{}".format(nowDayStr),newdic,"编号='%s'"%ii)
- else:
- newdic = {"编号": "%s" % ii, "航班编号": "%s" % i[0], "保障时间": "%s" % receivetime, "航班类型": "短停接",
- "航班日期": "%s" % flight_date_str, "级别": 2}
- database.lazyInsertData("sortFlight{}".format(nowDayStr),newdic)
- elif database.queryTabel("flightinfo{}".format(nowDayStr),"非航前实际到达","航班编号='%s'"%i[0])[0][0] !="":
- time=database.queryTabel("flightinfo{}".format(nowDayStr),"非航前实际到达","航班编号='%s'"%i[0])[0][0]
- receivetime = datetime.datetime.strptime(time, "%Y-%m-%d %H:%M:%S")
- ii=str(i[0])+str(-1)
- if ii in str(sort_flight_ids_arr):
- newdic={"编号":"'%s'"%ii,"航班编号":"'%s'"%i[0],"保障时间":"'%s'"%receivetime,"航班类型":"'短停接'","航班日期":"'%s'"%flight_date_str,"级别":"4"}
- database.lazyUpdateItem("sortFlight{}".format(nowDayStr),newdic,"编号='%s'"%ii)
- else:
- newdic = {"编号": "%s" % ii, "航班编号": "%s" % i[0], "保障时间": "%s" % receivetime, "航班类型": "短停接",
- "航班日期": "%s" % flight_date_str, "级别": 4}
- database.lazyInsertData("sortFlight{}".format(nowDayStr), newdic)
- elif database.queryTabel("flightinfo{}".format(nowDayStr),"航班类型","航班编号='%s'"%i[0])[0][0] =="短停" and "MAN" in str(i[0]):
- time=database.queryTabel("flightinfo{}".format(nowDayStr),"非航前预计到达","航班编号='%s'"%i[0])[0][0]
- receivetime = datetime.datetime.strptime(time, "%Y-%m-%d %H:%M:%S") - datetime.timedelta(minutes=15)
- receivetime2 = datetime.datetime.strptime(time, "%Y-%m-%d %H:%M:%S")
- if now < receivetime2:
- ii=str(i[0])+str(-1)
- if ii in str(sort_flight_ids_arr):
- newdic={"编号":"'%s'"%ii,"航班编号":"'%s'"%i[0],"保障时间":"'%s'"%receivetime,"航班类型":"'短停接'","航班日期":"'%s'"%flight_date_str,"级别":"1"}
- database.lazyUpdateItem("sortFlight{}".format(nowDayStr),newdic,"编号='%s'"%ii)
- else:
- newdic = {"编号": "%s" % ii, "航班编号": "%s" % i[0], "保障时间": "%s" % receivetime, "航班类型": "短停接",
- "航班日期": "%s" % flight_date_str, "级别": 1}
- database.lazyInsertData("sortFlight{}".format(nowDayStr),newdic)
- else:
- ii=str(i[0])+str(-1)
- if ii in str(sort_flight_ids_arr):
- newdic={"编号":"'%s'"%ii,"航班编号":"'%s'"%i[0],"保障时间":"'%s'"%receivetime2,"航班类型":"'短停接'","航班日期":"'%s'"%flight_date_str,"级别":"4"}
- database.lazyUpdateItem("sortFlight{}".format(nowDayStr),newdic,"编号='%s'"%ii)
- else:
- newdic = {"编号": "%s" % ii, "航班编号": "%s" % i[0], "保障时间": "%s" % receivetime2, "航班类型": "短停接",
- "航班日期": "%s" % flight_date_str, "级别": 4}
- database.lazyInsertData("sortFlight{}".format(nowDayStr), newdic)
- elif database.queryTabel("flightinfo{}".format(nowDayStr),"航班类型","航班编号='%s'"%i[0])[0][0] =="特后前" and "MAN" not in str(i[0]):
- if database.queryTabel("flightinfo{}".format(nowDayStr), "非航前实际到达", "航班编号='%s'" % i[0])[0][0] == "" and \
- database.queryTabel("flightinfo{}".format(nowDayStr), "非航前预计到达", "航班编号='%s'" % i[0])[0][
- 0] != "" and \
- database.queryTabel("flightinfo{}".format(nowDayStr), "航前实际起飞", "航班编号='%s'" % i[0])[0][0] != "":
- time = database.queryTabel("flightinfo{}".format(nowDayStr), "非航前预计到达", "航班编号='%s'" % i[0])[0][0]
- receivetime = datetime.datetime.strptime(time, "%Y-%m-%d %H:%M:%S") - datetime.timedelta(minutes=15)
- ii = str(i[0]) + str(-1)
- if ii in str(sort_flight_ids_arr):
- newdic = {"编号": "'%s'" % ii, "航班编号": "'%s'" % i[0], "保障时间": "'%s'" % receivetime,
- "航班类型": "'特后前接'", "航班日期": "'%s'" % flight_date_str, "级别": "1"}
- database.lazyUpdateItem("sortFlight{}".format(nowDayStr), newdic, "编号='%s'" % ii)
- else:
- newdic = {"编号": "%s" % ii, "航班编号": "%s" % i[0], "保障时间": "%s" % receivetime, "航班类型": "特后前接",
- "航班日期": "%s" % flight_date_str, "级别": 1}
- database.lazyInsertData("sortFlight{}".format(nowDayStr), newdic)
- elif database.queryTabel("flightinfo{}".format(nowDayStr), "非航前实际到达", "航班编号='%s'" % i[0])[0][
- 0] == "" and \
- database.queryTabel("flightinfo{}".format(nowDayStr), "非航前预计到达", "航班编号='%s'" % i[0])[0][
- 0] == "" and \
- database.queryTabel("flightinfo{}".format(nowDayStr), "航前实际起飞", "航班编号='%s'" % i[0])[0][0] != "":
- time = database.queryTabel("flightinfo{}".format(nowDayStr), "非航前计划到达", "航班编号='%s'" % i[0])[0][0]
- receivetime = datetime.datetime.strptime(time, "%Y-%m-%d %H:%M:%S") - datetime.timedelta(minutes=15)
- ii = str(i[0]) + str(-1)
- if ii in str(sort_flight_ids_arr):
- newdic = {"编号": "'%s'" % ii, "航班编号": "'%s'" % i[0], "保障时间": "'%s'" % receivetime,
- "航班类型": "'特后前接'", "航班日期": "'%s'" % flight_date_str, "级别": "1"}
- database.lazyUpdateItem("sortFlight{}".format(nowDayStr), newdic, "编号='%s'" % ii)
- else:
- newdic = {"编号": "%s" % ii, "航班编号": "%s" % i[0], "保障时间": "%s" % receivetime, "航班类型": "特后前接",
- "航班日期": "%s" % flight_date_str, "级别": 1}
- database.lazyInsertData("sortFlight{}".format(nowDayStr), newdic)
- elif database.queryTabel("flightinfo{}".format(nowDayStr), "非航前实际到达", "航班编号='%s'" % i[0])[0][
- 0] == "" and \
- database.queryTabel("flightinfo{}".format(nowDayStr), "航前实际起飞", "航班编号='%s'" % i[0])[0][
- 0] == "" and \
- database.queryTabel("flightinfo{}".format(nowDayStr), "非航前预计到达", "航班编号='%s'" % i[0])[0][
- 0] == "" and \
- database.queryTabel("flightinfo{}".format(nowDayStr), "非航前计划到达", "航班编号='%s'" % i[0])[0][
- 0] != "":
- time = database.queryTabel("flightinfo{}".format(nowDayStr), "非航前计划到达", "航班编号='%s'" % i[0])[0][0]
- receivetime = datetime.datetime.strptime(time, "%Y-%m-%d %H:%M:%S") - datetime.timedelta(minutes=15)
- ii = str(i[0]) + str(-1)
- if ii in str(sort_flight_ids_arr):
- newdic = {"编号": "'%s'" % ii, "航班编号": "'%s'" % i[0], "保障时间": "'%s'" % receivetime,
- "航班类型": "'特后前接'", "航班日期": "'%s'" % flight_date_str, "级别": "2"}
- database.lazyUpdateItem("sortFlight{}".format(nowDayStr), newdic, "编号='%s'" % ii)
- else:
- newdic = {"编号": "%s" % ii, "航班编号": "%s" % i[0], "保障时间": "%s" % receivetime, "航班类型": "特后前接",
- "航班日期": "%s" % flight_date_str, "级别": 2}
- database.lazyInsertData("sortFlight{}".format(nowDayStr), newdic)
- elif database.queryTabel("flightinfo{}".format(nowDayStr), "非航前实际到达", "航班编号='%s'" % i[0])[0][
- 0] == "" and \
- database.queryTabel("flightinfo{}".format(nowDayStr), "航前实际起飞", "航班编号='%s'" % i[0])[0][
- 0] == "" and \
- database.queryTabel("flightinfo{}".format(nowDayStr), "非航前预计到达", "航班编号='%s'" % i[0])[0][
- 0] != "":
- time = database.queryTabel("flightinfo{}".format(nowDayStr), "非航前预计到达", "航班编号='%s'" % i[0])[0][0]
- receivetime = datetime.datetime.strptime(time, "%Y-%m-%d %H:%M:%S") - datetime.timedelta(minutes=15)
- ii = str(i[0]) + str(-1)
- if ii in str(sort_flight_ids_arr):
- newdic = {"编号": "'%s'" % ii, "航班编号": "'%s'" % i[0], "保障时间": "'%s'" % receivetime,
- "航班类型": "'特后前接'", "航班日期": "'%s'" % flight_date_str, "级别": "2"}
- database.lazyUpdateItem("sortFlight{}".format(nowDayStr), newdic, "编号='%s'" % ii)
- else:
- newdic = {"编号": "%s" % ii, "航班编号": "%s" % i[0], "保障时间": "%s" % receivetime, "航班类型": "特后前接",
- "航班日期": "%s" % flight_date_str, "级别": 2}
- database.lazyInsertData("sortFlight{}".format(nowDayStr), newdic)
- elif database.queryTabel("flightinfo{}".format(nowDayStr), "非航前实际到达", "航班编号='%s'" % i[0])[0][0] != "":
- time = database.queryTabel("flightinfo{}".format(nowDayStr), "非航前实际到达", "航班编号='%s'" % i[0])[0][0]
- receivetime = datetime.datetime.strptime(time, "%Y-%m-%d %H:%M:%S")
- ii = str(i[0]) + str(-1)
- if ii in str(sort_flight_ids_arr):
- newdic = {"编号": "'%s'" % ii, "航班编号": "'%s'" % i[0], "保障时间": "'%s'" % receivetime,
- "航班类型": "'特后前接'", "航班日期": "'%s'" % flight_date_str, "级别": "4"}
- database.lazyUpdateItem("sortFlight{}".format(nowDayStr), newdic, "编号='%s'" % ii)
- else:
- newdic = {"编号": "%s" % ii, "航班编号": "%s" % i[0], "保障时间": "%s" % receivetime, "航班类型": "特后前接",
- "航班日期": "%s" % flight_date_str, "级别": 4}
- database.lazyInsertData("sortFlight{}".format(nowDayStr), newdic)
- elif database.queryTabel("flightinfo{}".format(nowDayStr), "航班类型", "航班编号='%s'" % i[0])[0][
- 0] == "特后前" and "MAN" in str(i[0]):
- time = database.queryTabel("flightinfo{}".format(nowDayStr), "非航前预计到达", "航班编号='%s'" % i[0])[0][0]
- receivetime = datetime.datetime.strptime(time, "%Y-%m-%d %H:%M:%S") - datetime.timedelta(minutes=15)
- receivetime2 = datetime.datetime.strptime(time, "%Y-%m-%d %H:%M:%S")
- if now < receivetime2:
- ii = str(i[0]) + str(-1)
- if ii in str(sort_flight_ids_arr):
- newdic = {"编号": "'%s'" % ii, "航班编号": "'%s'" % i[0], "保障时间": "'%s'" % receivetime,
- "航班类型": "'特后前接'", "航班日期": "'%s'" % flight_date_str, "级别": "1"}
- database.lazyUpdateItem("sortFlight{}".format(nowDayStr), newdic, "编号='%s'" % ii)
- else:
- newdic = {"编号": "%s" % ii, "航班编号": "%s" % i[0], "保障时间": "%s" % receivetime, "航班类型": "特后前接",
- "航班日期": "%s" % flight_date_str, "级别": 1}
- database.lazyInsertData("sortFlight{}".format(nowDayStr), newdic)
- else:
- ii = str(i[0]) + str(-1)
- if ii in str(sort_flight_ids_arr):
- newdic = {"编号": "'%s'" % ii, "航班编号": "'%s'" % i[0], "保障时间": "'%s'" % receivetime2,
- "航班类型": "'特后前接'", "航班日期": "'%s'" % flight_date_str, "级别": "4"}
- database.lazyUpdateItem("sortFlight{}".format(nowDayStr), newdic, "编号='%s'" % ii)
- else:
- newdic = {"编号": "%s" % ii, "航班编号": "%s" % i[0], "保障时间": "%s" % receivetime2, "航班类型": "特后前接",
- "航班日期": "%s" % flight_date_str, "级别": 4}
- database.lazyInsertData("sortFlight{}".format(nowDayStr), newdic)
- if database.queryTabel("flightinfo{}".format(nowDayStr), "航班类型", "航班编号='%s'" % i[0])[0][0] == "短停" and "MAN" not in str(i[0]):
- if "[实]" in str(database.queryTabel("flightinfo{}".format(nowDayStr),"非航前预计起飞","航班编号='%s'"%i[0])):
- time=database.queryTabel("flightinfo{}".format(nowDayStr),"非航前预计起飞","航班编号='%s'"%i[0])[0]
- receivetime_str =flight_date_str.split("-")[0] + "/" + time[0].split("]")[1]
- receivetime = datetime.datetime.strptime(receivetime_str, "%Y/%m/%d %H:%M") - datetime.timedelta(minutes=25)
- ii=str(i[0])+str(-2)
- if ii in str(sort_flight_ids_arr):
- newdic={"编号":"'%s'"%ii,"航班编号":"'%s'"%i[0],"保障时间":"'%s'"%receivetime,"航班类型":"'短停送'","航班日期":"'%s'"%flight_date_str,"级别":"4"}
- database.lazyUpdateItem("sortFlight{}".format(nowDayStr),newdic,"编号='%s'"%ii)
- else:
- newdic = {"编号": "%s" % ii, "航班编号": "%s" % i[0], "保障时间": "%s" % receivetime, "航班类型": "短停送",
- "航班日期": "%s" % flight_date_str, "级别": 4}
- database.lazyInsertData("sortFlight{}".format(nowDayStr),newdic)
- elif "[实]" not in str(database.queryTabel("flightinfo{}".format(nowDayStr), "非航前预计起飞", "航班编号='%s'" % i[0])) and \
- database.queryTabel("flightinfo{}".format(nowDayStr), "非航前实际到达", "航班编号='%s'" % i[0])[0][0] !="" and \
- database.queryTabel("flightinfo{}".format(nowDayStr), "非航前预计起飞", "航班编号='%s'" % i[0])[0][0] !="":
- time = database.queryTabel("flightinfo{}".format(nowDayStr), "非航前预计起飞", "航班编号='%s'" % i[0])[0]
- receivetime_str = flight_date_str.split("-")[0] + "/" + time[0].split("]")[1]
- receivetime = datetime.datetime.strptime(receivetime_str, "%Y/%m/%d %H:%M") - datetime.timedelta(minutes=25)
- ii = str(i[0]) + str(-2)
- if ii in str(sort_flight_ids_arr):
- newdic = {"编号": "'%s'" % ii, "航班编号": "'%s'" % i[0], "保障时间": "'%s'" % receivetime, "航班类型": "'短停送'",
- "航班日期": "'%s'" % flight_date_str, "级别": "1"}
- database.lazyUpdateItem("sortFlight{}".format(nowDayStr), newdic, "编号='%s'" % ii)
- else:
- newdic = {"编号": "%s" % ii, "航班编号": "%s" % i[0], "保障时间": "%s" % receivetime, "航班类型": "短停送",
- "航班日期": "%s" % flight_date_str, "级别": 1}
- database.lazyInsertData("sortFlight{}".format(nowDayStr),newdic)
- elif "[实]" not in str(database.queryTabel("flightinfo{}".format(nowDayStr), "非航前预计起飞", "航班编号='%s'" % i[0])) and \
- database.queryTabel("flightinfo{}".format(nowDayStr), "非航前实际到达", "航班编号='%s'" % i[0])[0][0] =="" and \
- database.queryTabel("flightinfo{}".format(nowDayStr), "非航前预计起飞", "航班编号='%s'" % i[0])[0][0] !="":
- time = database.queryTabel("flightinfo{}".format(nowDayStr), "非航前预计起飞", "航班编号='%s'" % i[0])[0]
- receivetime_str = flight_date_str.split("-")[0] + "/" + time[0].split("]")[1]
- receivetime = datetime.datetime.strptime(receivetime_str, "%Y/%m/%d %H:%M") - datetime.timedelta(minutes=25)
- ii = str(i[0]) + str(-2)
- if ii in str(sort_flight_ids_arr):
- newdic = {"编号": "'%s'" % ii, "航班编号": "'%s'" % i[0], "保障时间": "'%s'" % receivetime, "航班类型": "'短停送'",
- "航班日期": "'%s'" % flight_date_str, "级别": "2"}
- database.lazyUpdateItem("sortFlight{}".format(nowDayStr), newdic, "编号='%s'" % ii)
- else:
- newdic = {"编号": "%s" % ii, "航班编号": "%s" % i[0], "保障时间": "%s" % receivetime, "航班类型": "短停送",
- "航班日期": "%s" % flight_date_str, "级别": 2}
- database.lazyInsertData("sortFlight{}".format(nowDayStr),newdic)
- if database.queryTabel("flightinfo{}".format(nowDayStr), "航班类型", "航班编号='%s'" % i[0])[0][0] == "短停" and "MAN" in str(i[0]):
- time1 = database.queryTabel("flightinfo{}".format(nowDayStr), "非航前预计到达", "航班编号='%s'" % i[0])[0][0]
- receivetime1 = datetime.datetime.strptime(time1, "%Y-%m-%d %H:%M:%S")
- time=database.queryTabel("flightinfo{}".format(nowDayStr),"非航前预计起飞","航班编号='%s'"%i[0])[0]
- receivetime_str =flight_date_str.split("-")[0] + "/" + time[0].split("]")[1]
- receivetime = datetime.datetime.strptime(receivetime_str, "%Y/%m/%d %H:%M") - datetime.timedelta(minutes=25)
- receivetime2 = datetime.datetime.strptime(receivetime_str, "%Y/%m/%d %H:%M")
- if now<receivetime1:
- ii = str(i[0]) + str(-2)
- if ii in str(sort_flight_ids_arr):
- newdic = {"编号": "'%s'" % ii, "航班编号": "'%s'" % i[0], "保障时间": "'%s'" % receivetime,
- "航班类型": "'短停送'",
- "航班日期": "'%s'" % flight_date_str, "级别": "2"}
- database.lazyUpdateItem("sortFlight{}".format(nowDayStr), newdic, "编号='%s'" % ii)
- else:
- newdic = {"编号": "%s" % ii, "航班编号": "%s" % i[0], "保障时间": "%s" % receivetime,
- "航班类型": "短停送",
- "航班日期": "%s" % flight_date_str, "级别": 2}
- database.lazyInsertData("sortFlight{}".format(nowDayStr), newdic)
- elif receivetime1<now<receivetime2:
- ii = str(i[0]) + str(-2)
- if ii in str(sort_flight_ids_arr):
- newdic = {"编号": "'%s'" % ii, "航班编号": "'%s'" % i[0], "保障时间": "'%s'" % receivetime,
- "航班类型": "'短停送'",
- "航班日期": "'%s'" % flight_date_str, "级别": "1"}
- database.lazyUpdateItem("sortFlight{}".format(nowDayStr), newdic, "编号='%s'" % ii)
- else:
- newdic = {"编号": "%s" % ii, "航班编号": "%s" % i[0], "保障时间": "%s" % receivetime,
- "航班类型": "短停送",
- "航班日期": "%s" % flight_date_str, "级别": 1}
- database.lazyInsertData("sortFlight{}".format(nowDayStr), newdic)
- else:
- ii=str(i[0])+str(-2)
- if ii in str(sort_flight_ids_arr):
- newdic={"编号":"'%s'"%ii,"航班编号":"'%s'"%i[0],"保障时间":"'%s'"%receivetime2,"航班类型":"'短停送'","航班日期":"'%s'"%flight_date_str,"级别":"4"}
- database.lazyUpdateItem("sortFlight{}".format(nowDayStr),newdic,"编号='%s'"%ii)
- else:
- newdic = {"编号": "%s" % ii, "航班编号": "%s" % i[0], "保障时间": "%s" % receivetime2, "航班类型": "短停送",
- "航班日期": "%s" % flight_date_str, "级别": 4}
- database.lazyInsertData("sortFlight{}".format(nowDayStr),newdic)
- if database.queryTabel("flightinfo{}".format(nowDayStr), "航班类型", "航班编号='%s'" % i[0])[0][0] == "特后前" and "MAN" not in str(i[0]):
- if "[实]" in str(database.queryTabel("flightinfo{}".format(nowDayStr),"非航前预计起飞","航班编号='%s'"%i[0])):
- time=database.queryTabel("flightinfo{}".format(nowDayStr),"非航前预计起飞","航班编号='%s'"%i[0])[0]
- receivetime_str =flight_date_str.split("-")[0] + "/" + time[0].split("]")[1]
- receivetime = datetime.datetime.strptime(receivetime_str, "%Y/%m/%d %H:%M") - datetime.timedelta(minutes=25)
- ii=str(i[0])+str(-2)
- if ii in str(sort_flight_ids_arr):
- newdic={"编号":"'%s'"%ii,"航班编号":"'%s'"%i[0],"保障时间":"'%s'"%receivetime,"航班类型": "'特后前送'","航班日期":"'%s'"%flight_date_str,"级别":"4"}
- database.lazyUpdateItem("sortFlight{}".format(nowDayStr),newdic,"编号='%s'"%ii)
- else:
- newdic = {"编号": "%s" % ii, "航班编号": "%s" % i[0], "保障时间": "%s" % receivetime, "航班类型": "特后前送",
- "航班日期": "%s" % flight_date_str, "级别": 4}
- database.lazyInsertData("sortFlight{}".format(nowDayStr),newdic)
- elif "[实]" not in str(database.queryTabel("flightinfo{}".format(nowDayStr), "非航前预计起飞", "航班编号='%s'" % i[0])) and \
- database.queryTabel("flightinfo{}".format(nowDayStr), "非航前实际到达", "航班编号='%s'" % i[0])[0][0] !="" and \
- database.queryTabel("flightinfo{}".format(nowDayStr), "非航前预计起飞", "航班编号='%s'" % i[0])[0][0] !="":
- time = database.queryTabel("flightinfo{}".format(nowDayStr), "非航前预计起飞", "航班编号='%s'" % i[0])[0]
- receivetime_str = flight_date_str.split("-")[0] + "/" + time[0].split("]")[1]
- receivetime = datetime.datetime.strptime(receivetime_str, "%Y/%m/%d %H:%M") - datetime.timedelta(minutes=25)
- ii = str(i[0]) + str(-2)
- if ii in str(sort_flight_ids_arr):
- newdic = {"编号": "'%s'" % ii, "航班编号": "'%s'" % i[0], "保障时间": "'%s'" % receivetime, "航班类型": "'特后前送'",
- "航班日期": "'%s'" % flight_date_str, "级别": "1"}
- database.lazyUpdateItem("sortFlight{}".format(nowDayStr), newdic, "编号='%s'" % ii)
- else:
- newdic = {"编号": "%s" % ii, "航班编号": "%s" % i[0], "保障时间": "%s" % receivetime, "航班类型": "特后前送",
- "航班日期": "%s" % flight_date_str, "级别": 1}
- database.lazyInsertData("sortFlight{}".format(nowDayStr),newdic)
- elif "[实]" not in str(database.queryTabel("flightinfo{}".format(nowDayStr), "非航前预计起飞", "航班编号='%s'" % i[0])) and \
- database.queryTabel("flightinfo{}".format(nowDayStr), "非航前实际到达", "航班编号='%s'" % i[0])[0][0] =="" and \
- database.queryTabel("flightinfo{}".format(nowDayStr), "非航前预计起飞", "航班编号='%s'" % i[0])[0][0] !="":
- time = database.queryTabel("flightinfo{}".format(nowDayStr), "非航前预计起飞", "航班编号='%s'" % i[0])[0]
- receivetime_str = flight_date_str.split("-")[0] + "/" + time[0].split("]")[1]
- receivetime = datetime.datetime.strptime(receivetime_str, "%Y/%m/%d %H:%M") - datetime.timedelta(minutes=25)
- ii = str(i[0]) + str(-2)
- if ii in str(sort_flight_ids_arr):
- newdic = {"编号": "'%s'" % ii, "航班编号": "'%s'" % i[0], "保障时间": "'%s'" % receivetime, "航班类型": "'特后前送'",
- "航班日期": "'%s'" % flight_date_str, "级别": "2"}
- database.lazyUpdateItem("sortFlight{}".format(nowDayStr), newdic, "编号='%s'" % ii)
- else:
- newdic = {"编号": "%s" % ii, "航班编号": "%s" % i[0], "保障时间": "%s" % receivetime, "航班类型": "特后前送",
- "航班日期": "%s" % flight_date_str, "级别": 2}
- database.lazyInsertData("sortFlight{}".format(nowDayStr),newdic)
- if database.queryTabel("flightinfo{}".format(nowDayStr), "航班类型", "航班编号='%s'" % i[0])[0][
- 0] == "特后前" and "MAN" in str(i[0]):
- time1 = database.queryTabel("flightinfo{}".format(nowDayStr), "非航前预计到达", "航班编号='%s'" % i[0])[0][0]
- receivetime1 = datetime.datetime.strptime(time1, "%Y-%m-%d %H:%M:%S")
- time = database.queryTabel("flightinfo{}".format(nowDayStr), "非航前预计起飞", "航班编号='%s'" % i[0])[0]
- receivetime_str = flight_date_str.split("-")[0] + "/" + time[0].split("]")[1]
- receivetime = datetime.datetime.strptime(receivetime_str, "%Y/%m/%d %H:%M") - datetime.timedelta(
- minutes=25)
- receivetime2 = datetime.datetime.strptime(receivetime_str, "%Y/%m/%d %H:%M")
- if now < receivetime1:
- ii = str(i[0]) + str(-2)
- if ii in str(sort_flight_ids_arr):
- newdic = {"编号": "'%s'" % ii, "航班编号": "'%s'" % i[0], "保障时间": "'%s'" % receivetime,
- "航班类型": "'特后前送'",
- "航班日期": "'%s'" % flight_date_str, "级别": "2"}
- database.lazyUpdateItem("sortFlight{}".format(nowDayStr), newdic, "编号='%s'" % ii)
- else:
- newdic = {"编号": "%s" % ii, "航班编号": "%s" % i[0], "保障时间": "%s" % receivetime,
- "航班类型": "特后前送",
- "航班日期": "%s" % flight_date_str, "级别": 2}
- database.lazyInsertData("sortFlight{}".format(nowDayStr), newdic)
- elif receivetime1 < now < receivetime2:
- ii = str(i[0]) + str(-2)
- if ii in str(sort_flight_ids_arr):
- newdic = {"编号": "'%s'" % ii, "航班编号": "'%s'" % i[0], "保障时间": "'%s'" % receivetime,
- "航班类型": "'特后前送'",
- "航班日期": "'%s'" % flight_date_str, "级别": "1"}
- database.lazyUpdateItem("sortFlight{}".format(nowDayStr), newdic, "编号='%s'" % ii)
- else:
- newdic = {"编号": "%s" % ii, "航班编号": "%s" % i[0], "保障时间": "%s" % receivetime,
- "航班类型": "特后前送",
- "航班日期": "%s" % flight_date_str, "级别": 1}
- database.lazyInsertData("sortFlight{}".format(nowDayStr), newdic)
- else:
- ii = str(i[0]) + str(-2)
- if ii in str(sort_flight_ids_arr):
- newdic = {"编号": "'%s'" % ii, "航班编号": "'%s'" % i[0], "保障时间": "'%s'" % receivetime2,
- "航班类型": "'特后前送'", "航班日期": "'%s'" % flight_date_str, "级别": "4"}
- database.lazyUpdateItem("sortFlight{}".format(nowDayStr), newdic, "编号='%s'" % ii)
- else:
- newdic = {"编号": "%s" % ii, "航班编号": "%s" % i[0], "保障时间": "%s" % receivetime2, "航班类型": "特后前送",
- "航班日期": "%s" % flight_date_str, "级别": 4}
- database.lazyInsertData("sortFlight{}".format(nowDayStr), newdic)
- database.FunctionCommit()
- except Exception:
- dingding_alert(traceback.format_exc())
- database.FunctionCommit()
- print(datetime.datetime.now(),'[数据库操作]结束排序')
- 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.getSingledata('姓名','pglist%s'%nowDayStr1)
- if len(workernames1) != 0:
- for i in workernames1:
- workernames_arr.append(i[0])
- workernames2 = database.getSingledata('姓名', 'pglist%s' % nowDay_11)
- if len(workernames2) != 0:
- for i in workernames2:
- workernames_arr.append(i[0])
- for worker in workernames_arr:
- 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]
- # worker_number = a if len(a) !=0 else ""
- single_worker_load_ids = workload.getSingledata('编号', 'workload%s' % worker_number)
- single_worker_load_ids_arr = []
- if 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('flightinfo{}'.format(nowDayStr), '航班编号', "维修人员 like '%{}%'".format(worker))
- worker_laod_ids_arr = []
- if len(worker_laod_ids)!= 0:
- for j in worker_laod_ids:
- worker_laod_ids_arr.append(j[0])
- if len(worker_laod_ids_arr) != 0:
- for k in worker_laod_ids_arr:
- TYPE = database.queryTabel('flightinfo{}'.format(nowDayStr), '航班类型', "航班编号 ='%s'"%k)[0][0]
- #TYPE = a[0] if len(a) !=0 else ""
- acno = database.queryTabel('flightinfo{}'.format(nowDayStr), '机号', "航班编号 ='%s'" % k)[0][0]
- #acno = a[0] if len(a) !=0 else ""
- bay = database.queryTabel('flightinfo{}'.format(nowDayStr), '非航前进港机位', "航班编号 ='%s'" % k)[0][0]
- bay1 = database.queryTabel('flightinfo{}'.format(nowDayStr), '航前离港机位', "航班编号 ='%s'" % k)[0][0]
- #bay = a[0] if len(a) !=0 else ""
- flight_id = database.queryTabel('flightinfo{}'.format(nowDayStr), '航班编号', "航班编号 ='%s'" % k)[0][0]
- flight_id_1=str(str(flight_id))+str("-1") #接机保障标志
- flight_id_2 = str(str(flight_id)) + str("-2") # 接机保障标志
- #print(flight_id_1)
- #flight_id = a[0] if len(a) !=0 else ""
- flight_date = database.queryTabel('flightinfo{}'.format(nowDayStr), '航班日期', "航班编号 ='%s'" % k)[0][0]
- #flight_date = a[0] if len(a) !=0 else ""
- if TYPE == "短停" and database.queryTabel('flightinfo{}'.format(nowDayStr), '非航前预计到达', "航班编号 ='%s'"%k)[0][0] != "":
- eta_str=database.queryTabel('flightinfo{}'.format(nowDayStr), '非航前预计到达', "航班编号 ='%s'"%k)[0][0]
- starttime = datetime.datetime.strptime(eta_str, "%Y-%m-%d %H:%M:%S") - datetime.timedelta(minutes=15)
- endtime=database.queryTabel('flightinfo{}'.format(nowDayStr), '非航前实际到达', "航班编号='%s'"%k)[0][0]
- 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 database.queryTabel('flightinfo{}'.format(nowDayStr), '航前预计起飞', "航班编号 ='%s'"%k)[0][0] != "":
- endtime_ap = database.queryTabel('flightinfo{}'.format(nowDayStr),'航前实际起飞', "航班编号='{}'".format(k))[0][0]
- STD_ap=database.queryTabel('flightinfo{}'.format(nowDayStr),'航前预计起飞', "航班编号='{}'".format(k))[0]
- #STD_time_str =flight_date[0].split("-")[0] + "/" + STD_ap[0].split("]")[1]
- #print(STD_ap)
- starttime_ap = datetime.datetime.strptime(STD_ap[0], "%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 database.queryTabel('flightinfo{}'.format(nowDayStr), '非航前预计到达', "航班编号 ='%s'"%k)[0][0] != "":
- eta_str = database.queryTabel('flightinfo{}'.format(nowDayStr), '非航前预计到达', "航班编号 ='%s'" % k)[0][0]
- starttime = datetime.datetime.strptime(eta_str, "%Y-%m-%d %H:%M:%S") - datetime.timedelta(minutes=15)
- if str(database.queryTabel('flightinfo{}'.format(nowDayStr), '维修状态', "航班编号='%s'" % k)[0][0]) == "8":
- endtime = database.queryTabel('flightinfo{}'.format(nowDayStr), '维修状态时间', "航班编号='%s'" % k)[0][0]
- 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 database.queryTabel('flightinfo{}'.format(nowDayStr), '非航前预计到达', "航班编号 ='%s'"%k)[0][0] != "":
- eta_str=database.queryTabel('flightinfo{}'.format(nowDayStr), '非航前预计到达', "航班编号 ='%s'"%k)[0][0]
- starttime = datetime.datetime.strptime(eta_str, "%Y-%m-%d %H:%M:%S") - datetime.timedelta(minutes=15)
- if "[实]" in str(database.queryTabel('flightinfo{}'.format(nowDayStr), '非航前预计起飞', "航班编号='%s'" % k)[0][0]):
- endtime_str = database.queryTabel('flightinfo{}'.format(nowDayStr), '非航前预计起飞', "航班编号='%s'" % k)[0][0]
- endtime_str1 =flight_date.split("-")[0] + "/" + endtime_str.split("]")[1]
- endtime = datetime.datetime.strptime(endtime_str1, "%Y/%m/%d %H:%M")
- 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 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('flightinfo{}'.format(nowDayStr), '航班编号', "放行人员 like '%{}%'".format(worker))
- FX_laod_ids_arr = []
- if len(FX_laod_ids) != 0:
- for j in FX_laod_ids:
- FX_laod_ids_arr.append(j[0])
- if len(FX_laod_ids_arr) != 0:
- for k in FX_laod_ids_arr:
- TYPE = database.queryTabel('flightinfo{}'.format(nowDayStr), '航班类型', "航班编号 ='%s'"%k)[0][0]
- #TYPE = a[0] if len(a) !=0 else ""
- acno = database.queryTabel('flightinfo{}'.format(nowDayStr), '机号', "航班编号 ='%s'" % k)[0][0]
- #acno = a[0] if len(a) !=0 else ""
- bay = database.queryTabel('flightinfo{}'.format(nowDayStr), '非航前进港机位', "航班编号 ='%s'" % k)[0][0]
- bay1 = database.queryTabel('flightinfo{}'.format(nowDayStr), '航前离港机位', "航班编号 ='%s'" % k)[0][0]
- #bay = a[0] if len(a) !=0 else ""
- flight_id = database.queryTabel('flightinfo{}'.format(nowDayStr), '航班编号', "航班编号 ='%s'" % k)[0][0]
- flight_id_1=str(str(flight_id))+str("-1") #接机保障标志
- flight_id_2 = str(str(flight_id)) + str("-2") # 接机保障标志
- #print(flight_id_1)
- #flight_id = a[0] if len(a) !=0 else ""
- flight_date = database.queryTabel('flightinfo{}'.format(nowDayStr), '航班日期', "航班编号 ='%s'" % k)[0][0]
- #flight_date = a[0] if len(a) !=0 else ""
- if TYPE == "短停" and database.queryTabel('flightinfo{}'.format(nowDayStr), '非航前预计到达', "航班编号 ='%s'"%k)[0][0] != "":
- eta_str=database.queryTabel('flightinfo{}'.format(nowDayStr), '非航前预计到达', "航班编号 ='%s'"%k)[0][0]
- starttime = datetime.datetime.strptime(eta_str, "%Y-%m-%d %H:%M:%S") - datetime.timedelta(minutes=15)
- if str(database.queryTabel('flightinfo{}'.format(nowDayStr), '维修状态', "航班编号='%s'" % k)[0][0]) >= "7":
- endtime = database.queryTabel('flightinfo{}'.format(nowDayStr), '维修状态时间', "航班编号='%s'" % k)[0][0]
- 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 database.queryTabel('flightinfo{}'.format(nowDayStr), '航前预计起飞', "航班编号 ='%s'"%k)[0][0] != "":
- if str(database.queryTabel('flightinfo{}'.format(nowDayStr), '维修状态', "航班编号='%s'" % k)[0][0]) >= "7":
- endtime_ap = database.queryTabel('flightinfo{}'.format(nowDayStr), '维修状态时间', "航班编号='%s'" % k)[0][0]
- else:
- endtime_ap = ""
- STD_ap=database.queryTabel('flightinfo{}'.format(nowDayStr),'航前预计起飞', "航班编号='{}'".format(k))[0]
- #STD_time_str =flight_date[0].split("-")[0] + "/" + STD_ap[0].split("]")[1]
- #print(STD_ap)
- starttime_ap = datetime.datetime.strptime(STD_ap[0], "%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 database.queryTabel('flightinfo{}'.format(nowDayStr), '非航前预计到达', "航班编号 ='%s'"%k)[0][0] != "":
- eta_str = database.queryTabel('flightinfo{}'.format(nowDayStr), '非航前预计到达', "航班编号 ='%s'" % k)[0][0]
- starttime = datetime.datetime.strptime(eta_str, "%Y-%m-%d %H:%M:%S") - datetime.timedelta(minutes=15)
- if str(database.queryTabel('flightinfo{}'.format(nowDayStr), '维修状态', "航班编号='%s'" % k)[0][0]) >= "8":
- endtime = database.queryTabel('flightinfo{}'.format(nowDayStr), '维修状态时间', "航班编号='%s'" % k)[0][0]
- 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 database.queryTabel('flightinfo{}'.format(nowDayStr), '非航前预计到达', "航班编号 ='%s'"%k)[0][0] != "":
- eta_str=database.queryTabel('flightinfo{}'.format(nowDayStr), '非航前预计到达', "航班编号 ='%s'"%k)[0][0]
- starttime = datetime.datetime.strptime(eta_str, "%Y-%m-%d %H:%M:%S") - datetime.timedelta(minutes=15)
- if "[实]" in str(database.queryTabel('flightinfo{}'.format(nowDayStr), '非航前预计起飞', "航班编号='%s'" % k)[0][0]):
- #print(flight_date)
- #print(endtime_str)
- endtime_str = database.queryTabel('flightinfo{}'.format(nowDayStr), '非航前预计起飞', "航班编号='%s'" % k)[0][0]
- #print(flight_date.split("-")[0])
- #print(endtime_str.split("]")[1])
- endtime_str1 =flight_date.split("-")[0] + "/" + endtime_str.split("]")[1]
- endtime = datetime.datetime.strptime(endtime_str1, "%Y/%m/%d %H:%M")
- 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 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('flightinfo{}'.format(nowDayStr), '航班编号', "二送人员 like '%{}%'".format(worker))
- ECSJ_laod_ids_arr = []
- if len(ECCJ_laod_ids) != 0:
- for j in ECCJ_laod_ids:
- ECSJ_laod_ids_arr.append(j[0])
- if len(ECSJ_laod_ids_arr) != 0:
- for k in ECSJ_laod_ids_arr:
- TYPE = database.queryTabel('flightinfo{}'.format(nowDayStr), '航班类型', "航班编号 ='%s'" % k)[0][0]
- # TYPE = a[0] if len(a) !=0 else ""
- acno = database.queryTabel('flightinfo{}'.format(nowDayStr), '机号', "航班编号 ='%s'" % k)[0][0]
- # acno = a[0] if len(a) !=0 else ""
- bay = database.queryTabel('flightinfo{}'.format(nowDayStr), '非航前进港机位', "航班编号 ='%s'" % k)[0][0]
- bay1 = database.queryTabel('flightinfo{}'.format(nowDayStr), '航前离港机位', "航班编号 ='%s'" % k)[0][0]
- # bay = a[0] if len(a) !=0 else ""
- flight_id = database.queryTabel('flightinfo{}'.format(nowDayStr), '航班编号', "航班编号 ='%s'" % k)[0][0]
- flight_id_1 = str(str(flight_id)) + str("-1") # 接机保障标志
- flight_id_2 = str(str(flight_id)) + str("-2") # 接机保障标志
- # print(flight_id_1)
- # flight_id = a[0] if len(a) !=0 else ""
- flight_date = database.queryTabel('flightinfo{}'.format(nowDayStr), '航班日期', "航班编号 ='%s'" % k)[0][0]
- # flight_date = a[0] if len(a) !=0 else ""
- if TYPE == "短停" and database.queryTabel('flightinfo{}'.format(nowDayStr), '非航前预计起飞', "航班编号 ='%s'" % k)[0][0] != "":
- if "实" not in str(database.queryTabel('flightinfo{}'.format(nowDayStr), '非航前预计起飞', "航班编号 ='%s'" % k)[0][0]):
- starttime_str = database.queryTabel('flightinfo{}'.format(nowDayStr), '非航前预计起飞', "航班编号='%s'" % k)[0][0]
- starttime_str1 = flight_date.split("-")[0] + "/" + starttime_str.split("]")[1]
- starttime = datetime.datetime.strptime(starttime_str1, "%Y/%m/%d %H:%M")-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 "实" in str(database.queryTabel('flightinfo{}'.format(nowDayStr), '非航前预计起飞', "航班编号 ='%s'" % k)[0][0]):
- endtime_str = database.queryTabel('flightinfo{}'.format(nowDayStr), '非航前预计起飞', "航班编号='%s'" % k)[0][0]
- endtime_str1 = flight_date.split("-")[0] + "/" + endtime_str.split("]")[1]
- endtime = datetime.datetime.strptime(endtime_str1, "%Y/%m/%d %H:%M")
- starttime = datetime.datetime.strptime(endtime_str1, "%Y/%m/%d %H:%M") - 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 database.queryTabel('flightinfo{}'.format(nowDayStr), '非航前预计起飞', "航班编号 ='%s'" % k)[0][0] != "":
- if "实" not in str(database.queryTabel('flightinfo{}'.format(nowDayStr), '非航前预计起飞', "航班编号 ='%s'" % k)[0][0]):
- starttime_str = database.queryTabel('flightinfo{}'.format(nowDayStr), '非航前预计起飞', "航班编号='%s'" % k)[0][0]
- starttime_str1 = flight_date.split("-")[0] + "/" + starttime_str.split("]")[1]
- starttime = datetime.datetime.strptime(starttime_str1, "%Y/%m/%d %H:%M")-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 "实" in str(database.queryTabel('flightinfo{}'.format(nowDayStr), '非航前预计起飞', "航班编号 ='%s'" % k)[0][0]):
- endtime_str = database.queryTabel('flightinfo{}'.format(nowDayStr), '非航前预计起飞', "航班编号='%s'" % k)[0][0]
- endtime_str1 = flight_date.split("-")[0] + "/" + endtime_str.split("]")[1]
- endtime = datetime.datetime.strptime(endtime_str1, "%Y/%m/%d %H:%M")
- starttime = datetime.datetime.strptime(endtime_str1, "%Y/%m/%d %H:%M") - 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 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('flightinfo{}'.format(nowDay), '航班编号',"维修人员 like '%{}%'".format(worker))
- worker_laod_ids_twoday_arr = [] # 两天的量
- if 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('flightinfo{}'.format(nowDay_1), '航班编号',"维修人员 like '%{}%'".format(worker))
- if 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('flightinfo{}'.format(nowDay), '航班编号', "放行人员 like '%{}%'".format(worker))
- if 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('flightinfo{}'.format(nowDay_1), '航班编号',"放行人员 like '%{}%'".format(worker))
- if 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('flightinfo{}'.format(nowDay), '航班编号', "二送人员 like '%{}%'".format(worker))
- if 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('flightinfo{}'.format(nowDay_1), '航班编号',"二送人员 like '%{}%'".format(worker))
- if 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:
- dingding_alert(traceback.format_exc())
- def initAuthority(database:flightDB):
- try:
- fdb = database
- primaryKey = 'INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL'
- labelKey = ['登录名', '密码', '权限', '使用人']
- dic = {}
- for key in labelKey:
- dic[key] = 'text not null'
- fdb.initTable('logintable', 'ID', primaryKey, dic)
- except Exception:
- dingding_alert(traceback.format_exc())
- def insertDataToAuthority(database:flightDB):
- try:
- dataDic = {}
- dataDic['登录名'] = 'admin'
- dataDic['密码'] = 'admin123'
- dataDic['权限'] = '0'
- dataDic['使用人'] = '开发'
- rest = database.queryTabel('logintable', '*', "登录名='admin'")
- #print(rest)
- if len(rest) == 0:
- database.insertData('logintable', dataDic)
- except Exception:
- dingding_alert(traceback.format_exc())
- 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:
- dingding_alert(traceback.format_exc())
- res = {"返回值": "fail"}
- database.FunctionCommit()
- return res
- 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:
- dingding_alert(traceback.format_exc())
- def update_Pglist(database:flightDB,datatime: str,bc:str,jsonData):
- try:
- nowDayStr = datatime
- newdic={}
- database.deleteSingledata("pglist{}".format(nowDayStr), "班次='%s'" % bc)
- names=[]
- 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]
- database.lazyInsertData("pglist{}".format(nowDayStr),newdic)
- names = row["NAME"]
- database.FunctionCommit()
- except Exception:
- database.FunctionCommit()
- dingding_alert(traceback.format_exc())
- 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:
- dingding_alert(traceback.format_exc())
- 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:
- dingding_alert(traceback.format_exc())
- 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)
- except Exception:
- dingding_alert(traceback.format_exc())
- print(datetime.datetime.now(),"[数据中心]拨号失败")
- except Exception:
- print(traceback.format_exc())
- dingding_alert(traceback.format_exc())
- 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:
- fdb.FunctionCommit()
- dingding_alert(traceback.format_exc())
- 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 = ""
- ESempNos = ""
- FXempNos = ""
- WX = ""
- ES = ""
- FX = ""
- wxkey = ["工1", "工2", "工3/送1", "工4/送2"]
- eskey = [ "工3/送1", "工4/送2"]
- 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])
- elif len(aa) == 0:
- faillist.append(dict[i])
- if dict[i] != "" and WX == "":
- WX=dict[i]
- elif dict[i] != "" and WX != "":
- WX=WX+","+dict[i]
- for i in eskey:
- 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 ESempNos == "":
- if aa[0][0] !="":
- ESempNos = str(aa[0][0])
- else:
- faillist.append(dict[i])
- elif len(aa) != 0 and ESempNos != "":
- if aa[0][0] != "":
- ESempNos =ESempNos+","+str(aa[0][0])
- else:
- faillist.append(dict[i])
- elif len(aa) == 0:
- faillist.append(dict[i])
- if dict[i] != "" and ES == "":
- ES=dict[i]
- elif dict[i] != "" and ES != "":
- ES=ES+","+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 =="" and FXempNos=="" and ESempNos=="":
- dict1={"code":"fail","WXempNos":"","FXempNos":"","ESempNos":"","faillist":faillist,"date":date_str,"bc":bc,"WX":WX,"FX":FX,"ES":ES}
- elif faillist=="":
- dict1 = {"code": "ok", "WXempNos": WXempNos, "FXempNos": FXempNos, "ESempNos": ESempNos, "faillist":faillist,"date":date_str,"bc":bc,"WX":WX,"FX":FX,"ES":ES}
- elif faillist !="":
- dict1 = {"code": "justok", "WXempNos": WXempNos, "FXempNos": FXempNos, "ESempNos": ESempNos, "faillist":faillist,"date":date_str,"bc":bc,"WX":WX,"FX":FX,"ES":ES}
- return dict1
- except Exception:
- dingding_alert(traceback.format_exc())
- 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:
- dingding_alert(traceback.format_exc())
- 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:
- dingding_alert(traceback.format_exc())
- database.FunctionCommit()
- def getFlightData(database:flightDB,*args):
- try:
- nowDay = datetime.datetime.now()
- nowDayStr = nowDay.strftime("%Y%m%d")
- if args!=():
- flightData = database.getAlldata('flightinfo{}'.format(args[0]))
- else:
- flightData = database.getAlldata('flightinfo{}'.format(nowDayStr))
- return flightData
- except Exception:
- dingding_alert(traceback.format_exc())
- def getSortFlightdata(fdb:flightDB, datatime:str,tablename:str):
- try:
- nowDayStr = datatime
- sortData = fdb.sortTable('{}{}'.format(tablename,nowDayStr), '级别,保障时间','asc')
- return sortData
- except Exception:
- dingding_alert(traceback.format_exc())
- if __name__ == '__main__':
- fdb = flightDB(host=host,
- port=port,
- user=user,
- password=password,
- database=databaseflightDB4
- )
- loginDB = flightDB(host=host,
- port=port,
- user=user,
- password=password,
- database=databaseflightDB4
- )
|