worker-automate-hub 0.5.622__py3-none-any.whl → 0.5.623__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/devolucao_prazo_a_faturar.py +487 -247
- {worker_automate_hub-0.5.622.dist-info → worker_automate_hub-0.5.623.dist-info}/METADATA +1 -1
- {worker_automate_hub-0.5.622.dist-info → worker_automate_hub-0.5.623.dist-info}/RECORD +5 -5
- {worker_automate_hub-0.5.622.dist-info → worker_automate_hub-0.5.623.dist-info}/WHEEL +0 -0
- {worker_automate_hub-0.5.622.dist-info → worker_automate_hub-0.5.623.dist-info}/entry_points.txt +0 -0
@@ -43,6 +43,7 @@ from worker_automate_hub.utils.util import (
|
|
43
43
|
nf_busca_nf_saida,
|
44
44
|
pessoas_ativa_cliente_fornecedor,
|
45
45
|
nf_devolucao_liquidar_cupom,
|
46
|
+
status_trasmissao,
|
46
47
|
gerenciador_nf_header,
|
47
48
|
cadastro_pre_venda_header,
|
48
49
|
incluir_registro,
|
@@ -318,11 +319,20 @@ async def devolucao_prazo_a_faturar(task: RpaProcessoEntradaDTO) -> RpaRetornoPr
|
|
318
319
|
console.print("INSERINDO CODIGO DO FORNECEDOR ...\n")
|
319
320
|
field_fornecedor = main_window.child_window(class_name="TDBIEditCode", found_index=0)
|
320
321
|
field_fornecedor.click()
|
321
|
-
|
322
|
+
|
323
|
+
if cod_cliente_incorreto != "140552":
|
324
|
+
field_fornecedor.set_edit_text(cod_cliente_incorreto)
|
325
|
+
else:
|
326
|
+
field_fornecedor.set_edit_text(cod_empresa)
|
322
327
|
field_fornecedor.click()
|
323
328
|
pyautogui.press("tab")
|
324
329
|
await worker_sleep(2)
|
325
330
|
|
331
|
+
|
332
|
+
itens = nota.get('itens', [])
|
333
|
+
itens_arla = [item for item in itens if item['descricao'].lower() == 'arla']
|
334
|
+
|
335
|
+
|
326
336
|
#SELECIONAO A NOP
|
327
337
|
console.print("SELECIONAO A NOP...\n")
|
328
338
|
select_box_nop_select = main_window.child_window(class_name="TDBIComboBox", found_index=0)
|
@@ -331,20 +341,17 @@ async def devolucao_prazo_a_faturar(task: RpaProcessoEntradaDTO) -> RpaRetornoPr
|
|
331
341
|
itens_to_select = select_box_nop_select.texts()
|
332
342
|
nop_to_be_select = ''
|
333
343
|
|
334
|
-
|
335
|
-
if '2662' in item and (('c finan' in item.lower() or 'cfinan' in item.lower()) and ('s est' in item.lower() or 'sest' in item.lower())):
|
336
|
-
nop_to_be_select = item
|
337
|
-
break
|
338
|
-
|
339
|
-
if nop_to_be_select == '':
|
344
|
+
if len(itens_arla) == len(itens):
|
340
345
|
for item in itens_to_select:
|
341
|
-
if '
|
346
|
+
if ('1202' in item and ('s/ est' in item.lower() or 's/est' in item.lower()) and ('c/ fin' in item.lower() or 'c/fin' in item.lower())):
|
342
347
|
nop_to_be_select = item
|
343
348
|
break
|
344
|
-
|
345
|
-
|
349
|
+
elif '2202' in item and (('s/ est' in item.lower() or 's/est' in item.lower()) and ('c/ fin' in item.lower() or 'c/fin' in item.lower())):
|
350
|
+
nop_to_be_select = item
|
351
|
+
break
|
352
|
+
else:
|
346
353
|
for item in itens_to_select:
|
347
|
-
if '
|
354
|
+
if '1662' in item and (('c/fi' in item.lower() or 'c /fi' in item.lower())):
|
348
355
|
nop_to_be_select = item
|
349
356
|
break
|
350
357
|
|
@@ -913,7 +920,12 @@ async def devolucao_prazo_a_faturar(task: RpaProcessoEntradaDTO) -> RpaRetornoPr
|
|
913
920
|
pesquisar_venda_devolucao = await is_window_open_by_class("TFrmGerenciadorNFe2", "TFrmGerenciadorNFe2")
|
914
921
|
if pesquisar_venda_devolucao["IsOpened"] == True:
|
915
922
|
console.print(f"\n'Gerenciador de Notas Fiscais'aberta com sucesso",style="bold green")
|
916
|
-
|
923
|
+
|
924
|
+
if cod_cliente_incorreto != "140552":
|
925
|
+
selecionar_itens_gerenciador_nfe = await gerenciador_nf_header(data_hoje, cod_cliente_incorreto)
|
926
|
+
else:
|
927
|
+
selecionar_itens_gerenciador_nfe = await gerenciador_nf_header(data_hoje, cod_empresa)
|
928
|
+
|
917
929
|
if selecionar_itens_gerenciador_nfe.sucesso:
|
918
930
|
console.print("PROCESSO EXECUTADO COM SUCESSO, SEGUINDO COM O PROCESSO PARA TRANSMITIR A NF-E...\n")
|
919
931
|
app = Application().connect(class_name="TFrmGerenciadorNFe2", timeout=10)
|
@@ -1069,15 +1081,258 @@ async def devolucao_prazo_a_faturar(task: RpaProcessoEntradaDTO) -> RpaRetornoPr
|
|
1069
1081
|
tags=[RpaTagDTO(descricao=RpaTagEnum.Tecnico)]
|
1070
1082
|
)
|
1071
1083
|
else:
|
1072
|
-
|
1073
|
-
|
1074
|
-
|
1075
|
-
|
1076
|
-
|
1077
|
-
|
1078
|
-
|
1079
|
-
|
1080
|
-
|
1084
|
+
else:
|
1085
|
+
x = 0
|
1086
|
+
while x <= 2:
|
1087
|
+
app = Application().connect(class_name="TFrmGerenciadorNFe2")
|
1088
|
+
main_window = app["TFrmGerenciadorNFe2"]
|
1089
|
+
main_window.close()
|
1090
|
+
await worker_sleep(3)
|
1091
|
+
|
1092
|
+
|
1093
|
+
type_text_into_field("Gerenciador de Notas Fiscais", app["TFrmMenuPrincipal"]["Edit"], True, "50")
|
1094
|
+
pyautogui.press("enter")
|
1095
|
+
await worker_sleep(2)
|
1096
|
+
pyautogui.press("enter")
|
1097
|
+
await worker_sleep(5)
|
1098
|
+
console.print(f"\nPesquisa: 'Gerenciador de Notas Fiscais' realizada com sucesso",style="bold green")
|
1099
|
+
pesquisar_venda_devolucao = await is_window_open_by_class("TFrmGerenciadorNFe2", "TFrmGerenciadorNFe2")
|
1100
|
+
if pesquisar_venda_devolucao["IsOpened"] == True:
|
1101
|
+
console.print(f"\n'Gerenciador de Notas Fiscais'aberta com sucesso",style="bold green")
|
1102
|
+
selecionar_itens_gerenciador_nfe = await gerenciador_nf_header_retransmissao(data_hoje, cod_cliente_incorreto, "Rejeitada")
|
1103
|
+
if selecionar_itens_gerenciador_nfe.sucesso:
|
1104
|
+
console.print("PROCESSO EXECUTADO COM SUCESSO, SEGUINDO COM O PROCESSO PARA TRANSMITIR A NF-E...\n")
|
1105
|
+
app = Application().connect(class_name="TFrmGerenciadorNFe2", timeout=10)
|
1106
|
+
main_window = app["TFrmGerenciadorNFe2"]
|
1107
|
+
main_window.set_focus()
|
1108
|
+
|
1109
|
+
|
1110
|
+
console.print("Obtendo informacao da tela para o botao Transfimitir\n")
|
1111
|
+
tpanel_footer = main_window.child_window(class_name="TPanel", found_index=1)
|
1112
|
+
btn_transmitir = tpanel_footer.child_window(class_name="TBitBtn", found_index=5)
|
1113
|
+
btn_transmitir.click()
|
1114
|
+
pyautogui.click(595, 746)
|
1115
|
+
console.print("Transmitir clicado com sucesso...\n")
|
1116
|
+
await worker_sleep(3)
|
1117
|
+
|
1118
|
+
max_attempts = 15
|
1119
|
+
i = 0
|
1120
|
+
console.print("Aguardando pop de operacação concluida \n")
|
1121
|
+
while i < max_attempts:
|
1122
|
+
try:
|
1123
|
+
app = Application().connect(class_name="TFrmProcessamentoNFe2", timeout=10)
|
1124
|
+
main_window = app["TFrmProcessamentoNFe2"]
|
1125
|
+
|
1126
|
+
await worker_sleep(5)
|
1127
|
+
information_pop_up = await is_window_open_by_class("TMessageForm", "TMessageForm")
|
1128
|
+
if information_pop_up["IsOpened"] == True:
|
1129
|
+
msg_pop_up = await ocr_by_class(numero_nota_fiscal, "TMessageForm", "TMessageForm")
|
1130
|
+
if msg_pop_up.sucesso:
|
1131
|
+
if 'concl' in msg_pop_up.retorno.lower():
|
1132
|
+
try:
|
1133
|
+
information_operacao_concluida = main_window.child_window(class_name="TMessageForm")
|
1134
|
+
btn_ok = information_operacao_concluida.child_window(class_name="TButton")
|
1135
|
+
btn_ok.click()
|
1136
|
+
await worker_sleep(4)
|
1137
|
+
except:
|
1138
|
+
pyautogui.press('enter')
|
1139
|
+
await worker_sleep(4)
|
1140
|
+
finally:
|
1141
|
+
pyautogui.press('enter')
|
1142
|
+
break
|
1143
|
+
else:
|
1144
|
+
retorno = f"Pop up nao mapeado para seguimento do robo {msg_pop_up} \nEtapas Executadas:\n{steps}"
|
1145
|
+
return RpaRetornoProcessoDTO(
|
1146
|
+
sucesso=False,
|
1147
|
+
retorno=retorno,
|
1148
|
+
status=RpaHistoricoStatusEnum.Falha,
|
1149
|
+
tags=[RpaTagDTO(descricao=RpaTagEnum.Tecnico)]
|
1150
|
+
)
|
1151
|
+
else:
|
1152
|
+
retorno = f"Não foi possivel realizar a confirmação do msg do OCR \nEtapas Executadas:\n{steps}"
|
1153
|
+
return RpaRetornoProcessoDTO(
|
1154
|
+
sucesso=False,
|
1155
|
+
retorno=retorno,
|
1156
|
+
status=RpaHistoricoStatusEnum.Falha,
|
1157
|
+
tags=[RpaTagDTO(descricao=RpaTagEnum.Tecnico)]
|
1158
|
+
)
|
1159
|
+
except Exception as e:
|
1160
|
+
pass
|
1161
|
+
|
1162
|
+
|
1163
|
+
i += 1
|
1164
|
+
await worker_sleep(10)
|
1165
|
+
|
1166
|
+
|
1167
|
+
if i == max_attempts:
|
1168
|
+
console.print("Número máximo de tentativas atingido. Encerrando...")
|
1169
|
+
retorno = f"Tempo esgotado e numero de tentativas atingido, não foi possivel obter o retorno de conclusão para transmissão na tela de Gerenciador NF-e \nEtapas Executadas:\n{steps}"
|
1170
|
+
return RpaRetornoProcessoDTO(
|
1171
|
+
sucesso=False,
|
1172
|
+
retorno=retorno,
|
1173
|
+
status=RpaHistoricoStatusEnum.Falha,
|
1174
|
+
tags=[RpaTagDTO(descricao=RpaTagEnum.Tecnico)]
|
1175
|
+
)
|
1176
|
+
|
1177
|
+
|
1178
|
+
pop_up_status = await status_trasmissao()
|
1179
|
+
console.print(f"Status copiado: {pop_up_status}")
|
1180
|
+
|
1181
|
+
if "autorizado o uso da nf-e" in pop_up_status.lower():
|
1182
|
+
console.print("Sucesso ao transmitir...\n")
|
1183
|
+
app = Application().connect(class_name="TFrmProcessamentoNFe2", timeout=15)
|
1184
|
+
main_window = app["TFrmProcessamentoNFe2"]
|
1185
|
+
main_window.set_focus()
|
1186
|
+
await worker_sleep(3)
|
1187
|
+
console.print(f"Fechando tela de processamento...\n")
|
1188
|
+
fechar_tela_processamento = "assets\\emsys\\button_fechar.PNG"
|
1189
|
+
button_location = pyautogui.locateCenterOnScreen(
|
1190
|
+
fechar_tela_processamento, confidence=0.6
|
1191
|
+
)
|
1192
|
+
if button_location:
|
1193
|
+
pyautogui.click(button_location)
|
1194
|
+
console.print("Botão 'Fechar' clicado com sucesso!")
|
1195
|
+
|
1196
|
+
break
|
1197
|
+
elif 'duplicidade' in pop_up_status.lower():
|
1198
|
+
console.print("Duplicidade de NF...\n")
|
1199
|
+
app = Application().connect(class_name="TFrmProcessamentoNFe2", timeout=15)
|
1200
|
+
main_window = app["TFrmProcessamentoNFe2"]
|
1201
|
+
main_window.set_focus()
|
1202
|
+
await worker_sleep(3)
|
1203
|
+
console.print(f"Fechando tela de processamento...\n")
|
1204
|
+
fechar_tela_processamento = "assets\\emsys\\button_fechar.PNG"
|
1205
|
+
button_location = pyautogui.locateCenterOnScreen(
|
1206
|
+
fechar_tela_processamento, confidence=0.6
|
1207
|
+
)
|
1208
|
+
if button_location:
|
1209
|
+
pyautogui.click(button_location)
|
1210
|
+
console.print("Botão 'Fechar' clicado com sucesso!")
|
1211
|
+
|
1212
|
+
await worker_sleep(20)
|
1213
|
+
|
1214
|
+
try:
|
1215
|
+
app = Application().connect(class_name="TFrmGerenciadorNFe2", timeout=10)
|
1216
|
+
main_window = app["TFrmGerenciadorNFe2"]
|
1217
|
+
main_window.set_focus()
|
1218
|
+
|
1219
|
+
|
1220
|
+
console.print("Obtendo informacao da tela para o botao Transfimitir\n")
|
1221
|
+
tpanel_footer = main_window.child_window(class_name="TPanel", found_index=1)
|
1222
|
+
btn_consultar_sefaz = tpanel_footer.child_window(class_name="TBitBtn", found_index=4)
|
1223
|
+
btn_consultar_sefaz.click()
|
1224
|
+
|
1225
|
+
await worker_sleep(3)
|
1226
|
+
|
1227
|
+
max_attempts = 15
|
1228
|
+
i = 0
|
1229
|
+
console.print("Aguardando pop de operacação concluida \n")
|
1230
|
+
while i < max_attempts:
|
1231
|
+
try:
|
1232
|
+
app = Application().connect(class_name="TFrmProcessamentoNFe2", timeout=10)
|
1233
|
+
main_window = app["TFrmProcessamentoNFe2"]
|
1234
|
+
|
1235
|
+
await worker_sleep(5)
|
1236
|
+
information_pop_up = await is_window_open_by_class("TMessageForm", "TMessageForm")
|
1237
|
+
if information_pop_up["IsOpened"] == True:
|
1238
|
+
msg_pop_up = await ocr_by_class(numero_nota_fiscal, "TMessageForm", "TMessageForm")
|
1239
|
+
if msg_pop_up.sucesso:
|
1240
|
+
if 'concl' in msg_pop_up.retorno.lower():
|
1241
|
+
try:
|
1242
|
+
information_operacao_concluida = main_window.child_window(class_name="TMessageForm")
|
1243
|
+
btn_ok = information_operacao_concluida.child_window(class_name="TButton")
|
1244
|
+
btn_ok.click()
|
1245
|
+
await worker_sleep(4)
|
1246
|
+
except:
|
1247
|
+
pyautogui.press('enter')
|
1248
|
+
await worker_sleep(4)
|
1249
|
+
finally:
|
1250
|
+
pyautogui.press('enter')
|
1251
|
+
break
|
1252
|
+
else:
|
1253
|
+
retorno = f"Pop up nao mapeado para seguimento do robo {msg_pop_up} \nEtapas Executadas:\n{steps}"
|
1254
|
+
return RpaRetornoProcessoDTO(
|
1255
|
+
sucesso=False,
|
1256
|
+
retorno=retorno,
|
1257
|
+
status=RpaHistoricoStatusEnum.Falha,
|
1258
|
+
tags=[RpaTagDTO(descricao=RpaTagEnum.Tecnico)]
|
1259
|
+
)
|
1260
|
+
else:
|
1261
|
+
retorno = f"Não foi possivel realizar a confirmação do msg do OCR \nEtapas Executadas:\n{steps}"
|
1262
|
+
return RpaRetornoProcessoDTO(
|
1263
|
+
sucesso=False,
|
1264
|
+
retorno=retorno,
|
1265
|
+
status=RpaHistoricoStatusEnum.Falha,
|
1266
|
+
tags=[RpaTagDTO(descricao=RpaTagEnum.Tecnico)]
|
1267
|
+
)
|
1268
|
+
except Exception as e:
|
1269
|
+
pass
|
1270
|
+
|
1271
|
+
|
1272
|
+
i += 1
|
1273
|
+
await worker_sleep(10)
|
1274
|
+
|
1275
|
+
|
1276
|
+
if i == max_attempts:
|
1277
|
+
console.print("Número máximo de tentativas atingido. Encerrando...")
|
1278
|
+
retorno = f"Tempo esgotado e numero de tentativas atingido, não foi possivel obter o retorno de conclusão para transmissão na tela de Gerenciador NF-e \nEtapas Executadas:\n{steps}"
|
1279
|
+
return RpaRetornoProcessoDTO(
|
1280
|
+
sucesso=False,
|
1281
|
+
retorno=retorno,
|
1282
|
+
status=RpaHistoricoStatusEnum.Falha,
|
1283
|
+
tags=[RpaTagDTO(descricao=RpaTagEnum.Tecnico)]
|
1284
|
+
)
|
1285
|
+
|
1286
|
+
|
1287
|
+
pop_up_status = await status_trasmissao()
|
1288
|
+
console.print(f"Status copiado: {pop_up_status}")
|
1289
|
+
|
1290
|
+
if "autorizado o uso da nf-e" in pop_up_status.lower():
|
1291
|
+
console.print("Sucesso ao transmitir...\n")
|
1292
|
+
app = Application().connect(class_name="TFrmProcessamentoNFe2", timeout=15)
|
1293
|
+
main_window = app["TFrmProcessamentoNFe2"]
|
1294
|
+
main_window.set_focus()
|
1295
|
+
await worker_sleep(3)
|
1296
|
+
console.print(f"Fechando tela de processamento...\n")
|
1297
|
+
fechar_tela_processamento = "assets\\emsys\\button_fechar.PNG"
|
1298
|
+
button_location = pyautogui.locateCenterOnScreen(
|
1299
|
+
fechar_tela_processamento, confidence=0.6
|
1300
|
+
)
|
1301
|
+
if button_location:
|
1302
|
+
pyautogui.click(button_location)
|
1303
|
+
console.print("Botão 'Fechar' clicado com sucesso!")
|
1304
|
+
|
1305
|
+
else:
|
1306
|
+
get_error_msg = await get_text_display_window(pop_up_status)
|
1307
|
+
console.print(f"Mensagem Rejeição: {get_error_msg}")
|
1308
|
+
retorno = f"Erro ao transmitir, mensagem de rejeição {get_error_msg} \nEtapas Executadas:\n{steps}"
|
1309
|
+
return RpaRetornoProcessoDTO(
|
1310
|
+
sucesso=False,
|
1311
|
+
retorno=retorno,
|
1312
|
+
status=RpaHistoricoStatusEnum.Falha,
|
1313
|
+
tags=[RpaTagDTO(descricao=RpaTagEnum.Negocio)]
|
1314
|
+
)
|
1315
|
+
except Exception as e:
|
1316
|
+
retorno = f"Erro ao retransmitir, erro {e}, \nEtapas Executadas:\n{steps}"
|
1317
|
+
return RpaRetornoProcessoDTO(
|
1318
|
+
sucesso=False,
|
1319
|
+
retorno=retorno,
|
1320
|
+
status=RpaHistoricoStatusEnum.Falha,
|
1321
|
+
tags=[RpaTagDTO(descricao=RpaTagEnum.Negocio)]
|
1322
|
+
)
|
1323
|
+
else:
|
1324
|
+
console.print(f"Mensagem de Rejeição: {pop_up_status.lower()}")
|
1325
|
+
|
1326
|
+
x = x + 1
|
1327
|
+
if x == 2:
|
1328
|
+
retorno = f"Erro ao transmitir, \nEtapas Executadas:\n{steps}"
|
1329
|
+
return RpaRetornoProcessoDTO(
|
1330
|
+
sucesso=False,
|
1331
|
+
retorno=retorno,
|
1332
|
+
status=RpaHistoricoStatusEnum.Falha,
|
1333
|
+
tags=[RpaTagDTO(descricao=RpaTagEnum.Negocio)]
|
1334
|
+
)
|
1335
|
+
|
1081
1336
|
|
1082
1337
|
|
1083
1338
|
#PROCESSO DE IMPRESSÃO
|
@@ -1312,37 +1567,38 @@ async def devolucao_prazo_a_faturar(task: RpaProcessoEntradaDTO) -> RpaRetornoPr
|
|
1312
1567
|
if 'arla' in descricao.lower():
|
1313
1568
|
item_arla = True
|
1314
1569
|
|
1315
|
-
|
1316
|
-
|
1317
|
-
|
1318
|
-
|
1319
|
-
console.print("Itens acessado com sucesso, clicando em Incluir...\n")
|
1320
|
-
panel_TGroup_Box= panel_TPage.child_window(class_name="TGroupBox", found_index=0)
|
1321
|
-
btn_incluir = panel_TGroup_Box.child_window(class_name="TDBIBitBtn", found_index=4)
|
1322
|
-
btn_incluir.click()
|
1323
|
-
await worker_sleep(2)
|
1324
|
-
console.print("Incluir clicado com sucesso...\n")
|
1570
|
+
if 'gasolina' in descricao.lower() or 'diesel' in descricao.lower() or 'gnv' in descricao.lower() or 'etanol' in descricao.lower() or 'arla' in descricao.lower():
|
1571
|
+
app = Application().connect(class_name="TFrmPreVenda", timeout=60)
|
1572
|
+
main_window = app["TFrmPreVenda"]
|
1573
|
+
main_window.set_focus()
|
1325
1574
|
|
1326
|
-
|
1327
|
-
|
1328
|
-
|
1329
|
-
|
1330
|
-
|
1331
|
-
|
1332
|
-
|
1333
|
-
|
1334
|
-
|
1335
|
-
|
1336
|
-
|
1337
|
-
|
1338
|
-
)
|
1339
|
-
|
1340
|
-
|
1341
|
-
|
1342
|
-
|
1343
|
-
|
1344
|
-
|
1345
|
-
|
1575
|
+
console.print("Itens acessado com sucesso, clicando em Incluir...\n")
|
1576
|
+
panel_TGroup_Box= panel_TPage.child_window(class_name="TGroupBox", found_index=0)
|
1577
|
+
btn_incluir = panel_TGroup_Box.child_window(class_name="TDBIBitBtn", found_index=4)
|
1578
|
+
btn_incluir.click()
|
1579
|
+
await worker_sleep(2)
|
1580
|
+
console.print("Incluir clicado com sucesso...\n")
|
1581
|
+
|
1582
|
+
#VERIFICANDO A EXISTENCIA DE WARNINGS
|
1583
|
+
console.print("Verificando a existência de Warning... \n")
|
1584
|
+
warning_pop_up = await is_window_open("Warning")
|
1585
|
+
if warning_pop_up["IsOpened"] == True:
|
1586
|
+
console.print("possui Pop-up de Warning, analisando... \n")
|
1587
|
+
ocr_pop_warning = await ocr_warnings(numero_cupom_fiscal)
|
1588
|
+
if ocr_pop_warning.sucesso == True:
|
1589
|
+
return RpaRetornoProcessoDTO(
|
1590
|
+
sucesso=False,
|
1591
|
+
retorno=f"POP UP Warning não mapeado para seguimento do processo, mensagem: {ocr_pop_warning.retorno}",
|
1592
|
+
status=RpaHistoricoStatusEnum.Falha,
|
1593
|
+
tags=[RpaTagDTO(descricao=RpaTagEnum.Negocio)]
|
1594
|
+
)
|
1595
|
+
else:
|
1596
|
+
return RpaRetornoProcessoDTO(
|
1597
|
+
sucesso=False,
|
1598
|
+
retorno=f"POP UP Warning não mapeado para seguimento do processo",
|
1599
|
+
status=RpaHistoricoStatusEnum.Falha,
|
1600
|
+
tags=[RpaTagDTO(descricao=RpaTagEnum.Negocio)]
|
1601
|
+
)
|
1346
1602
|
|
1347
1603
|
|
1348
1604
|
i = 0
|
@@ -2861,162 +3117,162 @@ async def devolucao_prazo_a_faturar(task: RpaProcessoEntradaDTO) -> RpaRetornoPr
|
|
2861
3117
|
await worker_sleep(5) #FIM DO LOOP ITENS NOTA CONJUNTA
|
2862
3118
|
|
2863
3119
|
#FOR OUTROS ITENS NOTA
|
2864
|
-
for item in itens_nota:
|
2865
|
-
|
2866
|
-
|
2867
|
-
|
2868
|
-
|
2869
|
-
|
2870
|
-
|
2871
|
-
|
2872
|
-
|
2873
|
-
|
2874
|
-
|
2875
|
-
|
2876
|
-
|
2877
|
-
|
2878
|
-
|
2879
|
-
|
2880
|
-
|
3120
|
+
# for item in itens_nota:
|
3121
|
+
# quantidade = item['quantidade']
|
3122
|
+
# preco = item['valor_unitario']
|
3123
|
+
# descricao = item['descricao']
|
3124
|
+
# descricao = 'Diesel Comum' if descricao == 'Diesel S500' else descricao
|
3125
|
+
# item_cod = item['codigo']
|
3126
|
+
# #descricao = descricao.replace(".",",")
|
3127
|
+
|
3128
|
+
# if 'arla' in descricao.lower():
|
3129
|
+
# item_arla = True
|
3130
|
+
# continue #continue para pular o item arla
|
3131
|
+
|
3132
|
+
# console.print(quantidade, preco, descricao)
|
3133
|
+
|
3134
|
+
# app = Application().connect(class_name="TFrmPreVenda", timeout=60)
|
3135
|
+
# main_window = app["TFrmPreVenda"]
|
3136
|
+
# main_window.set_focus()
|
2881
3137
|
|
2882
|
-
|
2883
|
-
|
2884
|
-
|
2885
|
-
|
2886
|
-
|
2887
|
-
|
2888
|
-
|
2889
|
-
|
2890
|
-
|
2891
|
-
|
2892
|
-
|
2893
|
-
|
2894
|
-
|
2895
|
-
|
2896
|
-
|
2897
|
-
|
2898
|
-
|
2899
|
-
|
2900
|
-
|
2901
|
-
|
2902
|
-
|
2903
|
-
|
2904
|
-
|
2905
|
-
|
2906
|
-
|
2907
|
-
|
2908
|
-
|
2909
|
-
|
2910
|
-
|
2911
|
-
|
2912
|
-
|
2913
|
-
|
2914
|
-
|
2915
|
-
|
2916
|
-
|
2917
|
-
|
2918
|
-
|
2919
|
-
|
2920
|
-
|
2921
|
-
|
2922
|
-
|
2923
|
-
|
2924
|
-
|
2925
|
-
|
2926
|
-
|
2927
|
-
|
2928
|
-
|
2929
|
-
|
2930
|
-
|
2931
|
-
|
2932
|
-
|
2933
|
-
|
2934
|
-
|
2935
|
-
|
2936
|
-
|
2937
|
-
|
2938
|
-
|
2939
|
-
|
2940
|
-
|
2941
|
-
|
2942
|
-
|
2943
|
-
|
2944
|
-
|
2945
|
-
|
2946
|
-
|
2947
|
-
|
2948
|
-
|
2949
|
-
|
2950
|
-
|
2951
|
-
|
2952
|
-
|
2953
|
-
|
2954
|
-
|
2955
|
-
|
2956
|
-
|
2957
|
-
|
2958
|
-
|
3138
|
+
# console.print("Itens acessado com sucesso, clicando em Incluir...\n")
|
3139
|
+
# panel_TGroup_Box= panel_TPage.child_window(class_name="TGroupBox", found_index=0)
|
3140
|
+
# btn_incluir = panel_TGroup_Box.child_window(class_name="TDBIBitBtn", found_index=4)
|
3141
|
+
# btn_incluir.click()
|
3142
|
+
# await worker_sleep(5)
|
3143
|
+
# console.print("Incluir clicado com sucesso...\n")
|
3144
|
+
|
3145
|
+
# #VERIFICANDO A EXISTENCIA DE WARNINGS
|
3146
|
+
# console.print("Verificando a existência de Warning... \n")
|
3147
|
+
# warning_pop_up = await is_window_open("Warning")
|
3148
|
+
# if warning_pop_up["IsOpened"] == True:
|
3149
|
+
# console.print("possui Pop-up de Warning, analisando... \n")
|
3150
|
+
# ocr_pop_warning = await ocr_warnings(numero_cupom_fiscal)
|
3151
|
+
# if ocr_pop_warning.sucesso == True:
|
3152
|
+
# return RpaRetornoProcessoDTO(
|
3153
|
+
# sucesso=False,
|
3154
|
+
# retorno=f"POP UP Warning não mapeado para seguimento do processo, mensagem: {ocr_pop_warning.retorno}",
|
3155
|
+
# status=RpaHistoricoStatusEnum.Falha,
|
3156
|
+
# tags=[RpaTagDTO(descricao=RpaTagEnum.Negocio)]
|
3157
|
+
# )
|
3158
|
+
# else:
|
3159
|
+
# return RpaRetornoProcessoDTO(
|
3160
|
+
# sucesso=False,
|
3161
|
+
# retorno=f"POP UP Warning não mapeado para seguimento do processo",
|
3162
|
+
# status=RpaHistoricoStatusEnum.Falha,
|
3163
|
+
# tags=[RpaTagDTO(descricao=RpaTagEnum.Negocio)]
|
3164
|
+
# )
|
3165
|
+
|
3166
|
+
# app = Application().connect(class_name="TFrmIncluiItemPreVenda", timeout=60)
|
3167
|
+
# main_window = app["TFrmIncluiItemPreVenda"]
|
3168
|
+
# main_window.set_focus()
|
3169
|
+
# panel_TGroup_Box= main_window.child_window(class_name="TPanel", found_index=2)
|
3170
|
+
# almoxarificado_index = panel_TGroup_Box.child_window(class_name="TDBIEditNumber", found_index=1)
|
3171
|
+
# cod_almoxarificado = str(cod_empresa)+"50"
|
3172
|
+
# almoxarificado_index.click()
|
3173
|
+
# await worker_sleep(1)
|
3174
|
+
# for _ in range(5):
|
3175
|
+
# pyautogui.press("del")
|
3176
|
+
# pyautogui.press("backspace")
|
3177
|
+
# await worker_sleep(1)
|
3178
|
+
# pyautogui.write(cod_almoxarificado)
|
3179
|
+
# pyautogui.press('tab')
|
3180
|
+
# await worker_sleep(3)
|
3181
|
+
|
3182
|
+
# cod_item_index = panel_TGroup_Box.child_window(class_name="TDBIEditNumber", found_index=0)
|
3183
|
+
# cod_item_index.click()
|
3184
|
+
# await worker_sleep(1)
|
3185
|
+
|
3186
|
+
# for _ in range(5):
|
3187
|
+
# pyautogui.press("del")
|
3188
|
+
# pyautogui.press("backspace")
|
3189
|
+
|
3190
|
+
# await worker_sleep(1)
|
3191
|
+
# pyautogui.write(str(item_cod))
|
3192
|
+
# pyautogui.press('tab')
|
3193
|
+
# await worker_sleep(3)
|
3194
|
+
|
3195
|
+
|
3196
|
+
# natureza_oper_select = panel_TGroup_Box.child_window(class_name="TDBIComboBox", found_index=0)
|
3197
|
+
# nop_selected = natureza_oper_select.window_text()
|
3198
|
+
# nop_selected_value = nop_selected[:4]
|
3199
|
+
|
3200
|
+
# itens_to_select = natureza_oper_select.texts()
|
3201
|
+
# nop_to_be_select = ''
|
3202
|
+
|
3203
|
+
# for item in itens_to_select:
|
3204
|
+
# if nop_selected_value in item and (('c/' in item.lower() or 'c /' in item.lower()) and ('s/' in item.lower() or 's /' in item.lower())):
|
3205
|
+
# nop_to_be_select = item
|
3206
|
+
# break
|
3207
|
+
|
3208
|
+
# natureza_oper_select.click()
|
3209
|
+
# await worker_sleep(1)
|
3210
|
+
# console.print(f"Descrição: {descricao}")
|
3211
|
+
# if 'gasolina' in descricao.lower() or 'diesel' in descricao.lower() or 'gnv' in descricao.lower() or 'etanol' in descricao.lower():
|
3212
|
+
# try:
|
3213
|
+
# console.print("Selecionando NOP do item: '5667 - VENDA DE COMB OU LUBRI - SEM ESTOQ E COM FINANC'")
|
3214
|
+
# natureza_oper_select.select("5667 - VENDA DE COMB OU LUBRI - SEM ESTOQ E COM FINANC")
|
2959
3215
|
|
2960
|
-
|
2961
|
-
|
2962
|
-
|
3216
|
+
# except:
|
3217
|
+
# console.print("Selecionando NOP: 5656 - VENDA DE COMB OU LUB ADQ DE TERCEIRO C/ FIN S/ ESTOQUE")
|
3218
|
+
# natureza_oper_select.select("5656 - VENDA DE COMB OU LUB ADQ DE TERCEIRO C/ FIN S/ ESTOQUE")
|
2963
3219
|
|
2964
|
-
|
2965
|
-
|
2966
|
-
|
2967
|
-
|
2968
|
-
|
3220
|
+
# elif 'arla' in descricao.lower():
|
3221
|
+
# try:
|
3222
|
+
# #PRECISA DO ESPAÇO NO FINAL!!!
|
3223
|
+
# console.print("Selecionando NOP do item: '5102 - VENDA MERCAD. ADQ. DE TERCEIRO- 5.102 S/ ESTOQ C/ FINAN '")
|
3224
|
+
# natureza_oper_select.select("5102 - VENDA MERCAD. ADQ. DE TERCEIRO- 5.102 S/ ESTOQ C/ FINAN ")
|
2969
3225
|
|
2970
|
-
|
2971
|
-
|
2972
|
-
|
3226
|
+
# except:
|
3227
|
+
# console.print("Selecionando NOP do item: '5102 - VENDA MERCAD. ADQ. DE TERCEIRO- 5.102 S/ESTOQ C/ FINAN FE'")
|
3228
|
+
# natureza_oper_select.select("5102 - VENDA MERCAD. ADQ. DE TERCEIRO- 5.102 S/ESTOQ C/ FINAN FE")
|
2973
3229
|
|
2974
|
-
|
2975
|
-
|
2976
|
-
|
2977
|
-
|
2978
|
-
|
2979
|
-
|
2980
|
-
|
2981
|
-
|
2982
|
-
|
2983
|
-
|
2984
|
-
|
2985
|
-
|
2986
|
-
|
3230
|
+
# else:
|
3231
|
+
# if nop_to_be_select != '':
|
3232
|
+
# console.print(f"Selecionando NOP do item: '{nop_to_be_select}'")
|
3233
|
+
# natureza_oper_select.select(nop_to_be_select)
|
3234
|
+
# # set_combobox("||List", nop_to_be_select)
|
3235
|
+
# else:
|
3236
|
+
# retorno = f"Não foi possivel encontrar a nop para o item, nop original {nop_selected} \nEtapas Executadas:\n{steps}"
|
3237
|
+
# return RpaRetornoProcessoDTO(
|
3238
|
+
# sucesso=False,
|
3239
|
+
# retorno=retorno,
|
3240
|
+
# status=RpaHistoricoStatusEnum.Falha,
|
3241
|
+
# tags=[RpaTagDTO(descricao=RpaTagEnum.Negocio)]
|
3242
|
+
# )
|
2987
3243
|
|
2988
|
-
|
2989
|
-
|
2990
|
-
|
2991
|
-
|
2992
|
-
|
2993
|
-
|
2994
|
-
|
2995
|
-
|
2996
|
-
|
2997
|
-
|
2998
|
-
|
2999
|
-
|
3000
|
-
|
3001
|
-
|
3002
|
-
|
3003
|
-
|
3004
|
-
|
3005
|
-
|
3006
|
-
|
3007
|
-
|
3008
|
-
|
3009
|
-
|
3010
|
-
|
3011
|
-
|
3012
|
-
|
3013
|
-
|
3014
|
-
|
3015
|
-
|
3016
|
-
|
3017
|
-
|
3018
|
-
|
3019
|
-
|
3244
|
+
# await worker_sleep(1)
|
3245
|
+
# console.print("Natureza da operação selecionado com sucesso, preenchendo os itens...\n")
|
3246
|
+
|
3247
|
+
# #INSERINDO A QUANTIDADE
|
3248
|
+
# main_window.set_focus()
|
3249
|
+
# panel_TPage_Control= main_window.child_window(class_name="TcxPageControl", found_index=0)
|
3250
|
+
# panel_tabSheet = panel_TPage_Control.child_window(class_name="TcxTabSheet", found_index=0)
|
3251
|
+
|
3252
|
+
# field_quantidade = panel_tabSheet.child_window(class_name="TDBIEditNumber", found_index=8)
|
3253
|
+
# console.print("Inserindo a quantidade de Itens...\n")
|
3254
|
+
# field_quantidade.click()
|
3255
|
+
# await worker_sleep(1)
|
3256
|
+
# pyautogui.press('del')
|
3257
|
+
# await worker_sleep(1)
|
3258
|
+
# pyautogui.press('backspace')
|
3259
|
+
# await worker_sleep(1)
|
3260
|
+
# pyautogui.write(quantidade)
|
3261
|
+
# #field_quantidade.set_edit_text(quantidade)
|
3262
|
+
# await worker_sleep(1)
|
3263
|
+
# pyautogui.press('tab')
|
3264
|
+
# await worker_sleep(2)
|
3265
|
+
|
3266
|
+
# console.print("Verificando inclui itiem Pre Venda")
|
3267
|
+
# app = Application().connect(class_name="TFrmIncluiItemPreVenda", timeout=60)
|
3268
|
+
# main_window = app["TFrmIncluiItemPreVenda"]
|
3269
|
+
# main_window.set_focus()
|
3270
|
+
# send_keys("%i")
|
3271
|
+
# await worker_sleep(2)
|
3272
|
+
# #Divergencia de nop na capa e no item
|
3273
|
+
# await find_nop_divergence()
|
3274
|
+
# await worker_sleep(5)
|
3275
|
+
# main_window.close()
|
3020
3276
|
|
3021
3277
|
# Inclui registro
|
3022
3278
|
console.print(f"Incluindo registro...\n")
|
@@ -4182,61 +4438,45 @@ async def devolucao_prazo_a_faturar(task: RpaProcessoEntradaDTO) -> RpaRetornoPr
|
|
4182
4438
|
tags=[RpaTagDTO(descricao=RpaTagEnum.Tecnico)]
|
4183
4439
|
)
|
4184
4440
|
|
4185
|
-
|
4186
|
-
|
4187
|
-
reader = PdfReader(f)
|
4188
|
-
for p in reader.pages:
|
4189
|
-
txt += p.extract_text()
|
4441
|
+
with open(f"{path_to_txt}.pdf", 'rb') as file:
|
4442
|
+
file_bytes = io.BytesIO(file.read())
|
4190
4443
|
|
4191
|
-
console.print(f"Texto extraido {txt}...\n")
|
4192
|
-
v = re.findall(r'\b\d{1,3},\d{2}\b(?!\s*\d+\.\d+\.\d+)',txt)
|
4444
|
+
# console.print(f"Texto extraido {txt}...\n")
|
4445
|
+
# v = re.findall(r'\b\d{1,3},\d{2}\b(?!\s*\d+\.\d+\.\d+)',txt)
|
4193
4446
|
|
4194
|
-
ultimo_valor = v[-1]
|
4195
|
-
penultimo_valor = v[-2]
|
4447
|
+
# ultimo_valor = v[-1]
|
4448
|
+
# penultimo_valor = v[-2]
|
4196
4449
|
|
4197
|
-
if ultimo_valor == penultimo_valor:
|
4198
|
-
console.print("Valores no relatorio corretamente gerados...\n")
|
4199
|
-
with open(f"{path_to_txt}.pdf", 'rb') as file:
|
4200
|
-
file_bytes = io.BytesIO(file.read())
|
4201
4450
|
|
4202
|
-
|
4203
|
-
|
4204
|
-
|
4205
|
-
|
4206
|
-
|
4207
|
-
retorno = f"Processo de devolução executado com sucesso \nEtapas Executadas:\n{steps}"
|
4451
|
+
desArquivo = f"CAIXA 13 DEVOLUCAO {numero_cupom_fiscal}.pdf"
|
4452
|
+
try:
|
4453
|
+
await send_file(historico_id, desArquivo, "pdf", file_bytes, file_extension="pdf")
|
4454
|
+
os.remove(f"{path_to_txt}.pdf")
|
4455
|
+
retorno = f"Processo de devolução executado com sucesso \nEtapas Executadas:\n{steps}"
|
4208
4456
|
|
4209
|
-
|
4210
|
-
|
4211
|
-
|
4457
|
+
try:
|
4458
|
+
url_retorno = nota.get("urlRetorno")
|
4459
|
+
identificador = nota.get("identificador")
|
4212
4460
|
|
4213
|
-
|
4214
|
-
|
4215
|
-
|
4216
|
-
|
4217
|
-
|
4218
|
-
|
4219
|
-
|
4220
|
-
|
4221
|
-
|
4222
|
-
|
4223
|
-
|
4224
|
-
|
4225
|
-
|
4226
|
-
|
4227
|
-
return RpaRetornoProcessoDTO(
|
4228
|
-
sucesso=False,
|
4229
|
-
retorno=result,
|
4230
|
-
status=RpaHistoricoStatusEnum.Falha,
|
4231
|
-
tags=[RpaTagDTO(descricao=RpaTagEnum.Tecnico)]
|
4232
|
-
)
|
4233
|
-
else:
|
4234
|
-
os.remove(f"{path_to_txt}.pdf")
|
4461
|
+
if url_retorno and identificador:
|
4462
|
+
await post_partner(url_retorno, identificador, numero_nota_fiscal, valor_nota_fiscal)
|
4463
|
+
else:
|
4464
|
+
console.print("Não foi possivel obter o valor de urlRetorno/identificador")
|
4465
|
+
except:
|
4466
|
+
console.print(f"Erro ao obter os dados ou enviar a requisição: {e}")
|
4467
|
+
|
4468
|
+
return RpaRetornoProcessoDTO(
|
4469
|
+
sucesso=True,
|
4470
|
+
retorno=retorno,
|
4471
|
+
status=RpaHistoricoStatusEnum.Sucesso)
|
4472
|
+
except Exception as e:
|
4473
|
+
result = f"Arquivo CAIXA 13 DEVOLUÇÃO gerado com sucesso, porém gerou erro ao realizar o envio para o backoffice {e} - Arquivo ainda salvo na dispositivo utilizado no diretório {path_to_txt} !"
|
4474
|
+
console.print(result, style="bold red")
|
4235
4475
|
return RpaRetornoProcessoDTO(
|
4236
4476
|
sucesso=False,
|
4237
|
-
retorno=
|
4477
|
+
retorno=result,
|
4238
4478
|
status=RpaHistoricoStatusEnum.Falha,
|
4239
|
-
tags=[RpaTagDTO(descricao=RpaTagEnum.
|
4479
|
+
tags=[RpaTagDTO(descricao=RpaTagEnum.Tecnico)]
|
4240
4480
|
)
|
4241
4481
|
else:
|
4242
4482
|
console.print("Cliente FIDC não é necessario gerar relatorio final, enviando as informações para o parceiro.")
|
@@ -44,7 +44,7 @@ worker_automate_hub/tasks/jobs/cte_xml.py,sha256=CdDcDRjCJTU2DV0KAglqgCVb13ahMqz
|
|
44
44
|
worker_automate_hub/tasks/jobs/descartes.py,sha256=E5kKef8j7e0PTm6NBeZAXkljUoAFEMjVWvHaJ8g2fv4,44451
|
45
45
|
worker_automate_hub/tasks/jobs/devolucao_ctf.py,sha256=5vHKXUJjW5p-UgnghjgSTaSRYFbkiImQO7lNxFvAPbo,252967
|
46
46
|
worker_automate_hub/tasks/jobs/devolucao_ctf_35.py,sha256=e9t5k2mtZcUcEGKPWysbWzsH_gqrK-6aBXjWe2jWfTg,253948
|
47
|
-
worker_automate_hub/tasks/jobs/devolucao_prazo_a_faturar.py,sha256=
|
47
|
+
worker_automate_hub/tasks/jobs/devolucao_prazo_a_faturar.py,sha256=knX637_fiKiKmK7nwEgvylbC-nI9CqncIezyW7URktU,274442
|
48
48
|
worker_automate_hub/tasks/jobs/ecac_estadual_go.py,sha256=dKkf22nH5gp3RErq5u0UzRsKyJ81fc6ZZ4vLtUuMwHA,21002
|
49
49
|
worker_automate_hub/tasks/jobs/ecac_estadual_main.py,sha256=8WmKe4-MRtzHobXz2S4YBDNN8alfawkC-BBlRY-mn1g,1726
|
50
50
|
worker_automate_hub/tasks/jobs/ecac_estadual_mt.py,sha256=C26zmpGQGUq6sP9lU9nanM3Fje-rkyx5tjwmRy4lyL8,25300
|
@@ -97,7 +97,7 @@ worker_automate_hub/utils/updater.py,sha256=en2FCGhI8aZ-JNP3LQm64NJDc4awCNW7UhbV
|
|
97
97
|
worker_automate_hub/utils/util.py,sha256=_pgZOFWgXoov6WPbqyRTDVXJCRFfucYB3gb9swzU7bo,198281
|
98
98
|
worker_automate_hub/utils/utils_nfe_entrada.py,sha256=T3FiVcjVUNTKSauEAD7PBMAzT5uy96OwvKpb6u8PcjA,36408
|
99
99
|
worker_automate_hub/worker.py,sha256=axdrr1xLTjWEyWfcyH3OCSpPTsyzck_fL_0u1DBLjvw,6525
|
100
|
-
worker_automate_hub-0.5.
|
101
|
-
worker_automate_hub-0.5.
|
102
|
-
worker_automate_hub-0.5.
|
103
|
-
worker_automate_hub-0.5.
|
100
|
+
worker_automate_hub-0.5.623.dist-info/entry_points.txt,sha256=sddyhjx57I08RY8X7UxcTpdoOsWULAWNKN9Xr6pp_Kw,54
|
101
|
+
worker_automate_hub-0.5.623.dist-info/METADATA,sha256=8XaHAobJ66rW40rTAjfvHSmqGHpus_kaT1SjFd5oL34,3049
|
102
|
+
worker_automate_hub-0.5.623.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
|
103
|
+
worker_automate_hub-0.5.623.dist-info/RECORD,,
|
File without changes
|
{worker_automate_hub-0.5.622.dist-info → worker_automate_hub-0.5.623.dist-info}/entry_points.txt
RENAMED
File without changes
|