Skip to content

Commit

Permalink
Modifiche per cambio numero documento trasmesso alla fatturazione ele…
Browse files Browse the repository at this point in the history
…ttronica
  • Loading branch information
gifracr committed May 9, 2019
1 parent 460545c commit f3d0c2b
Show file tree
Hide file tree
Showing 9 changed files with 74 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ public void setEsercizio(Integer esercizio) {

private java.util.ArrayList<FatturaAttivaIntra> righeIntra;

private String numeroFattura;

private String cod_errore;
private String desc_errore;
private String ti_causale_emissione;
Expand Down Expand Up @@ -344,5 +346,11 @@ public String getFl_pagamento_anticipato() {
public void setFl_pagamento_anticipato(String fl_pagamento_anticipato) {
this.fl_pagamento_anticipato = fl_pagamento_anticipato;
}
public String getNumeroFattura() {
return numeroFattura;
}
public void setNumeroFattura(String numeroFattura) {
this.numeroFattura = numeroFattura;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -273,14 +273,17 @@ public Fattura_attivaBulk protocollaECreaFileXml(UserContext userContext,
throws BusinessProcessException, ComponentException, RemoteException, PersistencyException,
ApplicationException {
logger.info("Processo la fattura {}/{}", fatturaAttiva.getEsercizio(), fatturaAttiva.getPg_fattura_attiva());
File file = creaFileXml(userContext, fatturaAttiva);
DocAmmFatturazioneElettronicaComponentSession component = createComponentSession();
// Questo metodo va invocato perchè fa tutti i controlli prima che la fattura venga protocollata
component.preparaFattura(userContext, fatturaAttiva);

logger.info("Creato file XML {}/{}", fatturaAttiva.getEsercizio(), fatturaAttiva.getPg_fattura_attiva());
if (fatturaAttiva.getProtocollo_iva() == null){
Fattura_attivaBulk fatturaAttivaProtocollata = protocollazione(userContext, fatturaAttiva);
fatturaAttiva = fatturaAttivaProtocollata;
logger.info("Creato protocollazione {}/{}", fatturaAttiva.getEsercizio(), fatturaAttiva.getPg_fattura_attiva());
}
File file = creaFileXml(userContext, fatturaAttiva);
logger.info("Creato file XML {}/{}", fatturaAttiva.getEsercizio(), fatturaAttiva.getPg_fattura_attiva());
List<StorageFile> storageFileCreate = new ArrayList<StorageFile>();
List<StorageFile> storageFileAnnullati = new ArrayList<StorageFile>();
try {
Expand Down Expand Up @@ -497,6 +500,7 @@ public Fattura_attivaBulk protocollazione(UserContext userContext,
Integer offSet = 0;
componentFatturaAttiva.preparaProtocollazioneEProtocolla(userContext, pgProtocollazione, offSet, pgStampa, dataStampa, fattura);
return componentFatturaAttiva.ricercaFatturaByKey(userContext, new Long(fattura.getEsercizio()), fattura.getCd_cds(), fattura.getCd_unita_organizzativa(), fattura.getPg_fattura_attiva());

}

private void extracted(Exception e) throws ApplicationException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
import javax.xml.datatype.DatatypeFactory;
import javax.xml.datatype.XMLGregorianCalendar;

import it.cnr.contab.anagraf00.core.bulk.Anagrafico_esercizioBulk;
import it.cnr.contab.anagraf00.core.bulk.Anagrafico_esercizioHome;
import it.cnr.contab.anagraf00.core.bulk.TerzoBulk;
import it.cnr.contab.anagraf00.core.bulk.TerzoHome;
import it.cnr.contab.anagraf00.tabrif.bulk.Rif_modalita_pagamentoBulk;
Expand All @@ -26,6 +28,7 @@
import it.cnr.contab.config00.bulk.Configurazione_cnrBulk;
import it.cnr.contab.config00.contratto.bulk.ContrattoBulk;
import it.cnr.contab.docamm00.docs.bulk.Fattura_attivaBulk;
import it.cnr.contab.docamm00.docs.bulk.Fattura_attivaHome;
import it.cnr.contab.docamm00.docs.bulk.Fattura_attiva_rigaBulk;
import it.cnr.contab.docamm00.docs.bulk.Fattura_attiva_rigaIBulk;
import it.cnr.contab.docamm00.ejb.FatturaAttivaSingolaComponentSession;
Expand Down Expand Up @@ -353,7 +356,7 @@ public Configurazione_cnrBulk getAuthenticatorPecSdi(UserContext userContext) th
}
}

public JAXBElement<FatturaElettronicaType> creaFatturaElettronicaType(UserContext userContext, Fattura_attivaBulk fattura) throws ComponentException {
public FatturaElettronicaType preparaFattura(UserContext userContext, Fattura_attivaBulk fattura)throws ComponentException {
try {

ObjectFactory factory = new ObjectFactory();
Expand Down Expand Up @@ -600,7 +603,18 @@ public JAXBElement<FatturaElettronicaType> creaFatturaElettronicaType(UserContex
}
}

return factory.createFatturaElettronica(fatturaType);
return fatturaType;
} catch(Exception e) {
throw handleException(e);
}

}

public JAXBElement<FatturaElettronicaType> creaFatturaElettronicaType(UserContext userContext, Fattura_attivaBulk fattura) throws ComponentException {
try {

ObjectFactory factory = new ObjectFactory();
return factory.createFatturaElettronica(preparaFattura(userContext, fattura));
} catch(Exception e) {
throw handleException(e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6876,7 +6876,7 @@ else if (notec.size() == 1) {
}

caricaDettagliFatturaTrovato(userContext, fatturaAttiva);

getHomeCache(userContext).fetchAll(userContext);
if (fatturaAttiva != null)
return fatturaAttiva;
else if (ncAttiva != null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2124,6 +2124,9 @@ public String constructCMISNomeFile() {
}

public String recuperoIdFatturaAsString(){
if (getProtocollo_iva() != null){
return StrServ.replace(getCd_uo_origine(), ".", "")+getEsercizio()+StrServ.lpad(getCd_tipo_sezionale().substring(2), 4)+getTi_fattura()+StrServ.lpad(getProtocollo_iva().toString(),5);
}
return StrServ.replace(getCd_unita_organizzativa(), ".", "")+getEsercizio()+StrServ.lpad(getPg_fattura_attiva().toString(), 5);
}
public boolean quadraturaInDeroga() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,5 @@ public Configurazione_cnrBulk getAuthenticatorPecSdi(

public String recuperoInizioNomeFile(UserContext userContext)
throws RemoteException, ComponentException;
public FatturaElettronicaType preparaFattura(UserContext userContext, Fattura_attivaBulk fattura)throws RemoteException, ComponentException;
}
Original file line number Diff line number Diff line change
Expand Up @@ -101,4 +101,23 @@ public String recuperoInizioNomeFile(UserContext userContext) throws RemoteExcep
throw uncaughtError(userContext,componentObj,e);
}
}

public FatturaElettronicaType preparaFattura(UserContext userContext, Fattura_attivaBulk fattura)throws ComponentException{
pre_component_invocation(userContext,componentObj);
try {
FatturaElettronicaType result = ((DocAmmFatturazioneElettronicaComponent)componentObj).preparaFattura(userContext, fattura);
component_invocation_succes(userContext,componentObj);
return result;
} catch(it.cnr.jada.comp.NoRollbackException e) {
component_invocation_succes(userContext,componentObj);
throw e;
} catch(it.cnr.jada.comp.ComponentException e) {
component_invocation_failure(userContext,componentObj);
throw e;
} catch(RuntimeException e) {
throw uncaughtRuntimeException(userContext,componentObj,e);
} catch(Error e) {
throw uncaughtError(userContext,componentObj,e);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,23 @@ public JAXBElement<FatturaElettronicaType> creaFatturaElettronicaType(it.cnr.jad
}
}
}
public FatturaElettronicaType preparaFattura(UserContext userContext, Fattura_attivaBulk fattura)throws RemoteException,ComponentException{
try {
return (FatturaElettronicaType)invoke("preparaFattura",new Object[] {
userContext,
fattura});
} catch(java.rmi.RemoteException e) {
throw e;
} catch(java.lang.reflect.InvocationTargetException e) {
try {
throw e.getTargetException();
} catch(it.cnr.jada.comp.ComponentException ex) {
throw ex;
} catch(Throwable ex) {
throw new java.rmi.RemoteException("Uncaugth exception",ex);
}
}
}
public String recuperoInizioNomeFile(UserContext param0) throws RemoteException,ComponentException {
try {
return (String)invoke("recuperoInizioNomeFile",new Object[] {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1059,6 +1059,9 @@ public FatturaAttiva RicercaFattura(String user,Long esercizio,String cds,String
righescad=new java.util.ArrayList<FatturaAttivaScad>();
}
ritorno.setRighefat(righe);
if (fatturaAt.getProtocollo_iva() != null){
ritorno.setNumeroFattura(fatturaAt.recuperoIdFatturaAsString());
}

return ritorno;
}catch(FatturaNonTrovataException e){
Expand Down

0 comments on commit f3d0c2b

Please sign in to comment.