def setUp(self): global lg, data, token, groupId, csm, planId, phoneId, auto_test, sip, sip_id, group_number data = GetValue() #登录 lg = Login(data.getvalue('product_address')) res = lg.login(data.getvalue('account'), data.getvalue('product_password')) token = res['data']['token'] self.assertEqual(res['data']['userName'], data.getvalue('account')) self.assertEqual(res['data']['accountType'], 1) #创建客户组手动上传号码 csm = CustomerManage(data.getvalue('product_address')) res2 = csm.addPhoneNumber(token, data.getvalue('userid'), ['17200001999'], 1, 'autoTest') self.assertEqual(res2['status'], 1000) self.assertEqual(res2['msg'], '操作成功') #查询mongodb获取groupId product = Mongodb('outbound_product', 'phone_number', '172.20.10.20', 27017) table = product.connect_mongodb() res3 = product.mongodb_find(table, { 'userId': 21, 'groupName': 'autoTest' }) for item in res3: groupId = item['groupId'] #添加SIP sip = sipManage(data.getvalue('product_address')) res = sip.add_sip(token) self.assertEqual(res['status'], 1000) self.assertEqual(res['msg'], '操作成功') #查询mysql获取线路id、group_number product_m = Mysql('172.20.10.14', 3306, 'root', 'kalamodo', 'outbound_product') con = product_m.connect_mysql() res = product_m.mysql_select( con[0], 'SELECT id,group_number FROM ko_sipmanager where privately=21') for row in res: sip_id = row[0] group_number = row[1] #创建外呼计划 auto_test = OutPlan(data.getvalue('product_address')) res = auto_test.creat_outplan(token, data.getvalue('userid'), '3706', 'autoTest', '尚德销售纵线白名单', sip_id, groupId) planId = res['data']['planId'] self.assertEqual(res['status'], 1000) self.assertEqual(res['msg'], '操作成功') #获取phoneid res = auto_test.get_CallDetail(token, planId) phoneId = res['data']['list'][0]['id']
def setUp(self): global lg,token lg = Login(product_address) res = lg.login(account,product_password) token=res['data']['token'] self.assertEqual(res['data']['userName'],account) self.assertEqual(res['data']['accountType'], 1)
def setUp(self): global lg, token, groupId, csm, planId, phoneId, auto_test, sip, sip_id, group_number #登录 lg = Login(product_address) res = lg.login(account, product_password) token = res['data']['token'] self.assertEqual(res['data']['userName'], account) self.assertEqual(res['data']['accountType'], 1) #创建客户组手动上传号码 csm = CustomerManage(product_address) res2 = csm.addPhoneNumber(token, userid, phonum_list, 1, auto_name) self.assertEqual(res2['status'], code_1000) self.assertEqual(res2['msg'], import_suc) #查询mongodb获取groupId product = Mongodb(dbname, table_phonum, db_ip, db_port) table = product.connect_mongodb() res3 = product.mongodb_find(table, { 'userId': privately, 'groupName': auto_name }) for item in res3: groupId = item['groupId'] #添加SIP sip = sipManage(product_address) res = sip.add_sip(token, username, password, ip, port, comment, lineType, groupSize) self.assertEqual(res['status'], code_1000) self.assertEqual(res['msg'], success) #查询mysql获取线路id、group_number product_m = Mysql(myq_ip, myq_port, myq_user, myq_pswd, dbname) con = product_m.connect_mysql() res = product_m.mysql_select( con[0], 'SELECT id,group_number FROM ko_sipmanager where privately=21') for row in res: sip_id = row[0] group_number = row[1] #创建外呼计划 auto_test = OutPlan(product_address) res = auto_test.creat_outplan(token, userid, '3706', auto_name, '尚德销售纵线白名单', sip_id, groupId) planId = res['data']['planId'] self.assertEqual(res['status'], code_1000) self.assertEqual(res['msg'], success) #获取phoneid res = auto_test.get_CallDetail(token, planId) phoneId = res['data']['list'][0]['id']
def setUp(self): global lg,data,token data = GetValue() lg = Login(data.getvalue('uat_address')) res = lg.login(data.getvalue('account'), data.getvalue('uat_password')) token=res['data']['token'] self.assertEqual(res['data']['userName'], data.getvalue('account')) self.assertEqual(res['data']['accountType'], 1)
class get_ticket: canzhanshang_session = Login().send_login_request(name=13690769964, password=123456) zhubanfang_session = Login().send_login_request(name=18165702795, password=123456) def get_ticket(self, exhibition_id): #获取展会门票 ticket_lxml_url = 'http://exh.zhankoo-uat.com//exhibition/partial/_DetailActivityRegister?organizorID=12880853&eID=%s' % exhibition_id get_ticket_url = 'http://exh.zhankoo-uat.com/Exhibition/Home/ActivityRegisterSave' web_request_ticket = requests.get(url=ticket_lxml_url) soup = BeautifulSoup(web_request_ticket.text, 'lxml') ticket_active_id = soup.select('input')[0].get('value') ticket_name = soup.select('input')[0].get('title') from_on = soup.select('input')[0].get('data-from') to_on = soup.select('input')[0].get('data-to') data = { 'ExhibitionID': exhibition_id, 'TicketActiveID': ticket_active_id, 'TicketName': ticket_name, 'FromOn': from_on, 'ToOn': to_on, 'OrganizorID': '12880853', 'RealName': '测试', 'EnterpriseName': '深圳展酷网络有限公司', 'Title': 'test', 'X-Requested-With': 'XMLHttpRequest' } web_request = self.canzhanshang_session.post(url=get_ticket_url, data=data) assert json.loads(web_request.text)['success'] def update_ticket_pass(self): #主办方审核通过展会门票 organizer_ticket_page_url = 'http://exh.zhankoo-uat.com/Exhibition/Partial/_OrganizerTicketPage' organizer_ticket_page_data = { 'pageIndex': 1, 'pageSize': 20, 'State': '所有状态' } web_request_organizer_ticket_page = self.zhubanfang_session.post( url=organizer_ticket_page_url, data=organizer_ticket_page_data) ticket_id = str( BeautifulSoup(web_request_organizer_ticket_page.text, 'lxml')('a')[0])[51:56] update_ticket_pass_url = 'http://exh.zhankoo-uat.com/Exhibition/Organizer/UpdateTicketPass' data = {'ticketID': ticket_id, 'checkOpinion': ''} web_request = self.zhubanfang_session.post(url=update_ticket_pass_url, data=data) assert json.loads(web_request.text)['success']
def setUp(self): global lg,data data = GetValue() lg = Login(data.getvalue('dev_address')) res = lg.login(data.getvalue('account'), data.getvalue('dev_password')) try: self.assertEqual(res['data']['username'], data.getvalue('account')) self.assertEqual(res['data']['accountType'], 1) except Exception as e: print(e)
def setUp(self): super().setUp() QApplication(sys.argv) self.login_ = Login() User.db.connect() User.users.create(username=TEST_USERNAME, passwd="") User.db.close() self.to_remove = [TEST_USERNAME]
class Get_Var_Fun: zhubanfang_session = Login().send_login_request(name=18165702795, password=123456) back_session = Login().send_back_login_request() def zhubanfang_zhanhui_liebiao_var(self): #主办方展会列表 url = 'http://exh.zhankoo-uat.com/Exhibition/Partial/_ListPage' data = { 'pageIndex': 1, 'pageSize': 10, 'FromOn': '', 'ToOn': '', 'Name': '' } web_request = self.zhubanfang_session.post(url=url, data=data) soup = BeautifulSoup(web_request.text, 'lxml') exhibition_name = re.findall( r'"_blank">(.+?.)</a>', str(soup.select('td.txtleft a')[0]))[0] #主办方列表展会名称 exhibition_id = re.findall( r'(\d.*).html"', str(soup.select('td.txtleft a')[0]))[0] #主办方列表展会ID return exhibition_name, exhibition_id def back_dajianshang_guangli_var(self): designer_find_paged_url = 'http://back.zhankoo-uat.com/AMemeber/User/DesignerFindPaged' data = { 'UserID': '', 'page': 1, 'rows': 20, 'sort': 'Order', 'order': 'ASC' } web_request = self.back_session.post(url=designer_find_paged_url, data=data) designer_rows = json.loads(web_request.text)['rows'] designer_list = [] #后台设计师ID列表 for designer_rows_for in designer_rows: designer_list.append(designer_rows_for['ID']) return designer_list
class LoginDialogTests(unittest.TestCase): def setUp(self): super().setUp() QApplication(sys.argv) self.login_ = Login() User.db.connect() User.users.create(username=TEST_USERNAME, passwd="") User.db.close() self.to_remove = [TEST_USERNAME] def tearDown(self): super().tearDown() User.db.connect() for user_to_remove in self.to_remove: User.users.delete().where( User.users.username == user_to_remove).execute() User.db.close() def test_login(self): """login works well""" logged_in = self.login_.log_in(TEST_USERNAME, "") self.assertTrue(logged_in, msg="Error simply logging in") def test_incorrect_pair(self): """no user with this username or u-p pair""" username = '******' * 20 logged_in = self.login_.log_in(username, '') self.assertFalse( logged_in, msg="Succeded logging in with incorrect pair login-password") def test_no_login(self): """no username occured in required field""" username = '******' * 20 logged_in = self.login_.log_in(username, '') self.assertFalse( logged_in, msg="Succeded logging in with incorrect pair login-password") def test_sign_up(self): """sign up works well""" username = '******' * 20 signed_up = self.login_.sign_up(username, '') self.assertTrue(signed_up, msg="Error signing up") self.to_remove.append(username) def test_sign_up_empty_login(self): """cannot sign up without login""" signed_up = self.login_.sign_up('', '') self.assertFalse(signed_up, msg="Succeded signing up with empty login") def test_sign_up_existing_login(self): """error if user already exists""" signed_up = self.login_.sign_up(TEST_USERNAME, '') self.assertFalse(signed_up, msg="Created account twice")
def __init__(self, config=None): self.logger = logging.getLogger('main.' + self.__class__.__name__) p = cherrypy.process.plugins.PIDFile(cherrypy.engine, config.get('main', 'pid_file')) p.subscribe() # Create the configuration for cherrypy cherrypy.tree.mount( Login(), '/login', {'/': {'request.dispatch': cherrypy.dispatch.MethodDispatcher()} } ) cherrypy_conf = { 'server.socket_host' : '0.0.0.0', 'server.socket_port' : 80, 'server.thread_pool' : 10, # 'log.screen' : False, # 'log.error_file' : '/opt/app_api/logs/cherrypy_error.log', # 'log.access_file' : '/opt/app_api/logs/cherrypy.log' } cherrypy.config.update(cherrypy_conf)
def __init__(self): print('Welcome to the Milionaries') quest = input("Do you want to login in (L) or sign up (S)?: ") successful_login = False if quest == "L": while not successful_login: self.username = input("Enter your username: "******"Enter your password: "******"Invalid username or password.") else: print("Welcome to the platform") test = Test(self.username) test.run_test() elif quest == "S": if_account_create = False while not if_account_create: self.username = input("Enter your username: "******"Enter your password: "******"E": ') if register_quest == "E" or register_quest == "e": print('Thank you for using our app') break else: print("You type the order wrong. Restart app and try again")
class zhanzhuang_order: submit_zhanzhuang_demand_url = 'http://exh.zhankoo-uat.com/Decorate/Exhibitor/DecorateBookSave' zhanzhuang_demand_list_url = 'http://exh.zhankoo-uat.com/Decorate/Partial/_DecorateBookFindPage' zhanzhuang_demand_confirm_url = 'http://back.zhankoo-uat.com/Exhibition/Decorate/DecorateBookConfirmation' matching_company_url = 'http://back.zhankoo-uat.com/Exhibition/Decorate/MatchingCompany' demand_contract_and_price_url = 'http://back.zhankoo-uat.com/Exhibition/Decorate/DecoratePriceInsert' financ_zhanzhuang_demand_price_url = 'http://back.zhankoo-uat.com/Exhibition/Decorate/ConfirmPrice' zhanzhuang_demand_place_order_url = 'http://exh.zhankoo-uat.com/Decorate/Exhibitor/SureOrderSave' canzhanshang_session = Login().send_login_request(name=13690769964, password=123456) back_session = Login().send_back_login_request() def submit_zhanzhuang_demand(self, exhibition_id, exhibition_name, booth_id, booth_name, param): #个人中心提交展装需求 data = { 'FromSite': 10, 'FromSiteLocation': 'http://exh.zhankoo-uat.com/_Decorate_Exhibitor_DecorateBookCreate_Index', 'Subject': param['the_exhibition_title'], 'ExhibitorEnterpriseID': 519, 'ExhibitorEnterpriseName': '深圳展酷网络有限公司', 'ContactIDs': 134851, 'ProvinceName': '广东省', 'CityName': '深圳市', 'ExhibitionID': exhibition_id, 'ExhibitionName': exhibition_name, 'BoothID': booth_id, 'BoothName': booth_name, 'ServiceItem': param['service_item'], 'ProvinceCode': 440000, 'CityCode': 440300, 'FinishOn': param['finish_on'], 'DesignerDemand': param['designer_demand'], 'DecorateDemand': param['the_exhibition_demand'], 'X-Requested-With': 'XMLHttpRequest' } web_request = self.canzhanshang_session.post( url=self.submit_zhanzhuang_demand_url, data=data) assert json.loads(web_request.text)['success'] def get_zhanzhuang_demand_list_id(self): #个人中心展装需求列表获取最新需求id web_request = self.canzhanshang_session.get( url=self.zhanzhuang_demand_list_url) soup = BeautifulSoup(web_request.text, 'lxml') zhanzhuang_demand_id = soup.select('a')[0].get_text() return zhanzhuang_demand_id def back_zhanzhuang_demand_confirm(self, zhanzhuang_demand_id, budget): #后台展装需求确认 web_request_get_param = self.back_session.get( url= 'http://back.zhankoo-uat.com/Exhibition/Decorate/DecorateBookDetailView/%s' % zhanzhuang_demand_id) soup = BeautifulSoup(web_request_get_param.text, 'lxml') sbuject = soup.select('input')[1]['value'] exhibitor_enterprise_name = soup.select('input')[2]['value'] exhibition_name = soup.select('input')[4]['value'] exhibition_from_on = soup.select('input')[5]['value'] exhibition_to_on = soup.select('input')[6]['value'] exhibition_address = soup.select('input')[7]['value'] exhibition_industry = soup.select('input')[8]['value'] exhibition_area = soup.select('input')[9]['value'] booth_area = soup.select('input')[10]['value'] booth_width = soup.select('input')[11]['value'] booth_length = soup.select('input')[12]['value'] booth_name = soup.select('input')[13]['value'] booth_pavilion_no = soup.select('input')[14]['value'] service_item_str = str(soup.select('input')[15]['data-options']) service_item = re.findall(r'\'(.+?)\'', service_item_str)[-2] province_name = soup.select('input')[16]['value'] city_name = soup.select('input')[17]['value'] designer_demand = soup.select('input')[18]['value'] finish_on = soup.select('input')[19]['value'] decorate_demand_str = str(soup.select('td')[66]) decorate_demand = re.findall(r'\"(.+?)\"', decorate_demand_str)[-1] booth_description_str = str(soup.select('td')[60]) booth_description = re.findall(r'\=(.+?)\<', booth_description_str)[-1][-2:] data = { 'ID': zhanzhuang_demand_id, 'Subject': sbuject, 'ExhibitorEnterpriseName': exhibitor_enterprise_name, 'Budget': budget, 'ExhibitionName': exhibition_name, 'ExhibitionFromOn': exhibition_from_on, 'ExhibitionToOn': exhibition_to_on, 'ExhibitionAddress': exhibition_address, 'ExhibitionIndustry': exhibition_industry, 'ExhibitionArea': exhibition_area, 'BoothArea': booth_area, 'BoothWidth': booth_width, 'BoothLength': booth_length, 'BoothType': 'Standard', 'BoothName': booth_name, 'BoothPavilionNO': booth_pavilion_no, 'BoothStandardType': 'SingleDoor', 'BoothDescription': booth_description, 'ServiceItem': service_item, 'ProvinceCode': 440000, 'CityCode': 440300, 'ProvinceName': province_name, 'CityName': city_name, 'DesignerDemand': designer_demand, 'FinishOn': finish_on, 'DecorateDemand': decorate_demand } web_request = self.back_session.post( url=self.zhanzhuang_demand_confirm_url, data=data) assert json.loads(web_request.text)['success'] def back_matching_company(self, zhanzhuang_demand_id): #后台匹配展装公司 data = {'bookId': zhanzhuang_demand_id, 'DecoratorIdList[]': 6532350} web_request = self.back_session.post(url=self.matching_company_url, data=data) assert json.loads(web_request.text)['success'] def back_demand_contract_and_price(self, zhanzhuang_demand_id, price): #后台展装需求签合同及定价 get_matching_company_data = { 'bookId': zhanzhuang_demand_id, 'page': 1, 'rows': 20, 'sort': 'CreateOn', 'order': 'DESC' } web_request_get_zhanzhuang_company_num_id = self.back_session.get( url= 'http://back.zhankoo-uat.com/Exhibition/Decorate/DecorateBookDistributesFindPaged', data=get_matching_company_data) distributes_id = json.loads( web_request_get_zhanzhuang_company_num_id.text)['rows'][0]['ID'] data = { 'bookId': zhanzhuang_demand_id, 'distributesId': distributes_id, 'price': price, 'isOffline': 'false' } web_request = self.back_session.post( url=self.demand_contract_and_price_url, data=data) assert json.loads(web_request.text)['success'] def back_finance_zhanzhuang_demand_price(self, zhanzhuang_demand_id): #后台财务提交展装需求定价 data = { 'bookId': zhanzhuang_demand_id, # 'page':1, # 'rows':20, # 'sort':'Order', # 'order':'ASC' } web_request = self.back_session.post( url=self.financ_zhanzhuang_demand_price_url, data=data) assert json.loads(web_request.text)['success'] def zhanzhuang_demand_place_order(self, zhanzhuang_demand_id): #展装需求下订单 data = { 'DecorateBookID': zhanzhuang_demand_id, 'InternatType': 86, 'CountryName': '中国', 'CountryCode': 86, 'X-Requested-With': 'XMLHttpRequest' } web_request = self.canzhanshang_session.post( url=self.zhanzhuang_demand_place_order_url, data=data) assert json.loads(web_request.text)['success']
def setUp(self): Login().send_login_request(name=18165702795, password=123456) all_str_data()
def setUp(self): global lg lg = Login(product_address)
def AbrirLogin(self): self.Login = Login(self) self.Login.setWindowModality(QtCore.Qt.WindowModal) self.Login.exec_()
class VentanaMain(QtGui.QMainWindow): def __init__(self): super(VentanaMain, self).__init__() self.VentanaMain = Ui_QMainWindow() self.VentanaMain.setupUi(self) self.VentanaMain.dockWidget_ListaClientes.hide() self.Resize1 = False self.Resize = False self.LabelStatusBar = QtGui.QLabel() self.setWindowTitle('365Connect 4.15') self.LabelStatusBar.setText( '365Connect - Todos los derechos reservados. 2016 ') self.VentanaMain.statusbar.addPermanentWidget(self.LabelStatusBar) #Conexiones self.connect(self.VentanaMain.actionIngresar_a_Monitoreo, QtCore.SIGNAL("triggered()"), self.AbrirMonitoreo) self.connect(self.VentanaMain.actionLista_de_Clientes, QtCore.SIGNAL("triggered()"), self.AbrirListaClientes) self.connect(self.VentanaMain.actionNuevo_Cliente, QtCore.SIGNAL("triggered()"), self.AbrirNuevoCliente) self.connect(self.VentanaMain.actionUsuarios, QtCore.SIGNAL("triggered()"), self.AbrirUsuarios) self.connect(self.VentanaMain.actionTipos_de_Usuarios, QtCore.SIGNAL("triggered()"), self.AbrirTiposUsuarios) self.connect(self.VentanaMain.actionConfiguracion_Vehiculos, QtCore.SIGNAL("triggered()"), self.AbrirVehiculos) self.connect(self.VentanaMain.actionGrupos_de_Clientes, QtCore.SIGNAL("triggered()"), self.AbrirGrupoClientes) self.connect(self.VentanaMain.actionNuevo_Grupo, QtCore.SIGNAL("triggered()"), self.AbrirNuevoGrupoClientes) self.connect(self.VentanaMain.actionVer_Mapa, QtCore.SIGNAL("triggered()"), self.AbrirMapaClientes) self.connect(self.VentanaMain.actionPlanes, QtCore.SIGNAL("triggered()"), self.AbrirPlanesNotificaciones) self.connect(self.VentanaMain.actionMonitor_de_Alertas, QtCore.SIGNAL("triggered()"), self.AbrirMonitoreoAlertas) self.connect(self.VentanaMain.actionLogin_Logout, QtCore.SIGNAL("triggered()"), self.LoginLogout) self.connect(self.VentanaMain.actionModoVentana, QtCore.SIGNAL("triggered()"), self.ModoVentana) self.connect(self.VentanaMain.actionLateralBar, QtCore.SIGNAL("triggered()"), self.HideShowBar) self.connect(self.VentanaMain.lineEdit_BuscarCliente, QtCore.SIGNAL("textEdited(const QString&)"), self.BuscarClientesHechapormi) self.connect(self.VentanaMain.tableWidget_ListaClientes, QtCore.SIGNAL("cellDoubleClicked(int,int)"), self.AbrirCliente) ################################ ABRIR CONFIGURACIONES ################################### self.connect(self.VentanaMain.actionReceptores, QtCore.SIGNAL("triggered()"), self.AbrirReceptores) self.connect(self.VentanaMain.actionEmpresas, QtCore.SIGNAL("triggered()"), self.AbrirEmpresas) self.connect(self.VentanaMain.actionParentesco, QtCore.SIGNAL("triggered()"), self.AbrirParentesco) self.connect(self.VentanaMain.actionResoluciones, QtCore.SIGNAL("triggered()"), self.AbrirResoluciones) self.connect(self.VentanaMain.actionEventos, QtCore.SIGNAL("triggered()"), self.AbrirEventos) self.connect(self.VentanaMain.actionCodigos_de_Alarma, QtCore.SIGNAL("triggered()"), self.AbrirCodigosAlarmas) self.connect(self.VentanaMain.actionTipo_de_Cliente, QtCore.SIGNAL("triggered()"), self.AbrirTipoCliente) self.connect(self.VentanaMain.actionDepartamentos, QtCore.SIGNAL("triggered()"), self.AbrirDepartamentos) self.connect(self.VentanaMain.actionGrupo_Codigos_de_Alarma, QtCore.SIGNAL("triggered()"), self.AbrirGruposCodigosAlarma) self.connect(self.VentanaMain.actionMotivos_Soporte, QtCore.SIGNAL("triggered()"), self.AbrirMotivosSoporte) self.connect(self.VentanaMain.actionDias_Feriados, QtCore.SIGNAL("triggered()"), self.AbrirDiasFeriados) self.connect(self.VentanaMain.actionTipos, QtCore.SIGNAL("triggered()"), self.AbrirTiposEquipos) self.connect(self.VentanaMain.actionSub_Tipos_de_Equipos, QtCore.SIGNAL("triggered()"), self.AbrirSubTiposEquipos) self.connect(self.VentanaMain.actionMarcas, QtCore.SIGNAL("triggered()"), self.AbrirMarcasEquipos) self.connect(self.VentanaMain.actionModelos_de_Equipos, QtCore.SIGNAL("triggered()"), self.AbrirModelosEquipos) ################################## ABRIR REPORTES ############################################# self.connect(self.VentanaMain.actionClientes_sin_Imagen, QtCore.SIGNAL("triggered()"), self.AbrirClientesSinImagenes) self.connect(self.VentanaMain.actionCodigo_ALarmas, QtCore.SIGNAL("triggered()"), self.AbrirReporteCodigosAlarmas) self.connect(self.VentanaMain.actionActivaciones, QtCore.SIGNAL("triggered()"), self.AbrirReporteActivaciones) self.connect(self.VentanaMain.actionGrupos_Alarmas, QtCore.SIGNAL("triggered()"), self.AbrirReporteGruposSenales) self.connect(self.VentanaMain.actionEventos_no_definidos, QtCore.SIGNAL("triggered()"), self.AbrirReporteEventoNoDefinido) self.connect(self.VentanaMain.actionSMS_Entrada, QtCore.SIGNAL("triggered()"), self.AbrirReporteSMSEntrada) self.connect(self.VentanaMain.actionSMS_Cliente, QtCore.SIGNAL("triggered()"), self.AbrirReporteClientesSMS) self.connect(self.VentanaMain.actionEstatus_Panel, QtCore.SIGNAL("triggered()"), self.AbrirReporteEstatusPanel) self.connect(self.VentanaMain.actionClientes_Ultima_Se_al, QtCore.SIGNAL("triggered()"), self.AbrirReporteClienteUltimaSenal) self.connect(self.VentanaMain.actionClientes_Ultima_A_C, QtCore.SIGNAL("triggered()"), self.AbrirReporteClienteUltimaAperturaCierre) self.connect(self.VentanaMain.actionSMS_Totales, QtCore.SIGNAL("triggered()"), self.AbrirReporteTotalesSMS) self.connect(self.VentanaMain.actionFicha_Cliente, QtCore.SIGNAL("triggered()"), self.AbrirReporteFichaClientes) #Para que las todas las subventanas del mdiarea no tomen el mismo estado cuando se maximiza una self.VentanaMain.mdiArea.setOption( QtGui.QMdiArea.DontMaximizeSubWindowOnActivation, False) self.ModoWindows = True ########################## PARA LA BARRA LATERAL DE LISTA DE CLIENTE ###########################3 #Invento mio para solucionar el Bug con que si esta activado el rezize de las tablas\ #Con el resize de la ventana no se le puede colocar un tamano por defecto self.installEventFilter(self) self.HideBar = True self.BuscarClientesBD() self.ListarClientes() self.CargarTablasEstaticamente() if globalvars.Tipo == str(1): self.HiloRondas = HiloCalcRondas(self) self.HiloRondas.start() #self.HiloHorarios = HiloCalcHorarios(self) #self.HiloHorarios.start() self.HiloAlertas = HiloCalcAlertas(self) self.HiloAlertas.start() ####################### ABRIR LOGIN ########################### self.TimerLogin = QtCore.QTimer() self.TimerLogin.setSingleShot(True) self.TimerLogin.start(100) self.connect(self.TimerLogin, QtCore.SIGNAL("timeout()"), self.AbrirLogin) ##################FUNCIONES PARA EL SYSTEM TRAY ICON####################### self.exitOnClose = False exit = QtGui.QAction( QtGui.QIcon(":/iconos/ico/connections-512(1).png"), "Cerrar 365Connect", self) self.connect(exit, QtCore.SIGNAL("triggered()"), self.exitEvent) self.trayIcon = QtGui.QSystemTrayIcon( QtGui.QIcon(":/iconos/ico/connections-512(1).png"), self) menu = QtGui.QMenu(self) menu.addAction(exit) self.trayIcon.setContextMenu(menu) self.connect(self.trayIcon, \ QtCore.SIGNAL("activated(QSystemTrayIcon::ActivationReason)"), \ self.trayIconActivated) self.trayIcon.show() self.trayIcon.showMessage("365Connect Iniciando", "Un momento...", QtGui.QSystemTrayIcon.Information, 10000) self.trayIcon.setToolTip("365Connect") self.HayBD = True def trayIconActivated(self, reason): if reason == QtGui.QSystemTrayIcon.Context: self.trayIcon.contextMenu().show() elif reason == QtGui.QSystemTrayIcon.Trigger: self.show() self.raise_() if globalvars.Logueado == False: self.Login.show() def closeEvent(self, event): if self.exitOnClose: self.trayIcon.hide() if 'self.HiloMoniAlert' in locals(): self.HiloMoniAlert.terminate() while True: if self.HiloMoniAlert.isTerminated(): del self.HiloMoniAlert break if 'self.SubVentanaMonitoreoAlertas' in locals(): del self.SubVentanaMonitoreoAlertas if 'self.SubVentanaEventos' in locals(): del self.SubVentanaEventos if 'self.SubVentanaReporteTotalesSMS' in locals(): del self.SubVentanaReporteTotalesSMS self.VentanaMain.mdiArea.closeAllSubWindows() event.accept() else: self.hide() event.setAccepted(True) event.ignore() def exitEvent(self): self.exitOnClose = True self.close() ################################################################################ def LoginLogout(self): if globalvars.Logueado == True: self.AbrirLogin() def AbrirLogin(self): self.Login = Login(self) self.Login.setWindowModality(QtCore.Qt.WindowModal) self.Login.exec_() def CargarTablasEstaticamente(self): self.VentanaMain.tableWidget_ListaClientes.setColumnWidth(0, 40) self.VentanaMain.tableWidget_ListaClientes.setColumnWidth(1, 195) def BuscarClientesHechapormi(self, busqueda): self.ListarClientes() #print busqueda #for letra in busqueda: ResultadoBusqueda = self.VentanaMain.tableWidget_ListaClientes.findItems( busqueda, QtCore.Qt.MatchContains) #print ResultadoBusqueda #for i in ResultadoBusqueda: #print i.text() listafilasresultado = [] for r in ResultadoBusqueda: listafilasresultado.append( self.VentanaMain.tableWidget_ListaClientes.row(r)) #print listafilasresultado filasentotal = self.VentanaMain.tableWidget_ListaClientes.rowCount() for eliminar in reversed(range(filasentotal)): if eliminar in listafilasresultado: pass else: self.VentanaMain.tableWidget_ListaClientes.removeRow(eliminar) def AbrirClienteDesdeExterno(self, idcliente): for nombretipo, listatipo in self.DictClientesPorTipo.iteritems(): if int(idcliente) in listatipo: TipoCliente = nombretipo break if TipoCliente == 'Alarmas': self.AbrirPanelClienteAlarmas(idcliente) elif TipoCliente == 'GPS': pass elif TipoCliente == 'Bastones': self.AbrirPanelClienteRondas(idcliente) def AbrirCliente(self, *celda): ElementoTabla = self.VentanaMain.tableWidget_ListaClientes.item( celda[0], 0) PrefijoCuenta = str(ElementoTabla.text()) IDCliente = self.DictClientesIDCuenta[PrefijoCuenta] for nombretipo, listatipo in self.DictClientesPorTipo.iteritems(): if int(IDCliente) in listatipo: TipoCliente = nombretipo break if TipoCliente == 'Alarmas': self.AbrirPanelClienteAlarmas(IDCliente) elif TipoCliente == 'GPS': pass elif TipoCliente == 'Bastones': self.AbrirPanelClienteRondas(IDCliente) def eventFilter(self, source, event): if event.type() == QtCore.QEvent.WindowStateChange: self.ArreglarTamanoTablas() return QtGui.QWidget.eventFilter(self, source, event) def resizeEvent(self, resizeEvent): if self.Resize1 == True: self.ArreglarTamanoTablas() self.Resize1 = True pass def ArreglarTamanoTablas(self): if self.Resize == True: self.VentanaMain.tableWidget_ListaClientes.setColumnWidth( 0, self.VentanaMain.tableWidget_ListaClientes.width() / 5) self.VentanaMain.tableWidget_ListaClientes.setColumnWidth( 1, self.VentanaMain.tableWidget_ListaClientes.width() / 1.38) self.Resize = True def BuscarClientesBD(self): print 'CARGANDO' self.ResultadoListaClientes = globalvars.BD.Querys( 'ListarClientesIDNombre') self.ListarClientes() def ListarClientes(self): self.DictClientesIDCuenta = {} #Creo el diccionario donde estaran los clientes por tipo self.DictClientesPorTipo = {} #Agrego los Tipos self.DictClientesPorTipo['Alarmas'] = [] self.DictClientesPorTipo['Bastones'] = [] self.DictClientesPorTipo['GPS'] = [] self.VentanaMain.tableWidget_ListaClientes.verticalHeader().setVisible( False) self.VentanaMain.tableWidget_ListaClientes.setShowGrid(False) self.VentanaMain.tableWidget_ListaClientes.setAlternatingRowColors( True) #self.VentanaMain.tableWidget_ListaClientes.resizeColumnsToContents() self.VentanaMain.tableWidget_ListaClientes.verticalHeader( ).setDefaultSectionSize(20) self.VentanaMain.tableWidget_ListaClientes.setEditTriggers( QtGui.QAbstractItemView.NoEditTriggers) self.VentanaMain.tableWidget_ListaClientes.setSortingEnabled(False) self.VentanaMain.tableWidget_ListaClientes.setSelectionBehavior( QtGui.QAbstractItemView.SelectRows) while self.VentanaMain.tableWidget_ListaClientes.rowCount() > 0: self.VentanaMain.tableWidget_ListaClientes.removeRow(0) fila = 0 columna = 0 for cliente in reversed(self.ResultadoListaClientes): self.VentanaMain.tableWidget_ListaClientes.insertRow(0) columna = 0 #Columna 0 texto = QtGui.QTableWidgetItem( str(cliente.prefijo) + '-' + str(cliente.cuenta)) self.VentanaMain.tableWidget_ListaClientes.setItem( fila, columna, texto) #Columna 1 columna = columna + 1 texto = QtGui.QTableWidgetItem(cliente.nombre_cliente) self.VentanaMain.tableWidget_ListaClientes.setItem( fila, columna, texto) #Organizamos los Clientes segun su tipo de dispositivo (Alarma - GPS - Bastones) para al hacer click en Abrir abrir el panel que es if cliente.tipocuenta == None: ClienteTipo = 0 else: ClienteTipo = cliente.tipocuenta if int(ClienteTipo) == 5: self.DictClientesPorTipo['Alarmas'].append(cliente.id_cliente) elif int(ClienteTipo) == 6: self.DictClientesPorTipo['GPS'].append(cliente.id_cliente) elif int(ClienteTipo) == 7: self.DictClientesPorTipo['Bastones'].append(cliente.id_cliente) #Agregamos al diccionario self.DictClientesIDCuenta clave prefijo-cuenta valor idcliente self.DictClientesIDCuenta[str(cliente.prefijo) + '-' + str(cliente.cuenta)] = str( cliente.id_cliente) self.ArreglarTamanoTablas() def ModoVentana(self): if self.ModoWindows == True: self.VentanaMain.mdiArea.setViewMode(1) self.ModoWindows = False else: self.VentanaMain.mdiArea.setViewMode(0) self.ModoWindows = True def HideShowBar(self): if self.HideBar == True: self.VentanaMain.dockWidget_ListaClientes.show() self.HideBar = False else: self.VentanaMain.dockWidget_ListaClientes.hide() self.HideBar = True self.ArreglarTamanoTablas() ##################################### SUB VENTANAS ########################################################## def AbrirReporteFichaClientes(self): self.SubVentanaReporteFichaCliente = SubVentanaReporteFichaCliente() self.SubVentanaReporteFichaCliente.setAttribute( QtCore.Qt.WA_DeleteOnClose, True) #self.VentanaMain.mdiArea.addSubWindow(self.SubVentanaReporteFichaCliente) self.SubVentanaReporteFichaCliente.show() def AbrirReporteTotalesSMS(self): self.SubVentanaReporteTotalesSMS = SubVentanaReporteTotalesSMS() self.SubVentanaReporteTotalesSMS.setAttribute( QtCore.Qt.WA_DeleteOnClose, True) #self.VentanaMain.mdiArea.addSubWindow(self.SubVentanaReporteTotalesSMS) self.SubVentanaReporteTotalesSMS.showMaximized() def AbrirReporteClienteUltimaAperturaCierre(self): self.SubVentanaReporteClienteUltimaAperturaCierre = SubVentanaReporteClientesUltimaAperturaCierre( ) self.SubVentanaReporteClienteUltimaAperturaCierre.setAttribute( QtCore.Qt.WA_DeleteOnClose, True) #self.VentanaMain.mdiArea.addSubWindow(self.SubVentanaReporteClienteUltimaAperturaCierre) self.SubVentanaReporteClienteUltimaAperturaCierre.showMaximized() def AbrirReporteClienteUltimaSenal(self): self.SubVentanaReporteUltimaSenal = SubVentanaReporteClienteUltimaSenal( ) self.SubVentanaReporteUltimaSenal.setAttribute( QtCore.Qt.WA_DeleteOnClose, True) #self.VentanaMain.mdiArea.addSubWindow(self.AbrirReporteGruposSenales) self.SubVentanaReporteUltimaSenal.showMaximized() def AbrirReporteEstatusPanel(self): self.SubVentanaReporteEstatusPanel = SubVentanaReporteEstatusPanel() self.SubVentanaReporteEstatusPanel.setAttribute( QtCore.Qt.WA_DeleteOnClose, True) #self.VentanaMain.mdiArea.addSubWindow(self.AbrirReporteGruposSenales) self.SubVentanaReporteEstatusPanel.showMaximized() def AbrirReporteClientesSMS(self): self.SubVentanaReporteClientesSMS = SubVentanaReporteClientesSMS() self.SubVentanaReporteClientesSMS.setAttribute( QtCore.Qt.WA_DeleteOnClose, True) #self.VentanaMain.mdiArea.addSubWindow(self.AbrirReporteGruposSenales) self.SubVentanaReporteClientesSMS.showMaximized() def AbrirReporteSMSEntrada(self): self.SubVentanaReporteSMSEntrada = SubVentanaReporteSMSEntrada() self.SubVentanaReporteSMSEntrada.setAttribute( QtCore.Qt.WA_DeleteOnClose, True) #self.VentanaMain.mdiArea.addSubWindow(self.AbrirReporteGruposSenales) self.SubVentanaReporteSMSEntrada.showMaximized() def AbrirReporteEventoNoDefinido(self): self.AbrirReporteEventoNoDefinido = SubVentanaReporteEventoNoDefinido() self.AbrirReporteEventoNoDefinido.setAttribute( QtCore.Qt.WA_DeleteOnClose, True) #self.VentanaMain.mdiArea.addSubWindow(self.AbrirReporteGruposSenales) self.AbrirReporteEventoNoDefinido.showMaximized() def AbrirReporteGruposSenales(self): self.AbrirReporteGruposSenales = SubVentanaGruposSenales() self.AbrirReporteGruposSenales.setAttribute(QtCore.Qt.WA_DeleteOnClose, True) #self.VentanaMain.mdiArea.addSubWindow(self.AbrirReporteGruposSenales) self.AbrirReporteGruposSenales.showMaximized() def AbrirReporteActivaciones(self): self.AbrirReporteActivaciones = SubVentanaReporteActivaciones() self.AbrirReporteActivaciones.setAttribute(QtCore.Qt.WA_DeleteOnClose, True) #self.VentanaMain.mdiArea.addSubWindow(self.AbrirReporteActivaciones) self.AbrirReporteActivaciones.showMaximized() def AbrirMonitoreoAlertas(self): self.SubVentanaMonitoreoAlertas = SubVentanaMonitorAlertas() self.SubVentanaMonitoreoAlertas.setAttribute( QtCore.Qt.WA_DeleteOnClose, True) self.SubVentanaMonitoreoAlertas.showMaximized() self.HiloMoniAlert = HiloMonitoreoAlertas( self, self.SubVentanaMonitoreoAlertas.SubVentanaMonitorAlertas. tableWidget_Log, self.SubVentanaMonitoreoAlertas. SubVentanaMonitorAlertas.tableWidget_Cola, self.SubVentanaMonitoreoAlertas.SubVentanaMonitorAlertas. tableWidget_Enviados, self.SubVentanaMonitoreoAlertas. SubVentanaMonitorAlertas.tableWidget_Recibidos, self.SubVentanaMonitoreoAlertas.SubVentanaMonitorAlertas. label_ColaMensajes) self.HiloMoniAlert.start() def AbrirModelosEquipos(self): self.SubVentanaModelosEquipos = SubVentanaModelosEquipos() self.SubVentanaModelosEquipos.setAttribute(QtCore.Qt.WA_DeleteOnClose, True) self.SubVentanaModelosEquipos.show() def AbrirMarcasEquipos(self): self.SubVentanaMarcasEquipos = SubVentanaMarcasEquipos() self.SubVentanaMarcasEquipos.setAttribute(QtCore.Qt.WA_DeleteOnClose, True) self.SubVentanaMarcasEquipos.show() def AbrirSubTiposEquipos(self): self.SubVentanaSubTiposEquipos = SubVentanaSubTiposEquipos() self.SubVentanaSubTiposEquipos.setAttribute(QtCore.Qt.WA_DeleteOnClose, True) self.SubVentanaSubTiposEquipos.show() def AbrirTiposEquipos(self): self.SubVentanaTiposEquipos = SubVentanaTiposEquipos() self.SubVentanaTiposEquipos.setAttribute(QtCore.Qt.WA_DeleteOnClose, True) self.SubVentanaTiposEquipos.show() def AbrirPlanesNotificaciones(self): self.AbrirPlanesNotificaciones = SubVentanaPlanesNotificaciones() self.AbrirPlanesNotificaciones.setAttribute(QtCore.Qt.WA_DeleteOnClose, True) #self.VentanaMain.mdiArea.addSubWindow(self.AbrirPlanesNotificaciones) self.AbrirPlanesNotificaciones.show() def AbrirMapaClientes(self): self.SubVentanaMapaClientes = SubVentanaMapaClientes() self.SubVentanaMapaClientes.setAttribute(QtCore.Qt.WA_DeleteOnClose, True) #self.VentanaMain.mdiArea.addSubWindow(self.SubVentanaMapaClientes) self.SubVentanaMapaClientes.show() def AbrirReceptores(self): self.SubVentanaReceptores = SubVentanaReceptores() self.SubVentanaReceptores.setAttribute(QtCore.Qt.WA_DeleteOnClose, True) #self.VentanaMain.mdiArea.addSubWindow(self.SubVentanaReceptores) self.SubVentanaReceptores.show() def AbrirEmpresas(self): self.SubVentanaEmpresas = SubVentanaEmpresas() self.SubVentanaEmpresas.setAttribute(QtCore.Qt.WA_DeleteOnClose, True) #self.VentanaMain.mdiArea.addSubWindow(self.SubVentanaEmpresas) self.SubVentanaEmpresas.show() def AbrirParentesco(self): self.SubVentanaParentesco = SubVentanaParentesco() self.SubVentanaParentesco.setAttribute(QtCore.Qt.WA_DeleteOnClose, True) #self.VentanaMain.mdiArea.addSubWindow(self.SubVentanaParentesco) self.SubVentanaParentesco.show() def AbrirResoluciones(self): self.SubVentanaResoluciones = SubVentanaResoluciones() self.SubVentanaResoluciones.setAttribute(QtCore.Qt.WA_DeleteOnClose, True) #self.VentanaMain.mdiArea.addSubWindow(self.SubVentanaResoluciones) self.SubVentanaResoluciones.show() def AbrirEventos(self): self.SubVentanaEventos = SubVentanaEventos() self.SubVentanaEventos.setAttribute(QtCore.Qt.WA_DeleteOnClose, True) #self.VentanaMain.mdiArea.addSubWindow(self.SubVentanaEventos) self.SubVentanaEventos.show() def AbrirCodigosAlarmas(self): self.SubVentanaCodigosAlarma = SubVentanaCodigosAlarma() #self.VentanaMain.mdiArea.addSubWindow(self.SubVentanaCodigosAlarma) self.SubVentanaCodigosAlarma.setAttribute(QtCore.Qt.WA_DeleteOnClose, True) self.SubVentanaCodigosAlarma.show() def AbrirTipoCliente(self): self.SubVentanaTipoCliente = SubVentanaTipoCliente() #self.VentanaMain.mdiArea.addSubWindow(self.SubVentanaTipoCliente) self.SubVentanaTipoCliente.show() def AbrirDepartamentos(self): self.SubVentanaDepartamentos = SubVentanaDepartamentos() #self.VentanaMain.mdiArea.addSubWindow(self.SubVentanaDepartamentos) self.SubVentanaDepartamentos.show() def AbrirCodigosAlarma(self): self.SubVentanaDepartamentos = SubVentanaDepartamentos() #self.VentanaMain.mdiArea.addSubWindow(self.SubVentanaDepartamentos) self.SubVentanaDepartamentos.show() def AbrirGruposCodigosAlarma(self): self.SubVentanaGruposCodigosAlarma = SubVentanaGruposCodigosAlarma() #self.VentanaMain.mdiArea.addSubWindow(self.SubVentanaGruposCodigosAlarma) self.SubVentanaGruposCodigosAlarma.show() def AbrirMotivosSoporte(self): self.SubVentanaMotivosSoporte = SubVentanaMotivosSoporte() #self.VentanaMain.mdiArea.addSubWindow(self.SubVentanaMotivosSoporte) self.SubVentanaMotivosSoporte.show() def AbrirDiasFeriados(self): self.SubVentanaDiasFeriados = SubVentanaDiasFeriados() #self.VentanaMain.mdiArea.addSubWindow(self.SubVentanaDiasFeriados) self.SubVentanaDiasFeriados.show() def AbrirGrupoClientes(self): self.SubVentanaGruposdeClientes = SubVentanaGruposdeClientes() #self.VentanaMain.mdiArea.addSubWindow(self.SubVentanaGruposdeClientes) self.SubVentanaGruposdeClientes.setWindowTitle("Grupos Clientes") self.SubVentanaGruposdeClientes.show() self.connect(self.SubVentanaGruposdeClientes, QtCore.SIGNAL("signalAbrirCuentasGrupo"), self.AbrirCuentasGrupo) self.connect(self.SubVentanaGruposdeClientes, QtCore.SIGNAL("signalAbrirAgregarGrupo"), self.AbrirNuevoGrupoClientes) def AbrirCuentasGrupo(self, parent, idgrupo): self.DialogCuentasGrupo = DialogCuentasGrupo(parent, idgrupo) #self.VentanaMain.mdiArea.addSubWindow(self.DialogCuentasGrupo) self.DialogCuentasGrupo.show() self.connect(self.DialogCuentasGrupo, QtCore.SIGNAL("signalCerrar"), self.CerrarVentanaActiva) def CerrarVentanaActiva(self): self.VentanaMain.mdiArea.closeActiveSubWindow() def AbrirNuevoGrupoClientes(self, parent=None): self.SubVentanaNuevoGrupoClientes = SubVentanaNuevoGrupoClientes( parent) #self.VentanaMain.mdiArea.addSubWindow(self.SubVentanaNuevoGrupoClientes) self.SubVentanaNuevoGrupoClientes.setWindowTitle( "Nuevo Grupo Clientes") self.SubVentanaNuevoGrupoClientes.show() self.connect(self.SubVentanaNuevoGrupoClientes, QtCore.SIGNAL("signalCerrar"), self.CerrarVentanaActiva) def AbrirVehiculos(self): self.SubVentanaVehiculos = SubVentanaVehiculos() #self.VentanaMain.mdiArea.addSubWindow(self.SubVentanaVehiculos) self.SubVentanaVehiculos.setWindowTitle("Vehiculos") self.SubVentanaVehiculos.show() def AbrirUsuarios(self): self.SubVentanaUsuarios = SubVentanaUsuarios() self.SubVentanaUsuarios.setAttribute(QtCore.Qt.WA_DeleteOnClose, True) #self.VentanaMain.mdiArea.addSubWindow(self.SubVentanaUsuarios) self.SubVentanaUsuarios.show() def AbrirTiposUsuarios(self): self.SubVentanaTiposUsuarios = SubVentanaTiposUsuarios() self.SubVentanaTiposUsuarios.setAttribute(QtCore.Qt.WA_DeleteOnClose, True) #self.VentanaMain.mdiArea.addSubWindow(self.SubVentanaTiposUsuarios) self.SubVentanaTiposUsuarios.show() def AbrirMonitoreo(self): self.SubVentanaMonitoreo = SubVentanaMonitoreo(self) self.SubVentanaMonitoreo.setAttribute(QtCore.Qt.WA_DeleteOnClose, True) self.SubVentanaMonitoreo.setWindowTitle("Monitoreo") self.SubVentanaMonitoreo.showMaximized() def AbrirListaClientes(self): self.SubVentanaListaClientes = SubVentanaListaClientes() #self.SubVentanaListaClientes.setWindowIcon(QtGui.QIcon(":/iconos/ico/Feedbin-Icon-check.svg.png")) self.SW = self.VentanaMain.mdiArea.addSubWindow( self.SubVentanaListaClientes) self.SW.setWindowIcon( QtGui.QIcon(":/iconos/ico/Feedbin-Icon-check.svg.png")) self.SW.show() self.connect(self.SubVentanaListaClientes, QtCore.SIGNAL("signalAbrirPanelCliente"), self.AbrirClienteDesdeExterno) def AbrirNuevoCliente(self): self.SubVentanaNuevoCliente = SubVentanaNuevoCliente() #self.VentanaMain.mdiArea.addSubWindow(self.SubVentanaNuevoCliente) self.SubVentanaNuevoCliente.setWindowTitle("Agregar Cliente") self.SubVentanaNuevoCliente.show() self.connect(self.SubVentanaNuevoCliente, QtCore.SIGNAL("signalCargarClientesNuevamente"), self.BuscarClientesBD) self.connect(self.SubVentanaNuevoCliente, QtCore.SIGNAL("signalAbrirPanelClienteAlarmas"), self.AbrirPanelClienteAlarmas) self.connect(self.SubVentanaNuevoCliente, QtCore.SIGNAL("signalAbrirPanelClienteRondas"), self.AbrirPanelClienteRondas) def AbrirPanelClienteAlarmas(self, abonado): self.SubVentanaPanelClienteAlarmas = SubVentanaPanelClienteAlarmas( abonado) #self.VentanaMain.mdiArea.addSubWindow(self.SubVentanaPanelCliente) self.SubVentanaPanelClienteAlarmas.setStyleSheet(self.styleSheet()) self.SubVentanaPanelClienteAlarmas.show() self.connect(self.SubVentanaPanelClienteAlarmas, QtCore.SIGNAL("signalCargarClientesNuevamente"), self.BuscarClientesBD) self.connect(self.SubVentanaPanelClienteAlarmas, QtCore.SIGNAL("signalAbrirPanelClienteAlarmas"), self.AbrirPanelClienteAlarmas) self.connect(self.SubVentanaPanelClienteAlarmas, QtCore.SIGNAL("signalAbrirPanelClienteRondas"), self.AbrirPanelClienteRondas) def AbrirPanelClienteRondas(self, abonado): self.SubVentanaPanelClienteRondas = SubVentanaPanelClienteRondas( abonado) #self.VentanaMain.mdiArea.addSubWindow(self.SubVentanaPanelCliente) self.SubVentanaPanelClienteRondas.setStyleSheet(self.styleSheet()) self.SubVentanaPanelClienteRondas.show() self.connect(self.SubVentanaPanelClienteRondas, QtCore.SIGNAL("signalCargarClientesNuevamente"), self.BuscarClientesBD) self.connect(self.SubVentanaPanelClienteRondas, QtCore.SIGNAL("signalAbrirPanelClienteRondas"), self.AbrirPanelClienteRondas) self.connect(self.SubVentanaPanelClienteRondas, QtCore.SIGNAL("signalAbrirPanelClienteAlarmas"), self.AbrirPanelClienteAlarmas) def AbrirClientesSinImagenes(self): self.SubVentanaClientesSinImagenes = SubVentanaClientesSinImagenes() #self.VentanaMain.mdiArea.addSubWindow(self.SubVentanaClientesSinImagenes) self.SubVentanaClientesSinImagenes.show() def AbrirReporteCodigosAlarmas(self): self.SubVentanaReportesCodigoAlarma = SubVentanaReportesCodigoAlarma() #self.VentanaMain.mdiArea.addSubWindow(self.SubVentanaReportesCodigoAlarma) self.SubVentanaReportesCodigoAlarma.showMaximized()
class Dajianshang_Business_Info_Edit: #编辑搭建商商家资料 dajianshang_session = Login().send_login_request(name=18019237332, password=123456) back_session = Login().send_back_login_request() def upload_picture(self, filename, data): #上传图片 ''' data==1为logo图片 data==2为banner图片 data==3为公司形象图片或案例图片 data==4为公司资质图片 data==5为设计师图片 ''' picture_save_url = 'http://exh.zhankoo-uat.com/Home/PictureSave' if data == 1: data = { 'Width': 130, 'Height': 130, 'Prefix': 'EnterpriseLogo', 'CallBack': 'parent.OnEnterpriseLogoComplete' } elif data == 2: data = { 'Width': 130, 'Height': 130, 'Prefix': 'EnterpriseBanner', 'CallBack': 'parent.OnEnterpriseBannerComplete' } elif data == 3: data = { 'Index': '', 'Width': 460, 'Height': 280, 'Prefix': 'EnterpriseStyle', 'CallBack': 'parent.OnComplete' } elif data == 4: data = { 'Width': 220, 'Height': 150, 'Prefix': 'Qualification', 'CallBack': 'parent.OnQualificationComplete' } elif data == 5: data = { 'Width': 120, 'Height': 120, 'Prefix': 'Designer', 'CallBack': 'parent.OnDesignerComplete' } current = os.getcwd() base = current.split('\\test_case')[0] target = base + '\\data_file\\' + filename open_file = {'file': open(target, 'rb')} web_request_picture_save = self.dajianshang_session.post( url=picture_save_url, data=data, files=open_file) soup = BeautifulSoup(web_request_picture_save.text, 'lxml') picture_url = re.findall(r'"pictureUrl":"(.+?)"\,"pictureSizeUrl"', str(soup))[0] return picture_url def basic_info_save(self, param): #编辑基本信息 basic_info_save_url = 'http://exh.zhankoo-uat.com/Decorate/Decorator/BasicSave' data = { 'EnterpriseName': param['enterprise_name'], 'EnterpriseIntroduce': param['enterprise_introduce'], 'EnterpriseLogo': param['enterprise_logo'], 'EnterpriseBanner': param['enterprise_banner'], 'EnterpriseStyleImageUrl': param['enterprise_style_image_url'], 'X-Requested-With': 'XMLHttpRequest' } web_reuquest = self.dajianshang_session.post(url=basic_info_save_url, data=data) assert json.loads(web_reuquest.text)['success'] def service_scope_save(self, param): #编辑服务范围 service_scope_save_url = 'http://exh.zhankoo-uat.com/Decorate/Decorator/ServiceScopeSave' service_item_json = [{ "Name": param['item_name_1'], "ID": param['item_id_1'] }] service_area_json = [{ "Name": param['area_name_1'], "Code": param['code_1'], "ParentCode": param['parent_code_1'] }] data = { 'CountryName': param['country_name'], 'ProvinceName': param['province_name'], 'CityName': param['city_name'], 'CountyName': '', 'ServiceItemJson': service_item_json, 'ServiceAreaJson': service_area_json, 'MinTakePrice': param['min_take_price'], 'MinTakeArea': param['min_take_area'], 'InternatType': param['internat_type'], 'CountryCode': param['country_code'], 'ProvinceCode': param['province_code'], 'CityCode': param['city_code'], 'CountyCode': '', 'X-Requested-With': 'XMLHttpRequest' } web_reuqest = self.dajianshang_session.post(url=service_scope_save_url, data=data) print(json.loads(web_reuqest.text)) def qualification_save(self, param): #添加公司资质 qualification_save_url = 'http://exh.zhankoo-uat.com/Decorate/Decorator/QualificationSave' data = { 'ID': 0, 'Name': param['name'], 'ImageUrl': param['image_url'], 'Order': '', 'X-Requested-With': 'XMLHttpRequest' } web_request = self.dajianshang_session.post(url=qualification_save_url, data=data) assert json.loads(web_request.text)['success'] def designer_save(self, param): #添加设计师 designer_save_url = 'http://exh.zhankoo-uat.com/Decorate/Decorator/DesignerSave' data = { 'ID': 0, 'Name': param['name'], 'Title': param['title'], 'Introduce': param['introduce'], 'ImageUrl': param['image_url'], 'State': param['state'], 'Order': '', 'X-Requested-With': 'XMLHttpRequest' } web_request = self.dajianshang_session.post(url=designer_save_url, data=data) assert json.loads(web_request.text)['success'] def decorate_case_save(self, param): #添加公司案例 decorate_case_save_url = 'http://exh.zhankoo-uat.com/Decorate/Decorator/DecorateCaseSave' data = { 'ID': 0, 'Title': param['title'], 'Description': param['description'], 'IndustryName': param['industry_name'], 'IndustryID': param['industry_id'], 'Area': param['area'], 'BoothStandardType': param['booth_standard_type'], 'Material': param['material'], 'Style': param['style'], 'DesignerID': param['designer'], 'Price': param['price'], 'Order': '', 'colorAddId': param['color_add_id'], 'Color': param['color'], 'DecorateCaseImage': param['docorate_case_image'], 'X-Requested-With': 'XMLHttpRequest' } web_request = self.dajianshang_session.post(url=decorate_case_save_url, data=data) assert json.loads(web_request.text)['success']
class zhanhui_order: canzhanshang_session = Login().send_login_request(name=13690769964, password=123456) zhubanfang_session = Login().send_login_request(name=18165702795, password=123456) def online_booth_order(self, exhibition_id): #在线预订展位确认订单 online_booth_book_url = 'http://exh.zhankoo-uat.com/Exhibition/Partial/_BoothBookPaged' online_booth_book_data = { 'pageIndex': 1, 'pageSize': 10, 'exhibitionID': exhibition_id, 'state': '1', 'isSell': 'null', 'type': '', 'standardType': '', 'minArea': '', 'maxArea': '', 'minTotalPrice': '', 'maxTotalPrice': '', 'orderType': 'null' } web_request_online_booth_book = self.canzhanshang_session.post( url=online_booth_book_url, data=online_booth_book_data) online_booth_book_soup = BeautifulSoup( web_request_online_booth_book.text, 'lxml') result = online_booth_book_soup.select('tr') booth_id_list = [] for for_result in result: booth_id_list.append(for_result.get('data-id')) booth_id_list.pop() return random.choice(booth_id_list) def booth_book_sure_order_save(self, exhibition_id, booth_id): #预定展位提交订单 sure_order_url = 'http://exh.zhankoo-uat.com/exhibition/home/sureorder' sure_order_save_url = 'http://exh.zhankoo-uat.com/Exhibition/Home/SureOrderSave' sure_order_data = {'exhibitionid': exhibition_id, 'boothids': booth_id} web_request_sure_order = self.canzhanshang_session.get( url=sure_order_url, data=sure_order_data) sure_order_soup = BeautifulSoup(web_request_sure_order.text, 'lxml') original_price = sure_order_soup.select('input')[3]['value'] total_price = sure_order_soup.select('input')[4]['value'] sure_order_save_data = { 'ExhibitionID': exhibition_id, 'ContactID': 134851, 'ExhibitorEnterpriseID': 519, 'OriginalPrice': original_price, 'TotalPrice': total_price, 'CountryName': '中国', 'BoothIDs': booth_id, 'InternatType': 86, 'CountryCode': 86, 'X-Requested-With': 'XMLHttpRequest' } web_request_sure_order_save = self.canzhanshang_session.post( url=sure_order_save_url, data=sure_order_save_data) order_id = json.loads(web_request_sure_order_save.text)['orderID'] return order_id def canzhanshang_zhanhui_order_list(self): #展位订单列表 canzhanshang_order_page = 'http://so.zhankoo-uat.com/Exhibition/Partial/_ExhibitorOrderPage' data = { 'pageIndex': 1, 'pageSize': 5, 'exhibitionName': '', 'createOnFrom': '', 'state': 0 } web_request = self.canzhanshang_session.post( url=canzhanshang_order_page, data=data) print(BeautifulSoup(web_request.text, 'lxml')) def organizer_comfirm_order(self, order_id): #主办方确认订单 organizer_comfirm_order_url = 'http://so.zhankoo-uat.com/Exhibition/Organizer/OrderConfirm' data = {'stageCount': 1, 'orderID': order_id, 'stageParam': '[]'} web_request = self.zhubanfang_session.post( url=organizer_comfirm_order_url, data=data) assert json.loads(web_request.text)['success']
# Load the required variables from .env file. load_dotenv() env_token = os.getenv('DISCORD_TOKEN') db_username = os.getenv("MONGO_USR") db_password = os.getenv("MONGO_PWD") db_hostname = os.getenv("MONGO_HOSTNAME") db_port = os.getenv("MONGO_PORT") # Connect to DB. if db_username: client = pymongo.MongoClient( f"mongodb://{db_username}:{db_password}@{db_hostname}:{db_port}") else: client = pymongo.MongoClient(f"mongodb://127.0.0.1:27017") # Create maimaiDX database. db = client["maimaiDX"] # Add cogs to the bot. bot.add_cog(System(bot, db)) bot.add_cog(Login(bot, db)) bot.add_cog(DXNet(bot, db)) bot.add_cog(DXNetHistory(bot, db)) bot.add_cog(DXNetRecords(bot, db)) bot.add_cog(DXNetPlaylist(bot, db)) # Run the bot. atexit.register(shutdown) bot.run(env_token)
class VentanaMain(QtGui.QMainWindow): def __init__(self): super(VentanaMain, self).__init__() self.VentanaMain = Ui_QMainWindow() self.VentanaMain.setupUi(self) self.VentanaMain.dockWidget_ListaClientes.hide() self.Resize1 = False self.Resize = False self.LabelStatusBar = QtGui.QLabel() self.setWindowTitle('365Connect 4.15') self.LabelStatusBar.setText('365Connect - Todos los derechos reservados. 2016 ') self.VentanaMain.statusbar.addPermanentWidget(self.LabelStatusBar) #Conexiones self.connect(self.VentanaMain.actionIngresar_a_Monitoreo, QtCore.SIGNAL("triggered()"), self.AbrirMonitoreo) self.connect(self.VentanaMain.actionLista_de_Clientes, QtCore.SIGNAL("triggered()"), self.AbrirListaClientes) self.connect(self.VentanaMain.actionNuevo_Cliente, QtCore.SIGNAL("triggered()"), self.AbrirNuevoCliente) self.connect(self.VentanaMain.actionUsuarios, QtCore.SIGNAL("triggered()"), self.AbrirUsuarios) self.connect(self.VentanaMain.actionTipos_de_Usuarios, QtCore.SIGNAL("triggered()"), self.AbrirTiposUsuarios) self.connect(self.VentanaMain.actionConfiguracion_Vehiculos, QtCore.SIGNAL("triggered()"), self.AbrirVehiculos) self.connect(self.VentanaMain.actionGrupos_de_Clientes, QtCore.SIGNAL("triggered()"), self.AbrirGrupoClientes) self.connect(self.VentanaMain.actionNuevo_Grupo, QtCore.SIGNAL("triggered()"), self.AbrirNuevoGrupoClientes) self.connect(self.VentanaMain.actionVer_Mapa, QtCore.SIGNAL("triggered()"), self.AbrirMapaClientes) self.connect(self.VentanaMain.actionPlanes, QtCore.SIGNAL("triggered()"), self.AbrirPlanesNotificaciones) self.connect(self.VentanaMain.actionMonitor_de_Alertas, QtCore.SIGNAL("triggered()"), self.AbrirMonitoreoAlertas) self.connect(self.VentanaMain.actionLogin_Logout, QtCore.SIGNAL("triggered()"), self.LoginLogout) self.connect(self.VentanaMain.actionModoVentana, QtCore.SIGNAL("triggered()"), self.ModoVentana) self.connect(self.VentanaMain.actionLateralBar, QtCore.SIGNAL("triggered()"), self.HideShowBar) self.connect(self.VentanaMain.lineEdit_BuscarCliente, QtCore.SIGNAL("textEdited(const QString&)"), self.BuscarClientesHechapormi) self.connect(self.VentanaMain.tableWidget_ListaClientes, QtCore.SIGNAL("cellDoubleClicked(int,int)"),self.AbrirCliente) ################################ ABRIR CONFIGURACIONES ################################### self.connect(self.VentanaMain.actionReceptores, QtCore.SIGNAL("triggered()"), self.AbrirReceptores) self.connect(self.VentanaMain.actionEmpresas, QtCore.SIGNAL("triggered()"), self.AbrirEmpresas) self.connect(self.VentanaMain.actionParentesco, QtCore.SIGNAL("triggered()"), self.AbrirParentesco) self.connect(self.VentanaMain.actionResoluciones, QtCore.SIGNAL("triggered()"), self.AbrirResoluciones) self.connect(self.VentanaMain.actionEventos, QtCore.SIGNAL("triggered()"), self.AbrirEventos) self.connect(self.VentanaMain.actionCodigos_de_Alarma, QtCore.SIGNAL("triggered()"), self.AbrirCodigosAlarmas) self.connect(self.VentanaMain.actionTipo_de_Cliente, QtCore.SIGNAL("triggered()"), self.AbrirTipoCliente) self.connect(self.VentanaMain.actionDepartamentos, QtCore.SIGNAL("triggered()"), self.AbrirDepartamentos) self.connect(self.VentanaMain.actionGrupo_Codigos_de_Alarma, QtCore.SIGNAL("triggered()"), self.AbrirGruposCodigosAlarma) self.connect(self.VentanaMain.actionMotivos_Soporte, QtCore.SIGNAL("triggered()"), self.AbrirMotivosSoporte) self.connect(self.VentanaMain.actionDias_Feriados, QtCore.SIGNAL("triggered()"), self.AbrirDiasFeriados) self.connect(self.VentanaMain.actionTipos, QtCore.SIGNAL("triggered()"), self.AbrirTiposEquipos) self.connect(self.VentanaMain.actionSub_Tipos_de_Equipos, QtCore.SIGNAL("triggered()"), self.AbrirSubTiposEquipos) self.connect(self.VentanaMain.actionMarcas, QtCore.SIGNAL("triggered()"), self.AbrirMarcasEquipos) self.connect(self.VentanaMain.actionModelos_de_Equipos, QtCore.SIGNAL("triggered()"), self.AbrirModelosEquipos) ################################## ABRIR REPORTES ############################################# self.connect(self.VentanaMain.actionClientes_sin_Imagen, QtCore.SIGNAL("triggered()"), self.AbrirClientesSinImagenes) self.connect(self.VentanaMain.actionCodigo_ALarmas, QtCore.SIGNAL("triggered()"), self.AbrirReporteCodigosAlarmas) self.connect(self.VentanaMain.actionActivaciones, QtCore.SIGNAL("triggered()"), self.AbrirReporteActivaciones) self.connect(self.VentanaMain.actionGrupos_Alarmas, QtCore.SIGNAL("triggered()"), self.AbrirReporteGruposSenales) self.connect(self.VentanaMain.actionEventos_no_definidos, QtCore.SIGNAL("triggered()"), self.AbrirReporteEventoNoDefinido) self.connect(self.VentanaMain.actionSMS_Entrada, QtCore.SIGNAL("triggered()"), self.AbrirReporteSMSEntrada) self.connect(self.VentanaMain.actionSMS_Cliente, QtCore.SIGNAL("triggered()"), self.AbrirReporteClientesSMS) self.connect(self.VentanaMain.actionEstatus_Panel, QtCore.SIGNAL("triggered()"), self.AbrirReporteEstatusPanel) self.connect(self.VentanaMain.actionClientes_Ultima_Se_al, QtCore.SIGNAL("triggered()"), self.AbrirReporteClienteUltimaSenal) self.connect(self.VentanaMain.actionClientes_Ultima_A_C, QtCore.SIGNAL("triggered()"), self.AbrirReporteClienteUltimaAperturaCierre) self.connect(self.VentanaMain.actionSMS_Totales, QtCore.SIGNAL("triggered()"), self.AbrirReporteTotalesSMS) self.connect(self.VentanaMain.actionFicha_Cliente, QtCore.SIGNAL("triggered()"), self.AbrirReporteFichaClientes) #Para que las todas las subventanas del mdiarea no tomen el mismo estado cuando se maximiza una self.VentanaMain.mdiArea.setOption(QtGui.QMdiArea.DontMaximizeSubWindowOnActivation,False) self.ModoWindows = True ########################## PARA LA BARRA LATERAL DE LISTA DE CLIENTE ###########################3 #Invento mio para solucionar el Bug con que si esta activado el rezize de las tablas\ #Con el resize de la ventana no se le puede colocar un tamano por defecto self.installEventFilter(self) self.HideBar = True self.BuscarClientesBD() self.ListarClientes() self.CargarTablasEstaticamente() if globalvars.Tipo == str(1): self.HiloRondas = HiloCalcRondas(self) self.HiloRondas.start() #self.HiloHorarios = HiloCalcHorarios(self) #self.HiloHorarios.start() self.HiloAlertas = HiloCalcAlertas(self) self.HiloAlertas.start() ####################### ABRIR LOGIN ########################### self.TimerLogin = QtCore.QTimer() self.TimerLogin.setSingleShot(True) self.TimerLogin.start(100) self.connect(self.TimerLogin, QtCore.SIGNAL("timeout()"), self.AbrirLogin) ##################FUNCIONES PARA EL SYSTEM TRAY ICON####################### self.exitOnClose = False exit = QtGui.QAction(QtGui.QIcon(":/iconos/ico/connections-512(1).png"), "Cerrar 365Connect", self) self.connect(exit, QtCore.SIGNAL("triggered()"), self.exitEvent) self.trayIcon = QtGui.QSystemTrayIcon(QtGui.QIcon(":/iconos/ico/connections-512(1).png"), self) menu = QtGui.QMenu(self) menu.addAction(exit) self.trayIcon.setContextMenu(menu) self.connect(self.trayIcon, \ QtCore.SIGNAL("activated(QSystemTrayIcon::ActivationReason)"), \ self.trayIconActivated) self.trayIcon.show() self.trayIcon.showMessage("365Connect Iniciando","Un momento...",QtGui.QSystemTrayIcon.Information,10000) self.trayIcon.setToolTip("365Connect") self.HayBD = True def trayIconActivated(self, reason): if reason == QtGui.QSystemTrayIcon.Context: self.trayIcon.contextMenu().show() elif reason == QtGui.QSystemTrayIcon.Trigger: self.show() self.raise_() if globalvars.Logueado == False: self.Login.show() def closeEvent(self,event): if self.exitOnClose: self.trayIcon.hide() if 'self.HiloMoniAlert' in locals(): self.HiloMoniAlert.terminate() while True: if self.HiloMoniAlert.isTerminated(): del self.HiloMoniAlert break if 'self.SubVentanaMonitoreoAlertas' in locals(): del self.SubVentanaMonitoreoAlertas if 'self.SubVentanaEventos' in locals(): del self.SubVentanaEventos if 'self.SubVentanaReporteTotalesSMS' in locals(): del self.SubVentanaReporteTotalesSMS self.VentanaMain.mdiArea.closeAllSubWindows() event.accept() else: self.hide() event.setAccepted(True) event.ignore() def exitEvent(self): self.exitOnClose = True self.close() ################################################################################ def LoginLogout(self): if globalvars.Logueado == True: self.AbrirLogin() def AbrirLogin(self): self.Login = Login(self) self.Login.setWindowModality(QtCore.Qt.WindowModal) self.Login.exec_() def CargarTablasEstaticamente(self): self.VentanaMain.tableWidget_ListaClientes.setColumnWidth(0,40) self.VentanaMain.tableWidget_ListaClientes.setColumnWidth(1,195) def BuscarClientesHechapormi(self,busqueda): self.ListarClientes() #print busqueda #for letra in busqueda: ResultadoBusqueda = self.VentanaMain.tableWidget_ListaClientes.findItems(busqueda,QtCore.Qt.MatchContains) #print ResultadoBusqueda #for i in ResultadoBusqueda: #print i.text() listafilasresultado = [] for r in ResultadoBusqueda: listafilasresultado.append(self.VentanaMain.tableWidget_ListaClientes.row(r)) #print listafilasresultado filasentotal = self.VentanaMain.tableWidget_ListaClientes.rowCount() for eliminar in reversed(range(filasentotal)): if eliminar in listafilasresultado: pass else: self.VentanaMain.tableWidget_ListaClientes.removeRow(eliminar) def AbrirClienteDesdeExterno(self,idcliente): for nombretipo,listatipo in self.DictClientesPorTipo.iteritems(): if int(idcliente) in listatipo: TipoCliente = nombretipo break if TipoCliente == 'Alarmas': self.AbrirPanelClienteAlarmas(idcliente) elif TipoCliente == 'GPS': pass elif TipoCliente == 'Bastones': self.AbrirPanelClienteRondas(idcliente) def AbrirCliente(self,*celda): ElementoTabla = self.VentanaMain.tableWidget_ListaClientes.item(celda[0],0) PrefijoCuenta = str(ElementoTabla.text()) IDCliente = self.DictClientesIDCuenta[PrefijoCuenta] for nombretipo,listatipo in self.DictClientesPorTipo.iteritems(): if int(IDCliente) in listatipo: TipoCliente = nombretipo break if TipoCliente == 'Alarmas': self.AbrirPanelClienteAlarmas(IDCliente) elif TipoCliente == 'GPS': pass elif TipoCliente == 'Bastones': self.AbrirPanelClienteRondas(IDCliente) def eventFilter(self, source, event): if event.type() == QtCore.QEvent.WindowStateChange: self.ArreglarTamanoTablas() return QtGui.QWidget.eventFilter(self, source, event) def resizeEvent(self,resizeEvent): if self.Resize1 == True: self.ArreglarTamanoTablas() self.Resize1 = True pass def ArreglarTamanoTablas(self): if self.Resize == True: self.VentanaMain.tableWidget_ListaClientes.setColumnWidth(0,self.VentanaMain.tableWidget_ListaClientes.width()/5) self.VentanaMain.tableWidget_ListaClientes.setColumnWidth(1,self.VentanaMain.tableWidget_ListaClientes.width()/1.38) self.Resize = True def BuscarClientesBD(self): print 'CARGANDO' self.ResultadoListaClientes = globalvars.BD.Querys('ListarClientesIDNombre') self.ListarClientes() def ListarClientes(self): self.DictClientesIDCuenta = {} #Creo el diccionario donde estaran los clientes por tipo self.DictClientesPorTipo = {} #Agrego los Tipos self.DictClientesPorTipo['Alarmas'] = [] self.DictClientesPorTipo['Bastones'] = [] self.DictClientesPorTipo['GPS'] = [] self.VentanaMain.tableWidget_ListaClientes.verticalHeader().setVisible(False) self.VentanaMain.tableWidget_ListaClientes.setShowGrid(False) self.VentanaMain.tableWidget_ListaClientes.setAlternatingRowColors(True) #self.VentanaMain.tableWidget_ListaClientes.resizeColumnsToContents() self.VentanaMain.tableWidget_ListaClientes.verticalHeader().setDefaultSectionSize(20) self.VentanaMain.tableWidget_ListaClientes.setEditTriggers(QtGui.QAbstractItemView.NoEditTriggers) self.VentanaMain.tableWidget_ListaClientes.setSortingEnabled(False) self.VentanaMain.tableWidget_ListaClientes.setSelectionBehavior(QtGui.QAbstractItemView.SelectRows) while self.VentanaMain.tableWidget_ListaClientes.rowCount() > 0: self.VentanaMain.tableWidget_ListaClientes.removeRow(0) fila = 0 columna = 0 for cliente in reversed(self.ResultadoListaClientes): self.VentanaMain.tableWidget_ListaClientes.insertRow(0) columna = 0 #Columna 0 texto = QtGui.QTableWidgetItem(str(cliente.prefijo)+'-'+str(cliente.cuenta)) self.VentanaMain.tableWidget_ListaClientes.setItem(fila,columna,texto) #Columna 1 columna = columna + 1 texto = QtGui.QTableWidgetItem(cliente.nombre_cliente) self.VentanaMain.tableWidget_ListaClientes.setItem(fila,columna,texto) #Organizamos los Clientes segun su tipo de dispositivo (Alarma - GPS - Bastones) para al hacer click en Abrir abrir el panel que es if cliente.tipocuenta == None: ClienteTipo = 0 else: ClienteTipo = cliente.tipocuenta if int(ClienteTipo) == 5: self.DictClientesPorTipo['Alarmas'].append(cliente.id_cliente) elif int(ClienteTipo) == 6: self.DictClientesPorTipo['GPS'].append(cliente.id_cliente) elif int(ClienteTipo) == 7: self.DictClientesPorTipo['Bastones'].append(cliente.id_cliente) #Agregamos al diccionario self.DictClientesIDCuenta clave prefijo-cuenta valor idcliente self.DictClientesIDCuenta[str(cliente.prefijo)+'-'+str(cliente.cuenta)] = str(cliente.id_cliente) self.ArreglarTamanoTablas() def ModoVentana(self): if self.ModoWindows == True: self.VentanaMain.mdiArea.setViewMode(1) self.ModoWindows = False else: self.VentanaMain.mdiArea.setViewMode(0) self.ModoWindows = True def HideShowBar(self): if self.HideBar == True: self.VentanaMain.dockWidget_ListaClientes.show() self.HideBar = False else: self.VentanaMain.dockWidget_ListaClientes.hide() self.HideBar = True self.ArreglarTamanoTablas() ##################################### SUB VENTANAS ########################################################## def AbrirReporteFichaClientes(self): self.SubVentanaReporteFichaCliente = SubVentanaReporteFichaCliente() self.SubVentanaReporteFichaCliente.setAttribute(QtCore.Qt.WA_DeleteOnClose,True) #self.VentanaMain.mdiArea.addSubWindow(self.SubVentanaReporteFichaCliente) self.SubVentanaReporteFichaCliente.show() def AbrirReporteTotalesSMS(self): self.SubVentanaReporteTotalesSMS = SubVentanaReporteTotalesSMS() self.SubVentanaReporteTotalesSMS.setAttribute(QtCore.Qt.WA_DeleteOnClose,True) #self.VentanaMain.mdiArea.addSubWindow(self.SubVentanaReporteTotalesSMS) self.SubVentanaReporteTotalesSMS.showMaximized() def AbrirReporteClienteUltimaAperturaCierre(self): self.SubVentanaReporteClienteUltimaAperturaCierre = SubVentanaReporteClientesUltimaAperturaCierre() self.SubVentanaReporteClienteUltimaAperturaCierre.setAttribute(QtCore.Qt.WA_DeleteOnClose,True); #self.VentanaMain.mdiArea.addSubWindow(self.SubVentanaReporteClienteUltimaAperturaCierre) self.SubVentanaReporteClienteUltimaAperturaCierre.showMaximized() def AbrirReporteClienteUltimaSenal(self): self.SubVentanaReporteUltimaSenal = SubVentanaReporteClienteUltimaSenal() self.SubVentanaReporteUltimaSenal.setAttribute(QtCore.Qt.WA_DeleteOnClose,True); #self.VentanaMain.mdiArea.addSubWindow(self.AbrirReporteGruposSenales) self.SubVentanaReporteUltimaSenal.showMaximized() def AbrirReporteEstatusPanel(self): self.SubVentanaReporteEstatusPanel = SubVentanaReporteEstatusPanel() self.SubVentanaReporteEstatusPanel.setAttribute(QtCore.Qt.WA_DeleteOnClose,True); #self.VentanaMain.mdiArea.addSubWindow(self.AbrirReporteGruposSenales) self.SubVentanaReporteEstatusPanel.showMaximized() def AbrirReporteClientesSMS(self): self.SubVentanaReporteClientesSMS = SubVentanaReporteClientesSMS() self.SubVentanaReporteClientesSMS.setAttribute(QtCore.Qt.WA_DeleteOnClose,True); #self.VentanaMain.mdiArea.addSubWindow(self.AbrirReporteGruposSenales) self.SubVentanaReporteClientesSMS.showMaximized() def AbrirReporteSMSEntrada(self): self.SubVentanaReporteSMSEntrada = SubVentanaReporteSMSEntrada() self.SubVentanaReporteSMSEntrada.setAttribute(QtCore.Qt.WA_DeleteOnClose,True); #self.VentanaMain.mdiArea.addSubWindow(self.AbrirReporteGruposSenales) self.SubVentanaReporteSMSEntrada.showMaximized() def AbrirReporteEventoNoDefinido(self): self.AbrirReporteEventoNoDefinido = SubVentanaReporteEventoNoDefinido() self.AbrirReporteEventoNoDefinido.setAttribute(QtCore.Qt.WA_DeleteOnClose,True); #self.VentanaMain.mdiArea.addSubWindow(self.AbrirReporteGruposSenales) self.AbrirReporteEventoNoDefinido.showMaximized() def AbrirReporteGruposSenales(self): self.AbrirReporteGruposSenales = SubVentanaGruposSenales() self.AbrirReporteGruposSenales.setAttribute(QtCore.Qt.WA_DeleteOnClose,True); #self.VentanaMain.mdiArea.addSubWindow(self.AbrirReporteGruposSenales) self.AbrirReporteGruposSenales.showMaximized() def AbrirReporteActivaciones(self): self.AbrirReporteActivaciones = SubVentanaReporteActivaciones() self.AbrirReporteActivaciones.setAttribute(QtCore.Qt.WA_DeleteOnClose,True); #self.VentanaMain.mdiArea.addSubWindow(self.AbrirReporteActivaciones) self.AbrirReporteActivaciones.showMaximized() def AbrirMonitoreoAlertas(self): self.SubVentanaMonitoreoAlertas = SubVentanaMonitorAlertas() self.SubVentanaMonitoreoAlertas.setAttribute(QtCore.Qt.WA_DeleteOnClose,True) self.SubVentanaMonitoreoAlertas.showMaximized() self.HiloMoniAlert = HiloMonitoreoAlertas(self,self.SubVentanaMonitoreoAlertas.SubVentanaMonitorAlertas.tableWidget_Log,self.SubVentanaMonitoreoAlertas.SubVentanaMonitorAlertas.tableWidget_Cola,self.SubVentanaMonitoreoAlertas.SubVentanaMonitorAlertas.tableWidget_Enviados,self.SubVentanaMonitoreoAlertas.SubVentanaMonitorAlertas.tableWidget_Recibidos,self.SubVentanaMonitoreoAlertas.SubVentanaMonitorAlertas.label_ColaMensajes) self.HiloMoniAlert.start() def AbrirModelosEquipos(self): self.SubVentanaModelosEquipos = SubVentanaModelosEquipos() self.SubVentanaModelosEquipos.setAttribute(QtCore.Qt.WA_DeleteOnClose,True) self.SubVentanaModelosEquipos.show() def AbrirMarcasEquipos(self): self.SubVentanaMarcasEquipos = SubVentanaMarcasEquipos() self.SubVentanaMarcasEquipos.setAttribute(QtCore.Qt.WA_DeleteOnClose,True) self.SubVentanaMarcasEquipos.show() def AbrirSubTiposEquipos(self): self.SubVentanaSubTiposEquipos = SubVentanaSubTiposEquipos() self.SubVentanaSubTiposEquipos.setAttribute(QtCore.Qt.WA_DeleteOnClose,True) self.SubVentanaSubTiposEquipos.show() def AbrirTiposEquipos(self): self.SubVentanaTiposEquipos = SubVentanaTiposEquipos() self.SubVentanaTiposEquipos.setAttribute(QtCore.Qt.WA_DeleteOnClose,True) self.SubVentanaTiposEquipos.show() def AbrirPlanesNotificaciones(self): self.AbrirPlanesNotificaciones = SubVentanaPlanesNotificaciones() self.AbrirPlanesNotificaciones.setAttribute(QtCore.Qt.WA_DeleteOnClose,True); #self.VentanaMain.mdiArea.addSubWindow(self.AbrirPlanesNotificaciones) self.AbrirPlanesNotificaciones.show() def AbrirMapaClientes(self): self.SubVentanaMapaClientes = SubVentanaMapaClientes() self.SubVentanaMapaClientes.setAttribute(QtCore.Qt.WA_DeleteOnClose,True); #self.VentanaMain.mdiArea.addSubWindow(self.SubVentanaMapaClientes) self.SubVentanaMapaClientes.show() def AbrirReceptores(self): self.SubVentanaReceptores = SubVentanaReceptores() self.SubVentanaReceptores.setAttribute(QtCore.Qt.WA_DeleteOnClose,True); #self.VentanaMain.mdiArea.addSubWindow(self.SubVentanaReceptores) self.SubVentanaReceptores.show() def AbrirEmpresas(self): self.SubVentanaEmpresas = SubVentanaEmpresas() self.SubVentanaEmpresas.setAttribute(QtCore.Qt.WA_DeleteOnClose,True); #self.VentanaMain.mdiArea.addSubWindow(self.SubVentanaEmpresas) self.SubVentanaEmpresas.show() def AbrirParentesco(self): self.SubVentanaParentesco = SubVentanaParentesco() self.SubVentanaParentesco.setAttribute(QtCore.Qt.WA_DeleteOnClose,True); #self.VentanaMain.mdiArea.addSubWindow(self.SubVentanaParentesco) self.SubVentanaParentesco.show() def AbrirResoluciones(self): self.SubVentanaResoluciones = SubVentanaResoluciones() self.SubVentanaResoluciones.setAttribute(QtCore.Qt.WA_DeleteOnClose,True); #self.VentanaMain.mdiArea.addSubWindow(self.SubVentanaResoluciones) self.SubVentanaResoluciones.show() def AbrirEventos(self): self.SubVentanaEventos = SubVentanaEventos() self.SubVentanaEventos.setAttribute(QtCore.Qt.WA_DeleteOnClose,True) #self.VentanaMain.mdiArea.addSubWindow(self.SubVentanaEventos) self.SubVentanaEventos.show() def AbrirCodigosAlarmas(self): self.SubVentanaCodigosAlarma = SubVentanaCodigosAlarma() #self.VentanaMain.mdiArea.addSubWindow(self.SubVentanaCodigosAlarma) self.SubVentanaCodigosAlarma.setAttribute(QtCore.Qt.WA_DeleteOnClose,True) self.SubVentanaCodigosAlarma.show() def AbrirTipoCliente(self): self.SubVentanaTipoCliente = SubVentanaTipoCliente() #self.VentanaMain.mdiArea.addSubWindow(self.SubVentanaTipoCliente) self.SubVentanaTipoCliente.show() def AbrirDepartamentos(self): self.SubVentanaDepartamentos = SubVentanaDepartamentos() #self.VentanaMain.mdiArea.addSubWindow(self.SubVentanaDepartamentos) self.SubVentanaDepartamentos.show() def AbrirCodigosAlarma(self): self.SubVentanaDepartamentos = SubVentanaDepartamentos() #self.VentanaMain.mdiArea.addSubWindow(self.SubVentanaDepartamentos) self.SubVentanaDepartamentos.show() def AbrirGruposCodigosAlarma(self): self.SubVentanaGruposCodigosAlarma = SubVentanaGruposCodigosAlarma() #self.VentanaMain.mdiArea.addSubWindow(self.SubVentanaGruposCodigosAlarma) self.SubVentanaGruposCodigosAlarma.show() def AbrirMotivosSoporte(self): self.SubVentanaMotivosSoporte = SubVentanaMotivosSoporte() #self.VentanaMain.mdiArea.addSubWindow(self.SubVentanaMotivosSoporte) self.SubVentanaMotivosSoporte.show() def AbrirDiasFeriados(self): self.SubVentanaDiasFeriados = SubVentanaDiasFeriados() #self.VentanaMain.mdiArea.addSubWindow(self.SubVentanaDiasFeriados) self.SubVentanaDiasFeriados.show() def AbrirGrupoClientes(self): self.SubVentanaGruposdeClientes = SubVentanaGruposdeClientes() #self.VentanaMain.mdiArea.addSubWindow(self.SubVentanaGruposdeClientes) self.SubVentanaGruposdeClientes.setWindowTitle("Grupos Clientes") self.SubVentanaGruposdeClientes.show() self.connect(self.SubVentanaGruposdeClientes, QtCore.SIGNAL("signalAbrirCuentasGrupo"), self.AbrirCuentasGrupo) self.connect(self.SubVentanaGruposdeClientes, QtCore.SIGNAL("signalAbrirAgregarGrupo"), self.AbrirNuevoGrupoClientes) def AbrirCuentasGrupo(self,parent,idgrupo): self.DialogCuentasGrupo = DialogCuentasGrupo(parent,idgrupo) #self.VentanaMain.mdiArea.addSubWindow(self.DialogCuentasGrupo) self.DialogCuentasGrupo.show() self.connect(self.DialogCuentasGrupo, QtCore.SIGNAL("signalCerrar"), self.CerrarVentanaActiva) def CerrarVentanaActiva(self): self.VentanaMain.mdiArea.closeActiveSubWindow() def AbrirNuevoGrupoClientes(self,parent=None): self.SubVentanaNuevoGrupoClientes = SubVentanaNuevoGrupoClientes(parent) #self.VentanaMain.mdiArea.addSubWindow(self.SubVentanaNuevoGrupoClientes) self.SubVentanaNuevoGrupoClientes.setWindowTitle("Nuevo Grupo Clientes") self.SubVentanaNuevoGrupoClientes.show() self.connect(self.SubVentanaNuevoGrupoClientes, QtCore.SIGNAL("signalCerrar"), self.CerrarVentanaActiva) def AbrirVehiculos(self): self.SubVentanaVehiculos = SubVentanaVehiculos() #self.VentanaMain.mdiArea.addSubWindow(self.SubVentanaVehiculos) self.SubVentanaVehiculos.setWindowTitle("Vehiculos") self.SubVentanaVehiculos.show() def AbrirUsuarios(self): self.SubVentanaUsuarios = SubVentanaUsuarios() self.SubVentanaUsuarios.setAttribute(QtCore.Qt.WA_DeleteOnClose,True); #self.VentanaMain.mdiArea.addSubWindow(self.SubVentanaUsuarios) self.SubVentanaUsuarios.show() def AbrirTiposUsuarios(self): self.SubVentanaTiposUsuarios = SubVentanaTiposUsuarios() self.SubVentanaTiposUsuarios.setAttribute(QtCore.Qt.WA_DeleteOnClose,True); #self.VentanaMain.mdiArea.addSubWindow(self.SubVentanaTiposUsuarios) self.SubVentanaTiposUsuarios.show() def AbrirMonitoreo(self): self.SubVentanaMonitoreo = SubVentanaMonitoreo(self) self.SubVentanaMonitoreo.setAttribute(QtCore.Qt.WA_DeleteOnClose,True); self.SubVentanaMonitoreo.setWindowTitle("Monitoreo") self.SubVentanaMonitoreo.showMaximized() def AbrirListaClientes(self): self.SubVentanaListaClientes = SubVentanaListaClientes() #self.SubVentanaListaClientes.setWindowIcon(QtGui.QIcon(":/iconos/ico/Feedbin-Icon-check.svg.png")) self.SW = self.VentanaMain.mdiArea.addSubWindow(self.SubVentanaListaClientes) self.SW.setWindowIcon(QtGui.QIcon(":/iconos/ico/Feedbin-Icon-check.svg.png")) self.SW.show() self.connect(self.SubVentanaListaClientes, QtCore.SIGNAL("signalAbrirPanelCliente"),self.AbrirClienteDesdeExterno) def AbrirNuevoCliente(self): self.SubVentanaNuevoCliente = SubVentanaNuevoCliente() #self.VentanaMain.mdiArea.addSubWindow(self.SubVentanaNuevoCliente) self.SubVentanaNuevoCliente.setWindowTitle("Agregar Cliente") self.SubVentanaNuevoCliente.show() self.connect(self.SubVentanaNuevoCliente, QtCore.SIGNAL("signalCargarClientesNuevamente"),self.BuscarClientesBD) self.connect(self.SubVentanaNuevoCliente, QtCore.SIGNAL("signalAbrirPanelClienteAlarmas"),self.AbrirPanelClienteAlarmas) self.connect(self.SubVentanaNuevoCliente, QtCore.SIGNAL("signalAbrirPanelClienteRondas"),self.AbrirPanelClienteRondas) def AbrirPanelClienteAlarmas(self,abonado): self.SubVentanaPanelClienteAlarmas = SubVentanaPanelClienteAlarmas(abonado) #self.VentanaMain.mdiArea.addSubWindow(self.SubVentanaPanelCliente) self.SubVentanaPanelClienteAlarmas.setStyleSheet(self.styleSheet()) self.SubVentanaPanelClienteAlarmas.show() self.connect(self.SubVentanaPanelClienteAlarmas, QtCore.SIGNAL("signalCargarClientesNuevamente"),self.BuscarClientesBD) self.connect(self.SubVentanaPanelClienteAlarmas, QtCore.SIGNAL("signalAbrirPanelClienteAlarmas"),self.AbrirPanelClienteAlarmas) self.connect(self.SubVentanaPanelClienteAlarmas, QtCore.SIGNAL("signalAbrirPanelClienteRondas"),self.AbrirPanelClienteRondas) def AbrirPanelClienteRondas(self,abonado): self.SubVentanaPanelClienteRondas = SubVentanaPanelClienteRondas(abonado) #self.VentanaMain.mdiArea.addSubWindow(self.SubVentanaPanelCliente) self.SubVentanaPanelClienteRondas.setStyleSheet(self.styleSheet()) self.SubVentanaPanelClienteRondas.show() self.connect(self.SubVentanaPanelClienteRondas, QtCore.SIGNAL("signalCargarClientesNuevamente"),self.BuscarClientesBD) self.connect(self.SubVentanaPanelClienteRondas, QtCore.SIGNAL("signalAbrirPanelClienteRondas"),self.AbrirPanelClienteRondas) self.connect(self.SubVentanaPanelClienteRondas, QtCore.SIGNAL("signalAbrirPanelClienteAlarmas"),self.AbrirPanelClienteAlarmas) def AbrirClientesSinImagenes(self): self.SubVentanaClientesSinImagenes = SubVentanaClientesSinImagenes() #self.VentanaMain.mdiArea.addSubWindow(self.SubVentanaClientesSinImagenes) self.SubVentanaClientesSinImagenes.show() def AbrirReporteCodigosAlarmas(self): self.SubVentanaReportesCodigoAlarma = SubVentanaReportesCodigoAlarma() #self.VentanaMain.mdiArea.addSubWindow(self.SubVentanaReportesCodigoAlarma) self.SubVentanaReportesCodigoAlarma.showMaximized()
def setUp(self): global lg, data, path data = GetValue() lg = Login(data.getvalue('product_address'))
class Back: #运营后台数据 zhanzhuang_xuqiu_url = 'http://back.zhankoo-uat.com/Exhibition/Decorate/DecorateBookFindPaged' zhanzhuang_dingdan_url = 'http://back.zhankoo-uat.com/SOrder/DecorateOrder/DecorateOrderFindPaged' zhanhui_xuqiu_url = 'http://back.zhankoo-uat.com/Exhibition/Booth/BoothBookFindPaged' zhanwei_dingdan_url = 'http://back.zhankoo-uat.com/SOrder/BoothOrder/BoothOrderFindPaged' zhanzhuang_gongchang_dingdan_url = 'http://back.zhankoo-uat.com/SOrder/DecFactoryOrder/DecFactoryOrderFindPaged' zhanhui_guangli_url = 'http://back.zhankoo-uat.com/Exhibition/Exhibition/ExhibitionFindPaged' del_zhanzhuang_xuqiu_url = 'http://back.zhankoo-uat.com/Exhibition/Decorate/DecorateBookDelete' del_zhanzhuang_dingdan_url = 'http://back.zhankoo-uat.com/SOrder/DecorateOrder/DecorateOrderDelete' del_zhanhui_xuqiu_url = 'http://back.zhankoo-uat.com/Exhibition/Booth/BoothBookDelete' del_zhanwei_dingdan_url = 'http://back.zhankoo-uat.com/SOrder/BoothOrder/BoothOrderDelete' del_zhanzhuang_gongchang_dingdan_url = 'http://back.zhankoo-uat.com/SOrder/DecFactoryOrder/DecFactoryOrderDelete' session = Login().send_back_login_request() ''' 1.展装需求 2.展装订单 3.展会需求 4.展位订单 5.展装工厂订单 6.展会管理 ''' def back_management_list(self,code): #获取订单管理的id data = { 'page':1, 'rows':1, 'sort':'CreateOn', 'order':'DESC' } if code == 1: url = self.zhanzhuang_xuqiu_url elif code == 2: url = self.zhanzhuang_dingdan_url elif code == 3: url = self.zhanhui_xuqiu_url elif code == 4: url = self.zhanwei_dingdan_url elif code == 5: url = self.zhanzhuang_gongchang_dingdan_url elif code ==6: url = self.zhanhui_guangli_url web_request = self.session.post(url,data=data) id = json.loads(web_request.text)['rows'][0]['ID'] return id def back_del_management_list_data(self,id,code): #删除订单管理数据 data = { 'id':id } if code == 1: url = self.del_zhanzhuang_xuqiu_url elif code == 2: url = self.del_zhanzhuang_dingdan_url elif code == 3: url = self.del_zhanhui_xuqiu_url elif code == 4: url = self.del_zhanwei_dingdan_url elif code == 5: url = self.del_zhanzhuang_gongchang_dingdan_url elif code == 6: url = self.zhanhui_guangli_url web_request = self.session.post(url,data=data) res = json.loads(web_request.text)['success'] return res == True def back_booth_order_detials(self,order_id): #后台展位订单详情 booth_basics_info_url = 'http://back.zhankoo-uat.com/SOrder/BoothOrder/BoothOrderDetailView/%s'% order_id web_request_booth_basics_info = self.session.get(url=booth_basics_info_url) soup1 = BeautifulSoup(web_request_booth_basics_info.text, 'lxml') exhibition_name = str(soup1.select('td')[15])[4:-5] booth_info_url = 'http://back.zhankoo-uat.com/SOrder/BoothOrder/BoothSnapshotFindPaged' data = { 'BoothOrderID':681, 'page':1, 'rows':20, 'sort':'CreateOn', 'order':'DESC' } web_request_booth_info = self.session.get(url=booth_info_url,data=data) booth_id = json.loads(web_request_booth_info.text)['rows'][0]['ID'] booth_name = json.loads(web_request_booth_info.text)['rows'][0]['Name'] # print(booth_name) return exhibition_name,booth_id,booth_name
class New_Exhibition: '''新增展会信息''' basic_info_url = 'http://exh.zhankoo-uat.com/Exhibition/Organizer/BasicSave' exhibition_introduction_url = 'http://exh.zhankoo-uat.com/Exhibition/Organizer/IntroductionSave' organization_url = 'http://exh.zhankoo-uat.com/Exhibition/Organizer/InstitutionSave' basic_booth_url = 'http://exh.zhankoo-uat.com/Exhibition/Organizer/BasicBoothSave' exhibition_picture_upload_url = 'http://exh.zhankoo-uat.com/Exhibition/Organizer/ExPictureSave' exhibition_picture_url = 'http://exh.zhankoo-uat.com/Exhibition/Organizer/PictureSave' meeting_picture_upload_url = 'http://exh.zhankoo-uat.com/Exhibition/Organizer/MeetingPictureSave' meeting_url = 'http://exh.zhankoo-uat.com/Exhibition/Organizer/MeetingSave' contact_url = 'http://exh.zhankoo-uat.com/Exhibition/Organizer/ContactSave' exhibition_data_url = 'http://exh.zhankoo-uat.com/Exhibition/Organizer/DataSave' exhibitor_url = 'http://exh.zhankoo-uat.com/Exhibition/Organizer/ExhibitorSave' back_edit_exhibition_url = 'http://back.zhankoo-uat.com/Exhibition/Exhibition/ExhibitionSave' add_zhanwei_url = 'http://exh.zhankoo-uat.com/exhibition/organizer/onlineboothinsert' zhanwei_peizhi_xinxi_url = 'http://exh.zhankoo-uat.com/exhibition/organizer/onlineboothstandardboothconfigsave' zhanwei_picture_upload_url = 'http://exh.zhankoo-uat.com/Exhibition/Organizer/OnlineBoothPictureFrom' zhanwei_picture_url = 'http://exh.zhankoo-uat.com/exhibition/organizer/onlineboothpicturesave' update_exhibition_index_url = 'http://back.zhankoo-uat.com/CompositePlat/SearchEngine/UpdateAllExhibition' back_update_zhanhui_index_url = 'http://back.zhankoo-uat.com/CompositePlat/SearchEngine/UpdateAllExhibition' zhubanfang_session = Login().send_login_request(name=18165702795,password=123456) back_session = Login().send_back_login_request() def new_basic_info(self,param): '''新增基本信息''' data = { 'ID':0, 'Name':param['name'], 'ShortName':'测试', 'IndustryName':param['industry_name'], 'IndustryID':param['industry_id'], 'ExhibitCategory':'[{"ID":3,"Name":"包装机械/塑料机械"},{"ID":62,"Name":"门窗"}]', 'HoldFrequencyWithYear':1, 'HoldFrequency':1, 'FromOn':param['from_on'], 'ToOn':param['to_on'], 'PavilionID':3118, 'PavilionName':'深圳会展中心', 'Address':'中国广东深圳市福田区', 'Site':'www.zhankoo.com', 'X-Requested-With':'XMLHttpRequest' } web_request = self.zhubanfang_session.post(url=self.basic_info_url,data=data) soup = BeautifulSoup(web_request.text,'lxml') result = soup.select('html > body > p')[0].get_text() return json.loads(result) def new_zhanhui_introduction(self,exhibition_id,description,scope,label): '''新增展会介绍''' data = { 'ID':exhibition_id, 'Description':description, 'Scope':scope, 'ExhibitorManualUrl':'', 'Tag':label, 'X-Requested-With':'XMLHttpRequest' } web_request = self.zhubanfang_session.post(url=self.exhibition_introduction_url,data=data) assert json.loads(web_request.text)['success'] def new_organization(self,exhibition_id,organizer,contractor): '''新增举办机构''' data = { 'ID':exhibition_id, 'Organizer':organizer, 'Contractor':contractor, 'X-Requested-With':'XMLHttpRequest' } web_request = self.zhubanfang_session.post(url=self.organization_url,data=data) assert json.loads(web_request.text)['success'] def new_booth_info(self,exhibition_id,param): '''新增展位基本信息''' orderjson_data = [ {'Type':1, 'Price':param['biaozhan_price'], 'Area':param['biaozhan_area'], 'Description':param['biaozhan_description']}, {'Type':2, 'Price': param['guangdi_price'], 'Area': param['guangdi_area'], 'Description': param['guangdi_description']}] data = { 'ID':exhibition_id, 'MinOrderJson':str(orderjson_data), 'StandardBoothMoney':param['biaozhan_price'], 'StandardBoothArea':param['biaozhan_area'], 'StandardBoothRemark':param['biaozhan_description'], 'BareSpaceBoothMoney':param['guangdi_price'], 'BareSpaceBoothArea':param['guangdi_area'], 'BareSpaceBoothRemark':param['guangdi_description'], 'X-Requested-With': 'XMLHttpRequest' } web_request = self.zhubanfang_session.post(url=self.basic_booth_url,data=data) assert json.loads(web_request.text)['success'] def picture_upload(self, index, filename): #index == 1 为上传展会图片,index == 2 为上传同期会议图片 current = os.getcwd() base = current.split('\\test_case')[0] target = base + '\\data_file\\' + filename open_file = {'file': open(target, 'rb')} url = '' if index == 1: url = self.exhibition_picture_upload_url elif index == 2: url = self.meeting_picture_upload_url elif index ==3: url = self.zhanwei_picture_upload_url web_response = self.zhubanfang_session.post(url=url, files=open_file) result = '' if index == 1: result = json.loads(web_response.text.split('OnCompleteUpload')[1].split('catch(e)')[0][2:-4]) elif index == 2: result = json.loads(web_response.text.split('MeetingComplete')[1].split('catch(e)')[0][2:-4]) elif index == 3: result = json.loads(web_response.text.split('OnCompleteUpload')[1].split('catch(e)')[0][2:-4]) assert result['success'] == True return result['pictureUrl'] def save_exhibition_picture(self,exhibition_id,imges): #保存展会图片 data = { 'ID': exhibition_id, 'ImgStr': imges } web_request = self.zhubanfang_session.post(url=self.exhibition_picture_url, data=data) assert json.loads(web_request.text)['success'] def new_meeting(self,exhibition_id,param): #新增同期会议 data = { 'ID':'', 'ExhibitionID':exhibition_id, 'Name':param['meeting_title'], 'MeetingFromOn':param['meeting_from_on'], 'MeetingToOn':param['meeting_to_on'], 'Address':param['address'], 'Organizer':param['organizer'], 'MaxPeople':param['max_people'], 'ImageUrl':param['image-url'], 'Description':param['descrition'], 'X-Requested-With':'XMLHttpRequest' } web_request = self.zhubanfang_session.post(url=self.meeting_url, data=data) assert json.loads(web_request.text)['success'] def contact_info(self,exhibition_id,param): #新增联系方式 data = { 'ID':exhibition_id, 'Contact':param['contact'], 'Telephone':param['telephone'], 'Mobile':param['mobile'], 'Fax':param['fax'], 'QQ':param['qq'], 'Email':param['email'], 'X-Requested-With':'XMLHttpRequest' } web_request = self.zhubanfang_session.post(url=self.contact_url, data=data) assert json.loads(web_request.text)['success'] def new_exhibition_data(self,exhibition_id,param): #新增展会数据 audiences_data = [{"Id": "0", "Statue": "new", "Type": param['textfield_type_1'], "Percent": param["textfield_percent_1"]}, {"Id": "0", "Statue": "new", "Type": param['textfield_type_2'],"Percent":param["textfield_percent_2"]}] exhibitors_data = [{"Id": "0", "Statue": "new", "Type": param['textfield_type_3'], "Percent": param["textfield_percent_3"]}, {"Id": "0", "Statue": "new","Type":param['textfield_type_4'],"Percent":param["textfield_percent_4"]}] data = { 'ExhibitionID':exhibition_id, 'Area':param['area'], 'NetArea':param['net_area'], 'HistoryNum':param['history_num'], 'ViewerQuantity':param['viewer_quantity'], 'id':0, 'statue':'new', 'textfield3':param['textfield_type_1'], 'textfield6':param['textfield_percent_1'], 'AudiencesData':str(audiences_data), 'id':0, 'statue':'new', 'textfield3':param['textfield_type_2'], 'textfield6':param['textfield_percent_2'], 'ExhibitorQuantity':param['exhibition_quantity'], 'id':0, 'statue':'new', 'textfield3':param['textfield_type_3'], 'textfield6':param["textfield_percent_3"], 'id':0, 'statue':'new', 'textfield3':param['textfield_type_4'], 'textfield6':param['textfield_percent_4'], 'ExhibitorsData':str(exhibitors_data), 'ViewerSatisfy':param['viewer_satisfy'], 'ExhibitorSatisfy':param['exhibitor_satisfy'], 'X-Requested-With':'XMLHttpRequest' } web_request = self.zhubanfang_session.post(url=self.exhibition_data_url, data=data) assert json.loads(web_request.text)['success'] def new_exhibitor(self,exhibition_id,exhibitor_list): #新增展商名录 data = { 'ID':exhibition_id, 'ExhibitorList':exhibitor_list, 'X-Requested-With':'XMLHttpRequest' } web_request = self.zhubanfang_session.post(url=self.exhibitor_url, data=data) assert json.loads(web_request.text)['success'] def back_edit_zhanhui(self,exhibition_id): # 后台编辑审核、签约展会信息 request_back_get_edit_zhanhui_data = self.back_session.post(url='http://back.zhankoo-uat.com/Exhibition/Exhibition/ExhibitionDetailView/%s'% exhibition_id) soup = BeautifulSoup(request_back_get_edit_zhanhui_data.text,'lxml') exhibition_id = soup.select('td')[1]('input')[0].get('value') name = soup.select('td')[1]('input')[1].get('value') short_name = soup.select('td')[3]('input')[0].get('value') pavilion_name = soup.select('td')[15]('input')[0].get('value') pavilion_id = soup.select('td')[15]('input')[1].get('value') organizer = re.findall(r'">(.+?.)</textarea>',str(soup.select('td')[17]))[0] contractor = re.findall(r'">(.+?.)</textarea>',str(soup.select('td')[19]))[0] scope = re.findall(r'">(.+?.)</textarea>',str(soup.select('td')[21]))[0] description = re.findall(r'">(.+?.)</textarea>',str(soup.select('td')[23]))[0] from_on = re.findall(r'value:\'(.+?.)\'',str(soup.select('td')[25]('input')[0]))[0] to_on = re.findall(r'value:\'(.+?.)\'',str(soup.select('td')[25]('input')[1]))[0] ticket_end_on = re.findall(r'value:\'(.+?.)\'',str(soup.select('td')[27]))[0] book_end_on = re.findall(r'value:\'(.+?.)\'',str(soup.select('td')[29]))[0] site = soup.select('td')[35]('input')[0].get('value') industry_id = re.findall(r'value:\'(\d*)\'',str(soup.select('td')[43]('input')[0]))[0] industry_name= soup.select('td')[43]('input')[1].get('value') exhibit_category = soup.select('td')[45]('input')[0].get('value') tag = soup.select('td')[47]('input')[0].get('value') contact = soup.select('td')[49]('input')[0].get('value') internat_type = soup.select('td')[51]('input')[0].get('value') country_code = soup.select('td')[51]('input')[0].get('value') country_name = soup.select('td')[51]('input')[0].get('value') province_name = soup.select('td')[51]('input')[1].get('value') city_name = soup.select('td')[51]('input')[2].get('value') county_name = soup.select('td')[51]('input')[3].get('value') telephone = soup.select('td')[53]('input')[0].get('value') mobile = soup.select('td')[55]('input')[0].get('value') qq = soup.select('td')[57]('input')[0].get('value') fax = soup.select('td')[59]('input')[0].get('value') address = soup.select('td')[61]('input')[0].get('value') postalcode = soup.select('td')[63]('input')[0].get('value') email = soup.select('td')[65]('input')[0].get('value') min_order_json = soup.select('td')[73]('input')[0].get('value') booth_discount = soup.select('td')[75]('input')[0].get('value') standard_booth_config = str(soup.select('td')[81])[128:-16] area = soup.select('td')[83]('input')[0].get('value') net_area = soup.select('td')[85]('input')[0].get('value') hold_frequency = eval(soup.select('td')[87]('input')[0].get('value')) hold_year = hold_frequency['year'] hold_boundary = hold_frequency['number'] viewer_quantity = soup.select('td')[91]('input')[0].get('value') exhibitor_quantity = soup.select('td')[95]('input')[0].get('value') viewer_satisfy = soup.select('td')[99]('input')[0].get('value') exhibitor_satisfy = soup.select('td')[101]('input')[0].get('value') history_num = soup.select('td')[105]('input')[0].get('value') exhibitor_list = re.findall(r'">(.+?.)</textarea>',str(soup.select('td')[107]))[0] virtual_synthesize_goal = soup.select('td')[117]('input')[0].get('value') data = { 'ID':exhibition_id, 'Name':name, 'ShortName':short_name, 'PavilionName':pavilion_name, 'PavilionID':pavilion_id, 'Organizer':organizer, 'Contractor':contractor, 'Scope':scope, 'Description':description, 'FromOn':from_on, 'ToOn':to_on, 'TicketEndOn':ticket_end_on, 'BookEndOn':book_end_on, 'Site':site, 'IsSign':'True', 'IndustryID':industry_id, 'IndustryName':industry_name, 'ExhibitCategory':exhibit_category, 'Tag':tag, 'Contact':contact, 'InternatType':internat_type, 'CountryCode':country_code, 'CountryName':country_name, 'ProvinceName':province_name, 'CityName':city_name, 'CountyName':county_name, 'Telephone':telephone, 'Mobile':mobile, 'QQ':qq, 'Fax':fax, 'Address':address, 'Postalcode':postalcode, 'Email':email, 'State':1, 'MinOrderJson':min_order_json, 'BoothDiscount':booth_discount, 'StandardBoothConfig':standard_booth_config, 'Area':area, 'NetArea':net_area, 'HoldFrequency':hold_frequency, 'HoldYear': hold_year, 'HoldBoundary': hold_boundary, 'ViewerQuantity':viewer_quantity, 'ExhibitorQuantity':exhibitor_quantity, 'ViewerSatisfy':viewer_satisfy, 'ExhibitorSatisfy':exhibitor_satisfy, 'HistoryNum':history_num, 'ExhibitorList':exhibitor_list, 'VirtualSynthesizeGoal':virtual_synthesize_goal } web_request = self.back_session.post(url=self.back_edit_exhibition_url,data=data) assert json.loads(web_request.text)['message'] == '操作成功!' def add_zhanwei(self,exhibition_id,param): #新增展位 data = { 'ExhibitionID':exhibition_id, 'Name':param['zhanwei_num'], 'PavilionNO':param['zhanguang_num'], 'Type':param['zhanwei_xingshi'], 'StandardType':param['kaikou_leixing'], 'Price':param['price'], 'Area':param['area'], 'Length':param['length'], 'Width':param['width'], 'Discount':param['discount'], 'IsSell':param['is_sell'], 'Description':param['description'] } web_request = self.zhubanfang_session.post(url=self.add_zhanwei_url,data=data) assert json.loads(web_request.text)['success'] def zhanwei_peizhi_xinxi(self,exhibition_id,standard_booth_config): #新增展位配置信息 data = { 'StandardBoothConfig':standard_booth_config, 'ID':exhibition_id } web_request = self.zhubanfang_session.post(url=self.zhanwei_peizhi_xinxi_url, data=data) assert json.loads(web_request.text)['success'] def save_zhanwei_picture(self,exhibition_id,zhanwei_picture): #上传展位图片 data = { 'BoothImageUrl':zhanwei_picture, 'ID':exhibition_id } web_request = self.zhubanfang_session.post(url=self.zhanwei_picture_url, data=data) assert json.loads(web_request.text)['success'] def back_update_zhanhui_index(self): #后台更新展会索引 web_request = self.back_session.post(url=self.back_update_zhanhui_index_url) assert json.loads(web_request.text)['success']