worker-automate-hub 0.5.34__py3-none-any.whl → 0.5.36__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.
@@ -1126,86 +1126,93 @@ async def get_xml(xml_file: str) -> None:
1126
1126
  - None
1127
1127
  """
1128
1128
 
1129
- console.print("Verificando a existencia da tela de importação do XML... \n")
1130
- app = Application().connect(title="Selecione a forma de obter o XML da NF-e")
1131
- main_window = app["Selecione a forma de obter o XML da NF-e"]
1129
+ try:
1130
+ console.print("Verificando a existencia da tela de importação do XML... \n")
1131
+ app = Application().connect(title="Selecione a forma de obter o XML da NF-e")
1132
+ main_window = app["Selecione a forma de obter o XML da NF-e"]
1132
1133
 
1133
- # Verificando se a janela principal existe
1134
- if main_window.exists():
1135
- console.print("Janela principal encontrada com sucesso... \n")
1136
- else:
1137
- raise Exception("Janela principal de importação do XML não foi encontrada.")
1134
+ # Verificando se a janela principal existe
1135
+ if main_window.exists():
1136
+ console.print("Janela principal encontrada com sucesso... \n")
1137
+ else:
1138
+ raise Exception("Janela principal de importação do XML não foi encontrada.")
1138
1139
 
1139
- console.print("Selecionando Arquivo XML para seguir com a importação... \n")
1140
- arquivo_xml_button = main_window.child_window(title="Arquivo XML")
1141
- if arquivo_xml_button.exists() and arquivo_xml_button.is_enabled():
1142
- arquivo_xml_button.click()
1143
- console.print("Arquivo XML selecionado com sucesso... \n")
1144
- else:
1145
- raise Exception("Botão Arquivo XML não foi encontrado.")
1140
+ console.print("Selecionando Arquivo XML para seguir com a importação... \n")
1141
+ arquivo_xml_button = main_window.child_window(title="Arquivo XML")
1142
+ if arquivo_xml_button.exists() and arquivo_xml_button.is_enabled():
1143
+ arquivo_xml_button.click()
1144
+ console.print("Arquivo XML selecionado com sucesso... \n")
1145
+ else:
1146
+ raise Exception("Botão Arquivo XML não foi encontrado.")
1146
1147
 
1147
- await worker_sleep(3)
1148
+ await worker_sleep(3)
1148
1149
 
1149
- console.print("Verificando se o botão OK existe ... \n")
1150
- ok_button = main_window.child_window(title="OK", class_name="TBitBtn")
1151
- if ok_button.exists() and ok_button.is_enabled():
1152
- max_attempts = 3
1153
- i = 0
1154
- while i < max_attempts:
1155
- console.print("Clicando em OK... \n")
1156
- try:
1157
- ok_button.click()
1158
- console.print("Botão OK clicado com sucesso... \n")
1159
- except:
1160
- console.print("Não foi possivel clicar no Botão OK... \n")
1150
+ console.print("Verificando se o botão OK existe ... \n")
1151
+ ok_button = main_window.child_window(title="OK", class_name="TBitBtn")
1152
+ if ok_button.exists() and ok_button.is_enabled():
1153
+ max_attempts = 3
1154
+ i = 0
1155
+ while i < max_attempts:
1156
+ console.print("Clicando em OK... \n")
1157
+ try:
1158
+ ok_button.click()
1159
+ console.print("Botão OK clicado com sucesso... \n")
1160
+ except:
1161
+ console.print("Não foi possivel clicar no Botão OK... \n")
1161
1162
 
1162
- await worker_sleep(3)
1163
+ await worker_sleep(3)
1163
1164
 
1164
- console.print("Verificando a existência da tela para importar o XML...\n")
1165
- try:
1166
- app = Application().connect(title="Abrir")
1167
- main_window = app["Abrir"]
1168
- console.print("A tela de importação foi encontrada!")
1169
- break
1170
- except Exception as e:
1171
- console.print(
1172
- f"Tela de importação não encontrada. Tentativa {i + 1}/{max_attempts}."
1173
- )
1165
+ console.print("Verificando a existência da tela para importar o XML...\n")
1166
+ try:
1167
+ app = Application().connect(title="Abrir")
1168
+ main_window = app["Abrir"]
1169
+ console.print("A tela de importação foi encontrada!")
1170
+ break
1171
+ except Exception as e:
1172
+ console.print(
1173
+ f"Tela de importação não encontrada. Tentativa {i + 1}/{max_attempts}."
1174
+ )
1174
1175
 
1175
- i += 1
1176
+ i += 1
1176
1177
 
1177
- if i == max_attempts:
1178
- raise Exception(
1179
- "Número máximo de tentativas atingido. A tela para importar o XML não foi encontrada."
1180
- )
1178
+ if i == max_attempts:
1179
+ raise Exception(
1180
+ "Número máximo de tentativas atingido. A tela para importar o XML não foi encontrada."
1181
+ )
1181
1182
 
1182
- else:
1183
- raise Exception("Botão OK não foi encontrado.")
1183
+ else:
1184
+ raise Exception("Botão OK não foi encontrado.")
1184
1185
 
1185
- await worker_sleep(10)
1186
+ await worker_sleep(10)
1186
1187
 
1187
- console.print("Conectando na tela de importação do XML...\n")
1188
- app = Application().connect(title="Abrir")
1189
- main_window = app["Abrir"]
1188
+ console.print("Conectando na tela de importação do XML...\n")
1189
+ app = Application().connect(title="Abrir")
1190
+ main_window = app["Abrir"]
1190
1191
 
1191
- # Verificando se a janela principal existe
1192
- if main_window.exists():
1193
- console.print("Janela para importar o xml encontrada com sucesso... \n")
1194
- else:
1195
- raise Exception("Janela para importar o xml não foi encontrada.")
1196
-
1197
- console.print("Carregando informações do XML a ser importado...\n")
1198
- username = getpass.getuser()
1199
- xml_name = f"{xml_file}.xml"
1200
- path_to_xml = f"C:\\Users\\{username}\\Downloads\\{xml_name}"
1201
- console.print("Inserindo caminho do XML...\n")
1202
- main_window.type_keys("%n")
1203
- await worker_sleep(2)
1204
- pyautogui.write(path_to_xml)
1205
- await worker_sleep(2)
1206
- main_window.type_keys("%a")
1207
- await worker_sleep(2)
1192
+ # Verificando se a janela principal existe
1193
+ if main_window.exists():
1194
+ console.print("Janela para importar o xml encontrada com sucesso... \n")
1195
+ else:
1196
+ raise Exception("Janela para importar o xml não foi encontrada.")
1208
1197
 
1198
+ console.print("Carregando informações do XML a ser importado...\n")
1199
+ username = getpass.getuser()
1200
+ xml_name = f"{xml_file}.xml"
1201
+ path_to_xml = f"C:\\Users\\{username}\\Downloads\\{xml_name}"
1202
+ console.print("Inserindo caminho do XML...\n")
1203
+ main_window.type_keys("%n")
1204
+ await worker_sleep(2)
1205
+ pyautogui.write(path_to_xml)
1206
+ await worker_sleep(2)
1207
+ main_window.type_keys("%a")
1208
+ await worker_sleep(2)
1209
+ except Exception as error:
1210
+ return RpaRetornoProcessoDTO(
1211
+ sucesso=False,
1212
+ retorno=f"Erro ao obter XML: {error}",
1213
+ status=RpaHistoricoStatusEnum.Falha,
1214
+ tags=[RpaTagDTO(descricao=RpaTagEnum.Tecnico)]
1215
+ )
1209
1216
 
1210
1217
  async def delete_xml(nfe_key: str) -> None:
1211
1218
  """
@@ -2404,11 +2411,18 @@ async def error_after_xml_imported() -> RpaRetornoProcessoDTO:
2404
2411
 
2405
2412
  status=RpaHistoricoStatusEnum.Falha, tags=[RpaTagDTO(descricao=RpaTagEnum.Tecnico)]
2406
2413
  )
2414
+ elif "ja lancada" in control_text:
2415
+ return RpaRetornoProcessoDTO(
2416
+ sucesso=False,
2417
+ retorno=f"Pop-up nota incluida encontrada, porém nota encontrada como 'já lançada' trazendo as seguintes informações: {control_text}",
2418
+ status=RpaHistoricoStatusEnum.Falha,
2419
+ tags=[RpaTagDTO(descricao=RpaTagEnum.Negocio)]
2420
+ )
2407
2421
  else:
2408
2422
  return RpaRetornoProcessoDTO(
2409
2423
  sucesso=False,
2410
2424
  retorno=f"Erro do banco de dados: {control_text} \n",
2411
- status=RpaHistoricoStatusEnum.Falha, tags=[RpaTagDTO(descricao=RpaTagEnum.Negocio)]
2425
+ status=RpaHistoricoStatusEnum.Falha, tags=[RpaTagDTO(descricao=RpaTagEnum.Tecnico)]
2412
2426
  )
2413
2427
 
2414
2428
  elif "XML já foi importado anteriormente" in control_text:
@@ -2424,7 +2438,7 @@ async def error_after_xml_imported() -> RpaRetornoProcessoDTO:
2424
2438
  retorno=f"Nota descartada: {control_text}... \n",
2425
2439
  status=RpaHistoricoStatusEnum.Descartado,
2426
2440
  )
2427
-
2441
+
2428
2442
 
2429
2443
  async def error_before_persist_record() -> RpaRetornoProcessoDTO:
2430
2444
  try:
@@ -627,15 +627,22 @@ class EMSys:
627
627
  )
628
628
 
629
629
  async def get_xml(self, xml_file):
630
- username = getpass.getuser()
631
- xml_name = f"{xml_file}.xml"
632
- path_to_xml = f"C:\\Users\\{username}\\Downloads\\{xml_name}"
633
- pyautogui.click(722, 792)
634
- await worker_sleep(2)
635
- pyautogui.write(path_to_xml)
636
- await worker_sleep(2)
637
- pyautogui.hotkey("enter")
638
- await worker_sleep(2)
630
+ try:
631
+ username = getpass.getuser()
632
+ xml_name = f"{xml_file}.xml"
633
+ path_to_xml = f"C:\\Users\\{username}\\Downloads\\{xml_name}"
634
+ pyautogui.click(722, 792)
635
+ await worker_sleep(2)
636
+ pyautogui.write(path_to_xml)
637
+ await worker_sleep(2)
638
+ pyautogui.hotkey("enter")
639
+ await worker_sleep(2)
640
+ except Exception as error:
641
+ return RpaRetornoProcessoDTO(
642
+ sucesso=False,
643
+ retorno=f"O xml {xml_name} não foi encontrado em {path_to_xml}",
644
+ status=RpaHistoricoStatusEnum.Falha, tags=[RpaTagDTO(descricao=RpaTagEnum.Tecnico)]
645
+ )
639
646
 
640
647
  async def delete_xml(self, nfe_key: str) -> None:
641
648
  """
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: worker-automate-hub
3
- Version: 0.5.34
3
+ Version: 0.5.36
4
4
  Summary: Worker Automate HUB é uma aplicação para automatizar rotinas de RPA nos ambientes Argenta.
5
5
  Author: Joel Paim
6
6
  Requires-Python: >=3.12,<4.0
@@ -72,10 +72,10 @@ worker_automate_hub/utils/get_creds_gworkspace.py,sha256=ZJ0IIEjM4IXIV9rwfbOZ1V1
72
72
  worker_automate_hub/utils/logger.py,sha256=FYV9fg0_RAYJF_ZOCJEbqQAiCXlXk2gMpvUU1rzT_xs,671
73
73
  worker_automate_hub/utils/toast.py,sha256=xPHc5r5uOxB_cZlCzm13Kt2qSKLLFZALncU6Qg3Ft68,1162
74
74
  worker_automate_hub/utils/updater.py,sha256=en2FCGhI8aZ-JNP3LQm64NJDc4awCNW7UhbVlwDl49Y,7972
75
- worker_automate_hub/utils/util.py,sha256=edMz-FlsMhzubxZuI1rp6C29TWQmYdyUoAzEJWgI_R8,129994
76
- worker_automate_hub/utils/utils_nfe_entrada.py,sha256=UfzkgCDjZD-DGkViizpciCkFI2NfWuwRXQsfmt7x6dU,31502
75
+ worker_automate_hub/utils/util.py,sha256=famjVaoCDHLUoULQIGvqpVDu9gQihOLH2Nv1kCTsSqc,130967
76
+ worker_automate_hub/utils/utils_nfe_entrada.py,sha256=ZTb1XoKWZY7coXt06iIE8KI56N6AguhZv5DEPX2qUu8,31862
77
77
  worker_automate_hub/worker.py,sha256=CT-poyP1ZYvubArYsnnNd9oJ53SPaDwgr6p6keS3nI4,6248
78
- worker_automate_hub-0.5.34.dist-info/entry_points.txt,sha256=sddyhjx57I08RY8X7UxcTpdoOsWULAWNKN9Xr6pp_Kw,54
79
- worker_automate_hub-0.5.34.dist-info/METADATA,sha256=mkIOYJb9pmXkdv5XVmET1DyJBkchh97hIVch5P9QRlI,2894
80
- worker_automate_hub-0.5.34.dist-info/WHEEL,sha256=RaoafKOydTQ7I_I3JTrPCg6kUmTgtm4BornzOqyEfJ8,88
81
- worker_automate_hub-0.5.34.dist-info/RECORD,,
78
+ worker_automate_hub-0.5.36.dist-info/entry_points.txt,sha256=sddyhjx57I08RY8X7UxcTpdoOsWULAWNKN9Xr6pp_Kw,54
79
+ worker_automate_hub-0.5.36.dist-info/METADATA,sha256=ew4_v2H0gKlSryBxMIZX5fjeBWy_Ipc4dpIeWtF3BV0,2894
80
+ worker_automate_hub-0.5.36.dist-info/WHEEL,sha256=RaoafKOydTQ7I_I3JTrPCg6kUmTgtm4BornzOqyEfJ8,88
81
+ worker_automate_hub-0.5.36.dist-info/RECORD,,