Integracao Touch Comp ERP Terceiros (API/Endpoints)/Pesquisa Dados
Integracao_Touch_Comp_ERP_Terceiros_(API/Endpoints)
O Touch Comp ERP, possui API's preparadas para pesquisas genéricas de dados, vinculados ao endpoint integrado.
A mensagem do PUT, a ser enviada, deve conter os parâmetros. Especialmente sobre o parametro tipo de pesquisa, há 3 opções:
- Normal
- Inteligente
- Últimos registros
Pesquisa Normal
Esta deve ser a pesquisa mais utilizada por parceiros integradores. A mesma da possibilidades de pesquisa por diversos filtros(campos) e opções de pesquisa. Podem ser realizadas diversas combinações de condições e campos, conforme a necessidade do integrador.
{
"input": {
"indiceNrRegistros": 1,
"registrosPorRequisicao": 100,
"entityClass": "ClassificacaoProdutos",
"tipoPesquisa": "PESQUISA_NORMAL",
"criteriaJunctions": [
{
"junction": "CONJUNCTION",
"searchFields": [
{
"field": "classificacaoPai.identificador",
"restrictionOption": "EQUAL",
"value1": "73",
"value2": null
}
]
}
]
}
}
O json acima especifica que será pesquisado dados de produtos, onde será retornado a página 1 (indiceNrRegistros) com 100 produtos. Para listar os próximos 100 produtos, basta informar indiceNrRegistros=2.
criteriaJunctions especifica que realizaza uma junção (and) dos fields vinculados (searchFields). Foi informado apenas um filtro (identificador) com opção "igual a" (EQUAL) a 1 ("value1":"1").
Cada entidade possui filtros(fields) diferentes conforme os dados que armazenam. Para conhecer os fields, basta acessar o recurso em questão na WEB, e verificar na tela de pesquisa quais as opções existentes. Por outro lado as restrições (restrictionOption) variam conform o tipo de dado do field (Númerico, texto, Data). Consulte na seção específica os tipos de dados existentes e as opções de pesquisa.
O json resultado desta pesquisa, irá retornar os campos conforme o modelo DTO a ser retornado, informado como parâmetro na query. Este modelo deve ser mapeado previamente pela Touch Comp, que irá informar ao integrador qual o modelo a ser utilizado conforme sua necessidade.
Pesquisa Inteligente
Nesta opção, o ERP identifica o dado e automaticamente associa a uma opção especifica correspondente. Se informado um número, irá pesquisar como se fosse o identificador da entidade. Se informado uma data, irá pesquisar por exemplo, pela data de cadastro, e assim sucessivamente.
Cada entidade pode possui um comportamento diferente neste caso, conforme o mapeamento realizado pela Touch Comp.
{
"indiceNrRegistros":1,
"registrosPorRequisicao":100,
"entityClass":"Produto",
"tipoPesquisa":"PESQUISA_INTELIGENTE",
"strSmartSearch":"1"
}
No caso de Produto, seria pesquisado automaticamente o produto com identificador = 1. Se informado em strSmartSearch a palavra "Tinta", por outro lado, o sistema pesquisaria automaticamente os produtos cujo nome contenha a palavra tinta.
Últimos Registros
Neste formato de pesquisa, são carregados os últimos registros que foram salvos no banco, ligados a entidade/tabela.
{
"indiceNrRegistros":1,
"registrosPorRequisicao":100,
"entityClass":"Produto",
"tipoPesquisa":"PESQUISA_ULT_REGISTROS"
}
Campos de Pesquisa
Para saber quais campos de pesquisa que cada entidade possui, utilize o endpoint (GET):
http://servidor:porta/touch-erp/auth/{api_integrada}/get-filter-options/entidade
Troque o parametro entidade, para entidade correspondente, como por exemplo a entidade produto:
http://192.168.0.197:8080/touch-erp/auth/{api_integrada}/get-filter-options/Produto
Será retornado o json:
{
"@type": "WebDTOResult",
"status": "SUCESSO",
"messages": [],
"result": {
"identificador": 1307,
"descricao": "Produto",
"searchFields": [
{
"id": 10869,
"text": "Codigo de Barras",
"fieldClass": "java.lang.String",
"field": "codigoBarras.codigoBarras",
"percSize": 0,
"indice": 0,
"retrictions": [
{
"id": "ILIKE",
"text": "Contendo"
},
{
"id": "NOT_EQUAL",
"text": "Diferente de"
},
{
"id": "EQUAL",
"text": "Igual a"
},
{
"id": "IS_NULL",
"text": "Nulo"
},
{
"id": "IS_NOT_NULL",
"text": "Nao Nulo"
}
],
"restrictionOption": null,
"value1": "",
"value2": ""
},
{
"id": 10309,
"text": "Codigo Referencia",
"fieldClass": "java.lang.String",
"field": "codigoReferencia",
"percSize": 0,
"indice": 2,
"retrictions": [
{
"id": "ILIKE",
"text": "Contendo"
},
{
"id": "NOT_EQUAL",
"text": "Diferente de"
},
{
"id": "EQUAL",
"text": "Igual a"
},
{
"id": "IS_NULL",
"text": "Nulo"
},
{
"id": "IS_NOT_NULL",
"text": "Nao Nulo"
}
],
"restrictionOption": null,
"value1": "",
"value2": ""
},
{
"id": 8027,
"text": "Código Auxiliar",
"fieldClass": "java.lang.String",
"field": "codigoAuxiliar",
"percSize": 10,
"indice": 10,
"retrictions": [
{
"id": "ILIKE",
"text": "Contendo"
},
{
"id": "NOT_EQUAL",
"text": "Diferente de"
},
{
"id": "EQUAL",
"text": "Igual a"
},
{
"id": "IS_NULL",
"text": "Nulo"
},
{
"id": "IS_NOT_NULL",
"text": "Nao Nulo"
}
],
"restrictionOption": null,
"value1": "",
"value2": ""
},
{
"id": 8028,
"text": "Código NCM",
"fieldClass": "java.lang.String",
"field": "ncm.codigo",
"percSize": 10,
"indice": 11,
"retrictions": [
{
"id": "ILIKE",
"text": "Contendo"
},
{
"id": "NOT_EQUAL",
"text": "Diferente de"
},
{
"id": "EQUAL",
"text": "Igual a"
},
{
"id": "IS_NULL",
"text": "Nulo"
},
{
"id": "IS_NOT_NULL",
"text": "Nao Nulo"
}
],
"restrictionOption": null,
"value1": "",
"value2": ""
},
{
"id": 8029,
"text": "Data Cadastro",
"fieldClass": "java.util.Date",
"field": "dataCadastro",
"percSize": 10,
"indice": 12,
"retrictions": [
{
"id": "EQUAL",
"text": "Igual a"
},
{
"id": "NOT_EQUAL",
"text": "Diferente de"
},
{
"id": "GREATER",
"text": "Maior que"
},
{
"id": "GREATER_EQUAL",
"text": "Maior igual a"
},
{
"id": "LESS",
"text": "Menor que"
},
{
"id": "LESS_EQUAL",
"text": "Menor igual a"
},
{
"id": "BETWEEN",
"text": "Entre datas"
},
{
"id": "IS_NULL",
"text": "Nulo"
},
{
"id": "IS_NOT_NULL",
"text": "N�o Nulo"
}
],
"restrictionOption": null,
"value1": "19/10/2023",
"value2": "19/10/2023"
},
{
"id": 6,
"text": "Id. Produtos Similares",
"fieldClass": "java.lang.Long",
"field": "produtosSimilaresItens.produtosSimilares.identificador",
"percSize": 0,
"indice": 13,
"retrictions": [
{
"id": "EQUAL",
"text": "Igual a"
},
{
"id": "NOT_EQUAL",
"text": "Diferente de"
},
{
"id": "GREATER",
"text": "Maior que"
},
{
"id": "GREATER_EQUAL",
"text": "Maior igual a"
},
{
"id": "LESS",
"text": "Menor que"
},
{
"id": "LESS_EQUAL",
"text": "Menor igual a"
},
{
"id": "BETWEEN",
"text": "Entre"
},
{
"id": "IS_NULL",
"text": "Nulo"
},
{
"id": "IS_NOT_NULL",
"text": "Nao Nulo"
}
],
"restrictionOption": null,
"value1": "0",
"value2": "0"
},
{
"id": 7,
"text": "Descricao Produtos Similares",
"fieldClass": "java.lang.String",
"field": "produtosSimilaresItens.produtosSimilares.descricao",
"percSize": 0,
"indice": 14,
"retrictions": [
{
"id": "ILIKE",
"text": "Contendo"
},
{
"id": "NOT_EQUAL",
"text": "Diferente de"
},
{
"id": "EQUAL",
"text": "Igual a"
},
{
"id": "IS_NULL",
"text": "Nulo"
},
{
"id": "IS_NOT_NULL",
"text": "Nao Nulo"
}
],
"restrictionOption": null,
"value1": "",
"value2": ""
},
{
"id": 8032,
"text": "Fabricante",
"fieldClass": "java.lang.String",
"field": "fabricante.nome",
"percSize": 10,
"indice": 15,
"retrictions": [
{
"id": "ILIKE",
"text": "Contendo"
},
{
"id": "NOT_EQUAL",
"text": "Diferente de"
},
{
"id": "EQUAL",
"text": "Igual a"
},
{
"id": "IS_NULL",
"text": "Nulo"
},
{
"id": "IS_NOT_NULL",
"text": "Nao Nulo"
}
],
"restrictionOption": null,
"value1": "",
"value2": ""
},
{
"id": 8033,
"text": "Identificador",
"fieldClass": "java.lang.Long",
"field": "identificador",
"percSize": 10,
"indice": 16,
"retrictions": [
{
"id": "EQUAL",
"text": "Igual a"
},
{
"id": "NOT_EQUAL",
"text": "Diferente de"
},
{
"id": "GREATER",
"text": "Maior que"
},
{
"id": "GREATER_EQUAL",
"text": "Maior igual a"
},
{
"id": "LESS",
"text": "Menor que"
},
{
"id": "LESS_EQUAL",
"text": "Menor igual a"
},
{
"id": "BETWEEN",
"text": "Entre"
},
{
"id": "IS_NULL",
"text": "Nulo"
},
{
"id": "IS_NOT_NULL",
"text": "Nao Nulo"
}
],
"restrictionOption": null,
"value1": "0",
"value2": "0"
},
{
"id": 8034,
"text": "Localização",
"fieldClass": "java.lang.String",
"field": "localizacao.nome",
"percSize": 10,
"indice": 17,
"retrictions": [
{
"id": "ILIKE",
"text": "Contendo"
},
{
"id": "NOT_EQUAL",
"text": "Diferente de"
},
{
"id": "EQUAL",
"text": "Igual a"
},
{
"id": "IS_NULL",
"text": "Nulo"
},
{
"id": "IS_NOT_NULL",
"text": "Nao Nulo"
}
],
"restrictionOption": null,
"value1": "",
"value2": ""
},
{
"id": 8035,
"text": "Nome",
"fieldClass": "java.lang.String",
"field": "nome",
"percSize": 10,
"indice": 18,
"retrictions": [
{
"id": "ILIKE",
"text": "Contendo"
},
{
"id": "NOT_EQUAL",
"text": "Diferente de"
},
{
"id": "EQUAL",
"text": "Igual a"
},
{
"id": "IS_NULL",
"text": "Nulo"
},
{
"id": "IS_NOT_NULL",
"text": "Nao Nulo"
}
],
"restrictionOption": null,
"value1": "",
"value2": ""
},
{
"id": 8036,
"text": "Nome Auxiliar",
"fieldClass": "java.lang.String",
"field": "nomeAuxiliar",
"percSize": 10,
"indice": 19,
"retrictions": [
{
"id": "ILIKE",
"text": "Contendo"
},
{
"id": "NOT_EQUAL",
"text": "Diferente de"
},
{
"id": "EQUAL",
"text": "Igual a"
},
{
"id": "IS_NULL",
"text": "Nulo"
},
{
"id": "IS_NOT_NULL",
"text": "Nao Nulo"
}
],
"restrictionOption": null,
"value1": "",
"value2": ""
},
{
"id": 8037,
"text": "Observação",
"fieldClass": "java.lang.String",
"field": "observacao",
"percSize": 10,
"indice": 20,
"retrictions": [
{
"id": "ILIKE",
"text": "Contendo"
},
{
"id": "NOT_EQUAL",
"text": "Diferente de"
},
{
"id": "EQUAL",
"text": "Igual a"
},
{
"id": "IS_NULL",
"text": "Nulo"
},
{
"id": "IS_NOT_NULL",
"text": "Nao Nulo"
}
],
"restrictionOption": null,
"value1": "",
"value2": ""
},
{
"id": 8038,
"text": "Subespécie",
"fieldClass": "java.lang.String",
"field": "subEspecie.nome",
"percSize": 10,
"indice": 21,
"retrictions": [
{
"id": "ILIKE",
"text": "Contendo"
},
{
"id": "NOT_EQUAL",
"text": "Diferente de"
},
{
"id": "EQUAL",
"text": "Igual a"
},
{
"id": "IS_NULL",
"text": "Nulo"
},
{
"id": "IS_NOT_NULL",
"text": "Nao Nulo"
}
],
"restrictionOption": null,
"value1": "",
"value2": ""
},
{
"id": 8039,
"text": "Unidade Medida",
"fieldClass": "java.lang.String",
"field": "unidadeMedida.sigla",
"percSize": 10,
"indice": 22,
"retrictions": [
{
"id": "ILIKE",
"text": "Contendo"
},
{
"id": "NOT_EQUAL",
"text": "Diferente de"
},
{
"id": "EQUAL",
"text": "Igual a"
},
{
"id": "IS_NULL",
"text": "Nulo"
},
{
"id": "IS_NOT_NULL",
"text": "Nao Nulo"
}
],
"restrictionOption": null,
"value1": "",
"value2": ""
}
]
},
"countOf": 0,
"name": null,
"message": null,
"detailMessage": null
}