Implementado (3 features)
**Agrupamento de faltantes contíguos** (`detector_sequencia.rs`) - Nova função pública `agrupar_contiguos(&[u64]) -> Vec<(u64, u64)>` com 4 testes - Na tela de resultado, faltantes agora aparecem como `• 100–104 (5 notas)` em vez de 5 linhas separadas **Estatísticas de completude** (`resultado.rs`) - Cada série exibe: `Série 001 — 10 faltante(s) — 990/1000 notas (99.0% completo):` **Copiar para clipboard** (`resultado.rs`) - Botão `📋 Copiar` ao lado de cada série nos faltantes — copia todos os números (não só a página atual) - Botão `📋 Copiar` nas duplicatas — copia no formato `1234 (3x), 5678 (2x)` Total: **42 → 46 testes**, todos passando.
This commit is contained in:
@@ -8,8 +8,9 @@ pub fn salvar(conn: &Connection, layout: &Layout) -> Result<i64> {
|
||||
conn.execute(
|
||||
"INSERT INTO layouts
|
||||
(nome, tipo, delimitador, encoding, linha_cabecalho,
|
||||
indice_numero, indice_serie, indice_valor, indice_data)
|
||||
VALUES (?1, 'csv', ?2, ?3, ?4, ?5, ?6, ?7, ?8)",
|
||||
indice_numero, indice_serie, indice_valor, indice_data,
|
||||
indice_documento_tipo)
|
||||
VALUES (?1, 'csv', ?2, ?3, ?4, ?5, ?6, ?7, ?8, ?9)",
|
||||
params![
|
||||
nome,
|
||||
config.delimitador.to_string(),
|
||||
@@ -19,6 +20,7 @@ pub fn salvar(conn: &Connection, layout: &Layout) -> Result<i64> {
|
||||
config.indice_serie as i64,
|
||||
config.indice_valor.map(|v| v as i64),
|
||||
config.indice_data.map(|v| v as i64),
|
||||
config.indice_documento_tipo.map(|v| v as i64),
|
||||
],
|
||||
)?;
|
||||
Ok(conn.last_insert_rowid())
|
||||
@@ -26,8 +28,9 @@ pub fn salvar(conn: &Connection, layout: &Layout) -> Result<i64> {
|
||||
Layout::Xlsx { nome, config, .. } => {
|
||||
conn.execute(
|
||||
"INSERT INTO layouts
|
||||
(nome, tipo, aba, pos_numero, pos_serie, pos_valor, pos_data)
|
||||
VALUES (?1, 'xlsx', ?2, ?3, ?4, ?5, ?6)",
|
||||
(nome, tipo, aba, pos_numero, pos_serie, pos_valor, pos_data,
|
||||
pos_documento_tipo)
|
||||
VALUES (?1, 'xlsx', ?2, ?3, ?4, ?5, ?6, ?7)",
|
||||
params![
|
||||
nome,
|
||||
config.aba,
|
||||
@@ -35,6 +38,7 @@ pub fn salvar(conn: &Connection, layout: &Layout) -> Result<i64> {
|
||||
config.pos_serie,
|
||||
config.pos_valor,
|
||||
config.pos_data,
|
||||
config.pos_documento_tipo,
|
||||
],
|
||||
)?;
|
||||
Ok(conn.last_insert_rowid())
|
||||
@@ -54,8 +58,8 @@ pub fn atualizar(conn: &Connection, layout: &Layout) -> Result<()> {
|
||||
"UPDATE layouts SET
|
||||
nome = ?1, delimitador = ?2, encoding = ?3,
|
||||
linha_cabecalho = ?4, indice_numero = ?5, indice_serie = ?6,
|
||||
indice_valor = ?7, indice_data = ?8
|
||||
WHERE id = ?9",
|
||||
indice_valor = ?7, indice_data = ?8, indice_documento_tipo = ?9
|
||||
WHERE id = ?10",
|
||||
params![
|
||||
nome,
|
||||
config.delimitador.to_string(),
|
||||
@@ -65,6 +69,7 @@ pub fn atualizar(conn: &Connection, layout: &Layout) -> Result<()> {
|
||||
config.indice_serie as i64,
|
||||
config.indice_valor.map(|v| v as i64),
|
||||
config.indice_data.map(|v| v as i64),
|
||||
config.indice_documento_tipo.map(|v| v as i64),
|
||||
id,
|
||||
],
|
||||
)?;
|
||||
@@ -73,8 +78,8 @@ pub fn atualizar(conn: &Connection, layout: &Layout) -> Result<()> {
|
||||
conn.execute(
|
||||
"UPDATE layouts SET
|
||||
nome = ?1, aba = ?2, pos_numero = ?3, pos_serie = ?4,
|
||||
pos_valor = ?5, pos_data = ?6
|
||||
WHERE id = ?7",
|
||||
pos_valor = ?5, pos_data = ?6, pos_documento_tipo = ?7
|
||||
WHERE id = ?8",
|
||||
params![
|
||||
nome,
|
||||
config.aba,
|
||||
@@ -82,6 +87,7 @@ pub fn atualizar(conn: &Connection, layout: &Layout) -> Result<()> {
|
||||
config.pos_serie,
|
||||
config.pos_valor,
|
||||
config.pos_data,
|
||||
config.pos_documento_tipo,
|
||||
id,
|
||||
],
|
||||
)?;
|
||||
@@ -96,7 +102,8 @@ pub fn listar(conn: &Connection) -> Result<Vec<Layout>> {
|
||||
"SELECT id, nome, tipo,
|
||||
delimitador, encoding, linha_cabecalho,
|
||||
indice_numero, indice_serie, indice_valor, indice_data,
|
||||
aba, pos_numero, pos_serie, pos_valor, pos_data
|
||||
aba, pos_numero, pos_serie, pos_valor, pos_data,
|
||||
indice_documento_tipo, pos_documento_tipo
|
||||
FROM layouts ORDER BY nome ASC",
|
||||
)?;
|
||||
|
||||
@@ -124,6 +131,9 @@ pub fn listar(conn: &Connection) -> Result<Vec<Layout>> {
|
||||
indice_data: row
|
||||
.get::<_, Option<i64>>(9)?
|
||||
.map(|v| v as usize),
|
||||
indice_documento_tipo: row
|
||||
.get::<_, Option<i64>>(15)?
|
||||
.map(|v| v as usize),
|
||||
},
|
||||
})
|
||||
} else {
|
||||
@@ -136,6 +146,7 @@ pub fn listar(conn: &Connection) -> Result<Vec<Layout>> {
|
||||
pos_serie: row.get(12)?,
|
||||
pos_valor: row.get(13)?,
|
||||
pos_data: row.get(14)?,
|
||||
pos_documento_tipo: row.get(16)?,
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user