#DesignSharePage.py
###设计工程,派单改造交房
# -*- coding:utf8 -*- from base.Base import Base from base import Page from selenium.webdriver.common.by import By from base import SQL import time from base.Base import log from base.Base import consoleLog class DesignSharePage(Base): searchMould = { 'contract_num_loc' : (By.ID,'contract_num_search'), 'search_btn_loc' : (By.ID,'search_btn_share'), 'tr_contract' : (By.CSS_SELECTOR,'tr[datagrid-row-index="0"]') } designShareMould = { #操作按钮 'design_btn':(By.CSS_SELECTOR,"[οnclick='ShareIndex.dialog(\"workBlank\",0)']"), #分割户型:index=0右侧、1右键 'design_btn_1': (By.CSS_SELECTOR,"[οnclick='ShareIndex.dialog(\"sendOrder\",0)']"), #派单:index=0右侧、1右键 'design_btn_2': (By.CSS_SELECTOR,"[οnclick='ShareIndex.dialog(\"closingRoom\",0)']"), #交房:index=0右侧、1右键 #公共区域房东配置 'an_electric_appliance_btn': (By.CSS_SELECTOR,'#publicLandlordElectricConfiguration > input:nth-child(1)'),#电器全选 'kitchen_and_toilet_btn': (By.CSS_SELECTOR, '#publicLandlordKitchenBathConfiguration > input:nth-child(1)'),#厨卫全选 'home_furnishing_btn': (By.CSS_SELECTOR, '#publicLandlordHouseHomeConfiguration > input:nth-child(1)'),#家居全选 #新增房间 'add_house_btn': (By.CSS_SELECTOR,'#design_share_panel > div:nth-child(7) > div > div > a'),#新增房间 'room_area' : (By.CSS_SELECTOR,'#room_area + span > input'),#面积 'houseRoomFunc': (By.CSS_SELECTOR, '# houseRoomFunc > input:nth-child(1)'), # 房间附间 'an_electric_appliance_btn_l': (By.CSS_SELECTOR, '#roomLandlordElectricConfiguration > input:nth-child(1)'), # 电器全选 'home_furnishing_btn_l': (By.CSS_SELECTOR, '#roomLandlordHouseHomeConfiguration > input[type="checkbox"]:nth-child(1)'), #家居全选 'save_btn' : (By.ID,'form_btn_workBlank'), #保存 #派单界面 'save_btn_1': (By.ID, 'send_order_form_btn'), # 保存 #交房界面 'total_cost': (By.CSS_SELECTOR,'#total_cost + span > input'),#装修总成本 'save_btn_2': (By.ID,'closing_room_form_btn'),#保存 } typeMould = { 'fitment_style' : '#fitment_style ',#装修风格 'room_no' : '#room_no ',#房号 'room_orientation' : '#room_orientation ',#朝向 'fitment_uid' : '#fitment_uid ',#施工专员 'decorate_start_date' : '#decorate_start_date ',#装修开工日 'hard_delivery_date' : '#hard_delivery_date ', #硬装交付日 'set_delivery_date' : '#set_delivery_date ', #整套交付日 } @log def designhouse(self): """品牌合租公寓设计装修""" self.open(Page.designSharePage, self.searchMould['tr_contract'], havaFrame=False) self.input_text(self.searchMould['contract_num_loc'],'AutoTest') self.click(self.searchMould['search_btn_loc']) self.staleness_of(self.searchMould['tr_contract']) self.context_click(self.searchMould['tr_contract']) self.click(self.designShareMould['design_btn'],index=0) #分割户型 self.click(self.designShareMould['an_electric_appliance_btn']) self.type_select(self.typeMould['fitment_style'],'SIMPLECHINESE') self.click(self.designShareMould['kitchen_and_toilet_btn']) self.click(self.designShareMould['home_furnishing_btn']) self.click(self.designShareMould['add_house_btn']) self.type_select(self.typeMould['room_no'],'METH') self.input_text(self.designShareMould['room_area'],'50') self.type_select(self.typeMould['room_orientation'],'NORTH') self.click(self.designShareMould['an_electric_appliance_btn_l']) self.click(self.designShareMould['home_furnishing_btn_l']) self.click(self.designShareMould['save_btn']) self.check_submit() #派单 self.context_click(self.searchMould['tr_contract']) self.click(self.designShareMould['design_btn_1'], index=0) self.wait_element(self.designShareMould['save_btn_1']) uid = SQL.serach("SELECT su.user_id FROM sys_user su, sys_position sp WHERE su.position_id = sp.position_id AND su.user_status = 'INCUMBENCY' AND sp.position_name LIKE '%品牌公寓专员%' LIMIT 1") self.type_select(self.typeMould['fitment_uid'],uid) time.sleep(1) self.click(self.designShareMould['save_btn_1']) self.check_submit() #交房 self.context_click(self.searchMould['tr_contract']) self.click(self.designShareMould['design_btn_2'], index=0) self.input_text(self.designShareMould['total_cost'], '5000.00') self.type_date(self.typeMould['decorate_start_date'],'2017-01-01') self.type_date(self.typeMould['hard_delivery_date'],'2017-01-15') self.type_date(self.typeMould['set_delivery_date'],'2017-01-20') self.click(self.designShareMould['save_btn_2']) self.check_submit() Base.succeed += 1 consoleLog('设计装修成功') try: self.solr('apartment',self.test) consoleLog('apartment-core增量成功') except: consoleLog(Exception.message,level='ERROR') consoleLog('执行solr增量出现问题,请查看solr是否正常',level='ERROR')