Compare commits
70 Commits
feature-re
...
develop
| Author | SHA1 | Date | |
|---|---|---|---|
| 635ac0a1c7 | |||
| 8abf441a8a | |||
| 8781b406ff | |||
| c9325674d9 | |||
| 99ca1731b1 | |||
| af6f465c0e | |||
| d981e59a7d | |||
| 6d7212ce97 | |||
| 5103830369 | |||
| 5056d7e0c8 | |||
| 4b5e46de7b | |||
| 4d686ee145 | |||
| e842326f5b | |||
| 63ad11086f | |||
| 21f6fc6717 | |||
| 8c2789b5f3 | |||
| 8f3ef405cf | |||
| 76e76dfcf4 | |||
| 1df5ad7137 | |||
| a43ca46395 | |||
| a63eba544b | |||
| ce912bf103 | |||
| ababbf6142 | |||
| e97fd0aacb | |||
| 51c1ed1d23 | |||
| a9be8f7003 | |||
| 7522092a12 | |||
| 4dc0174800 | |||
| a04b2fa4a1 | |||
| 04317470c6 | |||
| 187216dd9f | |||
| e11172a90f | |||
| 51d5b05bd3 | |||
| 3a2ceaf217 | |||
| c783f69a49 | |||
| 1c8695095b | |||
| fc28af761c | |||
| fd4db5ab3b | |||
| f7e1d1f6ca | |||
| 0b8f82f041 | |||
| 99680dccd8 | |||
| e948855fc0 | |||
| 0854acacfb | |||
| 1aba141c9f | |||
| 741cb960d4 | |||
| 313bfc21ff | |||
| 36f50ad846 | |||
| 4e3d15ebd8 | |||
| 8afa01d8ef | |||
| db1949b5b6 | |||
| 92cd4b1af5 | |||
| 671c2e99d0 | |||
| e8a1a8ca0b | |||
| 78dbf9f7e3 | |||
| 1d52f79337 | |||
| 0e1adccb7c | |||
| fa76a8e92d | |||
| 9b34a51bd9 | |||
| b75f7e3810 | |||
| 4aeccdfa76 | |||
| 39db8e6e1b | |||
| 1b87cacca2 | |||
| 326bd4294e | |||
| e887aceaaf | |||
| 55f23b2dfc | |||
| 1ef49b87e8 | |||
| 920257812c | |||
| 77c79c6247 | |||
| c26f7feb35 | |||
| 21cc88f295 |
18
.idea/copilotDiffState.xml
generated
Normal file
18
.idea/copilotDiffState.xml
generated
Normal file
File diff suppressed because one or more lines are too long
33
.idea/dataSources.xml
generated
33
.idea/dataSources.xml
generated
@@ -1,11 +1,40 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="DataSourceManagerImpl" format="xml" multifile-model="true">
|
||||
<data-source source="LOCAL" name="@SERVERDB2019" uuid="ff4f0bad-7271-429e-a4e1-bae28629efc8">
|
||||
<data-source source="LOCAL" name="Biolevante@SERVERDB2019" uuid="ff4f0bad-7271-429e-a4e1-bae28629efc8">
|
||||
<driver-ref>sqlserver.ms</driver-ref>
|
||||
<synchronize>true</synchronize>
|
||||
<jdbc-driver>com.microsoft.sqlserver.jdbc.SQLServerDriver</jdbc-driver>
|
||||
<jdbc-url>jdbc:sqlserver://SERVERDB2019</jdbc-url>
|
||||
<jdbc-url>jdbc:sqlserver://SERVERDB2019\MSSQLSERVER;database=Biolevante</jdbc-url>
|
||||
<jdbc-additional-properties>
|
||||
<property name="com.intellij.clouds.kubernetes.db.host.port" />
|
||||
<property name="com.intellij.clouds.kubernetes.db.enabled" value="false" />
|
||||
<property name="com.intellij.clouds.kubernetes.db.container.port" />
|
||||
</jdbc-additional-properties>
|
||||
<working-dir>$ProjectFileDir$</working-dir>
|
||||
</data-source>
|
||||
<data-source source="LOCAL" name="Gramm@SERVERDB2019" uuid="02282d62-6d2a-4b83-bdcf-b558fa6db140">
|
||||
<driver-ref>sqlserver.ms</driver-ref>
|
||||
<synchronize>true</synchronize>
|
||||
<jdbc-driver>com.microsoft.sqlserver.jdbc.SQLServerDriver</jdbc-driver>
|
||||
<jdbc-url>jdbc:sqlserver://SERVERDB2019\MSSQLSERVER;database=Gramm</jdbc-url>
|
||||
<jdbc-additional-properties>
|
||||
<property name="com.intellij.clouds.kubernetes.db.host.port" />
|
||||
<property name="com.intellij.clouds.kubernetes.db.enabled" value="false" />
|
||||
<property name="com.intellij.clouds.kubernetes.db.container.port" />
|
||||
</jdbc-additional-properties>
|
||||
<working-dir>$ProjectFileDir$</working-dir>
|
||||
</data-source>
|
||||
<data-source source="LOCAL" name="vgalimenti@SERVERDB" uuid="eaf0bcaf-4620-478b-b63c-42e77902813f">
|
||||
<driver-ref>sqlserver.ms</driver-ref>
|
||||
<synchronize>true</synchronize>
|
||||
<jdbc-driver>com.microsoft.sqlserver.jdbc.SQLServerDriver</jdbc-driver>
|
||||
<jdbc-url>jdbc:sqlserver://SERVERDB\MSSQLSERVER;database=vgalimenti</jdbc-url>
|
||||
<jdbc-additional-properties>
|
||||
<property name="com.intellij.clouds.kubernetes.db.host.port" />
|
||||
<property name="com.intellij.clouds.kubernetes.db.enabled" value="false" />
|
||||
<property name="com.intellij.clouds.kubernetes.db.container.port" />
|
||||
</jdbc-additional-properties>
|
||||
<working-dir>$ProjectFileDir$</working-dir>
|
||||
</data-source>
|
||||
</component>
|
||||
|
||||
8
.idea/data_source_mapping.xml
generated
Normal file
8
.idea/data_source_mapping.xml
generated
Normal file
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="DataSourcePerFileMappings">
|
||||
<file url="file://$PROJECT_DIR$/.idea/queries/Query.sql" value="ff4f0bad-7271-429e-a4e1-bae28629efc8" />
|
||||
<file url="file://$PROJECT_DIR$/.idea/queries/Query_1.sql" value="02282d62-6d2a-4b83-bdcf-b558fa6db140" />
|
||||
<file url="file://$PROJECT_DIR$/.idea/queries/Query_2.sql" value="eaf0bcaf-4620-478b-b63c-42e77902813f" />
|
||||
</component>
|
||||
</project>
|
||||
6
.idea/db-forest-config.xml
generated
Normal file
6
.idea/db-forest-config.xml
generated
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="db-tree-configuration">
|
||||
<option name="data" value="---------------------------------------- 1:0:ff4f0bad-7271-429e-a4e1-bae28629efc8 2:0:02282d62-6d2a-4b83-bdcf-b558fa6db140 3:0:eaf0bcaf-4620-478b-b63c-42e77902813f " />
|
||||
</component>
|
||||
</project>
|
||||
5
.idea/jarRepositories.xml
generated
5
.idea/jarRepositories.xml
generated
@@ -1,6 +1,11 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="RemoteRepositoriesConfiguration">
|
||||
<remote-repository>
|
||||
<option name="id" value="central" />
|
||||
<option name="name" value="central" />
|
||||
<option name="url" value="https://repo.maven.apache.org/maven2" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="central" />
|
||||
<option name="name" value="Central Repository" />
|
||||
|
||||
8
.idea/sqldialects.xml
generated
Normal file
8
.idea/sqldialects.xml
generated
Normal file
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="SqlDialectMappings">
|
||||
<file url="file://$PROJECT_DIR$/.idea/queries/Query.sql" dialect="TSQL" />
|
||||
<file url="file://$PROJECT_DIR$/.idea/queries/Query_1.sql" dialect="TSQL" />
|
||||
<file url="file://$PROJECT_DIR$/.idea/queries/Query_2.sql" dialect="TSQL" />
|
||||
</component>
|
||||
</project>
|
||||
@@ -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
|
||||
|
||||
RUN apk add --no-cache fontconfig ttf-dejavu
|
||||
FROM tomcat:9-jre8
|
||||
|
||||
ENV TZ="Europe/Rome"
|
||||
ENV JAVA_OPTS="-DDISABLE_DROOLS_COMPILE=TRUE -Xms512M -Xmx2G -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005"
|
||||
ENV USERDOMAIN="STUDIO-ML"
|
||||
|
||||
# Install Samba
|
||||
RUN apt-get update && \
|
||||
apt-get install -y samba samba-common-bin && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Ensure log directory exists and is readable
|
||||
RUN mkdir -p /usr/local/tomcat/logs && \
|
||||
chmod -R 755 /usr/local/tomcat/logs
|
||||
|
||||
# Create samba user (no login) and add to root group
|
||||
RUN useradd -M -s /usr/sbin/nologin sambauser && \
|
||||
printf "sambapass\nsambapass\n" | smbpasswd -a -s sambauser && \
|
||||
usermod -aG root sambauser
|
||||
|
||||
# Samba configuration
|
||||
RUN printf "\
|
||||
[global]\n\
|
||||
workgroup = STUDIO-ML\n\
|
||||
security = user\n\
|
||||
map to guest = never\n\
|
||||
server role = standalone server\n\
|
||||
unix extensions = no\n\
|
||||
client min protocol = NT1\n\
|
||||
\n\
|
||||
[tomcat-logs]\n\
|
||||
comment = Tomcat logs (read-only)\n\
|
||||
path = /usr/local/tomcat/logs\n\
|
||||
browseable = yes\n\
|
||||
read only = yes\n\
|
||||
guest ok = no\n\
|
||||
valid users = sambauser\n\
|
||||
force user = root\n\
|
||||
create mask = 0644\n\
|
||||
directory mask = 0755\n\
|
||||
" > /etc/samba/smb.conf
|
||||
|
||||
COPY docker/tomcat/conf/integry/ems.properties /usr/local/tomcat/conf/integry/
|
||||
COPY docker/tomcat/conf/integry/ems_automated_operations.json /usr/local/tomcat/conf/integry/
|
||||
COPY docker/tomcat/conf/integry/ems_settings.json /usr/local/tomcat/conf/integry/
|
||||
|
||||
@@ -42,7 +42,7 @@ pipeline {
|
||||
bat(script: 'mvn clean install -t toolchains-jenkins.xml', returnStdout: 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 "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\""
|
||||
|
||||
//containerImageLink "git.studioml.it/integry/ems-api-${env.GIT_BRANCH.toLowerCase().replace('/', '-')}:latest}"
|
||||
|
||||
@@ -404,6 +404,17 @@
|
||||
<artifactId>spring-orm</artifactId>
|
||||
<version>${spring.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.data</groupId>
|
||||
<artifactId>spring-data-jpa</artifactId>
|
||||
<version>2.7.18</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.hibernate</groupId>
|
||||
<artifactId>hibernate-core</artifactId>
|
||||
<version>5.6.15.Final</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-context-support</artifactId>
|
||||
|
||||
@@ -28,10 +28,8 @@ public class DbmsChangeTrackerComponent {
|
||||
private final HashMap<IntegryCustomerDB, DbmsChangeTracker> activeChangeTrackers = new HashMap<>();
|
||||
|
||||
private final ArrayList<String> trackedTables = new ArrayList<String>() {{
|
||||
add(MtbAart.ENTITY);
|
||||
add(MtbAartBarCode.ENTITY);
|
||||
add(MtbUntMis.ENTITY);
|
||||
add(MtbDepo.ENTITY);
|
||||
add(MtbDepoPosizioni.ENTITY);
|
||||
add(StbEditLimit.ENTITY);
|
||||
add(StbGestSetup.ENTITY);
|
||||
add(StbGestSetupDepo.ENTITY);
|
||||
|
||||
@@ -53,10 +53,8 @@ public class EntityCacheComponent implements ApplicationListener {
|
||||
}
|
||||
|
||||
private final HashMap<String, Class<? extends EntityBase>> enabledEntities = new HashMap<String, Class<? extends EntityBase>>() {{
|
||||
put(MtbAart.ENTITY, MtbAart.class);
|
||||
put(MtbAartBarCode.ENTITY, MtbAartBarCode.class);
|
||||
put(MtbUntMis.ENTITY, MtbUntMis.class);
|
||||
put(MtbDepo.ENTITY, MtbDepo.class);
|
||||
put(MtbDepoPosizioni.ENTITY, MtbDepoPosizioni.class);
|
||||
put(StbEditLimit.ENTITY, StbEditLimit.class);
|
||||
put(StbGestSetup.ENTITY, StbGestSetup.class);
|
||||
put(StbGestSetupDepo.ENTITY, StbGestSetupDepo.class);
|
||||
|
||||
@@ -3,6 +3,7 @@ package it.integry.ems.javabeans;
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import it.integry.common.var.CommonConstants;
|
||||
import it.integry.ems._context.ApplicationContextProvider;
|
||||
import it.integry.ems.jpa.TenantContext;
|
||||
import it.integry.ems.json.ResponseJSONObjectMapper;
|
||||
import it.integry.ems.migration._base.IntegryCustomerDB;
|
||||
import it.integry.ems.model.IntegryApplicationEnum;
|
||||
@@ -19,13 +20,15 @@ import org.springframework.security.authentication.AnonymousAuthenticationToken;
|
||||
import org.springframework.security.core.Authentication;
|
||||
import org.springframework.security.core.context.SecurityContextHolder;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.context.WebApplicationContext;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.annotation.PreDestroy;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.io.IOException;
|
||||
|
||||
@Component
|
||||
@Scope("request")
|
||||
@Scope(WebApplicationContext.SCOPE_REQUEST)
|
||||
public class RequestDataDTO {
|
||||
|
||||
private final Logger logger = LogManager.getLogger();
|
||||
@@ -100,6 +103,24 @@ public class RequestDataDTO {
|
||||
} else {
|
||||
jsonObjectMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
|
||||
}
|
||||
|
||||
// Logica di fallback o recupero tenant da sessione/utente
|
||||
if (profileDB == null || profileDB.isEmpty()) {
|
||||
// Esempio: recupero da sessione se presente
|
||||
// tenantId = (String) request.getSession().getAttribute("TENANT_ID");
|
||||
|
||||
// Fallback temporaneo per test
|
||||
// tenantId = DEFAULT_TENANT;
|
||||
}
|
||||
|
||||
if (profileDB != null) {
|
||||
TenantContext.setCurrentTenant(profileDB);
|
||||
}
|
||||
}
|
||||
|
||||
@PreDestroy
|
||||
public void destroy() throws Exception {
|
||||
TenantContext.clear();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
package it.integry.ems.jpa;
|
||||
|
||||
import it.integry.ems.settings.Model.AvailableConnectionModel;
|
||||
import it.integry.ems.settings.Model.SettingsModel;
|
||||
import it.integry.ems.sync.MultiDBTransaction.BasicConnectionPool;
|
||||
import org.springframework.jdbc.datasource.lookup.AbstractRoutingDataSource;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class MultiTenantDataSource extends AbstractRoutingDataSource {
|
||||
|
||||
private final BasicConnectionPool basicConnectionPool;
|
||||
private final SettingsModel settingsModel;
|
||||
|
||||
public MultiTenantDataSource(BasicConnectionPool basicConnectionPool, SettingsModel settingsModel) {
|
||||
this.basicConnectionPool = basicConnectionPool;
|
||||
this.settingsModel = settingsModel;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Object determineCurrentLookupKey() {
|
||||
return TenantContext.getCurrentTenant();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() {
|
||||
Map<Object, Object> targetDataSources = new HashMap<>();
|
||||
List<AvailableConnectionModel> connections = settingsModel.getAvailableConnections(false);
|
||||
|
||||
// Imposta il primo come default se necessario, o gestisci il caso null
|
||||
DataSource defaultDataSource = null;
|
||||
|
||||
for (AvailableConnectionModel model : connections) {
|
||||
DataSource ds = basicConnectionPool.getDataSource(model.getProfileName());
|
||||
if (ds != null) {
|
||||
targetDataSources.put(model.getProfileName(), ds);
|
||||
if (defaultDataSource == null) {
|
||||
defaultDataSource = ds;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.setTargetDataSources(targetDataSources);
|
||||
this.setDefaultTargetDataSource(defaultDataSource);
|
||||
super.afterPropertiesSet();
|
||||
}
|
||||
|
||||
// Metodo per ricaricare i datasource se vengono aggiunti nuovi tenant a runtime
|
||||
public void refreshDataSources() {
|
||||
this.afterPropertiesSet();
|
||||
}
|
||||
}
|
||||
|
||||
18
ems-core/src/main/java/it/integry/ems/jpa/TenantContext.java
Normal file
18
ems-core/src/main/java/it/integry/ems/jpa/TenantContext.java
Normal file
@@ -0,0 +1,18 @@
|
||||
package it.integry.ems.jpa;
|
||||
|
||||
public class TenantContext {
|
||||
private static final ThreadLocal<String> currentTenant = new ThreadLocal<>();
|
||||
|
||||
public static void setCurrentTenant(String tenant) {
|
||||
currentTenant.set(tenant);
|
||||
}
|
||||
|
||||
public static String getCurrentTenant() {
|
||||
return currentTenant.get();
|
||||
}
|
||||
|
||||
public static void clear() {
|
||||
currentTenant.remove();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
package it.integry.ems.jpa.entity;
|
||||
|
||||
import javax.persistence.MappedSuperclass;
|
||||
import java.io.Serializable;
|
||||
|
||||
@MappedSuperclass
|
||||
public abstract class BaseEntity implements Serializable {
|
||||
// Classe base per le entity JPA
|
||||
}
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
package it.integry.ems.jpa.repository;
|
||||
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.repository.NoRepositoryBean;
|
||||
|
||||
@NoRepositoryBean
|
||||
public interface BaseRepository<T, ID> extends JpaRepository<T, ID> {
|
||||
// Interfaccia base per i repository
|
||||
}
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
package it.integry.ems.jpa.repository;
|
||||
|
||||
import it.integry.ems_model.entity.MtbAart;
|
||||
import org.springframework.data.jpa.repository.EntityGraph;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
import org.springframework.data.repository.query.Param;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
@Repository
|
||||
public interface MtbAartRepository extends BaseRepository<MtbAart, String> {
|
||||
|
||||
Optional<MtbAart> findByCodMart(String codMart);
|
||||
|
||||
@EntityGraph(attributePaths = {"mtbUntMis"})
|
||||
Optional<MtbAart> findWithUntMisByCodMart(String codMart);
|
||||
|
||||
List<MtbAart> findByCodMartIn(List<String> codMarts);
|
||||
|
||||
@EntityGraph(attributePaths = {"mtbUntMis"})
|
||||
List<MtbAart> findWithUntMisByCodMartIn(List<String> codMarts);
|
||||
|
||||
@EntityGraph(attributePaths = {"mtbUntMis", "mtbAartBarCode"})
|
||||
List<MtbAart> findWithBarcodeWithUntMisByCodMartIn(List<String> codMarts);
|
||||
|
||||
@EntityGraph(attributePaths = {"mtbAartBarCode"})
|
||||
Optional<MtbAart> findWithBarcodeByCodMart(String codMart);
|
||||
|
||||
@Query("SELECT m FROM MtbAart m WHERE m.untMis = 'KG'")
|
||||
List<MtbAart> findByUntMisKG();
|
||||
|
||||
@Query("SELECT m.flagQtaCnfFissa FROM MtbAart m WHERE m.codMart = :codMart")
|
||||
Optional<String> findFlagQtaCnfFissaByCodMart(@Param("codMart") String codMart);
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package it.integry.ems.jpa.repository;
|
||||
|
||||
import it.integry.ems_model.entity.MtbUntMis;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
import org.springframework.data.repository.query.Param;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
public interface MtbUntMisRepository extends BaseRepository<MtbUntMis, String> {
|
||||
|
||||
Optional<MtbUntMis> findByUntMis(String untMis);
|
||||
|
||||
List<MtbUntMis> findByUntMisIn(List<String> untMis);
|
||||
|
||||
@Query("SELECT a.mtbUntMis FROM MtbAart a WHERE a.codMart = :codMart")
|
||||
Optional<MtbUntMis> findByCodMart(@Param("codMart") String codMart);
|
||||
|
||||
int countByUntMis(String untMis);
|
||||
|
||||
@Query("SELECT u.cifreDec FROM MtbUntMis u WHERE u.flagUnitaKg = :flagUnitaKg")
|
||||
List<BigDecimal> findCifreDecByFlagUnitaKg(@Param("flagUnitaKg") String flagUnitaKg);
|
||||
}
|
||||
@@ -524,6 +524,16 @@ public abstract class BaseMigration implements MigrationModelInterface {
|
||||
stbGestSetup.manageWithParentConnection(connection);
|
||||
}
|
||||
|
||||
protected void dropSetup(String gestName, String section, String keySection) throws Exception {
|
||||
StbGestSetup stbGestSetup = new StbGestSetup()
|
||||
.setGestName(gestName)
|
||||
.setSection(section)
|
||||
.setKeySection(keySection);
|
||||
|
||||
stbGestSetup.setOperation(OperationType.DELETE);
|
||||
stbGestSetup.manageWithParentConnection(connection);
|
||||
}
|
||||
|
||||
protected void addAutomatedOperation(BaseScheduledOperationDTO operation) {
|
||||
new Thread(() -> {
|
||||
try {
|
||||
|
||||
@@ -119,8 +119,10 @@ public enum IntegryCustomer {
|
||||
IntegryCustomerDB.Suit_TenutaArianna,
|
||||
IntegryCustomerDB.Suit_Valpietro),
|
||||
Tempesta(IntegryCustomerDB.Tempesta_Tempesta,
|
||||
IntegryCustomerDB.Tempesta_DI,
|
||||
IntegryCustomerDB.Tempesta_VivaiTempesta,
|
||||
IntegryCustomerDB.Tempesta_DI),
|
||||
IntegryCustomerDB.Tempesta_VivaiTempesta_DI
|
||||
),
|
||||
Tosca(IntegryCustomerDB.Tosca_Ba,
|
||||
IntegryCustomerDB.Tosca_Ce,
|
||||
IntegryCustomerDB.Tosca_Cz,
|
||||
|
||||
@@ -198,8 +198,9 @@ public enum IntegryCustomerDB {
|
||||
|
||||
|
||||
Tempesta_Tempesta("tempesta"),
|
||||
Tempesta_VivaiTempesta("vivaitempesta"),
|
||||
Tempesta_DI("tempestadi"),
|
||||
Tempesta_VivaiTempesta("vivaitempesta"),
|
||||
Tempesta_VivaiTempesta_DI("vivaitempestadi"),
|
||||
|
||||
|
||||
Tosca_Ba("tosca_ba"),
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
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_20251124143153 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
createSetupQuery("TIPO_GRIGLIA", "tipo griglia", "SELECT 'A|GRIGLIA DI ACQUISTO'\n" +
|
||||
"UNION ALL\n" +
|
||||
"SELECT 'V|GRIGLIA DI VENDITA'");
|
||||
createSetup
|
||||
("PVM", "RILEVAZIONI_STEUP", "TIPO_GRIGLIA", null,
|
||||
"Indicare per ogni reparto se la griglia per l'assortimento è quella di acquisto o di vendita",
|
||||
false, "TIPO_GRIGLIA", true, false, false, false, false, "jtb_fasi", false,
|
||||
"SELECT 'A|GRIGLIA DI ACQUISTO'\n" +
|
||||
"UNION ALL\n" +
|
||||
"SELECT 'V|GRIGLIA DI VENDITA'");
|
||||
|
||||
if (!isCustomerDb(IntegryCustomerDB.Carelli_Winact)) return;
|
||||
|
||||
executeStatement("insert into stb_gest_setup_det \n" +
|
||||
"select gest_name, section, key_section, tipo_setup, f.cod_jfas, f.valUe\n" +
|
||||
"from stb_gest_setup\n" +
|
||||
"cross apply (\n" +
|
||||
"select distinct jtb_fasi.cod_jfas,\n" +
|
||||
"IIF (jtb_fasi.cod_jfas = '01' OR jtb_fasi.cod_jfas = '02', 'V', 'A') as valUe\n" +
|
||||
"from jtb_fasi inner join jrl_fasi_mtb_grup on jtb_fasi.cod_jfas = jrl_fasi_mtb_grup.cod_jfas ) f\n" +
|
||||
"where gest_name = 'PVM' \n" +
|
||||
"and section = 'RILEVAZIONI_STEUP'\n" +
|
||||
"and key_section = 'TIPO_GRIGLIA'\n");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
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_20251124161416 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
if (!isCustomerDb(IntegryCustomerDB.Carelli_Winact)) return;
|
||||
|
||||
createOrUpdateFunction("[steup_getGrigliaVendita]", "CREATE FUNCTION [dbo].[steup_getGrigliaVendita](\n" +
|
||||
" @codMdep VARCHAR(5), @codJfas VARCHAR(5), @dataIspezione datetime\n" +
|
||||
")\n" +
|
||||
" RETURNS TABLE\n" +
|
||||
" AS\n" +
|
||||
" RETURN(WITH tipiArt AS (SELECT value_string AS cod_mtip\n" +
|
||||
" FROM dbo.ParseStringIntoArray((SELECT value\n" +
|
||||
" FROM stb_gest_setup\n" +
|
||||
" WHERE gest_name = 'PVM'\n" +
|
||||
" AND section = 'RILEVAZIONI_STEUP'\n" +
|
||||
" AND key_section = 'EXCLUDE_COD_MTIP'), '|') t)\n" +
|
||||
" , art AS (SELECT DISTINCT cod_griglia, cod_mart\n" +
|
||||
" FROM carelli.dbo.vtb_griglia_art\n" +
|
||||
" WHERE cod_griglia = @codMdep\n" +
|
||||
" AND data_validita =\n" +
|
||||
" (SELECT MAX(data_validita) FROM carelli.dbo.vtb_griglia_art WHERE cod_griglia = @codMdep AND data_validita <=@dataIspezione)\n" +
|
||||
" )\n" +
|
||||
" \n" +
|
||||
" SELECT DISTINCT case when @codJfas = '01' then art_det.cod_mart_griglia else mtb_aart.cod_mart end as cod_mart,\n" +
|
||||
" mtb_aart.descrizione,\n" +
|
||||
" mtb_aart.bar_code,\n" +
|
||||
" mtb_aart.cod_msgr,\n" +
|
||||
" mtb_aart.plu,\n" +
|
||||
" art_det.cod_mart AS cod_mart_kit \n" +
|
||||
" FROM carelli.dbo.mtb_aart\n" +
|
||||
" INNER JOIN jrl_fasi_mtb_grup ON\n" +
|
||||
" mtb_aart.cod_mgrp = jrl_fasi_mtb_grup.cod_mgrp\n" +
|
||||
" INNER JOIN (SELECT cod_mart, cod_comp AS cod_mart_griglia\n" +
|
||||
" FROM carelli.dbo.mtb_comp\n" +
|
||||
" UNION ALL\n" +
|
||||
" SELECT cod_comp AS cod_mart, cod_mart AS cod_mart_griglia\n" +
|
||||
" FROM carelli.dbo.mtb_comp \n" +
|
||||
" where @codJfas <> '01'\n" +
|
||||
" UNION ALL\n" +
|
||||
" SELECT cod_mart, cod_mart AS cod_mart_griglia\n" +
|
||||
" FROM carelli.dbo.mtb_aart\n" +
|
||||
" WHERE cod_mart NOT IN (SELECT cod_mart FROM carelli.dbo.mtb_comp)) AS art_det\n" +
|
||||
" ON mtb_aart.cod_mart = art_det.cod_mart\n" +
|
||||
" INNER JOIN art ON art_det.cod_mart_griglia = art.cod_mart\n" +
|
||||
" WHERE jrl_fasi_mtb_grup.cod_jfas = @codJfas\n" +
|
||||
" AND flag_stato = 'A'\n" +
|
||||
" AND (mtb_aart.cod_mtip IS NULL OR mtb_aart.cod_mtip NOT IN (SELECT cod_mtip FROM tipiArt)) \n" +
|
||||
" )");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -13,6 +13,10 @@ public class Migration_20251201105344 extends BaseMigration implements Migration
|
||||
if (isDMS())
|
||||
return;
|
||||
|
||||
if (isDMS())
|
||||
return;
|
||||
|
||||
|
||||
createOrUpdateTrigger("tr_changeTipoRiep", "CREATE TRIGGER [dbo].[tr_changeTipoRiep]\n" +
|
||||
" ON [dbo].[ctb_cont]\n" +
|
||||
" INSTEAD OF update\n" +
|
||||
|
||||
@@ -10,6 +10,10 @@ public class Migration_20251202161223 extends BaseMigration implements Migration
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
if (isDMS())
|
||||
return;
|
||||
|
||||
|
||||
createOrUpdateView("cvw_saldo_scad", "CREATE VIEW dbo.cvw_saldo_scad\n" +
|
||||
" WITH SCHEMABINDING\n" +
|
||||
" AS\n" +
|
||||
|
||||
@@ -10,6 +10,9 @@ public class Migration_20251203121227 extends BaseMigration implements Migration
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
if (isDMS())
|
||||
return;
|
||||
|
||||
|
||||
createOrUpdateFunction("f_AggiungiGiorniScad", "CREATE FUNCTION [dbo].[f_AggiungiGiorniScad](@dataIniz DateTime, @giorni int, @ls_dataRif varchar(20)) \n" +
|
||||
"RETURNS dateTime\n" +
|
||||
|
||||
@@ -10,6 +10,10 @@ public class Migration_20251205101442 extends BaseMigration implements Migration
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
if (isDMS())
|
||||
return;
|
||||
|
||||
|
||||
executeStatement("alter table srl_activity_type_user add activity_default bit not null default 0;\n",
|
||||
"CREATE UNIQUE INDEX ux_srl_activity_type_user_default\n" +
|
||||
"ON srl_activity_type_user (user_name, flag_tipologia)\n" +
|
||||
|
||||
@@ -10,6 +10,9 @@ public class Migration_20251205111526 extends BaseMigration implements Migration
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
if (isDMS())
|
||||
return;
|
||||
|
||||
|
||||
createOrUpdateView("mvw_sitart_udc_det_all","CREATE VIEW [dbo].[mvw_sitart_udc_det_all] AS\n" +
|
||||
"WITH SitMtbColr AS (\n" +
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20251209113110 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
if (isDMS())
|
||||
return;
|
||||
|
||||
executeStatement("alter table mtb_aart alter column ingredienti varchar(8000)");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20251209154901 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
if (isDMS())
|
||||
return;
|
||||
|
||||
executeStatement(
|
||||
"insert into mtb_unt_mis ( unt_mis)\n" +
|
||||
"select *\n" +
|
||||
"from (\n" +
|
||||
"select unt_mis\n" +
|
||||
"from mtb_aart\n" +
|
||||
"union\n" +
|
||||
"select unt_mis2\n" +
|
||||
"from mtb_aart\n" +
|
||||
"where unt_mis2 is not null\n" +
|
||||
"union\n" +
|
||||
"select unt_mis3\n" +
|
||||
"from mtb_aart\n" +
|
||||
"where unt_mis3 is not null\n" +
|
||||
") um \n" +
|
||||
"where not exists (select 1 from mtb_unt_mis where mtb_unt_mis.unt_mis = um.unt_mis )",
|
||||
"ALTER TABLE MTB_AART ADD CONSTRAINT FK_MTB_AART_UNT_MIS FOREIGN KEY (UNT_MIS) REFERENCES DBO.MTB_UNT_MIS (UNT_MIS)",
|
||||
"ALTER TABLE MTB_AART ALTER COLUMN UNT_MIS2 VARCHAR(3)",
|
||||
"ALTER TABLE MTB_AART ADD CONSTRAINT FK_MTB_AART_UNT_MIS2 FOREIGN KEY (UNT_MIS2) REFERENCES DBO.MTB_UNT_MIS (UNT_MIS)",
|
||||
"ALTER TABLE MTB_AART ADD CONSTRAINT FK_MTB_AART_UNT_MIS3 FOREIGN KEY (UNT_MIS3) REFERENCES DBO.MTB_UNT_MIS (UNT_MIS)" );
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
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_20251210095206 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
executeStatement("ALTER TABLE mtb_aart_anag ADD cod_vdes varchar(5);");
|
||||
|
||||
if(isCustomerDb(IntegryCustomerDB.Carelli_Format) || isCustomerDb(IntegryCustomerDB.Carelli_GestFood)){
|
||||
executeStatement("delete from mtb_aart_anag\n" +
|
||||
"from (\n" +
|
||||
"select cod_mart, cod_mart_anag, cod_anag, ROW_NUMBER() over (partition by cod_mart, cod_anag order by cod_mart, cod_mart_anag, cod_anag ) as id\n" +
|
||||
"from mtb_aart_anag ) m inner join mtb_aart_anag on m.cod_anag = mtb_aart_anag.cod_anag and m.cod_mart = mtb_aart_anag.cod_mart and mtb_aart_anag.cod_mart_anag = m.cod_mart_anag\n" +
|
||||
"and m.id > 1");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,253 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20251210111441 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
createOrUpdateFunction("pvm_getassortimentoClientePedane","CREATE FUNCTION [dbo].[pvm_getassortimentoClientePedane](\n" +
|
||||
" @codAnag VARCHAR(5), @codVlis VARCHAR(5), @codVdes VARCHAR(5), @dataValidita DATETIME, @viewPromo BIT,\n" +
|
||||
" @pedane INT = 0\n" +
|
||||
")\n" +
|
||||
" RETURNS TABLE\n" +
|
||||
" AS\n" +
|
||||
" RETURN( /*\n" +
|
||||
"\n" +
|
||||
"\t\t\tdeclare @codAnag VARCHAR(5), @codVlis VARCHAR(5), @dataValidita DATETIME, @viewPromo BIT\n" +
|
||||
"\t\t\tset @codAnag = 'C3355'\n" +
|
||||
"\t\t\tset @codVlis = 'C3355'\n" +
|
||||
"\t\t\tset @dataValidita = '2023/04/04'\n" +
|
||||
"\t\t\tset @viewPromo = 1;\n" +
|
||||
"\t\t\t*/\n" +
|
||||
" WITH assortimento AS (SELECT vtb_griglia_art.cod_mart\n" +
|
||||
" FROM vtb_clie\n" +
|
||||
" INNER JOIN vtb_griglia ON vtb_clie.cod_griglia = vtb_griglia.cod_griglia\n" +
|
||||
" INNER JOIN vtb_griglia_art\n" +
|
||||
" ON vtb_griglia.cod_griglia = vtb_griglia_art.cod_griglia AND\n" +
|
||||
" vtb_griglia.data_validita = vtb_griglia_art.data_validita\n" +
|
||||
" WHERE vtb_clie.cod_anag = @codAnag\n" +
|
||||
" AND vtb_griglia.data_validita = (SELECT MAX(g.data_validita)\n" +
|
||||
" FROM vtb_griglia g\n" +
|
||||
" WHERE g.cod_griglia = vtb_clie.cod_griglia\n" +
|
||||
" AND g.data_validita <= ISNULL(@dataValidita, CAST(GETDATE() AS DATE)))),\n" +
|
||||
" lisv AS (SELECT cod_vlis, cod_vlis AS cod_vlis_rif\n" +
|
||||
" FROM vtb_list\n" +
|
||||
" WHERE cod_vlis_rif IS NULL\n" +
|
||||
" UNION ALL\n" +
|
||||
" SELECT cod_vlis, cod_vlis_rif\n" +
|
||||
" FROM vtb_list\n" +
|
||||
" WHERE cod_vlis_rif IS NOT NULL),\n" +
|
||||
" listino AS (SELECT DISTINCT cod_mart, tipo_variazione\n" +
|
||||
" FROM (SELECT lisv.cod_vlis,\n" +
|
||||
" mtb_lisv.cod_mart,\n" +
|
||||
" LAST_VALUE(CASE\n" +
|
||||
" WHEN vtb_list_data.data_iniz IS NULL THEN NULL\n" +
|
||||
" ELSE mtb_lisv_data.tipo_variazione END)\n" +
|
||||
" OVER (PARTITION BY lisv.cod_vlis, mtb_lisv.cod_mart\n" +
|
||||
" ORDER BY vtb_list_data.data_iniz, CASE WHEN vtb_list_data.cod_promo IS NULL THEN 0 ELSE 1 END, vtb_list_data.versione\n" +
|
||||
" RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS tipo_variazione\n" +
|
||||
" FROM lisv\n" +
|
||||
" INNER JOIN mtb_lisv ON lisv.cod_vlis_rif = mtb_lisv.cod_vlis\n" +
|
||||
" INNER JOIN mtb_lisv_data ON mtb_lisv.cod_vlis = mtb_lisv_data.cod_vlis AND\n" +
|
||||
" mtb_lisv.cod_mart = mtb_lisv_data.cod_mart\n" +
|
||||
" LEFT OUTER JOIN vtb_list_data\n" +
|
||||
" ON mtb_lisv_data.cod_vlis = vtb_list_data.cod_vlis AND\n" +
|
||||
" mtb_lisv_data.versione = vtb_list_data.versione AND\n" +
|
||||
" vtb_list_data.data_iniz <=\n" +
|
||||
" ISNULL(@dataValidita, CAST(GETDATE() AS DATE))\n" +
|
||||
" WHERE lisv.cod_vlis = @codVlis\n" +
|
||||
" AND NOT EXISTS(SELECT cod_mart FROM assortimento)) t\n" +
|
||||
" WHERE (t.tipo_variazione IS NULL OR t.tipo_variazione <> 'D')),\n" +
|
||||
" tmp_lisv AS (SELECT l.cod_mart,\n" +
|
||||
" l.cod_vlis,\n" +
|
||||
" ISNULL(p.data_iniz, l.data_iniz) AS data_iniz,\n" +
|
||||
" p.data_fine,\n" +
|
||||
" l.da,\n" +
|
||||
" l.a,\n" +
|
||||
" ISNULL(p.prz_vend, l.prz_vend_trasp) AS prz_vend,\n" +
|
||||
" ISNULL(p.prz_vend_netto, l.prz_vend_trasp_netto) AS prz_vend_netto,\n" +
|
||||
" ISNULL(p.perc_sco1, l.perc_sco1) AS perc_sco1,\n" +
|
||||
" ISNULL(p.perc_sco2, l.perc_sco2) AS perc_sco2,\n" +
|
||||
" ISNULL(p.perc_sco3, l.perc_sco3) AS perc_sco3,\n" +
|
||||
" ISNULL(p.perc_sco4, l.perc_sco4) AS perc_sco4,\n" +
|
||||
" p.perc_prov,\n" +
|
||||
" CONVERT(NUMERIC(20, 5), 0) AS qta_residua,\n" +
|
||||
" CONVERT(BIGINT, NULL) AS id_contratto,\n" +
|
||||
" ISNULL(p.rap_conv, l.rap_conv) AS rap_conv,\n" +
|
||||
" ISNULL(p.note, l.note) AS note,\n" +
|
||||
" CAST(NULL AS VARCHAR(5)) AS cod_vdes,\n" +
|
||||
" l.cod_tcol_ul AS cod_tcol_ul,\n" +
|
||||
" ISNULL(p.unt_mis_ven, l.unt_mis_ven) AS unt_mis_ven,\n" +
|
||||
" l.colli_pedana AS colli_pedana,\n" +
|
||||
" ISNULL(p.tipo_variazione, l.tipo_variazione) AS tipo_variazione,\n" +
|
||||
" CONVERT(VARCHAR(1), CASE\n" +
|
||||
" WHEN p.cod_promo IS NULL THEN NULL\n" +
|
||||
" ELSE 'P' END) AS tipo_promo,\n" +
|
||||
" CONVERT(VARCHAR(5), NULL) AS cod_paga,\n" +
|
||||
" CONVERT(VARCHAR(5), NULL) AS descr_paga,\n" +
|
||||
" l.porto,\n" +
|
||||
" l.qta_cnf,\n" +
|
||||
" NULL AS note_incoterms,\n" +
|
||||
" NULL AS data_rif_scad,\n" +
|
||||
" NULL AS note_carico,\n" +
|
||||
" NULL AS term_cons,\n" +
|
||||
" NULL AS cod_banc,\n" +
|
||||
" NULL AS descr_banc,\n" +
|
||||
" l.flag_primario\n" +
|
||||
" FROM dbo.getListinoVenditaPedane(@dataValidita, @codVlis, NULL, @pedane) l\n" +
|
||||
" LEFT OUTER JOIN dbo.getPromozioneVendita(@dataValidita, @dataValidita,\n" +
|
||||
" @codVlis, NULL, NULL) p\n" +
|
||||
" ON l.cod_vlis = p.cod_vlis AND l.cod_mart = p.cod_mart AND\n" +
|
||||
" ISNULL(@viewPromo, 0) = 1\n" +
|
||||
" WHERE l.cod_vlis = @codVlis\n" +
|
||||
" AND l.cod_mart IN (SELECT cod_mart\n" +
|
||||
" FROM assortimento\n" +
|
||||
" UNION ALL\n" +
|
||||
" SELECT cod_mart\n" +
|
||||
" FROM listino)\n" +
|
||||
" AND l.tipo_variazione <> 'D'\n" +
|
||||
" AND l.tipo_variazione IS NOT NULL\n" +
|
||||
" AND l.flag_attivo = 'S'\n" +
|
||||
" UNION ALL\n" +
|
||||
" SELECT l.cod_mart,\n" +
|
||||
" l.cod_vlis,\n" +
|
||||
" NULL AS data_iniz,\n" +
|
||||
" NULL AS data_fine,\n" +
|
||||
" NULL AS da,\n" +
|
||||
" NULL AS a,\n" +
|
||||
" NULL AS prz_vend,\n" +
|
||||
" NULL AS prz_vend_netto,\n" +
|
||||
" NULL AS perc_sco1,\n" +
|
||||
" NULL AS perc_sco2,\n" +
|
||||
" NULL AS perc_sco3,\n" +
|
||||
" NULL AS perc_sco4,\n" +
|
||||
" NULL AS perc_prov,\n" +
|
||||
" NULL AS qta_residua,\n" +
|
||||
" NULL AS id_contratto,\n" +
|
||||
" um.rap_conv AS rap_conv,\n" +
|
||||
" NULL AS note,\n" +
|
||||
" CAST(NULL AS VARCHAR(5)) AS cod_vdes,\n" +
|
||||
" NULL AS cod_tcol_ul,\n" +
|
||||
" l.unt_mis_ven AS unt_mis_ven,\n" +
|
||||
" NULL AS colli_pedana,\n" +
|
||||
" NULL AS tipo_variazione,\n" +
|
||||
" NULL AS tipo_promo,\n" +
|
||||
" CONVERT(VARCHAR(5), NULL) AS cod_paga,\n" +
|
||||
" CONVERT(VARCHAR(5), NULL) AS descr_paga,\n" +
|
||||
" NULL porto,\n" +
|
||||
" mtb_aart.qta_cnf,\n" +
|
||||
" NULL AS note_incoterms,\n" +
|
||||
" NULL AS data_rif_scad,\n" +
|
||||
" NULL AS note_carico,\n" +
|
||||
" NULL AS term_cons,\n" +
|
||||
" NULL AS cod_banc,\n" +
|
||||
" NULL AS descr_banc,\n" +
|
||||
" 1 AS flag_primario\n" +
|
||||
" FROM mtb_lisv l\n" +
|
||||
" INNER JOIN listino ON l.cod_mart = listino.cod_mart\n" +
|
||||
" INNER JOIN mtb_aart ON l.cod_mart = mtb_aart.cod_mart\n" +
|
||||
" CROSS APPLY dbo.getUntMisArticolo(l.cod_mart, l.unt_mis_ven) um\n" +
|
||||
" WHERE l.cod_vlis = @codVlis\n" +
|
||||
" AND listino.tipo_variazione IS NULL\n" +
|
||||
" UNION ALL\n" +
|
||||
" SELECT vvw_contratti_vendita.cod_mart,\n" +
|
||||
" NULL AS cod_vlis,\n" +
|
||||
" vvw_contratti_vendita.data_iniz,\n" +
|
||||
" vvw_contratti_vendita.data_fine,\n" +
|
||||
" NULL AS da,\n" +
|
||||
" NULL AS a,\n" +
|
||||
" vvw_contratti_vendita.prz_vend,\n" +
|
||||
" ROUND(vvw_contratti_vendita.prz_vend *\n" +
|
||||
" (1 - ISNULL(vvw_contratti_vendita.perc_sco1, 0))\n" +
|
||||
" * (1 - ISNULL(vvw_contratti_vendita.perc_sco2, 0))\n" +
|
||||
" * (1 - ISNULL(vvw_contratti_vendita.perc_sco3, 0))\n" +
|
||||
" * (1 - ISNULL(vvw_contratti_vendita.perc_sco4, 0)),\n" +
|
||||
" 5) AS prz_vend_netto,\n" +
|
||||
" vvw_contratti_vendita.perc_sco1,\n" +
|
||||
" vvw_contratti_vendita.perc_sco2,\n" +
|
||||
" vvw_contratti_vendita.perc_sco3,\n" +
|
||||
" vvw_contratti_vendita.perc_sco4,\n" +
|
||||
" vvw_contratti_vendita.perc_prov,\n" +
|
||||
" vvw_contratti_vendita.qta_residua,\n" +
|
||||
" vvw_contratti_vendita.id_contratto,\n" +
|
||||
" vvw_contratti_vendita.rap_conv,\n" +
|
||||
" vvw_contratti_vendita.note,\n" +
|
||||
" vvw_contratti_vendita.cod_vdes,\n" +
|
||||
" NULL,\n" +
|
||||
" vvw_contratti_vendita.unt_mis_ven,\n" +
|
||||
" NULL,\n" +
|
||||
" NULL,\n" +
|
||||
" 'C' AS tipo_promo,\n" +
|
||||
" vvw_contratti_vendita.cod_paga,\n" +
|
||||
" vvw_contratti_vendita.descrizione_paga AS descr_paga,\n" +
|
||||
" vvw_contratti_vendita.incoterms AS porto,\n" +
|
||||
" mtb_aart.qta_cnf,\n" +
|
||||
" vvw_contratti_vendita.note_incoterms,\n" +
|
||||
" vvw_contratti_vendita.data_rif_scad,\n" +
|
||||
" vvw_contratti_vendita.note_carico,\n" +
|
||||
" vvw_contratti_vendita.term_cons,\n" +
|
||||
" vvw_contratti_vendita.cod_banc,\n" +
|
||||
" vvw_contratti_vendita.descr_banc,\n" +
|
||||
" 1 AS flag_primario\n" +
|
||||
" FROM vvw_contratti_vendita\n" +
|
||||
" INNER JOIN mtb_aart ON vvw_contratti_vendita.cod_mart = mtb_aart.cod_mart\n" +
|
||||
" WHERE vvw_contratti_vendita.cod_anag = @codAnag\n" +
|
||||
" AND (@codVdes IS NULL OR vvw_contratti_vendita.cod_vdes IS NULL OR\n" +
|
||||
" vvw_contratti_vendita.cod_vdes = @codVdes)\n" +
|
||||
" AND (ISNULL(@dataValidita, CAST(GETDATE() AS DATE)) BETWEEN\n" +
|
||||
" vvw_contratti_vendita.data_iniz AND vvw_contratti_vendita.data_fine)\n" +
|
||||
"-- AND vvw_contratti_vendita.qta_residua >= 0\n" +
|
||||
" )\n" +
|
||||
"\n" +
|
||||
" SELECT tmp_lisv.cod_mart,\n" +
|
||||
" ISNULL(maa.cod_mart_anag, tmp_lisv.cod_mart) AS cod_mart_anag,\n" +
|
||||
" cod_vlis,\n" +
|
||||
" data_iniz,\n" +
|
||||
" data_fine,\n" +
|
||||
" da,\n" +
|
||||
" a,\n" +
|
||||
" prz_vend,\n" +
|
||||
" prz_vend_netto,\n" +
|
||||
" perc_sco1,\n" +
|
||||
" perc_sco2,\n" +
|
||||
" perc_sco3,\n" +
|
||||
" perc_sco4,\n" +
|
||||
" perc_prov,\n" +
|
||||
" qta_residua,\n" +
|
||||
" id_contratto,\n" +
|
||||
" rap_conv,\n" +
|
||||
" ISNULL(maa.note, tmp_lisv.note) AS note,\n" +
|
||||
" cod_tcol_ul,\n" +
|
||||
" unt_mis_ven,\n" +
|
||||
" CASE\n" +
|
||||
" WHEN maa.colli_pedana IS NULL OR maa.colli_pedana = 0 THEN tmp_lisv.colli_pedana\n" +
|
||||
" ELSE maa.colli_pedana END AS colli_pedana,\n" +
|
||||
" tipo_variazione,\n" +
|
||||
" tipo_promo,\n" +
|
||||
" cod_paga,\n" +
|
||||
" descr_paga,\n" +
|
||||
" porto,\n" +
|
||||
" qta_cnf,\n" +
|
||||
" CAST(CASE WHEN tmp_lisv.data_iniz IS NULL THEN 0 ELSE 1 END AS BIT) AS art_lisv,\n" +
|
||||
" tmp_lisv.cod_vdes,\n" +
|
||||
" note_incoterms,\n" +
|
||||
" data_rif_scad,\n" +
|
||||
" note_carico,\n" +
|
||||
" term_cons,\n" +
|
||||
" cod_banc,\n" +
|
||||
" descr_banc,\n" +
|
||||
" flag_primario\n" +
|
||||
" FROM tmp_lisv\n" +
|
||||
" LEFT OUTER JOIN mtb_aart_anag maa\n" +
|
||||
" ON tmp_lisv.cod_mart = maa.cod_mart AND maa.cod_anag = @codAnag)");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.IntegryCustomer;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20251211085116 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
createSetup("W_CREG_IVA_DISP", "DATAWINDOW", "D_CREG_IVA_REP", null,
|
||||
null, false, null, false, false,
|
||||
false, false, false, null, false, null);
|
||||
|
||||
if(isCustomer(IntegryCustomer.Cosmapack)) {
|
||||
updateSetupValue("W_CREG_IVA_DISP", "DATAWINDOW", "D_CREG_IVA_REP", "d_creg_iva_cosmopack_rep");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20251211162655 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
createSetupQuery("SI_NO", "SI_NO", "SELECT 'S' UNION ALL SELECT 'N'");
|
||||
createSetup("PVM", "ORDINI_V_SLIM2K", "EXPORT_ORDINI", "N",
|
||||
"Esporta gli ordini già esportati", false, "SI_NO", false, false,
|
||||
false, false, false, null, false, "SELECT 'S' UNION ALL SELECT 'N'");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.IntegryCustomer;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20251211165528 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
createSetup("w_vriepfattagecomp_disp", "CB_VIS_DETTAGLIO", "VISIBLE", "N",
|
||||
null, false, null, false, false,
|
||||
false, false, false, null, false, null);
|
||||
|
||||
if(isCustomer(IntegryCustomer.RossoGargano)) {
|
||||
updateSetupValue("w_vriepfattagecomp_disp", "CB_VIS_DETTAGLIO", "VISIBLE", "S");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.IntegryCustomer;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20251212095000 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
if(isCustomer(IntegryCustomer.RossoGargano)) {
|
||||
executeStatement("INSERT INTO dtb_note_doc (note, data_iniz, data_fine, flag_bio)\n" +
|
||||
"SELECT \n" +
|
||||
" (\n" +
|
||||
" SELECT value \n" +
|
||||
" FROM stb_gest_setup \n" +
|
||||
" WHERE gest_name = 'stampa_documenti'\n" +
|
||||
" AND section = 'bio'\n" +
|
||||
" AND key_section = 'descrizione'\n" +
|
||||
" )\n" +
|
||||
" + ' ' +\n" +
|
||||
" (\n" +
|
||||
" SELECT value \n" +
|
||||
" FROM stb_gest_setup \n" +
|
||||
" WHERE gest_name = 'stampa_documenti'\n" +
|
||||
" AND section = 'bio'\n" +
|
||||
" AND key_section = 'certificato'\n" +
|
||||
" ) AS note,\n" +
|
||||
" '2025-07-01',\n" +
|
||||
" '2099-12-31',\n" +
|
||||
" 1;",
|
||||
"INSERT INTO drl_tipi_note_doc (cod_dtip, id_note, id_riga)\n" +
|
||||
"SELECT\n" +
|
||||
" t.cod_dtip,\n" +
|
||||
" n.id_note,\n" +
|
||||
" ISNULL(\n" +
|
||||
" (\n" +
|
||||
" SELECT MAX(d.id_riga)\n" +
|
||||
" FROM drl_tipi_note_doc d\n" +
|
||||
" WHERE d.cod_dtip = t.cod_dtip\n" +
|
||||
" ), 0\n" +
|
||||
" ) + 1 AS id_riga\n" +
|
||||
"FROM (\n" +
|
||||
" SELECT MAX(id) AS id_note\n" +
|
||||
" FROM dtb_note_doc\n" +
|
||||
" WHERE flag_bio = 1\n" +
|
||||
" ) n\n" +
|
||||
"JOIN (\n" +
|
||||
" SELECT cod_dtip\n" +
|
||||
" FROM dtb_tipi\n" +
|
||||
" WHERE gestione = 'V'\n" +
|
||||
" AND mod_stamp IN ('bolac', 'fat', 'fatac')\n" +
|
||||
" ) t\n" +
|
||||
"ON 1 = 1;",
|
||||
"UPDATE stb_gest_setup set value = null \n" +
|
||||
"WHERE gest_name = 'stampa_documenti'\n" +
|
||||
" AND section = 'bio'\n" +
|
||||
" AND key_section IN ('certificato','descrizione');");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.IntegryCustomer;
|
||||
import it.integry.ems.migration._base.IntegryCustomerDB;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20251212130317 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
if (isCustomer(IntegryCustomer.Auricchio) || isCustomer(IntegryCustomer.Levanplast) || isCustomer(IntegryCustomer.Agricoper) || isCustomerDb(IntegryCustomerDB.Auricchio_Ind05)){
|
||||
executeStatement("delete from mtb_aart_anag\n" +
|
||||
"from \n" +
|
||||
"(select mtb_aart_anag.cod_anag,\n" +
|
||||
"\t\tmtb_aart_anag.cod_mart, \n" +
|
||||
"\t\tmax(id) as id\n" +
|
||||
"from (select cod_anag, cod_mart, row_number() over (partition by cod_anag, cod_mart order by cod_anag, cod_mart) as riga \n" +
|
||||
"\t\tfrom dbo.mtb_aart_anag\t\t\n" +
|
||||
"\t\t)error inner join mtb_aart_anag on mtb_aart_anag.cod_anag = error.cod_anag and\n" +
|
||||
"\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tmtb_aart_anag.cod_mart = error.cod_mart\n" +
|
||||
"where riga > 1\n" +
|
||||
"group by mtb_aart_anag.cod_anag,\n" +
|
||||
"\t\tmtb_aart_anag.cod_mart)rowDelete inner join mtb_aart_anag on rowDelete.id = mtb_aart_anag.id");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,121 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.IntegryCustomer;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20251212151308 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
if ( !isCustomer(IntegryCustomer.Carelli) ) return;
|
||||
|
||||
createOrUpdateFunction("steup_getRilevazioni", "CREATE FUNCTION [dbo].[steup_getRilevazioni]\n" +
|
||||
"(\n" +
|
||||
" @dataIspezione DATETIME,\n" +
|
||||
" @codMdep VARCHAR(5),\n" +
|
||||
" @userRilevatore VARCHAR(20)\n" +
|
||||
")\n" +
|
||||
"RETURNS TABLE AS return \n" +
|
||||
"SELECT activity_id,\n" +
|
||||
" stb_activity.user_name,\n" +
|
||||
" user_creator,\n" +
|
||||
" ISNULL(effective_time, ora_ins_act) AS effective_time,\n" +
|
||||
" effective_endtime,\n" +
|
||||
" activity_result_id,\n" +
|
||||
" mtb_depo.cod_mdep,\n" +
|
||||
" mtb_depo.descrizione AS descr_deposito,\n" +
|
||||
" ISNULL(effective_date, data_ins_act) AS data_isp\n" +
|
||||
"FROM winact.dbo.stb_activity INNER JOIN winact.dbo.wtb_depo ON stb_activity.user_name = wtb_depo.user_name\n" +
|
||||
" INNER JOIN winact.dbo.mtb_depo ON wtb_depo.cod_mdep = mtb_depo.cod_mdep\n" +
|
||||
"WHERE flag_tipologia = 'P' AND\n" +
|
||||
" activity_type_id = 'ISPEZIONE' AND \n" +
|
||||
" (@dataIspezione is null or stb_activity.effective_date = @dataIspezione ) AND \n" +
|
||||
" (@codMdep is null or mtb_depo.cod_mdep = @codMdep ) AND \n" +
|
||||
" (@userRilevatore is null or stb_activity.user_creator = @userRilevatore );");
|
||||
createOrUpdateFunction("steup_getEntriesRilevazione", "CREATE FUNCTION [dbo].[steup_getEntriesRilevazione](@idIspezione varchar(20))\n" +
|
||||
" RETURNS TABLE AS return\n" +
|
||||
"WITH steup_ispezioni AS (SELECT * FROM steup_getRilevazioni(null, null, null)),\n" +
|
||||
"\n" +
|
||||
" steup_activities AS (SELECT stb_activity.activity_id,\n" +
|
||||
" stb_activity.activity_type_id,\n" +
|
||||
" stb_activity.data_ins_act,\n" +
|
||||
" ISNULL(stb_activity.effective_time, stb_activity.ora_ins_act) AS effective_time,\n" +
|
||||
" stb_activity.cod_mart,\n" +
|
||||
" mtb_aart.descrizione AS descr_art,\n" +
|
||||
" stb_activity.activity_play_counter,\n" +
|
||||
" stb_activity.note,\n" +
|
||||
" stb_activity.cod_jfas,\n" +
|
||||
" stb_activity.flag_tipologia,\n" +
|
||||
" stb_activity.persona_rif,\n" +
|
||||
" stb_activity.priorita,\n" +
|
||||
" wtb_depo.cod_mdep,\n" +
|
||||
" jtb_fasi.descrizione AS descr_fase,\n" +
|
||||
" stb_activity.parent_activity_id as id_ispezione,\n" +
|
||||
" stb_activity.indice_gradimento,\n" +
|
||||
" stb_activity.user_creator,\n" +
|
||||
" jtb_fasi.max_allocazione,\n" +
|
||||
" SUM(indice_gradimento)\n" +
|
||||
" OVER ( PARTITION BY parent_activity_id,wtb_depo.cod_mdep,jtb_fasi.cod_jfas ) AS gradimento_reparto,\n" +
|
||||
" steup_ispezioni.data_isp\n" +
|
||||
" FROM winact.dbo.stb_activity\n" +
|
||||
" INNER JOIN steup_ispezioni ON parent_activity_id = steup_ispezioni.activity_id\n" +
|
||||
" LEFT OUTER JOIN winact.dbo.jtb_fasi ON stb_activity.cod_jfas = jtb_fasi.cod_jfas\n" +
|
||||
" LEFT OUTER JOIN winact.dbo.mtb_aart ON stb_activity.cod_mart = mtb_aart.cod_mart\n" +
|
||||
" LEFT OUTER JOIN winact.dbo.wtb_depo ON stb_activity.user_name = wtb_depo.user_name\n" +
|
||||
" WHERE ISNULL(cod_jcom, '') <> 'MODEL'\n" +
|
||||
" and stb_activity.cod_mart is null\n" +
|
||||
" AND stb_activity.flag_tipologia = 'A')\n" +
|
||||
" ,\n" +
|
||||
"\n" +
|
||||
"\n" +
|
||||
"\n" +
|
||||
"\n" +
|
||||
" gradimento_reparto AS (SELECT DISTINCT id_ispezione,\n" +
|
||||
" cod_jfas,\n" +
|
||||
" cod_mdep,\n" +
|
||||
" data_isp,\n" +
|
||||
" gradimento_reparto,\n" +
|
||||
" LAG(gradimento_reparto, 1, 0)\n" +
|
||||
" OVER (PARTITION BY cod_mdep,cod_jfas ORDER BY data_isp ) AS grad_1,\n" +
|
||||
" LAG(gradimento_reparto, 2, 0)\n" +
|
||||
" OVER (PARTITION BY cod_mdep,cod_jfas ORDER BY data_isp ) AS grad_2\n" +
|
||||
"\n" +
|
||||
" FROM (SELECT DISTINCT id_ispezione, cod_mdep, cod_jfas, gradimento_reparto, data_isp\n" +
|
||||
" FROM steup_activities) acti)\n" +
|
||||
"\n" +
|
||||
"\n" +
|
||||
"SELECT steup_activities.*,\n" +
|
||||
" CASE\n" +
|
||||
" WHEN gradimento_reparto.grad_1 > max_allocazione AND gradimento_reparto.grad_2 > max_allocazione THEN 1\n" +
|
||||
" ELSE 0 END AS recidiva,\n" +
|
||||
" ((SELECT COUNT(*)\n" +
|
||||
" FROM stb_activity art\n" +
|
||||
" WHERE steup_activities.activity_id = art.parent_activity_id) + (SELECT COUNT(*)\n" +
|
||||
" FROM mtb_colt\n" +
|
||||
" INNER JOIN mtb_colr\n" +
|
||||
" ON mtb_colt.gestione =\n" +
|
||||
" mtb_colr.gestione AND\n" +
|
||||
" mtb_colt.data_collo =\n" +
|
||||
" mtb_colr.data_collo AND\n" +
|
||||
" mtb_colt.ser_collo =\n" +
|
||||
" mtb_colr.ser_collo AND\n" +
|
||||
" mtb_colt.num_collo =\n" +
|
||||
" mtb_colr.num_collo\n" +
|
||||
" WHERE mtb_colt.activity_id = steup_activities.activity_id)) AS count_art\n" +
|
||||
"FROM steup_activities\n" +
|
||||
" left outer JOIN gradimento_reparto ON steup_activities.id_ispezione = gradimento_reparto.id_ispezione\n" +
|
||||
" AND steup_activities.cod_mdep = gradimento_reparto.cod_mdep\n" +
|
||||
" AND steup_activities.cod_jfas = gradimento_reparto.cod_jfas\n" +
|
||||
"WHERE (@idIspezione is null or steup_activities.id_ispezione = @idIspezione)");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
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_20251212182900 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
if (isCustomerDb(IntegryCustomerDB.FolliesGroup_FolliesGroup)) {
|
||||
executeStatement("delete from mtb_aart_anag\n" +
|
||||
"from (select mtb_aart_anag.cod_anag, mtb_aart_anag.cod_mart, mtb_aart_anag.cod_col, mtb_aart_anag.cod_tagl, max(id) as id \n" +
|
||||
"\t\tfrom (select cod_anag, cod_mart, cod_col, cod_tagl, row_number() over (partition by cod_anag, cod_mart, cod_col, cod_tagl order by cod_anag, cod_mart, cod_col, cod_tagl, id desc) as riga \n" +
|
||||
"\t\tfrom dbo.mtb_aart_anag \n" +
|
||||
"\t\t)error inner join mtb_aart_anag on mtb_aart_anag.cod_anag = error.cod_anag and \n" +
|
||||
"\t\t\t\t\t\t\t\t\t\t\tmtb_aart_anag.cod_mart = error.cod_mart \n" +
|
||||
"where riga > 1 \n" +
|
||||
"group by mtb_aart_anag.cod_anag, mtb_aart_anag.cod_col, mtb_aart_anag.cod_tagl, mtb_aart_anag.cod_mart)rowDelete inner join mtb_aart_anag on rowDelete.id = mtb_aart_anag.id");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
}
|
||||
}
|
||||
@@ -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 {
|
||||
}
|
||||
}
|
||||
@@ -184,7 +184,7 @@ public class AccountingRules extends QueryRules {
|
||||
|
||||
if (!UtilityString.isNullOrEmpty(codBiva)) {
|
||||
for (CtbMovi ctbMovi : ctbMovt.getCtbMovi()) {
|
||||
if (UtilityString.isNullOrEmpty(ctbMovi.getCodBiva()) && !ctbMovi.getCodBiva().equalsIgnoreCase(EmsRestConstants.NULL)) {
|
||||
if (ctbMovi.getCodBiva() != null && ctbMovi.getCodBiva().trim().isEmpty()) {
|
||||
ctbMovi.setCodBiva(codBiva);
|
||||
}
|
||||
movi.add(ctbMovi);
|
||||
|
||||
@@ -4,7 +4,8 @@ import com.annimon.stream.ComparatorCompat;
|
||||
import com.annimon.stream.Stream;
|
||||
import it.integry.common.var.CommonConstants;
|
||||
import it.integry.ems._context.ApplicationContextProvider;
|
||||
import it.integry.ems.dynamic_cache.EntityCacheComponent;
|
||||
import it.integry.ems.jpa.repository.MtbAartRepository;
|
||||
import it.integry.ems.jpa.repository.MtbUntMisRepository;
|
||||
import it.integry.ems.json.ResponseJSONObjectMapper;
|
||||
import it.integry.ems.migration._base.IntegryCustomerDB;
|
||||
import it.integry.ems.sync.MultiDBTransaction.Connection;
|
||||
@@ -674,41 +675,46 @@ public class CommonRules extends QueryRules {
|
||||
public static String completeCodBarre(IntegryCustomerDB customerDB, Connection connection, String codMart)
|
||||
throws SQLException {
|
||||
|
||||
final EntityCacheComponent entityCacheComponent = ApplicationContextProvider.getApplicationContext().getBean(EntityCacheComponent.class);
|
||||
|
||||
final MtbAartRepository mtbAartRepository = ApplicationContextProvider.getApplicationContext().getBean(MtbAartRepository.class);
|
||||
|
||||
List<HashMap<String, Object>> result = new ArrayList<>();
|
||||
|
||||
entityCacheComponent.<MtbAart>getCachedEntitiesStream(customerDB, MtbAart.ENTITY,
|
||||
x -> x.getCodMart().equalsIgnoreCase(codMart) && !UtilityString.isNullOrEmpty(x.getBarCode()))
|
||||
.forEach(x -> result.add(new HashMap<String, Object>() {{
|
||||
put("cod_mart", x.getCodMart());
|
||||
put("cod_barre", x.getBarCode());
|
||||
Optional<MtbAart> optMtbAart = mtbAartRepository.findWithBarcodeByCodMart(codMart);
|
||||
|
||||
if (optMtbAart.isPresent()) {
|
||||
MtbAart mtbAart = optMtbAart.get();
|
||||
|
||||
if (!UtilityString.isNullOrEmpty(mtbAart.getBarCode())) {
|
||||
result.add(new HashMap<String, Object>() {{
|
||||
put("cod_mart", mtbAart.getCodMart());
|
||||
put("cod_barre", mtbAart.getBarCode());
|
||||
put("cod_col", null);
|
||||
put("cod_tagl", null);
|
||||
put("qta_cnf", BigDecimal.ONE);
|
||||
}}));
|
||||
}});
|
||||
}
|
||||
|
||||
entityCacheComponent.<MtbAart>getCachedEntitiesStream(customerDB, MtbAart.ENTITY,
|
||||
x -> x.getCodMart().equalsIgnoreCase(codMart) && !UtilityString.isNullOrEmpty(x.getCodBarreImb()))
|
||||
.forEach(x -> result.add(new HashMap<String, Object>() {{
|
||||
put("cod_mart", x.getCodMart());
|
||||
put("cod_barre", x.getCodBarreImb());
|
||||
if (!UtilityString.isNullOrEmpty(mtbAart.getCodBarreImb())) {
|
||||
result.add(new HashMap<String, Object>() {{
|
||||
put("cod_mart", mtbAart.getCodMart());
|
||||
put("cod_barre", mtbAart.getCodBarreImb());
|
||||
put("cod_col", null);
|
||||
put("cod_tagl", null);
|
||||
put("qta_cnf", x.getQtaCnf());
|
||||
}}));
|
||||
|
||||
entityCacheComponent.<MtbAartBarCode>getCachedEntitiesStream(customerDB, MtbAartBarCode.ENTITY,
|
||||
x -> x.getCodMart().equalsIgnoreCase(codMart))
|
||||
.forEach(x -> result.add(new HashMap<String, Object>() {{
|
||||
put("cod_mart", x.getCodMart());
|
||||
put("cod_barre", x.getCodBarre());
|
||||
put("cod_col", null);
|
||||
put("cod_tagl", null);
|
||||
put("qta_cnf", x.getQtaCnf());
|
||||
}}));
|
||||
put("qta_cnf", mtbAart.getQtaCnf());
|
||||
}});
|
||||
}
|
||||
|
||||
if (mtbAart.getMtbAartBarCode() != null) {
|
||||
mtbAart.getMtbAartBarCode()
|
||||
.forEach(x -> result.add(new HashMap<String, Object>() {{
|
||||
put("cod_mart", x.getCodMart());
|
||||
put("cod_barre", x.getCodBarre());
|
||||
put("cod_col", null);
|
||||
put("cod_tagl", null);
|
||||
put("qta_cnf", x.getQtaCnf());
|
||||
}}));
|
||||
}
|
||||
}
|
||||
|
||||
String barcode = null;
|
||||
|
||||
@@ -728,14 +734,12 @@ public class CommonRules extends QueryRules {
|
||||
}
|
||||
|
||||
public static String completeFlagQtaCnfFissa(Connection connection, IntegryCustomerDB customerDB, String codMart) {
|
||||
final EntityCacheComponent entityCacheComponent = ApplicationContextProvider.getApplicationContext().getBean(EntityCacheComponent.class);
|
||||
final MtbAartRepository mtbAartRepository = ApplicationContextProvider.getApplicationContext().getBean(MtbAartRepository.class);
|
||||
|
||||
final List<MtbAart> cachedMtbAarts = entityCacheComponent.getCachedEntitiesList(customerDB, MtbAart.ENTITY, x -> x.getCodMart().equals(codMart));
|
||||
final String flagQtaCnfFissaArt = mtbAartRepository.findFlagQtaCnfFissaByCodMart(codMart)
|
||||
.orElse(null);
|
||||
|
||||
if (cachedMtbAarts == null || cachedMtbAarts.isEmpty())
|
||||
return null;
|
||||
|
||||
return cachedMtbAarts.get(0).getFlagQtaCnfFissa();
|
||||
return flagQtaCnfFissaArt;
|
||||
}
|
||||
|
||||
public static String getApplicationName(Connection connection) throws Exception {
|
||||
@@ -1092,6 +1096,8 @@ public class CommonRules extends QueryRules {
|
||||
}
|
||||
|
||||
public static List<MtbUntMis> insUntMis(Connection conn, MtbAart mtbAart) throws Exception {
|
||||
MtbUntMisRepository mtbUntMisRepository = ApplicationContextProvider.getApplicationContext().getBean(MtbUntMisRepository.class);
|
||||
|
||||
List<MtbUntMis> mtbUntMisList = new ArrayList<>();
|
||||
List<String> untMisList = new ArrayList<>();
|
||||
|
||||
@@ -1106,8 +1112,7 @@ public class CommonRules extends QueryRules {
|
||||
}
|
||||
|
||||
for (String untMis : untMisList) {
|
||||
String sql = "SELECT count(*) FROM mtb_unt_mis WHERE unt_mis = " + UtilityDB.valueToString(untMis);
|
||||
Integer countUM = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(conn, sql);
|
||||
Integer countUM = mtbUntMisRepository.countByUntMis(untMis);
|
||||
if (countUM == null || countUM == 0) {
|
||||
MtbUntMis mtbUntMis = new MtbUntMis();
|
||||
mtbUntMis.setUntMis(untMis);
|
||||
@@ -1378,12 +1383,12 @@ public class CommonRules extends QueryRules {
|
||||
public static boolean getChkCompatibilitaCarat(Connection connection, String codMart, String carat) throws SQLException {
|
||||
String sql =
|
||||
Query.format("SELECT chk_compatibilita\n" +
|
||||
"FROM mtb_aart\n" +
|
||||
" INNER JOIN mtb_tipi_carat ON mtb_aart.cod_mtip = mtb_tipi_carat.cod_mtip AND\n" +
|
||||
" mtb_aart.cod_mstp = mtb_tipi_carat.cod_mstp\n" +
|
||||
"WHERE mtb_aart.cod_mart = %s\n" +
|
||||
" AND mtb_tipi_carat.carat = %s\n" ,
|
||||
codMart, carat);
|
||||
"FROM mtb_aart\n" +
|
||||
" INNER JOIN mtb_tipi_carat ON mtb_aart.cod_mtip = mtb_tipi_carat.cod_mtip AND\n" +
|
||||
" mtb_aart.cod_mstp = mtb_tipi_carat.cod_mstp\n" +
|
||||
"WHERE mtb_aart.cod_mart = %s\n" +
|
||||
" AND mtb_tipi_carat.carat = %s\n",
|
||||
codMart, carat);
|
||||
|
||||
Boolean chkCompatibilita = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(connection, sql);
|
||||
if (chkCompatibilita == null) chkCompatibilita = false;
|
||||
|
||||
@@ -435,12 +435,12 @@ public class DocumentCheckRules {
|
||||
}
|
||||
|
||||
if (returnVal && entity.getOperation() == OperationType.INSERT) {
|
||||
throw new Exception("DOCUMENTO INTESTATO A " + entity.getCodAnag() + " - " + entity.getCodDtip() + " N. " + entity.getNumDoc().toString() + "/" + entity.getSerDoc() + " DEL " + new SimpleDateFormat(CommonConstants.DATE_FORMAT_DMY).format(entity.getDataDoc()) + " GIA' ESISTENTE");
|
||||
throw new Exception(String.format("Documento intestato a %s - %s numero %s/%d già esistente", entity.getCodAnag(), entity.getCodDtip(), entity.getSerDoc(), entity.getNumDoc()));
|
||||
} else {
|
||||
if (checkDocInSequenza(conn, entity) == false && "AUTOMATICA".equalsIgnoreCase(tipoNumeraz) &&
|
||||
entity.getOperation() != OperationType.UPDATE) {
|
||||
String valueDataDoc = new SimpleDateFormat(CommonConstants.DATE_FORMAT_DMY).format(dataDoc);
|
||||
throw new Exception("(DOC. " + codDtip + " N° " + numDoc + "/" + serDoc + " DEL " + valueDataDoc + " INTESTATO A " + codAnag + " FUORI SEQUENZA)");
|
||||
throw new Exception("(Doc. " + codDtip + " N° " + numDoc + "/" + serDoc + " del " + valueDataDoc + " intestato a " + codAnag + " fuori sequenza)");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,8 @@ package it.integry.ems.rules.completing;
|
||||
|
||||
import com.annimon.stream.Stream;
|
||||
import it.integry.ems._context.ApplicationContextProvider;
|
||||
import it.integry.ems.dynamic_cache.EntityCacheComponent;
|
||||
import it.integry.ems.jpa.repository.MtbAartRepository;
|
||||
import it.integry.ems.jpa.repository.MtbUntMisRepository;
|
||||
import it.integry.ems.migration._base.IntegryCustomerDB;
|
||||
import it.integry.ems.rules.completing.dto.DatiPartitaMagDTO;
|
||||
import it.integry.ems.sync.MultiDBTransaction.Connection;
|
||||
@@ -333,16 +334,14 @@ public class PackagesRules extends QueryRules {
|
||||
|
||||
public static HashMap<String, Object> calcPeso(IntegryCustomerDB customerDB, Connection conn, MtbColr entity) throws Exception {
|
||||
|
||||
final EntityCacheComponent entityCacheComponent = ApplicationContextProvider.getApplicationContext().getBean(EntityCacheComponent.class);
|
||||
final MtbAartRepository mtbAartRepository = ApplicationContextProvider.getApplicationContext().getBean(MtbAartRepository.class);
|
||||
final MtbUntMisRepository mtbUntMisRepository = ApplicationContextProvider.getApplicationContext().getBean(MtbUntMisRepository.class);
|
||||
|
||||
BigDecimal cifreDec = entityCacheComponent.<MtbUntMis>getCachedEntitiesStream(customerDB, MtbUntMis.ENTITY,
|
||||
x -> x.getFlagUnitaKg().equalsIgnoreCase("S"))
|
||||
.map(MtbUntMis::getCifreDec)
|
||||
BigDecimal cifreDec = mtbUntMisRepository.findCifreDecByFlagUnitaKg("S").stream()
|
||||
.findFirst()
|
||||
.orElse(BigDecimal.valueOf(5));
|
||||
|
||||
HashMap<String, Object> anagArt = entityCacheComponent.<MtbAart>getCachedEntitiesStream(customerDB, MtbAart.ENTITY,
|
||||
x -> x.getCodMart().equalsIgnoreCase(entity.getCodMart()))
|
||||
HashMap<String, Object> anagArt = mtbAartRepository.findByCodMart(entity.getCodMart())
|
||||
.map(x -> new HashMap<String, Object>() {{
|
||||
put("unt_mis", x.getUntMis());
|
||||
put("tara_kg", x.getTaraKg());
|
||||
@@ -350,7 +349,6 @@ public class PackagesRules extends QueryRules {
|
||||
put("flag_peso_egalizzato", x.getFlagPesoEgalizzato());
|
||||
put("peso_egalizzato", x.getFlagPesoEgalizzato() ? x.getQtaCnf().multiply(x.getPesoKg()) : null);
|
||||
}})
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
|
||||
|
||||
@@ -365,10 +363,8 @@ public class PackagesRules extends QueryRules {
|
||||
|
||||
BigDecimal pesoNetto = BigDecimal.ZERO, pesoLordo = BigDecimal.ZERO;
|
||||
if (anagArt != null) {
|
||||
String flagUnitaKg = entityCacheComponent.<MtbUntMis>getCachedEntitiesStream(customerDB, MtbUntMis.ENTITY,
|
||||
x -> x.getUntMis().equalsIgnoreCase(String.valueOf(anagArt.get("unt_mis"))))
|
||||
String flagUnitaKg = mtbUntMisRepository.findByUntMis((String) anagArt.get("unt_mis"))
|
||||
.map(MtbUntMis::getFlagUnitaKg)
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
|
||||
BigDecimal taraKg = (BigDecimal) anagArt.get("tara_kg");
|
||||
|
||||
@@ -76,12 +76,11 @@ public class PurchasesRules extends QueryRules {
|
||||
if ( !UtilityString.isNullOrEmpty(tipoVariazione) ) return tipoVariazione;
|
||||
|
||||
sql =
|
||||
Query.format("SELECT tipo_variazione"
|
||||
+ " FROM dbo.getGrigliaAcquisto(%s, %s,%s, %s, %s)",
|
||||
Query.format("SELECT TOP 1 tipo_variazione"
|
||||
+ " FROM dbo.getGrigliaAcquisto(%s, NULL,%s, NULL, %s) g\n" +
|
||||
"ORDER BY data_validita DESC, tipo_variazione DESC",
|
||||
atbGriglieArt.getDataValidita(),
|
||||
atbGriglieArt.getCodAlis(),
|
||||
atbGriglieArt.getCodMdep(),
|
||||
atbGriglieArt.getCodArtFor(),
|
||||
atbGriglieArt.getCodMart());
|
||||
|
||||
tipoVariazione = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(connection, sql);
|
||||
|
||||
@@ -109,6 +109,20 @@ public class BasicConnectionPool {
|
||||
}
|
||||
}
|
||||
|
||||
public javax.sql.DataSource getDataSource(String profileName) {
|
||||
AvailableConnectionModel model = settingsModel.findConnectionModel(profileName);
|
||||
if (model == null) {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
registerDataSourceIfNotExists(model);
|
||||
return registeredDatasources.get(model);
|
||||
} catch (Exception e) {
|
||||
logger.error("Error retrieving DataSource for profile: " + profileName, e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void registerDataSourceIfNotExists(AvailableConnectionModel connectionModel) throws Exception {
|
||||
if (!registeredDatasources.containsKey(connectionModel)) {
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
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_model.entity.MtbDepoPosizioni;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class MtbDepoPosizioniUtils {
|
||||
|
||||
|
||||
public static final List<MtbDepoPosizioni> getAllMonoUlPositions(IntegryCustomerDB customerDB) {
|
||||
final EntityCacheComponent entityCacheComponent = ApplicationContextProvider.getApplicationContext().getBean(EntityCacheComponent.class);
|
||||
|
||||
return entityCacheComponent.<MtbDepoPosizioni>getCachedEntitiesList(customerDB, MtbDepoPosizioni.ENTITY,
|
||||
x -> x.isFlagMonoCollo());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -116,6 +116,7 @@ public class EmsRestConstants {
|
||||
public static final String PATH_USERS = PATH + "getUser";
|
||||
public static final String PATH_EXPORT_ORDINI_ACQ = PATH + "exportOrdiniAcquisto";
|
||||
public static final String PATH_PROCESS_REPORT = PATH + "processReport";
|
||||
public static final String PATH_DOWNLOAD_REPORT_LIST = PATH + "downloadReportList";
|
||||
public static final String PATH_DOWNLOAD_REPORT = PATH + "downloadReport";
|
||||
public static final String PATH_PROCESS_REPORT_TYPE = PATH + "processReportType";
|
||||
public static final String PATH_PRINT_REPORT_TYPE = PATH + "printReportType";
|
||||
|
||||
@@ -13,12 +13,15 @@ import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.kie.api.definition.type.PropertyReactive;
|
||||
|
||||
import javax.persistence.Transient;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
@javax.persistence.Entity
|
||||
@javax.persistence.Table(name = MtbAart.ENTITY)
|
||||
@Master
|
||||
@PropertyReactive
|
||||
@Table(MtbAart.ENTITY)
|
||||
@@ -31,341 +34,462 @@ public class MtbAart extends EntityBase implements EquatableEntityInterface<MtbA
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@javax.persistence.Id
|
||||
@javax.persistence.Column(name = "cod_mart")
|
||||
@PK
|
||||
@SqlField(value = "cod_mart", maxLength = 15, nullable = false)
|
||||
private String codMart;
|
||||
|
||||
@javax.persistence.Column(name = "descrizione")
|
||||
@SqlField(value = "descrizione", maxLength = 40, nullable = false)
|
||||
private String descrizione;
|
||||
|
||||
@javax.persistence.Column(name = "unt_mis")
|
||||
@FK(tableName = "mtb_unt_mis", columnName = "unt_mis")
|
||||
@SqlField(value = "unt_mis", maxLength = 3, nullable = false)
|
||||
private String untMis;
|
||||
|
||||
@javax.persistence.Column(name = "bar_code")
|
||||
@SqlField(value = "bar_code", maxLength = 40)
|
||||
private String barCode;
|
||||
|
||||
@javax.persistence.Column(name = "peso_kg")
|
||||
@SqlField(value = "peso_kg", nullable = false, defaultObjectValue = "0")
|
||||
private BigDecimal pesoKg;
|
||||
|
||||
@javax.persistence.Column(name = "qta_cnf")
|
||||
@SqlField(value = "qta_cnf", nullable = false, defaultObjectValue = "1")
|
||||
private BigDecimal qtaCnf;
|
||||
|
||||
@javax.persistence.Column(name = "cod_aliq")
|
||||
@SqlField(value = "cod_aliq", maxLength = 5)
|
||||
private String codAliq;
|
||||
|
||||
@javax.persistence.Column(name = "cod_sco_art")
|
||||
@SqlField(value = "cod_sco_art", maxLength = 5)
|
||||
private String codScoArt;
|
||||
|
||||
@javax.persistence.Column(name = "cod_tcol_ui")
|
||||
@SqlField(value = "cod_tcol_ui")
|
||||
private String codTcolUi;
|
||||
|
||||
@javax.persistence.Column(name = "cod_tcol_ul")
|
||||
@SqlField(value = "cod_tcol_ul")
|
||||
private String codTcolUl;
|
||||
|
||||
@javax.persistence.Column(name = "articolo_composto")
|
||||
@SqlField(value = "articolo_composto", maxLength = 1, nullable = false, defaultObjectValue = "N")
|
||||
private String articoloComposto;
|
||||
|
||||
@javax.persistence.Column(name = "esposizione_comp")
|
||||
@SqlField(value = "esposizione_comp", maxLength = 1, nullable = false, defaultObjectValue = "N")
|
||||
private String esposizioneComp;
|
||||
|
||||
@javax.persistence.Column(name = "descrizione_estesa")
|
||||
@SqlField(value = "descrizione_estesa", maxLength = 4096)
|
||||
private String descrizioneEstesa;
|
||||
|
||||
@javax.persistence.Column(name = "cod_ult_forn")
|
||||
@SqlField(value = "cod_ult_forn", maxLength = 5)
|
||||
private String codUltForn;
|
||||
|
||||
@javax.persistence.Column(name = "data_ult_car")
|
||||
@SqlField(value = "data_ult_car")
|
||||
private Date dataUltCar;
|
||||
|
||||
@javax.persistence.Column(name = "val_ult_car")
|
||||
@SqlField(value = "val_ult_car")
|
||||
private BigDecimal valUltCar;
|
||||
|
||||
@javax.persistence.Column(name = "cod_ult_clie")
|
||||
@SqlField(value = "cod_ult_clie", maxLength = 5)
|
||||
private String codUltClie;
|
||||
|
||||
@javax.persistence.Column(name = "data_ult_scar")
|
||||
@SqlField(value = "data_ult_scar")
|
||||
private Date dataUltScar;
|
||||
|
||||
@javax.persistence.Column(name = "val_ult_scar")
|
||||
@SqlField(value = "val_ult_scar")
|
||||
private BigDecimal valUltScar;
|
||||
|
||||
@javax.persistence.Column(name = "tipo_codice")
|
||||
@SqlField(value = "tipo_codice", maxLength = 10)
|
||||
private String tipoCodice;
|
||||
|
||||
@javax.persistence.Column(name = "note")
|
||||
@SqlField(value = "note", maxLength = 255)
|
||||
private String note;
|
||||
|
||||
@javax.persistence.Column(name = "posizione")
|
||||
@SqlField(value = "posizione", maxLength = 15)
|
||||
private String posizione;
|
||||
|
||||
@javax.persistence.Column(name = "colli_pedana")
|
||||
@SqlField(value = "colli_pedana", defaultObjectValue = "1")
|
||||
private BigDecimal colliPedana;
|
||||
|
||||
@SqlField(value = "unt_mis2", maxLength = 5)
|
||||
@javax.persistence.Column(name = "unt_mis2")
|
||||
@FK(tableName = "mtb_unt_mis", columnName = "unt_mis")
|
||||
@SqlField(value = "unt_mis2", maxLength = 3)
|
||||
private String untMis2;
|
||||
|
||||
@javax.persistence.Column(name = "rap_conv2")
|
||||
@SqlField(value = "rap_conv2", defaultObjectValue = "1")
|
||||
private BigDecimal rapConv2;
|
||||
|
||||
@javax.persistence.Column(name = "flag_incl_listino")
|
||||
@SqlField(value = "flag_incl_listino", maxLength = 1, nullable = false, defaultObjectValue = "S")
|
||||
private String flagInclListino;
|
||||
|
||||
@javax.persistence.Column(name = "unt_mis3")
|
||||
@FK(tableName = "mtb_unt_mis", columnName = "unt_mis")
|
||||
@SqlField(value = "unt_mis3", maxLength = 3)
|
||||
private String untMis3;
|
||||
|
||||
@javax.persistence.Column(name = "rap_conv3")
|
||||
@SqlField(value = "rap_conv3", defaultObjectValue = "1")
|
||||
private BigDecimal rapConv3;
|
||||
|
||||
@javax.persistence.Column(name = "cod_mart_stat")
|
||||
@SqlField(value = "cod_mart_stat", maxLength = 15)
|
||||
private String codMartStat;
|
||||
|
||||
@javax.persistence.Column(name = "cod_mcon")
|
||||
@SqlField(value = "cod_mcon", maxLength = 5)
|
||||
private String codMcon;
|
||||
|
||||
@javax.persistence.Column(name = "cod_mgrp")
|
||||
@SqlField(value = "cod_mgrp", maxLength = 5, nullable = false)
|
||||
private String codMgrp;
|
||||
|
||||
@javax.persistence.Column(name = "cod_msfa")
|
||||
@SqlField(value = "cod_msfa", maxLength = 6)
|
||||
private String codMsfa;
|
||||
|
||||
@javax.persistence.Column(name = "cod_msgr")
|
||||
@SqlField(value = "cod_msgr", maxLength = 5, nullable = false)
|
||||
private String codMsgr;
|
||||
|
||||
@javax.persistence.Column(name = "cod_mstp")
|
||||
@SqlField(value = "cod_mstp", maxLength = 5)
|
||||
private String codMstp;
|
||||
|
||||
@javax.persistence.Column(name = "cod_mtip")
|
||||
@SqlField(value = "cod_mtip", maxLength = 5)
|
||||
private String codMtip;
|
||||
|
||||
@javax.persistence.Column(name = "descrizione_stat")
|
||||
@SqlField(value = "descrizione_stat", maxLength = 40)
|
||||
private String descrizioneStat;
|
||||
|
||||
@javax.persistence.Column(name = "flag_stato")
|
||||
@SqlField(value = "flag_stato", maxLength = 1, nullable = false, defaultObjectValue = "A")
|
||||
private String flagStato;
|
||||
|
||||
@javax.persistence.Column(name = "cambio_divi_car")
|
||||
@SqlField(value = "cambio_divi_car", nullable = false)
|
||||
private BigDecimal cambioDiviCar;
|
||||
|
||||
@javax.persistence.Column(name = "cambio_divi_scar")
|
||||
@SqlField(value = "cambio_divi_scar", nullable = false)
|
||||
private BigDecimal cambioDiviScar;
|
||||
|
||||
@javax.persistence.Column(name = "gg_scad_partita")
|
||||
@SqlField(value = "gg_scad_partita", nullable = false, defaultObjectValue = "0")
|
||||
private Integer ggScadPartita;
|
||||
|
||||
@javax.persistence.Column(name = "volume_mc")
|
||||
@SqlField(value = "volume_mc", defaultObjectValue = "0")
|
||||
private BigDecimal volumeMc;
|
||||
|
||||
@javax.persistence.Column(name = "flag_esponi_prz")
|
||||
@SqlField(value = "flag_esponi_prz", maxLength = 1, nullable = false, defaultObjectValue = "N")
|
||||
private String flagEsponiPrz;
|
||||
|
||||
@javax.persistence.Column(name = "data_ult_var")
|
||||
@SqlField(value = "data_ult_var", format = CommonConstants.SYSDATE)
|
||||
private Date dataUltVar;
|
||||
|
||||
@javax.persistence.Column(name = "perc_sfrido")
|
||||
@SqlField(value = "perc_sfrido", nullable = false, defaultObjectValue = "0")
|
||||
private BigDecimal percSfrido;
|
||||
|
||||
@javax.persistence.Column(name = "cod_barre_imb")
|
||||
@SqlField(value = "cod_barre_imb", maxLength = 40)
|
||||
private String codBarreImb;
|
||||
|
||||
@javax.persistence.Column(name = "flag_calc_prz")
|
||||
@SqlField(value = "flag_calc_prz", maxLength = 1, nullable = false, defaultObjectValue = "K")
|
||||
private String flagCalcPrz;
|
||||
|
||||
@javax.persistence.Column(name = "esposizione_comp_acq")
|
||||
@SqlField(value = "esposizione_comp_acq", maxLength = 1, nullable = false, defaultObjectValue = "N")
|
||||
private String esposizioneCompAcq;
|
||||
|
||||
@javax.persistence.Column(name = "flag_calc_prz_acq")
|
||||
@SqlField(value = "flag_calc_prz_acq", maxLength = 1, nullable = false, defaultObjectValue = "K")
|
||||
private String flagCalcPrzAcq;
|
||||
|
||||
@javax.persistence.Column(name = "diacod")
|
||||
@SqlField(value = "diacod", maxLength = 40)
|
||||
private String diacod;
|
||||
|
||||
@javax.persistence.Column(name = "plu")
|
||||
@SqlField(value = "plu", maxLength = 6)
|
||||
private String plu;
|
||||
|
||||
@javax.persistence.Column(name = "part_iva_prod")
|
||||
@SqlField(value = "part_iva_prod", maxLength = 20)
|
||||
private String partIvaProd;
|
||||
|
||||
@javax.persistence.Column(name = "rag_soc_prod")
|
||||
@SqlField(value = "rag_soc_prod", maxLength = 40)
|
||||
private String ragSocProd;
|
||||
|
||||
@javax.persistence.Column(name = "flag_rap_conv_variabile")
|
||||
@SqlField(value = "flag_rap_conv_variabile", maxLength = 1, nullable = false, defaultObjectValue = "N")
|
||||
private String flagRapConvVariabile;
|
||||
|
||||
@javax.persistence.Column(name = "flag_mov_art_mag")
|
||||
@SqlField(value = "flag_mov_art_mag", maxLength = 1, nullable = false, defaultObjectValue = "S")
|
||||
private String flagMovArtMag;
|
||||
|
||||
@javax.persistence.Column(name = "flag_tracciabilita")
|
||||
@SqlField(value = "flag_tracciabilita", maxLength = 1, nullable = false, defaultObjectValue = "N")
|
||||
private String flagTracciabilita;
|
||||
|
||||
@javax.persistence.Column(name = "tara_kg")
|
||||
@SqlField(value = "tara_kg", defaultObjectValue = "0")
|
||||
private BigDecimal taraKg;
|
||||
|
||||
@javax.persistence.Column(name = "colli_strato")
|
||||
@SqlField(value = "colli_strato", nullable = false, defaultObjectValue = "1")
|
||||
private BigDecimal colliStrato;
|
||||
|
||||
@javax.persistence.Column(name = "flag_qta_cnf_fissa")
|
||||
@SqlField(value = "flag_qta_cnf_fissa", maxLength = 1, nullable = false, defaultObjectValue = "S")
|
||||
private String flagQtaCnfFissa;
|
||||
|
||||
@javax.persistence.Column(name = "flag_colli_pedana_fisso")
|
||||
@SqlField(value = "flag_colli_pedana_fisso", maxLength = 1, nullable = false, defaultObjectValue = "S")
|
||||
private String flagColliPedanaFisso;
|
||||
|
||||
@javax.persistence.Column(name = "cod_ccon_costi")
|
||||
@SqlField(value = "cod_ccon_costi", maxLength = 6)
|
||||
private String codCconCosti;
|
||||
|
||||
@javax.persistence.Column(name = "cod_ccon_ricavi")
|
||||
@SqlField(value = "cod_ccon_ricavi", maxLength = 6)
|
||||
private String codCconRicavi;
|
||||
|
||||
@javax.persistence.Column(name = "cod_dgrp_art")
|
||||
@SqlField(value = "cod_dgrp_art", maxLength = 5)
|
||||
private String codDgrpArt;
|
||||
|
||||
@javax.persistence.Column(name = "cod_divi_car")
|
||||
@SqlField(value = "cod_divi_car", maxLength = 5, nullable = false)
|
||||
private String codDiviCar;
|
||||
|
||||
@javax.persistence.Column(name = "cod_divi_scar")
|
||||
@SqlField(value = "cod_divi_scar", maxLength = 5, nullable = false)
|
||||
private String codDiviScar;
|
||||
|
||||
@javax.persistence.Column(name = "cod_ecr_cat")
|
||||
@SqlField(value = "cod_ecr_cat", maxLength = 10)
|
||||
private String codEcrCat;
|
||||
|
||||
@javax.persistence.Column(name = "cod_ecr_mcat")
|
||||
@SqlField(value = "cod_ecr_mcat", maxLength = 10)
|
||||
private String codEcrMcat;
|
||||
|
||||
@javax.persistence.Column(name = "cod_ecr_rep")
|
||||
@SqlField(value = "cod_ecr_rep", maxLength = 10)
|
||||
private String codEcrRep;
|
||||
|
||||
@javax.persistence.Column(name = "cod_ecr_stipo")
|
||||
@SqlField(value = "cod_ecr_stipo", maxLength = 10)
|
||||
private String codEcrStipo;
|
||||
|
||||
@javax.persistence.Column(name = "cod_ecr_tipo")
|
||||
@SqlField(value = "cod_ecr_tipo", maxLength = 10)
|
||||
private String codEcrTipo;
|
||||
|
||||
@javax.persistence.Column(name = "cod_grp_bolla")
|
||||
@SqlField(value = "cod_grp_bolla", maxLength = 5)
|
||||
private String codGrpBolla;
|
||||
|
||||
@SqlField(value = "ingredienti", maxLength = 1024)
|
||||
@javax.persistence.Column(name = "ingredienti")
|
||||
@SqlField(value = "ingredienti", maxLength = 8000)
|
||||
private String ingredienti;
|
||||
|
||||
@javax.persistence.Column(name = "id_art_equi")
|
||||
@SqlField(value = "id_art_equi", maxLength = 25)
|
||||
private String idArtEqui;
|
||||
|
||||
@javax.persistence.Column(name = "descr_cassa")
|
||||
@SqlField(value = "descr_cassa", maxLength = 40)
|
||||
private String descrCassa;
|
||||
|
||||
@javax.persistence.Column(name = "cod_nc_intracee")
|
||||
@SqlField(value = "cod_nc_intracee", maxLength = 20)
|
||||
private String codNcIntracee;
|
||||
|
||||
@javax.persistence.Column(name = "marchio")
|
||||
@SqlField(value = "marchio", maxLength = 255)
|
||||
private String marchio;
|
||||
|
||||
@javax.persistence.Column(name = "sezione")
|
||||
@SqlField(value = "sezione")
|
||||
private Integer sezione;
|
||||
|
||||
@javax.persistence.Column(name = "tipo_reg")
|
||||
@SqlField(value = "tipo_reg", maxLength = 1)
|
||||
private String tipoReg;
|
||||
|
||||
@javax.persistence.Column(name = "tipo_stock")
|
||||
@SqlField(value = "tipo_stock", maxLength = 1)
|
||||
private String tipoStock;
|
||||
|
||||
@javax.persistence.Column(name = "qta_multipla_ord")
|
||||
@SqlField(value = "qta_multipla_ord")
|
||||
private BigDecimal qtaMultiplaOrd;
|
||||
|
||||
@MapToTable(value = "flag_kit")
|
||||
@Transient
|
||||
private String flagKit;
|
||||
|
||||
@javax.persistence.Column(name = "cod_forn_cv")
|
||||
@SqlField(value = "cod_forn_cv", maxLength = 5)
|
||||
private String codFornCv;
|
||||
|
||||
@javax.persistence.Column(name = "cpa")
|
||||
@SqlField(value = "cpa", maxLength = 5)
|
||||
private String cpa;
|
||||
|
||||
@javax.persistence.Column(name = "taric")
|
||||
@SqlField(value = "taric", maxLength = 5)
|
||||
private String taric;
|
||||
|
||||
@javax.persistence.Column(name = "sezione_dogana")
|
||||
@SqlField(value = "sezione_dogana", maxLength = 6)
|
||||
private String sezioneDogana;
|
||||
|
||||
@javax.persistence.Column(name = "flag_peso_egalizzato")
|
||||
@SqlField(value = "flag_peso_egalizzato", nullable = false, defaultObjectValue = "0")
|
||||
private Boolean flagPesoEgalizzato;
|
||||
|
||||
@javax.persistence.Column(name = "cod_jfas_costi")
|
||||
@SqlField(value = "cod_jfas_costi", maxLength = 5)
|
||||
private String codJfasCosti;
|
||||
|
||||
@javax.persistence.Column(name = "cod_jfas_ricavi")
|
||||
@SqlField(value = "cod_jfas_ricavi", maxLength = 5)
|
||||
private String codJfasRicavi;
|
||||
|
||||
@Transient
|
||||
private String mtbAartEqui_descrizione;
|
||||
|
||||
@javax.persistence.Column(name = "flag_arr_prz_vend_iva")
|
||||
@SqlField(value = "flag_arr_prz_vend_iva", nullable = false, defaultObjectValue = "1")
|
||||
private Boolean flagArrPrzVendIva;
|
||||
|
||||
@javax.persistence.Column(name = "classificazione_abc")
|
||||
@SqlField(value = "classificazione_abc", maxLength = 1)
|
||||
private String classificazioneAbc;
|
||||
|
||||
@javax.persistence.Column(name = "tipo_codice_imballo")
|
||||
@SqlField(value = "tipo_codice_imballo", maxLength = 10)
|
||||
private String tipoCodiceImballo;
|
||||
|
||||
@javax.persistence.Column(name = "flag_stampa_docu_vend")
|
||||
@SqlField(value = "flag_stampa_docu_vend", nullable = false, defaultObjectValue = "1")
|
||||
private Boolean flagStampaDocuVend;
|
||||
|
||||
@javax.persistence.Column(name = "flag_reso_tec")
|
||||
@SqlField(value = "flag_reso_tec", nullable = false, defaultObjectValue = "0")
|
||||
private Boolean flagResoTec;
|
||||
|
||||
@javax.persistence.Column(name = "cod_mssfa")
|
||||
@SqlField(value = "cod_mssfa", maxLength = 6)
|
||||
private String codMssfa;
|
||||
|
||||
@javax.persistence.Column(name = "cod_linea")
|
||||
@SqlField(value = "cod_linea", maxLength = 6)
|
||||
private String codLinea;
|
||||
|
||||
@javax.persistence.Column(name = "cod_slinea")
|
||||
@SqlField(value = "cod_slinea", maxLength = 6)
|
||||
private String codSlinea;
|
||||
|
||||
@javax.persistence.Column(name = "cod_sslinea")
|
||||
@SqlField(value = "cod_sslinea", maxLength = 6)
|
||||
private String codSslinea;
|
||||
|
||||
@javax.persistence.ManyToOne(fetch = javax.persistence.FetchType.LAZY)
|
||||
@javax.persistence.JoinColumn(name = "unt_mis", insertable = false, updatable = false)
|
||||
private MtbUntMis mtbUntMis;
|
||||
|
||||
@Priority(1)
|
||||
@Transient
|
||||
//Compatible with EntityBase
|
||||
private List<MtbUntMis> mtbUntMisList;
|
||||
|
||||
@Priority(1)
|
||||
@Transient
|
||||
private MtbAartMarchio mtbAartMarchio;
|
||||
|
||||
@Priority(1)
|
||||
@Transient
|
||||
private MtbAartEqui mtbAartEqui;
|
||||
|
||||
@Priority(1)
|
||||
private List<MtbUntMis> mtbUntMis;
|
||||
|
||||
@EntityChild
|
||||
@javax.persistence.OneToMany(fetch = javax.persistence.FetchType.LAZY, mappedBy = "mtbAart")
|
||||
private List<MtbAartBarCode> mtbAartBarCode = new ArrayList<>();
|
||||
|
||||
/*@EntityChild
|
||||
private List<MtbPart> mtbPart;*/
|
||||
@EntityChild
|
||||
@Transient
|
||||
private List<MtbAartCarat> mtbAartCarat = new ArrayList<>();
|
||||
|
||||
@EntityChild
|
||||
@Transient
|
||||
private List<MtbAartAnag> mtbAartAnag = new ArrayList<>();
|
||||
|
||||
@EntityChild
|
||||
@Transient
|
||||
private List<MtbSpes> mtbSpes = new ArrayList<>();
|
||||
|
||||
@EntityChild
|
||||
@Transient
|
||||
private List<MtbComp> mtbComp = new ArrayList<>();
|
||||
|
||||
@EntityChild
|
||||
@Transient
|
||||
private List<MtbAartDesc> mtbAartDesc = new ArrayList<>();
|
||||
|
||||
@EntityChild
|
||||
@Transient
|
||||
private List<MtbAartLink> mtbAartLink = new ArrayList<>();
|
||||
|
||||
@EntityChild
|
||||
@Transient
|
||||
private List<MtbPartitaMag> mtbPartitaMag = new ArrayList<>();
|
||||
|
||||
@EntityChild
|
||||
@Transient
|
||||
private List<MrlAartSchTecSet> mrlAartSchTecSet = new ArrayList<>();
|
||||
|
||||
@EntityChild
|
||||
@Transient
|
||||
private List<MtbAartColori> mtbAartColori = new ArrayList<>();
|
||||
|
||||
@Priority(101)
|
||||
@Transient
|
||||
List<JtbCicl> jtbCicl;
|
||||
|
||||
@Transient
|
||||
private List<MtbLisa> mtbLisa;
|
||||
|
||||
public MtbAart() {
|
||||
@@ -1178,15 +1302,24 @@ public class MtbAart extends EntityBase implements EquatableEntityInterface<MtbA
|
||||
return this;
|
||||
}
|
||||
|
||||
public List<MtbUntMis> getMtbUntMis() {
|
||||
public MtbUntMis getMtbUntMis() {
|
||||
return mtbUntMis;
|
||||
}
|
||||
|
||||
public MtbAart setMtbUntMis(List<MtbUntMis> mtbUntMis) {
|
||||
public MtbAart setMtbUntMis(MtbUntMis mtbUntMis) {
|
||||
this.mtbUntMis = mtbUntMis;
|
||||
return this;
|
||||
}
|
||||
|
||||
public List<MtbUntMis> getMtbUntMisList() {
|
||||
return mtbUntMisList;
|
||||
}
|
||||
|
||||
public MtbAart setMtbUntMisList(List<MtbUntMis> mtbUntMisList) {
|
||||
this.mtbUntMisList = mtbUntMisList;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getClassificazioneAbc() {
|
||||
return classificazioneAbc;
|
||||
}
|
||||
@@ -1258,8 +1391,9 @@ public class MtbAart extends EntityBase implements EquatableEntityInterface<MtbA
|
||||
return mtbAartCarat;
|
||||
}
|
||||
|
||||
public void setMtbAartCarat(List<MtbAartCarat> mtbAartCarat) {
|
||||
public MtbAart setMtbAartCarat(List<MtbAartCarat> mtbAartCarat) {
|
||||
this.mtbAartCarat = mtbAartCarat;
|
||||
return this;
|
||||
}
|
||||
|
||||
public List<MtbAartLink> getMtbAartLink() {
|
||||
|
||||
@@ -63,6 +63,9 @@ public class MtbAartAnag extends EntityBase {
|
||||
@SqlField(value = "note", maxLength = 255)
|
||||
private String note;
|
||||
|
||||
@SqlField(value = "cod_vdes", maxLength = 5)
|
||||
private String codVdes;
|
||||
|
||||
public MtbAartAnag() {
|
||||
super(logger);
|
||||
}
|
||||
@@ -174,4 +177,13 @@ public class MtbAartAnag extends EntityBase {
|
||||
this.note = note;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getCodVdes() {
|
||||
return codVdes;
|
||||
}
|
||||
|
||||
public MtbAartAnag setCodVdes(String codVdes) {
|
||||
this.codVdes = codVdes;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,6 +13,8 @@ import org.kie.api.definition.type.PropertyReactive;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Objects;
|
||||
|
||||
@javax.persistence.Entity
|
||||
@javax.persistence.Table(name = MtbAartBarCode.ENTITY)
|
||||
@PropertyReactive
|
||||
@Table(MtbAartBarCode.ENTITY)
|
||||
@JsonTypeName(MtbAartBarCode.ENTITY)
|
||||
@@ -26,18 +28,28 @@ public class MtbAartBarCode extends EntityBase implements EquatableEntityInterfa
|
||||
|
||||
@PK
|
||||
@SqlField(value = "cod_barre", maxLength = 40, nullable = false)
|
||||
@javax.persistence.Id
|
||||
@javax.persistence.Column(name = "cod_barre")
|
||||
private String codBarre;
|
||||
|
||||
@SqlField(value = "cod_mart", maxLength = 15)
|
||||
@javax.persistence.Column(name = "cod_mart")
|
||||
private String codMart;
|
||||
|
||||
@javax.persistence.ManyToOne(fetch = javax.persistence.FetchType.LAZY)
|
||||
@javax.persistence.JoinColumn(name = "cod_mart", insertable = false, updatable = false)
|
||||
private MtbAart mtbAart;
|
||||
|
||||
@SqlField(value = "qta_cnf", nullable = false, defaultObjectValue = "1")
|
||||
@javax.persistence.Column(name = "qta_cnf")
|
||||
private BigDecimal qtaCnf;
|
||||
|
||||
@SqlField(value = "flag_primario", maxLength = 1, nullable = false, defaultObjectValue = "N")
|
||||
@javax.persistence.Column(name = "flag_primario")
|
||||
private String flagPrimario;
|
||||
|
||||
@SqlField(value = "tipo_cod_barre", maxLength = 10)
|
||||
@javax.persistence.Column(name = "tipo_cod_barre")
|
||||
private String tipoCodBarre;
|
||||
|
||||
public MtbAartBarCode() {
|
||||
@@ -62,6 +74,14 @@ public class MtbAartBarCode extends EntityBase implements EquatableEntityInterfa
|
||||
return this;
|
||||
}
|
||||
|
||||
public MtbAart getMtbAart() {
|
||||
return mtbAart;
|
||||
}
|
||||
|
||||
public void setMtbAart(MtbAart mtbAart) {
|
||||
this.mtbAart = mtbAart;
|
||||
}
|
||||
|
||||
public BigDecimal getQtaCnf() {
|
||||
return qtaCnf;
|
||||
}
|
||||
|
||||
@@ -5,14 +5,17 @@ import it.integry.ems_model.annotation.PK;
|
||||
import it.integry.ems_model.annotation.SqlField;
|
||||
import it.integry.ems_model.annotation.Table;
|
||||
import it.integry.ems_model.base.EntityBase;
|
||||
import it.integry.ems_model.base.EquatableEntityInterface;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.kie.api.definition.type.PropertyReactive;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
@PropertyReactive
|
||||
@Table(MtbAartDesc.ENTITY)
|
||||
@JsonTypeName(MtbAartDesc.ENTITY)
|
||||
public class MtbAartDesc extends EntityBase {
|
||||
public class MtbAartDesc extends EntityBase implements EquatableEntityInterface<MtbAartDesc> {
|
||||
|
||||
private final static Logger logger = LogManager.getLogger();
|
||||
|
||||
@@ -34,6 +37,9 @@ public class MtbAartDesc extends EntityBase {
|
||||
@SqlField(value = "descrizione", maxLength = 40, nullable = false)
|
||||
private String descrizione;
|
||||
|
||||
@SqlField(value = "descrizione_html")
|
||||
private String descrizioneHtml;
|
||||
|
||||
public MtbAartDesc() {
|
||||
super(logger);
|
||||
}
|
||||
@@ -69,4 +75,40 @@ public class MtbAartDesc extends EntityBase {
|
||||
public void setDescrizione(String descrizione) {
|
||||
this.descrizione = descrizione;
|
||||
}
|
||||
|
||||
public String getDescrizioneHtml() {
|
||||
return descrizioneHtml;
|
||||
}
|
||||
|
||||
public MtbAartDesc setDescrizioneHtml(String descrizioneHtml) {
|
||||
this.descrizioneHtml = descrizioneHtml;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (!(o instanceof MtbAartDesc)) return false;
|
||||
MtbAartDesc that = (MtbAartDesc) o;
|
||||
return Objects.equals(getCodMart(), that.getCodMart()) && Objects.equals(getCodLingua(), that.getCodLingua()) && Objects.equals(getDescrizioneEstesa(), that.getDescrizioneEstesa()) && Objects.equals(getDescrizione(), that.getDescrizione()) && Objects.equals(getDescrizioneHtml(), that.getDescrizioneHtml());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(getCodMart(), getCodLingua(), getDescrizioneEstesa(), getDescrizione(), getDescrizioneHtml());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCodeKey() {
|
||||
return Objects.hash(getCodMart(), getCodLingua());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equalsKey(MtbAartDesc other) {
|
||||
if (this == other) return true;
|
||||
if (!(other instanceof MtbAartDesc)) return false;
|
||||
MtbAartDesc mtbAartDesc = other;
|
||||
return Objects.equals(getCodLingua(), mtbAartDesc.getCodLingua()) &&
|
||||
Objects.equals(getCodMart(), mtbAartDesc.getCodMart());
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,6 +41,9 @@ public class MtbAartEqui extends EntityBase implements EquatableEntityInterface<
|
||||
@SqlField(value = "descrizione_estera", maxLength = 255, nullable = false)
|
||||
private String descrizioneEstera;
|
||||
|
||||
@SqlField(value = "flag_equi_anag", maxLength = 1, nullable = false, defaultObjectValue = "0")
|
||||
private Boolean flagEquiAnag;
|
||||
|
||||
public MtbAartEqui() {
|
||||
super(logger);
|
||||
}
|
||||
@@ -89,16 +92,26 @@ public class MtbAartEqui extends EntityBase implements EquatableEntityInterface<
|
||||
this.descrizioneEstera = descrizioneEstera;
|
||||
}
|
||||
|
||||
public Boolean getFlagEquiAnag() {
|
||||
return flagEquiAnag;
|
||||
}
|
||||
|
||||
public MtbAartEqui setFlagEquiAnag(Boolean flagEquiAnag) {
|
||||
this.flagEquiAnag = flagEquiAnag;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (!(o instanceof MtbAartEqui)) return false;
|
||||
MtbAartEqui that = (MtbAartEqui) o;
|
||||
return Objects.equals(getIdArtEqui(), that.getIdArtEqui()) && Objects.equals(getDescrizione(), that.getDescrizione()) && Objects.equals(getFlagEquiPrezzo(), that.getFlagEquiPrezzo()) && Objects.equals(getFlagEquiCosto(), that.getFlagEquiCosto()) && Objects.equals(getDescrizioneEstera(), that.getDescrizioneEstera());
|
||||
return Objects.equals(getIdArtEqui(), that.getIdArtEqui()) && Objects.equals(getDescrizione(), that.getDescrizione()) && Objects.equals(getFlagEquiPrezzo(), that.getFlagEquiPrezzo()) && Objects.equals(getFlagEquiCosto(), that.getFlagEquiCosto()) && Objects.equals(getDescrizioneEstera(), that.getDescrizioneEstera())
|
||||
&& Objects.equals(getFlagEquiAnag(), that.getFlagEquiAnag());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(getIdArtEqui(), getDescrizione(), getFlagEquiPrezzo(), getFlagEquiCosto(), getDescrizioneEstera());
|
||||
return Objects.hash(getIdArtEqui(), getDescrizione(), getFlagEquiPrezzo(), getFlagEquiCosto(), getDescrizioneEstera(),getFlagEquiAnag());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -9,12 +9,15 @@ import it.integry.ems_model.annotation.SqlField;
|
||||
import it.integry.ems_model.annotation.Table;
|
||||
import it.integry.ems_model.base.EntityBase;
|
||||
import it.integry.ems_model.entity._enum.IBaseEnum;
|
||||
import org.kie.api.definition.type.PropertyReactive;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.kie.api.definition.type.PropertyReactive;
|
||||
|
||||
import javax.persistence.Transient;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@javax.persistence.Entity
|
||||
@javax.persistence.Table(name = MtbUntMis.ENTITY)
|
||||
@Master
|
||||
@PropertyReactive
|
||||
@Table(MtbUntMis.ENTITY)
|
||||
@@ -27,29 +30,40 @@ public class MtbUntMis extends EntityBase {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@javax.persistence.Id
|
||||
@javax.persistence.Column(name = "unt_mis")
|
||||
@PK
|
||||
@SqlField(value = "unt_mis", maxLength = 3, nullable = false)
|
||||
private String untMis;
|
||||
|
||||
@javax.persistence.Column(name = "flag_dig")
|
||||
@SqlField(value = "flag_dig", maxLength = 1, nullable = false, defaultObjectValue = "N")
|
||||
private String flagDig;
|
||||
|
||||
@javax.persistence.Column(name = "cifre_dec")
|
||||
@SqlField(value = "cifre_dec", nullable = false, defaultObjectValue = "0")
|
||||
private BigDecimal cifreDec;
|
||||
|
||||
@javax.persistence.Column(name = "tipo_um")
|
||||
@javax.persistence.Enumerated(javax.persistence.EnumType.STRING)
|
||||
@SqlField(value = "tipo_um", maxLength = 2)
|
||||
private TipoUM tipoUm;
|
||||
|
||||
@javax.persistence.Column(name = "flag_unita_kg")
|
||||
@SqlField(value = "flag_unita_kg", maxLength = 1, nullable = false)
|
||||
private String flagUnitaKg;
|
||||
|
||||
@javax.persistence.Column(name = "flag_attivo")
|
||||
@SqlField(value = "flag_attivo", maxLength = 1, nullable = false)
|
||||
private String flagAttivo;
|
||||
|
||||
@javax.persistence.Column(name = "grandezza")
|
||||
@javax.persistence.Enumerated(javax.persistence.EnumType.STRING)
|
||||
@SqlField(value = "grandezza")
|
||||
private Grandezza grandezza;
|
||||
|
||||
@JsonProperty(value = "ordinamento")
|
||||
@Transient
|
||||
private Integer ordinamento;
|
||||
|
||||
public MtbUntMis() {
|
||||
|
||||
@@ -5,9 +5,11 @@ import java.util.Objects;
|
||||
|
||||
public class DtbOrdtKey {
|
||||
|
||||
private final String gestione;
|
||||
private final Date dataOrd;
|
||||
private final Integer numOrd;
|
||||
private String gestione;
|
||||
private Date dataOrd;
|
||||
private Integer numOrd;
|
||||
|
||||
public DtbOrdtKey() {}
|
||||
|
||||
public DtbOrdtKey(String gestione, Date dataOrd, Integer numOrd) {
|
||||
this.gestione = gestione;
|
||||
|
||||
@@ -155,7 +155,7 @@ when
|
||||
$entity : MtbAart((untMis != null || untMis2 != null || untMis3 != null ) && operation != OperationType.DELETE)
|
||||
then
|
||||
List<MtbUntMis> mtbUntMis = CommonRules.insUntMis(conn, $entity);
|
||||
modify($entity){setMtbUntMis(mtbUntMis)}
|
||||
modify($entity){setMtbUntMisList(mtbUntMis)}
|
||||
|
||||
end
|
||||
|
||||
|
||||
@@ -18,6 +18,8 @@ import java.time.LocalDate
|
||||
import it.integry.ems_model.utility.UtilityLocalDate;
|
||||
import it.integry.ems.migration._base.IntegryCustomerDB;
|
||||
import it.integry.ems.migration._base.IntegryCustomer
|
||||
import it.integry.ems.jpa.repository.MtbUntMisRepository
|
||||
import it.integry.ems._context.ApplicationContextProvider
|
||||
|
||||
global Connection conn
|
||||
global String username
|
||||
@@ -225,14 +227,16 @@ when
|
||||
eval(completeRulesEnabled)
|
||||
$entity : MtbColr(artAPeso == null && codMart != null )
|
||||
then
|
||||
String sql =
|
||||
"SELECT CASE WHEN dbo.f_getTipoUntMis(mtb_aart.unt_mis) = 'KG' THEN 'S' ELSE 'N' END " +
|
||||
" FROM mtb_aart WHERE cod_mart = " + UtilityDB.valueToString($entity.getCodMart());
|
||||
MtbUntMisRepository mtbUntMisRepository = ApplicationContextProvider.getApplicationContext().getBean(MtbUntMisRepository.class);
|
||||
|
||||
MtbUntMis mtbUntMis = mtbUntMisRepository.findByCodMart($entity.getCodMart())
|
||||
.orElse(null);
|
||||
|
||||
String artAPeso = "N";
|
||||
|
||||
if (mtbUntMis != null)
|
||||
artAPeso = "KG".equalsIgnoreCase(mtbUntMis.getUntMis()) ? "S" : "N";
|
||||
|
||||
String artAPeso = (String) QueryRules.getSingleValue(conn, sql);
|
||||
if (artAPeso == null ) {
|
||||
artAPeso = "N";
|
||||
}
|
||||
modify ( $entity ) { setArtAPeso(artAPeso) }
|
||||
end
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@ import it.integry.ems.response.ServiceRestResponse;
|
||||
import it.integry.ems.service.PrinterService;
|
||||
import it.integry.ems.service.ReportProcessor;
|
||||
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
|
||||
import it.integry.ems.utility.UtilityPdf;
|
||||
import it.integry.ems_model.config.EmsRestConstants;
|
||||
import it.integry.ems_model.entity.GrlAnagJrept;
|
||||
import it.integry.ems_model.entity.JtbDisegniFiles;
|
||||
@@ -88,6 +89,7 @@ public class EmsEngineController {
|
||||
return response;
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping(value = EmsRestConstants.PATH_DOWNLOAD_REPORT, method = RequestMethod.POST)
|
||||
public @ResponseBody
|
||||
ServiceRestResponse downloadReport(HttpServletRequest request,
|
||||
@@ -100,6 +102,27 @@ public class EmsEngineController {
|
||||
return ServiceRestResponse.createNegativeResponse("Nessun report generato!");
|
||||
}
|
||||
|
||||
@RequestMapping(value = EmsRestConstants.PATH_DOWNLOAD_REPORT_LIST, method = RequestMethod.POST)
|
||||
public @ResponseBody
|
||||
ServiceRestResponse downloadReportList(HttpServletRequest request,
|
||||
@RequestParam(CommonConstants.PROFILE_DB) String configuration,
|
||||
@RequestBody JasperDTO[] jasperDTOList)throws Exception {
|
||||
|
||||
FileItem fi = new FileItem();
|
||||
List<byte[]> pdfList = new ArrayList<>();
|
||||
for (JasperDTO jasperDTO : jasperDTOList) {
|
||||
pdfList.add(emsEngineService.processReport(jasperDTO));
|
||||
}
|
||||
byte[] bytes = UtilityPdf.merge(pdfList);
|
||||
|
||||
if (bytes != null && bytes.length > 0) {
|
||||
return ServiceRestResponse.createPositiveResponse(downloadFileHandlerService.generateDownloadItem(new Date().getTime() + ".pdf", bytes));
|
||||
} else {
|
||||
return ServiceRestResponse.createNegativeResponse("Nessun report generato!");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@RequestMapping(value = EmsRestConstants.PATH_PROCESS_REPORT_TYPE, method = RequestMethod.POST)
|
||||
public @ResponseBody
|
||||
ServiceRestResponse processReportTypeList(HttpServletRequest request,
|
||||
@@ -122,14 +145,9 @@ public class EmsEngineController {
|
||||
public @ResponseBody
|
||||
ServiceRestResponse printReportTypeList(HttpServletRequest request,
|
||||
@RequestParam(CommonConstants.PROFILE_DB) String configuration,
|
||||
@RequestBody ReportTypeDTO reportTypeDTO) {
|
||||
try {
|
||||
printerService.printReportType(reportTypeDTO);
|
||||
return ServiceRestResponse.createPositiveResponse();
|
||||
} catch (Exception e) {
|
||||
logger.error(request.getRequestURI(), e);
|
||||
return ServiceRestResponse.createNegativeResponse(configuration, e);
|
||||
}
|
||||
@RequestBody ReportTypeDTO reportTypeDTO) throws Exception {
|
||||
printerService.printReportType(reportTypeDTO);
|
||||
return ServiceRestResponse.createPositiveResponse();
|
||||
}
|
||||
|
||||
@RequestMapping(value = EmsRestConstants.PATH_GET_SETUP_REPORT_TYPE, method = RequestMethod.POST)
|
||||
|
||||
@@ -393,6 +393,17 @@ public class SteUPController {
|
||||
return ServiceRestResponse.createPositiveResponse();
|
||||
}
|
||||
|
||||
@PostMapping(value = "analisiRottureDiStock")
|
||||
public @ResponseBody
|
||||
ServiceRestResponse analisiRottureDiStock(HttpServletRequest request,
|
||||
@RequestParam(CommonConstants.PROFILE_DB) String profileDB,
|
||||
@RequestParam @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) LocalDate dataIspezione,
|
||||
@RequestParam (required = false) String codMdep) throws Exception {
|
||||
|
||||
steUPService.analisiRottureDiStock(dataIspezione, codMdep);
|
||||
return ServiceRestResponse.createPositiveResponse();
|
||||
}
|
||||
|
||||
@RequestMapping(value = "recuperoIspezioni", method = RequestMethod.POST)
|
||||
public @ResponseBody
|
||||
ServiceRestResponse recuperoIspezioni(HttpServletRequest request,
|
||||
|
||||
@@ -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.Stream;
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import it.integry.common.var.CommonConstants;
|
||||
import it.integry.ems.activity.dto.DescrizioneTipiAttivitaDTO;
|
||||
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.activity.dto.*;
|
||||
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.DatabaseTableColumn;
|
||||
import it.integry.ems.entity_logger.db_schema_manager.dto.DatabaseTableView;
|
||||
import it.integry.ems.javabeans.RequestDataDTO;
|
||||
import it.integry.ems.json.ResponseJSONObjectMapper;
|
||||
import it.integry.ems.order.dto.UserGroupENUM;
|
||||
import it.integry.ems.report.dto.JasperDTO;
|
||||
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.MailService;
|
||||
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.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.context.ContextLoader;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.File;
|
||||
@@ -60,6 +61,8 @@ import java.util.stream.Collectors;
|
||||
import static it.integry.ems.order.dto.UserGroupENUM.RILEVATORE;
|
||||
import static it.integry.ems.order.dto.UserGroupENUM.TECNICO;
|
||||
import static java.util.stream.Collectors.groupingBy;
|
||||
import static org.codehaus.groovy.runtime.DefaultGroovyMethods.collect;
|
||||
import static org.json.XMLTokener.entity;
|
||||
|
||||
@Service
|
||||
@Scope("request")
|
||||
@@ -514,7 +517,7 @@ public class SteUPService {
|
||||
String tipoAttivitaInevasi = setup.get("TIPO_ATTIVITA_VERIFICA_INEVASI");
|
||||
String reportInevasi = setup.get("REPORT_INEVASI");
|
||||
String activityId = null;
|
||||
if ( !isNewIsepzione ) {
|
||||
if (!isNewIsepzione) {
|
||||
String sql =
|
||||
Query.format(
|
||||
"SELECT activity_id\n" +
|
||||
@@ -534,7 +537,7 @@ public class SteUPService {
|
||||
|
||||
activityId = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(multiDBTransactionManager.getPrimaryConnection(), sql);
|
||||
}
|
||||
|
||||
|
||||
StbActivity activityItem =
|
||||
new StbActivity()
|
||||
.setActivityDescription(activityTypeId)
|
||||
@@ -665,9 +668,6 @@ public class SteUPService {
|
||||
String content = new String(contentB64);
|
||||
barcodes = UtilityString.splitStringToMultipleLine(content, CommonConstants.A_CAPO);
|
||||
saveFile = false;
|
||||
} else if (UtilityDebug.isDebugExecution()) {
|
||||
barcodes = UtilityDB.executeSimpleQueryOnlyFirstColumn(multiDBTransactionManager.getPrimaryConnection(),
|
||||
"select cod_mart from stb_activity where parent_activity_id = 'C0000843821'");
|
||||
} else {
|
||||
throw new Exception("File " + fileNameElencoArt + " non trovato.");
|
||||
}
|
||||
@@ -739,36 +739,9 @@ public class SteUPService {
|
||||
|
||||
if (barcodes != null && !barcodes.isEmpty()) {
|
||||
for (String barcode : barcodes) {
|
||||
sql =
|
||||
"SELECT activity_type_id_next " +
|
||||
" FROM srl_activity_type " +
|
||||
" WHERE activity_type_id = " + UtilityDB.valueToString(activityTypeId) + " AND " +
|
||||
"flag_tipologia = 'A' ";
|
||||
|
||||
String activityTypeArt = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(multiDBTransactionManager.getPrimaryConnection(), sql);
|
||||
|
||||
if (UtilityString.isNullOrEmpty(activityTypeArt)) {
|
||||
throw new Exception("Nessun tipo attività associato a " + activityTypeId + " per l'inserimento degli articoli.");
|
||||
}
|
||||
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
String codMart = this.getCodMartFromBarcode(barcode);
|
||||
StbActivity item = new StbActivity()
|
||||
.setActivityDescription(activityTypeArt)
|
||||
.setNote(parentActivity.getNote())
|
||||
.setCodJfas(codJfas)
|
||||
.setCodMart(codMart)
|
||||
.setFlagTipologia("A")
|
||||
.setUserName(userNamePv)
|
||||
.setUserCreator(parentActivity.getUserCreator())
|
||||
.setUserModifier(parentActivity.getUserCreator())
|
||||
.setActivityTypeId(activityTypeArt)
|
||||
.setOraInsAct(now)
|
||||
.setEffectiveTime(dataCreation)
|
||||
.setParentActivityId(activityId);
|
||||
|
||||
item.setOperation(OperationType.INSERT);
|
||||
stbActivityList.add(item);
|
||||
StbActivity art = getArticoli(barcode, null, activityTypeId, codJfas, userNamePv);
|
||||
if (art != null)
|
||||
stbActivityList.add(art);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -814,6 +787,36 @@ public class SteUPService {
|
||||
return stbActivityList;
|
||||
}
|
||||
|
||||
private StbActivity getArticoli(String barcode, String codMart, String activityTypeId, String codJfas, String userNamePv) throws Exception {
|
||||
String sql;
|
||||
sql =
|
||||
"SELECT activity_type_id_next " +
|
||||
" FROM srl_activity_type " +
|
||||
" WHERE activity_type_id = " + UtilityDB.valueToString(activityTypeId) + " AND " +
|
||||
"flag_tipologia = 'A' ";
|
||||
|
||||
String activityTypeArt = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(multiDBTransactionManager.getPrimaryConnection(), sql);
|
||||
|
||||
if (UtilityString.isNullOrEmpty(activityTypeArt)) {
|
||||
throw new Exception("Nessun tipo attività associato a " + activityTypeId + " per l'inserimento degli articoli.");
|
||||
}
|
||||
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
if (!UtilityString.isNullOrEmpty(barcode))
|
||||
codMart = this.getCodMartFromBarcode(barcode);
|
||||
StbActivity item = new StbActivity()
|
||||
.setActivityDescription(activityTypeArt)
|
||||
.setCodJfas(codJfas)
|
||||
.setCodMart(codMart)
|
||||
.setFlagTipologia("A")
|
||||
.setUserName(userNamePv)
|
||||
.setActivityTypeId(activityTypeArt)
|
||||
.setOraInsAct(now);
|
||||
|
||||
item.setOperation(OperationType.INSERT);
|
||||
return item;
|
||||
}
|
||||
|
||||
public HashMap<String, Object> getPrezzo(String codMdep, String barcode) throws Exception {
|
||||
String sql =
|
||||
"SELECT p.descrizione, p.prz_vend_iva " +
|
||||
@@ -865,80 +868,61 @@ public class SteUPService {
|
||||
"ORDER BY mtb_aart.descrizione";
|
||||
sql = UtilityDB.addwhereCond(sql, whereCond, false);
|
||||
} else if (activityTypeId.equalsIgnoreCase(tipoAttivitaRotturaStock)) {
|
||||
if (repartiFreschi.contains(codJfas)) {
|
||||
String tipoGriglia = setupGest.getSetupDet(multiDBTransactionManager.getPrimaryConnection(), "PVM", "RILEVAZIONI_STEUP", "TIPO_GRIGLIA", codJfas);
|
||||
|
||||
String queryAssortimento = "";
|
||||
switch (tipoGriglia) {
|
||||
case "A":
|
||||
queryAssortimento = Query.format("SELECT cod_mart,descrizione,bar_code as barcode,cod_msgr\n" +
|
||||
"FROM steup_getAssortimento(%s,%s,%s) art\n",
|
||||
codMdep, codJfas, dataCreation
|
||||
);
|
||||
break;
|
||||
case "V":
|
||||
queryAssortimento =
|
||||
Query.format("SELECT griglia.cod_mart, \n" +
|
||||
"descrizione, \n" +
|
||||
(chkRotturaStock ? "mvw_barcode.cod_barre" : "griglia.bar_code") + " as barcode, \n" +
|
||||
"cod_msgr\n " +
|
||||
" from steup_getGrigliaVendita(%s, %s, %s) griglia " +
|
||||
(chkRotturaStock ? " INNER JOIN mvw_barcode on griglia.cod_mart_kit = mvw_barcode.cod_mart " : ""),
|
||||
codMdep, codJfas, dataCreation);
|
||||
break;
|
||||
}
|
||||
|
||||
if (repartiFreschi.contains(codJfas) || (chkRotturaStock && barcode != null & !barcode.isEmpty())) {
|
||||
sql =
|
||||
"SELECT griglia.cod_mart, \n" +
|
||||
"WITH assortimento AS ( " +
|
||||
queryAssortimento +
|
||||
") " +
|
||||
"SELECT griglia.cod_mart, \n" +
|
||||
"descrizione, \n" +
|
||||
(chkRotturaStock ? "mvw_barcode.cod_barre" : "griglia.bar_code") + " as barcode, \n" +
|
||||
"barcode, \n" +
|
||||
"cod_msgr\n " +
|
||||
" from steup_getGrigliaVendita(" + UtilityDB.valueToString(codMdep) + "," + UtilityDB.valueToString(codJfas) + ", " + UtilityDB.valueToString(dataCreation) + ") griglia " +
|
||||
(chkRotturaStock ? " INNER JOIN mvw_barcode on griglia.cod_mart_kit = mvw_barcode.cod_mart " : "") +
|
||||
" WHERE griglia.cod_mart NOT IN (SELECT cod_mart\n" +
|
||||
" from assortimento " +
|
||||
" WHERE assortimento.cod_mart NOT IN (SELECT cod_mart\n" +
|
||||
" FROM (SELECT cod_mart,\n" +
|
||||
" cod_mdep,\n" +
|
||||
" data_validita,\n" +
|
||||
" CASE\n" +
|
||||
" WHEN tipo_variazione = 'I' AND\n" +
|
||||
" LEAD(tipo_variazione, 1, NULL)\n" +
|
||||
" OVER (PARTITION BY cod_mart, cod_mdep ORDER BY data_validita, tipo_variazione DESC ) =\n" +
|
||||
" 'D' AND\n" +
|
||||
" LEAD(data_validita, 1, NULL)\n" +
|
||||
" OVER (PARTITION BY cod_mart, cod_mdep ORDER BY data_validita, tipo_variazione DESC ) =\n" +
|
||||
" data_validita THEN 'U'\n" +
|
||||
" ELSE tipo_variazione END AS tipo_variazione,\n" +
|
||||
" LEAD(tipo_variazione, 1, NULL)\n" +
|
||||
" OVER (PARTITION BY cod_mart, cod_mdep ORDER BY data_validita, tipo_variazione ) AS tipo_variazione_succ\n" +
|
||||
" FROM carelli.dbo.atb_griglie_art\n" +
|
||||
" WHERE atb_griglie_art.data_validita <= " + UtilityDB.valueToString(dataCreation) + "\n" +
|
||||
" AND atb_griglie_art.cod_mdep = " + UtilityDB.valueToString(codMdep) + ") g\n" +
|
||||
" WHERE g.tipo_variazione_succ IS NULL\n" +
|
||||
" AND DATEDIFF(DAY, data_validita, " + UtilityDB.valueToString(dataCreation) + ") < 7\n" +
|
||||
" tipo_variazione \n" +
|
||||
" FROM carelli.dbo.getGrigliaAssortimento([DATA_CREAZIONE], null,[COD_MDEP], null, null) g\n" +
|
||||
" WHERE DATEDIFF(DAY, data_validita, [DATA_CREAZIONE]) < 7\n" +
|
||||
" AND g.tipo_variazione = 'I'\n" +
|
||||
" UNION \n" +
|
||||
" SELECT cod_mart \n" +
|
||||
" FROM dbo.steup_getInevasi(" + UtilityDB.valueToString(codMdep) + ", " + UtilityDB.valueToString(codJfas) + ", " + UtilityDB.valueToString(dataCreation) + "))\n " +
|
||||
" FROM dbo.steup_getInevasi([COD_MDEP], [COD_JFAS], [DATA_CREAZIONE]))\n " +
|
||||
(chkRotturaStock && barcode != null & !barcode.isEmpty() ?
|
||||
"AND EXISTS(SELECT cod_mart from carelli.dbo.mvw_barcode WHERE cod_barre in (" + UtilityDB.listValueToString(barcode) + ") and art.cod_mart = mvw_barcode.cod_mart)\n" : "") +
|
||||
"order by descrizione";
|
||||
} else if (chkRotturaStock && barcode != null & !barcode.isEmpty()) {
|
||||
sql = "SELECT cod_mart,descrizione,bar_code as barcode,cod_msgr\n" +
|
||||
"FROM steup_getAssortimento(" + UtilityDB.valueToString(codMdep) + "," + UtilityDB.valueToString(codJfas) + ", " + UtilityDB.valueToString(dataCreation) + ") art\n" +
|
||||
"WHERE EXISTS(SELECT cod_mart from carelli.dbo.mvw_barcode WHERE cod_barre in (" + UtilityDB.listValueToString(barcode) + ") and art.cod_mart = mvw_barcode.cod_mart)\n" +
|
||||
" AND cod_mart NOT IN (SELECT cod_mart\n" +
|
||||
" FROM (SELECT cod_mart,\n" +
|
||||
" cod_mdep,\n" +
|
||||
" data_validita,\n" +
|
||||
" CASE\n" +
|
||||
" WHEN tipo_variazione = 'I' AND\n" +
|
||||
" LEAD(tipo_variazione, 1, NULL)\n" +
|
||||
" OVER (PARTITION BY cod_mart, cod_mdep ORDER BY data_validita, tipo_variazione DESC ) =\n" +
|
||||
" 'D' AND\n" +
|
||||
" LEAD(data_validita, 1, NULL)\n" +
|
||||
" OVER (PARTITION BY cod_mart, cod_mdep ORDER BY data_validita, tipo_variazione DESC ) =\n" +
|
||||
" data_validita THEN 'U'\n" +
|
||||
" ELSE tipo_variazione END AS tipo_variazione,\n" +
|
||||
" LEAD(tipo_variazione, 1, NULL)\n" +
|
||||
" OVER (PARTITION BY cod_mart, cod_mdep ORDER BY data_validita, tipo_variazione ) AS tipo_variazione_succ\n" +
|
||||
" FROM carelli.dbo.atb_griglie_art\n" +
|
||||
" WHERE atb_griglie_art.data_validita <= " + UtilityDB.valueToString(dataCreation) + "\n" +
|
||||
" AND atb_griglie_art.cod_mdep = " + UtilityDB.valueToString(codMdep) + ") g\n" +
|
||||
" WHERE g.tipo_variazione_succ IS NULL\n" +
|
||||
" AND DATEDIFF(DAY, data_validita, " + UtilityDB.valueToString(dataCreation) + ") < 7\n" +
|
||||
" AND g.tipo_variazione = 'I'\n" +
|
||||
" UNION \n" +
|
||||
" SELECT cod_mart \n" +
|
||||
" FROM dbo.steup_getInevasi(" + UtilityDB.valueToString(codMdep) + ", " + UtilityDB.valueToString(codJfas) + ", " + UtilityDB.valueToString(dataCreation) + "))";
|
||||
|
||||
sql = sql
|
||||
.replace("[DATA_CREAZIONE]", UtilityDB.valueToString(dataCreation))
|
||||
.replace("[COD_MDEP]", UtilityDB.valueToString(codMdep))
|
||||
.replace("[COD_JFAS]", UtilityDB.valueToString(codJfas));
|
||||
} else {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
} else {
|
||||
/*
|
||||
sql = "SELECT DISTINCT mtb_aart.cod_mart, " +
|
||||
" mtb_aart.descrizione, " +
|
||||
" mtb_aart.bar_code AS barcode," +
|
||||
" mtb_aart.cod_msgr " +
|
||||
"FROM dbo.steup_getAssortimento(" + UtilityDB.valueToString(codMdep) + ", " + UtilityDB.valueToString(codJfas) + " ) mtb_aart" +
|
||||
" WHERE mtb_aart.plu IS NOT NULL " +
|
||||
"ORDER BY mtb_aart.descrizione";
|
||||
*/
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
@@ -950,7 +934,6 @@ public class SteUPService {
|
||||
logger.info("Uploading attachment activity ID: " + activityId);
|
||||
String fileName = new SimpleDateFormat("yyyyMMddHHmmss").format(new Date()) + ".zip";
|
||||
String pathFile = UtilityDirs.getEmsApiTempDirectoryPath() + File.separator + activityId + File.separator;
|
||||
//UtilityFile.createZipFromMultipartFile(pathFile, fileName, f);
|
||||
|
||||
UtilityFile.saveFile(pathFile, f.getOriginalFilename(), f.getBytes());
|
||||
|
||||
@@ -1425,7 +1408,7 @@ public class SteUPService {
|
||||
" activity_result_id,\n" +
|
||||
" cod_mdep,\n" +
|
||||
" descr_deposito\n" +
|
||||
"FROM dbo.steup_getRilevazioni()\n" +
|
||||
"FROM dbo.steup_getRilevazioni(null, null, null)\n" +
|
||||
"WHERE CAST(effective_time AS DATE) BETWEEN %s AND %s",
|
||||
dataInizio,
|
||||
dataFine
|
||||
@@ -1493,4 +1476,310 @@ public class SteUPService {
|
||||
entityProcessor.processEntityList(entityList, true);
|
||||
}
|
||||
}
|
||||
|
||||
public void analisiRottureDiStock(LocalDate dataIspezione, String codMdep) throws Exception {
|
||||
Map<String, String> setup = setupGest.getSetupSection(multiDBTransactionManager.getPrimaryConnection(), "PVM", "RILEVAZIONI_STEUP");
|
||||
|
||||
String tipoAttivitaRotturaStock = setup.get("TIPO_ATTIVITA_ROTTURA_STOCK");
|
||||
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"), ""), "|"));
|
||||
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 =
|
||||
Query.format(
|
||||
"select i.cod_mdep, stb_activity.cod_jfas, stb_activity.activity_id, stb_activity.user_name\n" +
|
||||
"from dbo.steup_getRilevazioni(%s, %s, null) i\n" +
|
||||
"inner join stb_activity on i.activity_id = stb_activity.parent_activity_id\n" +
|
||||
"where stb_activity.activity_type_id = %s",
|
||||
dataIspezione, codMdep, tipoAttivitaRotturaStock);
|
||||
|
||||
List<HashMap<String, Object>> ispezioni = UtilityDB.executeSimpleQuery(multiDBTransactionManager.getPrimaryConnection(), sql);
|
||||
if (ispezioni == null || ispezioni.isEmpty()) {
|
||||
throw new Exception("Nessuna ispezione trovata per la data e il punto vendita indicati.");
|
||||
}
|
||||
|
||||
Map<String, List<HashMap<String, Object>>> ispezioniDepo = ispezioni.stream().collect(groupingBy(x -> (String) x.get("cod_mdep")));
|
||||
|
||||
for (Map.Entry<String, List<HashMap<String, Object>>> entry : ispezioniDepo.entrySet()) {
|
||||
String userNamePv = entry.getValue().get(0).get("user_name").toString();
|
||||
Map<String, List<HashMap<String, Object>>> reparti = entry.getValue().stream().collect(groupingBy(x -> (String) x.get("cod_jfas")));
|
||||
for (Map.Entry<String, List<HashMap<String, Object>>> reparto : reparti.entrySet()) {
|
||||
String codJfas = reparto.getKey();
|
||||
List<String> barcodes = new ArrayList<>();
|
||||
|
||||
List<String> idAttivita = new ArrayList<>();
|
||||
for (HashMap<String, Object> r : reparto.getValue()) {
|
||||
String activityId = (String) r.get("activity_id");
|
||||
idAttivita.add(activityId);
|
||||
StbActivityFile stbActivityFile = new StbActivityFile()
|
||||
.setId(activityId)
|
||||
.setFileName("elenco_articoli.txt");
|
||||
stbActivityFile.setOperation(OperationType.SELECT_OBJECT);
|
||||
|
||||
entityProcessor.processEntity(stbActivityFile, multiDBTransactionManager);
|
||||
|
||||
byte[] contentB64 = stbActivityFile.getContent();
|
||||
if (contentB64 != null && contentB64.length > 0) {
|
||||
String content = new String(contentB64);
|
||||
barcodes.addAll(UtilityString.splitStringToMultipleLine(content, CommonConstants.A_CAPO));
|
||||
if (UtilityDebug.isDebugExecution()) {
|
||||
barcodes=Arrays.asList(
|
||||
("8001990030611\n" +
|
||||
"8003650000798\n" +
|
||||
"8054633830833\n" +
|
||||
"8410436393942\n" +
|
||||
"8002340012103\n" +
|
||||
"8007300004297\n" +
|
||||
"8002340012660\n" +
|
||||
"8033532102838\n" +
|
||||
"8052675290028\n" +
|
||||
"8000697001917\n" +
|
||||
"8055719541384\n" +
|
||||
"8055719541377\n" +
|
||||
"8018700037204\n" +
|
||||
"8001480720800\n" +
|
||||
"8001280070648\n" +
|
||||
"8054633831656\n" +
|
||||
"8720182641618\n" +
|
||||
"8011380002074\n" +
|
||||
"8230485606837\n" +
|
||||
"8033532107987\n" +
|
||||
"8033908800726\n" +
|
||||
"8021719130026\n" +
|
||||
"8051886470717\n" +
|
||||
"8700216772082\n" +
|
||||
"8033447586204\n" +
|
||||
"8006540891469\n" +
|
||||
"4012400502363\n" +
|
||||
"8051499395889\n" +
|
||||
"8051499393571\n" +
|
||||
"8051499395872\n" +
|
||||
"8034055535387\n" +
|
||||
"8056364996130\n" +
|
||||
"8056364993467\n" +
|
||||
"8007675733877").split("\n")
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (barcodes.isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
List<String> articoli = verificaRottura(entry.getKey(), codJfas, dataIspezione, repartiFreschi, tipiEsclusi, fornitori, barcodes);
|
||||
|
||||
/*List<StbActivity> attivitaArticoli = new ArrayList<>();
|
||||
for (String articolo : articoli) {
|
||||
attivitaArticoli.add(getArticoli(null, articolo, tipoAttivitaRotturaStock, codJfas, userNamePv));
|
||||
} */
|
||||
|
||||
List<StbActivity> stbActivityList = new ArrayList<>();
|
||||
for (String activityId : idAttivita) {
|
||||
sql = "select *\n" +
|
||||
"from srl_activity_art\n" +
|
||||
"where activity_id = " + UtilityDB.valueToString(activityId) + "\n";
|
||||
|
||||
List<SrlActivityArt> articoliPresenti = UtilityDB.executeSimpleQueryDTO(multiDBTransactionManager.getPrimaryConnection(), sql, SrlActivityArt.class);
|
||||
List<String> artP;
|
||||
if (articoliPresenti != null) {
|
||||
articoliPresenti
|
||||
.stream()
|
||||
.forEach(x -> {
|
||||
if (articoli.contains(x.getCodMart()))
|
||||
x.setOperation(OperationType.UPDATE);
|
||||
else
|
||||
x.setOperation(OperationType.DELETE);
|
||||
});
|
||||
artP = articoliPresenti.stream().map(x -> x.getCodMart()).distinct().collect(Collectors.toList());
|
||||
} else {
|
||||
artP = new ArrayList<>();
|
||||
}
|
||||
|
||||
List<SrlActivityArt> artNew = articoli
|
||||
.stream()
|
||||
.filter(x -> !artP.contains(x))
|
||||
.map(x -> {
|
||||
SrlActivityArt s = new SrlActivityArt().setCodMart(x);
|
||||
s.setOperation(OperationType.INSERT);
|
||||
return s;
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
|
||||
StbActivity activityToUpdate = new StbActivity();
|
||||
activityToUpdate.setActivityId(activityId);
|
||||
activityToUpdate.setSrlActivityArt(articoliPresenti);
|
||||
activityToUpdate.getSrlActivityArt().addAll(artNew);
|
||||
activityToUpdate.setOperation(OperationType.UPDATE);
|
||||
stbActivityList.add(activityToUpdate);
|
||||
|
||||
}
|
||||
|
||||
UtilityEntity.throwEntitiesException(entityProcessor.processEntityList(stbActivityList, true));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public List<String> verificaRottura(String codMdep, String codJfas,
|
||||
LocalDate dataCreation,
|
||||
List<String> repartiFreschi,
|
||||
List<String> tipiEsclusi,
|
||||
List<SteUpFornitoriDTO> fornitori,
|
||||
List<String> barcode) throws Exception {
|
||||
|
||||
String tipoGriglia = setupGest.getSetupDet(multiDBTransactionManager.getPrimaryConnection(), "PVM", "RILEVAZIONI_STEUP", "TIPO_GRIGLIA", codJfas);
|
||||
|
||||
String profileDb = setupGest.getSetupDepo(multiDBTransactionManager.getPrimaryConnection(), "DATI_AZIENDA", "DATI_DEPOSITO", "PROFILE_DB", codMdep);
|
||||
|
||||
String sql = Query.format("SELECT cod_mgrp FROM jrl_fasi_mtb_grup WHERE cod_jfas = %s", codJfas);
|
||||
|
||||
List<String> gruppiMerc = UtilityDB.executeSimpleQueryOnlyFirstColumn(multiDBTransactionManager.getPrimaryConnection(), sql);
|
||||
|
||||
String queryAssortimento = "";
|
||||
switch (tipoGriglia) {
|
||||
case "A":
|
||||
queryAssortimento =
|
||||
"SELECT DISTINCT mtb_aart.cod_mart\n" +
|
||||
" FROM mvw_barcode INNER JOIN mtb_aart ON mtb_aart.cod_mart = mvw_barcode.cod_mart \n";
|
||||
break;
|
||||
case "V":
|
||||
queryAssortimento =
|
||||
"SELECT DISTINCT vtb_griglia_art.cod_mart\n" +
|
||||
"FROM vtb_griglia_art\n" +
|
||||
" INNER JOIN mvw_barcode ON vtb_griglia_art.cod_mart = mvw_barcode.cod_mart\n" +
|
||||
" INNER JOIN mtb_aart ON vtb_griglia_art.cod_mart = mtb_aart.cod_mart\n" +
|
||||
"WHERE cod_griglia = [COD_MDEP]\n" +
|
||||
" AND data_validita = [DATA_ISPEZIONE]\n" +
|
||||
" AND (SELECT MAX(data_validita)\n" +
|
||||
" FROM vtb_griglia_art\n" +
|
||||
" WHERE cod_griglia = [COD_MDEP]\n" +
|
||||
" AND data_validita <= [DATA_ISPEZIONE])";
|
||||
|
||||
queryAssortimento = queryAssortimento.replace("[COD_MDEP]", UtilityDB.valueToString(codMdep))
|
||||
.replace("[DATA_ISPEZIONE]", UtilityDB.valueToString(dataCreation));
|
||||
break;
|
||||
}
|
||||
|
||||
queryAssortimento = UtilityDB.addwhereCond(queryAssortimento, "mtb_aart.cod_mgrp IN (" + UtilityDB.listValueToString(gruppiMerc) + ")", false);
|
||||
String whereCondBarcode = "";
|
||||
if (repartiFreschi.contains(codJfas)) {
|
||||
whereCondBarcode = "mvw_barcode.cod_barre not in (" + UtilityDB.listValueToString(barcode) + ")";
|
||||
} else {
|
||||
whereCondBarcode = "mvw_barcode.cod_barre in (" + UtilityDB.listValueToString(barcode) + ")";
|
||||
}
|
||||
queryAssortimento = UtilityDB.addwhereCond(queryAssortimento, whereCondBarcode, false);
|
||||
|
||||
/*Nella query dei kit prendiamo componenti, composti, articoli sostitutivi ( cod_mart_stat) E componeni della distinta*/
|
||||
String queryKit =
|
||||
"SELECT mtb_aart.cod_mart, mtb_aart.cod_mart AS cod_mart_griglia\n" +
|
||||
"FROM mtb_aart\n" +
|
||||
"WHERE mtb_aart.articolo_composto = 'N'\n" +
|
||||
"UNION\n" +
|
||||
"SELECT mtb_aart.cod_mart, mtb_comp.cod_comp AS cod_mart_griglia\n" +
|
||||
"FROM mtb_aart\n" +
|
||||
" INNER JOIN mtb_comp ON mtb_aart.cod_mart = mtb_comp.cod_mart\n" +
|
||||
"WHERE mtb_aart.articolo_composto = 'S'\n" +
|
||||
"UNION\n" +
|
||||
"SELECT mtb_comp.cod_comp, mtb_comp.cod_mart\n" +
|
||||
"FROM mtb_aart\n" +
|
||||
" INNER JOIN mtb_comp ON mtb_aart.cod_mart = mtb_comp.cod_mart\n" +
|
||||
"WHERE mtb_aart.articolo_composto = 'S'\n" +
|
||||
"UNION\n" +
|
||||
"SELECT mtb_aart.cod_mart, mtb_aart.cod_mart_stat\n" +
|
||||
"FROM mtb_aart\n" +
|
||||
"WHERE mtb_aart.cod_mart_stat IS NOT NULL\n" +
|
||||
"UNION\n" +
|
||||
"SELECT cod_prod, cod_mart\n" +
|
||||
"FROM jtb_dist_mate\n" +
|
||||
"WHERE cod_mart IS NOT NULL";
|
||||
|
||||
List<String> articoli = new ArrayList<>();
|
||||
try (MultiDBTransactionManager mdb = new MultiDBTransactionManager(profileDb)) {
|
||||
articoli = UtilityDB.executeSimpleQueryOnlyFirstColumn(mdb.getPrimaryConnection(), queryAssortimento);
|
||||
|
||||
//Eliminazione nuovi inserimenti in griglia
|
||||
String sqlGriglia =
|
||||
"WITH articoli AS ( \n" + queryKit + " ) \n" +
|
||||
"SELECT g.cod_mart\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 articoli ON g.cod_mart = articoli.cod_mart_griglia\n" +
|
||||
"WHERE g.tipo_variazione = 'I'\n" +
|
||||
" AND g.data_validita >= DATEADD(DAY, -7, [DATA_CREAZIONE]) ";
|
||||
|
||||
sqlGriglia = sqlGriglia
|
||||
.replace("[DATA_CREAZIONE]", UtilityDB.valueToString(dataCreation))
|
||||
.replace("[COD_MDEP]", UtilityDB.valueToString(codMdep))
|
||||
.replace("[COD_JFAS]", UtilityDB.valueToString(codJfas))
|
||||
.replace("[GRUPPI_MERC]", UtilityDB.listValueToString(gruppiMerc));
|
||||
|
||||
if (!tipiEsclusi.isEmpty()) {
|
||||
sqlGriglia = UtilityDB.addwhereCond(sqlGriglia, "(mtb_aart.cod_mtip IS NULL OR mtb_aart.cod_mtip not in (" + UtilityDB.listValueToString(tipiEsclusi) + "))", true);
|
||||
}
|
||||
|
||||
List<String> nuoviInserimenti = UtilityDB.executeSimpleQueryOnlyFirstColumn(mdb.getPrimaryConnection(), sqlGriglia);
|
||||
|
||||
articoli = articoli.stream()
|
||||
.filter(x -> !nuoviInserimenti.contains(x))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
if (fornitori.size() > 0) {
|
||||
String whereCondFornitori = fornitori.stream().map(
|
||||
x -> {
|
||||
return "(gtb_anag.part_iva = " + UtilityDB.valueToString(x.getPartitaIva()) + " AND \n" +
|
||||
" dtb_ordr.data_cons BETWEEN DATEADD(DAY, - (" + x.getGgCons() + "-1), " + UtilityDB.valueToString(dataCreation) + ") AND " + UtilityDB.valueToString(dataCreation) + ")\n";
|
||||
}
|
||||
).collect(Collectors.joining(" OR \n", " AND ( \n", " ) \n"));
|
||||
|
||||
//Verifica Inevasi
|
||||
String sqlInevasi =
|
||||
"WITH articoli AS (" + queryKit + "), \n" +
|
||||
" ordini AS (SELECT articoli.cod_mart,\n" +
|
||||
" dtb_ordt.data_ord,\n" +
|
||||
" 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 ";
|
||||
;
|
||||
|
||||
sqlInevasi =
|
||||
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());
|
||||
}
|
||||
}
|
||||
|
||||
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,9 +5,9 @@ import com.annimon.stream.function.Predicate;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import it.integry.common.var.CommonConstants;
|
||||
import it.integry.ems._context.ApplicationContextProvider;
|
||||
import it.integry.ems.jpa.repository.MtbAartRepository;
|
||||
import it.integry.ems.logistic.dto.sm2.FiltroDistribuzioneColloDTO;
|
||||
import it.integry.ems.product.importaz.service.ProductServices;
|
||||
import it.integry.ems.retail.wms.Utility.WMSUtility;
|
||||
import it.integry.ems.service.EntityProcessor;
|
||||
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
|
||||
import it.integry.ems_model.base.EntityBase;
|
||||
@@ -31,12 +31,13 @@ import static java.util.stream.Collectors.groupingBy;
|
||||
@Component
|
||||
public class DistribuzioneColliService {
|
||||
|
||||
|
||||
private final List<MtbColt> mCurrentlyDistributingMtbColt = new ArrayList<>();
|
||||
|
||||
|
||||
public List<MtbColt> distribuzioneRigheColloNew(final FiltroDistribuzioneColloDTO filtroDistribuzioneColloDTO, boolean skipCommit) throws Exception {
|
||||
|
||||
MtbAartRepository mtbAartRepository = ContextLoader.getCurrentWebApplicationContext().getBean(MtbAartRepository.class);
|
||||
|
||||
MultiDBTransactionManager multiDBTransactionManager = ContextLoader.getCurrentWebApplicationContext().getBean(MultiDBTransactionManager.class);
|
||||
EntityProcessor entityProcessor = ApplicationContextProvider.getApplicationContext().getBean(EntityProcessor.class);
|
||||
ProductServices productServices = ContextLoader.getCurrentWebApplicationContext().getBean(ProductServices.class);
|
||||
@@ -116,8 +117,7 @@ public class DistribuzioneColliService {
|
||||
.map(MtbColr::getCodMart)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
List<MtbAart> mtbAarts = WMSUtility.getArticoliByCodMarts(codMarts, multiDBTransactionManager.getPrimaryConnection());
|
||||
|
||||
List<MtbAart> mtbAarts = mtbAartRepository.findByCodMartIn(codMarts);
|
||||
|
||||
//Lettura del filtro ordini
|
||||
String filtroOrdini = sourceMtbColt.getFiltroOrdini();
|
||||
|
||||
@@ -3,7 +3,7 @@ package it.integry.ems.order.Import.service;
|
||||
import it.integry.common.var.CommonConstants;
|
||||
import it.integry.ems._context.ApplicationContextProvider;
|
||||
import it.integry.ems.exception.PrimaryDatabaseNotPresentException;
|
||||
import it.integry.ems.retail.wms.Utility.WMSUtility;
|
||||
import it.integry.ems.jpa.repository.MtbAartRepository;
|
||||
import it.integry.ems.service.EntityProcessor;
|
||||
import it.integry.ems.sync.MultiDBTransaction.Connection;
|
||||
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
|
||||
@@ -44,6 +44,8 @@ public class OrdiniMaxiDataImportService {
|
||||
private EntityProcessor entityProcessor;
|
||||
|
||||
private MaxiDataApiService maxiDataApiService;
|
||||
@Autowired
|
||||
private MtbAartRepository mtbAartRepository;
|
||||
|
||||
@PostConstruct
|
||||
private void init() throws PrimaryDatabaseNotPresentException {
|
||||
@@ -132,12 +134,11 @@ public class OrdiniMaxiDataImportService {
|
||||
if (schedeProduzione == null || schedeProduzione.isEmpty())
|
||||
return new ArrayList<>();
|
||||
|
||||
List<MtbAart> anafraficheArticoli = WMSUtility.getArticoliByCodMarts(
|
||||
List<MtbAart> anafraficheArticoli = mtbAartRepository.findByCodMartIn(
|
||||
schedeProduzione.stream()
|
||||
.map(MaxidataUveBII40V2BLLUVE2kSchedeProd::getIdProdotto)
|
||||
.distinct()
|
||||
.collect(Collectors.toList()),
|
||||
conn);
|
||||
.collect(Collectors.toList()));
|
||||
|
||||
List<DtbOrdt> generatedOrders = new ArrayList<>();
|
||||
|
||||
|
||||
@@ -10,11 +10,13 @@ import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
|
||||
import it.integry.ems_model.base.EntityBase;
|
||||
import it.integry.ems_model.entity.DtbOrdr;
|
||||
import it.integry.ems_model.entity.DtbOrdt;
|
||||
import it.integry.ems_model.service.SetupGest;
|
||||
import it.integry.ems_model.types.OperationType;
|
||||
import it.integry.ems_model.utility.Query;
|
||||
import it.integry.ems_model.utility.UtilityBigDecimal;
|
||||
import it.integry.ems_model.utility.UtilityDB;
|
||||
import it.integry.ems_model.utility.UtilityHashMap;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
@@ -26,6 +28,9 @@ public class OrdiniVSlim2kService {
|
||||
private final EntityProcessor entityProcessor;
|
||||
private final EmsServices emsServices;
|
||||
|
||||
@Autowired
|
||||
private SetupGest setupGest;
|
||||
|
||||
public OrdiniVSlim2kService(EntityProcessor entityProcessor, EmsServices emsServices) {
|
||||
this.entityProcessor = entityProcessor;
|
||||
this.emsServices = emsServices;
|
||||
@@ -43,11 +48,11 @@ public class OrdiniVSlim2kService {
|
||||
List<HashMap<String, Object>> articoli = new ArrayList<>();
|
||||
List<HashMap<String, Object>> export = new ArrayList<>();
|
||||
|
||||
for(DtbOrdt ord : groupOrdini.keySet()) {
|
||||
for (DtbOrdt ord : groupOrdini.keySet()) {
|
||||
for (DtbOrdr dtbOrdr : groupOrdini.get(ord)) {
|
||||
String sql =
|
||||
Query.format("SELECT * FROM dtb_ordt WHERE gestione = %s AND data_ord = %s AND num_ord = %s",
|
||||
ord.getGestione(), ord.getDataOrd(), ord.getNumOrd());
|
||||
ord.getGestione(), ord.getDataOrd(), ord.getNumOrd());
|
||||
|
||||
ord = UtilityDB.executeSimpleQueryOnlyFirstRowDTO(multiDBTransactionManager.getPrimaryConnection(), sql, DtbOrdt.class);
|
||||
BigDecimal qtaCnf;
|
||||
@@ -73,48 +78,51 @@ public class OrdiniVSlim2kService {
|
||||
}
|
||||
|
||||
entityProcessor.processEntity(ord, multiDBTransactionManager, false);
|
||||
boolean exportOrdini = setupGest.getSetupBoolean(multiDBTransactionManager.getPrimaryConnection(), "PVM", "ORDINI_V_SLIM2K", "EXPORT_ORDINI");
|
||||
|
||||
DtbOrdt finalOrd = ord;
|
||||
Optional<HashMap<String, Object>> exportOpt = export.stream()
|
||||
.filter(x -> ((String) x.get("cod_anag")).equalsIgnoreCase(finalOrd.getCodAnag())).findFirst();
|
||||
HashMap<String, Object> datiExport;
|
||||
if ( exportOpt.isPresent() ) {
|
||||
datiExport = exportOpt.get();
|
||||
} else {
|
||||
String query =
|
||||
Query.format(
|
||||
"SELECT wtb_clie.cod_anag, " +
|
||||
"wtb_users.user_name, wtb_users.password, wtb_users_info.format_file, COUNT(wtb_users_info.format_file) over (partition by wtb_users_info.user_name) as count_export" +
|
||||
" FROM wtb_users " +
|
||||
"INNER JOIN wtb_users_info ON wtb_users.User_name = wtb_users_info.user_name " +
|
||||
"INNER JOIN wtb_clie ON wtb_users.User_name = wtb_clie.user_name " +
|
||||
" WHERE wtb_users_info.flag_state = 'S' and " +
|
||||
" wtb_clie.cod_anag = %s AND \n" +
|
||||
" wtb_users_info.export_type = %s",
|
||||
ord.getCodAnag(), EntityExportType.ORDINI_VENDITA.getText());
|
||||
|
||||
datiExport = UtilityDB.executeSimpleQueryOnlyFirstRow(multiDBTransactionManager.getPrimaryConnection(), query);
|
||||
export.add(datiExport);
|
||||
}
|
||||
|
||||
if (UtilityHashMap.isPresent(datiExport)) {
|
||||
String userNameExport = UtilityHashMap.getValueIfExists(datiExport, "user_name");
|
||||
String passwordExport = UtilityHashMap.getValueIfExists(datiExport, "password");
|
||||
String formatExport = UtilityHashMap.getValueIfExists(datiExport, "format_file");
|
||||
Integer countExport = UtilityHashMap.getValueIfExists(datiExport, "count_export");
|
||||
|
||||
if (countExport == 1) {
|
||||
RequestDataDTO requestDataDTO = new RequestDataDTO();
|
||||
requestDataDTO.setUsername(userNameExport);
|
||||
requestDataDTO.setPassword(passwordExport);
|
||||
String whereCond =
|
||||
if (ord.getDataEsportazione() != null && exportOrdini) {
|
||||
DtbOrdt finalOrd = ord;
|
||||
Optional<HashMap<String, Object>> exportOpt = export.stream()
|
||||
.filter(x -> ((String) x.get("cod_anag")).equalsIgnoreCase(finalOrd.getCodAnag())).findFirst();
|
||||
HashMap<String, Object> datiExport;
|
||||
if (exportOpt.isPresent()) {
|
||||
datiExport = exportOpt.get();
|
||||
} else {
|
||||
String query =
|
||||
Query.format(
|
||||
"dtb_ordt.gestione = %s AND dtb_ordt.data_ord = %s AND dtb_ordt.num_ord = %s",
|
||||
ord.getGestione(), ord.getDataOrd(), ord.getNumOrd());
|
||||
"SELECT wtb_clie.cod_anag, " +
|
||||
"wtb_users.user_name, wtb_users.password, wtb_users_info.format_file, COUNT(wtb_users_info.format_file) over (partition by wtb_users_info.user_name) as count_export" +
|
||||
" FROM wtb_users " +
|
||||
"INNER JOIN wtb_users_info ON wtb_users.User_name = wtb_users_info.user_name " +
|
||||
"INNER JOIN wtb_clie ON wtb_users.User_name = wtb_clie.user_name " +
|
||||
" WHERE wtb_users_info.flag_state = 'S' and " +
|
||||
" wtb_clie.cod_anag = %s AND \n" +
|
||||
" wtb_users_info.export_type = %s",
|
||||
ord.getCodAnag(), EntityExportType.ORDINI_VENDITA.getText());
|
||||
|
||||
ObjectNode jsonNode = JsonNodeFactory.instance.objectNode();
|
||||
jsonNode.put("whereCond", whereCond);
|
||||
emsServices.export(multiDBTransactionManager, requestDataDTO, EntityExportType.ORDINI_VENDITA.getText(), formatExport, jsonNode, true);
|
||||
datiExport = UtilityDB.executeSimpleQueryOnlyFirstRow(multiDBTransactionManager.getPrimaryConnection(), query);
|
||||
export.add(datiExport);
|
||||
}
|
||||
|
||||
if (UtilityHashMap.isPresent(datiExport)) {
|
||||
String userNameExport = UtilityHashMap.getValueIfExists(datiExport, "user_name");
|
||||
String passwordExport = UtilityHashMap.getValueIfExists(datiExport, "password");
|
||||
String formatExport = UtilityHashMap.getValueIfExists(datiExport, "format_file");
|
||||
Integer countExport = UtilityHashMap.getValueIfExists(datiExport, "count_export");
|
||||
|
||||
if (countExport == 1) {
|
||||
RequestDataDTO requestDataDTO = new RequestDataDTO();
|
||||
requestDataDTO.setUsername(userNameExport);
|
||||
requestDataDTO.setPassword(passwordExport);
|
||||
String whereCond =
|
||||
Query.format(
|
||||
"dtb_ordt.gestione = %s AND dtb_ordt.data_ord = %s AND dtb_ordt.num_ord = %s",
|
||||
ord.getGestione(), ord.getDataOrd(), ord.getNumOrd());
|
||||
|
||||
ObjectNode jsonNode = JsonNodeFactory.instance.objectNode();
|
||||
jsonNode.put("whereCond", whereCond);
|
||||
emsServices.export(multiDBTransactionManager, requestDataDTO, EntityExportType.ORDINI_VENDITA.getText(), formatExport, jsonNode, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,6 +64,9 @@ public class ProductController {
|
||||
@Autowired
|
||||
private MultiDBTransactionManager multiDBTransactionManager;
|
||||
|
||||
@Autowired
|
||||
private it.integry.ems.jpa.repository.MtbAartRepository mtbAartRepository;
|
||||
|
||||
@Autowired
|
||||
private ServiceChecker serviceChecker;
|
||||
|
||||
@@ -282,7 +285,20 @@ public class ProductController {
|
||||
@RequestParam("codMart") String codMartString) throws Exception {
|
||||
|
||||
List<String> codMarts = Arrays.asList(codMartString.split(","));
|
||||
List<MtbAart> mtbAartList = productServices.getArticoliByCodMarts(codMarts);
|
||||
|
||||
List<MtbAart> mtbAartList = mtbAartRepository.findWithBarcodeWithUntMisByCodMartIn(codMarts);
|
||||
|
||||
return new ServiceRestResponse(EsitoType.OK, null, mtbAartList);
|
||||
}
|
||||
|
||||
@RequestMapping(value = EmsRestConstants.PATH_SMART_ENTERPRISE_GET_ART_BY_CODMART + "/jpa", method = RequestMethod.GET)
|
||||
public @ResponseBody
|
||||
ServiceRestResponse getArticoloByCodMartJpa(HttpServletRequest request,
|
||||
@RequestParam(CommonConstants.PROFILE_DB) String configuration,
|
||||
@RequestParam("codMart") String codMartString) throws Exception {
|
||||
|
||||
List<String> codMarts = Arrays.asList(codMartString.split(","));
|
||||
List<MtbAart> mtbAartList = mtbAartRepository.findByCodMartIn(codMarts);
|
||||
|
||||
return new ServiceRestResponse(EsitoType.OK, null, mtbAartList);
|
||||
}
|
||||
|
||||
@@ -11,7 +11,6 @@ import it.integry.ems.product.importaz.dto.ArticoliMorganteDTO;
|
||||
import it.integry.ems.product.importaz.dto.ContrattiVenditaDTO;
|
||||
import it.integry.ems.product.importaz.dto.StatoArticoloDTO;
|
||||
import it.integry.ems.properties.EmsProperties;
|
||||
import it.integry.ems.retail.wms.Utility.WMSUtility;
|
||||
import it.integry.ems.rules.completing.QueryRules;
|
||||
import it.integry.ems.service.EntityProcessor;
|
||||
import it.integry.ems.sync.MultiDBTransaction.Connection;
|
||||
@@ -234,10 +233,6 @@ public class ProductServices {
|
||||
return results;
|
||||
}
|
||||
|
||||
public List<MtbAart> getArticoliByCodMarts(List<String> codMarts) throws Exception {
|
||||
return WMSUtility.getArticoliByCodMarts(codMarts, multiDBTransactionManager.getPrimaryConnection());
|
||||
}
|
||||
|
||||
public List<EntityBase> importArticoliBiolevante() throws Exception {
|
||||
List<EntityBase> toBeProcessed = new ArrayList<EntityBase>();
|
||||
List<EntityBase> entitiesReturn = new ArrayList<EntityBase>();
|
||||
|
||||
@@ -14,6 +14,7 @@ import it.integry.ems.document.dto.ScaricoLavorazioneDTO;
|
||||
import it.integry.ems.document.service.DocumentProdService;
|
||||
import it.integry.ems.exception.MissingDataException;
|
||||
import it.integry.ems.exception.PrimaryDatabaseNotPresentException;
|
||||
import it.integry.ems.jpa.repository.MtbAartRepository;
|
||||
import it.integry.ems.migration._base.IntegryCustomerDB;
|
||||
import it.integry.ems.production.dto.*;
|
||||
import it.integry.ems.production.event.ProductionOrderPausedEvent;
|
||||
@@ -22,7 +23,6 @@ import it.integry.ems.production.event.ProductionUlCreatedEvent;
|
||||
import it.integry.ems.report.dto.JasperDTO;
|
||||
import it.integry.ems.report.dto.PairsDTO;
|
||||
import it.integry.ems.retail.pvmRetail.service.PvmService;
|
||||
import it.integry.ems.retail.wms.Utility.WMSUtility;
|
||||
import it.integry.ems.retail.wms.accettazione.service.WMSAccettazioneService;
|
||||
import it.integry.ems.retail.wms.dto.*;
|
||||
import it.integry.ems.retail.wms.generic.dto.MvwSitArtUdcDetInventarioDTO;
|
||||
@@ -129,6 +129,8 @@ public class MesProductionServiceV2 {
|
||||
|
||||
@Autowired
|
||||
private ApplicationEventPublisher applicationEventPublisher;
|
||||
@Autowired
|
||||
private MtbAartRepository mtbAartRepository;
|
||||
|
||||
public BasePanelAnswerDTO callSupervisorServiceGET(String serviceIp, int servicePort, String serviceName, HashMap<String, String> queryParams) throws Exception {
|
||||
Integer timeout = setupGest.getSetupInteger(multiDBTransactionManager.getPrimaryConnection(), "MES", "HMI", "TIMEOUT_MACHINE_CONNECTION", 5);
|
||||
@@ -1126,7 +1128,8 @@ public class MesProductionServiceV2 {
|
||||
entityProcessor.processEntity(ordineLav, true, multiDBTransactionManager);
|
||||
|
||||
MtbAart mtbAart =
|
||||
WMSUtility.getArticoloByCodMart(ordineLav.getCodProd(), multiDBTransactionManager.getPrimaryConnection());
|
||||
mtbAartRepository.findByCodMart(ordineLav.getCodProd())
|
||||
.orElse(null);
|
||||
|
||||
if (UtilityBigDecimal.isNullOrZero(dto.getQtaCollo())) {
|
||||
if (UtilityBigDecimal.isNullOrZero(dto.getColliPedana())) {
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
package it.integry.ems.retail.pvmRetail.controller;
|
||||
|
||||
import it.integry.ems.javabeans.RequestDataDTO;
|
||||
import it.integry.ems.response.ServiceRestResponse;
|
||||
import it.integry.ems.retail.pvmRetail.service.OrdiniAService;
|
||||
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
|
||||
import it.integry.ems_model.entity.key.DtbOrdtKey;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@Scope("request")
|
||||
@RequestMapping("pvm/ordini_a")
|
||||
public class OrdiniAController {
|
||||
|
||||
|
||||
private final RequestDataDTO requestDataDTO;
|
||||
private final MultiDBTransactionManager multiDBTransactionManager;
|
||||
private final OrdiniAService ordiniAService;
|
||||
|
||||
public OrdiniAController(RequestDataDTO requestDataDTO, MultiDBTransactionManager multiDBTransactionManager, OrdiniAService ordiniAService) {
|
||||
this.requestDataDTO = requestDataDTO;
|
||||
this.multiDBTransactionManager = multiDBTransactionManager;
|
||||
this.ordiniAService = ordiniAService;
|
||||
}
|
||||
|
||||
@PostMapping("/checkOrder")
|
||||
public ServiceRestResponse checkOrder(@RequestBody DtbOrdtKey orderKey) throws Exception{
|
||||
return ServiceRestResponse.createPositiveResponse(ordiniAService.checkOrder(multiDBTransactionManager.getPrimaryConnection(),orderKey));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,110 @@
|
||||
package it.integry.ems.retail.pvmRetail.dto;
|
||||
|
||||
import it.integry.ems_model.annotation.SqlField;
|
||||
import it.integry.ems_model.entity.DtbOrdr;
|
||||
import it.integry.ems_model.entity.key.DtbOrdtKey;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
public class CheckOrderResponseDTO {
|
||||
|
||||
@SqlField("gestione")
|
||||
private String gestione;
|
||||
@SqlField("data_ord")
|
||||
private Date dataOrd;
|
||||
@SqlField("num_ord")
|
||||
private Integer numOrd;
|
||||
@SqlField("tot_merce")
|
||||
private BigDecimal totMerce;
|
||||
@SqlField("valore_min_ord")
|
||||
private BigDecimal valoreMinOrd;
|
||||
@SqlField("valore_minimo_superato")
|
||||
private boolean valoreMinimoSuperato = true;
|
||||
private Integer articoliInPromo = 0;
|
||||
private List<DtbOrdr> articoliFuoriGriglia = new ArrayList<>();
|
||||
private List<DtbOrdr> articoliQtaInvalida = new ArrayList<>();
|
||||
|
||||
public BigDecimal getTotMerce() {
|
||||
return totMerce;
|
||||
}
|
||||
|
||||
public CheckOrderResponseDTO setTotMerce(BigDecimal totMerce) {
|
||||
this.totMerce = totMerce;
|
||||
return this;
|
||||
}
|
||||
|
||||
public BigDecimal getValoreMinOrd() {
|
||||
return valoreMinOrd;
|
||||
}
|
||||
|
||||
public CheckOrderResponseDTO setValoreMinOrd(BigDecimal valoreMinOrd) {
|
||||
this.valoreMinOrd = valoreMinOrd;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isValoreMinimoSuperato() {
|
||||
return valoreMinimoSuperato;
|
||||
}
|
||||
|
||||
public CheckOrderResponseDTO setValoreMinimoSuperato(boolean valoreMinimoSuperato) {
|
||||
this.valoreMinimoSuperato = valoreMinimoSuperato;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Integer getArticoliInPromo() {
|
||||
return articoliInPromo;
|
||||
}
|
||||
|
||||
public CheckOrderResponseDTO setArticoliInPromo(Integer articoliInPromo) {
|
||||
this.articoliInPromo = articoliInPromo;
|
||||
return this;
|
||||
}
|
||||
|
||||
public List<DtbOrdr> getArticoliFuoriGriglia() {
|
||||
return articoliFuoriGriglia;
|
||||
}
|
||||
|
||||
public CheckOrderResponseDTO setArticoliFuoriGriglia(List<DtbOrdr> articoliFuoriGriglia) {
|
||||
this.articoliFuoriGriglia = articoliFuoriGriglia;
|
||||
return this;
|
||||
}
|
||||
|
||||
public List<DtbOrdr> getArticoliQtaInvalida() {
|
||||
return articoliQtaInvalida;
|
||||
}
|
||||
|
||||
public CheckOrderResponseDTO setArticoliQtaInvalida(List<DtbOrdr> articoliQtaInvalida) {
|
||||
this.articoliQtaInvalida = articoliQtaInvalida;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getGestione() {
|
||||
return gestione;
|
||||
}
|
||||
|
||||
public CheckOrderResponseDTO setGestione(String gestione) {
|
||||
this.gestione = gestione;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Date getDataOrd() {
|
||||
return dataOrd;
|
||||
}
|
||||
|
||||
public CheckOrderResponseDTO setDataOrd(Date dataOrd) {
|
||||
this.dataOrd = dataOrd;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Integer getNumOrd() {
|
||||
return numOrd;
|
||||
}
|
||||
|
||||
public CheckOrderResponseDTO setNumOrd(Integer numOrd) {
|
||||
this.numOrd = numOrd;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
package it.integry.ems.retail.pvmRetail.service;
|
||||
|
||||
import it.integry.ems.retail.pvmRetail.dto.CheckOrderResponseDTO;
|
||||
import it.integry.ems.sync.MultiDBTransaction.Connection;
|
||||
import it.integry.ems_model.entity.DtbOrdr;
|
||||
import it.integry.ems_model.entity.key.DtbOrdtKey;
|
||||
import it.integry.ems_model.utility.Query;
|
||||
import it.integry.ems_model.utility.UtilityDB;
|
||||
import it.integry.ems_model.utility.UtilityList;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class OrdiniAService {
|
||||
|
||||
public CheckOrderResponseDTO checkOrder(Connection connection, DtbOrdtKey orderKey) throws Exception {
|
||||
CheckOrderResponseDTO response = UtilityDB.executeSimpleQueryOnlyFirstRowDTO(connection, Query.format(
|
||||
"select gestione,\n" +
|
||||
"data_ord,\n" +
|
||||
"num_ord,\n" +
|
||||
"tot_merce,\n" +
|
||||
" valore_min_ord,\n" +
|
||||
" cast(case\n" +
|
||||
" when valore_min_ord is not null then\n" +
|
||||
" case when tot_merce > valore_min_ord then 1 else 0 end\n" +
|
||||
" else 1 end as bit) as valore_minimo_superato\n" +
|
||||
"from dtb_ordt\n" +
|
||||
" inner join atb_list al on al.cod_alis = dtb_ordt.listino\n" +
|
||||
"where dtb_ordt.gestione = {}\n" +
|
||||
" and dtb_ordt.data_ord = {}\n" +
|
||||
" and dtb_ordt.num_ord = {}"
|
||||
, orderKey.getGestione(), orderKey.getDataOrd(), orderKey.getNumOrd()), CheckOrderResponseDTO.class);
|
||||
|
||||
Integer articoliInPromo = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(connection,
|
||||
Query.format("select count(*)\n" +
|
||||
"from dtb_ordt\n" +
|
||||
" inner join dtb_ordr on dtb_ordt.gestione = dtb_ordr.gestione and\n" +
|
||||
" dtb_ordt.data_ord = dtb_ordr.data_ord and\n" +
|
||||
" dtb_ordt.num_ord = dtb_ordr.num_ord\n" +
|
||||
" inner join mtb_depo on dtb_ordt.cod_mdep = mtb_depo.cod_mdep\n" +
|
||||
"where dtb_ordt.gestione = {}\n" +
|
||||
" AND dtb_ordt.data_ord = {}\n" +
|
||||
" AND dtb_ordt.num_ord = {}\n" +
|
||||
" and dtb_ordr.cod_mart in (\n" +
|
||||
" select distinct griglia.cod_mart\n" +
|
||||
" from dbo.getGrigliaAcquisto({}, dtb_ordt.listino, mtb_depo.cod_mdep, null, null) griglia\n" +
|
||||
" inner join\n" +
|
||||
" dbo.getPromozioneVendita({}, {}, mtb_depo.cod_vlis, null, null) promo_vend\n" +
|
||||
" on griglia.cod_mart = promo_vend.cod_mart\n" +
|
||||
")\n", orderKey.getGestione(), orderKey.getDataOrd(), orderKey.getNumOrd(), orderKey.getDataOrd(), orderKey.getDataOrd(), orderKey.getDataOrd())
|
||||
);
|
||||
|
||||
response.setArticoliInPromo(articoliInPromo);
|
||||
|
||||
List<DtbOrdr> righeFuoriGriglia = UtilityDB.executeSimpleQueryDTO(connection, Query.format(
|
||||
"SELECT dtb_ordr.cod_mart, dtb_ordr.descrizione, dtb_ordr.qta_ord, dtb_ordr.unt_ord\n" +
|
||||
"FROM dtb_ordt\n" +
|
||||
" INNER JOIN dtb_ordr ON dtb_ordt.gestione = dtb_ordr.gestione AND\n" +
|
||||
" dtb_ordt.data_ord = dtb_ordr.data_ord AND\n" +
|
||||
" dtb_ordt.num_ord = dtb_ordr.num_ord\n" +
|
||||
"\n" +
|
||||
"WHERE dtb_ordt.gestione = {}\n" +
|
||||
" AND dtb_ordt.data_ord = {}\n" +
|
||||
" AND dtb_ordt.num_ord = {}\n" +
|
||||
" AND NOT EXISTS (SELECT *\n" +
|
||||
" FROM dbo.getgrigliaacquisto({}, NULL, NULL, NULL, NULL) griglia\n" +
|
||||
" WHERE tipo_variazione <> 'D'\n" +
|
||||
" AND dtb_ordt.listino = griglia.cod_alis\n" +
|
||||
" AND dtb_ordt.cod_mdep = griglia.cod_mdep\n" +
|
||||
" AND dtb_ordr.cod_mart = griglia.cod_mart\n" +
|
||||
" AND (dtb_ordr.cod_art_for IS NULL OR dtb_ordr.cod_art_for = griglia.cod_art_for))\n",
|
||||
orderKey.getGestione(), orderKey.getDataOrd(), orderKey.getNumOrd(), orderKey.getDataOrd()
|
||||
), DtbOrdr.class);
|
||||
|
||||
if (!UtilityList.isNullOrEmpty(righeFuoriGriglia)) {
|
||||
response.setArticoliFuoriGriglia(righeFuoriGriglia);
|
||||
}
|
||||
|
||||
|
||||
List<DtbOrdr> articoliQtaOrdInvalida = UtilityDB.executeSimpleQueryDTO(connection, Query.format(
|
||||
"select gestione,data_ord,num_ord, riga_ord, cod_mart, descrizione, unt_ord , qta_ord, qta_cnf\n" +
|
||||
"from dtb_ordr\n" +
|
||||
"where gestione = {}\n" +
|
||||
" and data_ord = {}\n" +
|
||||
" and num_ord = {}\n" +
|
||||
" and unt_ord = 'pz'\n" +
|
||||
"and not qta_ord %% qta_cnf = 0",
|
||||
orderKey.getGestione(), orderKey.getDataOrd(), orderKey.getNumOrd()
|
||||
), DtbOrdr.class);
|
||||
|
||||
if (!UtilityList.isNullOrEmpty(articoliQtaOrdInvalida)) {
|
||||
response.setArticoliQtaInvalida(articoliQtaOrdInvalida);
|
||||
}
|
||||
|
||||
|
||||
return response;
|
||||
}
|
||||
}
|
||||
@@ -1,45 +1,48 @@
|
||||
package it.integry.ems.retail.service;
|
||||
|
||||
import it.integry.ems.dynamic_cache.EntityCacheComponent;
|
||||
import it.integry.ems.production.agribook.model.AgribookOrderDTO;
|
||||
import it.integry.ems.jpa.repository.MtbAartRepository;
|
||||
import it.integry.ems.retail.dto.AnomalieMerceDTO;
|
||||
import it.integry.ems.retail.dto.DettaglioULDTO;
|
||||
import it.integry.ems.retail.dto.SaveAnomaliaRequestDTO;
|
||||
import it.integry.ems.retail.dto.SaveLivelloAnomaliaRequestDTO;
|
||||
import it.integry.ems.retail.utility.AnomalieUlUtility;
|
||||
import it.integry.ems.retail.wms.Utility.WMSUtility;
|
||||
import it.integry.ems.retail.wms.generic.dto.MvwSitArtUdcDetInventarioDTO;
|
||||
import it.integry.ems.service.EntityProcessor;
|
||||
import it.integry.ems.sync.MultiDBTransaction.Connection;
|
||||
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
|
||||
import it.integry.ems.utility.UtilityEntity;
|
||||
import it.integry.ems_model.base.EntityBase;
|
||||
import it.integry.ems_model.config.EmsRestConstants;
|
||||
import it.integry.ems_model.entity.MtbAart;
|
||||
import it.integry.ems_model.entity.MtbAnomalieUl;
|
||||
import it.integry.ems_model.entity.MtbColt;
|
||||
import it.integry.ems_model.entity.MtbLivelliAnomalie;
|
||||
import it.integry.ems_model.types.OperationType;
|
||||
import it.integry.ems_model.utility.*;
|
||||
import it.integry.ems_model.utility.UtilityDB;
|
||||
import it.integry.ems_model.utility.UtilityList;
|
||||
import it.integry.ems_model.utility.UtilityLong;
|
||||
import it.integry.ems_model.utility.UtilityString;
|
||||
import it.integry.ems_model.utility.dto.PageableRequestDTO;
|
||||
import it.integry.ems_model.utility.dto.PaginatedDTO;
|
||||
import org.jfree.util.ObjectList;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
@Service
|
||||
public class AnomalieUlService {
|
||||
|
||||
private final EntityCacheComponent entityCacheComponent;
|
||||
private final EntityProcessor entityProcessor;
|
||||
private final MtbAartRepository mtbAartRepository;
|
||||
|
||||
public AnomalieUlService(EntityCacheComponent entityCacheComponent, EntityProcessor entityProcessor) {
|
||||
public AnomalieUlService(EntityCacheComponent entityCacheComponent, EntityProcessor entityProcessor, MtbAartRepository mtbAartRepository) {
|
||||
this.entityCacheComponent = entityCacheComponent;
|
||||
this.entityProcessor = entityProcessor;
|
||||
this.mtbAartRepository = mtbAartRepository;
|
||||
}
|
||||
|
||||
public PaginatedDTO<AnomalieMerceDTO> getAnomalieProd(PageableRequestDTO requestDTO, Connection connection) throws Exception {
|
||||
@@ -78,14 +81,13 @@ public class AnomalieUlService {
|
||||
if (UtilityList.isNullOrEmpty(ulDetails))
|
||||
return new ArrayList<>();
|
||||
|
||||
List<String> codMarts = ulDetails.stream().map(DettaglioULDTO::getCodMart).distinct().collect(Collectors.toList());
|
||||
Map<String, MtbAart> artMap = entityCacheComponent.<MtbAart>getCachedEntitiesStream(connection.getIntegryCustomerDB(), MtbAart.ENTITY, art -> codMarts.contains(art.getCodMart())).collect(Collectors.toMap(MtbAart::getCodMart, x -> x));
|
||||
ulDetails.forEach(ul -> {
|
||||
MtbAart art = artMap.get(ul.getCodMart());
|
||||
ul.setDescrizione(art.getDescrizione())
|
||||
.setDescrizioneEstesa(art.getDescrizioneEstesa())
|
||||
.setUntMis(art.getUntMis());
|
||||
});
|
||||
for (DettaglioULDTO ulDetail : ulDetails) {
|
||||
final MtbAart mtbAart = mtbAartRepository.findByCodMart(ulDetail.getCodMart()).get();
|
||||
ulDetail.setDescrizione(mtbAart.getDescrizione())
|
||||
.setDescrizioneEstesa(mtbAart.getDescrizioneEstesa())
|
||||
.setUntMis(mtbAart.getUntMis());
|
||||
}
|
||||
|
||||
|
||||
return ulDetails;
|
||||
}
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
package it.integry.ems.retail.wms.Utility;
|
||||
|
||||
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.exception.MissingDataException;
|
||||
import it.integry.ems.exception.PrimaryDatabaseNotPresentException;
|
||||
import it.integry.ems.javabeans.RequestDataDTO;
|
||||
import it.integry.ems.jpa.repository.MtbAartRepository;
|
||||
import it.integry.ems.retail.wms.dto.*;
|
||||
import it.integry.ems.retail.wms.exceptions.InvalidArticoloException;
|
||||
import it.integry.ems.retail.wms.generic.dto.MvwSitArtUdcDetInventarioDTO;
|
||||
@@ -30,7 +29,10 @@ import java.io.IOException;
|
||||
import java.math.BigDecimal;
|
||||
import java.sql.SQLException;
|
||||
import java.time.LocalDate;
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class WMSUtility {
|
||||
@@ -246,15 +248,16 @@ public class WMSUtility {
|
||||
|
||||
public static InsertUDSRowResponseDTO insertUDSLavorazioneRowMovement(Connection connection, InsertUDSRowRequestDTO insertUDSRowRequestDTO, String username) throws Exception {
|
||||
DroolsDataCompleting droolsDataCompleting = ApplicationContextProvider.getApplicationContext().getBean(DroolsDataCompleting.class);
|
||||
MtbAartRepository mtbAartRepository = ApplicationContextProvider.getApplicationContext().getBean(MtbAartRepository.class);
|
||||
|
||||
//Prendo solo la chiave
|
||||
MtbColt targetMtbColt = insertUDSRowRequestDTO.getTargetMtbColt();
|
||||
if (targetMtbColt == null)
|
||||
throw new Exception("Nessun collo di destinazione specificato durante l'inserimento di una riga in una UDS (targetMtbColt null)");
|
||||
|
||||
MtbAart mtbAart = WMSUtility.getArticoloByCodMart(insertUDSRowRequestDTO.getCodMart(), connection);
|
||||
if (mtbAart == null)
|
||||
throw new InvalidArticoloException(insertUDSRowRequestDTO.getCodMart());
|
||||
|
||||
MtbAart mtbAart = mtbAartRepository.findByCodMart(insertUDSRowRequestDTO.getCodMart())
|
||||
.orElseThrow(() -> new InvalidArticoloException(insertUDSRowRequestDTO.getCodMart()));
|
||||
|
||||
MtbColrInfoProd mtbColrInfoProd = null;
|
||||
|
||||
@@ -503,6 +506,8 @@ public class WMSUtility {
|
||||
|
||||
public static InsertUDCRowResponseDTO insertUDCRow(InsertUDCRowRequestDTO insertUDCRowRequestDTO, EntityProcessor entityProcessor, MultiDBTransactionManager multiDBTransactionManager) throws Exception {
|
||||
|
||||
MtbAartRepository mtbAartRepository = ApplicationContextProvider.getApplicationContext().getBean(MtbAartRepository.class);
|
||||
|
||||
MtbColt targetMtbColt = insertUDCRowRequestDTO.getTargetMtbColt();
|
||||
|
||||
if (targetMtbColt == null)
|
||||
@@ -538,9 +543,8 @@ public class WMSUtility {
|
||||
|
||||
|
||||
if (insertUDCRowRequestDTO.getCodMart() != null) {
|
||||
MtbAart mtbAart = getArticoloByCodMart(insertUDCRowRequestDTO.getCodMart(), multiDBTransactionManager.getPrimaryConnection());
|
||||
if (mtbAart == null)
|
||||
throw new InvalidArticoloException(insertUDCRowRequestDTO.getCodMart());
|
||||
MtbAart mtbAart = mtbAartRepository.findByCodMart(insertUDCRowRequestDTO.getCodMart())
|
||||
.orElseThrow(() -> new InvalidArticoloException(insertUDCRowRequestDTO.getCodMart()));
|
||||
|
||||
targetMtbColr
|
||||
.setCodMart(mtbAart.getCodMart())
|
||||
@@ -567,84 +571,7 @@ public class WMSUtility {
|
||||
.setSavedMtbColr(targetMtbColr);
|
||||
}
|
||||
|
||||
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 = getAlternativeMtbAartBarCodes(codMarts, connection);
|
||||
|
||||
if (listMtbAart != null && !listMtbAart.isEmpty()) {
|
||||
List<String> untMisStrings = listMtbAart.stream()
|
||||
.map(MtbAart::getUntMis)
|
||||
.collect(Collectors.toList());
|
||||
List<MtbUntMis> listUntMis = getUntMisFromCod(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 List<MtbUntMis> getUntMisFromCod(List<String> untMisCods, Connection connection) throws Exception {
|
||||
List<String> untMisStrings = Stream.of(untMisCods)
|
||||
.withoutNulls()
|
||||
.distinct()
|
||||
.toList();
|
||||
|
||||
String queryUntMis = "SELECT * FROM mtb_unt_mis WHERE unt_mis IN (" + UtilityQuery.concatStringFieldsWithSeparator(untMisStrings, ",") + ")";
|
||||
final List<MtbUntMis> mtbUntMis = UtilityDB.executeSimpleQueryDTO(connection, queryUntMis, MtbUntMis.class);
|
||||
return mtbUntMis != null ? mtbUntMis : new ArrayList<>();
|
||||
}
|
||||
|
||||
public static 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<>();
|
||||
}
|
||||
|
||||
public static MtbColt createInternalMovement(String codMdep) {
|
||||
|
||||
@@ -665,6 +592,10 @@ public class WMSUtility {
|
||||
return null;
|
||||
|
||||
return new MtbColr()
|
||||
.setNumCollo(inputData.getNumCollo())
|
||||
.setDataCollo(inputData.getDataCollo())
|
||||
.setGestione(inputData.getGestione())
|
||||
.setSerCollo(inputData.getSerCollo())
|
||||
.setCodMart(inputData.getCodMart())
|
||||
.setPartitaMag(inputData.getPartitaMag())
|
||||
// .setCodCol(inputData.getCodCol())
|
||||
@@ -728,4 +659,14 @@ public class WMSUtility {
|
||||
|
||||
return UtilityDB.executeSimpleQueryDTO(connection,Query.format("SELECT * from mtb_colt where barcode_ul in ("+UtilityDB.listValueToString(barcodeList)+")"), MtbColt.class);
|
||||
}
|
||||
|
||||
public static MtbColt getUlPosizioneMonoUl(Connection connection, String posizione) throws Exception {
|
||||
String sql = "SELECT * FROM mtb_colt " +
|
||||
" inner join mtb_depo_posizioni on mtb_colt.posizione = mtb_depo_posizioni.posizione" +
|
||||
" WHERE mtb_colt.segno = 1 AND mtb_depo_posizioni.flag_mono_collo = 'S' and mtb_depo_posizioni.posizione = " + UtilityDB.valueToString(posizione) ;
|
||||
List<MtbColt> listaUl = UtilityDB.executeSimpleQueryDTO(connection,sql,MtbColt.class);
|
||||
if (listaUl.isEmpty()) throw new Exception("Nessuna UL trovata per la posizione " + posizione);
|
||||
if (listaUl.size() > 1) throw new Exception("Ci sono più UL disponibili per la posizione " + posizione);
|
||||
return listaUl.get(0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package it.integry.ems.retail.wms.accettazione.service;
|
||||
|
||||
import it.integry.ems.javabeans.RequestDataDTO;
|
||||
import it.integry.ems.jpa.repository.MtbAartRepository;
|
||||
import it.integry.ems.product.importaz.service.ProductServices;
|
||||
import it.integry.ems.retail.wms.Utility.WMSUtility;
|
||||
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.SitBollaAccettazioneDTO;
|
||||
@@ -43,6 +43,8 @@ public class WMSAccettazioneBollaService {
|
||||
|
||||
@Autowired
|
||||
private UserSession userSession;
|
||||
@Autowired
|
||||
private MtbAartRepository mtbAartRepository;
|
||||
|
||||
public List<BollaAccettazioneDTO> retrieveBolleDaAccettare() throws Exception {
|
||||
|
||||
@@ -166,11 +168,11 @@ public class WMSAccettazioneBollaService {
|
||||
|
||||
if (sitBollaAccettazioneDTOS == null || sitBollaAccettazioneDTOS.isEmpty()) return null;
|
||||
|
||||
final List<MtbAart> articoliByCodMarts = WMSUtility.getArticoliByCodMarts(sitBollaAccettazioneDTOS.stream()
|
||||
final List<MtbAart> articoliByCodMarts = mtbAartRepository.findByCodMartIn(sitBollaAccettazioneDTOS.stream()
|
||||
.map(SitBollaAccettazioneDTO::getCodMart)
|
||||
.filter(Objects::nonNull)
|
||||
.distinct()
|
||||
.collect(Collectors.toList()), multiDBTransactionManager.getPrimaryConnection());
|
||||
.collect(Collectors.toList()));
|
||||
|
||||
final Map<String, BigDecimal> qtaCnfsByArt = articoliByCodMarts.stream()
|
||||
.collect(Collectors.toMap(MtbAart::getCodMart, MtbAart::getQtaCnf));
|
||||
|
||||
@@ -2,6 +2,7 @@ package it.integry.ems.retail.wms.accettazione.service;
|
||||
|
||||
import it.integry.ems.exception.PrimaryDatabaseNotPresentException;
|
||||
import it.integry.ems.javabeans.RequestDataDTO;
|
||||
import it.integry.ems.jpa.repository.MtbAartRepository;
|
||||
import it.integry.ems.product.importaz.service.ProductServices;
|
||||
import it.integry.ems.retail.pvmRetail.dto.OrdineInevasoDTO;
|
||||
import it.integry.ems.retail.wms.Utility.WMSUtility;
|
||||
@@ -69,6 +70,9 @@ public class WMSAccettazioneService {
|
||||
@Autowired
|
||||
private AziendaService aziendaService;
|
||||
|
||||
@Autowired
|
||||
private MtbAartRepository mtbAartRepository;
|
||||
|
||||
public MtbColt createUDC(CreateUDCRequestDTO createUDCRequestDTO) throws Exception {
|
||||
if (!userSession.isAttivo()) {
|
||||
throw new UsernameNotFoundException("Utente " + userSession.getUsername() + " non riconoscuto!");
|
||||
@@ -291,7 +295,7 @@ public class WMSAccettazioneService {
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
|
||||
List<MtbAart> mtbAarts = productServices.getArticoliByCodMarts(codMarts);
|
||||
List<MtbAart> mtbAarts = mtbAartRepository.findByCodMartIn(codMarts);
|
||||
|
||||
MtbColt targetMtbColt = inputData.getTargetMtbColt();
|
||||
targetMtbColt.setOperation(OperationType.SELECT_OBJECT);
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
package it.integry.ems.retail.wms.documenti.service;
|
||||
|
||||
import it.integry.ems.jpa.repository.MtbUntMisRepository;
|
||||
import it.integry.ems.product.importaz.service.ProductServices;
|
||||
import it.integry.ems.retail.pvmRetail.dto.PvmArticoliChildDTO;
|
||||
import it.integry.ems.retail.pvmRetail.dto.PvmArticoliDTO;
|
||||
import it.integry.ems.retail.pvmRetail.service.PvmService;
|
||||
import it.integry.ems.retail.wms.Utility.WMSUtility;
|
||||
import it.integry.ems.retail.wms.documenti.dto.DocumentArtDTO;
|
||||
import it.integry.ems.retail.wms.documenti.dto.RetrieveLottiDTO;
|
||||
import it.integry.ems.sync.MultiDBTransaction.Connection;
|
||||
@@ -38,6 +38,8 @@ public class WMSDocumentService {
|
||||
|
||||
@Autowired
|
||||
private SetupGest setupGest;
|
||||
@Autowired
|
||||
private MtbUntMisRepository mtbUntMisRepository;
|
||||
|
||||
public Boolean checkDoc(String fornitore, String numDoc, Date dataDoc, String tipoDoc) throws Exception {
|
||||
Connection conn = multiDBTransactionManager.getPrimaryConnection();
|
||||
@@ -114,7 +116,8 @@ public class WMSDocumentService {
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
|
||||
final List<MtbUntMis> untMisFromCod = WMSUtility.getUntMisFromCod(untMiss,multiDBTransactionManager.getPrimaryConnection());
|
||||
|
||||
final List<MtbUntMis> untMisFromCod = mtbUntMisRepository.findByUntMisIn(untMiss);
|
||||
|
||||
for (DocumentArtDTO art : arts) {
|
||||
final MtbUntMis mtbUntMis = untMisFromCod.stream().filter(x -> x.getUntMis().equalsIgnoreCase(art.getUntMis()))
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package it.integry.ems.retail.wms.generic.controller;
|
||||
|
||||
import it.integry.common.var.CommonConstants;
|
||||
import it.integry.ems.jpa.repository.MtbAartRepository;
|
||||
import it.integry.ems.product.importaz.service.ProductServices;
|
||||
import it.integry.ems.response.ServiceRestResponse;
|
||||
import it.integry.ems.retail.wms.generic.dto.*;
|
||||
@@ -37,6 +38,8 @@ public class WMSArticoloController {
|
||||
|
||||
@Autowired
|
||||
private UserSession userSession;
|
||||
@Autowired
|
||||
private MtbAartRepository mtbAartRepository;
|
||||
|
||||
|
||||
@RequestMapping(value = "", method = RequestMethod.GET)
|
||||
@@ -93,8 +96,7 @@ public class WMSArticoloController {
|
||||
ServiceRestResponse searchByCodMartOrBarcode(@RequestParam(CommonConstants.PROFILE_DB) String profileDB,
|
||||
@RequestBody RetrieveArticoloByCodMartRequestDTO retrieveArticoloByCodMartRequest) throws Exception {
|
||||
|
||||
return ServiceRestResponse.createPositiveResponse(
|
||||
productServices.getArticoliByCodMarts(retrieveArticoloByCodMartRequest.getCodMarts()));
|
||||
return ServiceRestResponse.createPositiveResponse(mtbAartRepository.findByCodMartIn(retrieveArticoloByCodMartRequest.getCodMarts()));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -556,9 +556,16 @@ public class WMSGenericController {
|
||||
public @ResponseBody
|
||||
ServiceRestResponse spostaULInPosizione(@RequestParam(CommonConstants.PROFILE_DB) String configuration,
|
||||
@RequestBody SpostaUlRequestDTO requestDTO) throws Exception {
|
||||
wmsGenericService.spostaUL(requestDTO);
|
||||
return ServiceRestResponse.createPositiveResponse();
|
||||
|
||||
try {
|
||||
MtbColt mtbColt = wmsGenericService.spostaUL(requestDTO);
|
||||
if (mtbColt != null) {
|
||||
mtbColt.setOnlyPkMaster(false);
|
||||
}
|
||||
return ServiceRestResponse.createPositiveResponse(mtbColt);
|
||||
} catch (Exception e) {
|
||||
multiDBTransactionManager.rollbackAll();
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -705,4 +712,11 @@ public class WMSGenericController {
|
||||
) throws Exception {
|
||||
return ServiceRestResponse.createPositiveResponse(WMSUtility.retrieveBarcodesByBarcodeAndCodJfas(multiDBTransactionManager.getPrimaryConnection(),barcodeUl,codJfas, maxResults));
|
||||
}
|
||||
|
||||
@GetMapping("wms/resetta-posizioni-mono-ul")
|
||||
ServiceRestResponse resettaPosizioniMonoUl() throws Exception {
|
||||
wmsGenericService.resettaPosizioniMonoUL(multiDBTransactionManager, entityProcessor);
|
||||
|
||||
return ServiceRestResponse.createPositiveResponse();
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,7 @@ package it.integry.ems.retail.wms.generic.dto;
|
||||
import it.integry.ems_model.entity.MtbColt;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
public class SpostaUlRequestDTO {
|
||||
@@ -10,6 +11,9 @@ public class SpostaUlRequestDTO {
|
||||
private String codMdep;
|
||||
private String posizione;
|
||||
private String annotazioni;
|
||||
private Date dataTrasf;
|
||||
private Integer numTrasf;
|
||||
private String codVvet;
|
||||
private boolean createDocAutomatically = true;
|
||||
private List<MtbColt> mtbColtsToMove = new ArrayList<>();
|
||||
|
||||
@@ -49,6 +53,33 @@ public class SpostaUlRequestDTO {
|
||||
return this;
|
||||
}
|
||||
|
||||
public Date getDataTrasf() {
|
||||
return dataTrasf;
|
||||
}
|
||||
|
||||
public SpostaUlRequestDTO setDataTrasf(Date dataTrasf) {
|
||||
this.dataTrasf = dataTrasf;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Integer getNumTrasf() {
|
||||
return numTrasf;
|
||||
}
|
||||
|
||||
public SpostaUlRequestDTO setNumTrasf(Integer numTrasf) {
|
||||
this.numTrasf = numTrasf;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getCodVvet() {
|
||||
return codVvet;
|
||||
}
|
||||
|
||||
public SpostaUlRequestDTO setCodVvet(String codVvet) {
|
||||
this.codVvet = codVvet;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isCreateDocAutomatically() {
|
||||
return createDocAutomatically;
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import it.integry.common.var.CommonConstants;
|
||||
import it.integry.ems.Import.dto.AnomalieDTO;
|
||||
import it.integry.ems.exception.MissingDataException;
|
||||
import it.integry.ems.javabeans.RequestDataDTO;
|
||||
import it.integry.ems.jpa.repository.MtbAartRepository;
|
||||
import it.integry.ems.product.importaz.service.ProductServices;
|
||||
import it.integry.ems.report.dto.PairsDTO;
|
||||
import it.integry.ems.report.dto.ReportTypeDTO;
|
||||
@@ -36,10 +37,12 @@ import it.integry.ems.service.dto.production.OrdineInevasoGroupMercDTO;
|
||||
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
|
||||
import it.integry.ems.user.UserSession;
|
||||
import it.integry.ems.utility.UtilityEntity;
|
||||
import it.integry.ems.utility.entity.MtbDepoPosizioniUtils;
|
||||
import it.integry.ems_model.base.EntityBase;
|
||||
import it.integry.ems_model.config.EmsRestConstants;
|
||||
import it.integry.ems_model.db.ResultSetMapper;
|
||||
import it.integry.ems_model.entity.*;
|
||||
import it.integry.ems_model.exception.GestSetupNotFoundException;
|
||||
import it.integry.ems_model.service.SetupGest;
|
||||
import it.integry.ems_model.types.OperationType;
|
||||
import it.integry.ems_model.types.SetupGestKeySection;
|
||||
@@ -101,6 +104,10 @@ public class WMSGenericService {
|
||||
|
||||
@Autowired
|
||||
private WMSAccettazioneService wmsAccettazioneService;
|
||||
@Autowired
|
||||
private WMSGiacenzaULService wmsGiacenzaULService;
|
||||
@Autowired
|
||||
private MtbAartRepository mtbAartRepository;
|
||||
|
||||
public List<AvailableCodMdepDTO> getAvailableCodMdepsForUser() throws Exception {
|
||||
|
||||
@@ -782,7 +789,7 @@ public class WMSGenericService {
|
||||
.distinct()
|
||||
.toList();
|
||||
|
||||
final List<MtbAart> mtbAarts = WMSUtility.getArticoliByCodMarts(codMarts, multiDBTransactionManager.getPrimaryConnection());
|
||||
final List<MtbAart> mtbAarts = mtbAartRepository.findByCodMartIn(codMarts);
|
||||
|
||||
|
||||
//Carico la giacenza degli articoli
|
||||
@@ -1714,11 +1721,16 @@ public class WMSGenericService {
|
||||
anomalieList.add(AnomalieDTO.error("Non è stato trovato alcun articolo in giacenza"));
|
||||
continue;
|
||||
}
|
||||
List<String> articoliDaScaricare = Stream.of(results).map(MvwSitArtUdcDetInventarioDTO::getCodMart).distinct().toList();
|
||||
List<String> articoliDaScaricare = results.stream()
|
||||
.map(MvwSitArtUdcDetInventarioDTO::getCodMart)
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
|
||||
|
||||
for (String codMart : articoliDaScaricare) {
|
||||
List<MvwSitArtUdcDetInventarioDTO> giacenzeArticolo = Stream.of(results).filter(x -> x.getCodMart().equalsIgnoreCase(codMart)).toList();
|
||||
List<MvwSitArtUdcDetInventarioDTO> giacenzeArticolo = results.stream()
|
||||
.filter(x -> x.getCodMart().equalsIgnoreCase(codMart))
|
||||
.collect(Collectors.toList());
|
||||
if (giacenzeArticolo.isEmpty()) {
|
||||
anomalieList.add(AnomalieDTO.warning("Non è stato possibile scaricare la quantita di materia prima dell'articolo " + codMart + ". "));
|
||||
continue; //throw new Exception("Non è stato trovato alcun articolo in giacenza");
|
||||
@@ -2017,7 +2029,7 @@ public class WMSGenericService {
|
||||
UtilityEntity.throwEntitiesException(entitiesToSave);
|
||||
}
|
||||
|
||||
public void spostaUL(SpostaUlRequestDTO requestDTO) throws Exception {
|
||||
public MtbColt spostaUL(SpostaUlRequestDTO requestDTO) throws Exception {
|
||||
if (UtilityString.isNullOrEmpty(requestDTO.getCodMdep()))
|
||||
throw new Exception("Nessun deposito di arrivo selezionato");
|
||||
|
||||
@@ -2040,9 +2052,9 @@ public class WMSGenericService {
|
||||
|
||||
boolean gestisciColli = WMSUtility.isGestisciColli(mtbDepo, entityProcessor, multiDBTransactionManager);
|
||||
|
||||
MtbDepoPosizioni mtbDepoPosizioni = new MtbDepoPosizioni();
|
||||
if (!UtilityString.isNullOrEmpty(requestDTO.getPosizione())) {
|
||||
MtbDepoPosizioni mtbDepoPosizioni = new MtbDepoPosizioni()
|
||||
.setCodMdep(requestDTO.getCodMdep())
|
||||
mtbDepoPosizioni.setCodMdep(requestDTO.getCodMdep())
|
||||
.setPosizione(requestDTO.getPosizione());
|
||||
mtbDepoPosizioni.setOperation(OperationType.SELECT_OBJECT);
|
||||
|
||||
@@ -2060,7 +2072,7 @@ public class WMSGenericService {
|
||||
String codDtipToUse = setupGest.getSetupDepo(multiDBTransactionManager.getPrimaryConnection(), "PICKING", "LOGISTICA", "COD_DTIP_DOC_TRASF_INTERNI", requestDTO.getCodMdep());
|
||||
|
||||
if (UtilityString.isNullOrEmpty(codDtipToUse))
|
||||
throw new Exception("La configurazione della setup gest non è completa per gestire gli spostamenti tra depositi");
|
||||
throw new GestSetupNotFoundException("PICKING", "LOGISTICA", "COD_DTIP_DOC_TRASF_INTERNI");
|
||||
|
||||
String codAnag = mtbDepo.getCodAnag();
|
||||
String codVdes = mtbDepo.getCodVdes();
|
||||
@@ -2092,6 +2104,9 @@ public class WMSGenericService {
|
||||
.setCodMdep(codMdepDoc)
|
||||
.setCodVdes(codVdes)
|
||||
.setCodAnag(codAnag)
|
||||
.setDataDoc(requestDTO.getDataTrasf())
|
||||
.setNumDoc(requestDTO.getNumTrasf())
|
||||
.setCodVvet(requestDTO.getCodVvet())
|
||||
.setAnnotazioni(requestDTO.getAnnotazioni())
|
||||
.setCodDtip(codDtipToUse);
|
||||
|
||||
@@ -2155,13 +2170,19 @@ public class WMSGenericService {
|
||||
WMSUtility.trasferisciPedane(mtbColtToMove, listaPedane, dtbDoct);
|
||||
}
|
||||
|
||||
mtbColtToMove.setOperation(OperationType.UPDATE);
|
||||
mtbColtToMove
|
||||
.setMtbColr(new ArrayList<>())
|
||||
.setPosizione(UtilityString.isNull(requestDTO.getPosizione(), EmsRestConstants.NULL))
|
||||
.setCodMdep(requestDTO.getCodMdep());
|
||||
if (!UtilityString.isNullOrEmpty(mtbDepoPosizioni.getPosizione()) && mtbDepoPosizioni.isFlagMonoCollo()) {
|
||||
MtbColt ulMonocollo = WMSUtility.getUlPosizioneMonoUl(multiDBTransactionManager.getPrimaryConnection(),mtbDepoPosizioni.getPosizione());
|
||||
WMSUtility.spostaArtsTraUL(multiDBTransactionManager.getPrimaryConnection(), mtbColtToMove, ulMonocollo, false, entityProcessor, requestDataDTO);
|
||||
} else {
|
||||
|
||||
mtbColtToMove.setOperation(OperationType.UPDATE);
|
||||
mtbColtToMove
|
||||
.setMtbColr(new ArrayList<>())
|
||||
.setPosizione(UtilityString.isNull(requestDTO.getPosizione(), EmsRestConstants.NULL))
|
||||
.setCodMdep(requestDTO.getCodMdep());
|
||||
entitiesToSave.add(mtbColtToMove);
|
||||
}
|
||||
|
||||
entitiesToSave.add(mtbColtToMove);
|
||||
}
|
||||
|
||||
if (dtbDoct != null && !UtilityString.isNullOrEmpty(requestDTO.getAnnotazioni())) {
|
||||
@@ -2175,6 +2196,8 @@ public class WMSGenericService {
|
||||
|
||||
entityProcessor.processEntityList(entitiesToSave, true);
|
||||
UtilityEntity.throwEntitiesException(entitiesToSave);
|
||||
|
||||
return mtbCotlList.stream().findFirst().orElse(null);
|
||||
}
|
||||
|
||||
public void spostaULInPosizione(MtbColt mtbColtToMove, MtbDepoPosizioni mtbDepoPosizioni) throws Exception {
|
||||
@@ -2509,17 +2532,17 @@ public class WMSGenericService {
|
||||
.distinct()
|
||||
.toList();
|
||||
|
||||
List<MtbAart> mtbAarts = WMSUtility.getArticoliByCodMarts(codMarts, multiDBTransactionManager.getPrimaryConnection());
|
||||
List<MtbAart> mtbAarts = mtbAartRepository.findByCodMartIn(codMarts);
|
||||
|
||||
List<MtbColt> mtbColtToSave = new ArrayList<>();
|
||||
List<MtbColr> successMtbColr = new ArrayList<>();
|
||||
List<MtbColr> failedMtbColr = new ArrayList<>();
|
||||
|
||||
for (MtbColr inputMtbColr : resultRows) {
|
||||
MtbAart mtbAart = Stream.of(mtbAarts)
|
||||
MtbAart mtbAart = mtbAarts.stream()
|
||||
.filter(x -> x.getCodMart().equals(inputMtbColr.getCodMart()))
|
||||
.findFirst()
|
||||
.get();
|
||||
.orElse(null);
|
||||
|
||||
inputMtbColr
|
||||
.setOnlyPkMaster(false);
|
||||
@@ -3088,4 +3111,59 @@ public class WMSGenericService {
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
public void resettaPosizioniMonoUL(MultiDBTransactionManager multiDBTransactionManager, EntityProcessor entityProcessor) throws Exception {
|
||||
List<MtbDepoPosizioni> posizioniMonoUL = MtbDepoPosizioniUtils.getAllMonoUlPositions(multiDBTransactionManager.getPrimaryConnection().getIntegryCustomerDB());
|
||||
|
||||
try {
|
||||
for (MtbDepoPosizioni posizione : posizioniMonoUL) {
|
||||
final List<MtbColt> oldUdcs = getULInPosizione(posizione, false);
|
||||
|
||||
if (oldUdcs == null)
|
||||
continue;
|
||||
|
||||
oldUdcs.removeIf(ul -> ul.getSegno() != 1); //consider only Lavorazione UDCs
|
||||
|
||||
|
||||
if (oldUdcs.isEmpty()) {
|
||||
//skip position
|
||||
continue;
|
||||
} else if (oldUdcs.size() > 1) {
|
||||
throw new Exception("Posizione " + posizione.getPosizione() + " contiene più di una UDC in una posizione mono UL");
|
||||
}
|
||||
final MtbColt newUdc = wmsLavorazioneService.createUDC(new CreateUDCRequestDTO()
|
||||
.setCodMdep(posizione.getCodMdep())
|
||||
.setPosizione(posizione.getPosizione()));
|
||||
|
||||
final MtbColt oldUdc = oldUdcs.get(0);
|
||||
|
||||
final List<MvwSitArtUdcDetInventarioDTO> giacenzaItems = wmsGiacenzaULService.retrieveArtsInGiacenzaByPosition(multiDBTransactionManager.getPrimaryConnection(), posizione.getPosizione());
|
||||
|
||||
if (giacenzaItems != null) {
|
||||
oldUdc.setMtbColr(WMSUtility.convertMvwItemsToMtbColrs(giacenzaItems));
|
||||
|
||||
WMSUtility.spostaArtsTraUL(multiDBTransactionManager.getPrimaryConnection(),
|
||||
oldUdc, newUdc, false, entityProcessor, RequestDataDTO.systemMockupData());
|
||||
|
||||
}
|
||||
|
||||
//remove position from old UL
|
||||
UtilityDB.executeStatement(multiDBTransactionManager.getPrimaryConnection(),
|
||||
"UPDATE mtb_colt SET posizione = NULL " +
|
||||
"WHERE gestione = " + UtilityDB.valueToString(oldUdc.getGestione()) + " " +
|
||||
"AND data_collo = " + UtilityDB.valueToString(oldUdc.getDataCollo()) + " " +
|
||||
"AND ser_collo = " + UtilityDB.valueToString(oldUdc.getSerCollo()) + " " +
|
||||
"AND num_collo = " + UtilityDB.valueToString(oldUdc.getNumCollo())
|
||||
);
|
||||
|
||||
//save all
|
||||
}
|
||||
|
||||
} catch (Exception ex) {
|
||||
multiDBTransactionManager.rollbackAll();
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
package it.integry.ems.retail.wms.inventario.service;
|
||||
|
||||
import it.integry.common.var.CommonConstants;
|
||||
import it.integry.ems.jpa.repository.MtbUntMisRepository;
|
||||
import it.integry.ems.json.ResponseJSONObjectMapper;
|
||||
import it.integry.ems.product.importaz.service.ProductServices;
|
||||
import it.integry.ems.retail.pvmRetail.dto.PvmArticoliChildDTO;
|
||||
import it.integry.ems.retail.pvmRetail.dto.PvmArticoliDTO;
|
||||
import it.integry.ems.retail.pvmRetail.service.PvmService;
|
||||
import it.integry.ems.retail.wms.Utility.WMSUtility;
|
||||
import it.integry.ems.retail.wms.inventario.dto.InventarioArtDTO;
|
||||
import it.integry.ems.service.EntityProcessor;
|
||||
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
|
||||
@@ -58,6 +58,8 @@ public class WMSInventarioService {
|
||||
|
||||
@Autowired
|
||||
private ResponseJSONObjectMapper jsonObjectMapper;
|
||||
@Autowired
|
||||
private MtbUntMisRepository mtbUntMisRepository;
|
||||
|
||||
|
||||
public MtbInvent loadInventarioIfExists(int inventoryId, String codMdep) throws Exception {
|
||||
@@ -136,7 +138,7 @@ public class WMSInventarioService {
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
|
||||
final List<MtbUntMis> untMisFromCod = WMSUtility.getUntMisFromCod(untMiss,multiDBTransactionManager.getPrimaryConnection());
|
||||
final List<MtbUntMis> untMisFromCod = mtbUntMisRepository.findByUntMisIn(untMiss);
|
||||
|
||||
for (InventarioArtDTO art : arts) {
|
||||
final MtbUntMis mtbUntMis = untMisFromCod.stream().filter(x -> x.getUntMis().equalsIgnoreCase(art.getUntMis()))
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.annimon.stream.Stream;
|
||||
import it.integry.ems.document.dto.ProduzioneOrdineDTO;
|
||||
import it.integry.ems.document.dto.ScarichiArticoloDTO;
|
||||
import it.integry.ems.javabeans.RequestDataDTO;
|
||||
import it.integry.ems.jpa.repository.MtbAartRepository;
|
||||
import it.integry.ems.logistic.dto.sm2.FiltroDistribuzioneColloDTO;
|
||||
import it.integry.ems.product.importaz.service.ProductServices;
|
||||
import it.integry.ems.retail.wms.Utility.WMSUtility;
|
||||
@@ -74,6 +75,8 @@ public class WMSLavorazioneService {
|
||||
|
||||
@Autowired
|
||||
private AziendaService aziendaService;
|
||||
@Autowired
|
||||
private MtbAartRepository mtbAartRepository;
|
||||
|
||||
public MtbColt createUDS(CreateUDSRequestDTO createUDSRequestDTO) throws Exception {
|
||||
|
||||
@@ -264,9 +267,9 @@ public class WMSLavorazioneService {
|
||||
entityProcessor.processEntity(targetMtbColt, true, multiDBTransactionManager);
|
||||
|
||||
|
||||
MtbAart mtbAart = WMSUtility.getArticoloByCodMart(insertUDSRowRequestDTO.getCodMart(), multiDBTransactionManager.getPrimaryConnection());
|
||||
if (mtbAart == null)
|
||||
throw new InvalidArticoloException(insertUDSRowRequestDTO.getCodMart());
|
||||
MtbAart mtbAart = mtbAartRepository.findByCodMart(insertUDSRowRequestDTO.getCodMart())
|
||||
.orElseThrow(() -> new InvalidArticoloException(insertUDSRowRequestDTO.getCodMart()));
|
||||
|
||||
|
||||
MtbColrInfoProd mtbColrInfoProd = null;
|
||||
|
||||
@@ -350,7 +353,8 @@ public class WMSLavorazioneService {
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
|
||||
List<MtbAart> mtbAarts = productServices.getArticoliByCodMarts(codMarts);
|
||||
|
||||
List<MtbAart> mtbAarts = mtbAartRepository.findByCodMartIn(codMarts);
|
||||
|
||||
//Prendo solo la chiave
|
||||
MtbColt targetMtbColt = new MtbColt()
|
||||
@@ -605,7 +609,7 @@ public class WMSLavorazioneService {
|
||||
.setCodMdep(createUDCRequestDTO.getCodMdep())
|
||||
.setCodVdes(createUDCRequestDTO.getCodVdes())
|
||||
.setOraInizPrep(new Date())
|
||||
.setPreparatoDa(UtilityString.isNull(createUDCRequestDTO.getPreparatoDa(),requestDataDTO.getUsername()))
|
||||
.setPreparatoDa(UtilityString.isNull(createUDCRequestDTO.getPreparatoDa(), requestDataDTO.getUsername()))
|
||||
.setPosizione(UtilityString.isNull(createUDCRequestDTO.getPosizione(), defaultPosizioneColliAccettazione))
|
||||
.setCodTcol(createUDCRequestDTO.getCodTcol())
|
||||
.setCodJfas(createUDCRequestDTO.getCodJfas())
|
||||
@@ -858,7 +862,7 @@ public class WMSLavorazioneService {
|
||||
|
||||
public String getEtichettaSSCCOrdine(DtbOrdt ordine) throws Exception {
|
||||
ordine.setOperation(OperationType.SELECT_OBJECT);
|
||||
entityProcessor.processEntity(ordine,true,multiDBTransactionManager);
|
||||
entityProcessor.processEntity(ordine, true, multiDBTransactionManager);
|
||||
if (UtilityString.isNullOrEmpty(ordine.getCodProd())) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package it.integry.ems.retail.wms.lavorazione.service;
|
||||
|
||||
import it.integry.ems.jpa.repository.MtbAartRepository;
|
||||
import it.integry.ems.production.service.MesProductionServiceV2;
|
||||
import it.integry.ems.retail.wms.Utility.WMSUtility;
|
||||
import it.integry.ems.retail.wms.exceptions.InvalidArticoloException;
|
||||
@@ -51,6 +52,8 @@ public class WMSMaterialiService {
|
||||
private UserSession userSession;
|
||||
|
||||
private final Logger logger = LogManager.getLogger();
|
||||
@Autowired
|
||||
private MtbAartRepository mtbAartRepository;
|
||||
|
||||
public VersaMaterialiResponseDTO versa(VersaMaterialiRequestDTO request) throws Exception {
|
||||
final boolean versamentoDirettoEnabled = setupGest.getSetupBoolean(multiDBTransactionManager.getPrimaryConnection(), "PICKING", "PRODUZIONE", "FLAG_VERSAMENTO_DIRETTO");
|
||||
@@ -93,9 +96,8 @@ public class WMSMaterialiService {
|
||||
if (!versamentoDirettoEnabled) {
|
||||
MvwSitArtUdcDetInventarioDTO itemDaVersare = artsInGiacenza.get(0);
|
||||
|
||||
MtbAart mtbAart = WMSUtility.getArticoloByCodMart(itemDaVersare.getCodMart(), multiDBTransactionManager.getPrimaryConnection());
|
||||
if (mtbAart == null)
|
||||
throw new InvalidArticoloException(request.getCodMart());
|
||||
MtbAart mtbAart = mtbAartRepository.findByCodMart(itemDaVersare.getCodMart())
|
||||
.orElseThrow(() -> new InvalidArticoloException(request.getCodMart()));
|
||||
|
||||
if (posizioneVersamento == null)
|
||||
throw new Exception("Posizione di versamento non trovata (" + request.getPosizioneVersamento() + ")");
|
||||
@@ -134,7 +136,7 @@ public class WMSMaterialiService {
|
||||
// throw new Exception("Impossibile recuperare le informazioni della posizione (" + request.getPosizioneVersamento() + ")");
|
||||
//
|
||||
// for(MvwSitArtUdcDetInventarioDTO artInGiacenza : artsInGiacenza) {
|
||||
// final MtbAart currentArtAnag = WMSUtility.getArticoloByCodMart(artInGiacenza.getCodMart(), multiDBTransactionManager.getPrimaryConnection());
|
||||
// final MtbAart currentArtAnag = MtbAartUtils.getArticoloByCodMart(artInGiacenza.getCodMart(), multiDBTransactionManager.getPrimaryConnection());
|
||||
//
|
||||
// if(currentArtAnag == null)
|
||||
// continue;
|
||||
@@ -275,9 +277,8 @@ public class WMSMaterialiService {
|
||||
final boolean versamentoDirettoEnabled = setupGest.getSetupBoolean(multiDBTransactionManager.getPrimaryConnection(), "PICKING", "PRODUZIONE", "FLAG_VERSAMENTO_DIRETTO");
|
||||
final boolean forceAllToColli = setupGest.getSetupBoolean(multiDBTransactionManager.getPrimaryConnection(), "PICKING", "SETUP", "FLAG_FORCE_ALL_TO_COLLI");
|
||||
|
||||
MtbAart mtbAart = WMSUtility.getArticoloByCodMart(request.getCodMart(), multiDBTransactionManager.getPrimaryConnection());
|
||||
if (mtbAart == null)
|
||||
throw new InvalidArticoloException(request.getCodMart());
|
||||
MtbAart mtbAart = mtbAartRepository.findByCodMart(request.getCodMart())
|
||||
.orElseThrow(() -> new InvalidArticoloException(request.getCodMart()));
|
||||
|
||||
if (request.getMtbColtCarico() == null)
|
||||
throw new Exception("Indicare una UL in cui effettuare il carico del materiale");
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package it.integry.ems.retail.wms.vendita.service;
|
||||
|
||||
import it.integry.ems.javabeans.RequestDataDTO;
|
||||
import it.integry.ems.jpa.repository.MtbAartRepository;
|
||||
import it.integry.ems.logistic.dto.sm2.FiltroDistribuzioneColloDTO;
|
||||
import it.integry.ems.product.importaz.service.ProductServices;
|
||||
import it.integry.ems.retail.pvmRetail.dto.OrdineInevasoDTO;
|
||||
@@ -70,6 +71,8 @@ public class WMSSpedizioneService {
|
||||
|
||||
@Autowired
|
||||
private PvmServiceSave pvmServiceSave;
|
||||
@Autowired
|
||||
private MtbAartRepository mtbAartRepository;
|
||||
|
||||
public MtbColt createUDS(CreateUDSRequestDTO createUDSRequestDTO) throws Exception {
|
||||
|
||||
@@ -244,10 +247,8 @@ public class WMSSpedizioneService {
|
||||
entityProcessor.processEntity(targetMtbColt, multiDBTransactionManager);
|
||||
|
||||
|
||||
MtbAart mtbAart = WMSUtility.getArticoloByCodMart(insertUDSRowRequestDTO.getCodMart(), multiDBTransactionManager.getPrimaryConnection());
|
||||
if (mtbAart == null)
|
||||
throw new InvalidArticoloException(insertUDSRowRequestDTO.getCodMart());
|
||||
|
||||
MtbAart mtbAart = mtbAartRepository.findByCodMart(insertUDSRowRequestDTO.getCodMart())
|
||||
.orElseThrow(() -> new InvalidArticoloException(insertUDSRowRequestDTO.getCodMart()));
|
||||
|
||||
final MtbColr targetMtbColr = new MtbColr()
|
||||
.setCausale(MtbColr.Causale.DEFAULT)
|
||||
|
||||
@@ -106,6 +106,7 @@ public class ExchangeArticoliImportService {
|
||||
x.getMtbAartBarCode().forEach(y -> y.setOperation(y.getOperation() == OperationType.INSERT ? OperationType.INSERT_OR_UPDATE : y.getOperation()));
|
||||
x.getMtbAartCarat().forEach(y -> y.setOperation(y.getOperation() == OperationType.INSERT ? OperationType.INSERT_OR_UPDATE : y.getOperation()));
|
||||
x.getMtbAartColori().forEach(y -> y.setOperation(y.getOperation() == OperationType.INSERT ? OperationType.INSERT_OR_UPDATE : y.getOperation()));
|
||||
x.getMtbAartDesc().forEach(y -> y.setOperation(y.getOperation() == OperationType.INSERT ? OperationType.INSERT_OR_UPDATE : y.getOperation()));
|
||||
});
|
||||
|
||||
final Exception[] firstExceptionToThrow = {null};
|
||||
@@ -150,6 +151,7 @@ public class ExchangeArticoliImportService {
|
||||
final List<MtbAartBarCode> mtbAartBarCode = retrieveMtbAartBarcode(connection, retrieveAlreadyImported, useTempTable);
|
||||
final List<MtbAartColori> mtbAartColori = retrieveMtbAartColori(connection, retrieveAlreadyImported, useTempTable);
|
||||
final List<MtbAartCarat> mtbAartCarat = retrieveMtbAartCarat(connection, retrieveAlreadyImported, useTempTable);
|
||||
final List<MtbAartDesc> mtbAartDesc = retrieveMtbAartDesc(connection, retrieveAlreadyImported, useTempTable);
|
||||
|
||||
mtbAart
|
||||
.parallelStream()
|
||||
@@ -162,6 +164,10 @@ public class ExchangeArticoliImportService {
|
||||
.filter(y -> y.getCodMart().equalsIgnoreCase(x.getCodMart()))
|
||||
.collect(Collectors.toList()))
|
||||
.setMtbAartCarat(mtbAartCarat.stream()
|
||||
.map(y -> y)
|
||||
.filter(y -> y.getCodMart().equalsIgnoreCase(x.getCodMart()))
|
||||
.collect(Collectors.toList()))
|
||||
.setMtbAartDesc(mtbAartDesc.stream()
|
||||
.map(y -> y)
|
||||
.filter(y -> y.getCodMart().equalsIgnoreCase(x.getCodMart()))
|
||||
.collect(Collectors.toList())));
|
||||
@@ -178,13 +184,38 @@ public class ExchangeArticoliImportService {
|
||||
|
||||
exchangeImportDataManagerService.updateImportedStatus(connection, "mtb_aart", importedKey, useTempTable);
|
||||
|
||||
final List<HashMap<String, Object>> importedMtbSgrpKeys = importedMtbAart.getMtbAartColori().stream()
|
||||
final List<HashMap<String, Object>> importedMtbAartColori = importedMtbAart.getMtbAartColori().stream()
|
||||
.map(x -> new HashMap<String, Object>() {{
|
||||
put("cod_col", x.getCodCol());
|
||||
}})
|
||||
.collect(Collectors.toList());
|
||||
|
||||
exchangeImportDataManagerService.updateImportedStatus(connection, "mtb_aart_colori", importedMtbSgrpKeys, useTempTable);
|
||||
exchangeImportDataManagerService.updateImportedStatus(connection, "mtb_aart_colori", importedMtbAartColori, useTempTable);
|
||||
|
||||
final List<HashMap<String, Object>> importedMtbAartCarat = importedMtbAart.getMtbAartCarat().stream()
|
||||
.map(x -> new HashMap<String, Object>() {{
|
||||
put("carat", x.getCarat());
|
||||
}})
|
||||
.collect(Collectors.toList());
|
||||
|
||||
exchangeImportDataManagerService.updateImportedStatus(connection, "mtb_aart_carat", importedMtbAartCarat, useTempTable);
|
||||
|
||||
final List<HashMap<String, Object>> importedMtbAartBarcode = importedMtbAart.getMtbAartBarCode().stream()
|
||||
.map(x -> new HashMap<String, Object>() {{
|
||||
put("cod_barre", x.getCodBarre());
|
||||
}})
|
||||
.collect(Collectors.toList());
|
||||
|
||||
exchangeImportDataManagerService.updateImportedStatus(connection, "mtb_aart_bar_code", importedMtbAartBarcode, useTempTable);
|
||||
|
||||
|
||||
final List<HashMap<String, Object>> importedMtbAartDesc = importedMtbAart.getMtbAartDesc().stream()
|
||||
.map(x -> new HashMap<String, Object>() {{
|
||||
put("cod_lingua", x.getCodLingua());
|
||||
}})
|
||||
.collect(Collectors.toList());
|
||||
|
||||
exchangeImportDataManagerService.updateImportedStatus(connection, "mtb_aart_desc", importedMtbAartDesc, useTempTable);
|
||||
}
|
||||
|
||||
|
||||
@@ -677,7 +708,7 @@ public class ExchangeArticoliImportService {
|
||||
false, useTempTable);
|
||||
|
||||
List<EquatableEntityInterface> allData = exchangeImportDataManagerService
|
||||
.runSync(MtbAartMarchio.class, exchangeImportedData, exchangeUpdatedData);
|
||||
.runSync(MtbTipi.class, exchangeImportedData, exchangeUpdatedData);
|
||||
|
||||
allData.forEach(x -> x.setOperation(x.getOperation() == OperationType.INSERT ? OperationType.INSERT_OR_UPDATE : x.getOperation()));
|
||||
|
||||
@@ -993,5 +1024,22 @@ public class ExchangeArticoliImportService {
|
||||
tableName, null, retrieveAlreadyImported);
|
||||
}
|
||||
|
||||
private List<MtbAartDesc> retrieveMtbAartDesc(Connection connection, boolean retrieveAlreadyImported, boolean useTempTable) throws Exception {
|
||||
String originalTableName = "mtb_aart_desc";
|
||||
String tableName = originalTableName + (useTempTable ? "_tmp" : "");
|
||||
|
||||
|
||||
if (useTempTable) {
|
||||
UtilityDB.executeStatement(connection,
|
||||
"INSERT INTO " + tableName +
|
||||
" SELECT * FROM " + originalTableName
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
return exchangeImportDataManagerService.retrieveDataFromExchange(connection, MtbAartDesc.class,
|
||||
tableName, null, retrieveAlreadyImported);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -108,6 +108,7 @@ public class ExchangeImportSchemaManagerService {
|
||||
put("mtb_aart_bar_code", MtbAartBarCode.class);
|
||||
put("mtb_aart_carat", MtbAartCarat.class);
|
||||
put("mtb_aart_equi", MtbAartEqui.class);
|
||||
put("mtb_aart_desc", MtbAartDesc.class);
|
||||
}});
|
||||
put(SchemaType.PartiteMagazzinoLavorazione, new HashMap<String, Class<? extends EntityInterface>>() {{
|
||||
put("mtb_partita_mag_lav", MtbPartitaMag.class);
|
||||
|
||||
5
ems-engine/src/main/resources/configs/jpa.properties
Normal file
5
ems-engine/src/main/resources/configs/jpa.properties
Normal file
@@ -0,0 +1,5 @@
|
||||
hibernate.dialect=org.hibernate.dialect.SQLServer2012Dialect
|
||||
hibernate.show_sql=false
|
||||
hibernate.format_sql=false
|
||||
hibernate.hbm2ddl.auto=none
|
||||
|
||||
@@ -84,6 +84,15 @@
|
||||
<!-- <!– JBoss RESTEasy Loggers –>-->
|
||||
<!-- <AsyncLogger name="org.jboss.resteasy" level="INFO" additivity="false"/>-->
|
||||
|
||||
<!-- <AsyncLogger name="org.hibernate.cache" level="DEBUG" additivity="false" includeLocation="true">-->
|
||||
<!-- <AppenderRef ref="console" />-->
|
||||
<!-- </AsyncLogger>-->
|
||||
|
||||
<!-- <!– Hibernate Statistics Logger –>-->
|
||||
<!-- <AsyncLogger name="org.hibernate.stat" level="DEBUG" additivity="false" includeLocation="true">-->
|
||||
<!-- <AppenderRef ref="console" />-->
|
||||
<!-- </AsyncLogger>-->
|
||||
|
||||
<!-- Application Logger -->
|
||||
<AsyncLogger name="it.integry" level="DEBUG" additivity="false" includeLocation="true">
|
||||
<AppenderRef ref="console" />
|
||||
|
||||
@@ -11,6 +11,8 @@
|
||||
http://www.springframework.org/schema/mvc/spring-mvc-4.3.xsd">
|
||||
<context:component-scan base-package="it.integry"/>
|
||||
|
||||
<import resource="hibernate-context.xml"/>
|
||||
|
||||
<bean id="ppConfig" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
|
||||
<property name="ignoreUnresolvablePlaceholders" value="false"/>
|
||||
<property name="locations">
|
||||
|
||||
62
ems-engine/src/main/resources/spring/hibernate-context.xml
Normal file
62
ems-engine/src/main/resources/spring/hibernate-context.xml
Normal file
@@ -0,0 +1,62 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:jpa="http://www.springframework.org/schema/data/jpa"
|
||||
xmlns:tx="http://www.springframework.org/schema/tx"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||
http://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://www.springframework.org/schema/data/jpa
|
||||
http://www.springframework.org/schema/data/jpa/spring-jpa.xsd
|
||||
http://www.springframework.org/schema/tx
|
||||
http://www.springframework.org/schema/tx/spring-tx.xsd">
|
||||
|
||||
<!-- MultiTenant DataSource -->
|
||||
<bean id="multiTenantDataSource" class="it.integry.ems.jpa.MultiTenantDataSource">
|
||||
<constructor-arg ref="basicConnectionPool"/>
|
||||
<constructor-arg ref="settingsModel"/>
|
||||
</bean>
|
||||
|
||||
<!-- JPA EntityManagerFactory -->
|
||||
<bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
|
||||
<property name="dataSource" ref="multiTenantDataSource"/>
|
||||
<property name="packagesToScan">
|
||||
<list>
|
||||
<value>it.integry.ems_model.entity</value>
|
||||
</list>
|
||||
</property>
|
||||
<property name="jpaVendorAdapter">
|
||||
<bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
|
||||
<property name="showSql" value="false"/>
|
||||
<property name="generateDdl" value="false"/> <!-- Disabilitato per sicurezza su DB esistenti -->
|
||||
</bean>
|
||||
</property>
|
||||
<property name="jpaProperties">
|
||||
<props>
|
||||
<prop key="hibernate.dialect">${hibernate.dialect}</prop>
|
||||
<prop key="hibernate.temp.use_jdbc_metadata_defaults">false</prop> <!-- Per startup più veloce -->
|
||||
<prop key="hibernate.jdbc.lob.non_contextual_creation">true</prop>
|
||||
|
||||
<!-- Cache Configuration -->
|
||||
<!-- La cache di livello 1 (Session Cache) è sempre abilitata in Hibernate e non può essere disattivata. -->
|
||||
<!-- Disabilitiamo esplicitamente la cache di livello 2 per evitare confusioni. -->
|
||||
<prop key="hibernate.cache.use_second_level_cache">false</prop>
|
||||
|
||||
<!-- Abilita le statistiche di Hibernate per monitorare la cache di livello 1 -->
|
||||
<prop key="hibernate.generate_statistics">true</prop>
|
||||
</props>
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<!-- Transaction Manager -->
|
||||
<bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
|
||||
<property name="entityManagerFactory" ref="entityManagerFactory"/>
|
||||
</bean>
|
||||
|
||||
<!-- Abilita i repository JPA -->
|
||||
<jpa:repositories base-package="it.integry.ems.jpa.repository"/>
|
||||
|
||||
<!-- Abilita la gestione delle transazioni tramite annotazioni -->
|
||||
<tx:annotation-driven transaction-manager="transactionManager"/>
|
||||
|
||||
</beans>
|
||||
|
||||
Reference in New Issue
Block a user