Jump to content
Fivewin Brasil

Ariston Santos

Membros
  • Posts

    500
  • Joined

  • Last visited

  • Days Won

    11

Ariston Santos last won the day on April 25 2018

Ariston Santos had the most liked content!

About Ariston Santos

  • Birthday 07/30/1971

Contact Methods

  • MSN
    ariston.ap@hotmail.com
  • Website URL
    https://www.arsoft-ap.com
  • Skype
    ariston.ap

Profile Information

  • Gender
    Male
  • Location
    Macap-AP, Brasil
  • Interests
    Programação

Recent Profile Visitors

1,683 profile views

Ariston Santos's Achievements

  1. Estou à procura de API par a Pix. Tentem com Matera mas está muito caro por operação. Você indica alguma que tenha custo zero ou que seja bem acessível por operação?
  2. Olá. Alguém consegue usar SQLRDD com Firebird 3? Se sim, qual é o segredo? Grato!
  3. Fou muito bom aprender sobre "deadlock" neste link: https://www.youtube.com/watch?v=HnB1e21tuvA
  4. O erro era porque não existia a coluna "observ" na tabela "sga_atendmento". O SQLRDD não informava isso, não aparecia nada relacionado no sqlerror.log. Só deu para descobrir executando a query no EMS QuickDesk. Obrigado por esclarecer que ASC é Default. Agora vou informar apenas DESC, e se precisar classificar no formado Z-A.
  5. Dá pra contornar. Desinstale o AnyDesk atual com IOBit Uninstaller (para remover resíduos do registro do windows) Instale uma versão mais antiga, e pronto! Para min assim ainda está funcionando.
  6. Valeu pela dica. Com isso descobri que o erro estava na estrutura da tabela. SQLRDD não mostrou isso.
  7. Olá. Aguém já passou por este erro? Sabe como resolver? Dynamic SQL Error - Native error code 335544569 Command : SELECT FIRST 1 a.cod_seq AS cod_seq, a.idunico AS idunico, a.cod_opr AS cod_opr, a.nom_opr AS nom_opr, a.nom_atd AS nom_atd, a.dtatend AS dtatend, a.hoatend AS hoatend, a.nrpront AS nrpront, a.iduprnt AS iduprnt, a.nome AS nome, a.end_rua AS end_rua, a.end_nro AS end_nro, a.end_bai AS end_bai, a.end_cep AS end_cep, a.end_cid AS end_cid, a.end_uf AS end_uf, a.end_zona AS end_zona, a.queixa AS queixa, a.observacao AS observacao, a.tipoatd AS tipoatd, a.tipocad AS tipocad, b.cod_atd AS codativ, b.idunico AS iduativ, b.descatd AS descatd, b.nomprof AS nomprof, b.observ AS obsativ, a.estcivi AS estcivi, a.dultmen AS dultmen, coalesce(a.qtgesta, 0) AS qtgesta, coalesce(a.qtpariu, 0) AS qtpariu, coalesce(a.qtabort, 0) AS qtabort, a.clrisco AS clrisco, coalesce(a.num_ord, 0) AS num_ord FROM sga_atend_atv b JOIN sga_atendimento a ON b.idunico = a.idunico WHERE a.cod_seq > 0 ORDER BY a.cod_seq ASC hStmt : Steatment handle : Connection handle : RetCode : -1 SR_FIREBIRD:RUNTIMEERR Linha : 859 SR_FIREBIRD:EXECUTE Linha : 618 SQLARRAY Linha : 81 ATDGETRECEP Linha : 931 ATDRECEPCAO Linha : 58 (b)SGAMAIN Linha : 168 TBTNBMP:CLICK Linha : 465 TBTNBMP:LBUTTONUP Linha : 656 TCONTROL:HANDLEEVENT Linha : 1690 TBTNBMP:HANDLEEVENT Linha : 1408 _FWH Linha : 3153 WINRUN Linha : 0 TWINDOW:ACTIVATE Linha : 980 SGAMAIN Linha : 226
  8. TiraAcentos() FUNCTION TiraAcentos(cStr) LOCAL cStrNew := "", nX, aAcento, aLetras aAcento := {"ã","Ã","Æ","Â"," ","µ","…","·","‚","","ˆ","Ò","¡","Ö","¢","à","ä","å","“","â","£","š","á","Á","à","À","é","É","ê","Ê","í","Í","ó","Ó","õ","Õ","ô","Ô","ú","Ú","ü","Ü","ù","ç","‡","Ç","€","§","¦","º","°","ª","ƒ"} aLetras := {"a","A","a","A","a","A","a","A","e","E","e","E","i","I","o","O","o","O","o","O","u","U","a","A","a","A","e","E","e","E","i","I","o","O","o","O","o","O","u","U","u","U"," ","c","c","C","C",".",".",".",".",".", ""} FOR nX := 1 TO LEN(aAcento) try cStrNew := STRTRAN(cStr,aAcento[nX],aLetras[nX]) cStr := cStrNew catch e end try NEXT IF EMPTY(cStrNew) ; cStrNew := cStr ; ENDIF RETURN(cStrNew) MyMsgRun() // Substitua por MsgRun() Filewrite() FUNCTION FileWrite(cFname, cStrig) *----------( Alternativa ao memowrit, para salver texto em arquivo )-----------* LOCAL _lOk := .f., nH, _nBt, nErrNr := 0 IF FILE(cFname) IF FERASE(cFname) = -1 nErrNr := FERROR() // pegar código de erro com FERROR() SysRefresh() ; MsgAlert("Não foi possível excluir o arquivo "+cFname, "Erro: ("+ALLTRIM(STR(nErrNr))+") "+DosErr2Str(nErrNr)) RETURN .F. ENDIF ENDIF nH := FCreate(cFname) // Se houver erro, retorna -1 IF nH >= 0 _nBt := FWrite(nH, cStrig) // Retorna a quantidade de bytes escritos FClose(nH) // Retorna .T. ou .F., pegar código de erro com FERROR() nErrNr := FERROR() IF nErrNr > 0 ; _lOk := .F. ; ELSE ; _lOk := .T. ; ENDIF // Se maior que zero, houve erro. Consulte FERROR() ENDIF IF ! _lOk SysRefresh() ; MsgAlert("Ocorreu um erro ao criar o arquivo "+cFname, "Erro: ("+ALLTRIM(STR(nErrNr))+") "+DosErr2Str(nErrNr)) ENDIF RETURN _lOk FUNCTION DosErr2Str(nErrNr) *-------------------( Retorna uma strig com o motivo do erro )-----------------* LOCAL c_Err := "" IF nErrNr = 02 ; c_Err := "Arquivo nao encontrado" ; ENDIF IF nErrNr = 03 ; c_Err := "Pasta não encontrada" ; ENDIF IF nErrNr = 04 ; c_Err := "Muitos arquivos abertos" ; ENDIF IF nErrNr = 05 ; c_Err := "Acesso negado" ; ENDIF IF nErrNr = 06 ; c_Err := "Handle inválido" ; ENDIF IF nErrNr = 08 ; c_Err := "Memória insuficiente" ; ENDIF IF nErrNr = 15 ; c_Err := "Especificado um drive inválido" ; ENDIF IF nErrNr = 19 ; c_Err := "Tentativa de gravar em disco protegido" ; ENDIF IF nErrNr = 21 ; c_Err := "Disco não pronto" ; ENDIF IF nErrNr = 23 ; c_Err := "Erro de CRC" ; ENDIF IF nErrNr = 29 ; c_Err := "Erro de gravação" ; ENDIF IF nErrNr = 30 ; c_Err := "Erro de leitura" ; ENDIF IF nErrNr = 32 ; c_Err := "Violação de compartilhamento" ; ENDIF IF nErrNr = 33 ; c_Err := "Violação de travamento" ; ENDIF RETURN( c_Err )
  9. Este exemplo obtém o JSON e baixa a imagem, mas o modo como faço o download está incorreto porque estou salvando o conteúdo como JPEG, mas a imagem baixada pode ter outras formatos. O que quero saber se se os senhores pode indicar um modo melhor de fazer o download. FUNCTION PrdBaixInfo(aBars, xInfo, cFimg) LOCAL xmlhttp_resultado := "", _xBar := "7896806700069" LOCAL _xNome := "", _xNcm := "", _Cest := "", _xEmbal := "", _xQtEmb := "", _xMarca := "", _xCateg := "", _xPeso := "", _xTrib := "" DEFAULT cFimg := "" _xBar := ALLTRIM(aBars[1,2]) IF EMPTY(_xBar) SysRefresh() ; MsgAlert("É preciso informar um código de barras no cadastro do produto", "Atenção!") return nil endif url := "http://www.eanpictures.com.br:9000/api/"+xInfo+"/"+_xBar // Ex: 7896806700069 (xInfo: desc=JSON, gtin=Imagem) CursorWait() try oUrl:=TUrl():New( url ) // From tip.lib oHttp := TipClientHttp():New( oUrl , .f. ) // From tip.lib catch oErr CursorArrow() SysRefresh() ; MsgAlert("Houve um erro: "+oErr:Description, "Atenção!") return nil end try Try oHttp:Open() _xRet := oHttp:ReadAll() // Baixa todo o conteúdo do site. Catch oErr CursorArrow() SysRefresh() ; MsgAlert("Houve um erro: "+oErr:Description, "Atenção!") return nil End oHttp:Close() DeleteUrlCacheEntry(url) // Lipar Cache IF EMPTY(_xRet) CursorArrow() SysRefresh() ; MsgAlert("Houve um erro na comunicação com o Webservice", "Atenção!") return nil ENDIF CursorArrow() IF '"Status":"404"' $ _xRet _xMsg := "" _xRet := "["+TiraAcentos(UnicodeToStr(_xRet, .f.))+"]" hJson := {} nLength := hb_JSONDecode( _xRet, @hJson ) for nInf := 1 to len(hJson) Li := hJson[nInf] if len(Li) > 0 try ; _xMsg := Alltrim(Li["Status_Desc"]) ; catch ; end try && Para republicavirtual endif next SysRefresh() ; MsgInfo(_xMsg, "Info") return nil ENDIF IF xInfo = "desc" // Obter um JSON com as informações do proudto IF '"Status":"200"' $ _xRet * SysRefresh() ; MsgInfo(_xRet, "Ok") _xRet := "["+TiraAcentos(UnicodeToStr(_xRet, .f.))+"]" hJson := {} nLength := hb_JSONDecode( _xRet, @hJson ) for nInf := 1 to len(hJson) Li := hJson[nInf] if len(Li) > 0 try ; _xNome := LEFT(UPPER(Li["Nome"])+SPACE(50),50) ; catch ; end try && Para republicavirtual try ; _xNcm := LEFT(UPPER(Li["Ncm"])+SPACE(50),50) ; catch ; end try try ; _Cest := LEFT(UPPER(Li["Cest_Codigo"])+SPACE(02),02) ; catch ; end try try ; _xEmbal := LEFT(UPPER(Li["Embalagem"])+SPACE(30),30) ; catch ; end try try ; _xQtEmb := LEFT(UPPER(Li["QuantidadeEmbalagem"])+SPACE(50),50) ; catch ; end try try ; _xMarca := LEFT(UPPER(Li["Marca"])+SPACE(50),50) ; catch ; end try try ; _xCateg := LEFT(UPPER(Li["Categoria"])+SPACE(30),30) ; catch ; end try try ; _xPeso := LEFT(UPPER(Li["Peso"])+SPACE(50),50) ; catch ; end try && Para republicavirtual try ; _xTrib := LEFT(UPPER(Li["tributacao"])+SPACE(50),50) ; catch ; end try && Para republicavirtual endif next c_Txt :="DESCRIÇÃO: "+ALLTRIM(_xNome )+CRLF+; "NCM......: "+ALLTRIM(_xNcm )+CRLF+; "CEST.....: "+ALLTRIM(_Cest )+CRLF+; "TIPO EMB.: "+ALLTRIM(_xEmbal)+CRLF+; "QT. EMB..: "+ALLTRIM(_xQtEmb)+CRLF+; "MARCA....: "+ALLTRIM(_xMarca)+CRLF+; "CATEGORIA: "+ALLTRIM(_xCateg)+CRLF+; "PESO.....: "+ALLTRIM(_xPeso )+CRLF+; "TRUBUT...: "+ALLTRIM(_xTrib ) IF FileWrite("eaninfo.txt", c_Txt) MyMsgRun("",,{||WAITRUN(GETENV("ComSpec")+" /C START NOTEPAD .\eaninfo.txt", 0 )}) ELSE SysRefresh() ; MsgAlert("Não foi possível criar o arquivo .txt!", "Aviso do sistema") ENDIF else SysRefresh() ; MsgInfo(_xRet, "Aviso") endif ELSE // Donwload da imagem do produto cFimg := GetCurDir()+"\tempdir\"+_xBar+".jpg" FileWrite(cFimg, _xRet) hIni := LEFT(TIME(),8) WHILE ! FILE(cFimg) SysWait(0.25) IF SECS(ELAPTIME(hIni, LEFT(TIME(),8))) > 10 ; EXIT ; ENDIF LOOP END SysWait(0.25) * WAITRUN(GETENV("ComSpec")+" /C START NOTEPAD .\"+cFimg, 0 ) ENDIF RETURN NIL
  10. Olá, senhores. Como faço para obter a imagem baixada deste exemplo via código? http://www.eanpictures.com.br:9000/api/gtin/7896806700069 Grato
  11. Você poderia enviar o link do site?
  12. Opa! Eu tinha entendido errado. Mas, desculpa minha ignorância, poderia me dizer por que precisa fazer isso?
  13. Será que os valores retornados na função abaixo server? //----------------------------------------------------------------------------// FUNCTION DLG_RESOLUCION( oDlg ) LOCAL aPor := {1,1},; nWidth := GetSysMetrics(0),; nHeight := GetSysMetrics(1) nTWid := WndWidth(FindWindow( 'Shell_TrayWnd',nil)) IF nTWid < nWidth // TrayBar position: Right or left nWidth -= nTWid ENDIF nThei := WndHeight(FindWindow( 'Shell_TrayWnd',nil)) IF nThei < nHeight // TrayBar position: Bottom or top nHeight -= nThei ENDIF nBwid := ((100/oDlg:nWidth)*nWidth)/100 nBhei := ((100/oDlg:nHeight)*nHeight)/100 aPor := {nBwid, nBhei} RETURN aPor
  14. Realmente JSON é mais simples. Mas como eu tive alguns problemas com a função hb_jsondecode() em outro caso, fiquei preocupado e parei de usar.
×
×
  • Create New...