Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 8781b406ff | |||
| c9325674d9 | |||
| 99ca1731b1 | |||
| af6f465c0e | |||
| d981e59a7d | |||
| 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"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="DataSourceManagerImpl" format="xml" multifile-model="true">
|
<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>
|
<driver-ref>sqlserver.ms</driver-ref>
|
||||||
<synchronize>true</synchronize>
|
<synchronize>true</synchronize>
|
||||||
<jdbc-driver>com.microsoft.sqlserver.jdbc.SQLServerDriver</jdbc-driver>
|
<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>
|
<working-dir>$ProjectFileDir$</working-dir>
|
||||||
</data-source>
|
</data-source>
|
||||||
</component>
|
</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"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="RemoteRepositoriesConfiguration">
|
<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>
|
<remote-repository>
|
||||||
<option name="id" value="central" />
|
<option name="id" value="central" />
|
||||||
<option name="name" value="Central Repository" />
|
<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>
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
FROM tomcat:9-jre8-alpine
|
|
||||||
|
|
||||||
RUN apk add --no-cache fontconfig ttf-dejavu
|
|
||||||
|
|
||||||
ENV TZ="Europe/Rome"
|
|
||||||
ENV JAVA_OPTS="-DDISABLE_DROOLS_COMPILE=TRUE -Xms512M -Xmx1G -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005"
|
|
||||||
ENV USERDOMAIN="STUDIO-ML"
|
|
||||||
|
|
||||||
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/
|
|
||||||
COPY ems-engine/target/ems-api.war /usr/local/tomcat/webapps/
|
|
||||||
|
|
||||||
#COPY docker/FontTest.class .
|
|
||||||
#ENTRYPOINT ["java","FontTest"]
|
|
||||||
|
|
||||||
EXPOSE 8080
|
|
||||||
EXPOSE 5005
|
|
||||||
40
Dockerfile
40
Dockerfile
@@ -1,11 +1,45 @@
|
|||||||
FROM tomcat:9-jre8-alpine
|
FROM tomcat:9-jre8
|
||||||
|
|
||||||
RUN apk add --no-cache fontconfig ttf-dejavu
|
|
||||||
|
|
||||||
ENV TZ="Europe/Rome"
|
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 JAVA_OPTS="-DDISABLE_DROOLS_COMPILE=TRUE -Xms512M -Xmx2G -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005"
|
||||||
ENV USERDOMAIN="STUDIO-ML"
|
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.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_automated_operations.json /usr/local/tomcat/conf/integry/
|
||||||
COPY docker/tomcat/conf/integry/ems_settings.json /usr/local/tomcat/conf/integry/
|
COPY docker/tomcat/conf/integry/ems_settings.json /usr/local/tomcat/conf/integry/
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ pipeline {
|
|||||||
bat(script: 'mvn clean install -t toolchains-jenkins.xml', returnStdout: true)
|
bat(script: 'mvn clean install -t toolchains-jenkins.xml', returnStdout: true)
|
||||||
archiveArtifacts(artifacts: 'ems-engine/target/ems-api.war', onlyIfSuccessful: true)
|
archiveArtifacts(artifacts: 'ems-engine/target/ems-api.war', onlyIfSuccessful: true)
|
||||||
}
|
}
|
||||||
stash includes: 'ems-engine/target/ems-api.war,docker/**,Containerfile', name: 'container-files'
|
stash includes: 'ems-engine/target/ems-api.war,docker/**,Dockerfile', name: 'container-files'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -128,7 +128,7 @@ sleep 10''', execTimeout: 120000, flatten: false, makeEmptyDirs: false, noDefaul
|
|||||||
}
|
}
|
||||||
|
|
||||||
// bat "docker buildx build --platform linux/amd64,linux/arm64 --push -t \"git.studioml.it/integry/ems-api${branchVersion}:latest\" ."
|
// bat "docker buildx build --platform linux/amd64,linux/arm64 --push -t \"git.studioml.it/integry/ems-api${branchVersion}:latest\" ."
|
||||||
bat "podman build -f .\\Containerfile -t \"git.studioml.it/integry/ems-api${branchVersion}:latest\" ."
|
bat "podman build -t \"git.studioml.it/integry/ems-api${branchVersion}:latest\" ."
|
||||||
bat "podman push \"git.studioml.it/integry/ems-api${branchVersion}:latest\""
|
bat "podman push \"git.studioml.it/integry/ems-api${branchVersion}:latest\""
|
||||||
|
|
||||||
//containerImageLink "git.studioml.it/integry/ems-api-${env.GIT_BRANCH.toLowerCase().replace('/', '-')}:latest}"
|
//containerImageLink "git.studioml.it/integry/ems-api-${env.GIT_BRANCH.toLowerCase().replace('/', '-')}:latest}"
|
||||||
|
|||||||
@@ -404,6 +404,17 @@
|
|||||||
<artifactId>spring-orm</artifactId>
|
<artifactId>spring-orm</artifactId>
|
||||||
<version>${spring.version}</version>
|
<version>${spring.version}</version>
|
||||||
</dependency>
|
</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>
|
<dependency>
|
||||||
<groupId>org.springframework</groupId>
|
<groupId>org.springframework</groupId>
|
||||||
<artifactId>spring-context-support</artifactId>
|
<artifactId>spring-context-support</artifactId>
|
||||||
|
|||||||
@@ -28,9 +28,6 @@ public class DbmsChangeTrackerComponent {
|
|||||||
private final HashMap<IntegryCustomerDB, DbmsChangeTracker> activeChangeTrackers = new HashMap<>();
|
private final HashMap<IntegryCustomerDB, DbmsChangeTracker> activeChangeTrackers = new HashMap<>();
|
||||||
|
|
||||||
private final ArrayList<String> trackedTables = new ArrayList<String>() {{
|
private final ArrayList<String> trackedTables = new ArrayList<String>() {{
|
||||||
add(MtbAart.ENTITY);
|
|
||||||
add(MtbAartBarCode.ENTITY);
|
|
||||||
add(MtbUntMis.ENTITY);
|
|
||||||
add(MtbDepo.ENTITY);
|
add(MtbDepo.ENTITY);
|
||||||
add(MtbDepoPosizioni.ENTITY);
|
add(MtbDepoPosizioni.ENTITY);
|
||||||
add(StbEditLimit.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>>() {{
|
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(MtbDepo.ENTITY, MtbDepo.class);
|
||||||
put(MtbDepoPosizioni.ENTITY, MtbDepoPosizioni.class);
|
put(MtbDepoPosizioni.ENTITY, MtbDepoPosizioni.class);
|
||||||
put(StbEditLimit.ENTITY, StbEditLimit.class);
|
put(StbEditLimit.ENTITY, StbEditLimit.class);
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package it.integry.ems.javabeans;
|
|||||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||||
import it.integry.common.var.CommonConstants;
|
import it.integry.common.var.CommonConstants;
|
||||||
import it.integry.ems._context.ApplicationContextProvider;
|
import it.integry.ems._context.ApplicationContextProvider;
|
||||||
|
import it.integry.ems.jpa.TenantContext;
|
||||||
import it.integry.ems.json.ResponseJSONObjectMapper;
|
import it.integry.ems.json.ResponseJSONObjectMapper;
|
||||||
import it.integry.ems.migration._base.IntegryCustomerDB;
|
import it.integry.ems.migration._base.IntegryCustomerDB;
|
||||||
import it.integry.ems.model.IntegryApplicationEnum;
|
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.Authentication;
|
||||||
import org.springframework.security.core.context.SecurityContextHolder;
|
import org.springframework.security.core.context.SecurityContextHolder;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
import org.springframework.web.context.WebApplicationContext;
|
||||||
|
|
||||||
import javax.annotation.PostConstruct;
|
import javax.annotation.PostConstruct;
|
||||||
|
import javax.annotation.PreDestroy;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
@Scope("request")
|
@Scope(WebApplicationContext.SCOPE_REQUEST)
|
||||||
public class RequestDataDTO {
|
public class RequestDataDTO {
|
||||||
|
|
||||||
private final Logger logger = LogManager.getLogger();
|
private final Logger logger = LogManager.getLogger();
|
||||||
@@ -100,6 +103,24 @@ public class RequestDataDTO {
|
|||||||
} else {
|
} else {
|
||||||
jsonObjectMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
|
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);
|
||||||
|
}
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
package it.integry.ems.migration.model;
|
||||||
|
|
||||||
|
import it.integry.ems.migration._base.BaseMigration;
|
||||||
|
import it.integry.ems.migration._base.IntegryCustomerDB;
|
||||||
|
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||||
|
|
||||||
|
public class Migration_20251216103055 extends BaseMigration implements MigrationModelInterface {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void up() throws Exception {
|
||||||
|
if (isHistoryDB())
|
||||||
|
return;
|
||||||
|
|
||||||
|
createSetup("PVM", "RILEVAZIONI_STEUP", "FORN_INEVASI", null, "Inserire un json [\n" +
|
||||||
|
"\t{\n" +
|
||||||
|
"\t\t\"partitaIva\": \"\",\n" +
|
||||||
|
"\t\t\"ggCons\": 7\n" +
|
||||||
|
"\t}]", false,
|
||||||
|
null,
|
||||||
|
true, false, false, true, false, null, false, null);
|
||||||
|
|
||||||
|
if (!isCustomerDb(IntegryCustomerDB.Carelli_Winact)) return;
|
||||||
|
|
||||||
|
String json = "[\n" +
|
||||||
|
"\t{\n" +
|
||||||
|
"\t\t\"partitaIva\": \"05848860721\",\n" +
|
||||||
|
"\t\t\"ggCons\": 7\n" +
|
||||||
|
"\t},\n" +
|
||||||
|
"\t{\n" +
|
||||||
|
"\t\t\"partitaIva\": \"05754810728\",\n" +
|
||||||
|
"\t\t\"ggCons\": 7\n" +
|
||||||
|
"\t},\n" +
|
||||||
|
"\t{\n" +
|
||||||
|
"\t\t\"partitaIva\": \"07716650721\",\n" +
|
||||||
|
"\t\t\"ggCons\": 1\n" +
|
||||||
|
"\t}\n" +
|
||||||
|
"]";
|
||||||
|
updateSetupValue("PVM", "RILEVAZIONI_STEUP", "FORN_INEVASI", json);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void down() throws Exception {
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -4,7 +4,8 @@ import com.annimon.stream.ComparatorCompat;
|
|||||||
import com.annimon.stream.Stream;
|
import com.annimon.stream.Stream;
|
||||||
import it.integry.common.var.CommonConstants;
|
import it.integry.common.var.CommonConstants;
|
||||||
import it.integry.ems._context.ApplicationContextProvider;
|
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.json.ResponseJSONObjectMapper;
|
||||||
import it.integry.ems.migration._base.IntegryCustomerDB;
|
import it.integry.ems.migration._base.IntegryCustomerDB;
|
||||||
import it.integry.ems.sync.MultiDBTransaction.Connection;
|
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)
|
public static String completeCodBarre(IntegryCustomerDB customerDB, Connection connection, String codMart)
|
||||||
throws SQLException {
|
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<>();
|
List<HashMap<String, Object>> result = new ArrayList<>();
|
||||||
|
|
||||||
entityCacheComponent.<MtbAart>getCachedEntitiesStream(customerDB, MtbAart.ENTITY,
|
Optional<MtbAart> optMtbAart = mtbAartRepository.findWithBarcodeByCodMart(codMart);
|
||||||
x -> x.getCodMart().equalsIgnoreCase(codMart) && !UtilityString.isNullOrEmpty(x.getBarCode()))
|
|
||||||
.forEach(x -> result.add(new HashMap<String, Object>() {{
|
if (optMtbAart.isPresent()) {
|
||||||
put("cod_mart", x.getCodMart());
|
MtbAart mtbAart = optMtbAart.get();
|
||||||
put("cod_barre", x.getBarCode());
|
|
||||||
|
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_col", null);
|
||||||
put("cod_tagl", null);
|
put("cod_tagl", null);
|
||||||
put("qta_cnf", BigDecimal.ONE);
|
put("qta_cnf", BigDecimal.ONE);
|
||||||
}}));
|
}});
|
||||||
|
}
|
||||||
|
|
||||||
entityCacheComponent.<MtbAart>getCachedEntitiesStream(customerDB, MtbAart.ENTITY,
|
if (!UtilityString.isNullOrEmpty(mtbAart.getCodBarreImb())) {
|
||||||
x -> x.getCodMart().equalsIgnoreCase(codMart) && !UtilityString.isNullOrEmpty(x.getCodBarreImb()))
|
result.add(new HashMap<String, Object>() {{
|
||||||
.forEach(x -> result.add(new HashMap<String, Object>() {{
|
put("cod_mart", mtbAart.getCodMart());
|
||||||
put("cod_mart", x.getCodMart());
|
put("cod_barre", mtbAart.getCodBarreImb());
|
||||||
put("cod_barre", x.getCodBarreImb());
|
|
||||||
put("cod_col", null);
|
put("cod_col", null);
|
||||||
put("cod_tagl", null);
|
put("cod_tagl", null);
|
||||||
put("qta_cnf", x.getQtaCnf());
|
put("qta_cnf", mtbAart.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());
|
|
||||||
}}));
|
|
||||||
|
|
||||||
|
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;
|
String barcode = null;
|
||||||
|
|
||||||
@@ -728,14 +734,12 @@ public class CommonRules extends QueryRules {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static String completeFlagQtaCnfFissa(Connection connection, IntegryCustomerDB customerDB, String codMart) {
|
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 flagQtaCnfFissaArt;
|
||||||
return null;
|
|
||||||
|
|
||||||
return cachedMtbAarts.get(0).getFlagQtaCnfFissa();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getApplicationName(Connection connection) throws Exception {
|
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 {
|
public static List<MtbUntMis> insUntMis(Connection conn, MtbAart mtbAart) throws Exception {
|
||||||
|
MtbUntMisRepository mtbUntMisRepository = ApplicationContextProvider.getApplicationContext().getBean(MtbUntMisRepository.class);
|
||||||
|
|
||||||
List<MtbUntMis> mtbUntMisList = new ArrayList<>();
|
List<MtbUntMis> mtbUntMisList = new ArrayList<>();
|
||||||
List<String> untMisList = new ArrayList<>();
|
List<String> untMisList = new ArrayList<>();
|
||||||
|
|
||||||
@@ -1106,8 +1112,7 @@ public class CommonRules extends QueryRules {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (String untMis : untMisList) {
|
for (String untMis : untMisList) {
|
||||||
String sql = "SELECT count(*) FROM mtb_unt_mis WHERE unt_mis = " + UtilityDB.valueToString(untMis);
|
Integer countUM = mtbUntMisRepository.countByUntMis(untMis);
|
||||||
Integer countUM = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(conn, sql);
|
|
||||||
if (countUM == null || countUM == 0) {
|
if (countUM == null || countUM == 0) {
|
||||||
MtbUntMis mtbUntMis = new MtbUntMis();
|
MtbUntMis mtbUntMis = new MtbUntMis();
|
||||||
mtbUntMis.setUntMis(untMis);
|
mtbUntMis.setUntMis(untMis);
|
||||||
@@ -1378,12 +1383,12 @@ public class CommonRules extends QueryRules {
|
|||||||
public static boolean getChkCompatibilitaCarat(Connection connection, String codMart, String carat) throws SQLException {
|
public static boolean getChkCompatibilitaCarat(Connection connection, String codMart, String carat) throws SQLException {
|
||||||
String sql =
|
String sql =
|
||||||
Query.format("SELECT chk_compatibilita\n" +
|
Query.format("SELECT chk_compatibilita\n" +
|
||||||
"FROM mtb_aart\n" +
|
"FROM mtb_aart\n" +
|
||||||
" INNER JOIN mtb_tipi_carat ON mtb_aart.cod_mtip = mtb_tipi_carat.cod_mtip AND\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" +
|
" mtb_aart.cod_mstp = mtb_tipi_carat.cod_mstp\n" +
|
||||||
"WHERE mtb_aart.cod_mart = %s\n" +
|
"WHERE mtb_aart.cod_mart = %s\n" +
|
||||||
" AND mtb_tipi_carat.carat = %s\n" ,
|
" AND mtb_tipi_carat.carat = %s\n",
|
||||||
codMart, carat);
|
codMart, carat);
|
||||||
|
|
||||||
Boolean chkCompatibilita = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(connection, sql);
|
Boolean chkCompatibilita = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(connection, sql);
|
||||||
if (chkCompatibilita == null) chkCompatibilita = false;
|
if (chkCompatibilita == null) chkCompatibilita = false;
|
||||||
|
|||||||
@@ -2,7 +2,8 @@ package it.integry.ems.rules.completing;
|
|||||||
|
|
||||||
import com.annimon.stream.Stream;
|
import com.annimon.stream.Stream;
|
||||||
import it.integry.ems._context.ApplicationContextProvider;
|
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.migration._base.IntegryCustomerDB;
|
||||||
import it.integry.ems.rules.completing.dto.DatiPartitaMagDTO;
|
import it.integry.ems.rules.completing.dto.DatiPartitaMagDTO;
|
||||||
import it.integry.ems.sync.MultiDBTransaction.Connection;
|
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 {
|
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,
|
BigDecimal cifreDec = mtbUntMisRepository.findCifreDecByFlagUnitaKg("S").stream()
|
||||||
x -> x.getFlagUnitaKg().equalsIgnoreCase("S"))
|
|
||||||
.map(MtbUntMis::getCifreDec)
|
|
||||||
.findFirst()
|
.findFirst()
|
||||||
.orElse(BigDecimal.valueOf(5));
|
.orElse(BigDecimal.valueOf(5));
|
||||||
|
|
||||||
HashMap<String, Object> anagArt = entityCacheComponent.<MtbAart>getCachedEntitiesStream(customerDB, MtbAart.ENTITY,
|
HashMap<String, Object> anagArt = mtbAartRepository.findByCodMart(entity.getCodMart())
|
||||||
x -> x.getCodMart().equalsIgnoreCase(entity.getCodMart()))
|
|
||||||
.map(x -> new HashMap<String, Object>() {{
|
.map(x -> new HashMap<String, Object>() {{
|
||||||
put("unt_mis", x.getUntMis());
|
put("unt_mis", x.getUntMis());
|
||||||
put("tara_kg", x.getTaraKg());
|
put("tara_kg", x.getTaraKg());
|
||||||
@@ -350,7 +349,6 @@ public class PackagesRules extends QueryRules {
|
|||||||
put("flag_peso_egalizzato", x.getFlagPesoEgalizzato());
|
put("flag_peso_egalizzato", x.getFlagPesoEgalizzato());
|
||||||
put("peso_egalizzato", x.getFlagPesoEgalizzato() ? x.getQtaCnf().multiply(x.getPesoKg()) : null);
|
put("peso_egalizzato", x.getFlagPesoEgalizzato() ? x.getQtaCnf().multiply(x.getPesoKg()) : null);
|
||||||
}})
|
}})
|
||||||
.findFirst()
|
|
||||||
.orElse(null);
|
.orElse(null);
|
||||||
|
|
||||||
|
|
||||||
@@ -365,10 +363,8 @@ public class PackagesRules extends QueryRules {
|
|||||||
|
|
||||||
BigDecimal pesoNetto = BigDecimal.ZERO, pesoLordo = BigDecimal.ZERO;
|
BigDecimal pesoNetto = BigDecimal.ZERO, pesoLordo = BigDecimal.ZERO;
|
||||||
if (anagArt != null) {
|
if (anagArt != null) {
|
||||||
String flagUnitaKg = entityCacheComponent.<MtbUntMis>getCachedEntitiesStream(customerDB, MtbUntMis.ENTITY,
|
String flagUnitaKg = mtbUntMisRepository.findByUntMis((String) anagArt.get("unt_mis"))
|
||||||
x -> x.getUntMis().equalsIgnoreCase(String.valueOf(anagArt.get("unt_mis"))))
|
|
||||||
.map(MtbUntMis::getFlagUnitaKg)
|
.map(MtbUntMis::getFlagUnitaKg)
|
||||||
.findFirst()
|
|
||||||
.orElse(null);
|
.orElse(null);
|
||||||
|
|
||||||
BigDecimal taraKg = (BigDecimal) anagArt.get("tara_kg");
|
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 {
|
private void registerDataSourceIfNotExists(AvailableConnectionModel connectionModel) throws Exception {
|
||||||
if (!registeredDatasources.containsKey(connectionModel)) {
|
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.LogManager;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
import org.kie.api.definition.type.PropertyReactive;
|
import org.kie.api.definition.type.PropertyReactive;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
|
|
||||||
|
import javax.persistence.Transient;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
|
@javax.persistence.Entity
|
||||||
|
@javax.persistence.Table(name = MtbAart.ENTITY)
|
||||||
@Master
|
@Master
|
||||||
@PropertyReactive
|
@PropertyReactive
|
||||||
@Table(MtbAart.ENTITY)
|
@Table(MtbAart.ENTITY)
|
||||||
@@ -32,344 +34,462 @@ public class MtbAart extends EntityBase implements EquatableEntityInterface<MtbA
|
|||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@javax.persistence.Id
|
||||||
|
@javax.persistence.Column(name = "cod_mart")
|
||||||
@PK
|
@PK
|
||||||
@SqlField(value = "cod_mart", maxLength = 15, nullable = false)
|
@SqlField(value = "cod_mart", maxLength = 15, nullable = false)
|
||||||
private String codMart;
|
private String codMart;
|
||||||
|
|
||||||
|
@javax.persistence.Column(name = "descrizione")
|
||||||
@SqlField(value = "descrizione", maxLength = 40, nullable = false)
|
@SqlField(value = "descrizione", maxLength = 40, nullable = false)
|
||||||
private String descrizione;
|
private String descrizione;
|
||||||
|
|
||||||
|
@javax.persistence.Column(name = "unt_mis")
|
||||||
@FK(tableName = "mtb_unt_mis", columnName = "unt_mis")
|
@FK(tableName = "mtb_unt_mis", columnName = "unt_mis")
|
||||||
@SqlField(value = "unt_mis", maxLength = 3, nullable = false)
|
@SqlField(value = "unt_mis", maxLength = 3, nullable = false)
|
||||||
private String untMis;
|
private String untMis;
|
||||||
|
|
||||||
|
@javax.persistence.Column(name = "bar_code")
|
||||||
@SqlField(value = "bar_code", maxLength = 40)
|
@SqlField(value = "bar_code", maxLength = 40)
|
||||||
private String barCode;
|
private String barCode;
|
||||||
|
|
||||||
|
@javax.persistence.Column(name = "peso_kg")
|
||||||
@SqlField(value = "peso_kg", nullable = false, defaultObjectValue = "0")
|
@SqlField(value = "peso_kg", nullable = false, defaultObjectValue = "0")
|
||||||
private BigDecimal pesoKg;
|
private BigDecimal pesoKg;
|
||||||
|
|
||||||
|
@javax.persistence.Column(name = "qta_cnf")
|
||||||
@SqlField(value = "qta_cnf", nullable = false, defaultObjectValue = "1")
|
@SqlField(value = "qta_cnf", nullable = false, defaultObjectValue = "1")
|
||||||
private BigDecimal qtaCnf;
|
private BigDecimal qtaCnf;
|
||||||
|
|
||||||
|
@javax.persistence.Column(name = "cod_aliq")
|
||||||
@SqlField(value = "cod_aliq", maxLength = 5)
|
@SqlField(value = "cod_aliq", maxLength = 5)
|
||||||
private String codAliq;
|
private String codAliq;
|
||||||
|
|
||||||
|
@javax.persistence.Column(name = "cod_sco_art")
|
||||||
@SqlField(value = "cod_sco_art", maxLength = 5)
|
@SqlField(value = "cod_sco_art", maxLength = 5)
|
||||||
private String codScoArt;
|
private String codScoArt;
|
||||||
|
|
||||||
|
@javax.persistence.Column(name = "cod_tcol_ui")
|
||||||
@SqlField(value = "cod_tcol_ui")
|
@SqlField(value = "cod_tcol_ui")
|
||||||
private String codTcolUi;
|
private String codTcolUi;
|
||||||
|
|
||||||
|
@javax.persistence.Column(name = "cod_tcol_ul")
|
||||||
@SqlField(value = "cod_tcol_ul")
|
@SqlField(value = "cod_tcol_ul")
|
||||||
private String codTcolUl;
|
private String codTcolUl;
|
||||||
|
|
||||||
|
@javax.persistence.Column(name = "articolo_composto")
|
||||||
@SqlField(value = "articolo_composto", maxLength = 1, nullable = false, defaultObjectValue = "N")
|
@SqlField(value = "articolo_composto", maxLength = 1, nullable = false, defaultObjectValue = "N")
|
||||||
private String articoloComposto;
|
private String articoloComposto;
|
||||||
|
|
||||||
|
@javax.persistence.Column(name = "esposizione_comp")
|
||||||
@SqlField(value = "esposizione_comp", maxLength = 1, nullable = false, defaultObjectValue = "N")
|
@SqlField(value = "esposizione_comp", maxLength = 1, nullable = false, defaultObjectValue = "N")
|
||||||
private String esposizioneComp;
|
private String esposizioneComp;
|
||||||
|
|
||||||
|
@javax.persistence.Column(name = "descrizione_estesa")
|
||||||
@SqlField(value = "descrizione_estesa", maxLength = 4096)
|
@SqlField(value = "descrizione_estesa", maxLength = 4096)
|
||||||
private String descrizioneEstesa;
|
private String descrizioneEstesa;
|
||||||
|
|
||||||
|
@javax.persistence.Column(name = "cod_ult_forn")
|
||||||
@SqlField(value = "cod_ult_forn", maxLength = 5)
|
@SqlField(value = "cod_ult_forn", maxLength = 5)
|
||||||
private String codUltForn;
|
private String codUltForn;
|
||||||
|
|
||||||
|
@javax.persistence.Column(name = "data_ult_car")
|
||||||
@SqlField(value = "data_ult_car")
|
@SqlField(value = "data_ult_car")
|
||||||
private Date dataUltCar;
|
private Date dataUltCar;
|
||||||
|
|
||||||
|
@javax.persistence.Column(name = "val_ult_car")
|
||||||
@SqlField(value = "val_ult_car")
|
@SqlField(value = "val_ult_car")
|
||||||
private BigDecimal valUltCar;
|
private BigDecimal valUltCar;
|
||||||
|
|
||||||
|
@javax.persistence.Column(name = "cod_ult_clie")
|
||||||
@SqlField(value = "cod_ult_clie", maxLength = 5)
|
@SqlField(value = "cod_ult_clie", maxLength = 5)
|
||||||
private String codUltClie;
|
private String codUltClie;
|
||||||
|
|
||||||
|
@javax.persistence.Column(name = "data_ult_scar")
|
||||||
@SqlField(value = "data_ult_scar")
|
@SqlField(value = "data_ult_scar")
|
||||||
private Date dataUltScar;
|
private Date dataUltScar;
|
||||||
|
|
||||||
|
@javax.persistence.Column(name = "val_ult_scar")
|
||||||
@SqlField(value = "val_ult_scar")
|
@SqlField(value = "val_ult_scar")
|
||||||
private BigDecimal valUltScar;
|
private BigDecimal valUltScar;
|
||||||
|
|
||||||
|
@javax.persistence.Column(name = "tipo_codice")
|
||||||
@SqlField(value = "tipo_codice", maxLength = 10)
|
@SqlField(value = "tipo_codice", maxLength = 10)
|
||||||
private String tipoCodice;
|
private String tipoCodice;
|
||||||
|
|
||||||
|
@javax.persistence.Column(name = "note")
|
||||||
@SqlField(value = "note", maxLength = 255)
|
@SqlField(value = "note", maxLength = 255)
|
||||||
private String note;
|
private String note;
|
||||||
|
|
||||||
|
@javax.persistence.Column(name = "posizione")
|
||||||
@SqlField(value = "posizione", maxLength = 15)
|
@SqlField(value = "posizione", maxLength = 15)
|
||||||
private String posizione;
|
private String posizione;
|
||||||
|
|
||||||
|
@javax.persistence.Column(name = "colli_pedana")
|
||||||
@SqlField(value = "colli_pedana", defaultObjectValue = "1")
|
@SqlField(value = "colli_pedana", defaultObjectValue = "1")
|
||||||
private BigDecimal colliPedana;
|
private BigDecimal colliPedana;
|
||||||
|
|
||||||
|
@javax.persistence.Column(name = "unt_mis2")
|
||||||
@FK(tableName = "mtb_unt_mis", columnName = "unt_mis")
|
@FK(tableName = "mtb_unt_mis", columnName = "unt_mis")
|
||||||
@SqlField(value = "unt_mis2", maxLength = 3)
|
@SqlField(value = "unt_mis2", maxLength = 3)
|
||||||
private String untMis2;
|
private String untMis2;
|
||||||
|
|
||||||
|
@javax.persistence.Column(name = "rap_conv2")
|
||||||
@SqlField(value = "rap_conv2", defaultObjectValue = "1")
|
@SqlField(value = "rap_conv2", defaultObjectValue = "1")
|
||||||
private BigDecimal rapConv2;
|
private BigDecimal rapConv2;
|
||||||
|
|
||||||
|
@javax.persistence.Column(name = "flag_incl_listino")
|
||||||
@SqlField(value = "flag_incl_listino", maxLength = 1, nullable = false, defaultObjectValue = "S")
|
@SqlField(value = "flag_incl_listino", maxLength = 1, nullable = false, defaultObjectValue = "S")
|
||||||
private String flagInclListino;
|
private String flagInclListino;
|
||||||
|
|
||||||
|
@javax.persistence.Column(name = "unt_mis3")
|
||||||
@FK(tableName = "mtb_unt_mis", columnName = "unt_mis")
|
@FK(tableName = "mtb_unt_mis", columnName = "unt_mis")
|
||||||
@SqlField(value = "unt_mis3", maxLength = 3)
|
@SqlField(value = "unt_mis3", maxLength = 3)
|
||||||
private String untMis3;
|
private String untMis3;
|
||||||
|
|
||||||
|
@javax.persistence.Column(name = "rap_conv3")
|
||||||
@SqlField(value = "rap_conv3", defaultObjectValue = "1")
|
@SqlField(value = "rap_conv3", defaultObjectValue = "1")
|
||||||
private BigDecimal rapConv3;
|
private BigDecimal rapConv3;
|
||||||
|
|
||||||
|
@javax.persistence.Column(name = "cod_mart_stat")
|
||||||
@SqlField(value = "cod_mart_stat", maxLength = 15)
|
@SqlField(value = "cod_mart_stat", maxLength = 15)
|
||||||
private String codMartStat;
|
private String codMartStat;
|
||||||
|
|
||||||
|
@javax.persistence.Column(name = "cod_mcon")
|
||||||
@SqlField(value = "cod_mcon", maxLength = 5)
|
@SqlField(value = "cod_mcon", maxLength = 5)
|
||||||
private String codMcon;
|
private String codMcon;
|
||||||
|
|
||||||
|
@javax.persistence.Column(name = "cod_mgrp")
|
||||||
@SqlField(value = "cod_mgrp", maxLength = 5, nullable = false)
|
@SqlField(value = "cod_mgrp", maxLength = 5, nullable = false)
|
||||||
private String codMgrp;
|
private String codMgrp;
|
||||||
|
|
||||||
|
@javax.persistence.Column(name = "cod_msfa")
|
||||||
@SqlField(value = "cod_msfa", maxLength = 6)
|
@SqlField(value = "cod_msfa", maxLength = 6)
|
||||||
private String codMsfa;
|
private String codMsfa;
|
||||||
|
|
||||||
|
@javax.persistence.Column(name = "cod_msgr")
|
||||||
@SqlField(value = "cod_msgr", maxLength = 5, nullable = false)
|
@SqlField(value = "cod_msgr", maxLength = 5, nullable = false)
|
||||||
private String codMsgr;
|
private String codMsgr;
|
||||||
|
|
||||||
|
@javax.persistence.Column(name = "cod_mstp")
|
||||||
@SqlField(value = "cod_mstp", maxLength = 5)
|
@SqlField(value = "cod_mstp", maxLength = 5)
|
||||||
private String codMstp;
|
private String codMstp;
|
||||||
|
|
||||||
|
@javax.persistence.Column(name = "cod_mtip")
|
||||||
@SqlField(value = "cod_mtip", maxLength = 5)
|
@SqlField(value = "cod_mtip", maxLength = 5)
|
||||||
private String codMtip;
|
private String codMtip;
|
||||||
|
|
||||||
|
@javax.persistence.Column(name = "descrizione_stat")
|
||||||
@SqlField(value = "descrizione_stat", maxLength = 40)
|
@SqlField(value = "descrizione_stat", maxLength = 40)
|
||||||
private String descrizioneStat;
|
private String descrizioneStat;
|
||||||
|
|
||||||
|
@javax.persistence.Column(name = "flag_stato")
|
||||||
@SqlField(value = "flag_stato", maxLength = 1, nullable = false, defaultObjectValue = "A")
|
@SqlField(value = "flag_stato", maxLength = 1, nullable = false, defaultObjectValue = "A")
|
||||||
private String flagStato;
|
private String flagStato;
|
||||||
|
|
||||||
|
@javax.persistence.Column(name = "cambio_divi_car")
|
||||||
@SqlField(value = "cambio_divi_car", nullable = false)
|
@SqlField(value = "cambio_divi_car", nullable = false)
|
||||||
private BigDecimal cambioDiviCar;
|
private BigDecimal cambioDiviCar;
|
||||||
|
|
||||||
|
@javax.persistence.Column(name = "cambio_divi_scar")
|
||||||
@SqlField(value = "cambio_divi_scar", nullable = false)
|
@SqlField(value = "cambio_divi_scar", nullable = false)
|
||||||
private BigDecimal cambioDiviScar;
|
private BigDecimal cambioDiviScar;
|
||||||
|
|
||||||
|
@javax.persistence.Column(name = "gg_scad_partita")
|
||||||
@SqlField(value = "gg_scad_partita", nullable = false, defaultObjectValue = "0")
|
@SqlField(value = "gg_scad_partita", nullable = false, defaultObjectValue = "0")
|
||||||
private Integer ggScadPartita;
|
private Integer ggScadPartita;
|
||||||
|
|
||||||
|
@javax.persistence.Column(name = "volume_mc")
|
||||||
@SqlField(value = "volume_mc", defaultObjectValue = "0")
|
@SqlField(value = "volume_mc", defaultObjectValue = "0")
|
||||||
private BigDecimal volumeMc;
|
private BigDecimal volumeMc;
|
||||||
|
|
||||||
|
@javax.persistence.Column(name = "flag_esponi_prz")
|
||||||
@SqlField(value = "flag_esponi_prz", maxLength = 1, nullable = false, defaultObjectValue = "N")
|
@SqlField(value = "flag_esponi_prz", maxLength = 1, nullable = false, defaultObjectValue = "N")
|
||||||
private String flagEsponiPrz;
|
private String flagEsponiPrz;
|
||||||
|
|
||||||
|
@javax.persistence.Column(name = "data_ult_var")
|
||||||
@SqlField(value = "data_ult_var", format = CommonConstants.SYSDATE)
|
@SqlField(value = "data_ult_var", format = CommonConstants.SYSDATE)
|
||||||
private Date dataUltVar;
|
private Date dataUltVar;
|
||||||
|
|
||||||
|
@javax.persistence.Column(name = "perc_sfrido")
|
||||||
@SqlField(value = "perc_sfrido", nullable = false, defaultObjectValue = "0")
|
@SqlField(value = "perc_sfrido", nullable = false, defaultObjectValue = "0")
|
||||||
private BigDecimal percSfrido;
|
private BigDecimal percSfrido;
|
||||||
|
|
||||||
|
@javax.persistence.Column(name = "cod_barre_imb")
|
||||||
@SqlField(value = "cod_barre_imb", maxLength = 40)
|
@SqlField(value = "cod_barre_imb", maxLength = 40)
|
||||||
private String codBarreImb;
|
private String codBarreImb;
|
||||||
|
|
||||||
|
@javax.persistence.Column(name = "flag_calc_prz")
|
||||||
@SqlField(value = "flag_calc_prz", maxLength = 1, nullable = false, defaultObjectValue = "K")
|
@SqlField(value = "flag_calc_prz", maxLength = 1, nullable = false, defaultObjectValue = "K")
|
||||||
private String flagCalcPrz;
|
private String flagCalcPrz;
|
||||||
|
|
||||||
|
@javax.persistence.Column(name = "esposizione_comp_acq")
|
||||||
@SqlField(value = "esposizione_comp_acq", maxLength = 1, nullable = false, defaultObjectValue = "N")
|
@SqlField(value = "esposizione_comp_acq", maxLength = 1, nullable = false, defaultObjectValue = "N")
|
||||||
private String esposizioneCompAcq;
|
private String esposizioneCompAcq;
|
||||||
|
|
||||||
|
@javax.persistence.Column(name = "flag_calc_prz_acq")
|
||||||
@SqlField(value = "flag_calc_prz_acq", maxLength = 1, nullable = false, defaultObjectValue = "K")
|
@SqlField(value = "flag_calc_prz_acq", maxLength = 1, nullable = false, defaultObjectValue = "K")
|
||||||
private String flagCalcPrzAcq;
|
private String flagCalcPrzAcq;
|
||||||
|
|
||||||
|
@javax.persistence.Column(name = "diacod")
|
||||||
@SqlField(value = "diacod", maxLength = 40)
|
@SqlField(value = "diacod", maxLength = 40)
|
||||||
private String diacod;
|
private String diacod;
|
||||||
|
|
||||||
|
@javax.persistence.Column(name = "plu")
|
||||||
@SqlField(value = "plu", maxLength = 6)
|
@SqlField(value = "plu", maxLength = 6)
|
||||||
private String plu;
|
private String plu;
|
||||||
|
|
||||||
|
@javax.persistence.Column(name = "part_iva_prod")
|
||||||
@SqlField(value = "part_iva_prod", maxLength = 20)
|
@SqlField(value = "part_iva_prod", maxLength = 20)
|
||||||
private String partIvaProd;
|
private String partIvaProd;
|
||||||
|
|
||||||
|
@javax.persistence.Column(name = "rag_soc_prod")
|
||||||
@SqlField(value = "rag_soc_prod", maxLength = 40)
|
@SqlField(value = "rag_soc_prod", maxLength = 40)
|
||||||
private String ragSocProd;
|
private String ragSocProd;
|
||||||
|
|
||||||
|
@javax.persistence.Column(name = "flag_rap_conv_variabile")
|
||||||
@SqlField(value = "flag_rap_conv_variabile", maxLength = 1, nullable = false, defaultObjectValue = "N")
|
@SqlField(value = "flag_rap_conv_variabile", maxLength = 1, nullable = false, defaultObjectValue = "N")
|
||||||
private String flagRapConvVariabile;
|
private String flagRapConvVariabile;
|
||||||
|
|
||||||
|
@javax.persistence.Column(name = "flag_mov_art_mag")
|
||||||
@SqlField(value = "flag_mov_art_mag", maxLength = 1, nullable = false, defaultObjectValue = "S")
|
@SqlField(value = "flag_mov_art_mag", maxLength = 1, nullable = false, defaultObjectValue = "S")
|
||||||
private String flagMovArtMag;
|
private String flagMovArtMag;
|
||||||
|
|
||||||
|
@javax.persistence.Column(name = "flag_tracciabilita")
|
||||||
@SqlField(value = "flag_tracciabilita", maxLength = 1, nullable = false, defaultObjectValue = "N")
|
@SqlField(value = "flag_tracciabilita", maxLength = 1, nullable = false, defaultObjectValue = "N")
|
||||||
private String flagTracciabilita;
|
private String flagTracciabilita;
|
||||||
|
|
||||||
|
@javax.persistence.Column(name = "tara_kg")
|
||||||
@SqlField(value = "tara_kg", defaultObjectValue = "0")
|
@SqlField(value = "tara_kg", defaultObjectValue = "0")
|
||||||
private BigDecimal taraKg;
|
private BigDecimal taraKg;
|
||||||
|
|
||||||
|
@javax.persistence.Column(name = "colli_strato")
|
||||||
@SqlField(value = "colli_strato", nullable = false, defaultObjectValue = "1")
|
@SqlField(value = "colli_strato", nullable = false, defaultObjectValue = "1")
|
||||||
private BigDecimal colliStrato;
|
private BigDecimal colliStrato;
|
||||||
|
|
||||||
|
@javax.persistence.Column(name = "flag_qta_cnf_fissa")
|
||||||
@SqlField(value = "flag_qta_cnf_fissa", maxLength = 1, nullable = false, defaultObjectValue = "S")
|
@SqlField(value = "flag_qta_cnf_fissa", maxLength = 1, nullable = false, defaultObjectValue = "S")
|
||||||
private String flagQtaCnfFissa;
|
private String flagQtaCnfFissa;
|
||||||
|
|
||||||
|
@javax.persistence.Column(name = "flag_colli_pedana_fisso")
|
||||||
@SqlField(value = "flag_colli_pedana_fisso", maxLength = 1, nullable = false, defaultObjectValue = "S")
|
@SqlField(value = "flag_colli_pedana_fisso", maxLength = 1, nullable = false, defaultObjectValue = "S")
|
||||||
private String flagColliPedanaFisso;
|
private String flagColliPedanaFisso;
|
||||||
|
|
||||||
|
@javax.persistence.Column(name = "cod_ccon_costi")
|
||||||
@SqlField(value = "cod_ccon_costi", maxLength = 6)
|
@SqlField(value = "cod_ccon_costi", maxLength = 6)
|
||||||
private String codCconCosti;
|
private String codCconCosti;
|
||||||
|
|
||||||
|
@javax.persistence.Column(name = "cod_ccon_ricavi")
|
||||||
@SqlField(value = "cod_ccon_ricavi", maxLength = 6)
|
@SqlField(value = "cod_ccon_ricavi", maxLength = 6)
|
||||||
private String codCconRicavi;
|
private String codCconRicavi;
|
||||||
|
|
||||||
|
@javax.persistence.Column(name = "cod_dgrp_art")
|
||||||
@SqlField(value = "cod_dgrp_art", maxLength = 5)
|
@SqlField(value = "cod_dgrp_art", maxLength = 5)
|
||||||
private String codDgrpArt;
|
private String codDgrpArt;
|
||||||
|
|
||||||
|
@javax.persistence.Column(name = "cod_divi_car")
|
||||||
@SqlField(value = "cod_divi_car", maxLength = 5, nullable = false)
|
@SqlField(value = "cod_divi_car", maxLength = 5, nullable = false)
|
||||||
private String codDiviCar;
|
private String codDiviCar;
|
||||||
|
|
||||||
|
@javax.persistence.Column(name = "cod_divi_scar")
|
||||||
@SqlField(value = "cod_divi_scar", maxLength = 5, nullable = false)
|
@SqlField(value = "cod_divi_scar", maxLength = 5, nullable = false)
|
||||||
private String codDiviScar;
|
private String codDiviScar;
|
||||||
|
|
||||||
|
@javax.persistence.Column(name = "cod_ecr_cat")
|
||||||
@SqlField(value = "cod_ecr_cat", maxLength = 10)
|
@SqlField(value = "cod_ecr_cat", maxLength = 10)
|
||||||
private String codEcrCat;
|
private String codEcrCat;
|
||||||
|
|
||||||
|
@javax.persistence.Column(name = "cod_ecr_mcat")
|
||||||
@SqlField(value = "cod_ecr_mcat", maxLength = 10)
|
@SqlField(value = "cod_ecr_mcat", maxLength = 10)
|
||||||
private String codEcrMcat;
|
private String codEcrMcat;
|
||||||
|
|
||||||
|
@javax.persistence.Column(name = "cod_ecr_rep")
|
||||||
@SqlField(value = "cod_ecr_rep", maxLength = 10)
|
@SqlField(value = "cod_ecr_rep", maxLength = 10)
|
||||||
private String codEcrRep;
|
private String codEcrRep;
|
||||||
|
|
||||||
|
@javax.persistence.Column(name = "cod_ecr_stipo")
|
||||||
@SqlField(value = "cod_ecr_stipo", maxLength = 10)
|
@SqlField(value = "cod_ecr_stipo", maxLength = 10)
|
||||||
private String codEcrStipo;
|
private String codEcrStipo;
|
||||||
|
|
||||||
|
@javax.persistence.Column(name = "cod_ecr_tipo")
|
||||||
@SqlField(value = "cod_ecr_tipo", maxLength = 10)
|
@SqlField(value = "cod_ecr_tipo", maxLength = 10)
|
||||||
private String codEcrTipo;
|
private String codEcrTipo;
|
||||||
|
|
||||||
|
@javax.persistence.Column(name = "cod_grp_bolla")
|
||||||
@SqlField(value = "cod_grp_bolla", maxLength = 5)
|
@SqlField(value = "cod_grp_bolla", maxLength = 5)
|
||||||
private String codGrpBolla;
|
private String codGrpBolla;
|
||||||
|
|
||||||
|
@javax.persistence.Column(name = "ingredienti")
|
||||||
@SqlField(value = "ingredienti", maxLength = 8000)
|
@SqlField(value = "ingredienti", maxLength = 8000)
|
||||||
private String ingredienti;
|
private String ingredienti;
|
||||||
|
|
||||||
|
@javax.persistence.Column(name = "id_art_equi")
|
||||||
@SqlField(value = "id_art_equi", maxLength = 25)
|
@SqlField(value = "id_art_equi", maxLength = 25)
|
||||||
private String idArtEqui;
|
private String idArtEqui;
|
||||||
|
|
||||||
|
@javax.persistence.Column(name = "descr_cassa")
|
||||||
@SqlField(value = "descr_cassa", maxLength = 40)
|
@SqlField(value = "descr_cassa", maxLength = 40)
|
||||||
private String descrCassa;
|
private String descrCassa;
|
||||||
|
|
||||||
|
@javax.persistence.Column(name = "cod_nc_intracee")
|
||||||
@SqlField(value = "cod_nc_intracee", maxLength = 20)
|
@SqlField(value = "cod_nc_intracee", maxLength = 20)
|
||||||
private String codNcIntracee;
|
private String codNcIntracee;
|
||||||
|
|
||||||
|
@javax.persistence.Column(name = "marchio")
|
||||||
@SqlField(value = "marchio", maxLength = 255)
|
@SqlField(value = "marchio", maxLength = 255)
|
||||||
private String marchio;
|
private String marchio;
|
||||||
|
|
||||||
|
@javax.persistence.Column(name = "sezione")
|
||||||
@SqlField(value = "sezione")
|
@SqlField(value = "sezione")
|
||||||
private Integer sezione;
|
private Integer sezione;
|
||||||
|
|
||||||
|
@javax.persistence.Column(name = "tipo_reg")
|
||||||
@SqlField(value = "tipo_reg", maxLength = 1)
|
@SqlField(value = "tipo_reg", maxLength = 1)
|
||||||
private String tipoReg;
|
private String tipoReg;
|
||||||
|
|
||||||
|
@javax.persistence.Column(name = "tipo_stock")
|
||||||
@SqlField(value = "tipo_stock", maxLength = 1)
|
@SqlField(value = "tipo_stock", maxLength = 1)
|
||||||
private String tipoStock;
|
private String tipoStock;
|
||||||
|
|
||||||
|
@javax.persistence.Column(name = "qta_multipla_ord")
|
||||||
@SqlField(value = "qta_multipla_ord")
|
@SqlField(value = "qta_multipla_ord")
|
||||||
private BigDecimal qtaMultiplaOrd;
|
private BigDecimal qtaMultiplaOrd;
|
||||||
|
|
||||||
@MapToTable(value = "flag_kit")
|
@MapToTable(value = "flag_kit")
|
||||||
|
@Transient
|
||||||
private String flagKit;
|
private String flagKit;
|
||||||
|
|
||||||
|
@javax.persistence.Column(name = "cod_forn_cv")
|
||||||
@SqlField(value = "cod_forn_cv", maxLength = 5)
|
@SqlField(value = "cod_forn_cv", maxLength = 5)
|
||||||
private String codFornCv;
|
private String codFornCv;
|
||||||
|
|
||||||
|
@javax.persistence.Column(name = "cpa")
|
||||||
@SqlField(value = "cpa", maxLength = 5)
|
@SqlField(value = "cpa", maxLength = 5)
|
||||||
private String cpa;
|
private String cpa;
|
||||||
|
|
||||||
|
@javax.persistence.Column(name = "taric")
|
||||||
@SqlField(value = "taric", maxLength = 5)
|
@SqlField(value = "taric", maxLength = 5)
|
||||||
private String taric;
|
private String taric;
|
||||||
|
|
||||||
|
@javax.persistence.Column(name = "sezione_dogana")
|
||||||
@SqlField(value = "sezione_dogana", maxLength = 6)
|
@SqlField(value = "sezione_dogana", maxLength = 6)
|
||||||
private String sezioneDogana;
|
private String sezioneDogana;
|
||||||
|
|
||||||
|
@javax.persistence.Column(name = "flag_peso_egalizzato")
|
||||||
@SqlField(value = "flag_peso_egalizzato", nullable = false, defaultObjectValue = "0")
|
@SqlField(value = "flag_peso_egalizzato", nullable = false, defaultObjectValue = "0")
|
||||||
private Boolean flagPesoEgalizzato;
|
private Boolean flagPesoEgalizzato;
|
||||||
|
|
||||||
|
@javax.persistence.Column(name = "cod_jfas_costi")
|
||||||
@SqlField(value = "cod_jfas_costi", maxLength = 5)
|
@SqlField(value = "cod_jfas_costi", maxLength = 5)
|
||||||
private String codJfasCosti;
|
private String codJfasCosti;
|
||||||
|
|
||||||
|
@javax.persistence.Column(name = "cod_jfas_ricavi")
|
||||||
@SqlField(value = "cod_jfas_ricavi", maxLength = 5)
|
@SqlField(value = "cod_jfas_ricavi", maxLength = 5)
|
||||||
private String codJfasRicavi;
|
private String codJfasRicavi;
|
||||||
|
|
||||||
|
@Transient
|
||||||
private String mtbAartEqui_descrizione;
|
private String mtbAartEqui_descrizione;
|
||||||
|
|
||||||
|
@javax.persistence.Column(name = "flag_arr_prz_vend_iva")
|
||||||
@SqlField(value = "flag_arr_prz_vend_iva", nullable = false, defaultObjectValue = "1")
|
@SqlField(value = "flag_arr_prz_vend_iva", nullable = false, defaultObjectValue = "1")
|
||||||
private Boolean flagArrPrzVendIva;
|
private Boolean flagArrPrzVendIva;
|
||||||
|
|
||||||
|
@javax.persistence.Column(name = "classificazione_abc")
|
||||||
@SqlField(value = "classificazione_abc", maxLength = 1)
|
@SqlField(value = "classificazione_abc", maxLength = 1)
|
||||||
private String classificazioneAbc;
|
private String classificazioneAbc;
|
||||||
|
|
||||||
|
@javax.persistence.Column(name = "tipo_codice_imballo")
|
||||||
@SqlField(value = "tipo_codice_imballo", maxLength = 10)
|
@SqlField(value = "tipo_codice_imballo", maxLength = 10)
|
||||||
private String tipoCodiceImballo;
|
private String tipoCodiceImballo;
|
||||||
|
|
||||||
|
@javax.persistence.Column(name = "flag_stampa_docu_vend")
|
||||||
@SqlField(value = "flag_stampa_docu_vend", nullable = false, defaultObjectValue = "1")
|
@SqlField(value = "flag_stampa_docu_vend", nullable = false, defaultObjectValue = "1")
|
||||||
private Boolean flagStampaDocuVend;
|
private Boolean flagStampaDocuVend;
|
||||||
|
|
||||||
|
@javax.persistence.Column(name = "flag_reso_tec")
|
||||||
@SqlField(value = "flag_reso_tec", nullable = false, defaultObjectValue = "0")
|
@SqlField(value = "flag_reso_tec", nullable = false, defaultObjectValue = "0")
|
||||||
private Boolean flagResoTec;
|
private Boolean flagResoTec;
|
||||||
|
|
||||||
|
@javax.persistence.Column(name = "cod_mssfa")
|
||||||
@SqlField(value = "cod_mssfa", maxLength = 6)
|
@SqlField(value = "cod_mssfa", maxLength = 6)
|
||||||
private String codMssfa;
|
private String codMssfa;
|
||||||
|
|
||||||
|
@javax.persistence.Column(name = "cod_linea")
|
||||||
@SqlField(value = "cod_linea", maxLength = 6)
|
@SqlField(value = "cod_linea", maxLength = 6)
|
||||||
private String codLinea;
|
private String codLinea;
|
||||||
|
|
||||||
|
@javax.persistence.Column(name = "cod_slinea")
|
||||||
@SqlField(value = "cod_slinea", maxLength = 6)
|
@SqlField(value = "cod_slinea", maxLength = 6)
|
||||||
private String codSlinea;
|
private String codSlinea;
|
||||||
|
|
||||||
|
@javax.persistence.Column(name = "cod_sslinea")
|
||||||
@SqlField(value = "cod_sslinea", maxLength = 6)
|
@SqlField(value = "cod_sslinea", maxLength = 6)
|
||||||
private String codSslinea;
|
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)
|
@Priority(1)
|
||||||
|
@Transient
|
||||||
|
//Compatible with EntityBase
|
||||||
|
private List<MtbUntMis> mtbUntMisList;
|
||||||
|
|
||||||
|
@Priority(1)
|
||||||
|
@Transient
|
||||||
private MtbAartMarchio mtbAartMarchio;
|
private MtbAartMarchio mtbAartMarchio;
|
||||||
|
|
||||||
@Priority(1)
|
@Priority(1)
|
||||||
|
@Transient
|
||||||
private MtbAartEqui mtbAartEqui;
|
private MtbAartEqui mtbAartEqui;
|
||||||
|
|
||||||
@Priority(1)
|
|
||||||
private List<MtbUntMis> mtbUntMis;
|
|
||||||
|
|
||||||
@EntityChild
|
@EntityChild
|
||||||
|
@javax.persistence.OneToMany(fetch = javax.persistence.FetchType.LAZY, mappedBy = "mtbAart")
|
||||||
private List<MtbAartBarCode> mtbAartBarCode = new ArrayList<>();
|
private List<MtbAartBarCode> mtbAartBarCode = new ArrayList<>();
|
||||||
|
|
||||||
/*@EntityChild
|
/*@EntityChild
|
||||||
private List<MtbPart> mtbPart;*/
|
private List<MtbPart> mtbPart;*/
|
||||||
@EntityChild
|
@EntityChild
|
||||||
|
@Transient
|
||||||
private List<MtbAartCarat> mtbAartCarat = new ArrayList<>();
|
private List<MtbAartCarat> mtbAartCarat = new ArrayList<>();
|
||||||
|
|
||||||
@EntityChild
|
@EntityChild
|
||||||
|
@Transient
|
||||||
private List<MtbAartAnag> mtbAartAnag = new ArrayList<>();
|
private List<MtbAartAnag> mtbAartAnag = new ArrayList<>();
|
||||||
|
|
||||||
@EntityChild
|
@EntityChild
|
||||||
|
@Transient
|
||||||
private List<MtbSpes> mtbSpes = new ArrayList<>();
|
private List<MtbSpes> mtbSpes = new ArrayList<>();
|
||||||
|
|
||||||
@EntityChild
|
@EntityChild
|
||||||
|
@Transient
|
||||||
private List<MtbComp> mtbComp = new ArrayList<>();
|
private List<MtbComp> mtbComp = new ArrayList<>();
|
||||||
|
|
||||||
@EntityChild
|
@EntityChild
|
||||||
|
@Transient
|
||||||
private List<MtbAartDesc> mtbAartDesc = new ArrayList<>();
|
private List<MtbAartDesc> mtbAartDesc = new ArrayList<>();
|
||||||
|
|
||||||
@EntityChild
|
@EntityChild
|
||||||
|
@Transient
|
||||||
private List<MtbAartLink> mtbAartLink = new ArrayList<>();
|
private List<MtbAartLink> mtbAartLink = new ArrayList<>();
|
||||||
|
|
||||||
@EntityChild
|
@EntityChild
|
||||||
|
@Transient
|
||||||
private List<MtbPartitaMag> mtbPartitaMag = new ArrayList<>();
|
private List<MtbPartitaMag> mtbPartitaMag = new ArrayList<>();
|
||||||
|
|
||||||
@EntityChild
|
@EntityChild
|
||||||
|
@Transient
|
||||||
private List<MrlAartSchTecSet> mrlAartSchTecSet = new ArrayList<>();
|
private List<MrlAartSchTecSet> mrlAartSchTecSet = new ArrayList<>();
|
||||||
|
|
||||||
@EntityChild
|
@EntityChild
|
||||||
|
@Transient
|
||||||
private List<MtbAartColori> mtbAartColori = new ArrayList<>();
|
private List<MtbAartColori> mtbAartColori = new ArrayList<>();
|
||||||
|
|
||||||
@Priority(101)
|
@Priority(101)
|
||||||
|
@Transient
|
||||||
List<JtbCicl> jtbCicl;
|
List<JtbCicl> jtbCicl;
|
||||||
|
|
||||||
|
@Transient
|
||||||
private List<MtbLisa> mtbLisa;
|
private List<MtbLisa> mtbLisa;
|
||||||
|
|
||||||
public MtbAart() {
|
public MtbAart() {
|
||||||
@@ -1182,15 +1302,24 @@ public class MtbAart extends EntityBase implements EquatableEntityInterface<MtbA
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<MtbUntMis> getMtbUntMis() {
|
public MtbUntMis getMtbUntMis() {
|
||||||
return mtbUntMis;
|
return mtbUntMis;
|
||||||
}
|
}
|
||||||
|
|
||||||
public MtbAart setMtbUntMis(List<MtbUntMis> mtbUntMis) {
|
public MtbAart setMtbUntMis(MtbUntMis mtbUntMis) {
|
||||||
this.mtbUntMis = mtbUntMis;
|
this.mtbUntMis = mtbUntMis;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<MtbUntMis> getMtbUntMisList() {
|
||||||
|
return mtbUntMisList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MtbAart setMtbUntMisList(List<MtbUntMis> mtbUntMisList) {
|
||||||
|
this.mtbUntMisList = mtbUntMisList;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
public String getClassificazioneAbc() {
|
public String getClassificazioneAbc() {
|
||||||
return classificazioneAbc;
|
return classificazioneAbc;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,6 +13,8 @@ import org.kie.api.definition.type.PropertyReactive;
|
|||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
|
@javax.persistence.Entity
|
||||||
|
@javax.persistence.Table(name = MtbAartBarCode.ENTITY)
|
||||||
@PropertyReactive
|
@PropertyReactive
|
||||||
@Table(MtbAartBarCode.ENTITY)
|
@Table(MtbAartBarCode.ENTITY)
|
||||||
@JsonTypeName(MtbAartBarCode.ENTITY)
|
@JsonTypeName(MtbAartBarCode.ENTITY)
|
||||||
@@ -26,18 +28,28 @@ public class MtbAartBarCode extends EntityBase implements EquatableEntityInterfa
|
|||||||
|
|
||||||
@PK
|
@PK
|
||||||
@SqlField(value = "cod_barre", maxLength = 40, nullable = false)
|
@SqlField(value = "cod_barre", maxLength = 40, nullable = false)
|
||||||
|
@javax.persistence.Id
|
||||||
|
@javax.persistence.Column(name = "cod_barre")
|
||||||
private String codBarre;
|
private String codBarre;
|
||||||
|
|
||||||
@SqlField(value = "cod_mart", maxLength = 15)
|
@SqlField(value = "cod_mart", maxLength = 15)
|
||||||
|
@javax.persistence.Column(name = "cod_mart")
|
||||||
private String codMart;
|
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")
|
@SqlField(value = "qta_cnf", nullable = false, defaultObjectValue = "1")
|
||||||
|
@javax.persistence.Column(name = "qta_cnf")
|
||||||
private BigDecimal qtaCnf;
|
private BigDecimal qtaCnf;
|
||||||
|
|
||||||
@SqlField(value = "flag_primario", maxLength = 1, nullable = false, defaultObjectValue = "N")
|
@SqlField(value = "flag_primario", maxLength = 1, nullable = false, defaultObjectValue = "N")
|
||||||
|
@javax.persistence.Column(name = "flag_primario")
|
||||||
private String flagPrimario;
|
private String flagPrimario;
|
||||||
|
|
||||||
@SqlField(value = "tipo_cod_barre", maxLength = 10)
|
@SqlField(value = "tipo_cod_barre", maxLength = 10)
|
||||||
|
@javax.persistence.Column(name = "tipo_cod_barre")
|
||||||
private String tipoCodBarre;
|
private String tipoCodBarre;
|
||||||
|
|
||||||
public MtbAartBarCode() {
|
public MtbAartBarCode() {
|
||||||
@@ -62,6 +74,14 @@ public class MtbAartBarCode extends EntityBase implements EquatableEntityInterfa
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public MtbAart getMtbAart() {
|
||||||
|
return mtbAart;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMtbAart(MtbAart mtbAart) {
|
||||||
|
this.mtbAart = mtbAart;
|
||||||
|
}
|
||||||
|
|
||||||
public BigDecimal getQtaCnf() {
|
public BigDecimal getQtaCnf() {
|
||||||
return qtaCnf;
|
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.annotation.Table;
|
||||||
import it.integry.ems_model.base.EntityBase;
|
import it.integry.ems_model.base.EntityBase;
|
||||||
import it.integry.ems_model.entity._enum.IBaseEnum;
|
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.LogManager;
|
||||||
import org.apache.logging.log4j.Logger;
|
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
|
@Master
|
||||||
@PropertyReactive
|
@PropertyReactive
|
||||||
@Table(MtbUntMis.ENTITY)
|
@Table(MtbUntMis.ENTITY)
|
||||||
@@ -27,29 +30,40 @@ public class MtbUntMis extends EntityBase {
|
|||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@javax.persistence.Id
|
||||||
|
@javax.persistence.Column(name = "unt_mis")
|
||||||
@PK
|
@PK
|
||||||
@SqlField(value = "unt_mis", maxLength = 3, nullable = false)
|
@SqlField(value = "unt_mis", maxLength = 3, nullable = false)
|
||||||
private String untMis;
|
private String untMis;
|
||||||
|
|
||||||
|
@javax.persistence.Column(name = "flag_dig")
|
||||||
@SqlField(value = "flag_dig", maxLength = 1, nullable = false, defaultObjectValue = "N")
|
@SqlField(value = "flag_dig", maxLength = 1, nullable = false, defaultObjectValue = "N")
|
||||||
private String flagDig;
|
private String flagDig;
|
||||||
|
|
||||||
|
@javax.persistence.Column(name = "cifre_dec")
|
||||||
@SqlField(value = "cifre_dec", nullable = false, defaultObjectValue = "0")
|
@SqlField(value = "cifre_dec", nullable = false, defaultObjectValue = "0")
|
||||||
private BigDecimal cifreDec;
|
private BigDecimal cifreDec;
|
||||||
|
|
||||||
|
@javax.persistence.Column(name = "tipo_um")
|
||||||
|
@javax.persistence.Enumerated(javax.persistence.EnumType.STRING)
|
||||||
@SqlField(value = "tipo_um", maxLength = 2)
|
@SqlField(value = "tipo_um", maxLength = 2)
|
||||||
private TipoUM tipoUm;
|
private TipoUM tipoUm;
|
||||||
|
|
||||||
|
@javax.persistence.Column(name = "flag_unita_kg")
|
||||||
@SqlField(value = "flag_unita_kg", maxLength = 1, nullable = false)
|
@SqlField(value = "flag_unita_kg", maxLength = 1, nullable = false)
|
||||||
private String flagUnitaKg;
|
private String flagUnitaKg;
|
||||||
|
|
||||||
|
@javax.persistence.Column(name = "flag_attivo")
|
||||||
@SqlField(value = "flag_attivo", maxLength = 1, nullable = false)
|
@SqlField(value = "flag_attivo", maxLength = 1, nullable = false)
|
||||||
private String flagAttivo;
|
private String flagAttivo;
|
||||||
|
|
||||||
|
@javax.persistence.Column(name = "grandezza")
|
||||||
|
@javax.persistence.Enumerated(javax.persistence.EnumType.STRING)
|
||||||
@SqlField(value = "grandezza")
|
@SqlField(value = "grandezza")
|
||||||
private Grandezza grandezza;
|
private Grandezza grandezza;
|
||||||
|
|
||||||
@JsonProperty(value = "ordinamento")
|
@JsonProperty(value = "ordinamento")
|
||||||
|
@Transient
|
||||||
private Integer ordinamento;
|
private Integer ordinamento;
|
||||||
|
|
||||||
public MtbUntMis() {
|
public MtbUntMis() {
|
||||||
|
|||||||
@@ -155,7 +155,7 @@ when
|
|||||||
$entity : MtbAart((untMis != null || untMis2 != null || untMis3 != null ) && operation != OperationType.DELETE)
|
$entity : MtbAart((untMis != null || untMis2 != null || untMis3 != null ) && operation != OperationType.DELETE)
|
||||||
then
|
then
|
||||||
List<MtbUntMis> mtbUntMis = CommonRules.insUntMis(conn, $entity);
|
List<MtbUntMis> mtbUntMis = CommonRules.insUntMis(conn, $entity);
|
||||||
modify($entity){setMtbUntMis(mtbUntMis)}
|
modify($entity){setMtbUntMisList(mtbUntMis)}
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -18,7 +18,8 @@ import java.time.LocalDate
|
|||||||
import it.integry.ems_model.utility.UtilityLocalDate;
|
import it.integry.ems_model.utility.UtilityLocalDate;
|
||||||
import it.integry.ems.migration._base.IntegryCustomerDB;
|
import it.integry.ems.migration._base.IntegryCustomerDB;
|
||||||
import it.integry.ems.migration._base.IntegryCustomer
|
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 Connection conn
|
||||||
global String username
|
global String username
|
||||||
@@ -226,7 +227,10 @@ when
|
|||||||
eval(completeRulesEnabled)
|
eval(completeRulesEnabled)
|
||||||
$entity : MtbColr(artAPeso == null && codMart != null )
|
$entity : MtbColr(artAPeso == null && codMart != null )
|
||||||
then
|
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";
|
String artAPeso = "N";
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,24 @@
|
|||||||
|
package it.integry.ems.activity.dto;
|
||||||
|
|
||||||
|
public class SteUpFornitoriDTO {
|
||||||
|
private String partitaIva;
|
||||||
|
private Integer ggCons;
|
||||||
|
|
||||||
|
public String getPartitaIva() {
|
||||||
|
return partitaIva;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SteUpFornitoriDTO setPartitaIva(String partitaIva) {
|
||||||
|
this.partitaIva = partitaIva;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getGgCons() {
|
||||||
|
return ggCons;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SteUpFornitoriDTO setGgCons(Integer ggCons) {
|
||||||
|
this.ggCons = ggCons;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,20 +2,20 @@ package it.integry.ems.activity.service;
|
|||||||
|
|
||||||
import com.annimon.stream.Optional;
|
import com.annimon.stream.Optional;
|
||||||
import com.annimon.stream.Stream;
|
import com.annimon.stream.Stream;
|
||||||
|
import com.fasterxml.jackson.core.type.TypeReference;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import it.integry.common.var.CommonConstants;
|
import it.integry.common.var.CommonConstants;
|
||||||
import it.integry.ems.activity.dto.DescrizioneTipiAttivitaDTO;
|
import it.integry.ems.activity.dto.*;
|
||||||
import it.integry.ems.activity.dto.ModellinoDTO;
|
|
||||||
import it.integry.ems.activity.dto.SteUPEntryDTO;
|
|
||||||
import it.integry.ems.activity.dto.SteUpScoreDTO;
|
|
||||||
import it.integry.ems.entity_logger.db_schema_manager.component.SQLServerDBSchemaManager;
|
import it.integry.ems.entity_logger.db_schema_manager.component.SQLServerDBSchemaManager;
|
||||||
import it.integry.ems.entity_logger.db_schema_manager.dto.DatabaseTable;
|
import it.integry.ems.entity_logger.db_schema_manager.dto.DatabaseTable;
|
||||||
import it.integry.ems.entity_logger.db_schema_manager.dto.DatabaseTableColumn;
|
import it.integry.ems.entity_logger.db_schema_manager.dto.DatabaseTableColumn;
|
||||||
import it.integry.ems.entity_logger.db_schema_manager.dto.DatabaseTableView;
|
import it.integry.ems.entity_logger.db_schema_manager.dto.DatabaseTableView;
|
||||||
import it.integry.ems.javabeans.RequestDataDTO;
|
import it.integry.ems.javabeans.RequestDataDTO;
|
||||||
|
import it.integry.ems.json.ResponseJSONObjectMapper;
|
||||||
import it.integry.ems.order.dto.UserGroupENUM;
|
import it.integry.ems.order.dto.UserGroupENUM;
|
||||||
import it.integry.ems.report.dto.JasperDTO;
|
import it.integry.ems.report.dto.JasperDTO;
|
||||||
import it.integry.ems.report.dto.PairsDTO;
|
import it.integry.ems.report.dto.PairsDTO;
|
||||||
|
import it.integry.ems.retail.pvmRetail.dto.FiltroArtDTO;
|
||||||
import it.integry.ems.service.EntityProcessor;
|
import it.integry.ems.service.EntityProcessor;
|
||||||
import it.integry.ems.service.MailService;
|
import it.integry.ems.service.MailService;
|
||||||
import it.integry.ems.service.ReportProcessor;
|
import it.integry.ems.service.ReportProcessor;
|
||||||
@@ -43,6 +43,7 @@ import org.apache.logging.log4j.Logger;
|
|||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.context.annotation.Scope;
|
import org.springframework.context.annotation.Scope;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.web.context.ContextLoader;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
@@ -61,6 +62,7 @@ import static it.integry.ems.order.dto.UserGroupENUM.RILEVATORE;
|
|||||||
import static it.integry.ems.order.dto.UserGroupENUM.TECNICO;
|
import static it.integry.ems.order.dto.UserGroupENUM.TECNICO;
|
||||||
import static java.util.stream.Collectors.groupingBy;
|
import static java.util.stream.Collectors.groupingBy;
|
||||||
import static org.codehaus.groovy.runtime.DefaultGroovyMethods.collect;
|
import static org.codehaus.groovy.runtime.DefaultGroovyMethods.collect;
|
||||||
|
import static org.json.XMLTokener.entity;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
@Scope("request")
|
@Scope("request")
|
||||||
@@ -738,7 +740,7 @@ public class SteUPService {
|
|||||||
if (barcodes != null && !barcodes.isEmpty()) {
|
if (barcodes != null && !barcodes.isEmpty()) {
|
||||||
for (String barcode : barcodes) {
|
for (String barcode : barcodes) {
|
||||||
StbActivity art = getArticoli(barcode, null, activityTypeId, codJfas, userNamePv);
|
StbActivity art = getArticoli(barcode, null, activityTypeId, codJfas, userNamePv);
|
||||||
if( art != null)
|
if (art != null)
|
||||||
stbActivityList.add(art);
|
stbActivityList.add(art);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1481,8 +1483,13 @@ public class SteUPService {
|
|||||||
String tipoAttivitaRotturaStock = setup.get("TIPO_ATTIVITA_ROTTURA_STOCK");
|
String tipoAttivitaRotturaStock = setup.get("TIPO_ATTIVITA_ROTTURA_STOCK");
|
||||||
List<String> repartiFreschi = Arrays.asList(StringUtils.split(UtilityString.isNull(setup.get("REPARTI_FRESCHI"), ""), "|"));
|
List<String> repartiFreschi = Arrays.asList(StringUtils.split(UtilityString.isNull(setup.get("REPARTI_FRESCHI"), ""), "|"));
|
||||||
List<String> tipiEsclusi = Arrays.asList(StringUtils.split(UtilityString.isNull(setup.get("EXCLUDE_COD_MTIP"), ""), "|"));
|
List<String> tipiEsclusi = Arrays.asList(StringUtils.split(UtilityString.isNull(setup.get("EXCLUDE_COD_MTIP"), ""), "|"));
|
||||||
List<String> fornitori = Arrays.asList(StringUtils.split(UtilityString.isNull(setup.get("ELENCO_FORN_INEVASI"), ""), "|"));
|
String jsonFornitori = setup.get("FORN_INEVASI");
|
||||||
|
List<SteUpFornitoriDTO> fornitori = new ArrayList<>();
|
||||||
|
if (!UtilityString.isNullOrEmpty(jsonFornitori)) {
|
||||||
|
TypeReference<List<SteUpFornitoriDTO>> mapType = new TypeReference<List<SteUpFornitoriDTO>>() {
|
||||||
|
};
|
||||||
|
fornitori = new ResponseJSONObjectMapper().readValue(jsonFornitori, mapType);
|
||||||
|
}
|
||||||
String sql =
|
String sql =
|
||||||
Query.format(
|
Query.format(
|
||||||
"select i.cod_mdep, stb_activity.cod_jfas, stb_activity.activity_id, stb_activity.user_name\n" +
|
"select i.cod_mdep, stb_activity.cod_jfas, stb_activity.activity_id, stb_activity.user_name\n" +
|
||||||
@@ -1506,7 +1513,7 @@ public class SteUPService {
|
|||||||
List<String> barcodes = new ArrayList<>();
|
List<String> barcodes = new ArrayList<>();
|
||||||
|
|
||||||
List<String> idAttivita = new ArrayList<>();
|
List<String> idAttivita = new ArrayList<>();
|
||||||
for ( HashMap<String, Object> r: reparto.getValue() ) {
|
for (HashMap<String, Object> r : reparto.getValue()) {
|
||||||
String activityId = (String) r.get("activity_id");
|
String activityId = (String) r.get("activity_id");
|
||||||
idAttivita.add(activityId);
|
idAttivita.add(activityId);
|
||||||
StbActivityFile stbActivityFile = new StbActivityFile()
|
StbActivityFile stbActivityFile = new StbActivityFile()
|
||||||
@@ -1617,11 +1624,11 @@ public class SteUPService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public List<String> verificaRottura(String codMdep, String codJfas,
|
public List<String> verificaRottura(String codMdep, String codJfas,
|
||||||
LocalDate dataCreation,
|
LocalDate dataCreation,
|
||||||
List<String> repartiFreschi,
|
List<String> repartiFreschi,
|
||||||
List<String> tipiEsclusi,
|
List<String> tipiEsclusi,
|
||||||
List<String> fornitori,
|
List<SteUpFornitoriDTO> fornitori,
|
||||||
List<String> barcode) throws Exception {
|
List<String> barcode) throws Exception {
|
||||||
|
|
||||||
String tipoGriglia = setupGest.getSetupDet(multiDBTransactionManager.getPrimaryConnection(), "PVM", "RILEVAZIONI_STEUP", "TIPO_GRIGLIA", codJfas);
|
String tipoGriglia = setupGest.getSetupDet(multiDBTransactionManager.getPrimaryConnection(), "PVM", "RILEVAZIONI_STEUP", "TIPO_GRIGLIA", codJfas);
|
||||||
|
|
||||||
@@ -1636,7 +1643,7 @@ public class SteUPService {
|
|||||||
case "A":
|
case "A":
|
||||||
queryAssortimento =
|
queryAssortimento =
|
||||||
"SELECT DISTINCT mtb_aart.cod_mart\n" +
|
"SELECT DISTINCT mtb_aart.cod_mart\n" +
|
||||||
" FROM mvw_barcode INNER JOIN mtb_aart ON mtb_aart.cod_mart = mvw_barcode.cod_mart \n";
|
" FROM mvw_barcode INNER JOIN mtb_aart ON mtb_aart.cod_mart = mvw_barcode.cod_mart \n";
|
||||||
break;
|
break;
|
||||||
case "V":
|
case "V":
|
||||||
queryAssortimento =
|
queryAssortimento =
|
||||||
@@ -1696,7 +1703,7 @@ public class SteUPService {
|
|||||||
//Eliminazione nuovi inserimenti in griglia
|
//Eliminazione nuovi inserimenti in griglia
|
||||||
String sqlGriglia =
|
String sqlGriglia =
|
||||||
"WITH articoli AS ( \n" + queryKit + " ) \n" +
|
"WITH articoli AS ( \n" + queryKit + " ) \n" +
|
||||||
"SELECT g.cod_mart\n" +
|
"SELECT g.cod_mart\n" +
|
||||||
"FROM dbo.getgrigliaacquisto([DATA_CREAZIONE], NULL, [COD_MDEP], NULL, NULL) g\n" +
|
"FROM dbo.getgrigliaacquisto([DATA_CREAZIONE], NULL, [COD_MDEP], NULL, NULL) g\n" +
|
||||||
" INNER JOIN mtb_aart ON g.cod_mart = mtb_aart.cod_mart AND mtb_aart.cod_mgrp IN ([GRUPPI_MERC])\n" +
|
" INNER JOIN mtb_aart ON g.cod_mart = mtb_aart.cod_mart AND mtb_aart.cod_mgrp IN ([GRUPPI_MERC])\n" +
|
||||||
" INNER JOIN articoli ON g.cod_mart = articoli.cod_mart_griglia\n" +
|
" INNER JOIN articoli ON g.cod_mart = articoli.cod_mart_griglia\n" +
|
||||||
@@ -1719,42 +1726,57 @@ public class SteUPService {
|
|||||||
.filter(x -> !nuoviInserimenti.contains(x))
|
.filter(x -> !nuoviInserimenti.contains(x))
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
//Verifica Inevasi
|
if (fornitori.size() > 0) {
|
||||||
String sqlInevasi =
|
String whereCondFornitori = fornitori.stream().map(
|
||||||
"WITH articoli AS (" + queryKit + ")\n" +
|
x -> {
|
||||||
"SELECT DISTINCT articoli.cod_mart\n" +
|
return "(gtb_anag.part_iva = " + UtilityDB.valueToString(x.getPartitaIva()) + " AND \n" +
|
||||||
"FROM dtb_ordt\n" +
|
" dtb_ordr.data_cons BETWEEN DATEADD(DAY, - (" + x.getGgCons() + "-1), " + UtilityDB.valueToString(dataCreation) + ") AND " + UtilityDB.valueToString(dataCreation) + ")\n";
|
||||||
" INNER JOIN dtb_ordr ON dtb_ordt.gestione = dtb_ordr.gestione\n" +
|
}
|
||||||
" AND dtb_ordt.data_ord = dtb_ordr.data_ord\n" +
|
).collect(Collectors.joining(" OR \n", " AND ( \n", " ) \n"));
|
||||||
" AND dtb_ordt.num_ord = dtb_ordr.num_ord\n" +
|
|
||||||
" INNER JOIN gtb_anag ON dtb_ordt.cod_anag = gtb_anag.cod_anag\n" +
|
|
||||||
" INNER JOIN mtb_aart ON dtb_ordr.cod_mart = mtb_aart.cod_mart\n" +
|
|
||||||
" INNER JOIN articoli ON mtb_aart.cod_mart = articoli.cod_mart_griglia\n" +
|
|
||||||
"WHERE dtb_ordt.gestione = 'A'\n" +
|
|
||||||
" AND dtb_ordt.flag_annulla = 'N'\n" +
|
|
||||||
" AND gtb_anag.part_iva IN ([ELENCO_FORNITORI])\n" +
|
|
||||||
" AND dtb_ordt.cod_mdep = [COD_MDEP]\n" +
|
|
||||||
" AND dtb_ordt.data_esportazione IS NOT NULL\n" +
|
|
||||||
" AND mtb_aart.cod_mgrp IN ( [GRUPPI_MERC] ) \n" +
|
|
||||||
" AND dtb_ordr.qta_evasa = 0\n" +
|
|
||||||
" AND dtb_ordr.data_cons BETWEEN DATEADD(DAY, -7, [DATA_ISPEZIONE]) AND [DATA_ISPEZIONE]\n";
|
|
||||||
|
|
||||||
sqlInevasi =
|
//Verifica Inevasi
|
||||||
sqlInevasi
|
String sqlInevasi =
|
||||||
.replace("[DATA_ISPEZIONE]", UtilityDB.valueToString(dataCreation))
|
"WITH articoli AS (" + queryKit + "), \n" +
|
||||||
.replace("[COD_MDEP]", UtilityDB.valueToString(codMdep))
|
" ordini AS (SELECT articoli.cod_mart,\n" +
|
||||||
.replace("[GRUPPI_MERC]", UtilityDB.listValueToString(gruppiMerc))
|
" dtb_ordt.data_ord,\n" +
|
||||||
.replace("[ELENCO_FORNITORI]", UtilityDB.listValueToString(fornitori));
|
" dtb_ordt.num_ord,\n" +
|
||||||
|
" dtb_ordr.qta_evasa,\n" +
|
||||||
|
" DENSE_RANK() OVER (PARTITION BY dtb_ordt.cod_anag, dtb_ordt.cod_mdep ORDER BY dtb_ordr.data_cons DESC) id_ord\n" +
|
||||||
|
" FROM dtb_ordt\n" +
|
||||||
|
" INNER JOIN dtb_ordr ON dtb_ordt.gestione = dtb_ordr.gestione\n" +
|
||||||
|
" AND dtb_ordt.data_ord = dtb_ordr.data_ord\n" +
|
||||||
|
" AND dtb_ordt.num_ord = dtb_ordr.num_ord\n" +
|
||||||
|
" INNER JOIN gtb_anag ON dtb_ordt.cod_anag = gtb_anag.cod_anag\n" +
|
||||||
|
" INNER JOIN mtb_aart ON dtb_ordr.cod_mart = mtb_aart.cod_mart\n" +
|
||||||
|
" INNER JOIN articoli ON mtb_aart.cod_mart = articoli.cod_mart_griglia\n" +
|
||||||
|
" WHERE dtb_ordt.gestione = 'A'\n" +
|
||||||
|
" AND dtb_ordt.flag_annulla = 'N'\n" +
|
||||||
|
" AND dtb_ordt.cod_mdep = [COD_MDEP]\n" +
|
||||||
|
" [WHERE_COND_FORN]\n" +
|
||||||
|
(!tipiEsclusi.isEmpty()?
|
||||||
|
" AND (mtb_aart.cod_mtip IS NULL OR mtb_aart.cod_mtip not in (" + UtilityDB.listValueToString(tipiEsclusi) + "))\n":""
|
||||||
|
) +
|
||||||
|
" AND dtb_ordt.data_esportazione IS NOT NULL\n" +
|
||||||
|
" AND mtb_aart.cod_mgrp IN ( [GRUPPI_MERC] ) \n)\n"+
|
||||||
|
"SELECT DISTINCT cod_mart\n" +
|
||||||
|
"FROM ordini\n" +
|
||||||
|
"WHERE id_ord <= 2\n" +
|
||||||
|
" AND qta_evasa = 0 ";
|
||||||
|
;
|
||||||
|
|
||||||
if (!tipiEsclusi.isEmpty()) {
|
sqlInevasi =
|
||||||
sqlInevasi = UtilityDB.addwhereCond(sqlInevasi, "(mtb_aart.cod_mtip IS NULL OR mtb_aart.cod_mtip not in (" + UtilityDB.listValueToString(tipiEsclusi) + "))", true);
|
sqlInevasi
|
||||||
|
.replace("[DATA_ISPEZIONE]", UtilityDB.valueToString(dataCreation))
|
||||||
|
.replace("[COD_MDEP]", UtilityDB.valueToString(codMdep))
|
||||||
|
.replace("[GRUPPI_MERC]", UtilityDB.listValueToString(gruppiMerc))
|
||||||
|
.replace("[WHERE_COND_FORN]", whereCondFornitori);
|
||||||
|
|
||||||
|
List<String> inevasi = UtilityDB.executeSimpleQueryOnlyFirstColumn(mdb.getPrimaryConnection(), sqlInevasi);
|
||||||
|
|
||||||
|
articoli = articoli.stream()
|
||||||
|
.filter(x -> !inevasi.contains(x))
|
||||||
|
.collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
List<String> inevasi = UtilityDB.executeSimpleQueryOnlyFirstColumn(mdb.getPrimaryConnection(), sqlInevasi);
|
|
||||||
|
|
||||||
articoli = articoli.stream()
|
|
||||||
.filter(x -> !inevasi.contains(x))
|
|
||||||
.collect(Collectors.toList());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return articoli;
|
return articoli;
|
||||||
|
|||||||
@@ -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 com.fasterxml.jackson.databind.JsonNode;
|
||||||
import it.integry.common.var.CommonConstants;
|
import it.integry.common.var.CommonConstants;
|
||||||
import it.integry.ems._context.ApplicationContextProvider;
|
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.logistic.dto.sm2.FiltroDistribuzioneColloDTO;
|
||||||
import it.integry.ems.product.importaz.service.ProductServices;
|
import it.integry.ems.product.importaz.service.ProductServices;
|
||||||
import it.integry.ems.service.EntityProcessor;
|
import it.integry.ems.service.EntityProcessor;
|
||||||
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
|
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.EntityBase;
|
||||||
import it.integry.ems_model.base.EntityNotFound;
|
import it.integry.ems_model.base.EntityNotFound;
|
||||||
import it.integry.ems_model.entity.*;
|
import it.integry.ems_model.entity.*;
|
||||||
@@ -31,12 +31,13 @@ import static java.util.stream.Collectors.groupingBy;
|
|||||||
@Component
|
@Component
|
||||||
public class DistribuzioneColliService {
|
public class DistribuzioneColliService {
|
||||||
|
|
||||||
|
|
||||||
private final List<MtbColt> mCurrentlyDistributingMtbColt = new ArrayList<>();
|
private final List<MtbColt> mCurrentlyDistributingMtbColt = new ArrayList<>();
|
||||||
|
|
||||||
|
|
||||||
public List<MtbColt> distribuzioneRigheColloNew(final FiltroDistribuzioneColloDTO filtroDistribuzioneColloDTO, boolean skipCommit) throws Exception {
|
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);
|
MultiDBTransactionManager multiDBTransactionManager = ContextLoader.getCurrentWebApplicationContext().getBean(MultiDBTransactionManager.class);
|
||||||
EntityProcessor entityProcessor = ApplicationContextProvider.getApplicationContext().getBean(EntityProcessor.class);
|
EntityProcessor entityProcessor = ApplicationContextProvider.getApplicationContext().getBean(EntityProcessor.class);
|
||||||
ProductServices productServices = ContextLoader.getCurrentWebApplicationContext().getBean(ProductServices.class);
|
ProductServices productServices = ContextLoader.getCurrentWebApplicationContext().getBean(ProductServices.class);
|
||||||
@@ -116,8 +117,7 @@ public class DistribuzioneColliService {
|
|||||||
.map(MtbColr::getCodMart)
|
.map(MtbColr::getCodMart)
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
List<MtbAart> mtbAarts = MtbAartUtils.getArticoliByCodMarts(codMarts, multiDBTransactionManager.getPrimaryConnection());
|
List<MtbAart> mtbAarts = mtbAartRepository.findByCodMartIn(codMarts);
|
||||||
|
|
||||||
|
|
||||||
//Lettura del filtro ordini
|
//Lettura del filtro ordini
|
||||||
String filtroOrdini = sourceMtbColt.getFiltroOrdini();
|
String filtroOrdini = sourceMtbColt.getFiltroOrdini();
|
||||||
|
|||||||
@@ -3,11 +3,11 @@ package it.integry.ems.order.Import.service;
|
|||||||
import it.integry.common.var.CommonConstants;
|
import it.integry.common.var.CommonConstants;
|
||||||
import it.integry.ems._context.ApplicationContextProvider;
|
import it.integry.ems._context.ApplicationContextProvider;
|
||||||
import it.integry.ems.exception.PrimaryDatabaseNotPresentException;
|
import it.integry.ems.exception.PrimaryDatabaseNotPresentException;
|
||||||
|
import it.integry.ems.jpa.repository.MtbAartRepository;
|
||||||
import it.integry.ems.service.EntityProcessor;
|
import it.integry.ems.service.EntityProcessor;
|
||||||
import it.integry.ems.sync.MultiDBTransaction.Connection;
|
import it.integry.ems.sync.MultiDBTransaction.Connection;
|
||||||
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
|
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
|
||||||
import it.integry.ems.utility.UtilityEntity;
|
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.base.EntityBase;
|
||||||
import it.integry.ems_model.config.EmsRestConstants;
|
import it.integry.ems_model.config.EmsRestConstants;
|
||||||
import it.integry.ems_model.entity.*;
|
import it.integry.ems_model.entity.*;
|
||||||
@@ -44,6 +44,8 @@ public class OrdiniMaxiDataImportService {
|
|||||||
private EntityProcessor entityProcessor;
|
private EntityProcessor entityProcessor;
|
||||||
|
|
||||||
private MaxiDataApiService maxiDataApiService;
|
private MaxiDataApiService maxiDataApiService;
|
||||||
|
@Autowired
|
||||||
|
private MtbAartRepository mtbAartRepository;
|
||||||
|
|
||||||
@PostConstruct
|
@PostConstruct
|
||||||
private void init() throws PrimaryDatabaseNotPresentException {
|
private void init() throws PrimaryDatabaseNotPresentException {
|
||||||
@@ -132,12 +134,11 @@ public class OrdiniMaxiDataImportService {
|
|||||||
if (schedeProduzione == null || schedeProduzione.isEmpty())
|
if (schedeProduzione == null || schedeProduzione.isEmpty())
|
||||||
return new ArrayList<>();
|
return new ArrayList<>();
|
||||||
|
|
||||||
List<MtbAart> anafraficheArticoli = MtbAartUtils.getArticoliByCodMarts(
|
List<MtbAart> anafraficheArticoli = mtbAartRepository.findByCodMartIn(
|
||||||
schedeProduzione.stream()
|
schedeProduzione.stream()
|
||||||
.map(MaxidataUveBII40V2BLLUVE2kSchedeProd::getIdProdotto)
|
.map(MaxidataUveBII40V2BLLUVE2kSchedeProd::getIdProdotto)
|
||||||
.distinct()
|
.distinct()
|
||||||
.collect(Collectors.toList()),
|
.collect(Collectors.toList()));
|
||||||
conn);
|
|
||||||
|
|
||||||
List<DtbOrdt> generatedOrders = new ArrayList<>();
|
List<DtbOrdt> generatedOrders = new ArrayList<>();
|
||||||
|
|
||||||
|
|||||||
@@ -64,6 +64,9 @@ public class ProductController {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private MultiDBTransactionManager multiDBTransactionManager;
|
private MultiDBTransactionManager multiDBTransactionManager;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private it.integry.ems.jpa.repository.MtbAartRepository mtbAartRepository;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ServiceChecker serviceChecker;
|
private ServiceChecker serviceChecker;
|
||||||
|
|
||||||
@@ -282,7 +285,20 @@ public class ProductController {
|
|||||||
@RequestParam("codMart") String codMartString) throws Exception {
|
@RequestParam("codMart") String codMartString) throws Exception {
|
||||||
|
|
||||||
List<String> codMarts = Arrays.asList(codMartString.split(","));
|
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);
|
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.Connection;
|
||||||
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
|
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
|
||||||
import it.integry.ems.utility.UtilityEntity;
|
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.base.EntityBase;
|
||||||
import it.integry.ems_model.db.ResultSetMapper;
|
import it.integry.ems_model.db.ResultSetMapper;
|
||||||
import it.integry.ems_model.entity.*;
|
import it.integry.ems_model.entity.*;
|
||||||
@@ -234,10 +233,6 @@ public class ProductServices {
|
|||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<MtbAart> getArticoliByCodMarts(List<String> codMarts) throws Exception {
|
|
||||||
return MtbAartUtils.getArticoliByCodMarts(codMarts, multiDBTransactionManager.getPrimaryConnection());
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<EntityBase> importArticoliBiolevante() throws Exception {
|
public List<EntityBase> importArticoliBiolevante() throws Exception {
|
||||||
List<EntityBase> toBeProcessed = new ArrayList<EntityBase>();
|
List<EntityBase> toBeProcessed = new ArrayList<EntityBase>();
|
||||||
List<EntityBase> entitiesReturn = 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.document.service.DocumentProdService;
|
||||||
import it.integry.ems.exception.MissingDataException;
|
import it.integry.ems.exception.MissingDataException;
|
||||||
import it.integry.ems.exception.PrimaryDatabaseNotPresentException;
|
import it.integry.ems.exception.PrimaryDatabaseNotPresentException;
|
||||||
|
import it.integry.ems.jpa.repository.MtbAartRepository;
|
||||||
import it.integry.ems.migration._base.IntegryCustomerDB;
|
import it.integry.ems.migration._base.IntegryCustomerDB;
|
||||||
import it.integry.ems.production.dto.*;
|
import it.integry.ems.production.dto.*;
|
||||||
import it.integry.ems.production.event.ProductionOrderPausedEvent;
|
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.sync.MultiDBTransaction.MultiDBTransactionManager;
|
||||||
import it.integry.ems.utility.UtilityDebug;
|
import it.integry.ems.utility.UtilityDebug;
|
||||||
import it.integry.ems.utility.UtilityEntity;
|
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.base.EntityBase;
|
||||||
import it.integry.ems_model.business_logic.dto.DatiMaterialiDTO;
|
import it.integry.ems_model.business_logic.dto.DatiMaterialiDTO;
|
||||||
import it.integry.ems_model.config.EmsRestConstants;
|
import it.integry.ems_model.config.EmsRestConstants;
|
||||||
@@ -129,6 +129,8 @@ public class MesProductionServiceV2 {
|
|||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ApplicationEventPublisher applicationEventPublisher;
|
private ApplicationEventPublisher applicationEventPublisher;
|
||||||
|
@Autowired
|
||||||
|
private MtbAartRepository mtbAartRepository;
|
||||||
|
|
||||||
public BasePanelAnswerDTO callSupervisorServiceGET(String serviceIp, int servicePort, String serviceName, HashMap<String, String> queryParams) throws Exception {
|
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);
|
Integer timeout = setupGest.getSetupInteger(multiDBTransactionManager.getPrimaryConnection(), "MES", "HMI", "TIMEOUT_MACHINE_CONNECTION", 5);
|
||||||
@@ -1126,7 +1128,8 @@ public class MesProductionServiceV2 {
|
|||||||
entityProcessor.processEntity(ordineLav, true, multiDBTransactionManager);
|
entityProcessor.processEntity(ordineLav, true, multiDBTransactionManager);
|
||||||
|
|
||||||
MtbAart mtbAart =
|
MtbAart mtbAart =
|
||||||
MtbAartUtils.getArticoloByCodMart(ordineLav.getCodProd(), multiDBTransactionManager.getPrimaryConnection());
|
mtbAartRepository.findByCodMart(ordineLav.getCodProd())
|
||||||
|
.orElse(null);
|
||||||
|
|
||||||
if (UtilityBigDecimal.isNullOrZero(dto.getQtaCollo())) {
|
if (UtilityBigDecimal.isNullOrZero(dto.getQtaCollo())) {
|
||||||
if (UtilityBigDecimal.isNullOrZero(dto.getColliPedana())) {
|
if (UtilityBigDecimal.isNullOrZero(dto.getColliPedana())) {
|
||||||
|
|||||||
@@ -1,45 +1,48 @@
|
|||||||
package it.integry.ems.retail.service;
|
package it.integry.ems.retail.service;
|
||||||
|
|
||||||
import it.integry.ems.dynamic_cache.EntityCacheComponent;
|
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.AnomalieMerceDTO;
|
||||||
import it.integry.ems.retail.dto.DettaglioULDTO;
|
import it.integry.ems.retail.dto.DettaglioULDTO;
|
||||||
import it.integry.ems.retail.dto.SaveAnomaliaRequestDTO;
|
import it.integry.ems.retail.dto.SaveAnomaliaRequestDTO;
|
||||||
import it.integry.ems.retail.dto.SaveLivelloAnomaliaRequestDTO;
|
import it.integry.ems.retail.dto.SaveLivelloAnomaliaRequestDTO;
|
||||||
import it.integry.ems.retail.utility.AnomalieUlUtility;
|
import it.integry.ems.retail.utility.AnomalieUlUtility;
|
||||||
import it.integry.ems.retail.wms.Utility.WMSUtility;
|
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.service.EntityProcessor;
|
||||||
import it.integry.ems.sync.MultiDBTransaction.Connection;
|
import it.integry.ems.sync.MultiDBTransaction.Connection;
|
||||||
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
|
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
|
||||||
import it.integry.ems.utility.UtilityEntity;
|
import it.integry.ems.utility.UtilityEntity;
|
||||||
import it.integry.ems_model.base.EntityBase;
|
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.MtbAart;
|
||||||
import it.integry.ems_model.entity.MtbAnomalieUl;
|
import it.integry.ems_model.entity.MtbAnomalieUl;
|
||||||
import it.integry.ems_model.entity.MtbColt;
|
import it.integry.ems_model.entity.MtbColt;
|
||||||
import it.integry.ems_model.entity.MtbLivelliAnomalie;
|
import it.integry.ems_model.entity.MtbLivelliAnomalie;
|
||||||
import it.integry.ems_model.types.OperationType;
|
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.PageableRequestDTO;
|
||||||
import it.integry.ems_model.utility.dto.PaginatedDTO;
|
import it.integry.ems_model.utility.dto.PaginatedDTO;
|
||||||
import org.jfree.util.ObjectList;
|
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import javax.validation.constraints.NotNull;
|
import java.util.ArrayList;
|
||||||
import java.util.*;
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
import java.util.stream.Stream;
|
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class AnomalieUlService {
|
public class AnomalieUlService {
|
||||||
|
|
||||||
private final EntityCacheComponent entityCacheComponent;
|
private final EntityCacheComponent entityCacheComponent;
|
||||||
private final EntityProcessor entityProcessor;
|
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.entityCacheComponent = entityCacheComponent;
|
||||||
this.entityProcessor = entityProcessor;
|
this.entityProcessor = entityProcessor;
|
||||||
|
this.mtbAartRepository = mtbAartRepository;
|
||||||
}
|
}
|
||||||
|
|
||||||
public PaginatedDTO<AnomalieMerceDTO> getAnomalieProd(PageableRequestDTO requestDTO, Connection connection) throws Exception {
|
public PaginatedDTO<AnomalieMerceDTO> getAnomalieProd(PageableRequestDTO requestDTO, Connection connection) throws Exception {
|
||||||
@@ -78,14 +81,13 @@ public class AnomalieUlService {
|
|||||||
if (UtilityList.isNullOrEmpty(ulDetails))
|
if (UtilityList.isNullOrEmpty(ulDetails))
|
||||||
return new ArrayList<>();
|
return new ArrayList<>();
|
||||||
|
|
||||||
List<String> codMarts = ulDetails.stream().map(DettaglioULDTO::getCodMart).distinct().collect(Collectors.toList());
|
for (DettaglioULDTO ulDetail : ulDetails) {
|
||||||
Map<String, MtbAart> artMap = entityCacheComponent.<MtbAart>getCachedEntitiesStream(connection.getIntegryCustomerDB(), MtbAart.ENTITY, art -> codMarts.contains(art.getCodMart())).collect(Collectors.toMap(MtbAart::getCodMart, x -> x));
|
final MtbAart mtbAart = mtbAartRepository.findByCodMart(ulDetail.getCodMart()).get();
|
||||||
ulDetails.forEach(ul -> {
|
ulDetail.setDescrizione(mtbAart.getDescrizione())
|
||||||
MtbAart art = artMap.get(ul.getCodMart());
|
.setDescrizioneEstesa(mtbAart.getDescrizioneEstesa())
|
||||||
ul.setDescrizione(art.getDescrizione())
|
.setUntMis(mtbAart.getUntMis());
|
||||||
.setDescrizioneEstesa(art.getDescrizioneEstesa())
|
}
|
||||||
.setUntMis(art.getUntMis());
|
|
||||||
});
|
|
||||||
|
|
||||||
return ulDetails;
|
return ulDetails;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import it.integry.ems._context.ApplicationContextProvider;
|
|||||||
import it.integry.ems.exception.MissingDataException;
|
import it.integry.ems.exception.MissingDataException;
|
||||||
import it.integry.ems.exception.PrimaryDatabaseNotPresentException;
|
import it.integry.ems.exception.PrimaryDatabaseNotPresentException;
|
||||||
import it.integry.ems.javabeans.RequestDataDTO;
|
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.dto.*;
|
||||||
import it.integry.ems.retail.wms.exceptions.InvalidArticoloException;
|
import it.integry.ems.retail.wms.exceptions.InvalidArticoloException;
|
||||||
import it.integry.ems.retail.wms.generic.dto.MvwSitArtUdcDetInventarioDTO;
|
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.Connection;
|
||||||
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
|
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
|
||||||
import it.integry.ems.utility.UtilityEntity;
|
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.*;
|
||||||
import it.integry.ems_model.entity._enum.GestioneEnum;
|
import it.integry.ems_model.entity._enum.GestioneEnum;
|
||||||
import it.integry.ems_model.rulescompleting.DroolsDataCompleting;
|
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 {
|
public static InsertUDSRowResponseDTO insertUDSLavorazioneRowMovement(Connection connection, InsertUDSRowRequestDTO insertUDSRowRequestDTO, String username) throws Exception {
|
||||||
DroolsDataCompleting droolsDataCompleting = ApplicationContextProvider.getApplicationContext().getBean(DroolsDataCompleting.class);
|
DroolsDataCompleting droolsDataCompleting = ApplicationContextProvider.getApplicationContext().getBean(DroolsDataCompleting.class);
|
||||||
|
MtbAartRepository mtbAartRepository = ApplicationContextProvider.getApplicationContext().getBean(MtbAartRepository.class);
|
||||||
|
|
||||||
//Prendo solo la chiave
|
//Prendo solo la chiave
|
||||||
MtbColt targetMtbColt = insertUDSRowRequestDTO.getTargetMtbColt();
|
MtbColt targetMtbColt = insertUDSRowRequestDTO.getTargetMtbColt();
|
||||||
if (targetMtbColt == null)
|
if (targetMtbColt == null)
|
||||||
throw new Exception("Nessun collo di destinazione specificato durante l'inserimento di una riga in una UDS (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)
|
MtbAart mtbAart = mtbAartRepository.findByCodMart(insertUDSRowRequestDTO.getCodMart())
|
||||||
throw new InvalidArticoloException(insertUDSRowRequestDTO.getCodMart());
|
.orElseThrow(() -> new InvalidArticoloException(insertUDSRowRequestDTO.getCodMart()));
|
||||||
|
|
||||||
MtbColrInfoProd mtbColrInfoProd = null;
|
MtbColrInfoProd mtbColrInfoProd = null;
|
||||||
|
|
||||||
@@ -505,6 +506,8 @@ public class WMSUtility {
|
|||||||
|
|
||||||
public static InsertUDCRowResponseDTO insertUDCRow(InsertUDCRowRequestDTO insertUDCRowRequestDTO, EntityProcessor entityProcessor, MultiDBTransactionManager multiDBTransactionManager) throws Exception {
|
public static InsertUDCRowResponseDTO insertUDCRow(InsertUDCRowRequestDTO insertUDCRowRequestDTO, EntityProcessor entityProcessor, MultiDBTransactionManager multiDBTransactionManager) throws Exception {
|
||||||
|
|
||||||
|
MtbAartRepository mtbAartRepository = ApplicationContextProvider.getApplicationContext().getBean(MtbAartRepository.class);
|
||||||
|
|
||||||
MtbColt targetMtbColt = insertUDCRowRequestDTO.getTargetMtbColt();
|
MtbColt targetMtbColt = insertUDCRowRequestDTO.getTargetMtbColt();
|
||||||
|
|
||||||
if (targetMtbColt == null)
|
if (targetMtbColt == null)
|
||||||
@@ -540,9 +543,8 @@ public class WMSUtility {
|
|||||||
|
|
||||||
|
|
||||||
if (insertUDCRowRequestDTO.getCodMart() != null) {
|
if (insertUDCRowRequestDTO.getCodMart() != null) {
|
||||||
MtbAart mtbAart = MtbAartUtils.getArticoloByCodMart(insertUDCRowRequestDTO.getCodMart(), multiDBTransactionManager.getPrimaryConnection());
|
MtbAart mtbAart = mtbAartRepository.findByCodMart(insertUDCRowRequestDTO.getCodMart())
|
||||||
if (mtbAart == null)
|
.orElseThrow(() -> new InvalidArticoloException(insertUDCRowRequestDTO.getCodMart()));
|
||||||
throw new InvalidArticoloException(insertUDCRowRequestDTO.getCodMart());
|
|
||||||
|
|
||||||
targetMtbColr
|
targetMtbColr
|
||||||
.setCodMart(mtbAart.getCodMart())
|
.setCodMart(mtbAart.getCodMart())
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package it.integry.ems.retail.wms.accettazione.service;
|
package it.integry.ems.retail.wms.accettazione.service;
|
||||||
|
|
||||||
import it.integry.ems.javabeans.RequestDataDTO;
|
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.product.importaz.service.ProductServices;
|
||||||
import it.integry.ems.retail.wms.accettazione.dto.AlreadyRegisteredUlDTO;
|
import it.integry.ems.retail.wms.accettazione.dto.AlreadyRegisteredUlDTO;
|
||||||
import it.integry.ems.retail.wms.accettazione.dto.BollaAccettazioneDTO;
|
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.service.EntityProcessor;
|
||||||
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
|
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
|
||||||
import it.integry.ems.user.UserSession;
|
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.MtbAart;
|
||||||
import it.integry.ems_model.entity.WdtbDoct;
|
import it.integry.ems_model.entity.WdtbDoct;
|
||||||
import it.integry.ems_model.types.OperationType;
|
import it.integry.ems_model.types.OperationType;
|
||||||
@@ -43,6 +43,8 @@ public class WMSAccettazioneBollaService {
|
|||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private UserSession userSession;
|
private UserSession userSession;
|
||||||
|
@Autowired
|
||||||
|
private MtbAartRepository mtbAartRepository;
|
||||||
|
|
||||||
public List<BollaAccettazioneDTO> retrieveBolleDaAccettare() throws Exception {
|
public List<BollaAccettazioneDTO> retrieveBolleDaAccettare() throws Exception {
|
||||||
|
|
||||||
@@ -166,11 +168,11 @@ public class WMSAccettazioneBollaService {
|
|||||||
|
|
||||||
if (sitBollaAccettazioneDTOS == null || sitBollaAccettazioneDTOS.isEmpty()) return null;
|
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)
|
.map(SitBollaAccettazioneDTO::getCodMart)
|
||||||
.filter(Objects::nonNull)
|
.filter(Objects::nonNull)
|
||||||
.distinct()
|
.distinct()
|
||||||
.collect(Collectors.toList()), multiDBTransactionManager.getPrimaryConnection());
|
.collect(Collectors.toList()));
|
||||||
|
|
||||||
final Map<String, BigDecimal> qtaCnfsByArt = articoliByCodMarts.stream()
|
final Map<String, BigDecimal> qtaCnfsByArt = articoliByCodMarts.stream()
|
||||||
.collect(Collectors.toMap(MtbAart::getCodMart, MtbAart::getQtaCnf));
|
.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.exception.PrimaryDatabaseNotPresentException;
|
||||||
import it.integry.ems.javabeans.RequestDataDTO;
|
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.product.importaz.service.ProductServices;
|
||||||
import it.integry.ems.retail.pvmRetail.dto.OrdineInevasoDTO;
|
import it.integry.ems.retail.pvmRetail.dto.OrdineInevasoDTO;
|
||||||
import it.integry.ems.retail.wms.Utility.WMSUtility;
|
import it.integry.ems.retail.wms.Utility.WMSUtility;
|
||||||
@@ -69,6 +70,9 @@ public class WMSAccettazioneService {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private AziendaService aziendaService;
|
private AziendaService aziendaService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private MtbAartRepository mtbAartRepository;
|
||||||
|
|
||||||
public MtbColt createUDC(CreateUDCRequestDTO createUDCRequestDTO) throws Exception {
|
public MtbColt createUDC(CreateUDCRequestDTO createUDCRequestDTO) throws Exception {
|
||||||
if (!userSession.isAttivo()) {
|
if (!userSession.isAttivo()) {
|
||||||
throw new UsernameNotFoundException("Utente " + userSession.getUsername() + " non riconoscuto!");
|
throw new UsernameNotFoundException("Utente " + userSession.getUsername() + " non riconoscuto!");
|
||||||
@@ -291,7 +295,7 @@ public class WMSAccettazioneService {
|
|||||||
.distinct()
|
.distinct()
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
List<MtbAart> mtbAarts = productServices.getArticoliByCodMarts(codMarts);
|
List<MtbAart> mtbAarts = mtbAartRepository.findByCodMartIn(codMarts);
|
||||||
|
|
||||||
MtbColt targetMtbColt = inputData.getTargetMtbColt();
|
MtbColt targetMtbColt = inputData.getTargetMtbColt();
|
||||||
targetMtbColt.setOperation(OperationType.SELECT_OBJECT);
|
targetMtbColt.setOperation(OperationType.SELECT_OBJECT);
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package it.integry.ems.retail.wms.documenti.service;
|
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.product.importaz.service.ProductServices;
|
||||||
import it.integry.ems.retail.pvmRetail.dto.PvmArticoliChildDTO;
|
import it.integry.ems.retail.pvmRetail.dto.PvmArticoliChildDTO;
|
||||||
import it.integry.ems.retail.pvmRetail.dto.PvmArticoliDTO;
|
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.retail.wms.documenti.dto.RetrieveLottiDTO;
|
||||||
import it.integry.ems.sync.MultiDBTransaction.Connection;
|
import it.integry.ems.sync.MultiDBTransaction.Connection;
|
||||||
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
|
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
|
||||||
import it.integry.ems.utility.entity.MtbUntMisUtils;
|
|
||||||
import it.integry.ems_model.entity.MtbUntMis;
|
import it.integry.ems_model.entity.MtbUntMis;
|
||||||
import it.integry.ems_model.entity._enum.GestioneEnum;
|
import it.integry.ems_model.entity._enum.GestioneEnum;
|
||||||
import it.integry.ems_model.service.SetupGest;
|
import it.integry.ems_model.service.SetupGest;
|
||||||
@@ -38,6 +38,8 @@ public class WMSDocumentService {
|
|||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private SetupGest setupGest;
|
private SetupGest setupGest;
|
||||||
|
@Autowired
|
||||||
|
private MtbUntMisRepository mtbUntMisRepository;
|
||||||
|
|
||||||
public Boolean checkDoc(String fornitore, String numDoc, Date dataDoc, String tipoDoc) throws Exception {
|
public Boolean checkDoc(String fornitore, String numDoc, Date dataDoc, String tipoDoc) throws Exception {
|
||||||
Connection conn = multiDBTransactionManager.getPrimaryConnection();
|
Connection conn = multiDBTransactionManager.getPrimaryConnection();
|
||||||
@@ -114,7 +116,8 @@ public class WMSDocumentService {
|
|||||||
.distinct()
|
.distinct()
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
final List<MtbUntMis> untMisFromCod = MtbUntMisUtils.getFromCods(untMiss, multiDBTransactionManager.getPrimaryConnection());
|
|
||||||
|
final List<MtbUntMis> untMisFromCod = mtbUntMisRepository.findByUntMisIn(untMiss);
|
||||||
|
|
||||||
for (DocumentArtDTO art : arts) {
|
for (DocumentArtDTO art : arts) {
|
||||||
final MtbUntMis mtbUntMis = untMisFromCod.stream().filter(x -> x.getUntMis().equalsIgnoreCase(art.getUntMis()))
|
final MtbUntMis mtbUntMis = untMisFromCod.stream().filter(x -> x.getUntMis().equalsIgnoreCase(art.getUntMis()))
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package it.integry.ems.retail.wms.generic.controller;
|
package it.integry.ems.retail.wms.generic.controller;
|
||||||
|
|
||||||
import it.integry.common.var.CommonConstants;
|
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.product.importaz.service.ProductServices;
|
||||||
import it.integry.ems.response.ServiceRestResponse;
|
import it.integry.ems.response.ServiceRestResponse;
|
||||||
import it.integry.ems.retail.wms.generic.dto.*;
|
import it.integry.ems.retail.wms.generic.dto.*;
|
||||||
@@ -37,6 +38,8 @@ public class WMSArticoloController {
|
|||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private UserSession userSession;
|
private UserSession userSession;
|
||||||
|
@Autowired
|
||||||
|
private MtbAartRepository mtbAartRepository;
|
||||||
|
|
||||||
|
|
||||||
@RequestMapping(value = "", method = RequestMethod.GET)
|
@RequestMapping(value = "", method = RequestMethod.GET)
|
||||||
@@ -93,8 +96,7 @@ public class WMSArticoloController {
|
|||||||
ServiceRestResponse searchByCodMartOrBarcode(@RequestParam(CommonConstants.PROFILE_DB) String profileDB,
|
ServiceRestResponse searchByCodMartOrBarcode(@RequestParam(CommonConstants.PROFILE_DB) String profileDB,
|
||||||
@RequestBody RetrieveArticoloByCodMartRequestDTO retrieveArticoloByCodMartRequest) throws Exception {
|
@RequestBody RetrieveArticoloByCodMartRequestDTO retrieveArticoloByCodMartRequest) throws Exception {
|
||||||
|
|
||||||
return ServiceRestResponse.createPositiveResponse(
|
return ServiceRestResponse.createPositiveResponse(mtbAartRepository.findByCodMartIn(retrieveArticoloByCodMartRequest.getCodMarts()));
|
||||||
productServices.getArticoliByCodMarts(retrieveArticoloByCodMartRequest.getCodMarts()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import it.integry.common.var.CommonConstants;
|
|||||||
import it.integry.ems.Import.dto.AnomalieDTO;
|
import it.integry.ems.Import.dto.AnomalieDTO;
|
||||||
import it.integry.ems.exception.MissingDataException;
|
import it.integry.ems.exception.MissingDataException;
|
||||||
import it.integry.ems.javabeans.RequestDataDTO;
|
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.product.importaz.service.ProductServices;
|
||||||
import it.integry.ems.report.dto.PairsDTO;
|
import it.integry.ems.report.dto.PairsDTO;
|
||||||
import it.integry.ems.report.dto.ReportTypeDTO;
|
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.sync.MultiDBTransaction.MultiDBTransactionManager;
|
||||||
import it.integry.ems.user.UserSession;
|
import it.integry.ems.user.UserSession;
|
||||||
import it.integry.ems.utility.UtilityEntity;
|
import it.integry.ems.utility.UtilityEntity;
|
||||||
import it.integry.ems.utility.entity.MtbAartUtils;
|
|
||||||
import it.integry.ems.utility.entity.MtbDepoPosizioniUtils;
|
import it.integry.ems.utility.entity.MtbDepoPosizioniUtils;
|
||||||
import it.integry.ems_model.base.EntityBase;
|
import it.integry.ems_model.base.EntityBase;
|
||||||
import it.integry.ems_model.config.EmsRestConstants;
|
import it.integry.ems_model.config.EmsRestConstants;
|
||||||
@@ -106,6 +106,8 @@ public class WMSGenericService {
|
|||||||
private WMSAccettazioneService wmsAccettazioneService;
|
private WMSAccettazioneService wmsAccettazioneService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private WMSGiacenzaULService wmsGiacenzaULService;
|
private WMSGiacenzaULService wmsGiacenzaULService;
|
||||||
|
@Autowired
|
||||||
|
private MtbAartRepository mtbAartRepository;
|
||||||
|
|
||||||
public List<AvailableCodMdepDTO> getAvailableCodMdepsForUser() throws Exception {
|
public List<AvailableCodMdepDTO> getAvailableCodMdepsForUser() throws Exception {
|
||||||
|
|
||||||
@@ -787,7 +789,7 @@ public class WMSGenericService {
|
|||||||
.distinct()
|
.distinct()
|
||||||
.toList();
|
.toList();
|
||||||
|
|
||||||
final List<MtbAart> mtbAarts = MtbAartUtils.getArticoliByCodMarts(codMarts, multiDBTransactionManager.getPrimaryConnection());
|
final List<MtbAart> mtbAarts = mtbAartRepository.findByCodMartIn(codMarts);
|
||||||
|
|
||||||
|
|
||||||
//Carico la giacenza degli articoli
|
//Carico la giacenza degli articoli
|
||||||
@@ -2530,17 +2532,17 @@ public class WMSGenericService {
|
|||||||
.distinct()
|
.distinct()
|
||||||
.toList();
|
.toList();
|
||||||
|
|
||||||
List<MtbAart> mtbAarts = MtbAartUtils.getArticoliByCodMarts(codMarts, multiDBTransactionManager.getPrimaryConnection());
|
List<MtbAart> mtbAarts = mtbAartRepository.findByCodMartIn(codMarts);
|
||||||
|
|
||||||
List<MtbColt> mtbColtToSave = new ArrayList<>();
|
List<MtbColt> mtbColtToSave = new ArrayList<>();
|
||||||
List<MtbColr> successMtbColr = new ArrayList<>();
|
List<MtbColr> successMtbColr = new ArrayList<>();
|
||||||
List<MtbColr> failedMtbColr = new ArrayList<>();
|
List<MtbColr> failedMtbColr = new ArrayList<>();
|
||||||
|
|
||||||
for (MtbColr inputMtbColr : resultRows) {
|
for (MtbColr inputMtbColr : resultRows) {
|
||||||
MtbAart mtbAart = Stream.of(mtbAarts)
|
MtbAart mtbAart = mtbAarts.stream()
|
||||||
.filter(x -> x.getCodMart().equals(inputMtbColr.getCodMart()))
|
.filter(x -> x.getCodMart().equals(inputMtbColr.getCodMart()))
|
||||||
.findFirst()
|
.findFirst()
|
||||||
.get();
|
.orElse(null);
|
||||||
|
|
||||||
inputMtbColr
|
inputMtbColr
|
||||||
.setOnlyPkMaster(false);
|
.setOnlyPkMaster(false);
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package it.integry.ems.retail.wms.inventario.service;
|
package it.integry.ems.retail.wms.inventario.service;
|
||||||
|
|
||||||
import it.integry.common.var.CommonConstants;
|
import it.integry.common.var.CommonConstants;
|
||||||
|
import it.integry.ems.jpa.repository.MtbUntMisRepository;
|
||||||
import it.integry.ems.json.ResponseJSONObjectMapper;
|
import it.integry.ems.json.ResponseJSONObjectMapper;
|
||||||
import it.integry.ems.product.importaz.service.ProductServices;
|
import it.integry.ems.product.importaz.service.ProductServices;
|
||||||
import it.integry.ems.retail.pvmRetail.dto.PvmArticoliChildDTO;
|
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.sync.MultiDBTransaction.MultiDBTransactionManager;
|
||||||
import it.integry.ems.utility.UtilityDirs;
|
import it.integry.ems.utility.UtilityDirs;
|
||||||
import it.integry.ems.utility.UtilityFile;
|
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.MtbInvenr;
|
||||||
import it.integry.ems_model.entity.MtbInvent;
|
import it.integry.ems_model.entity.MtbInvent;
|
||||||
import it.integry.ems_model.entity.MtbUntMis;
|
import it.integry.ems_model.entity.MtbUntMis;
|
||||||
@@ -58,6 +58,8 @@ public class WMSInventarioService {
|
|||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ResponseJSONObjectMapper jsonObjectMapper;
|
private ResponseJSONObjectMapper jsonObjectMapper;
|
||||||
|
@Autowired
|
||||||
|
private MtbUntMisRepository mtbUntMisRepository;
|
||||||
|
|
||||||
|
|
||||||
public MtbInvent loadInventarioIfExists(int inventoryId, String codMdep) throws Exception {
|
public MtbInvent loadInventarioIfExists(int inventoryId, String codMdep) throws Exception {
|
||||||
@@ -136,7 +138,7 @@ public class WMSInventarioService {
|
|||||||
.distinct()
|
.distinct()
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
final List<MtbUntMis> untMisFromCod = MtbUntMisUtils.getFromCods(untMiss, multiDBTransactionManager.getPrimaryConnection());
|
final List<MtbUntMis> untMisFromCod = mtbUntMisRepository.findByUntMisIn(untMiss);
|
||||||
|
|
||||||
for (InventarioArtDTO art : arts) {
|
for (InventarioArtDTO art : arts) {
|
||||||
final MtbUntMis mtbUntMis = untMisFromCod.stream().filter(x -> x.getUntMis().equalsIgnoreCase(art.getUntMis()))
|
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.ProduzioneOrdineDTO;
|
||||||
import it.integry.ems.document.dto.ScarichiArticoloDTO;
|
import it.integry.ems.document.dto.ScarichiArticoloDTO;
|
||||||
import it.integry.ems.javabeans.RequestDataDTO;
|
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.logistic.dto.sm2.FiltroDistribuzioneColloDTO;
|
||||||
import it.integry.ems.product.importaz.service.ProductServices;
|
import it.integry.ems.product.importaz.service.ProductServices;
|
||||||
import it.integry.ems.retail.wms.Utility.WMSUtility;
|
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.sync.MultiDBTransaction.MultiDBTransactionManager;
|
||||||
import it.integry.ems.user.UserSession;
|
import it.integry.ems.user.UserSession;
|
||||||
import it.integry.ems.utility.UtilityEntity;
|
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.base.EntityBase;
|
||||||
import it.integry.ems_model.entity.*;
|
import it.integry.ems_model.entity.*;
|
||||||
import it.integry.ems_model.entity._enum.GestioneEnum;
|
import it.integry.ems_model.entity._enum.GestioneEnum;
|
||||||
@@ -75,6 +75,8 @@ public class WMSLavorazioneService {
|
|||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private AziendaService aziendaService;
|
private AziendaService aziendaService;
|
||||||
|
@Autowired
|
||||||
|
private MtbAartRepository mtbAartRepository;
|
||||||
|
|
||||||
public MtbColt createUDS(CreateUDSRequestDTO createUDSRequestDTO) throws Exception {
|
public MtbColt createUDS(CreateUDSRequestDTO createUDSRequestDTO) throws Exception {
|
||||||
|
|
||||||
@@ -265,9 +267,9 @@ public class WMSLavorazioneService {
|
|||||||
entityProcessor.processEntity(targetMtbColt, true, multiDBTransactionManager);
|
entityProcessor.processEntity(targetMtbColt, true, multiDBTransactionManager);
|
||||||
|
|
||||||
|
|
||||||
MtbAart mtbAart = MtbAartUtils.getArticoloByCodMart(insertUDSRowRequestDTO.getCodMart(), multiDBTransactionManager.getPrimaryConnection());
|
MtbAart mtbAart = mtbAartRepository.findByCodMart(insertUDSRowRequestDTO.getCodMart())
|
||||||
if (mtbAart == null)
|
.orElseThrow(() -> new InvalidArticoloException(insertUDSRowRequestDTO.getCodMart()));
|
||||||
throw new InvalidArticoloException(insertUDSRowRequestDTO.getCodMart());
|
|
||||||
|
|
||||||
MtbColrInfoProd mtbColrInfoProd = null;
|
MtbColrInfoProd mtbColrInfoProd = null;
|
||||||
|
|
||||||
@@ -351,7 +353,8 @@ public class WMSLavorazioneService {
|
|||||||
.distinct()
|
.distinct()
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
List<MtbAart> mtbAarts = productServices.getArticoliByCodMarts(codMarts);
|
|
||||||
|
List<MtbAart> mtbAarts = mtbAartRepository.findByCodMartIn(codMarts);
|
||||||
|
|
||||||
//Prendo solo la chiave
|
//Prendo solo la chiave
|
||||||
MtbColt targetMtbColt = new MtbColt()
|
MtbColt targetMtbColt = new MtbColt()
|
||||||
@@ -606,7 +609,7 @@ public class WMSLavorazioneService {
|
|||||||
.setCodMdep(createUDCRequestDTO.getCodMdep())
|
.setCodMdep(createUDCRequestDTO.getCodMdep())
|
||||||
.setCodVdes(createUDCRequestDTO.getCodVdes())
|
.setCodVdes(createUDCRequestDTO.getCodVdes())
|
||||||
.setOraInizPrep(new Date())
|
.setOraInizPrep(new Date())
|
||||||
.setPreparatoDa(UtilityString.isNull(createUDCRequestDTO.getPreparatoDa(),requestDataDTO.getUsername()))
|
.setPreparatoDa(UtilityString.isNull(createUDCRequestDTO.getPreparatoDa(), requestDataDTO.getUsername()))
|
||||||
.setPosizione(UtilityString.isNull(createUDCRequestDTO.getPosizione(), defaultPosizioneColliAccettazione))
|
.setPosizione(UtilityString.isNull(createUDCRequestDTO.getPosizione(), defaultPosizioneColliAccettazione))
|
||||||
.setCodTcol(createUDCRequestDTO.getCodTcol())
|
.setCodTcol(createUDCRequestDTO.getCodTcol())
|
||||||
.setCodJfas(createUDCRequestDTO.getCodJfas())
|
.setCodJfas(createUDCRequestDTO.getCodJfas())
|
||||||
@@ -859,7 +862,7 @@ public class WMSLavorazioneService {
|
|||||||
|
|
||||||
public String getEtichettaSSCCOrdine(DtbOrdt ordine) throws Exception {
|
public String getEtichettaSSCCOrdine(DtbOrdt ordine) throws Exception {
|
||||||
ordine.setOperation(OperationType.SELECT_OBJECT);
|
ordine.setOperation(OperationType.SELECT_OBJECT);
|
||||||
entityProcessor.processEntity(ordine,true,multiDBTransactionManager);
|
entityProcessor.processEntity(ordine, true, multiDBTransactionManager);
|
||||||
if (UtilityString.isNullOrEmpty(ordine.getCodProd())) {
|
if (UtilityString.isNullOrEmpty(ordine.getCodProd())) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package it.integry.ems.retail.wms.lavorazione.service;
|
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.production.service.MesProductionServiceV2;
|
||||||
import it.integry.ems.retail.wms.Utility.WMSUtility;
|
import it.integry.ems.retail.wms.Utility.WMSUtility;
|
||||||
import it.integry.ems.retail.wms.exceptions.InvalidArticoloException;
|
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.sync.MultiDBTransaction.MultiDBTransactionManager;
|
||||||
import it.integry.ems.user.UserSession;
|
import it.integry.ems.user.UserSession;
|
||||||
import it.integry.ems.utility.UtilityEntity;
|
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.base.EntityBase;
|
||||||
import it.integry.ems_model.entity.*;
|
import it.integry.ems_model.entity.*;
|
||||||
import it.integry.ems_model.service.SetupGest;
|
import it.integry.ems_model.service.SetupGest;
|
||||||
@@ -52,6 +52,8 @@ public class WMSMaterialiService {
|
|||||||
private UserSession userSession;
|
private UserSession userSession;
|
||||||
|
|
||||||
private final Logger logger = LogManager.getLogger();
|
private final Logger logger = LogManager.getLogger();
|
||||||
|
@Autowired
|
||||||
|
private MtbAartRepository mtbAartRepository;
|
||||||
|
|
||||||
public VersaMaterialiResponseDTO versa(VersaMaterialiRequestDTO request) throws Exception {
|
public VersaMaterialiResponseDTO versa(VersaMaterialiRequestDTO request) throws Exception {
|
||||||
final boolean versamentoDirettoEnabled = setupGest.getSetupBoolean(multiDBTransactionManager.getPrimaryConnection(), "PICKING", "PRODUZIONE", "FLAG_VERSAMENTO_DIRETTO");
|
final boolean versamentoDirettoEnabled = setupGest.getSetupBoolean(multiDBTransactionManager.getPrimaryConnection(), "PICKING", "PRODUZIONE", "FLAG_VERSAMENTO_DIRETTO");
|
||||||
@@ -94,9 +96,8 @@ public class WMSMaterialiService {
|
|||||||
if (!versamentoDirettoEnabled) {
|
if (!versamentoDirettoEnabled) {
|
||||||
MvwSitArtUdcDetInventarioDTO itemDaVersare = artsInGiacenza.get(0);
|
MvwSitArtUdcDetInventarioDTO itemDaVersare = artsInGiacenza.get(0);
|
||||||
|
|
||||||
MtbAart mtbAart = MtbAartUtils.getArticoloByCodMart(itemDaVersare.getCodMart(), multiDBTransactionManager.getPrimaryConnection());
|
MtbAart mtbAart = mtbAartRepository.findByCodMart(itemDaVersare.getCodMart())
|
||||||
if (mtbAart == null)
|
.orElseThrow(() -> new InvalidArticoloException(request.getCodMart()));
|
||||||
throw new InvalidArticoloException(request.getCodMart());
|
|
||||||
|
|
||||||
if (posizioneVersamento == null)
|
if (posizioneVersamento == null)
|
||||||
throw new Exception("Posizione di versamento non trovata (" + request.getPosizioneVersamento() + ")");
|
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 versamentoDirettoEnabled = setupGest.getSetupBoolean(multiDBTransactionManager.getPrimaryConnection(), "PICKING", "PRODUZIONE", "FLAG_VERSAMENTO_DIRETTO");
|
||||||
final boolean forceAllToColli = setupGest.getSetupBoolean(multiDBTransactionManager.getPrimaryConnection(), "PICKING", "SETUP", "FLAG_FORCE_ALL_TO_COLLI");
|
final boolean forceAllToColli = setupGest.getSetupBoolean(multiDBTransactionManager.getPrimaryConnection(), "PICKING", "SETUP", "FLAG_FORCE_ALL_TO_COLLI");
|
||||||
|
|
||||||
MtbAart mtbAart = MtbAartUtils.getArticoloByCodMart(request.getCodMart(), multiDBTransactionManager.getPrimaryConnection());
|
MtbAart mtbAart = mtbAartRepository.findByCodMart(request.getCodMart())
|
||||||
if (mtbAart == null)
|
.orElseThrow(() -> new InvalidArticoloException(request.getCodMart()));
|
||||||
throw new InvalidArticoloException(request.getCodMart());
|
|
||||||
|
|
||||||
if (request.getMtbColtCarico() == null)
|
if (request.getMtbColtCarico() == null)
|
||||||
throw new Exception("Indicare una UL in cui effettuare il carico del materiale");
|
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;
|
package it.integry.ems.retail.wms.vendita.service;
|
||||||
|
|
||||||
import it.integry.ems.javabeans.RequestDataDTO;
|
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.logistic.dto.sm2.FiltroDistribuzioneColloDTO;
|
||||||
import it.integry.ems.product.importaz.service.ProductServices;
|
import it.integry.ems.product.importaz.service.ProductServices;
|
||||||
import it.integry.ems.retail.pvmRetail.dto.OrdineInevasoDTO;
|
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.sync.MultiDBTransaction.MultiDBTransactionManager;
|
||||||
import it.integry.ems.user.UserSession;
|
import it.integry.ems.user.UserSession;
|
||||||
import it.integry.ems.utility.UtilityEntity;
|
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.base.EntityBase;
|
||||||
import it.integry.ems_model.entity.DtbOrdt;
|
import it.integry.ems_model.entity.DtbOrdt;
|
||||||
import it.integry.ems_model.entity.MtbAart;
|
import it.integry.ems_model.entity.MtbAart;
|
||||||
@@ -71,6 +71,8 @@ public class WMSSpedizioneService {
|
|||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private PvmServiceSave pvmServiceSave;
|
private PvmServiceSave pvmServiceSave;
|
||||||
|
@Autowired
|
||||||
|
private MtbAartRepository mtbAartRepository;
|
||||||
|
|
||||||
public MtbColt createUDS(CreateUDSRequestDTO createUDSRequestDTO) throws Exception {
|
public MtbColt createUDS(CreateUDSRequestDTO createUDSRequestDTO) throws Exception {
|
||||||
|
|
||||||
@@ -245,10 +247,8 @@ public class WMSSpedizioneService {
|
|||||||
entityProcessor.processEntity(targetMtbColt, multiDBTransactionManager);
|
entityProcessor.processEntity(targetMtbColt, multiDBTransactionManager);
|
||||||
|
|
||||||
|
|
||||||
MtbAart mtbAart = MtbAartUtils.getArticoloByCodMart(insertUDSRowRequestDTO.getCodMart(), multiDBTransactionManager.getPrimaryConnection());
|
MtbAart mtbAart = mtbAartRepository.findByCodMart(insertUDSRowRequestDTO.getCodMart())
|
||||||
if (mtbAart == null)
|
.orElseThrow(() -> new InvalidArticoloException(insertUDSRowRequestDTO.getCodMart()));
|
||||||
throw new InvalidArticoloException(insertUDSRowRequestDTO.getCodMart());
|
|
||||||
|
|
||||||
|
|
||||||
final MtbColr targetMtbColr = new MtbColr()
|
final MtbColr targetMtbColr = new MtbColr()
|
||||||
.setCausale(MtbColr.Causale.DEFAULT)
|
.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 –>-->
|
<!-- <!– JBoss RESTEasy Loggers –>-->
|
||||||
<!-- <AsyncLogger name="org.jboss.resteasy" level="INFO" additivity="false"/>-->
|
<!-- <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 -->
|
<!-- Application Logger -->
|
||||||
<AsyncLogger name="it.integry" level="DEBUG" additivity="false" includeLocation="true">
|
<AsyncLogger name="it.integry" level="DEBUG" additivity="false" includeLocation="true">
|
||||||
<AppenderRef ref="console" />
|
<AppenderRef ref="console" />
|
||||||
|
|||||||
@@ -11,6 +11,8 @@
|
|||||||
http://www.springframework.org/schema/mvc/spring-mvc-4.3.xsd">
|
http://www.springframework.org/schema/mvc/spring-mvc-4.3.xsd">
|
||||||
<context:component-scan base-package="it.integry"/>
|
<context:component-scan base-package="it.integry"/>
|
||||||
|
|
||||||
|
<import resource="hibernate-context.xml"/>
|
||||||
|
|
||||||
<bean id="ppConfig" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
|
<bean id="ppConfig" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
|
||||||
<property name="ignoreUnresolvablePlaceholders" value="false"/>
|
<property name="ignoreUnresolvablePlaceholders" value="false"/>
|
||||||
<property name="locations">
|
<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