Arquivo de Remessa CNAB

bug#9100
bug#9803
bug#10881

dev:rafael.henrique

qua:José

git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/GeneradorBoletosCNAB/trunk@82482 d1611594-4594-4d17-8e1d-87c2c4800839
master
rafael.henrique 2018-06-07 21:07:27 +00:00
parent 46dd13bea1
commit 7933368120
2 changed files with 124 additions and 19 deletions

View File

@ -146,29 +146,29 @@ public abstract class AbstractFlatFile{
public void copyInputStreamToFile(InputStream initialStream, File targetFile) throws IOException { public void copyInputStreamToFile(InputStream initialStream, File targetFile) throws IOException {
// OutputStream outStream = new FileOutputStream(targetFile); OutputStream outStream = new FileOutputStream(targetFile);
//
// byte[] buffer = new byte[8 * 1024]; byte[] buffer = new byte[8 * 1024];
// int bytesRead;
// while ((bytesRead = initialStream.read(buffer)) != -1) {
// outStream.write(buffer, 0, bytesRead);
// }
//
// IOUtils.closeQuietly(initialStream);
// IOUtils.closeQuietly(outStream);
Reader reader = new BufferedReader(new InputStreamReader(initialStream));
Writer writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(targetFile), "Cp1252"));
char[] buffer = new char[8 * 1024];
int bytesRead; int bytesRead;
while ((bytesRead = reader.read(buffer)) != -1){ while ((bytesRead = initialStream.read(buffer)) != -1) {
writer.write(buffer, 0, bytesRead); outStream.write(buffer, 0, bytesRead);
} }
IOUtils.closeQuietly(initialStream); IOUtils.closeQuietly(initialStream);
IOUtils.closeQuietly(reader); IOUtils.closeQuietly(outStream);
IOUtils.closeQuietly(writer);
// Reader reader = new BufferedReader(new InputStreamReader(initialStream));
// Writer writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(targetFile), "Cp1252"));
//
// char[] buffer = new char[8 * 1024];
// int bytesRead;
// while ((bytesRead = reader.read(buffer)) != -1){
// writer.write(buffer, 0, bytesRead);
// }
//
// IOUtils.closeQuietly(initialStream);
// IOUtils.closeQuietly(reader);
// IOUtils.closeQuietly(writer);
} }
/** /**

View File

@ -0,0 +1,105 @@
<txg:Texgit xmlns:txg="http://gilmatryx.googlepages.com/Texgit" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://gilmatryx.googlepages.com/Texgit file:////home/gilmar/NFM/WORKSPACE/TexgitSchema.xsd" version="1.0-academic">
<FlatFile>
<layout>
<name>Arquivo-Remessa_BBCNAB240</name>
<version>Version 01, Published: 2012/05/25</version>
<description>
Layout para Cobrança.
Arquivo texto - padrão CNAB Meio de Registro Transmissão de Dados Descrição de Registro - Tamanho 240 Bytes
Organização Sequencial ARQUIVO FORMATO CNAB REMESSA,
REGISTROS:
0 - Header do Arquivo
1 - Header do Lote
3 - Segmento P
3 - Segmento Q
5 - Trailler Lote
9 - Trailler Arquivo
</description>
</layout>
<GroupOfRecords>
<Record name="Header" description="Protocolo de comunicação">
<GroupOfFields>
<IdType name="IdentificacaoRegistro" value="0" length="1" position="1" />
<Field name="TipoOperacao" length="1" padding="ZERO_LEFT" />
<Field name="IdentificacaoExtensoTipoOperacao" value="REMESSA" length="7" />
<Field name="IdentificacaoTipoServico" length="2" padding="ZERO_LEFT" />
<Field name="IdentificacaoExtensoTipoServico" length="8" />
<Field name="ComplementoRegistro" length="7" />
<Field name="PrefixoAgencia" length="4" padding="ZERO_LEFT" />
<Field name="DigitoVerificadorAgencia" length="1"/>
<Field name="NumeroContaCorrente" length="8" padding="ZERO_LEFT" />
<Field name="DigitoVerificadorContaCorrente" length="1" />
<Field name="Filler" length="6" />
<Field name="NomeCedente" length="30" />
<Field name="BB" length="18" value="001BANCODOBRASIL" />
<Field name="DataGravacao" length="6" type="DATE" format="DATE_DDMMYY" />
<Field name="SequencialRemessa" length="7" />
<Field name="Filler" length="22" />
<Field name="NumeroConvencioLider" length="7" padding="ZERO_LEFT" />
<Field name="Filler" length="258" />
</GroupOfFields>
</Record>
<Record name="TransacaoTitulo" repeatable="true" description="Registro de Transação - Tipo 1">
<GroupOfFields>
<IdType name="IdentiFicacaoRegistroDetalhe" value="1" length="1" position="1" />
<Field name="TipoInscricaoCedente" length="2" padding="ZERO_LEFT" />
<Field name="NumeroCpfCnpjCedente" length="14" padding="ZERO_LEFT"/>
<Field name="PrefixoAgencia" length="4" padding="ZERO_LEFT" />
<Field name="DigitoVerificadorAgencia" length="1" />
<Field name="NumeroContaCorrenteCedente" length="8" padding="ZERO_LEFT" />
<Field name="DigitoVerificadorConta" length="1" />
<Field name="NumeroCovenioCobrancaCedente" length="7" padding="ZERO_LEFT" />
<Field name="CodigoControleEmpresa" length="25"/>
<Field name="NossoNumero" length="17" padding="ZERO_LEFT" />
<Field name="NumeroPrestacao" length="2" padding="ZERO_LEFT" />
<Field name="GrupoValor" length="2" padding="ZERO_LEFT"/>
<Field name="Filler" length="3" />
<Field name="IndicativoMensagemSacador" length="1" />
<Field name="PrefixoTitulo" length="3" />
<Field name="VariacaoCarteira" length="3" padding="ZERO_LEFT" />
<Field name="ContaCaucao" length="1" padding="ZERO_LEFT" />
<Field name="NumeroBordero" length="6" padding="ZERO_LEFT" />
<Field name="TipoCobranca" length="5"/>
<Field name="CarteiraCobranca" length="2" padding="ZERO_LEFT" />
<Field name="Comando" length="2" padding="ZERO_LEFT" />
<Field name="NumeroTituloAtribuidoCedente" length="10" />
<Field name="DataVencimento" length="6" type="DATE" format="DATE_DDMMYY" />
<Field name="ValorTitulo" length="11" type="BIGDECIMAL" format="DECIMAL_DD" padding="ZERO_LEFT" />
<Field name="NumeroBanco" length="3" padding="ZERO_LEFT" />
<Field name="PrefixoAgenciaCobradora" length="4" padding="ZERO_LEFT" />
<Field name="DigitoVerificadorPrefixoAgenciaCobradora" length="1" />
<Field name="EspecieTitulo" length="2" padding="ZERO_LEFT" />
<Field name="AceiteTitulo" length="1" />
<Field name="DataEmissao" length="6" type="DATE" format="DATE_DDMMYY" />
<Field name="InstrucaoCodificada" length="2" padding="ZERO_LEFT" />
<Field name="InstrucaoCodificada" length="2" padding="ZERO_LEFT" />
<Field name="JurosMoraDiaAtraso" length="11" padding="ZERO_LEFT" />
<Field name="DataLimite" length="6" padding="ZERO_LEFT" type="DATE" format="DATE_DDMMYY" />
<Field name="ValorDesconto" length="11" type="BIGDECIMAL" format="DECIMAL_DD" padding="ZERO_LEFT" />
<Field name="ValorIof" length="11" type="BIGDECIMAL" format="DECIMAL_DD" padding="ZERO_LEFT" />
<Field name="ValorAbatimento" length="11" type="BIGDECIMAL" format="DECIMAL_DD" padding="ZERO_LEFT" />
<Field name="TipoInscricaoSacado" length="2" padding="ZERO_LEFT" />
<Field name="NumeroCnpjCpfSacado" length="14" padding="ZERO_LEFT" />
<Field name="NomeSacado" length="37" />
<Field name="Complemento" length="3" />
<Field name="EnderecoSacado" length="40" />
<Field name="BairroSacado" length="12" />
<Field name="CepEnderecoSacado" length="8" padding="ZERO_LEFT" />
<Field name="CidadeSacado" length="15" />
<Field name="UfCidadeSacado" length="2" />
<Field name="Observacao" length="40" />
<Field name="NumeroDiasProtesto" length="2" />
<Field name="ComplementoRegistro" length="1" />
<Field name="SequencialRegistro" length="6" padding="ZERO_LEFT" />
</GroupOfFields>
</Record>
<Record name="Trailler">
<GroupOfFields>
<IdType name="CodigoDoRegistro" value="9" length="1" position="1" />
<Field name="Filler" length="393" />
<Field name="NumeroSequencialRegistro" length="6" padding="ZERO_LEFT" />
</GroupOfFields>
</Record>
</GroupOfRecords>
</FlatFile>
</txg:Texgit>