nuova procedura di importazione scontrini
Some checks failed
IntegryManagementSystem_Multi/pipeline/head There was a failure building this commit
Some checks failed
IntegryManagementSystem_Multi/pipeline/head There was a failure building this commit
This commit is contained in:
2
.idea/dataSources.xml
generated
2
.idea/dataSources.xml
generated
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="DataSourceManagerImpl" format="xml" multifile-model="true">
|
||||
<data-source source="LOCAL" name="Biolevante" uuid="ff4f0bad-7271-429e-a4e1-bae28629efc8">
|
||||
<data-source source="LOCAL" name="@SERVERDB2019" uuid="ff4f0bad-7271-429e-a4e1-bae28629efc8">
|
||||
<driver-ref>sqlserver.ms</driver-ref>
|
||||
<synchronize>true</synchronize>
|
||||
<jdbc-driver>com.microsoft.sqlserver.jdbc.SQLServerDriver</jdbc-driver>
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.IntegryCustomerDB;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20250828100041 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
executeStatement(
|
||||
"alter table ntb_docr add val_sco_art numeric(20,5);",
|
||||
"alter table mtb_depo_casse add last_idx int;",
|
||||
"Create table ntb_docs ( " +
|
||||
" id bigint identity not null, " +
|
||||
" cod_mdep varchar(5) not null, " +
|
||||
" cod_cassa varchar(5) not null, " +
|
||||
" data_doc datetime not null, " +
|
||||
" id_riga int not null, " +
|
||||
" promozione varchar(40) not null , " +
|
||||
" val_sco numeric(20,5) not null default 0); ",
|
||||
"alter table ntb_docs add constraint pk_ntb_docs primary key (id)",
|
||||
"alter table ntb_docs add constraint fk_ntb_docs_ntb_docr foreign key (cod_mdep, cod_cassa, data_doc, id_riga) references ntb_docr (cod_mdep, cod_cassa, data_doc, id_riga);"
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.IntegryCustomerDB;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20250828145642 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
createSetup("IMPORT_SCONTRINI", "MMPOS_SERVICES", "PROFILE_DB", null,
|
||||
"insiere il profile del db a cui collegarsi", false, null, false, false,
|
||||
false, false, false, null, false, null);
|
||||
|
||||
if (isCustomerDb(IntegryCustomerDB.Carelli_Carelli) && isCustomerDb(IntegryCustomerDB.Carelli_GestFood) ) {
|
||||
updateSetupValue("IMPORT_SCONTRINI", "MMPOS_SERVICES", "PROFILE_DB", "MMPOS");
|
||||
}else if (isCustomerDb(IntegryCustomerDB.Carelli_Murgia) && isCustomerDb(IntegryCustomerDB.Carelli_GestFood) ) {
|
||||
updateSetupValue("IMPORT_SCONTRINI", "MMPOS_SERVICES", "PROFILE_DB", "MMPOS_FORNO");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -238,4 +238,7 @@ public class ReceiptRules extends QueryRules {
|
||||
|
||||
return dtbOrdt;
|
||||
}
|
||||
public static BigDecimal calcValScoArt(NtbDocr ntbDocr) {
|
||||
return ntbDocr.getNtbDocs().stream().map(NtbDocs::getValSco).reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,55 +45,73 @@ public class MtbDepoCasse extends EntityBase {
|
||||
@SqlField(value = "matricola", maxLength = 255, nullable = false)
|
||||
private String matricola;
|
||||
|
||||
@SqlField(value = "last_idx")
|
||||
private Integer lastIdx;
|
||||
|
||||
public MtbDepoCasse() {
|
||||
super(logger);
|
||||
}
|
||||
|
||||
public String getCodMdep() {
|
||||
return codMdep;
|
||||
}
|
||||
|
||||
public void setCodMdep(String codMdep) {
|
||||
this.codMdep = codMdep;
|
||||
}
|
||||
|
||||
public String getCodCassa() {
|
||||
return codCassa;
|
||||
}
|
||||
|
||||
public void setCodCassa(String codCassa) {
|
||||
this.codCassa = codCassa;
|
||||
}
|
||||
|
||||
public String getMatricola() {
|
||||
return matricola;
|
||||
}
|
||||
|
||||
public void setMatricola(String matricola) {
|
||||
this.matricola = matricola;
|
||||
}
|
||||
|
||||
public String getFlagTipoNumerazione() {
|
||||
return flagTipoNumerazione;
|
||||
}
|
||||
|
||||
public void setFlagTipoNumerazione(String flagTipoNumerazione) {
|
||||
public MtbDepoCasse setFlagTipoNumerazione(String flagTipoNumerazione) {
|
||||
this.flagTipoNumerazione = flagTipoNumerazione;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getCodDtipFat() {
|
||||
return codDtipFat;
|
||||
}
|
||||
|
||||
public void setCodDtipFat(String codDtipFat) {
|
||||
public MtbDepoCasse setCodDtipFat(String codDtipFat) {
|
||||
this.codDtipFat = codDtipFat;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getSerDoc() {
|
||||
return serDoc;
|
||||
}
|
||||
|
||||
public void setSerDoc(String serDoc) {
|
||||
public MtbDepoCasse setSerDoc(String serDoc) {
|
||||
this.serDoc = serDoc;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getCodMdep() {
|
||||
return codMdep;
|
||||
}
|
||||
|
||||
public MtbDepoCasse setCodMdep(String codMdep) {
|
||||
this.codMdep = codMdep;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getCodCassa() {
|
||||
return codCassa;
|
||||
}
|
||||
|
||||
public MtbDepoCasse setCodCassa(String codCassa) {
|
||||
this.codCassa = codCassa;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getMatricola() {
|
||||
return matricola;
|
||||
}
|
||||
|
||||
public MtbDepoCasse setMatricola(String matricola) {
|
||||
this.matricola = matricola;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Integer getLastIdx() {
|
||||
return lastIdx;
|
||||
}
|
||||
|
||||
public MtbDepoCasse setLastIdx(Integer lastIdx) {
|
||||
this.lastIdx = lastIdx;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,9 @@ import it.integry.ems_model.annotation.*;
|
||||
import it.integry.ems_model.base.EntityBase;
|
||||
import org.kie.api.definition.type.PropertyReactive;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
@@ -98,6 +100,11 @@ public class NtbDocr extends EntityBase {
|
||||
@SqlField(value = "causale_reso", maxLength = 5)
|
||||
private String causaleReso;
|
||||
|
||||
@SqlField(value = "val_sco_art", nullable = false, defaultObjectValue = "0")
|
||||
private BigDecimal valScoArt;
|
||||
|
||||
private List<NtbDocs> ntbDocs = new ArrayList<>();
|
||||
|
||||
@ImportFromParent
|
||||
private String causale;
|
||||
|
||||
@@ -318,6 +325,24 @@ public class NtbDocr extends EntityBase {
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getCausaleReso() {
|
||||
return causaleReso;
|
||||
}
|
||||
|
||||
public NtbDocr setCausaleReso(String causaleReso) {
|
||||
this.causaleReso = causaleReso;
|
||||
return this;
|
||||
}
|
||||
|
||||
public BigDecimal getValScoArt() {
|
||||
return valScoArt;
|
||||
}
|
||||
|
||||
public NtbDocr setValScoArt(BigDecimal valScoArt) {
|
||||
this.valScoArt = valScoArt;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getCausale() {
|
||||
return causale;
|
||||
}
|
||||
@@ -345,24 +370,18 @@ public class NtbDocr extends EntityBase {
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getCausaleReso() {
|
||||
return causaleReso;
|
||||
public List<NtbDocs> getNtbDocs() {
|
||||
return ntbDocs;
|
||||
}
|
||||
|
||||
public void setCausaleReso(String causaleReso) {
|
||||
this.causaleReso = causaleReso;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void insertChilds() throws Exception {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void updateChilds() throws Exception {
|
||||
insertChilds();
|
||||
public NtbDocr setNtbDocs(List<NtbDocs> ntbDocs) {
|
||||
this.ntbDocs = ntbDocs;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void deleteChilds() throws Exception {
|
||||
NtbDocs ntbDocs = new NtbDocs();
|
||||
ntbDocs.deleteAllEntities(connection, this);
|
||||
}
|
||||
}
|
||||
|
||||
123
ems-core/src/main/java/it/integry/ems_model/entity/NtbDocs.java
Normal file
123
ems-core/src/main/java/it/integry/ems_model/entity/NtbDocs.java
Normal file
@@ -0,0 +1,123 @@
|
||||
package it.integry.ems_model.entity;
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
import it.integry.ems_model.base.EntityBase;
|
||||
import it.integry.ems_model.annotation.Master;
|
||||
import org.kie.api.definition.type.PropertyReactive;
|
||||
import it.integry.ems_model.annotation.Table;
|
||||
import com.fasterxml.jackson.annotation.JsonTypeName;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import it.integry.ems_model.annotation.PK;
|
||||
import it.integry.ems_model.annotation.Identity;
|
||||
import it.integry.ems_model.annotation.SqlField;
|
||||
import it.integry.ems_model.annotation.FK;
|
||||
import java.util.Date;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@PropertyReactive()
|
||||
@Table(value = NtbDocs.ENTITY)
|
||||
@JsonTypeName(value = NtbDocs.ENTITY)
|
||||
public class NtbDocs extends EntityBase {
|
||||
|
||||
public final static String ENTITY = "ntb_docs";
|
||||
|
||||
private final static Long serialVersionUID = 1L;
|
||||
|
||||
private final static Logger logger = LogManager.getLogger();
|
||||
|
||||
public NtbDocs() {
|
||||
super(logger);
|
||||
}
|
||||
|
||||
@PK()
|
||||
@Identity()
|
||||
@SqlField(value = "id", nullable = false)
|
||||
private Long id;
|
||||
|
||||
@SqlField(value = "cod_mdep", maxLength = 5, nullable = false)
|
||||
@FK(tableName = NtbDocr.ENTITY, columnName = "cod_mdep")
|
||||
private String codMdep;
|
||||
|
||||
@SqlField(value = "cod_cassa", maxLength = 5, nullable = false)
|
||||
@FK(tableName = NtbDocr.ENTITY, columnName = "cod_cassa")
|
||||
private String codCassa;
|
||||
|
||||
@SqlField(value = "data_doc", nullable = false)
|
||||
@FK(tableName = NtbDocr.ENTITY, columnName = "data_doc")
|
||||
private Date dataDoc;
|
||||
|
||||
@SqlField(value = "id_riga", nullable = false)
|
||||
@FK(tableName = NtbDocr.ENTITY, columnName = "id_riga")
|
||||
private Integer idRiga;
|
||||
|
||||
@SqlField(value = "promozione", maxLength = 40, nullable = false)
|
||||
private String promozione;
|
||||
|
||||
@SqlField(value = "val_sco", nullable = false)
|
||||
private BigDecimal valSco;
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public NtbDocs setId(Long id) {
|
||||
this.id = id;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getCodMdep() {
|
||||
return codMdep;
|
||||
}
|
||||
|
||||
public NtbDocs setCodMdep(String codMdep) {
|
||||
this.codMdep = codMdep;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getCodCassa() {
|
||||
return codCassa;
|
||||
}
|
||||
|
||||
public NtbDocs setCodCassa(String codCassa) {
|
||||
this.codCassa = codCassa;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Date getDataDoc() {
|
||||
return dataDoc;
|
||||
}
|
||||
|
||||
public NtbDocs setDataDoc(Date dataDoc) {
|
||||
this.dataDoc = dataDoc;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Integer getIdRiga() {
|
||||
return idRiga;
|
||||
}
|
||||
|
||||
public NtbDocs setIdRiga(Integer idRiga) {
|
||||
this.idRiga = idRiga;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getPromozione() {
|
||||
return promozione;
|
||||
}
|
||||
|
||||
public NtbDocs setPromozione(String promozione) {
|
||||
this.promozione = promozione;
|
||||
return this;
|
||||
}
|
||||
|
||||
public BigDecimal getValSco() {
|
||||
return valSco;
|
||||
}
|
||||
|
||||
public NtbDocs setValSco(BigDecimal valSco) {
|
||||
this.valSco = valSco;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -269,3 +269,16 @@ then
|
||||
}
|
||||
|
||||
end
|
||||
|
||||
|
||||
rule "completeValScoArtNtbDocr"
|
||||
no-loop
|
||||
when
|
||||
eval(completeRulesEnabled)
|
||||
$entity: NtbDocr(( valScoArt == null || valScoArt == 0 ) && operation != OperationType.DELETE && ntbDocs.size() > 0)
|
||||
then
|
||||
BigDecimal valScoArt = ReceiptRules.calcValScoArt($entity);
|
||||
modify ( $entity ) {
|
||||
setValScoArt(valScoArt)
|
||||
}
|
||||
end
|
||||
@@ -0,0 +1,105 @@
|
||||
package it.integry.ems.retail.Scontrini.dto;
|
||||
|
||||
import it.integry.ems_model.annotation.SqlField;
|
||||
|
||||
public class MMPosDTO {
|
||||
@SqlField(value="CODICE")
|
||||
private String codice;
|
||||
|
||||
@SqlField(value="CODICOPER")
|
||||
private String codicoper;
|
||||
|
||||
@SqlField(value="CODINTER")
|
||||
private String codinter;
|
||||
|
||||
@SqlField(value="CODREP")
|
||||
private String codrep;
|
||||
|
||||
@SqlField(value="DESRIDOT")
|
||||
private String desridot;
|
||||
|
||||
@SqlField(value="FLAGIDENT")
|
||||
private String flagident;
|
||||
|
||||
@SqlField(value="FLSCANBIL")
|
||||
private String flscanbil;
|
||||
|
||||
@SqlField(value="FLTRANS")
|
||||
private String fltrans;
|
||||
|
||||
@SqlField(value="GIORNO")
|
||||
private String giorno;
|
||||
|
||||
@SqlField(value="GRMERCP")
|
||||
private String grmercp;
|
||||
|
||||
@SqlField(value="GRPROMOZP")
|
||||
private String grpromozp;
|
||||
|
||||
@SqlField(value="ISCOPY")
|
||||
private String iscopy;
|
||||
|
||||
@SqlField(value="LKIVAP")
|
||||
private String lkivap;
|
||||
|
||||
@SqlField(value="N_CASSA")
|
||||
private String n_cassa;
|
||||
|
||||
@SqlField(value="N_SCONTR")
|
||||
private String n_scontr;
|
||||
|
||||
@SqlField(value="ORA")
|
||||
private String ora;
|
||||
|
||||
@SqlField(value="PRACQ")
|
||||
private String pracq;
|
||||
|
||||
@SqlField(value="PREZZO")
|
||||
private String prezzo;
|
||||
|
||||
@SqlField(value="QUANTITA")
|
||||
private String quantita;
|
||||
|
||||
@SqlField(value="SEGNO")
|
||||
private String segno;
|
||||
|
||||
@SqlField(value="VALUTA")
|
||||
private String valuta;
|
||||
|
||||
@SqlField(value="IDX")
|
||||
private String idx;
|
||||
|
||||
@SqlField(value="codfascia")
|
||||
private String codfascia;
|
||||
|
||||
@SqlField(value="key_battuta")
|
||||
private String key_battuta;
|
||||
|
||||
@SqlField(value="stampato")
|
||||
private String stampato;
|
||||
|
||||
@SqlField(value="CodiceScontrino")
|
||||
private String codicescontrino;
|
||||
|
||||
@SqlField(value="PREZZONETTO")
|
||||
private String prezzonetto;
|
||||
|
||||
@SqlField(value="OPTRANS")
|
||||
private String optrans;
|
||||
|
||||
@SqlField(value="VALTRANS")
|
||||
private String valtrans;
|
||||
|
||||
@SqlField(value="PARAM1")
|
||||
private String param1;
|
||||
|
||||
@SqlField(value="PARAM2")
|
||||
private String param2;
|
||||
|
||||
@SqlField(value="KEYS_REF")
|
||||
private String keys_ref;
|
||||
|
||||
@SqlField(value="CodMagaz.")
|
||||
private String codmagaz;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package it.integry.ems.retail.Scontrini.service;
|
||||
|
||||
import it.integry.ems.Import.dto.AnomalieDTO;
|
||||
import it.integry.ems.sync.MultiDBTransaction.Connection;
|
||||
import it.integry.ems_model.base.EntityBase;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class MmposServices {
|
||||
public List<EntityBase> importScontrini(String fileName, Connection connection, String typeImport, String formatImport, List<AnomalieDTO> anomalie) throws Exception {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user