Merge remote-tracking branch 'origin/develop' into develop
This commit is contained in:
43
build/create_build_tag.bat
Normal file
43
build/create_build_tag.bat
Normal file
@@ -0,0 +1,43 @@
|
||||
REM SET YEAR
|
||||
set YEAR=%date:~6,4%
|
||||
|
||||
REM SET MONTH
|
||||
set MONTH=%date:~3,2%
|
||||
if %MONTH% LSS 10 set MONTH=%MONTH:~1,2%
|
||||
if %MONTH% LSS 10 set MONTH=0%MONTH%
|
||||
|
||||
REM SET DAY
|
||||
set DAY=%date:~0,2%
|
||||
if %DAY% LSS 10 set DAY=%DAY:~1,2%
|
||||
if %DAY% LSS 10 set DAY=0%DAY%
|
||||
|
||||
REM SET HOUR
|
||||
set HOUR=%time:~0,2%
|
||||
if %HOUR% LSS 10 set HOUR=%HOUR:~1,2%
|
||||
if %HOUR% LSS 10 set HOUR=0%HOUR%
|
||||
|
||||
REM SET MINUTE
|
||||
set MINUTE=%time:~3,2%
|
||||
if %MINUTE% LSS 10 set MINUTE=%MINUTE:~1,2%
|
||||
if %MINUTE% LSS 10 set MINUTE=0%MINUTE%
|
||||
|
||||
REM SET SECOND
|
||||
set SECOND=%time:~6,2%
|
||||
if %SECOND% LSS 10 set SECOND=%SECOND:~1,2%
|
||||
if %SECOND% LSS 10 set SECOND=0%SECOND%
|
||||
|
||||
set mydate=%YEAR%%MONTH%%DAY%_%HOUR%%MINUTE%%SECOND%
|
||||
|
||||
|
||||
|
||||
echo #spring.profiles.active=@activatedProperties@ > ems-core\src\main\resources\configs\env.properties
|
||||
echo project.version=%mydate% >> ems-core\src\main\resources\configs\env.properties
|
||||
|
||||
|
||||
git add . -A
|
||||
git commit -m "%mydate%"
|
||||
git tag "%mydate%"
|
||||
|
||||
|
||||
git push https://git.studioml.it/Integry/IntegryManagementSystem.git --tags
|
||||
git push https://git.studioml.it/Integry/IntegryManagementSystem.git --all
|
||||
@@ -0,0 +1,50 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.IntegryCustomer;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20241007093433 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
if(!isCustomer(IntegryCustomer.RossoGargano)) return;
|
||||
|
||||
executeStatement(
|
||||
"update ctb_part \n" +
|
||||
"set ctb_part.cod_abi = vs_banca.cod_abi,\n" +
|
||||
"ctb_part.cod_cab = vs_banca.cod_cab,\n" +
|
||||
"ctb_part.iban = vs_banca.iban,\n" +
|
||||
"ctb_part.cod_banc = gtb_banc_azi.cod_banc_azi\n" +
|
||||
"from rossogarganoExchange.dbo.pnota inner join rg_crl_movt on pnota.pn_data_competenza = rg_crl_movt.pn_data_competenza\n" +
|
||||
"and pnota.pn_nro_reg = rg_crl_movt.pn_nro_reg\n" +
|
||||
"inner join ctb_parr on rg_crl_movt.num_cmov = ctb_parr.num_cmov\n" +
|
||||
"inner join ctb_part on ctb_parr.tipo_anag = ctb_part.tipo_anag\n" +
|
||||
"and ctb_parr.cod_anag = ctb_part.cod_anag\n" +
|
||||
"and ctb_parr.anno_part = ctb_part.anno_part\n" +
|
||||
"and ctb_parr.ser_doc = ctb_part.ser_doc\n" +
|
||||
"and ctb_parr.num_doc = ctb_part.num_doc\n" +
|
||||
"left outer join (select cbanca_key1,\n" +
|
||||
"\tiif (CBANCA.CBANCA_PAESE = 'IT', IIF(LEN(CBANCA.CBANCA_CC) > 0, CBANCA.CBANCA_PAESE + CBANCA.CBANCA_CTRL + CBANCA.CBANCA_CIN + CBANCA.CBANCA_ABI + CBANCA.CBANCA_CAB + CBANCA.CBANCA_CC,NULL) , CBANCA.CBANCA_BBAN) AS IBAN,\n" +
|
||||
"\tCBANCA.CBANCA_ABI AS COD_ABI,\n" +
|
||||
"\tCBANCA.CBANCA_CAB AS COD_CAB,\n" +
|
||||
"\tCBANCA.CBANCA_CC AS NUM_CC,\n" +
|
||||
"\tiif(len(CBANCA.CBANCA_BIC)=0,null, trim(CBANCA.CBANCA_BIC) ) AS COD_BIc\n" +
|
||||
"\tfrom RossoGarganoExchange.dbo.cbanca) vs_banca on pnota.pn_vs_banca_cc = vs_banca.cbanca_key1\n" +
|
||||
"left outer join (select cbanca_key1,\n" +
|
||||
"\tcbanca_c_coge\n" +
|
||||
"\tfrom RossoGarganoExchange.dbo.cbanca) ns_banca on ns_banca.cbanca_key1 like '%' + pnota.pn_ns_banca_cc \n" +
|
||||
"left outer join ctb_cont on ns_banca.cbanca_c_coge = ctb_cont.diacod\n" +
|
||||
"left outer join gtb_banc_azi on ctb_cont.cod_ccon = gtb_banc_azi.cod_ccon_ordinario\n" +
|
||||
"where Len(pnota.pn_vs_banca_cc) <> 0 OR Len(pnota.pn_ns_banca_cc) <> 0");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
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_20241007142159 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
createSetup("IMPORT_DOCUMENTI", "PAZIENZA_RIFORD", "ATTIVO", "N",
|
||||
"Inserire S/N per attivare/disattivare il tipo di importazione", false, null, false, false,
|
||||
false, false, false, null, false, null);
|
||||
createSetup("IMPORT_DOCUMENTI", "PAZIENZA_RIFORD", "EMAIL_FOR_LOG", null,
|
||||
"Inserire il file l'indirizzo email per inviare il log dell'importazione", false, null, false, false,
|
||||
false, false, false, null, false, null);
|
||||
createSetup("IMPORT_DOCUMENTI", "PAZIENZA_RIFORD", "FILE_FILTER", null,
|
||||
"Inserire il criterio di filtro dei file o il nome del file specifio (seguire la sintassi di java)", false, null, false, false,
|
||||
false, false, false, null, false, null);
|
||||
createSetup("IMPORT_DOCUMENTI", "PAZIENZA_RIFORD", "GG_CANC_FILE", null,
|
||||
"Giorni per la cancellazione dei file dalla cartella di appoggio", false, null, false, false,
|
||||
false, false, false, null, false, null);
|
||||
createSetup("IMPORT_DOCUMENTI", "PAZIENZA_RIFORD", "IMPORT_REST", "S",
|
||||
"Inserire S/N per attivare/disattivare il salvataggio con i servizi REST", false, null, false, false,
|
||||
false, false, false, null, false, null);
|
||||
createSetup("IMPORT_DOCUMENTI", "PAZIENZA_RIFORD", "LISTENING", "N",
|
||||
"Se LISTENIG = 'N' la procedura di importazione non si potrà mai mettere in ascolto sulla directory perchè nella procedura vengono prese in considerazione più file.", false, null, false, false,
|
||||
false, false, false, null, false, null);
|
||||
createSetup("IMPORT_DOCUMENTI", "PAZIENZA_RIFORD", "PATH_FILE", null,
|
||||
"Directory contente i file da importare.", false, null, false, false,
|
||||
false, false, false, null, false, null);
|
||||
createSetup("IMPORT_DOCUMENTI", "PAZIENZA_RIFORD", "PATH_FILE_IMPORTED", null,
|
||||
"Directory dove vengono spostati i file dopo l'importazione.", false, null, false, false,
|
||||
false, false, false, null, false, null);
|
||||
|
||||
createSetup("IMPORT_DOCUMENTI", "PAZIENZA_RIFORD", "TIPO_DOCUMENTO", null,
|
||||
"Tipi documento su cui assegnare i riferimenti.", false, null, false, false,
|
||||
false, false, false, null, false, null);
|
||||
|
||||
createSetup("IMPORT_DOCUMENTI", "PAZIENZA_RIFORD", "PARTITA_IVA", null,
|
||||
"Partita Iva del fornitore.", false, null, false, false,
|
||||
false, false, false, null, false, null);
|
||||
|
||||
createSetup("IMPORT_DOCUMENTI", "PAZIENZA_RIFORD", "USE_PART_IVA_AZIENDA", "S",
|
||||
"Usa partita iva per riconoscere l'azienda.", false, "SI_NO", false, false,
|
||||
false, false, false, null, false, null);
|
||||
createSetup("IMPORT_DOCUMENTI", "APULIA_RIFORD", "USE_PART_IVA_AZIENDA", "N",
|
||||
"Usa partita iva per riconoscere l'azienda.", false, "SI_NO", false, false,
|
||||
false, false, false, null, false, null);
|
||||
|
||||
if (!isCustomerDb(IntegryCustomerDB.Carelli_Carelli)) return;
|
||||
|
||||
updateSetupValue("IMPORT_DOCUMENTI", "PAZIENZA_RIFORD", "TIPO_DOCUMENTO", "BA|BA1|FTIA|FRCDF|FAD" );
|
||||
updateSetupValue("IMPORT_DOCUMENTI", "PAZIENZA_RIFORD", "ATTIVO", "S" );
|
||||
updateSetupValue("IMPORT_DOCUMENTI", "PAZIENZA_RIFORD", "LISTENING", "S" );
|
||||
updateSetupValue("IMPORT_DOCUMENTI", "PAZIENZA_RIFORD", "PARTITA_IVA", "07716650721" );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -35,17 +35,22 @@ public class DocOrdUntMisRules extends QueryRules {
|
||||
|
||||
BigDecimal qta1 = entity.getQta();
|
||||
String untMis1 = entity.getUntMis();
|
||||
final String finalUntMis1 = untMis1;
|
||||
BigDecimal qtaCnf = entity.getQtaCnf();
|
||||
|
||||
if (mtbAart == null) {
|
||||
mtbAart = CommonRules.completeDatiMtbAart(connection, codMart);
|
||||
}
|
||||
if (mtbPartitaMag == null){
|
||||
if (mtbPartitaMag == null) {
|
||||
mtbPartitaMag = CommonRules.completeDatiMtbPartitaMag(connection, codMart, partitaMag);
|
||||
}
|
||||
|
||||
List<MtbUntMis> mtbUntMisArt = getUmArticolo(connection, codMart);
|
||||
|
||||
boolean isEntityUMOfTipoImballo = mtbUntMisArt.stream()
|
||||
.anyMatch(x -> x.getUntMis().equalsIgnoreCase(finalUntMis1) && x.getTipoUm() == MtbUntMis.TipoUM.UI);
|
||||
|
||||
|
||||
if (UtilityString.isNullOrEmpty(untMis1)) {
|
||||
untMis1 = mtbAart.getUntMis();
|
||||
}
|
||||
@@ -74,7 +79,10 @@ public class DocOrdUntMisRules extends QueryRules {
|
||||
} else {
|
||||
cifreDec = 0;
|
||||
}
|
||||
if (!UtilityBigDecimal.isNullOrZero(qtaCnf) && !UtilityBigDecimal.isNullOrZero(qta1)) {
|
||||
|
||||
if (isEntityUMOfTipoImballo && numCnf == null) {
|
||||
numCnf = qta1;
|
||||
} else if (!UtilityBigDecimal.isNullOrZero(qtaCnf) && !UtilityBigDecimal.isNullOrZero(qta1)) {
|
||||
numCnf = qta1.divide(qtaCnf, cifreDec, RoundingMode.CEILING);
|
||||
} else {
|
||||
numCnf = BigDecimal.ZERO;
|
||||
@@ -82,7 +90,6 @@ public class DocOrdUntMisRules extends QueryRules {
|
||||
|
||||
}
|
||||
|
||||
final String finalUntMis1 = untMis1;
|
||||
Optional<MtbUntMis> optUM = Stream.of(mtbUntMisArt)
|
||||
.filter(mtbUntMis -> mtbUntMis.getUntMis().equalsIgnoreCase(finalUntMis1)).findFirst();
|
||||
|
||||
@@ -109,7 +116,7 @@ public class DocOrdUntMisRules extends QueryRules {
|
||||
String untMis2 = null, untMis3 = null;
|
||||
BigDecimal qta2 = BigDecimal.ZERO, qta3 = BigDecimal.ZERO;
|
||||
|
||||
if (mtbUntMisList.size() > 0) {
|
||||
if (!mtbUntMisList.isEmpty()) {
|
||||
if (mtbUntMisList.get(0).getOrdinamento() == 1) {
|
||||
mtbUntMisList = Stream.of(mtbUntMisList).sorted(Comparator.comparingInt(MtbUntMis::getOrdinamento)).toList();
|
||||
}
|
||||
@@ -161,8 +168,8 @@ public class DocOrdUntMisRules extends QueryRules {
|
||||
}
|
||||
|
||||
public static BigDecimal calcQtaCnf(Connection connection, String codMart, String partitaMag,
|
||||
MtbAart mtbAart, BigDecimal numCnf, BigDecimal rapConv, BigDecimal qta, BigDecimal qtaCnf ) throws Exception {
|
||||
return calcQtaCnf(connection, codMart, partitaMag, mtbAart, numCnf, rapConv, qta,qtaCnf, null, null, null);
|
||||
MtbAart mtbAart, BigDecimal numCnf, BigDecimal rapConv, BigDecimal qta, BigDecimal qtaCnf) throws Exception {
|
||||
return calcQtaCnf(connection, codMart, partitaMag, mtbAart, numCnf, rapConv, qta, qtaCnf, null, null, null);
|
||||
}
|
||||
|
||||
public static BigDecimal calcQtaCnf(Connection connection, String codMart, String partitaMag,
|
||||
@@ -186,7 +193,7 @@ public class DocOrdUntMisRules extends QueryRules {
|
||||
if (UtilityBigDecimal.isNullOrZero(qtaCnf) && UtilityString.equalsIgnoreCase(gestione, "A") && !UtilityString.isNullOrEmpty(listino)) {
|
||||
sql =
|
||||
Query.format("SELECT qta_cnf FROM dbo.getListinoAcquisto(null, %s, %s, %s, 'N', null) lisa ORDER BY flag_attivo",
|
||||
listino, codArtFor, codMart);
|
||||
listino, codArtFor, codMart);
|
||||
qtaCnf = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(connection, sql);
|
||||
}
|
||||
|
||||
@@ -237,7 +244,7 @@ public class DocOrdUntMisRules extends QueryRules {
|
||||
private static BigDecimal getRapConvUM(String untMis, MtbAart mtbAart, MtbPartitaMag mtbPartitaMag) {
|
||||
BigDecimal rapConvArt = BigDecimal.ONE;
|
||||
|
||||
if (mtbAart.getFlagQtaCnfFissa().equalsIgnoreCase("P") && mtbPartitaMag != null){
|
||||
if (mtbAart.getFlagQtaCnfFissa().equalsIgnoreCase("P") && mtbPartitaMag != null) {
|
||||
if (untMis.equalsIgnoreCase(mtbAart.getUntMis2())) {
|
||||
rapConvArt = mtbPartitaMag.getRapConv2();
|
||||
} else if (untMis.equalsIgnoreCase(mtbAart.getUntMis3())) {
|
||||
@@ -245,7 +252,7 @@ public class DocOrdUntMisRules extends QueryRules {
|
||||
} else {
|
||||
rapConvArt = BigDecimal.ONE;
|
||||
}
|
||||
}else {
|
||||
} else {
|
||||
if (untMis.equalsIgnoreCase(mtbAart.getUntMis2())) {
|
||||
rapConvArt = mtbAart.getRapConv2();
|
||||
} else if (untMis.equalsIgnoreCase(mtbAart.getUntMis3())) {
|
||||
|
||||
@@ -27,6 +27,7 @@ import java.io.IOException;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Statement;
|
||||
import java.text.DecimalFormat;
|
||||
@@ -139,6 +140,12 @@ public class RossoGarganoSyncService {
|
||||
|
||||
entityProcessor.processEntity(ctbMovt, true, multiDBTransactionManager);
|
||||
UtilityEntity.throwEntityException(ctbMovt);
|
||||
String sqlDelete = Query.format("DELETE FROM rg_crl_movt where num_cmov = %S", numCmov);
|
||||
PreparedStatement ps = multiDBTransactionManager.getPrimaryConnection().prepareStatement(sqlDelete);
|
||||
ps.executeUpdate();
|
||||
ps.close();
|
||||
multiDBTransactionManager.getPrimaryConnection().commit();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1018,6 +1025,39 @@ public class RossoGarganoSyncService {
|
||||
String tipoReg = ctbMovt.getCodIreg().substring(0, 1);
|
||||
int annoPart = UtilityDate.getYear(ctbMovt.getDataDoc());
|
||||
|
||||
//Recuperare la banca del cliente o dell'azienda
|
||||
String vsBanca = (String) dati.get("PN_VS_BANCA_CC");
|
||||
String nsBanca = (String) dati.get("PN_NS_BANCA_CC");
|
||||
|
||||
String iban = null, codAbi = null, codCab = null, codBanc = null;
|
||||
if (!UtilityString.isNullOrEmpty(vsBanca)){
|
||||
String sql =
|
||||
Query.format(
|
||||
"SELECT iif (CBANCA.CBANCA_PAESE = 'IT', IIF(LEN(CBANCA.CBANCA_CC) > 0, CBANCA.CBANCA_PAESE + CBANCA.CBANCA_CTRL + CBANCA.CBANCA_CIN + CBANCA.CBANCA_ABI + CBANCA.CBANCA_CAB + CBANCA.CBANCA_CC,NULL) , CBANCA.CBANCA_BBAN) AS IBAN,\n" +
|
||||
"CBANCA.CBANCA_ABI AS COD_ABI,\n" +
|
||||
"CBANCA.CBANCA_CAB AS COD_CAB\n" +
|
||||
" FROM cbanca\n"+
|
||||
" WHERE cbanca_key1 = %s", vsBanca) ;
|
||||
HashMap<String, Object> datiBanca = UtilityDB.executeSimpleQueryOnlyFirstRow(suorceData, sql);
|
||||
if (UtilityHashMap.isPresent(datiBanca)){
|
||||
iban = (String) datiBanca.get("IBAN");
|
||||
codAbi = (String) datiBanca.get("COD_ABI");
|
||||
codCab = (String) datiBanca.get("COD_CAB");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (!UtilityString.isNullOrEmpty(nsBanca)){
|
||||
String dbName =multiDBTransactionManager.getPrimaryDatasource().getDbName();
|
||||
String sql =
|
||||
"SELECT gtb_banc_azi.cod_banc\n" +
|
||||
" FROM cbanca \n" +
|
||||
" INNER JOIN "+ dbName+ ".dbo.ctb_cont on cbanca.cbanca_c_coge = ctb_cont.diacod \n"+
|
||||
" INNER JOIN "+ dbName+ ".dbo.gtb_banc_azi on ctb_cont.cod_ccon = gtb_banc_azi.cod_ccon_ordinario \n"+
|
||||
" WHERE cbanca_key1 like '%" + nsBanca + "'" ;
|
||||
codBanc = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(suorceData, sql);
|
||||
}
|
||||
|
||||
CtbPart ctbPart =
|
||||
new CtbPart()
|
||||
.setDataDoc(ctbMovt.getDataDoc())
|
||||
@@ -1030,7 +1070,11 @@ public class RossoGarganoSyncService {
|
||||
.setTotImponib(imponib)
|
||||
.setTotIva(iva)
|
||||
.setCodVage((String) dati.get("PN_COD_AGENTE"))
|
||||
.setCodPaga((String) dati.get("PN_COD_PAGAMENTO"));
|
||||
.setCodPaga((String) dati.get("PN_COD_PAGAMENTO"))
|
||||
.setCodAbi(codAbi)
|
||||
.setCodCab(codCab)
|
||||
.setIban(iban)
|
||||
.setCodBanc(codBanc);
|
||||
ctbPart.setOperation(OperationType.INSERT);
|
||||
// List<CtbScad> listaScadenze = new ArrayList<>();
|
||||
//
|
||||
|
||||
@@ -156,6 +156,7 @@ public class DocumentiImporter extends BaseEntityImporter<List<EntityBase>> impl
|
||||
.importDocumentiVenditaGelorent(type, format, requestDto.getRawContent(), anomalie);
|
||||
break;
|
||||
case APULIA_RIFORD:
|
||||
case PAZIENZA_RIFORD:
|
||||
entities = getContextBean(DocumentiAcquistoImportService.class)
|
||||
.importApuliaRifOrd(type, format, requestDto, anomalie, headless);
|
||||
break;
|
||||
@@ -220,6 +221,7 @@ public class DocumentiImporter extends BaseEntityImporter<List<EntityBase>> impl
|
||||
SCAR_MP_DA_DIST("SCAR_MP_DA_DIST"),
|
||||
GELORENT("GELORENT"),
|
||||
APULIA_RIFORD("APULIA_RIFORD"),
|
||||
PAZIENZA_RIFORD("PAZIENZA_RIFORD"),
|
||||
CASSETTO_FISCALE("CASSETTO_FISCALE");
|
||||
|
||||
private String text;
|
||||
|
||||
@@ -428,38 +428,41 @@ public class DocumentiAcquistoImportService {
|
||||
if (addRow) {
|
||||
List<String> articoli = Stream.of(doc.getWdtbDocr()).map(x -> x.getCodArtFor()).distinct().toList();
|
||||
|
||||
sql =
|
||||
String.format(
|
||||
"SELECT cod_art_for FROM mtb_lisa WHERE cod_alis = %s AND cod_art_for in (%s) AND cod_mart is null",
|
||||
UtilityDB.valueToString(dtbDoct.getListino()),
|
||||
UtilityDB.listValueToString(articoli));
|
||||
if (articoli != null && articoli.size() > 0 ) {
|
||||
|
||||
List<String> artMancanti = UtilityDB.executeSimpleQueryOnlyFirstColumn(multiDBTransactionManager.getPrimaryConnection(), sql);
|
||||
sql =
|
||||
String.format(
|
||||
"SELECT cod_art_for FROM mtb_lisa WHERE cod_alis = %s AND cod_art_for in (%s) AND cod_mart is null",
|
||||
UtilityDB.valueToString(dtbDoct.getListino()),
|
||||
UtilityDB.listValueToString(articoli));
|
||||
|
||||
if (artMancanti != null && artMancanti.size() > 0) {
|
||||
throw new Exception(String.format("Attenzione nel documento ci sono articoli non agganciati ad un codice interno. Articoli non codificati: %s",
|
||||
StringUtils.join(artMancanti, ",")));
|
||||
List<String> artMancanti = UtilityDB.executeSimpleQueryOnlyFirstColumn(multiDBTransactionManager.getPrimaryConnection(), sql);
|
||||
|
||||
if (artMancanti != null && artMancanti.size() > 0) {
|
||||
throw new Exception(String.format("Attenzione nel documento ci sono articoli non agganciati ad un codice interno. Articoli non codificati: %s",
|
||||
StringUtils.join(artMancanti, ",")));
|
||||
|
||||
}
|
||||
|
||||
|
||||
List<DtbDocr> righe = Stream.of(doc.getWdtbDocr()).map(
|
||||
d -> {
|
||||
DtbDocr dtbDocr = new DtbDocr();
|
||||
dtbDocr.setCodArtFor(d.getCodArtFor())
|
||||
.setDescrizione(d.getDescrizione())
|
||||
.setQtaDoc(d.getQtaDoc())
|
||||
.setValUnt(d.getValUnt())
|
||||
.setSconto5(d.getSconto5())
|
||||
.setSconto6(d.getSconto6())
|
||||
.setSconto7(d.getSconto7())
|
||||
.setSconto8(d.getSconto8());
|
||||
dtbDocr.setOperation(OperationType.INSERT_OR_UPDATE);
|
||||
return dtbDocr;
|
||||
}
|
||||
).toList();
|
||||
|
||||
dtbDoct.setDtbDocr(righe);
|
||||
}
|
||||
|
||||
|
||||
List<DtbDocr> righe = Stream.of(doc.getWdtbDocr()).map(
|
||||
d -> {
|
||||
DtbDocr dtbDocr = new DtbDocr();
|
||||
dtbDocr.setCodArtFor(d.getCodArtFor())
|
||||
.setDescrizione(d.getDescrizione())
|
||||
.setQtaDoc(d.getQtaDoc())
|
||||
.setValUnt(d.getValUnt())
|
||||
.setSconto5(d.getSconto5())
|
||||
.setSconto6(d.getSconto6())
|
||||
.setSconto7(d.getSconto7())
|
||||
.setSconto8(d.getSconto8());
|
||||
dtbDocr.setOperation(OperationType.INSERT_OR_UPDATE);
|
||||
return dtbDocr;
|
||||
}
|
||||
).toList();
|
||||
|
||||
dtbDoct.setDtbDocr(righe);
|
||||
entityList.add(dtbDoct);
|
||||
}
|
||||
|
||||
@@ -890,8 +893,10 @@ public class DocumentiAcquistoImportService {
|
||||
Map<String, String> setup = setupGest.getImportSetupSection(multiDBTransactionManager.getPrimaryConnection(), type, format);
|
||||
String tipiDoc = setup.get("TIPI_DOCUMENTO");
|
||||
String pIva = setup.get("PARTITA_IVA");
|
||||
|
||||
int ggImport = Integer.parseInt(setup.get("GG_IMPORT"));
|
||||
boolean usePartIvaAzienda = UtilityString.equalsIgnoreCase(setup.get("USE_PART_IVA_AZIENDA"), "S");
|
||||
int ggImport = 0;
|
||||
if ( setup.get("GG_IMPORT") != null )
|
||||
ggImport = Integer.parseInt(setup.get("GG_IMPORT"));
|
||||
|
||||
if (pIva == null || pIva.isEmpty()) {
|
||||
throw new Exception("Partita iva mancante");
|
||||
@@ -900,11 +905,12 @@ public class DocumentiAcquistoImportService {
|
||||
String fileName = requestDTO.getFileName();
|
||||
fileName = FilenameUtils.removeExtension(fileName);
|
||||
|
||||
Date dataFile = UtilityDate.StringToDate(fileName.substring(fileName.length() - 8), "yyyyMMdd");
|
||||
if (UtilityDate.DaysAfter(dataFile, UtilityDate.getTodayWithoutTime()) < ggImport) {
|
||||
throw new Exception("File con data antecedente alla data prevista per l'importazione");
|
||||
if (ggImport != 0 ) {
|
||||
Date dataFile = UtilityDate.StringToDate(fileName.substring(fileName.length() - 8), "yyyyMMdd");
|
||||
if (UtilityDate.DaysAfter(dataFile, UtilityDate.getTodayWithoutTime()) < ggImport) {
|
||||
throw new Exception("File con data antecedente alla data prevista per l'importazione");
|
||||
}
|
||||
}
|
||||
|
||||
Iterator<Row> rowIterator = UtilityExcel.readXlsxFile(requestDTO);
|
||||
List<RifOrdApuliaDTO> rifOrdApuliaList = new ArrayList<>();
|
||||
|
||||
@@ -915,23 +921,24 @@ public class DocumentiAcquistoImportService {
|
||||
String codiceAzienda = UtilityExcel.getCellAsString(row, 4);
|
||||
String codicePv = UtilityExcel.getCellAsString(row, 5);
|
||||
|
||||
String numFattura;
|
||||
Date dataFattura;
|
||||
Date dataFattura;
|
||||
|
||||
if (UtilityExcel.getCellAsString(row, 6).equalsIgnoreCase("0")) {
|
||||
String numFattura = UtilityExcel.getCellAsString(row, 6, false);
|
||||
if (UtilityString.isNullOrEmpty(numFattura ) || numFattura.equalsIgnoreCase("0")) {
|
||||
numFattura = UtilityExcel.getCellAsString(row, 1);
|
||||
dataFattura = UtilityExcel.getCellAsDate(row, 2, "yyyyMMdd");
|
||||
} else {
|
||||
numFattura = UtilityExcel.getCellAsString(row, 6);
|
||||
|
||||
dataFattura = UtilityExcel.getCellAsDate(row, 7, "yyyyMMdd");
|
||||
}
|
||||
|
||||
//Controllo che il numero dell'ordine sia formato solo da numeri
|
||||
if (numOrd.matches("\\d+")) {
|
||||
String finalNumFattura = numFattura;
|
||||
com.annimon.stream.Optional<RifOrdApuliaDTO> rifOrdApuliaDTOOptional = Stream.of(rifOrdApuliaList)
|
||||
.filter(i -> i.getCodicePv().equals(codicePv)
|
||||
&& i.getDataFattura().equals(dataFattura)
|
||||
&& i.getNumFattura().equals(numFattura)
|
||||
&& i.getNumFattura().equals(finalNumFattura)
|
||||
)
|
||||
.findFirst();
|
||||
|
||||
@@ -972,34 +979,42 @@ public class DocumentiAcquistoImportService {
|
||||
|
||||
for (AdvancedDataSource ds : multiDBTransactionManager.getActiveConnections()) {
|
||||
Connection connection = ds.getConnection();
|
||||
String codClie = null;
|
||||
|
||||
sql = "select cod_clie from gtb_anag inner join atb_forn on gtb_anag.cod_anag = atb_forn.cod_anag\n" +
|
||||
"where gtb_anag.part_iva = " + UtilityDB.valueToString(pIva) + " \n" +
|
||||
"and atb_forn.cod_clie is not null";
|
||||
String codClie = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(connection, sql);
|
||||
if (usePartIvaAzienda) {
|
||||
sql = "SELECT part_iva FROM azienda";
|
||||
codClie = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(connection, sql);
|
||||
} else {
|
||||
sql = "select cod_clie from gtb_anag inner join atb_forn on gtb_anag.cod_anag = atb_forn.cod_anag\n" +
|
||||
"where gtb_anag.part_iva = " + UtilityDB.valueToString(pIva) + " \n" +
|
||||
"and atb_forn.cod_clie is not null";
|
||||
codClie = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(connection, sql);
|
||||
|
||||
if (codClie == null) {
|
||||
anomalie.add(
|
||||
AnomalieDTO.info(
|
||||
"Codice cliente non trovato: " +
|
||||
CommonConstants.A_CAPO +
|
||||
CommonConstants.TAB +
|
||||
CommonConstants.TAB +
|
||||
"ProfileDb: " + ds.getProfileName()
|
||||
)
|
||||
);
|
||||
if (codClie == null) {
|
||||
anomalie.add(
|
||||
AnomalieDTO.info(
|
||||
"Codice cliente non trovato: " +
|
||||
CommonConstants.A_CAPO +
|
||||
CommonConstants.TAB +
|
||||
CommonConstants.TAB +
|
||||
"ProfileDb: " + ds.getProfileName()
|
||||
)
|
||||
);
|
||||
|
||||
continue;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
String finalCodClie = codClie;
|
||||
List<RifOrdApuliaDTO> list = Stream.of(rifOrdApuliaGroup)
|
||||
.filter(entry -> entry.getKey().equalsIgnoreCase(codClie))
|
||||
.filter(entry -> entry.getKey().equalsIgnoreCase(finalCodClie))
|
||||
.findFirst()
|
||||
.map(Map.Entry::getValue)
|
||||
.orElseGet(ArrayList::new);
|
||||
|
||||
if (list != null && !list.isEmpty()) {
|
||||
for (RifOrdApuliaDTO rifOrdApulia : list) {
|
||||
|
||||
sql = "select distinct mtb_depo_intercode.cod_mdep, mtb_depo_intercode.cod_forn, stb_gest_setup_depo.value as profile_db\n" +
|
||||
"from mtb_depo_intercode inner join gtb_anag on gtb_anag.cod_anag = mtb_depo_intercode.cod_forn \n" +
|
||||
"left outer join stb_gest_setup_depo on mtb_depo_intercode.cod_mdep = stb_gest_setup_depo.cod_mdep and\n" +
|
||||
@@ -1007,7 +1022,8 @@ public class DocumentiAcquistoImportService {
|
||||
"stb_gest_setup_depo.section = 'DATI_DEPOSITO' and \n" +
|
||||
"stb_gest_setup_depo.key_section = 'profile_db'\n" +
|
||||
"where gtb_anag.part_iva = " + UtilityDB.valueToString(pIva) + "\n" +
|
||||
"and intercode like '%<D>'+ " + UtilityDB.valueToString(rifOrdApulia.getCodicePv());
|
||||
"and ( intercode like '%<D>'+ " + UtilityDB.valueToString(rifOrdApulia.getCodicePv()) + " OR \n"+
|
||||
" mtb_depo_intercode.cod_mdep = " + UtilityDB.valueToString(rifOrdApulia.getCodicePv()) + ")";
|
||||
|
||||
HashMap<String, Object> result = UtilityDB.executeSimpleQueryOnlyFirstRow(connection, sql);
|
||||
|
||||
|
||||
@@ -769,7 +769,7 @@ public class SystemController {
|
||||
"from jtb_comt \n" +
|
||||
"inner join jrl_flav_users on jtb_comt.cod_jflav_tec = jrl_flav_users.cod_jflav and jrl_flav_users.flag_jflav_default = 's'\n" +
|
||||
"inner join stb_user on jrl_flav_users.user_name =stb_user.user_name " +
|
||||
"where cod_jcom = %S ", activity.getCodJcom());
|
||||
"where cod_jcom = %S + AND stb_user.user_name <> %S", activity.getCodJcom(), activity.getUserCreator()) ;
|
||||
String emailResponsabile = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(multiDBTransactionManager.getPrimaryConnection(), query);
|
||||
|
||||
if (!UtilityString.isNullOrEmpty(emailResponsabile) && !listEmailCcn.contains(emailResponsabile))
|
||||
|
||||
@@ -124,6 +124,9 @@ public class ExchangeDocumentImportService {
|
||||
|
||||
dataCount.addAndGet(allTestateData.size());
|
||||
|
||||
// allTestateData = allTestateData.stream()
|
||||
// .filter(x -> ((DtbDoct)x).getNumDoc() == 2428 && ((DtbDoct)x).getSerDoc().equalsIgnoreCase("A1"))
|
||||
// .collect(Collectors.toList());
|
||||
|
||||
for (EquatableEntityInterface dataToSave : allTestateData) {
|
||||
DtbDoct document = (DtbDoct) dataToSave;
|
||||
|
||||
@@ -8,6 +8,7 @@ import it.integry.ems.system.exchange.service.structure.ExchangeImportDataManage
|
||||
import it.integry.ems.system.exchange.service.structure.ExchangeImportSchemaManagerService;
|
||||
import it.integry.ems_model.base.EquatableEntityInterface;
|
||||
import it.integry.ems_model.entity.MtbPartitaMag;
|
||||
import it.integry.ems_model.exception.MergeEntityDBToObjectException;
|
||||
import it.integry.ems_model.types.OperationType;
|
||||
import it.integry.ems_model.utility.UtilityDB;
|
||||
import it.integry.ems_model.utility.UtilityLocalDate;
|
||||
@@ -22,7 +23,6 @@ import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
@Service
|
||||
@@ -67,8 +67,8 @@ public class ExchangePartiteMagazzinoImportService {
|
||||
|
||||
allData.forEach(x -> x.setOperation(x.getOperation() == OperationType.INSERT ? OperationType.INSERT_OR_UPDATE : x.getOperation()));
|
||||
|
||||
allData = allData.stream().filter(x -> x.getOperation() != OperationType.DELETE)
|
||||
.collect(Collectors.toList());
|
||||
// allData = allData.stream().filter(x -> x.getOperation() != OperationType.DELETE)
|
||||
// .collect(Collectors.toList());
|
||||
|
||||
final Exception[] firstExceptionToThrow = {null};
|
||||
|
||||
@@ -82,7 +82,12 @@ public class ExchangePartiteMagazzinoImportService {
|
||||
// calls.add(() -> {
|
||||
logger.debug("Importate {} partite di magazzino di {}", importedCounter.incrementAndGet(), allData.size());
|
||||
try {
|
||||
entityProcessor.processEntity(dataToSave, true, true, ROSSOGARGANO_EXCHANGE_USER, internalMultiDb, requestDataDTO);
|
||||
try {
|
||||
entityProcessor.processEntity(dataToSave, true, true, ROSSOGARGANO_EXCHANGE_USER, internalMultiDb, requestDataDTO);
|
||||
} catch (MergeEntityDBToObjectException mergeEntityDBToObjectException) {
|
||||
//ignore error if is DELETE
|
||||
if (dataToSave.getOperation() != OperationType.DELETE) throw mergeEntityDBToObjectException;
|
||||
}
|
||||
singleUpdateImported(exchangeMultiDb.getPrimaryConnection(), (MtbPartitaMag) dataToSave, useTempTable);
|
||||
|
||||
internalMultiDb.commitAll();
|
||||
|
||||
Reference in New Issue
Block a user