Skip to content

Commit

Permalink
Merge pull request #430 from adrbarros/master
Browse files Browse the repository at this point in the history
Redimensionamento no tamanho do campo quantidade. (NFeRetrato)
  • Loading branch information
robertorp authored Aug 26, 2017
2 parents 89b89f6 + e73fc97 commit c31818f
Show file tree
Hide file tree
Showing 15 changed files with 898 additions and 232 deletions.
13 changes: 11 additions & 2 deletions NFe.AppTeste/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1544,11 +1544,20 @@ private void btn_NFeDistribuicaoDFe_Click(object sender, RoutedEventArgs e)
if (cnpj.Length != 14) throw new Exception("O CNPJ deve conter 14 caracteres!");

var nsu = Funcoes.InpuBox(this, "Consulta NFeDistribuicaoDFe", "Ultimo NSU Retornado");
if (string.IsNullOrEmpty(nsu)) throw new Exception("NSU deve ser informado!");
if (string.IsNullOrEmpty(nsu))
nsu = "0";

if (int.Parse(nsu) < 0) throw new Exception("NSU deve ser maior ou igual a 0");

string chnfe = "";
if (string.IsNullOrEmpty(nsu) || int.Parse(nsu) <= 0)
chnfe = Funcoes.InpuBox(this, "Consulta NFeDistribuicaoDFe", "Chave Eletrônica NFe");

if ((string.IsNullOrEmpty(nsu) || int.Parse(nsu) < 0) && string.IsNullOrEmpty(chnfe))
throw new Exception("Último NSU ou Chave Eletrônica devem ser informados");

var servicoNFe = new ServicosNFe(_configuracoes.CfgServico);
var retornoNFeDistDFe = servicoNFe.NfeDistDFeInteresse(_configuracoes.Emitente.enderEmit.UF.ToString(), cnpj, nsu);
var retornoNFeDistDFe = servicoNFe.NfeDistDFeInteresse(_configuracoes.Emitente.enderEmit.UF.ToString(), cnpj, ultNSU: nsu, chNFE: chnfe);

TrataRetorno(retornoNFeDistDFe);

Expand Down
85 changes: 85 additions & 0 deletions NFe.AppTeste/Schemas/distDFeInt_v1.01.xsd
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://www.portalfiscal.inf.br/nfe" targetNamespace="http://www.portalfiscal.inf.br/nfe" elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:include schemaLocation="tiposDistDFe_v1.01.xsd"/>
<xs:element name="distDFeInt">
<xs:annotation>
<xs:documentation>Schema de pedido de distribuição de DF-e de interesse</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element name="tpAmb" type="TAmb">
<xs:annotation>
<xs:documentation>
Identificação do Ambiente:
1 - Produção
2 - Homologação
</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="cUFAutor" type="TCodUfIBGE" minOccurs="0">
<xs:annotation>
<xs:documentation>Código da UF do Autor</xs:documentation>
</xs:annotation>
</xs:element>
<xs:choice>
<xs:element name="CNPJ" type="TCnpj">
<xs:annotation>
<xs:documentation>CNPJ do interessado no DF-e</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="CPF" type="TCpf">
<xs:annotation>
<xs:documentation>CPF do interessado no DF-e</xs:documentation>
</xs:annotation>
</xs:element>
</xs:choice>
<xs:choice>
<xs:element name="distNSU">
<xs:annotation>
<xs:documentation>Grupo para distribuir DF-e de interesse</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element name="ultNSU" type="TNSU">
<xs:annotation>
<xs:documentation>Último NSU recebido pelo ator. Caso seja informado com zero, ou com um NSU muito antigo, a consulta retornará unicamente as informações resumidas e documentos fiscais eletrônicos que tenham sido recepcionados pelo Ambiente Nacional nos últimos 3 meses.</xs:documentation>
</xs:annotation>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="consNSU">
<xs:annotation>
<xs:documentation>Grupo para consultar um DF-e a partir de um NSU específico</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element name="NSU" type="TNSU">
<xs:annotation>
<xs:documentation>Número Sequencial Único. Geralmente esta consulta será utilizada quando identificado pelo interessado um NSU faltante. O Web Service retornará o documento ou informará que o NSU não existe no Ambiente Nacional. Assim, esta consulta fechará a lacuna do NSU identificado como faltante.</xs:documentation>
</xs:annotation>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="consChNFe">
<xs:annotation>
<xs:documentation>Grupo para consultar uma NF-e a partir da chave de acesso</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element name="chNFe" type="TChNFe">
<xs:annotation>
<xs:documentation>Chave de acesso da NF-e a ser consultada</xs:documentation>
</xs:annotation>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:sequence>
<xs:attribute name="versao" type="TVerDistDFe" use="required"/>
</xs:complexType>
</xs:element>
</xs:schema>

95 changes: 95 additions & 0 deletions NFe.AppTeste/Schemas/resEvento_v1.01.xsd
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://www.portalfiscal.inf.br/nfe" targetNamespace="http://www.portalfiscal.inf.br/nfe" elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:import namespace="http://www.w3.org/2000/09/xmldsig#" schemaLocation="xmldsig-core-schema_v1.01.xsd"/>
<xs:include schemaLocation="tiposDistDFe_v1.01.xsd"/>
<xs:element name="resEvento">
<xs:annotation>
<xs:documentation>Schema da estrutura XML gerada pelo Ambiente Nacional com o conjunto de informações resumidas de um evento de NF-e</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element name="cOrgao" type="TCOrgaoIBGE">
<xs:annotation>
<xs:documentation>Código do órgão de recepção do Evento. Utilizar a Tabela do IBGE extendida, utilizar 91 para identificar o Ambiente Nacional</xs:documentation>
</xs:annotation>
</xs:element>
<xs:choice>
<xs:element name="CNPJ" type="TCnpj">
<xs:annotation>
<xs:documentation>CNPJ do Emitente</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="CPF" type="TCpf">
<xs:annotation>
<xs:documentation>CPF do Emitente</xs:documentation>
</xs:annotation>
</xs:element>
</xs:choice>
<xs:element name="chNFe" type="TChNFe">
<xs:annotation>
<xs:documentation>Chave de acesso da NF-e</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="dhEvento" type="TDateTimeUTC">
<xs:annotation>
<xs:documentation>Data e Hora do Evento, formato UTC (AAAA-MM-DDThh:mm:ssTZD, onde TZD = +hh:mm ou -hh:mm)</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="tpEvento">
<xs:annotation>
<xs:documentation>Tipo do Evento</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:whiteSpace value="preserve"/>
<xs:pattern value="[0-9]{6}"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="nSeqEvento">
<xs:annotation>
<xs:documentation>Seqüencial do evento para o mesmo tipo de evento. Para maioria dos eventos será 1, nos casos em que possa existir mais de um evento, como é o caso da carta de correção, o autor do evento deve numerar de forma seqüencial</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:whiteSpace value="preserve"/>
<xs:pattern value="[1-9][0-9]{0,1}"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="xEvento">
<xs:annotation>
<xs:documentation>Descrição do Evento</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:restriction base="TString">
<xs:minLength value="5"/>
<xs:maxLength value="60"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="dhRecbto" type="TDateTimeUTC">
<xs:annotation>
<xs:documentation>Data e hora de autorização do evento no formato AAAA-MM-DDTHH:MM:SSTZD</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="nProt" type="TProt">
<xs:annotation>
<xs:documentation>Número do Protocolo do evento. 1 posição (1 – Secretaria de Fazenda Estadual 2 – Receita Federal); 2 - códiga da UF - 2 posições ano; 10 seqüencial no ano</xs:documentation>
</xs:annotation>
</xs:element>
</xs:sequence>
<xs:attribute name="versao" type="TVerResEvento" use="required"/>
</xs:complexType>
</xs:element>
<xs:simpleType name="TVerResEvento">
<xs:annotation>
<xs:documentation>Tipo Versão do leiate resNFe</xs:documentation>
</xs:annotation>
<xs:restriction base="xs:string">
<xs:whiteSpace value="preserve"/>
<xs:enumeration value="1.01"/>
</xs:restriction>
</xs:simpleType>
</xs:schema>

113 changes: 113 additions & 0 deletions NFe.AppTeste/Schemas/resNFe_v1.01.xsd
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://www.portalfiscal.inf.br/nfe" targetNamespace="http://www.portalfiscal.inf.br/nfe" elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:import namespace="http://www.w3.org/2000/09/xmldsig#" schemaLocation="xmldsig-core-schema_v1.01.xsd"/>
<xs:include schemaLocation="tiposDistDFe_v1.01.xsd"/>
<xs:element name="resNFe">
<xs:annotation>
<xs:documentation>Schema da estrutura XML gerada pelo Ambiente Nacional com o conjunto de informações resumidas de uma NF-e</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element name="chNFe" type="TChNFe">
<xs:annotation>
<xs:documentation>Chave de acesso da NF-e</xs:documentation>
</xs:annotation>
</xs:element>
<xs:choice>
<xs:element name="CNPJ" type="TCnpj">
<xs:annotation>
<xs:documentation>CNPJ do Emitente</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="CPF" type="TCpf">
<xs:annotation>
<xs:documentation>CPF do Emitente</xs:documentation>
</xs:annotation>
</xs:element>
</xs:choice>
<xs:element name="xNome">
<xs:annotation>
<xs:documentation>Razão Social ou Nome do emitente</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:restriction base="TString">
<xs:maxLength value="60"/>
<xs:minLength value="2"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="IE" type="TIe">
<xs:annotation>
<xs:documentation>Inscrição Estadual do Emitente</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="dhEmi" type="TDateTimeUTC">
<xs:annotation>
<xs:documentation>Data e Hora de emissão do Documento Fiscal (AAAA-MM-DDThh:mm:ssTZD) ex.: 2012-09-01T13:00:00-03:00</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="tpNF">
<xs:annotation>
<xs:documentation>Tipo do Documento Fiscal (0 - entrada; 1 - saída)</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:whiteSpace value="preserve"/>
<xs:enumeration value="0"/>
<xs:enumeration value="1"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="vNF" type="TDec_1302">
<xs:annotation>
<xs:documentation>Valor Total da NF-e</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="digVal" type="ds:DigestValueType" minOccurs="0">
<xs:annotation>
<xs:documentation>Digest Value da NF-e processada. Utilizado para conferir a integridade da NF-e original</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="dhRecbto" type="TDateTimeUTC">
<xs:annotation>
<xs:documentation>Data e hora de autorização da NF-e, no formato AAAA-MM-DDTHH:MM:SSTZD</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="nProt" type="TProt">
<xs:annotation>
<xs:documentation>Número do Protocolo de Status da NF-e. 1 posição (1 – Secretaria de Fazenda Estadual 2 – Receita Federal); 2 - códiga da UF - 2 posições ano; 10 seqüencial no ano</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="cSitNFe">
<xs:annotation>
<xs:documentation>
Situação da NF-e
1-Uso autorizado no momento da consulta;
2-Uso denegado;
</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:whiteSpace value="preserve"/>
<xs:enumeration value="1"/>
<xs:enumeration value="2"/>
<xs:enumeration value="3"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
</xs:sequence>
<xs:attribute name="versao" type="TVerResNFe" use="required"/>
</xs:complexType>
</xs:element>
<xs:simpleType name="TVerResNFe">
<xs:annotation>
<xs:documentation>Tipo Versão do leiate resNFe</xs:documentation>
</xs:annotation>
<xs:restriction base="xs:string">
<xs:whiteSpace value="preserve"/>
<xs:enumeration value="1.01"/>
</xs:restriction>
</xs:simpleType>
</xs:schema>


Loading

0 comments on commit c31818f

Please sign in to comment.