Posté le 09 décembre 2014 - 16:38 |
Procedure WS_Taxi_Disponivel(LOCAL DebugSN)
ok, bRet is boolean = False
nRetornoCodigo is int = 0
nContador is int = 0
CodClienteCelula is string = ""
XML_Retorno is string = ""
LocSt_TaxisLogados is ST_TaxisLogados
IpSaladaFruta01 is string = Morango_01 +"."+ Abacaxi_02 +"."+ Limao_03 +"."+ Melancia_04 +":"+ Laranja_05
IpSaladaFruta02 is string = Morango_01 +"."+ Abacaxi_02 +"."+ Limao_03 +"."+ Melancia_04 +":"+ Manga_06
ChangeCharset(charsetOccidental)
HReadSeekFirst(t001_cliente,t001_cliente.t001_seq_cliente,1) IF HFound(t001_cliente) = True AND t001_cliente.t001_cod_clientecelula > 0 THEN
CodClienteCelula = t001_cliente.t001_cod_clientecelula
NumProces is string = WS_Taxi_ValidaRequisicao(t001_cliente.t001_ddd_telefone,... t001_cliente.t001_num_telefone,... 0,... 0,... "N")
Xml_SEND is string = [ <soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:act297_RtPlusSSDM-IRtPlusSSDM#ObterRelacaoDeVeiculosLogados"> <soapenv:Header/> <soapenv:Body> <urn:ObterRelacaoDeVeiculosLogados soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> <cod_client_celula xsi:type="xsd:int">V001</cod_client_celula> <dat_hora_proces xsi:type="xsd:string">V002</dat_hora_proces> <num_proces xsi:type="xsd:int">V003</num_proces> </urn:ObterRelacaoDeVeiculosLogados> </soapenv:Body> </soapenv:Envelope> ]
Xml_SEND = Clip(Replace(Xml_SEND,"V001",CodClienteCelula)) Xml_SEND = Clip(Replace(Xml_SEND,"V002",GloDataHora)) Xml_SEND = Clip(Replace(Xml_SEND,"V003",NumProces))
IF DebugSN = "S" THEN Info("/mnt/sdcard/TaxiFv/Arquivos/EnvioWSVersao.TXT", Xml_SEND) IF InAndroidMode() = True IF InSimulatorMode() = False THEN fSaveBuffer("/mnt/sdcard/TaxiFv/Arquivos/EnvioWSVersao.TXT", Xml_SEND) ELSE fSaveBuffer("c:\EnvioWSVersao.TXT", Xml_SEND) END END END
HTTPTimeOut(GloHTTPTimeOut)
ok = HTTPRequest("http://"+IpSaladaFruta01+"/soap/IRtPlusSSDM","", "", Xml_SEND, "text/xml","","")
IF ok = True
XML_Retorno = WS_Android_IOS_HTTPGetResult()
ok = False
IF DebugSN = "S" Info("/mnt/sdcard/TaxiFv/Arquivos/RetornoWSVersaoSemTratamento.TXT",XML_Retorno) IF InAndroidMode() = True IF InSimulatorMode() = False THEN fSaveBuffer("/mnt/sdcard/TaxiFv/Arquivos/RetornoWSVersaoSemTratamento.TXT", XML_Retorno) ELSE fSaveBuffer("C:\RetornoWSVersao.TXT", XML_Retorno) END END END
XML_Retorno = WS_RemoveAcentos(XML_Retorno)
IF Length(XML_Retorno) > 0 THEN
ArrayDeleteAll(arr_TaxisLogados)
IF IniOSMode() = True THEN
NoXml is string i is int = 1
LOOP
NoXml = XMLExtractString(XML_Retorno,"NS2:TVeiculoLogadoVO",i)
IF NoXml = "" THEN BREAK END
LocSt_TaxisLogados.ST_ID = XMLExtractString(NoXml,"NumUnidad") LocSt_TaxisLogados.ST_Latitude = XMLExtractString(NoXml,"ValLatitu",1) LocSt_TaxisLogados.ST_Longitude = XMLExtractString(NoXml,"ValLongit",1) LocSt_TaxisLogados.ST_Situacao = XMLExtractString(NoXml,"IdeStatus",1)
arr_TaxisLogados[LocSt_TaxisLogados.ST_ID] = LocSt_TaxisLogados
nContador ++ i++ ok = True
IF DebugSN = "S" THEN Info(LocSt_TaxisLogados.ST_ID,LocSt_TaxisLogados.ST_Latitude,LocSt_TaxisLogados.ST_Longitude,LocSt_TaxisLogados.ST_Situacao) END
END
ELSE IF InAndroidMode() = True
nInicial is int nFinal is int nInicial = PositionOccurrence(XML_Retorno,"<NS2:TVeiculoLogadoVO",firstRank,FromBeginning) nFinal = PositionOccurrence(XML_Retorno,"</NS2:TVeiculoLogadoVO>",lastRank,FromEnd) +Length("</NS2:TVeiculoLogadoVO>") XML_Retorno = Middle(XML_Retorno,nInicial,nFinal - nInicial) XML_Retorno = Replace(XML_Retorno,"NS2:TVeiculoLogadoVO","NoXml") XML_Retorno = "<Xml><Recorte>"+XML_Retorno+"</Recorte></Xml>"
IF DebugSN = "S" THEN Info(XML_Retorno) IF InAndroidMode() = True fSaveBuffer("/mnt/sdcard/TaxiFv/Arquivos/RecorteBlocoLogados.TXT", XML_Retorno) END END
XmlDoc is XMLDocument
XmlDoc = XMLOpen(XML_Retorno, fromString)
NoXml is xmlNode
FOR EACH NoXml OF XmlDoc.Xml.Recorte on NoXml
IF NoXml.NumUnidad <> Null AND NoXml.ValLatitu <> Null AND NoXml.ValLongit <> Null THEN
nContador += 1 ok = True LocSt_TaxisLogados.ST_ID = NoXml.NumUnidad LocSt_TaxisLogados.ST_Latitude = NoXml.ValLatitu LocSt_TaxisLogados.ST_Longitude = NoXml.ValLongit LocSt_TaxisLogados.ST_Situacao = NoXml.IdeStatus
arr_TaxisLogados[LocSt_TaxisLogados.ST_ID] = LocSt_TaxisLogados
END
END
END
END
END
END
IF DebugSN = "S" THEN Info("Qtde de Taxis Disponiveis:",nContador) END
RESULT(ok) |
| |
| |
|