import collections
import re
if 82 - 82: Iii1i
from flask_wtf . csrf import CSRFError , generate_csrf
if 87 - 87: Ii % i1i1i1111I . Oo / OooOoo * I1Ii1I1 - I1I
import binascii
import http
import json
import threading
import time
from collections import deque
from datetime import datetime
if 81 - 81: i1 + ooOOO / oOo0O00 * i1iiIII111 * IiIIii11Ii
from flask import Blueprint , render_template , request , g
from sqlalchemy import text
if 84 - 84: ooo000 - Ooo0Ooo + iI1iII1I1I1i . IIiIIiIi11I1
from blueprints . wgcomm_pri import uploadSingleConfigure , WGControllerPri2023
if 98 - 98: I11iiIi11i1I % oOO
from exts import db
from decorators import login_required
from forms . wgcommform import AddDepartmentForm
from models . iccard import *
from vwAppConfig import WGTools
from vwAppConfigParam import vwAppConfigParam
import vwAppConfig
from datetime import timedelta
from datetime import datetime
if 31 - 31: i1I
__all__ = [
 "bp" ,
 "checkConnectedSingle" ,

# "check_network_address",
"console_getcsrf" ,

"getNewSwipeUserInfo" ,
 "getswipeSelected" ,
 "getswipeSingle" ,
 "web_console_searchcontroller" ,
 "web_console_monitorInfo" ,
 "web_console_swipe_list" ,
 "web_console_adjusttime" ,
 "web_console_checkcontroller" ,
 "web_console_remoteopendoor" ,
 "web_console_swipe_getselected" ,
 "web_edit_netconfigure" ,
 "WGControllerCenter2023" ,
 "web_edit_wifinetconfigure" ,

 "sendByHttp" ,
 "sendByHttpWithMsg" ,

# iI1iI11Ii111
# oOo0O00 * ooo000
"web_console_onekey_selected" ,
 "web_extern_console_location_query" ,
 "web_extern_console_location_query_realize" ,

"getReacordFloorDescription" ,

 ]
if 86 - 86: iI1iII1I1I1i + iI1iII1I1I1i % i1 . i1i1i1111I / Iii1i + i1I
bp = Blueprint ( 'wgcomm_console' , __name__ , url_prefix = '/' )
if 71 - 71: i1 % Iii1i
if 10 - 10: Ii * i1i1i1111I / i1iiIII111 . I11iiIi11i1I . ooOOO / IIiIIiIi11I1
class WGControllerCenter2023 :
 def __init__ ( self ) :
  if 28 - 28: i1I / IIiIIiIi11I1 % IIiIIiIi11I1 / I1I - Oo
  if 13 - 13: IiIIii11Ii - Ooo0Ooo - Ii - Oo * ooo000 . i1iiIII111
  if 14 - 14: I1I / oOO
  self . getswipeSNOK = [ ]
  self . getswipeSNFailed = [ ]
  self . getswipeSN = [ ]
  self . getswipeSNRecordNum = [ ]
  if 58 - 58: I1Ii1I1 - ooOOO
  self . getswipeSNConnectedOK = [ ]
  self . getswipeIdConnectedOK = [ ]
  if 60 - 60: iI1iII1I1I1i . oOO
  if 13 - 13: oOO
  if 2 - 2: i1
  if 22 - 22: IIiIIiIi11I1 - ooo000 / I1Ii1I1 . ooo000
  self . arrswipe = None
  self . arrswipe = deque ( )
  self . recvsn = [ ]
  if 1 - 1: iI1iII1I1I1i + Ooo0Ooo + oOO * IIiIIiIi11I1
  if 20 - 20: I1I + Ii
  self . doorIDOperateAll = [ ]
  self . doorIDOperateOK = [ ]
  self . doorIDOperateFailed = [ ]
  self . doorIDOperateInfo = [ ]
  if 75 - 75: Ii % i1iiIII111 * Ii . IIiIIiIi11I1 % I11iiIi11i1I % I1Ii1I1
  if 8 - 8: I1Ii1I1 . iI1iI11Ii111 . i1 . Oo - i1I
  if 32 - 32: Ii % i1i1i1111I % i1I - I11iiIi11i1I % i1iiIII111
  if 34 - 34: i1iiIII111 * i1
  if 34 - 34: oOo0O00 / i1iiIII111 - Iii1i . iI1iII1I1I1i
  if 80 - 80: i1i1i1111I . I1I % ooOOO % IiIIii11Ii / i1i1i1111I
  if 32 - 32: I1Ii1I1 + oOO - oOo0O00
  if 79 - 79: Iii1i % oOO * Oo + ooOOO / Oo . oOO
  if 20 - 20: iI1iI11Ii111 + i1iiIII111 / I1I
@ bp . route ( '/console_swipe_list' , methods = [ 'GET' , 'POST' ] )
@ login_required
def web_console_swipe_list ( ) :
 if 88 - 88: I11iiIi11i1I + ooOOO - i1i1i1111I . Ooo0Ooo * Ii + Iii1i
 if 43 - 43: ooOOO * I1Ii1I1
 if 95 - 95: Ooo0Ooo % Iii1i % i1i1i1111I . OooOoo
 if 70 - 70: IiIIii11Ii
 if 75 - 75: Ooo0Ooo / Ii / IiIIii11Ii + IiIIii11Ii . I1I
 if 88 - 88: Oo * IiIIii11Ii
 if 100 - 100: iI1iI11Ii111 - OooOoo * I1Ii1I1 / Ooo0Ooo / Iii1i
 if 23 - 23: Ooo0Ooo + i1 * I1Ii1I1 + Oo * Ii - IIiIIiIi11I1
 if 29 - 29: IiIIii11Ii - oOo0O00
 if 30 - 30: I1I . ooo000
 if 43 - 43: ooOOO . I11iiIi11i1I + ooo000
 if 87 - 87: Iii1i + ooOOO . i1I / Ii + Oo
 if 77 - 77: i1iiIII111 + iI1iI11Ii111 - Oo % ooo000
 if 74 - 74: Ii + Ooo0Ooo
 if 1 - 1: I1I % Ooo0Ooo + i1iiIII111 . i1iiIII111 % Oo
 if 93 - 93: oOo0O00 % Ooo0Ooo * i1iiIII111
 if 52 - 52: oOO + I1I / ooo000 - I1Ii1I1 * i1I % oOo0O00
 if 52 - 52: oOo0O00 . I1I + i1I - i1iiIII111 % iI1iII1I1I1i
 if 57 - 57: I1I * IIiIIiIi11I1 % I1Ii1I1 * i1i1i1111I
 Oo0 = db . session . query ( TBDoor . f_DoorID , TBDoor . f_DoorName , TBDoor . f_DoorNO , TBController . f_ControllerSN ,
 ) . join ( TBController , TBController . f_ControllerID == TBDoor . f_ControllerID ) . order_by (
 TBDoor . f_DoorName )
 ooooo = Oo0 . all ( )
 if 61 - 61: iI1iII1I1I1i . i1I - ooo000 / ooo000 - i1
 if 19 - 19: Iii1i * Ooo0Ooo . I1Ii1I1 / I11iiIi11i1I * Ii - oOO
 if 32 - 32: iI1iII1I1I1i
 if 18 - 18: I11iiIi11i1I * iI1iI11Ii111 % iI1iII1I1I1i + iI1iI11Ii111
 if 93 - 93: oOO - I1Ii1I1 - IIiIIiIi11I1 * ooOOO - i1
 if 82 - 82: IIiIIiIi11I1 % i1 * ooOOO
 oOoOOO0ooooO0 = {

 "objlistDoor" : ooooo ,
 "deleteUrl" : "/user_del" ,
 "losecardUrl" : "/user_losecard"
 }
 return render_template ( "wgcomm/console-getswipe.html" , ** oOoOOO0ooooO0 )
 if 20 - 20: i1i1i1111I / Ooo0Ooo - oOO + Ooo0Ooo - I1I . Ooo0Ooo
 if 50 - 50: Iii1i * ooo000 % Iii1i - oOo0O00 + ooo000
@ bp . route ( '/console_checkcontroller' , methods = [ 'POST' ] )
@ login_required
def web_console_checkcontroller ( ) :
 ooOOOoOO0 = vwAppConfig . parseInt ( request . form . get ( "sn" ) )
 oo00oO000 = vwAppConfig . parseInt ( request . form . get ( "doorno" ) )
 iIiIiiIIIiII = request . form . get ( "doorname" )
 OOOoOo = [ 0 ] * 1024
 I1i1i = [ 0 ] * 1024
 ii1ii = (
 '20' , '58' , 'B4' , '94' , '820000FFFFFFFF01' , '820000FFFFFFFF02' , '820000FFFFFFFF03' , '820000FFFFFFFF04' ,
 'F40000FFFFFFFF55aaaa55f101009a0100ec0100f90100ef01002d0000' )
 if 17 - 17: Oo * I1I % ooOOO - IiIIii11Ii
 iIi1 = 0
 if 4 - 4: ooo000 % I1I - i1i1i1111I
 if 76 - 76: i1 * oOo0O00 . iI1iI11Ii111 * i1I . IiIIii11Ii . oOO
 if 55 - 55: i1i1i1111I + i1iiIII111 % Ooo0Ooo . Oo - IiIIii11Ii - iI1iII1I1I1i
 if 91 - 91: I1Ii1I1 - I11iiIi11i1I
 if 84 - 84: oOO % iI1iII1I1I1i - Ooo0Ooo
 if 94 - 94: i1iiIII111 + i1i1i1111I / iI1iII1I1I1i + iI1iII1I1I1i / i1I
 if 79 - 79: i1iiIII111 - IIiIIiIi11I1 . I1Ii1I1 + I1I - ooOOO + i1iiIII111
 if 36 - 36: ooOOO * Iii1i % I1I % i1 . Ooo0Ooo
 if 63 - 63: IIiIIiIi11I1 / IIiIIiIi11I1 * Iii1i - oOo0O00 . i1
 if 52 - 52: oOo0O00 / i1I * IIiIIiIi11I1 + I11iiIi11i1I % Ooo0Ooo + oOO
 if 43 - 43: iI1iII1I1I1i * oOo0O00 + ooOOO
 if 30 - 30: I1I
 if 41 - 41: oOO
 if 98 - 98: I1I / IIiIIiIi11I1 / i1I + iI1iI11Ii111 % Oo + I1I
 if 38 - 38: I1Ii1I1 + oOo0O00
 if 2 - 2: OooOoo % Ii + oOO . OooOoo + IIiIIiIi11I1 * Oo
 if 2 - 2: IIiIIiIi11I1 + iI1iII1I1I1i - I1Ii1I1 + ooOOO . IIiIIiIi11I1
 if 15 - 15: ooo000
 if 63 - 63: i1I
 if 81 - 81: OooOoo . i1I / i1i1i1111I + Oo / Ooo0Ooo % iI1iI11Ii111
 if 77 - 77: I11iiIi11i1I / iI1iII1I1I1i - oOo0O00 - Ooo0Ooo % oOo0O00
 if 73 - 73: iI1iI11Ii111 . Oo * I1I / i1i1i1111I + I1Ii1I1
 if 31 - 31: i1i1i1111I % I1Ii1I1
 if 1 - 1: iI1iI11Ii111 - oOo0O00 - i1 . oOo0O00
 if 91 - 91: iI1iII1I1I1i * i1 . ooOOO
 if 81 - 81: I1I * Oo - i1 % OooOoo * ooOOO
 if 19 - 19: Ii
 I11IIiI1I1I = {
 "jsonrpc" : "2.0" ,
 "method" : "Primit64ByteCommand" ,
 "params" : [ { 'ControllerSN' : ooOOOoOO0 ,
 'CommandPacket' : WGTools . getarrStringWithsplitDou ( ii1ii )
 } ] ,
 "id" : "1005"
 }
 Oo0oO0O0O = sendByHttpWithMsg ( I11IIiI1I1I )
 if vwAppConfig . successIsTrue ( Oo0oO0O0O ) :
  if 4 - 4: i1
  if 87 - 87: Iii1i % ooOOO * Ii % IIiIIiIi11I1 / I11iiIi11i1I
  O0O0 = Oo0oO0O0O [ "ReturnPacket" ]
  I1i1i = bytearray ( binascii . unhexlify ( O0O0 . replace ( " " , "" ) ) )
  if 63 - 63: IIiIIiIi11I1
 else :
  vwAppConfig . vwlog ( '{}--{}[{}]' . format ( g . user . f_OperatorName ,
 "{}-Check Controllers" . format ( iIiIiiIIIiII ) ,
 "Communication Failed-2" ) )
  return "Communication Failed -2"
 if I1i1i [ 1 ] == 0x20 :
  OO0ooOO = I1i1i [ 0 : 64 ]
  if 89 - 89: ooo000 + Ii % i1i1i1111I - i1iiIII111
  OO0 = (
 "255.255.255.255" , 60000 )
  if 1 - 1: iI1iII1I1I1i % Ii - I11iiIi11i1I / iI1iI11Ii111 + iI1iII1I1I1i - Ii
  if 27 - 27: OooOoo % iI1iII1I1I1i + IIiIIiIi11I1
  if 16 - 16: iI1iI11Ii111
  if 31 - 31: oOo0O00 / Iii1i % Ooo0Ooo % i1 . iI1iII1I1I1i . Oo
  II11IIIIiI1iI = "OnLine"
  if I1i1i [ 64 * ( 4 + oo00oO000 - 1 ) + 9 ] == 1 :
   II11IIIIiI1iI = 'NormalOpen'
  if I1i1i [ 64 * ( 4 + oo00oO000 - 1 ) + 9 ] == 2 :
   II11IIIIiI1iI = 'NormalClosed'
  iII = I1i1i [ 64 * ( 4 + oo00oO000 - 1 ) + 10 ]
  try :
   OO = "20{0:0>2X}-{1:0>2X}-{2:0>2X} {3:0>2X}:{4:0>2X}:{5:0>2X}" . format ( OO0ooOO [ 51 ] , OO0ooOO [ 52 ] , OO0ooOO [ 53 ] ,
 OO0ooOO [ 37 ] , OO0ooOO [ 38 ] , OO0ooOO [ 39 ] )
   OO0O = datetime . strptime ( OO , "%Y-%m-%d %H:%M:%S" )
  except Exception as O0OOOo0o0O :
   OO0O = datetime . strptime ( "2000-01-19 19:19:19" ,
 "%Y-%m-%d %H:%M:%S" )
   if 30 - 30: i1iiIII111 . IIiIIiIi11I1 * ooo000 * ooo000
  Iioo0Oo0oO0 = 0
  if 20 - 20: IIiIIiIi11I1
  O0O0oO00OO0 = ( 200 * 1024 )
  ooo00Oo0oOo = WGTools . getLongByByte ( I1i1i , 64 * 2 + 8 , 4 )
  I1Ii = WGTools . getLongByByte ( I1i1i , 8 , 4 )
  if ( ( ooo00Oo0oOo == 0 ) or (
 I1Ii >= ( ooo00Oo0oOo + O0O0oO00OO0 - 4096 / 16 - 1 ) )
 or ( I1Ii < ooo00Oo0oOo ) ) :
   if I1Ii > 0 :
    if I1Ii >= O0O0oO00OO0 :
     Iioo0Oo0oO0 = O0O0oO00OO0 - 4096 / 16 + (
 I1Ii % ( 4096 / 16 ) )
    else :
     Iioo0Oo0oO0 = I1Ii
   else :
    pass
  else :
   Iioo0Oo0oO0 = I1Ii - ooo00Oo0oOo
  if Iioo0Oo0oO0 < 0 :
   Iioo0Oo0oO0 = 0
  OO = "{0:0>2X}{1:0>2X}-{2:0>2X}-{3:0>2X}" . format ( I1i1i [ 64 * 3 + 28 ] ,
 I1i1i [ 64 * 3 + 29 ] , I1i1i [ 64 * 3 + 30 ] ,
 I1i1i [ 64 * 3 + 31 ] )
  II = "{0:0>2X}" . format ( I1i1i [ 64 * 3 + 20 ] )
  for Ooo0O00o in range ( 5 ) :
   II += "-{0:0>2X}" . format ( I1i1i [ 64 * 3 + 21 + Ooo0O00o ] )
   if 22 - 22: iI1iI11Ii111 . ooo000
  IiiI1III1iI = "V{}.{}[{}]" . format ( I1i1i [ 64 * 3 + 26 ] - ( I1i1i [ 64 * 3 + 26 ] >> 4 ) * 6 ,
 I1i1i [ 64 * 3 + 27 ] - ( I1i1i [ 64 * 3 + 27 ] >> 4 ) * 6 ,
 OO )
  if 37 - 37: I1Ii1I1 % iI1iII1I1I1i . i1I + Ooo0Ooo + ooOOO * iI1iII1I1I1i
  if 39 - 39: IIiIIiIi11I1 - Oo
  II1I1Ii1IIi = "{}.{}.{}.{}" . format ( I1i1i [ 64 * 3 + 8 ] , I1i1i [ 64 * 3 + 9 ] , I1i1i [ 64 * 3 + 10 ] ,
 I1i1i [ 64 * 3 + 11 ] )
  if II1I1Ii1IIi in ( "192.168.0.0" , "192.168.168.0" , "0.0.0.0" ) :
   II1I1Ii1IIi = ""
   if 73 - 73: Ii * IIiIIiIi11I1 % i1 + IiIIii11Ii % I1I / iI1iI11Ii111
  oo00oOOo0O0o = ( {
 "Door Name" : iIiIiiIIIiII ,
  "Door Status" : 'Closed' if OO0ooOO [ 28 + oo00oO000 - 1 ] == 0 else 'Open' ,

  "DoorControlMode" : II11IIIIiI1iI ,
  "OpenDelay(seconds)" : iII ,
  "Controller SN" : ooOOOoOO0 ,
  "IP" : II1I1Ii1IIi ,
  "--Records" : Iioo0Oo0oO0 ,
  "--Privilege" : WGTools . getLongByByte ( I1i1i , 64 + 8 , 4 ) ,

  "--Time" : OO0O . strftime ( "%Y-%m-%d %H:%M:%S" ) ,
  "--Driver Version" : IiiI1III1iI ,
  "--MAC" : II
  } )
  I1Iiii1 = ''
  OOOO = ''
  if 96 - 96: iI1iII1I1I1i . OooOoo . i1
  if 87 - 87: ooo000 * IiIIii11Ii % ooo000 . ooOOO . Oo % iI1iII1I1I1i
  if 48 - 48: ooOOO * ooo000 % IiIIii11Ii * i1 . Iii1i - iI1iI11Ii111
  I1Iiii1 += "{}:\t{}\r\n" . format ( "Door Name" , iIiIiiIIIiII )
  OOOO += "{}-" . format ( iIiIiiIIIiII )
  I1Iiii1 += "{}:\t{}\r\n" . format ( "Door Status" , 'Closed' if OO0ooOO [ 28 + oo00oO000 - 1 ] == 0 else 'Open' )
  OOOO += "{}-" . format ( 'Closed' if OO0ooOO [ 28 + oo00oO000 - 1 ] == 0 else 'Open' )
  I1Iiii1 += "{}:\t{}\r\n" . format ( "DoorControlMode" , II11IIIIiI1iI )
  OOOO += "{}-" . format ( II11IIIIiI1iI )
  I1Iiii1 += "{}:\t{}\r\n" . format ( "OpenDelay(seconds)" , iII )
  OOOO += "{}-" . format ( iII )
  I1Iiii1 += "{}:\t{}\r\n" . format ( "Controller SN" , ooOOOoOO0 )
  OOOO += "{}-" . format ( ooOOOoOO0 )
  I1Iiii1 += "{}:\t{}\r\n" . format ( "IP" , II1I1Ii1IIi )
  OOOO += "{}-" . format ( II1I1Ii1IIi )
  I1Iiii1 += "{}:\t{}\r\n" . format ( "--Records" , int ( Iioo0Oo0oO0 ) )
  OOOO += "{}-" . format ( int ( Iioo0Oo0oO0 ) )
  I1Iiii1 += "{}:\t{}\r\n" . format ( "--Privilege" , WGTools . getLongByByte ( I1i1i , 64 + 8 , 4 ) )
  OOOO += "{}-" . format ( WGTools . getLongByByte ( I1i1i , 64 + 8 , 4 ) )
  I1Iiii1 += "{}:\t{}\r\n" . format ( "--Time" , OO0O . strftime ( "%Y-%m-%d %H:%M:%S" ) )
  OOOO += "{}-" . format ( OO0O . strftime ( "%Y-%m-%d %H:%M:%S" ) )
  I1Iiii1 += "{}:\t{}\r\n" . format ( "Driver Version" , IiiI1III1iI )
  OOOO += "{}-" . format ( IiiI1III1iI )
  I1Iiii1 += "{}:\t{}\r\n" . format ( "--MAC" , II )
  OOOO += "{}-" . format ( II )
  if 72 - 72: i1 % i1i1i1111I * iI1iII1I1I1i
  if 90 - 90: Ooo0Ooo * OooOoo . Ii
  Iiii1iIII = WGTools . getLongByByte ( I1i1i , 64 * 8 + 8 , 1 )
  if Iiii1iIII == 1 :
   Iiii1iIII = WGTools . getLongByByte ( I1i1i , 64 * 8 + 8 + 6 , 1 )
   if Iiii1iIII == 0x87 :
    I1Iiii1 += "{}:\t{}\r\n" . format ( "--QRCode" , "Enable QR code transparent transmission, allowing both card swiping + QR code scanning" )
    OOOO += "{}-" . format ( "Enable QR code transparent transmission, allowing both card swiping + QR code scanning" )
   elif Iiii1iIII == 0x81 :
    I1Iiii1 += "{}:\t{}\r\n" . format ( "--QRCode" , "Enable QR code transparent transmission" )
    OOOO += "{}-" . format ( "Enable QR code transparent transmission" )
   elif Iiii1iIII != 0 :
    I1Iiii1 += "{}:\t{}\r\n" . format ( "--QRCode" , "{0:0>2X}" . format ( Iiii1iIII ) )
    OOOO += "{}{}-" . format ( "QRCode" , "{0:0>2X}" . format ( Iiii1iIII ) )
    if 86 - 86: oOO * i1I - OooOoo * Oo - iI1iI11Ii111 - Ooo0Ooo
   Iiii1iIII = WGTools . getLongByByte ( I1i1i , 64 * 8 + 8 + 6 + 3 , 1 )
   if Iiii1iIII == 0xa5 :
    I1Iiii1 += "{}:\t{}\r\n" . format ( "--Scheduled upload" , "Card swipe upload 192 bytes (0x26)" )
    OOOO += "{}-" . format ( "Card swipe upload 192 bytes (0x26)" )
    if 36 - 36: IiIIii11Ii
   Iiii1iIII = WGTools . getLongByByte ( I1i1i , 64 * 8 + 8 + 6 + 3 * 2 , 1 )
   if Iiii1iIII > 0 :
    if ( WGTools . getLongByByte ( I1i1i , 64 * 8 + 8 + 6 + 3 * 3 , 1 ) & ( 1 << 3 ) ) > 0 :
     IiIi1I11I = "115200"
    else :
     IiIi1I11I = "9600"
    I1Iiii1 += "{}:\t{}\r\n" . format ( "--Serial port" , "" + IiIi1I11I )
    OOOO += "{}-" . format ( "Serial port enabled" )
    I1Iiii1 += "{}:\t{}\r\n" . format ( "--Modbus address" , WGTools . getLongByByte ( I1i1i , 64 * 8 + 8 + 6 + 3 * 4 , 1 ) )
    if 8 - 8: I1I + iI1iII1I1I1i . I1I . iI1iI11Ii111
   Iiii1iIII = WGTools . getLongByByte ( I1i1i , 64 * 8 + 8 + 6 + 3 * 5 , 1 )
   if Iiii1iIII > 0 :
    I1Iiii1 += "{}:\t{}\r\n" . format ( "--Event logging" , "Enabled logging of door contact/button alarm events" )
    OOOO += "{}-" . format ( "Enabled logging of door contact/button alarm events" )
  vwAppConfig . vwlog ( '{}--{}[{}]' . format ( g . user . f_OperatorName ,
 "{}-Check Controllers" . format ( iIiIiiIIIiII ) ,
 I1Iiii1 ) )
  return I1Iiii1
 vwAppConfig . vwlog ( '{}--{}[{}]' . format ( g . user . f_OperatorName ,
 "{}-Check Controllers" . format ( iIiIiiIIIiII ) , "Communication Failed-1" ) )
 return "Communication Failed-1"
 if 3 - 3: i1iiIII111
 if 32 - 32: I1I % i1i1i1111I
 if 98 - 98: i1I / i1 / OooOoo + Iii1i % ooOOO
def iIii1iiiIi ( sn , strCommCommand , xid ) :
 oOoo = 0x37
 if type ( strCommCommand ) is str :
  ooOOO00oO0o0o = bytearray ( binascii . unhexlify ( strCommCommand . replace ( " " , "" ) ) )
 else :
  ooOOO00oO0o0o = bytearray ( binascii . unhexlify ( strCommCommand ) )
  if 94 - 94: oOo0O00 % Iii1i - IIiIIiIi11I1 . Ooo0Ooo - Oo * IIiIIiIi11I1
 if ( len ( ooOOO00oO0o0o ) < 64 ) :
  if 92 - 92: i1i1i1111I . iI1iI11Ii111 + i1i1i1111I / OooOoo
  O00OO00O = [ 0 ] * 64
  for i111iIIiIIII in range ( 0 , len ( ooOOO00oO0o0o ) ) :
   O00OO00O [ i111iIIiIIII ] = ooOOO00oO0o0o [ i111iIIiIIII ]
  ooOOO00oO0o0o = O00OO00O
 ooOOO00oO0o0o [ 0 ] = oOoo
 vwAppConfig . longToByte ( sn , ooOOO00oO0o0o , 4 , 4 )
 vwAppConfig . longToByte ( xid , ooOOO00oO0o0o , 40 , 4 )
 return ooOOO00oO0o0o
 if 54 - 54: i1iiIII111 . i1iiIII111 - ooOOO * OooOoo + IIiIIiIi11I1 * i1i1i1111I
 if 12 - 12: i1i1i1111I
@ bp . route ( '/console_adjusttime' , methods = [ 'POST' ] )
@ login_required
def web_console_adjusttime ( ) :
 ooOOOoOO0 = vwAppConfig . parseInt ( request . form . get ( "sn" ) )
 o0Oo0o000O0oO = request . form . get ( "doorname" )
 I11IIiI1I1I = ( {
 "jsonrpc" : "2.0" ,
 "method" : "AdjustTime" ,
 "params" : [ { "ControllerSN" : ooOOOoOO0 } ] ,
 "id" : 1002
 } )
 Oo0oO0O0O = sendByHttp ( I11IIiI1I1I )
 if Oo0oO0O0O == "OK" :
  vwAppConfig . vwlog ( '{}--{}' . format ( g . user . f_OperatorName ,
 "{}-Adjust Time Successfully" . format ( o0Oo0o000O0oO ) ) )
  return "{}-Adjust Time Successfully" . format ( o0Oo0o000O0oO )
 else :
  vwAppConfig . vwlog ( '{}--{}' . format ( g . user . f_OperatorName ,
 "{}-Adjust Time Failed" . format ( o0Oo0o000O0oO ) ) )
  return "{}-Adjust Time Failed" . format ( o0Oo0o000O0oO )
  if 46 - 46: Ii - iI1iI11Ii111 + IiIIii11Ii + i1I . I1I % OooOoo
  if 85 - 85: Oo / oOO + Oo + ooOOO
@ bp . route ( '/console_remoteopendoor' , methods = [ 'POST' ] )
@ login_required
def web_console_remoteopendoor ( ) :
 ooOOOoOO0 = vwAppConfig . parseInt ( request . form . get ( "sn" ) )
 o0Oo0o000O0oO = request . form . get ( "doorname" )
 I11111i111 = vwAppConfig . parseInt ( request . form . get ( "doorno" ) )
 I11IIiI1I1I = ( {
 "jsonrpc" : "2.0" ,
 "method" : "RemoteOpenDoor" ,
 "params" : [ { "ControllerSN" : ooOOOoOO0 , "DoorNO" : I11111i111 } ] ,
 "id" : 1002
 } )
 Oo0oO0O0O = sendByHttp ( I11IIiI1I1I )
 if Oo0oO0O0O == "OK" :
  vwAppConfig . vwlog ( '{}--{}' . format ( g . user . f_OperatorName , "{}-Remote Open Successfully" . format ( o0Oo0o000O0oO )
 ) )
  return "{}-Remote Open Successfully" . format ( o0Oo0o000O0oO )
 else :
  vwAppConfig . vwlog ( '{}--{}' . format ( g . user . f_OperatorName , "{}-Remote Open Failed" . format ( o0Oo0o000O0oO )
 ) )
  return "{}-Remote Open Failed" . format ( o0Oo0o000O0oO )
  if 35 - 35: I1Ii1I1
  if 35 - 35: i1iiIII111 + Iii1i + OooOoo / ooo000 % OooOoo . Iii1i
def sendByHttpWithMsg ( arrinfo , timeoutSec = 3 ) :
 iIIIiII1 = None
 try :
  oo = vwAppConfigParam . server1001_ip
  iiII1II1IIIi = vwAppConfigParam . server1001_webport
  IiI111I1 = http . client . HTTPConnection ( host = oo , port = iiII1II1IIIi , timeout = 3 )
  if 86 - 86: i1 . iI1iI11Ii111 - Ii
  iiiIII = bytes ( json . dumps ( arrinfo , sort_keys = False , indent = 4 ) , encoding = 'utf8' )
  if 16 - 16: IIiIIiIi11I1
  if 96 - 96: OooOoo / oOO - i1 * I11iiIi11i1I
  o0oOoOoO = { "Content-type" : "application/json" , "Accept" : "application/json" }
  IiI111I1 . timeout = timeoutSec
  if 74 - 74: ooo000 % Ooo0Ooo * Oo + ooo000
  IiI111I1 . request ( "POST" , oo , iiiIII , o0oOoOoO )
  I1I1 = IiI111I1 . getresponse ( )
  if 47 - 47: Ooo0Ooo
  i1I1iII1 = I1I1 . read ( )
  if 44 - 44: I1Ii1I1 + i1i1i1111I
  if 66 - 66: I11iiIi11i1I . I1I % IiIIii11Ii + OooOoo * Oo / OooOoo
  if 33 - 33: iI1iI11Ii111 / OooOoo
  IiI111I1 . close ( )
  try :
   if 98 - 98: I1Ii1I1 . IIiIIiIi11I1 * i1I - iI1iII1I1I1i % i1I * iI1iI11Ii111
   if 42 - 42: OooOoo + i1i1i1111I - iI1iII1I1I1i - oOo0O00 * i1I + Ii
   if 46 - 46: oOo0O00 . iI1iII1I1I1i - Ii . oOo0O00 + i1i1i1111I
   if 83 - 83: iI1iI11Ii111
   O00oO00oO0O = json . loads ( i1I1iII1 . decode ( "utf-8" ) )
   iIIIiII1 = O00oO00oO0O [ 'result' ]
   if 65 - 65: iI1iII1I1I1i . Oo
   if 44 - 44: I11iiIi11i1I . I1Ii1I1 * i1 . iI1iII1I1I1i * I11iiIi11i1I - I11iiIi11i1I
   if 79 - 79: IiIIii11Ii + oOo0O00
   if 50 - 50: iI1iI11Ii111 + i1iiIII111 . i1iiIII111 . Oo
   if 72 - 72: oOo0O00 - iI1iI11Ii111 + i1iiIII111 / i1I . OooOoo * IiIIii11Ii
  except Exception as O0OOOo0o0O :
   if 40 - 40: ooo000 * iI1iI11Ii111 / i1i1i1111I * oOO + i1iiIII111 - OooOoo
   if 86 - 86: I11iiIi11i1I * Ooo0Ooo . IiIIii11Ii % IiIIii11Ii . I1Ii1I1 + I1I
   if 44 - 44: i1 / OooOoo / oOo0O00 . Oo
   vwAppConfig . wglog ( O0OOOo0o0O )
   iIIIiII1 = None
   return iIIIiII1
   if 65 - 65: I11iiIi11i1I * i1iiIII111 . OooOoo % ooo000 % OooOoo
   if 21 - 21: iI1iI11Ii111 * I1Ii1I1
  return iIIIiII1
 except Exception as O0OOOo0o0O :
  pass
  print ( O0OOOo0o0O )
  if 93 - 93: Ooo0Ooo . i1 + iI1iI11Ii111 - oOo0O00
  if 97 - 97: i1 - i1 % IIiIIiIi11I1 + IiIIii11Ii / i1I * iI1iII1I1I1i
 return None
 if 60 - 60: I11iiIi11i1I - Ooo0Ooo % I1Ii1I1
 if 26 - 26: ooOOO / IIiIIiIi11I1 . oOO + I11iiIi11i1I . Oo
 if 37 - 37: I1Ii1I1
 if 35 - 35: OooOoo % i1i1i1111I - iI1iII1I1I1i / IiIIii11Ii
 if 4 - 4: ooo000 . IiIIii11Ii % ooo000 / i1i1i1111I
 if 48 - 48: i1iiIII111 . Oo
 if 92 - 92: OooOoo + Ii / IIiIIiIi11I1 + OooOoo * IIiIIiIi11I1 * iI1iII1I1I1i
 if 79 - 79: i1i1i1111I
 if 3 - 3: OooOoo / iI1iI11Ii111 % I11iiIi11i1I
 if 55 - 55: oOo0O00
 if 31 - 31: Ii . Ooo0Ooo / iI1iI11Ii111
 if 59 - 59: Oo
 if 64 - 64: Iii1i % I11iiIi11i1I * i1 % OooOoo * oOo0O00
 if 55 - 55: iI1iI11Ii111
 if 46 - 46: Ooo0Ooo % I1Ii1I1
 if 86 - 86: I11iiIi11i1I . i1i1i1111I + oOO % I11iiIi11i1I % Iii1i % ooo000
 if 61 - 61: ooo000
 if 48 - 48: Iii1i * i1i1i1111I + IiIIii11Ii
 if 31 - 31: Oo * i1iiIII111 % Ii / oOO + I1Ii1I1 + iI1iII1I1I1i
 if 90 - 90: I1Ii1I1 * i1i1i1111I / iI1iII1I1I1i * Ii
 if 38 - 38: I1I . Ii
 if 41 - 41: ooo000 % IIiIIiIi11I1 % ooOOO
 if 5 - 5: oOo0O00 / Ii + i1iiIII111 * Oo + Ooo0Ooo + ooo000
 if 96 - 96: i1iiIII111 - IIiIIiIi11I1 / IIiIIiIi11I1 * IiIIii11Ii
 if 67 - 67: Ooo0Ooo . Ooo0Ooo . iI1iI11Ii111
 if 24 - 24: i1iiIII111 + i1i1i1111I . oOo0O00 + iI1iII1I1I1i + iI1iI11Ii111
 if 92 - 92: iI1iII1I1I1i / iI1iII1I1I1i + IiIIii11Ii . iI1iI11Ii111
 if 56 - 56: Ii * ooo000 . IiIIii11Ii
 if 66 - 66: I1Ii1I1 * OooOoo . iI1iII1I1I1i % OooOoo . i1 . IiIIii11Ii
 if 47 - 47: Ii % OooOoo % iI1iII1I1I1i * IiIIii11Ii
def sendByHttp ( arrinfo , cloudserverip = None , timeoutSec = 3 ) :
 iIIIiII1 = None
 try :
  oo = vwAppConfigParam . server1001_ip
  if cloudserverip :
   oo = cloudserverip
  iiII1II1IIIi = vwAppConfigParam . server1001_webport
  IiI111I1 = http . client . HTTPConnection ( host = oo , port = iiII1II1IIIi , timeout = 3 )
  if 48 - 48: i1I . I11iiIi11i1I / ooo000 + i1iiIII111
  iiiIII = bytes ( json . dumps ( arrinfo , sort_keys = False , indent = 4 ) , encoding = 'utf8' )
  if 84 - 84: Oo / I1Ii1I1 . IIiIIiIi11I1
  if 67 - 67: Oo % ooOOO + iI1iII1I1I1i * I1I
  o0oOoOoO = { "Content-type" : "application/json" , "Accept" : "application/json" }
  IiI111I1 . timeout = timeoutSec
  if 79 - 79: IIiIIiIi11I1 * Oo / OooOoo
  IiI111I1 . request ( "POST" , oo , iiiIII , o0oOoOoO )
  I1I1 = IiI111I1 . getresponse ( )
  if 10 - 10: iI1iII1I1I1i / i1iiIII111 . IiIIii11Ii * i1i1i1111I
  i1I1iII1 = I1I1 . read ( )
  if 71 - 71: oOo0O00 + I1Ii1I1 / I11iiIi11i1I + Oo / I1I
  if 18 - 18: Iii1i - IiIIii11Ii
  if 71 - 71: iI1iII1I1I1i + OooOoo % i1i1i1111I % oOo0O00 . ooo000
  IiI111I1 . close ( )
  try :
   if 92 - 92: I11iiIi11i1I - Ooo0Ooo - i1i1i1111I % i1iiIII111 / i1i1i1111I * iI1iII1I1I1i
   if 60 - 60: IiIIii11Ii % oOO / i1I * OooOoo / I11iiIi11i1I - Ii
   O00oO00oO0O = json . loads ( i1I1iII1 . decode ( "utf-8" ) )
   if 16 - 16: oOo0O00 / I1Ii1I1 / i1 + I11iiIi11i1I + oOo0O00
   if O00oO00oO0O [ 'result' ] [ 'success' ] :
    iIIIiII1 = "OK"
   else :
    iIIIiII1 = O00oO00oO0O [ 'result' ] [ 'msg' ]
    if 11 - 11: oOO / OooOoo + oOo0O00
  except :
   if 79 - 79: I11iiIi11i1I . I1Ii1I1 * i1I % I1Ii1I1 / iI1iI11Ii111
   if 93 - 93: i1I + Iii1i . Ii . i1I * ooOOO
   if 84 - 84: Ooo0Ooo % iI1iI11Ii111
   iIIIiII1 = None
   return iIIIiII1
   if 82 - 82: IIiIIiIi11I1
   if 81 - 81: oOo0O00 + i1 - ooo000 * iI1iII1I1I1i + i1i1i1111I
  return iIIIiII1
 except Exception as O0OOOo0o0O :
  pass
  print ( O0OOOo0o0O )
  if 89 - 89: I1Ii1I1
  if 57 - 57: iI1iII1I1I1i - i1iiIII111 / OooOoo % i1iiIII111
 return None
 if 92 - 92: IiIIii11Ii * OooOoo - IiIIii11Ii
 if 66 - 66: i1iiIII111 . iI1iII1I1I1i / ooOOO . i1 - OooOoo
 if 13 - 13: oOo0O00
 if 50 - 50: i1 - i1iiIII111 / i1iiIII111 % I1Ii1I1 / IIiIIiIi11I1
 if 66 - 66: oOo0O00 - Iii1i - ooo000 . I11iiIi11i1I
 if 59 - 59: i1I / IiIIii11Ii
 if 7 - 7: oOo0O00
 if 64 - 64: IIiIIiIi11I1 * oOO + Oo . OooOoo - ooOOO
 if 94 - 94: IiIIii11Ii - ooo000 . Ii
 if 73 - 73: IiIIii11Ii / oOo0O00 % ooo000 . iI1iII1I1I1i % oOO
 if 36 - 36: iI1iI11Ii111 * OooOoo . ooo000 . i1iiIII111 + oOO
 if 47 - 47: iI1iI11Ii111 / I11iiIi11i1I
 if 52 - 52: Ii . OooOoo . i1iiIII111 * I11iiIi11i1I - iI1iII1I1I1i
 if 20 - 20: OooOoo % iI1iI11Ii111 + I1Ii1I1 + iI1iI11Ii111 - oOo0O00
 if 76 - 76: I11iiIi11i1I % IIiIIiIi11I1 % i1I
 if 39 - 39: IiIIii11Ii . Oo + i1I - oOo0O00
 if 93 - 93: Iii1i * IIiIIiIi11I1 % i1I + i1 % Ii * i1I
@ bp . route ( '/console_swipe_getselected' , methods = [ 'POST' ] )
@ login_required
def web_console_swipe_getselected ( ) :
 if 62 - 62: iI1iI11Ii111 % ooo000
 i1iI = request . form . get ( "selecteddoor" )
 if 41 - 41: Ooo0Ooo / I1I * I11iiIi11i1I - iI1iI11Ii111
 if len ( i1iI ) == 0 :
  return "OK"
  if 61 - 61: Ii * OooOoo * I1I % i1iiIII111 % IIiIIiIi11I1 * I11iiIi11i1I
 i1iI = i1iI . split ( "," )
 i1iI = [ int ( x ) for x in i1iI ]
 i1iI . sort ( )
 Oo0oO0O0O = getswipeSelected ( i1iI )
 vwAppConfig . vwlog ( '{}--{}[{}]' . format ( g . user . f_OperatorName ,
 "{}-DownloadSwipe" . format ( "" ) , Oo0oO0O0O ) )
 if 49 - 49: iI1iII1I1I1i / i1iiIII111 % oOO
 print ( "Doors={}" . format ( len ( i1iI ) ) )
 if 46 - 46: ooOOO * IIiIIiIi11I1 % i1 / oOO + i1 + oOo0O00
 return Oo0oO0O0O
 if 99 - 99: I1I * IIiIIiIi11I1 * i1iiIII111
 if 62 - 62: ooOOO % Oo + i1I
 if 87 - 87: ooo000 - OooOoo + Ii + i1i1i1111I + IiIIii11Ii
 if 57 - 57: IIiIIiIi11I1 + I1I / ooOOO % ooOOO % Oo / iI1iI11Ii111
 if 95 - 95: i1 / I11iiIi11i1I . i1 / Oo . Ooo0Ooo
 if 43 - 43: Oo - OooOoo * oOO . Ooo0Ooo / IIiIIiIi11I1 * IIiIIiIi11I1
 if 84 - 84: i1iiIII111 + oOo0O00
 if 83 - 83: i1i1i1111I
 if 84 - 84: oOO / Ii * Ooo0Ooo / Ii / ooo000
 if 64 - 64: oOo0O00 * Ii
 if 2 - 2: iI1iI11Ii111 % i1iiIII111 . oOo0O00
 if 59 - 59: I11iiIi11i1I % OooOoo - iI1iII1I1I1i % I1I + i1iiIII111 . I1Ii1I1
def getswipeSelected ( doorDst ) :
 print ( "getswipeSelected" )
 Ooo0OO00oo00O = WGControllerCenter2023 ( )
 if 55 - 55: i1i1i1111I + Oo - OooOoo / i1iiIII111 - i1
 IiIIII11 = ""
 for II1ii1iIIiI1 in doorDst :
  IiIIII11 += str ( II1ii1iIIiI1 ) + ","
 IiIIII11 += '0'
 if 65 - 65: Oo + oOo0O00 * iI1iI11Ii111 + i1 / IIiIIiIi11I1 / OooOoo
 if 59 - 59: IiIIii11Ii % oOO - oOO - I1I * iI1iI11Ii111 / i1i1i1111I
 if 68 - 68: IiIIii11Ii % i1I . Ii . oOO
 if 65 - 65: oOO % OooOoo
 if 22 - 22: iI1iII1I1I1i % I1I . i1I
 if 63 - 63: I11iiIi11i1I
 if 58 - 58: iI1iII1I1I1i
 if 17 - 17: iI1iII1I1I1i - Ii % iI1iII1I1I1i % oOo0O00 * Iii1i
 if 51 - 51: I1I . i1i1i1111I % Ii
 if 55 - 55: i1i1i1111I * Ii % i1i1i1111I
 if 61 - 61: oOo0O00
 if 53 - 53: Ooo0Ooo / IiIIii11Ii
 if 49 - 49: ooo000 - oOO . IiIIii11Ii / Oo
 Oo0 = db . session . query ( TBController . f_ControllerID , TBController . f_ControllerSN , TBDoor . f_DoorNO ,
 TBDoor . f_DoorID ) . join ( TBDoor ,
 TBDoor . f_ControllerID == TBController . f_ControllerID )
 Ii1iiiII11 = Oo0 . all ( )
 OoOOo = dict ( )
 for II1ii1iIIiI1 in Ii1iiiII11 :
  ooOOOoOO0 = II1ii1iIIiI1 . f_ControllerSN
  oo00oO000 = II1ii1iIIiI1 . f_DoorNO
  OoOOo [ ooOOOoOO0 * 10 + oo00oO000 ] = II1ii1iIIiI1 . f_DoorID
  if ooOOOoOO0 not in Ooo0OO00oo00O . getswipeSN :
   if II1ii1iIIiI1 . f_DoorID in doorDst :
    ooo0O0ooooo0o = II1ii1iIIiI1 . f_ControllerID
    Ooo0OO00oo00O . getswipeSN . append ( ooOOOoOO0 )
    o0oOO = threading . Thread ( target = checkConnectedSingle , args = ( ooOOOoOO0 , ooo0O0ooooo0o , Ooo0OO00oo00O ) )
    o0oOO . start ( )
 ii = time . time ( )
 while time . time ( ) < ii + 10 :
  if len ( Ooo0OO00oo00O . getswipeSNConnectedOK ) + len ( Ooo0OO00oo00O . getswipeSNFailed ) == len ( Ooo0OO00oo00O . getswipeSN ) :
   break
  time . sleep ( 0.1 )
 print ( "getswipeSNConnectedOK" )
 print ( Ooo0OO00oo00O . getswipeSNConnectedOK )
 o0O000OoOo00o = 0
 if 53 - 53: Ii + i1I % I1Ii1I1
 if 81 - 81: oOO - Ii - ooo000 + i1iiIII111 % Ooo0Ooo * Ooo0Ooo
 if 20 - 20: I1Ii1I1 - IIiIIiIi11I1 % i1
 IiIi1II11iIiI = dict ( )
 if len ( Ooo0OO00oo00O . getswipeSNConnectedOK ) > 0 :
  for Ooo0O00o in range ( len ( Ooo0OO00oo00O . getswipeSNConnectedOK ) ) :
   ooo0O0ooooo0o = Ooo0OO00oo00O . getswipeIdConnectedOK [ Ooo0O00o ]
   ooOOOoOO0 = Ooo0OO00oo00O . getswipeSNConnectedOK [ Ooo0O00o ]
   o0oOO = threading . Thread ( target = getswipeSingle , args = ( ooOOOoOO0 , ooo0O0ooooo0o , Ooo0OO00oo00O ) )
   o0oOO . start ( )
   if 27 - 27: i1i1i1111I * IiIIii11Ii - i1i1i1111I
   if 69 - 69: Ii / ooo000 + iI1iI11Ii111 * Ii % I1I . i1I
   if 93 - 93: I1I % I1I - oOo0O00 + I1I . Oo / IIiIIiIi11I1
   if 32 - 32: I1I % i1 - i1iiIII111 % ooo000 + oOO - IiIIii11Ii
   if 40 - 40: I11iiIi11i1I + iI1iII1I1I1i - Oo
  OOOOo = TBConsumer . query . filter ( TBConsumer . f_CardNO . isnot ( None ) ) . all ( )
  for II1ii1iIIiI1 in OOOOo :
   IiIi1II11iIiI [ II1ii1iIIiI1 . f_CardNO ] = II1ii1iIIiI1 . f_ConsumerID
   if 73 - 73: OooOoo * Iii1i
 OooOoO = time . time ( ) + vwAppConfigParam . uploadpri_timeout_second + ( o0O000OoOo00o / 1000 ) * 2
 while time . time ( ) < OooOoO :
  if len ( Ooo0OO00oo00O . recvsn ) > 0 :
   Ooo0OO00oo00O . recvsn . clear ( )
   if 73 - 73: oOO - i1iiIII111
   O00OOo0Ooo00O = time . time ( ) + vwAppConfigParam . uploadpri_timeout_second
   if O00OOo0Ooo00O > OooOoO :
    OooOoO = O00OOo0Ooo00O
  if len ( Ooo0OO00oo00O . arrswipe ) == 0 :
   if len ( Ooo0OO00oo00O . getswipeSNOK ) + len ( Ooo0OO00oo00O . getswipeSNFailed ) == len ( Ooo0OO00oo00O . getswipeSN ) :
    break
   time . sleep ( 0.1 )
  while len ( Ooo0OO00oo00O . arrswipe ) > 0 :
   if 24 - 24: Ii * Ii % Ii . Ooo0Ooo . OooOoo
   II1ii1iIIiI1 = Ooo0OO00oo00O . arrswipe . pop ( )
   iiii1IIi1111I ( II1ii1iIIiI1 [ 'sn' ] , II1ii1iIIiI1 [ 'arrRecords' ] , IiIi1II11iIiI , OoOOo )
   if 85 - 85: Iii1i . oOO % Iii1i - Iii1i
   if 68 - 68: oOO + Iii1i + Ooo0Ooo % Oo / I11iiIi11i1I . OooOoo
 i1IIIIiIII1 = [ ]
 i1i11i = [ ]
 II1Ii1i1 = [ ]
 iI1I1i1ii = [ ]
 for Iii1I1 in doorDst :
  IiIIII11 += str ( Iii1I1 ) + ","
  for II1ii1iIIiI1 in Ii1iiiII11 :
   ooOOOoOO0 = II1ii1iIIiI1 . f_ControllerSN
   if 73 - 73: I1Ii1I1 . Iii1i + i1I / ooo000 / oOo0O00 . I1Ii1I1
   if 73 - 73: ooo000 % oOO
   if Iii1I1 == II1ii1iIIiI1 . f_DoorID :
    Oo00o00OooOoo = - 1
    try :
     Oo00o00OooOoo = Ooo0OO00oo00O . getswipeSNOK . index ( ooOOOoOO0 )
    except :
     Oo00o00OooOoo = - 1
     if 44 - 44: iI1iI11Ii111 % i1iiIII111 - ooOOO . IIiIIiIi11I1 - i1
    if Oo00o00OooOoo >= 0 :
     i1IIIIiIII1 . append ( Iii1I1 )
     i1i11i . append ( Ooo0OO00oo00O . getswipeSNRecordNum [ Oo00o00OooOoo ] )
    else :
     try :
      Oo00o00OooOoo = Ooo0OO00oo00O . getswipeSNConnectedOK . index ( ooOOOoOO0 )
     except :
      Oo00o00OooOoo = - 1
     if Oo00o00OooOoo < 0 :
      II1Ii1i1 . append ( Iii1I1 )
     else :
      iI1I1i1ii . append ( Iii1I1 )
      if 46 - 46: Ooo0Ooo - i1I / ooo000 * iI1iI11Ii111 . oOo0O00
 return { "doorID_OK" : i1IIIIiIII1 , "doorID_GetSwipeNum" : i1i11i ,
 "doorID_NotConnected" : II1Ii1i1 , "doorID_Fail" : iI1I1i1ii }
 if 32 - 32: i1i1i1111I . OooOoo + OooOoo - ooo000 * IiIIii11Ii + Oo
 if 12 - 12: oOo0O00
 if 57 - 57: Oo + i1i1i1111I / I1Ii1I1
def checkConnectedSingle ( sn , conid , wgcondata , cloudserverip = None ) :
 I11IIiI1I1I = ( {
 "jsonrpc" : "2.0" ,
 "method" : "QueryControllerStatus" ,
 "params" : [ { "ControllerSN" : sn } ] ,
 "id" : 1002
 } )
 if sendByHttp ( I11IIiI1I1I , cloudserverip ) == "OK" :
  wgcondata . getswipeSNConnectedOK . append ( sn )
  wgcondata . getswipeIdConnectedOK . append ( conid )
 else :
  wgcondata . getswipeSNFailed . append ( sn )
  if 56 - 56: oOO % Ooo0Ooo % Iii1i . i1i1i1111I
  if 46 - 46: iI1iI11Ii111 . i1iiIII111 % Iii1i - Ooo0Ooo + ooo000
  if 100 - 100: oOO
  if 32 - 32: I1Ii1I1 % ooo000 * OooOoo / oOo0O00 + ooOOO
  if 64 - 64: I1Ii1I1 . Ooo0Ooo
  if 36 - 36: IIiIIiIi11I1 + IiIIii11Ii . i1 + IIiIIiIi11I1
def getswipeSingle ( sn , conid , wgcondata ) :
 vwAppConfig . wglog ( "getswipeSingle  sn={} conid={}  start" . format ( sn , conid ) )
 if 77 - 77: iI1iII1I1I1i / OooOoo . Iii1i + i1iiIII111 - iI1iI11Ii111
 OOO00oOO0 = 10
 if 89 - 89: i1iiIII111 - I1Ii1I1
 if 51 - 51: IIiIIiIi11I1 + i1 % i1iiIII111
 if 49 - 49: IiIIii11Ii - i1I . I1I
 if 76 - 76: oOO / iI1iII1I1I1i . I1I * oOo0O00 - i1i1i1111I
 if 53 - 53: OooOoo - oOo0O00 * ooOOO / OooOoo * Ooo0Ooo * ooo000
 if 10 - 10: IIiIIiIi11I1 % ooo000 % I11iiIi11i1I % Ooo0Ooo
 if 70 - 70: IiIIii11Ii
 if 90 - 90: i1i1i1111I % i1 . IiIIii11Ii * iI1iI11Ii111 / Ii
 if 73 - 73: ooo000 * Ooo0Ooo + Iii1i . ooOOO . I11iiIi11i1I / I11iiIi11i1I
 if 72 - 72: i1I * iI1iII1I1I1i / ooo000 + i1I - I11iiIi11i1I
 if 20 - 20: IIiIIiIi11I1 . oOo0O00 . Ooo0Ooo
 if 11 - 11: OooOoo
 if 45 - 45: iI1iII1I1I1i + I11iiIi11i1I / IIiIIiIi11I1
 if 45 - 45: iI1iII1I1I1i . iI1iII1I1I1i * i1i1i1111I + oOo0O00
 if 6 - 6: Iii1i . Oo + I1Ii1I1 * i1 * I1Ii1I1 % oOO
 IIIiI1ii11 = 1000
 O0 = 300000 / IIIiI1ii11
 IIIi1iiI1i1 = 1
 iIiIiI1 = 0
 OO0O0oOOO0o = False
 ooOooOooO0o0 = 0
 Oo0OOoO0000 = 0
 iIiiII1iI = - 1
 IiI1 = - 1
 OOO00oOO0 = 6000
 OOO0OOoo0ooO = - 1
 I1IiI = [ ]
 ooO0O0o0O0o = 0
 o0oOoOOOoOooo = 0
 while IIIi1iiI1i1 < O0 :
  IIIi1iiI1i1 = IIIi1iiI1i1 + 1
  O0oo = ( {
 "jsonrpc" : "2.0" ,
 "method" : "DownloadSwipe" ,
 "params" : [
 {
 "ControllerSN" : sn ,
 "RecordNumberAtEveryTime" : 1000 ,
 "GotRecordLastIndex" : OOO0OOoo0ooO
 }
 ] ,
 "id" : 3001
 } )
  iI1I11iI1II = sendByHttpWithMsg ( O0oo , OOO00oOO0 )
  if 74 - 74: Oo % Ooo0Ooo / Ii
  if len ( iI1I11iI1II ) == 0 :
   o0oOoOOOoOooo += 1
   print ( "{}Communication Failed --{}" . format ( sn , o0oOoOOOoOooo ) )
   if o0oOoOOOoOooo < 3 :
    continue
    if 36 - 36: OooOoo / OooOoo / i1iiIII111 * ooo000 / OooOoo - i1I
   break
  else :
   o0oOoOOOoOooo = 0
   if 81 - 81: Ooo0Ooo * iI1iII1I1I1i - i1i1i1111I
   if vwAppConfig . successIsTrue ( iI1I11iI1II ) :
    I1I1IIII1i = iI1I11iI1II
    I11Ii1IiIiII = vwAppConfig . parseInt ( I1I1IIII1i [ "GetSwipeNumber" ] )
    O00o0OO = 0
    if I11Ii1IiIiII > 0 :
     ooOooOooO0o0 = vwAppConfig . parseInt ( I1I1IIII1i [ "LastSwipeIndex" ] )
     if iIiiII1iI >= ooOooOooO0o0 :
      ooOooOooO0o0 = IiI1
      if 88 - 88: Ii
      if 13 - 13: Iii1i - I1Ii1I1 . iI1iII1I1I1i - Ooo0Ooo . OooOoo / oOo0O00
      if 21 - 21: IiIIii11Ii . i1i1i1111I + IiIIii11Ii
      vwAppConfig . wglog ( "DownloadSwipe Finished..." )
      OO0O0oOOO0o = True
      break
     iIiIiI1 += I11Ii1IiIiII
     if 86 - 86: Ii / oOo0O00 - i1 * i1i1i1111I - Oo * Iii1i
     if 28 - 28: OooOoo . i1 % iI1iII1I1I1i % Iii1i
     I1IiI . extend ( I1I1IIII1i [ "RecordInformation" ] )
     wgcondata . recvsn . append ( sn )
     print ( "sn={}, bFinished={}, newestIndex={}" . format ( sn , OO0O0oOOO0o , ooOooOooO0o0 ) )
     if 2 - 2: Oo + OooOoo - i1i1i1111I - ooo000 / Oo . Oo
     O00o0OO = I1I1IIII1i [ "RecordInformation" ] [ len ( I1I1IIII1i [ "RecordInformation" ] ) - 1 ] [ "CardNO" ]
     IiI1 = I1I1IIII1i [ "RecordInformation" ] [ len ( I1I1IIII1i [ "RecordInformation" ] ) - 1 ] [ "RecordIndex" ]
     if 41 - 41: OooOoo + OooOoo - OooOoo
     if 9 - 9: Iii1i % I1Ii1I1 % IiIIii11Ii - I1I * OooOoo
     if 53 - 53: iI1iII1I1I1i * i1i1i1111I / OooOoo . i1I . ooo000
     if 45 - 45: OooOoo + ooOOO / i1i1i1111I * i1
    if I11Ii1IiIiII < IIIiI1ii11 :
     if I11Ii1IiIiII > 0 :
      ooO0O0o0O0o += 1
      if ooO0O0o0O0o > 5 :
       vwAppConfig . wglog ( "DownloadSwipe Finished5..." )
       OO0O0oOOO0o = True
       break
      vwAppConfig . wglog ( "cntLessthangetNumOneTime={}" . format ( ooO0O0o0O0o ) )
      OOO0OOoo0ooO = ooOooOooO0o0 + 2
      if 71 - 71: iI1iI11Ii111 % Iii1i + oOo0O00 * I11iiIi11i1I / iI1iI11Ii111
      if 66 - 66: ooo000 * oOo0O00
      if iIiiII1iI == - 1 :
       iIiiII1iI = ooOooOooO0o0
       if 83 - 83: i1
     else :
      vwAppConfig . wglog ( "DownloadSwipe Finished..." )
      if 64 - 64: i1 . iI1iI11Ii111 - I11iiIi11i1I . Iii1i
      if 47 - 47: ooo000 / Ooo0Ooo % IiIIii11Ii
      if 70 - 70: IIiIIiIi11I1 / Iii1i . i1i1i1111I % ooOOO . Ii / Ii
      OO0O0oOOO0o = True
      break
    else :
     ooO0O0o0O0o = 0
     OOO0OOoo0ooO = ooOooOooO0o0
     if iIiiII1iI == - 1 :
      iIiiII1iI = ooOooOooO0o0
      if 51 - 51: I11iiIi11i1I + Ooo0Ooo - ooo000 * oOO . oOO
   else :
    vwAppConfig . wglog ( iI1I11iI1II )
    vwAppConfig . wglog ( "DownloadSwipe  Failed ..." )
    if 79 - 79: i1i1i1111I + oOo0O00
    if 11 - 11: OooOoo / i1iiIII111 % i1I - i1i1i1111I * oOo0O00
    break
    if 90 - 90: i1 * i1 . Ooo0Ooo . Oo
    if 59 - 59: Ii % I1Ii1I1 + Iii1i . OooOoo * Iii1i
 print ( "bFinished={}, newestIndex={}" . format ( OO0O0oOOO0o , ooOooOooO0o0 ) )
 if OO0O0oOOO0o :
  if ooOooOooO0o0 > 0 :
   II1ii1iIIiI1 = ( { "sn" : sn , "arrRecords" : I1IiI } )
   wgcondata . arrswipe . append ( II1ii1iIIiI1 )
   if 21 - 21: I11iiIi11i1I + ooOOO % IiIIii11Ii / OooOoo
   O0oo = ( {
 "jsonrpc" : "2.0" ,
 "method" : "ConfirmGotSwipe" ,
 "params" : [
 {
 "ControllerSN" : sn ,
 "LastSwipeIndex" : ooOooOooO0o0
 }
 ] ,
 "id" : 3002
 } )
   iI1I11iI1II = sendByHttpWithMsg ( O0oo , OOO00oOO0 )
   if 96 - 96: Oo * i1iiIII111 . Ooo0Ooo
   if len ( iI1I11iI1II ) == 0 :
    if 35 - 35: ooOOO . i1I * i1i1i1111I * iI1iII1I1I1i - I11iiIi11i1I
    print ( "Communication Failed " )
    wgcondata . getswipeSNFailed . append ( sn )
    return " Failed "
   else :
    wgcondata . getswipeSNOK . append ( sn )
    wgcondata . getswipeSNRecordNum . append ( len ( I1IiI ) )
    return "OK"
  wgcondata . getswipeSNOK . append ( sn )
  wgcondata . getswipeSNRecordNum . append ( 0 )
  return "OK"
 else :
  wgcondata . getswipeSNFailed . append ( sn )
  return " Failed "
  if 47 - 47: IIiIIiIi11I1
  if 73 - 73: I1Ii1I1 + ooOOO
  if 99 - 99: i1I
  if 87 - 87: i1 . I11iiIi11i1I * Ii . i1 . IIiIIiIi11I1 . IiIIii11Ii
  if 50 - 50: Ii / oOO
  if 92 - 92: Ooo0Ooo * i1iiIII111 / Ooo0Ooo / i1iiIII111 * i1i1i1111I + i1I
  if 48 - 48: I11iiIi11i1I
  if 87 - 87: I1Ii1I1
  if 29 - 29: ooo000 . iI1iII1I1I1i . oOo0O00 + i1i1i1111I + oOO
  if 59 - 59: IiIIii11Ii
def iiii1IIi1111I ( sn , infolist , usersByCardNO , doorcontollersBySNDoor ) :
 if 26 - 26: oOo0O00 % iI1iI11Ii111 * i1
 if 60 - 60: IIiIIiIi11I1 % oOO / i1
 if 20 - 20: Ooo0Ooo
 if 4 - 4: IiIIii11Ii % Iii1i
 if 43 - 43: ooo000
 if 95 - 95: Oo + I11iiIi11i1I / Ooo0Ooo / Ii - ooOOO / i1i1i1111I
 if len ( infolist ) :
  if 6 - 6: Ooo0Ooo % IiIIii11Ii
  if 59 - 59: i1I . I11iiIi11i1I . ooo000 / i1I . Ii % Ooo0Ooo
  if 85 - 85: oOo0O00 / ooOOO
  if 41 - 41: i1iiIII111 * iI1iII1I1I1i + i1 + i1i1i1111I
  if 26 - 26: Oo % OooOoo
  if 14 - 14: iI1iII1I1I1i - i1iiIII111
  oOoOOOOooo = False
  for Ooo0O00o in range ( len ( infolist ) ) :
   Oo0oO0O0O = infolist [ Ooo0O00o ]
   if 88 - 88: iI1iI11Ii111 * I1I . i1iiIII111
   iiII1i1IIiiII = Oo0oO0O0O [ 'DoorNO' ]
   if 72 - 72: i1 % iI1iII1I1I1i . OooOoo . Iii1i . i1 . OooOoo
   I111i11 = doorcontollersBySNDoor . get ( sn * 10 + iiII1i1IIiiII )
   if 34 - 34: Iii1i
   if I111i11 is not None :
    iIiiIiiIii1I = iiII1i1IIiiII
    OOoooOOOo = time . strftime ( '%Y-%m-%d %H:%M:%S' )
    iIII1IiiIIiI , i1iI1II1II11 , OooO0o , IIooo0 = 0 , 0 , 0 , 0
    I1ii1IIiii , Oo00O00o0oO = 0 , 0
    if 70 - 70: IIiIIiIi11I1 / i1i1i1111I . Ii
    if 30 - 30: Iii1i / IIiIIiIi11I1 % i1iiIII111 . I1I % OooOoo
    oooo00o = 0
    if 100 - 100: I11iiIi11i1I
    if 47 - 47: IiIIii11Ii
    OOoooOOOo = Oo0oO0O0O [ 'Time' ]
    if 91 - 91: i1I - i1iiIII111 . i1iiIII111 + I1Ii1I1 / Ooo0Ooo * IIiIIiIi11I1
    I1ii1IIiii = sn
    IIooo0 = 1
    o000Oo00oOO00 = I111i11
    if 38 - 38: Iii1i / i1I
    Oo00O00o0oO = Oo0oO0O0O [ "RecordIndex" ]
    o0O0 = Oo0oO0O0O [ "Description" ]
    if 'CardNO' in Oo0oO0O0O . keys ( ) :
     iIII1IiiIIiI = Oo0oO0O0O [ 'CardNO' ]
    if Oo0oO0O0O [ 'RecordType' ] == 1 :
     iIII1IiiIIiI = Oo0oO0O0O [ 'CardNO' ]
     if 29 - 29: Oo % OooOoo - i1i1i1111I + IiIIii11Ii / I1Ii1I1 + i1i1i1111I
     OOiiIIi1iiII1Ii = ""
     OO0OoO00 = ""
     iiiIiIIii = ""
     if 44 - 44: I1Ii1I1 - i1i1i1111I
     I1I1iI1i1Ii = usersByCardNO . get ( Oo0oO0O0O [ 'CardNO' ] )
     if I1I1iI1i1Ii is not None :
      i1iI1II1II11 = I1I1iI1i1Ii
      if 7 - 7: i1iiIII111
      if 27 - 27: oOO - oOO
      if 34 - 34: oOo0O00 + Oo / ooo000 . oOO % OooOoo - Ii
      if 47 - 47: Ooo0Ooo
      if 12 - 12: iI1iI11Ii111 * I1I - Oo
     if Oo0oO0O0O [ 'Valid' ] == 'Pass' :
      OooO0o = 1
     if Oo0oO0O0O [ 'InExit' ] == "Exit" :
      IIooo0 = 2
      if 4 - 4: oOo0O00 / i1i1i1111I
      if 61 - 61: oOo0O00
      if 51 - 51: ooOOO - oOO . I1Ii1I1 - IiIIii11Ii
      if 49 - 49: iI1iII1I1I1i / ooOOO . iI1iII1I1I1i
      if 60 - 60: ooOOO / Ii % OooOoo
    elif Oo0oO0O0O [ 'RecordType' ] == 2 :
     OooO0o = 1
     if 'CardNO' in Oo0oO0O0O . keys ( ) :
      iIII1IiiIIiI = Oo0oO0O0O [ 'CardNO' ]
      o0O0 = "{}, CardNO={}" . format ( o0O0 , iIII1IiiIIiI )
      if 97 - 97: Oo * IiIIii11Ii . Ooo0Ooo % i1 % Ii % ooo000
      OOiiIIi1iiII1Ii = ""
      OO0OoO00 = ""
      iiiIiIIii = ""
      if 67 - 67: IIiIIiIi11I1 % i1 % oOo0O00 - i1i1i1111I
      I1I1iI1i1Ii = usersByCardNO . get ( Oo0oO0O0O [ 'CardNO' ] )
      if I1I1iI1i1Ii is not None :
       i1iI1II1II11 = I1I1iI1i1Ii
       if 51 - 51: I11iiIi11i1I . I11iiIi11i1I % iI1iI11Ii111 % Oo / I1Ii1I1 - I1Ii1I1
     else :
      OooO0o = 1
      if 28 - 28: Ii / Ooo0Ooo
      if 11 - 11: I1I - OooOoo * ooOOO % i1i1i1111I + ooo000 . oOO
    elif Oo0oO0O0O [ 'RecordType' ] == 3 :
     pass
     if 51 - 51: ooOOO + iI1iII1I1I1i % iI1iI11Ii111 . I11iiIi11i1I % Ooo0Ooo
     if 15 - 15: OooOoo / i1I % Oo % Oo
     if 73 - 73: oOo0O00
    else :
     iIII1IiiIIiI = - 1
    if iIII1IiiIIiI >= 0 :
     if 69 - 69: ooOOO - IIiIIiIi11I1 - i1I
     if 78 - 78: I1Ii1I1 . ooo000 + iI1iI11Ii111 / iI1iI11Ii111
     if 88 - 88: Ii - i1iiIII111 - i1 * IIiIIiIi11I1 . IiIIii11Ii + Iii1i
     if 44 - 44: ooOOO + Oo - i1
     if 18 - 18: iI1iII1I1I1i * ooOOO + Ooo0Ooo
     if 78 - 78: I1I . I1I - IIiIIiIi11I1 - IiIIii11Ii % I11iiIi11i1I . I1Ii1I1
     OOoooOOOo = vwAppConfig . getDateTimeFromStr ( OOoooOOOo )
     I1Ii11iiiiiii = TDSwiperecord2022 ( f_ReadDate = OOoooOOOo , f_CardNO = iIII1IiiIIiI , f_ConsumerID = i1iI1II1II11 ,
 f_Character = OooO0o , f_DoorID = o000Oo00oOO00 , f_InOut = IIooo0 ,
 f_Desc = o0O0 , f_ControllerSN = I1ii1IIiii , f_DoorNO = iIiiIiiIii1I ,
 f_RecordFlashLoc = Oo00O00o0oO , f_ExtValue = oooo00o ,
 f_Modified = datetime . now ( ) )
     db . session . add ( I1Ii11iiiiiii )
     if 59 - 59: IiIIii11Ii
     oOoOOOOooo = True
     if 91 - 91: IiIIii11Ii + iI1iII1I1I1i
     if 65 - 65: Oo * Iii1i * IiIIii11Ii / IIiIIiIi11I1
     if 77 - 77: IIiIIiIi11I1 / oOO % IiIIii11Ii + I1Ii1I1
     if 34 - 34: i1i1i1111I * Iii1i + Ii - i1I / i1 / i1
  if oOoOOOOooo :
   II1i1iIi1i1i = db . session . commit ( )
   if 29 - 29: oOo0O00 % ooOOO * Ooo0Ooo
   if 49 - 49: ooOOO - iI1iII1I1I1i / oOo0O00
   if 87 - 87: ooo000 % Oo % I11iiIi11i1I . IiIIii11Ii * oOO
   if 83 - 83: oOo0O00 % Oo + i1i1i1111I - ooOOO + i1iiIII111
   if 36 - 36: oOo0O00 * OooOoo / I11iiIi11i1I
   if 98 - 98: iI1iI11Ii111 . ooo000
@ bp . route ( '/console_searchcontroller' , methods = [ 'POST' ] )
@ login_required
def web_console_searchcontroller ( ) :
 if 85 - 85: OooOoo * Iii1i * IIiIIiIi11I1
 OOO0o000 = vwAppConfig . parseInt ( request . form . get ( "controllersn" ) )
 ooOOOoOO0 = OOO0o000
 print ( ooOOOoOO0 )
 if 25 - 25: i1 * oOO * IIiIIiIi11I1
 if 86 - 86: oOo0O00 % oOO / I1Ii1I1
 if 38 - 38: IIiIIiIi11I1
 ii1ii = ( '20' , '58' , 'B4' , '94' , '820000FFFFFFFF01' , '820000FFFFFFFF02' , '820000FFFFFFFF03' , '820000FFFFFFFF04' ,
 'F40000FFFFFFFF55aaaa55920000' ,
 '92' )
 if 17 - 17: oOO + i1iiIII111 / i1i1i1111I * IiIIii11Ii / oOo0O00 / Ooo0Ooo
 I11IIiI1I1I = {
 "jsonrpc" : "2.0" ,
 "method" : "Primit64ByteCommand" ,
 "params" : [ { 'ControllerSN' : ooOOOoOO0 ,
 'CommandPacket' : WGTools . getarrStringWithsplitDou ( ii1ii )
 } ] ,
 "id" : "1005"
 }
 Oo0oO0O0O = sendByHttpWithMsg ( I11IIiI1I1I )
 if vwAppConfig . successIsTrue ( Oo0oO0O0O ) :
  if 43 - 43: i1I + iI1iII1I1I1i + Oo
  if 61 - 61: i1I
  O0O0 = Oo0oO0O0O [ "ReturnPacket" ]
  I1i1i = bytearray ( binascii . unhexlify ( O0O0 . replace ( " " , "" ) ) )
  if 75 - 75: IIiIIiIi11I1 . I11iiIi11i1I / ooo000 . oOo0O00 % Ooo0Ooo
 else :
  vwAppConfig . vwlog ( '{}--{}[{}]' . format ( g . user . f_OperatorName ,
 "{}-Check Controllers" . format ( ooOOOoOO0 ) ,
 "Communication Failed -2" ) )
  return "Communication Failed -2"
 if I1i1i [ 1 ] == 0x20 :
  OO0ooOO = I1i1i [ 0 : 64 ]
  if 7 - 7: I1I / i1iiIII111
  OO0 = (
 "255.255.255.255" , 60000 )
  if 53 - 53: OooOoo - I1Ii1I1 + IIiIIiIi11I1 . I1Ii1I1 + i1iiIII111
  OO = "{0:0>2X}{1:0>2X}-{2:0>2X}-{3:0>2X}" . format ( I1i1i [ 64 * 3 + 28 ] ,
 I1i1i [ 64 * 3 + 29 ] , I1i1i [ 64 * 3 + 30 ] ,
 I1i1i [ 64 * 3 + 31 ] )
  II = "{0:0>2X}" . format ( I1i1i [ 64 * 3 + 20 ] )
  for Ooo0O00o in range ( 5 ) :
   II += "-{0:0>2X}" . format ( I1i1i [ 64 * 3 + 21 + Ooo0O00o ] )
   if 82 - 82: Iii1i
  IiiI1III1iI = "V{}.{}[{}]" . format ( I1i1i [ 64 * 3 + 26 ] - ( I1i1i [ 64 * 3 + 26 ] >> 4 ) * 6 ,
 I1i1i [ 64 * 3 + 27 ] - ( I1i1i [ 64 * 3 + 27 ] >> 4 ) * 6 ,
 OO )
  Oo0oO = ( I1i1i [ 64 * 3 + 26 ] << 8 ) + I1i1i [ 64 * 3 + 27 ]
  iI1IIIIIii1 = I1i1i [
 64 * 3 + 26 ]
  if 26 - 26: Iii1i + I11iiIi11i1I + Iii1i / Iii1i * i1 * i1
  if 89 - 89: OooOoo + ooo000 . I11iiIi11i1I
  if 76 - 76: i1i1i1111I / oOo0O00 . oOo0O00
  OO0ooOO = I1i1i [ 64 * 3 : 64 * 3 + 64 ]
  ooOOOoOO0 = "{0:d}" . format ( WGTools . getLongByByte ( OO0ooOO , 4 , 4 ) )
  II1I1Ii1IIi = "{0:d}.{1:d}.{2:d}.{3:d}" . format ( OO0ooOO [ 8 ] , OO0ooOO [ 9 ] , OO0ooOO [ 10 ] , OO0ooOO [ 11 ] )
  O0oOOOoo = "{0:d}.{1:d}.{2:d}.{3:d}" . format ( OO0ooOO [ 12 ] , OO0ooOO [ 13 ] , OO0ooOO [ 14 ] , OO0ooOO [ 15 ] )
  oo0oo = "{0:d}.{1:d}.{2:d}.{3:d}" . format ( OO0ooOO [ 12 + 4 ] , OO0ooOO [ 13 + 4 ] , OO0ooOO [ 14 + 4 ] , OO0ooOO [ 15 + 4 ] )
  if 94 - 94: i1I
  if 65 - 65: IiIIii11Ii . Ii
  if 49 - 49: oOO + Ii % Ii % Oo * Iii1i * Ii
  II = "{0:0>2X}-{1:0>2X}-{2:0>2X}-{3:0>2X}-{4:0>2X}-{5:0>2X}" . format ( OO0ooOO [ 20 ] , OO0ooOO [ 21 ] ,
 OO0ooOO [ 22 ] , OO0ooOO [ 23 ] ,
 OO0ooOO [ 24 ] , OO0ooOO [ 25 ] )
  if 89 - 89: Ooo0Ooo
  if 57 - 57: oOO . IIiIIiIi11I1 + OooOoo * I1I
  if 89 - 89: Iii1i * Ooo0Ooo + Oo * I11iiIi11i1I * iI1iI11Ii111 + iI1iI11Ii111
  I11 = "V{0:d}.{1:d}[{2:0>2X}{3:0>2X}-{4:0>2X}-{5:0>2X}]" . format ( ( OO0ooOO [ 26 ] & 0xf ) + ( OO0ooOO [ 26 ] >> 4 ) * 10 ,
 ( OO0ooOO [ 27 ] & 0xf ) + (
 ( OO0ooOO [ 27 ] >> 4 ) * 10 ) , OO0ooOO [ 28 ] ,
 OO0ooOO [ 29 ] , OO0ooOO [ 30 ] ,
 OO0ooOO [ 31 ] )
  IiI = "Static IP"
  if I1i1i [ 8 * 64 + 14 ] == 0xa5 :
   IiI = "DHCP"
   if 26 - 26: ooOOO / I1I % Ooo0Ooo + I1Ii1I1 + Ii
  OO0ooOO = I1i1i [ 9 * 64 : 10 * 64 ]
  oOOooo0oo00Oo = "{0:d}.{1:d}.{2:d}.{3:d}" . format ( OO0ooOO [ 8 ] , OO0ooOO [ 9 ] , OO0ooOO [ 10 ] , OO0ooOO [ 11 ] )
  i1iI1iIIIIiii = OO0ooOO [ 12 ] + ( OO0ooOO [ 13 ] << 8 )
  I1II1ii = "{0:d}.{1:d}.{2:d}.{3:d}" . format ( OO0ooOO [ 16 + 8 ] , OO0ooOO [ 16 + 9 ] , OO0ooOO [ 16 + 10 ] , OO0ooOO [ 16 + 11 ] )
  i11i = OO0ooOO [ 16 + 12 ] + ( OO0ooOO [ 16 + 13 ] << 8 )
  oo00oOOo0O0o = collections . OrderedDict ( )
  if 43 - 43: iI1iI11Ii111 - i1i1i1111I + IiIIii11Ii
  if 44 - 44: ooo000 . ooo000
  oo00oOOo0O0o = ( {

  # ooo000 + IIiIIiIi11I1 * I1Ii1I1 - Oo
  # Ii * I1Ii1I1
  # Ooo0Ooo
  # i1I - iI1iII1I1I1i * iI1iI11Ii111 / IiIIii11Ii - iI1iI11Ii111
  "SN" : ooOOOoOO0 ,
  "IP Mode" : IiI ,
 "IP" : II1I1Ii1IIi ,
  "Netmask" : O0oOOOoo ,
 "Gateway" : oo0oo ,
 "MAC" : II ,
  "Driver Version" : IiiI1III1iI ,
  # OooOoo
  # Oo - iI1iII1I1I1i - i1i1i1111I . ooOOO
  # Iii1i + I11iiIi11i1I * i1I * i1I * i1iiIII111 / I11iiIi11i1I
  # iI1iI11Ii111 * Ooo0Ooo . i1 * IiIIii11Ii - ooo000
  # iI1iI11Ii111 % Ii
  # I1Ii1I1
  # IIiIIiIi11I1 - i1i1i1111I / i1iiIII111 - i1iiIII111 / ooOOO
  # I11iiIi11i1I
  } )
  if 29 - 29: ooo000 * i1 - iI1iII1I1I1i . i1I - iI1iII1I1I1i
  if oOOooo0oo00Oo != "0.0.0.0" :
   oo00oOOo0O0o [ 'UDP DataServer' ] = "{0:s}:{1:d}" . format ( oOOooo0oo00Oo , i1iI1iIIIIiii )
  if I1II1ii != "0.0.0.0" :
   oo00oOOo0O0o [ 'TCP DataServer' ] = "{0:s}:{1:d}" . format ( I1II1ii , i11i )
  IIiI11iiI = I1i1i [ 50 ] & 0x20
  if IIiI11iiI > 0 :
   oo00oOOo0O0o [ 'Wi-Fi' ] = "Extended"
  I1Iiii1 = ''
  OOOO = ''
  if 53 - 53: oOO
  if 71 - 71: i1i1i1111I
  if 78 - 78: oOo0O00 * oOO % iI1iII1I1I1i / IiIIii11Ii + Ii
  if 29 - 29: oOO + iI1iI11Ii111 % IiIIii11Ii - iI1iII1I1I1i
  if 15 - 15: i1
  I1Iiii1 += "{}:\t{}<br>" . format ( "SN" , ooOOOoOO0 )
  OOOO += "{}," . format ( ooOOOoOO0 )
  I1Iiii1 += "{}:\t{}<br>" . format ( "IP Mode" , IiI )
  OOOO += "{}," . format ( IiI )
  I1Iiii1 += "{}:\t{}<br>" . format ( "IP" , II1I1Ii1IIi )
  OOOO += "{}," . format ( II1I1Ii1IIi )
  I1Iiii1 += "{}:\t{}<br>" . format ( "Netmask" , O0oOOOoo )
  OOOO += "{}," . format ( O0oOOOoo )
  I1Iiii1 += "{}:\t{}<br>" . format ( "Gateway" , oo0oo )
  OOOO += "{}," . format ( oo0oo )
  I1Iiii1 += "{}:\t{}<br>" . format ( "MAC" , II )
  OOOO += "{}," . format ( II )
  I1Iiii1 += "{}:\t{}<br>" . format ( "Driver Version" , IiiI1III1iI )
  OOOO += "{}," . format ( IiiI1III1iI )
  if oOOooo0oo00Oo != "0.0.0.0" :
   if 1 - 1: oOo0O00 + I11iiIi11i1I % IiIIii11Ii
   I1Iiii1 += "{}:\t{}<br>" . format ( "UDP DataServer" ,
 "{0:s}:{1:d}" . format ( oOOooo0oo00Oo , i1iI1iIIIIiii ) )
   OOOO += "{}(UDP)," . format ( "{0:s}:{1:d}" . format ( oOOooo0oo00Oo , i1iI1iIIIIiii ) )
  if I1II1ii != "0.0.0.0" :
   if 90 - 90: Ii
   I1Iiii1 += "{}:\t{}<br>" . format ( "TCP DataServer" , "{0:s}:{1:d}" . format ( I1II1ii , i11i ) )
   OOOO += "{}(TCP)," . format ( "{0:s}:{1:d}" . format ( I1II1ii , i11i ) )
  if IIiI11iiI > 0 :
   oo00oOOo0O0o [ 'Wi-Fi' ] = "Extended"
   I1Iiii1 += "{}:\t{}<br>" . format ( "Wi-Fi" , "Extended" )
   OOOO += "{}," . format ( "Wi-FiExtended" )
   if 22 - 22: Ooo0Ooo / ooOOO . I1I % I1I
  vwAppConfig . vwlog ( '{}--{}[{}]' . format ( g . user . f_OperatorName ,
 "{}-Check Controllers" . format ( ooOOOoOO0 ) , I1Iiii1 ) )
  if 16 - 16: iI1iII1I1I1i / i1iiIII111 / Ooo0Ooo . Ii
  if 82 - 82: Oo % iI1iII1I1I1i - i1I * OooOoo % Iii1i - I11iiIi11i1I
  if 95 - 95: oOO
  if 56 - 56: I11iiIi11i1I - i1I / OooOoo / ooo000 . iI1iI11Ii111
  O00oOOOO = ""
  O00oOOOO += '<td class="text-muted fs-15 fw-semibold text-start">{0}</td>' . format ( ooOOOoOO0 )
  O00oOOOO += '<td class="text-muted fs-15 fw-semibold text-start">{0}</td>' . format ( II1I1Ii1IIi )
  O00oOOOO += '<td class="text-muted fs-15 fw-semibold text-start">{0}</td>' . format ( IiI )
  oO00 = ''
  if oOOooo0oo00Oo != "0.0.0.0" :
   if 96 - 96: oOO + oOO + I1I * I1I / iI1iI11Ii111
   oO00 += "{}(UDP)" . format ( "{0:s}" . format ( oOOooo0oo00Oo , i1iI1iIIIIiii ) )
  if I1II1ii != "0.0.0.0" :
   if oO00 != "" :
    oO00 += ", "
    if 92 - 92: IiIIii11Ii * OooOoo * I1Ii1I1
   oO00 += "{}" . format ( "{0:s}" . format ( I1II1ii , i11i ) )
   if 65 - 65: i1iiIII111 * Oo * oOO + i1I - i1I
  O00oOOOO += '<td class="text-muted fs-15 fw-semibold text-start">{0}</td>' . format ( oO00 )
  O00oOOOO += '<td class="text-muted fs-15 fw-semibold text-start">{0}</td>' . format ( IiiI1III1iI )
  O00oOOOO += '<td class="text-muted fs-15 fw-semibold text-start">' . format ( )
  Oo0ooOoo = ""
  if 86 - 86: I1I
  if vwAppConfigParam . extfunc5678_develop_mode :
   O00oOOOO += '<button href="#" class="btn btn-primary active-btnEditControllerNetConfigure" data-id="{0}"  data-sn="{1}">Edit网络配置</button></td>' . format ( ooOOOoOO0 , ooOOOoOO0 )
   Oo0ooOoo = 1
  else :
   O00oOOOO += '<div class="btn-list"> <button href="#" class="btn btn-primary active-btnEditControllerNetConfigure" data-id="{0}"  data-sn="{1}">Edit网络配置</button>' . format ( ooOOOoOO0 , ooOOOoOO0 )
   O00oOOOO += '<button href="#" class="btn btn-primary active-btnaddselectedcon" data-id="{0}"  data-sn="{1}">添加</button>' . format ( ooOOOoOO0 , ooOOOoOO0 )
   O00oOOOO += '</div></td>' . format ( )
   Oo0ooOoo = 2
   if 35 - 35: ooOOO + OooOoo
   if 8 - 8: I1I + Ii % iI1iII1I1I1i + iI1iI11Ii111 . oOO * i1
  O00oOOOO += '</tr>' . format ( )
  if 96 - 96: ooo000 % I11iiIi11i1I / oOo0O00 * Ii * ooo000 - Ooo0Ooo
  if 88 - 88: Ii % ooOOO . I1I
  o000O0000o0o = [ 0 , ooOOOoOO0 , II1I1Ii1IIi , IiI , oO00 , IiiI1III1iI , Oo0ooOoo ]
  return "{};{}" . format ( I1Iiii1 , o000O0000o0o )
  if 38 - 38: i1i1i1111I / I1Ii1I1 / I11iiIi11i1I * Oo
  if 49 - 49: Ooo0Ooo
 vwAppConfig . vwlog ( '{}--{}[{}]' . format ( g . user . f_OperatorName ,
 "{}-Check Controllers" . format ( ooOOOoOO0 ) ,
 "Communication Failed-1" ) )
 return ""
 if 36 - 36: OooOoo + i1I / Iii1i + iI1iII1I1I1i + OooOoo
 if 6 - 6: iI1iI11Ii111 + Ii
 if 100 - 100: oOo0O00 % i1I - IiIIii11Ii % i1iiIII111 . i1 % I1Ii1I1
@ bp . errorhandler ( CSRFError )
def i11IiIii ( e ) :
 return "The session is expired or invalid, please return to the prev page or refresh and try again!"
 if 85 - 85: IiIIii11Ii + I1I + iI1iI11Ii111
 if 68 - 68: Iii1i % IiIIii11Ii . i1 - iI1iI11Ii111
@ bp . route ( '/console_monitorInfo' , methods = [ 'POST' ] )
@ login_required
def web_console_monitorInfo ( ) :
 iIIiII11Ii1I = request . form . get ( "swipeinfo" )
 if 66 - 66: IIiIIiIi11I1 - oOo0O00 . I1I * I11iiIi11i1I + i1i1i1111I
 Oo0oO0O0O = getNewSwipeUserInfo ( json . loads ( iIIiII11Ii1I ) )
 if 13 - 13: oOO % Iii1i
 if 81 - 81: I1I
 if len ( Oo0oO0O0O ) > 0 :
  I1Iiii1 = [ ]
  for II1ii1iIIiI1 in Oo0oO0O0O :
   I1Iiii1 . append ( II1ii1iIIiI1 [ 'infoDetailMore' ] )
  return ";;" . join ( x for x in I1Iiii1 )
 return Oo0oO0O0O
 if 86 - 86: Ooo0Ooo / I1I . Ooo0Ooo % i1i1i1111I * OooOoo * Iii1i
 if 59 - 59: Ii + i1i1i1111I . I1Ii1I1 . oOO + i1I . i1
@ bp . route ( '/console_getcsrf' , methods = [ 'Get' , 'POST' ] )
@ login_required
def console_getcsrf ( ) :
 Oo0oO0O0O = generate_csrf ( )
 if Oo0oO0O0O != '' :
  if 34 - 34: iI1iII1I1I1i - ooo000 * i1iiIII111 - Iii1i
  return 'csrf_{}' . format ( Oo0oO0O0O )
 return Oo0oO0O0O
 if 50 - 50: oOO . iI1iI11Ii111 . i1I . i1i1i1111I . I11iiIi11i1I + Oo
 if 38 - 38: iI1iI11Ii111 + oOo0O00 . ooo000 - Iii1i - I1Ii1I1 - oOO
class iI1I1iI111Ii1 ( object ) :
 Rec0Info = 0
 Rec1Pass = 1
 Rec2NoPass = 2
 Rec3Warn = 3
 Rec4Falt = 4
 if 72 - 72: Ii . Iii1i
 if 74 - 74: oOO - i1i1i1111I % I1I + IiIIii11Ii * I1I
 if 53 - 53: OooOoo % I1Ii1I1 / iI1iI11Ii111 / I1I + I1Ii1I1 . i1I
 if 7 - 7: oOO - oOo0O00 . i1i1i1111I * Oo + I1I
 if 93 - 93: i1iiIII111 - OooOoo + i1 * oOo0O00 . iI1iI11Ii111
def getReacordFloorDescription ( swipeinfo , f_Character , floorno , f_DoorID = 0 ) :
 iIII11I = None
 try :
  Oo0oO0O0O = swipeinfo
  iIII11I = Oo0oO0O0O [ "Description" ]
  if 89 - 89: i1I / IiIIii11Ii % Ooo0Ooo + Iii1i / i1iiIII111
  if 'CabinetDoor' in iIII11I :
   return iIII11I
  if f_Character :
   i11IIIi11IIII = None
   if Oo0oO0O0O [ 'RecordType' ] == 1 :
    i11IIIi11IIII = "Swipe"
   if Oo0oO0O0O [ 'RecordType' ] == 2 :
    i11IIIi11IIII = "RemoteOpenDoor"
   if i11IIIi11IIII :
    if floorno < 128 :
     O0oo00oOo = None
     if f_DoorID > 0 :
      O0oo00oOo = db . session . query ( TBFloor . f_FloorName ) . filter ( TBFloor . f_ControllerID == f_DoorID ) . filter (
 TBFloor . f_FloorNO == floorno ) . first ( )
     if O0oo00oOo :
      o0O0 = "{0} DirectGo={1}" . format ( i11IIIi11IIII , O0oo00oOo [ 0 ] )
     else :
      if floorno < 10 :
       o0O0 = "{0} DirectGo=_{1}Floor" . format ( i11IIIi11IIII , floorno )
      else :
       o0O0 = "{0} DirectGo={1}Floor" . format ( i11IIIi11IIII , floorno )
    else :
     o0O0 = "{0} Allow More Floors..." . format ( i11IIIi11IIII )
    iIII11I = o0O0
 except Exception as I1i1ii11i11I1 :
  vwAppConfig . wglog ( I1i1ii11i11I1 )
 return iIII11I
 if 28 - 28: oOO
def getNewSwipeUserInfo ( infolist ) :
 if len ( infolist ) :
  if 34 - 34: IIiIIiIi11I1 % OooOoo * ooo000 + i1I / oOo0O00
  if 18 - 18: I11iiIi11i1I % ooo000 . I11iiIi11i1I + Iii1i
  if 85 - 85: I1Ii1I1 % I11iiIi11i1I
  if 18 - 18: I1Ii1I1 / i1I % OooOoo * IIiIIiIi11I1
  if 46 - 46: i1
  if 98 - 98: i1i1i1111I / IiIIii11Ii + Ii / I1I
  oOoOOOOooo = False
  OOOO = ''
  I1Iiii1 = ''
  OOoo0Oo00 = iI1I1iI111Ii1 . Rec0Info
  O00oO0OO00o = [ ]
  for Ooo0O00o in range ( len ( infolist ) ) :
   Oo0oO0O0O = infolist [ Ooo0O00o ]
   ooOOOoOO0 = Oo0oO0O0O [ 'SN' ]
   if ooOOOoOO0 == 0 :
    continue
   iiII1i1IIiiII = Oo0oO0O0O [ 'DoorNO' ]
   if 67 - 67: i1 - ooo000 % IiIIii11Ii
   if 45 - 45: iI1iI11Ii111 - I11iiIi11i1I . iI1iII1I1I1i / I1Ii1I1
   if 30 - 30: I11iiIi11i1I
   oooO = - 1
   o000Oo00oOO00 = 0
   if vwAppConfig . WGTools . IsElevator ( ooOOOoOO0 ) :
    oooO = iiII1i1IIiiII
    iiII1i1IIiiII = 1
    if 78 - 78: i1 . i1iiIII111 - Oo * IIiIIiIi11I1 - I1I - i1I
    if 21 - 21: Iii1i - Ii / i1I / I1Ii1I1 % I11iiIi11i1I / Ii
    if 74 - 74: I1Ii1I1 . ooOOO
    if 24 - 24: iI1iI11Ii111 - Iii1i % oOo0O00 * I1I . iI1iII1I1I1i
   Oo0 = db . session . query ( TBDoor . f_DoorName , TBController . f_ControllerSN , TBDoor . f_DoorID ) . join ( TBDoor ,
 TBDoor . f_ControllerID == TBController . f_ControllerID ) . filter (
 TBController . f_ControllerSN == ooOOOoOO0 ) . filter ( TBDoor . f_DoorNO == iiII1i1IIiiII )
   Ii1iiiII11 = Oo0 . first ( )
   if 78 - 78: I1Ii1I1 - Ooo0Ooo / OooOoo % i1I
   if 99 - 99: I11iiIi11i1I % ooOOO
   if 22 - 22: i1iiIII111 * iI1iI11Ii111 - i1i1i1111I % ooo000 / OooOoo - Oo
   if Ii1iiiII11 is not None :
    iIiIiiIIIiII = Ii1iiiII11 [ 0 ]
    o000Oo00oOO00 = Ii1iiiII11 [ 2 ]
   else :
    iIiIiiIIIiII = None
   if vwAppConfigParam . extfunc5678_develop_mode :
    iIiIiiIIIiII = "{0}-{1}#" . format ( ooOOOoOO0 , iiII1i1IIiiII )
   if iIiIiiIIIiII is not None :
    if 3 - 3: I11iiIi11i1I % Ooo0Ooo
    if "PrimitHexData" in Oo0oO0O0O . keys ( ) :
     try :
      if 20 - 20: I1Ii1I1 . iI1iI11Ii111 - Ii % I11iiIi11i1I % Oo
      if "ConvertedToString" in Oo0oO0O0O . keys ( ) :
       OOOO = "{}-{}-{}" . format ( Oo0oO0O0O [ 'Time' ] , iIiIiiIIIiII , Oo0oO0O0O [ 'ConvertedToString' ] )
       I1Iiii1 = ( "QRCodeData\r\n" + "Time:\t{}\r\n" . format ( Oo0oO0O0O [ 'Time' ] ) + "Location  :\t{}\r\n" . format (
 iIiIiiIIIiII ) + "ConvertedToString:\r\n{}\r\n" . format ( Oo0oO0O0O [ 'ConvertedToString' ] ) +
 "PrimitHexData:\r\n{}" . format ( Oo0oO0O0O [ 'PrimitHexData' ] ) )
      else :
       OOOO = "{}-{}-{}" . format ( Oo0oO0O0O [ 'Time' ] , iIiIiiIIIiII , Oo0oO0O0O [ 'PrimitHexData' ] )
       I1Iiii1 = ( "QRCodeData\r\n" + "Time:\t{}\r\n" . format ( Oo0oO0O0O [ 'Time' ] ) + "Location  :\t{}\r\n" . format (
 iIiIiiIIIiII ) +
 "PrimitHexData:\r\n{}" . format ( Oo0oO0O0O [ 'PrimitHexData' ] ) )
     except Exception as I1i1ii11i11I1 :
      print ( I1i1ii11i11I1 )
      pass
      if 12 - 12: OooOoo * oOO % Ooo0Ooo . I11iiIi11i1I
    if "RecordIndex" in Oo0oO0O0O . keys ( ) :
     iIiiIiiIii1I = iiII1i1IIiiII
     OOoooOOOo = time . strftime ( '%Y-%m-%d %H:%M:%S' )
     iIII1IiiIIiI , i1iI1II1II11 , OooO0o , IIooo0 = 0 , 0 , 0 , 0
     I1ii1IIiii , Oo00O00o0oO = 0 , 0
     if 54 - 54: I11iiIi11i1I . i1 - IIiIIiIi11I1
     if 99 - 99: i1I + i1I * Ooo0Ooo . OooOoo
     oooo00o = 0
     if 33 - 33: i1i1i1111I / iI1iI11Ii111 + Ooo0Ooo % ooOOO
     if 25 - 25: Iii1i
     OOoooOOOo = Oo0oO0O0O [ 'Time' ]
     I1ii1IIiii = ooOOOoOO0
     IIooo0 = 1
     if 74 - 74: I11iiIi11i1I . ooo000 . I1I * i1iiIII111 * Ooo0Ooo
     if 47 - 47: OooOoo
     Oo00O00o0oO = Oo0oO0O0O [ "RecordIndex" ]
     o0O0 = Oo0oO0O0O [ "Description" ]
     if 'CardNO' in Oo0oO0O0O . keys ( ) :
      iIII1IiiIIiI = Oo0oO0O0O [ 'CardNO' ]
     if Oo0oO0O0O [ 'RecordType' ] == 1 :
      iIII1IiiIIiI = Oo0oO0O0O [ 'CardNO' ]
      if 55 - 55: ooOOO % oOO + i1I - iI1iI11Ii111 + ooo000 + I1I
      OOiiIIi1iiII1Ii = ""
      OO0OoO00 = ""
      iiiIiIIii = ""
      if 53 - 53: IIiIIiIi11I1 % IiIIii11Ii / oOO % ooOOO - oOo0O00
      if 74 - 74: ooo000 * OooOoo * Oo
      I1I1iI1i1Ii = db . session . query ( TBConsumer . f_ConsumerID , TBConsumer . f_ConsumerNO ,
 TBConsumer . f_ConsumerName ,
 TBGroup . f_GroupName , TBConsumer . f_CardNO ) . join ( TBGroup ,
 TBConsumer . f_GroupID == TBGroup . f_GroupID ,
 isouter = True ) . filter (
 TBConsumer . f_CardNO == Oo0oO0O0O [ 'CardNO' ] ) . first ( )
      if 96 - 96: I1Ii1I1 - Oo
      if I1I1iI1i1Ii is not None :
       i1iI1II1II11 = I1I1iI1i1Ii [ 0 ]
       OOiiIIi1iiII1Ii = I1I1iI1i1Ii [ 1 ]
       OO0OoO00 = I1I1iI1i1Ii [ 2 ]
       iiiIiIIii = I1I1iI1i1Ii [ 3 ] if I1I1iI1i1Ii [ 3 ] is not None else ""
      if Oo0oO0O0O [ 'Valid' ] == 'Pass' :
       OooO0o = 1
       OOoo0Oo00 = iI1I1iI111Ii1 . Rec1Pass
      else :
       OOoo0Oo00 = iI1I1iI111Ii1 . Rec2NoPass
      if vwAppConfig . WGTools . IsElevator ( ooOOOoOO0 ) :
       Oo0oO0O0O [ 'Description' ] = getReacordFloorDescription ( Oo0oO0O0O , OooO0o , oooO ,
 o000Oo00oOO00 )
      OOOO = "{}-{}-{}-{}-{}-{}-{}-{}" . format (
 Oo0oO0O0O [ 'CardNO' ] , OOiiIIi1iiII1Ii , OO0OoO00 , iiiIiIIii , Oo0oO0O0O [ 'Time' ] , iIiIiiIIIiII , Oo0oO0O0O [ 'InExit' ] ,
 Oo0oO0O0O [ 'Description' ]
 )
      if 28 - 28: i1iiIII111 - iI1iI11Ii111 % Ii * ooo000 / Iii1i
      I1Iiii1 = "CardNO:\t{}\r\n" . format ( Oo0oO0O0O [ 'CardNO' ] ) + "UserID:\t{}\r\n" . format (
 OOiiIIi1iiII1Ii ) + "Name:\t{}\r\n" . format ( OO0OoO00 ) + "Department:\t{}\r\n" . format (
 iiiIiIIii ) + "Time:\t{}\r\n" . format ( Oo0oO0O0O [ 'Time' ] ) + "Location  :\t{}-{}\r\n" . format ( iIiIiiIIIiII , Oo0oO0O0O [
 'InExit' ] ) + "Status:\t{}" . format ( Oo0oO0O0O [ 'Description' ] )
      if 12 - 12: iI1iI11Ii111 - Ooo0Ooo
      if Oo0oO0O0O [ 'InExit' ] == "Exit" :
       IIooo0 = 2
       if 12 - 12: ooOOO
       if 29 - 29: iI1iI11Ii111 . ooo000 . ooo000
       if 79 - 79: oOo0O00 % iI1iI11Ii111 * I1Ii1I1 . IIiIIiIi11I1 * Iii1i - I1I
       if 85 - 85: I1I + iI1iI11Ii111 . I11iiIi11i1I % i1 * iI1iI11Ii111
       if 22 - 22: IiIIii11Ii . Iii1i / i1i1i1111I / ooo000 + ooo000 + ooo000
       if 76 - 76: Iii1i % i1i1i1111I
     elif Oo0oO0O0O [ 'RecordType' ] == 2 :
      OooO0o = 1
      if vwAppConfig . WGTools . IsElevator ( ooOOOoOO0 ) :
       Oo0oO0O0O [ 'Description' ] = getReacordFloorDescription ( Oo0oO0O0O , OooO0o , oooO ,
 o000Oo00oOO00 )
      if 'CardNO' in Oo0oO0O0O . keys ( ) :
       iIII1IiiIIiI = Oo0oO0O0O [ 'CardNO' ]
       if 12 - 12: oOO + IiIIii11Ii % ooOOO + iI1iI11Ii111 / I1I
       if 59 - 59: Iii1i % I1Ii1I1 + I11iiIi11i1I - Oo
       if 72 - 72: I11iiIi11i1I
       if 38 - 38: I11iiIi11i1I . oOO + i1I
       if 33 - 33: ooo000 - IIiIIiIi11I1 % i1iiIII111 / iI1iII1I1I1i - Iii1i % IIiIIiIi11I1
       if 15 - 15: ooo000 . i1 * i1
       if 41 - 41: I11iiIi11i1I + Iii1i % ooOOO * i1
       I1I1iI1i1Ii = db . session . query ( TBConsumer . f_ConsumerID , TBConsumer . f_ConsumerNO ,
 TBConsumer . f_ConsumerName ,
 TBGroup . f_GroupName , TBConsumer . f_CardNO ) . join ( TBGroup ,
 TBConsumer . f_GroupID == TBGroup . f_GroupID ,
 isouter = True ) . filter (
 TBConsumer . f_CardNO == Oo0oO0O0O [ 'CardNO' ] ) . first ( )
       if 37 - 37: ooo000
       if I1I1iI1i1Ii is not None :
        OOiiIIi1iiII1Ii = I1I1iI1i1Ii [ 1 ]
        OO0OoO00 = I1I1iI1i1Ii [ 2 ]
        iiiIiIIii = I1I1iI1i1Ii [ 3 ] if I1I1iI1i1Ii [ 3 ] is not None else ""
        OOOO = "{}-{}-{}-{}-{}-{}-{}" . format ( Oo0oO0O0O [ 'CardNO' ] , OOiiIIi1iiII1Ii , OO0OoO00 , iiiIiIIii ,
 Oo0oO0O0O [ 'Time' ] , iIiIiiIIIiII , Oo0oO0O0O [ 'Description' ] )
        I1Iiii1 = "CardNO:\t{}\r\n" . format ( Oo0oO0O0O [ 'CardNO' ] ) + "UserID:\t{}\r\n" . format (
 OOiiIIi1iiII1Ii ) + "Name:\t{}\r\n" . format ( OO0OoO00 ) + "Department:\t{}\r\n" . format (
 iiiIiIIii ) + "Time:\t{}\r\n" . format ( Oo0oO0O0O [ 'Time' ] ) + "Location  :\t{}\r\n" . format (
 iIiIiiIIIiII ) + "Status:\t{}" . format ( Oo0oO0O0O [ 'Description' ] )
       else :
        if 87 - 87: i1i1i1111I + I1Ii1I1 % i1iiIII111 - I1I + ooOOO % I1Ii1I1
        if 96 - 96: IIiIIiIi11I1 / I1I * i1 / I1I + I1I / i1
        OOOO = "{}-{}-{}" . format ( Oo0oO0O0O [ 'Time' ] , iIiIiiIIIiII , Oo0oO0O0O [ 'Description' ] )
        I1Iiii1 = "Time:\t{}\r\n" . format ( Oo0oO0O0O [ 'Time' ] ) + "Location  :\t{}\r\n" . format (
 iIiIiiIIIiII ) + "Status:\t{}" . format ( Oo0oO0O0O [ 'Description' ] )
        if 80 - 80: Oo / i1i1i1111I . IIiIIiIi11I1
      else :
       OOOO = "{}-{}-{}" . format ( Oo0oO0O0O [ 'Time' ] , iIiIiiIIIiII , Oo0oO0O0O [ 'Description' ] )
       I1Iiii1 = "Time:\t{}\r\n" . format ( Oo0oO0O0O [ 'Time' ] ) + "Location  :\t{}\r\n" . format (
 iIiIiiIIIiII ) + "Status:\t{}" . format ( Oo0oO0O0O [ 'Description' ] )
      OOoo0Oo00 = iI1I1iI111Ii1 . Rec3Warn
      if 79 - 79: oOO
      if 6 - 6: iI1iI11Ii111 + IIiIIiIi11I1 + ooOOO % IIiIIiIi11I1
     elif Oo0oO0O0O [ 'RecordType' ] == 3 :
      OOoo0Oo00 = iI1I1iI111Ii1 . Rec4Falt
      OOOO = "{}-{}-{}" . format ( Oo0oO0O0O [ 'Time' ] , iIiIiiIIIiII , Oo0oO0O0O [ 'Description' ] )
      I1Iiii1 = "Time:\t{}\r\n" . format ( Oo0oO0O0O [ 'Time' ] ) + "Location  :\t{}\r\n" . format (
 iIiIiiIIIiII ) + "Status:\t{}" . format ( Oo0oO0O0O [ 'Description' ] )
      if 24 - 24: ooo000 + i1I / Ii / Ooo0Ooo % IIiIIiIi11I1
      if 70 - 70: I11iiIi11i1I
      if 45 - 45: I1Ii1I1 * Oo - I11iiIi11i1I * iI1iII1I1I1i
     else :
      iIII1IiiIIiI = - 1
   if OOOO != '' :
    O00oO0OO00o . append ( { "infoSimple" : OOOO , "infoDetailMore" : I1Iiii1 , "recordtype" : OOoo0Oo00 } )
    if 41 - 41: Iii1i . I1I * i1I - i1iiIII111 . iI1iI11Ii111 + ooOOO
    if 24 - 24: i1 + IIiIIiIi11I1 + i1iiIII111 % I1Ii1I1 + IIiIIiIi11I1
  if len ( O00oO0OO00o ) > 0 :
   return O00oO0OO00o ;
  return ''
  if 55 - 55: IiIIii11Ii - IiIIii11Ii
  if 52 - 52: I1Ii1I1 - OooOoo % i1I
  if 88 - 88: ooOOO . i1
  if 72 - 72: I1I - OooOoo / Iii1i - I1Ii1I1
  if 54 - 54: I11iiIi11i1I / i1iiIII111 % oOo0O00 - ooOOO
  if 72 - 72: ooo000 . I1Ii1I1 . I1I . IIiIIiIi11I1 + Oo
  if 58 - 58: ooOOO + IiIIii11Ii + oOO % IiIIii11Ii + Ooo0Ooo . Oo
  if 45 - 45: I1I % i1I % oOO * oOo0O00 / i1iiIII111 + I11iiIi11i1I
  if 63 - 63: i1i1i1111I - iI1iI11Ii111 - iI1iII1I1I1i + OooOoo * i1iiIII111 / Ooo0Ooo
  if 81 - 81: ooo000 % i1i1i1111I . i1iiIII111 / i1iiIII111 / i1iiIII111
  if 84 - 84: ooOOO * ooo000 % ooOOO
def O00OOoooo0o0O ( address ) :
 if not address :
  return False
  if 96 - 96: i1i1i1111I * I1Ii1I1 / Oo - i1i1i1111I . oOO - Ii
 IiiI1ii1II = "^((2[0-4]\d|25[0-5]|[01]?\d\d?)\.){3}(2[0-4]\d|25[0-5]|[01]?\d\d?)$"
 if not re . match ( IiiI1ii1II , address ) :
  return False
 return True
 if 30 - 30: oOo0O00 * iI1iII1I1I1i
 if 81 - 81: I11iiIi11i1I / I1Ii1I1
def iIIII1I1Ii11 ( address ) :
 if not address :
  return False
  if 23 - 23: iI1iII1I1I1i % i1I * I11iiIi11i1I - oOO * oOo0O00
 IiiI1ii1II = "^((2[0-4]\d|25[0-5]|[01]?\d\d?)\.){3}(2[0-4]\d|25[0-5]|[01]?\d\d?)$"
 if not re . match ( IiiI1ii1II , address ) :
  return False
 OooOOOOOoO = address . split ( '.' )
 iiIII1i1II = bin ( int ( OooOOOOOoO [ 0 ] ) ) . replace ( '0b' , '' )
 oO0oo0Oo = bin ( int ( OooOOOOOoO [ 1 ] ) ) . replace ( '0b' , '' )
 Ooo000OO = bin ( int ( OooOOOOOoO [ 2 ] ) ) . replace ( '0b' , '' )
 II1 = bin ( int ( OooOOOOOoO [ 3 ] ) ) . replace ( '0b' , '' )
 I111II = "{0}{1}{2}{3}" . format ( iiIII1i1II , oO0oo0Oo , Ooo000OO , II1 )
 if I111II . find ( '01' ) != - 1 :
  return False
 return True
 if 25 - 25: I1Ii1I1
 if 18 - 18: iI1iII1I1I1i . iI1iII1I1I1i % ooOOO
 if 90 - 90: I1I - Iii1i + Ii / Iii1i % I1Ii1I1
def Ii1I1i ( address ) :
 iiIi = 0
 OooOOOOOoO = address . split ( '.' )
 OOOO0o = False
 for ooOO in OooOOOOOoO :
  IiII = bin ( int ( ooOO ) ) . replace ( '0b' , '' )
  for iiIIi1iiI1i11 in IiII :
   if int ( iiIIi1iiI1i11 ) == 1 :
    iiIi += 1
   if int ( iiIIi1iiI1i11 ) == 0 :
    OOOO0o = True
    break
  if OOOO0o :
   break
 return iiIi
 if 27 - 27: oOo0O00 - I1Ii1I1 + Ii * oOO
 if 67 - 67: ooOOO
 if 62 - 62: I1I + Ii + I1I * i1 . Ooo0Ooo * i1iiIII111
@ bp . route ( '/edit_netconfigure' , methods = [ 'POST' ] )
@ login_required
def web_edit_netconfigure ( ) :
 if 2 - 2: i1I + Oo
 if 51 - 51: Ii . i1I
 if 89 - 89: iI1iI11Ii111 * IiIIii11Ii / i1 . I1Ii1I1
 if 64 - 64: iI1iI11Ii111
 if 44 - 44: Ii . OooOoo + oOO * OooOoo . i1 - i1iiIII111
 if 72 - 72: iI1iII1I1I1i + I1I * ooo000 . OooOoo + Ii + IIiIIiIi11I1
 if 91 - 91: oOo0O00 % IIiIIiIi11I1 % i1I / I1Ii1I1
 if 70 - 70: iI1iII1I1I1i + iI1iI11Ii111 + oOO
 if 21 - 21: I11iiIi11i1I
 if 20 - 20: ooOOO + IiIIii11Ii % Iii1i - I11iiIi11i1I
 if 49 - 49: Iii1i / IiIIii11Ii % i1 % i1i1i1111I + oOO * ooo000
 if 25 - 25: IIiIIiIi11I1 * OooOoo % oOo0O00 % Ooo0Ooo + i1iiIII111
 Oo0oO0O0O = "OK"
 if 15 - 15: I11iiIi11i1I
 I1ii1IIiii = request . form . get ( "f_ControllerSN" )
 iiii = request . form . get ( "f_MAC" )
 Iii11 = request . form . get ( "f_DHCP" )
 O000OoOo00 = request . form . get ( "f_IP" )
 i1IiI = request . form . get ( "f_MASK" )
 I1II1i1I1i = request . form . get ( "f_Gateway" )
 if 94 - 94: oOo0O00
 iii1i1Iii1 = request . form . get ( "f_UdpServerIP" )
 i11I1i11I1 = request . form . get ( "f_UdpServerPort" )
 Ooo = request . form . get ( "f_TcpServerIP" )
 Oo00OOO0OOO0 = request . form . get ( "f_TcpServerPort" )
 if Iii11 == '0' :
  if not O00OOoooo0o0O ( O000OoOo00 ) :
   Oo0oO0O0O = ( "IP {} " + " invalid. please input valid value" . format ( O000OoOo00 ) )
   return Oo0oO0O0O
  if not ( iIIII1I1Ii11 ( i1IiI ) and Ii1I1i ( i1IiI ) < 32 ) :
   Oo0oO0O0O = "Netmask {}  " + " invalid. please input valid value" . format ( i1IiI )
   return Oo0oO0O0O
  if not O00OOoooo0o0O ( I1II1i1I1i ) :
   Oo0oO0O0O = "Gateway {}   invalid. please input valid value" . format ( I1II1i1I1i )
   return Oo0oO0O0O
 if iii1i1Iii1 != "" :
  if not O00OOoooo0o0O ( iii1i1Iii1 ) :
   Oo0oO0O0O = "UDP DataServerIP {}  invalid. please input valid value" . format ( iii1i1Iii1 )
   return Oo0oO0O0O
  if vwAppConfig . parseInt ( i11I1i11I1 ) <= 0 :
   Oo0oO0O0O = "UDP DataServerPort {}  invalid. please input valid value" . format ( i11I1i11I1 )
   return Oo0oO0O0O
 if Ooo != "" :
  if not O00OOoooo0o0O ( Ooo ) :
   Oo0oO0O0O = "TCP DataServerIP {}  invalid. please input valid value" . format ( Ooo )
   return Oo0oO0O0O
  if vwAppConfig . parseInt ( Oo00OOO0OOO0 ) <= 0 :
   Oo0oO0O0O = "TCP DataServerPort {}  invalid. please input valid value" . format ( Oo00OOO0OOO0 )
   return Oo0oO0O0O
 vwAppConfig . vwlog ( '{}--{}[{}]' . format ( g . user . f_OperatorName ,
 "Edit Controller Net Configuration {} -- Start" . format ( I1ii1IIiii ) ,
 request . form ) )
 if 56 - 56: iI1iI11Ii111 + i1I / I1I % oOO - ooOOO * IiIIii11Ii
 if 58 - 58: Iii1i - Ii * iI1iI11Ii111 + Iii1i
 if 67 - 67: Iii1i + oOo0O00
 if 29 - 29: Iii1i + ooOOO
 if 71 - 71: i1I % OooOoo % Ii . IiIIii11Ii - OooOoo
 if 18 - 18: i1I + i1 / ooOOO
 if 39 - 39: i1I
 if 52 - 52: i1i1i1111I / i1iiIII111 * I1Ii1I1 - i1I - Oo
 if 77 - 77: Ii + i1I * i1i1i1111I - i1iiIII111 . Ooo0Ooo + Ooo0Ooo
 ii1ii = (
 '20' , '58' , 'B4' , '94' , '820000FFFFFFFF01' , '820000FFFFFFFF02' , '820000FFFFFFFF03' , '820000FFFFFFFF04' )
 ii1ii = ( '20' , '58' , 'B4' , '94' , '820000FFFFFFFF01' , '820000FFFFFFFF02' , '820000FFFFFFFF03' , '820000FFFFFFFF04' ,
 'F40000FFFFFFFF55aaaa5592000000000000000000000000000000000000000000000000000000020000200000000000000000000000000000000000000000' ,
 '92' )
 i11i11IiI1iI1 = 'F20000FFFFFFFF55aaaa559a0a5' . ljust ( 126 , '0' )
 i11i11IiI1iI1 = 'F20000FFFFFFFF55aaaa559a0a500000000000000000000000000000000000000000000000000020000200000000000000000000000000000000000000000' ,
 if 73 - 73: I11iiIi11i1I + i1
 if 20 - 20: ooo000
 if 58 - 58: I11iiIi11i1I % i1 . oOo0O00 - OooOoo - OooOoo
 o00o0OOoO = "900000FFFFFFFF"
 oO0o = iii1i1Iii1
 O0o0000oooOO = i11I1i11I1
 o0O = 30
 if len ( oO0o ) == 0 :
  oO0o = "0.0.0.0"
  O0o0000oooOO = "0"
 if len ( O0o0000oooOO ) == 0 :
  O0o0000oooOO = '61005'
 OoOO00o = oO0o . split ( "." )
 for II1ii1iIIiI1 in OoOO00o :
  o00o0OOoO += WGTools . getHexString1Byte ( int ( II1ii1iIIiI1 ) )
 o00o0OOoO += WGTools . getHexString2Byte ( int ( O0o0000oooOO ) )
 o00o0OOoO += WGTools . getHexString1Byte ( int ( o0O ) )
 o00o0OOoO += "00"
 o00o0OOoO += "00"
 o00o0OOoO += "01"
 o00o0OOoO += "000000000000"
 o00o0OOoO += ""
 if 99 - 99: IiIIii11Ii / iI1iII1I1I1i % iI1iI11Ii111
 oO0o = Ooo
 O0o0000oooOO = Oo00OOO0OOO0
 o0O = 30
 if len ( oO0o ) == 0 :
  oO0o = "0.0.0.0"
  O0o0000oooOO = "0"
 if len ( O0o0000oooOO ) == 0 :
  O0o0000oooOO = '61005'
 OoOO00o = oO0o . split ( "." )
 for II1ii1iIIiI1 in OoOO00o :
  o00o0OOoO += WGTools . getHexString1Byte ( int ( II1ii1iIIiI1 ) )
 o00o0OOoO += WGTools . getHexString2Byte ( int ( O0o0000oooOO ) )
 o00o0OOoO += "00"
 o00o0OOoO += "00"
 o00o0OOoO += "01"
 IiI1ii = "F20000FFFFFFFF55AAAA559A01A5" . ljust ( 126 , '0' )
 iiIiI1iIIIi = "F20000FFFFFFFF55AAAA55FFFFFF"
 if 43 - 43: oOO * I1I
 if 27 - 27: ooOOO % IIiIIiIi11I1 % OooOoo % Iii1i * ooo000
 if 75 - 75: Ii % I1Ii1I1 + oOo0O00 . iI1iI11Ii111 / Ii + iI1iII1I1I1i
 if 84 - 84: i1i1i1111I
 if 50 - 50: IiIIii11Ii + Iii1i . ooo000 + ooo000 / Oo % i1iiIII111
 ii1ii = ( o00o0OOoO . ljust ( 126 , '0' ) , IiI1ii . ljust ( 126 , '0' ) )
 ooOOOoOO0 = vwAppConfig . parseInt ( I1ii1IIiii )
 I11IIiI1I1I = {
 "jsonrpc" : "2.0" ,
 "method" : "Primit64ByteCommand" ,
 "params" : [ { 'ControllerSN' : ooOOOoOO0 ,
 'CommandPacket' : WGTools . getarrStringWithsplitDou ( ii1ii )
 } ] ,
 "id" : "1005"
 }
 oo0O = sendByHttpWithMsg ( I11IIiI1I1I )
 if vwAppConfig . successIsTrue ( oo0O ) :
  if 72 - 72: Ii . I11iiIi11i1I / i1iiIII111 + ooo000 - I1Ii1I1 * Iii1i
  if 45 - 45: IiIIii11Ii + oOo0O00 * I11iiIi11i1I / Ii + ooOOO * ooo000
  O0O0 = oo0O [ "ReturnPacket" ]
  if 4 - 4: i1 + i1iiIII111 / OooOoo - ooo000 . I11iiIi11i1I
  if Iii11 == '0' :
   o00o0OOoO = "960000FFFFFFFF"
   OoOO00o = O000OoOo00 . split ( "." )
   for II1ii1iIIiI1 in OoOO00o :
    o00o0OOoO += WGTools . getHexString1Byte ( int ( II1ii1iIIiI1 ) )
   I1iII = i1IiI . split ( "." )
   for II1ii1iIIiI1 in I1iII :
    o00o0OOoO += WGTools . getHexString1Byte ( int ( II1ii1iIIiI1 ) )
   Ooo0o000oo = I1II1i1I1i . split ( "." )
   for II1ii1iIIiI1 in Ooo0o000oo :
    o00o0OOoO += WGTools . getHexString1Byte ( int ( II1ii1iIIiI1 ) )
   o00o0OOoO += "55aaaa55"
  else :
   if 40 - 40: I11iiIi11i1I * Ooo0Ooo / i1I / i1iiIII111 / oOO . oOO
   o00o0OOoO = "960000FFFFFFFF00000000000000000000000055AAAA55"
  IiI1ii = "F20000FFFFFFFF55AAAA55FFFFFF"
  ii1ii = ( o00o0OOoO . ljust ( 126 , '0' ) , IiI1ii . ljust ( 126 , '0' ) )
  I11IIiI1I1I = {
 "jsonrpc" : "2.0" ,
 "method" : "Primit64ByteCommand" ,
 "params" : [ { 'ControllerSN' : ooOOOoOO0 ,
 'CommandPacket' : WGTools . getarrStringWithsplitDou ( ii1ii )
 } ] ,
 "id" : "1005"
 }
  oo0O = sendByHttpWithMsg ( I11IIiI1I1I , 1 )
  if 93 - 93: I1Ii1I1
 else :
  return "Communication Failed -2"
 vwAppConfig . vwlog ( '{}--{}[{}]' . format ( g . user . f_OperatorName ,
 "Edit Controller Net Configuration {}" . format ( I1ii1IIiii ) ,
 Oo0oO0O0O ) )
 if 41 - 41: Iii1i * i1iiIII111
 I11IIiI1I1I = {
 "jsonrpc" : "2.0" ,
 "method" : "ExternFunctions" ,
 "params" : [
 {
 "FunctionName" : "SearchController"
 }
 ] ,
 "id" : 4001
 }
 Oo0oO0O0O = vwAppConfig . sendByHttpWithMsg ( I11IIiI1I1I )
 if 53 - 53: iI1iII1I1I1i + ooOOO * I1I / Oo
 return Oo0oO0O0O
 if 17 - 17: iI1iI11Ii111 . iI1iI11Ii111
 if 35 - 35: iI1iI11Ii111 % iI1iI11Ii111 / i1 / Iii1i * IiIIii11Ii
@ bp . route ( '/edit_wifinetconfigure' , methods = [ 'POST' ] )
@ login_required
def web_edit_wifinetconfigure ( ) :
 if 11 - 11: OooOoo - iI1iI11Ii111 % IiIIii11Ii - ooo000 / IIiIIiIi11I1 - OooOoo
 if 21 - 21: Ii / Ooo0Ooo
 if 98 - 98: ooOOO
 if 53 - 53: I1I * I1I
 if 9 - 9: iI1iI11Ii111 - IIiIIiIi11I1
 Oo0oO0O0O = "OK"
 if 89 - 89: i1 - ooo000 - Ii
 I1ii1IIiii = request . form . get ( "f_Wi_Fi_ControllerSN" )
 O0000000 = request . form . get ( "f_Wi_Fi_Name" )
 iIii11I1i = request . form . get ( "f_Wi_Fi_Password" )
 Ooo = request . form . get ( "f_Wi_Fi_TcpServerIP" )
 Oo00OOO0OOO0 = request . form . get ( "f_Wi_Fi_TcpServerPort" )
 iii1i1Iii1 = request . form . get ( "f_Wi_Fi_UdpServerIP" )
 i11I1i11I1 = request . form . get ( "f_Wi_Fi_UdpServerPort" )
 if 72 - 72: Ii % oOo0O00 / ooo000 - oOo0O00
 if 100 - 100: I1Ii1I1 - oOo0O00 - iI1iI11Ii111
 if iii1i1Iii1 != "" :
  if not O00OOoooo0o0O ( iii1i1Iii1 ) :
   Oo0oO0O0O = "UDP DataServerIP {}  invalid. please input valid value" . format ( iii1i1Iii1 )
   return Oo0oO0O0O
  if vwAppConfig . parseInt ( i11I1i11I1 ) <= 0 :
   Oo0oO0O0O = "UDP DataServerPort {}  invalid. please input valid value" . format ( i11I1i11I1 )
   return Oo0oO0O0O
   if 7 - 7: OooOoo % iI1iII1I1I1i - I11iiIi11i1I . I1Ii1I1 . oOO % OooOoo
   if 51 - 51: iI1iII1I1I1i + I1Ii1I1 . i1I - I1I
   if 59 - 59: ooOOO
 if Ooo != "" :
  if not O00OOoooo0o0O ( Ooo ) :
   Oo0oO0O0O = "TCP DataServerIP {}  invalid. please input valid value" . format ( Ooo )
   return Oo0oO0O0O
  if vwAppConfig . parseInt ( Oo00OOO0OOO0 ) <= 0 :
   Oo0oO0O0O = "TCP DataServerPort {}  invalid. please input valid value" . format ( Oo00OOO0OOO0 )
   return Oo0oO0O0O
 else :
  Oo0oO0O0O = "Please input TCP DataServerIP" . format ( "" )
  return Oo0oO0O0O
  if 42 - 42: I1Ii1I1 * Oo * Oo . iI1iII1I1I1i * IiIIii11Ii * i1i1i1111I
 vwAppConfig . vwlog ( '{}--{}[{}]' . format ( g . user . f_OperatorName ,
 "Wi-Fi Configuration {} -- Start" . format ( I1ii1IIiii ) ,
 request . form ) )
 if 68 - 68: I11iiIi11i1I - I1Ii1I1 % oOO - Ii - i1iiIII111 / i1I
 o00o0OOoO = "900000FFFFFFFF"
 oO0o = iii1i1Iii1
 O0o0000oooOO = i11I1i11I1
 o0O = 30
 if len ( oO0o ) == 0 :
  oO0o = "0.0.0.0"
  O0o0000oooOO = "0"
 if len ( O0o0000oooOO ) == 0 :
  O0o0000oooOO = '61005'
 OoOO00o = oO0o . split ( "." )
 for II1ii1iIIiI1 in OoOO00o :
  o00o0OOoO += WGTools . getHexString1Byte ( int ( II1ii1iIIiI1 ) )
 o00o0OOoO += WGTools . getHexString2Byte ( int ( O0o0000oooOO ) )
 o00o0OOoO += WGTools . getHexString1Byte ( int ( o0O ) )
 o00o0OOoO += "00"
 o00o0OOoO += "00"
 o00o0OOoO += "01"
 o00o0OOoO += "000000000000"
 o00o0OOoO += ""
 if 85 - 85: OooOoo / I1Ii1I1
 oO0o = Ooo
 O0o0000oooOO = Oo00OOO0OOO0
 o0O = 30
 if len ( oO0o ) == 0 :
  oO0o = "0.0.0.0"
  O0o0000oooOO = "0"
 if len ( O0o0000oooOO ) == 0 :
  O0o0000oooOO = '61005'
 OoOO00o = oO0o . split ( "." )
 for II1ii1iIIiI1 in OoOO00o :
  o00o0OOoO += WGTools . getHexString1Byte ( int ( II1ii1iIIiI1 ) )
 o00o0OOoO += WGTools . getHexString2Byte ( int ( O0o0000oooOO ) )
 o00o0OOoO += "00"
 o00o0OOoO += "00"
 o00o0OOoO += "01"
 if 99 - 99: Ooo0Ooo . oOo0O00 + iI1iII1I1I1i * I1Ii1I1 + OooOoo . I1I
 IiI1ii = "F20000FFFFFFFF55AAAA559A01A5" . ljust ( 126 , '0' )
 iiIiI1iIIIi = "F20000FFFFFFFF55AAAA55FFFFFF"
 IiI1ii = "F80000FFFFFFFFAA5555AA"
 IIOo0Ooo00OO = O0000000 . encode ( 'utf-8' )
 iIi1 = 0
 for II1ii1iIIiI1 in IIOo0Ooo00OO :
  IiI1ii += WGTools . getHexString1Byte ( int ( II1ii1iIIiI1 ) )
  iIi1 = iIi1 + 1
  if iIi1 == 28 :
   break
 IiI1ii = IiI1ii . ljust ( 43 * 2 , '0' )
 O00 = iIii11I1i . encode ( 'utf-8' )
 iIi1 = 0
 for II1ii1iIIiI1 in O00 :
  IiI1ii += WGTools . getHexString1Byte ( int ( II1ii1iIIiI1 ) )
  iIi1 = iIi1 + 1
  if iIi1 == 16 :
   break
 IiI1ii = IiI1ii . ljust ( 59 * 2 , '0' )
 if len ( IIOo0Ooo00OO ) > 28 :
  for II1ii1iIIiI1 in IIOo0Ooo00OO :
   if iIi1 >= 28 :
    IiI1ii += WGTools . getHexString1Byte ( int ( II1ii1iIIiI1 ) )
   iIi1 = iIi1 + 1
   if iIi1 == 32 :
    break
 IiI1ii = IiI1ii . ljust ( 63 * 2 , '0' )
 if 1 - 1: ooOOO % iI1iI11Ii111
 if 81 - 81: Ii / OooOoo / IiIIii11Ii . OooOoo . Ii
 if 86 - 86: oOo0O00 % i1i1i1111I + Oo . I1Ii1I1 - I1Ii1I1
 if 87 - 87: iI1iI11Ii111 % oOO % I1Ii1I1
 if 59 - 59: IiIIii11Ii % i1i1i1111I . i1iiIII111 + ooo000 + Ooo0Ooo . oOO
 if 9 - 9: OooOoo - ooOOO . i1iiIII111
 if 68 - 68: I1I % I1I * Ii % Oo
 ooOOOoOO0 = vwAppConfig . parseInt ( I1ii1IIiii )
 I11IIiI1I1I = {
 "jsonrpc" : "2.0" ,
 "method" : "Primit64ByteCommand" ,
 "params" : [ { 'ControllerSN' : ooOOOoOO0 ,
 'CommandPacket' : '17{}' . format ( o00o0OOoO . ljust ( 126 , '0' ) ) ,
 } ] ,
 "id" : "1005"
 }
 oo0O = sendByHttpWithMsg ( I11IIiI1I1I )
 if vwAppConfig . successIsTrue ( oo0O ) :
  I111II1II111I = "F20000FFFFFFFF55AAAA55FFFFFF"
  ii1ii = ( IiI1ii . ljust ( 126 , '0' ) , I111II1II111I . ljust ( 126 , '0' ) )
  if 17 - 17: IIiIIiIi11I1 % IIiIIiIi11I1 % I1Ii1I1 - i1 % oOo0O00
  I11IIiI1I1I = {
 "jsonrpc" : "2.0" ,
 "method" : "Primit64ByteCommand" ,
 "params" : [ { 'ControllerSN' : ooOOOoOO0 ,
 'CommandPacket' : WGTools . getarrStringWithsplitDou ( ii1ii )
 } ] ,
 "id" : "1005"
 }
  oo0O = sendByHttpWithMsg ( I11IIiI1I1I , 1 )
  if 25 - 25: Oo
 else :
  return "Communication Failed -2"
 vwAppConfig . vwlog ( '{}--{}[{}]' . format ( g . user . f_OperatorName ,
 "Wi-Fi Configuration {}" . format ( I1ii1IIiii ) , Oo0oO0O0O ) )
 I11IIiI1I1I = {
 "jsonrpc" : "2.0" ,
 "method" : "ExternFunctions" ,
 "params" : [
 {
 "FunctionName" : "SearchController"
 }
 ] ,
 "id" : 4001
 }
 Oo0oO0O0O = vwAppConfig . sendByHttpWithMsg ( I11IIiI1I1I )
 return Oo0oO0O0O
 if 4 - 4: Oo * I1I * Ooo0Ooo % Ooo0Ooo
 if 6 - 6: oOO + I1I * Iii1i
 if 82 - 82: oOo0O00 * ooOOO
 if 9 - 9: I11iiIi11i1I + i1iiIII111 % Iii1i
 if 15 - 15: i1iiIII111 + i1I - Iii1i % I1I / i1iiIII111 + IIiIIiIi11I1
def ooOo0O0OOO0o ( sn , conid , wgcondata ) :
 I11IIiI1I1I = ( {
 "jsonrpc" : "2.0" ,
 "method" : "QueryControllerStatus" ,
 "params" : [ { "ControllerSN" : sn } ] ,
 "id" : 1002
 } )
 if sendByHttp ( I11IIiI1I1I ) == "OK" :
  wgcondata . uploadedSNConnectedOK . append ( sn )
  wgcondata . uploadedIdConnectedOK . append ( conid )
  wgcondata . recvsnpri . append ( conid )
 else :
  wgcondata . uploadedSNFailed . append ( sn )
  if 67 - 67: i1iiIII111 % oOO % Iii1i
@ bp . route ( '/console_onekey_selected' , methods = [ 'POST' ] )
@ login_required
def web_console_onekey_selected ( ) :
 Oo0oO0O0O = 'OK'
 i1iI = request . form . get ( "selecteddoor" )
 if 27 - 27: i1iiIII111 * i1i1i1111I + ooOOO / i1iiIII111 . ooo000
 if len ( i1iI ) == 0 :
  return "OK"
 I1iI = request . form . get ( "selOperate" )
 if 91 - 91: Ii * Ooo0Ooo + i1i1i1111I
 if 64 - 64: iI1iII1I1I1i + oOo0O00
 if 28 - 28: I1Ii1I1 + IiIIii11Ii . I1I . iI1iII1I1I1i . I11iiIi11i1I
 if 4 - 4: OooOoo % i1iiIII111 / I11iiIi11i1I - oOo0O00
 if 100 - 100: Oo / OooOoo % I1I
 if 93 - 93: iI1iII1I1I1i
 i1iI = i1iI . split ( "," )
 i1iI = [ int ( x ) for x in i1iI ]
 i1iI . sort ( )
 oO = None
 iIii111 = None
 if 40 - 40: i1I
 if I1iI == "CloseDoor" :
  oO = oooOO0O ( i1iI , "CloseDoor" )
 if I1iI == "OpenDoor" :
  oO = oooOO0O ( i1iI , "OpenDoor" )
  if 99 - 99: Oo * OooOoo + ooOOO / Oo
  if 2 - 2: I11iiIi11i1I % I1I . IiIIii11Ii % i1iiIII111 % ooOOO
  if 19 - 19: i1I + I1Ii1I1 / oOo0O00 . i1iiIII111 % iI1iII1I1I1i % Ii
  if 17 - 17: IIiIIiIi11I1
 print ( "Doors={}" . format ( len ( i1iI ) ) )
 if 87 - 87: Oo
 if 50 - 50: i1i1i1111I
 Oo0oO0O0O = { "configure" : oO , "pri" : iIii111 }
 vwAppConfig . vwlog ( '{}--{}[{}]' . format ( g . user . f_OperatorName ,
 "{}-One-click Operation" . format ( "" ) , Oo0oO0O0O ) )
 return Oo0oO0O0O
 if 55 - 55: iI1iI11Ii111 / iI1iII1I1I1i % IiIIii11Ii % oOo0O00
 if 43 - 43: oOO * i1i1i1111I
def oooOO0O ( doorDst , opDoor ) :
 print ( "uploadSelectedConfigure" )
 Ooo0OO00oo00O = WGControllerPri2023 ( )
 IiIIII11 = ""
 for II1ii1iIIiI1 in doorDst :
  IiIIII11 += str ( II1ii1iIIiI1 ) + ","
 IiIIII11 += '0'
 if 97 - 97: OooOoo % iI1iII1I1I1i . iI1iII1I1I1i . oOo0O00
 Oo0 = db . session . query ( TBController . f_ControllerID , TBController . f_ControllerSN ) . join ( TBDoor ,
 TBDoor . f_ControllerID == TBController . f_ControllerID ) . filter (
 TBDoor . f_DoorID . in_ ( doorDst ) )
 Oo0 = db . session . query ( TBController . f_ControllerID , TBController . f_ControllerSN , TBDoor . f_DoorNO , TBDoor . f_DoorID ) . join ( TBDoor ,
 TBDoor . f_ControllerID == TBController . f_ControllerID ) . filter (
 TBDoor . f_DoorID . in_ ( doorDst ) )
 OOOOo = Oo0 . all ( )
 for II1ii1iIIiI1 in OOOOo :
  ooOOOoOO0 = II1ii1iIIiI1 . f_ControllerSN
  if ooOOOoOO0 not in Ooo0OO00oo00O . uploadedSN :
   ooo0O0ooooo0o = II1ii1iIIiI1 . f_ControllerID
   Ooo0OO00oo00O . uploadedSN . append ( ooOOOoOO0 )
   o0oOO = threading . Thread ( target = ooOo0O0OOO0o , args = ( ooOOOoOO0 , ooo0O0ooooo0o , Ooo0OO00oo00O ) )
   o0oOO . start ( )
 ii = time . time ( )
 while time . time ( ) < ii + 10 :
  if len ( Ooo0OO00oo00O . uploadedSNConnectedOK ) + len ( Ooo0OO00oo00O . uploadedSNFailed ) == len ( Ooo0OO00oo00O . uploadedSN ) :
   break
  time . sleep ( 0.1 )
 print ( "uploadedSNConnectedOK" )
 print ( Ooo0OO00oo00O . uploadedSNConnectedOK )
 if 88 - 88: iI1iII1I1I1i * i1 - OooOoo / ooOOO % ooo000 + I1Ii1I1
 if len ( Ooo0OO00oo00O . uploadedSNConnectedOK ) > 0 :
  for Ooo0O00o in range ( len ( Ooo0OO00oo00O . uploadedSNConnectedOK ) ) :
   ooo0O0ooooo0o = Ooo0OO00oo00O . uploadedIdConnectedOK [ Ooo0O00o ]
   ooOOOoOO0 = Ooo0OO00oo00O . uploadedSNConnectedOK [ Ooo0O00o ]
   OOooOoOOO = vwAppConfig . wgMjControllerConfigure ( )
   for II1ii1iIIiI1 in OOOOo :
    I11i1iI = II1ii1iIIiI1 . f_ControllerSN
    if ooOOOoOO0 == I11i1iI :
     I1iI1II1Ii = II1ii1iIIiI1 . f_DoorNO
     if opDoor == "CloseDoor" :
      OOooOoOOO . DoorControlSet ( I1iI1II1Ii , 3 )
     elif opDoor == "OpenDoor" :
      OOooOoOOO . DoorControlSet ( I1iI1II1Ii , 1 )
      if 80 - 80: I1Ii1I1 % IIiIIiIi11I1
      if 50 - 50: i1iiIII111
      if 27 - 27: Ooo0Ooo % i1I - oOO + i1 * i1i1i1111I / i1I
      if 63 - 63: i1I
      if 77 - 77: oOO + iI1iII1I1I1i . oOo0O00 / ooo000
      if 9 - 9: iI1iI11Ii111 . i1iiIII111 - Ii - I1I . OooOoo
      if 75 - 75: OooOoo . OooOoo * oOO - ooo000 + i1I % iI1iII1I1I1i
   o0oOO = threading . Thread ( target = uploadSingleConfigure ,
 args = ( ooOOOoOO0 , OOooOoOOO , Ooo0OO00oo00O , None ) )
   o0oOO . start ( )
   if 26 - 26: i1iiIII111 * oOo0O00
   if 73 - 73: Ooo0Ooo + IiIIii11Ii * i1I . iI1iI11Ii111 . ooo000 % OooOoo
   if 38 - 38: IiIIii11Ii
 OooOoO = time . time ( ) + vwAppConfigParam . uploadpri_timeout_second + ( 0 / 1000 ) * 2
 while time . time ( ) < OooOoO :
  if len ( Ooo0OO00oo00O . recvsnpri ) > 0 :
   Ooo0OO00oo00O . recvsnpri . clear ( )
   if 71 - 71: Iii1i
   O00OOo0Ooo00O = time . time ( ) + vwAppConfigParam . uploadpri_timeout_second
   if O00OOo0Ooo00O > OooOoO :
    OooOoO = O00OOo0Ooo00O
    if 91 - 91: Oo + Iii1i + Ooo0Ooo / i1I * ooo000
  if len ( Ooo0OO00oo00O . uploadedSNOK ) + len ( Ooo0OO00oo00O . uploadedSNFailed ) == len ( Ooo0OO00oo00O . uploadedSN ) and len (
 Ooo0OO00oo00O . uploadedSNOK_Delete ) + len (
 Ooo0OO00oo00O . uploadedSNFailed_Delete ) == len ( Ooo0OO00oo00O . uploadedSN_Delete ) :
   break
   if 81 - 81: ooo000 * ooo000 - Ooo0Ooo
 Oo0 = db . session . query ( TBController . f_ControllerID , TBController . f_ControllerSN , TBDoor . f_DoorNO ,
 TBDoor . f_DoorID ) . join ( TBDoor ,
 TBDoor . f_ControllerID == TBController . f_ControllerID )
 Ii1iiiII11 = Oo0 . all ( )
 if 70 - 70: I1Ii1I1 * IIiIIiIi11I1
 i1IIIIiIII1 = [ ]
 i1i11i = [ ]
 II1Ii1i1 = [ ]
 iI1I1i1ii = [ ]
 for Iii1I1 in doorDst :
  IiIIII11 += str ( Iii1I1 ) + ","
  for II1ii1iIIiI1 in Ii1iiiII11 :
   ooOOOoOO0 = II1ii1iIIiI1 . f_ControllerSN
   if 18 - 18: ooo000 % IiIIii11Ii
   if 54 - 54: OooOoo + OooOoo
   if Iii1I1 == II1ii1iIIiI1 . f_DoorID :
    Oo00o00OooOoo = - 1
    try :
     Oo00o00OooOoo = Ooo0OO00oo00O . uploadedSNOK . index ( ooOOOoOO0 )
    except :
     Oo00o00OooOoo = - 1
     if 2 - 2: Iii1i
    if Oo00o00OooOoo >= 0 :
     i1IIIIiIII1 . append ( Iii1I1 )
     if 19 - 19: Ooo0Ooo - i1i1i1111I / Ooo0Ooo / iI1iI11Ii111 - iI1iI11Ii111 - I1Ii1I1
    else :
     try :
      Oo00o00OooOoo = Ooo0OO00oo00O . uploadedSNConnectedOK . index ( ooOOOoOO0 )
     except :
      Oo00o00OooOoo = - 1
     if Oo00o00OooOoo < 0 :
      II1Ii1i1 . append ( Iii1I1 )
     else :
      iI1I1i1ii . append ( Iii1I1 )
      if 59 - 59: oOO - ooo000 - i1 + Ooo0Ooo / iI1iI11Ii111
 return { "updateConOK" : Ooo0OO00oo00O . uploadedSNOK , "updateConFailed" : Ooo0OO00oo00O . uploadedSNFailed ,
 "doorID_OK" : i1IIIIiIII1 ,
 "doorID_NotConnected" : II1Ii1i1 , "doorID_Fail" : iI1I1i1ii }
 if 1 - 1: i1 - I11iiIi11i1I * Ooo0Ooo + i1I % IiIIii11Ii
@ bp . route ( '/extern_console_location_query' , methods = [ 'GET' , 'POST' ] )
@ login_required
def web_extern_console_location_query ( ) :
 iI1Ii1I1ii1 = AddDepartmentForm ( )
 return render_template ( "wgcomm/extern-console-location-query.html" , wgform = iI1Ii1I1ii1 )
 if 94 - 94: iI1iII1I1I1i + i1i1i1111I % iI1iI11Ii111 % i1 . IIiIIiIi11I1
@ bp . route ( '/extern_console_location_query_realize' , methods = [ 'POST' ] )
@ login_required
def web_extern_console_location_query_realize ( ) :
 IiI1iII1I11 = request . form . get ( "consumername" )
 TBConsumer . query . all ( )
 Oo0 = db . session . query ( TBConsumer . f_ConsumerID , TBConsumer . f_ConsumerNO , TBConsumer . f_ConsumerName ,
 TBConsumer . f_CardNO , TBConsumer . f_BeginYMD ,
 TBConsumer . f_EndYMD , TBGroup . f_GroupName ) . join ( TBGroup ,
 TBConsumer . f_GroupID == TBGroup . f_GroupID , isouter = True ) . filter ( TBConsumer . f_ConsumerName . like ( "%{0}%" . format ( IiI1iII1I11 ) , escape = '\\' ) )
 OOOoo00 = Oo0 . all ( )
 Oo0oO0O0O = ""
 if OOOoo00 :
  Oo0oO0O0O = ""
  O0oo0O00oOOoo = [ ]
  if 65 - 65: ooOOO
  if 33 - 33: ooOOO % ooOOO
  if 33 - 33: Oo
  if 78 - 78: OooOoo % iI1iII1I1I1i
  if 48 - 48: i1 + IIiIIiIi11I1
  iii1iII = datetime . now ( ) + timedelta ( days = 2 )
  for II1ii1iIIiI1 in OOOoo00 :
   if 99 - 99: iI1iII1I1I1i / I1Ii1I1 * i1I / IiIIii11Ii
   if 7 - 7: Oo + I1Ii1I1 . ooo000 - oOo0O00 - oOO - i1
   if 49 - 49: ooo000 * ooOOO - I11iiIi11i1I / Iii1i - iI1iII1I1I1i + ooo000
   if 87 - 87: Ii % oOO . IiIIii11Ii
   if 56 - 56: ooOOO * ooOOO + Oo + i1I + ooo000
   if 60 - 60: i1 * i1I * I11iiIi11i1I / I1Ii1I1 + oOO + Iii1i
   if 87 - 87: i1i1i1111I
   if 2 - 2: I11iiIi11i1I . iI1iII1I1I1i . i1 + oOo0O00
   if 33 - 33: Iii1i . iI1iI11Ii111
   I1Iiii1 = "Name:\t{}\r\n" . format ( II1ii1iIIiI1 . f_ConsumerName ) + "UserID:\t{}\r\n" . format (
 II1ii1iIIiI1 . f_ConsumerNO ) + "Department:\t{}\r\n" . format (
 II1ii1iIIiI1 . f_GroupName ) . replace ( "None" , "" )
   if 12 - 12: iI1iI11Ii111
   if 85 - 85: Oo % Oo
   if 12 - 12: ooo000 / i1I * Oo / I1Ii1I1 * ooOOO
   Oo0 = db . session . query ( TDSwiperecord2022 . f_RecID , TDSwiperecord2022 . f_CardNO ,
 TBConsumer . f_ConsumerNO , TBConsumer . f_ConsumerName ,
 TDSwiperecord2022 . f_ReadDate , TBDoor . f_DoorName ,
 TDSwiperecord2022 . f_InOut , TDSwiperecord2022 . f_Character , TDSwiperecord2022 . f_ControllerSN ,
 TDSwiperecord2022 . f_Desc ) . join (
 TBDoor , TBDoor . f_DoorID == TDSwiperecord2022 . f_DoorID , isouter = False ) . join (
 TBConsumer , TBConsumer . f_ConsumerID == TDSwiperecord2022 . f_ConsumerID , isouter = False ) . filter (
 TDSwiperecord2022 . f_ConsumerID == II1ii1iIIiI1 . f_ConsumerID ) . filter (
 TDSwiperecord2022 . f_Character > 0 ) . filter (
 TDSwiperecord2022 . f_ReadDate < iii1iII
 )
   OOOOo = Oo0 . order_by ( TDSwiperecord2022 . f_ReadDate . desc ( ) ) . offset ( 0 ) . limit ( 2 ) . all ( )
   if 38 - 38: i1i1i1111I * iI1iII1I1I1i * Ooo0Ooo + i1iiIII111
   if 33 - 33: ooOOO . Ii
   if 49 - 49: Ii + ooOOO + iI1iII1I1I1i / i1i1i1111I
   if 63 - 63: ooo000 % I1Ii1I1
   if 83 - 83: OooOoo . Ooo0Ooo % iI1iI11Ii111 / Oo
   if 57 - 57: Oo + i1i1i1111I . i1I . ooOOO * Iii1i - IIiIIiIi11I1
   if 20 - 20: Iii1i * ooo000 . OooOoo + i1iiIII111 * i1I - Iii1i
   if 66 - 66: IIiIIiIi11I1 - ooo000 - i1i1i1111I * i1 % ooo000 . IIiIIiIi11I1
   if 16 - 16: IiIIii11Ii % oOo0O00 + Ii - i1i1i1111I * IiIIii11Ii
   if 69 - 69: iI1iII1I1I1i . I1I + I1Ii1I1
   IiI1Ii11IIi1 = len ( OOOOo )
   oooo = [ desc [ 'name' ] for desc in Oo0 . column_descriptions ]
   Ii11II1I = [ dict ( zip ( oooo , row ) ) for row in OOOOo ]
   iiI1iIi = ""
   if IiI1Ii11IIi1 == 0 :
    iiI1iIi = ""
   elif ( IiI1Ii11IIi1 == 2 and
 Ii11II1I [ 0 ] [ "f_ControllerSN" ] == Ii11II1I [ 1 ] [ "f_ControllerSN" ] and
 ( Ii11II1I [ 0 ] [ "f_ReadDate" ] ) > ( Ii11II1I [ 1 ] [ "f_ReadDate" ] ) and
 Ii11II1I [ 0 ] [ "f_InOut" ] == 2 and Ii11II1I [ 1 ] [ "f_InOut" ] == 1 ) :
    if 28 - 28: I11iiIi11i1I * oOO - i1I / i1i1i1111I / OooOoo . IIiIIiIi11I1
    if 84 - 84: IIiIIiIi11I1
    if 80 - 80: i1
    if 90 - 90: Iii1i / Ii / Oo + iI1iI11Ii111 - i1I / i1i1i1111I
    if 14 - 14: IIiIIiIi11I1
    iII11 = ( Ii11II1I [ 1 ] [ "f_ReadDate" ] )
    iiI1iIi += iII11 . strftime ( "%Y-%m-%d %H:%M:%S" ) + "   " + "Enter" + "  " + Ii11II1I [ 1 ] [ "f_DoorName" ] + "\n"
    if 52 - 52: i1I . OooOoo % i1iiIII111
    if 28 - 28: i1I
    if 23 - 23: Oo . OooOoo + Ooo0Ooo
    if 22 - 22: oOO + iI1iII1I1I1i / i1I / OooOoo . iI1iI11Ii111 . ooo000
    iiiiii111 = ( Ii11II1I [ 0 ] [ "f_ReadDate" ] )
    iiI1iIi += iiiiii111 . strftime ( "%Y-%m-%d %H:%M:%S" ) + "   " + "Leave" + "  " + ( Ii11II1I [ 0 ] [ "f_DoorName" ] ) + "\n"
    if 37 - 37: IIiIIiIi11I1 * OooOoo * OooOoo / ooOOO
    if 67 - 67: i1 - iI1iI11Ii111 / Ii * iI1iI11Ii111
    if 24 - 24: iI1iI11Ii111 - oOo0O00 . Ooo0Ooo + oOO . I1I / Oo
    I1iI11iIii = iiiiii111 - iII11
    iiI1iIi += "Dwell time:  "
    if 15 - 15: IIiIIiIi11I1 * IIiIIiIi11I1
    if I1iI11iIii . days >= 1 :
     iiI1iIi += "{0} day(s) " . format ( I1iI11iIii . days )
    if I1iI11iIii . seconds // 3600 > 0 :
     iiI1iIi += "{0} hour " . format ( I1iI11iIii . seconds // 3600 )
    if ( I1iI11iIii . seconds % 3600 ) // 60 > 0 :
     iiI1iIi += "{0} minutes" . format ( ( I1iI11iIii . seconds % 3600 ) // 60 )
     if 23 - 23: Ii * Ii
   else :
    if 83 - 83: I1I + ooOOO - i1iiIII111
    if 79 - 79: Oo . Ii * I1Ii1I1 % I1Ii1I1
    if 4 - 4: Oo % i1 . iI1iII1I1I1i * i1I
    if Ii11II1I [ 0 ] [ "f_InOut" ] == 2 :
     iiI1iIi += "Entered without swiping card\n"
     iiiiii111 = ( Ii11II1I [ 0 ] [ "f_ReadDate" ] )
     iiI1iIi += iiiiii111 . strftime ( "%Y-%m-%d %H:%M:%S" ) + "   " + "Leave" + "    " + ( Ii11II1I [ 0 ] [ "f_DoorName" ] ) + "\n"
     if 75 - 75: I1I - i1iiIII111 * i1
     iiI1iIi += "Dwell time:  "
    else :
     iiiiii111 = ( Ii11II1I [ 0 ] [ "f_ReadDate" ] )
     iiI1iIi += iiiiii111 . strftime ( "%Y-%m-%d %H:%M:%S" ) + "   " + "Enter" + "    " + ( Ii11II1I [ 0 ] [ "f_DoorName" ] ) + "\n"
     if 100 - 100: i1iiIII111
     iiI1iIi += "Not left\n"
     iiI1iIi += "Dwell time:  "
     if 30 - 30: i1
     if 95 - 95: ooo000 / i1i1i1111I / i1I - IIiIIiIi11I1
     I1iI11iIii = datetime . now ( ) - iiiiii111
     if 7 - 7: I1I / iI1iII1I1I1i % ooo000 / IiIIii11Ii
     if I1iI11iIii . total_seconds ( ) < 0 :
      iiI1iIi += "[Later than the current time] "
     else :
      if I1iI11iIii . days >= 1 :
       iiI1iIi += "{0} day(s) " . format ( I1iI11iIii . days )
      if I1iI11iIii . seconds // 3600 > 0 :
       iiI1iIi += "{0} hour " . format ( I1iI11iIii . seconds // 3600 )
      if ( I1iI11iIii . seconds % 3600 ) // 60 > 0 :
       iiI1iIi += "{0} minutes" . format ( ( I1iI11iIii . seconds % 3600 ) // 60 )
   I1Iiii1 += "Location:\r\n{}\r\n" . format ( iiI1iIi )
   if 18 - 18: I1I * IiIIii11Ii * I1I + i1iiIII111
   O0oo0O00oOOoo . append ( I1Iiii1 )
  if len ( O0oo0O00oOOoo ) > 0 :
   Oo0oO0O0O = "\r\n" . join ( O0oo0O00oOOoo )
   if 17 - 17: i1I
   if 8 - 8: Oo / iI1iII1I1I1i - Ooo0Ooo
 return Oo0oO0O0O
 if 22 - 22: oOo0O00 / I1Ii1I1 % iI1iI11Ii111
 if 22 - 22: i1 % Ooo0Ooo . IIiIIiIi11I1 % i1I / IIiIIiIi11I1
 if 60 - 60: Ooo0Ooo . i1 * i1
 if 42 - 42: i1 % OooOoo % Iii1i % Ooo0Ooo
 if 6 - 6: IIiIIiIi11I1
 if 94 - 94: Ooo0Ooo . ooo000 % Oo - IIiIIiIi11I1 - i1
 if 11 - 11: Ooo0Ooo . OooOoo / oOo0O00 + i1i1i1111I / Iii1i
 if 62 - 62: I1Ii1I1 + iI1iII1I1I1i * i1I % iI1iII1I1I1i . OooOoo - ooo000
 if 24 - 24: iI1iII1I1I1i * Iii1i * i1i1i1111I
 if 50 - 50: I11iiIi11i1I + oOo0O00 . ooOOO - iI1iI11Ii111 * i1I % I1I
 if 88 - 88: iI1iI11Ii111
 if 43 - 43: I11iiIi11i1I . IiIIii11Ii * Oo . IiIIii11Ii - iI1iI11Ii111 - Ii
 if 47 - 47: oOO / i1i1i1111I * oOO
 if 91 - 91: i1iiIII111 / i1
 if 70 - 70: IIiIIiIi11I1
 if 95 - 95: I1I * i1 * IiIIii11Ii + I11iiIi11i1I + Ooo0Ooo
 if 36 - 36: i1i1i1111I
 if 48 - 48: IIiIIiIi11I1 - I11iiIi11i1I % Oo
 if 61 - 61: oOO % iI1iII1I1I1i + IiIIii11Ii % i1i1i1111I * iI1iII1I1I1i / i1i1i1111I
 if 11 - 11: oOo0O00 / Oo . ooOOO / Oo
 if 90 - 90: OooOoo - I1I
 if 67 - 67: oOo0O00 . oOO - IIiIIiIi11I1 / Ooo0Ooo + Iii1i - oOo0O00
 if 25 - 25: Iii1i
# dd678faae9ac167bc83abf78e5cb2f3f0688d3a3
