def Baidu_search(self, pv_1=None): input = 'RPA' #网站 self.__logger.dlogs( job_no=self.job_no, logmsg= 'Flow:Baidu_search,StepNodeTag:2020091702300252617,Title:网站,Note:') iie.open_url( ie_path='C:/Program Files (x86)/Internet Explorer/iexplore.exe', url='www.baidu.com') #鼠标点击 self.__logger.dlogs( job_no=self.job_no, logmsg= 'Flow:Baidu_search,StepNodeTag:2020091702303042024,Title:鼠标点击,Note:' ) iie.do_click_pos(waitfor=10.000, run_mode='unctrl', button='left', curson='center', continue_on_error='break', win_title=r'百度一下,你就知道 - Internet Explorer', selector=r'#kw', url=r'https://www.baidu.com/') #模拟按键 self.__logger.dlogs( job_no=self.job_no, logmsg= 'Flow:Baidu_search,StepNodeTag:2020091702310358326,Title:模拟按键,Note:' ) ikeyboard.key_send_cs(waitfor=10.000, text='{LShift}') #模拟按键 self.__logger.dlogs( job_no=self.job_no, logmsg= 'Flow:Baidu_search,StepNodeTag:2020091702315568728,Title:模拟按键,Note:' ) ikeyboard.key_send_cs(waitfor=10.000, text=input) #鼠标点击 self.__logger.dlogs( job_no=self.job_no, logmsg= 'Flow:Baidu_search,StepNodeTag:2020091702332197730,Title:鼠标点击,Note:' ) iie.do_click_pos(waitfor=10.000, run_mode='unctrl', button='left', curson='center', continue_on_error='break', win_title=r'百度一下,你就知道 - Internet Explorer', selector=r'#su', url=r'https://www.baidu.com/')
def login(self): #热键输入 self.__logger.dlogs(job_no=self.job_no,logmsg='Flow:login,StepNodeTag:2020102716440633945,Title:热键输入,Note:') ikeyboard.key_send_cs(waitfor=10.000,text=r'#d') #鼠标双击 self.__logger.dlogs(job_no=self.job_no,logmsg='Flow:login,StepNodeTag:2020102716440633944,Title:鼠标双击,Note:') iimg.do_click_pos(waitfor=30.000,button='left',curson='Center',times=2,image=r'snapshot_20201029103253721.png',image_size=r'38X29',img_res_path = self.path) #鼠标点击 self.__logger.dlogs(job_no=self.job_no,logmsg='Flow:login,StepNodeTag:2020102716440633942,Title:鼠标点击,Note:') iimg.do_click_pos(waitfor=30.000,button='left',curson='Center',image=r'snapshot_20201027163736752.png',image_size=r'272X15',win_title=r'金蝶EAS系统登录',continue_on_error='break',img_res_path = self.path) #模拟按键 self.__logger.dlogs(job_no=self.job_no,logmsg='Flow:login,StepNodeTag:2020102716440633941,Title:模拟按键,Note:') ikeyboard.key_send_cs(waitfor=10.000,text="123456") #鼠标点击 self.__logger.dlogs(job_no=self.job_no,logmsg='Flow:login,StepNodeTag:2020102716440633943,Title:鼠标点击,Note:') iimg.do_click_pos(waitfor=30.000,button='left',curson='Center',image=r'snapshot_20201027164204785.png',image_size=r'76X18',win_title=r'金蝶EAS系统登录',continue_on_error='break',img_res_path = self.path)
def flow1(self): #鼠标点击 self.__logger.dlogs(job_no=self.job_no,logmsg='Flow:flow1,StepNodeTag:2020102811431669279,Title:鼠标点击,Note:') iimg.do_click_pos(waitfor=30.000,button='left',curson='Center',offsetX=100,times=2,image=r'snapshot_20201029102745076.png',image_size=r'107X19',win_title=r'银行日记账-条件查询',continue_on_error='break',img_res_path = self.path) #模拟按键 self.__logger.dlogs(job_no=self.job_no,logmsg='Flow:flow1,StepNodeTag:2020102811443953682,Title:模拟按键,Note:') time.sleep(0.3) ikeyboard.key_send_cs(waitfor=10.000,text='2016') time.sleep(0.3) #鼠标点击 self.__logger.dlogs(job_no=self.job_no,logmsg='Flow:flow1,StepNodeTag:20201029104525554947,Title:鼠标点击,Note:') iimg.do_click_pos(waitfor=30.000,button='left',curson='Center',offsetX=240,times=2,image=r'snapshot_20201029102745076.png',image_size=r'107X19',win_title=r'银行日记账-条件查询',continue_on_error='break',img_res_path = self.path) #模拟按键 self.__logger.dlogs(job_no=self.job_no,logmsg='Flow:flow1,StepNodeTag:20201029104628537954,Title:模拟按键,Note:') ikeyboard.key_send_cs(waitfor=10.000,text=11) #鼠标点击 self.__logger.dlogs(job_no=self.job_no,logmsg='Flow:flow1,StepNodeTag:20201029103034188926,Title:鼠标点击,Note:') iimg.do_click_pos(waitfor=30.000,button='left',curson='Center',offsetX=100,times=2,image=r'snapshot_20201029103053436.png',image_size=r'94X18',win_title=r'银行日记账-条件查询',continue_on_error='break',img_res_path = self.path) time.sleep(0.3) #模拟按键 self.__logger.dlogs(job_no=self.job_no,logmsg='Flow:flow1,StepNodeTag:20201029102936035924,Title:模拟按键,Note:') time.sleep(0.3) ikeyboard.key_send_cs(waitfor=10.000,text='2017') time.sleep(0.3) #鼠标点击 self.__logger.dlogs(job_no=self.job_no,logmsg='Flow:flow1,StepNodeTag:20201029104712257957,Title:鼠标点击,Note:') iimg.do_click_pos(waitfor=30.000,button='left',curson='Center',offsetX=240,times=2,image=r'snapshot_20201029103053436.png',image_size=r'94X18',win_title=r'银行日记账-条件查询',continue_on_error='break',img_res_path = self.path) time.sleep(0.3) #模拟按键 self.__logger.dlogs(job_no=self.job_no,logmsg='Flow:flow1,StepNodeTag:20201029104741631965,Title:模拟按键,Note:') ikeyboard.key_send_cs(waitfor=10.000,text='11') #鼠标点击 self.__logger.dlogs(job_no=self.job_no,logmsg='Flow:flow1,StepNodeTag:2020102811454933884,Title:鼠标点击,Note:') iimg.do_click_pos(waitfor=30.000,button='left',curson='Center',image=r'snapshot_20201028114606050.png',image_size=r'79X24',win_title=r'银行日记账-条件查询',continue_on_error='break',img_res_path = self.path) #鼠标点击 self.__logger.dlogs(job_no=self.job_no,logmsg='Flow:flow1,StepNodeTag:20201028133001493128,Title:鼠标点击,Note:') iimg.do_click_pos(waitfor=30.000,button='left',curson='Center',image=r'snapshot_20201028133026462.png',image_size=r'73X91',win_title=r'金蝶EAS-IT_Test',continue_on_error='break',img_res_path = self.path) #模拟按键 self.__logger.dlogs(job_no=self.job_no,logmsg='Flow:flow1,StepNodeTag:20201028133117833130,Title:模拟按键,Note:') ikeyboard.key_send_cs(waitfor=10.000,text='1102{Enter}{Enter}') #图片检测 self.__logger.dlogs(job_no=self.job_no,logmsg='Flow:flow1,StepNodeTag:20201029092629318884,Title:图片检测,Note:') tvar_20201029092629318885=iimg.img_exists(waitfor=30.000,win_title=r'金蝶EAS-IT_Test',image=r'snapshot_20201029092535882.png',img_res_path = self.path) print('[flow1] [图片检测] [20201029092629318884] 返回值:[' + str(type(tvar_20201029092629318885)) + ']' + str(tvar_20201029092629318885)) #鼠标点击 self.__logger.dlogs(job_no=self.job_no,logmsg='Flow:flow1,StepNodeTag:2020102813020652490,Title:鼠标点击,Note:') iimg.do_click_pos(waitfor=30.000,button='left',curson='Center',image=r'snapshot_20201029091730871.png',image_size=r'79X23',win_title=r'金蝶EAS-IT_Test',continue_on_error='break',img_res_path = self.path)
def approval(self): # 鼠标点击 self.__logger.debug('Flow:approval,StepNodeTag:14160829843157,Note:') iie.do_click_pos(win_title=r'合同管理系统 - Internet Explorer', url=r'http://localhost/grwl/Main.aspx', selector=r'#TreeView1n1 > IMG:nth-of-type(1)', button=r'left', curson=r'center', times=1, run_mode=r'unctrl', waitfor=10, scroll_view='no') # 鼠标点击 self.__logger.debug('Flow:approval,StepNodeTag:14160906410160,Note:') time.sleep(0.5) iie.do_click_pos(win_title=r'合同管理系统 - Internet Explorer', url=r'http://localhost/grwl/Main.aspx', selector=r'#TreeView1t3', button=r'left', curson=r'center', times=1, run_mode=r'unctrl', waitfor=10, scroll_view='no') # 鼠标点击 self.__logger.debug('Flow:approval,StepNodeTag:14161050177162,Note:') time.sleep(0.5) iie.do_click_pos(win_title=r'合同管理系统 - Internet Explorer', title=r'合同发起', selector=r'#btnAdd', button=r'left', curson=r'center', times=1, run_mode=r'unctrl', waitfor=10, scroll_view='no') # 鼠标点击 self.__logger.debug('Flow:approval,StepNodeTag:14161213450164,Note:') iie.do_click_pos(win_title=r'合同管理系统 - Internet Explorer', title=r'合同发起', selector=r'#searchcn10291', button=r'left', curson=r'center', times=1, run_mode=r'unctrl', waitfor=10, scroll_view='no') # 键盘输入 self.__logger.debug('Flow:approval,StepNodeTag:14161908967175,Note:') time.sleep(0.5) ikeyboard.key_send_cs(text='{DOWN}{ENTER}', waitfor=10) # 鼠标点击 self.__logger.debug('Flow:approval,StepNodeTag:14162054646178,Note:') iie.do_click_pos(win_title=r'合同管理系统 - Internet Explorer', title=r'合同发起', selector=r'#searchcn10270', button=r'left', curson=r'center', times=1, run_mode=r'unctrl', waitfor=10, scroll_view='no') # 键盘输入 self.__logger.debug('Flow:approval,StepNodeTag:14162054646177,Note:') time.sleep(0.5) ikeyboard.key_send_cs(text='{DOWN}{ENTER}', waitfor=10) # 键盘输入 self.__logger.debug('Flow:approval,StepNodeTag:14162214581185,Note:') time.sleep(0.5) ikeyboard.key_send_cs(text='20191114_test_1{RSHIFT}', waitfor=10) # 鼠标点击 self.__logger.debug('Flow:approval,StepNodeTag:14162330489186,Note:') iie.do_click_pos(win_title=r'合同管理系统 - Internet Explorer', title=r'合同发起', selector=r'#searchcn10273', button=r'left', curson=r'center', times=1, run_mode=r'unctrl', waitfor=10, scroll_view='no') # 键盘输入 self.__logger.debug('Flow:approval,StepNodeTag:14162330489187,Note:') time.sleep(0.5) ikeyboard.key_send_cs(text='{DOWN}{ENTER}', waitfor=10) # 鼠标点击 self.__logger.debug('Flow:approval,StepNodeTag:14162354762195,Note:') iie.do_click_pos(win_title=r'合同管理系统 - Internet Explorer', title=r'合同发起', selector=r'#searchcn10274img', button=r'left', curson=r'center', times=1, run_mode=r'unctrl', waitfor=10, scroll_view='no') # 鼠标点击 self.__logger.debug('Flow:approval,StepNodeTag:14162436852202,Note:') iie.do_click_pos(win_title=r'合同管理系统 - Internet Explorer', title=r'请选择', selector=r'#xgvData_DXDataRow0 > TD:nth-of-type(1)', button=r'left', curson=r'center', times=1, run_mode=r'unctrl', waitfor=10, scroll_view='no') # 鼠标点击 self.__logger.debug('Flow:approval,StepNodeTag:14162447299204,Note:') iie.do_click_pos(win_title=r'合同管理系统 - Internet Explorer', title=r'请选择', selector=r'#btnSearchSelect', button=r'left', curson=r'center', times=1, run_mode=r'unctrl', waitfor=10, scroll_view='no')
def login(self): # 打开浏览器 self.__logger.debug('Flow:login,StepNodeTag:14155052697138,Note:') ibrowse.open_browser(browser_type='ie', url="http://localhost/grwl/") # 热键输入 self.__logger.debug('Flow:login,StepNodeTag:14155052697137,Note:') ikeyboard.key_send_cs(text='!{SPACE}', waitfor=10) # 键盘输入 self.__logger.debug('Flow:login,StepNodeTag:14155052697136,Note:') time.sleep(0.5) ikeyboard.key_send_cs(text='X', waitfor=10) # 键盘输入 self.__logger.debug('Flow:login,StepNodeTag:14155052697130,Note:') time.sleep(0.5) ikeyboard.key_send_cs(text='{TAB}', waitfor=10) # 键盘输入 self.__logger.debug('Flow:login,StepNodeTag:14155052697131,Note:') time.sleep(0.5) ikeyboard.key_send_cs(text='ZCAdmin{LSHIFT}', waitfor=10) # 键盘输入 self.__logger.debug('Flow:login,StepNodeTag:14155052697135,Note:') time.sleep(0.5) ikeyboard.key_send_cs(text='{TAB}', waitfor=10) # 键盘输入 self.__logger.debug('Flow:login,StepNodeTag:14155052697134,Note:') time.sleep(0.5) ikeyboard.key_send_cs(text=self.pwd, waitfor=10) # 鼠标点击 self.__logger.debug('Flow:login,StepNodeTag:14155052697139,Note:') time.sleep(0.5) iie.do_click_pos( win_title=r'合同管理系统 - Internet Explorer', url= r'http://localhost/grwl/Login.aspx?ReturnUrl=%2fgrwl%2fdefault.aspx', selector=r'#imgbtnLogin', button=r'left', curson=r'center', times=1, run_mode=r'unctrl', waitfor=10, scroll_view='no')
def flow2(self): yzm_pic = None tishi = None list_1 = [ '电子普通发票', '深圳增值税电子普通发票', '91440300MA5EGKDJ92', '2020年06月11日', '044031900111', '23838102', '17960524178417916383', '875.29', '62.05', '937.34', "[{'row': '1', 'word': '(详见销货清单'}]" ] dict_info = { 'AmountInWords': '佰叁拾圆叁角肆分', 'NoteDrawer': '谢登梅', 'SellerAddress': '深州市龙华区庆湾街道庆津大道乌庆旺路文汇处民治商务中心1栋115栋、2、3栋、4幢009栋7553323188', 'CommodityPrice': '[]', 'CommodityNum': '[]', 'SellerRegisterNum': '91440300689404127F', 'SellerBank': '农业银行龙华支行41028900040099987', 'Remarks': '订单号1047426466044621910支付日期2020-06-07', 'CommodityTaxRate': '[]', 'TotalTax': '62.05', 'CheckCode': '17960524178417916383', 'InvoiceCode': '044031900111', 'InvoiceDate': '2020年06月11日', 'PurchaserRegisterNum': '91440300MA5EGKDJ92', 'InvoiceTypeOrg': '深圳增值税电子普通发票', 'Password': '', 'PurchaserBank': '', 'AmountInFiguers': '937.34', 'Checker': '郑晓碧', 'TotalAmount': '875.29', 'CommodityAmount': "[{'row':'1','word':'875.29'}]", 'PurchaserName': '深圳市蓝禾技术有限公司', 'CommodityType': '[]', 'InvoiceType': '电子普通发票', 'PurchaserAddress': '', 'CommodityTax': "[{'row':'1','word':'62.05'}]", 'CommodityUnit': '[]', 'Payee': '刘笑额', 'SellerName': '深圳康润华商贸有限公司', 'CommodityName': "[{'row':'1','word':'(详见销货清单'}]", 'InvoiceNum': '23838102' } code = None #网站 self.__logger.debug('Flow:flow2,StepNodeTag:2317224431623,Note:') iie.open_url(url='https://inv-veri.chinatax.gov.cn/index.html') time.sleep(0.5) # 热键输入 self.__logger.debug('Flow:flow2,StepNodeTag:240950181343,Note:') ikeyboard.key_send_cs(text='#{UP}', waitfor=10) time.sleep(2.5) # 鼠标点击 self.__logger.debug('Flow:flow2,StepNodeTag:2317224431622,Note:') iie.do_click_pos(win_title=r'国家税务总局全国增值税发票查验平台 - Internet Explorer', url=r'https://inv-veri.chinatax.gov.cn/index.html', selector=r'#fpdm', button=r'left', curson=r'center', times=1, run_mode=r'unctrl', continue_on_error=r'break', waitfor=10) time.sleep(0.8) # 键盘输入 self.__logger.debug('Flow:flow2,StepNodeTag:2317224431621,Note:输入发票代码') time.sleep(0.5) ikeyboard.key_send_cs(text='044031900111', waitfor=10) time.sleep(0.6) # 键盘输入 self.__logger.debug('Flow:flow2,StepNodeTag:2317224431620,Note:') time.sleep(0.5) ikeyboard.key_send_cs(text='{TAB}', waitfor=10) # 键盘输入 self.__logger.debug('Flow:flow2,StepNodeTag:2317224431619,Note:输入发票号码') time.sleep(0.5) ikeyboard.key_send_cs(text='23838102', waitfor=10) # 键盘输入 self.__logger.debug('Flow:flow2,StepNodeTag:2317224431618,Note:') time.sleep(0.5) ikeyboard.key_send_cs(text='{TAB}', waitfor=10) # 键盘输入 self.__logger.debug('Flow:flow2,StepNodeTag:2317224431617,Note:开票日期') time.sleep(0.5) ikeyboard.key_send_cs(text='20200611', waitfor=10) # 键盘输入 self.__logger.debug('Flow:flow2,StepNodeTag:2317224431616,Note:') time.sleep(0.5) ikeyboard.key_send_cs(text='{TAB}', waitfor=10) # 图像检测 self.__logger.debug('Flow:flow2,StepNodeTag:2317224431613,Note:判断输入内容') tvar2317224431613 = iimg.img_exists( win_title=r'国家税务总局全国增值税发票查验平台 - Internet Explorer', img_res_path=self.path, image=r'snapshot_20200623142820581.png', fuzzy=True, confidence=0.85, waitfor=30) time.sleep(0.5) # IF-N分支 self.__logger.debug('Flow:flow2,StepNodeTag:2317224431614,Note:判断') if tvar2317224431613: # 键盘输入 self.__logger.debug( 'Flow:flow2,StepNodeTag:2317224431612,Note:输入校验码') time.sleep(0.5) ikeyboard.key_send_cs(text='916383', waitfor=10) else: # 键盘输入 self.__logger.debug( 'Flow:flow2,StepNodeTag:2317224431615,Note:输入开具金额') time.sleep(0.5) ikeyboard.key_send_cs(text='937.34', waitfor=10) # While循环 self.__logger.debug('Flow:flow2,StepNodeTag:2317224431611,Note:') while 1: # 鼠标点击 self.__logger.debug('Flow:flow2,StepNodeTag:2317224431627,Note:') time.sleep(0.5) iie.do_click_pos( win_title=r'国家税务总局全国增值税发票查验平台 - Internet Explorer', url=r'https://inv-veri.chinatax.gov.cn/index.html', selector=r'#yzm_img', button=r'left', curson=r'center', times=1, run_mode=r'unctrl', continue_on_error=r'break', waitfor=10) time.sleep(5) # 鼠标移动 self.__logger.debug('Flow:flow2,StepNodeTag:2317224431628,Note:') iie.do_moveto_pos( win_title=r'国家税务总局全国增值税发票查验平台 - Internet Explorer', url=r'https://inv-veri.chinatax.gov.cn/index.html', selector= r'#content2 > TABLE:nth-of-type(1) > TBODY:nth-of-type(1) > TR:nth-of-type(6) > TD:nth-of-type(1)', curson=r'center', waitfor=10) time.sleep(5) # 截图 self.__logger.debug('Flow:flow2,StepNodeTag:2317224431610,Note:') tishi = iimg.capture_image( win_title=r'国家税务总局全国增值税发票查验平台 - Internet Explorer', win_text=r'', left_indent=1253, top_indent=572, width=210, height=36, waitfor=30) time.sleep(0.8) # 截图 self.__logger.debug('Flow:flow2,StepNodeTag:231722443169,Note:') yzm_pic = iimg.capture_image( win_title=r'国家税务总局全国增值税发票查验平台 - Internet Explorer', win_text=r'', left_indent=992, top_indent=620, width=139, height=64, waitfor=30) time.sleep(0.8) # 自定义函数 self.__logger.debug('Flow:flow2,StepNodeTag:2317224431625,Note:') tvar2317224431625 = GlobalFun.code_color(tishi, yzm_pic) #验证码 self.__logger.debug('Flow:flow2,StepNodeTag:231722443168,Note:') code = iocr.vcode_recognize( image_path=tvar2317224431625, code_type=8001, apiKey='8159a500cc9d4a69a71e6ac14263f029', secretKey='2d078aa8c13741239b3d00ced85832e3') time.sleep(1) # 鼠标点击 self.__logger.debug('Flow:flow2,StepNodeTag:2317224431629,Note:') iie.do_click_pos( win_title=r'国家税务总局全国增值税发票查验平台 - Internet Explorer', url=r'https://inv-veri.chinatax.gov.cn/index.html', selector=r'#yzm', button=r'left', curson=r'center', times=1, run_mode=r'unctrl', continue_on_error=r'break', waitfor=10) # 键盘输入 self.__logger.debug('Flow:flow2,StepNodeTag:2317224431626,Note:') time.sleep(0.5) ikeyboard.key_send_cs(text=code, waitfor=10) # 鼠标点击 self.__logger.debug('Flow:flow2,StepNodeTag:2317224431631,Note:') iie.do_click_pos( win_title=r'国家税务总局全国增值税发票查验平台 - Internet Explorer', url=r'https://inv-veri.chinatax.gov.cn/index.html', selector=r'#checkfp', button=r'left', curson=r'center', times=1, run_mode=r'unctrl', continue_on_error=r'break', waitfor=10) time.sleep(3) # 图像检测 self.__logger.debug('Flow:flow2,StepNodeTag:2317224431630,Note:') tvar2317224431630 = iimg.img_exists( win_title=r'国家税务总局全国增值税发票查验平台 - Internet Explorer', img_res_path=self.path, image=r'snapshot_20200623152556855.png', fuzzy=True, confidence=0.85, waitfor=5) # IF-N分支 self.__logger.debug('Flow:flow2,StepNodeTag:2317224431632,Note:') if tvar2317224431630: # 鼠标点击 self.__logger.debug( 'Flow:flow2,StepNodeTag:2317224431634,Note:') iie.do_click_pos( win_title=r'国家税务总局全国增值税发票查验平台 - Internet Explorer', url=r'https://inv-veri.chinatax.gov.cn/index.html', selector=r'#popup_ok', button=r'left', curson=r'center', times=1, run_mode=r'unctrl', continue_on_error=r'break', waitfor=10) time.sleep(0.8) # 鼠标点击 self.__logger.debug( 'Flow:flow2,StepNodeTag:2317224431635,Note:') iie.do_click_pos( win_title=r'国家税务总局全国增值税发票查验平台 - Internet Explorer', url=r'https://inv-veri.chinatax.gov.cn/index.html', selector=r'#yzm', button=r'left', curson=r'center', times=1, run_mode=r'unctrl', continue_on_error=r'break', waitfor=10) time.sleep(0.8) # 热键输入 self.__logger.debug( 'Flow:flow2,StepNodeTag:2317224431636,Note:') ikeyboard.key_send_cs(text='^a', waitfor=10) # 键盘输入 self.__logger.debug( 'Flow:flow2,StepNodeTag:2317224431637,Note:') time.sleep(0.5) ikeyboard.key_send_cs(text='{BACKSPACE}', waitfor=10) else: # Break中断 self.__logger.debug( 'Flow:flow2,StepNodeTag:2317224431633,Note:') break # 图像检测 self.__logger.debug('Flow:flow2,StepNodeTag:2317224431639,Note:') tvar2317224431639 = iimg.img_exists( win_title=r'国家税务总局全国增值税发票查验平台 - Internet Explorer', img_res_path=self.path, image=r'snapshot_20200623153842415.png', fuzzy=True, confidence=0.85, waitfor=5) # IF-N分支 self.__logger.debug('Flow:flow2,StepNodeTag:2317224431638,Note:') if tvar2317224431639: # 代码块 self.__logger.debug('Flow:flow2,StepNodeTag:2317224431745,Note:') list_1.append('否') #单元格写入 self.__logger.debug('Flow:flow2,StepNodeTag:2317224431640,Note:') iexcel.write_cell(path='C:/Users/jky/Desktop/fapiao_info.xlsx', cell='A2', text=list_1, file_type='excel') # 鼠标点击 self.__logger.debug('Flow:flow2,StepNodeTag:2317224431642,Note:') iie.do_click_pos( win_title=r'国家税务总局全国增值税发票查验平台 - Internet Explorer', url=r'https://inv-veri.chinatax.gov.cn/index.html', selector=r'#closebt', button=r'left', curson=r'center', times=1, run_mode=r'unctrl', continue_on_error=r'break', waitfor=10) # 消息框 self.__logger.debug('Flow:flow2,StepNodeTag:2317224431747,Note:') ibox.msgs_box('结束', timeout=0) else: # 代码块 self.__logger.debug('Flow:flow2,StepNodeTag:2317224431746,Note:') list_1.append('是') #单元格写入 self.__logger.debug('Flow:flow2,StepNodeTag:2317224431641,Note:') iexcel.write_cell(path='C:/Users/jky/Desktop/fapiao_info.xlsx', cell='A2', text=list_1, file_type='excel') # 鼠标点击 self.__logger.debug('Flow:flow2,StepNodeTag:23174311384140,Note:') iie.do_click_pos( win_title=r'国家税务总局全国增值税发票查验平台 - Internet Explorer', url=r'https://inv-veri.chinatax.gov.cn/index.html', selector=r'#closebt', button=r'left', curson=r'center', times=1, run_mode=r'unctrl', continue_on_error=r'break', waitfor=10) # 消息框 self.__logger.debug('Flow:flow2,StepNodeTag:2317224431743,Note:') ibox.msgs_box('结束', timeout=3)
def flow2(self,fangshi=None,leixing=None,initial=4,num=0,excel=0): #鼠标点击 self.__logger.dlogs(job_no=self.job_no,logmsg='Flow:flow2,StepNodeTag:20201029100501969918,Title:鼠标点击,Note:') iimg.do_click_pos(waitfor=30.000,button='left',curson='Center',offsetX=10,image=r'snapshot_20201029100607886.png',image_size=r'14X24',win_title=r'金蝶EAS-IT_Test',continue_on_error='break',img_res_path = self.path) #鼠标点击 self.__logger.dlogs(job_no=self.job_no,logmsg='Flow:flow2,StepNodeTag:20201029100714286921,Title:鼠标点击,Note:') iimg.do_click_pos(waitfor=30.000,button='left',curson='Center',image=r'snapshot_20201029100801595.png',image_size=r'85X22',win_title=r'金蝶EAS-IT_Test',continue_on_error='break',img_res_path = self.path) #工作表行数获取 self.__logger.dlogs(job_no=self.job_no,logmsg='Flow:flow2,StepNodeTag:20201028230910820504,Title:工作表行数获取,Note:') excel=iexcel.get_rows_count(path='C:/Users/Administrator/Desktop/银行日记账20201020112540会计录入收款信息.xlsx') print('[flow2] [工作表行数获取] [20201028230910820504] 返回值:[' + str(type(excel)) + ']' + str(excel)) #鼠标点击 self.__logger.dlogs(job_no=self.job_no,logmsg='Flow:flow2,StepNodeTag:20201028143452321202,Title:鼠标点击,Note:') iimg.do_click_pos(waitfor=30.000,button='left',curson='Center',image=r'snapshot_20201028143508572.png',image_size=r'77X29',win_title=r'金蝶EAS-IT_Test',continue_on_error='break',img_res_path = self.path) #模拟按键 self.__logger.dlogs(job_no=self.job_no,logmsg='Flow:flow2,StepNodeTag:20201029015023339827,Title:模拟按键,Note:') ikeyboard.key_send_cs(waitfor=10.000,text='{Tab}') # For循环 self.__logger.dlogs(job_no=self.job_no, logmsg='Flow:flow2,StepNodeTag:20201028230954859509,Title:For循环,Note:') for num in range(excel-3): #单元格读取 self.__logger.dlogs(job_no=self.job_no,logmsg='Flow:flow2,StepNodeTag:20201029012445614787,Title:单元格读取,Note:') time.sleep(0.3) tvar_20201029012445614788=iexcel.read_cell(path='C:/Users/Administrator/Desktop/银行日记账20201020112540会计录入收款信息.xlsx',cell='B'+str(initial),cell_type='time') print('[flow2] [单元格读取] [20201029012445614787] 返回值:[' + str(type(tvar_20201029012445614788)) + ']' + str(tvar_20201029012445614788)) time.sleep(0.3) #模拟按键 self.__logger.dlogs(job_no=self.job_no,logmsg='Flow:flow2,StepNodeTag:20201028143734693212,Title:模拟按键,Note:') ikeyboard.key_send_cs(waitfor=10.000,text=tvar_20201029012445614788) #模拟按键 self.__logger.dlogs(job_no=self.job_no,logmsg='Flow:flow2,StepNodeTag:20201028150809975282,Title:模拟按键,Note:') ikeyboard.key_send_cs(waitfor=10.000,text='{Tab}') #单元格读取 self.__logger.dlogs(job_no=self.job_no,logmsg='Flow:flow2,StepNodeTag:20201028144321938225,Title:单元格读取,Note:') time.sleep(0.3) tvar_20201028144321939226=iexcel.read_cell(path='C:/Users/Administrator/Desktop/银行日记账20201020112540会计录入收款信息.xlsx',cell='C'+str(initial),cell_type='time') print('[flow2] [单元格读取] [20201028144321938225] 返回值:[' + str(type(tvar_20201028144321939226)) + ']' + str(tvar_20201028144321939226)) time.sleep(0.3) #模拟按键 self.__logger.dlogs(job_no=self.job_no,logmsg='Flow:flow2,StepNodeTag:20201028144335510228,Title:模拟按键,Note:') ikeyboard.key_send_cs(waitfor=10.000,text=tvar_20201028144321939226) #模拟按键 self.__logger.dlogs(job_no=self.job_no,logmsg='Flow:flow2,StepNodeTag:20201028144459937234,Title:模拟按键,Note:') ikeyboard.key_send_cs(waitfor=10.000,text='{Tab}') #单元格读取 self.__logger.dlogs(job_no=self.job_no,logmsg='Flow:flow2,StepNodeTag:20201028144459937236,Title:单元格读取,Note:') time.sleep(0.3) tvar_20201028144459937237=iexcel.read_cell(path='C:/Users/Administrator/Desktop/银行日记账20201020112540会计录入收款信息.xlsx',cell='I'+str(initial),cell_type='string') print('[flow2] [单元格读取] [20201028144459937236] 返回值:[' + str(type(tvar_20201028144459937237)) + ']' + str(tvar_20201028144459937237)) time.sleep(0.3) #模拟按键 self.__logger.dlogs(job_no=self.job_no,logmsg='Flow:flow2,StepNodeTag:20201028144459937235,Title:模拟按键,Note:') ikeyboard.key_send_cs(waitfor=10.000,text=tvar_20201028144459937237) time.sleep(0.5) #模拟按键 self.__logger.dlogs(job_no=self.job_no,logmsg='Flow:flow2,StepNodeTag:20201028151111503295,Title:模拟按键,Note:') time.sleep(0.5) ikeyboard.key_send_cs(waitfor=10.000,text='{Tab}') #单元格读取 self.__logger.dlogs(job_no=self.job_no,logmsg='Flow:flow2,StepNodeTag:202010291412063991055,Title:单元格读取,Note:') time.sleep(0.3) leixing=iexcel.read_cell(path='C:/Users/Administrator/Desktop/银行日记账20201020112540会计录入收款信息.xlsx',cell='D'+str(initial),cell_type='string') print('[flow2] [单元格读取] [202010291412063991055] 返回值:[' + str(type(leixing)) + ']' + str(leixing)) time.sleep(0.3) # IF分支 self.__logger.dlogs(job_no=self.job_no, logmsg='Flow:flow2,StepNodeTag:202010291416021701074,Title:IF分支,Note:') if leixing == '银收': #模拟按键 self.__logger.dlogs(job_no=self.job_no,logmsg='Flow:flow2,StepNodeTag:202010291416444871078,Title:模拟按键,Note:') ikeyboard.key_send_cs(waitfor=10.000,text='{Down 15}') elif leixing == '银付': #模拟按键 self.__logger.dlogs(job_no=self.job_no,logmsg='Flow:flow2,StepNodeTag:202010291417369811080,Title:模拟按键,Note:') ikeyboard.key_send_cs(waitfor=10.000,text='{Down 8}') else: pass #模拟按键 self.__logger.dlogs(job_no=self.job_no,logmsg='Flow:flow2,StepNodeTag:20201028153949690307,Title:模拟按键,Note:') ikeyboard.key_send_cs(waitfor=10.000,text='{Enter}') #单元格读取 self.__logger.dlogs(job_no=self.job_no,logmsg='Flow:flow2,StepNodeTag:20201028154040326309,Title:单元格读取,Note:') time.sleep(0.3) tvar_20201028154040327310=iexcel.read_cell(path='C:/Users/Administrator/Desktop/银行日记账20201020112540会计录入收款信息.xlsx',cell='E'+str(initial),cell_type=None) print('[flow2] [单元格读取] [20201028154040326309] 返回值:[' + str(type(tvar_20201028154040327310)) + ']' + str(tvar_20201028154040327310)) time.sleep(0.3) #模拟按键 self.__logger.dlogs(job_no=self.job_no,logmsg='Flow:flow2,StepNodeTag:20201028154124182312,Title:模拟按键,Note:') ikeyboard.key_send_cs(waitfor=10.000,text=tvar_20201028154040327310) #模拟按键 self.__logger.dlogs(job_no=self.job_no,logmsg='Flow:flow2,StepNodeTag:20201028173223637496,Title:模拟按键,Note:') ikeyboard.key_send_cs(waitfor=10.000,text='{Tab 4}') #单元格读取 self.__logger.dlogs(job_no=self.job_no,logmsg='Flow:flow2,StepNodeTag:202010291422234261086,Title:单元格读取,Note:') time.sleep(0.3) fangshi=iexcel.read_cell(path='C:/Users/Administrator/Desktop/银行日记账20201020112540会计录入收款信息.xlsx',cell='J'+str(initial),cell_type='string') print('[flow2] [单元格读取] [202010291422234261086] 返回值:[' + str(type(fangshi)) + ']' + str(fangshi)) time.sleep(0.3) # IF分支 self.__logger.dlogs(job_no=self.job_no, logmsg='Flow:flow2,StepNodeTag:202010291423319511100,Title:IF分支,Note:') if fangshi =='电汇': #模拟按键 self.__logger.dlogs(job_no=self.job_no,logmsg='Flow:flow2,StepNodeTag:202010291426471281103,Title:模拟按键,Note:') ikeyboard.key_send_cs(waitfor=10.000,text='{Down 8}') elif fangshi =='银行承兑汇票(收)': #模拟按键 self.__logger.dlogs(job_no=self.job_no,logmsg='Flow:flow2,StepNodeTag:202010291427017501104,Title:模拟按键,Note:') ikeyboard.key_send_cs(waitfor=10.000,text='{Down 3}') elif fangshi =='转帐': #模拟按键 self.__logger.dlogs(job_no=self.job_no,logmsg='Flow:flow2,StepNodeTag:202010291427022791107,Title:模拟按键,Note:') ikeyboard.key_send_cs(waitfor=10.000,text='{Down 17}') else: pass #模拟按键 self.__logger.dlogs(job_no=self.job_no,logmsg='Flow:flow2,StepNodeTag:20201028154301537329,Title:模拟按键,Note:') ikeyboard.key_send_cs(waitfor=10.000,text='{Enter}') #单元格读取 self.__logger.dlogs(job_no=self.job_no,logmsg='Flow:flow2,StepNodeTag:20201028154445770331,Title:单元格读取,Note:') time.sleep(0.3) tvar_20201028154445771332=iexcel.read_cell(path='C:/Users/Administrator/Desktop/银行日记账20201020112540会计录入收款信息.xlsx',cell='K'+str(initial),cell_type='string') print('[flow2] [单元格读取] [20201028154445770331] 返回值:[' + str(type(tvar_20201028154445771332)) + ']' + str(tvar_20201028154445771332)) time.sleep(0.3) #replace self.__logger.dlogs(job_no=self.job_no,logmsg='Flow:flow2,StepNodeTag:20201028165150667415,Title:replace,Note:') tvar_20201028165150667416=rpa_str.replace(string=tvar_20201028154445771332,old='#',new='{#}') print('[flow2] [replace] [20201028165150667415] 返回值:[' + str(type(tvar_20201028165150667416)) + ']' + str(tvar_20201028165150667416)) #模拟按键 self.__logger.dlogs(job_no=self.job_no,logmsg='Flow:flow2,StepNodeTag:20201028165226010429,Title:模拟按键,Note:') ikeyboard.key_send_cs(waitfor=10.000,text=tvar_20201028165150667416) #模拟按键 self.__logger.dlogs(job_no=self.job_no,logmsg='Flow:flow2,StepNodeTag:20201028154630210337,Title:模拟按键,Note:') ikeyboard.key_send_cs(waitfor=10.000,text='{Tab}') #单元格读取 self.__logger.dlogs(job_no=self.job_no,logmsg='Flow:flow2,StepNodeTag:20201028154707544339,Title:单元格读取,Note:') time.sleep(0.3) tvar_20201028154707545340=iexcel.read_cell(path='C:/Users/Administrator/Desktop/银行日记账20201020112540会计录入收款信息.xlsx',cell='L'+str(initial),cell_type=None) print('[flow2] [单元格读取] [20201028154707544339] 返回值:[' + str(type(tvar_20201028154707545340)) + ']' + str(tvar_20201028154707545340)) time.sleep(0.3) #模拟按键 self.__logger.dlogs(job_no=self.job_no,logmsg='Flow:flow2,StepNodeTag:20201028154718140342,Title:模拟按键,Note:') ikeyboard.key_send_cs(waitfor=10.000,text=tvar_20201028154707545340) #模拟按键 self.__logger.dlogs(job_no=self.job_no,logmsg='Flow:flow2,StepNodeTag:20201028154748193347,Title:模拟按键,Note:') ikeyboard.key_send_cs(waitfor=10.000,text='{Tab}') #单元格读取 self.__logger.dlogs(job_no=self.job_no,logmsg='Flow:flow2,StepNodeTag:20201028154805912349,Title:单元格读取,Note:') time.sleep(0.3) tvar_20201028154805912350=iexcel.read_cell(path='C:/Users/Administrator/Desktop/银行日记账20201020112540会计录入收款信息.xlsx',cell='M'+str(initial),cell_type=None) print('[flow2] [单元格读取] [20201028154805912349] 返回值:[' + str(type(tvar_20201028154805912350)) + ']' + str(tvar_20201028154805912350)) time.sleep(0.3) #模拟按键 self.__logger.dlogs(job_no=self.job_no,logmsg='Flow:flow2,StepNodeTag:20201028154840804352,Title:模拟按键,Note:') ikeyboard.key_send_cs(waitfor=10.000,text=tvar_20201028154805912350) #模拟按键 self.__logger.dlogs(job_no=self.job_no,logmsg='Flow:flow2,StepNodeTag:20201028172525264494,Title:模拟按键,Note:') ikeyboard.key_send_cs(waitfor=10.000,text='{Tab 4}') #相加 self.__logger.dlogs(job_no=self.job_no,logmsg='Flow:flow2,StepNodeTag:20201029015908212843,Title:相加,Note:') initial=rpa_fun.add(a=initial,b=1) print('[flow2] [相加] [20201029015908212843] 返回值:[' + str(type(initial)) + ']' + str(initial)) #模拟按键 self.__logger.dlogs(job_no=self.job_no,logmsg='Flow:flow2,StepNodeTag:20201029100341149915,Title:模拟按键,Note:') ikeyboard.key_send_cs(waitfor=10.000)
def flow2(self): yzm_pic = None tishi = None list_1 = [ '电子普通发票', '深圳增值税电子普通发票', '91440300MA5EGKDJ92', '2020年06月11日', '044031900111', '23838102', '17960524178417916383', '875.29', '62.05', '937.34', "[{'row': '1', 'word': '(详见销货清单'}]" ] dict_info = { 'AmountInWords': '佰叁拾圆叁角肆分', 'NoteDrawer': '谢登梅', 'SellerAddress': '深州市龙华区庆湾街道庆津大道乌庆旺路文汇处民治商务中心1栋115栋、2、3栋、4幢009栋7553323188', 'CommodityPrice': '[]', 'CommodityNum': '[]', 'SellerRegisterNum': '91440300689404127F', 'SellerBank': '农业银行龙华支行41028900040099987', 'Remarks': '订单号1047426466044621910支付日期2020-06-07', 'CommodityTaxRate': '[]', 'TotalTax': '62.05', 'CheckCode': '17960524178417916383', 'InvoiceCode': '044031900111', 'InvoiceDate': '2020年06月11日', 'PurchaserRegisterNum': '91440300MA5EGKDJ92', 'InvoiceTypeOrg': '深圳增值税电子普通发票', 'Password': '', 'PurchaserBank': '', 'AmountInFiguers': '937.34', 'Checker': '郑晓碧', 'TotalAmount': '875.29', 'CommodityAmount': "[{'row':'1','word':'875.29'}]", 'PurchaserName': '深圳市蓝禾技术有限公司', 'CommodityType': '[]', 'InvoiceType': '电子普通发票', 'PurchaserAddress': '', 'CommodityTax': "[{'row':'1','word':'62.05'}]", 'CommodityUnit': '[]', 'Payee': '刘笑额', 'SellerName': '深圳康润华商贸有限公司', 'CommodityName': "[{'row':'1','word':'(详见销货清单'}]", 'InvoiceNum': '23838102' } code = None #网站 self.__logger.dlogs( job_no=self.job_no, logmsg='Flow:flow2,StepNodeTag:2317224431623,Title:网站,Note:') time.sleep(0.5) iie.open_url( ie_path='C:/Program Files (x86)/Internet Explorer/iexplore.exe', url='https://inv-veri.chinatax.gov.cn/index.html') time.sleep(0.5) # Try异常 self.__logger.dlogs( job_no=self.job_no, logmsg= 'Flow:flow2,StepNodeTag:20201027172041803566,Title:Try异常,Note:') try: #鼠标点击 self.__logger.dlogs( job_no=self.job_no, logmsg= 'Flow:flow2,StepNodeTag:20201027172049219568,Title:鼠标点击,Note:') iimg.do_click_pos(waitfor=30.000, button='left', curson='Center', image=r'snapshot_20201029175005894.png', image_size=r'64X15', win_title=r'此站点不安全 - Internet Explorer', continue_on_error='break', img_res_path=self.path) #鼠标点击 self.__logger.dlogs( job_no=self.job_no, logmsg= 'Flow:flow2,StepNodeTag:20201027172102123570,Title:鼠标点击,Note:') iimg.do_click_pos(waitfor=30.000, button='left', curson='Center', image=r'snapshot_20201029175415351.png', image_size=r'161X28', win_title=r'此站点不安全 - Internet Explorer', continue_on_error='break', img_res_path=self.path) except Exception as e: pass finally: pass #热键输入 self.__logger.dlogs( job_no=self.job_no, logmsg='Flow:flow2,StepNodeTag:240950181343,Title:热键输入,Note:') ikeyboard.key_send_cs(waitfor=10.000, text=r'#{UP}') time.sleep(2.5) #鼠标点击 self.__logger.dlogs( job_no=self.job_no, logmsg='Flow:flow2,StepNodeTag:2317224431622,Title:鼠标点击,Note:') iie.do_click_pos(waitfor=10.000, run_mode='unctrl', button='left', curson='center', continue_on_error='break', win_title=r'国家税务总局全国增值税发票查验平台 - Internet Explorer', selector=r'#fpdm', url=r'https://inv-veri.chinatax.gov.cn/index.html') time.sleep(0.8) #模拟按键 self.__logger.dlogs( job_no=self.job_no, logmsg='Flow:flow2,StepNodeTag:2317224431621,Title:模拟按键,Note:输入发票代码' ) time.sleep(0.5) ikeyboard.key_send_cs(waitfor=10.000, text='044031900111') time.sleep(0.6) #模拟按键 self.__logger.dlogs( job_no=self.job_no, logmsg='Flow:flow2,StepNodeTag:2317224431620,Title:模拟按键,Note:') time.sleep(0.5) ikeyboard.key_send_cs(waitfor=10.000, text='{TAB}') #模拟按键 self.__logger.dlogs( job_no=self.job_no, logmsg='Flow:flow2,StepNodeTag:2317224431619,Title:模拟按键,Note:输入发票号码' ) time.sleep(0.5) ikeyboard.key_send_cs(waitfor=10.000, text='23838102') #模拟按键 self.__logger.dlogs( job_no=self.job_no, logmsg='Flow:flow2,StepNodeTag:2317224431618,Title:模拟按键,Note:') time.sleep(0.5) ikeyboard.key_send_cs(waitfor=10.000, text='{TAB}') #模拟按键 self.__logger.dlogs( job_no=self.job_no, logmsg='Flow:flow2,StepNodeTag:2317224431617,Title:模拟按键,Note:开票日期') time.sleep(0.5) ikeyboard.key_send_cs(waitfor=10.000, text='20200611') #模拟按键 self.__logger.dlogs( job_no=self.job_no, logmsg='Flow:flow2,StepNodeTag:2317224431616,Title:模拟按键,Note:') time.sleep(0.5) ikeyboard.key_send_cs(waitfor=10.000, text='{Tab}') #图片检测 self.__logger.dlogs( job_no=self.job_no, logmsg='Flow:flow2,StepNodeTag:2317224431613,Title:图片检测,Note:判断输入内容' ) tvar_2020102717112596416 = iimg.img_exists( waitfor=30.000, win_title=r'国家税务总局全国增值税发票查验平台 - Internet Explorer', image=r'snapshot_20201030101359793.png', img_res_path=self.path) print('[flow2] [图片检测] [2317224431613] 返回值:[' + str(type(tvar_2020102717112596416)) + ']' + str(tvar_2020102717112596416)) time.sleep(0.5)