diff --git a/Fluig novo/.metadata/.plugins/org.eclipse.m2e.logback.configuration/0.log b/Fluig novo/.metadata/.plugins/org.eclipse.m2e.logback.configuration/0.log
index 1653cc8..beed5a7 100644
--- a/Fluig novo/.metadata/.plugins/org.eclipse.m2e.logback.configuration/0.log
+++ b/Fluig novo/.metadata/.plugins/org.eclipse.m2e.logback.configuration/0.log
@@ -6,3 +6,4 @@
2026-05-12 08:45:43,538 [Worker-5: Loading available Gradle versions] INFO o.e.b.c.i.u.g.PublishedGradleVersions - Gradle version information cache is out-of-date. Trying to update.
2026-05-13 08:52:02,273 [Worker-4: Loading available Gradle versions] INFO o.e.b.c.i.u.g.PublishedGradleVersions - Gradle version information cache is out-of-date. Trying to update.
2026-05-15 08:38:54,281 [Worker-4: Loading available Gradle versions] INFO o.e.b.c.i.u.g.PublishedGradleVersions - Gradle version information cache is out-of-date. Trying to update.
+2026-05-19 10:21:23,094 [Worker-6: Loading available Gradle versions] INFO o.e.b.c.i.u.g.PublishedGradleVersions - Gradle version information cache is out-of-date. Trying to update.
diff --git a/Fluig novo/.metadata/.plugins/org.eclipse.wst.jsdt.core/indexes/savedIndexNames.txt b/Fluig novo/.metadata/.plugins/org.eclipse.wst.jsdt.core/indexes/savedIndexNames.txt
index 312fcbf..b2bdb3e 100644
--- a/Fluig novo/.metadata/.plugins/org.eclipse.wst.jsdt.core/indexes/savedIndexNames.txt
+++ b/Fluig novo/.metadata/.plugins/org.eclipse.wst.jsdt.core/indexes/savedIndexNames.txt
@@ -1,2 +1,14 @@
INDEX VERSION 1.4+C:\Users\andrey.cunha\eclipse-workspace.new\Fluig novo\.metadata\.plugins\org.eclipse.wst.jsdt.core\indexes
3974601650.index
+2378767110.index
+1979626790.index
+689185822.index
+2072538917.index
+1124494010.index
+2904386551.index
+636540028.index
+2173043530.index
+2447630285.index
+1053508610.index
+1223765803.index
+1053469344.index
diff --git a/Ginseng_chamados/.vscode/servers.json b/Ginseng_chamados/.vscode/servers.json
index 301f7cf..7a5ee95 100644
--- a/Ginseng_chamados/.vscode/servers.json
+++ b/Ginseng_chamados/.vscode/servers.json
@@ -2,13 +2,13 @@
"version": "1.0.0",
"configurations": [
{
- "id": "s220blnhijmp1hrc14fyurof1h5bo",
+ "id": "q7ea9knyu7mpco81suuc482gafgxi",
"name": "Ginseng Produção",
"host": "comerciode188006.fluig.cloudtotvs.com.br",
"ssl": true,
"port": 443,
"username": "andrey.cunha",
- "password": "eyJpdiI6IjYwM2Y4MjdmODAyMWNiMTE3ZmFiNmNlZTc4Yzk3NTkyIiwic2FsdCI6ImQ0Nzg1N2I1OGYxNWUxZTQxYTg3MGMzYzRlMTdiM2JiIiwidGV4dCI6IjdiOTZkMTVlYmIzYjBmOTk0YjE2YmQ3YWFiZmY1MjFlIn0=",
+ "password": "eyJpdiI6ImVlZTgwOTZiMzhlNjhiMGU5N2MzNjQzY2UwMzRlOGVhIiwic2FsdCI6IjcyOWFhNjRkMjZlYTZkOGJkZjY5NWI2N2Q5MTI4NDZkIiwidGV4dCI6ImNmMmEyN2NmMWJkNTA3MzgyZGZjM2Y4NzE4NjkwYjllIn0=",
"userCode": "andrey.cunha",
"confirmExporting": false,
"hasBrowser": false,
diff --git a/Ginseng_chamados/forms/Abertura_chamado_operacoes/totvsflow_abertura_chamado.html b/Ginseng_chamados/forms/Abertura_chamado_operacoes/totvsflow_abertura_chamado.html
index a0ce0e8..a51ac08 100644
--- a/Ginseng_chamados/forms/Abertura_chamado_operacoes/totvsflow_abertura_chamado.html
+++ b/Ginseng_chamados/forms/Abertura_chamado_operacoes/totvsflow_abertura_chamado.html
@@ -313,18 +313,20 @@
*
+ 'displayKey':'LOJA',
+ 'datasetId':'dsFiliais',
+ 'placeholder': 'Pesquisar por nome do estabelecimento.',
+ 'fields':[
+ {'field':'LOJA','label':'Filial','standard':'true','search':'true'},
+ {'field':'REGIONAL','label':'REGIONAL','standard':'true'},
+ {'field':'UF','label':'UF','standard':'true'},
+ {'field':'RESPONSAVEL_LOJA','label':'RESPONSAVEL_LOJA','visible':'false'},
+ {'field':'PDV','label':'PDV','visible':'false'},
+ {'field':'PROTHEUS','label':'PROTHEUS','visible':'false'},
+ {'field':'COLLEAGUE_ID','label':'COLLEAGUE_ID','visible':'false'},
+ {'field':'LOGIN_LOJA','label':'LOGIN_LOJA','visible':'false'}
+ ]
+ }"/>
Preenchimento obrigatório.
diff --git a/compras_digital/forms/Compras_digital/Compras_digital.html b/compras_digital/forms/Compras_digital/Compras_digital.html
index 5a46dd7..46cea72 100644
--- a/compras_digital/forms/Compras_digital/Compras_digital.html
+++ b/compras_digital/forms/Compras_digital/Compras_digital.html
@@ -651,6 +651,7 @@
+
@@ -914,7 +915,7 @@
-
@@ -953,7 +954,7 @@
0
- Com pedido
+ Com documento
0
diff --git a/compras_digital/forms/Compras_digital/compras_digital.js b/compras_digital/forms/Compras_digital/compras_digital.js
index 8854927..a956401 100644
--- a/compras_digital/forms/Compras_digital/compras_digital.js
+++ b/compras_digital/forms/Compras_digital/compras_digital.js
@@ -510,17 +510,28 @@ function documentoEhPlaceholder(valor) {
return /^X+$/.test(v);
}
+function contratoEhValido(valor) {
+ var v = String(valor || "").trim();
+ if (!v) return false;
+ if (/^0+$/.test(v)) return false;
+ return true;
+}
+
function linhaCotacaoVencedora(row) {
var pedido = String(row.C8_NUMPED || "").trim();
var itemPedido = String(row.C8_ITEMPED || "").trim();
var fornece = String(row.C8_FORNECE || "").trim();
var loja = String(row.C8_LOJA || "").trim();
- if (documentoEhPlaceholder(pedido)) return false;
- if (documentoEhPlaceholder(itemPedido)) return false;
if (!fornece || !loja) return false;
- return true;
+ // Pedido gerado
+ if (!documentoEhPlaceholder(pedido) && !documentoEhPlaceholder(itemPedido)) return true;
+
+ // Contrato gerado
+ if (contratoEhValido(row.C8_NUMCON)) return true;
+
+ return false;
}
function possuiFornecedorCotacao(row) {
@@ -557,7 +568,8 @@ function classificarLinhaCotacao(row) {
var status = String(row.STATUS || "").trim().toUpperCase();
if (linhaCotacaoVencedora(row)) {
- return { tipo: "PEDIDO_GERADO", label: "GANHOU", badge: "badge bg-success", tipoFornecedor: "Fornecedor homologado" };
+ var tipoDoc = contratoEhValido(row.C8_NUMCON) ? "CONTRATO_GERADO" : "PEDIDO_GERADO";
+ return { tipo: tipoDoc, label: "GANHOU", badge: "badge bg-success", tipoFornecedor: "Fornecedor homologado" };
}
if (possuiFornecedorCotacao(row)) {
@@ -1010,6 +1022,7 @@ function montarResumoCotacaoPorLinhas(rows, cotacao) {
preco: row.C8_PRECO,
total: row.C8_TOTAL,
pedido: String(row.C8_NUMPED || "").trim(),
+ contrato: String(row.C8_NUMCON || "").trim(),
statusApi: String(row.STATUS || "").trim(),
tipo: classif.tipo,
label: classif.label,
@@ -1046,11 +1059,13 @@ function montarResumoCotacaoPorLinhas(rows, cotacao) {
if (vencedorPedido) {
qtdPedidoGerado++;
+ var tipoVencedor = contratoEhValido(vencedorPedido.C8_NUMCON) ? "CONTRATO_GERADO" : "PEDIDO_GERADO";
itens.push({
item: item,
fornecedor: String(vencedorPedido.C8_FORNECE || "").trim() + "/" + String(vencedorPedido.C8_LOJA || "").trim(),
pedido: String(vencedorPedido.C8_NUMPED || "").trim(),
- tipo: "PEDIDO_GERADO"
+ contrato: String(vencedorPedido.C8_NUMCON || "").trim(),
+ tipo: tipoVencedor
});
return;
}
@@ -1169,7 +1184,19 @@ function alternarTimelineSC() {
focarTimelineSC();
}
-function montarStatusAndamento(scRow, cotacao, pedido) {
+function extrairContratoDoResumoCotacao(resumo) {
+ if (!resumo || !resumo.detalhes) return "";
+ for (var i = 0; i < resumo.detalhes.length; i++) {
+ var d = resumo.detalhes[i];
+ if (d.tipo === "CONTRATO_GERADO" && contratoEhValido(d.contrato)) {
+ return normalizarCodigoComparacao(d.contrato);
+ }
+ }
+ return "";
+}
+
+function montarStatusAndamento(scRow, cotacao, pedido, contrato) {
+ if (contrato) return "Contrato gerado";
if (pedido) return "Pedido gerado";
if (cotacao) return "Cotacao gerada";
@@ -1195,15 +1222,22 @@ function preencherResumoSC(resumoCotacao, erroCotacao, resumoPedido, erroPedido)
var horaCadastro = valorCampo("horaCadastroSCProtheus");
var cotacao = limparNumeroDocumento(valorCampo("cotacaoSCProtheus"));
var pedido = limparNumeroDocumento(valorCampo("pedidoSCProtheus"));
+ var contrato = limparNumeroDocumento(valorCampo("contratoSCProtheus"));
var andamento = valorCampo("statusAtendimento");
var statusCadastroPadrao = normalizarStatusCadastro(statusCadastro, numero);
+ // Fallback: extrair contrato do resumo de cotação se ainda não salvo no campo
+ if (!contrato && resumoCotacao) {
+ contrato = extrairContratoDoResumoCotacao(resumoCotacao);
+ }
+
if (!andamento && numero) {
- if (pedido) andamento = "Pedido gerado";
+ if (contrato) andamento = "Contrato gerado";
+ else if (pedido) andamento = "Pedido gerado";
else if (cotacao) andamento = "Cotacao gerada";
else andamento = "Em andamento";
}
- andamento = normalizarAndamento(andamento, cotacao, pedido);
+ andamento = normalizarAndamento(andamento, cotacao, pedido || contrato);
setLabel("numeroSCProtheus_label", numero);
setLabel("solicitanteSCProtheus_label", solicitante);
@@ -1212,7 +1246,8 @@ function preencherResumoSC(resumoCotacao, erroCotacao, resumoPedido, erroPedido)
setLabel("dataCadastroSCProtheus_label", dataCadastro);
setLabel("horaCadastroSCProtheus_label", horaCadastro);
setLabel("cotacaoSC_label", cotacao);
- setLabel("pedidoSC_label", pedido);
+ setLabel("pedidoSC_label", contrato || pedido);
+ $("#pedidoContratoTipo_label").text(contrato ? "Contrato" : "Pedido");
setBadge("#statusSCProtheus_label", statusCadastroPadrao || (numero ? "SC cadastrada com sucesso" : ""));
setBadge("#statusSC_label", andamento);
@@ -1264,14 +1299,16 @@ function consultarAndamentoSC() {
var cotacao = limparNumeroDocumento(row.C1_COTACAO);
var pedido = limparNumeroDocumento(row.C1_PEDIDO);
+ var contrato = limparNumeroDocumento(row.C1_CONTRATO || "");
if (cotacao) $("#cotacaoSCProtheus").val(cotacao);
if (pedido) $("#pedidoSCProtheus").val(pedido);
+ if (contrato) $("#contratoSCProtheus").val(contrato);
if (row.C1_SOLICIT) $("#solicitanteSCProtheus").val(String(row.C1_SOLICIT).trim());
if (row.C1_EMISSAO) $("#emissaoSCProtheus").val(normalizarDataProtheus(row.C1_EMISSAO));
- var andamento = montarStatusAndamento(row, cotacao, pedido);
+ var andamento = montarStatusAndamento(row, cotacao, pedido, contrato);
if (andamento) $("#statusAtendimento").val(andamento);
var resumoCotacao = null;
@@ -1281,6 +1318,14 @@ function consultarAndamentoSC() {
try {
var cotacoes = JSON.parse(jsonCotacoes);
resumoCotacao = montarResumoCotacaoPorLinhas(cotacoes, cotacao);
+ // Persistir contrato extraído das cotações no campo hidden para recargas futuras
+ if (!contrato && resumoCotacao) {
+ var contratoExtraido = extrairContratoDoResumoCotacao(resumoCotacao);
+ if (contratoExtraido) {
+ contrato = contratoExtraido;
+ $("#contratoSCProtheus").val(contrato);
+ }
+ }
} catch (eCot) {
if (!erroCotacao) erroCotacao = "Falha ao ler cotacoes retornadas pelo ds_consultaSC";
}