class UserYansPage(): def __init__(self, driver): #BaseHandle.__init__(self, driver) self.handle = BaseHandle(driver) #切换iframe def __switch_iframe(self): self.handle.switch_iframe("iframe", "iframe_yansgl") @BaseHandle.functional_combination("使用人", "验收资产", index=[1]) def yans_tj(self): ''' 验收提交 ''' self.handle.click_element("验收资产", "提交")
class XinxgzPage(): def __init__(self, driver): self.driver = driver self.handle = BaseHandle(driver) #切换iframe def switch_iframe(self): self.handle.switch_iframe("iframe", "iframe_xinxgz") #获取提示信息 def __get_message(self): try: self.handle.switch_iframe() self.handle.wait_element('message', 'message_shenhcg') message_text = self.handle.get_element('message', 'message_shenhcg').text except: message_text = None return message_text @BaseHandle.functional_combination("使用人", "我要处置", [1, 2]) def weix_ss(self): ''' 维修审核 value:退回、送审、同意、不同意 ''' print(1111111111111111)
def login(self): self.driver = webdriver.Chrome() self.sys_o = SeleniumDriver(self.driver) self.sys_h = BaseHandle(self.driver) self.driver.get('http://192.168.1.164:27979/zl/179333') self.sys_o.handle_windows("max") self.sys_o.send_value('登录', "username", "admin") self.sys_o.send_value('登录', "password", "zl123456zl") try: # 截取验证码 self.driver.save_screenshot("C:/ZL_testing/image/ZL.png") code_element = self.sys_o.get_element('登录', "yanzm") left = code_element.location['x'] top = code_element.location['y'] right = code_element.size['width'] + left height = code_element.size['height'] + top im = Image.open('C:/ZL_testing/image/ZL.png') img = im.crop((left, top, right, height)) img1 = img.resize((1024, 728)) img1.save("C:/ZL_testing/image/yanzm.png") # 图片转base64 f = open('C:/ZL_testing/image/yanzm.png', 'rb') # 第一个参数图像路径 ls_f = base64.b64encode(f.read()) f.close() # Showapi识别验证码 精度高, 不免费 r = ShowapiRequest("http://route.showapi.com/184-5", "126468", "b76ac488b076469ea5f5a19d109e1bd3") r.addBodyPara("img_base64", ls_f) r.addBodyPara("typeId", "34") r.addBodyPara("convert_to_jpg", "0") r.addBodyPara("needMorePrecise", "0") res = r.post() yanzm_test = res.json()['showapi_res_body']['Result'] ''' # pytesseract识别验证码 精度低, 免费 img1 = Image.open("C:/ZL_testing/image/yanzm.png") test = pytesseract.image_to_string(img1) ''' self.sys_o.send_value('登录', "yanzm_key", yanzm_test) except: pass self.sys_o.click_element('登录', 'login')
def __init__(self, driver): self.handle = BaseHandle(driver) self.unit_chengzu = unit_chengzu_page.chengzu(driver) self.unit_chuzu = unit_chuzu_page.ChuzPage(driver) self.unit_dengz = unit_dengzgl_page.DengzglPage(driver) self.unit_touz = unit_duiwtz_page.DuiwtzPage(driver) self.unit_peiz = unit_peiz_page.PeizlPage(driver) self.unit_shouy = unit_shouy_page.ShouyPage(driver) self.unit_weix = unit_weixgl_page.WeixglPage(driver) self.unit_yans = unit_yansgl_page.YansglPage(driver) self.unit_chuz = unit_ziccz_page.ZicczPage(driver) self.unit_fenp = unit_zicfp_page.ZicfpPage(driver) self.unit_shouh = unit_zicsh_page.ZicshPage(driver) self.unit_zhuany = unit_ziczy_page.ZiczyPage(driver) self.unit_shouygl = unit_shouygl_page.ShouyglPage(driver) self.fin_hex = fin_hexzc_page.HexzcPage(driver) self.fin_shouy = fin_shouy_page.ShouyiPage(driver) self.fin_weix = fin_weix_page.FinWeixPage(driver) self.fin_dengz = fin_xinzzc_page.XinzzcPage(driver) self.dep_guih = dep_guih_page.DepGuihPage(driver) self.dep_peiz = dep_peiz_page.DepPeizlPage(driver) self.dep_shouy = dep_shouy_page.DepShouyPage(driver) self.dep_weix = dep_weixgl_page.DepWeixglPage(driver) self.dep_yans = dep_yansgl_page.DepYansglPage(driver) self.dep_ziccz = dep_ziccz_page.DepZicczPage(driver) self.dep_fenp = dep_zicfp_page.DepZicfpPage(driver) self.dep_shouh = dep_zicsh_page.DepZicshPage(driver) self.dep_zhuany = dep_ziczy_page.DepZiczyPage(driver) self.user_chuz = user_chuz_page.UserZicczPage(driver) self.user_guih = user_guih_page.UserGuihPage(driver) self.user_shenl = user_shenl_page.UserShenllPage(driver) self.user_shouy = user_shouy_page.UserShouyPage(driver) self.user_zhuany = user_zhuany_page.UserZhuanyPage(driver) self.user_weix = user_weix_page.UserWeixPage(driver) self.user_yans = user_yans_page.UserYansPage(driver)
class DepGuihPage(): def __init__(self, driver): self.handle = BaseHandle(driver) #切换iframe def switch_iframe(self): self.handle.switch_iframe("iframe", "iframe_guih") #获取勾选框,判断是否有数据 def get_date(self): self.handle.get_elements("通用", "勾选卡片") #归还 @BaseHandle.functional_combination("部门资产管理员", "资产归还", index=[1]) def guih_pass(self): ''' 归还 ''' self.handle.click_element("资产归还", "归还") self.handle.click_element("通用", "确定")
class UserGuihPage(): def __init__(self, driver): self.handle = BaseHandle(driver) #切换iframe def switch_iframe(self): self.handle.switch_iframe("iframe", "iframe_guih") @BaseHandle.functional_combination("使用人", "资产归还", index=[1]) def guih_pass(self): ''' 归还 ''' self.handle.click_element("资产归还", "归还") self.handle.click_element("通用", "确定")
class ShouyglPage(): def __init__(self, driver): #BaseHandle.__init__(self, driver) self.handle = BaseHandle(driver) #切换iframe def switch_iframe(self): self.handle.switch_iframe("iframe", "iframe_shouygl") @BaseHandle.functional_combination("单位资产管理员", "收益管理", index=[1]) def shouy_ss(self): ''' 收益送财务 ''' self.handle.click_element("收益管理", "送财务登账") self.handle.click_element("通用", "确定")
class UserZicczPage(): def __init__(self, driver): self.handle = BaseHandle(driver) #切换iframe def switch_iframe(self): self.handle.switch_iframe("iframe", "iframe_ziccz") #处置提交 @BaseHandle.functional_combination("使用人", "我要处置", [1]) def chuz_ss(self, value): ''' 处置提交 value:提交申请、删除申请 ''' self.handle.click_element("我要处置", value) self.handle.click_element("通用", "确定")
class SysBusiness(object): def __init__(self): self.myWindow = Tk() #设置标题 self.myWindow.title('重建单位用户') # 连接oracle def Connect_oracle(self): self.address = 'zx/zl123456zl@164_XE' self.conn = cx_Oracle.connect(self.address) self.curs = self.conn.cursor() # 提交 断开Oracle def broken_oralce(self): self.curs.close() self.conn.commit() self.conn.close() def oracle_package(self): self.Connect_oracle() #声明变量 #调用存储过程 #删除单位 try: P_ORGID = "7B2998E7A2CA4C32A5F9B58652EE7333" msg = self.curs.var(cx_Oracle.STRING) # plsql出参 args = [P_ORGID, msg] self.curs.callproc("AST_COMMON.CLEAR", args) # 删除单位 except cx_Oracle.Error as e: print(e) self.broken_oralce() def execute_sqlfile(self): self.Connect_oracle() try: ##读取SQL文件,获得sql语句的list with open( 'C:\ZL_testing\config\insert_bd_org.sql', encoding='UTF-8') as f: sql_list = f.read().split(';')[:-1] # sql文件最后一行加上; sql_list = [ x.replace('\n', ' ') if '\n' in x else x for x in sql_list ] # 将每段sql里的换行符改成空格 ##执行sql语句,使用循环执行sql语句 for sql_item in sql_list: # print (sql_item) self.curs.execute(sql_item) except cx_Oracle.Error as e: print(e) finally: self.broken_oralce() def login(self): self.driver = webdriver.Chrome() self.sys_o = SeleniumDriver(self.driver) self.sys_h = BaseHandle(self.driver) self.driver.get('http://192.168.1.164:27979/zl/179333') self.sys_o.handle_windows("max") self.sys_o.send_value('登录', "username", "admin") self.sys_o.send_value('登录', "password", "zl123456zl") try: # 截取验证码 self.driver.save_screenshot("C:/ZL_testing/image/ZL.png") code_element = self.sys_o.get_element('登录', "yanzm") left = code_element.location['x'] top = code_element.location['y'] right = code_element.size['width'] + left height = code_element.size['height'] + top im = Image.open('C:/ZL_testing/image/ZL.png') img = im.crop((left, top, right, height)) img1 = img.resize((1024, 728)) img1.save("C:/ZL_testing/image/yanzm.png") # 图片转base64 f = open('C:/ZL_testing/image/yanzm.png', 'rb') # 第一个参数图像路径 ls_f = base64.b64encode(f.read()) f.close() # Showapi识别验证码 精度高, 不免费 r = ShowapiRequest("http://route.showapi.com/184-5", "126468", "b76ac488b076469ea5f5a19d109e1bd3") r.addBodyPara("img_base64", ls_f) r.addBodyPara("typeId", "34") r.addBodyPara("convert_to_jpg", "0") r.addBodyPara("needMorePrecise", "0") res = r.post() yanzm_test = res.json()['showapi_res_body']['Result'] ''' # pytesseract识别验证码 精度低, 免费 img1 = Image.open("C:/ZL_testing/image/yanzm.png") test = pytesseract.image_to_string(img1) ''' self.sys_o.send_value('登录', "yanzm_key", yanzm_test) except: pass self.sys_o.click_element('登录', 'login') def switch_operation(self, value, date): self.sys_h.click_two_level_menu("系统选项配置") self.sys_o.switch_iframe("iframe", "iframe_Xitxxpzxg") self.sys_h.search_assets(value) time.sleep(1) element = self.sys_o.get_element("后台管理", "当前值_0") dangqz = element.get_attribute("value") if dangqz != date[0:1]: self.sys_o.click_element("后台管理", "下拉") time.sleep(1) self.sys_o.click_element("后台管理", date) time.sleep(1) self.sys_o.click_element("通用", "确定") def zhej(self): self.sys_h.click_two_level_menu("系统选项配置") self.sys_o.switch_iframe("iframe", "iframe_Xitxxpzxg") self.sys_h.search_assets("是否启用“新会计制度”") time.sleep(1) self.sys_o.click_element("后台管理", "设置") time.sleep(1) self.sys_o.click_element("后台管理", "启用") time.sleep(1) self.sys_o.click_element("后台管理", "折旧开关") time.sleep(1) self.sys_o.click_element("后台管理", "折旧必须升级版") time.sleep(1) self.sys_o.click_element("通用", "确定") time.sleep(2) def add_user(self): time.sleep(3) self.sys_o.switch_iframe("iframe", "iframe_adminHome") self.sys_o.click_element('后台管理', '核对部门人员信息') time.sleep(1) self.sys_o.right_click('后台管理', '单位树') self.sys_o.click_element('后台管理', '新增') self.sys_o.send_value('后台管理', '部门名称', '测试') self.sys_o.click_element('通用', '确定') time.sleep(2) self.sys_o.click_element('后台管理', '部门树') self.sys_o.click_element('后台管理', '新增部门人员') self.sys_o.send_value('通用', '输入框', 'ss', 0) self.sys_o.click_element('通用', '输入框', 3) self.sys_o.click_element('后台管理', '使用人') self.sys_o.click_element('后台管理', '部门资产管理员') self.sys_o.click_element('后台管理', '部门领导') self.sys_o.click_element('后台管理', '单位资产管理员') self.sys_o.click_element('后台管理', '单位领导') self.sys_o.click_element('后台管理', '财务制单人员') self.sys_o.click_element('通用', '输入框', 3) self.sys_o.click_element('后台管理', '职级', 2) self.sys_o.click_element('后台管理', '国家级正职') self.sys_o.click_element('通用', '确定') self.sys_o.switch_iframe() def init_user(self): time.sleep(3) self.sys_o.click_element('通用', '系统管理') time.sleep(1) self.sys_o.click_element('通用', '重新登录') self.sys_o.send_value('登录', "username", "ss") self.sys_o.send_value('登录', "password", "1") self.sys_o.click_element('登录', 'login') time.sleep(1) self.sys_o.send_value('通用', '输入框', '17621231905', 1) self.sys_o.send_value('通用', '输入框', '123', 3) self.sys_o.send_value('通用', '输入框', '123', 4) self.sys_o.click_element('后台管理', '保存') def close_driver(self): try: self.driver.close() except: pass self.myWindow.quit() def init_operation(self): self.switch_operation("是否启用“密码强度提示”", "否01") self.driver.refresh() self.switch_operation("是否启用“登录页面显示验证码”", "否01") self.driver.refresh() self.switch_operation("是否启用权限管理", "否01") self.driver.refresh() self.switch_operation("是否启用“送久其审批”", "否01") self.driver.refresh() self.zhej() def init_date(self): self.oracle_package() self.execute_sqlfile() self.login() self.init_operation() self.driver.refresh() self.add_user() self.init_user() def Button(self): Button( self.myWindow, text='初始化数据', font=('Helvetica 10 bold'), relief='raised', width=8, height=2, command=self.init_date).grid( row=0, column=0, sticky=W, padx=5, pady=5) Button( self.myWindow, text='退出', font=('Helvetica 10 bold'), relief='raised', command=self.close_driver, width=8, height=2).grid( row=0, column=1, sticky=W, padx=5, pady=5) self.myWindow.mainloop()
class DepZicfpPage(): def __init__(self, driver): #BaseHandle.__init__(self, driver) self.handle = BaseHandle(driver) #切换iframe def switch_iframe(self): self.handle.switch_iframe("iframe", "iframe_fenp") #获取提示信息 def __get_message(self): try: self.handle.switch_iframe() self.handle.wait_element('message', 'ty_message') message_text = self.handle.get_element('message', 'ty_message').text except: message_text = None return message_text #删除接收方 def del_per(self): self.handle.click_element("资产分配", "取消接收方") time.sleep(0.5) self.handle.click_element("通用", "确定") #添加接收方 def add_per(self): self.handle.click_element("资产分配", "添加接收方") time.sleep(1) self.handle.click_element("资产分配", "勾选添加接收方") self.handle.click_element("通用", "确定") @BaseHandle.functional_combination("部门资产管理员", "资产分配", index=[1]) def fenp(self, value): ''' 分配 value:使用人、部门 ''' self.handle.click_element("资产分配", "添加接收方") time.sleep(1) if value == "使用人": self.handle.click_element("资产分配", "勾选添加接收方") self.handle.click_element("通用", "确定") time.sleep(1) self.handle.click_element("资产分配", "分配") time.sleep(0.5) self.handle.click_element("通用", "确定") #取消分配 @BaseHandle.functional_combination("部门资产管理员", "资产分配", "分配中", index=[1]) def quxfp(self): self.handle.click_element("资产分配", "取消分配") time.sleep(0.5) self.handle.click_element("通用", "确定") #取消分配成功 def quxfp_success(self): self.quxfp() if self.handle.get_zicfp_message() == "操作成功": return True else: return False #无接收方取消接收方 @BaseHandle.functional_combination("部门资产管理员", "资产分配", index=[1]) def del_personnel_error(self): if self.handle.get_element("资产分配", "新增部门人员") == None: self.__del() self.__del() if self.handle.get_element('error', 'fenp_error').text == "请添加分配人方可操作": return True else: return False #无接收方分配 @BaseHandle.functional_combination("部门资产管理员", "资产分配", index=[1]) def distribution_error(self): if self.handle.get_element("资产分配", "新增部门人员") == None: self.__del() self.handle.click_element("资产分配", "分配") if self.handle.get_element( 'error', 'fenp_error').text.endswith('请先添加接收人或接收部门') == True: return True else: return False #添加接收方成功 @BaseHandle.functional_combination("部门资产管理员", "资产分配", index=[1]) def add_personnel_success(self): self.add_per() if self.__get_message() == "添加成功": return True else: return False #取消接受方成功 @BaseHandle.functional_combination("部门资产管理员", "资产分配", index=[1]) def del_personnel_success(self): self.del_per() if self.__get_message() == "删除成功": return True else: return False
class WeixglPage(): def __init__(self, driver): #Base__init__(self, driver) self.handle = BaseHandle(driver) #切换iframe def switch_iframe(self): self.handle.switch_iframe("iframe", "iframe_weixgl") #获取提示信息 def __get_message(self): try: self.handle.switch_iframe() self.handle.wait_element('message', 'message_shenhcg') message_text = self.handle.get_element('message', 'message_shenhcg').text except: message_text = None return message_text #维修审核 @BaseHandle.functional_combination("单位资产管理员", "维修管理", "待审核", index=[1]) def weix_ss(self, value): ''' value:退回、送审、同意、不同意 ''' self.handle.click_element("维修管理", "审核") self.handle.switch_iframe() self.handle.switch_iframe("iframe", "iframe1") time.sleep(0.5) self.handle.click_element("通用", value) time.sleep(0.5) self.handle.click_element("维修管理", "保存") #维修验收 @BaseHandle.functional_combination("单位资产管理员", "维修管理", "已审核") def weix_yans(self, key): ''' key:维修费用 ''' self.handle.click_element("维修管理", "维修验收") self.handle.click_element("维修管理", "选择维修商", 1) time.sleep(2) self.handle.click_element("维修管理", "勾选维修商") self.handle.click_element("维修管理", "选择维修商确定") self.handle.send_value("通用", "输入框", key, 2) self.handle.click_element("通用", "确定") def weix_ss_success(self, value): ''' value:退回、送审、同意、不同意 ''' self.weix_ss(value) if self.__get_message() == "审核成功!": return True else: return False
class DuiwtzPage(): def __init__(self, driver): #BaseHandle.__init__(self, driver) self.handle = BaseHandle(driver) #切换iframe def switch_iframe(self): self.handle.switch_iframe("iframe", "iframe_touz") #获取提示信息 def __get_message(self): try: self.handle.wait_element('message', 'message_touzcg') message_text = self.handle.get_element('message', 'message_touzcg').text except: message_text = None return message_text #投资生成单据 @BaseHandle.functional_combination("单位资产管理员", "对外投资", index=[1]) def touz_scdj(self): self.handle.click_element("对外投资", "生成投资申请单") self.handle.click_element("通用", "输入框", 0) self.handle.click_element("对外投资", "初始投资") self.handle.click_element("通用", "确定") time.sleep(1) self.handle.click_element("对外投资", "下一步") time.sleep(1) self.handle.click_element("通用", "勾选卡片", 0) self.handle.click_element("对外投资", "下一步") time.sleep(1) self.handle.send_value("通用", "输入框", 1, 0) self.handle.send_value("通用", "输入框", 2, 3) self.handle.click_element("对外投资", "下一步") time.sleep(1) self.handle.click_element("对外投资", "编辑") self.handle.click_element("通用", "输入框", 2) self.handle.click_element("对外投资", "长期股权投资") self.handle.send_value("通用", "输入框", "哲凌科技", 3) self.handle.click_element("通用", "输入框", 4) self.handle.click_element("对外投资", "其他") self.handle.send_value("通用", "输入框", 2, 5) self.handle.send_value("通用", "输入框", 2, 6) #投资到期日 data = self.handle.get_elements("通用", "输入框")[7].get_attribute('value') self.handle.caledar("通用", "输入框", data, 8) self.handle.click_element("通用", "输入框", 8) self.handle.send_value("通用", "输入框", 2, 9) self.handle.click_element("通用", "确定") self.handle.click_element("对外投资", "下一步") time.sleep(1) self.handle.send_value("通用", "输入框", 2, 0) self.handle.send_value("通用", "输入框", 2, 1) self.handle.send_value("通用", "输入框", 2, 2) self.handle.send_value("通用", "输入框", 2, 3) self.handle.send_value("通用", "输入框", 2, 4) self.handle.send_value("通用", "输入框", 2, 5) self.handle.click_element("对外投资", "附报材料") self.handle.click_element("对外投资", "附报材料_勾选", 0) self.handle.click_element("对外投资", "附报材料_勾选", 1) self.handle.click_element("对外投资", "附报材料_勾选", 3) self.handle.click_element("对外投资", "附报材料_勾选", 4) self.handle.click_element("对外投资", "附报材料_勾选", 5) self.handle.click_element("对外投资", "附报材料_勾选", 6) self.handle.click_element("对外投资", "附报材料_勾选", 7) self.handle.click_element("通用", "确定") #送审 @BaseHandle.functional_combination("单位资产管理员", "对外投资", "待送审", index=[1]) def touz_ss(self): self.handle.click_element("对外投资", "送审") time.sleep(1) self.handle.click_element("通用", "确定") #执行 @BaseHandle.functional_combination("单位资产管理员", "对外投资", "待送审") def touz_zhix(self): self.handle.click_element("对外投资", "执行投资") self.handle.send_value("通用", "输入框", 100, 2) self.handle.click_element("通用", "确定") if self.__get_message() == "①登记对外投资信息": return True else: return False #执行成功 def touz_zhix_success(self): self.touz_zhix() if self.__get_message() == "①登记对外投资信息": return True else: return False
class ZicshPage(): def __init__(self, driver): self.handle = BaseHandle(driver) #切换iframe def switch_iframe(self): self.handle.switch_iframe("iframe", "iframe_shouh") #获取提示信息 def __get_message(self): try: self.handle.switch_iframe() self.handle.wait_element('message', 'message') message_text = self.handle.get_element('message', 'message').text except: message_text = None return message_text #收回 @BaseHandle.functional_combination("单位资产管理员", "资产收回") def take_back(self): ''' 收回 ''' time.sleep(0.5) self.handle.click_element("资产收回", "操作_收回") time.sleep(1) self.handle.click_element("通用", "确定") #全部收回 @BaseHandle.functional_combination("单位资产管理员", "资产收回") def all_take_back(self): ''' 全部收回 ''' self.handle.click_element("通用", "全选") self.handle.click_element("资产收回", "收回") time.sleep(0.5) self.handle.click_element("通用", "确定") time.sleep(0.5) self.handle.click_element("资产收回", "全部收回确定") #收回成功 def take_back_success(self): self.take_back() self.handle.switch_iframe() self.handle.wait_element('message', '收回成功') message_text = self.handle.get_element('message', '收回成功').text if message_text == "收回成功": return True else: return False #全部收回成功 def all_take_back_success(self): self.all_take_back() if self.__get_message() == "收回成功": return True else: return False
class YansglPage(): def __init__(self, driver): #Base__init__(self, driver) self.handle = BaseHandle(driver) #切换至待验收iframe def switch_iframe(self): self.handle.switch_iframe("iframe", "iframe_yansgl") #填写通用卡片资料 def __send_card_data(self, value): self.handle.send_value("验收管理", "卡片信息", value, 3) #self.handle.caledar("验收管理", "卡片信息", date, 8) self.handle.click_element("验收管理", "卡片信息", 8) self.handle.click_element("通用", "今天") self.handle.click_element("验收管理", "保存") #获取提示信息 def __get_message(self): try: self.handle.wait_element('message', 'accept_message') message_text = self.handle.get_element('message', 'accept_message').text except: message_text = None return message_text #新增卡片 @BaseHandle.functional_combination("单位资产管理员", "验收管理") def add_card(self, value, card_value): ''' --->待验收<--- 新增卡片and增加同类型卡片 ''' self.handle.click_element("验收管理", "增加") if card_value != None: self.handle.click_element("验收管理", "新增资产") self.handle.switch_iframe() self.handle.switch_iframe("iframe", "iframe1") time.sleep(2) self.handle.choice_first_class(card_value) self.handle.click_element("验收管理", "确定") time.sleep(2) self.handle.switch_iframe() self.handle.switch_iframe("iframe", "iframe2") else: self.handle.click_element("验收管理", "新增同类型资产") self.handle.click_element("通用", "勾选卡片", 0) self.handle.click_element("验收管理", "确认添加") time.sleep(2) self.handle.switch_iframe() self.handle.switch_iframe("iframe", "iframe1") self.__send_card_data(value) #开始验收 @BaseHandle.functional_combination("单位资产管理员", "验收管理", index=[1]) def start_acceptance(self): ''' 开始验收 ''' self.handle.click_element("验收管理", "开始验收") time.sleep(1) #验收通过 @BaseHandle.functional_combination("单位资产管理员", "验收管理", "验收中", index=[1]) def yansgl_pass(self): ''' 验收通过 ''' time.sleep(0.5) self.handle.click_element("验收管理", "验收通过") time.sleep(0.5) self.handle.click_element("通用", "确定") time.sleep(1) #新增卡片成功 def add_card_success(self, value, card_value): ''' --->待验收<--- 新增卡片and增加同类型卡片 ''' old_lines = self.handle.get_database_lines("待验收") self.add_card(value, card_value) new_lines = self.handle.get_database_lines("待验收") if old_lines + 1 == new_lines: return True else: return False #开始验收成功 def start_acceptance_success(self): old_lines = self.handle.get_database_lines("待验收") self.start_acceptance() new_lines = self.handle.get_database_lines("待验收") if old_lines - 1 == new_lines: return True else: return False #验收通过成功 def yansgl_pass_success(self): ''' 验收通过 ''' self.yansgl_pass() if self.__get_message() == "验收已通过": return True else: return False
class ChuzPage(): def __init__(self, driver): self.handle = BaseHandle(driver) #切换iframe def switch_iframe(self): self.handle.switch_iframe("iframe", "iframe_zuj") #获取提示 def __get_message(self): try: self.handle.switch_iframe() self.handle.wait_element('message', 'ty_message') message_text = self.handle.get_element('message', 'ty_message').text except: message_text = None return message_text #出租生成单据 @BaseHandle.functional_combination("单位资产管理员", "出租 (借)", "待审核", index=[1]) def chuzu_scdj(self): ''' 出租生成单据 ''' self.handle.click_element("出租", "生成单据") self.handle.wait_element("出租", "下一步") self.handle.click_element("出租", "下一步") time.sleep(1) self.handle.click_element("出租", "下一步") time.sleep(1) self.handle.click_element("出租", "添加承租(借)方") self.handle.send_value("通用", "输入框", 1, 1) self.handle.send_value("通用", "输入框", 2, 7) self.handle.click_element("通用", "确定") time.sleep(1) self.handle.click_element("出租", "下一步") time.sleep(1) self.handle.send_value("通用", "输入框", 1, 0) self.handle.send_value("通用", "输入框", 2, 1) self.handle.send_value("通用", "输入框", 3, 2) self.handle.send_value("通用", "输入框", 4, 3) self.handle.send_value("通用", "输入框", 5, 4) self.handle.send_value("通用", "输入框", 6, 5) self.handle.click_element("出租", "附报材料") time.sleep(1) self.handle.click_element("出租", "附报材料_勾选", 0) self.handle.click_element("出租", "附报材料_勾选", 1) self.handle.click_element("出租", "附报材料_勾选", 2) self.handle.click_element("通用", "确定") #添加资产 @BaseHandle.functional_combination("单位资产管理员", "出租 (借)", "待审核") def chuzu_addcard(self, value): ''' 添加资产 ''' self.handle.click_element("通用", "添加资产") time.sleep(1) self.handle.switch_iframe("iframe", "iframe1") time.sleep(1) card_n = self.handle.get_element("出租", "添加资产_卡片编号").text self.handle.click_element("出租", "添加资产_勾选卡片", 0) time.sleep(1) self.handle.click_element("通用", "确定_01") time.sleep(1) if value == "出租": self.handle.click_element("出租", "申请出租资产") else: self.handle.click_element("出租", "申请出借资产") time.sleep(1) self.handle.click_element("通用", "确定") return card_n #取消申请 @BaseHandle.functional_combination("单位资产管理员", "出租 (借)", "待审核", index=[1]) def quxiao(self): self.handle.click_element("出租", "取消申请") self.handle.click_element("通用", "确定") #操作栏——生成单据 @BaseHandle.functional_combination("单位资产管理员", "出租 (借)", "待审核") def caoz_scdj(self): self.handle.click_element("出租", "操作_生成单据") #操作栏——取消申请 @BaseHandle.functional_combination("单位资产管理员", "出租 (借)", "待审核") def caoz_qux(self): self.handle.click_element("出租", "操作_取消申请") self.handle.click_element("通用", "确定") #送审 @BaseHandle.functional_combination("单位资产管理员", "出租 (借)", "待送审", index=[1]) def chuzu_ss(self): ''' 送审 ''' self.handle.click_element("出租", "送审") time.sleep(1) self.handle.click_element("通用", "确定") #删除 @BaseHandle.functional_combination("单位资产管理员", "出租 (借)", "待送审") def chuzu_del(self): ''' 删除 ''' self.handle.click_element("出租", "删除") time.sleep(1) self.handle.click_element("通用", "确定") #修改 @BaseHandle.functional_combination("单位资产管理员", "出租 (借)", "待送审") def chuzu_xiug(self): ''' 修改 ''' self.handle.click_element("出租", "修改") #通过 @BaseHandle.functional_combination("单位资产管理员", "出租 (借)", "审批中") def chuzu_tg(self): ''' 通过 ''' time.sleep(1) self.handle.click_element("出租", "通过", 0) time.sleep(1) self.handle.click_element("通用", "确定") #执行 @BaseHandle.functional_combination("单位资产管理员", "出租 (借)", "已审批") def chuzu_zhix(self): ''' 执行 ''' self.handle.click_element("出租", "执行出租(借)") time.sleep(1) self.handle.click_element("通用", "确定") #登记收益 @BaseHandle.functional_combination("单位资产管理员", "出租 (借)", "出租(借)中") def chuzu_shouyi(self, value): ''' 登记收益 value:暂存 送财务部门 ''' self.handle.click_element("出租", "登记收益", 0) time.sleep(1) self.handle.click_element("通用", "输入框", 0) self.handle.click_element("出租", "今天") self.handle.send_value("通用", "输入框", 1000, 1) self.handle.click_element("出租", value) #收回 @BaseHandle.functional_combination("单位资产管理员", "出租 (借)", "出租(借)中") def chuzu_shouh(self): ''' 出租资产收回 ''' self.handle.click_element("出租", "提前收回") time.sleep(1) self.handle.click_element("通用", "确定") def chuzu_zhix_success(self): ''' 执行 ''' self.chuzu_zhix() if self.__get_message() == "出租(借)成功": return True else: return False def chuzu_shouh_success(self): ''' 出租资产收回成功 ''' self.chuzu_shouh() if self.__get_message() == "收回成功": return True else: return False def chuzu_addcard_success(self, value): aa = self.chuzu_addcard(value) time.sleep(2) self.handle.switch_iframe() self.switch_iframe() bb = self.handle.get_level_element("通用", "data_info", "通用", "资产编号", 0).text if aa == bb[5:]: return True else: return False def quxiao_success(self): self.quxiao() if self.__get_message() == "取消申请成功": return True else: return False def caoz_qux_success(self): self.caoz_qux() if self.__get_message() == "取消申请成功": return True else: return False def caoz_scdj_success(self): self.caoz_scdj() self.handle.wait_element("出租", "下一步") if self.handle.get_element("出租", "下一步"): return True else: return False def chuzu_del_success(self): self.chuzu_del() if self.__get_message() == "删除成功": return True else: return False def chuzu_xiug_success(self): self.chuzu_xiug() self.handle.wait_element("出租", "下一步") if self.handle.get_element("出租", "下一步"): return True else: return False
class DepShouyPage(): ''' 部门首页 ''' def __init__(self, driver): self.handle = BaseHandle(driver) #切换iframe def switch_iframe(self): self.handle.switch_iframe("iframe", "iframe_home") def __get_message(self): try: self.handle.switch_iframe() self.handle.driver.implicitly_wait(3) message_text = self.handle.get_element('message', 'message').text except: message_text = None return message_text #获取流程中卡片发起业务,提示信息 def get_message_error(self): try: time.sleep(3) message_text = self.handle.get_element('message', 'ty_message').text except: message_text = None return message_text[-5:-2] #获取使用状态 def get_shiyzt(self): try: time.sleep(2) message_text = self.handle.get_element("首页", "使用状态").text except: message_text = None return message_text[-4:-1] #获取价值 @BaseHandle.functional_combination("部门资产管理员", "首页", "所有资产") def get_jiaz(self): try: time.sleep(2) message_text = self.handle.get_element("首页", "价值").text except: message_text = None return message_text #打开菜单--->选择卡片--->办理业务 @BaseHandle.functional_combination("部门资产管理员", "首页", "所有资产", index=[1]) def apply_business(self, yewu): ''' 打开菜单--->选择卡片--->办理业务 yewu:申请报修、申请转移、申请归还、申请处置 ''' self.handle.click_element("通用", "办理业务") self.handle.click_element("首页", yewu) time.sleep(1) self.handle.click_element("通用", "确定") if yewu == "申请归还": time.sleep(2) self.handle.click_element("使用人_首页", "确定") time.sleep(2) #申请报修错误 def apply_weix_error(self): self.apply_business("申请报修") zt = self.get_shiyzt() if self.get_message_error() == zt: return True else: return False #操作栏点击申请报修 @BaseHandle.functional_combination("部门资产管理员", "首页", "所有资产") def apply_business_02(self, yewu): self.handle.click_level_element("通用", "data_img", "首页", yewu, 0) time.sleep(1) self.handle.click_element("通用", "确定") if yewu == "申请归还": time.sleep(2) self.handle.click_element("使用人_首页", "确定") #物品操作——申请成功 def apply_business_success(self, value): self.apply_business_02(value) self.handle.wait_element("通用", "否") self.handle.click_element("通用", "否") time.sleep(2) if value == "操作_申请报修" and self.get_shiyzt() == "维修中": return True elif value == "操作_申请转移" and self.get_shiyzt() == "转移中": return True elif value == "操作_申请处置" and self.get_shiyzt() == "处置中": return True else: return False @BaseHandle.functional_combination("部门资产管理员", "首页", "待收货", index=[1]) def receipt(self, value): ''' 确认收货 value: 确认收货、取消收货、全部收货 ''' self.handle.click_element("待收货", value) time.sleep(0.5) if value != "全部收货": self.handle.click_element("通用", "确定") def receipt_success(self): self.receipt("确认收货") if self.__get_message() == "收货成功": return True else: return False def cancel_receipt_success(self): self.receipt("取消收货") if self.__get_message() == "取消收货成功": return True else: return False def all_receipt_success(self): self.receipt("全部收货") if self.__get_message() == "收货成功": return True else: return False
class ZiczyPage(): def __init__(self, driver): self.handle = BaseHandle(driver) #切换iframe def switch_iframe(self): self.handle.switch_iframe("iframe", "iframe_zhuany") #获取提示信息 def __get_message(self): try: self.handle.switch_iframe() self.handle.wait_element('message', 'message') message_text = self.handle.get_element('message', 'message').text except: message_text = None return message_text @BaseHandle.functional_combination("单位资产管理员", "资产转移", index=[1]) def zhuany(self, value): ''' 转移 value:使用人、部门 ''' self.handle.click_element("资产转移", "办理业务") time.sleep(0.5) self.handle.click_element("资产转移", "添加接收方") time.sleep(0.5) if value == "使用人": self.handle.click_element("资产转移", "勾选添加接收方") time.sleep(0.5) self.handle.click_element("通用", "确定") time.sleep(1) self.handle.click_element("通用", "勾选卡片", 0) self.handle.click_element("资产转移", "办理业务") self.handle.click_element("资产转移", "转移", 0) time.sleep(1) self.handle.click_element("通用", "确定") time.sleep(1) #转移成功 def zhuany_success(self, value): zicbh = self.handle.get_level_element("通用", "data_info", "通用", "资产编号", 0) time.sleep(0.5) self.zhuany(value) element = self.handle.get_level_element("通用", "data_info", "通用", "资产编号", 0) if element == None: return True else: zicbh_new = element.text if zicbh_new != zicbh: return True else: return False
class DepZicczPage(): def __init__(self, driver): #BaseHandle.__init__(self, driver) self.handle = BaseHandle(driver) #切换iframe def switch_iframe(self): self.handle.switch_iframe("iframe", "iframe_ziccz") #获取提示信息 def __get_message(self): try: self.handle.switch_iframe() self.handle.wait_element('message', 'message_shenhcg') message_text = self.handle.get_element('message', 'message_shenhcg').text except: message_text = None return message_text @BaseHandle.functional_combination("部门资产管理员", "资产处置", index=[1]) def chuz_ss(self, value): ''' 处置审核 value:退回、送审、同意、不同意 ''' self.handle.click_element("资产处置", "审核") time.sleep(1) self.handle.switch_iframe1() self.handle.click_element("通用", value) time.sleep(1) self.handle.click_element("通用", "保存") if self.__get_message() == "审核成功!": return True else: return False def chuz_ss_success(self, value): ''' 处置审核 value:退回、送审、同意、不同意 ''' self.chuz_ss() if self.__get_message() == "审核成功!": return True else: return False
class ShouyPage(): def __init__(self, driver): self.handle = BaseHandle(driver) #切换iframe def switch_iframe(self): self.handle.switch_iframe("iframe", "iframe_home") #获取提示信息 def __get_suoyzc_message(self): try: self.handle.wait_element_not("message", "提示") self.handle.wait_element("message", "信息") time.sleep(0.5) message_text = self.handle.get_element("message", "ty_message").text except: message_text = None return message_text def get_message(self): try: self.handle.switch_iframe() self.handle.wait_element('message', 'message') message_text = self.handle.get_element('message', 'message').text except: message_text = None return message_text #获取流程中卡片发起业务,提示信息 def get_message_error(self): try: time.sleep(3) message_text = self.handle.get_element('message', 'ty_message').text except: message_text = None return message_text[-5:-2] #获取使用状态 def get_shiyzt(self): try: time.sleep(2) message_text = self.handle.get_element("首页", "使用状态").text except: message_text = None return message_text[-4:-1] #获取价值 @BaseHandle.functional_combination("单位资产管理员", "首页", "所有资产") def get_jiaz(self): try: time.sleep(2) message_text = self.handle.get_element("首页", "价值").text except: message_text = None return message_text #首页发起业务 @BaseHandle.functional_combination("单位资产管理员", "首页", "所有资产", index=[1]) def apply_business(self, yewu): ''' 打开菜单--->选择卡片--->办理业务 yewu:业务名称 ''' self.handle.click_element("通用", "办理业务") self.handle.click_element("首页", yewu) time.sleep(1) self.handle.click_element("通用", "确定") if yewu == "申请出租" or yewu == "申请出借": time.sleep(2) self.handle.click_element("通用", "确定") time.sleep(2) #申请报修错误 def apply_weix_error(self): self.apply_business("申请报修") zt = self.get_shiyzt() if self.get_message_error() == zt: return True else: return False #操作栏点击申请报修 @BaseHandle.functional_combination("单位资产管理员", "首页", "所有资产") def apply_business_02(self, yewu): self.handle.click_level_element("通用", "data_img", "首页", yewu, 0) time.sleep(1) self.handle.click_element("通用", "确定") if yewu == "申请归还": time.sleep(2) self.handle.click_element("使用人_首页", "确定") #物品操作——申请成功 def apply_business_success(self, value): self.apply_business_02(value) self.handle.wait_element("通用", "否") self.handle.click_element("通用", "否") time.sleep(2) if value == "操作_申请报修" and self.get_shiyzt() == "维修中": return True elif value == "操作_申请转移" and self.get_shiyzt() == "转移中": return True elif value == "操作_申请处置" and self.get_shiyzt() == "处置中": return True else: return False #收货 @BaseHandle.functional_combination("单位资产管理员", "首页", "待收货", index=[1]) def receipt(self, value): ''' 收货 value:确认收货、取消收货、全部收货 ''' self.handle.click_element("待收货", value) time.sleep(0.5) if value != "全部收货": self.handle.click_element("通用", "确定") #申请报修成功 def repair(self): self.handle.apply_business("申请报修") if self.__get_suoyzc_message( ) == "您选择的卡片已放入“我要报修/维修管理”中,您如果想现在就去提交,请选择“是”;您如果还想继续选择其他卡片,请选择“否”。": return True else: return False #申请转移成功 def transfer(self): self.handle.apply_business("申请转移") if self.__get_suoyzc_message( ) == "您选择的卡片已放入“我要转移/待转移”中,您如果想现在就去提交,请选择“是”;您如果还想继续选择其他卡片,请选择“否”。": return True else: return False #申请处置成功 def management(self): self.handle.apply_business("申请处置") if self.__get_suoyzc_message( ) == "您选择的卡片已放入“我要处置/资产处置”中,您如果想现在就去提交,请选择“是”;您如果还想继续选择其他卡片,请选择“否”。": return True else: return False #申请更正成功 def corrections(self): self.handle.apply_business("申请更正") if self.__get_suoyzc_message( ) == "您选择的卡片已放入信息更正待提交中,您如果想现在就去提交,请选择“是”;您如果还想继续选择其他卡片,请选择“否”。": return True else: return False #申请出租成功 def lease(self): self.handle.apply_business("申请出租") if self.__get_suoyzc_message( ) == "您选择的卡片已放入出租(借)待审核中,您如果想现在就去提交,请选择“是”;您如果还想继续选择其他卡片,请选择“否”。": return True else: return False #申请对外投资成功 def investment(self): self.handle.apply_business("申请对外投资") if self.__get_suoyzc_message( ) == "您选择的卡片已放入对外投资待审核中,您如果想现在就去提交,请选择“是”;您如果还想继续选择其他卡片,请选择“否”。": return True else: return False #确认收货成功 def receipt_success(self): ''' 收货 value:确认收货、取消收货、全部收货 ''' self.receipt("确认收货") if self.get_message() == "收货成功": return True else: return False #取消收货成功 def cancel_receipt_success(self): ''' 取消收货 ''' self.receipt("取消收货") if self.get_message() == "取消收货成功": return True else: return False #全部收货成功 def all_receipt_success(self): ''' 全部收货 ''' self.receipt("全部收货") if self.get_message() == "收货成功": return True else: return False
def __init__(self, driver): BaseHandle.__init__(self, driver)
class PeizlPage(): def __init__(self, driver): self.handle = BaseHandle(driver) #切换iframe def switch_iframe(self): self.handle.switch_iframe("iframe", "iframe_peizgl") #获取提示信息 def __get_message(self): try: self.handle.switch_iframe() self.handle.wait_element('message', '审核成功') message_text = self.handle.get_element('message', '审核成功').text except: message_text = None return message_text #单位审核 @BaseHandle.functional_combination("单位资产管理员", "配置管理", "待审核", index=[1]) def peiz_ss(self, value): ''' 单位审核 value:退回、同意、不同意 ''' self.handle.click_element("配置管理", "审核") self.handle.switch_iframe() self.handle.switch_iframe("iframe", "iframe1") self.handle.click_element("通用", value) time.sleep(1) self.handle.click_element("配置管理", "保存") #单位审核成功 def peiz_ss_success(self, value): ''' 单位审核 value:退回、同意、不同意 ''' self.peiz_ss(value) if self.__get_message() == "审核成功!": return True else: return False
class chengzu(): def __init__(self, driver): self.handle = BaseHandle(driver) #切换iframe def switch_iframe(self): self.handle.switch_iframe("iframe", "iframe_chengzj") #获取提示 def __get_message(self): try: self.handle.switch_iframe() self.handle.wait_element('message', 'ty_message') message_text = self.handle.get_element('message', 'ty_message').text except: message_text = None return message_text #查看合同编号 def __get_hetbh(self): try: het_message = self.handle.get_elements( "通用", "输入框")[15].get_attribute('value') except: het_message = None return het_message #承租借 填写卡片资料 def __chengzj_card(self, het_value=111): time.sleep(1) self.handle.click_element("承租", "日期", 0) # 取得日期 self.handle.click_element("通用", "今天") self.handle.send_value("通用", "输入框", het_value, 15) # 合同编号 self.handle.click_element("承租", "日期", 3) # 合同签订日期 self.handle.click_element("通用", "今天") self.handle.send_value("通用", "输入框", "asd", 17) # 合同签订人 self.handle.click_element("承租", "日期", 4) # 租赁期限 self.handle.click_element("通用", "今天") self.handle.send_value("通用", "输入框", "1000", 20) # 押金 self.handle.send_value("通用", "输入框", "100000", 21) # 租金总额 self.handle.send_value("通用", "输入框", "10000", 22) # 每期租金 self.handle.send_value("通用", "输入框", "10", 23) # 缴纳期数 def __xvzu_card(self): #续租合同填写 self.handle.send_value("通用", "输入框", "1000") # 合同编号 self.handle.click_element("承租", "日期") # 合同签订日期 self.handle.click_element("通用", "今天") @BaseHandle.functional_combination("单位资产管理员", "承租 (借)", "待承租 (借)") def xinz(self): ''' 新增承租资产 ''' self.handle.click_element("承租", "增加承租(借)资产") self.handle.click_element("承租", "新增承租资产") self.handle.switch_iframe() self.handle.switch_iframe("iframe", "iframe1") self.handle.choice_first_class("pc服务器") self.handle.click_element("承租", "确定") time.sleep(2) self.handle.switch_iframe() self.handle.switch_iframe("iframe", "iframe2") self.__chengzj_card() self.handle.click_element("承租", "保存") @BaseHandle.functional_combination("单位资产管理员", "承租 (借)", "待承租 (借)", index=[1]) def jiaofu(self): ''' 交付完成 ''' self.handle.click_element("承租", "交付完成") time.sleep(1) self.handle.click_element("通用", "确定") time.sleep(1) self.handle.click_element("通用", "否") @BaseHandle.functional_combination("单位资产管理员", "承租 (借)", "承租 (借)中") def xvzu(self): ''' 续租 ''' self.handle.click_element("承租", "操作_申请续租") self.handle.switch_iframe("iframe", "iframe1") self.__xvzu_card() self.handle.switch_iframe() self.switch_iframe() self.handle.click_element("通用", "保存") time.sleep(1) self.handle.click_element("通用", "确定") @BaseHandle.functional_combination("单位资产管理员", "承租 (借)", "承租 (借)中") def tuih(self): ''' 退还 ''' self.handle.click_element("承租", "操作_退还") self.handle.click_element("通用", "确定") if self.__get_message() == "退还成功": return True else: return False @BaseHandle.functional_combination("单位资产管理员", "承租 (借)", "承租 (借)中", index=[1, 2]) def pilth(self): ''' 批量退还 ''' self.handle.click_element("承租", "批量退还") self.handle.click_element("通用", "确定") if self.__get_message() == "退还成功": return True else: return False @BaseHandle.functional_combination("单位资产管理员", "承租 (借)", "承租 (借)完成") def zaicxz(self): ''' 承借完成, 再次续租 ''' self.handle.click_element("承租", "操作_再次续租") self.handle.click_element("通用", "确定") time.sleep(1) self.handle.switch_iframe() self.handle.switch_iframe("iframe", "iframe1") self.__chengzj_card(het_value=222) self.handle.click_element("承租", "保存") time.sleep(1) def xvzu_success(self): ''' 续租成功 ''' self.xvzu() if self.__get_message() == "续租成功": return True else: return False def tuih_success(self): ''' 退还成功 ''' self.tuih() if self.__get_message() == "退还成功": return True else: return False def pilth_success(self): ''' 批量退还 ''' self.pilth() if self.__get_message() == "退还成功": return True else: return False def zaicxz_success(self): ''' 承借完成, 再次续租 ''' self.zaicxz() time.sleep(1) self.handle.switch_iframe() self.switch_iframe() self.handle.click_element("承租", "待承租 (借)") self.handle.switch_iframe() self.switch_iframe() self.handle.click_element("承租", "详细信息") self.handle.switch_iframe() self.handle.switch_iframe("iframe", "iframe2") if self.__get_hetbh() == "222": return True else: return False
class UserWeixPage(): def __init__(self, driver): self.handle = BaseHandle(driver) #切换iframe def switch_iframe(self): self.handle.switch_iframe("iframe", "iframe_weixgl") #获取信息 def get_message(self, value): try: self.handle.switch_iframe() self.handle.wait_element('message', value) message_text = self.handle.get_element('message', value).text except: message_text = None return message_text #勾选维修单审核 @BaseHandle.functional_combination("使用人", "我要报修", "待提交", index=[1]) def weix_ss(self, value): ''' 维修 value:删除申请、提交申请 ''' self.handle.click_element("我要报修", value) self.handle.click_element("通用", "确定") time.sleep(3) #选择当前页维修单审核 @BaseHandle.functional_combination("使用人", "我要报修", "待提交", index="选择当前页") def weix_dangq_ss(self, value): ''' 维修 value:删除申请、提交申请 ''' self.handle.click_element("我要报修", value) self.handle.click_element("通用", "确定") time.sleep(3) #业务操作-提交申请 #删除申请 @BaseHandle.functional_combination("使用人", "我要报修", "待提交") def weix_yewcz(self, value): ''' 维修-业务操作 value:操作_删除申请、操作_提交申请 ''' self.handle.click_element("我要报修", value, 0) self.handle.click_element("通用", "确定") time.sleep(3) #维修-添加资产 @BaseHandle.functional_combination("使用人", "我要报修", "待提交") def add_weix_assets(self, index): aa = self.handle.add_assets(index) return aa # 修改维修方式 @BaseHandle.functional_combination("使用人", "我要报修", "待提交") def change_mode(self, mode_value): ''' 修改维修方式 mode_value: 维修方式 ''' self.handle.click_element('维修管理', "维修方式", 1) self.handle.click_element('维修管理', mode_value) # 填维修原因 @BaseHandle.functional_combination("使用人", "我要报修", "待提交") def weix_reason(self, value): ''' 填维修原因 value: 原因 ''' self.handle.click_element('维修管理', "输入维修原因") self.handle.send_value('维修管理', "维修原因", value) self.handle.click_element('维修管理', "维修方式", 1) # 待提交页面搜索功能 #更多筛选 #翻页 #导出 #@BaseHandle.functional_combination("使用人", "我要报修", "待提交", index=[1]) def export_success(self): #self.handle.export() #获取导出文件信息 ex = ExcelUtil("C:\\Users\\sunH\\Downloads\\待提交_20191206.xls") value = ex.get_data() return value #打印 #删除维修单成功 def weix_sahnc_success(self): self.weix_ss("删除申请") if self.get_message("删除成功") == "删除成功": return True else: return False #业务操作删除维修单成功 def weix_yewcz_sahnc_success(self): self.weix_yewcz("操作_删除申请") if self.get_message("删除成功") == "删除成功": return True else: return False #选择当前页删除 def weix_dangqy_sahnc_success(self): self.weix_dangq_ss("删除申请") if self.get_message("删除成功") == "删除成功": return True else: return False #维修-添加资产成功 def add_assets_success(self): aa = self.add_weix_assets([1]) self.handle.switch_iframe() self.switch_iframe() time.sleep(2) bb = self.handle.get_level_element("通用", "data_info", "通用", "资产编号", 0).text if aa == bb[5:]: return True else: return False # 修改维修方式成功 def change_mode_success(self, mode_value): self.change_mode(mode_value) if self.get_message("修改成功") == "修改成功": return True else: return False # 填维修原因 def weix_reason_success(self, value): self.weix_reason(value) if self.get_message("修改成功") == "修改成功": return True else: return False #维修验收 @BaseHandle.functional_combination("使用人", "我要报修", "已审核") def weix_yans(self, key): ''' 维修验收 key:维修费用 ''' self.handle.click_element("维修管理", "维修验收") time.sleep(2) self.handle.click_element("维修管理", "选择维修商", 1) time.sleep(2) self.handle.click_element("维修管理", "勾选维修商") self.handle.click_element("维修管理", "选择维修商确定") self.handle.send_value("通用", "输入框", key, 2) self.handle.click_element("通用", "确定")
class ShouyiPage(): def __init__(self, driver): self.handle = BaseHandle(driver) #切换iframe def switch_iframe(self): self.handle.switch_iframe("iframe", "iframe_shouygl") @BaseHandle.functional_combination("财务制单人员", "收益管理", index=[1]) def shouy_dengz(self): ''' 收益登账 ''' self.handle.click_element("通用", "登账") self.handle.click_element("财务_收益管理", "财务入账日期") self.handle.click_element("财务_收益管理", "今天") self.handle.send_value("财务_收益管理", "会计凭证号", 1000) self.handle.click_element("财务_收益管理", "登账") time.sleep(3) @BaseHandle.functional_combination("财务制单人员", "收益管理") def shouy_dengz_success(self): sbdh = self.handle.get_elements("财务_收益管理", "申报单号")[0].text self.shouy_dengz() try: new_sbdh = self.handle.get_elements("财务_收益管理", "申报单号")[0].text if new_sbdh != sbdh: return True else: return False except: return True
class ZicpdBusiness(): def __init__(self, driver): self.handle = BaseHandle(driver) #切换iframe def __switch_iframe(self): self.handle.switch_iframe("iframe", "iframe_pand") #新增任务----------->新盘点 def add_task(self): today = datetime.date.today() oneday = datetime.timedelta(days=1) yesterday = today - oneday tomorrow = today + oneday self.handle.switch_users("单位资产管理员") self.handle.click_first_class_menu("资产盘点") self.__switch_iframe() self.handle.click_element("资产盘点", "新增") self.handle.send_value("资产盘点", "任务信息", "test1", 0) self.handle.caledar("资产盘点", "任务信息", str(yesterday), 2) self.handle.click_element("资产盘点", "任务信息", 2) self.handle.caledar("资产盘点", "任务信息", str(today), 3) self.handle.click_element("资产盘点", "任务信息", 3) self.handle.caledar("资产盘点", "任务信息", str(tomorrow), 4) self.handle.click_element("资产盘点", "任务信息", 4) self.handle.click_element("通用", "保存") time.sleep(0.5) self.handle.click_element("资产盘点", "发起", 0) time.sleep(0.5) self.handle.click_element("通用", "确定") time.sleep(0.5) if self.handle.get_element("资产盘点", "状态")[0].text == "已发起": return True else: return False #设置盘点信息----------->老盘点 def set_date(self): self.handle.switch_users("单位资产管理员") self.handle.click_first_class_menu("资产盘点") self.switch_iframe_zicpd() self.handle.click_element("资产盘点", "设置盘点信息") time.sleep(0.5) self.handle.click_element("通用", "确定") def dish_one(self): self.handle.switch_users("单位资产管理员") self.handle.click_first_class_menu("资产盘点") self.switch_iframe_zicpd() self.handle.click_element("资产盘点", "未盘资产") self.handle.check_card() self.handle.click_element("资产盘点", "盘一下") self.handle.click_element("通用", "确定") def del_date(self): self.handle.switch_users("单位资产管理员") self.handle.click_first_class_menu("资产盘点") self.switch_iframe_zicpd() self.handle.click_element("资产盘点", "设置盘点信息") time.sleep(0.5) while self.handle.get_element("资产盘点", "删除") is not None: time.sleep(0.5) self.handle.click_element("资产盘点", "删除", 0) time.sleep(0.5) self.handle.click_element("资产盘点", "确定") time.sleep(0.5) self.handle.click_element("通用", "是") time.sleep(0.5)
class UserZhuanyPage(): def __init__(self, driver): self.handle = BaseHandle(driver) #切换iframe def switch_iframe(self): self.handle.switch_iframe("iframe", "iframe_zhuany") #转移 @BaseHandle.functional_combination("使用人", "资产转移", index=[1]) def zhuany(self, value): ''' 转移 value:使用人、部门 ''' self.handle.click_element("资产转移", "办理业务") time.sleep(0.5) self.handle.click_element("资产转移", "添加接收方", 0) time.sleep(0.5) if value == "使用人": self.handle.click_element("资产转移", "勾选添加接收方") self.handle.click_element("通用", "确定") time.sleep(0.5) self.handle.click_element("通用", "勾选卡片", 0) self.handle.click_element("资产转移", "办理业务") self.handle.click_element("资产转移", "转移", 0) time.sleep(1) self.handle.click_element("通用", "确定")
class HexzcPage(): def __init__(self, driver): self.handle = BaseHandle(driver) #切换iframe def switch_iframe(self): self.handle.switch_iframe("iframe", "iframe_hexzc") @BaseHandle.functional_combination("财务制单人员", "核销资产", index=[1]) def hex_dengz(self): ''' 核销登账 ''' self.handle.click_element("财务_核销资产", "登账") self.handle.click_element("财务_核销资产", "财务入账日期") self.handle.click_element("通用", "今天") self.handle.send_value("通用", "输入框", 1000, 1) self.handle.click_element("通用", "确定") time.sleep(1) def hex_dengz_success(self): ''' 核销登账 ''' sbdh = self.handle.get_elements("财务_核销资产", "申报单号")[0].text self.hex_dengz() try: new_sbdh = self.handle.get_elements("财务_核销资产", "申报单号")[0].text if new_sbdh != sbdh: return True else: return False except: return True
class make_date(): def __init__(self, driver): self.handle = BaseHandle(driver) self.unit_chengzu = unit_chengzu_page.chengzu(driver) self.unit_chuzu = unit_chuzu_page.ChuzPage(driver) self.unit_dengz = unit_dengzgl_page.DengzglPage(driver) self.unit_touz = unit_duiwtz_page.DuiwtzPage(driver) self.unit_peiz = unit_peiz_page.PeizlPage(driver) self.unit_shouy = unit_shouy_page.ShouyPage(driver) self.unit_weix = unit_weixgl_page.WeixglPage(driver) self.unit_yans = unit_yansgl_page.YansglPage(driver) self.unit_chuz = unit_ziccz_page.ZicczPage(driver) self.unit_fenp = unit_zicfp_page.ZicfpPage(driver) self.unit_shouh = unit_zicsh_page.ZicshPage(driver) self.unit_zhuany = unit_ziczy_page.ZiczyPage(driver) self.unit_shouygl = unit_shouygl_page.ShouyglPage(driver) self.fin_hex = fin_hexzc_page.HexzcPage(driver) self.fin_shouy = fin_shouy_page.ShouyiPage(driver) self.fin_weix = fin_weix_page.FinWeixPage(driver) self.fin_dengz = fin_xinzzc_page.XinzzcPage(driver) self.dep_guih = dep_guih_page.DepGuihPage(driver) self.dep_peiz = dep_peiz_page.DepPeizlPage(driver) self.dep_shouy = dep_shouy_page.DepShouyPage(driver) self.dep_weix = dep_weixgl_page.DepWeixglPage(driver) self.dep_yans = dep_yansgl_page.DepYansglPage(driver) self.dep_ziccz = dep_ziccz_page.DepZicczPage(driver) self.dep_fenp = dep_zicfp_page.DepZicfpPage(driver) self.dep_shouh = dep_zicsh_page.DepZicshPage(driver) self.dep_zhuany = dep_ziczy_page.DepZiczyPage(driver) self.user_chuz = user_chuz_page.UserZicczPage(driver) self.user_guih = user_guih_page.UserGuihPage(driver) self.user_shenl = user_shenl_page.UserShenllPage(driver) self.user_shouy = user_shouy_page.UserShouyPage(driver) self.user_zhuany = user_zhuany_page.UserZhuanyPage(driver) self.user_weix = user_weix_page.UserWeixPage(driver) self.user_yans = user_yans_page.UserYansPage(driver) def unit_suoyzc_wdengz(self, value="1000", card_value='pc服务器'): ''' 单位资产管理员验收未登账卡片 ''' self.unit_yans.add_card(value, card_value) self.unit_yans.start_acceptance() self.unit_yans.yansgl_pass() def unit_suoyzc_dengz(self, value="1000", card_value='pc服务器'): ''' 单位资产管理员验收登账卡片 ''' self.unit_suoyzc_wdengz(value, card_value) self.unit_dengz.songcw() self.fin_dengz.dengz() def unit_peiz_01(self): ''' 新增配置管理--待审核数据 ''' self.dep_peiz.peiz_tj() self.refresh_f5() self.dep_peiz.peiz_ss("送审") def unit_peiz_02(self, value="同意"): ''' 新增配置管理--已审核数据 value:默认同意 ''' self.unit_peiz_01() self.unit_peiz.peiz_ss(value) def unit_yans_01(self): ''' 新增验管理--待验收数据 ''' self.unit_yans.add_card("1000", card_value="pc服务器") def unit_yans_02(self): ''' 新增验管理--验收中数据 ''' self.unit_yans_01() self.unit_yans.start_acceptance() def unit_yans_03(self): ''' 新增验管理--验收完成数据 ''' self.unit_yans_02() self.unit_yans.yansgl_pass() def unit_dengz_01(self): ''' 新增登账管理--待登账数据 ''' self.unit_yans_03() def unit_dengz_02(self, value=None): ''' 新增登账管理--登账中数据 默认无发票号 ''' self.unit_dengz_01() self.unit_dengz.songcw(value) def unit_dengz_03(self, value=None): ''' 新增登账管理--登账完成数据 默认无发票号 ''' self.unit_dengz_02(value) self.fin_dengz.dengz() self.handle.refresh_f5() def unit_fenp_01(self): ''' 单位资产管理员新增资产分配--待分配 ''' self.unit_yans_03() def unit_fenp_02(self): ''' 单位资产管理员新增资产分配--分配中 ''' self.unit_fenp_01() self.unit_fenp.fenp("部门") def unit_fenp_03(self): ''' 单位资产管理员新增资产分配--分配完成 ''' self.unit_fenp_02() self.unit_shouy.receipt("确认收货") def unit_shouhui_01(self): ''' 新增资产收回--待收回 ''' self.unit_fenp_03() def unit_shouhui_02(self): ''' 新增资产收回--收回完成 ''' self.unit_shouhui_01() self.unit_shouh.take_back() def unit_zhuany_01(self): ''' 新增资产转移--待转移 ''' self.unit_yans_03() self.unit_shouy.apply_business("申请转移") def unit_zhuany_02(self): ''' 新增资产转移--转移中 ''' self.unit_zhuany_01() self.unit_zhuany.zhuany("部门") def unit_zhuany_03(self): ''' 新增资产转移--转移中 ''' self.unit_zhuany_02() self.unit_shouy.receipt("确认收货") def unit_weix_01(self): ''' 新增维修管理--待审核 ''' self.unit_dengz_03() self.unit_shouy.apply_business("申请报修") def unit_weix_02(self): ''' 新增维修管理--已审核 ''' self.unit_weix_01() self.unit_weix.weix_ss("同意") def unit_weix_03(self): ''' 新增维修管理--维修完成 ''' self.unit_weix_02() self.unit_weix.weix_yans(1000) def unit_chuz_01(self): ''' 新增资产处置--待审核 ''' self.unit_dengz_03() self.unit_shouy.apply_business("申请处置") def unit_chuz_02(self): ''' 新增资产处置--待审核 ''' self.unit_chuz_01() self.unit_chuz.chuz_shengcczd() def unit_chuz_03(self): ''' 新增资产处置--已审核 ''' self.unit_chuz_02() self.unit_chuz.chuz_songs() def unit_chuz_04(self): ''' 新增资产处置--执行中 ''' self.unit_chuz_03() self.unit_chuz.chuz_zhix() def unit_chuz_05(self): ''' 新增资产处置--完成 ''' self.unit_chuz_04() self.unit_chuz.chuz_chuzhi() def unit_chuzu_01(self): ''' 新增资产出租--待审核 ''' self.unit_dengz_03() self.unit_shouy.apply_business("申请出租") def unit_chuzu_02(self): ''' 新增资产出租--待送审 ''' self.unit_chuzu_01() self.unit_chuzu.chuzu_scdj() def unit_chuzu_03(self): ''' 新增资产出租-审批中 ''' self.unit_chuzu_02() self.unit_chuzu.chuzu_ss() def unit_chuzu_04(self): ''' 新增资产出租-已审批 ''' self.unit_chuzu_03() self.unit_chuzu.chuzu_tg() def unit_chuzu_05(self): ''' 新增资产出租-出租(借)中 ''' self.unit_chuzu_04() self.unit_chuzu.chuzu_zhix() def unit_chuzu_06(self): ''' 新增资产出租-租(借)收回 ''' self.unit_chuzu_05() self.unit_chuzu.chuzu_shouh() def unit_chengzu_01(self): ''' 新增承租借-待承租借 ''' self.unit_chengzu.xinz() def unit_chengzu_02(self): ''' 新增承租借-承租借中 ''' self.unit_chengzu_01() self.unit_chengzu.jiaofu() def unit_chengzu_03(self): ''' 新增承租借-承租借完成 ''' self.unit_chengzu_02() self.unit_chengzu.tuih() def unit_shouy_01(self): ''' 新增收益管理--待登账 出租收益 ''' self.unit_chuzu_06() self.unit_chuzu.chuzu_shouyi("暂存") def unit_shouy_02(self): ''' 新增收益管理--登账中 ''' self.unit_shouy_01() self.refresh_f5() self.unit_shouygl.shouy_ss() def unit_shouy_03(self): ''' 新增收益管理--已登账 ''' self.unit_shouy_02() self.fin_shouy.shouy_dengz() def user_suoyzc_wdengz(self): ''' 使用人所有资产界面添加未登账卡片 ''' self.unit_suoyzc_wdengz() self.unit_fenp.fenp("使用人") self.user_shouy.receipt("确认收货") def user_suoyzc_dengz(self, value=None, card_value=None): ''' 使用人所有资产界面添加登账卡片 ''' self.unit_suoyzc_dengz(value, card_value) self.unit_fenp.fenp("使用人") self.user_shouy.receipt("确认收货") def user_shenl_01(self): ''' 使用人我要申领--待提交界面添加数据 ''' self.user_shenl.shenl_xinz(card_value="pc服务器") def user_shenl_02(self): ''' 使用人我要申领--审核中界面添加数据 ''' self.user_shenl_01() self.user_shenl.shenl_tj() def user_shenl_03(self): ''' 使用人我要申领--已审核界面添加数据 ''' self.user_shenl_02() self.dep_peiz.peiz_ss("同意") def user_baox_01(self): ''' 使用人我要报修--待提交界面添加数据 ''' self.user_suoyzc_dengz() self.user_shouy.apply_business("申请报修") def user_baox_02(self): ''' 使用人我要报修--审核中界面添加数据 ''' self.user_baox_01() self.user_weix.weix_ss("提交申请") def user_baox_03(self): ''' 使用人我要报修--已审核界面添加数据 ''' self.user_baox_02() self.dep_weix.weix_ss("同意") def user_baox_04(self): ''' 使用人我要报修--维修完成界面添加数据 ''' self.user_baox_03() self.dep_weix.weix_yans(1000) def user_guih_01(self): ''' 使用人资产归还---待归还界面添加数据 ''' self.user_suoyzc_dengz() self.user_shouy.apply_business("申请归还") def user_guih_02(self): ''' 使用人资产归还---归还中界面添加数据 ''' self.user_guih_01() self.user_guih.guih_pass() def user_guih_03(self): ''' 使用人资产归还--归还完成界面添加数据 ''' self.user_guih_02() self.dep_shouy.receipt("确认收货") def user_zhuany_01(self): ''' 使用人资产转移--待转移界面添加数据 ''' self.user_suoyzc_wdengz() self.user_shouy.apply_business("申请转移") def user_zhuany_02(self): ''' 使用人资产转移--转移中界面添加数据 ''' self.user_zhuany_01() self.user_zhuany.zhuany("部门") def user_zhuany_03(self): ''' 使用人资产转移--转移完成界面添加数据 ''' self.user_zhuany_02() self.dep_shouy.receipt("确认收货") def user_chuz_01(self): ''' 使用人我要处置--待提交界面添加数据 ''' self.user_suoyzc_dengz() self.user_shouy.apply_business("申请处置") def user_chuz_02(self): ''' 使用人我要处置--审核中界面添加数据 ''' self.user_chuz_01() self.user_chuz.chuz_ss("提交申请") def user_chuz_03(self): ''' 使用人我要处置--已审核界面添加数据 ''' self.user_chuz_02() self.dep_ziccz.chuz_ss("同意") def user_yans_01(self): ''' 使用人我要处置--已审核界面添加数据 ''' self.dep_yans.add_card(card_value="pc服务器") self.dep_yans.start_acceptance("添加验收人") def user_yans_02(self): ''' 使用人我要处置--已审核界面添加数据 ''' self.user_yans_01() self.user_yans.yans_tj() def dep_suoyzc_wdengz(self): ''' 部门资产管理员所有资产界面添加未登账卡片 ''' self.dep_yans.add_card(card_value="pc服务器") def dep_suoyzc_dengz(self, value=None, card_value=None): ''' 部门资产管理员所有资产界面添加登账卡片 ''' self.unit_suoyzc_dengz(value, card_value) self.handle.refresh_f5() self.unit_fenp.fenp("部门") self.dep_shouy.receipt("确认收货") def dep_peiz_01(self): ''' 部门资产管理员配置管理--待审核页面添加数据 ''' self.user_shenl_03() def dep_peiz_02(self): ''' 部门资产管理员配置管理--审核中页面添加数据 ''' self.dep_peiz_01() self.dep_peiz.peiz_ss("送审") def dep_peiz_03(self): ''' 部门资产管理员配置管理--已审核页面添加数据 ''' self.dep_peiz_02() self.unit_peiz.peiz_ss("同意") def dep_yans_01(self): ''' 部门资产管理员验收资产--待验收页面添加数据 ''' self.dep_yans.add_card(card_value="pc服务器") def dep_yans_02(self): ''' 部门资产管理员验收资产--验收中页面添加数据 ''' self.dep_yans_01() self.dep_yans.start_acceptance() def dep_yans_03(self): ''' 部门资产管理员验收资产--验收完成页面添加数据 ''' self.dep_yans_02() self.dep_yans.yansgl_pass() def dep_fenp_01(self, value="未登账"): ''' 部门资产管理员资产分配--待分配页面添加数据 value: 登账,未登账 ''' if value == "登账": self.dep_suoyzc_dengz() else: self.dep_suoyzc_wdengz() def dep_fenp_02(self): ''' 部门资产管理员资产分配--分配中页面添加数据 ''' self.dep_fenp_01() self.handle.refresh_f5() self.dep_fenp.fenp("使用人") def dep_fenp_03(self): ''' 部门资产管理员资产分配--分配完成页面添加数据 ''' self.dep_fenp_02() self.user_shouy.receipt("确认收货") def dep_guih_01(self): ''' 部门资产管理员资产归还--待归还页面添加数据 ''' self.unit_fenp_03() def dep_guih_02(self): ''' 部门资产管理员资产归还--归还中页面添加数据 ''' self.dep_guih_01() self.dep_guih.guih_pass() def dep_guih_03(self): ''' 部门资产管理员资产归还--归还完成页面添加数据 ''' self.dep_guih_02() self.unit_shouy.receipt("确认收货") def dep_shouh_01(self): ''' 部门资产管理员资产收回--待收回页面添加数据 ''' self.dep_fenp_03() def dep_shouh_02(self): ''' 部门资产管理员资产收回--收回完成页面添加数据 ''' self.dep_shouh_01() self.dep_shouh.take_back() def dep_zhuany_01(self): ''' 部门资产管理员资产转移--待转移页面添加数据 ''' self.dep_suoyzc_wdengz() self.dep_shouy.apply_business("申请转移") def dep_zhuany_02(self): ''' 部门资产管理员资产转移--转移中页面添加数据 ''' self.dep_zhuany_01() self.dep_zhuany.zhuany("使用人") def dep_zhuany_03(self): ''' 部门资产管理员资产转移--转移完成页面添加数据 ''' self.dep_zhuany_02() self.user_shouy.receipt("确认收货") def dep_weix_01(self): ''' 部门资产管理员维修管理--待审核页面添加数据 ''' self.dep_suoyzc_dengz() self.dep_shouy.apply_business("申请报修") def dep_weix_02(self): ''' 部门资产管理员维修管理--审核中页面添加数据 ''' self.dep_weix_01() self.handle.refresh_f5() self.dep_weix.weix_ss("送审") def dep_weix_03(self): ''' 部门资产管理员维修管理--已审核页面添加数据 ''' self.dep_weix_01() self.handle.refresh_f5() self.dep_weix.weix_ss("同意") def dep_weix_04(self): ''' 部门资产管理员维修管理--维修完成页面添加数据 ''' self.dep_weix_03() self.handle.refresh_f5() self.dep_weix.weix_yans(1000) def dep_chuz_01(self): ''' 部门资产管理员资产处置--待审核页面添加数据 ''' self.dep_suoyzc_dengz() self.dep_shouy.apply_business("申请处置") def dep_chuz_02(self): ''' 部门资产管理员资产处置--审核中页面添加数据 ''' self.dep_chuz_01() self.handle.refresh_f5() self.dep_ziccz.chuz_ss("送审") def dep_chuz_03(self): ''' 部门资产管理员资产处置--已审核页面添加数据 ''' self.dep_chuz_02() self.unit_chuz.chuz_shengcczd() self.unit_chuz.chuz_songs() def fin_suoyzc_wdengz(self): ''' 财务制单人员所有资产界面新增未登账卡片 ''' self.unit_suoyzc_wdengz() def fin_suoyzc_dengz(self): ''' 财务制单人员所有资产界面新增登账卡片 ''' self.unit_suoyzc_dengz() def fin_xinz_01(self): ''' 财务制单人员新增资产--待登账 ''' self.unit_dengz_02() def fin_xinz_02(self): ''' 财务制单人员新增资产--已登账 ''' self.unit_dengz_03() def fin_hex_01(self): ''' 财务制单人员核销资产--待登账 ''' self.unit_chuz_03() def fin_hex_02(self): ''' 财务制单人员核销资产--已登账 ''' self.fin_hex_01() self.fin_hex.hex_dengz() def fin_weix_01(self): ''' 财务制单人员资产维修--待登账 ''' self.unit_weix_03() def fin_weix_02(self, value): ''' 财务制单人员资产维修--已登账 维修费用化登账 value:资本化 or 费用化 ''' self.fin_weix_01() self.fin_weix.weix_dengz(value) def fin_shouyi_01(self, value): ''' 财务制单人员收益管理--待登账 value:处置、出租 ''' if value == "处置": self.unit_chuz_05() elif value == "出租": self.unit_chuzu_05() self.unit_chuzu.chuzu_shouyi("送财务部门") def fin_shouyi_02(self, value): ''' 财务制单人员收益管理--已登账 value:处置、出租 ''' self.fin_shouyi_01(value) if value == "处置": self.fin_hex.hex_dengz() # 处置先核销 self.fin_shouy.shouy_dengz() def make_init_card(self): # 未登帐,更正中、维修中、转移中、分配中、处置中、租借中、投资中、承租借卡片 self.unit_suoyzc_wdengz() self.unit_weix_01() self.unit.dep_zhuany_01() self.unit_fenp_01() self.unit_chuz_01() self.unit_chuzu_01() self.unit_chengzu_01()
def __init__(self, driver): self.handle = BaseHandle(driver)
class FinWeixPage(): def __init__(self, driver): self.handle = BaseHandle(driver) #切换iframe def switch_iframe(self): self.handle.switch_iframe("iframe", "iframe_weixgl") #获取提示信息 def __get_message(self): try: self.handle.switch_iframe() self.handle.wait_element('message', 'message') message_text = self.handle.get_element('message', 'message').text except: message_text = None return message_text @BaseHandle.functional_combination("财务制单人员", "资产修理", index=[1]) def weix_dengz(self, value): ''' 维修费用化登账 value:资本化 or 费用化 ''' self.handle.click_element("通用", "登账") self.handle.click_element("财务_资产修理", value) time.sleep(1) self.handle.click_element("财务_资产修理", "财务入账日期", 0) time.sleep(1) self.handle.click_element("通用", "今天") self.handle.send_value("通用", "输入框", 1000, 3) jiaz = self.handle.get_element("财务_资产修理", "价值").text self.handle.send_value("通用", "输入框", jiaz, 4) # 财政补助收入 if value == "资本化": self.handle.send_value("通用", "输入框", 10, 7) # 重新设置剩余折旧年限 time.sleep(1) self.handle.click_element("财务_资产修理", "登账", 1) def weix_dengz_success(self, value): ''' 维修费用化登账 value:资本化 or 费用化 ''' self.weix_dengz(value) if value == "费用化" and self.__get_message() == "费用化登账成功": return True elif value == "资本化" and self.__get_message() == "资本化登账成功": return True else: return False