Gestita creazione della commessa direttamente nel preventivo

This commit is contained in:
2024-06-10 11:53:01 +02:00
parent b8c4caaa9b
commit 5067eff40b
2 changed files with 36 additions and 0 deletions

View File

@@ -25,6 +25,7 @@ public class CrmCompletaOrd {
public String flagTipologia;
public CrmCliente cliente;
public CrmDestinazione destinazione;
public CrmCommessa commessa;
public List<CrmPersRif> persRif;
public List<CrmSpese> spese;
BigDecimal acconto;
@@ -111,6 +112,16 @@ public class CrmCompletaOrd {
this.destinazione = destinazione;
}
public CrmCommessa getCommessa() {
return commessa;
}
@JsonProperty("CRMCommessa")
public CrmCompletaOrd setCommessa(CrmCommessa commessa) {
this.commessa = commessa;
return this;
}
public List<CrmPersRif> getPersRif() {
return persRif;
}

View File

@@ -716,6 +716,31 @@ public class CrmService {
entityProcessor.processEntity(wdtbOrdsDelete, true, multiDBTransactionManager);
if (activityId == null) { // SE NON HA ATTIVITA PREVENTIVAZIONE, NE CREA UNA
if (codJcom == null) {
CrmCommessa crmCommessa = completaOrd.getCommessa();
if (crmCommessa != null) {
JtbComt jtbComt = new JtbComt();
jtbComt.setOperation(OperationType.INSERT);
jtbComt.setPrecode("C");
jtbComt.setTipoAnag(tipoAnag);
jtbComt.setCodAnag(codAnag);
jtbComt.setCodVdes(codVdes);
jtbComt.setDescrizione(crmCommessa.getDescrizione());
jtbComt.setDescrizioneEstesa(crmCommessa.getDescrizioneEstesa());
jtbComt.setNote(crmCommessa.getNote());
jtbComt.setCodJflav(crmCommessa.getCodJflav());
jtbComt.setCodJfas(crmCommessa.getCodJfas());
jtbComt.setStatoCommessa(crmCommessa.getStatoCommessa());
entityProcessor.processEntity(jtbComt, true, multiDBTransactionManager);
entityBaseList.add(jtbComt);
codJcom = jtbComt.getCodJcom();
} else {
throw new Exception("Dati di commessa da creare inesistenti");
}
}
// Acquisizione processo padre
String parentActivityId = null;
String activityDescription = "PREVENTIVO N. " + numOrd + " DEL " + new SimpleDateFormat(CommonConstants.DATE_FORMAT_DMY).format(dataOrd);