Merge remote-tracking branch 'origin/develop' into develop
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit is unstable
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit is unstable
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
package it.integry.ems.dto;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class ApplicationInfoDTO {
|
||||
private String name;
|
||||
@@ -10,7 +9,6 @@ public class ApplicationInfoDTO {
|
||||
private Short annoContab;
|
||||
|
||||
private String loadMenuPvm;
|
||||
private List<String> salvataggiSoap;
|
||||
|
||||
private boolean delimitedIdentifier;
|
||||
private boolean ansiPadding;
|
||||
@@ -70,15 +68,6 @@ public class ApplicationInfoDTO {
|
||||
return this;
|
||||
}
|
||||
|
||||
public List<String> getSalvataggiSoap() {
|
||||
return salvataggiSoap;
|
||||
}
|
||||
|
||||
public ApplicationInfoDTO setSalvataggiSoap(List<String> salvataggiSoap) {
|
||||
this.salvataggiSoap = salvataggiSoap;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isConcatNullYieldsNull() {
|
||||
return concatNullYieldsNull;
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.annimon.stream.Stream;
|
||||
import com.microsoft.sqlserver.jdbc.SQLServerException;
|
||||
import it.integry.ems.entity_logger.db_schema_manager.dto.*;
|
||||
import it.integry.ems.sync.MultiDBTransaction.Connection;
|
||||
import it.integry.ems_model.types.TypeDbObject;
|
||||
import it.integry.ems_model.utility.UtilityDB;
|
||||
import it.integry.ems_model.utility.UtilityHashMap;
|
||||
import it.integry.ems_model.utility.UtilityLocalDate;
|
||||
@@ -391,15 +392,19 @@ public class SQLServerDBSchemaManager {
|
||||
|
||||
|
||||
public void dropTable(DatabaseTable databaseTable) throws Exception {
|
||||
String dropSql = "DROP TABLE " + databaseTable.getTableName();
|
||||
execTableAlterSQL(dropSql);
|
||||
if (UtilityDB.existDatabaseObject(mConnection, databaseTable.getTableName(), TypeDbObject.TABLE)) {
|
||||
String dropSql = "DROP TABLE " + databaseTable.getTableName();
|
||||
execTableAlterSQL(dropSql);
|
||||
}
|
||||
this.mConnection.commit();
|
||||
}
|
||||
|
||||
|
||||
public void dropView(DatabaseView databaseTable) throws Exception {
|
||||
String dropSql = "DROP VIEW " + databaseTable.getTableName();
|
||||
execTableAlterSQL(dropSql);
|
||||
if (UtilityDB.existDatabaseObject(mConnection, databaseTable.getTableName(), TypeDbObject.VIEW)) {
|
||||
String dropSql = "DROP VIEW " + databaseTable.getTableName();
|
||||
execTableAlterSQL(dropSql);
|
||||
}
|
||||
this.mConnection.commit();
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ public class Migration_20240904103937 extends BaseMigration implements Migration
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
if (isHistoryDB() )
|
||||
return;
|
||||
|
||||
String val = "N";
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
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_20250305142509 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
createSetup("DATI_AZIENDA", "GIACENZA_DA_INV", "EMAIL_FOR_LOG", null, "Inidirizzi email ai quali inviare gli errori della procedura", null);
|
||||
|
||||
if (isCustomer(IntegryCustomer.Carelli))
|
||||
updateSetupValue("DATI_AZIENDA", "GIACENZA_DA_INV", "EMAIL_FOR_LOG", "f.lomangino@carellidistribuzione.it");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
}
|
||||
}
|
||||
@@ -1004,16 +1004,6 @@ public class EmsServices {
|
||||
for (AdvancedDataSource dataSource : db) {
|
||||
HashMap<String, Object> resultDbInfo = UtilityDB.executeSimpleQueryOnlyFirstRow(dataSource.getConnection(), sql);
|
||||
|
||||
String sqlSoap =
|
||||
"SELECT gest_name FROM stb_gest_sync where syncronize = 'S' " +
|
||||
"UNION ALL " +
|
||||
"SELECT DISTINCT 'EXPORT ' + export_type + ' : ' + format_file + ' - Utente: ' + wtb_users_info.user_name \n" +
|
||||
"from wtb_users_info cross apply dbo.getExportProperties(export_type, format_file) e \n" +
|
||||
"where export_mode = 'soap' and flag_state = 'S' and e.attivo = 's' \n" +
|
||||
"UNION ALL " +
|
||||
"SELECT gest_name + ' : ' + SECTION FROM DBO.getImportProperties(NULL, NULL) WHERE attivo = 's' and import_rest = 'n'";
|
||||
List<String> soap = UtilityDB.executeSimpleQueryOnlyFirstColumn(dataSource.getConnection(), sqlSoap);
|
||||
|
||||
final HashMap<String, String> setupSection = setupGest.getSetupSection(multiDBTransactionManager.getPrimaryConnection(), "DATI_AZIENDA", "SETUP");
|
||||
|
||||
ApplicationInfoDTO applicationInfoDTO = new ApplicationInfoDTO()
|
||||
@@ -1023,7 +1013,6 @@ public class EmsServices {
|
||||
.setAnnoMagaz(UtilityHashMap.getValueIfExists(resultDbInfo, "annoMagaz"))
|
||||
.setAnnoContab(UtilityHashMap.getValueIfExists(resultDbInfo, "annoContab"))
|
||||
.setLoadMenuPvm(UtilityHashMap.getValueIfExists(resultDbInfo, "loadMenuPvm"))
|
||||
.setSalvataggiSoap(soap)
|
||||
.setAnsiPadding(UtilityHashMap.<String>getValueIfExists(setupSection, "FLAG_ANSI_PADDING").equals("S"))
|
||||
.setDelimitedIdentifier(UtilityHashMap.<String>getValueIfExists(setupSection, "DELIMITED_IDENTIFIER").equals("1"))
|
||||
.setConcatNullYieldsNull(UtilityHashMap.<String>getValueIfExists(setupSection, "FLAG_CONCAT_NULL_YIELDS_NULL").equals("S"));
|
||||
@@ -1201,6 +1190,4 @@ public class EmsServices {
|
||||
|
||||
return entityFields;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -479,3 +479,13 @@ then
|
||||
setQta((BigDecimal) dati.get("qta"))
|
||||
}
|
||||
end
|
||||
|
||||
rule "completePortoOrd"
|
||||
no-loop
|
||||
when
|
||||
eval(completeRulesEnabled)
|
||||
$ordT : DtbOrdt(incoterms !=null && noteIncoterms != null )
|
||||
then
|
||||
String porto = $ordT.getIncoterms() + " " + $ordT.getNoteIncoterms();
|
||||
modify ( $ordT ) { setPorto(porto) }
|
||||
end
|
||||
@@ -864,8 +864,14 @@ public class SteUPService {
|
||||
sql = UtilityDB.addwhereCond(sql, whereCond, false);
|
||||
} else if (activityTypeId.equalsIgnoreCase(tipoAttivitaRotturaStock)) {
|
||||
if (repartiFreschi.contains(codJfas)) {
|
||||
sql = "Select cod_mart,descrizione,bar_code as barcode,cod_msgr " +
|
||||
" from steup_getGrigliaVendita(" + UtilityDB.valueToString(codMdep) + "," + UtilityDB.valueToString(codJfas) + ") order by descrizione";
|
||||
sql =
|
||||
"SELECT griglia.cod_mart, \n" +
|
||||
"descrizione, \n" +
|
||||
(chkRotturaStock?"mvw_barcode.cod_barre":"griglia.bar_code") + " as barcode, \n" +
|
||||
"cod_msgr\n " +
|
||||
" from steup_getGrigliaVendita(" + UtilityDB.valueToString(codMdep) + "," + UtilityDB.valueToString(codJfas) + ") griglia " +
|
||||
(chkRotturaStock?" INNER JOIN mvw_barcode on griglia.cod_mart = mvw_barcode.cod_mart ":"") +
|
||||
"order by descrizione";
|
||||
} else if (chkRotturaStock && barcode != null & !barcode.isEmpty()) {
|
||||
sql = "SELECT cod_mart,descrizione,bar_code as barcode,cod_msgr\n" +
|
||||
"FROM steup_getAssortimento(" + UtilityDB.valueToString(codMdep) + "," + UtilityDB.valueToString(codJfas) + ", " + UtilityDB.valueToString(dataCreation) + ") art\n" +
|
||||
|
||||
@@ -531,6 +531,13 @@ public class RossoGarganoSyncService {
|
||||
BigDecimal segnoReg = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(multiDBTransactionManager.getPrimaryConnection(), sql);
|
||||
if (UtilityBigDecimal.lowerThan(segnoReg, BigDecimal.ZERO)) {
|
||||
codDtip = "N" + codDtip;
|
||||
if (ctbMovt.getCodIreg().equalsIgnoreCase("FR")) {
|
||||
codDtip = "NTD16";
|
||||
} else if (ctbMovt.getCodIreg().equalsIgnoreCase("FY")) {
|
||||
codDtip = "NT17Y";
|
||||
} else if (ctbMovt.getCodIreg().equalsIgnoreCase("FZ")) {
|
||||
codDtip = "NTD17";
|
||||
}
|
||||
}
|
||||
|
||||
AutofatturaDTO autofatturaDTO =
|
||||
|
||||
@@ -8,7 +8,9 @@ import it.integry.ems.retail.dto.GiacenzaDTO;
|
||||
import it.integry.ems.retail.pvmRetail.service.PvmService;
|
||||
import it.integry.ems.retail.wms.inventario.service.WMSInventarioService;
|
||||
import it.integry.ems.service.EntityProcessor;
|
||||
import it.integry.ems.service.MailService;
|
||||
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
|
||||
import it.integry.ems.utility.UtilityDebug;
|
||||
import it.integry.ems.utility.UtilityEntity;
|
||||
import it.integry.ems_model.base.EntityBase;
|
||||
import it.integry.ems_model.db.ResultSetMapper;
|
||||
@@ -18,6 +20,7 @@ import it.integry.ems_model.entity.MtbInvenr;
|
||||
import it.integry.ems_model.service.SetupGest;
|
||||
import it.integry.ems_model.types.OperationType;
|
||||
import it.integry.ems_model.utility.*;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -29,6 +32,7 @@ import java.math.BigDecimal;
|
||||
import java.sql.SQLException;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
@Scope("request")
|
||||
@@ -38,17 +42,21 @@ public class GiacenzaService {
|
||||
@Autowired
|
||||
SetupGest setupGest;
|
||||
@Autowired
|
||||
WMSInventarioService wmsInventarioService;
|
||||
@Autowired
|
||||
EntityProcessor entityProcessor;
|
||||
|
||||
@Autowired
|
||||
private MailService mailService;
|
||||
|
||||
@Autowired
|
||||
PvmService pvmService;
|
||||
|
||||
private final Logger logger = LogManager.getLogger();
|
||||
private final String gestName = "DATI_AZIENDA";
|
||||
private final String section = "GIACENZA_DA_INV";
|
||||
|
||||
public void popolaGiancezaDaInventario(String codMdepParm) throws Exception {
|
||||
Date startDate = new Date();
|
||||
String emailDest = setupGest.getSetup(gestName, section, "EMAIL_FOR_LOG");
|
||||
|
||||
final String queryArt =
|
||||
"SELECT mtb_aart.cod_mart AS cod_mart,\n" +
|
||||
@@ -60,16 +68,53 @@ public class GiacenzaService {
|
||||
" LEFT OUTER JOIN mtb_comp ON mtb_aart.cod_mart = mtb_comp.cod_mart and mtb_aart.articolo_composto = 'S'";
|
||||
|
||||
String sql =
|
||||
"SELECT cod_mdep\n" +
|
||||
"FROM stb_gest_setup_depo\n" +
|
||||
"WHERE gest_name = 'DATI_AZIENDA'\n" +
|
||||
" AND section = 'GIACENZA_DA_INV'\n" +
|
||||
" AND key_section = 'ATTIVO'\n" +
|
||||
" AND value = 'S'";
|
||||
(
|
||||
"SELECT mtb_depo.cod_mdep,\n" +
|
||||
" CAST(IIF(stb_gest_setup_depo.value IS NOT NULL AND stb_gest_setup_depo.value = 'S', 1, 0) AS BIT) AS flag_attivo\n" +
|
||||
"FROM mtb_depo\n" +
|
||||
" LEFT OUTER JOIN stb_gest_setup_depo\n" +
|
||||
" ON stb_gest_setup_depo.cod_mdep = mtb_depo.cod_mdep \n" +
|
||||
" AND gest_name = '[GEST_NAME]'\n" +
|
||||
" AND section = '[SECTION]'\n" +
|
||||
" AND key_section = 'ATTIVO'\n" +
|
||||
"WHERE mtb_depo.flag_movimentabile = 'S'\n" +
|
||||
" AND mtb_depo.cod_vlis IS NOT NULL\n" +
|
||||
" AND NOT EXISTS(SELECT *\n" +
|
||||
" FROM stb_gest_setup_depo\n" +
|
||||
" WHERE gest_name = '[GEST_NAME]'\n" +
|
||||
" AND section = '[SECTION]'\n" +
|
||||
" AND key_section = 'REPLACE_DEPO'\n" +
|
||||
" AND stb_gest_setup_depo.cod_mdep = mtb_depo.cod_mdep)")
|
||||
.replace("[GEST_NAME]", gestName)
|
||||
.replace("[SECTION]", section);
|
||||
|
||||
if (!UtilityString.isNullOrEmpty(codMdepParm))
|
||||
sql += " AND stb_gest_setup_depo.cod_mdep = " + UtilityDB.valueToString(codMdepParm);
|
||||
List<String> depositi = UtilityDB.executeSimpleQueryOnlyFirstColumn(multiDBTransactionManager.getPrimaryConnection(), sql);
|
||||
sql += " AND mtb_depo.cod_mdep = " + UtilityDB.valueToString(codMdepParm);
|
||||
List<HashMap<String, Object>> datiDepo = UtilityDB.executeSimpleQuery(multiDBTransactionManager.getPrimaryConnection(), sql);
|
||||
|
||||
List<String> depositiDisattivi = datiDepo.stream()
|
||||
.filter(x -> !((Boolean) x.get("flag_attivo"))).
|
||||
map(x -> (String) x.get("cod_mdep")).collect(Collectors.toList());
|
||||
|
||||
if (!depositiDisattivi.isEmpty() && emailDest != null) {
|
||||
String message = String.format("Attenzione sui seguenti depositi non è attiva la procedura di popolamento delle giancenze: %S",
|
||||
StringUtils.join(depositiDisattivi, ","));
|
||||
|
||||
logger.error(message);
|
||||
if (!UtilityDebug.isDebugExecution()) {
|
||||
mailService.sendErrorMail(multiDBTransactionManager,
|
||||
emailDest,
|
||||
"Errore nel popolamento delle giacenze " + multiDBTransactionManager.getPrimaryDatasource().getDbName(),
|
||||
"Errore nel popolamento delle giacenze. " + message, null,
|
||||
null, null, null);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
List<String> depositi = datiDepo.stream()
|
||||
.filter(x -> ((Boolean) x.get("flag_attivo"))).
|
||||
map(x -> (String) x.get("cod_mdep")).collect(Collectors.toList());
|
||||
|
||||
List<RunnableThrowable> calls = new ArrayList<>();
|
||||
for (String codMdep : depositi) {
|
||||
calls.add(() -> {
|
||||
@@ -100,14 +145,14 @@ public class GiacenzaService {
|
||||
|
||||
private void popolamentoDatiDeposito(String codMdep, String queryArt, Date startDate) throws Exception {
|
||||
|
||||
String codDtipRett = setupGest.getSetup(multiDBTransactionManager.getPrimaryConnection(), "DATI_AZIENDA", "GIACENZA_DA_INV", "TIPO_DOC_RETT");
|
||||
String codDtipRett = setupGest.getSetup(multiDBTransactionManager.getPrimaryConnection(), gestName, section, "TIPO_DOC_RETT");
|
||||
|
||||
List<String> elencoDepositi = getElencoDepositi(codMdep);
|
||||
|
||||
cancellazioneKit(elencoDepositi);
|
||||
logger.debug(String.format(GiacenzaService.class.getSimpleName() + " - Deposito %s - Cancellazione kit: Timing " + ((new Date().getTime() - startDate.getTime()) / 1000) + " secs", codMdep));
|
||||
|
||||
String dataParm = setupGest.getSetupDepo(multiDBTransactionManager.getPrimaryConnection(), "DATI_AZIENDA", "GIACENZA_DA_INV", "DATA_INIZ", codMdep);
|
||||
String dataParm = setupGest.getSetupDepo(multiDBTransactionManager.getPrimaryConnection(), gestName, section, "DATA_INIZ", codMdep);
|
||||
Date dataIniz;
|
||||
if (!UtilityString.isNullOrEmpty(dataParm))
|
||||
dataIniz = UtilityString.parseDate(dataParm);
|
||||
@@ -515,7 +560,7 @@ public class GiacenzaService {
|
||||
|
||||
String sql = Query.format(
|
||||
"SELECT cod_mdep FROM stb_gest_setup_depo WHERE gest_name = %s AND section = %s AND key_section = %S AND value = %S",
|
||||
"DATI_AZIENDA", "GIACENZA_DA_INV", "REPLACE_DEPO", codMdep);
|
||||
gestName, section, "REPLACE_DEPO", codMdep);
|
||||
String codMdepNew = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(multiDBTransactionManager.getPrimaryConnection(), sql);
|
||||
String whereCond = UtilityDB.valueToString(codMdep);
|
||||
|
||||
@@ -672,7 +717,7 @@ public class GiacenzaService {
|
||||
|
||||
List<GiacenzaDTO> listGiacenza = UtilityDB.executeSimpleQueryDTO(multiDBTransactionManager.getPrimaryConnection(), sql, GiacenzaDTO.class);
|
||||
|
||||
String listiniAcquisto = setupGest.getSetup("DATI_AZIENDA", "GIACENZA_DA_INV", "LISTINI_ACQUISTO");
|
||||
String listiniAcquisto = setupGest.getSetup(gestName, section, "LISTINI_ACQUISTO");
|
||||
List<String> listini = new ArrayList<>();
|
||||
if (!UtilityString.isNullOrEmpty(listiniAcquisto)) {
|
||||
listini = Arrays.asList(listiniAcquisto.split("\\|"));
|
||||
|
||||
@@ -16,6 +16,7 @@ import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
|
||||
import it.integry.ems.system.Import.AnagraficaImporter;
|
||||
import it.integry.ems.system.export.AnagraficaExporter;
|
||||
import it.integry.ems.system.export.RisorseUmaneExporter;
|
||||
import it.integry.ems_model.utility.UtilityDB;
|
||||
import it.integry.ems_model.utility.UtilityLocalDate;
|
||||
import it.integry.ems_model.utility.UtilityThread;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
|
||||
@@ -1263,15 +1263,6 @@ public class SystemController {
|
||||
return sr;
|
||||
}
|
||||
|
||||
@RequestMapping(value = EmsRestConstants.PATH_LOG_SOAP_SERVICES, method = RequestMethod.POST)
|
||||
public void logSoapServices(HttpServletRequest request) {
|
||||
try {
|
||||
systemService.logSoapServices();
|
||||
} catch (Exception ex) {
|
||||
logger.error(ex);
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value = EmsRestConstants.PATH_MIGRATE_STB_FILES_SHARING_RULES, method = RequestMethod.POST)
|
||||
public ServiceRestResponse migrateStbFilesSharingRules(HttpServletRequest request,
|
||||
@RequestParam(CommonConstants.PROFILE_DB) String configuration) {
|
||||
|
||||
@@ -1877,49 +1877,6 @@ public class SystemService {
|
||||
|
||||
}
|
||||
|
||||
public void logSoapServices() throws Exception {
|
||||
|
||||
String tomcatBase = System.getProperty("catalina.base");
|
||||
String pathFile = tomcatBase + File.separator + "logs" +
|
||||
File.separator + "localhost_access_log." +
|
||||
new SimpleDateFormat(CommonConstants.DATE_FORMAT_YMD).format(new Date()) + ".txt";
|
||||
|
||||
File file = new File(pathFile);
|
||||
List<String> righe = UtilityFile.readLinesFromFile(file);
|
||||
|
||||
for (String riga : righe) {
|
||||
String serviceName = null;
|
||||
String dataService = null;
|
||||
if (riga.contains("axis") &&
|
||||
!riga.contains("WS_connectionEndpoint") &&
|
||||
!riga.contains("TransactionCoordinator")) {
|
||||
String[] prova = riga.split("/services/");
|
||||
serviceName = UtilityString.left(prova[1], prova[1].indexOf(" "));
|
||||
if (serviceName.indexOf(".") > 0) {
|
||||
serviceName = UtilityString.left(serviceName, serviceName.indexOf("."));
|
||||
}
|
||||
dataService = prova[0].substring(prova[0].indexOf("[") + 1, prova[0].indexOf("+"));
|
||||
Date dataS = new SimpleDateFormat("dd/MMM/yyyy:HH:mm:ss", Locale.ENGLISH).parse(dataService);
|
||||
dataService = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss").format(dataS);
|
||||
}
|
||||
|
||||
if (!UtilityString.isNullOrEmpty(serviceName)) {
|
||||
String url = "https://www.studioml.it/log_handler.php";
|
||||
HashMap<String, String> arguments = new HashMap<>();
|
||||
arguments.put("nome_azienda", emsProperties.getDefaultDatabase());
|
||||
arguments.put("type", "");
|
||||
arguments.put("format", "");
|
||||
arguments.put("username", "");
|
||||
arguments.put("entity_name", serviceName);
|
||||
arguments.put("date", dataService);
|
||||
StringBuilder srb = new StringBuilder();
|
||||
int requestStatusCode = HttpRestWrapper.callGeneric(url, null, null, null, ContentType.APPLICATION_JSON, srb, arguments);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public class UpdateMtbMoviNumMovTask implements Runnable {
|
||||
private final String profileDB;
|
||||
private final HashMap<String, Object> inputData;
|
||||
|
||||
Reference in New Issue
Block a user