totvs / tir

This module is used to create and execute test suites and test cases for web interfaces.
MIT License
82 stars 49 forks source link

Problema ao concatenar variáveis de conversão de data e executar QueryExecute #1452

Closed caiquess closed 3 weeks ago

caiquess commented 2 months ago

Tento concatenar variáveis de data convertida em string em uma CONSULTA para executar o QueryExecute e apresenta erro de DeprecationWarning: np.bool

Ex ERRO - SS13 Screenshot_13

Quando é passada as avariáveis em string "digitada" o script segue normalmente. Ex OK - SS14 Screenshot_14

renanllisboa commented 1 month ago

Boa tarde, @caiquess .

Tentei simular este comportamento no meu ambiente, e o mesmo não se repete.

Você está utilizando a lib padrão do projeto?

Consegue no enviar o conteúdo do comando "pip freeze"?

Este Warning aparentemente é inofensivo para a execução, a principio não deveria impedir a sequencia da execução.

caiquess commented 1 month ago

Boa tarde,

Estou usando o padrão extraído do GIT. Eu tentei desativar o warning, mas mesmo assim parava o processo.

segue resultado do comando: PS C:\Users\caique.silva\Music\GIT_TIR_SCRIPTS\tir-script-samples> pip freeze beautifulsoup4==4.12.2 certifi==2024.6.2 charset-normalizer==3.3.2 enum34==1.1.10 idna==3.7 lxml==4.6.5 numpy==1.21.6 opencv-python==4.6.0.66 packaging==24.0 pandas==1.0.1 psutil==5.9.5 pyodbc==4.0.39 python-dateutil==2.8.2 python-dotenv==0.21.1 pytz==2023.3 requests==2.29.0 selenium==3.8.0 six==1.16.0 soupsieve==2.4.1 tir-framework==1.20.20 urllib3==1.26.19 webdriver-manager==4.0.1

Atenciosamente,

Caíque de Souza Silva +55 71 9 9197 6129

Em qui., 18 de jul. de 2024 às 16:20, Renan Lacerda Lisboa < @.***> escreveu:

Boa tarde, @caiquess https://github.com/caiquess .

Tentei simular este comportamento no meu ambiente, e o mesmo não se repete.

Você está utilizando a lib padrão do projeto?

Consegue no enviar o conteúdo do comando "pip freeze"?

Este Warning aparentemente é inofensivo para a execução, a principio não deveria impedir a sequencia da execução.

— Reply to this email directly, view it on GitHub https://github.com/totvs/tir/issues/1452#issuecomment-2237362710, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALFUHSJKPOG5BUCFQMSM7STZNAIRRAVCNFSM6AAAAABKNH3ZZWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMZXGM3DENZRGA . You are receiving this because you were mentioned.Message ID: @.***>

renanllisboa commented 1 month ago

Bom dia,

Esta correto a versão da lib.

Poderia mandar o script que esta utilizando?

Precisamos avaliar o objeto data.

Atenciosamente

caiquess commented 1 month ago

Segue script que tentei executar.

from tir import Webapp

from datetime import date,datetime from calendar import monthrange import unittest

class MATA910(unittest.TestCase):

@classmethod
def setUpClass(inst):
    DateSystem = datetime.today().strftime('%d/%m/%Y')

    inst.oHelper = Webapp()
    inst.oHelper.Setup('SIGAMDI', DateSystem,'01', '01', '09')

def test_MATA910_001(self):

    data_atual = date.today()
    # monthrange retorna o último dia do mês, basta setá-lo na data e

pronto data_fimsql = data_atual.replace(day=monthrange(data_atual.year, data_atual.month)[1]) data_fim = data_fimsql.strftime('%d/%m/%Y') data_fimsql = str(data_fimsql)

    data_inisql = data_atual.replace(day=1)
    data_ini = data_inisql.strftime('%d/%m/%Y')
    data_inisql = str(data_inisql)

    cQuery = "Select DISTINCT ZW1_FILIAL AS FILIAL, "
    cQuery += "(case when ZW1_TIPO = 'DEV' then 'D' else 'N' end) AS

TIPONF, " cQuery += "ZW1_NDOC AS DOC, ZW1_SDOC AS SERIE, " cQuery += "CASE WHEN ZW1_TIPO = 'REM' THEN (SELECT TOP 1 A2_COD FROM SA2010 A2 WHERE A2_CGC = Z.ZW1_CNPJFO AND A2.D_E_L_ET='') " cQuery += "ELSE (SELECT TOP 1 A1_COD FROM SA1010 A1 WHERE A1_CGC = Z.ZW1_CNPJFO AND A1.D_E_L_ET='') END AS CLIENTE, " cQuery += "CASE WHEN ZW1_TIPO = 'REM' THEN (SELECT TOP 1 A2_LOJA FROM SA2010 A2 WHERE A2_CGC = Z.ZW1_CNPJFO AND A2.D_E_L_ET='') " cQuery += "ELSE (SELECT TOP 1 A1_LOJA FROM SA1010 A1 WHERE A1_CGC = Z.ZW1_CNPJFO AND A1.D_E_L_ET='') END AS LOJA, " cQuery += "ZW1_VLRDOC AS VALOR,ZW1_CHAVE AS CHAVE,convert(varchar,Z.ZW1_DATAEM,103) AS EMISSAO,'SPED' AS TIPODC " cQuery += "from ZW1010 Z " cQuery += "INNER JOIN ITENS_NOTAS_ANTIGAS I ON I.CHAVE = Z.ZW1_CHAVE " cQuery += "where ZW1_CCLIEN <> '' AND ZW1_TIPO IN ('DEV','REM') " cQuery += "AND ZW1_STATUS NOT IN ('04','14','15','99','97','00','01','13') " cQuery += "AND ZW1_DATAEM >= '20190501' " cQuery += "AND ZW1_DATAEM >= '"+data_inisql+"' " cQuery += "AND ZW1_DATAEM <= '"+data_fimsql+"' " cQuery += "AND (CASE WHEN ZW1_TIPO = 'REM' THEN (SELECT TOP 1 A2_COD FROM SA2010 A2 WHERE A2_CGC = Z.ZW1_CNPJFO AND A2.D_E_L_ET='') " cQuery += "ELSE (SELECT TOP 1 A1_COD FROM SA1010 A1 WHERE A1_CGC = Z.ZW1_CNPJFO AND A1.D_E_L_ET='') END) IS NOT NULL"

    database_content_dictionary = self.oHelper.QueryExecute(cQuery)

    FILIAL  = database_content_dictionary['FILIAL']
    TIPONF  = database_content_dictionary['TIPONF']
    SERIE   = database_content_dictionary['SERIE']
    CLIENTE = database_content_dictionary['CLIENTE']
    LOJA    = database_content_dictionary['LOJA']
    CHAVE   = database_content_dictionary['CHAVE']
    EMISSAO = database_content_dictionary['EMISSAO']
    TIPODC  = database_content_dictionary['TIPODC']

    self.oHelper.Program('MATA910')
    self.oHelper.SetValue("__dInfoData",data_fim)
    #self.oHelper.SetValue("__cGroup","01")
    #self.oHelper.SetValue("__cFil","01")
    self.oHelper.SetButton("Confirmar")

    for row, DOC in

enumerate(database_content_dictionary['DOC'].values()):# Percorrer a mesma quantidade do A1_COD na tabela. self.oHelper.SetButton("Incluir") self.oHelper.SearchBrowse(FILIAL[row]) self.oHelper.SetButton("OK") self.oHelper.SetValue("c910Tipo", TIPONF[row]) self.oHelper.SetValue("cNFiscal",DOC) self.oHelper.SetValue("cSerie",SERIE[row]) self.oHelper.SetValue("dDEmissao",EMISSAO[row]) self.oHelper.SetValue("ca100For",CLIENTE[row]) self.oHelper.SetValue("cLoja",LOJA[row]) self.oHelper.SetValue("cEspecie",TIPODC[row])

        database_content_dictionary2 =

self.oHelper.QueryExecute("SELECT CFOP, QTD_PROD AS QTD, TES, VLR_PROD, VLR_PROD AS VLITEM, 'A002002' AS CODPROD FROM ITENS_NOTAS_ANTIGAS WHERE CHAVE = '"+CHAVE[row]+"'") CFOP = database_content_dictionary2['CFOP'] QTD = database_content_dictionary2['QTD'] TES = database_content_dictionary2['TES'] VLITEM = database_content_dictionary2['VLITEM']

        for irow, CODPROD in

enumerate(database_content_dictionary2['CODPROD'].values()):# Percorrer a mesma quantidade do A1_COD na tabela. self.oHelper.SetValue("D1_COD",CODPROD) self.oHelper.SetValue("D1_QUANT",QTD[irow]) self.oHelper.SetValue("D1_VUNIT",VLITEM[irow]) self.oHelper.SetValue("D1_TES",TES[irow]) if TIPONF[irow] == 'D': self.oHelper.SetValue("D1_NFORI","000000001")

    self.oHelper.ClickFolder("Informações DANFE")
    self.oHelper.SetValue("aDanfe[01]",CHAVE[row])
    self.oHelper.SetButton("Salvar")
    self.oHelper.SetButton("Cancelar"),
    #self.oHelper.SetButton('x')

@classmethod
def tearDownClass(inst):
    inst.oHelper.TearDown()

if name == 'main': unittest.main()

Atenciosamente,

Caíque de Souza Silva +55 71 9 9197 6129

Em ter., 23 de jul. de 2024 às 10:15, Renan Lacerda Lisboa < @.***> escreveu:

Bom dia,

Esta correto a versão da lib.

Poderia mandar o script que esta utilizando?

Precisamos avaliar o objeto data.

Atenciosamente

— Reply to this email directly, view it on GitHub https://github.com/totvs/tir/issues/1452#issuecomment-2245225204, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALFUHSNGTC2VE4J7QTC4XBTZNZJQVAVCNFSM6AAAAABKNH3ZZWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDENBVGIZDKMRQGQ . You are receiving this because you were mentioned.Message ID: @.***>

renanllisboa commented 3 weeks ago

Bom dia,

Com este cenário não consegui reproduzir o problema, quer deixar o seu e-mail para que possamos entrar em contato e marcar um call?

Pode deixar uma mensagem privada no gitter por questões de privacidade.

Atenciosamente