Пример #1
0
 def Excel(self):
     sheet2_val = None
     sheet1_val = None
     #读取Excel
     self.__logger.dlogs(
         job_no=self.job_no,
         logmsg=
         'Flow:Excel,StepNodeTag:20200917160132552143,Title:读取Excel,Note:')
     sheet1_val = pd.read_excel(io='D:/YiSaiQi/RPA_D3/mydata.xls')
     #读取Excel
     self.__logger.dlogs(
         job_no=self.job_no,
         logmsg=
         'Flow:Excel,StepNodeTag:20200917160727776167,Title:读取Excel,Note:')
     sheet2_val = pd.read_excel(io='D:/YiSaiQi/RPA_D3/mydata.xls',
                                sheet_name=1)
     #代码块
     self.__logger.dlogs(
         job_no=self.job_no,
         logmsg='Flow:Excel,StepNodeTag:20200917161108141183,Title:代码块,Note:'
     )
     sheet1_val = sheet1_val.append(sheet2_val)
     #输出
     self.__logger.dlogs(
         job_no=self.job_no,
         logmsg='Flow:Excel,StepNodeTag:20200917161214523186,Title:输出,Note:'
     )
     rpa_str.iprints(sheet1_val)
     # Try异常
     self.__logger.dlogs(
         job_no=self.job_no,
         logmsg=
         'Flow:Excel,StepNodeTag:20200917162950407191,Title:Try异常,Note:')
     try:
         #创建excel
         self.__logger.dlogs(
             job_no=self.job_no,
             logmsg=
             'Flow:Excel,StepNodeTag:20200917154223848138,Title:创建excel,Note:'
         )
         iexcel.create_excel(path='D:/YiSaiQi/RPA_D3',
                             file_name='Create_excel.xls')
     except Exception as e:
         #导出excel
         self.__logger.dlogs(
             job_no=self.job_no,
             logmsg=
             'Flow:Excel,StepNodeTag:20200917163240519199,Title:导出excel,Note:'
         )
         icsv.write_excel(path='D:/YiSaiQi/RPA_D3/Create_excel.xls',
                          df=sheet1_val)
     finally:
         #导出excel
         self.__logger.dlogs(
             job_no=self.job_no,
             logmsg=
             'Flow:Excel,StepNodeTag:20200917160944573180,Title:导出excel,Note:'
         )
         icsv.write_excel(path='D:/YiSaiQi/RPA_D3/Create_excel.xls',
                          df=sheet1_val)
Пример #2
0
 def Excel(self):
     text = None
     #获取文本
     self.__logger.dlogs(
         job_no=self.job_no,
         logmsg='Flow:Excel,StepNodeTag:2020091703541846134,Title:获取文本,Note:'
     )
     text = iie.get_text(
         waitfor=10.000,
         selector=
         r'#frame-nav > UL:nth-of-type(1) > LI:nth-of-type(1) > A:nth-of-type(1)',
         url=r'http://122.112.200.222:9080/login.action')
     print('[Excel] [获取文本] [2020091703541846134]  返回值:[' + str(type(text)) +
           ']' + str(text))
     #输出
     self.__logger.dlogs(
         job_no=self.job_no,
         logmsg='Flow:Excel,StepNodeTag:2020091703550173641,Title:输出,Note:')
     rpa_str.iprints(text)
     #单元格写入
     self.__logger.dlogs(
         job_no=self.job_no,
         logmsg=
         'Flow:Excel,StepNodeTag:2020091703553501645,Title:单元格写入,Note:')
     tvar_2020091703553501646 = iexcel.write_cell(
         path='C:/Users/帅气可爱的小飞/Desktop/RPA_test1.xls', text=text)
     print('[Excel] [单元格写入] [2020091703553501645]  返回值:[' +
           str(type(tvar_2020091703553501646)) + ']' +
           str(tvar_2020091703553501646))
Пример #3
0
 def for_demo(self):
     # For循环
     self.__logger.dlogs(
         job_no=self.job_no,
         logmsg=
         'Flow:for_demo,StepNodeTag:2020091808042353439,Title:For循环,Note:')
     for i in [1, 2, 3, 4, 5]:
         #输出
         self.__logger.dlogs(
             job_no=self.job_no,
             logmsg=
             'Flow:for_demo,StepNodeTag:2020091808050105143,Title:输出,Note:')
         rpa_str.iprints(i)
Пример #4
0
 def flow1(self):
     #增值税发票OCR
     self.__logger.dlogs(
         job_no=self.job_no,
         logmsg=
         'Flow:flow1,StepNodeTag:20201030113643160121,Title:增值税发票OCR,Note:')
     tvar_20201030113643161122 = iocr.vat_recognize(
         image_path='E:/fapiao/不干胶发票0608.pdf')
     print('[flow1] [增值税发票OCR] [20201030113643160121]  返回值:[' +
           str(type(tvar_20201030113643161122)) + ']' +
           str(tvar_20201030113643161122))
     #输出
     self.__logger.dlogs(
         job_no=self.job_no,
         logmsg='Flow:flow1,StepNodeTag:20201030113715259124,Title:输出,Note:'
     )
     rpa_str.iprints(tvar_20201030113643161122)
Пример #5
0
 def OCR(self):
     YZM = None
     #截图
     self.__logger.dlogs(
         job_no=self.job_no,
         logmsg='Flow:OCR,StepNodeTag:20200918084212118111,Title:截图,Note:')
     tvar_20200918084212118112 = iimg.capture_image(
         waitfor=30.000,
         win_title=r'中国工商银行企业网上银行 - Internet Explorer',
         left_indent=935,
         top_indent=458,
         width=90,
         height=34)
     print('[OCR] [截图] [20200918084212118111]  返回值:[' +
           str(type(tvar_20200918084212118112)) + ']' +
           str(tvar_20200918084212118112))
     #获取OCR文本
     self.__logger.dlogs(
         job_no=self.job_no,
         logmsg=
         'Flow:OCR,StepNodeTag:2020091808312854183,Title:获取OCR文本,Note:')
     YZM = iocr.general_recognize(
         image_path=tvar_20200918084212118112,
         apiKey='c578a472e212448fb9f78b17a79fffc9',
         secretKey='5588921ccc2047fd87a2e54fabee90ed')
     print('[OCR] [获取OCR文本] [2020091808312854183]  返回值:[' + str(type(YZM)) +
           ']' + str(YZM))
     #replace
     self.__logger.dlogs(
         job_no=self.job_no,
         logmsg=
         'Flow:OCR,StepNodeTag:2020091808351721592,Title:replace,Note:')
     tvar_2020091808351722593 = rpa_str.replace(string=YZM, old=' ', new='')
     print('[OCR] [replace] [2020091808351721592]  返回值:[' +
           str(type(tvar_2020091808351722593)) + ']' +
           str(tvar_2020091808351722593))
     #输出
     self.__logger.dlogs(
         job_no=self.job_no,
         logmsg='Flow:OCR,StepNodeTag:20200918083727282102,Title:输出,Note:')
     rpa_str.iprints(tvar_2020091808351722593)
Пример #6
0
 def while_dmeo(self):
     carr = 0
     # While循环
     self.__logger.dlogs(
         job_no=self.job_no,
         logmsg=
         'Flow:while_dmeo,StepNodeTag:2020091807503206120,Title:While循环,Note:'
     )
     while carr <= 100:
         #相加
         self.__logger.dlogs(
             job_no=self.job_no,
             logmsg=
             'Flow:while_dmeo,StepNodeTag:2020091807551612223,Title:相加,Note:'
         )
         carr = rpa_fun.add(a=carr, b=1)
         print('[while_dmeo] [相加] [2020091807551612223]  返回值:[' +
               str(type(carr)) + ']' + str(carr))
         # IF分支
         self.__logger.dlogs(
             job_no=self.job_no,
             logmsg=
             'Flow:while_dmeo,StepNodeTag:2020091807565996529,Title:IF分支,Note:'
         )
         if carr % 2 == 0:
             #输出
             self.__logger.dlogs(
                 job_no=self.job_no,
                 logmsg=
                 'Flow:while_dmeo,StepNodeTag:2020091807574119732,Title:输出,Note:'
             )
             rpa_str.iprints(carr)
         else:
             # Continue继续
             self.__logger.dlogs(
                 job_no=self.job_no,
                 logmsg=
                 'Flow:while_dmeo,StepNodeTag:2020091807582317635,Title:Continue继续,Note:'
             )
             continue
Пример #7
0
 def Dataframe_list(self):
     value_isearch03 = None
     #读取Excel
     self.__logger.dlogs(
         job_no=self.job_no,
         logmsg=
         'Flow:Dataframe_list,StepNodeTag:2020091715025272589,Title:读取Excel,Note:'
     )
     tvar_2020091715025272690 = pd.read_excel(
         io='D:/YiSaiQi/RPA_D3/mydata.xls')
     #表格过滤
     self.__logger.dlogs(
         job_no=self.job_no,
         logmsg=
         'Flow:Dataframe_list,StepNodeTag:2020091714592597678,Title:表格过滤,Note:'
     )
     value_isearch03 = tvar_2020091715025272690[(
         tvar_2020091715025272690['产品代码'].str.startswith('i-Search-03'))]
     #设置变量
     self.__logger.dlogs(
         job_no=self.job_no,
         logmsg=
         'Flow:Dataframe_list,StepNodeTag:20200917150802293115,Title:设置变量,Note:'
     )
     value_isearch03 = value_isearch03.values.tolist()
     # For循环
     self.__logger.dlogs(
         job_no=self.job_no,
         logmsg=
         'Flow:Dataframe_list,StepNodeTag:20200917151128158119,Title:For循环,Note:'
     )
     for tvar_20200917151128161120 in value_isearch03:
         #输出
         self.__logger.dlogs(
             job_no=self.job_no,
             logmsg=
             'Flow:Dataframe_list,StepNodeTag:2020091715004175083,Title:输出,Note:'
         )
         rpa_str.iprints(tvar_20200917151128161120)
Пример #8
0
 def pic_JC(self):
     #元素截图
     self.__logger.dlogs(
         job_no=self.job_no,
         logmsg=
         'Flow:pic_JC,StepNodeTag:2020091808241867472,Title:元素截图,Note:')
     tvar_2020091808243847274 = iie.capture_element_img(
         waitfor=10.000,
         win_title=r'金融RPA_银行RPA机器人_RPA金融银行解决方案_艺赛旗 - Internet Explorer',
         selector=
         r'#fh5co-header > DIV:nth-of-type(1) > DIV:nth-of-type(1) > DIV:nth-of-type(1) > DIV:nth-of-type(1) > DIV:nth-of-type(1) > DIV:nth-of-type(2) > IMG:nth-of-type(1)',
         in_img_path=r'C:/Users/帅气可爱的小飞/Desktop/图片素材',
         url=r'https://www.i-search.com.cn/finance.html')
     print('[pic_JC] [元素截图] [2020091808241867472]  返回值:[' +
           str(type(tvar_2020091808243847274)) + ']' +
           str(tvar_2020091808243847274))
     #输出
     self.__logger.dlogs(
         job_no=self.job_no,
         logmsg='Flow:pic_JC,StepNodeTag:2020091808252203975,Title:输出,Note:'
     )
     rpa_str.iprints(tvar_2020091808243847274)