AGGIUNTO NUOVO DETTAGLIO SUI DOCUMENTI

This commit is contained in:
2024-12-09 19:30:08 +01:00
parent 8807fca122
commit 6281079988
5 changed files with 259 additions and 0 deletions

View File

@@ -0,0 +1,52 @@
package it.integry.ems.migration.model;
import it.integry.ems.migration._base.BaseMigration;
import it.integry.ems.migration._base.MigrationModelInterface;
import it.integry.ems_model.utility.dto.IndexTableDTO;
import java.util.ArrayList;
import java.util.List;
public class Migration_20241209150324 extends BaseMigration implements MigrationModelInterface {
@Override
public void up() throws Exception {
if (isHistoryDB())
return;
executeStatement("create table dtb_doc_imb\n" +
" (id bigint not null identity,\n" +
" cod_anag varchar(5) not null,\n" +
" cod_dtip varchar(5) not null,\n" +
" data_doc datetime not null,\n" +
" ser_doc varchar(2) not null,\n" +
" num_doc int not null,\n" +
" cod_tcol varchar(5) not null,\n" +
" num_imb_cons int not null default 0,\n" +
" num_imb_resi int not null default 0,\n" +
" tipo_reso TINYINT not null default 0 )",
"alter table dtb_doc_imb add constraint pk_dtb_doc_imb primary key (id);",
"alter table dtb_doc_imb add constraint fk_dtb_doc_imb_dtb_doct FOREIGN KEY(cod_anag, cod_Dtip, data_doc, ser_doc, num_doc) "+
"REFERENCES dbo.dtb_doct (cod_anag, cod_Dtip, data_doc, ser_doc, num_doc)",
"alter table dtb_doc_imb CHECK CONSTRAINT fk_dtb_doc_imb_dtb_doct",
"alter table dtb_doc_imb add constraint fk_dtb_doc_imb_mtb_tcol FOREIGN KEY(cod_tcol) REFERENCES dbo.mtb_tcol (cod_tcol) ",
"alter table dtb_doc_imb CHECK CONSTRAINT fk_dtb_doc_imb_mtb_tcol");
List<IndexTableDTO.ColumnIndex> columnsIndex = new ArrayList<>();
columnsIndex.add(new IndexTableDTO.ColumnIndex("cod_anag"));
columnsIndex.add(new IndexTableDTO.ColumnIndex("cod_dtip"));
columnsIndex.add(new IndexTableDTO.ColumnIndex("data_doc"));
columnsIndex.add(new IndexTableDTO.ColumnIndex("ser_doc"));
columnsIndex.add(new IndexTableDTO.ColumnIndex("num_doc"));
IndexTableDTO indexTableDTO = new IndexTableDTO()
.setIndexName("ux_dtb_doc_imb")
.setTableName("dtb_doc_imb")
.setColumnsIndex(columnsIndex)
.setUnique(true);
createIndex(indexTableDTO);
}
@Override
public void down() throws Exception {
}
}

View File

@@ -0,0 +1,19 @@
package it.integry.ems.migration.model;
import it.integry.ems.migration._base.BaseMigration;
import it.integry.ems.migration._base.MigrationModelInterface;
public class Migration_20241209163928 extends BaseMigration implements MigrationModelInterface {
@Override
public void up() throws Exception {
if (isHistoryDB())
return;
executeStatement("ALTER TABLE gtb_porto ADD flag_fattura_vettore bit not null default 0");
}
@Override
public void down() throws Exception {
}
}

View File

@@ -4,6 +4,7 @@ import com.annimon.stream.Optional;
import com.annimon.stream.Stream;
import it.integry.common.var.CommonConstants;
import it.integry.ems.rules.businessLogic.dto.DocCompDTO;
import it.integry.ems.rules.businessLogic.enums.TipoEmissione;
import it.integry.ems.rules.completing.CommonRules;
import it.integry.ems.sync.MultiDBTransaction.Connection;
import it.integry.ems_model.config.EmsRestConstants;
@@ -1143,4 +1144,5 @@ public class DocumentBusinessLogic {
}
}

View File

@@ -0,0 +1,162 @@
package it.integry.ems_model.entity;
import it.integry.ems_model.annotation.*;
import org.apache.logging.log4j.LogManager;
import java.util.List;
import java.util.ArrayList;
import it.integry.ems_model.base.EntityBase;
import org.kie.api.definition.type.PropertyReactive;
import com.fasterxml.jackson.annotation.JsonTypeName;
import org.apache.logging.log4j.Logger;
import java.util.Date;
@PropertyReactive()
@Table(value = DtbDocImb.ENTITY)
@JsonTypeName(value = DtbDocImb.ENTITY)
public class DtbDocImb extends EntityBase {
public final static String ENTITY = "dtb_doc_imb";
private final static Long serialVersionUID = 1L;
private final static Logger logger = LogManager.getLogger();
public DtbDocImb() {
super(logger);
}
@PK()
@Identity()
@SqlField(value = "id", nullable = false)
private Long id;
@Unique
@SqlField(value = "cod_anag", maxLength = 5, nullable = false)
@FK(tableName = DtbDoct.ENTITY, columnName = "cod_anag")
private String codAnag;
@Unique
@SqlField(value = "cod_dtip", maxLength = 5, nullable = false)
@FK(tableName = DtbDoct.ENTITY, columnName = "cod_dtip")
private String codDtip;
@Unique
@SqlField(value = "data_doc", nullable = false)
@FK(tableName = DtbDoct.ENTITY, columnName = "data_doc")
private Date dataDoc;
@Unique
@SqlField(value = "ser_doc", maxLength = 2, nullable = false)
@FK(tableName = DtbDoct.ENTITY, columnName = "ser_doc")
private String serDoc;
@Unique
@SqlField(value = "num_doc", nullable = false)
@FK(tableName = DtbDoct.ENTITY, columnName = "num_doc")
private Integer numDoc;
@Unique
@SqlField(value = "cod_tcol", maxLength = 5, nullable = false)
@FK(tableName = MtbTcol.ENTITY, columnName = "cod_tcol")
private String codTcol;
@SqlField(value = "num_imb_cons", nullable = false)
private Integer numImbCons;
@SqlField(value = "num_imb_resi", nullable = false)
private Integer numImbResi;
@SqlField(value = "tipo_reso", nullable = false)
private Short tipoReso;
public Long getId() {
return id;
}
public DtbDocImb setId(Long id) {
this.id = id;
return this;
}
public String getCodAnag() {
return codAnag;
}
public DtbDocImb setCodAnag(String codAnag) {
this.codAnag = codAnag;
return this;
}
public String getCodDtip() {
return codDtip;
}
public DtbDocImb setCodDtip(String codDtip) {
this.codDtip = codDtip;
return this;
}
public Date getDataDoc() {
return dataDoc;
}
public DtbDocImb setDataDoc(Date dataDoc) {
this.dataDoc = dataDoc;
return this;
}
public String getSerDoc() {
return serDoc;
}
public DtbDocImb setSerDoc(String serDoc) {
this.serDoc = serDoc;
return this;
}
public Integer getNumDoc() {
return numDoc;
}
public DtbDocImb setNumDoc(Integer numDoc) {
this.numDoc = numDoc;
return this;
}
public String getCodTcol() {
return codTcol;
}
public DtbDocImb setCodTcol(String codTcol) {
this.codTcol = codTcol;
return this;
}
public Integer getNumImbCons() {
return numImbCons;
}
public DtbDocImb setNumImbCons(Integer numImbCons) {
this.numImbCons = numImbCons;
return this;
}
public Integer getNumImbResi() {
return numImbResi;
}
public DtbDocImb setNumImbResi(Integer numImbResi) {
this.numImbResi = numImbResi;
return this;
}
public Short getTipoReso() {
return tipoReso;
}
public DtbDocImb setTipoReso(Short tipoReso) {
this.tipoReso = tipoReso;
return this;
}
}

View File

@@ -21,6 +21,7 @@ import org.kie.api.definition.type.PropertyReactive;
import java.math.BigDecimal;
import java.sql.*;
import java.util.*;
import java.util.Date;
import java.util.*;
@@ -378,6 +379,9 @@ public class DtbDoct extends DtbBaseDocT implements EquatableEntityInterface<Dtb
@EntityChild
private List<DrlDocAttached> drlDocAttached = new ArrayList<>();
@EntityChild
private List<DtbDocImb> dtbDocImb = new ArrayList<>();
@EntityChild
private List<DtbDocCarat> dtbDocCarat = new ArrayList<>();
@@ -1428,6 +1432,15 @@ public class DtbDoct extends DtbBaseDocT implements EquatableEntityInterface<Dtb
return this;
}
public List<DtbDocImb> getDtbDocImb() {
return dtbDocImb;
}
public DtbDoct setDtbDocImb(List<DtbDocImb> dtbDocImb) {
this.dtbDocImb = dtbDocImb;
return this;
}
public List<MtbColt> getMtbColt() {
return mtbColt;
}
@@ -1500,6 +1513,12 @@ public class DtbDoct extends DtbBaseDocT implements EquatableEntityInterface<Dtb
return this;
}
public DtbDoct addDtbDoctBolla(DtbDoct dtbDoctBolla) {
if (getDtbDoctBolle() == null ) setDtbDoctBolle(new ArrayList<>());
getDtbDoctBolle().add(dtbDoctBolla);
return this;
}
public DtbInum getDtbInum() {
return dtbInum;
}
@@ -1570,6 +1589,9 @@ public class DtbDoct extends DtbBaseDocT implements EquatableEntityInterface<Dtb
for (DrlDocAttached drlDocAttached : getDrlDocAttached()) {
drlDocAttached.manageWithParentConnection(connection, drlDocAttached.getOperation(), dataCompleting, entityHolder);
}
for (DtbDocImb dtbDocImb : getDtbDocImb()) {
dtbDocImb.manageWithParentConnection(connection, dtbDocImb.getOperation(), dataCompleting, entityHolder);
}
for (ArlSchaccDoc arlSchaccDoc : getArlSchaccDoc()) {
arlSchaccDoc.manageWithParentConnection(connection, arlSchaccDoc.getOperation(), dataCompleting, entityHolder);
}
@@ -1625,6 +1647,8 @@ public class DtbDoct extends DtbBaseDocT implements EquatableEntityInterface<Dtb
dtbDocr.deleteAllEntities(connection, this);
DtbDocs dtbDocs = new DtbDocs();
dtbDocs.deleteAllEntities(connection, this);
DtbDocImb dtbDocImb = new DtbDocImb();
dtbDocImb.deleteAllEntities(connection, this);
DtbDocCarat dtbDocCarat = new DtbDocCarat();
dtbDocCarat.deleteAllEntities(connection, this);
DrlDocAttached drlDocAttached = new DrlDocAttached();