Merge branch 'master' into develop
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
This commit is contained in:
@@ -4,6 +4,7 @@ import com.fasterxml.jackson.annotation.JsonTypeName;
|
|||||||
import it.integry.common.var.CommonConstants;
|
import it.integry.common.var.CommonConstants;
|
||||||
import it.integry.ems_model.annotation.*;
|
import it.integry.ems_model.annotation.*;
|
||||||
import it.integry.ems_model.base.EntityBase;
|
import it.integry.ems_model.base.EntityBase;
|
||||||
|
import it.integry.ems_model.base.EquatableEntityInterface;
|
||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
import org.kie.api.definition.type.PropertyReactive;
|
import org.kie.api.definition.type.PropertyReactive;
|
||||||
@@ -12,12 +13,13 @@ import java.math.BigDecimal;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
@Master
|
@Master
|
||||||
@PropertyReactive
|
@PropertyReactive
|
||||||
@Table(JtbCicl.ENTITY)
|
@Table(JtbCicl.ENTITY)
|
||||||
@JsonTypeName(JtbCicl.ENTITY)
|
@JsonTypeName(JtbCicl.ENTITY)
|
||||||
public class JtbCicl extends EntityBase {
|
public class JtbCicl extends EntityBase implements EquatableEntityInterface<JtbCicl> {
|
||||||
|
|
||||||
private final static Logger logger = LogManager.getLogger();
|
private final static Logger logger = LogManager.getLogger();
|
||||||
|
|
||||||
@@ -586,4 +588,32 @@ public class JtbCicl extends EntityBase {
|
|||||||
JtbCiclCq jtbCiclCq = new JtbCiclCq();
|
JtbCiclCq jtbCiclCq = new JtbCiclCq();
|
||||||
jtbCiclCq.deleteAllEntities(connection, this);
|
jtbCiclCq.deleteAllEntities(connection, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCodeKey() {
|
||||||
|
return Objects.hash(getCodProd());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equalsKey(JtbCicl other) {
|
||||||
|
if (this == other)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
if (hashCodeKey() != other.hashCodeKey())
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return Objects.equals(getCodProd(), other.getCodProd());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object o) {
|
||||||
|
if (!(o instanceof JtbCicl)) return false;
|
||||||
|
JtbCicl jtbCicl = (JtbCicl) o;
|
||||||
|
return Objects.equals(getCodProd(), jtbCicl.getCodProd()) && Objects.equals(getCodJfas(), jtbCicl.getCodJfas()) && Objects.equals(getQtaProd(), jtbCicl.getQtaProd()) && Objects.equals(getgIniz(), jtbCicl.getgIniz()) && Objects.equals(getGgTot(), jtbCicl.getGgTot()) && Objects.equals(getDescrizione(), jtbCicl.getDescrizione()) && Objects.equals(getDataUltVar(), jtbCicl.getDataUltVar()) && Objects.equals(getDescrizioneProd(), jtbCicl.getDescrizioneProd()) && Objects.equals(getUntMisProd(), jtbCicl.getUntMisProd()) && Objects.equals(getCaratteristica1(), jtbCicl.getCaratteristica1()) && Objects.equals(getDescrizioneCar1(), jtbCicl.getDescrizioneCar1()) && Objects.equals(getCaratteristica2(), jtbCicl.getCaratteristica2()) && Objects.equals(getDescrizioneCar2(), jtbCicl.getDescrizioneCar2()) && Objects.equals(getPesoSpec(), jtbCicl.getPesoSpec()) && Objects.equals(getDescrizioneEstesa(), jtbCicl.getDescrizioneEstesa()) && Objects.equals(getPercCostGen(), jtbCicl.getPercCostGen()) && Objects.equals(getPercRicLb(), jtbCicl.getPercRicLb()) && Objects.equals(getCodMart(), jtbCicl.getCodMart()) && Objects.equals(getFlagAttiva(), jtbCicl.getFlagAttiva()) && Objects.equals(getImgFile(), jtbCicl.getImgFile()) && Objects.equals(getRapConvProd(), jtbCicl.getRapConvProd()) && Objects.equals(getCodDiviCont(), jtbCicl.getCodDiviCont()) && Objects.equals(getCambioDiviCont(), jtbCicl.getCambioDiviCont()) && Objects.equals(getLunghezza(), jtbCicl.getLunghezza()) && Objects.equals(getLarghezza(), jtbCicl.getLarghezza()) && Objects.equals(getAltezza(), jtbCicl.getAltezza()) && Objects.equals(getLottoMinOrd(), jtbCicl.getLottoMinOrd()) && Objects.equals(getFlagQtaMultipla(), jtbCicl.getFlagQtaMultipla()) && Objects.equals(getQtaAllocazione(), jtbCicl.getQtaAllocazione()) && Objects.equals(getActivityTypeId(), jtbCicl.getActivityTypeId()) && Objects.equals(getFlagTipologia(), jtbCicl.getFlagTipologia()) && Objects.equals(getFlagTipoProd(), jtbCicl.getFlagTipoProd()) && Objects.equals(getSupplyDefault(), jtbCicl.getSupplyDefault()) && Objects.equals(getFlagScomposizione(), jtbCicl.getFlagScomposizione()) && Objects.equals(getCodCq(), jtbCicl.getCodCq()) && Objects.equals(getDataIns(), jtbCicl.getDataIns()) && Objects.equals(getPrezzoBase(), jtbCicl.getPrezzoBase()) && Objects.equals(getCostoProduzione(), jtbCicl.getCostoProduzione()) && Objects.equals(getCostoComplessivo(), jtbCicl.getCostoComplessivo());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return Objects.hash(getCodProd(), getCodJfas(), getQtaProd(), getgIniz(), getGgTot(), getDescrizione(), getDataUltVar(), getDescrizioneProd(), getUntMisProd(), getCaratteristica1(), getDescrizioneCar1(), getCaratteristica2(), getDescrizioneCar2(), getPesoSpec(), getDescrizioneEstesa(), getPercCostGen(), getPercRicLb(), getCodMart(), getFlagAttiva(), getImgFile(), getRapConvProd(), getCodDiviCont(), getCambioDiviCont(), getLunghezza(), getLarghezza(), getAltezza(), getLottoMinOrd(), getFlagQtaMultipla(), getQtaAllocazione(), getActivityTypeId(), getFlagTipologia(), getFlagTipoProd(), getSupplyDefault(), getFlagScomposizione(), getCodCq(), getDataIns(), getPrezzoBase(), getCostoProduzione(), getCostoComplessivo());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,17 +8,19 @@ import it.integry.ems_model.annotation.SqlDetailId;
|
|||||||
import it.integry.ems_model.annotation.SqlField;
|
import it.integry.ems_model.annotation.SqlField;
|
||||||
import it.integry.ems_model.annotation.Table;
|
import it.integry.ems_model.annotation.Table;
|
||||||
import it.integry.ems_model.base.EntityBase;
|
import it.integry.ems_model.base.EntityBase;
|
||||||
|
import it.integry.ems_model.base.EquatableEntityInterface;
|
||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
import org.kie.api.definition.type.PropertyReactive;
|
import org.kie.api.definition.type.PropertyReactive;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
@PropertyReactive
|
@PropertyReactive
|
||||||
@Table(JtbDistMate.ENTITY)
|
@Table(JtbDistMate.ENTITY)
|
||||||
@JsonTypeName(JtbDistMate.ENTITY)
|
@JsonTypeName(JtbDistMate.ENTITY)
|
||||||
public class JtbDistMate extends EntityBase {
|
public class JtbDistMate extends EntityBase implements EquatableEntityInterface<JtbDistMate> {
|
||||||
|
|
||||||
private final static Logger logger = LogManager.getLogger();
|
private final static Logger logger = LogManager.getLogger();
|
||||||
|
|
||||||
@@ -236,4 +238,32 @@ public class JtbDistMate extends EntityBase {
|
|||||||
this.codProdPri = codProdPri;
|
this.codProdPri = codProdPri;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCodeKey() {
|
||||||
|
return Objects.hash(getCodProd(), getIdRiga());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equalsKey(JtbDistMate other) {
|
||||||
|
if (this == other)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
if (hashCodeKey() != other.hashCodeKey())
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return Objects.equals(getCodProd(), other.getCodProd()) && Objects.equals(getIdRiga(), other.getIdRiga());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object o) {
|
||||||
|
if (!(o instanceof JtbDistMate)) return false;
|
||||||
|
JtbDistMate that = (JtbDistMate) o;
|
||||||
|
return Objects.equals(getCodProd(), that.getCodProd()) && Objects.equals(getIdRiga(), that.getIdRiga()) && Objects.equals(getCodMart(), that.getCodMart()) && Objects.equals(getQtaStd(), that.getQtaStd()) && Objects.equals(getDescrizione(), that.getDescrizione()) && Objects.equals(getRifProgetto(), that.getRifProgetto()) && Objects.equals(getNote(), that.getNote()) && Objects.equals(getPercSfrido(), that.getPercSfrido()) && Objects.equals(getDescrizioneEstesa(), that.getDescrizioneEstesa()) && Objects.equals(getUntMisDist(), that.getUntMisDist()) && Objects.equals(getRapConvDist(), that.getRapConvDist()) && Objects.equals(getFlagPri(), that.getFlagPri()) && Objects.equals(getCostoUnt(), that.getCostoUnt()) && Objects.equals(getNumFase(), that.getNumFase()) && Objects.equals(getDataUltMod(), that.getDataUltMod()) && Objects.equals(getModificatoDa(), that.getModificatoDa()) && Objects.equals(getCodProdPri(), that.getCodProdPri());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return Objects.hash(getCodProd(), getIdRiga(), getCodMart(), getQtaStd(), getDescrizione(), getRifProgetto(), getNote(), getPercSfrido(), getDescrizioneEstesa(), getUntMisDist(), getRapConvDist(), getFlagPri(), getCostoUnt(), getNumFase(), getDataUltMod(), getModificatoDa(), getCodProdPri());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,8 @@
|
|||||||
package it.integry.ems.logistic.Import.service;
|
package it.integry.ems.logistic.Import.service;
|
||||||
|
|
||||||
import it.integry.ems.Import.dto.AnomalieDTO;
|
import it.integry.ems.Import.dto.AnomalieDTO;
|
||||||
import it.integry.ems.datasource.DataSource;
|
|
||||||
import it.integry.ems.javabeans.RequestDataDTO;
|
import it.integry.ems.javabeans.RequestDataDTO;
|
||||||
import it.integry.ems.service.EntityProcessor;
|
import it.integry.ems.service.EntityProcessor;
|
||||||
import it.integry.ems.sync.MultiDBTransaction.Connection;
|
|
||||||
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
|
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
|
||||||
import it.integry.ems_model.base.EntityBase;
|
import it.integry.ems_model.base.EntityBase;
|
||||||
import it.integry.ems_model.entity.MtbColr;
|
import it.integry.ems_model.entity.MtbColr;
|
||||||
@@ -68,272 +66,272 @@ public class BiolexchImportService {
|
|||||||
throw new Exception("CONFIGURARE PROFILEDB BIOLEXCH IN STB_GEST_SETUP.");
|
throw new Exception("CONFIGURARE PROFILEDB BIOLEXCH IN STB_GEST_SETUP.");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Connessione al database di interscambio
|
try (MultiDBTransactionManager exchangeMultiDb = new MultiDBTransactionManager(profileSource)) {
|
||||||
DataSource dsBiolexch = new DataSource();
|
|
||||||
dsBiolexch.initialize(profileSource);
|
|
||||||
Connection connBiolexch = dsBiolexch.getConnection();
|
|
||||||
|
|
||||||
// Acquisizione colli da importare
|
// Acquisizione colli da importare
|
||||||
sql = "select colli.SSCC " +
|
sql = "select colli.SSCC " +
|
||||||
" ,colli.riga " +
|
" ,colli.riga " +
|
||||||
" ,colli.data_collo " +
|
" ,colli.data_collo " +
|
||||||
" ,colli.OrdRow " +
|
" ,colli.OrdRow " +
|
||||||
" ,colli.cod_mart " +
|
" ,colli.cod_mart " +
|
||||||
" ,colli.partita_mag " +
|
" ,colli.partita_mag " +
|
||||||
" ,colli.data_scad " +
|
" ,colli.data_scad " +
|
||||||
" ,colli.UM " +
|
" ,colli.UM " +
|
||||||
" ,colli.qta_col " +
|
" ,colli.qta_col " +
|
||||||
" ,colli.num_cnf " +
|
" ,colli.num_cnf " +
|
||||||
" ,colli.datetime_row " +
|
" ,colli.datetime_row " +
|
||||||
" ,ordini.gestione " +
|
" ,ordini.gestione " +
|
||||||
" ,ordini.data_ord " +
|
" ,ordini.data_ord " +
|
||||||
" ,ordini.num_ord " +
|
" ,ordini.num_ord " +
|
||||||
" ,ordini.cod_anag " +
|
" ,ordini.cod_anag " +
|
||||||
" ,ordini.cod_vdes " +
|
" ,ordini.cod_vdes " +
|
||||||
" ,ordini.cod_mdep " +
|
" ,ordini.cod_mdep " +
|
||||||
" ,ordini.listino " +
|
" ,ordini.listino " +
|
||||||
" ,ordini.anno " +
|
" ,ordini.anno " +
|
||||||
" ,ordini.num_ord_provv " +
|
" ,ordini.num_ord_provv " +
|
||||||
" ,ordini.serie " +
|
" ,ordini.serie " +
|
||||||
" ,colli.UDCOrigine " +
|
" ,colli.UDCOrigine " +
|
||||||
" from (select SSCC " +
|
" from (select SSCC " +
|
||||||
",ROW_NUMBER() over (partition by SSCC order by SSCC) as riga " +
|
",ROW_NUMBER() over (partition by SSCC order by SSCC) as riga " +
|
||||||
",movdate as data_collo " +
|
",movdate as data_collo " +
|
||||||
",OrdRow " +
|
",OrdRow " +
|
||||||
",ItemID as cod_mart " +
|
",ItemID as cod_mart " +
|
||||||
",BatchNum as partita_mag " +
|
",BatchNum as partita_mag " +
|
||||||
",ExpirationDate as data_scad " +
|
",ExpirationDate as data_scad " +
|
||||||
",UM " +
|
",UM " +
|
||||||
",Qty as qta_col" +
|
",Qty as qta_col" +
|
||||||
",NumPack as num_cnf" +
|
",NumPack as num_cnf" +
|
||||||
",MovDate as datetime_row" +
|
",MovDate as datetime_row" +
|
||||||
",flagERPRead " +
|
",flagERPRead " +
|
||||||
",ordNum" +
|
",ordNum" +
|
||||||
",ShippingList.UDCOrigine " +
|
",ShippingList.UDCOrigine " +
|
||||||
" from BiolevanteExch.dbo.ShippingList where len(SSCC) <> 0 AND SSCC IS NOT NULL) colli inner join " +
|
" from BiolevanteExch.dbo.ShippingList where len(SSCC) <> 0 AND SSCC IS NOT NULL) colli inner join " +
|
||||||
" (select CONVERT(varchar(4), DATEPART(year, dtb_ordt.data_ord)) + 'I' + SPACE(2) + FORMAT(case when dbo.getGestSetup('IMPORT_COLLI', 'BIOLEXCH', 'ORDINI_DA_PLURIMA') = 'S' then dtb_ordt.num_ord_provv else dtb_ordt.num_ord end, '000000') as ordNumBiolexch, " +
|
" (select CONVERT(varchar(4), DATEPART(year, dtb_ordt.data_ord)) + 'I' + SPACE(2) + FORMAT(case when dbo.getGestSetup('IMPORT_COLLI', 'BIOLEXCH', 'ORDINI_DA_PLURIMA') = 'S' then dtb_ordt.num_ord_provv else dtb_ordt.num_ord end, '000000') as ordNumBiolexch, " +
|
||||||
" dtb_ordt.gestione, " +
|
" dtb_ordt.gestione, " +
|
||||||
" dtb_ordt.data_ord, " +
|
" dtb_ordt.data_ord, " +
|
||||||
" dtb_ordt.num_ord, " +
|
" dtb_ordt.num_ord, " +
|
||||||
" dtb_ordt.cod_anag, " +
|
" dtb_ordt.cod_anag, " +
|
||||||
" dtb_ordt.cod_vdes, " +
|
" dtb_ordt.cod_vdes, " +
|
||||||
" dtb_ordt.cod_mdep, " +
|
" dtb_ordt.cod_mdep, " +
|
||||||
" dtb_ordt.listino, " +
|
" dtb_ordt.listino, " +
|
||||||
" dtb_ordr.riga_ord, " +
|
" dtb_ordr.riga_ord, " +
|
||||||
" DATEPART(year, dtb_ordt.data_ord) as anno, " +
|
" DATEPART(year, dtb_ordt.data_ord) as anno, " +
|
||||||
" dtb_ordt.num_ord_provv, " +
|
" dtb_ordt.num_ord_provv, " +
|
||||||
" dtb_ordt.serie " +
|
" dtb_ordt.serie " +
|
||||||
" from dtb_ordt, " +
|
" from dtb_ordt, " +
|
||||||
" dtb_ordr " +
|
" dtb_ordr " +
|
||||||
" where dtb_ordt.data_ord = dtb_ordr.data_ord and " +
|
" where dtb_ordt.data_ord = dtb_ordr.data_ord and " +
|
||||||
" dtb_ordt.gestione = dtb_ordr.gestione and " +
|
" dtb_ordt.gestione = dtb_ordr.gestione and " +
|
||||||
" dtb_ordt.num_ord = dtb_ordr.num_ord and" +
|
" dtb_ordt.num_ord = dtb_ordr.num_ord and" +
|
||||||
" dtb_ordt.gestione = 'V' and " +
|
" dtb_ordt.gestione = 'V' and " +
|
||||||
" ISNULL(dtb_ordt.serie,'') = case when dbo.getGestSetup('IMPORT_COLLI', 'BIOLEXCH', 'ORDINI_DA_PLURIMA') = 'S' then 'O' else '' end and " +
|
" ISNULL(dtb_ordt.serie,'') = case when dbo.getGestSetup('IMPORT_COLLI', 'BIOLEXCH', 'ORDINI_DA_PLURIMA') = 'S' then 'O' else '' end and " +
|
||||||
" dtb_ordt.data_ord > DATEADD(year, -1, getDate()) )ordini on colli.OrdNum = ordini.ordNumBiolexch and " +
|
" dtb_ordt.data_ord > DATEADD(year, -1, getDate()) )ordini on colli.OrdNum = ordini.ordNumBiolexch and " +
|
||||||
" colli.OrdRow = ordini.riga_ord " +
|
" colli.OrdRow = ordini.riga_ord " +
|
||||||
" where flagERPRead = 0 " +
|
" where flagERPRead = 0 " +
|
||||||
"order by SSCC, riga";
|
"order by SSCC, riga";
|
||||||
|
|
||||||
sql = UtilityDB.addwhereCond(sql, whereCond, true);
|
sql = UtilityDB.addwhereCond(sql, whereCond, true);
|
||||||
PreparedStatement ps = multiDBTransactionManager.getPrimaryDatasource().getConnection().prepareStatement(sql, ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
|
PreparedStatement ps = multiDBTransactionManager.getPrimaryDatasource().getConnection().prepareStatement(sql, ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
|
||||||
ResultSet rs = ps.executeQuery();
|
ResultSet rs = ps.executeQuery();
|
||||||
int rows = UtilityDB.countRow(rs);
|
int rows = UtilityDB.countRow(rs);
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
while (rs.next()) {
|
while (rs.next()) {
|
||||||
String SSCC = rs.getString(1);
|
String SSCC = rs.getString(1);
|
||||||
int SSCCRow = rs.getInt(2);
|
int SSCCRow = rs.getInt(2);
|
||||||
LocalDate SSCCDate = UtilityLocalDate.localDateFromDate(rs.getDate(3));
|
LocalDate SSCCDate = UtilityLocalDate.localDateFromDate(rs.getDate(3));
|
||||||
Integer ordRigaBio = rs.getInt(4);
|
Integer ordRigaBio = rs.getInt(4);
|
||||||
String codMart = rs.getString(5);
|
String codMart = rs.getString(5);
|
||||||
String partitaMag = rs.getString(6);
|
String partitaMag = rs.getString(6);
|
||||||
Date dataScadPartitaMag = rs.getDate(7);
|
Date dataScadPartitaMag = rs.getDate(7);
|
||||||
String untMis = rs.getString(8);
|
String untMis = rs.getString(8);
|
||||||
BigDecimal qtaCol = rs.getBigDecimal(9);
|
BigDecimal qtaCol = rs.getBigDecimal(9);
|
||||||
BigDecimal numCnf = rs.getBigDecimal(10);
|
BigDecimal numCnf = rs.getBigDecimal(10);
|
||||||
LocalDateTime SSCCDataOraRiga = rs.getTimestamp(11).toLocalDateTime();
|
LocalDateTime SSCCDataOraRiga = rs.getTimestamp(11).toLocalDateTime();
|
||||||
String gestione = rs.getString(12);
|
String gestione = rs.getString(12);
|
||||||
Date dataOrd = rs.getDate(13);
|
Date dataOrd = rs.getDate(13);
|
||||||
Integer numOrd = rs.getInt(14);
|
Integer numOrd = rs.getInt(14);
|
||||||
String codAnag = rs.getString(15);
|
String codAnag = rs.getString(15);
|
||||||
String codVdes = rs.getString(16);
|
String codVdes = rs.getString(16);
|
||||||
String codMdep = rs.getString(17);
|
String codMdep = rs.getString(17);
|
||||||
String codVlis = rs.getString(18);
|
String codVlis = rs.getString(18);
|
||||||
String UDCOrigine = rs.getString(22);
|
String UDCOrigine = rs.getString(22);
|
||||||
i++;
|
i++;
|
||||||
|
|
||||||
// Acquisizione collo orgine riferimento
|
// Acquisizione collo orgine riferimento
|
||||||
Boolean existColloRif = false;
|
Boolean existColloRif = false;
|
||||||
if (UDCOrigine != null && UDCOrigine.length() == 18) {
|
if (UDCOrigine != null && UDCOrigine.length() == 18) {
|
||||||
String gestioneOrigine = SSCC.substring(9, 10);
|
String gestioneOrigine = SSCC.substring(9, 10);
|
||||||
if (gestioneOrigine.compareTo("1") == 0) {
|
if (gestioneOrigine.compareTo("1") == 0) {
|
||||||
gestioneColloRif = "A";
|
gestioneColloRif = "A";
|
||||||
} else if (gestioneOrigine.compareTo("2") == 0) {
|
} else if (gestioneOrigine.compareTo("2") == 0) {
|
||||||
gestioneColloRif = "L";
|
gestioneColloRif = "L";
|
||||||
} else {
|
} else {
|
||||||
gestioneColloRif = "V";
|
gestioneColloRif = "V";
|
||||||
|
}
|
||||||
|
annoColloRif = new Integer("20" + SSCC.substring(10, 12));
|
||||||
|
numColloRif = new Integer(SSCC.substring(12, 17));
|
||||||
|
|
||||||
|
sql = "SELECT data_collo, ser_collo " +
|
||||||
|
" FROM mtb_colt " +
|
||||||
|
" WHERE gestione = " + UtilityDB.valueToString(gestioneColloRif) + " AND " +
|
||||||
|
" DATEPART(year, data_collo) = " + UtilityDB.valueToString(annoColloRif) + " AND " +
|
||||||
|
" num_collo = " + UtilityDB.valueToString(numColloRif);
|
||||||
|
|
||||||
|
PreparedStatement info = multiDBTransactionManager.getPrimaryDatasource().getConnection().prepareStatement(sql);
|
||||||
|
ResultSet res = info.executeQuery();
|
||||||
|
if (res.next()) {
|
||||||
|
existColloRif = true;
|
||||||
|
dataColloRif = UtilityLocalDate.localDateFromDate(res.getDate(1));
|
||||||
|
serColloRif = res.getString(2);
|
||||||
|
}
|
||||||
|
res.close();
|
||||||
|
info.close();
|
||||||
}
|
}
|
||||||
annoColloRif = new Integer("20" + SSCC.substring(10, 12));
|
|
||||||
numColloRif = new Integer(SSCC.substring(12, 17));
|
|
||||||
|
|
||||||
sql = "SELECT data_collo, ser_collo " +
|
|
||||||
" FROM mtb_colt " +
|
// Verifica esistenza articolo/lotto
|
||||||
" WHERE gestione = " + UtilityDB.valueToString(gestioneColloRif) + " AND " +
|
int count = 0;
|
||||||
" DATEPART(year, data_collo) = " + UtilityDB.valueToString(annoColloRif) + " AND " +
|
sql = "SELECT count(*) " +
|
||||||
" num_collo = " + UtilityDB.valueToString(numColloRif);
|
" FROM mtb_partita_mag " +
|
||||||
|
" WHERE cod_mart = " + UtilityDB.valueToString(codMart) + " AND " +
|
||||||
|
" partita_mag = " + UtilityDB.valueToString(partitaMag);
|
||||||
|
|
||||||
PreparedStatement info = multiDBTransactionManager.getPrimaryDatasource().getConnection().prepareStatement(sql);
|
PreparedStatement info = multiDBTransactionManager.getPrimaryDatasource().getConnection().prepareStatement(sql);
|
||||||
ResultSet res = info.executeQuery();
|
ResultSet res = info.executeQuery();
|
||||||
if (res.next()) {
|
if (res.next()) {
|
||||||
existColloRif = true;
|
count = res.getInt(1);
|
||||||
dataColloRif = UtilityLocalDate.localDateFromDate(res.getDate(1));
|
|
||||||
serColloRif = res.getString(2);
|
|
||||||
}
|
}
|
||||||
res.close();
|
res.close();
|
||||||
info.close();
|
info.close();
|
||||||
}
|
|
||||||
|
|
||||||
// Verifica esistenza articolo/lotto
|
if (count == 0) {
|
||||||
int count = 0;
|
int index = 0;
|
||||||
sql = "SELECT count(*) " +
|
MtbPartitaMag partMag = new MtbPartitaMag();
|
||||||
" FROM mtb_partita_mag " +
|
partMag.setOperation(OperationType.INSERT_OR_UPDATE);
|
||||||
" WHERE cod_mart = " + UtilityDB.valueToString(codMart) + " AND " +
|
partMag.setCodMart(codMart);
|
||||||
" partita_mag = " + UtilityDB.valueToString(partitaMag);
|
partMag.setPartitaMag(partitaMag);
|
||||||
|
partMag.setDataScad(dataScadPartitaMag);
|
||||||
PreparedStatement info = multiDBTransactionManager.getPrimaryDatasource().getConnection().prepareStatement(sql);
|
if (!entities.isEmpty()) {
|
||||||
ResultSet res = info.executeQuery();
|
index = entities.size() - 1;
|
||||||
if (res.next()) {
|
} else {
|
||||||
count = res.getInt(1);
|
index = entities.size();
|
||||||
}
|
|
||||||
res.close();
|
|
||||||
info.close();
|
|
||||||
|
|
||||||
if (count == 0) {
|
|
||||||
int index = 0;
|
|
||||||
MtbPartitaMag partMag = new MtbPartitaMag();
|
|
||||||
partMag.setOperation(OperationType.INSERT_OR_UPDATE);
|
|
||||||
partMag.setCodMart(codMart);
|
|
||||||
partMag.setPartitaMag(partitaMag);
|
|
||||||
partMag.setDataScad(dataScadPartitaMag);
|
|
||||||
if (!entities.isEmpty()) {
|
|
||||||
index = entities.size() - 1;
|
|
||||||
} else {
|
|
||||||
index = entities.size();
|
|
||||||
}
|
|
||||||
entities.add(index, partMag);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Verifica unità di misura: se non è UM Magazzino allora la quantità viene ricalcolata in funzione del'UM di magazzino
|
|
||||||
BigDecimal rapConv = null;
|
|
||||||
String untMisMagaz = null;
|
|
||||||
sql = "SELECT CASE " + UtilityDB.valueToString(untMis) + " WHEN unt_mis THEN 1 WHEN unt_mis2 THEN rap_conv2 " + " WHEN unt_mis3 THEN rap_conv3 " + " ELSE 1 END as rap_conv " +
|
|
||||||
" FROM mtb_aart " +
|
|
||||||
" WHERE cod_mart = " + UtilityDB.valueToString(codMart);
|
|
||||||
|
|
||||||
info = multiDBTransactionManager.getPrimaryDatasource().getConnection().prepareStatement(sql);
|
|
||||||
res = info.executeQuery();
|
|
||||||
if (res.next()) {
|
|
||||||
rapConv = res.getBigDecimal(1);
|
|
||||||
if (rapConv.compareTo(BigDecimal.ONE) != 0) {
|
|
||||||
qtaCol = qtaCol.multiply(rapConv).setScale(5, RoundingMode.HALF_UP);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
res.close();
|
|
||||||
info.close();
|
|
||||||
|
|
||||||
// Inserimento testata collo
|
|
||||||
if (SSCCRow == 1) {
|
|
||||||
if (SSCC.length() == 18) {
|
|
||||||
numCollo = new Integer(SSCC.substring(11, 17));
|
|
||||||
serCollo = "V"; /*E' stata creata una pedana mista*/
|
|
||||||
} else if (SSCC.substring(0, 1).compareTo("U") == 0) {
|
|
||||||
numCollo = new Integer(SSCC.substring(3));
|
|
||||||
serCollo = "UL"; /*E' stata sparata l'intera pedana*/
|
|
||||||
} else {
|
|
||||||
numCollo = 0;
|
|
||||||
serCollo = "/";
|
|
||||||
}
|
|
||||||
|
|
||||||
colT = new MtbColt();
|
|
||||||
colT.setOperation(OperationType.INSERT_OR_UPDATE);
|
|
||||||
colT.setGestione(gestione);
|
|
||||||
colT.setDataCollo(SSCCDate);
|
|
||||||
colT.setSerCollo(serCollo);
|
|
||||||
colT.setNumCollo(numCollo);
|
|
||||||
colT.setSegno(-1);
|
|
||||||
colT.setDataOrd(UtilityLocalDate.localDateFromDate(dataOrd));
|
|
||||||
colT.setNumOrd(numOrd);
|
|
||||||
colT.setCodAnag(codAnag);
|
|
||||||
colT.setCodVdes(codVdes);
|
|
||||||
colT.setCodMdep(codMdep);
|
|
||||||
colT.setCodVlis(codVlis);
|
|
||||||
colT.setAnnotazioni(SSCC);
|
|
||||||
entities.add(colT);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Inserimento righe collo
|
|
||||||
MtbColr colR = new MtbColr();
|
|
||||||
colR.setOperation(OperationType.INSERT);
|
|
||||||
colR.setRiga(SSCCRow);
|
|
||||||
colR.setCodMart(codMart);
|
|
||||||
colR.setPartitaMag(partitaMag);
|
|
||||||
colR.setDataOrd(UtilityLocalDate.localDateFromDate(dataOrd));
|
|
||||||
colR.setNumOrd(numOrd);
|
|
||||||
colR.setRigaOrd(ordRigaBio);
|
|
||||||
colR.setQtaCol(qtaCol);
|
|
||||||
colR.setNumCnf(numCnf);
|
|
||||||
colR.setDataScadPartita(dataScadPartitaMag);
|
|
||||||
colR.setDatetimeRow(SSCCDataOraRiga);
|
|
||||||
if (existColloRif) {
|
|
||||||
colR.setGestioneRif(gestioneColloRif);
|
|
||||||
colR.setDataColloRif(dataColloRif);
|
|
||||||
colR.setSerColloRif(serColloRif);
|
|
||||||
colR.setNumColloRif(numColloRif);
|
|
||||||
}
|
|
||||||
colT.getMtbColr().add(colR);
|
|
||||||
|
|
||||||
if (i < rows) {
|
|
||||||
rs.next();
|
|
||||||
SSCCNew = rs.getString(1);
|
|
||||||
rs.previous();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Registrazione colli
|
|
||||||
if (i == rows || SSCC.compareTo(SSCCNew) != 0) {
|
|
||||||
try {
|
|
||||||
for (int a = 0; a < entities.size(); a++) {
|
|
||||||
colTCheck = new MtbColt();
|
|
||||||
if (entities.get(a) instanceof MtbColt) {
|
|
||||||
colTCheck = (MtbColt) entities.get(a);
|
|
||||||
}
|
|
||||||
entityProcessor.processEntity(entities.get(a), true, true, multiDBTransactionManager.getPrimaryDatasource().getProfile(), multiDBTransactionManager);
|
|
||||||
if (entities.get(a) instanceof MtbColt) {
|
|
||||||
entitiesReturn.add(entities.get(a));
|
|
||||||
|
|
||||||
// Blocco collo registrato
|
|
||||||
sql = "UPDATE ShippingList SET flagERPRead = 1 " +
|
|
||||||
"WHERE SSCC = " + UtilityDB.valueToString(((MtbColt) entities.get(a)).getAnnotazioni());
|
|
||||||
ps = connBiolexch.prepareStatement(sql);
|
|
||||||
ps.executeUpdate();
|
|
||||||
ps.close();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
multiDBTransactionManager.commitAll();
|
entities.add(index, partMag);
|
||||||
connBiolexch.commit();
|
}
|
||||||
entities = new ArrayList<>();
|
|
||||||
} catch (Exception e) {
|
// Verifica unità di misura: se non è UM Magazzino allora la quantità viene ricalcolata in funzione del'UM di magazzino
|
||||||
if (colTCheck != null) {
|
BigDecimal rapConv = null;
|
||||||
anomalies.add(AnomalieDTO.warning(colTCheck.getAnnotazioni() + "\r\n" + e.getMessage()));
|
String untMisMagaz = null;
|
||||||
|
sql = "SELECT CASE " + UtilityDB.valueToString(untMis) + " WHEN unt_mis THEN 1 WHEN unt_mis2 THEN rap_conv2 " + " WHEN unt_mis3 THEN rap_conv3 " + " ELSE 1 END as rap_conv " +
|
||||||
|
" FROM mtb_aart " +
|
||||||
|
" WHERE cod_mart = " + UtilityDB.valueToString(codMart);
|
||||||
|
|
||||||
|
info = multiDBTransactionManager.getPrimaryDatasource().getConnection().prepareStatement(sql);
|
||||||
|
res = info.executeQuery();
|
||||||
|
if (res.next()) {
|
||||||
|
rapConv = res.getBigDecimal(1);
|
||||||
|
if (rapConv.compareTo(BigDecimal.ONE) != 0) {
|
||||||
|
qtaCol = qtaCol.multiply(rapConv).setScale(5, RoundingMode.HALF_UP);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
res.close();
|
||||||
|
info.close();
|
||||||
|
|
||||||
|
// Inserimento testata collo
|
||||||
|
if (SSCCRow == 1) {
|
||||||
|
if (SSCC.length() == 18) {
|
||||||
|
numCollo = new Integer(SSCC.substring(11, 17));
|
||||||
|
serCollo = "V"; /*E' stata creata una pedana mista*/
|
||||||
|
} else if (SSCC.substring(0, 1).compareTo("U") == 0) {
|
||||||
|
numCollo = new Integer(SSCC.substring(3));
|
||||||
|
serCollo = "UL"; /*E' stata sparata l'intera pedana*/
|
||||||
|
} else {
|
||||||
|
numCollo = 0;
|
||||||
|
serCollo = "/";
|
||||||
|
}
|
||||||
|
|
||||||
|
colT = new MtbColt();
|
||||||
|
colT.setOperation(OperationType.INSERT_OR_UPDATE);
|
||||||
|
colT.setGestione(gestione);
|
||||||
|
colT.setDataCollo(SSCCDate);
|
||||||
|
colT.setSerCollo(serCollo);
|
||||||
|
colT.setNumCollo(numCollo);
|
||||||
|
colT.setSegno(-1);
|
||||||
|
colT.setDataOrd(UtilityLocalDate.localDateFromDate(dataOrd));
|
||||||
|
colT.setNumOrd(numOrd);
|
||||||
|
colT.setCodAnag(codAnag);
|
||||||
|
colT.setCodVdes(codVdes);
|
||||||
|
colT.setCodMdep(codMdep);
|
||||||
|
colT.setCodVlis(codVlis);
|
||||||
|
colT.setAnnotazioni(SSCC);
|
||||||
|
entities.add(colT);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Inserimento righe collo
|
||||||
|
MtbColr colR = new MtbColr();
|
||||||
|
colR.setOperation(OperationType.INSERT);
|
||||||
|
colR.setRiga(SSCCRow);
|
||||||
|
colR.setCodMart(codMart);
|
||||||
|
colR.setPartitaMag(partitaMag);
|
||||||
|
colR.setDataOrd(UtilityLocalDate.localDateFromDate(dataOrd));
|
||||||
|
colR.setNumOrd(numOrd);
|
||||||
|
colR.setRigaOrd(ordRigaBio);
|
||||||
|
colR.setQtaCol(qtaCol);
|
||||||
|
colR.setNumCnf(numCnf);
|
||||||
|
colR.setDataScadPartita(dataScadPartitaMag);
|
||||||
|
colR.setDatetimeRow(SSCCDataOraRiga);
|
||||||
|
if (existColloRif) {
|
||||||
|
colR.setGestioneRif(gestioneColloRif);
|
||||||
|
colR.setDataColloRif(dataColloRif);
|
||||||
|
colR.setSerColloRif(serColloRif);
|
||||||
|
colR.setNumColloRif(numColloRif);
|
||||||
|
}
|
||||||
|
colT.getMtbColr().add(colR);
|
||||||
|
|
||||||
|
if (i < rows) {
|
||||||
|
rs.next();
|
||||||
|
SSCCNew = rs.getString(1);
|
||||||
|
rs.previous();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Registrazione colli
|
||||||
|
if (i == rows || SSCC.compareTo(SSCCNew) != 0) {
|
||||||
|
try {
|
||||||
|
for (int a = 0; a < entities.size(); a++) {
|
||||||
|
colTCheck = new MtbColt();
|
||||||
|
if (entities.get(a) instanceof MtbColt) {
|
||||||
|
colTCheck = (MtbColt) entities.get(a);
|
||||||
|
}
|
||||||
|
entityProcessor.processEntity(entities.get(a), true, true, multiDBTransactionManager.getPrimaryDatasource().getProfile(), multiDBTransactionManager);
|
||||||
|
if (entities.get(a) instanceof MtbColt) {
|
||||||
|
entitiesReturn.add(entities.get(a));
|
||||||
|
|
||||||
|
// Blocco collo registrato
|
||||||
|
sql = "UPDATE ShippingList SET flagERPRead = 1 " +
|
||||||
|
"WHERE SSCC = " + UtilityDB.valueToString(((MtbColt) entities.get(a)).getAnnotazioni());
|
||||||
|
ps = exchangeMultiDb.prepareStatement(sql);
|
||||||
|
ps.executeUpdate();
|
||||||
|
ps.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
multiDBTransactionManager.commitAll();
|
||||||
|
exchangeMultiDb.commitAll();
|
||||||
|
entities = new ArrayList<>();
|
||||||
|
} catch (Exception e) {
|
||||||
|
if (colTCheck != null) {
|
||||||
|
anomalies.add(AnomalieDTO.warning(colTCheck.getAnnotazioni() + "\r\n" + e.getMessage()));
|
||||||
|
}
|
||||||
|
multiDBTransactionManager.rollbackAll();
|
||||||
|
exchangeMultiDb.rollbackAll();
|
||||||
|
entities = new ArrayList<>();
|
||||||
}
|
}
|
||||||
multiDBTransactionManager.rollbackAll();
|
|
||||||
connBiolexch.rollback();
|
|
||||||
entities = new ArrayList<>();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
rs.close();
|
||||||
|
ps.close();
|
||||||
|
|
||||||
}
|
}
|
||||||
rs.close();
|
|
||||||
ps.close();
|
|
||||||
if (entitiesReturn.isEmpty()) {
|
if (entitiesReturn.isEmpty()) {
|
||||||
entitiesReturn.add(new MtbColt());
|
entitiesReturn.add(new MtbColt());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,35 @@
|
|||||||
|
package it.integry.ems.system.exchange.controller;
|
||||||
|
|
||||||
|
import it.integry.common.var.CommonConstants;
|
||||||
|
import it.integry.ems.javabeans.RequestDataDTO;
|
||||||
|
import it.integry.ems.response.ServiceRestResponse;
|
||||||
|
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
|
||||||
|
import it.integry.ems.system.exchange.service.ExchangeDistinteImportService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.annotation.Scope;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@Scope("request")
|
||||||
|
@RequestMapping("exchange/distinte/")
|
||||||
|
public class ExchangeDistinteImportController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ExchangeDistinteImportService exchangeDistinteImportService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private RequestDataDTO requestDataDTO;
|
||||||
|
|
||||||
|
@GetMapping(value = "import")
|
||||||
|
public @ResponseBody
|
||||||
|
ServiceRestResponse importDistinte(@RequestParam(CommonConstants.PROFILE_DB) String profileDb,
|
||||||
|
@RequestParam() String profileDbExchange) throws Exception {
|
||||||
|
|
||||||
|
|
||||||
|
try (MultiDBTransactionManager internalDb = new MultiDBTransactionManager(profileDb);
|
||||||
|
MultiDBTransactionManager exchangeDb = new MultiDBTransactionManager(profileDbExchange)) {
|
||||||
|
exchangeDistinteImportService.importDistinte(internalDb, exchangeDb, requestDataDTO);
|
||||||
|
}
|
||||||
|
return ServiceRestResponse.createPositiveResponse();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,194 @@
|
|||||||
|
package it.integry.ems.system.exchange.service;
|
||||||
|
|
||||||
|
import it.integry.ems.javabeans.RequestDataDTO;
|
||||||
|
import it.integry.ems.service.EntityProcessor;
|
||||||
|
import it.integry.ems.sync.MultiDBTransaction.Connection;
|
||||||
|
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
|
||||||
|
import it.integry.ems.system.exchange.service.structure.ExchangeImportDataManagerService;
|
||||||
|
import it.integry.ems.system.exchange.service.structure.ExchangeImportSchemaManagerService;
|
||||||
|
import it.integry.ems_model.base.EquatableEntityInterface;
|
||||||
|
import it.integry.ems_model.entity.JtbCicl;
|
||||||
|
import it.integry.ems_model.entity.JtbDistMate;
|
||||||
|
import it.integry.ems_model.types.OperationType;
|
||||||
|
import org.apache.logging.log4j.LogManager;
|
||||||
|
import org.apache.logging.log4j.Logger;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class ExchangeDistinteImportService {
|
||||||
|
|
||||||
|
//TODO: To be remove, only for fast development
|
||||||
|
private final String EXCHANGE_USER = "EXCHANGE";
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private EntityProcessor entityProcessor;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ExchangeImportSchemaManagerService exchangeImportSchemaManagerService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ExchangeImportDataManagerService exchangeImportDataManagerService;
|
||||||
|
|
||||||
|
private final Logger logger = LogManager.getLogger();
|
||||||
|
|
||||||
|
|
||||||
|
public void importDistinte(MultiDBTransactionManager internalMultiDb, MultiDBTransactionManager exchangeMultiDb, RequestDataDTO requestDataDTO) throws Exception {
|
||||||
|
boolean useTempTable = true;
|
||||||
|
ExchangeImportSchemaManagerService.SchemaType schemaType = ExchangeImportSchemaManagerService.SchemaType.DistinteBase;
|
||||||
|
|
||||||
|
String testataTableName = null;
|
||||||
|
String righeTableName = null;
|
||||||
|
|
||||||
|
if (schemaType == ExchangeImportSchemaManagerService.SchemaType.DistinteBase) {
|
||||||
|
testataTableName = "jtb_cicl";
|
||||||
|
righeTableName = "jtb_dist_mate";
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
exchangeImportSchemaManagerService.syncSchema(exchangeMultiDb.getPrimaryConnection(), schemaType, useTempTable);
|
||||||
|
exchangeImportDataManagerService.prepareData(exchangeMultiDb.getPrimaryConnection(), useTempTable,
|
||||||
|
exchangeImportSchemaManagerService.getTablesBySchemaType(schemaType));
|
||||||
|
exchangeMultiDb.commitAll();
|
||||||
|
|
||||||
|
final List<JtbCicl> exchangeImportedData = retrieveDistinte(
|
||||||
|
exchangeMultiDb.getPrimaryConnection(),
|
||||||
|
true, false,
|
||||||
|
testataTableName, righeTableName);
|
||||||
|
|
||||||
|
final List<JtbCicl> exchangeUpdatedData = retrieveDistinte(
|
||||||
|
exchangeMultiDb.getPrimaryConnection(),
|
||||||
|
false, useTempTable,
|
||||||
|
testataTableName, righeTableName);
|
||||||
|
|
||||||
|
List<EquatableEntityInterface> allData = exchangeImportDataManagerService
|
||||||
|
.runSync(JtbCicl.class, exchangeImportedData, exchangeUpdatedData);
|
||||||
|
|
||||||
|
allData.stream()
|
||||||
|
.filter(x -> x.getOperation() == OperationType.INSERT)
|
||||||
|
.map(x -> (JtbCicl) x)
|
||||||
|
.forEach(x -> {
|
||||||
|
x.setFlagAttiva("S");
|
||||||
|
x.setOperation(OperationType.INSERT_OR_UPDATE);
|
||||||
|
});
|
||||||
|
|
||||||
|
allData.removeIf(x -> x.getOperation() == OperationType.DELETE);
|
||||||
|
|
||||||
|
// allData.parallelStream()
|
||||||
|
// .filter(x -> x.getOperation() == OperationType.DELETE)
|
||||||
|
// .map(x -> (JtbCicl) x)
|
||||||
|
// .forEach(x -> {
|
||||||
|
// x.setFlagAttiva("N");
|
||||||
|
// x.setOperation(OperationType.UPDATE);
|
||||||
|
// });
|
||||||
|
|
||||||
|
final Exception[] firstExceptionToThrow = {null};
|
||||||
|
|
||||||
|
AtomicInteger importedCounter = new AtomicInteger();
|
||||||
|
|
||||||
|
for (EquatableEntityInterface<?> dataToSave : allData) {
|
||||||
|
|
||||||
|
JtbCicl distintaToSave = (JtbCicl) dataToSave;
|
||||||
|
|
||||||
|
logger.debug("Importate {} distinte di {}", importedCounter.incrementAndGet(), allData.size());
|
||||||
|
try {
|
||||||
|
entityProcessor.processEntity(distintaToSave, true, true, EXCHANGE_USER, internalMultiDb, requestDataDTO);
|
||||||
|
|
||||||
|
singleUpdateImported(exchangeMultiDb.getPrimaryConnection(), distintaToSave, useTempTable, testataTableName);
|
||||||
|
singleUpdateImported(exchangeMultiDb.getPrimaryConnection(), distintaToSave.getJtbDistMate(), useTempTable, righeTableName);
|
||||||
|
|
||||||
|
internalMultiDb.commitAll();
|
||||||
|
exchangeMultiDb.commitAll();
|
||||||
|
} catch (Exception ex) {
|
||||||
|
if (firstExceptionToThrow[0] == null) firstExceptionToThrow[0] = ex;
|
||||||
|
|
||||||
|
logger.error("Errore durante l'importazione della distinta [" +
|
||||||
|
"cod prod: " + distintaToSave.getCodProd() + "]", ex);
|
||||||
|
internalMultiDb.rollbackAll();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (firstExceptionToThrow[0] != null) throw firstExceptionToThrow[0];
|
||||||
|
} finally {
|
||||||
|
if (useTempTable)
|
||||||
|
exchangeImportSchemaManagerService.deleteTempTables(exchangeMultiDb.getPrimaryConnection(), schemaType);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private List<JtbCicl> retrieveDistinte(Connection connection, boolean retrieveAlreadyImported, boolean useTempTable,
|
||||||
|
String testataOriginalName, String righeOriginalName) throws Exception {
|
||||||
|
String testataTableName = testataOriginalName + (useTempTable ? "_tmp" : "");
|
||||||
|
String righeTableName = righeOriginalName + (useTempTable ? "_tmp" : "");
|
||||||
|
|
||||||
|
|
||||||
|
final List<JtbCicl> testate = exchangeImportDataManagerService.retrieveDataFromExchange(connection, JtbCicl.class,
|
||||||
|
testataTableName, null, retrieveAlreadyImported);
|
||||||
|
|
||||||
|
final List<JtbDistMate> righe = exchangeImportDataManagerService.retrieveDataFromExchange(connection, JtbDistMate.class,
|
||||||
|
righeTableName, null, retrieveAlreadyImported);
|
||||||
|
|
||||||
|
final List<JtbCicl> orphanTestateToAdd = righe.parallelStream()
|
||||||
|
.filter(riga ->
|
||||||
|
testate.parallelStream()
|
||||||
|
.noneMatch(testata ->
|
||||||
|
Objects.hash(riga.getCodProd()) ==
|
||||||
|
Objects.hash(testata.getCodProd()) &&
|
||||||
|
|
||||||
|
(Objects.equals(riga.getCodProd(), testata.getCodProd()))))
|
||||||
|
.map(riga -> {
|
||||||
|
JtbCicl testata = new JtbCicl();
|
||||||
|
testata.setCodProd(riga.getCodProd());
|
||||||
|
testata.setOperation(OperationType.UPDATE);
|
||||||
|
return testata;
|
||||||
|
})
|
||||||
|
.filter(testataOrphan -> testate.stream().noneMatch(testataOrphan::equalsKey))
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
|
|
||||||
|
testate.addAll(orphanTestateToAdd);
|
||||||
|
|
||||||
|
testate.parallelStream()
|
||||||
|
.forEach(testata -> {
|
||||||
|
testata.setUsername(EXCHANGE_USER);
|
||||||
|
//testata.setUpdProgMaga(false);
|
||||||
|
|
||||||
|
testata.setJtbDistMate(righe.parallelStream()
|
||||||
|
.filter(riga ->
|
||||||
|
Objects.hash(testata.getCodProd()) == Objects.hash(riga.getCodProd()) &&
|
||||||
|
|
||||||
|
(Objects.equals(testata.getCodProd(), riga.getCodProd())))
|
||||||
|
.collect(Collectors.toList()));
|
||||||
|
});
|
||||||
|
|
||||||
|
return testate;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private void singleUpdateImported(Connection connection, JtbCicl imported, boolean useTempTable, String tableName) throws Exception {
|
||||||
|
final HashMap<String, Object> importedKey = new HashMap<String, Object>() {{
|
||||||
|
put("cod_prod", imported.getCodProd());
|
||||||
|
}};
|
||||||
|
|
||||||
|
exchangeImportDataManagerService.updateImportedStatus(connection, tableName, importedKey, useTempTable);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void singleUpdateImported(Connection connection, List<JtbDistMate> imported, boolean useTempTable, String tableName) throws Exception {
|
||||||
|
final List<HashMap<String, Object>> importedRowKeys = imported.stream()
|
||||||
|
.map(x -> new HashMap<String, Object>() {{
|
||||||
|
put("cod_prod", x.getCodProd());
|
||||||
|
put("id_riga", x.getIdRiga());
|
||||||
|
}}).collect(Collectors.toList());
|
||||||
|
exchangeImportDataManagerService.updateImportedStatus(connection, tableName, importedRowKeys, useTempTable);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -259,20 +259,20 @@ public class ExchangeDocumentImportService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void singleUpdateImported(Connection connection, DtbDoct importedDtbDoct, boolean useTempTable, String tableName) throws Exception {
|
private void singleUpdateImported(Connection connection, DtbDoct imported, boolean useTempTable, String tableName) throws Exception {
|
||||||
final HashMap<String, Object> importedKey = new HashMap<String, Object>() {{
|
final HashMap<String, Object> importedKey = new HashMap<String, Object>() {{
|
||||||
put("data_doc", importedDtbDoct.getDataDoc());
|
put("data_doc", imported.getDataDoc());
|
||||||
put("ser_doc", importedDtbDoct.getSerDoc());
|
put("ser_doc", imported.getSerDoc());
|
||||||
put("num_doc", importedDtbDoct.getNumDoc());
|
put("num_doc", imported.getNumDoc());
|
||||||
put("cod_anag", importedDtbDoct.getCodAnag());
|
put("cod_anag", imported.getCodAnag());
|
||||||
put("cod_dtip", importedDtbDoct.getCodDtip());
|
put("cod_dtip", imported.getCodDtip());
|
||||||
}};
|
}};
|
||||||
|
|
||||||
exchangeImportDataManagerService.updateImportedStatus(connection, tableName, importedKey, useTempTable);
|
exchangeImportDataManagerService.updateImportedStatus(connection, tableName, importedKey, useTempTable);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void singleUpdateImported(Connection connection, List<DtbDocr> importedDtbDocr, boolean useTempTable, String tableName) throws Exception {
|
private void singleUpdateImported(Connection connection, List<DtbDocr> imported, boolean useTempTable, String tableName) throws Exception {
|
||||||
final List<HashMap<String, Object>> importedRowKeys = importedDtbDocr.stream()
|
final List<HashMap<String, Object>> importedRowKeys = imported.stream()
|
||||||
.map(x -> new HashMap<String, Object>() {{
|
.map(x -> new HashMap<String, Object>() {{
|
||||||
put("data_doc", x.getDataDoc());
|
put("data_doc", x.getDataDoc());
|
||||||
put("ser_doc", x.getSerDoc());
|
put("ser_doc", x.getSerDoc());
|
||||||
|
|||||||
@@ -200,6 +200,11 @@ public class ExchangeSystemManagerService {
|
|||||||
final ExchangeContrattiImportService beanContrattiVendita = ContextLoader.getCurrentWebApplicationContext().getBean(ExchangeContrattiImportService.class);
|
final ExchangeContrattiImportService beanContrattiVendita = ContextLoader.getCurrentWebApplicationContext().getBean(ExchangeContrattiImportService.class);
|
||||||
beanContrattiVendita.importVendita(internalDb, exchangeDb, requestDataDTO);
|
beanContrattiVendita.importVendita(internalDb, exchangeDb, requestDataDTO);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case DistinteBase:
|
||||||
|
final ExchangeDistinteImportService beanDistinteBase = ContextLoader.getCurrentWebApplicationContext().getBean(ExchangeDistinteImportService.class);
|
||||||
|
beanDistinteBase.importDistinte(internalDb, exchangeDb, requestDataDTO);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,7 +39,8 @@ public class ExchangeImportSchemaManagerService {
|
|||||||
DocumentiAcquisto(15),
|
DocumentiAcquisto(15),
|
||||||
ColliVendita(16),
|
ColliVendita(16),
|
||||||
OrdiniVendita(17),
|
OrdiniVendita(17),
|
||||||
ContrattiVendita(18);
|
ContrattiVendita(18),
|
||||||
|
DistinteBase(19);
|
||||||
|
|
||||||
|
|
||||||
private final int value;
|
private final int value;
|
||||||
@@ -147,6 +148,10 @@ public class ExchangeImportSchemaManagerService {
|
|||||||
put("vtb_offt_vend", VtbOfft.class);
|
put("vtb_offt_vend", VtbOfft.class);
|
||||||
put("vtb_offr_vend", VtbOffr.class);
|
put("vtb_offr_vend", VtbOffr.class);
|
||||||
}});
|
}});
|
||||||
|
put(SchemaType.DistinteBase, new HashMap<String, Class<? extends EntityInterface>>() {{
|
||||||
|
put("jtb_cicl", JtbCicl.class);
|
||||||
|
put("jtb_dist_mate", JtbDistMate.class);
|
||||||
|
}});
|
||||||
|
|
||||||
}};
|
}};
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ package it.integry.ems.system.service;
|
|||||||
import com.annimon.stream.Optional;
|
import com.annimon.stream.Optional;
|
||||||
import com.annimon.stream.Stream;
|
import com.annimon.stream.Stream;
|
||||||
import it.integry.ems.Import.dto.AnomalieDTO;
|
import it.integry.ems.Import.dto.AnomalieDTO;
|
||||||
import it.integry.ems.datasource.DataSource;
|
|
||||||
import it.integry.ems.service.EntityProcessor;
|
import it.integry.ems.service.EntityProcessor;
|
||||||
import it.integry.ems.service.MailService;
|
import it.integry.ems.service.MailService;
|
||||||
import it.integry.ems.service.MapService;
|
import it.integry.ems.service.MapService;
|
||||||
@@ -301,105 +300,106 @@ public class AnagImportService {
|
|||||||
if (UtilityString.streNull(profileSource).compareTo("") == 0) {
|
if (UtilityString.streNull(profileSource).compareTo("") == 0) {
|
||||||
throw new Exception("CONFIGURARE PROFILEDB EXCH2WINGEST IN STB_GEST_SETUP.");
|
throw new Exception("CONFIGURARE PROFILEDB EXCH2WINGEST IN STB_GEST_SETUP.");
|
||||||
}
|
}
|
||||||
DataSource dsExch2Wingest = new DataSource();
|
|
||||||
dsExch2Wingest.initialize(profileSource);
|
|
||||||
Connection connExch2Wingest = dsExch2Wingest.getConnection();
|
|
||||||
|
|
||||||
sql = "select distinct Addresses.country as nazione " +
|
try(MultiDBTransactionManager exchangeMultiDb = new MultiDBTransactionManager(profileSource)) {
|
||||||
" from Addresses " +
|
Connection exchangeConnection = exchangeMultiDb.getPrimaryConnection();
|
||||||
" WHERE Addresses.country NOT IN (SELECT nazione FROM " + dbPrimaryName + ".dbo.gtb_nazi)";
|
|
||||||
|
|
||||||
List<GtbNazi> gtbNazi = new ResultSetMapper()
|
sql = "select distinct Addresses.country as nazione " +
|
||||||
.mapQuerySetToList(connExch2Wingest, sql, GtbNazi.class, OperationType.INSERT);
|
" from Addresses " +
|
||||||
toBeProcessed.addAll(gtbNazi);
|
" WHERE Addresses.country NOT IN (SELECT nazione FROM " + dbPrimaryName + ".dbo.gtb_nazi)";
|
||||||
|
|
||||||
sql = "select Companies.CompID as diacod," +
|
List<GtbNazi> gtbNazi = new ResultSetMapper()
|
||||||
" Companies.CompName as rag_soc," +
|
.mapQuerySetToList(exchangeConnection, sql, GtbNazi.class, OperationType.INSERT);
|
||||||
" Companies.VatNum as part_iva, " +
|
toBeProcessed.addAll(gtbNazi);
|
||||||
" CASE WHEN Companies.VatNum <> Companies.TaxCode THEN Companies.TaxCode ELSE null END as cod_fisc, " +
|
|
||||||
" Addresses.addressId as cod_vdes, " +
|
|
||||||
" Addresses.address as indirizzo, " +
|
|
||||||
" Addresses.ZipCode as cap, " +
|
|
||||||
" Addresses.City as citta, " +
|
|
||||||
" Addresses.Prov as prov, " +
|
|
||||||
" Addresses.Country as nazione, " +
|
|
||||||
" Addresses.TelNum as telefono, " +
|
|
||||||
" Addresses.Email as e_mail " +
|
|
||||||
" from Companies, Addresses" +
|
|
||||||
" where Companies.CompID = Addresses.CompID and (left(Companies.CompID,1)+Right(Companies.CompID, 4) not in (select cod_anag from " + dbPrimaryName + ".dbo.gtb_anag ) OR (Right(Addresses.addressId,5) <>'00000' AND left(Companies.CompID,1)+Right(Companies.CompID, 4)+ Right(Addresses.addressId,5) not in (select cod_anag + cod_vdes from " + dbPrimaryName + ".dbo.vtb_dest )))" +
|
|
||||||
" order by Companies.CompID, Addresses.addressId ";
|
|
||||||
|
|
||||||
info = connExch2Wingest.prepareStatement(sql, ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
|
sql = "select Companies.CompID as diacod," +
|
||||||
res = info.executeQuery();
|
" Companies.CompName as rag_soc," +
|
||||||
while (res.next()) {
|
" Companies.VatNum as part_iva, " +
|
||||||
diacod = res.getString("diacod");
|
" CASE WHEN Companies.VatNum <> Companies.TaxCode THEN Companies.TaxCode ELSE null END as cod_fisc, " +
|
||||||
ragSoc = res.getString("rag_soc");
|
" Addresses.addressId as cod_vdes, " +
|
||||||
partIva = UtilityString.right(UtilityString.streNull(res.getString("part_iva")).trim(), 20);
|
" Addresses.address as indirizzo, " +
|
||||||
codFisc = UtilityString.right(UtilityString.streNull(res.getString("cod_fisc")).trim(), 16);
|
" Addresses.ZipCode as cap, " +
|
||||||
destinatario = res.getString("cod_vdes");
|
" Addresses.City as citta, " +
|
||||||
codVdes = UtilityString.right(destinatario.trim(), 5);
|
" Addresses.Prov as prov, " +
|
||||||
indirizzo = UtilityString.right(res.getString("indirizzo").trim(), 80);
|
" Addresses.Country as nazione, " +
|
||||||
cap = res.getString("cap").trim();
|
" Addresses.TelNum as telefono, " +
|
||||||
citta = UtilityString.right(res.getString("citta").trim(), 30);
|
" Addresses.Email as e_mail " +
|
||||||
prov = UtilityString.right(res.getString("prov").trim(), 2);
|
" from Companies, Addresses" +
|
||||||
nazione = UtilityString.right(res.getString("nazione").trim(), 3);
|
" where Companies.CompID = Addresses.CompID and (left(Companies.CompID,1)+Right(Companies.CompID, 4) not in (select cod_anag from " + dbPrimaryName + ".dbo.gtb_anag ) OR (Right(Addresses.addressId,5) <>'00000' AND left(Companies.CompID,1)+Right(Companies.CompID, 4)+ Right(Addresses.addressId,5) not in (select cod_anag + cod_vdes from " + dbPrimaryName + ".dbo.vtb_dest )))" +
|
||||||
telefono = UtilityString.right(res.getString("telefono").trim(), 40);
|
" order by Companies.CompID, Addresses.addressId ";
|
||||||
email = UtilityString.left(UtilityString.replaceSubString(res.getString("e_mail").trim(), " ", ""), 40);
|
|
||||||
|
|
||||||
codAnag = UtilityString.left(diacod, 1) + UtilityString.right(diacod, 4);
|
info = exchangeConnection.prepareStatement(sql, ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
|
||||||
|
res = info.executeQuery();
|
||||||
|
while (res.next()) {
|
||||||
|
diacod = res.getString("diacod");
|
||||||
|
ragSoc = res.getString("rag_soc");
|
||||||
|
partIva = UtilityString.right(UtilityString.streNull(res.getString("part_iva")).trim(), 20);
|
||||||
|
codFisc = UtilityString.right(UtilityString.streNull(res.getString("cod_fisc")).trim(), 16);
|
||||||
|
destinatario = res.getString("cod_vdes");
|
||||||
|
codVdes = UtilityString.right(destinatario.trim(), 5);
|
||||||
|
indirizzo = UtilityString.right(res.getString("indirizzo").trim(), 80);
|
||||||
|
cap = res.getString("cap").trim();
|
||||||
|
citta = UtilityString.right(res.getString("citta").trim(), 30);
|
||||||
|
prov = UtilityString.right(res.getString("prov").trim(), 2);
|
||||||
|
nazione = UtilityString.right(res.getString("nazione").trim(), 3);
|
||||||
|
telefono = UtilityString.right(res.getString("telefono").trim(), 40);
|
||||||
|
email = UtilityString.left(UtilityString.replaceSubString(res.getString("e_mail").trim(), " ", ""), 40);
|
||||||
|
|
||||||
GtbAnag gtbAnag = new GtbAnag();
|
codAnag = UtilityString.left(diacod, 1) + UtilityString.right(diacod, 4);
|
||||||
gtbAnag.setCodAnag(codAnag);
|
|
||||||
if (codVdes.compareTo("00000") == 0) {
|
GtbAnag gtbAnag = new GtbAnag();
|
||||||
gtbAnag.setOperation(OperationType.INSERT);
|
gtbAnag.setCodAnag(codAnag);
|
||||||
gtbAnag.setRagSoc(ragSoc);
|
if (codVdes.compareTo("00000") == 0) {
|
||||||
gtbAnag.setIndirizzo(indirizzo);
|
gtbAnag.setOperation(OperationType.INSERT);
|
||||||
gtbAnag.setCap(cap);
|
gtbAnag.setRagSoc(ragSoc);
|
||||||
gtbAnag.setCitta(citta);
|
gtbAnag.setIndirizzo(indirizzo);
|
||||||
gtbAnag.setProv(prov);
|
gtbAnag.setCap(cap);
|
||||||
gtbAnag.setNazione(nazione);
|
gtbAnag.setCitta(citta);
|
||||||
gtbAnag.setPartIva(partIva);
|
gtbAnag.setProv(prov);
|
||||||
gtbAnag.setCodFisc(codFisc);
|
gtbAnag.setNazione(nazione);
|
||||||
gtbAnag.setTelefono(telefono);
|
gtbAnag.setPartIva(partIva);
|
||||||
gtbAnag.seteMail(email);
|
gtbAnag.setCodFisc(codFisc);
|
||||||
gtbAnag.setDiacod(diacod);
|
gtbAnag.setTelefono(telefono);
|
||||||
} else {
|
gtbAnag.seteMail(email);
|
||||||
gtbAnag.setOperation(OperationType.NO_OP);
|
gtbAnag.setDiacod(diacod);
|
||||||
VtbDest vtbDest = new VtbDest();
|
} else {
|
||||||
vtbDest.setOperation(OperationType.INSERT);
|
gtbAnag.setOperation(OperationType.NO_OP);
|
||||||
vtbDest.setCodAnag(codAnag);
|
VtbDest vtbDest = new VtbDest();
|
||||||
vtbDest.setCodVdes(codVdes);
|
vtbDest.setOperation(OperationType.INSERT);
|
||||||
vtbDest.setDestinatario(ragSoc);
|
vtbDest.setCodAnag(codAnag);
|
||||||
vtbDest.setCodEan(destinatario);
|
vtbDest.setCodVdes(codVdes);
|
||||||
vtbDest.setCap(cap);
|
vtbDest.setDestinatario(ragSoc);
|
||||||
vtbDest.setCitta(citta);
|
vtbDest.setCodEan(destinatario);
|
||||||
vtbDest.setProv(prov);
|
vtbDest.setCap(cap);
|
||||||
vtbDest.setIndirizzo(UtilityString.right(indirizzo, 40));
|
vtbDest.setCitta(citta);
|
||||||
vtbDest.setNazione(nazione);
|
vtbDest.setProv(prov);
|
||||||
vtbDest.setTel(telefono);
|
vtbDest.setIndirizzo(UtilityString.right(indirizzo, 40));
|
||||||
vtbDest.seteMail(email);
|
vtbDest.setNazione(nazione);
|
||||||
vtbDest.setCodFisc(codFisc);
|
vtbDest.setTel(telefono);
|
||||||
vtbDest.setPartIva(partIva);
|
vtbDest.seteMail(email);
|
||||||
gtbAnag.getVtbDest().add(vtbDest);
|
vtbDest.setCodFisc(codFisc);
|
||||||
|
vtbDest.setPartIva(partIva);
|
||||||
|
gtbAnag.getVtbDest().add(vtbDest);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (UtilityString.left(diacod, 1).compareTo("C") == 0 && codVdes.compareTo("00000") == 0) {
|
||||||
|
VtbClie vtbClie = new VtbClie();
|
||||||
|
vtbClie.setOperation(OperationType.INSERT);
|
||||||
|
vtbClie.setCodAnag(codAnag);
|
||||||
|
gtbAnag.setVtbClie(vtbClie);
|
||||||
|
}
|
||||||
|
if (UtilityString.left(diacod, 1).compareTo("F") == 0 && codVdes.compareTo("00000") == 0) {
|
||||||
|
AtbForn atbForn = new AtbForn();
|
||||||
|
atbForn.setOperation(OperationType.INSERT);
|
||||||
|
atbForn.setCodAnag(codAnag);
|
||||||
|
gtbAnag.setAtbForn(atbForn);
|
||||||
|
}
|
||||||
|
|
||||||
|
toBeProcessed.add(gtbAnag);
|
||||||
}
|
}
|
||||||
|
res.close();
|
||||||
if (UtilityString.left(diacod, 1).compareTo("C") == 0 && codVdes.compareTo("00000") == 0) {
|
info.close();
|
||||||
VtbClie vtbClie = new VtbClie();
|
|
||||||
vtbClie.setOperation(OperationType.INSERT);
|
|
||||||
vtbClie.setCodAnag(codAnag);
|
|
||||||
gtbAnag.setVtbClie(vtbClie);
|
|
||||||
}
|
|
||||||
if (UtilityString.left(diacod, 1).compareTo("F") == 0 && codVdes.compareTo("00000") == 0) {
|
|
||||||
AtbForn atbForn = new AtbForn();
|
|
||||||
atbForn.setOperation(OperationType.INSERT);
|
|
||||||
atbForn.setCodAnag(codAnag);
|
|
||||||
gtbAnag.setAtbForn(atbForn);
|
|
||||||
}
|
|
||||||
|
|
||||||
toBeProcessed.add(gtbAnag);
|
|
||||||
}
|
}
|
||||||
res.close();
|
|
||||||
info.close();
|
|
||||||
|
|
||||||
if (!toBeProcessed.isEmpty()) {
|
if (!toBeProcessed.isEmpty()) {
|
||||||
entitiesReturn = entityProcessor.processEntityList(toBeProcessed, true);
|
entitiesReturn = entityProcessor.processEntityList(toBeProcessed, true);
|
||||||
|
|||||||
Reference in New Issue
Block a user