Compare commits
4 Commits
feature/JD
...
JpaTest
| Author | SHA1 | Date | |
|---|---|---|---|
| 8781b406ff | |||
| c9325674d9 | |||
| 99ca1731b1 | |||
| 6d7212ce97 |
18
.idea/copilotDiffState.xml
generated
Normal file
18
.idea/copilotDiffState.xml
generated
Normal file
File diff suppressed because one or more lines are too long
33
.idea/dataSources.xml
generated
33
.idea/dataSources.xml
generated
@@ -1,11 +1,40 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="DataSourceManagerImpl" format="xml" multifile-model="true">
|
||||
<data-source source="LOCAL" name="@SERVERDB2019" uuid="ff4f0bad-7271-429e-a4e1-bae28629efc8">
|
||||
<data-source source="LOCAL" name="Biolevante@SERVERDB2019" uuid="ff4f0bad-7271-429e-a4e1-bae28629efc8">
|
||||
<driver-ref>sqlserver.ms</driver-ref>
|
||||
<synchronize>true</synchronize>
|
||||
<jdbc-driver>com.microsoft.sqlserver.jdbc.SQLServerDriver</jdbc-driver>
|
||||
<jdbc-url>jdbc:sqlserver://SERVERDB2019</jdbc-url>
|
||||
<jdbc-url>jdbc:sqlserver://SERVERDB2019\MSSQLSERVER;database=Biolevante</jdbc-url>
|
||||
<jdbc-additional-properties>
|
||||
<property name="com.intellij.clouds.kubernetes.db.host.port" />
|
||||
<property name="com.intellij.clouds.kubernetes.db.enabled" value="false" />
|
||||
<property name="com.intellij.clouds.kubernetes.db.container.port" />
|
||||
</jdbc-additional-properties>
|
||||
<working-dir>$ProjectFileDir$</working-dir>
|
||||
</data-source>
|
||||
<data-source source="LOCAL" name="Gramm@SERVERDB2019" uuid="02282d62-6d2a-4b83-bdcf-b558fa6db140">
|
||||
<driver-ref>sqlserver.ms</driver-ref>
|
||||
<synchronize>true</synchronize>
|
||||
<jdbc-driver>com.microsoft.sqlserver.jdbc.SQLServerDriver</jdbc-driver>
|
||||
<jdbc-url>jdbc:sqlserver://SERVERDB2019\MSSQLSERVER;database=Gramm</jdbc-url>
|
||||
<jdbc-additional-properties>
|
||||
<property name="com.intellij.clouds.kubernetes.db.host.port" />
|
||||
<property name="com.intellij.clouds.kubernetes.db.enabled" value="false" />
|
||||
<property name="com.intellij.clouds.kubernetes.db.container.port" />
|
||||
</jdbc-additional-properties>
|
||||
<working-dir>$ProjectFileDir$</working-dir>
|
||||
</data-source>
|
||||
<data-source source="LOCAL" name="vgalimenti@SERVERDB" uuid="eaf0bcaf-4620-478b-b63c-42e77902813f">
|
||||
<driver-ref>sqlserver.ms</driver-ref>
|
||||
<synchronize>true</synchronize>
|
||||
<jdbc-driver>com.microsoft.sqlserver.jdbc.SQLServerDriver</jdbc-driver>
|
||||
<jdbc-url>jdbc:sqlserver://SERVERDB\MSSQLSERVER;database=vgalimenti</jdbc-url>
|
||||
<jdbc-additional-properties>
|
||||
<property name="com.intellij.clouds.kubernetes.db.host.port" />
|
||||
<property name="com.intellij.clouds.kubernetes.db.enabled" value="false" />
|
||||
<property name="com.intellij.clouds.kubernetes.db.container.port" />
|
||||
</jdbc-additional-properties>
|
||||
<working-dir>$ProjectFileDir$</working-dir>
|
||||
</data-source>
|
||||
</component>
|
||||
|
||||
8
.idea/data_source_mapping.xml
generated
Normal file
8
.idea/data_source_mapping.xml
generated
Normal file
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="DataSourcePerFileMappings">
|
||||
<file url="file://$PROJECT_DIR$/.idea/queries/Query.sql" value="ff4f0bad-7271-429e-a4e1-bae28629efc8" />
|
||||
<file url="file://$PROJECT_DIR$/.idea/queries/Query_1.sql" value="02282d62-6d2a-4b83-bdcf-b558fa6db140" />
|
||||
<file url="file://$PROJECT_DIR$/.idea/queries/Query_2.sql" value="eaf0bcaf-4620-478b-b63c-42e77902813f" />
|
||||
</component>
|
||||
</project>
|
||||
6
.idea/db-forest-config.xml
generated
Normal file
6
.idea/db-forest-config.xml
generated
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="db-tree-configuration">
|
||||
<option name="data" value="---------------------------------------- 1:0:ff4f0bad-7271-429e-a4e1-bae28629efc8 2:0:02282d62-6d2a-4b83-bdcf-b558fa6db140 3:0:eaf0bcaf-4620-478b-b63c-42e77902813f " />
|
||||
</component>
|
||||
</project>
|
||||
5
.idea/jarRepositories.xml
generated
5
.idea/jarRepositories.xml
generated
@@ -1,6 +1,11 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="RemoteRepositoriesConfiguration">
|
||||
<remote-repository>
|
||||
<option name="id" value="central" />
|
||||
<option name="name" value="central" />
|
||||
<option name="url" value="https://repo.maven.apache.org/maven2" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="central" />
|
||||
<option name="name" value="Central Repository" />
|
||||
|
||||
8
.idea/sqldialects.xml
generated
Normal file
8
.idea/sqldialects.xml
generated
Normal file
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="SqlDialectMappings">
|
||||
<file url="file://$PROJECT_DIR$/.idea/queries/Query.sql" dialect="TSQL" />
|
||||
<file url="file://$PROJECT_DIR$/.idea/queries/Query_1.sql" dialect="TSQL" />
|
||||
<file url="file://$PROJECT_DIR$/.idea/queries/Query_2.sql" dialect="TSQL" />
|
||||
</component>
|
||||
</project>
|
||||
40
Dockerfile
40
Dockerfile
@@ -1,11 +1,45 @@
|
||||
FROM tomcat:9-jre8-alpine
|
||||
|
||||
RUN apk add --no-cache fontconfig ttf-dejavu
|
||||
FROM tomcat:9-jre8
|
||||
|
||||
ENV TZ="Europe/Rome"
|
||||
ENV JAVA_OPTS="-DDISABLE_DROOLS_COMPILE=TRUE -Xms512M -Xmx2G -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005"
|
||||
ENV USERDOMAIN="STUDIO-ML"
|
||||
|
||||
# Install Samba
|
||||
RUN apt-get update && \
|
||||
apt-get install -y samba samba-common-bin && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Ensure log directory exists and is readable
|
||||
RUN mkdir -p /usr/local/tomcat/logs && \
|
||||
chmod -R 755 /usr/local/tomcat/logs
|
||||
|
||||
# Create samba user (no login) and add to root group
|
||||
RUN useradd -M -s /usr/sbin/nologin sambauser && \
|
||||
printf "sambapass\nsambapass\n" | smbpasswd -a -s sambauser && \
|
||||
usermod -aG root sambauser
|
||||
|
||||
# Samba configuration
|
||||
RUN printf "\
|
||||
[global]\n\
|
||||
workgroup = STUDIO-ML\n\
|
||||
security = user\n\
|
||||
map to guest = never\n\
|
||||
server role = standalone server\n\
|
||||
unix extensions = no\n\
|
||||
client min protocol = NT1\n\
|
||||
\n\
|
||||
[tomcat-logs]\n\
|
||||
comment = Tomcat logs (read-only)\n\
|
||||
path = /usr/local/tomcat/logs\n\
|
||||
browseable = yes\n\
|
||||
read only = yes\n\
|
||||
guest ok = no\n\
|
||||
valid users = sambauser\n\
|
||||
force user = root\n\
|
||||
create mask = 0644\n\
|
||||
directory mask = 0755\n\
|
||||
" > /etc/samba/smb.conf
|
||||
|
||||
COPY docker/tomcat/conf/integry/ems.properties /usr/local/tomcat/conf/integry/
|
||||
COPY docker/tomcat/conf/integry/ems_automated_operations.json /usr/local/tomcat/conf/integry/
|
||||
COPY docker/tomcat/conf/integry/ems_settings.json /usr/local/tomcat/conf/integry/
|
||||
|
||||
@@ -404,6 +404,17 @@
|
||||
<artifactId>spring-orm</artifactId>
|
||||
<version>${spring.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.data</groupId>
|
||||
<artifactId>spring-data-jpa</artifactId>
|
||||
<version>2.7.18</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.hibernate</groupId>
|
||||
<artifactId>hibernate-core</artifactId>
|
||||
<version>5.6.15.Final</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-context-support</artifactId>
|
||||
|
||||
@@ -28,9 +28,6 @@ public class DbmsChangeTrackerComponent {
|
||||
private final HashMap<IntegryCustomerDB, DbmsChangeTracker> activeChangeTrackers = new HashMap<>();
|
||||
|
||||
private final ArrayList<String> trackedTables = new ArrayList<String>() {{
|
||||
add(MtbAart.ENTITY);
|
||||
add(MtbAartBarCode.ENTITY);
|
||||
add(MtbUntMis.ENTITY);
|
||||
add(MtbDepo.ENTITY);
|
||||
add(MtbDepoPosizioni.ENTITY);
|
||||
add(StbEditLimit.ENTITY);
|
||||
|
||||
@@ -53,9 +53,6 @@ public class EntityCacheComponent implements ApplicationListener {
|
||||
}
|
||||
|
||||
private final HashMap<String, Class<? extends EntityBase>> enabledEntities = new HashMap<String, Class<? extends EntityBase>>() {{
|
||||
put(MtbAart.ENTITY, MtbAart.class);
|
||||
put(MtbAartBarCode.ENTITY, MtbAartBarCode.class);
|
||||
put(MtbUntMis.ENTITY, MtbUntMis.class);
|
||||
put(MtbDepo.ENTITY, MtbDepo.class);
|
||||
put(MtbDepoPosizioni.ENTITY, MtbDepoPosizioni.class);
|
||||
put(StbEditLimit.ENTITY, StbEditLimit.class);
|
||||
|
||||
@@ -3,6 +3,7 @@ package it.integry.ems.javabeans;
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import it.integry.common.var.CommonConstants;
|
||||
import it.integry.ems._context.ApplicationContextProvider;
|
||||
import it.integry.ems.jpa.TenantContext;
|
||||
import it.integry.ems.json.ResponseJSONObjectMapper;
|
||||
import it.integry.ems.migration._base.IntegryCustomerDB;
|
||||
import it.integry.ems.model.IntegryApplicationEnum;
|
||||
@@ -19,13 +20,15 @@ import org.springframework.security.authentication.AnonymousAuthenticationToken;
|
||||
import org.springframework.security.core.Authentication;
|
||||
import org.springframework.security.core.context.SecurityContextHolder;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.context.WebApplicationContext;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.annotation.PreDestroy;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.io.IOException;
|
||||
|
||||
@Component
|
||||
@Scope("request")
|
||||
@Scope(WebApplicationContext.SCOPE_REQUEST)
|
||||
public class RequestDataDTO {
|
||||
|
||||
private final Logger logger = LogManager.getLogger();
|
||||
@@ -100,6 +103,24 @@ public class RequestDataDTO {
|
||||
} else {
|
||||
jsonObjectMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
|
||||
}
|
||||
|
||||
// Logica di fallback o recupero tenant da sessione/utente
|
||||
if (profileDB == null || profileDB.isEmpty()) {
|
||||
// Esempio: recupero da sessione se presente
|
||||
// tenantId = (String) request.getSession().getAttribute("TENANT_ID");
|
||||
|
||||
// Fallback temporaneo per test
|
||||
// tenantId = DEFAULT_TENANT;
|
||||
}
|
||||
|
||||
if (profileDB != null) {
|
||||
TenantContext.setCurrentTenant(profileDB);
|
||||
}
|
||||
}
|
||||
|
||||
@PreDestroy
|
||||
public void destroy() throws Exception {
|
||||
TenantContext.clear();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
package it.integry.ems.jpa;
|
||||
|
||||
import it.integry.ems.settings.Model.AvailableConnectionModel;
|
||||
import it.integry.ems.settings.Model.SettingsModel;
|
||||
import it.integry.ems.sync.MultiDBTransaction.BasicConnectionPool;
|
||||
import org.springframework.jdbc.datasource.lookup.AbstractRoutingDataSource;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class MultiTenantDataSource extends AbstractRoutingDataSource {
|
||||
|
||||
private final BasicConnectionPool basicConnectionPool;
|
||||
private final SettingsModel settingsModel;
|
||||
|
||||
public MultiTenantDataSource(BasicConnectionPool basicConnectionPool, SettingsModel settingsModel) {
|
||||
this.basicConnectionPool = basicConnectionPool;
|
||||
this.settingsModel = settingsModel;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Object determineCurrentLookupKey() {
|
||||
return TenantContext.getCurrentTenant();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() {
|
||||
Map<Object, Object> targetDataSources = new HashMap<>();
|
||||
List<AvailableConnectionModel> connections = settingsModel.getAvailableConnections(false);
|
||||
|
||||
// Imposta il primo come default se necessario, o gestisci il caso null
|
||||
DataSource defaultDataSource = null;
|
||||
|
||||
for (AvailableConnectionModel model : connections) {
|
||||
DataSource ds = basicConnectionPool.getDataSource(model.getProfileName());
|
||||
if (ds != null) {
|
||||
targetDataSources.put(model.getProfileName(), ds);
|
||||
if (defaultDataSource == null) {
|
||||
defaultDataSource = ds;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.setTargetDataSources(targetDataSources);
|
||||
this.setDefaultTargetDataSource(defaultDataSource);
|
||||
super.afterPropertiesSet();
|
||||
}
|
||||
|
||||
// Metodo per ricaricare i datasource se vengono aggiunti nuovi tenant a runtime
|
||||
public void refreshDataSources() {
|
||||
this.afterPropertiesSet();
|
||||
}
|
||||
}
|
||||
|
||||
18
ems-core/src/main/java/it/integry/ems/jpa/TenantContext.java
Normal file
18
ems-core/src/main/java/it/integry/ems/jpa/TenantContext.java
Normal file
@@ -0,0 +1,18 @@
|
||||
package it.integry.ems.jpa;
|
||||
|
||||
public class TenantContext {
|
||||
private static final ThreadLocal<String> currentTenant = new ThreadLocal<>();
|
||||
|
||||
public static void setCurrentTenant(String tenant) {
|
||||
currentTenant.set(tenant);
|
||||
}
|
||||
|
||||
public static String getCurrentTenant() {
|
||||
return currentTenant.get();
|
||||
}
|
||||
|
||||
public static void clear() {
|
||||
currentTenant.remove();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
package it.integry.ems.jpa.entity;
|
||||
|
||||
import javax.persistence.MappedSuperclass;
|
||||
import java.io.Serializable;
|
||||
|
||||
@MappedSuperclass
|
||||
public abstract class BaseEntity implements Serializable {
|
||||
// Classe base per le entity JPA
|
||||
}
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
package it.integry.ems.jpa.repository;
|
||||
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.repository.NoRepositoryBean;
|
||||
|
||||
@NoRepositoryBean
|
||||
public interface BaseRepository<T, ID> extends JpaRepository<T, ID> {
|
||||
// Interfaccia base per i repository
|
||||
}
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
package it.integry.ems.jpa.repository;
|
||||
|
||||
import it.integry.ems_model.entity.MtbAart;
|
||||
import org.springframework.data.jpa.repository.EntityGraph;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
import org.springframework.data.repository.query.Param;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
@Repository
|
||||
public interface MtbAartRepository extends BaseRepository<MtbAart, String> {
|
||||
|
||||
Optional<MtbAart> findByCodMart(String codMart);
|
||||
|
||||
@EntityGraph(attributePaths = {"mtbUntMis"})
|
||||
Optional<MtbAart> findWithUntMisByCodMart(String codMart);
|
||||
|
||||
List<MtbAart> findByCodMartIn(List<String> codMarts);
|
||||
|
||||
@EntityGraph(attributePaths = {"mtbUntMis"})
|
||||
List<MtbAart> findWithUntMisByCodMartIn(List<String> codMarts);
|
||||
|
||||
@EntityGraph(attributePaths = {"mtbUntMis", "mtbAartBarCode"})
|
||||
List<MtbAart> findWithBarcodeWithUntMisByCodMartIn(List<String> codMarts);
|
||||
|
||||
@EntityGraph(attributePaths = {"mtbAartBarCode"})
|
||||
Optional<MtbAart> findWithBarcodeByCodMart(String codMart);
|
||||
|
||||
@Query("SELECT m FROM MtbAart m WHERE m.untMis = 'KG'")
|
||||
List<MtbAart> findByUntMisKG();
|
||||
|
||||
@Query("SELECT m.flagQtaCnfFissa FROM MtbAart m WHERE m.codMart = :codMart")
|
||||
Optional<String> findFlagQtaCnfFissaByCodMart(@Param("codMart") String codMart);
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package it.integry.ems.jpa.repository;
|
||||
|
||||
import it.integry.ems_model.entity.MtbUntMis;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
import org.springframework.data.repository.query.Param;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
public interface MtbUntMisRepository extends BaseRepository<MtbUntMis, String> {
|
||||
|
||||
Optional<MtbUntMis> findByUntMis(String untMis);
|
||||
|
||||
List<MtbUntMis> findByUntMisIn(List<String> untMis);
|
||||
|
||||
@Query("SELECT a.mtbUntMis FROM MtbAart a WHERE a.codMart = :codMart")
|
||||
Optional<MtbUntMis> findByCodMart(@Param("codMart") String codMart);
|
||||
|
||||
int countByUntMis(String untMis);
|
||||
|
||||
@Query("SELECT u.cifreDec FROM MtbUntMis u WHERE u.flagUnitaKg = :flagUnitaKg")
|
||||
List<BigDecimal> findCifreDecByFlagUnitaKg(@Param("flagUnitaKg") String flagUnitaKg);
|
||||
}
|
||||
@@ -4,7 +4,8 @@ import com.annimon.stream.ComparatorCompat;
|
||||
import com.annimon.stream.Stream;
|
||||
import it.integry.common.var.CommonConstants;
|
||||
import it.integry.ems._context.ApplicationContextProvider;
|
||||
import it.integry.ems.dynamic_cache.EntityCacheComponent;
|
||||
import it.integry.ems.jpa.repository.MtbAartRepository;
|
||||
import it.integry.ems.jpa.repository.MtbUntMisRepository;
|
||||
import it.integry.ems.json.ResponseJSONObjectMapper;
|
||||
import it.integry.ems.migration._base.IntegryCustomerDB;
|
||||
import it.integry.ems.sync.MultiDBTransaction.Connection;
|
||||
@@ -674,41 +675,46 @@ public class CommonRules extends QueryRules {
|
||||
public static String completeCodBarre(IntegryCustomerDB customerDB, Connection connection, String codMart)
|
||||
throws SQLException {
|
||||
|
||||
final EntityCacheComponent entityCacheComponent = ApplicationContextProvider.getApplicationContext().getBean(EntityCacheComponent.class);
|
||||
|
||||
final MtbAartRepository mtbAartRepository = ApplicationContextProvider.getApplicationContext().getBean(MtbAartRepository.class);
|
||||
|
||||
List<HashMap<String, Object>> result = new ArrayList<>();
|
||||
|
||||
entityCacheComponent.<MtbAart>getCachedEntitiesStream(customerDB, MtbAart.ENTITY,
|
||||
x -> x.getCodMart().equalsIgnoreCase(codMart) && !UtilityString.isNullOrEmpty(x.getBarCode()))
|
||||
.forEach(x -> result.add(new HashMap<String, Object>() {{
|
||||
put("cod_mart", x.getCodMart());
|
||||
put("cod_barre", x.getBarCode());
|
||||
Optional<MtbAart> optMtbAart = mtbAartRepository.findWithBarcodeByCodMart(codMart);
|
||||
|
||||
if (optMtbAart.isPresent()) {
|
||||
MtbAart mtbAart = optMtbAart.get();
|
||||
|
||||
if (!UtilityString.isNullOrEmpty(mtbAart.getBarCode())) {
|
||||
result.add(new HashMap<String, Object>() {{
|
||||
put("cod_mart", mtbAart.getCodMart());
|
||||
put("cod_barre", mtbAart.getBarCode());
|
||||
put("cod_col", null);
|
||||
put("cod_tagl", null);
|
||||
put("qta_cnf", BigDecimal.ONE);
|
||||
}}));
|
||||
}});
|
||||
}
|
||||
|
||||
entityCacheComponent.<MtbAart>getCachedEntitiesStream(customerDB, MtbAart.ENTITY,
|
||||
x -> x.getCodMart().equalsIgnoreCase(codMart) && !UtilityString.isNullOrEmpty(x.getCodBarreImb()))
|
||||
.forEach(x -> result.add(new HashMap<String, Object>() {{
|
||||
put("cod_mart", x.getCodMart());
|
||||
put("cod_barre", x.getCodBarreImb());
|
||||
if (!UtilityString.isNullOrEmpty(mtbAart.getCodBarreImb())) {
|
||||
result.add(new HashMap<String, Object>() {{
|
||||
put("cod_mart", mtbAart.getCodMart());
|
||||
put("cod_barre", mtbAart.getCodBarreImb());
|
||||
put("cod_col", null);
|
||||
put("cod_tagl", null);
|
||||
put("qta_cnf", x.getQtaCnf());
|
||||
}}));
|
||||
|
||||
entityCacheComponent.<MtbAartBarCode>getCachedEntitiesStream(customerDB, MtbAartBarCode.ENTITY,
|
||||
x -> x.getCodMart().equalsIgnoreCase(codMart))
|
||||
.forEach(x -> result.add(new HashMap<String, Object>() {{
|
||||
put("cod_mart", x.getCodMart());
|
||||
put("cod_barre", x.getCodBarre());
|
||||
put("cod_col", null);
|
||||
put("cod_tagl", null);
|
||||
put("qta_cnf", x.getQtaCnf());
|
||||
}}));
|
||||
put("qta_cnf", mtbAart.getQtaCnf());
|
||||
}});
|
||||
}
|
||||
|
||||
if (mtbAart.getMtbAartBarCode() != null) {
|
||||
mtbAart.getMtbAartBarCode()
|
||||
.forEach(x -> result.add(new HashMap<String, Object>() {{
|
||||
put("cod_mart", x.getCodMart());
|
||||
put("cod_barre", x.getCodBarre());
|
||||
put("cod_col", null);
|
||||
put("cod_tagl", null);
|
||||
put("qta_cnf", x.getQtaCnf());
|
||||
}}));
|
||||
}
|
||||
}
|
||||
|
||||
String barcode = null;
|
||||
|
||||
@@ -728,14 +734,12 @@ public class CommonRules extends QueryRules {
|
||||
}
|
||||
|
||||
public static String completeFlagQtaCnfFissa(Connection connection, IntegryCustomerDB customerDB, String codMart) {
|
||||
final EntityCacheComponent entityCacheComponent = ApplicationContextProvider.getApplicationContext().getBean(EntityCacheComponent.class);
|
||||
final MtbAartRepository mtbAartRepository = ApplicationContextProvider.getApplicationContext().getBean(MtbAartRepository.class);
|
||||
|
||||
final List<MtbAart> cachedMtbAarts = entityCacheComponent.getCachedEntitiesList(customerDB, MtbAart.ENTITY, x -> x.getCodMart().equalsIgnoreCase(codMart));
|
||||
final String flagQtaCnfFissaArt = mtbAartRepository.findFlagQtaCnfFissaByCodMart(codMart)
|
||||
.orElse(null);
|
||||
|
||||
if (cachedMtbAarts == null || cachedMtbAarts.isEmpty())
|
||||
return null;
|
||||
|
||||
return cachedMtbAarts.get(0).getFlagQtaCnfFissa();
|
||||
return flagQtaCnfFissaArt;
|
||||
}
|
||||
|
||||
public static String getApplicationName(Connection connection) throws Exception {
|
||||
@@ -1092,6 +1096,8 @@ public class CommonRules extends QueryRules {
|
||||
}
|
||||
|
||||
public static List<MtbUntMis> insUntMis(Connection conn, MtbAart mtbAart) throws Exception {
|
||||
MtbUntMisRepository mtbUntMisRepository = ApplicationContextProvider.getApplicationContext().getBean(MtbUntMisRepository.class);
|
||||
|
||||
List<MtbUntMis> mtbUntMisList = new ArrayList<>();
|
||||
List<String> untMisList = new ArrayList<>();
|
||||
|
||||
@@ -1106,8 +1112,7 @@ public class CommonRules extends QueryRules {
|
||||
}
|
||||
|
||||
for (String untMis : untMisList) {
|
||||
String sql = "SELECT count(*) FROM mtb_unt_mis WHERE unt_mis = " + UtilityDB.valueToString(untMis);
|
||||
Integer countUM = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(conn, sql);
|
||||
Integer countUM = mtbUntMisRepository.countByUntMis(untMis);
|
||||
if (countUM == null || countUM == 0) {
|
||||
MtbUntMis mtbUntMis = new MtbUntMis();
|
||||
mtbUntMis.setUntMis(untMis);
|
||||
@@ -1378,12 +1383,12 @@ public class CommonRules extends QueryRules {
|
||||
public static boolean getChkCompatibilitaCarat(Connection connection, String codMart, String carat) throws SQLException {
|
||||
String sql =
|
||||
Query.format("SELECT chk_compatibilita\n" +
|
||||
"FROM mtb_aart\n" +
|
||||
" INNER JOIN mtb_tipi_carat ON mtb_aart.cod_mtip = mtb_tipi_carat.cod_mtip AND\n" +
|
||||
" mtb_aart.cod_mstp = mtb_tipi_carat.cod_mstp\n" +
|
||||
"WHERE mtb_aart.cod_mart = %s\n" +
|
||||
" AND mtb_tipi_carat.carat = %s\n" ,
|
||||
codMart, carat);
|
||||
"FROM mtb_aart\n" +
|
||||
" INNER JOIN mtb_tipi_carat ON mtb_aart.cod_mtip = mtb_tipi_carat.cod_mtip AND\n" +
|
||||
" mtb_aart.cod_mstp = mtb_tipi_carat.cod_mstp\n" +
|
||||
"WHERE mtb_aart.cod_mart = %s\n" +
|
||||
" AND mtb_tipi_carat.carat = %s\n",
|
||||
codMart, carat);
|
||||
|
||||
Boolean chkCompatibilita = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(connection, sql);
|
||||
if (chkCompatibilita == null) chkCompatibilita = false;
|
||||
|
||||
@@ -2,7 +2,8 @@ package it.integry.ems.rules.completing;
|
||||
|
||||
import com.annimon.stream.Stream;
|
||||
import it.integry.ems._context.ApplicationContextProvider;
|
||||
import it.integry.ems.dynamic_cache.EntityCacheComponent;
|
||||
import it.integry.ems.jpa.repository.MtbAartRepository;
|
||||
import it.integry.ems.jpa.repository.MtbUntMisRepository;
|
||||
import it.integry.ems.migration._base.IntegryCustomerDB;
|
||||
import it.integry.ems.rules.completing.dto.DatiPartitaMagDTO;
|
||||
import it.integry.ems.sync.MultiDBTransaction.Connection;
|
||||
@@ -333,16 +334,14 @@ public class PackagesRules extends QueryRules {
|
||||
|
||||
public static HashMap<String, Object> calcPeso(IntegryCustomerDB customerDB, Connection conn, MtbColr entity) throws Exception {
|
||||
|
||||
final EntityCacheComponent entityCacheComponent = ApplicationContextProvider.getApplicationContext().getBean(EntityCacheComponent.class);
|
||||
final MtbAartRepository mtbAartRepository = ApplicationContextProvider.getApplicationContext().getBean(MtbAartRepository.class);
|
||||
final MtbUntMisRepository mtbUntMisRepository = ApplicationContextProvider.getApplicationContext().getBean(MtbUntMisRepository.class);
|
||||
|
||||
BigDecimal cifreDec = entityCacheComponent.<MtbUntMis>getCachedEntitiesStream(customerDB, MtbUntMis.ENTITY,
|
||||
x -> x.getFlagUnitaKg().equalsIgnoreCase("S"))
|
||||
.map(MtbUntMis::getCifreDec)
|
||||
BigDecimal cifreDec = mtbUntMisRepository.findCifreDecByFlagUnitaKg("S").stream()
|
||||
.findFirst()
|
||||
.orElse(BigDecimal.valueOf(5));
|
||||
|
||||
HashMap<String, Object> anagArt = entityCacheComponent.<MtbAart>getCachedEntitiesStream(customerDB, MtbAart.ENTITY,
|
||||
x -> x.getCodMart().equalsIgnoreCase(entity.getCodMart()))
|
||||
HashMap<String, Object> anagArt = mtbAartRepository.findByCodMart(entity.getCodMart())
|
||||
.map(x -> new HashMap<String, Object>() {{
|
||||
put("unt_mis", x.getUntMis());
|
||||
put("tara_kg", x.getTaraKg());
|
||||
@@ -350,7 +349,6 @@ public class PackagesRules extends QueryRules {
|
||||
put("flag_peso_egalizzato", x.getFlagPesoEgalizzato());
|
||||
put("peso_egalizzato", x.getFlagPesoEgalizzato() ? x.getQtaCnf().multiply(x.getPesoKg()) : null);
|
||||
}})
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
|
||||
|
||||
@@ -365,10 +363,8 @@ public class PackagesRules extends QueryRules {
|
||||
|
||||
BigDecimal pesoNetto = BigDecimal.ZERO, pesoLordo = BigDecimal.ZERO;
|
||||
if (anagArt != null) {
|
||||
String flagUnitaKg = entityCacheComponent.<MtbUntMis>getCachedEntitiesStream(customerDB, MtbUntMis.ENTITY,
|
||||
x -> x.getUntMis().equalsIgnoreCase(String.valueOf(anagArt.get("unt_mis"))))
|
||||
String flagUnitaKg = mtbUntMisRepository.findByUntMis((String) anagArt.get("unt_mis"))
|
||||
.map(MtbUntMis::getFlagUnitaKg)
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
|
||||
BigDecimal taraKg = (BigDecimal) anagArt.get("tara_kg");
|
||||
|
||||
@@ -109,6 +109,20 @@ public class BasicConnectionPool {
|
||||
}
|
||||
}
|
||||
|
||||
public javax.sql.DataSource getDataSource(String profileName) {
|
||||
AvailableConnectionModel model = settingsModel.findConnectionModel(profileName);
|
||||
if (model == null) {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
registerDataSourceIfNotExists(model);
|
||||
return registeredDatasources.get(model);
|
||||
} catch (Exception e) {
|
||||
logger.error("Error retrieving DataSource for profile: " + profileName, e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void registerDataSourceIfNotExists(AvailableConnectionModel connectionModel) throws Exception {
|
||||
if (!registeredDatasources.containsKey(connectionModel)) {
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
package it.integry.ems.utility.entity;
|
||||
|
||||
import it.integry.ems._context.ApplicationContextProvider;
|
||||
import it.integry.ems.dynamic_cache.EntityCacheComponent;
|
||||
import it.integry.ems.sync.MultiDBTransaction.Connection;
|
||||
import it.integry.ems_model.entity.MtbAartBarCode;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class MtbAartBarcodeUtils {
|
||||
|
||||
|
||||
public static final List<MtbAartBarCode> getAlternativeMtbAartBarCodes(List<String> codMarts, Connection conn) {
|
||||
codMarts = codMarts.stream()
|
||||
.distinct().collect(Collectors.toList());
|
||||
|
||||
final EntityCacheComponent entityCacheComponent = ApplicationContextProvider.getApplicationContext().getBean(EntityCacheComponent.class);
|
||||
|
||||
List<String> finalCodMarts = codMarts;
|
||||
List<MtbAartBarCode> barCodeList = entityCacheComponent.getCachedEntitiesList(
|
||||
conn.getIntegryCustomerDB(),
|
||||
MtbAartBarCode.ENTITY,
|
||||
x -> finalCodMarts.stream().anyMatch(y -> y.equalsIgnoreCase(x.getCodMart())));
|
||||
|
||||
return barCodeList != null ? barCodeList : new ArrayList<>();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,82 +0,0 @@
|
||||
package it.integry.ems.utility.entity;
|
||||
|
||||
import com.annimon.stream.Optional;
|
||||
import com.annimon.stream.Stream;
|
||||
import it.integry.ems._context.ApplicationContextProvider;
|
||||
import it.integry.ems.dynamic_cache.EntityCacheComponent;
|
||||
import it.integry.ems.sync.MultiDBTransaction.Connection;
|
||||
import it.integry.ems_model.entity.MtbAart;
|
||||
import it.integry.ems_model.entity.MtbAartBarCode;
|
||||
import it.integry.ems_model.entity.MtbUntMis;
|
||||
import it.integry.ems_model.utility.UtilityString;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class MtbAartUtils {
|
||||
|
||||
public static MtbAart getArticoloByCodMart(String codMart, Connection connection) throws Exception {
|
||||
if (UtilityString.isNullOrEmpty(codMart))
|
||||
return null;
|
||||
|
||||
List<MtbAart> mtbAarts = getArticoliByCodMarts(new ArrayList<>(Collections.singleton(codMart)), connection);
|
||||
if (mtbAarts == null || mtbAarts.isEmpty())
|
||||
return null;
|
||||
|
||||
return mtbAarts.get(0);
|
||||
}
|
||||
|
||||
public static List<MtbAart> getArticoliByCodMarts(List<String> codMarts, Connection connection) throws Exception {
|
||||
if (codMarts == null || codMarts.isEmpty()) return null;
|
||||
|
||||
codMarts.replaceAll(String::toUpperCase);
|
||||
|
||||
final EntityCacheComponent entityCacheComponent = ApplicationContextProvider.getApplicationContext().getBean(EntityCacheComponent.class);
|
||||
|
||||
List<MtbAart> listMtbAart = entityCacheComponent.getCachedEntitiesList(
|
||||
connection.getIntegryCustomerDB(), MtbAart.ENTITY, x -> codMarts.contains(x.getCodMart().toUpperCase()));
|
||||
|
||||
List<MtbAartBarCode> barCodeFromCod = MtbAartBarcodeUtils.getAlternativeMtbAartBarCodes(codMarts, connection);
|
||||
|
||||
if (listMtbAart != null && !listMtbAart.isEmpty()) {
|
||||
List<String> untMisStrings = listMtbAart.stream()
|
||||
.map(MtbAart::getUntMis)
|
||||
.collect(Collectors.toList());
|
||||
List<MtbUntMis> listUntMis = MtbUntMisUtils.getFromCods(untMisStrings, connection);
|
||||
|
||||
for (final MtbAart mtbAart : listMtbAart) {
|
||||
Optional<MtbUntMis> mtbUntMis = Stream.of(listUntMis)
|
||||
.filter(mtbUntMis1 -> mtbUntMis1.getUntMis().equalsIgnoreCase(mtbAart.getUntMis()))
|
||||
.findFirst();
|
||||
|
||||
List<MtbAartBarCode> barcodeList = Stream.of(barCodeFromCod)
|
||||
.filter(x -> x.getCodMart().equalsIgnoreCase(mtbAart.getCodMart()))
|
||||
.toList();
|
||||
|
||||
if (!barcodeList.isEmpty()) {
|
||||
mtbAart.getMtbAartBarCode().addAll(barcodeList);
|
||||
}
|
||||
|
||||
if (mtbUntMis.isPresent()) {
|
||||
mtbAart.setMtbUntMis(new ArrayList<>());
|
||||
mtbAart.getMtbUntMis().add(mtbUntMis.get());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return listMtbAart;
|
||||
}
|
||||
|
||||
public static final HashMap<String, MtbAart> getArticoliByCodMartsAsMap(List<String> codMarts, Connection connection) throws Exception {
|
||||
List<MtbAart> mtbAarts = getArticoliByCodMarts(codMarts, connection);
|
||||
if (mtbAarts == null || mtbAarts.isEmpty()) return new HashMap<>();
|
||||
|
||||
return mtbAarts.stream()
|
||||
.collect(Collectors.toMap(MtbAart::getCodMart, a -> a, (a, b) -> a, HashMap::new));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,56 +0,0 @@
|
||||
package it.integry.ems.utility.entity;
|
||||
|
||||
import it.integry.ems._context.ApplicationContextProvider;
|
||||
import it.integry.ems.dynamic_cache.EntityCacheComponent;
|
||||
import it.integry.ems.migration._base.IntegryCustomerDB;
|
||||
import it.integry.ems.sync.MultiDBTransaction.Connection;
|
||||
import it.integry.ems_model.entity.MtbAart;
|
||||
import it.integry.ems_model.entity.MtbUntMis;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class MtbUntMisUtils {
|
||||
|
||||
public static final MtbUntMis getMtbUntMisFromCodMart(IntegryCustomerDB customerDB, String codMart) throws SQLException {
|
||||
final EntityCacheComponent entityCacheComponent = ApplicationContextProvider.getApplicationContext().getBean(EntityCacheComponent.class);
|
||||
|
||||
MtbAart mtbAart = entityCacheComponent.<MtbAart>getCachedEntitiesStream(customerDB, MtbAart.ENTITY,
|
||||
x -> x.getCodMart().equalsIgnoreCase(codMart))
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
|
||||
if (mtbAart != null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
final MtbUntMis mtbUntMis = entityCacheComponent.<MtbUntMis>getCachedEntitiesStream(customerDB, MtbUntMis.ENTITY,
|
||||
x -> x.getUntMis().equalsIgnoreCase(mtbAart.getUntMis()))
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
|
||||
return mtbUntMis;
|
||||
}
|
||||
|
||||
|
||||
public static List<MtbUntMis> getFromCods(List<String> untMisCods, Connection connection) {
|
||||
List<String> untMisStrings = untMisCods.stream()
|
||||
.filter(Objects::nonNull)
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
|
||||
final EntityCacheComponent entityCacheComponent = ApplicationContextProvider.getApplicationContext().getBean(EntityCacheComponent.class);
|
||||
|
||||
List<MtbUntMis> mtbUntMis = entityCacheComponent.getCachedEntitiesList(
|
||||
connection.getIntegryCustomerDB(),
|
||||
MtbUntMis.ENTITY,
|
||||
x -> untMisCods.contains(x.getUntMis()));
|
||||
|
||||
return mtbUntMis != null ? mtbUntMis : new ArrayList<>();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -12,14 +12,16 @@ import it.integry.ems_model.utility.UtilityDB;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.kie.api.definition.type.PropertyReactive;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import javax.persistence.Transient;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
@javax.persistence.Entity
|
||||
@javax.persistence.Table(name = MtbAart.ENTITY)
|
||||
@Master
|
||||
@PropertyReactive
|
||||
@Table(MtbAart.ENTITY)
|
||||
@@ -32,344 +34,462 @@ public class MtbAart extends EntityBase implements EquatableEntityInterface<MtbA
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@javax.persistence.Id
|
||||
@javax.persistence.Column(name = "cod_mart")
|
||||
@PK
|
||||
@SqlField(value = "cod_mart", maxLength = 15, nullable = false)
|
||||
private String codMart;
|
||||
|
||||
@javax.persistence.Column(name = "descrizione")
|
||||
@SqlField(value = "descrizione", maxLength = 40, nullable = false)
|
||||
private String descrizione;
|
||||
|
||||
@javax.persistence.Column(name = "unt_mis")
|
||||
@FK(tableName = "mtb_unt_mis", columnName = "unt_mis")
|
||||
@SqlField(value = "unt_mis", maxLength = 3, nullable = false)
|
||||
private String untMis;
|
||||
|
||||
@javax.persistence.Column(name = "bar_code")
|
||||
@SqlField(value = "bar_code", maxLength = 40)
|
||||
private String barCode;
|
||||
|
||||
@javax.persistence.Column(name = "peso_kg")
|
||||
@SqlField(value = "peso_kg", nullable = false, defaultObjectValue = "0")
|
||||
private BigDecimal pesoKg;
|
||||
|
||||
@javax.persistence.Column(name = "qta_cnf")
|
||||
@SqlField(value = "qta_cnf", nullable = false, defaultObjectValue = "1")
|
||||
private BigDecimal qtaCnf;
|
||||
|
||||
@javax.persistence.Column(name = "cod_aliq")
|
||||
@SqlField(value = "cod_aliq", maxLength = 5)
|
||||
private String codAliq;
|
||||
|
||||
@javax.persistence.Column(name = "cod_sco_art")
|
||||
@SqlField(value = "cod_sco_art", maxLength = 5)
|
||||
private String codScoArt;
|
||||
|
||||
@javax.persistence.Column(name = "cod_tcol_ui")
|
||||
@SqlField(value = "cod_tcol_ui")
|
||||
private String codTcolUi;
|
||||
|
||||
@javax.persistence.Column(name = "cod_tcol_ul")
|
||||
@SqlField(value = "cod_tcol_ul")
|
||||
private String codTcolUl;
|
||||
|
||||
@javax.persistence.Column(name = "articolo_composto")
|
||||
@SqlField(value = "articolo_composto", maxLength = 1, nullable = false, defaultObjectValue = "N")
|
||||
private String articoloComposto;
|
||||
|
||||
@javax.persistence.Column(name = "esposizione_comp")
|
||||
@SqlField(value = "esposizione_comp", maxLength = 1, nullable = false, defaultObjectValue = "N")
|
||||
private String esposizioneComp;
|
||||
|
||||
@javax.persistence.Column(name = "descrizione_estesa")
|
||||
@SqlField(value = "descrizione_estesa", maxLength = 4096)
|
||||
private String descrizioneEstesa;
|
||||
|
||||
@javax.persistence.Column(name = "cod_ult_forn")
|
||||
@SqlField(value = "cod_ult_forn", maxLength = 5)
|
||||
private String codUltForn;
|
||||
|
||||
@javax.persistence.Column(name = "data_ult_car")
|
||||
@SqlField(value = "data_ult_car")
|
||||
private Date dataUltCar;
|
||||
|
||||
@javax.persistence.Column(name = "val_ult_car")
|
||||
@SqlField(value = "val_ult_car")
|
||||
private BigDecimal valUltCar;
|
||||
|
||||
@javax.persistence.Column(name = "cod_ult_clie")
|
||||
@SqlField(value = "cod_ult_clie", maxLength = 5)
|
||||
private String codUltClie;
|
||||
|
||||
@javax.persistence.Column(name = "data_ult_scar")
|
||||
@SqlField(value = "data_ult_scar")
|
||||
private Date dataUltScar;
|
||||
|
||||
@javax.persistence.Column(name = "val_ult_scar")
|
||||
@SqlField(value = "val_ult_scar")
|
||||
private BigDecimal valUltScar;
|
||||
|
||||
@javax.persistence.Column(name = "tipo_codice")
|
||||
@SqlField(value = "tipo_codice", maxLength = 10)
|
||||
private String tipoCodice;
|
||||
|
||||
@javax.persistence.Column(name = "note")
|
||||
@SqlField(value = "note", maxLength = 255)
|
||||
private String note;
|
||||
|
||||
@javax.persistence.Column(name = "posizione")
|
||||
@SqlField(value = "posizione", maxLength = 15)
|
||||
private String posizione;
|
||||
|
||||
@javax.persistence.Column(name = "colli_pedana")
|
||||
@SqlField(value = "colli_pedana", defaultObjectValue = "1")
|
||||
private BigDecimal colliPedana;
|
||||
|
||||
@javax.persistence.Column(name = "unt_mis2")
|
||||
@FK(tableName = "mtb_unt_mis", columnName = "unt_mis")
|
||||
@SqlField(value = "unt_mis2", maxLength = 3)
|
||||
private String untMis2;
|
||||
|
||||
@javax.persistence.Column(name = "rap_conv2")
|
||||
@SqlField(value = "rap_conv2", defaultObjectValue = "1")
|
||||
private BigDecimal rapConv2;
|
||||
|
||||
@javax.persistence.Column(name = "flag_incl_listino")
|
||||
@SqlField(value = "flag_incl_listino", maxLength = 1, nullable = false, defaultObjectValue = "S")
|
||||
private String flagInclListino;
|
||||
|
||||
@javax.persistence.Column(name = "unt_mis3")
|
||||
@FK(tableName = "mtb_unt_mis", columnName = "unt_mis")
|
||||
@SqlField(value = "unt_mis3", maxLength = 3)
|
||||
private String untMis3;
|
||||
|
||||
@javax.persistence.Column(name = "rap_conv3")
|
||||
@SqlField(value = "rap_conv3", defaultObjectValue = "1")
|
||||
private BigDecimal rapConv3;
|
||||
|
||||
@javax.persistence.Column(name = "cod_mart_stat")
|
||||
@SqlField(value = "cod_mart_stat", maxLength = 15)
|
||||
private String codMartStat;
|
||||
|
||||
@javax.persistence.Column(name = "cod_mcon")
|
||||
@SqlField(value = "cod_mcon", maxLength = 5)
|
||||
private String codMcon;
|
||||
|
||||
@javax.persistence.Column(name = "cod_mgrp")
|
||||
@SqlField(value = "cod_mgrp", maxLength = 5, nullable = false)
|
||||
private String codMgrp;
|
||||
|
||||
@javax.persistence.Column(name = "cod_msfa")
|
||||
@SqlField(value = "cod_msfa", maxLength = 6)
|
||||
private String codMsfa;
|
||||
|
||||
@javax.persistence.Column(name = "cod_msgr")
|
||||
@SqlField(value = "cod_msgr", maxLength = 5, nullable = false)
|
||||
private String codMsgr;
|
||||
|
||||
@javax.persistence.Column(name = "cod_mstp")
|
||||
@SqlField(value = "cod_mstp", maxLength = 5)
|
||||
private String codMstp;
|
||||
|
||||
@javax.persistence.Column(name = "cod_mtip")
|
||||
@SqlField(value = "cod_mtip", maxLength = 5)
|
||||
private String codMtip;
|
||||
|
||||
@javax.persistence.Column(name = "descrizione_stat")
|
||||
@SqlField(value = "descrizione_stat", maxLength = 40)
|
||||
private String descrizioneStat;
|
||||
|
||||
@javax.persistence.Column(name = "flag_stato")
|
||||
@SqlField(value = "flag_stato", maxLength = 1, nullable = false, defaultObjectValue = "A")
|
||||
private String flagStato;
|
||||
|
||||
@javax.persistence.Column(name = "cambio_divi_car")
|
||||
@SqlField(value = "cambio_divi_car", nullable = false)
|
||||
private BigDecimal cambioDiviCar;
|
||||
|
||||
@javax.persistence.Column(name = "cambio_divi_scar")
|
||||
@SqlField(value = "cambio_divi_scar", nullable = false)
|
||||
private BigDecimal cambioDiviScar;
|
||||
|
||||
@javax.persistence.Column(name = "gg_scad_partita")
|
||||
@SqlField(value = "gg_scad_partita", nullable = false, defaultObjectValue = "0")
|
||||
private Integer ggScadPartita;
|
||||
|
||||
@javax.persistence.Column(name = "volume_mc")
|
||||
@SqlField(value = "volume_mc", defaultObjectValue = "0")
|
||||
private BigDecimal volumeMc;
|
||||
|
||||
@javax.persistence.Column(name = "flag_esponi_prz")
|
||||
@SqlField(value = "flag_esponi_prz", maxLength = 1, nullable = false, defaultObjectValue = "N")
|
||||
private String flagEsponiPrz;
|
||||
|
||||
@javax.persistence.Column(name = "data_ult_var")
|
||||
@SqlField(value = "data_ult_var", format = CommonConstants.SYSDATE)
|
||||
private Date dataUltVar;
|
||||
|
||||
@javax.persistence.Column(name = "perc_sfrido")
|
||||
@SqlField(value = "perc_sfrido", nullable = false, defaultObjectValue = "0")
|
||||
private BigDecimal percSfrido;
|
||||
|
||||
@javax.persistence.Column(name = "cod_barre_imb")
|
||||
@SqlField(value = "cod_barre_imb", maxLength = 40)
|
||||
private String codBarreImb;
|
||||
|
||||
@javax.persistence.Column(name = "flag_calc_prz")
|
||||
@SqlField(value = "flag_calc_prz", maxLength = 1, nullable = false, defaultObjectValue = "K")
|
||||
private String flagCalcPrz;
|
||||
|
||||
@javax.persistence.Column(name = "esposizione_comp_acq")
|
||||
@SqlField(value = "esposizione_comp_acq", maxLength = 1, nullable = false, defaultObjectValue = "N")
|
||||
private String esposizioneCompAcq;
|
||||
|
||||
@javax.persistence.Column(name = "flag_calc_prz_acq")
|
||||
@SqlField(value = "flag_calc_prz_acq", maxLength = 1, nullable = false, defaultObjectValue = "K")
|
||||
private String flagCalcPrzAcq;
|
||||
|
||||
@javax.persistence.Column(name = "diacod")
|
||||
@SqlField(value = "diacod", maxLength = 40)
|
||||
private String diacod;
|
||||
|
||||
@javax.persistence.Column(name = "plu")
|
||||
@SqlField(value = "plu", maxLength = 6)
|
||||
private String plu;
|
||||
|
||||
@javax.persistence.Column(name = "part_iva_prod")
|
||||
@SqlField(value = "part_iva_prod", maxLength = 20)
|
||||
private String partIvaProd;
|
||||
|
||||
@javax.persistence.Column(name = "rag_soc_prod")
|
||||
@SqlField(value = "rag_soc_prod", maxLength = 40)
|
||||
private String ragSocProd;
|
||||
|
||||
@javax.persistence.Column(name = "flag_rap_conv_variabile")
|
||||
@SqlField(value = "flag_rap_conv_variabile", maxLength = 1, nullable = false, defaultObjectValue = "N")
|
||||
private String flagRapConvVariabile;
|
||||
|
||||
@javax.persistence.Column(name = "flag_mov_art_mag")
|
||||
@SqlField(value = "flag_mov_art_mag", maxLength = 1, nullable = false, defaultObjectValue = "S")
|
||||
private String flagMovArtMag;
|
||||
|
||||
@javax.persistence.Column(name = "flag_tracciabilita")
|
||||
@SqlField(value = "flag_tracciabilita", maxLength = 1, nullable = false, defaultObjectValue = "N")
|
||||
private String flagTracciabilita;
|
||||
|
||||
@javax.persistence.Column(name = "tara_kg")
|
||||
@SqlField(value = "tara_kg", defaultObjectValue = "0")
|
||||
private BigDecimal taraKg;
|
||||
|
||||
@javax.persistence.Column(name = "colli_strato")
|
||||
@SqlField(value = "colli_strato", nullable = false, defaultObjectValue = "1")
|
||||
private BigDecimal colliStrato;
|
||||
|
||||
@javax.persistence.Column(name = "flag_qta_cnf_fissa")
|
||||
@SqlField(value = "flag_qta_cnf_fissa", maxLength = 1, nullable = false, defaultObjectValue = "S")
|
||||
private String flagQtaCnfFissa;
|
||||
|
||||
@javax.persistence.Column(name = "flag_colli_pedana_fisso")
|
||||
@SqlField(value = "flag_colli_pedana_fisso", maxLength = 1, nullable = false, defaultObjectValue = "S")
|
||||
private String flagColliPedanaFisso;
|
||||
|
||||
@javax.persistence.Column(name = "cod_ccon_costi")
|
||||
@SqlField(value = "cod_ccon_costi", maxLength = 6)
|
||||
private String codCconCosti;
|
||||
|
||||
@javax.persistence.Column(name = "cod_ccon_ricavi")
|
||||
@SqlField(value = "cod_ccon_ricavi", maxLength = 6)
|
||||
private String codCconRicavi;
|
||||
|
||||
@javax.persistence.Column(name = "cod_dgrp_art")
|
||||
@SqlField(value = "cod_dgrp_art", maxLength = 5)
|
||||
private String codDgrpArt;
|
||||
|
||||
@javax.persistence.Column(name = "cod_divi_car")
|
||||
@SqlField(value = "cod_divi_car", maxLength = 5, nullable = false)
|
||||
private String codDiviCar;
|
||||
|
||||
@javax.persistence.Column(name = "cod_divi_scar")
|
||||
@SqlField(value = "cod_divi_scar", maxLength = 5, nullable = false)
|
||||
private String codDiviScar;
|
||||
|
||||
@javax.persistence.Column(name = "cod_ecr_cat")
|
||||
@SqlField(value = "cod_ecr_cat", maxLength = 10)
|
||||
private String codEcrCat;
|
||||
|
||||
@javax.persistence.Column(name = "cod_ecr_mcat")
|
||||
@SqlField(value = "cod_ecr_mcat", maxLength = 10)
|
||||
private String codEcrMcat;
|
||||
|
||||
@javax.persistence.Column(name = "cod_ecr_rep")
|
||||
@SqlField(value = "cod_ecr_rep", maxLength = 10)
|
||||
private String codEcrRep;
|
||||
|
||||
@javax.persistence.Column(name = "cod_ecr_stipo")
|
||||
@SqlField(value = "cod_ecr_stipo", maxLength = 10)
|
||||
private String codEcrStipo;
|
||||
|
||||
@javax.persistence.Column(name = "cod_ecr_tipo")
|
||||
@SqlField(value = "cod_ecr_tipo", maxLength = 10)
|
||||
private String codEcrTipo;
|
||||
|
||||
@javax.persistence.Column(name = "cod_grp_bolla")
|
||||
@SqlField(value = "cod_grp_bolla", maxLength = 5)
|
||||
private String codGrpBolla;
|
||||
|
||||
@javax.persistence.Column(name = "ingredienti")
|
||||
@SqlField(value = "ingredienti", maxLength = 8000)
|
||||
private String ingredienti;
|
||||
|
||||
@javax.persistence.Column(name = "id_art_equi")
|
||||
@SqlField(value = "id_art_equi", maxLength = 25)
|
||||
private String idArtEqui;
|
||||
|
||||
@javax.persistence.Column(name = "descr_cassa")
|
||||
@SqlField(value = "descr_cassa", maxLength = 40)
|
||||
private String descrCassa;
|
||||
|
||||
@javax.persistence.Column(name = "cod_nc_intracee")
|
||||
@SqlField(value = "cod_nc_intracee", maxLength = 20)
|
||||
private String codNcIntracee;
|
||||
|
||||
@javax.persistence.Column(name = "marchio")
|
||||
@SqlField(value = "marchio", maxLength = 255)
|
||||
private String marchio;
|
||||
|
||||
@javax.persistence.Column(name = "sezione")
|
||||
@SqlField(value = "sezione")
|
||||
private Integer sezione;
|
||||
|
||||
@javax.persistence.Column(name = "tipo_reg")
|
||||
@SqlField(value = "tipo_reg", maxLength = 1)
|
||||
private String tipoReg;
|
||||
|
||||
@javax.persistence.Column(name = "tipo_stock")
|
||||
@SqlField(value = "tipo_stock", maxLength = 1)
|
||||
private String tipoStock;
|
||||
|
||||
@javax.persistence.Column(name = "qta_multipla_ord")
|
||||
@SqlField(value = "qta_multipla_ord")
|
||||
private BigDecimal qtaMultiplaOrd;
|
||||
|
||||
@MapToTable(value = "flag_kit")
|
||||
@Transient
|
||||
private String flagKit;
|
||||
|
||||
@javax.persistence.Column(name = "cod_forn_cv")
|
||||
@SqlField(value = "cod_forn_cv", maxLength = 5)
|
||||
private String codFornCv;
|
||||
|
||||
@javax.persistence.Column(name = "cpa")
|
||||
@SqlField(value = "cpa", maxLength = 5)
|
||||
private String cpa;
|
||||
|
||||
@javax.persistence.Column(name = "taric")
|
||||
@SqlField(value = "taric", maxLength = 5)
|
||||
private String taric;
|
||||
|
||||
@javax.persistence.Column(name = "sezione_dogana")
|
||||
@SqlField(value = "sezione_dogana", maxLength = 6)
|
||||
private String sezioneDogana;
|
||||
|
||||
@javax.persistence.Column(name = "flag_peso_egalizzato")
|
||||
@SqlField(value = "flag_peso_egalizzato", nullable = false, defaultObjectValue = "0")
|
||||
private Boolean flagPesoEgalizzato;
|
||||
|
||||
@javax.persistence.Column(name = "cod_jfas_costi")
|
||||
@SqlField(value = "cod_jfas_costi", maxLength = 5)
|
||||
private String codJfasCosti;
|
||||
|
||||
@javax.persistence.Column(name = "cod_jfas_ricavi")
|
||||
@SqlField(value = "cod_jfas_ricavi", maxLength = 5)
|
||||
private String codJfasRicavi;
|
||||
|
||||
@Transient
|
||||
private String mtbAartEqui_descrizione;
|
||||
|
||||
@javax.persistence.Column(name = "flag_arr_prz_vend_iva")
|
||||
@SqlField(value = "flag_arr_prz_vend_iva", nullable = false, defaultObjectValue = "1")
|
||||
private Boolean flagArrPrzVendIva;
|
||||
|
||||
@javax.persistence.Column(name = "classificazione_abc")
|
||||
@SqlField(value = "classificazione_abc", maxLength = 1)
|
||||
private String classificazioneAbc;
|
||||
|
||||
@javax.persistence.Column(name = "tipo_codice_imballo")
|
||||
@SqlField(value = "tipo_codice_imballo", maxLength = 10)
|
||||
private String tipoCodiceImballo;
|
||||
|
||||
@javax.persistence.Column(name = "flag_stampa_docu_vend")
|
||||
@SqlField(value = "flag_stampa_docu_vend", nullable = false, defaultObjectValue = "1")
|
||||
private Boolean flagStampaDocuVend;
|
||||
|
||||
@javax.persistence.Column(name = "flag_reso_tec")
|
||||
@SqlField(value = "flag_reso_tec", nullable = false, defaultObjectValue = "0")
|
||||
private Boolean flagResoTec;
|
||||
|
||||
@javax.persistence.Column(name = "cod_mssfa")
|
||||
@SqlField(value = "cod_mssfa", maxLength = 6)
|
||||
private String codMssfa;
|
||||
|
||||
@javax.persistence.Column(name = "cod_linea")
|
||||
@SqlField(value = "cod_linea", maxLength = 6)
|
||||
private String codLinea;
|
||||
|
||||
@javax.persistence.Column(name = "cod_slinea")
|
||||
@SqlField(value = "cod_slinea", maxLength = 6)
|
||||
private String codSlinea;
|
||||
|
||||
@javax.persistence.Column(name = "cod_sslinea")
|
||||
@SqlField(value = "cod_sslinea", maxLength = 6)
|
||||
private String codSslinea;
|
||||
|
||||
@javax.persistence.ManyToOne(fetch = javax.persistence.FetchType.LAZY)
|
||||
@javax.persistence.JoinColumn(name = "unt_mis", insertable = false, updatable = false)
|
||||
private MtbUntMis mtbUntMis;
|
||||
|
||||
@Priority(1)
|
||||
@Transient
|
||||
//Compatible with EntityBase
|
||||
private List<MtbUntMis> mtbUntMisList;
|
||||
|
||||
@Priority(1)
|
||||
@Transient
|
||||
private MtbAartMarchio mtbAartMarchio;
|
||||
|
||||
@Priority(1)
|
||||
@Transient
|
||||
private MtbAartEqui mtbAartEqui;
|
||||
|
||||
@Priority(1)
|
||||
private List<MtbUntMis> mtbUntMis;
|
||||
|
||||
@EntityChild
|
||||
@javax.persistence.OneToMany(fetch = javax.persistence.FetchType.LAZY, mappedBy = "mtbAart")
|
||||
private List<MtbAartBarCode> mtbAartBarCode = new ArrayList<>();
|
||||
|
||||
/*@EntityChild
|
||||
private List<MtbPart> mtbPart;*/
|
||||
@EntityChild
|
||||
@Transient
|
||||
private List<MtbAartCarat> mtbAartCarat = new ArrayList<>();
|
||||
|
||||
@EntityChild
|
||||
@Transient
|
||||
private List<MtbAartAnag> mtbAartAnag = new ArrayList<>();
|
||||
|
||||
@EntityChild
|
||||
@Transient
|
||||
private List<MtbSpes> mtbSpes = new ArrayList<>();
|
||||
|
||||
@EntityChild
|
||||
@Transient
|
||||
private List<MtbComp> mtbComp = new ArrayList<>();
|
||||
|
||||
@EntityChild
|
||||
@Transient
|
||||
private List<MtbAartDesc> mtbAartDesc = new ArrayList<>();
|
||||
|
||||
@EntityChild
|
||||
@Transient
|
||||
private List<MtbAartLink> mtbAartLink = new ArrayList<>();
|
||||
|
||||
@EntityChild
|
||||
@Transient
|
||||
private List<MtbPartitaMag> mtbPartitaMag = new ArrayList<>();
|
||||
|
||||
@EntityChild
|
||||
@Transient
|
||||
private List<MrlAartSchTecSet> mrlAartSchTecSet = new ArrayList<>();
|
||||
|
||||
@EntityChild
|
||||
@Transient
|
||||
private List<MtbAartColori> mtbAartColori = new ArrayList<>();
|
||||
|
||||
@Priority(101)
|
||||
@Transient
|
||||
List<JtbCicl> jtbCicl;
|
||||
|
||||
@Transient
|
||||
private List<MtbLisa> mtbLisa;
|
||||
|
||||
public MtbAart() {
|
||||
@@ -1182,15 +1302,24 @@ public class MtbAart extends EntityBase implements EquatableEntityInterface<MtbA
|
||||
return this;
|
||||
}
|
||||
|
||||
public List<MtbUntMis> getMtbUntMis() {
|
||||
public MtbUntMis getMtbUntMis() {
|
||||
return mtbUntMis;
|
||||
}
|
||||
|
||||
public MtbAart setMtbUntMis(List<MtbUntMis> mtbUntMis) {
|
||||
public MtbAart setMtbUntMis(MtbUntMis mtbUntMis) {
|
||||
this.mtbUntMis = mtbUntMis;
|
||||
return this;
|
||||
}
|
||||
|
||||
public List<MtbUntMis> getMtbUntMisList() {
|
||||
return mtbUntMisList;
|
||||
}
|
||||
|
||||
public MtbAart setMtbUntMisList(List<MtbUntMis> mtbUntMisList) {
|
||||
this.mtbUntMisList = mtbUntMisList;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getClassificazioneAbc() {
|
||||
return classificazioneAbc;
|
||||
}
|
||||
|
||||
@@ -13,6 +13,8 @@ import org.kie.api.definition.type.PropertyReactive;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Objects;
|
||||
|
||||
@javax.persistence.Entity
|
||||
@javax.persistence.Table(name = MtbAartBarCode.ENTITY)
|
||||
@PropertyReactive
|
||||
@Table(MtbAartBarCode.ENTITY)
|
||||
@JsonTypeName(MtbAartBarCode.ENTITY)
|
||||
@@ -26,18 +28,28 @@ public class MtbAartBarCode extends EntityBase implements EquatableEntityInterfa
|
||||
|
||||
@PK
|
||||
@SqlField(value = "cod_barre", maxLength = 40, nullable = false)
|
||||
@javax.persistence.Id
|
||||
@javax.persistence.Column(name = "cod_barre")
|
||||
private String codBarre;
|
||||
|
||||
@SqlField(value = "cod_mart", maxLength = 15)
|
||||
@javax.persistence.Column(name = "cod_mart")
|
||||
private String codMart;
|
||||
|
||||
@javax.persistence.ManyToOne(fetch = javax.persistence.FetchType.LAZY)
|
||||
@javax.persistence.JoinColumn(name = "cod_mart", insertable = false, updatable = false)
|
||||
private MtbAart mtbAart;
|
||||
|
||||
@SqlField(value = "qta_cnf", nullable = false, defaultObjectValue = "1")
|
||||
@javax.persistence.Column(name = "qta_cnf")
|
||||
private BigDecimal qtaCnf;
|
||||
|
||||
@SqlField(value = "flag_primario", maxLength = 1, nullable = false, defaultObjectValue = "N")
|
||||
@javax.persistence.Column(name = "flag_primario")
|
||||
private String flagPrimario;
|
||||
|
||||
@SqlField(value = "tipo_cod_barre", maxLength = 10)
|
||||
@javax.persistence.Column(name = "tipo_cod_barre")
|
||||
private String tipoCodBarre;
|
||||
|
||||
public MtbAartBarCode() {
|
||||
@@ -62,6 +74,14 @@ public class MtbAartBarCode extends EntityBase implements EquatableEntityInterfa
|
||||
return this;
|
||||
}
|
||||
|
||||
public MtbAart getMtbAart() {
|
||||
return mtbAart;
|
||||
}
|
||||
|
||||
public void setMtbAart(MtbAart mtbAart) {
|
||||
this.mtbAart = mtbAart;
|
||||
}
|
||||
|
||||
public BigDecimal getQtaCnf() {
|
||||
return qtaCnf;
|
||||
}
|
||||
|
||||
@@ -9,12 +9,15 @@ import it.integry.ems_model.annotation.SqlField;
|
||||
import it.integry.ems_model.annotation.Table;
|
||||
import it.integry.ems_model.base.EntityBase;
|
||||
import it.integry.ems_model.entity._enum.IBaseEnum;
|
||||
import org.kie.api.definition.type.PropertyReactive;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.kie.api.definition.type.PropertyReactive;
|
||||
|
||||
import javax.persistence.Transient;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@javax.persistence.Entity
|
||||
@javax.persistence.Table(name = MtbUntMis.ENTITY)
|
||||
@Master
|
||||
@PropertyReactive
|
||||
@Table(MtbUntMis.ENTITY)
|
||||
@@ -27,29 +30,40 @@ public class MtbUntMis extends EntityBase {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@javax.persistence.Id
|
||||
@javax.persistence.Column(name = "unt_mis")
|
||||
@PK
|
||||
@SqlField(value = "unt_mis", maxLength = 3, nullable = false)
|
||||
private String untMis;
|
||||
|
||||
@javax.persistence.Column(name = "flag_dig")
|
||||
@SqlField(value = "flag_dig", maxLength = 1, nullable = false, defaultObjectValue = "N")
|
||||
private String flagDig;
|
||||
|
||||
@javax.persistence.Column(name = "cifre_dec")
|
||||
@SqlField(value = "cifre_dec", nullable = false, defaultObjectValue = "0")
|
||||
private BigDecimal cifreDec;
|
||||
|
||||
@javax.persistence.Column(name = "tipo_um")
|
||||
@javax.persistence.Enumerated(javax.persistence.EnumType.STRING)
|
||||
@SqlField(value = "tipo_um", maxLength = 2)
|
||||
private TipoUM tipoUm;
|
||||
|
||||
@javax.persistence.Column(name = "flag_unita_kg")
|
||||
@SqlField(value = "flag_unita_kg", maxLength = 1, nullable = false)
|
||||
private String flagUnitaKg;
|
||||
|
||||
@javax.persistence.Column(name = "flag_attivo")
|
||||
@SqlField(value = "flag_attivo", maxLength = 1, nullable = false)
|
||||
private String flagAttivo;
|
||||
|
||||
@javax.persistence.Column(name = "grandezza")
|
||||
@javax.persistence.Enumerated(javax.persistence.EnumType.STRING)
|
||||
@SqlField(value = "grandezza")
|
||||
private Grandezza grandezza;
|
||||
|
||||
@JsonProperty(value = "ordinamento")
|
||||
@Transient
|
||||
private Integer ordinamento;
|
||||
|
||||
public MtbUntMis() {
|
||||
|
||||
@@ -155,7 +155,7 @@ when
|
||||
$entity : MtbAart((untMis != null || untMis2 != null || untMis3 != null ) && operation != OperationType.DELETE)
|
||||
then
|
||||
List<MtbUntMis> mtbUntMis = CommonRules.insUntMis(conn, $entity);
|
||||
modify($entity){setMtbUntMis(mtbUntMis)}
|
||||
modify($entity){setMtbUntMisList(mtbUntMis)}
|
||||
|
||||
end
|
||||
|
||||
|
||||
@@ -18,7 +18,8 @@ import java.time.LocalDate
|
||||
import it.integry.ems_model.utility.UtilityLocalDate;
|
||||
import it.integry.ems.migration._base.IntegryCustomerDB;
|
||||
import it.integry.ems.migration._base.IntegryCustomer
|
||||
import it.integry.ems.utility.entity.MtbUntMisUtils
|
||||
import it.integry.ems.jpa.repository.MtbUntMisRepository
|
||||
import it.integry.ems._context.ApplicationContextProvider
|
||||
|
||||
global Connection conn
|
||||
global String username
|
||||
@@ -226,7 +227,10 @@ when
|
||||
eval(completeRulesEnabled)
|
||||
$entity : MtbColr(artAPeso == null && codMart != null )
|
||||
then
|
||||
MtbUntMis mtbUntMis = MtbUntMisUtils.getMtbUntMisFromCodMart(customerDb, $entity.getCodMart());
|
||||
MtbUntMisRepository mtbUntMisRepository = ApplicationContextProvider.getApplicationContext().getBean(MtbUntMisRepository.class);
|
||||
|
||||
MtbUntMis mtbUntMis = mtbUntMisRepository.findByCodMart($entity.getCodMart())
|
||||
.orElse(null);
|
||||
|
||||
String artAPeso = "N";
|
||||
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
package it.integry.ems.jpa;
|
||||
|
||||
import it.integry.ems.javabeans.RequestDataDTO;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
public class TenantInterceptor extends HandlerInterceptorAdapter {
|
||||
|
||||
@Autowired
|
||||
private RequestDataDTO requestDataDTO;
|
||||
|
||||
// private static final String TENANT_HEADER = "X-Tenant-ID";
|
||||
// private static final String DEFAULT_TENANT = "default"; // O recuperalo da configurazione
|
||||
|
||||
@Override
|
||||
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
|
||||
String profileDb = requestDataDTO.getProfileDB();
|
||||
|
||||
// String tenantId = request.getHeader(TENANT_HEADER);
|
||||
|
||||
// Logica di fallback o recupero tenant da sessione/utente
|
||||
if (profileDb == null || profileDb.isEmpty()) {
|
||||
// Esempio: recupero da sessione se presente
|
||||
// tenantId = (String) request.getSession().getAttribute("TENANT_ID");
|
||||
|
||||
// Fallback temporaneo per test
|
||||
// tenantId = DEFAULT_TENANT;
|
||||
}
|
||||
|
||||
if (profileDb != null) {
|
||||
TenantContext.setCurrentTenant(profileDb);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,11 +5,11 @@ import com.annimon.stream.function.Predicate;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import it.integry.common.var.CommonConstants;
|
||||
import it.integry.ems._context.ApplicationContextProvider;
|
||||
import it.integry.ems.jpa.repository.MtbAartRepository;
|
||||
import it.integry.ems.logistic.dto.sm2.FiltroDistribuzioneColloDTO;
|
||||
import it.integry.ems.product.importaz.service.ProductServices;
|
||||
import it.integry.ems.service.EntityProcessor;
|
||||
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
|
||||
import it.integry.ems.utility.entity.MtbAartUtils;
|
||||
import it.integry.ems_model.base.EntityBase;
|
||||
import it.integry.ems_model.base.EntityNotFound;
|
||||
import it.integry.ems_model.entity.*;
|
||||
@@ -31,12 +31,13 @@ import static java.util.stream.Collectors.groupingBy;
|
||||
@Component
|
||||
public class DistribuzioneColliService {
|
||||
|
||||
|
||||
private final List<MtbColt> mCurrentlyDistributingMtbColt = new ArrayList<>();
|
||||
|
||||
|
||||
public List<MtbColt> distribuzioneRigheColloNew(final FiltroDistribuzioneColloDTO filtroDistribuzioneColloDTO, boolean skipCommit) throws Exception {
|
||||
|
||||
MtbAartRepository mtbAartRepository = ContextLoader.getCurrentWebApplicationContext().getBean(MtbAartRepository.class);
|
||||
|
||||
MultiDBTransactionManager multiDBTransactionManager = ContextLoader.getCurrentWebApplicationContext().getBean(MultiDBTransactionManager.class);
|
||||
EntityProcessor entityProcessor = ApplicationContextProvider.getApplicationContext().getBean(EntityProcessor.class);
|
||||
ProductServices productServices = ContextLoader.getCurrentWebApplicationContext().getBean(ProductServices.class);
|
||||
@@ -116,8 +117,7 @@ public class DistribuzioneColliService {
|
||||
.map(MtbColr::getCodMart)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
List<MtbAart> mtbAarts = MtbAartUtils.getArticoliByCodMarts(codMarts, multiDBTransactionManager.getPrimaryConnection());
|
||||
|
||||
List<MtbAart> mtbAarts = mtbAartRepository.findByCodMartIn(codMarts);
|
||||
|
||||
//Lettura del filtro ordini
|
||||
String filtroOrdini = sourceMtbColt.getFiltroOrdini();
|
||||
|
||||
@@ -3,11 +3,11 @@ package it.integry.ems.order.Import.service;
|
||||
import it.integry.common.var.CommonConstants;
|
||||
import it.integry.ems._context.ApplicationContextProvider;
|
||||
import it.integry.ems.exception.PrimaryDatabaseNotPresentException;
|
||||
import it.integry.ems.jpa.repository.MtbAartRepository;
|
||||
import it.integry.ems.service.EntityProcessor;
|
||||
import it.integry.ems.sync.MultiDBTransaction.Connection;
|
||||
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
|
||||
import it.integry.ems.utility.UtilityEntity;
|
||||
import it.integry.ems.utility.entity.MtbAartUtils;
|
||||
import it.integry.ems_model.base.EntityBase;
|
||||
import it.integry.ems_model.config.EmsRestConstants;
|
||||
import it.integry.ems_model.entity.*;
|
||||
@@ -44,6 +44,8 @@ public class OrdiniMaxiDataImportService {
|
||||
private EntityProcessor entityProcessor;
|
||||
|
||||
private MaxiDataApiService maxiDataApiService;
|
||||
@Autowired
|
||||
private MtbAartRepository mtbAartRepository;
|
||||
|
||||
@PostConstruct
|
||||
private void init() throws PrimaryDatabaseNotPresentException {
|
||||
@@ -132,12 +134,11 @@ public class OrdiniMaxiDataImportService {
|
||||
if (schedeProduzione == null || schedeProduzione.isEmpty())
|
||||
return new ArrayList<>();
|
||||
|
||||
List<MtbAart> anafraficheArticoli = MtbAartUtils.getArticoliByCodMarts(
|
||||
List<MtbAart> anafraficheArticoli = mtbAartRepository.findByCodMartIn(
|
||||
schedeProduzione.stream()
|
||||
.map(MaxidataUveBII40V2BLLUVE2kSchedeProd::getIdProdotto)
|
||||
.distinct()
|
||||
.collect(Collectors.toList()),
|
||||
conn);
|
||||
.collect(Collectors.toList()));
|
||||
|
||||
List<DtbOrdt> generatedOrders = new ArrayList<>();
|
||||
|
||||
|
||||
@@ -64,6 +64,9 @@ public class ProductController {
|
||||
@Autowired
|
||||
private MultiDBTransactionManager multiDBTransactionManager;
|
||||
|
||||
@Autowired
|
||||
private it.integry.ems.jpa.repository.MtbAartRepository mtbAartRepository;
|
||||
|
||||
@Autowired
|
||||
private ServiceChecker serviceChecker;
|
||||
|
||||
@@ -282,7 +285,20 @@ public class ProductController {
|
||||
@RequestParam("codMart") String codMartString) throws Exception {
|
||||
|
||||
List<String> codMarts = Arrays.asList(codMartString.split(","));
|
||||
List<MtbAart> mtbAartList = productServices.getArticoliByCodMarts(codMarts);
|
||||
|
||||
List<MtbAart> mtbAartList = mtbAartRepository.findWithBarcodeWithUntMisByCodMartIn(codMarts);
|
||||
|
||||
return new ServiceRestResponse(EsitoType.OK, null, mtbAartList);
|
||||
}
|
||||
|
||||
@RequestMapping(value = EmsRestConstants.PATH_SMART_ENTERPRISE_GET_ART_BY_CODMART + "/jpa", method = RequestMethod.GET)
|
||||
public @ResponseBody
|
||||
ServiceRestResponse getArticoloByCodMartJpa(HttpServletRequest request,
|
||||
@RequestParam(CommonConstants.PROFILE_DB) String configuration,
|
||||
@RequestParam("codMart") String codMartString) throws Exception {
|
||||
|
||||
List<String> codMarts = Arrays.asList(codMartString.split(","));
|
||||
List<MtbAart> mtbAartList = mtbAartRepository.findByCodMartIn(codMarts);
|
||||
|
||||
return new ServiceRestResponse(EsitoType.OK, null, mtbAartList);
|
||||
}
|
||||
|
||||
@@ -16,7 +16,6 @@ import it.integry.ems.service.EntityProcessor;
|
||||
import it.integry.ems.sync.MultiDBTransaction.Connection;
|
||||
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
|
||||
import it.integry.ems.utility.UtilityEntity;
|
||||
import it.integry.ems.utility.entity.MtbAartUtils;
|
||||
import it.integry.ems_model.base.EntityBase;
|
||||
import it.integry.ems_model.db.ResultSetMapper;
|
||||
import it.integry.ems_model.entity.*;
|
||||
@@ -234,10 +233,6 @@ public class ProductServices {
|
||||
return results;
|
||||
}
|
||||
|
||||
public List<MtbAart> getArticoliByCodMarts(List<String> codMarts) throws Exception {
|
||||
return MtbAartUtils.getArticoliByCodMarts(codMarts, multiDBTransactionManager.getPrimaryConnection());
|
||||
}
|
||||
|
||||
public List<EntityBase> importArticoliBiolevante() throws Exception {
|
||||
List<EntityBase> toBeProcessed = new ArrayList<EntityBase>();
|
||||
List<EntityBase> entitiesReturn = new ArrayList<EntityBase>();
|
||||
|
||||
@@ -14,6 +14,7 @@ import it.integry.ems.document.dto.ScaricoLavorazioneDTO;
|
||||
import it.integry.ems.document.service.DocumentProdService;
|
||||
import it.integry.ems.exception.MissingDataException;
|
||||
import it.integry.ems.exception.PrimaryDatabaseNotPresentException;
|
||||
import it.integry.ems.jpa.repository.MtbAartRepository;
|
||||
import it.integry.ems.migration._base.IntegryCustomerDB;
|
||||
import it.integry.ems.production.dto.*;
|
||||
import it.integry.ems.production.event.ProductionOrderPausedEvent;
|
||||
@@ -41,7 +42,6 @@ import it.integry.ems.service.production.ProductionOrderDataHandlerService;
|
||||
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
|
||||
import it.integry.ems.utility.UtilityDebug;
|
||||
import it.integry.ems.utility.UtilityEntity;
|
||||
import it.integry.ems.utility.entity.MtbAartUtils;
|
||||
import it.integry.ems_model.base.EntityBase;
|
||||
import it.integry.ems_model.business_logic.dto.DatiMaterialiDTO;
|
||||
import it.integry.ems_model.config.EmsRestConstants;
|
||||
@@ -129,6 +129,8 @@ public class MesProductionServiceV2 {
|
||||
|
||||
@Autowired
|
||||
private ApplicationEventPublisher applicationEventPublisher;
|
||||
@Autowired
|
||||
private MtbAartRepository mtbAartRepository;
|
||||
|
||||
public BasePanelAnswerDTO callSupervisorServiceGET(String serviceIp, int servicePort, String serviceName, HashMap<String, String> queryParams) throws Exception {
|
||||
Integer timeout = setupGest.getSetupInteger(multiDBTransactionManager.getPrimaryConnection(), "MES", "HMI", "TIMEOUT_MACHINE_CONNECTION", 5);
|
||||
@@ -1126,7 +1128,8 @@ public class MesProductionServiceV2 {
|
||||
entityProcessor.processEntity(ordineLav, true, multiDBTransactionManager);
|
||||
|
||||
MtbAart mtbAart =
|
||||
MtbAartUtils.getArticoloByCodMart(ordineLav.getCodProd(), multiDBTransactionManager.getPrimaryConnection());
|
||||
mtbAartRepository.findByCodMart(ordineLav.getCodProd())
|
||||
.orElse(null);
|
||||
|
||||
if (UtilityBigDecimal.isNullOrZero(dto.getQtaCollo())) {
|
||||
if (UtilityBigDecimal.isNullOrZero(dto.getColliPedana())) {
|
||||
|
||||
@@ -1,45 +1,48 @@
|
||||
package it.integry.ems.retail.service;
|
||||
|
||||
import it.integry.ems.dynamic_cache.EntityCacheComponent;
|
||||
import it.integry.ems.production.agribook.model.AgribookOrderDTO;
|
||||
import it.integry.ems.jpa.repository.MtbAartRepository;
|
||||
import it.integry.ems.retail.dto.AnomalieMerceDTO;
|
||||
import it.integry.ems.retail.dto.DettaglioULDTO;
|
||||
import it.integry.ems.retail.dto.SaveAnomaliaRequestDTO;
|
||||
import it.integry.ems.retail.dto.SaveLivelloAnomaliaRequestDTO;
|
||||
import it.integry.ems.retail.utility.AnomalieUlUtility;
|
||||
import it.integry.ems.retail.wms.Utility.WMSUtility;
|
||||
import it.integry.ems.retail.wms.generic.dto.MvwSitArtUdcDetInventarioDTO;
|
||||
import it.integry.ems.service.EntityProcessor;
|
||||
import it.integry.ems.sync.MultiDBTransaction.Connection;
|
||||
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
|
||||
import it.integry.ems.utility.UtilityEntity;
|
||||
import it.integry.ems_model.base.EntityBase;
|
||||
import it.integry.ems_model.config.EmsRestConstants;
|
||||
import it.integry.ems_model.entity.MtbAart;
|
||||
import it.integry.ems_model.entity.MtbAnomalieUl;
|
||||
import it.integry.ems_model.entity.MtbColt;
|
||||
import it.integry.ems_model.entity.MtbLivelliAnomalie;
|
||||
import it.integry.ems_model.types.OperationType;
|
||||
import it.integry.ems_model.utility.*;
|
||||
import it.integry.ems_model.utility.UtilityDB;
|
||||
import it.integry.ems_model.utility.UtilityList;
|
||||
import it.integry.ems_model.utility.UtilityLong;
|
||||
import it.integry.ems_model.utility.UtilityString;
|
||||
import it.integry.ems_model.utility.dto.PageableRequestDTO;
|
||||
import it.integry.ems_model.utility.dto.PaginatedDTO;
|
||||
import org.jfree.util.ObjectList;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
@Service
|
||||
public class AnomalieUlService {
|
||||
|
||||
private final EntityCacheComponent entityCacheComponent;
|
||||
private final EntityProcessor entityProcessor;
|
||||
private final MtbAartRepository mtbAartRepository;
|
||||
|
||||
public AnomalieUlService(EntityCacheComponent entityCacheComponent, EntityProcessor entityProcessor) {
|
||||
public AnomalieUlService(EntityCacheComponent entityCacheComponent, EntityProcessor entityProcessor, MtbAartRepository mtbAartRepository) {
|
||||
this.entityCacheComponent = entityCacheComponent;
|
||||
this.entityProcessor = entityProcessor;
|
||||
this.mtbAartRepository = mtbAartRepository;
|
||||
}
|
||||
|
||||
public PaginatedDTO<AnomalieMerceDTO> getAnomalieProd(PageableRequestDTO requestDTO, Connection connection) throws Exception {
|
||||
@@ -78,14 +81,13 @@ public class AnomalieUlService {
|
||||
if (UtilityList.isNullOrEmpty(ulDetails))
|
||||
return new ArrayList<>();
|
||||
|
||||
List<String> codMarts = ulDetails.stream().map(DettaglioULDTO::getCodMart).distinct().collect(Collectors.toList());
|
||||
Map<String, MtbAart> artMap = entityCacheComponent.<MtbAart>getCachedEntitiesStream(connection.getIntegryCustomerDB(), MtbAart.ENTITY, art -> codMarts.contains(art.getCodMart())).collect(Collectors.toMap(MtbAart::getCodMart, x -> x));
|
||||
ulDetails.forEach(ul -> {
|
||||
MtbAart art = artMap.get(ul.getCodMart());
|
||||
ul.setDescrizione(art.getDescrizione())
|
||||
.setDescrizioneEstesa(art.getDescrizioneEstesa())
|
||||
.setUntMis(art.getUntMis());
|
||||
});
|
||||
for (DettaglioULDTO ulDetail : ulDetails) {
|
||||
final MtbAart mtbAart = mtbAartRepository.findByCodMart(ulDetail.getCodMart()).get();
|
||||
ulDetail.setDescrizione(mtbAart.getDescrizione())
|
||||
.setDescrizioneEstesa(mtbAart.getDescrizioneEstesa())
|
||||
.setUntMis(mtbAart.getUntMis());
|
||||
}
|
||||
|
||||
|
||||
return ulDetails;
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import it.integry.ems._context.ApplicationContextProvider;
|
||||
import it.integry.ems.exception.MissingDataException;
|
||||
import it.integry.ems.exception.PrimaryDatabaseNotPresentException;
|
||||
import it.integry.ems.javabeans.RequestDataDTO;
|
||||
import it.integry.ems.jpa.repository.MtbAartRepository;
|
||||
import it.integry.ems.retail.wms.dto.*;
|
||||
import it.integry.ems.retail.wms.exceptions.InvalidArticoloException;
|
||||
import it.integry.ems.retail.wms.generic.dto.MvwSitArtUdcDetInventarioDTO;
|
||||
@@ -17,7 +18,6 @@ import it.integry.ems.service.production.ProductionOrderDataHandlerService;
|
||||
import it.integry.ems.sync.MultiDBTransaction.Connection;
|
||||
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
|
||||
import it.integry.ems.utility.UtilityEntity;
|
||||
import it.integry.ems.utility.entity.MtbAartUtils;
|
||||
import it.integry.ems_model.entity.*;
|
||||
import it.integry.ems_model.entity._enum.GestioneEnum;
|
||||
import it.integry.ems_model.rulescompleting.DroolsDataCompleting;
|
||||
@@ -248,15 +248,16 @@ public class WMSUtility {
|
||||
|
||||
public static InsertUDSRowResponseDTO insertUDSLavorazioneRowMovement(Connection connection, InsertUDSRowRequestDTO insertUDSRowRequestDTO, String username) throws Exception {
|
||||
DroolsDataCompleting droolsDataCompleting = ApplicationContextProvider.getApplicationContext().getBean(DroolsDataCompleting.class);
|
||||
MtbAartRepository mtbAartRepository = ApplicationContextProvider.getApplicationContext().getBean(MtbAartRepository.class);
|
||||
|
||||
//Prendo solo la chiave
|
||||
MtbColt targetMtbColt = insertUDSRowRequestDTO.getTargetMtbColt();
|
||||
if (targetMtbColt == null)
|
||||
throw new Exception("Nessun collo di destinazione specificato durante l'inserimento di una riga in una UDS (targetMtbColt null)");
|
||||
|
||||
MtbAart mtbAart = MtbAartUtils.getArticoloByCodMart(insertUDSRowRequestDTO.getCodMart(), connection);
|
||||
if (mtbAart == null)
|
||||
throw new InvalidArticoloException(insertUDSRowRequestDTO.getCodMart());
|
||||
|
||||
MtbAart mtbAart = mtbAartRepository.findByCodMart(insertUDSRowRequestDTO.getCodMart())
|
||||
.orElseThrow(() -> new InvalidArticoloException(insertUDSRowRequestDTO.getCodMart()));
|
||||
|
||||
MtbColrInfoProd mtbColrInfoProd = null;
|
||||
|
||||
@@ -505,6 +506,8 @@ public class WMSUtility {
|
||||
|
||||
public static InsertUDCRowResponseDTO insertUDCRow(InsertUDCRowRequestDTO insertUDCRowRequestDTO, EntityProcessor entityProcessor, MultiDBTransactionManager multiDBTransactionManager) throws Exception {
|
||||
|
||||
MtbAartRepository mtbAartRepository = ApplicationContextProvider.getApplicationContext().getBean(MtbAartRepository.class);
|
||||
|
||||
MtbColt targetMtbColt = insertUDCRowRequestDTO.getTargetMtbColt();
|
||||
|
||||
if (targetMtbColt == null)
|
||||
@@ -540,9 +543,8 @@ public class WMSUtility {
|
||||
|
||||
|
||||
if (insertUDCRowRequestDTO.getCodMart() != null) {
|
||||
MtbAart mtbAart = MtbAartUtils.getArticoloByCodMart(insertUDCRowRequestDTO.getCodMart(), multiDBTransactionManager.getPrimaryConnection());
|
||||
if (mtbAart == null)
|
||||
throw new InvalidArticoloException(insertUDCRowRequestDTO.getCodMart());
|
||||
MtbAart mtbAart = mtbAartRepository.findByCodMart(insertUDCRowRequestDTO.getCodMart())
|
||||
.orElseThrow(() -> new InvalidArticoloException(insertUDCRowRequestDTO.getCodMart()));
|
||||
|
||||
targetMtbColr
|
||||
.setCodMart(mtbAart.getCodMart())
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package it.integry.ems.retail.wms.accettazione.service;
|
||||
|
||||
import it.integry.ems.javabeans.RequestDataDTO;
|
||||
import it.integry.ems.jpa.repository.MtbAartRepository;
|
||||
import it.integry.ems.product.importaz.service.ProductServices;
|
||||
import it.integry.ems.retail.wms.accettazione.dto.AlreadyRegisteredUlDTO;
|
||||
import it.integry.ems.retail.wms.accettazione.dto.BollaAccettazioneDTO;
|
||||
@@ -8,7 +9,6 @@ import it.integry.ems.retail.wms.accettazione.dto.SitBollaAccettazioneDTO;
|
||||
import it.integry.ems.service.EntityProcessor;
|
||||
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
|
||||
import it.integry.ems.user.UserSession;
|
||||
import it.integry.ems.utility.entity.MtbAartUtils;
|
||||
import it.integry.ems_model.entity.MtbAart;
|
||||
import it.integry.ems_model.entity.WdtbDoct;
|
||||
import it.integry.ems_model.types.OperationType;
|
||||
@@ -43,6 +43,8 @@ public class WMSAccettazioneBollaService {
|
||||
|
||||
@Autowired
|
||||
private UserSession userSession;
|
||||
@Autowired
|
||||
private MtbAartRepository mtbAartRepository;
|
||||
|
||||
public List<BollaAccettazioneDTO> retrieveBolleDaAccettare() throws Exception {
|
||||
|
||||
@@ -166,11 +168,11 @@ public class WMSAccettazioneBollaService {
|
||||
|
||||
if (sitBollaAccettazioneDTOS == null || sitBollaAccettazioneDTOS.isEmpty()) return null;
|
||||
|
||||
final List<MtbAart> articoliByCodMarts = MtbAartUtils.getArticoliByCodMarts(sitBollaAccettazioneDTOS.stream()
|
||||
final List<MtbAart> articoliByCodMarts = mtbAartRepository.findByCodMartIn(sitBollaAccettazioneDTOS.stream()
|
||||
.map(SitBollaAccettazioneDTO::getCodMart)
|
||||
.filter(Objects::nonNull)
|
||||
.distinct()
|
||||
.collect(Collectors.toList()), multiDBTransactionManager.getPrimaryConnection());
|
||||
.collect(Collectors.toList()));
|
||||
|
||||
final Map<String, BigDecimal> qtaCnfsByArt = articoliByCodMarts.stream()
|
||||
.collect(Collectors.toMap(MtbAart::getCodMart, MtbAart::getQtaCnf));
|
||||
|
||||
@@ -2,6 +2,7 @@ package it.integry.ems.retail.wms.accettazione.service;
|
||||
|
||||
import it.integry.ems.exception.PrimaryDatabaseNotPresentException;
|
||||
import it.integry.ems.javabeans.RequestDataDTO;
|
||||
import it.integry.ems.jpa.repository.MtbAartRepository;
|
||||
import it.integry.ems.product.importaz.service.ProductServices;
|
||||
import it.integry.ems.retail.pvmRetail.dto.OrdineInevasoDTO;
|
||||
import it.integry.ems.retail.wms.Utility.WMSUtility;
|
||||
@@ -69,6 +70,9 @@ public class WMSAccettazioneService {
|
||||
@Autowired
|
||||
private AziendaService aziendaService;
|
||||
|
||||
@Autowired
|
||||
private MtbAartRepository mtbAartRepository;
|
||||
|
||||
public MtbColt createUDC(CreateUDCRequestDTO createUDCRequestDTO) throws Exception {
|
||||
if (!userSession.isAttivo()) {
|
||||
throw new UsernameNotFoundException("Utente " + userSession.getUsername() + " non riconoscuto!");
|
||||
@@ -291,7 +295,7 @@ public class WMSAccettazioneService {
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
|
||||
List<MtbAart> mtbAarts = productServices.getArticoliByCodMarts(codMarts);
|
||||
List<MtbAart> mtbAarts = mtbAartRepository.findByCodMartIn(codMarts);
|
||||
|
||||
MtbColt targetMtbColt = inputData.getTargetMtbColt();
|
||||
targetMtbColt.setOperation(OperationType.SELECT_OBJECT);
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package it.integry.ems.retail.wms.documenti.service;
|
||||
|
||||
import it.integry.ems.jpa.repository.MtbUntMisRepository;
|
||||
import it.integry.ems.product.importaz.service.ProductServices;
|
||||
import it.integry.ems.retail.pvmRetail.dto.PvmArticoliChildDTO;
|
||||
import it.integry.ems.retail.pvmRetail.dto.PvmArticoliDTO;
|
||||
@@ -8,7 +9,6 @@ import it.integry.ems.retail.wms.documenti.dto.DocumentArtDTO;
|
||||
import it.integry.ems.retail.wms.documenti.dto.RetrieveLottiDTO;
|
||||
import it.integry.ems.sync.MultiDBTransaction.Connection;
|
||||
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
|
||||
import it.integry.ems.utility.entity.MtbUntMisUtils;
|
||||
import it.integry.ems_model.entity.MtbUntMis;
|
||||
import it.integry.ems_model.entity._enum.GestioneEnum;
|
||||
import it.integry.ems_model.service.SetupGest;
|
||||
@@ -38,6 +38,8 @@ public class WMSDocumentService {
|
||||
|
||||
@Autowired
|
||||
private SetupGest setupGest;
|
||||
@Autowired
|
||||
private MtbUntMisRepository mtbUntMisRepository;
|
||||
|
||||
public Boolean checkDoc(String fornitore, String numDoc, Date dataDoc, String tipoDoc) throws Exception {
|
||||
Connection conn = multiDBTransactionManager.getPrimaryConnection();
|
||||
@@ -114,7 +116,8 @@ public class WMSDocumentService {
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
|
||||
final List<MtbUntMis> untMisFromCod = MtbUntMisUtils.getFromCods(untMiss, multiDBTransactionManager.getPrimaryConnection());
|
||||
|
||||
final List<MtbUntMis> untMisFromCod = mtbUntMisRepository.findByUntMisIn(untMiss);
|
||||
|
||||
for (DocumentArtDTO art : arts) {
|
||||
final MtbUntMis mtbUntMis = untMisFromCod.stream().filter(x -> x.getUntMis().equalsIgnoreCase(art.getUntMis()))
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package it.integry.ems.retail.wms.generic.controller;
|
||||
|
||||
import it.integry.common.var.CommonConstants;
|
||||
import it.integry.ems.jpa.repository.MtbAartRepository;
|
||||
import it.integry.ems.product.importaz.service.ProductServices;
|
||||
import it.integry.ems.response.ServiceRestResponse;
|
||||
import it.integry.ems.retail.wms.generic.dto.*;
|
||||
@@ -37,6 +38,8 @@ public class WMSArticoloController {
|
||||
|
||||
@Autowired
|
||||
private UserSession userSession;
|
||||
@Autowired
|
||||
private MtbAartRepository mtbAartRepository;
|
||||
|
||||
|
||||
@RequestMapping(value = "", method = RequestMethod.GET)
|
||||
@@ -93,8 +96,7 @@ public class WMSArticoloController {
|
||||
ServiceRestResponse searchByCodMartOrBarcode(@RequestParam(CommonConstants.PROFILE_DB) String profileDB,
|
||||
@RequestBody RetrieveArticoloByCodMartRequestDTO retrieveArticoloByCodMartRequest) throws Exception {
|
||||
|
||||
return ServiceRestResponse.createPositiveResponse(
|
||||
productServices.getArticoliByCodMarts(retrieveArticoloByCodMartRequest.getCodMarts()));
|
||||
return ServiceRestResponse.createPositiveResponse(mtbAartRepository.findByCodMartIn(retrieveArticoloByCodMartRequest.getCodMarts()));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ import it.integry.common.var.CommonConstants;
|
||||
import it.integry.ems.Import.dto.AnomalieDTO;
|
||||
import it.integry.ems.exception.MissingDataException;
|
||||
import it.integry.ems.javabeans.RequestDataDTO;
|
||||
import it.integry.ems.jpa.repository.MtbAartRepository;
|
||||
import it.integry.ems.product.importaz.service.ProductServices;
|
||||
import it.integry.ems.report.dto.PairsDTO;
|
||||
import it.integry.ems.report.dto.ReportTypeDTO;
|
||||
@@ -36,7 +37,6 @@ import it.integry.ems.service.dto.production.OrdineInevasoGroupMercDTO;
|
||||
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
|
||||
import it.integry.ems.user.UserSession;
|
||||
import it.integry.ems.utility.UtilityEntity;
|
||||
import it.integry.ems.utility.entity.MtbAartUtils;
|
||||
import it.integry.ems.utility.entity.MtbDepoPosizioniUtils;
|
||||
import it.integry.ems_model.base.EntityBase;
|
||||
import it.integry.ems_model.config.EmsRestConstants;
|
||||
@@ -106,6 +106,8 @@ public class WMSGenericService {
|
||||
private WMSAccettazioneService wmsAccettazioneService;
|
||||
@Autowired
|
||||
private WMSGiacenzaULService wmsGiacenzaULService;
|
||||
@Autowired
|
||||
private MtbAartRepository mtbAartRepository;
|
||||
|
||||
public List<AvailableCodMdepDTO> getAvailableCodMdepsForUser() throws Exception {
|
||||
|
||||
@@ -787,7 +789,7 @@ public class WMSGenericService {
|
||||
.distinct()
|
||||
.toList();
|
||||
|
||||
final List<MtbAart> mtbAarts = MtbAartUtils.getArticoliByCodMarts(codMarts, multiDBTransactionManager.getPrimaryConnection());
|
||||
final List<MtbAart> mtbAarts = mtbAartRepository.findByCodMartIn(codMarts);
|
||||
|
||||
|
||||
//Carico la giacenza degli articoli
|
||||
@@ -2530,17 +2532,17 @@ public class WMSGenericService {
|
||||
.distinct()
|
||||
.toList();
|
||||
|
||||
List<MtbAart> mtbAarts = MtbAartUtils.getArticoliByCodMarts(codMarts, multiDBTransactionManager.getPrimaryConnection());
|
||||
List<MtbAart> mtbAarts = mtbAartRepository.findByCodMartIn(codMarts);
|
||||
|
||||
List<MtbColt> mtbColtToSave = new ArrayList<>();
|
||||
List<MtbColr> successMtbColr = new ArrayList<>();
|
||||
List<MtbColr> failedMtbColr = new ArrayList<>();
|
||||
|
||||
for (MtbColr inputMtbColr : resultRows) {
|
||||
MtbAart mtbAart = Stream.of(mtbAarts)
|
||||
MtbAart mtbAart = mtbAarts.stream()
|
||||
.filter(x -> x.getCodMart().equals(inputMtbColr.getCodMart()))
|
||||
.findFirst()
|
||||
.get();
|
||||
.orElse(null);
|
||||
|
||||
inputMtbColr
|
||||
.setOnlyPkMaster(false);
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package it.integry.ems.retail.wms.inventario.service;
|
||||
|
||||
import it.integry.common.var.CommonConstants;
|
||||
import it.integry.ems.jpa.repository.MtbUntMisRepository;
|
||||
import it.integry.ems.json.ResponseJSONObjectMapper;
|
||||
import it.integry.ems.product.importaz.service.ProductServices;
|
||||
import it.integry.ems.retail.pvmRetail.dto.PvmArticoliChildDTO;
|
||||
@@ -11,7 +12,6 @@ import it.integry.ems.service.EntityProcessor;
|
||||
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
|
||||
import it.integry.ems.utility.UtilityDirs;
|
||||
import it.integry.ems.utility.UtilityFile;
|
||||
import it.integry.ems.utility.entity.MtbUntMisUtils;
|
||||
import it.integry.ems_model.entity.MtbInvenr;
|
||||
import it.integry.ems_model.entity.MtbInvent;
|
||||
import it.integry.ems_model.entity.MtbUntMis;
|
||||
@@ -58,6 +58,8 @@ public class WMSInventarioService {
|
||||
|
||||
@Autowired
|
||||
private ResponseJSONObjectMapper jsonObjectMapper;
|
||||
@Autowired
|
||||
private MtbUntMisRepository mtbUntMisRepository;
|
||||
|
||||
|
||||
public MtbInvent loadInventarioIfExists(int inventoryId, String codMdep) throws Exception {
|
||||
@@ -136,7 +138,7 @@ public class WMSInventarioService {
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
|
||||
final List<MtbUntMis> untMisFromCod = MtbUntMisUtils.getFromCods(untMiss, multiDBTransactionManager.getPrimaryConnection());
|
||||
final List<MtbUntMis> untMisFromCod = mtbUntMisRepository.findByUntMisIn(untMiss);
|
||||
|
||||
for (InventarioArtDTO art : arts) {
|
||||
final MtbUntMis mtbUntMis = untMisFromCod.stream().filter(x -> x.getUntMis().equalsIgnoreCase(art.getUntMis()))
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.annimon.stream.Stream;
|
||||
import it.integry.ems.document.dto.ProduzioneOrdineDTO;
|
||||
import it.integry.ems.document.dto.ScarichiArticoloDTO;
|
||||
import it.integry.ems.javabeans.RequestDataDTO;
|
||||
import it.integry.ems.jpa.repository.MtbAartRepository;
|
||||
import it.integry.ems.logistic.dto.sm2.FiltroDistribuzioneColloDTO;
|
||||
import it.integry.ems.product.importaz.service.ProductServices;
|
||||
import it.integry.ems.retail.wms.Utility.WMSUtility;
|
||||
@@ -23,7 +24,6 @@ import it.integry.ems.service.production.ProductionOrderDataHandlerService;
|
||||
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
|
||||
import it.integry.ems.user.UserSession;
|
||||
import it.integry.ems.utility.UtilityEntity;
|
||||
import it.integry.ems.utility.entity.MtbAartUtils;
|
||||
import it.integry.ems_model.base.EntityBase;
|
||||
import it.integry.ems_model.entity.*;
|
||||
import it.integry.ems_model.entity._enum.GestioneEnum;
|
||||
@@ -75,6 +75,8 @@ public class WMSLavorazioneService {
|
||||
|
||||
@Autowired
|
||||
private AziendaService aziendaService;
|
||||
@Autowired
|
||||
private MtbAartRepository mtbAartRepository;
|
||||
|
||||
public MtbColt createUDS(CreateUDSRequestDTO createUDSRequestDTO) throws Exception {
|
||||
|
||||
@@ -265,9 +267,9 @@ public class WMSLavorazioneService {
|
||||
entityProcessor.processEntity(targetMtbColt, true, multiDBTransactionManager);
|
||||
|
||||
|
||||
MtbAart mtbAart = MtbAartUtils.getArticoloByCodMart(insertUDSRowRequestDTO.getCodMart(), multiDBTransactionManager.getPrimaryConnection());
|
||||
if (mtbAart == null)
|
||||
throw new InvalidArticoloException(insertUDSRowRequestDTO.getCodMart());
|
||||
MtbAart mtbAart = mtbAartRepository.findByCodMart(insertUDSRowRequestDTO.getCodMart())
|
||||
.orElseThrow(() -> new InvalidArticoloException(insertUDSRowRequestDTO.getCodMart()));
|
||||
|
||||
|
||||
MtbColrInfoProd mtbColrInfoProd = null;
|
||||
|
||||
@@ -351,7 +353,8 @@ public class WMSLavorazioneService {
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
|
||||
List<MtbAart> mtbAarts = productServices.getArticoliByCodMarts(codMarts);
|
||||
|
||||
List<MtbAart> mtbAarts = mtbAartRepository.findByCodMartIn(codMarts);
|
||||
|
||||
//Prendo solo la chiave
|
||||
MtbColt targetMtbColt = new MtbColt()
|
||||
@@ -606,7 +609,7 @@ public class WMSLavorazioneService {
|
||||
.setCodMdep(createUDCRequestDTO.getCodMdep())
|
||||
.setCodVdes(createUDCRequestDTO.getCodVdes())
|
||||
.setOraInizPrep(new Date())
|
||||
.setPreparatoDa(UtilityString.isNull(createUDCRequestDTO.getPreparatoDa(),requestDataDTO.getUsername()))
|
||||
.setPreparatoDa(UtilityString.isNull(createUDCRequestDTO.getPreparatoDa(), requestDataDTO.getUsername()))
|
||||
.setPosizione(UtilityString.isNull(createUDCRequestDTO.getPosizione(), defaultPosizioneColliAccettazione))
|
||||
.setCodTcol(createUDCRequestDTO.getCodTcol())
|
||||
.setCodJfas(createUDCRequestDTO.getCodJfas())
|
||||
@@ -859,7 +862,7 @@ public class WMSLavorazioneService {
|
||||
|
||||
public String getEtichettaSSCCOrdine(DtbOrdt ordine) throws Exception {
|
||||
ordine.setOperation(OperationType.SELECT_OBJECT);
|
||||
entityProcessor.processEntity(ordine,true,multiDBTransactionManager);
|
||||
entityProcessor.processEntity(ordine, true, multiDBTransactionManager);
|
||||
if (UtilityString.isNullOrEmpty(ordine.getCodProd())) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package it.integry.ems.retail.wms.lavorazione.service;
|
||||
|
||||
import it.integry.ems.jpa.repository.MtbAartRepository;
|
||||
import it.integry.ems.production.service.MesProductionServiceV2;
|
||||
import it.integry.ems.retail.wms.Utility.WMSUtility;
|
||||
import it.integry.ems.retail.wms.exceptions.InvalidArticoloException;
|
||||
@@ -11,7 +12,6 @@ import it.integry.ems.service.EntityProcessor;
|
||||
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
|
||||
import it.integry.ems.user.UserSession;
|
||||
import it.integry.ems.utility.UtilityEntity;
|
||||
import it.integry.ems.utility.entity.MtbAartUtils;
|
||||
import it.integry.ems_model.base.EntityBase;
|
||||
import it.integry.ems_model.entity.*;
|
||||
import it.integry.ems_model.service.SetupGest;
|
||||
@@ -52,6 +52,8 @@ public class WMSMaterialiService {
|
||||
private UserSession userSession;
|
||||
|
||||
private final Logger logger = LogManager.getLogger();
|
||||
@Autowired
|
||||
private MtbAartRepository mtbAartRepository;
|
||||
|
||||
public VersaMaterialiResponseDTO versa(VersaMaterialiRequestDTO request) throws Exception {
|
||||
final boolean versamentoDirettoEnabled = setupGest.getSetupBoolean(multiDBTransactionManager.getPrimaryConnection(), "PICKING", "PRODUZIONE", "FLAG_VERSAMENTO_DIRETTO");
|
||||
@@ -94,9 +96,8 @@ public class WMSMaterialiService {
|
||||
if (!versamentoDirettoEnabled) {
|
||||
MvwSitArtUdcDetInventarioDTO itemDaVersare = artsInGiacenza.get(0);
|
||||
|
||||
MtbAart mtbAart = MtbAartUtils.getArticoloByCodMart(itemDaVersare.getCodMart(), multiDBTransactionManager.getPrimaryConnection());
|
||||
if (mtbAart == null)
|
||||
throw new InvalidArticoloException(request.getCodMart());
|
||||
MtbAart mtbAart = mtbAartRepository.findByCodMart(itemDaVersare.getCodMart())
|
||||
.orElseThrow(() -> new InvalidArticoloException(request.getCodMart()));
|
||||
|
||||
if (posizioneVersamento == null)
|
||||
throw new Exception("Posizione di versamento non trovata (" + request.getPosizioneVersamento() + ")");
|
||||
@@ -276,9 +277,8 @@ public class WMSMaterialiService {
|
||||
final boolean versamentoDirettoEnabled = setupGest.getSetupBoolean(multiDBTransactionManager.getPrimaryConnection(), "PICKING", "PRODUZIONE", "FLAG_VERSAMENTO_DIRETTO");
|
||||
final boolean forceAllToColli = setupGest.getSetupBoolean(multiDBTransactionManager.getPrimaryConnection(), "PICKING", "SETUP", "FLAG_FORCE_ALL_TO_COLLI");
|
||||
|
||||
MtbAart mtbAart = MtbAartUtils.getArticoloByCodMart(request.getCodMart(), multiDBTransactionManager.getPrimaryConnection());
|
||||
if (mtbAart == null)
|
||||
throw new InvalidArticoloException(request.getCodMart());
|
||||
MtbAart mtbAart = mtbAartRepository.findByCodMart(request.getCodMart())
|
||||
.orElseThrow(() -> new InvalidArticoloException(request.getCodMart()));
|
||||
|
||||
if (request.getMtbColtCarico() == null)
|
||||
throw new Exception("Indicare una UL in cui effettuare il carico del materiale");
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package it.integry.ems.retail.wms.vendita.service;
|
||||
|
||||
import it.integry.ems.javabeans.RequestDataDTO;
|
||||
import it.integry.ems.jpa.repository.MtbAartRepository;
|
||||
import it.integry.ems.logistic.dto.sm2.FiltroDistribuzioneColloDTO;
|
||||
import it.integry.ems.product.importaz.service.ProductServices;
|
||||
import it.integry.ems.retail.pvmRetail.dto.OrdineInevasoDTO;
|
||||
@@ -19,7 +20,6 @@ import it.integry.ems.service.EntityProcessor;
|
||||
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
|
||||
import it.integry.ems.user.UserSession;
|
||||
import it.integry.ems.utility.UtilityEntity;
|
||||
import it.integry.ems.utility.entity.MtbAartUtils;
|
||||
import it.integry.ems_model.base.EntityBase;
|
||||
import it.integry.ems_model.entity.DtbOrdt;
|
||||
import it.integry.ems_model.entity.MtbAart;
|
||||
@@ -71,6 +71,8 @@ public class WMSSpedizioneService {
|
||||
|
||||
@Autowired
|
||||
private PvmServiceSave pvmServiceSave;
|
||||
@Autowired
|
||||
private MtbAartRepository mtbAartRepository;
|
||||
|
||||
public MtbColt createUDS(CreateUDSRequestDTO createUDSRequestDTO) throws Exception {
|
||||
|
||||
@@ -245,10 +247,8 @@ public class WMSSpedizioneService {
|
||||
entityProcessor.processEntity(targetMtbColt, multiDBTransactionManager);
|
||||
|
||||
|
||||
MtbAart mtbAart = MtbAartUtils.getArticoloByCodMart(insertUDSRowRequestDTO.getCodMart(), multiDBTransactionManager.getPrimaryConnection());
|
||||
if (mtbAart == null)
|
||||
throw new InvalidArticoloException(insertUDSRowRequestDTO.getCodMart());
|
||||
|
||||
MtbAart mtbAart = mtbAartRepository.findByCodMart(insertUDSRowRequestDTO.getCodMart())
|
||||
.orElseThrow(() -> new InvalidArticoloException(insertUDSRowRequestDTO.getCodMart()));
|
||||
|
||||
final MtbColr targetMtbColr = new MtbColr()
|
||||
.setCausale(MtbColr.Causale.DEFAULT)
|
||||
|
||||
5
ems-engine/src/main/resources/configs/jpa.properties
Normal file
5
ems-engine/src/main/resources/configs/jpa.properties
Normal file
@@ -0,0 +1,5 @@
|
||||
hibernate.dialect=org.hibernate.dialect.SQLServer2012Dialect
|
||||
hibernate.show_sql=false
|
||||
hibernate.format_sql=false
|
||||
hibernate.hbm2ddl.auto=none
|
||||
|
||||
@@ -84,6 +84,15 @@
|
||||
<!-- <!– JBoss RESTEasy Loggers –>-->
|
||||
<!-- <AsyncLogger name="org.jboss.resteasy" level="INFO" additivity="false"/>-->
|
||||
|
||||
<!-- <AsyncLogger name="org.hibernate.cache" level="DEBUG" additivity="false" includeLocation="true">-->
|
||||
<!-- <AppenderRef ref="console" />-->
|
||||
<!-- </AsyncLogger>-->
|
||||
|
||||
<!-- <!– Hibernate Statistics Logger –>-->
|
||||
<!-- <AsyncLogger name="org.hibernate.stat" level="DEBUG" additivity="false" includeLocation="true">-->
|
||||
<!-- <AppenderRef ref="console" />-->
|
||||
<!-- </AsyncLogger>-->
|
||||
|
||||
<!-- Application Logger -->
|
||||
<AsyncLogger name="it.integry" level="DEBUG" additivity="false" includeLocation="true">
|
||||
<AppenderRef ref="console" />
|
||||
|
||||
@@ -11,6 +11,8 @@
|
||||
http://www.springframework.org/schema/mvc/spring-mvc-4.3.xsd">
|
||||
<context:component-scan base-package="it.integry"/>
|
||||
|
||||
<import resource="hibernate-context.xml"/>
|
||||
|
||||
<bean id="ppConfig" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
|
||||
<property name="ignoreUnresolvablePlaceholders" value="false"/>
|
||||
<property name="locations">
|
||||
|
||||
62
ems-engine/src/main/resources/spring/hibernate-context.xml
Normal file
62
ems-engine/src/main/resources/spring/hibernate-context.xml
Normal file
@@ -0,0 +1,62 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:jpa="http://www.springframework.org/schema/data/jpa"
|
||||
xmlns:tx="http://www.springframework.org/schema/tx"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||
http://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://www.springframework.org/schema/data/jpa
|
||||
http://www.springframework.org/schema/data/jpa/spring-jpa.xsd
|
||||
http://www.springframework.org/schema/tx
|
||||
http://www.springframework.org/schema/tx/spring-tx.xsd">
|
||||
|
||||
<!-- MultiTenant DataSource -->
|
||||
<bean id="multiTenantDataSource" class="it.integry.ems.jpa.MultiTenantDataSource">
|
||||
<constructor-arg ref="basicConnectionPool"/>
|
||||
<constructor-arg ref="settingsModel"/>
|
||||
</bean>
|
||||
|
||||
<!-- JPA EntityManagerFactory -->
|
||||
<bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
|
||||
<property name="dataSource" ref="multiTenantDataSource"/>
|
||||
<property name="packagesToScan">
|
||||
<list>
|
||||
<value>it.integry.ems_model.entity</value>
|
||||
</list>
|
||||
</property>
|
||||
<property name="jpaVendorAdapter">
|
||||
<bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
|
||||
<property name="showSql" value="false"/>
|
||||
<property name="generateDdl" value="false"/> <!-- Disabilitato per sicurezza su DB esistenti -->
|
||||
</bean>
|
||||
</property>
|
||||
<property name="jpaProperties">
|
||||
<props>
|
||||
<prop key="hibernate.dialect">${hibernate.dialect}</prop>
|
||||
<prop key="hibernate.temp.use_jdbc_metadata_defaults">false</prop> <!-- Per startup più veloce -->
|
||||
<prop key="hibernate.jdbc.lob.non_contextual_creation">true</prop>
|
||||
|
||||
<!-- Cache Configuration -->
|
||||
<!-- La cache di livello 1 (Session Cache) è sempre abilitata in Hibernate e non può essere disattivata. -->
|
||||
<!-- Disabilitiamo esplicitamente la cache di livello 2 per evitare confusioni. -->
|
||||
<prop key="hibernate.cache.use_second_level_cache">false</prop>
|
||||
|
||||
<!-- Abilita le statistiche di Hibernate per monitorare la cache di livello 1 -->
|
||||
<prop key="hibernate.generate_statistics">true</prop>
|
||||
</props>
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<!-- Transaction Manager -->
|
||||
<bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
|
||||
<property name="entityManagerFactory" ref="entityManagerFactory"/>
|
||||
</bean>
|
||||
|
||||
<!-- Abilita i repository JPA -->
|
||||
<jpa:repositories base-package="it.integry.ems.jpa.repository"/>
|
||||
|
||||
<!-- Abilita la gestione delle transazioni tramite annotazioni -->
|
||||
<tx:annotation-driven transaction-manager="transactionManager"/>
|
||||
|
||||
</beans>
|
||||
|
||||
Reference in New Issue
Block a user