worker-automate-hub 0.4.443__py3-none-any.whl → 0.4.444__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- worker_automate_hub/tasks/jobs/entrada_de_notas_16.py +54 -52
 - worker_automate_hub/utils/utils_nfe_entrada.py +17 -4
 - {worker_automate_hub-0.4.443.dist-info → worker_automate_hub-0.4.444.dist-info}/METADATA +1 -1
 - {worker_automate_hub-0.4.443.dist-info → worker_automate_hub-0.4.444.dist-info}/RECORD +6 -6
 - {worker_automate_hub-0.4.443.dist-info → worker_automate_hub-0.4.444.dist-info}/WHEEL +0 -0
 - {worker_automate_hub-0.4.443.dist-info → worker_automate_hub-0.4.444.dist-info}/entry_points.txt +0 -0
 
| 
         @@ -414,7 +414,7 @@ async def entrada_de_notas_16(task: RpaProcessoEntradaDTO) -> RpaRetornoProcesso 
     | 
|
| 
       414 
414 
     | 
    
         
             
                        max_attempts = 60
         
     | 
| 
       415 
415 
     | 
    
         
             
                        i = 0
         
     | 
| 
       416 
416 
     | 
    
         | 
| 
       417 
     | 
    
         
            -
                        while i < max_attempts:
         
     | 
| 
      
 417 
     | 
    
         
            +
                        while i < max_attempts and retorno is not True:
         
     | 
| 
       418 
418 
     | 
    
         
             
                            information_pop_up = await is_window_open("Information")
         
     | 
| 
       419 
419 
     | 
    
         
             
                            if information_pop_up["IsOpened"] == True:
         
     | 
| 
       420 
420 
     | 
    
         
             
                                break
         
     | 
| 
         @@ -424,60 +424,62 @@ async def entrada_de_notas_16(task: RpaProcessoEntradaDTO) -> RpaRetornoProcesso 
     | 
|
| 
       424 
424 
     | 
    
         
             
                                i += 1
         
     | 
| 
       425 
425 
     | 
    
         | 
| 
       426 
426 
     | 
    
         
             
                        information_pop_up = await is_window_open("Information")
         
     | 
| 
       427 
     | 
    
         
            -
                         
     | 
| 
       428 
     | 
    
         
            -
             
     | 
| 
       429 
     | 
    
         
            -
                             
     | 
| 
       430 
     | 
    
         
            -
             
     | 
| 
       431 
     | 
    
         
            -
             
     | 
| 
       432 
     | 
    
         
            -
             
     | 
| 
       433 
     | 
    
         
            -
             
     | 
| 
       434 
     | 
    
         
            -
             
     | 
| 
       435 
     | 
    
         
            -
             
     | 
| 
       436 
     | 
    
         
            -
             
     | 
| 
       437 
     | 
    
         
            -
             
     | 
| 
       438 
     | 
    
         
            -
                                 
     | 
| 
       439 
     | 
    
         
            -
             
     | 
| 
       440 
     | 
    
         
            -
                                     
     | 
| 
       441 
     | 
    
         
            -
             
     | 
| 
       442 
     | 
    
         
            -
             
     | 
| 
      
 427 
     | 
    
         
            +
                        
         
     | 
| 
      
 428 
     | 
    
         
            +
                        if not retorno:
         
     | 
| 
      
 429 
     | 
    
         
            +
                            if information_pop_up["IsOpened"] == True:
         
     | 
| 
      
 430 
     | 
    
         
            +
                                app = Application().connect(class_name="TFrmNotaFiscalEntrada")
         
     | 
| 
      
 431 
     | 
    
         
            +
                                main_window = app["Information"]
         
     | 
| 
      
 432 
     | 
    
         
            +
             
     | 
| 
      
 433 
     | 
    
         
            +
                                main_window.set_focus()
         
     | 
| 
      
 434 
     | 
    
         
            +
             
     | 
| 
      
 435 
     | 
    
         
            +
                                console.print(f"Obtendo texto do Information...\n")
         
     | 
| 
      
 436 
     | 
    
         
            +
                                console.print(f"Tirando print da janela do Information para realização do OCR...\n")
         
     | 
| 
      
 437 
     | 
    
         
            +
             
     | 
| 
      
 438 
     | 
    
         
            +
                                window_rect = main_window.rectangle()
         
     | 
| 
      
 439 
     | 
    
         
            +
                                screenshot = pyautogui.screenshot(
         
     | 
| 
      
 440 
     | 
    
         
            +
                                    region=(
         
     | 
| 
      
 441 
     | 
    
         
            +
                                        window_rect.left,
         
     | 
| 
      
 442 
     | 
    
         
            +
                                        window_rect.top,
         
     | 
| 
      
 443 
     | 
    
         
            +
                                        window_rect.width(),
         
     | 
| 
      
 444 
     | 
    
         
            +
                                        window_rect.height(),
         
     | 
| 
      
 445 
     | 
    
         
            +
                                    )
         
     | 
| 
       443 
446 
     | 
    
         
             
                                )
         
     | 
| 
       444 
     | 
    
         
            -
             
     | 
| 
       445 
     | 
    
         
            -
             
     | 
| 
       446 
     | 
    
         
            -
             
     | 
| 
       447 
     | 
    
         
            -
             
     | 
| 
       448 
     | 
    
         
            -
                            console.print(f"Print salvo em {path_to_png}...\n")
         
     | 
| 
      
 447 
     | 
    
         
            +
                                username = getpass.getuser()
         
     | 
| 
      
 448 
     | 
    
         
            +
                                path_to_png = f"C:\\Users\\{username}\\Downloads\\information_popup_{nota.get("nfe")}.png"
         
     | 
| 
      
 449 
     | 
    
         
            +
                                screenshot.save(path_to_png)
         
     | 
| 
      
 450 
     | 
    
         
            +
                                console.print(f"Print salvo em {path_to_png}...\n")
         
     | 
| 
       449 
451 
     | 
    
         | 
| 
       450 
     | 
    
         
            -
             
     | 
| 
       451 
     | 
    
         
            -
             
     | 
| 
       452 
     | 
    
         
            -
                            )
         
     | 
| 
       453 
     | 
    
         
            -
                            image = Image.open(path_to_png)
         
     | 
| 
       454 
     | 
    
         
            -
                            image = image.convert("L")
         
     | 
| 
       455 
     | 
    
         
            -
                            enhancer = ImageEnhance.Contrast(image)
         
     | 
| 
       456 
     | 
    
         
            -
                            image = enhancer.enhance(2.0)
         
     | 
| 
       457 
     | 
    
         
            -
                            image.save(path_to_png)
         
     | 
| 
       458 
     | 
    
         
            -
                            console.print(f"Imagem preparada com sucesso...\n")
         
     | 
| 
       459 
     | 
    
         
            -
                            console.print(f"Realizando OCR...\n")
         
     | 
| 
       460 
     | 
    
         
            -
                            captured_text = pytesseract.image_to_string(Image.open(path_to_png))
         
     | 
| 
       461 
     | 
    
         
            -
                            console.print(
         
     | 
| 
       462 
     | 
    
         
            -
                                f"Texto Full capturado {captured_text}...\n"
         
     | 
| 
       463 
     | 
    
         
            -
                            )
         
     | 
| 
       464 
     | 
    
         
            -
                            os.remove(path_to_png)
         
     | 
| 
       465 
     | 
    
         
            -
                            if 'nota fiscal inc' in captured_text.lower():
         
     | 
| 
       466 
     | 
    
         
            -
                                console.print(f"Tentando clicar no Botão OK...\n")
         
     | 
| 
       467 
     | 
    
         
            -
                                btn_ok = main_window.child_window(class_name="TButton")
         
     | 
| 
       468 
     | 
    
         
            -
             
     | 
| 
       469 
     | 
    
         
            -
                                if btn_ok.exists():
         
     | 
| 
       470 
     | 
    
         
            -
                                    btn_ok.click()
         
     | 
| 
       471 
     | 
    
         
            -
                                    retorno = True
         
     | 
| 
       472 
     | 
    
         
            -
                            else:
         
     | 
| 
       473 
     | 
    
         
            -
                                return RpaRetornoProcessoDTO(
         
     | 
| 
       474 
     | 
    
         
            -
                                    sucesso=False,
         
     | 
| 
       475 
     | 
    
         
            -
                                    retorno=f"Pop_up Informantion não mapeado para andamento do robô, mensagem {captured_text}",
         
     | 
| 
       476 
     | 
    
         
            -
                                    status=RpaHistoricoStatusEnum.Falha,
         
     | 
| 
      
 452 
     | 
    
         
            +
                                console.print(
         
     | 
| 
      
 453 
     | 
    
         
            +
                                    f"Preparando a imagem para maior resolução e assertividade no OCR...\n"
         
     | 
| 
       477 
454 
     | 
    
         
             
                                )
         
     | 
| 
       478 
     | 
    
         
            -
             
     | 
| 
       479 
     | 
    
         
            -
             
     | 
| 
       480 
     | 
    
         
            -
             
     | 
| 
      
 455 
     | 
    
         
            +
                                image = Image.open(path_to_png)
         
     | 
| 
      
 456 
     | 
    
         
            +
                                image = image.convert("L")
         
     | 
| 
      
 457 
     | 
    
         
            +
                                enhancer = ImageEnhance.Contrast(image)
         
     | 
| 
      
 458 
     | 
    
         
            +
                                image = enhancer.enhance(2.0)
         
     | 
| 
      
 459 
     | 
    
         
            +
                                image.save(path_to_png)
         
     | 
| 
      
 460 
     | 
    
         
            +
                                console.print(f"Imagem preparada com sucesso...\n")
         
     | 
| 
      
 461 
     | 
    
         
            +
                                console.print(f"Realizando OCR...\n")
         
     | 
| 
      
 462 
     | 
    
         
            +
                                captured_text = pytesseract.image_to_string(Image.open(path_to_png))
         
     | 
| 
      
 463 
     | 
    
         
            +
                                console.print(
         
     | 
| 
      
 464 
     | 
    
         
            +
                                    f"Texto Full capturado {captured_text}...\n"
         
     | 
| 
      
 465 
     | 
    
         
            +
                                )
         
     | 
| 
      
 466 
     | 
    
         
            +
                                os.remove(path_to_png)
         
     | 
| 
      
 467 
     | 
    
         
            +
                                if 'nota fiscal inc' in captured_text.lower():
         
     | 
| 
      
 468 
     | 
    
         
            +
                                    console.print(f"Tentando clicar no Botão OK...\n")
         
     | 
| 
      
 469 
     | 
    
         
            +
                                    btn_ok = main_window.child_window(class_name="TButton")
         
     | 
| 
      
 470 
     | 
    
         
            +
             
     | 
| 
      
 471 
     | 
    
         
            +
                                    if btn_ok.exists():
         
     | 
| 
      
 472 
     | 
    
         
            +
                                        btn_ok.click()
         
     | 
| 
      
 473 
     | 
    
         
            +
                                        retorno = True
         
     | 
| 
      
 474 
     | 
    
         
            +
                                else:
         
     | 
| 
      
 475 
     | 
    
         
            +
                                    return RpaRetornoProcessoDTO(
         
     | 
| 
      
 476 
     | 
    
         
            +
                                        sucesso=False,
         
     | 
| 
      
 477 
     | 
    
         
            +
                                        retorno=f"Pop_up Informantion não mapeado para andamento do robô, mensagem {captured_text}",
         
     | 
| 
      
 478 
     | 
    
         
            +
                                        status=RpaHistoricoStatusEnum.Falha,
         
     | 
| 
      
 479 
     | 
    
         
            +
                                    )
         
     | 
| 
      
 480 
     | 
    
         
            +
                            else:
         
     | 
| 
      
 481 
     | 
    
         
            +
                                console.print(f"Aba Information não encontrada")
         
     | 
| 
      
 482 
     | 
    
         
            +
                                retorno = await verify_nf_incuded()
         
     | 
| 
       481 
483 
     | 
    
         | 
| 
       482 
484 
     | 
    
         
             
                    except Exception as e:
         
     | 
| 
       483 
485 
     | 
    
         
             
                        console.print(f"Erro ao conectar à janela Information: {e}\n")
         
     | 
| 
         @@ -198,8 +198,7 @@ class EMSys: 
     | 
|
| 
       198 
198 
     | 
    
         
             
                                await worker_sleep(1)
         
     | 
| 
       199 
199 
     | 
    
         
             
                                pyautogui.click(1180, 776)
         
     | 
| 
       200 
200 
     | 
    
         
             
                                await worker_sleep(1)
         
     | 
| 
       201 
     | 
    
         
            -
                                 
     | 
| 
       202 
     | 
    
         
            -
                                await worker_sleep(1)
         
     | 
| 
      
 201 
     | 
    
         
            +
                                await self.click_itens_da_nota()
         
     | 
| 
       203 
202 
     | 
    
         | 
| 
       204 
203 
     | 
    
         
             
                                # Fecha a janela de alteração de item
         
     | 
| 
       205 
204 
     | 
    
         
             
                                # try:
         
     | 
| 
         @@ -207,7 +206,7 @@ class EMSys: 
     | 
|
| 
       207 
206 
     | 
    
         
             
                                #     console.print("Apertando [ESC]", style="bold blue")
         
     | 
| 
       208 
207 
     | 
    
         
             
                                # except Exception as e:
         
     | 
| 
       209 
208 
     | 
    
         
             
                                #     console.print(f"Erro ao cancelar edição de item: {e}", style="bold red")
         
     | 
| 
       210 
     | 
    
         
            -
                                await worker_sleep(3)
         
     | 
| 
      
 209 
     | 
    
         
            +
                                # await worker_sleep(3)
         
     | 
| 
       211 
210 
     | 
    
         | 
| 
       212 
211 
     | 
    
         
             
                            index_item_atual += 1
         
     | 
| 
       213 
212 
     | 
    
         
             
                            console.print(f"Item aual no final da execução: {index_item_atual}")
         
     | 
| 
         @@ -226,7 +225,21 @@ class EMSys: 
     | 
|
| 
       226 
225 
     | 
    
         
             
                    await worker_sleep(2)
         
     | 
| 
       227 
226 
     | 
    
         | 
| 
       228 
227 
     | 
    
         
             
                async def select_tipo_cobranca(self):
         
     | 
| 
       229 
     | 
    
         
            -
                     
     | 
| 
      
 228 
     | 
    
         
            +
                    # await worker_sleep(3)
         
     | 
| 
      
 229 
     | 
    
         
            +
                    # pyautogui.click(632, 384)
         
     | 
| 
      
 230 
     | 
    
         
            +
                    
         
     | 
| 
      
 231 
     | 
    
         
            +
                    console.print("Navegando pela Janela de Nota Fiscal de Entrada...\n")
         
     | 
| 
      
 232 
     | 
    
         
            +
                    app = Application().connect(class_name="TFrmNotaFiscalEntrada")
         
     | 
| 
      
 233 
     | 
    
         
            +
                    main_window = app["TFrmNotaFiscalEntrada"]
         
     | 
| 
      
 234 
     | 
    
         
            +
             
     | 
| 
      
 235 
     | 
    
         
            +
                    main_window.set_focus()
         
     | 
| 
      
 236 
     | 
    
         
            +
                    console.print("Acessando a aba de Pagamentos... \n")
         
     | 
| 
      
 237 
     | 
    
         
            +
                    panel_TPage = main_window.child_window(class_name="TPage", title="Formulario")
         
     | 
| 
      
 238 
     | 
    
         
            +
                    panel_TTabSheet = panel_TPage.child_window(class_name="TcxCustomInnerTreeView")
         
     | 
| 
      
 239 
     | 
    
         
            +
                    panel_TTabSheet.wait("visible")
         
     | 
| 
      
 240 
     | 
    
         
            +
                    panel_TTabSheet.click()
         
     | 
| 
      
 241 
     | 
    
         
            +
                    send_keys("{DOWN " + ("2") + "}")
         
     | 
| 
      
 242 
     | 
    
         
            +
                    
         
     | 
| 
       230 
243 
     | 
    
         
             
                    await worker_sleep(2)
         
     | 
| 
       231 
244 
     | 
    
         
             
                    pyautogui.click(893, 549)
         
     | 
| 
       232 
245 
     | 
    
         
             
                    await worker_sleep(5)
         
     | 
| 
         @@ -40,7 +40,7 @@ worker_automate_hub/tasks/jobs/ecac_estadual_sc.py,sha256=ZTjc4rS8J7VfWHPFLkJBcS 
     | 
|
| 
       40 
40 
     | 
    
         
             
            worker_automate_hub/tasks/jobs/ecac_estadual_sp.py,sha256=iS6za_nGCzBRVCXYYuUTIyMWJznHp8l6BPahqwzc_5c,29102
         
     | 
| 
       41 
41 
     | 
    
         
             
            worker_automate_hub/tasks/jobs/ecac_federal.py,sha256=ORQbA4DCfyHJqjfvOCenc97QHvBCBlA3oMSzl59K6vg,55316
         
     | 
| 
       42 
42 
     | 
    
         
             
            worker_automate_hub/tasks/jobs/entrada_de_notas_15.py,sha256=5Rqz_kf-399nEA3s1_69MGOAn6Mk0GbdAP_0EFzAcYw,16570
         
     | 
| 
       43 
     | 
    
         
            -
            worker_automate_hub/tasks/jobs/entrada_de_notas_16.py,sha256= 
     | 
| 
      
 43 
     | 
    
         
            +
            worker_automate_hub/tasks/jobs/entrada_de_notas_16.py,sha256=X4Hv2oWeIrD5eljIBtx_9lJWgpTV8dBx2BPTbRJbNc4,19917
         
     | 
| 
       44 
44 
     | 
    
         
             
            worker_automate_hub/tasks/jobs/entrada_de_notas_207.py,sha256=TfvGmH1__OGRx5oYordEJt-gpcETKA9OFhwHQD3yqs4,24928
         
     | 
| 
       45 
45 
     | 
    
         
             
            worker_automate_hub/tasks/jobs/entrada_de_notas_32.py,sha256=l8mAm_OIY2cg_ThdCUqlq9NYbIYJuiK6wVsarStRfG8,32487
         
     | 
| 
       46 
46 
     | 
    
         
             
            worker_automate_hub/tasks/jobs/entrada_de_notas_33.py,sha256=ktXc_kdMhlz9cbb7XjfMJhME29mgMFd_FnatxSZZU_s,31457
         
     | 
| 
         @@ -67,9 +67,9 @@ worker_automate_hub/utils/logger.py,sha256=FYV9fg0_RAYJF_ZOCJEbqQAiCXlXk2gMpvUU1 
     | 
|
| 
       67 
67 
     | 
    
         
             
            worker_automate_hub/utils/toast.py,sha256=xPHc5r5uOxB_cZlCzm13Kt2qSKLLFZALncU6Qg3Ft68,1162
         
     | 
| 
       68 
68 
     | 
    
         
             
            worker_automate_hub/utils/updater.py,sha256=en2FCGhI8aZ-JNP3LQm64NJDc4awCNW7UhbVlwDl49Y,7972
         
     | 
| 
       69 
69 
     | 
    
         
             
            worker_automate_hub/utils/util.py,sha256=SWpivcmtSH-4RVwjupyyE8wpRcuFlOlGq3_Z29gvUPM,121845
         
     | 
| 
       70 
     | 
    
         
            -
            worker_automate_hub/utils/utils_nfe_entrada.py,sha256= 
     | 
| 
      
 70 
     | 
    
         
            +
            worker_automate_hub/utils/utils_nfe_entrada.py,sha256=p5r_L5k7gqCBvV8v6dbLFM6INKiSpGc4Gegid0_YAh4,29017
         
     | 
| 
       71 
71 
     | 
    
         
             
            worker_automate_hub/worker.py,sha256=tftQpX8liC-_0_bOUf1YYzXSCvloMQBvjmQ6lzfEE-c,4816
         
     | 
| 
       72 
     | 
    
         
            -
            worker_automate_hub-0.4. 
     | 
| 
       73 
     | 
    
         
            -
            worker_automate_hub-0.4. 
     | 
| 
       74 
     | 
    
         
            -
            worker_automate_hub-0.4. 
     | 
| 
       75 
     | 
    
         
            -
            worker_automate_hub-0.4. 
     | 
| 
      
 72 
     | 
    
         
            +
            worker_automate_hub-0.4.444.dist-info/entry_points.txt,sha256=sddyhjx57I08RY8X7UxcTpdoOsWULAWNKN9Xr6pp_Kw,54
         
     | 
| 
      
 73 
     | 
    
         
            +
            worker_automate_hub-0.4.444.dist-info/METADATA,sha256=Nkf-St86T0ceB92JDNaFnHeiitM5Y0U2hpgcy2xBq2A,2895
         
     | 
| 
      
 74 
     | 
    
         
            +
            worker_automate_hub-0.4.444.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
         
     | 
| 
      
 75 
     | 
    
         
            +
            worker_automate_hub-0.4.444.dist-info/RECORD,,
         
     | 
| 
         
            File without changes
         
     | 
    
        {worker_automate_hub-0.4.443.dist-info → worker_automate_hub-0.4.444.dist-info}/entry_points.txt
    RENAMED
    
    | 
         
            File without changes
         
     |