Compare commits
149 Commits
feature-re
...
feature-re
| Author | SHA1 | Date | |
|---|---|---|---|
| e6d0f236c3 | |||
| b7ac9ce072 | |||
| 164b2e60f3 | |||
| b88f0a3c7d | |||
| 562116cb54 | |||
| 76d07ec9b0 | |||
| 454eb8c3c0 | |||
| b10bc86db0 | |||
| 3a95372f18 | |||
| 030d635dcd | |||
| 8ca15e4378 | |||
| 773611c978 | |||
| 8fb8e4c05a | |||
| 9b26849cb6 | |||
| c9104967cd | |||
| 6b0a1afc0b | |||
| 92e9f6fde7 | |||
| b17d807ca3 | |||
| 4957cba34b | |||
| 61d0a62004 | |||
| a99ccc5170 | |||
| 5c60cd2558 | |||
| 5a824d0b3a | |||
| 3218cca2cc | |||
| 5870865ce7 | |||
| 6a190cde08 | |||
| 9a2a77cc77 | |||
| 70f11c559f | |||
| 4ee64127b1 | |||
| be4c2d149e | |||
| ccb8b81597 | |||
| 68a45a9eea | |||
| 8fe752e595 | |||
| 71ffc5b4cf | |||
| cc189f4761 | |||
| bd3bf9a8dc | |||
| a2edd0f29c | |||
| dd62a4f5e0 | |||
| a2cdc5c52c | |||
| 7fd4b6236c | |||
| 5075e17078 | |||
| 656f2018a2 | |||
| 2b4cea4ada | |||
| 72ebb39b22 | |||
| 8e01509e99 | |||
| 18da8c2763 | |||
| a770e150a4 | |||
| 0646fd6943 | |||
| 72059e4623 | |||
| db5ee20a39 | |||
| 35621cadf2 | |||
| 04f1a9e2e6 | |||
| 7b40578ea4 | |||
| 9685bff5ef | |||
| bfa48cbbb1 | |||
| 4f2b251d20 | |||
| a1f1ffba95 | |||
| 1ab59fa9a6 | |||
| 800407ebd7 | |||
| 3dad6790fc | |||
| d073a8fd17 | |||
| a9068c45cd | |||
| ca78b09ad8 | |||
| 3e17a7239a | |||
| d78597cba4 | |||
| 91f28a8c82 | |||
| 03a7877899 | |||
| 46e8a19c53 | |||
| 81a42fc1d9 | |||
| fdbcc0c539 | |||
| 7d51ddb868 | |||
| 9f25bd2bf6 | |||
| a9ce0d82b6 | |||
| 83d2f329ce | |||
| 7e06512598 | |||
| b5776e82c9 | |||
| 05dd42b0bf | |||
| 636774ed86 | |||
| 6649af6e92 | |||
| acfff8e8d6 | |||
| 44c1bd7cee | |||
| 7f878b9a2e | |||
| e2b56e37d4 | |||
| c712e729cc | |||
| 7956a895d2 | |||
| b684129f39 | |||
| 1b339289c1 | |||
| b246991600 | |||
| dc578d1f17 | |||
| 6c6f6d4d7e | |||
| 50dcb999f1 | |||
| c656cc95de | |||
| 0b0b5bbf33 | |||
| c2310327d2 | |||
| 9962471f71 | |||
| 8ad86f71d3 | |||
| 3a42baab00 | |||
| a1bfd0150c | |||
| 2e420fc540 | |||
| f591246ae3 | |||
| c0d181fbfa | |||
| d4c02cf504 | |||
| e15878a9eb | |||
| 39f43b3361 | |||
| 18a6756860 | |||
| 3640b08041 | |||
| 928d47f772 | |||
| 28478cb11d | |||
| 0c48df7895 | |||
| 6766e8e964 | |||
| 327f5af3dd | |||
| 62234f2edf | |||
| 2fcba55965 | |||
| d29768776a | |||
| 3dcf6d3ee0 | |||
| 7c2aa55eb8 | |||
| e92d64a05e | |||
| b46f26790d | |||
| c364d57e86 | |||
| 6d89e4d09b | |||
| acba051357 | |||
| 21a189ea66 | |||
| 3a4a11d9e8 | |||
| 185d403d7a | |||
| 85ed6b54f9 | |||
| 9b6b0c87aa | |||
| fd68a9b73a | |||
| 433ab4b0ec | |||
| df9fbc7f65 | |||
| a8253614b4 | |||
| 9977cae821 | |||
| 344010ed90 | |||
| 1c51fb717a | |||
| 81827a8368 | |||
| 21222a25e9 | |||
| d24a033e01 | |||
| 5e76d8db2a | |||
| bae92e626b | |||
| 0d471db37d | |||
| c4c6875e16 | |||
| 3515e5c976 | |||
| 84a6f4c4f1 | |||
| ee9ec1a8a7 | |||
| 1884a9184e | |||
| caa62588b6 | |||
| 8bb9803f5b | |||
| ea27c26597 | |||
| 80aaa94036 | |||
| a82c0de415 |
1701
.idea/inspectionProfiles/LocalDate_passato_a_SimpleDate.xml
generated
Normal file
1701
.idea/inspectionProfiles/LocalDate_passato_a_SimpleDate.xml
generated
Normal file
File diff suppressed because it is too large
Load Diff
10
.idea/structuralSearch.xml
generated
Normal file
10
.idea/structuralSearch.xml
generated
Normal file
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="StructuralSearch">
|
||||
<searchConfiguration name="LocalDate passato a SimpleDateFormat" text="$formatter$.format($date$)" recursive="true" caseInsensitive="true" type="JAVA" pattern_context="default">
|
||||
<constraint name="__context__" within="" contains="" />
|
||||
<constraint name="formatter" nameOfExprType="java\.text\.SimpleDateFormat" within="" contains="" />
|
||||
<constraint name="date" nameOfExprType="java\.time\.LocalDate" within="" contains="" />
|
||||
</searchConfiguration>
|
||||
</component>
|
||||
</project>
|
||||
@@ -115,8 +115,8 @@ public class DataSource extends BasicDataSource {
|
||||
|
||||
// Validazione veloce ed efficiente
|
||||
this.setValidationQuery("SELECT 1");
|
||||
// this.setValidationQueryTimeout(60); // Ridotto a 1 secondo
|
||||
// this.setTestWhileIdle(true); // Testa connessioni idle
|
||||
this.setValidationQueryTimeout(30); // Ridotto a 1 secondo
|
||||
this.setTestWhileIdle(true); // Testa connessioni idle
|
||||
|
||||
// Eviction ottimizzata per READ_UNCOMMITTED
|
||||
// this.setTimeBetweenEvictionRunsMillis(1 * 1000); // Ogni 30 secondi
|
||||
|
||||
@@ -132,7 +132,7 @@ public class DbmsChangeTracker {
|
||||
|
||||
final List<String> trackedTables = retrieveTrackedTables();
|
||||
|
||||
HashMap<Long, DetectedChangeDataDTO> changesByVersion = new HashMap<>();
|
||||
HashMap<Long, List<DetectedChangeDataDTO>> changesByVersion = new HashMap<>();
|
||||
|
||||
for (String trackedTable : trackedTables) {
|
||||
long minValidVersion = getMinValidVersion(trackedTable);
|
||||
@@ -140,13 +140,12 @@ public class DbmsChangeTracker {
|
||||
throw new SQLException("Change Tracking on table " + trackedTable + " has been reset. Current version: " + currentVersion + ", Min valid version: " + minValidVersion);
|
||||
}
|
||||
|
||||
|
||||
final List<DetectedChangeDataDTO> detectedChanges = retrieveChangeList(trackedTable);
|
||||
|
||||
detectedChanges.forEach(detectedChangeDataDTO -> {
|
||||
changesByVersion.put(detectedChangeDataDTO.getSysChangeVersion(), detectedChangeDataDTO);
|
||||
changesByVersion.putIfAbsent(detectedChangeDataDTO.getSysChangeVersion(), new ArrayList<>());
|
||||
changesByVersion.get(detectedChangeDataDTO.getSysChangeVersion()).add(detectedChangeDataDTO);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
logTrace("Detected " + changesByVersion.size() + " changes since version " + currentVersion);
|
||||
@@ -154,32 +153,33 @@ public class DbmsChangeTracker {
|
||||
dispatchChanges(changesByVersion);
|
||||
}
|
||||
|
||||
private void dispatchChanges(HashMap<Long, DetectedChangeDataDTO> changesByVersion) throws Exception {
|
||||
private void dispatchChanges(HashMap<Long, List<DetectedChangeDataDTO>> changesByVersion) throws Exception {
|
||||
final List<Long> sortedChanges = changesByVersion.keySet().stream()
|
||||
.sorted()
|
||||
.collect(Collectors.toList());
|
||||
|
||||
|
||||
for (Long changeId : sortedChanges) {
|
||||
final DetectedChangeDataDTO detectedChange = changesByVersion.get(changeId);
|
||||
final List<DetectedChangeDataDTO> detectedChanges = changesByVersion.get(changeId);
|
||||
|
||||
switch (detectedChange.getSysChangeOperation()) {
|
||||
case INSERT:
|
||||
if (eventListener != null)
|
||||
eventListener.onInsertDetected(detectedChange.getTableName(), detectedChange.getPrimaryKey());
|
||||
break;
|
||||
for (DetectedChangeDataDTO detectedChange : detectedChanges) {
|
||||
switch (detectedChange.getSysChangeOperation()) {
|
||||
case INSERT:
|
||||
if (eventListener != null)
|
||||
eventListener.onInsertDetected(detectedChange.getTableName(), detectedChange.getPrimaryKey());
|
||||
break;
|
||||
|
||||
case UPDATE:
|
||||
if (eventListener != null)
|
||||
eventListener.onUpdateDetected(detectedChange.getTableName(), detectedChange.getPrimaryKey());
|
||||
break;
|
||||
case UPDATE:
|
||||
if (eventListener != null)
|
||||
eventListener.onUpdateDetected(detectedChange.getTableName(), detectedChange.getPrimaryKey());
|
||||
break;
|
||||
|
||||
case DELETE:
|
||||
if (eventListener != null)
|
||||
eventListener.onDeleteDetected(detectedChange.getTableName(), detectedChange.getPrimaryKey());
|
||||
break;
|
||||
case DELETE:
|
||||
if (eventListener != null)
|
||||
eventListener.onDeleteDetected(detectedChange.getTableName(), detectedChange.getPrimaryKey());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
currentVersion = changeId;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,14 +9,12 @@ import it.integry.ems.migration._base.IntegryCustomerDB;
|
||||
import it.integry.ems.sync.MultiDBTransaction.Connection;
|
||||
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
|
||||
import it.integry.ems_model.entity.*;
|
||||
import it.integry.ems_model.exception.DataConverterNotFoundException;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.springframework.context.ApplicationEventPublisher;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
@@ -32,6 +30,7 @@ public class DbmsChangeTrackerComponent {
|
||||
add(MtbAart.ENTITY);
|
||||
add(MtbAartBarCode.ENTITY);
|
||||
add(MtbUntMis.ENTITY);
|
||||
add(MtbDepo.ENTITY);
|
||||
add(StbEditLimit.ENTITY);
|
||||
add(StbGestSetup.ENTITY);
|
||||
add(StbGestSetupDepo.ENTITY);
|
||||
@@ -49,7 +48,7 @@ public class DbmsChangeTrackerComponent {
|
||||
}
|
||||
|
||||
|
||||
@PostContextConstruct
|
||||
@PostContextConstruct(priority = 10)
|
||||
public void init() throws Exception {
|
||||
for (Connection conn : multiDBTransactionManager.getActiveConnections()) {
|
||||
IntegryCustomerDB customerDB = IntegryCustomerDB.parse(conn.getDbName());
|
||||
@@ -60,37 +59,42 @@ public class DbmsChangeTrackerComponent {
|
||||
}
|
||||
|
||||
|
||||
private void enableAllChangeTracking() throws SQLException, DataConverterNotFoundException, InstantiationException, IllegalAccessException {
|
||||
private void enableAllChangeTracking() throws Exception {
|
||||
for (Map.Entry<IntegryCustomerDB, DbmsChangeTracker> entrySet : activeChangeTrackers.entrySet()) {
|
||||
IntegryCustomerDB customerDB = entrySet.getKey();
|
||||
DbmsChangeTracker dbmsChangeTracker = entrySet.getValue();
|
||||
|
||||
dbmsChangeTracker.enableTrackerInDbms();
|
||||
try {
|
||||
|
||||
for (String tableName : trackedTables) {
|
||||
dbmsChangeTracker.enableTrackerOnTable(tableName);
|
||||
dbmsChangeTracker.enableTrackerInDbms();
|
||||
|
||||
for (String tableName : trackedTables) {
|
||||
dbmsChangeTracker.enableTrackerOnTable(tableName);
|
||||
}
|
||||
|
||||
dbmsChangeTracker.disableTrackerOnNotUsedTables(trackedTables);
|
||||
|
||||
dbmsChangeTracker.setEventListener(new DbmsChangeTracker.Listener() {
|
||||
@Override
|
||||
public void onInsertDetected(String tableName, HashMap<String, Object> primaryKey) {
|
||||
onItemInserted(customerDB, tableName, primaryKey);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdateDetected(String tableName, HashMap<String, Object> primaryKey) {
|
||||
onItemUpdated(customerDB, tableName, primaryKey);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDeleteDetected(String tableName, HashMap<String, Object> primaryKey) {
|
||||
onItemDeleted(customerDB, tableName, primaryKey);
|
||||
}
|
||||
});
|
||||
|
||||
dbmsChangeTracker.startTracking();
|
||||
} catch (Exception e) {
|
||||
throw new Exception("Errore durante l'abilitazione del DbmsChangeTracker per il customer: " + customerDB.getValue(), e);
|
||||
}
|
||||
|
||||
dbmsChangeTracker.disableTrackerOnNotUsedTables(trackedTables);
|
||||
|
||||
dbmsChangeTracker.setEventListener(new DbmsChangeTracker.Listener() {
|
||||
@Override
|
||||
public void onInsertDetected(String tableName, HashMap<String, Object> primaryKey) {
|
||||
onItemInserted(customerDB, tableName, primaryKey);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdateDetected(String tableName, HashMap<String, Object> primaryKey) {
|
||||
onItemUpdated(customerDB, tableName, primaryKey);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDeleteDetected(String tableName, HashMap<String, Object> primaryKey) {
|
||||
onItemDeleted(customerDB, tableName, primaryKey);
|
||||
}
|
||||
});
|
||||
|
||||
dbmsChangeTracker.startTracking();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ public class DevicesRequestInterceptor implements HandlerInterceptor {
|
||||
RequestDataDTO requestDataDTO = ContextLoader.getCurrentWebApplicationContext().getBean(RequestDataDTO.class);
|
||||
|
||||
if (requestDataDTO.isValidProfileDB() && requestDataDTO.isValidDeviceId()) {
|
||||
deviceService.updateUsage(requestDataDTO.getApplication(), requestDataDTO.getDeviceId());
|
||||
deviceService.updateUsage(requestDataDTO.getDeviceId());
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -47,6 +47,7 @@ public class EntityCacheComponent implements ApplicationListener {
|
||||
put(MtbAart.ENTITY, MtbAart.class);
|
||||
put(MtbAartBarCode.ENTITY, MtbAartBarCode.class);
|
||||
put(MtbUntMis.ENTITY, MtbUntMis.class);
|
||||
put(MtbDepo.ENTITY, MtbDepo.class);
|
||||
put(StbEditLimit.ENTITY, StbEditLimit.class);
|
||||
put(StbGestSetup.ENTITY, StbGestSetup.class);
|
||||
put(StbGestSetupDepo.ENTITY, StbGestSetupDepo.class);
|
||||
@@ -63,7 +64,7 @@ public class EntityCacheComponent implements ApplicationListener {
|
||||
|
||||
@PostContextConstruct
|
||||
private void init() throws Exception {
|
||||
if (UtilityDebug.isDebugExecution())
|
||||
if (UtilityDebug.isDebugExecution() || UtilityDebug.isIntegryServer())
|
||||
return;
|
||||
|
||||
for (Connection conn : multiDBTransactionManager.getActiveConnections()) {
|
||||
@@ -111,7 +112,7 @@ public class EntityCacheComponent implements ApplicationListener {
|
||||
}
|
||||
|
||||
public <T extends EntityBase> Stream<T> getCachedEntitiesStream(IntegryCustomerDB customerDB, String tableName, Predicate<T> filterPredicate) {
|
||||
if (!isCacheEnabled(customerDB, tableName) && UtilityDebug.isDebugExecution()) {
|
||||
if (!isCacheEnabled(customerDB, tableName)) {
|
||||
try {
|
||||
refreshCacheForEntity(customerDB, tableName);
|
||||
} catch (Exception e) {
|
||||
@@ -241,7 +242,8 @@ public class EntityCacheComponent implements ApplicationListener {
|
||||
|
||||
|
||||
private boolean isCacheEnabled(IntegryCustomerDB customerDB, String tableName) {
|
||||
return entityCache.containsKey(customerDB) && entityCache.get(customerDB).containsKey(tableName);
|
||||
return (entityCache.containsKey(customerDB) && entityCache.get(customerDB).containsKey(tableName)) ||
|
||||
!(UtilityDebug.isDebugExecution() || UtilityDebug.isIntegryServer());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -75,6 +75,10 @@ public abstract class BaseMigration implements MigrationModelInterface {
|
||||
return UtilityDB.executeSimpleQueryDTO(connection, sql, clazz);
|
||||
}
|
||||
|
||||
protected @NotNull <T> List<T> executeQueryOnlyFirstColumn(String sql) throws SQLException {
|
||||
return UtilityDB.executeSimpleQueryOnlyFirstColumn(connection, sql);
|
||||
}
|
||||
|
||||
protected void executeStatement(String... sqls) throws SQLException {
|
||||
executeStatement(connection, sqls);
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ public enum IntegryCustomer {
|
||||
IntegryCustomerDB.Agricoper_IlVisone,
|
||||
IntegryCustomerDB.Agricoper_Luva),
|
||||
|
||||
ATI(IntegryCustomerDB.ATI_Finpart),
|
||||
ATI(IntegryCustomerDB.ATI, IntegryCustomerDB.ATI_Finpart),
|
||||
Auricchio(IntegryCustomerDB.Auricchio_Auricchio,
|
||||
IntegryCustomerDB.Auricchio_AuricchioMiki,
|
||||
IntegryCustomerDB.Auricchio_AuricchioSrl,
|
||||
|
||||
@@ -9,7 +9,9 @@ public enum IntegryCustomerDB {
|
||||
Agricoper_IlVisone("ilvisone"),
|
||||
Agricoper_Luva("luva"),
|
||||
|
||||
ATI("atisrl"),
|
||||
ATI_Finpart("Finpart"),
|
||||
|
||||
Auricchio_Auricchio("auricchio"),
|
||||
Auricchio_AuricchioMiki("auricchio_miki"),
|
||||
Auricchio_AuricchioSrl("auricchiosrl"),
|
||||
@@ -31,6 +33,7 @@ public enum IntegryCustomerDB {
|
||||
Carelli_Chiuso("chiuso"),
|
||||
Carelli_Format("format"),
|
||||
Carelli_Murgia("murgia"),
|
||||
Carelli_MurgiaTest("murgia_test"),
|
||||
Carelli_Panimal("panimal"),
|
||||
Carelli_Winact("winact"),
|
||||
Carelli_Csgr("csgr"),
|
||||
@@ -92,7 +95,7 @@ public enum IntegryCustomerDB {
|
||||
Gramm_Gramm("gramm_peppe"),
|
||||
Gramm_PrimeOlive("primeolive"),
|
||||
Gramm_ProveStage("grammprovestage"),
|
||||
Gramm_2MHolding("2M_HOLDING"),
|
||||
Gramm_2MHolding("dueemme"),
|
||||
|
||||
|
||||
Idrotecnica_Idrotecnica("idrotecnica"),
|
||||
@@ -123,6 +126,7 @@ public enum IntegryCustomerDB {
|
||||
Levanplast_Perilflor("perilflor"),
|
||||
Levanplast_PerilflorSrl("perilflorsrl"),
|
||||
Levanplast_Levanplast("levanplast"),
|
||||
Levanplast_Levanplastsrl("levanplastsrl"),
|
||||
|
||||
Maggio_MaggioSrl("maggiosrl"),
|
||||
Maggio_GiovMaggio("giovmaggio"),
|
||||
|
||||
@@ -6,6 +6,8 @@ import it.integry.ems.migration._base.IntegryCustomerDB;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
import it.integry.ems.migration.dto.common.MigrationMvwSitArtUdcDetInventarioDTO;
|
||||
|
||||
import java.sql.SQLException;
|
||||
|
||||
public class Migration_20250417110238 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
//Migration per aggiornare la view mvw_sitart_udc_det_inventario
|
||||
@@ -25,11 +27,16 @@ public class Migration_20250417110238 extends BaseMigration implements Migration
|
||||
MigrationMvwSitArtUdcDetInventarioDTO.apply(connection);
|
||||
|
||||
if (isCustomerDb(IntegryCustomerDB.Gramm_Gramm))
|
||||
alignCodJcomScarichiFromCarichi();
|
||||
resetCodJcomColli();
|
||||
//alignCodJcomScarichiFromCarichi();
|
||||
|
||||
MigrationMvwSitArtUdcDetInventarioDTO.alignGiacenza(connection);
|
||||
}
|
||||
|
||||
private void resetCodJcomColli() throws SQLException {
|
||||
executeStatement("UPDATE mtb_colr SET cod_jcom = NULL");
|
||||
}
|
||||
|
||||
private void alignCodJcomScarichiFromCarichi() throws Exception {
|
||||
String updateSql = "UPDATE mtb_colr\n" +
|
||||
"SET mtb_colr.cod_jcom = tmp.cod_jcom_carico\n" +
|
||||
@@ -59,8 +66,8 @@ public class Migration_20250417110238 extends BaseMigration implements Migration
|
||||
" mr_scarico.cod_mart = mr_carico.cod_mart AND\n" +
|
||||
" ISNULL(mr_scarico.partita_mag, '') = ISNULL(mr_carico.partita_mag, '')\n" +
|
||||
" WHERE\n" +
|
||||
" mt_scarico.segno = -1\n" +
|
||||
" AND mr_carico.num_collo IS NOT NULL\n" +
|
||||
// " mt_scarico.segno = -1 AND\n" +
|
||||
" mr_carico.num_collo IS NOT NULL\n" +
|
||||
" AND ISNULL(mr_carico.cod_jcom, '') <> ISNULL(mr_scarico.cod_jcom, '')) tmp\n" +
|
||||
"ON mtb_colr.num_collo = tmp.num_collo AND\n" +
|
||||
" mtb_colr.data_collo = tmp.data_collo AND\n" +
|
||||
|
||||
@@ -10,6 +10,8 @@ public class Migration_20251022125946 extends BaseMigration implements Migration
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
if (isDMS())
|
||||
return;
|
||||
|
||||
createOrUpdateFunction("getListinoVendita", "CREATE FUNCTION [dbo].[getListinoVendita](@datavalidita DATETIME, @codvlis VARCHAR(5), @codmart VARCHAR(15))\n" +
|
||||
" RETURNS TABLE AS\n" +
|
||||
|
||||
@@ -10,6 +10,9 @@ public class Migration_20251024175524 extends BaseMigration implements Migration
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
if (isDMS())
|
||||
return;
|
||||
|
||||
executeStatement(
|
||||
"exec DropForeignKey 'ctb_amac', 'mtb_depo_posizioni'",
|
||||
"exec DropForeignKey 'jrl_fase_posizioni', 'mtb_depo_posizioni'",
|
||||
|
||||
@@ -13,6 +13,9 @@ public class Migration_20251027172319 extends BaseMigration implements Migration
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
if (isDMS())
|
||||
return;
|
||||
|
||||
executeStatement(
|
||||
"CREATE TABLE [dbo].[mtb_ssfam]("
|
||||
+ " [cod_mgrp] varchar(5) NOT NULL, "
|
||||
|
||||
@@ -14,6 +14,9 @@ public class Migration_20251027173518 extends BaseMigration implements Migration
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
if (isDMS())
|
||||
return;
|
||||
|
||||
IndexTableDTO indexTableDTO =
|
||||
new IndexTableDTO()
|
||||
.setTableName("mtb_aart_marchio")
|
||||
|
||||
@@ -10,6 +10,8 @@ public class Migration_20251029153203 extends BaseMigration implements Migration
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
if (isDMS())
|
||||
return;
|
||||
|
||||
createOrUpdateView("[vw_tracciabUDCVend]", "CREATE VIEW [dbo].[vw_tracciabUDCVend] AS\n" +
|
||||
"SELECT mtb_colt.cod_anag AS codAnag,\n" +
|
||||
|
||||
@@ -10,6 +10,8 @@ public class Migration_20251029170931 extends BaseMigration implements Migration
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
if (isDMS())
|
||||
return;
|
||||
|
||||
createOrUpdateFunction("getDettMatricoleDaOrdine", "CREATE Function [dbo].[getDettMatricoleDaOrdine] (@codJcom varchar(10)) \n" +
|
||||
"RETURNS @dettMatricole TABLE( cod_prod varchar(15),\n" +
|
||||
|
||||
@@ -21,6 +21,9 @@ public class Migration_20251029181607 extends BaseMigration implements Migration
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
if (isDMS())
|
||||
return;
|
||||
|
||||
executeStatement(
|
||||
"EXEC sp_updateextendedproperty 'MS_Description',\n" +
|
||||
" 'Valori possibili: 0 -> Testo, 1 -> Boolean, 2 -> Intero, 3 -> Decimale, 4 -> Date, 5 -> Datetime, 6 -> Time, 7 -> DropdownList',\n" +
|
||||
|
||||
@@ -10,6 +10,9 @@ public class Migration_20251031092657 extends BaseMigration implements Migration
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
if (isDMS())
|
||||
return;
|
||||
|
||||
executeStatement("alter table dtb_tipi add flag_delete_plk bit not null default 0");
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,9 @@ public class Migration_20251031100008 extends BaseMigration implements Migration
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
if (isDMS())
|
||||
return;
|
||||
|
||||
executeStatement("exec sp_rename 'dtb_tipi.flag_delete_plk', 'flag_delete_pkl'");
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,9 @@ public class Migration_20251103175252 extends BaseMigration implements Migration
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
if (isDMS())
|
||||
return;
|
||||
|
||||
executeStatement(
|
||||
"CREATE TABLE mtb_colori ("
|
||||
+ " cod_col varchar(6) NOT NULL, "
|
||||
|
||||
@@ -10,6 +10,9 @@ public class Migration_20251104122721 extends BaseMigration implements Migration
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
if (isDMS())
|
||||
return;
|
||||
|
||||
executeStatement(
|
||||
"ALTER TABLE dbo.vtb_offt\n" +
|
||||
" ADD cod_banc VARCHAR(5)\n" +
|
||||
|
||||
@@ -10,6 +10,9 @@ public class Migration_20251105171403 extends BaseMigration implements Migration
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
if (isDMS())
|
||||
return;
|
||||
|
||||
executeStatement("delete dtb_ordr\n" +
|
||||
"from dtb_ordr \n" +
|
||||
"where not exists (select *\n" +
|
||||
|
||||
@@ -11,6 +11,9 @@ public class Migration_20251106104752 extends BaseMigration implements Migration
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
if (isDMS())
|
||||
return;
|
||||
|
||||
dropDefault("mtb_lisv", "flag_primario");
|
||||
|
||||
addDefault("mtb_lisv", "flag_primario", 1);
|
||||
|
||||
@@ -10,6 +10,9 @@ public class Migration_20251106113104 extends BaseMigration implements Migration
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
if (isDMS())
|
||||
return;
|
||||
|
||||
createOrUpdateFunction(
|
||||
"pvm_getassortimentoClientePedane",
|
||||
"CREATE FUNCTION [dbo].[pvm_getassortimentoClientePedane](\n" +
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20251110095557 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
createSetup("PVM","MRP", "COD_MDEP_PREF", null, "Inserire la lista dei depositi preselezionati per utente",
|
||||
"COD_MDEP", true, true);
|
||||
}
|
||||
|
||||
@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.IntegryCustomerDB;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
import it.integry.ems_model.utility.UtilityQuery;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class Migration_20251110100959 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
|
||||
if (!isCustomerDb(IntegryCustomerDB.Carelli_Winact))
|
||||
return;
|
||||
|
||||
final List<String> duplicatedBarcodes = executeQueryOnlyFirstColumn("SELECT cod_barre\n" +
|
||||
"FROM mtb_aart_bar_code\n" +
|
||||
"GROUP BY cod_barre\n" +
|
||||
"HAVING COUNT(cod_barre) > 1");
|
||||
|
||||
executeStatement("DELETE FROM dbo.mtb_aart_bar_code\n" +
|
||||
"WHERE cod_barre IN (" + UtilityQuery.concatStringFieldsWithSeparator(duplicatedBarcodes, ",") + ")");
|
||||
|
||||
|
||||
executeStatement("ALTER TABLE dbo.mtb_aart_bar_code\n" +
|
||||
" ALTER COLUMN cod_mart VARCHAR(15) NOT NULL",
|
||||
"ALTER TABLE dbo.mtb_aart_bar_code\n" +
|
||||
" ALTER COLUMN cod_barre VARCHAR(40) NOT NULL",
|
||||
"ALTER TABLE dbo.mtb_aart_bar_code\n" +
|
||||
" ADD CONSTRAINT pk_mtb_aart_bar_code\n" +
|
||||
" PRIMARY KEY (cod_mart, cod_barre)");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20251110104131 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
if (isDMS())
|
||||
return;
|
||||
|
||||
executeStatement(
|
||||
"ALTER TABLE dbo.vtb_viaggi\n" +
|
||||
" ALTER COLUMN note_incoterms VARCHAR(40) NULL;"
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
}
|
||||
}
|
||||
@@ -11,6 +11,9 @@ public class Migration_20251110111625 extends BaseMigration implements Migration
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
if (isDMS())
|
||||
return;
|
||||
|
||||
createSetupQuery(null, null, "SELECT '1|Prezzo netto d''acquisto e ricalcola il prezzo di vendita (Ricarica fissa)' UNION SELECT '2|Prezzo netto d''acquisto e ricalcola ricarica (Prezzo di vendita fisso)' UNION SELECT '3|Prezzo netto d''acquisto e prezzo di vendita da prezzo lordo d''acquisto (Ricalcola ricarica)' UNION SELECT '4|Prezzo netto d''acquisto e ricalcola il prezzo di vendita (Ricarica fissa da Testata listino)' UNION SELECT '5|Prezzo netto d''acquisto, prezzo di vendita e ricarica fissa (Non ricalcolare prezzo)' UNION SELECT '6|Prezzo netto d''acquisto, prezzo di vendita = Prezzo Vendita Suggerito' UNION SELECT '7|Non ricalcolare il prezzo' ");
|
||||
createSetup("VTB_LIST", "LISV4LISA", "CALC_PRZ_BASE", null,
|
||||
"SELEZIONARE IL CRITERIO DI CALCOLO DEL PREZZO BASE", false, null, false, false,
|
||||
|
||||
@@ -0,0 +1,284 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20251110175256 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
if (isDMS())
|
||||
return;
|
||||
|
||||
executeStatement("alter table vtb_list add tipo_um tinyint");
|
||||
createOrUpdateFunction("getListinoVendita","CREATE FUNCTION [dbo].[getListinoVendita](@datavalidita DATETIME, @codvlis VARCHAR(5), @codmart VARCHAR(15))\n" +
|
||||
" RETURNS TABLE AS\n" +
|
||||
" RETURN\n" +
|
||||
" SELECT vtb_list.cod_vlis,\n" +
|
||||
" vtb_list.descrizione,\n" +
|
||||
" CASE\n" +
|
||||
" WHEN tmp_list.max_lisv IS NULL THEN NULL\n" +
|
||||
" ELSE CONVERT(DATETIME, LEFT(tmp_list.max_lisv, 10)) END AS data_iniz,\n" +
|
||||
" CASE\n" +
|
||||
" WHEN tmp_list.max_lisv IS NULL THEN NULL\n" +
|
||||
" ELSE CONVERT(INT, RIGHT(tmp_list.max_lisv, 4)) END AS versione,\n" +
|
||||
" vtb_list.cod_divi,\n" +
|
||||
" vtb_list.cambio,\n" +
|
||||
" vtb_list.flag_arr_prz_iva,\n" +
|
||||
" vtb_list.arr_ric,\n" +
|
||||
" vtb_list.flag_list_iva_inclusa,\n" +
|
||||
" vtb_list.flag_lisv_margine,\n" +
|
||||
" vtb_list.flag_add_trasp,\n" +
|
||||
" tmp_list.cod_mart AS 'cod_mart',\n" +
|
||||
" mtb_lisv_data.unt_mis_ven AS unt_mis_ven,\n" +
|
||||
" ISNULL(mtb_lisv_data.rap_conv, 1) AS rap_conv,\n" +
|
||||
" ISNULL(mtb_lisv_data.prz_base, 0) AS prz_base,\n" +
|
||||
" ISNULL(mtb_lisv_data.ricarica, 0) AS ricarico,\n" +
|
||||
" CASE\n" +
|
||||
" WHEN mtb_lisv_data.prz_vend IS NOT NULL AND mtb_lisv_data.prz_vend <> 0 THEN\n" +
|
||||
" ROUND((ISNULL(mtb_lisv_data.prz_vend, 0) -\n" +
|
||||
" (ISNULL(mtb_lisv_data.prz_base, 0) / (1 - mtb_aart.perc_sfrido / 100))) /\n" +
|
||||
" ISNULL(mtb_lisv_data.prz_vend, 0) * 100, 2)\n" +
|
||||
" ELSE 0 END AS margine_eff,\n" +
|
||||
" --dbo.f_calcMargineEffettivo(IsNull(mtb_lisv_data.prz_base, 0), IsNull(mtb_lisv_data.prz_vend, 0), mtb_aart.perc_sfrido) as margine_eff,\n" +
|
||||
" --dbo.f_calcRicaricoEffettivo(IsNull(mtb_lisv_data.prz_base, 0), IsNull(mtb_lisv_data.prz_vend, 0), mtb_aart.perc_sfrido) ricarico_eff, \n" +
|
||||
" CASE\n" +
|
||||
" WHEN mtb_lisv_data.prz_base IS NOT NULL AND mtb_lisv_data.prz_base <> 0 THEN\n" +
|
||||
" ROUND((ISNULL(mtb_lisv_data.prz_vend, 0) -\n" +
|
||||
" (ISNULL(mtb_lisv_data.prz_base, 0) / (1 - mtb_aart.perc_sfrido / 100))) /\n" +
|
||||
" (ISNULL(mtb_lisv_data.prz_base, 0) / (1 - mtb_aart.perc_sfrido / 100)) * 100, 2)\n" +
|
||||
" ELSE 0 END AS ricarico_eff,\n" +
|
||||
"\n" +
|
||||
" ISNULL(mtb_lisv_data.magg_prz_vend, 0) AS magg_prz_vend,\n" +
|
||||
" ISNULL(mtb_lisv_data.prz_vend, 0) AS prz_vend,\n" +
|
||||
" ISNULL(mtb_lisv_data.prz_vend_iva, 0) AS prz_vend_iva,\n" +
|
||||
" ISNULL(mtb_lisv_data.perc_sco1, 0) AS perc_sco1,\n" +
|
||||
" ISNULL(mtb_lisv_data.perc_sco2, 0) AS perc_sco2,\n" +
|
||||
" ISNULL(mtb_lisv_data.perc_sco3, 0) AS perc_sco3,\n" +
|
||||
" ISNULL(mtb_lisv_data.perc_sco4, 0) AS perc_sco4,\n" +
|
||||
" ISNULL(mtb_lisv_data.perc_prov, 0) AS perc_prov,\n" +
|
||||
" ISNULL(mtb_lisv_data.fisso_prov, 0) AS fisso_prov,\n" +
|
||||
" ISNULL(mtb_lisv_data.posizione, '') AS posizione,\n" +
|
||||
" ISNULL(mtb_lisv_data.perc_gest, 0) AS perc_gest,\n" +
|
||||
" ISNULL(mtb_lisv_data.val_gest, 0) AS val_gest,\n" +
|
||||
" mtb_lisv_data.data_agg_prz AS data_agg_prz,\n" +
|
||||
" ISNULL(mtb_lisv_data.perc_ispe, 0) AS perc_ispe,\n" +
|
||||
" ISNULL(mtb_lisv_data.val_ispe, 0) AS val_ispe,\n" +
|
||||
" ISNULL(mtb_lisv_data.perc_promo, 0) AS perc_promo,\n" +
|
||||
" ISNULL(mtb_lisv_data.val_promo, 0) AS val_promo,\n" +
|
||||
" ISNULL(mtb_lisv_data.perc_oneri, 0) AS perc_oneri,\n" +
|
||||
" ISNULL(mtb_lisv_data.val_oneri, 0) AS val_oneri,\n" +
|
||||
" mtb_lisv_data.tipo_variazione AS tipo_variazione,\n" +
|
||||
" mtb_lisv_data.note AS note,\n" +
|
||||
" mtb_lisv_data.aggiornato_da AS aggiornato_da,\n" +
|
||||
" mtb_lisv_data.prz_vend * (1 - mtb_lisv_data.perc_sco1 / 100) * (1 - mtb_lisv_data.perc_sco2 / 100) *\n" +
|
||||
" (1 - mtb_lisv_data.perc_sco3 / 100) *\n" +
|
||||
" (1 - mtb_lisv_data.perc_sco4 / 100) AS prz_vend_netto,\n" +
|
||||
" CASE\n" +
|
||||
" WHEN ISNULL(mtb_lisv_data.colli_pedana, 0) <> 0 THEN mtb_lisv_data.colli_pedana\n" +
|
||||
" ELSE mtb_aart.colli_pedana END AS colli_pedana,\n" +
|
||||
" mtb_lisv_data.cod_tcol_ul AS cod_tcol_ul,\n" +
|
||||
" mtb_lisv_data.cod_tcol_ui AS cod_tcol_ui,\n" +
|
||||
" ISNULL(mtb_lisv_data.prz_vend_sug, 0) AS prz_vend_sug,\n" +
|
||||
" CASE\n" +
|
||||
" WHEN ISNULL(mtb_lisv_data.qta_cnf, 0) <> 0\n" +
|
||||
" AND dbo.getGestSetup('VTB_LIST', 'SETUP', 'QTA_CNF_LISTINO') = 'S' \n" +
|
||||
" THEN mtb_lisv_data.qta_cnf\n" +
|
||||
" ELSE mtb_aart.qta_cnf / ISNULL(mtb_lisv_data.rap_conv, 1) END AS qta_cnf,\n" +
|
||||
" CASE\n" +
|
||||
" WHEN ISNULL(mtb_lisv_data.colli_strato, 0) <> 0 THEN mtb_lisv_data.colli_strato\n" +
|
||||
" ELSE mtb_aart.colli_strato END AS colli_strato,\n" +
|
||||
" mtb_lisv_data.descrizione_html AS descrizione_html,\n" +
|
||||
" mtb_lisv_data.colli_pedana AS colli_pedana_lisv,\n" +
|
||||
" mtb_lisv_data.qta_cnf AS qta_cnf_lisv,\n" +
|
||||
" mtb_lisv_data.colli_strato AS colli_strato_lisv,\n" +
|
||||
" mtb_lisv_data.sconto_cartoni,\n" +
|
||||
" mtb_lisv_data.sconto_strato,\n" +
|
||||
" mtb_lisv_data.sconto_pedane,\n" +
|
||||
" vtb_list.flag_attivo,\n" +
|
||||
" vtb_list_data.note AS note_testata,\n" +
|
||||
" ISNULL(mtb_lisv_data.flag_prz_bloccato, 'N') AS flag_prz_bloccato,\n" +
|
||||
" vtb_list_data.porto AS porto,\n" +
|
||||
" mtb_lisv_data.system_note,\n" +
|
||||
" mtb_lisv.add_val_spese,\n" +
|
||||
" mtb_lisv.add_ric_spese,\n" +
|
||||
" mtb_lisv.add_sco_spese,\n" +
|
||||
"\t\t\t mtb_aart.flag_incl_listino,\n" +
|
||||
"\t\t\t mtb_lisv.flag_primario,\n" +
|
||||
"\t\t\t mtb_aart.id_art_equi,\n" +
|
||||
"\t\t\t vtb_list.tipo_um\n" +
|
||||
" FROM (SELECT vtb_list.cod_vlis AS cod_vlis,\n" +
|
||||
" mtb_lisv_data.cod_mart,\n" +
|
||||
" MAX(CASE\n" +
|
||||
" WHEN vtb_list_data.versione IS NULL THEN NULL\n" +
|
||||
" ELSE CONVERT(VARCHAR(10), vtb_list_data.data_iniz, 111) + ' ' +\n" +
|
||||
" REPLICATE('0', 5 - LEN(vtb_list_data.versione)) +\n" +
|
||||
" CONVERT(VARCHAR(5), vtb_list_data.versione) END) AS max_lisv,\n" +
|
||||
" vtb_list.cod_vlis AS 'cod_vlis_rif'\n" +
|
||||
" FROM vtb_list\n" +
|
||||
" INNER JOIN mtb_lisv_data ON vtb_list.cod_vlis = mtb_lisv_data.cod_vlis\n" +
|
||||
" LEFT OUTER JOIN vtb_list_data 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.cod_promo IS NULL AND\n" +
|
||||
" vtb_list_data.data_iniz <= ISNULL(@datavalidita, GETDATE())\n" +
|
||||
" WHERE vtb_list.cod_vlis_rif IS NULL\n" +
|
||||
" GROUP BY vtb_list.cod_vlis,\n" +
|
||||
" mtb_lisv_data.cod_mart\n" +
|
||||
" UNION\n" +
|
||||
" SELECT vtb_list.cod_vlis AS cod_vlis,\n" +
|
||||
" mtb_lisv_data.cod_mart,\n" +
|
||||
" MAX(CASE\n" +
|
||||
" WHEN vtb_list_data.versione IS NULL THEN NULL\n" +
|
||||
" ELSE CONVERT(VARCHAR(10), vtb_list_data.data_iniz, 111) + ' ' +\n" +
|
||||
" REPLICATE('0', 5 - LEN(vtb_list_data.versione_rif)) +\n" +
|
||||
" CONVERT(VARCHAR(5), vtb_list_data.versione_rif) END) AS max_lisv,\n" +
|
||||
" vtb_list.cod_vlis_rif AS 'cod_vlis_rif'\n" +
|
||||
" FROM vtb_list\n" +
|
||||
" INNER JOIN vtb_list_data ON vtb_list.cod_vlis = vtb_list_data.cod_vlis\n" +
|
||||
" INNER JOIN vtb_list_data vtb_list_data_rif\n" +
|
||||
" ON vtb_list_data.versione_rif = vtb_list_data_rif.versione AND\n" +
|
||||
" vtb_list_data.cod_vlis_rif = vtb_list_data_rif.cod_vlis\n" +
|
||||
" INNER JOIN mtb_lisv_data ON vtb_list_data_rif.cod_vlis = mtb_lisv_data.cod_vlis AND\n" +
|
||||
" vtb_list_data_rif.versione = mtb_lisv_data.versione\n" +
|
||||
"\n" +
|
||||
" WHERE vtb_list_data.data_iniz <= ISNULL(@datavalidita, GETDATE())\n" +
|
||||
" AND vtb_list.cod_vlis_rif IS NOT NULL\n" +
|
||||
" GROUP BY vtb_list.cod_vlis,\n" +
|
||||
" mtb_lisv_data.cod_mart,\n" +
|
||||
" vtb_list.cod_vlis_rif) tmp_list\n" +
|
||||
" INNER JOIN vtb_list ON vtb_list.cod_vlis = tmp_list.cod_vlis\n" +
|
||||
" INNER JOIN mtb_lisv\n" +
|
||||
" ON tmp_list.cod_vlis_rif = mtb_lisv.cod_vlis AND tmp_list.cod_mart = mtb_lisv.cod_mart\n" +
|
||||
" INNER JOIN mtb_aart ON tmp_list.cod_mart = mtb_aart.cod_mart\n" +
|
||||
" LEFT OUTER JOIN mtb_lisv_data ON tmp_list.cod_vlis_rif = mtb_lisv_data.cod_vlis AND\n" +
|
||||
" tmp_list.cod_mart = mtb_lisv_data.cod_mart AND\n" +
|
||||
" CONVERT(INT, RIGHT(tmp_list.max_lisv, 5)) = mtb_lisv_data.versione\n" +
|
||||
" LEFT OUTER JOIN vtb_list_data ON tmp_list.cod_vlis = vtb_list_data.cod_vlis AND\n" +
|
||||
" CONVERT(INT, RIGHT(tmp_list.max_lisv, 5)) = vtb_list_data.versione\n" +
|
||||
"\n" +
|
||||
" WHERE (@codmart IS NULL OR tmp_list.cod_mart = @codmart)\n" +
|
||||
" AND (@codvlis IS NULL OR tmp_list.cod_vlis = @codvlis)\n");
|
||||
|
||||
createOrUpdateFunction("getListinoVenditaPedane","CREATE FUNCTION [dbo].[getListinoVenditaPedane](@datavalidita DATETIME, @codvlis VARCHAR(5), @codmart VARCHAR(15), @pedane INT)\n" +
|
||||
" RETURNS TABLE AS\n" +
|
||||
" RETURN\n" +
|
||||
" WITH trasp AS (SELECT mtb_lisv_data_spese.cod_vlis,\n" +
|
||||
" mtb_lisv_data_spese.versione,\n" +
|
||||
" mtb_lisv_data_spese.cod_spes,\n" +
|
||||
" mtb_lisv_data_spese.perc_ricarico,\n" +
|
||||
" mtb_lisv_data_spese.val_ricarico,\n" +
|
||||
" mtb_lisv_data_spese.perc_sconto,\n" +
|
||||
" mtb_lisv_data_spese.da,\n" +
|
||||
" mtb_lisv_data_spese.a\n" +
|
||||
" FROM vtb_list_data\n" +
|
||||
" --riga Sotto Aggiunta da Massimo 08/01/25 per non fare uscire i range pedane quando il prezzo non deve essere addizionato del costo dei trasporti\n" +
|
||||
" --inner join vtb_list on vtb_list_data.cod_vlis = vtb_list.cod_vlis and vtb_list.flag_add_trasp = 1\n" +
|
||||
" INNER JOIN mtb_lisv_data_spese\n" +
|
||||
" ON vtb_list_data.cod_vlis = mtb_lisv_data_spese.cod_vlis AND\n" +
|
||||
" vtb_list_data.versione = mtb_lisv_data_spese.versione\n" +
|
||||
" CROSS APPLY (SELECT MAX(id_listino) AS max_id_listino\n" +
|
||||
" FROM vtb_list_data t\n" +
|
||||
" WHERE t.data_iniz <= ISNULL(@datavalidita, CAST(GETDATE() AS DATE))\n" +
|
||||
" AND vtb_list_data.cod_vlis = t.cod_vlis) max_lisv\n" +
|
||||
" WHERE vtb_list_data.id_listino = max_lisv.max_id_listino)\n" +
|
||||
"\n" +
|
||||
" SELECT list.cod_vlis,\n" +
|
||||
" list.descrizione,\n" +
|
||||
" list.data_iniz,\n" +
|
||||
" list.versione,\n" +
|
||||
" list.cod_divi,\n" +
|
||||
" list.cambio,\n" +
|
||||
" list.flag_arr_prz_iva,\n" +
|
||||
" list.arr_ric,\n" +
|
||||
" list.flag_list_iva_inclusa,\n" +
|
||||
" list.flag_lisv_margine,\n" +
|
||||
" list.flag_add_trasp,\n" +
|
||||
" list.cod_mart,\n" +
|
||||
" list.unt_mis_ven,\n" +
|
||||
" list.rap_conv,\n" +
|
||||
" list.prz_base,\n" +
|
||||
" list.ricarico,\n" +
|
||||
" list.margine_eff,\n" +
|
||||
" list.ricarico_eff,\n" +
|
||||
" list.magg_prz_vend,\n" +
|
||||
" list.prz_vend,\n" +
|
||||
" list.prz_vend_iva,\n" +
|
||||
" list.perc_sco1,\n" +
|
||||
" list.perc_sco2,\n" +
|
||||
" list.perc_sco3,\n" +
|
||||
" list.perc_sco4,\n" +
|
||||
" list.perc_prov,\n" +
|
||||
" list.fisso_prov,\n" +
|
||||
" list.posizione,\n" +
|
||||
" list.perc_gest,\n" +
|
||||
" list.val_gest,\n" +
|
||||
" list.data_agg_prz,\n" +
|
||||
" list.perc_ispe,\n" +
|
||||
" list.val_ispe,\n" +
|
||||
" list.perc_promo,\n" +
|
||||
" list.val_promo,\n" +
|
||||
" list.perc_oneri,\n" +
|
||||
" list.val_oneri,\n" +
|
||||
" list.tipo_variazione,\n" +
|
||||
" list.note,\n" +
|
||||
" list.aggiornato_da,\n" +
|
||||
" list.prz_vend_netto,\n" +
|
||||
" list.colli_pedana,\n" +
|
||||
" list.cod_tcol_ul,\n" +
|
||||
" list.cod_tcol_ui,\n" +
|
||||
" list.prz_vend_sug,\n" +
|
||||
" list.qta_cnf,\n" +
|
||||
" list.colli_strato,\n" +
|
||||
" list.descrizione_html,\n" +
|
||||
" list.colli_pedana_lisv,\n" +
|
||||
" list.qta_cnf_lisv,\n" +
|
||||
" list.colli_strato_lisv,\n" +
|
||||
" list.sconto_cartoni,\n" +
|
||||
" list.sconto_strato,\n" +
|
||||
" list.sconto_pedane,\n" +
|
||||
" list.flag_attivo,\n" +
|
||||
" list.note_testata,\n" +
|
||||
" list.flag_prz_bloccato,\n" +
|
||||
" list.porto,\n" +
|
||||
" list.system_note,\n" +
|
||||
" list.add_val_spese,\n" +
|
||||
" list.add_ric_spese,\n" +
|
||||
" list.add_sco_spese,\n" +
|
||||
" list.flag_incl_listino,\n" +
|
||||
" list.flag_primario,\n" +
|
||||
" list.id_art_equi,\n" +
|
||||
" trasp.cod_spes,\n" +
|
||||
" trasp.perc_ricarico,\n" +
|
||||
" trasp.val_ricarico,\n" +
|
||||
" trasp.perc_sconto,\n" +
|
||||
" trasp.da,\n" +
|
||||
" trasp.a,\n" +
|
||||
" (list.prz_vend +\n" +
|
||||
" IIF(list.flag_add_trasp = 1, --Questa condizione si potrebbe togliere per la modifica fatta l'8/01/25\n" +
|
||||
" ((ISNULL(val_ricarico, 0)) * list.add_val_spese) /\n" +
|
||||
" IIF(ISNULL(list.colli_pedana, 1) = 0, 1, list.colli_pedana), 0)) +\n" +
|
||||
" ((ISNULL(perc_ricarico, 0) * list.add_ric_spese * list.prz_vend) / 100) *\n" +
|
||||
" (1 - (ISNULL(perc_sconto, 0) * list.add_sco_spese) / 100) prz_vend_trasp,\n" +
|
||||
" ((list.prz_vend +\n" +
|
||||
" IIF(list.flag_add_trasp = 1, --Questa condizione si potrebbe togliere per la modifica fatta l'8/01/25\n" +
|
||||
" ((ISNULL(val_ricarico, 0)) * list.add_val_spese) /\n" +
|
||||
" IIF(ISNULL(list.colli_pedana, 1) = 0, 1, list.colli_pedana), 0)) +\n" +
|
||||
" ((ISNULL(perc_ricarico, 0) * list.add_ric_spese * list.prz_vend) / 100) *\n" +
|
||||
" (1 - (ISNULL(perc_sconto, 0) * list.add_sco_spese) / 100)) * (1 - list.perc_sco1 / 100) *\n" +
|
||||
" (1 - list.perc_sco2 / 100) *\n" +
|
||||
" (1 - list.perc_sco3 / 100) *\n" +
|
||||
" (1 - list.perc_sco4 / 100) AS prz_vend_trasp_netto,\n" +
|
||||
"\t\t\t list.tipo_um\n" +
|
||||
" FROM getlistinovendita(@datavalidita, @codvlis, @codmart) list\n" +
|
||||
" LEFT OUTER JOIN trasp ON list.cod_vlis = trasp.cod_vlis AND\n" +
|
||||
" (@pedane IS NULL OR @pedane BETWEEN da AND a OR\n" +
|
||||
" (@pedane IS NOT NULL AND da = 0 AND a = 0))");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
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_20251111110443 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
if (isCustomer(IntegryCustomer.Salpar)){
|
||||
executeStatement("INSERT INTO stb_tipi_indirizzi\n" +
|
||||
"VALUES ('PUNTO VENDITA', 'ABRW'),\n" +
|
||||
" ('PUNTO VENDITA', 'ABTW'),\n" +
|
||||
" ('PUNTO VENDITA', 'BAMW'),\n" +
|
||||
" ('PUNTO VENDITA', 'BATW')");
|
||||
|
||||
executeStatement("UPDATE vtb_clie_pers_rif\n" +
|
||||
"SET tipo_indirizzo = 'PUNTO VENDITA'\n" +
|
||||
"WHERE tipo_indirizzo = 'UFFICIO ACQUISTI'");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20251111120322 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
if (isDMS())
|
||||
return;
|
||||
|
||||
createOrUpdateFunction(
|
||||
"pvm_getassortimentoCliente",
|
||||
"CREATE FUNCTION [dbo].[pvm_getassortimentoCliente](\n" +
|
||||
" @codAnag VARCHAR(5), @codVlis VARCHAR(5), @codVdes VARCHAR(5), @dataValidita DATETIME, @viewPromo BIT\n" +
|
||||
")\n" +
|
||||
" RETURNS TABLE AS\n" +
|
||||
" RETURN(SELECT cod_mart,\n" +
|
||||
" 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" +
|
||||
" note,\n" +
|
||||
" cod_tcol_ul,\n" +
|
||||
" unt_mis_ven,\n" +
|
||||
" colli_pedana,\n" +
|
||||
" tipo_variazione,\n" +
|
||||
" tipo_promo,\n" +
|
||||
" cod_paga,\n" +
|
||||
" descr_paga,\n" +
|
||||
" porto,\n" +
|
||||
" qta_cnf,\n" +
|
||||
" art_lisv,\n" +
|
||||
" 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 [dbo].pvm_getassortimentoClientePedane(\n" +
|
||||
" @codAnag, @codVlis, @codVdes, @dataValidita, @viewPromo,\n" +
|
||||
" DEFAULT))"
|
||||
);
|
||||
}
|
||||
|
||||
@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.IntegryCustomerDB;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20251111151102 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
if (!isCustomerDb(IntegryCustomerDB.Gramm_Gramm))
|
||||
return;
|
||||
|
||||
createSetup("W_VEDI_DESADV_DLG", "SETUP", "VERSIONE_C2835", "20",
|
||||
null, false, null, false, false,
|
||||
false, false, false, null, false, null);
|
||||
createSetup("W_VEDI_DESADV_DLG", "SETUP", "DTM_C2835", "137",
|
||||
"Qualificatore data ora riferimento (Data documento), per default è impostato a 2", false, null, false, false,
|
||||
false, false, false, null, false, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
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;
|
||||
import it.integry.ems_model.entity.JtbCiclCq;
|
||||
import it.integry.ems_model.entity._enum.TipoValore;
|
||||
import it.integry.ems_model.types.OperationType;
|
||||
import it.integry.ems_model.utility.UtilityDB;
|
||||
import it.integry.ems_model.utility.UtilityInteger;
|
||||
import it.integry.ems_model.utility.UtilityList;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class Migration_20251111170814 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
if (!isCustomerDb(IntegryCustomerDB.Gramm_Gramm))
|
||||
return;
|
||||
|
||||
|
||||
String sql = "select distinct jtb_cicl.cod_prod,MAX(jtb_cicl_cq.num_fase) as num_fase,max(jtb_cicl_cq.id_riga) as id_riga\n" +
|
||||
"from jtb_dist_clav_dir dir\n" +
|
||||
" inner join jtb_cicl on dir.cod_prod = jtb_cicl.cod_prod\n" +
|
||||
" left outer join jtb_cicl_cq on jtb_cicl.cod_prod = jtb_cicl_cq.cod_prod\n" +
|
||||
"where dir.cod_jfas like 'SC%'\n" +
|
||||
" and jtb_cicl.flag_attiva = 'S'\n" +
|
||||
"group by jtb_cicl.cod_prod";
|
||||
|
||||
List<JtbCiclCq> distinteDaAggiornare = UtilityDB.executeSimpleQueryDTO(connection, sql, JtbCiclCq.class);
|
||||
if (UtilityList.isNullOrEmpty(distinteDaAggiornare))
|
||||
return;
|
||||
|
||||
for (JtbCiclCq jtbCiclCq : distinteDaAggiornare) {
|
||||
jtbCiclCq.setIdRiga(UtilityInteger.isNull(jtbCiclCq.getIdRiga(),0) + 1)
|
||||
.setNumFase(UtilityInteger.isNull(jtbCiclCq.getNumFase(),0))
|
||||
.setControllo("Check Etichetta Cartone")
|
||||
.setTipoValore(TipoValore.BOOLEAN)
|
||||
.setValoreRif("S")
|
||||
.setNumRip(0)
|
||||
.setTipologia("DETAILED_CQ")
|
||||
.setOperation(OperationType.INSERT);
|
||||
|
||||
jtbCiclCq.manageWithParentConnection(connection);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20251111171747 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
if (isDMS())
|
||||
return;
|
||||
|
||||
createOrUpdateFunction("lisv_getTipoUm", "CREATE FUNCTION dbo.lisv_getTipoUm\n" +
|
||||
"( \n" +
|
||||
" @codMart varchar(15), @tipoUmLisv tinyint\n" +
|
||||
")\n" +
|
||||
"RETURNS TABLE \n" +
|
||||
"AS\n" +
|
||||
"RETURN \n" +
|
||||
"(\n" +
|
||||
" with um as (\n" +
|
||||
"select cod_mart, unt_mis, rap_conv\n" +
|
||||
"from dbo.getUntMisArticolo(@codMart, null ) um\n" +
|
||||
"where @tipoUmLisv is not null\n" +
|
||||
"and ( (@tipoUmLisv = 1 and um.tipo_um = 'UI' ) or \n" +
|
||||
"(@tipoUmLisv = 2 and flag_unita_kg = 'S'))\n" +
|
||||
")\n" +
|
||||
"\n" +
|
||||
"select mtb_aart.cod_mart, \n" +
|
||||
"case \n" +
|
||||
"when @tipoUmLisv IS null then mtb_aart.unt_mis\n" +
|
||||
"when @tipoUmLisv = 1 and mtb_aart.qta_cnf not in (0, 1) then mtb_aart.unt_mis\n" +
|
||||
"when @tipoUmLisv = 2 and mtb_aart.peso_kg not in (0, 1) then mtb_aart.unt_mis\n" +
|
||||
" else ISNULL(um.unt_mis, mtb_aart.unt_mis) end as unt_mis_ven, \n" +
|
||||
"case \n" +
|
||||
"when @tipoUmLisv IS null then 1\n" +
|
||||
"when @tipoUmLisv = 1 and mtb_aart.qta_cnf not in (0, 1) then 1\n" +
|
||||
"when @tipoUmLisv = 2 and mtb_aart.peso_kg not in (0, 1) then 1\n" +
|
||||
" else ISNULL(um.rap_conv, 1) end as rap_conv_vend\n" +
|
||||
"from mtb_aart left outer join um on mtb_aart.cod_mart = um.cod_mart\n" +
|
||||
"where (@codMart is null or mtb_aart.cod_mart = @codMart )\n" +
|
||||
")");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20251113102040 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
executeStatement("ALTER TABLE vtb_list_data ADD promo_chiusa bit DEFAULT 0 NOT NULL");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,208 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20251113105159 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
executeStatement("exec sp_rename 'vtb_list_data.promo_chiusa', 'chiusura_immediata'");
|
||||
|
||||
|
||||
createOrUpdateFunction("getPromozioneVendita", "CREATE FUNCTION [dbo].[getPromozioneVendita](@dataIniz DATETIME, @dataFine DATETIME, @codVlis VARCHAR(5),\n" +
|
||||
" @codPromo VARCHAR(10), @codMart VARCHAR(15))\n" +
|
||||
" RETURNS TABLE AS\n" +
|
||||
" RETURN\n" +
|
||||
" SELECT vtb_list.cod_vlis,\n" +
|
||||
" vtb_list.descrizione,\n" +
|
||||
" vtb_list_data.data_iniz,\n" +
|
||||
" vtb_list_data.data_fine,\n" +
|
||||
" vtb_list_data.cod_promo,\n" +
|
||||
" vtb_list_data.versione,\n" +
|
||||
" vtb_list.cod_divi,\n" +
|
||||
" vtb_list.flag_arr_prz_iva,\n" +
|
||||
" vtb_list.arr_ric,\n" +
|
||||
" vtb_list.flag_list_iva_inclusa,\n" +
|
||||
" vtb_list.flag_lisv_margine,\n" +
|
||||
" mtb_lisv_data.cod_mart AS cod_mart,\n" +
|
||||
" mtb_lisv_data.unt_mis_ven AS unt_mis_ven,\n" +
|
||||
" mtb_lisv_data.rap_conv AS rap_conv,\n" +
|
||||
" mtb_lisv_data.prz_base AS prz_base,\n" +
|
||||
" mtb_lisv_data.ricarica AS ricarico,\n" +
|
||||
" --dbo.f_calcMargineEffettivo(mtb_lisv_data.prz_base, mtb_lisv_data.prz_vend, mtb_aart.perc_sfrido) as margine_eff,\n" +
|
||||
" --dbo.f_calcRicaricoEffettivo(mtb_lisv_data.prz_base, mtb_lisv_data.prz_vend, mtb_aart.perc_sfrido) as ricarico_eff, \n" +
|
||||
" CASE\n" +
|
||||
" WHEN mtb_lisv_data.prz_vend IS NOT NULL AND mtb_lisv_data.prz_vend <> 0 THEN\n" +
|
||||
" ROUND((ISNULL(mtb_lisv_data.prz_vend, 0) -\n" +
|
||||
" (ISNULL(mtb_lisv_data.prz_base, 0) / (1 - mtb_aart.perc_sfrido / 100))) /\n" +
|
||||
" ISNULL(mtb_lisv_data.prz_vend, 0) * 100, 2)\n" +
|
||||
" ELSE 0 END AS margine_eff,\n" +
|
||||
" CASE\n" +
|
||||
" WHEN mtb_lisv_data.prz_base IS NOT NULL AND mtb_lisv_data.prz_base <> 0 THEN\n" +
|
||||
" ROUND((ISNULL(mtb_lisv_data.prz_vend, 0) -\n" +
|
||||
" (ISNULL(mtb_lisv_data.prz_base, 0) / (1 - mtb_aart.perc_sfrido / 100))) /\n" +
|
||||
" (ISNULL(mtb_lisv_data.prz_base, 0) / (1 - mtb_aart.perc_sfrido / 100)) * 100, 2)\n" +
|
||||
" ELSE 0 END AS ricarico_eff,\n" +
|
||||
" mtb_lisv_data.prz_vend AS prz_vend,\n" +
|
||||
" mtb_lisv_data.prz_vend_iva AS prz_vend_iva,\n" +
|
||||
" mtb_lisv_data.perc_sco1 AS perc_sco1,\n" +
|
||||
" mtb_lisv_data.perc_sco2 AS perc_sco2,\n" +
|
||||
" mtb_lisv_data.perc_sco3 AS perc_sco3,\n" +
|
||||
" mtb_lisv_data.perc_sco4 AS perc_sco4,\n" +
|
||||
" mtb_lisv_data.perc_prov AS perc_prov,\n" +
|
||||
" mtb_lisv_data.fisso_prov AS fisso_prov,\n" +
|
||||
" mtb_lisv_data.posizione AS posizione,\n" +
|
||||
" mtb_lisv_data.perc_gest AS perc_gest,\n" +
|
||||
" mtb_lisv_data.val_gest AS val_gest,\n" +
|
||||
" mtb_lisv_data.data_agg_prz AS data_agg_prz,\n" +
|
||||
" mtb_lisv_data.perc_ispe AS perc_ispe,\n" +
|
||||
" mtb_lisv_data.val_ispe AS val_ispe,\n" +
|
||||
" mtb_lisv_data.perc_promo AS perc_promo,\n" +
|
||||
" mtb_lisv_data.val_promo AS val_promo,\n" +
|
||||
" mtb_lisv_data.perc_oneri AS perc_oneri,\n" +
|
||||
" mtb_lisv_data.val_oneri AS val_oneri,\n" +
|
||||
" mtb_lisv_data.tipo_variazione AS tipo_variazione,\n" +
|
||||
" mtb_lisv_data.note AS note,\n" +
|
||||
" mtb_lisv_data.aggiornato_da AS aggiornato_da,\n" +
|
||||
" mtb_lisv_data.prz_vend * (1 - mtb_lisv_data.perc_sco1 / 100) * (1 - mtb_lisv_data.perc_sco2 / 100) *\n" +
|
||||
" (1 - mtb_lisv_data.perc_sco3 / 100) * (1 - mtb_lisv_data.perc_sco4 / 100) AS prz_vend_netto,\n" +
|
||||
" vtb_promo.descrizione AS 'descr_promo',\n" +
|
||||
" vtb_promo.data_iniz_sell_out,\n" +
|
||||
" vtb_promo.data_fine_sell_out,\n" +
|
||||
" vtb_promo.flag_tipo_promo,\n" +
|
||||
" mtb_lisv_data.sconto_cartoni,\n" +
|
||||
" mtb_lisv_data.sconto_strato,\n" +
|
||||
" mtb_lisv_data.sconto_pedane,\n" +
|
||||
" mtb_lisv_data.giacenza,\n" +
|
||||
" mtb_lisv_data.magg_prz_vend,\n" +
|
||||
" vtb_promo.flag_sconto_contrattuale,\n" +
|
||||
" vtb_promo.intercode_xml_variazioni,\n" +
|
||||
" vtb_list_data.note AS note_testata,\n" +
|
||||
" vtb_promo.flag_tipologia,\n" +
|
||||
" vtb_promo.flag_volantino,\n" +
|
||||
" mtb_lisv_data.inserito_da,\n" +
|
||||
" vtb_list_data.chiusura_immediata\n" +
|
||||
" FROM vtb_list\n" +
|
||||
" INNER JOIN vtb_list_data ON vtb_list.cod_vlis = vtb_list_data.cod_vlis\n" +
|
||||
" INNER JOIN mtb_lisv_data ON vtb_list_data.cod_vlis = mtb_lisv_data.cod_vlis AND\n" +
|
||||
" vtb_list_data.versione = mtb_lisv_data.versione\n" +
|
||||
" INNER JOIN mtb_aart ON mtb_lisv_data.cod_mart = mtb_aart.cod_mart\n" +
|
||||
" INNER JOIN vtb_promo ON vtb_list_data.cod_promo = vtb_promo.cod_promo\n" +
|
||||
" OUTER APPLY (SELECT COUNT(*) AS conta\n" +
|
||||
" FROM vtb_list_data rif\n" +
|
||||
" WHERE vtb_list_data.cod_vlis = rif.cod_vlis_rif\n" +
|
||||
" AND vtb_list_data.versione = rif.versione) list_rif\n" +
|
||||
" WHERE (@codMart IS NULL OR mtb_lisv_data.cod_mart = @codMart)\n" +
|
||||
" AND (@codvlis IS NULL OR vtb_list_data.cod_vlis = @codVlis)\n" +
|
||||
" AND vtb_list.cod_vlis_rif IS NULL\n" +
|
||||
" AND (@codPromo IS NULL OR vtb_list_data.cod_promo = @codPromo)\n" +
|
||||
" AND (((@dataFine IS NULL OR ISNULL(@dataIniz, CAST(GETDATE() AS DATE)) = @dataFine) AND\n" +
|
||||
" ISNULL(@dataIniz, CAST(GETDATE() AS DATE)) BETWEEN vtb_list_data.data_iniz AND vtb_list_data.data_fine) OR\n" +
|
||||
" (@dataFine IS NOT NULL AND ISNULL(@dataIniz, CAST(GETDATE() AS DATE)) <> @dataFine AND\n" +
|
||||
" (vtb_list_data.data_iniz BETWEEN ISNULL(@dataIniz, CAST(GETDATE() AS DATE)) AND @dataFine OR\n" +
|
||||
" vtb_list_data.data_fine BETWEEN ISNULL(@dataIniz, CAST(GETDATE() AS DATE)) AND @dataFine OR\n" +
|
||||
" ISNULL(@dataIniz, CAST(GETDATE() AS DATE)) BETWEEN vtb_list_data.data_iniz AND vtb_list_data.data_fine OR\n" +
|
||||
" @dataFine BETWEEN vtb_list_data.data_iniz AND vtb_list_data.data_fine)))\n" +
|
||||
" AND (vtb_promo.flag_sconto_contrattuale = 'N' OR\n" +
|
||||
" (vtb_promo.flag_sconto_contrattuale = 'S' AND list_rif.conta = 0))\n" +
|
||||
" UNION\n" +
|
||||
" SELECT vtb_list.cod_vlis,\n" +
|
||||
" vtb_list.descrizione,\n" +
|
||||
" vtb_list_data.data_iniz,\n" +
|
||||
" vtb_list_data.data_fine,\n" +
|
||||
" vtb_list_data.cod_promo,\n" +
|
||||
" vtb_list_data.versione,\n" +
|
||||
" vtb_list.cod_divi,\n" +
|
||||
" vtb_list.flag_arr_prz_iva,\n" +
|
||||
" vtb_list.arr_ric,\n" +
|
||||
" vtb_list.flag_list_iva_inclusa,\n" +
|
||||
" vtb_list.flag_lisv_margine,\n" +
|
||||
" mtb_lisv_data.cod_mart AS cod_mart,\n" +
|
||||
" mtb_lisv_data.unt_mis_ven AS unt_mis_ven,\n" +
|
||||
" mtb_lisv_data.rap_conv AS rap_conv,\n" +
|
||||
" mtb_lisv_data.prz_base AS prz_base,\n" +
|
||||
" mtb_lisv_data.ricarica AS ricarico,\n" +
|
||||
" --dbo.f_calcMargineEffettivo(mtb_lisv_data.prz_base, mtb_lisv_data.prz_vend, mtb_aart.perc_sfrido) as margine_eff,\n" +
|
||||
" --dbo.f_calcRicaricoEffettivo(mtb_lisv_data.prz_base, mtb_lisv_data.prz_vend, mtb_aart.perc_sfrido) as ricarico_eff, \n" +
|
||||
" CASE\n" +
|
||||
" WHEN mtb_lisv_data.prz_vend IS NOT NULL AND mtb_lisv_data.prz_vend <> 0 THEN\n" +
|
||||
" ROUND((ISNULL(mtb_lisv_data.prz_vend, 0) -\n" +
|
||||
" (ISNULL(mtb_lisv_data.prz_base, 0) / (1 - mtb_aart.perc_sfrido / 100))) /\n" +
|
||||
" ISNULL(mtb_lisv_data.prz_vend, 0) * 100, 2)\n" +
|
||||
" ELSE 0 END AS margine_eff,\n" +
|
||||
" CASE\n" +
|
||||
" WHEN mtb_lisv_data.prz_base IS NOT NULL AND mtb_lisv_data.prz_base <> 0 THEN\n" +
|
||||
" ROUND((ISNULL(mtb_lisv_data.prz_vend, 0) -\n" +
|
||||
" (ISNULL(mtb_lisv_data.prz_base, 0) / (1 - mtb_aart.perc_sfrido / 100))) /\n" +
|
||||
" (ISNULL(mtb_lisv_data.prz_base, 0) / (1 - mtb_aart.perc_sfrido / 100)) * 100, 2)\n" +
|
||||
" ELSE 0 END AS ricarico_eff,\n" +
|
||||
" mtb_lisv_data.prz_vend AS prz_vend,\n" +
|
||||
" mtb_lisv_data.prz_vend_iva AS prz_vend_iva,\n" +
|
||||
" mtb_lisv_data.perc_sco1 AS perc_sco1,\n" +
|
||||
" mtb_lisv_data.perc_sco2 AS perc_sco2,\n" +
|
||||
" mtb_lisv_data.perc_sco3 AS perc_sco3,\n" +
|
||||
" mtb_lisv_data.perc_sco4 AS perc_sco4,\n" +
|
||||
" mtb_lisv_data.perc_prov AS perc_prov,\n" +
|
||||
" mtb_lisv_data.fisso_prov AS fisso_prov,\n" +
|
||||
" mtb_lisv_data.posizione AS posizione,\n" +
|
||||
" mtb_lisv_data.perc_gest AS perc_gest,\n" +
|
||||
" mtb_lisv_data.val_gest AS val_gest,\n" +
|
||||
" mtb_lisv_data.data_agg_prz AS data_agg_prz,\n" +
|
||||
" mtb_lisv_data.perc_ispe AS perc_ispe,\n" +
|
||||
" mtb_lisv_data.val_ispe AS val_ispe,\n" +
|
||||
" mtb_lisv_data.perc_promo AS perc_promo,\n" +
|
||||
" mtb_lisv_data.val_promo AS val_promo,\n" +
|
||||
" mtb_lisv_data.perc_oneri AS perc_oneri,\n" +
|
||||
" mtb_lisv_data.val_oneri AS val_oneri,\n" +
|
||||
" mtb_lisv_data.tipo_variazione AS tipo_variazione,\n" +
|
||||
" mtb_lisv_data.note AS note,\n" +
|
||||
" mtb_lisv_data.aggiornato_da AS aggiornato_da,\n" +
|
||||
" mtb_lisv_data.prz_vend * (1 - mtb_lisv_data.perc_sco1 / 100) * (1 - mtb_lisv_data.perc_sco2 / 100) *\n" +
|
||||
" (1 - mtb_lisv_data.perc_sco3 / 100) * (1 - mtb_lisv_data.perc_sco4 / 100) AS prz_vend_netto,\n" +
|
||||
" vtb_promo.descrizione AS 'descr_promo',\n" +
|
||||
" vtb_promo.data_iniz_sell_out,\n" +
|
||||
" vtb_promo.data_fine_sell_out,\n" +
|
||||
" vtb_promo.flag_tipo_promo,\n" +
|
||||
" mtb_lisv_data.sconto_cartoni,\n" +
|
||||
" mtb_lisv_data.sconto_strato,\n" +
|
||||
" mtb_lisv_data.sconto_pedane,\n" +
|
||||
" mtb_lisv_data.giacenza,\n" +
|
||||
" mtb_lisv_data.magg_prz_vend,\n" +
|
||||
" vtb_promo.flag_sconto_contrattuale,\n" +
|
||||
" vtb_promo.intercode_xml_variazioni,\n" +
|
||||
" vtb_list_data.note AS note_testata,\n" +
|
||||
" vtb_promo.flag_tipologia,\n" +
|
||||
" vtb_promo.flag_volantino,\n" +
|
||||
" mtb_lisv_data.inserito_da,\n" +
|
||||
" vtb_list_data_rif.chiusura_immediata\n" +
|
||||
" FROM vtb_list\n" +
|
||||
" INNER JOIN vtb_list_data ON vtb_list.cod_vlis = vtb_list_data.cod_vlis\n" +
|
||||
" INNER JOIN vtb_list_data vtb_list_data_rif\n" +
|
||||
" ON vtb_list_data.cod_vlis_rif = vtb_list_data_rif.cod_vlis AND\n" +
|
||||
" vtb_list_data.versione_rif = vtb_list_data_rif.versione\n" +
|
||||
" INNER JOIN mtb_lisv_data ON vtb_list_data_rif.cod_vlis = mtb_lisv_data.cod_vlis AND\n" +
|
||||
" vtb_list_data_rif.versione = mtb_lisv_data.versione\n" +
|
||||
" INNER JOIN mtb_aart ON mtb_lisv_data.cod_mart = mtb_aart.cod_mart\n" +
|
||||
" INNER JOIN vtb_promo ON vtb_list_data_rif.cod_promo = vtb_promo.cod_promo\n" +
|
||||
" WHERE (@codMart IS NULL OR mtb_lisv_data.cod_mart = @codMart)\n" +
|
||||
" AND (@codvlis IS NULL OR vtb_list_data.cod_vlis = @codVlis)\n" +
|
||||
" AND (@codPromo IS NULL OR vtb_list_data.cod_promo = @codPromo)\n" +
|
||||
" AND (((@dataFine IS NULL OR ISNULL(@dataIniz, CAST(GETDATE() AS DATE)) = @dataFine) AND\n" +
|
||||
" ISNULL(@dataIniz, CAST(GETDATE() AS DATE)) BETWEEN vtb_list_data.data_iniz AND vtb_list_data.data_fine) OR\n" +
|
||||
" (@dataFine IS NOT NULL AND ISNULL(@dataIniz, CAST(GETDATE() AS DATE)) <> @dataFine AND\n" +
|
||||
" (vtb_list_data.data_iniz BETWEEN ISNULL(@dataIniz, CAST(GETDATE() AS DATE)) AND @dataFine OR\n" +
|
||||
" vtb_list_data.data_fine BETWEEN ISNULL(@dataIniz, CAST(GETDATE() AS DATE)) AND @dataFine OR\n" +
|
||||
" ISNULL(@dataIniz, CAST(GETDATE() AS DATE)) BETWEEN vtb_list_data.data_iniz AND vtb_list_data.data_fine OR\n" +
|
||||
" @dataFine BETWEEN vtb_list_data.data_iniz AND vtb_list_data.data_fine)))");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20251113122313 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
createOrUpdateFunction("lisv_getTipoUm", "CREATE FUNCTION [dbo].[lisv_getTipoUm]\n" +
|
||||
"(\t\n" +
|
||||
"\t@codMart varchar(15), @tipoUmLisv tinyint\n" +
|
||||
")\n" +
|
||||
"RETURNS TABLE \n" +
|
||||
"AS\n" +
|
||||
"RETURN \n" +
|
||||
"(\n" +
|
||||
"\twith um as (\n" +
|
||||
"select cod_mart, unt_mis, rap_conv\n" +
|
||||
"from dbo.getUntMisArticolo(@codMart, null ) um\n" +
|
||||
"where @tipoUmLisv is not null\n" +
|
||||
"and ( (@tipoUmLisv = 1 and um.tipo_um = 'UI' ) or \n" +
|
||||
"(@tipoUmLisv = 2 and flag_unita_kg = 'S'))\n" +
|
||||
")\n" +
|
||||
"\n" +
|
||||
"select mtb_aart.cod_mart, \n" +
|
||||
"case \n" +
|
||||
"when @tipoUmLisv IS null then mtb_aart.unt_mis\n" +
|
||||
"when @tipoUmLisv = 1 and mtb_aart.qta_cnf in (0, 1) then mtb_aart.unt_mis\n" +
|
||||
"when @tipoUmLisv = 2 and mtb_aart.peso_kg in (0, 1) then mtb_aart.unt_mis\n" +
|
||||
"\telse ISNULL(um.unt_mis, mtb_aart.unt_mis) end as unt_mis_ven, \n" +
|
||||
"case \n" +
|
||||
"when @tipoUmLisv IS null then 1\n" +
|
||||
"when @tipoUmLisv = 1 and mtb_aart.qta_cnf in (0, 1) then 1\n" +
|
||||
"when @tipoUmLisv = 2 and mtb_aart.peso_kg in (0, 1) then 1\n" +
|
||||
"\telse ISNULL(um.rap_conv, 1) end as rap_conv_vend\n" +
|
||||
"from mtb_aart left outer join um on mtb_aart.cod_mart = um.cod_mart\n" +
|
||||
"where (@codMart is null or mtb_aart.cod_mart = @codMart )\n" +
|
||||
")");
|
||||
|
||||
executeStatement("alter table mtb_var_lisv_log alter column versione int null");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20251113170159 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
executeStatement("ALTER TABLE wdtb_doct ADD merce_ricevuta BIT DEFAULT 0 NOT NULL");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20251114114334 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
|
||||
executeStatement("ALTER TABLE ctb_amac DROP COLUMN cod_mdep;");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20251114150912 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
executeStatement("ALTER TABLE jtb_comt ADD data_mod DATETIME");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20251114163222 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
executeStatement("ALTER TABLE vtb_dest ADD data_mod DATETIME");
|
||||
executeStatement("ALTER TABLE ptb_pros ADD data_mod DATETIME");
|
||||
executeStatement("ALTER TABLE ptb_pros_rif ADD data_mod DATETIME");
|
||||
}
|
||||
|
||||
@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.IntegryCustomer;
|
||||
import it.integry.ems.migration._base.IntegryCustomerDB;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20251117142928 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("W_jriep_presenze_dip_disp", "SETUP", "SET_DATA_FINE", "N",
|
||||
"imposta data fine = fine mese", false, "SI_NO", false, false,
|
||||
false, false, false, null, false, "SELECT 'S' UNION ALL SELECT 'N'");
|
||||
|
||||
if (isCustomer(IntegryCustomer.Integry))
|
||||
updateSetupValue("W_jriep_presenze_dip_disp", "SETUP", "SET_DATA_FINE", "S");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
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_20251117170957 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
if (!isCustomerDb(IntegryCustomerDB.Gramm_Gramm))
|
||||
return;
|
||||
|
||||
executeStatement("update stb_gest_setup set value = 'S' where gest_name = 'DTB_ORDT' and key_section in ('NUOVA_PROCEDURA','DISABLE_TRIGGER_ORDL')");
|
||||
executeStatement("update stb_gest_sync set syncronize = 'R' where gest_name like 'lord%'");
|
||||
executeStatement("update stb_gest_sync set syncronize = 'R' where gest_name like 'pord%'");
|
||||
executeStatement("insert into stb_abil \n" +
|
||||
"select case when gest_name = 'lordi' then 'LG081' else 'AG031' end , user_name, 'S', case when gest_name = 'lordi' then 'lordi_tab' else 'pordi_tab' end from stb_abil \n" +
|
||||
"where gest_name in ('lordi','pordi') and case when gest_name = 'lordi' then 'LG081' else 'AG031' end + user_name not in (select cod_opz + user_name from stb_abil where cod_opz in ('LG081','AG031'))");
|
||||
executeStatement("update stb_abil set flag_abil = 'N' where gest_name in ('lordi','pordi')");
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
}
|
||||
}
|
||||
@@ -30,7 +30,7 @@ public class AccountingBusinessLogic {
|
||||
.setCodAnag(ctbMovt.getCodAnag())
|
||||
.setCodVage(ctbMovt.getCodVage())
|
||||
.setAnnoPart(annoPart)
|
||||
.setDataDoc(ctbMovt.getDataDoc())
|
||||
.setDataDoc(UtilityLocalDate.localDateFromDate(ctbMovt.getDataDoc()))
|
||||
.setSerDoc(ctbMovt.getSerDoc())
|
||||
.setNumDoc(ctbMovt.getNumDoc())
|
||||
.setCodDiviCont(ctbMovt.getCodDiviCont())
|
||||
@@ -120,7 +120,7 @@ public class AccountingBusinessLogic {
|
||||
"Convert(numeric(20,5), importo_enasarco * cambio_divi_cont) as importo_enasarco " +
|
||||
" FROM ctb_rit_acc " +
|
||||
" WHERE num_cmov_fat = " + UtilityDB.valueToString(testata.getNumCmov()) + " AND " +
|
||||
" data_doc = " + UtilityDB.valueDateToString(testata.getDataDoc(), CommonConstants.DATE_FORMAT_YMD_SLASHED) + " AND " +
|
||||
" data_doc = " + UtilityDB.valueToString(testata.getDataDoc()) + " AND " +
|
||||
" ser_doc = " + UtilityDB.valueToString(testata.getSerDoc()) + " AND " +
|
||||
" num_doc = " + UtilityDB.valueToString(testata.getNumDoc());
|
||||
|
||||
@@ -142,7 +142,7 @@ public class AccountingBusinessLogic {
|
||||
.setAnnoPart(annoPart)
|
||||
.setSerDoc(testata.getSerDoc())
|
||||
.setNumDoc(testata.getNumDoc())
|
||||
.setDataScad(testata.getDataDoc());
|
||||
.setDataScad(UtilityLocalDate.localDateFromDate(testata.getDataDoc()));
|
||||
if (testata.getTipoPartitaEnum() == TipoPartita.ATTIVA) {
|
||||
ctbScad.setImpDare(ritenuta);
|
||||
ctbScad.setImpAvere(BigDecimal.ZERO);
|
||||
@@ -166,7 +166,7 @@ public class AccountingBusinessLogic {
|
||||
.setAnnoPart(annoPart)
|
||||
.setSerDoc(testata.getSerDoc())
|
||||
.setNumDoc(testata.getNumDoc())
|
||||
.setDataScad(testata.getDataDoc());
|
||||
.setDataScad(UtilityLocalDate.localDateFromDate(testata.getDataDoc()));
|
||||
if (testata.getTipoPartitaEnum() == TipoPartita.ATTIVA) {
|
||||
ctbScad.setImpDare(enasarco);
|
||||
ctbScad.setImpAvere(BigDecimal.ZERO);
|
||||
@@ -413,10 +413,17 @@ public class AccountingBusinessLogic {
|
||||
}
|
||||
|
||||
public static BigDecimal pagaScadenze(Date dataCmov, BigDecimal residuo, List<CtbScad> elencoScadenze) {
|
||||
return pagaScadenze(dataCmov, residuo, elencoScadenze, null);
|
||||
return pagaScadenze(UtilityLocalDate.localDateFromDate(dataCmov), residuo, elencoScadenze, null);
|
||||
}
|
||||
|
||||
public static BigDecimal pagaScadenze(Date dataCmov, BigDecimal residuo, List<CtbScad> elencoScadenze, Integer idRigaMov) {
|
||||
return pagaScadenze(UtilityLocalDate.localDateFromDate(dataCmov), residuo, elencoScadenze, idRigaMov);
|
||||
}
|
||||
|
||||
public static BigDecimal pagaScadenze(LocalDate dataCmov, BigDecimal residuo, List<CtbScad> elencoScadenze) {
|
||||
return pagaScadenze(dataCmov, residuo, elencoScadenze, null);
|
||||
}
|
||||
public static BigDecimal pagaScadenze(LocalDate dataCmov, BigDecimal residuo, List<CtbScad> elencoScadenze, Integer idRigaMov) {
|
||||
long countScad =
|
||||
Stream.of(elencoScadenze)
|
||||
.distinctBy(x ->
|
||||
|
||||
@@ -18,6 +18,7 @@ import java.text.SimpleDateFormat;
|
||||
import java.time.LocalDate;
|
||||
import java.util.Date;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
public class AccountingRules extends QueryRules {
|
||||
@@ -181,7 +182,7 @@ public class AccountingRules extends QueryRules {
|
||||
|
||||
if (!UtilityString.isNullOrEmpty(codBiva)) {
|
||||
for (CtbMovi ctbMovi : ctbMovt.getCtbMovi()) {
|
||||
if (UtilityString.isNullOrEmpty(ctbMovi.getCodBiva())) {
|
||||
if (UtilityString.isNullOrEmpty(ctbMovi.getCodBiva()) && !ctbMovi.getCodBiva().equalsIgnoreCase(EmsRestConstants.NULL)) {
|
||||
ctbMovi.setCodBiva(codBiva);
|
||||
}
|
||||
movi.add(ctbMovi);
|
||||
@@ -389,7 +390,7 @@ public class AccountingRules extends QueryRules {
|
||||
.setCodAnag(ctbMovt.getCodAnag())
|
||||
.setCodVage(ctbMovt.getCodVage())
|
||||
.setAnnoPart(annoPart)
|
||||
.setDataDoc(ctbMovt.getDataDoc())
|
||||
.setDataDoc(UtilityLocalDate.localDateFromDate(ctbMovt.getDataDoc()))
|
||||
.setSerDoc(ctbMovt.getSerDoc())
|
||||
.setNumDoc(ctbMovt.getNumDoc())
|
||||
.setCodDiviCont(ctbMovt.getCodDiviCont())
|
||||
@@ -657,7 +658,7 @@ public class AccountingRules extends QueryRules {
|
||||
.setAnnoPart(ctbScad.getAnnoPart())
|
||||
.setSerDoc(ctbScad.getSerDoc())
|
||||
.setNumDoc(ctbScad.getNumDoc())
|
||||
.setDataCmov(ctbMovr.getDataCmov())
|
||||
.setDataCmov(UtilityLocalDate.localDateFromDate(ctbMovr.getDataCmov()))
|
||||
.setIdRiga(ctbMovr.getIdRiga())
|
||||
.setImpDare(impDare)
|
||||
.setImpAvere(impAvere)
|
||||
@@ -735,7 +736,7 @@ public class AccountingRules extends QueryRules {
|
||||
.setAnnoPart(ctbMovr.getAnnoPart())
|
||||
.setSerDoc(ctbMovr.getSerDoc())
|
||||
.setNumDoc(ctbMovr.getNumDoc())
|
||||
.setDataCmov(ctbMovr.getDataCmov())
|
||||
.setDataCmov(UtilityLocalDate.localDateFromDate(ctbMovr.getDataCmov()))
|
||||
.setIdRiga(ctbMovr.getIdRiga())
|
||||
.setImpDare(ctbMovr.getImpDare())
|
||||
.setImpAvere(ctbMovr.getImpAvere())
|
||||
@@ -962,18 +963,16 @@ public class AccountingRules extends QueryRules {
|
||||
public static CtbMovt completeScadRitAcc(Connection conn, CtbRitAcc ctbRitAcc) throws Exception {
|
||||
String sql =
|
||||
"SELECT count(*) as count_partita " +
|
||||
" FROM ctb_part inner join ctb_parr on ctb_part.tipo_anag = ctb_parr.tipo_anag and " +
|
||||
"ctb_part.cod_anag = ctb_parr.cod_anag and " +
|
||||
"ctb_part.anno_part = ctb_parr.anno_part and " +
|
||||
"ctb_part.ser_doc = ctb_parr.ser_doc and " +
|
||||
"ctb_part.num_doc = ctb_parr.num_doc " +
|
||||
" WHERE ctb_parr.num_cmov = " + UtilityDB.valueToString(ctbRitAcc.getNumCmovFat()) + " AND " +
|
||||
" ( ctb_part.dare_part = 0 or ctb_part.avere_part = 0 ) ";
|
||||
" FROM ctb_part inner join ctb_parr on ctb_part.tipo_anag = ctb_parr.tipo_anag and " +
|
||||
"ctb_part.cod_anag = ctb_parr.cod_anag and " +
|
||||
"ctb_part.anno_part = ctb_parr.anno_part and " +
|
||||
"ctb_part.ser_doc = ctb_parr.ser_doc and " +
|
||||
"ctb_part.num_doc = ctb_parr.num_doc " +
|
||||
" WHERE ctb_parr.num_cmov = " + UtilityDB.valueToString(ctbRitAcc.getNumCmovFat());
|
||||
|
||||
Integer countPart = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(conn, sql);
|
||||
|
||||
if (countPart > 0) {
|
||||
|
||||
if (countPart <= 1) {
|
||||
CtbMovt ctbMovt = new CtbMovt();
|
||||
ctbMovt.setNumCmov(ctbRitAcc.getNumCmovFat());
|
||||
ctbMovt.setGeneraScad(ctbRitAcc.getGeneraScadenze());
|
||||
@@ -989,7 +988,7 @@ public class AccountingRules extends QueryRules {
|
||||
for (CtbScad ctbScad : ctbMovt.getCtbScad()) {
|
||||
ctbScad.setTipoAnag(UtilityString.isNullOrEmpty(ctbScad.getTipoAnag()) ? ctbMovt.getTipoAnag() : ctbScad.getTipoAnag());
|
||||
ctbScad.setCodAnag(UtilityString.isNullOrEmpty(ctbScad.getCodAnag()) ? ctbMovt.getCodAnag() : ctbScad.getCodAnag());
|
||||
ctbScad.setDataDoc(UtilityString.isNullOrEmpty(ctbScad.getDataDoc()) ? ctbMovt.getDataDoc() : ctbScad.getDataDoc());
|
||||
ctbScad.setDataDoc(UtilityLocalDate.isNull(ctbScad.getDataDoc(), UtilityLocalDate.localDateFromDate(ctbMovt.getDataDoc())));
|
||||
ctbScad.setSerDoc(UtilityString.isNullOrEmpty(ctbScad.getSerDoc()) ? ctbMovt.getSerDoc() : ctbScad.getSerDoc());
|
||||
ctbScad.setNumDoc(UtilityString.isNullOrEmpty(ctbScad.getNumDoc()) ? ctbMovt.getNumDoc() : ctbScad.getNumDoc());
|
||||
Integer annoPart = Integer.parseInt(new SimpleDateFormat("yyyy").format(ctbMovt.getDataDoc()));
|
||||
@@ -1126,5 +1125,16 @@ public class AccountingRules extends QueryRules {
|
||||
}
|
||||
return ventilazione;
|
||||
}
|
||||
|
||||
public static void checkRigaMovCtbParr( CtbMovt ctbMovt) {
|
||||
List<CtbMovr> row = ctbMovt.getCtbMovr().stream()
|
||||
.filter(x -> x.getCtbScad() != null && x.getCtbScad().size() > 0)
|
||||
.collect(Collectors.toList());
|
||||
for(CtbMovr r : row) {
|
||||
r.getCtbScad()
|
||||
.forEach(scad -> {scad.getCrlScadParr()
|
||||
.stream()
|
||||
.filter(x->x.getIdRigaMov() != r.getIdRiga())
|
||||
.forEach(x->x.setIdRigaMov(r.getIdRiga()));});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -412,12 +412,12 @@ public class CommonRules extends QueryRules {
|
||||
}
|
||||
}
|
||||
|
||||
public static void completeRigaCtbMovr(EntityBase testata) {
|
||||
public static void completeRigaCtbMovr(CtbMovt testata) {
|
||||
//questo campo definisce anche l'ordinemanto delle righe quindi viene sempre riassegnato.
|
||||
Integer startRiga = 0;
|
||||
|
||||
List<CtbMovr> rows =
|
||||
Stream.of(((CtbMovt) testata).getCtbMovr())
|
||||
Stream.of(testata.getCtbMovr())
|
||||
.filter(x -> x.getOperation() != OperationType.DELETE)
|
||||
.toList();
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ 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.entity._enum.ListinoEnum;
|
||||
import it.integry.ems_model.entity.common.DtbBaseDocR;
|
||||
import it.integry.ems_model.entity.common.DtbDocOrdR;
|
||||
import it.integry.ems_model.entity.common.DtbDocOrdT;
|
||||
@@ -675,7 +676,11 @@ public class DocOrdCalTotaliRules extends QueryRules {
|
||||
if ("A".equals(gestione)) {
|
||||
costo = DocumentRules.completeCostoUntDocA(conn, ((DtbDocr) row));
|
||||
} else if ("L".equals(gestione)) {
|
||||
costo = DocumentRules.completeCostoUntDocL(conn, ((DtbDocr) row), flagValCosto);
|
||||
if (testata.getListino().equalsIgnoreCase(ListinoEnum.COSTO_ULTIMO.getValue()) && !UtilityBigDecimal.isNullOrZero(row.getValUnt())) {
|
||||
costo = row.getValUnt();
|
||||
} else {
|
||||
costo = DocumentRules.completeCostoUntDocL(conn, ((DtbDocr) row), flagValCosto);
|
||||
}
|
||||
}
|
||||
((DtbDocr) row).setCostoUnt(costo);
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@ import java.sql.ResultSetMetaData;
|
||||
import java.sql.SQLException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@@ -72,8 +73,8 @@ public class SalesRules extends QueryRules {
|
||||
|
||||
if (dataFine != null) {
|
||||
|
||||
if (dataFine.equals(UtilityLocalDate.localDateFromDate(vtbListData.getDataFine())) &&
|
||||
vtbListData.getDataIniz().before((UtilityDate.getTodayWithoutTime())) &&
|
||||
if (dataFine.equals(vtbListData.getDataFine()) &&
|
||||
vtbListData.getDataIniz().isBefore(LocalDate.now()) &&
|
||||
!vtbListData.getMtbLisvData().isEmpty()) {
|
||||
throw new Exception("Impossibile modificare gli articoli di una promozione con data inizio antecedente a oggi");
|
||||
|
||||
@@ -84,7 +85,7 @@ public class SalesRules extends QueryRules {
|
||||
|
||||
}
|
||||
|
||||
if (vtbListData.getDataIniz().before((UtilityDate.getTodayWithoutTime())))
|
||||
if (vtbListData.getDataIniz().isBefore(LocalDate.now()))
|
||||
throw new Exception(String.format("Impossibile inserire una %s data inizio antecedente a oggi",
|
||||
(vtbListData.getDataFine() != null ? "promozione" : "variazione")));
|
||||
|
||||
@@ -94,13 +95,13 @@ public class SalesRules extends QueryRules {
|
||||
|
||||
|
||||
public static boolean checkDataFine(Connection conn, VtbListData vtbListData) throws Exception {
|
||||
LocalDate dataIniz = UtilityLocalDate.localDateFromDate(vtbListData.getDataIniz());
|
||||
LocalDate dataFine = UtilityLocalDate.localDateFromDate(vtbListData.getDataFine());
|
||||
LocalDate dataIniz = vtbListData.getDataIniz();
|
||||
LocalDate dataFine = vtbListData.getDataFine();
|
||||
|
||||
if (dataFine.isBefore(dataIniz))
|
||||
throw new Exception(String.format("Impossibile inserire//modificare una promozione con data fine (%s) antecedente a data inizio ( %s )",
|
||||
new SimpleDateFormat(CommonConstants.DATE_FORMAT_DMY_SLASHED).format(vtbListData.getDataFine()),
|
||||
new SimpleDateFormat(CommonConstants.DATE_FORMAT_DMY_SLASHED).format(vtbListData.getDataIniz())));
|
||||
UtilityLocalDate.formatDate(vtbListData.getDataFine(), CommonConstants.DATE_FORMAT_DMY_SLASHED),
|
||||
UtilityLocalDate.formatDate(vtbListData.getDataIniz(), CommonConstants.DATE_FORMAT_DMY_SLASHED)));
|
||||
|
||||
String promoEscluse = setupGest.getSetup(conn, "VTB_LIST", "CHECK_DATA_FINE", "PROMO_ESCLUSE");
|
||||
if (!UtilityString.isNullOrEmpty(promoEscluse)) {
|
||||
@@ -112,7 +113,7 @@ public class SalesRules extends QueryRules {
|
||||
if (vtbListData.getCheckDataFine() != null && vtbListData.getCheckDataFine()) {
|
||||
if (UtilityLocalDate.isBeforeToday(dataFine))
|
||||
throw new Exception(String.format("Impossibile inserire//modificare una promozione con data fine (%s) antecedente ad oggi",
|
||||
new SimpleDateFormat(CommonConstants.DATE_FORMAT_DMY_SLASHED).format(vtbListData.getDataFine())));
|
||||
UtilityLocalDate.formatDate(vtbListData.getDataFine(), CommonConstants.DATE_FORMAT_DMY_SLASHED)));
|
||||
}
|
||||
|
||||
if (vtbListData.getCheckDataFine() != null && vtbListData.getCheckDataFine()) {
|
||||
@@ -254,8 +255,8 @@ public class SalesRules extends QueryRules {
|
||||
public static String completeCodPromo(Connection connection, VtbListData vtbListData) throws Exception {
|
||||
String partialCode =
|
||||
vtbListData.getCodVlis() + ";" +
|
||||
new SimpleDateFormat(CommonConstants.DATE_FORMAT_YMD_DASHED).format(vtbListData.getDataIniz()) + ";" +
|
||||
new SimpleDateFormat(CommonConstants.DATE_FORMAT_YMD_DASHED).format(vtbListData.getDataFine());
|
||||
UtilityLocalDate.formatDate(vtbListData.getDataIniz(), CommonConstants.DATE_FORMAT_DMY_SLASHED) + ";" +
|
||||
UtilityLocalDate.formatDate(vtbListData.getDataFine(), CommonConstants.DATE_FORMAT_DMY_SLASHED);
|
||||
|
||||
String sql = "SELECT dbo.f_suggestCodeCodPromoVend( " + UtilityDB.valueToString(partialCode) + " ) ";
|
||||
String codPromo = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(connection, sql);
|
||||
@@ -277,7 +278,7 @@ public class SalesRules extends QueryRules {
|
||||
"vtb_list_data.versione = mtb_lisv_data.versione " +
|
||||
"where mtb_lisv_data.cod_mart = " + UtilityDB.valueToString(mtbLisvData.getCodMart()) + " and " +
|
||||
"vtb_list_data.cod_vlis = " + UtilityDB.valueToString(mtbLisvData.getCodVlis()) + " and " +
|
||||
"vtb_list_data.data_iniz <= " + UtilityDB.valueDateToString(mtbLisvData.getDataIniz(), CommonConstants.DATE_FORMAT_YMD_DASHED) +
|
||||
"vtb_list_data.data_iniz <= " + UtilityDB.valueToString(mtbLisvData.getDataIniz()) +
|
||||
(mtbLisvData.getVersione() != null ? " AND vtb_list_data.versione <> " + UtilityDB.valueToString(mtbLisvData.getVersione()) : "") +
|
||||
" ORDER BY vtb_list_data.data_iniz desc";
|
||||
|
||||
@@ -346,9 +347,9 @@ public class SalesRules extends QueryRules {
|
||||
|
||||
public static void setDataUltVar(Connection connection, VtbListData testata) throws Exception {
|
||||
if (testata.getOperation() == OperationType.INSERT || testata.getOperation() == OperationType.UPDATE || testata.getOperation() == OperationType.INSERT_OR_UPDATE) {
|
||||
testata.setDataUltVar(new Date());
|
||||
testata.setDataUltVar(LocalDateTime.now());
|
||||
} else if ( testata.getMtbLisvData() != null && testata.getMtbLisvData().stream().anyMatch(x-> x.getOperation() == OperationType.INSERT || x.getOperation() == OperationType.UPDATE || x.getOperation() == OperationType.INSERT_OR_UPDATE )){
|
||||
testata.setDataUltVar(new Date());
|
||||
testata.setDataUltVar(LocalDateTime.now());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -371,7 +372,7 @@ public class SalesRules extends QueryRules {
|
||||
" FROM vtb_list_data " +
|
||||
" WHERE cod_vlis = " + UtilityDB.valueToString(vtbListData.getCodVlis()) + " AND " +
|
||||
"versione = " + UtilityDB.valueToString(vtbListData.getVersione()) + " AND " +
|
||||
"data_iniz = " + UtilityDB.valueDateToString(vtbListData.getDataIniz(), CommonConstants.DATE_FORMAT_YMD_DASHED);
|
||||
"data_iniz = " + UtilityDB.valueToString(vtbListData.getDataIniz());
|
||||
|
||||
boolean existLisv = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(conn, query);
|
||||
|
||||
@@ -388,7 +389,7 @@ public class SalesRules extends QueryRules {
|
||||
+ " WHERE cod_vlis = "
|
||||
+ UtilityDB.valueToString(vtbListData.getCodVlis())
|
||||
+ " AND data_iniz = "
|
||||
+ UtilityDB.valueDateToString(vtbListData.getDataIniz(), CommonConstants.DATE_FORMAT_YMD_DASHED)
|
||||
+ UtilityDB.valueToString(vtbListData.getDataIniz())
|
||||
+ " AND cod_promo IS NULL"
|
||||
+ " AND isNull(note, '') = IsNull(" + UtilityDB.valueToString(vtbListData.getNote()) + ", '') ";
|
||||
versioneNew = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(conn, query);
|
||||
@@ -399,9 +400,9 @@ public class SalesRules extends QueryRules {
|
||||
+ " WHERE cod_vlis = "
|
||||
+ UtilityDB.valueToString(vtbListData.getCodVlis())
|
||||
+ " AND data_iniz = "
|
||||
+ UtilityDB.valueDateToString(vtbListData.getDataIniz(), CommonConstants.DATE_FORMAT_YMD_DASHED)
|
||||
+ UtilityDB.valueToString(vtbListData.getDataIniz())
|
||||
+ " AND data_fine = "
|
||||
+ UtilityDB.valueDateToString(vtbListData.getDataFine(), CommonConstants.DATE_FORMAT_YMD_DASHED) + " AND "
|
||||
+ UtilityDB.valueToString(vtbListData.getDataFine()) + " AND "
|
||||
+ " cod_promo = " + UtilityDB.valueToString(vtbListData.getCodPromo()) + " AND "
|
||||
+ " ( note = " + UtilityDB.valueToString(vtbListData.getNote()) + " OR "
|
||||
+ UtilityDB.valueToString(vtbListData.getNote()) + " is null ) ";
|
||||
@@ -413,17 +414,6 @@ public class SalesRules extends QueryRules {
|
||||
if (versioneNew == null || versioneNew == 0) {
|
||||
if (vtbListData.getOperation() == OperationType.INSERT_OR_UPDATE)
|
||||
vtbListData.setOperation(OperationType.INSERT);
|
||||
// query = " SELECT max(versione) versione"
|
||||
// + " FROM vtb_list_data "
|
||||
// + " WHERE cod_vlis = "
|
||||
// + UtilityDB.valueToString(vtbListData.getCodVlis());
|
||||
// versioneNew = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(conn, query);
|
||||
//
|
||||
// if (versioneNew == null) {
|
||||
// versioneNew = 1;
|
||||
// } else {
|
||||
// versioneNew = versioneNew + 1;
|
||||
// }
|
||||
} else {
|
||||
vtbListData.setOperation(OperationType.UPDATE);
|
||||
}
|
||||
@@ -432,12 +422,11 @@ public class SalesRules extends QueryRules {
|
||||
return versioneNew;
|
||||
}
|
||||
|
||||
public static BigDecimal completeRicaricaRow(Connection connection, String codVlis, String codMart, Date dataIniz) throws Exception {
|
||||
public static BigDecimal completeRicaricaRow(Connection connection, String codVlis, String codMart, LocalDate dataIniz) throws Exception {
|
||||
|
||||
String sql = "SELECT distinct ricarico FROM dbo.ftx_getListinoVendita(" + UtilityDB.valueDateToString(dataIniz, CommonConstants.DATE_FORMAT_YMD_DASHED) + ","
|
||||
String sql = "SELECT distinct ricarico FROM dbo.ftx_getListinoVendita(" + UtilityDB.valueToString(dataIniz) + ","
|
||||
+ UtilityDB.valueToString(codVlis) + "," + UtilityDB.valueToString(codMart) + ", 'N')";
|
||||
|
||||
|
||||
BigDecimal ricarico = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(connection, sql);
|
||||
|
||||
return ricarico;
|
||||
@@ -447,7 +436,7 @@ public class SalesRules extends QueryRules {
|
||||
if (entity.getListData() == null) {
|
||||
String codVlis = entity.getCodVlis();
|
||||
String codMart = entity.getCodMart();
|
||||
Date dataIniz = entity.getDataIniz();
|
||||
LocalDate dataIniz = entity.getDataIniz();
|
||||
|
||||
String sql =
|
||||
"SELECT Cast(count(*) as bit) as existLisv " +
|
||||
@@ -489,7 +478,7 @@ public class SalesRules extends QueryRules {
|
||||
+ "sconto_strato, "
|
||||
+ "sconto_pedane, "
|
||||
+ "flag_prz_bloccato "
|
||||
+ " FROM dbo.getListinoVendita(" + UtilityDB.valueDateToString(dataIniz, CommonConstants.DATE_FORMAT_YMD_DASHED) + ","
|
||||
+ " FROM dbo.getListinoVendita(" + UtilityDB.valueToString(dataIniz) + ","
|
||||
+ UtilityDB.valueToString(codVlis) + ","
|
||||
+ UtilityDB.valueToString(codMart) + ") ";
|
||||
|
||||
@@ -947,15 +936,16 @@ public class SalesRules extends QueryRules {
|
||||
public static Boolean checkChangeRicarico(Connection conn, MtbLisvData entity) throws Exception {
|
||||
Boolean ret = false;
|
||||
String query =
|
||||
"SELECT user_name " +
|
||||
"SELECT Cast(count(*) as bit) " +
|
||||
" FROM stb_user " +
|
||||
" WHERE stb_user.user_name = " + UtilityDB.valueToString(entity.getUsername()) + " AND " +
|
||||
"stb_user.flag_dba = 'N' AND " +
|
||||
"stb_user.user_name not in (select user_name from stb_gest_setup_user WHERE section = 'W_VLIST_RC' AND key_section = 'DISABLE_CHK_RICARICO' and value = 'S') ";
|
||||
|
||||
PreparedStatement ps = conn.prepareStatement(query);
|
||||
ResultSet rs = ps.executeQuery();
|
||||
if (rs.next()) {
|
||||
Boolean checkRicarico = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(conn, query);
|
||||
if (checkRicarico == null) checkRicarico = false;
|
||||
|
||||
if (checkRicarico) {
|
||||
query =
|
||||
"SELECT ricarico_min, " +
|
||||
"ricarico_max, " +
|
||||
@@ -966,15 +956,12 @@ public class SalesRules extends QueryRules {
|
||||
" vtb_range_ricarico.cod_msgr = mtb_aart.cod_msgr " +
|
||||
" WHERE mtb_aart.cod_mart = " + UtilityDB.valueToString(entity.getCodMart()) + "AND " +
|
||||
"( vtb_range_ricarico.ricarico_min <> 0 OR vtb_range_ricarico.ricarico_max <> 0 )";
|
||||
ps = conn.prepareStatement(query);
|
||||
rs = ps.executeQuery();
|
||||
if (rs.next()) {
|
||||
BigDecimal ricaricoMin = rs.getBigDecimal(1);
|
||||
BigDecimal ricaricoMax = rs.getBigDecimal(2);
|
||||
String descrizioneArt = rs.getString(3);
|
||||
String flagTipoRicarico = rs.getString(4);
|
||||
rs.close();
|
||||
ps.close();
|
||||
HashMap<String, Object> dati = UtilityDB.executeSimpleQueryOnlyFirstRow(conn, query);
|
||||
if (UtilityHashMap.isPresent(dati)) {
|
||||
BigDecimal ricaricoMin = UtilityHashMap.getValueIfExists(dati, "ricarico_min");
|
||||
BigDecimal ricaricoMax = UtilityHashMap.getValueIfExists(dati, "ricarico_max");
|
||||
String descrizioneArt = UtilityHashMap.getValueIfExists(dati, "descrizione");
|
||||
String flagTipoRicarico = UtilityHashMap.getValueIfExists(dati, "flag_tipo_ricarico");
|
||||
|
||||
BigDecimal ricaricoCalc = BigDecimal.ZERO;
|
||||
if ("P".equals(flagTipoRicarico)) {
|
||||
@@ -984,14 +971,8 @@ public class SalesRules extends QueryRules {
|
||||
" mtb_aart.perc_sfrido)" +
|
||||
" FROM mtb_aart " +
|
||||
" WHERE mtb_aart.cod_mart = " + UtilityDB.valueToString(entity.getCodMart());
|
||||
ps = conn.prepareStatement(query);
|
||||
rs = ps.executeQuery();
|
||||
|
||||
if (rs.next()) {
|
||||
ricaricoCalc = rs.getBigDecimal(1);
|
||||
}
|
||||
rs.close();
|
||||
ps.close();
|
||||
ricaricoCalc = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(conn, query);
|
||||
} else {
|
||||
ricaricoCalc = entity.getPrzVend().subtract(entity.getPrzBase());
|
||||
}
|
||||
@@ -1003,8 +984,6 @@ public class SalesRules extends QueryRules {
|
||||
}
|
||||
|
||||
}
|
||||
rs.close();
|
||||
ps.close();
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -1017,7 +996,7 @@ public class SalesRules extends QueryRules {
|
||||
String flagPrzBloccato = "N";
|
||||
if (chkPrzBloccato) {
|
||||
query = "SELECT flag_prz_bloccato " +
|
||||
"FROM dbo.GetListinoVendita(" + UtilityDB.valueDateToString(entity.getDataIniz(), CommonConstants.DATE_FORMAT_YMD_DASHED) + ", " +
|
||||
"FROM dbo.GetListinoVendita(" + UtilityDB.valueToString(entity.getDataIniz()) + ", " +
|
||||
UtilityDB.valueToString(entity.getCodVlis()) + ", " +
|
||||
UtilityDB.valueToString(entity.getCodMart()) + ") lisv ";
|
||||
flagPrzBloccato = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(conn, query);
|
||||
@@ -1357,7 +1336,7 @@ public class SalesRules extends QueryRules {
|
||||
public static Long completeIdMtbLisvDataSpese(Connection connection, MtbLisvDataSpese mtbLisvDataSpese) throws SQLException {
|
||||
VtbListData vtbListData = (VtbListData) mtbLisvDataSpese.getParent();
|
||||
|
||||
Date dataIniz = vtbListData.getDataIniz();
|
||||
LocalDate dataIniz = vtbListData.getDataIniz();
|
||||
|
||||
String sql = Query.format(
|
||||
"SELECT id\n" +
|
||||
@@ -1371,4 +1350,19 @@ public class SalesRules extends QueryRules {
|
||||
|
||||
return UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(connection, sql);
|
||||
}
|
||||
|
||||
public static boolean checkMtbLisvDelete(Connection conn, MtbLisv mtbLisv) throws Exception {
|
||||
String sql = Query.format(
|
||||
"SELECT Cast(count(*) As BIT)\n" +
|
||||
"FROM mtb_lisv_data " +
|
||||
"WHERE cod_vlis = %s AND cod_mart = %s",
|
||||
mtbLisv.getCodVlis(),
|
||||
mtbLisv.getCodMart()
|
||||
);
|
||||
|
||||
Boolean exist = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(conn, sql);
|
||||
if (exist == null) exist = false;
|
||||
|
||||
return exist;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@ import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.context.ContextLoader;
|
||||
|
||||
import java.sql.PreparedStatement;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
@@ -186,8 +187,7 @@ public class AsyncManager {
|
||||
.orElse(null);
|
||||
|
||||
try (MultiDBTransactionManager multiDBTransactionManager = new MultiDBTransactionManager(connectionModel);
|
||||
SQLServerPreparedStatement insertBulkPs = (SQLServerPreparedStatement) multiDBTransactionManager.prepareStatement(insertSQL)) {
|
||||
|
||||
PreparedStatement insertBulkPs = multiDBTransactionManager.prepareStatement(insertSQL)) {
|
||||
insertBulkPs.setLong(1, stbTransactionLog.getPublicationGroupId());
|
||||
insertBulkPs.setObject(2, stbTransactionLog.getCreatedAt());
|
||||
insertBulkPs.setString(3, stbTransactionLog.getUserName());
|
||||
|
||||
@@ -21,7 +21,7 @@ public class BasicConnectionPool {
|
||||
@Autowired
|
||||
private SettingsModel settingsModel;
|
||||
|
||||
private final ConcurrentHashMap<String, DataSource> registeredDatasources = new ConcurrentHashMap<>();
|
||||
private final ConcurrentHashMap<AvailableConnectionModel, DataSource> registeredDatasources = new ConcurrentHashMap<>();
|
||||
|
||||
private volatile boolean initialized = false;
|
||||
private final Object initLock = new Object(); // Lock più leggero solo per inizializzazione
|
||||
@@ -63,7 +63,7 @@ public class BasicConnectionPool {
|
||||
|
||||
private void initializeConnections() {
|
||||
final List<AvailableConnectionModel> availableConnections =
|
||||
settingsModel.getAvailableConnectionsWithoutDuplicatedProfiles(false);
|
||||
settingsModel.getAvailableConnections(false);
|
||||
|
||||
for (AvailableConnectionModel model : availableConnections) {
|
||||
try {
|
||||
@@ -89,14 +89,15 @@ public class BasicConnectionPool {
|
||||
try {
|
||||
registerDataSourceIfNotExists(connectionsModel);
|
||||
|
||||
String dbName = connectionsModel.getDbName();
|
||||
DataSource ds = registeredDatasources.get(dbName);
|
||||
DataSource ds = registeredDatasources.get(connectionsModel);
|
||||
|
||||
if (ds == null) {
|
||||
throw new IllegalArgumentException("No datasource registered for profile: " + connectionsModel.getProfileName());
|
||||
}
|
||||
|
||||
String dbName = connectionsModel.getDbName();
|
||||
Connection connection = ds.getConnection();
|
||||
|
||||
if (!connection.getCatalog().equalsIgnoreCase(dbName)) {
|
||||
throw new IllegalArgumentException("Connection for profile " + connectionsModel.getProfileName() + " is not for database " + dbName);
|
||||
}
|
||||
@@ -110,9 +111,8 @@ public class BasicConnectionPool {
|
||||
|
||||
|
||||
private void registerDataSourceIfNotExists(AvailableConnectionModel connectionModel) throws Exception {
|
||||
String dbName = connectionModel.getDbName();
|
||||
if (!registeredDatasources.containsKey(dbName)) {
|
||||
registeredDatasources.put(dbName, createNewDataSource(connectionModel));
|
||||
if (!registeredDatasources.containsKey(connectionModel)) {
|
||||
registeredDatasources.put(connectionModel, createNewDataSource(connectionModel));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package it.integry.ems.sync.MultiDBTransaction;
|
||||
|
||||
import it.integry.ems.migration._base.IntegryCustomerDB;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
@@ -354,4 +355,8 @@ public class Connection implements java.sql.Connection {
|
||||
isInternalDb = internalDb;
|
||||
return this;
|
||||
}
|
||||
|
||||
public IntegryCustomerDB getIntegryCustomerDB() {
|
||||
return IntegryCustomerDB.parse(getDbName());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,7 +32,8 @@ public class UserSession {
|
||||
try {
|
||||
currentUser = UtilityUser.getCurrentUser(multiDBTransactionManager, requestDataDTO);
|
||||
|
||||
if(currentUser != null) currentUserDepo = UtilityUser.getDefaultUserDepo(multiDBTransactionManager, currentUser);
|
||||
if (currentUser != null)
|
||||
currentUserDepo = UtilityUser.getDefaultUserDepo(multiDBTransactionManager.getPrimaryConnection().getIntegryCustomerDB(), currentUser);
|
||||
} catch (Exception ex) {
|
||||
//logger.trace(UserSession.class.getName() + ": errore durante l'inizializzazione", ex);
|
||||
}
|
||||
|
||||
@@ -2,8 +2,10 @@ package it.integry.ems.user;
|
||||
|
||||
import it.integry.ems._context.ApplicationContextProvider;
|
||||
import it.integry.ems.dto.EntityPermissionsDTO;
|
||||
import it.integry.ems.dynamic_cache.EntityCacheComponent;
|
||||
import it.integry.ems.exception.PrimaryDatabaseNotPresentException;
|
||||
import it.integry.ems.javabeans.RequestDataDTO;
|
||||
import it.integry.ems.migration._base.IntegryCustomerDB;
|
||||
import it.integry.ems.service.EntityProcessor;
|
||||
import it.integry.ems.sync.MultiDBTransaction.Connection;
|
||||
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
|
||||
@@ -69,23 +71,30 @@ public class UtilityUser {
|
||||
}
|
||||
|
||||
|
||||
public static MtbDepo getDefaultUserDepo(MultiDBTransactionManager multiDBTransactionManager, UserDTO userDTO) throws SQLException, IOException, PrimaryDatabaseNotPresentException, DataConverterNotFoundException, InstantiationException, IllegalAccessException, InvalidUserException {
|
||||
public static MtbDepo getDefaultUserDepo(IntegryCustomerDB integryCustomerDB, UserDTO userDTO) throws SQLException, IOException, PrimaryDatabaseNotPresentException, DataConverterNotFoundException, InstantiationException, IllegalAccessException, InvalidUserException {
|
||||
if (userDTO == null) throw new InvalidUserException();
|
||||
|
||||
String sql = "SELECT md.* FROM " + MtbDepo.ENTITY + " md " +
|
||||
" INNER JOIN " + WtbDepo.ENTITY + " wd " +
|
||||
" ON md.cod_mdep = wd.cod_mdep" +
|
||||
" WHERE wd.user_name = " + UtilityDB.valueToString(userDTO.getUsername()) +
|
||||
" order by wd.default_depo desc";
|
||||
final EntityCacheComponent entityCacheComponent = ApplicationContextProvider.getApplicationContext().getBean(EntityCacheComponent.class);
|
||||
|
||||
List<MtbDepo> depos = UtilityDB.executeSimpleQueryDTO(multiDBTransactionManager.getPrimaryConnection(), sql, MtbDepo.class);
|
||||
MtbDepo defaultDepo = entityCacheComponent.<MtbDepo>getCachedEntitiesStream(integryCustomerDB, MtbDepo.ENTITY,
|
||||
x -> x.getCodMdep().equalsIgnoreCase(userDTO.getCodMdep()))
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
|
||||
if (depos == null || depos.isEmpty()) {
|
||||
// String sql = "SELECT md.* FROM " + MtbDepo.ENTITY + " md " +
|
||||
// " INNER JOIN " + WtbDepo.ENTITY + " wd " +
|
||||
// " ON md.cod_mdep = wd.cod_mdep" +
|
||||
// " WHERE wd.user_name = " + UtilityDB.valueToString(userDTO.getUsername()) +
|
||||
// " order by wd.default_depo desc";
|
||||
|
||||
// List<MtbDepo> depos = UtilityDB.executeSimpleQueryDTO(multiDBTransactionManager.getPrimaryConnection(), sql, MtbDepo.class);
|
||||
|
||||
if (defaultDepo == null) {
|
||||
logger.trace("Nessun deposito trovato per l'utente " + userDTO.getUsername());
|
||||
return null;
|
||||
}
|
||||
|
||||
return depos.get(0);
|
||||
return defaultDepo;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@JsonInclude(JsonInclude.Include.ALWAYS)
|
||||
public class UserDTO {
|
||||
public class UserDTO implements Cloneable{
|
||||
|
||||
@SqlField("user_name")
|
||||
private String username;
|
||||
@@ -288,4 +288,14 @@ public class UserDTO {
|
||||
this.availableProfiles = availableProfiles;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public UserDTO clone() {
|
||||
try {
|
||||
UserDTO clone = (UserDTO) super.clone();
|
||||
return clone;
|
||||
} catch (CloneNotSupportedException e) {
|
||||
throw new AssertionError();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -165,13 +165,13 @@ public class GeneraOrdLav {
|
||||
|
||||
String activityID = dtbOrdt.getActivityId();
|
||||
boolean existActivity = !UtilityString.isNullOrEmpty(activityID);
|
||||
HashMap<String, Object> datiOrdine = null;
|
||||
|
||||
if (existOrd && row.getOperation() == OperationType.UPDATE) {
|
||||
datiOrdine = checkOrdLav(conn, ordProdSetupDTO.isCheckLockProd(), row.getGestione(), row.getDataOrd(), row.getNumOrd(), row.getRigaOrd());
|
||||
activityID = UtilityHashMap.getValueIfExists(datiOrdine, "activity_id");
|
||||
datiOrdLav = checkOrdLav(conn, ordProdSetupDTO.isCheckLockProd(), row.getGestione(), row.getDataOrd(), row.getNumOrd(), row.getRigaOrd());
|
||||
activityID = UtilityHashMap.getValueIfExists(datiOrdLav, "activity_id");
|
||||
// Verifica su è stato passato l'operatore dall'esterno
|
||||
if (codJflavLav == null) {
|
||||
codJflavLav = UtilityHashMap.getValueIfExists(datiOrdine, "cod_jflav");
|
||||
codJflavLav = UtilityHashMap.getValueIfExists(datiOrdLav, "cod_jflav");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -230,8 +230,8 @@ public class GeneraOrdLav {
|
||||
if (!existOrd) {
|
||||
numOrdLav = OrderRules.completeNumOrd(conn, gestioneLav, dataOrd, null);
|
||||
} else {
|
||||
numOrdLav = UtilityHashMap.getValueIfExists(datiOrdine, "num_ord");
|
||||
dataOrd = UtilityHashMap.getValueIfExists(datiOrdine, "data_ord");
|
||||
numOrdLav = UtilityHashMap.getValueIfExists(datiOrdLav, "num_ord");
|
||||
dataOrd = UtilityHashMap.getValueIfExists(datiOrdLav, "data_ord");
|
||||
}
|
||||
|
||||
row.setNumOrdRif(numOrdLav);
|
||||
@@ -1457,48 +1457,51 @@ public class GeneraOrdLav {
|
||||
activityID = (String) datiOrdL.get("activity_id");
|
||||
}
|
||||
|
||||
Integer ggDiff = Math.toIntExact(UtilityLocalDate.daysAfterDate(dataInizProdOld, dataInizNew));
|
||||
if (ggDiff != 0) {
|
||||
sql = "SELECT * FROM dtb_ordr";
|
||||
sql = UtilityDB.addwhereCond(sql, ordT.getPkWhereCond(), true);
|
||||
List<DtbOrdr> dtbOrdrL = UtilityDB.executeSimpleQueryDTO(conn, sql, DtbOrdr.class);
|
||||
|
||||
if (dtbOrdrL != null && !dtbOrdrL.isEmpty()) {
|
||||
dtbOrdrL.stream().forEach(x -> {
|
||||
if (dataInizProdOld != null && dataInizNew != null && dataInizProdOld != EmsRestConstants.LOCAL_DATE_NULL && dataInizNew != EmsRestConstants.LOCAL_DATE_NULL){
|
||||
Integer ggDiff = Math.toIntExact(UtilityLocalDate.daysAfterDate(dataInizProdOld, dataInizNew));
|
||||
if (ggDiff != 0) {
|
||||
sql = "SELECT * FROM dtb_ordr";
|
||||
sql = UtilityDB.addwhereCond(sql, ordT.getPkWhereCond(), true);
|
||||
List<DtbOrdr> dtbOrdrL = UtilityDB.executeSimpleQueryDTO(conn, sql, DtbOrdr.class);
|
||||
|
||||
if (dtbOrdrL != null && !dtbOrdrL.isEmpty()) {
|
||||
dtbOrdrL.stream().forEach(x -> {
|
||||
x.setDataCons(x.getDataCons().plusDays(ggDiff));
|
||||
x.setOperation(OperationType.UPDATE);
|
||||
});
|
||||
|
||||
ordT.setDtbOrdr(dtbOrdrL);
|
||||
}
|
||||
|
||||
sql = "SELECT * FROM dtb_ord_steps";
|
||||
sql = UtilityDB.addwhereCond(sql, ordT.getPkWhereCond(), true);
|
||||
List<DtbOrdSteps> dtbOrdSteps = UtilityDB.executeSimpleQueryDTO(conn, sql, DtbOrdSteps.class);
|
||||
|
||||
dtbOrdSteps.stream().forEach(x -> {
|
||||
x.setDataIniz(x.getDataIniz() != null ? x.getDataIniz().plusDays(ggDiff) : null);
|
||||
x.setDataFine(x.getDataFine() != null ? x.getDataFine().plusDays(ggDiff) : null);
|
||||
x.setOperation(OperationType.UPDATE);
|
||||
});
|
||||
|
||||
ordT.setDtbOrdr(dtbOrdrL);
|
||||
}
|
||||
ordT.setDtbOrdSteps(dtbOrdSteps);
|
||||
|
||||
sql = "SELECT * FROM dtb_ord_steps";
|
||||
sql = UtilityDB.addwhereCond(sql, ordT.getPkWhereCond(), true);
|
||||
List<DtbOrdSteps> dtbOrdSteps = UtilityDB.executeSimpleQueryDTO(conn, sql, DtbOrdSteps.class);
|
||||
// FABIO: DA CAPIRE COME VALORIZZATA LE ATTIVITA MODIFICATE
|
||||
if (assegnaAttivita) {
|
||||
sql = "SELECT stb_activity.* " +
|
||||
" FROM stb_activity " +
|
||||
" where (activity_id = " + UtilityDB.valueToString(activityID) + " or " +
|
||||
" parent_activity_id = " + UtilityDB.valueToString(activityID) + ")";
|
||||
List<StbActivity> stbActivity = UtilityDB.executeSimpleQueryDTO(conn, sql, StbActivity.class);
|
||||
|
||||
dtbOrdSteps.stream().forEach(x -> {
|
||||
x.setDataIniz(x.getDataIniz() != null ? x.getDataIniz().plusDays(ggDiff) : null);
|
||||
x.setDataFine(x.getDataFine() != null ? x.getDataFine().plusDays(ggDiff) : null);
|
||||
x.setOperation(OperationType.UPDATE);
|
||||
});
|
||||
stbActivity.stream().forEach(x -> {
|
||||
x.setEstimatedTime(x.getEstimatedTime().plusDays(ggDiff));
|
||||
x.setEstimatedEndtime(x.getEstimatedEndtime().plusDays(ggDiff));
|
||||
x.setOperation(OperationType.INSERT_OR_UPDATE);
|
||||
});
|
||||
|
||||
ordT.setDtbOrdSteps(dtbOrdSteps);
|
||||
|
||||
// FABIO: DA CAPIRE COME VALORIZZATA LE ATTIVITA MODIFICATE
|
||||
if (assegnaAttivita) {
|
||||
sql = "SELECT stb_activity.* " +
|
||||
" FROM stb_activity " +
|
||||
" where (activity_id = " + UtilityDB.valueToString(activityID) + " or " +
|
||||
" parent_activity_id = " + UtilityDB.valueToString(activityID) + ")";
|
||||
List<StbActivity> stbActivity = UtilityDB.executeSimpleQueryDTO(conn, sql, StbActivity.class);
|
||||
|
||||
stbActivity.stream().forEach(x -> {
|
||||
x.setEstimatedTime(x.getEstimatedTime().plusDays(ggDiff));
|
||||
x.setEstimatedEndtime(x.getEstimatedEndtime().plusDays(ggDiff));
|
||||
x.setOperation(OperationType.INSERT_OR_UPDATE);
|
||||
});
|
||||
|
||||
row.setStbActivityList(stbActivity);
|
||||
row.setStbActivityList(stbActivity);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -373,9 +373,9 @@ public class ProductionBusinessLogic {
|
||||
if (partitaMag != null && !partitaMag.isEmpty() && existLotto == 0) {
|
||||
// Definizione data scadenza partita di magazzino
|
||||
parameter = codMart + ';' +
|
||||
formato.format(dataCons) + ';' +
|
||||
UtilityLocalDate.formatDate(dataCons,CommonConstants.DATE_FORMAT_YMD_SLASHED)+';' +
|
||||
codJfas + ";" +
|
||||
formato.format(dataOrd) + ";" + /*data ordine produzione*/
|
||||
UtilityLocalDate.formatDate(dataOrd,CommonConstants.DATE_FORMAT_YMD_SLASHED) + ";" + /*data ordine produzione*/
|
||||
numOrd + ";" /*numero ordine di produzione*/
|
||||
/*Data ordine e numero ordine di lavorazione non vengono passati perchè in questa fase non esistono*/;
|
||||
|
||||
|
||||
@@ -65,9 +65,6 @@ public class CtbAmac extends EntityBase {
|
||||
@SqlField(value = "flag_attivo", nullable = false, defaultObjectValue = "1")
|
||||
private Boolean flagAttivo;
|
||||
|
||||
@SqlField(value = "cod_mdep")
|
||||
private String codMdep;
|
||||
|
||||
@SqlField(value = "posizione")
|
||||
@FK(tableName = MtbDepoPosizioni.ENTITY)
|
||||
private String posizione;
|
||||
@@ -241,15 +238,6 @@ public class CtbAmac extends EntityBase {
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getCodMdep() {
|
||||
return codMdep;
|
||||
}
|
||||
|
||||
public CtbAmac setCodMdep(String codMdep) {
|
||||
this.codMdep = codMdep;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getPosizione() {
|
||||
return posizione;
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ import org.apache.logging.log4j.Logger;
|
||||
import org.kie.api.definition.type.PropertyReactive;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
|
||||
@PropertyReactive
|
||||
@@ -61,7 +61,7 @@ public class CtbParr extends EntityBase {
|
||||
|
||||
@ImportFromParent
|
||||
@SqlField(value = "data_cmov", nullable = false)
|
||||
private Date dataCmov;
|
||||
private LocalDate dataCmov;
|
||||
|
||||
@SqlField(value = "imp_dare", nullable = false, defaultObjectValue = "0")
|
||||
private BigDecimal impDare;
|
||||
@@ -86,7 +86,7 @@ public class CtbParr extends EntityBase {
|
||||
private BigDecimal cambioDiviCont;
|
||||
|
||||
@ImportFromParent
|
||||
private Date dataDoc;
|
||||
private LocalDate dataDoc;
|
||||
|
||||
@ImportFromParent
|
||||
private String chiudiScad;
|
||||
@@ -174,11 +174,11 @@ public class CtbParr extends EntityBase {
|
||||
return this;
|
||||
}
|
||||
|
||||
public Date getDataCmov() {
|
||||
public LocalDate getDataCmov() {
|
||||
return dataCmov;
|
||||
}
|
||||
|
||||
public CtbParr setDataCmov(Date dataCmov) {
|
||||
public CtbParr setDataCmov(LocalDate dataCmov) {
|
||||
this.dataCmov = dataCmov;
|
||||
return this;
|
||||
}
|
||||
@@ -237,11 +237,11 @@ public class CtbParr extends EntityBase {
|
||||
return this;
|
||||
}
|
||||
|
||||
public Date getDataDoc() {
|
||||
public LocalDate getDataDoc() {
|
||||
return dataDoc;
|
||||
}
|
||||
|
||||
public CtbParr setDataDoc(Date dataDoc) {
|
||||
public CtbParr setDataDoc(LocalDate dataDoc) {
|
||||
this.dataDoc = dataDoc;
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ import it.integry.ems_model.annotation.*;
|
||||
import it.integry.ems_model.base.EntityBase;
|
||||
import org.kie.api.definition.type.PropertyReactive;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
@@ -46,7 +46,7 @@ public class CtbPart extends EntityBase {
|
||||
|
||||
@ImportFromParent (value = "data_doc")
|
||||
@SqlField(value = "data_doc")
|
||||
private Date dataDoc;
|
||||
private LocalDate dataDoc;
|
||||
|
||||
@SqlField(value = "tot_imponib", nullable = false, defaultObjectValue = "0")
|
||||
private BigDecimal totImponib;
|
||||
@@ -185,11 +185,11 @@ public class CtbPart extends EntityBase {
|
||||
return this;
|
||||
}
|
||||
|
||||
public Date getDataDoc() {
|
||||
public LocalDate getDataDoc() {
|
||||
return dataDoc;
|
||||
}
|
||||
|
||||
public CtbPart setDataDoc(Date dataDoc) {
|
||||
public CtbPart setDataDoc(LocalDate dataDoc) {
|
||||
this.dataDoc = dataDoc;
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -10,8 +10,8 @@ import org.apache.logging.log4j.Logger;
|
||||
import org.kie.api.definition.type.PropertyReactive;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@PropertyReactive
|
||||
@@ -58,11 +58,11 @@ public class CtbScad extends EntityBase {
|
||||
private String codPaga;
|
||||
|
||||
@ImportFromParent( value = "data_doc")
|
||||
@SqlField(value = "data_doc", nullable = false, format = CommonConstants.SYSDATE)
|
||||
private Date dataDoc;
|
||||
@SqlField(value = "data_doc", nullable = false)
|
||||
private LocalDate dataDoc;
|
||||
|
||||
@SqlField(value = "data_scad", nullable = false, format = CommonConstants.SYSDATE)
|
||||
private Date dataScad;
|
||||
@SqlField(value = "data_scad", nullable = false)
|
||||
private LocalDate dataScad;
|
||||
|
||||
@SqlField(value = "imp_dare", nullable = false, defaultObjectValue = "0")
|
||||
private BigDecimal impDare;
|
||||
@@ -70,14 +70,14 @@ public class CtbScad extends EntityBase {
|
||||
@SqlField(value = "imp_avere", nullable = false, defaultObjectValue = "0")
|
||||
private BigDecimal impAvere;
|
||||
|
||||
@SqlField(value = "data_pag", format = CommonConstants.SYSDATE)
|
||||
private Date dataPag;
|
||||
@SqlField(value = "data_pag")
|
||||
private LocalDate dataPag;
|
||||
|
||||
@SqlField(value = "descriz_pag", maxLength = 40)
|
||||
private String descrizPag;
|
||||
|
||||
@SqlField(value = "data_ult_soll")
|
||||
private Date dataUltSoll;
|
||||
private LocalDate dataUltSoll;
|
||||
|
||||
@SqlField(value = "ult_soll")
|
||||
private Integer ultSoll;
|
||||
@@ -85,17 +85,17 @@ public class CtbScad extends EntityBase {
|
||||
@SqlField(value = "note", maxLength = 40)
|
||||
private String note;
|
||||
|
||||
@SqlField(value = "data_ant_provv", format = CommonConstants.SYSDATE)
|
||||
private Date dataAntProvv;
|
||||
@SqlField(value = "data_ant_provv")
|
||||
private LocalDate dataAntProvv;
|
||||
|
||||
@SqlField(value = "data_titolo", format = CommonConstants.SYSDATE)
|
||||
private Date dataTitolo;
|
||||
@SqlField(value = "data_titolo")
|
||||
private LocalDate dataTitolo;
|
||||
|
||||
@SqlField(value = "gestione", maxLength = 1)
|
||||
private String gestione;
|
||||
|
||||
@SqlField(value = "data_ord", format = CommonConstants.SYSDATE)
|
||||
private Date dataOrd;
|
||||
private LocalDate dataOrd;
|
||||
|
||||
@SqlField(value = "num_ord")
|
||||
private Integer numOrd;
|
||||
@@ -203,24 +203,44 @@ public class CtbScad extends EntityBase {
|
||||
return this;
|
||||
}
|
||||
|
||||
public Date getDataDoc() {
|
||||
public LocalDate getDataDoc() {
|
||||
return dataDoc;
|
||||
}
|
||||
|
||||
public CtbScad setDataDoc(Date dataDoc) {
|
||||
public CtbScad setDataDoc(LocalDate dataDoc) {
|
||||
this.dataDoc = dataDoc;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Date getDataScad() {
|
||||
public LocalDate getDataScad() {
|
||||
return dataScad;
|
||||
}
|
||||
|
||||
public CtbScad setDataScad(Date dataScad) {
|
||||
public CtbScad setDataScad(LocalDate dataScad) {
|
||||
this.dataScad = dataScad;
|
||||
return this;
|
||||
}
|
||||
|
||||
public CtbScad setDataUltSoll(LocalDate dataUltSoll) {
|
||||
this.dataUltSoll = dataUltSoll;
|
||||
return this;
|
||||
}
|
||||
|
||||
public CtbScad setDataAntProvv(LocalDate dataAntProvv) {
|
||||
this.dataAntProvv = dataAntProvv;
|
||||
return this;
|
||||
}
|
||||
|
||||
public CtbScad setDataTitolo(LocalDate dataTitolo) {
|
||||
this.dataTitolo = dataTitolo;
|
||||
return this;
|
||||
}
|
||||
|
||||
public CtbScad setDataOrd(LocalDate dataOrd) {
|
||||
this.dataOrd = dataOrd;
|
||||
return this;
|
||||
}
|
||||
|
||||
public BigDecimal getImpDare() {
|
||||
return impDare;
|
||||
}
|
||||
@@ -239,11 +259,11 @@ public class CtbScad extends EntityBase {
|
||||
return this;
|
||||
}
|
||||
|
||||
public Date getDataPag() {
|
||||
public LocalDate getDataPag() {
|
||||
return dataPag;
|
||||
}
|
||||
|
||||
public CtbScad setDataPag(Date dataPag) {
|
||||
public CtbScad setDataPag(LocalDate dataPag) {
|
||||
this.dataPag = dataPag;
|
||||
return this;
|
||||
}
|
||||
@@ -257,15 +277,6 @@ public class CtbScad extends EntityBase {
|
||||
return this;
|
||||
}
|
||||
|
||||
public Date getDataUltSoll() {
|
||||
return dataUltSoll;
|
||||
}
|
||||
|
||||
public CtbScad setDataUltSoll(Date dataUltSoll) {
|
||||
this.dataUltSoll = dataUltSoll;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Integer getUltSoll() {
|
||||
return ultSoll;
|
||||
}
|
||||
@@ -284,21 +295,28 @@ public class CtbScad extends EntityBase {
|
||||
return this;
|
||||
}
|
||||
|
||||
public Date getDataAntProvv() {
|
||||
public LocalDate getDataUltSoll() {
|
||||
return dataUltSoll;
|
||||
}
|
||||
|
||||
public LocalDate getDataAntProvv() {
|
||||
return dataAntProvv;
|
||||
}
|
||||
|
||||
public CtbScad setDataAntProvv(Date dataAntProvv) {
|
||||
this.dataAntProvv = dataAntProvv;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Date getDataTitolo() {
|
||||
public LocalDate getDataTitolo() {
|
||||
return dataTitolo;
|
||||
}
|
||||
|
||||
public CtbScad setDataTitolo(Date dataTitolo) {
|
||||
this.dataTitolo = dataTitolo;
|
||||
public LocalDate getDataOrd() {
|
||||
return dataOrd;
|
||||
}
|
||||
|
||||
public Boolean getInsoluto() {
|
||||
return isInsoluto;
|
||||
}
|
||||
|
||||
public CtbScad setInsoluto(Boolean insoluto) {
|
||||
isInsoluto = insoluto;
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -311,15 +329,6 @@ public class CtbScad extends EntityBase {
|
||||
return this;
|
||||
}
|
||||
|
||||
public Date getDataOrd() {
|
||||
return dataOrd;
|
||||
}
|
||||
|
||||
public CtbScad setDataOrd(Date dataOrd) {
|
||||
this.dataOrd = dataOrd;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Integer getNumOrd() {
|
||||
return numOrd;
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import it.integry.ems_model.annotation.*;
|
||||
import it.integry.ems_model.base.EntityBase;
|
||||
import org.kie.api.definition.type.PropertyReactive;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
@@ -132,6 +133,9 @@ public class JtbComt extends EntityBase {
|
||||
@SqlField(value = "rif_comm", maxLength = 255)
|
||||
private String rifComm;
|
||||
|
||||
@SqlField(value = "data_mod", defaultObjectValue = CommonConstants.TIMESTAMP)
|
||||
private LocalDateTime dataMod;
|
||||
|
||||
@EntityChild
|
||||
private List<JrlDisOrd> jrlDisOrd = new ArrayList<>();
|
||||
|
||||
@@ -468,6 +472,15 @@ public class JtbComt extends EntityBase {
|
||||
this.rifComm = rifComm;
|
||||
}
|
||||
|
||||
public LocalDateTime getDataMod() {
|
||||
return dataMod;
|
||||
}
|
||||
|
||||
public JtbComt setDataMod(LocalDateTime dataMod) {
|
||||
this.dataMod = dataMod;
|
||||
return this;
|
||||
}
|
||||
|
||||
public List<JrlDisOrd> getJrlDisOrd() {
|
||||
return jrlDisOrd;
|
||||
}
|
||||
|
||||
@@ -207,7 +207,13 @@ public class MtbColr extends EntityBase implements EquatableEntityInterface<MtbC
|
||||
|
||||
|
||||
public MtbColrKey getKey() {
|
||||
return new MtbColrKey(gestione, serCollo, dataCollo, numCollo, riga);
|
||||
return UtilityString.isNullOrEmpty(gestione) ||
|
||||
UtilityString.isNullOrEmpty(serCollo) ||
|
||||
dataCollo == null ||
|
||||
numCollo == null ||
|
||||
riga == null ?
|
||||
null :
|
||||
new MtbColrKey(gestione, serCollo, dataCollo, numCollo, riga);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -218,11 +218,11 @@ public class MtbColt extends EntityBase implements EquatableEntityInterface<MtbC
|
||||
|
||||
public MtbColtKey getKey() {
|
||||
return UtilityString.isNullOrEmpty(gestione) ||
|
||||
UtilityString.isNullOrEmpty(dataCollo) ||
|
||||
UtilityString.isNullOrEmpty(serCollo) ||
|
||||
dataCollo == null ||
|
||||
numCollo == null ?
|
||||
null :
|
||||
new MtbColtKey(gestione, serCollo, getDataCollo(), numCollo);
|
||||
new MtbColtKey(gestione, serCollo, dataCollo, numCollo);
|
||||
}
|
||||
|
||||
public String getGestione() {
|
||||
|
||||
@@ -63,6 +63,13 @@ public class MtbGrup extends EntityBase implements EquatableEntityInterface<MtbG
|
||||
@EntityChild
|
||||
private List<MtbSfam> mtbSfam = new ArrayList<>();
|
||||
|
||||
@EntityChild
|
||||
private List<MtbSsfam> mtbSsfam;
|
||||
|
||||
{
|
||||
mtbSsfam = new ArrayList<>();
|
||||
}
|
||||
|
||||
public MtbGrup() {
|
||||
super(logger);
|
||||
}
|
||||
@@ -169,6 +176,8 @@ public class MtbGrup extends EntityBase implements EquatableEntityInterface<MtbG
|
||||
|
||||
@Override
|
||||
protected void deleteChilds() throws Exception {
|
||||
MtbSsfam mtbSsfam = new MtbSsfam();
|
||||
mtbSsfam.deleteAllEntities(connection, this);
|
||||
MtbSfam mtbSfam = new MtbSfam();
|
||||
mtbSfam.deleteAllEntities(connection, this);
|
||||
MtbSgrp mtbSgrp = new MtbSgrp();
|
||||
|
||||
@@ -2,13 +2,13 @@ package it.integry.ems_model.entity;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.annotation.JsonTypeName;
|
||||
import it.integry.common.var.CommonConstants;
|
||||
import it.integry.ems_model.annotation.*;
|
||||
import it.integry.ems_model.base.EntityBase;
|
||||
import it.integry.ems_model.types.ApplicationName;
|
||||
import org.kie.api.definition.type.PropertyReactive;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
@@ -102,8 +102,8 @@ public class MtbLisvData extends EntityBase {
|
||||
@SqlField(value = "val_oneri", nullable = false, defaultObjectValue = "0")
|
||||
private BigDecimal valOneri;
|
||||
|
||||
@SqlField(value = "data_agg_prz", defaultObjectValue = CommonConstants.TIMESTAMP)
|
||||
private Date dataAggPrz;
|
||||
@SqlField(value = "data_agg_prz")
|
||||
private LocalDateTime dataAggPrz;
|
||||
|
||||
@SqlField(value = "tipo_variazione", maxLength = 1, nullable = false)
|
||||
private String tipoVariazione;
|
||||
@@ -183,11 +183,11 @@ public class MtbLisvData extends EntityBase {
|
||||
|
||||
@ImportFromParent
|
||||
@MapToTable("data_iniz")
|
||||
private Date dataIniz;
|
||||
private LocalDate dataIniz;
|
||||
|
||||
@ImportFromParent
|
||||
@MapToTable("data_fine")
|
||||
private Date dataFine;
|
||||
private LocalDate dataFine;
|
||||
|
||||
@ImportFromParent
|
||||
@MapToTable("cod_promo")
|
||||
@@ -210,6 +210,8 @@ public class MtbLisvData extends EntityBase {
|
||||
@JsonProperty("elenco_lisv_rif")
|
||||
private String elencoLisvRif;
|
||||
|
||||
private Boolean chiusuraImmediata;
|
||||
|
||||
@EntityChild
|
||||
private List<TtbLisvTaglieData> ttbLisvTaglieData = new ArrayList<>();
|
||||
|
||||
@@ -438,11 +440,11 @@ public class MtbLisvData extends EntityBase {
|
||||
return this;
|
||||
}
|
||||
|
||||
public Date getDataAggPrz() {
|
||||
public LocalDateTime getDataAggPrz() {
|
||||
return dataAggPrz;
|
||||
}
|
||||
|
||||
public MtbLisvData setDataAggPrz(Date dataAggPrz) {
|
||||
public MtbLisvData setDataAggPrz(LocalDateTime dataAggPrz) {
|
||||
this.dataAggPrz = dataAggPrz;
|
||||
return this;
|
||||
}
|
||||
@@ -627,20 +629,20 @@ public class MtbLisvData extends EntityBase {
|
||||
return this;
|
||||
}
|
||||
|
||||
public Date getDataIniz() {
|
||||
public LocalDate getDataIniz() {
|
||||
return dataIniz;
|
||||
}
|
||||
|
||||
public MtbLisvData setDataIniz(Date dataIniz) {
|
||||
public MtbLisvData setDataIniz(LocalDate dataIniz) {
|
||||
this.dataIniz = dataIniz;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Date getDataFine() {
|
||||
public LocalDate getDataFine() {
|
||||
return dataFine;
|
||||
}
|
||||
|
||||
public MtbLisvData setDataFine(Date dataFine) {
|
||||
public MtbLisvData setDataFine(LocalDate dataFine) {
|
||||
this.dataFine = dataFine;
|
||||
return this;
|
||||
}
|
||||
@@ -699,6 +701,15 @@ public class MtbLisvData extends EntityBase {
|
||||
return this;
|
||||
}
|
||||
|
||||
public Boolean getChiusuraImmediata() {
|
||||
return chiusuraImmediata;
|
||||
}
|
||||
|
||||
public MtbLisvData setChiusuraImmediata(Boolean chiusuraImmediata) {
|
||||
this.chiusuraImmediata = chiusuraImmediata;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getFlagEquiPrezzo() {
|
||||
return flagEquiPrezzo;
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ import org.apache.logging.log4j.Logger;
|
||||
import org.kie.api.definition.type.PropertyReactive;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.time.LocalDate;
|
||||
|
||||
@PropertyReactive
|
||||
@Table(MtbLisvDataSpese.ENTITY)
|
||||
@@ -53,7 +53,7 @@ public class MtbLisvDataSpese extends EntityBase {
|
||||
private Integer a;
|
||||
|
||||
@ImportFromParent
|
||||
private Date dataIniz;
|
||||
private LocalDate dataIniz;
|
||||
|
||||
public MtbLisvDataSpese() {
|
||||
super(logger);
|
||||
@@ -135,11 +135,11 @@ public class MtbLisvDataSpese extends EntityBase {
|
||||
return this;
|
||||
}
|
||||
|
||||
public Date getDataIniz() {
|
||||
public LocalDate getDataIniz() {
|
||||
return dataIniz;
|
||||
}
|
||||
|
||||
public void setDataIniz(Date dataIniz) {
|
||||
public void setDataIniz(LocalDate dataIniz) {
|
||||
this.dataIniz = dataIniz;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package it.integry.ems_model.entity;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonTypeName;
|
||||
import it.integry.ems_model.annotation.EntityChild;
|
||||
import it.integry.ems_model.annotation.PK;
|
||||
import it.integry.ems_model.annotation.SqlField;
|
||||
import it.integry.ems_model.annotation.Table;
|
||||
@@ -10,6 +11,8 @@ import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.kie.api.definition.type.PropertyReactive;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
@PropertyReactive
|
||||
@@ -38,6 +41,13 @@ public class MtbSfam extends EntityBase implements EquatableEntityInterface<MtbS
|
||||
@SqlField(value = "descrizione", maxLength = 40, nullable = false)
|
||||
private String descrizione;
|
||||
|
||||
@EntityChild
|
||||
private List<MtbSsfam> mtbSsfam;
|
||||
|
||||
{
|
||||
mtbSsfam = new ArrayList<>();
|
||||
}
|
||||
|
||||
public MtbSfam() {
|
||||
super(logger);
|
||||
}
|
||||
@@ -74,6 +84,21 @@ public class MtbSfam extends EntityBase implements EquatableEntityInterface<MtbS
|
||||
this.descrizione = descrizione;
|
||||
}
|
||||
|
||||
public List<MtbSsfam> getMtbSsfam() {
|
||||
return mtbSsfam;
|
||||
}
|
||||
|
||||
public MtbSfam setMtbSsfam(List<MtbSsfam> mtbSsfam) {
|
||||
this.mtbSsfam = mtbSsfam;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void deleteChilds() throws Exception {
|
||||
MtbSsfam mtbSsfam = new MtbSsfam();
|
||||
mtbSsfam.deleteAllEntities(connection, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equalsKey(MtbSfam other) {
|
||||
if (this == other)
|
||||
|
||||
@@ -59,6 +59,13 @@ public class MtbSgrp extends EntityBase implements EquatableEntityInterface<MtbS
|
||||
@EntityChild
|
||||
private List<MtbSfam> mtbSfam = new ArrayList<>();
|
||||
|
||||
@EntityChild
|
||||
private List<MtbSsfam> mtbSsfam;
|
||||
|
||||
{
|
||||
mtbSsfam = new ArrayList<>();
|
||||
}
|
||||
|
||||
public MtbSgrp() {
|
||||
super(logger);
|
||||
}
|
||||
@@ -162,6 +169,8 @@ public class MtbSgrp extends EntityBase implements EquatableEntityInterface<MtbS
|
||||
|
||||
@Override
|
||||
protected void deleteChilds() throws Exception {
|
||||
MtbSsfam mtbSsfam = new MtbSsfam();
|
||||
mtbSsfam.deleteAllEntities(connection, this);
|
||||
MtbSfam mtbSfam = new MtbSfam();
|
||||
mtbSfam.deleteAllEntities(connection, this);
|
||||
}
|
||||
|
||||
131
ems-core/src/main/java/it/integry/ems_model/entity/MtbSsfam.java
Normal file
131
ems-core/src/main/java/it/integry/ems_model/entity/MtbSsfam.java
Normal file
@@ -0,0 +1,131 @@
|
||||
package it.integry.ems_model.entity;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonTypeName;
|
||||
import it.integry.ems_model.annotation.FK;
|
||||
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(MtbSsfam.ENTITY)
|
||||
@JsonTypeName( MtbSsfam.ENTITY)
|
||||
public class MtbSsfam extends EntityBase implements EquatableEntityInterface<MtbSsfam> {
|
||||
|
||||
public final static String ENTITY = "mtb_ssfam";
|
||||
|
||||
private final static Long serialVersionUID = 1L;
|
||||
|
||||
private final static Logger logger = LogManager.getLogger();
|
||||
|
||||
public MtbSsfam() {
|
||||
super(logger);
|
||||
}
|
||||
|
||||
@PK()
|
||||
@SqlField(value = "cod_mgrp", maxLength = 5, nullable = false)
|
||||
@FK(tableName = MtbGrup.ENTITY, columnName = "cod_mgrp")
|
||||
@FK(tableName = MtbSfam.ENTITY, columnName = "cod_mgrp")
|
||||
@FK(tableName = MtbSgrp.ENTITY, columnName = "cod_mgrp")
|
||||
private String codMgrp;
|
||||
|
||||
@PK()
|
||||
@SqlField(value = "cod_msgr", maxLength = 5, nullable = false)
|
||||
@FK(tableName = MtbSfam.ENTITY, columnName = "cod_msgr")
|
||||
@FK(tableName = MtbSgrp.ENTITY, columnName = "cod_msgr")
|
||||
private String codMsgr;
|
||||
|
||||
@PK()
|
||||
@SqlField(value = "cod_msfa", maxLength = 6, nullable = false)
|
||||
@FK(tableName = MtbSfam.ENTITY, columnName = "cod_msfa")
|
||||
private String codMsfa;
|
||||
|
||||
@PK()
|
||||
@SqlField(value = "cod_mssfa", maxLength = 6, nullable = false)
|
||||
private String codMssfa;
|
||||
|
||||
@SqlField(value = "descrizione", maxLength = 40, nullable = false)
|
||||
private String descrizione;
|
||||
|
||||
public String getCodMgrp() {
|
||||
return codMgrp;
|
||||
}
|
||||
|
||||
public MtbSsfam setCodMgrp(String codMgrp) {
|
||||
this.codMgrp = codMgrp;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getCodMsgr() {
|
||||
return codMsgr;
|
||||
}
|
||||
|
||||
public MtbSsfam setCodMsgr(String codMsgr) {
|
||||
this.codMsgr = codMsgr;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getCodMsfa() {
|
||||
return codMsfa;
|
||||
}
|
||||
|
||||
public MtbSsfam setCodMsfa(String codMsfa) {
|
||||
this.codMsfa = codMsfa;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getCodMssfa() {
|
||||
return codMssfa;
|
||||
}
|
||||
|
||||
public MtbSsfam setCodMssfa(String codMssfa) {
|
||||
this.codMssfa = codMssfa;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getDescrizione() {
|
||||
return descrizione;
|
||||
}
|
||||
|
||||
public MtbSsfam setDescrizione(String descrizione) {
|
||||
this.descrizione = descrizione;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equalsKey(MtbSsfam other) {
|
||||
if (this == other)
|
||||
return true;
|
||||
|
||||
if(hashCodeKey() != other.hashCodeKey())
|
||||
return false;
|
||||
|
||||
return Objects.equals(getCodMgrp(), other.getCodMgrp()) && Objects.equals(getCodMsgr(), other.getCodMsgr()) && Objects.equals(getCodMsfa(), other.getCodMsfa()) && Objects.equals(getCodMssfa(), other.getCodMssfa());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCodeKey() {
|
||||
return Objects.hash(getCodMgrp(), getCodMsgr(), getCodMsfa() , getCodMssfa());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (!(o instanceof MtbSsfam)) return false;
|
||||
MtbSsfam mtbSsfam = (MtbSsfam) o;
|
||||
return Objects.equals(getCodMgrp(), mtbSsfam.getCodMgrp()) && Objects.equals(getCodMsgr(), mtbSsfam.getCodMsgr()) && Objects.equals(getCodMsfa(), mtbSsfam.getCodMsfa())&& Objects.equals(getCodMssfa(), mtbSsfam.getCodMssfa()) && Objects.equals(getDescrizione(), mtbSsfam.getDescrizione());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(getCodMgrp(), getCodMsgr(), getCodMsfa(), getCodMssfa(), getDescrizione());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -48,7 +48,7 @@ public class MtbVarLisvLog extends EntityBase {
|
||||
@SqlField(value = "cod_vlis", maxLength = 5, nullable = false)
|
||||
private String codVlis;
|
||||
|
||||
@SqlField(value = "versione", nullable = false)
|
||||
@SqlField(value = "versione")
|
||||
private Integer versione;
|
||||
|
||||
@SqlField(value = "cod_promo", maxLength = 10, nullable = true)
|
||||
|
||||
@@ -6,6 +6,7 @@ import it.integry.ems_model.annotation.*;
|
||||
import it.integry.ems_model.base.EntityBase;
|
||||
import org.kie.api.definition.type.PropertyReactive;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
@@ -153,6 +154,9 @@ public class PtbPros extends EntityBase {
|
||||
@SqlField(value = "flag_stato_pros", nullable = false, defaultObjectValue = "1")
|
||||
private Boolean flagStatoPros;
|
||||
|
||||
@SqlField(value = "data_mod", defaultObjectValue = CommonConstants.TIMESTAMP)
|
||||
private LocalDateTime dataMod;
|
||||
|
||||
@EntityChild
|
||||
private List<PtbProsRif> ptbProsRif = new ArrayList<>();
|
||||
|
||||
@@ -558,6 +562,15 @@ public class PtbPros extends EntityBase {
|
||||
this.flagStatoPros = flagStatoPros;
|
||||
}
|
||||
|
||||
public LocalDateTime getDataMod() {
|
||||
return dataMod;
|
||||
}
|
||||
|
||||
public PtbPros setDataMod(LocalDateTime dataMod) {
|
||||
this.dataMod = dataMod;
|
||||
return this;
|
||||
}
|
||||
|
||||
public List<PtbDest> getPtbDest() {
|
||||
return ptbDest;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package it.integry.ems_model.entity;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonTypeName;
|
||||
import it.integry.common.var.CommonConstants;
|
||||
import it.integry.ems_model.annotation.PK;
|
||||
import it.integry.ems_model.annotation.SqlDetailId;
|
||||
import it.integry.ems_model.annotation.SqlField;
|
||||
@@ -10,6 +11,8 @@ import org.kie.api.definition.type.PropertyReactive;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@PropertyReactive
|
||||
@Table(PtbProsRif.ENTITY)
|
||||
@JsonTypeName(PtbProsRif.ENTITY)
|
||||
@@ -48,6 +51,9 @@ public class PtbProsRif extends EntityBase {
|
||||
@SqlField(value = "telefono", maxLength = 40)
|
||||
private String telefono;
|
||||
|
||||
@SqlField(value = "data_mod", defaultObjectValue = CommonConstants.TIMESTAMP)
|
||||
private LocalDateTime dataMod;
|
||||
|
||||
public PtbProsRif() {
|
||||
super(logger);
|
||||
}
|
||||
@@ -123,4 +129,13 @@ public class PtbProsRif extends EntityBase {
|
||||
this.telefono = telefono;
|
||||
return this;
|
||||
}
|
||||
|
||||
public LocalDateTime getDataMod() {
|
||||
return dataMod;
|
||||
}
|
||||
|
||||
public PtbProsRif setDataMod(LocalDateTime dataMod) {
|
||||
this.dataMod = dataMod;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package it.integry.ems_model.entity;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonTypeName;
|
||||
import it.integry.common.var.CommonConstants;
|
||||
import it.integry.ems_model.annotation.EntityChild;
|
||||
import it.integry.ems_model.annotation.PK;
|
||||
import it.integry.ems_model.annotation.SqlField;
|
||||
@@ -12,6 +13,7 @@ import org.apache.logging.log4j.Logger;
|
||||
import org.kie.api.definition.type.PropertyReactive;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
@@ -225,6 +227,9 @@ public class VtbDest extends EntityBase implements EquatableEntityInterface<VtbD
|
||||
@SqlField(value = "stampa_doc_cons", nullable = false, defaultObjectValue = "0")
|
||||
private Boolean stampaDocCons;
|
||||
|
||||
@SqlField(value = "data_mod", defaultObjectValue = CommonConstants.TIMESTAMP)
|
||||
private LocalDateTime dataMod;
|
||||
|
||||
private String precode;
|
||||
|
||||
@EntityChild
|
||||
@@ -828,6 +833,15 @@ public class VtbDest extends EntityBase implements EquatableEntityInterface<VtbD
|
||||
return this;
|
||||
}
|
||||
|
||||
public LocalDateTime getDataMod() {
|
||||
return dataMod;
|
||||
}
|
||||
|
||||
public VtbDest setDataMod(LocalDateTime dataMod) {
|
||||
this.dataMod = dataMod;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void insertChilds() throws Exception {
|
||||
for (VtbDestIntercode vtbDestIntercode : getVtbDestIntercode()) {
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.annotation.JsonTypeName;
|
||||
import it.integry.ems_model.annotation.*;
|
||||
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 java.util.List;
|
||||
@@ -111,6 +112,9 @@ public class VtbList extends EntityBase {
|
||||
@SqlField(value = "flag_add_trasp", nullable = false, defaultObjectValue = "1")
|
||||
private Boolean flagAddTrasp;
|
||||
|
||||
@SqlField(value = "tipo_um", nullable = true)
|
||||
private Short tipoUm;
|
||||
|
||||
@JsonProperty("versioneRif")
|
||||
private Integer versioneRif;
|
||||
|
||||
@@ -123,6 +127,9 @@ public class VtbList extends EntityBase {
|
||||
@EntityChild
|
||||
private List<VtbListPremi> vtbListPremi = new ArrayList<>();
|
||||
|
||||
@EntityChild
|
||||
private List<MtbLisv> mtbLisv = new ArrayList<>();
|
||||
|
||||
public VtbList() {
|
||||
super(logger);
|
||||
}
|
||||
@@ -334,6 +341,15 @@ public class VtbList extends EntityBase {
|
||||
return this;
|
||||
}
|
||||
|
||||
public Short getTipoUm() {
|
||||
return tipoUm;
|
||||
}
|
||||
|
||||
public VtbList setTipoUm(Short tipoUm) {
|
||||
this.tipoUm = tipoUm;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Integer getVersioneRif() {
|
||||
return versioneRif;
|
||||
}
|
||||
@@ -370,18 +386,13 @@ public class VtbList extends EntityBase {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void insertChilds() throws Exception {
|
||||
for (VtbListPremi vtbListPremi : getVtbListPremi()) {
|
||||
vtbListPremi.manageWithParentConnection(connection, vtbListPremi.getOperation(), dataCompleting, entityHolder);
|
||||
}
|
||||
public List<MtbLisv> getMtbLisv() {
|
||||
return mtbLisv;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void updateChilds() throws Exception {
|
||||
for (VtbListPremi vtbListPremi : getVtbListPremi()) {
|
||||
vtbListPremi.manageWithParentConnection(connection, vtbListPremi.getOperation(), dataCompleting, entityHolder);
|
||||
}
|
||||
public VtbList setMtbLisv(List<MtbLisv> mtbLisv) {
|
||||
this.mtbLisv = mtbLisv;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -389,4 +400,44 @@ public class VtbList extends EntityBase {
|
||||
VtbListPremi vtbListPremi = new VtbListPremi();
|
||||
vtbListPremi.deleteAllEntities(connection, this);
|
||||
}
|
||||
|
||||
public enum TipoUm implements IBaseEnum<TipoUm> {
|
||||
ARTICOLO(null),
|
||||
COLLI((short) 1),
|
||||
PESO_KG((short) 2);
|
||||
|
||||
private Short value;
|
||||
|
||||
TipoUm(Short value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public static TipoUm fromValue(Object value) {
|
||||
for (TipoUm tipoUm : TipoUm.values()) {
|
||||
if (tipoUm.value==value) {
|
||||
return tipoUm;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public Short getValue() {
|
||||
return this.value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object get() {
|
||||
return this.value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TipoUm fromInternal(Object val) {
|
||||
return fromValue(val);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return String.valueOf(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,8 +15,9 @@ import org.kie.api.definition.type.PropertyReactive;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.sql.Statement;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
@@ -41,13 +42,13 @@ public class VtbListData extends EntityBase {
|
||||
private Integer versione;
|
||||
|
||||
@SqlField(value = "data_iniz", nullable = false, defaultObjectValue = CommonConstants.SYSDATE)
|
||||
private Date dataIniz;
|
||||
private LocalDate dataIniz;
|
||||
|
||||
@SqlField(value = "data_fine")
|
||||
private Date dataFine;
|
||||
private LocalDate dataFine;
|
||||
|
||||
@SqlField(value = "data_att")
|
||||
private Date dataAtt;
|
||||
private LocalDate dataAtt;
|
||||
|
||||
@SqlField(value = "ricarica", nullable = false)
|
||||
private BigDecimal ricarica;
|
||||
@@ -59,14 +60,14 @@ public class VtbListData extends EntityBase {
|
||||
@SqlField(value = "cod_promo", maxLength = 10)
|
||||
private String codPromo;
|
||||
|
||||
@SqlField(value = "data_ult_var", defaultObjectValue = CommonConstants.TIMESTAMP)
|
||||
private Date dataUltVar;
|
||||
@SqlField(value = "data_ult_var")
|
||||
private LocalDateTime dataUltVar;
|
||||
|
||||
@SqlField(value = "data_trasmissione")
|
||||
private Date dataTrasmissione;
|
||||
private LocalDateTime dataTrasmissione;
|
||||
|
||||
@SqlField(value = "data_trasmissione_fine_promo")
|
||||
private Date dataTrasmissioneFinePromo;
|
||||
private LocalDateTime dataTrasmissioneFinePromo;
|
||||
|
||||
@SqlField(value = "porto", maxLength = 20)
|
||||
private String porto;
|
||||
@@ -83,6 +84,9 @@ public class VtbListData extends EntityBase {
|
||||
@SqlField(value = "condizioni_comm")
|
||||
private String condizioniComm;
|
||||
|
||||
@SqlField(value = "chiusura_immediata", nullable = false, defaultObjectValue = "0")
|
||||
private Boolean chiusuraImmediata;
|
||||
|
||||
@MapToTable("descr_promo")
|
||||
private String descrPromo;
|
||||
|
||||
@@ -137,29 +141,29 @@ public class VtbListData extends EntityBase {
|
||||
return this;
|
||||
}
|
||||
|
||||
public Date getDataIniz() {
|
||||
public LocalDate getDataIniz() {
|
||||
return dataIniz;
|
||||
}
|
||||
|
||||
public VtbListData setDataIniz(Date dataIniz) {
|
||||
public VtbListData setDataIniz(LocalDate dataIniz) {
|
||||
this.dataIniz = dataIniz;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Date getDataFine() {
|
||||
public LocalDate getDataFine() {
|
||||
return dataFine;
|
||||
}
|
||||
|
||||
public VtbListData setDataFine(Date dataFine) {
|
||||
public VtbListData setDataFine(LocalDate dataFine) {
|
||||
this.dataFine = dataFine;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Date getDataAtt() {
|
||||
public LocalDate getDataAtt() {
|
||||
return dataAtt;
|
||||
}
|
||||
|
||||
public VtbListData setDataAtt(Date dataAtt) {
|
||||
public VtbListData setDataAtt(LocalDate dataAtt) {
|
||||
this.dataAtt = dataAtt;
|
||||
return this;
|
||||
}
|
||||
@@ -191,29 +195,29 @@ public class VtbListData extends EntityBase {
|
||||
return this;
|
||||
}
|
||||
|
||||
public Date getDataUltVar() {
|
||||
public LocalDateTime getDataUltVar() {
|
||||
return dataUltVar;
|
||||
}
|
||||
|
||||
public VtbListData setDataUltVar(Date dataUltVar) {
|
||||
public VtbListData setDataUltVar(LocalDateTime dataUltVar) {
|
||||
this.dataUltVar = dataUltVar;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Date getDataTrasmissione() {
|
||||
public LocalDateTime getDataTrasmissione() {
|
||||
return dataTrasmissione;
|
||||
}
|
||||
|
||||
public VtbListData setDataTrasmissione(Date dataTrasmissione) {
|
||||
public VtbListData setDataTrasmissione(LocalDateTime dataTrasmissione) {
|
||||
this.dataTrasmissione = dataTrasmissione;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Date getDataTrasmissioneFinePromo() {
|
||||
public LocalDateTime getDataTrasmissioneFinePromo() {
|
||||
return dataTrasmissioneFinePromo;
|
||||
}
|
||||
|
||||
public VtbListData setDataTrasmissioneFinePromo(Date dataTrasmissioneFinePromo) {
|
||||
public VtbListData setDataTrasmissioneFinePromo(LocalDateTime dataTrasmissioneFinePromo) {
|
||||
this.dataTrasmissioneFinePromo = dataTrasmissioneFinePromo;
|
||||
return this;
|
||||
}
|
||||
@@ -263,6 +267,15 @@ public class VtbListData extends EntityBase {
|
||||
return this;
|
||||
}
|
||||
|
||||
public Boolean getChiusuraImmediata() {
|
||||
return chiusuraImmediata;
|
||||
}
|
||||
|
||||
public VtbListData setChiusuraImmediata(Boolean chiusuraImmediata) {
|
||||
this.chiusuraImmediata = chiusuraImmediata;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getDescrPromo() {
|
||||
return descrPromo;
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ import it.integry.ems_model.annotation.Table;
|
||||
import it.integry.ems_model.base.EntityBase;
|
||||
import org.kie.api.definition.type.PropertyReactive;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.time.LocalDate;
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
@@ -33,16 +33,16 @@ public class VtbPromo extends EntityBase {
|
||||
private String descrizione;
|
||||
|
||||
@SqlField(value = "data_iniz_sell_in")
|
||||
private Date dataInizSellIn;
|
||||
private LocalDate dataInizSellIn;
|
||||
|
||||
@SqlField(value = "data_fine_sell_in")
|
||||
private Date dataFineSellIn;
|
||||
private LocalDate dataFineSellIn;
|
||||
|
||||
@SqlField(value = "data_iniz_sell_out")
|
||||
private Date dataInizSellOut;
|
||||
private LocalDate dataInizSellOut;
|
||||
|
||||
@SqlField(value = "data_fine_sell_out")
|
||||
private Date dataFineSellOut;
|
||||
private LocalDate dataFineSellOut;
|
||||
|
||||
@SqlField(value = "flag_promo_rimb", maxLength = 1, nullable = false, defaultObjectValue = "S")
|
||||
private String flagPromoRimb;
|
||||
@@ -123,42 +123,39 @@ public class VtbPromo extends EntityBase {
|
||||
return this;
|
||||
}
|
||||
|
||||
public Date getDataInizSellIn() {
|
||||
public LocalDate getDataInizSellIn() {
|
||||
return dataInizSellIn;
|
||||
}
|
||||
|
||||
public VtbPromo setDataInizSellIn(Date dataInizSellIn) {
|
||||
public VtbPromo setDataInizSellIn(LocalDate dataInizSellIn) {
|
||||
this.dataInizSellIn = dataInizSellIn;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Date getDataFineSellIn() {
|
||||
return dataFineSellIn;
|
||||
}
|
||||
|
||||
public VtbPromo setDataFineSellIn(Date dataFineSellIn) {
|
||||
this.dataFineSellIn = dataFineSellIn;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Date getDataInizSellOut() {
|
||||
return dataInizSellOut;
|
||||
}
|
||||
|
||||
public VtbPromo setDataInizSellOut(Date dataInizSellOut) {
|
||||
public VtbPromo setDataInizSellOut(LocalDate dataInizSellOut) {
|
||||
this.dataInizSellOut = dataInizSellOut;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Date getDataFineSellOut() {
|
||||
public LocalDate getDataFineSellOut() {
|
||||
return dataFineSellOut;
|
||||
}
|
||||
|
||||
public VtbPromo setDataFineSellOut(Date dataFineSellOut) {
|
||||
public LocalDate getDataFineSellIn() {
|
||||
return dataFineSellIn;
|
||||
}
|
||||
|
||||
public VtbPromo setDataFineSellIn(LocalDate dataFineSellIn) {
|
||||
this.dataFineSellIn = dataFineSellIn;
|
||||
return this;
|
||||
}
|
||||
|
||||
public VtbPromo setDataFineSellOut(LocalDate dataFineSellOut) {
|
||||
this.dataFineSellOut = dataFineSellOut;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
public String getFlagPromoRimb() {
|
||||
return flagPromoRimb;
|
||||
}
|
||||
|
||||
@@ -85,7 +85,7 @@ public class VtbViaggi extends EntityBase {
|
||||
@SqlField(value = "incoterms", maxLength = 20)
|
||||
private String incoterms;
|
||||
|
||||
@SqlField(value = "note_incoterms", maxLength = 20)
|
||||
@SqlField(value = "note_incoterms", maxLength = 40)
|
||||
private String noteIncoterms;
|
||||
|
||||
@Priority(value = 101, copyPk = false)
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
package it.integry.ems_model.entity._enum;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonValue;
|
||||
|
||||
public enum ListinoEnum implements IBaseEnum<ListinoEnum> {
|
||||
COSTO_MEDIO("CMED")
|
||||
, DISTINTA("DIST"), COSTO_ULTIMO("ULTC");
|
||||
|
||||
private final String value;
|
||||
|
||||
ListinoEnum(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public static ListinoEnum from(Object value) {
|
||||
String castValue = null;
|
||||
|
||||
if (value instanceof String)
|
||||
castValue = (String) value;
|
||||
|
||||
|
||||
for (ListinoEnum b : ListinoEnum.values()) {
|
||||
if (b.value == castValue)
|
||||
return b;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@JsonValue
|
||||
public String getValue() {
|
||||
return this.value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object get() {
|
||||
return this.value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ListinoEnum fromInternal(Object val) {
|
||||
return from(val);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return String.valueOf(value);
|
||||
}
|
||||
}
|
||||
@@ -62,11 +62,11 @@ public class DeviceService {
|
||||
return UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(multiDBTransactionManager.getPrimaryConnection(), sql);
|
||||
}
|
||||
|
||||
public void updateUsage(IntegryApplicationEnum application, long deviceId) throws Exception {
|
||||
public void updateUsage(long deviceId) throws Exception {
|
||||
MultiDBTransactionManager multiDBTransactionManager = ContextLoader.getCurrentWebApplicationContext().getBean(MultiDBTransactionManager.class);
|
||||
String updateSql = Query.format("UPDATE stb_devices " +
|
||||
" SET last_use = {}, name = {}" +
|
||||
" WHERE id = {}", UtilityLocalDate.getNowTime(), application.name(), deviceId);
|
||||
" SET last_use = {}" +
|
||||
" WHERE id = {}", UtilityLocalDate.getNowTime(), deviceId);
|
||||
|
||||
UtilityDB.executeSimpleUpdate(multiDBTransactionManager.getPrimaryConnection(), updateSql);
|
||||
}
|
||||
|
||||
@@ -166,7 +166,7 @@ public class RefreshTokenService {
|
||||
HashMap<String, AuthTokenProfileDetails> profilesData = new HashMap<>();
|
||||
|
||||
try {
|
||||
MtbDepo defaultUserDepo = UtilityUser.getDefaultUserDepo(multiDBTransactionManager, user);
|
||||
MtbDepo defaultUserDepo = UtilityUser.getDefaultUserDepo(multiDBTransactionManager.getPrimaryConnection().getIntegryCustomerDB(), user);
|
||||
|
||||
if (defaultUserDepo != null) {
|
||||
AuthTokenProfileDetails authTokenProfileDetails = new AuthTokenProfileDetails(AuthTokenDepoDetails.fromMtbDepo(defaultUserDepo));
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -37,7 +37,7 @@ end
|
||||
rule "completeValUntDISTDocL"
|
||||
when
|
||||
eval(completeRulesEnabled)
|
||||
$docR : DtbDocr(valUnt == null && rapConv != null && ("DIST" == listino || listino == null) && codMart != null && gestione == "L")
|
||||
$docR : DtbDocr(valUnt == null && rapConv != null && ("DIST" == listino) && codMart != null && gestione == "L")
|
||||
then
|
||||
BigDecimal valUnt = CommonRules.completeValUntDIST(conn, $docR);
|
||||
modify ( $docR ) { setValUnt(valUnt) }
|
||||
@@ -46,7 +46,7 @@ end
|
||||
rule "completeValUntCMEDDocL"
|
||||
when
|
||||
eval(completeRulesEnabled)
|
||||
$docR : DtbDocr(valUnt == null && rapConv != null && ("CMED" == listino || listino == null) && codMart != null && gestione == "L")
|
||||
$docR : DtbDocr(valUnt == null && rapConv != null && ("CMED" == listino ) && codMart != null && gestione == "L")
|
||||
then
|
||||
BigDecimal valUnt= CommonRules.completeValUntCMED(conn, $docR);
|
||||
modify ( $docR ) { setValUnt(valUnt) }
|
||||
|
||||
@@ -11,6 +11,7 @@ import it.integry.ems.sync.MultiDBTransaction.Connection;
|
||||
import org.drools.core.util.bitmask.LongBitMask
|
||||
import it.integry.ems.utility.UtilityEntity
|
||||
import it.integry.ems_model.utility.UtilityDB
|
||||
import java.time.LocalDate
|
||||
|
||||
global Connection conn
|
||||
global String username
|
||||
@@ -53,7 +54,7 @@ when
|
||||
eval(completeRulesEnabled)
|
||||
$lisvData: VtbListData(dataIniz == null)
|
||||
then
|
||||
Date dataIniz = (Date) CommonRules.completeWithDefault(VtbListData.class, "dataIniz");
|
||||
LocalDate dataIniz = (LocalDate) CommonRules.completeWithDefault(VtbListData.class, "dataIniz");
|
||||
modify ( $lisvData ) { setDataIniz(dataIniz) }
|
||||
end
|
||||
|
||||
@@ -388,7 +389,7 @@ when
|
||||
eval(completeRulesEnabled)
|
||||
$entity : MtbLisvData(codVlis != null && operation != OperationType.DELETE)
|
||||
then
|
||||
modify ( $entity ) { setDataAggPrz(new Date()) }
|
||||
modify ( $entity ) { setDataAggPrz(LocalDateTime.now()) }
|
||||
end
|
||||
|
||||
rule "completeCodVlisRif"
|
||||
|
||||
@@ -174,4 +174,28 @@ when
|
||||
$entity: GtbAnagNote(dataIns == null)
|
||||
then
|
||||
modify ( $entity ) { setDataIns(UtilityLocalDate.getNow()) }
|
||||
end
|
||||
|
||||
rule "completeDataModVtbDest"
|
||||
when
|
||||
eval(completeRulesEnabled)
|
||||
$entity : VtbDest(operation != OperationType.DELETE)
|
||||
then
|
||||
modify ( $entity ) { setDataMod(LocalDateTime.now()) }
|
||||
end
|
||||
|
||||
rule "completeDataModPtbPros"
|
||||
when
|
||||
eval(completeRulesEnabled)
|
||||
$entity : PtbPros(operation != OperationType.DELETE)
|
||||
then
|
||||
modify ( $entity ) { setDataMod(LocalDateTime.now()) }
|
||||
end
|
||||
|
||||
rule "completeDataModPtbProsRif"
|
||||
when
|
||||
eval(completeRulesEnabled)
|
||||
$entity : PtbProsRif(operation != OperationType.DELETE)
|
||||
then
|
||||
modify ( $entity ) { setDataMod(LocalDateTime.now()) }
|
||||
end
|
||||
@@ -456,3 +456,15 @@ then
|
||||
throw new CheckConstraintException(String.format("Attenzione! Email non valida per la persona di riferimento %s.",
|
||||
$vtbCliePersRif.getPersonaRif()));
|
||||
end
|
||||
|
||||
|
||||
rule "checkMtbLisvDelete"
|
||||
no-loop
|
||||
when
|
||||
eval(checkRulesEnabled)
|
||||
$entity : MtbLisv(operation == OperationType.DELETE)
|
||||
eval(SalesRules.checkMtbLisvDelete(conn, $entity))
|
||||
then
|
||||
throw new CheckConstraintException(
|
||||
String.format("Attezione!Impossibile cancellare l'articolo %s dal listino %s ci sono variazioni future. ", $entity.getCodMart(), $entity.getCodVlis()));
|
||||
end
|
||||
@@ -65,3 +65,13 @@ then
|
||||
String tipoAnag = CommesseRules.completeTipoAnag(conn, $comT.getCodAnag());
|
||||
modify($comT) {setTipoAnag(tipoAnag)}
|
||||
end
|
||||
|
||||
rule "completeDataMod"
|
||||
when
|
||||
eval(completeRulesEnabled)
|
||||
$entity : JtbComt(operation != OperationType.DELETE)
|
||||
then
|
||||
modify ( $entity ) {
|
||||
setDataMod(LocalDateTime.now())
|
||||
}
|
||||
end
|
||||
@@ -15,6 +15,7 @@ import it.integry.ems_model.utility.UtilityHashMap
|
||||
import it.integry.ems_model.utility.UtilityDate
|
||||
import it.integry.ems_model.utility.UtilityDB
|
||||
import it.integry.ems_model.utility.UtilityLocalDate
|
||||
import it.integry.ems_model.config.EmsRestConstants
|
||||
|
||||
global Connection conn
|
||||
global String username
|
||||
@@ -261,7 +262,7 @@ when
|
||||
eval(completeRulesEnabled)
|
||||
$entity: CtbPart(annoPart == null && dataDoc != null && operation != OperationType.DELETE )
|
||||
then
|
||||
int annoPart = UtilityDate.getYear($entity.getDataDoc());
|
||||
int annoPart = $entity.getDataDoc().getYear();
|
||||
modify ( $entity ) { setAnnoPart(annoPart)}
|
||||
end
|
||||
|
||||
@@ -425,7 +426,7 @@ then
|
||||
"ser_doc = '" + $entity.getSerDoc() + "' AND " +
|
||||
"num_doc = " + $entity.getNumDoc();
|
||||
Date dataDoc = (Date) QueryRules.getSingleValue(conn, sql);
|
||||
modify ( $entity ) { setDataDoc(dataDoc) }
|
||||
modify ( $entity ) { setDataDoc(UtilityLocalDate.localDateFromDate(dataDoc)) }
|
||||
end
|
||||
|
||||
|
||||
@@ -437,10 +438,9 @@ when
|
||||
$entity: CtbScad(riaperta != null && riaperta && numCmov !=null)
|
||||
then
|
||||
List<CrlScadParr> crlScadParrs = AccountingRules.completeCrlParrScadScad(conn, $entity);
|
||||
Date dataNull = new Date(-2208992400000L);
|
||||
modify ( $entity ) {
|
||||
setCrlScadParr(crlScadParrs),
|
||||
setDataPag(dataNull) }
|
||||
setDataPag(EmsRestConstants.LOCAL_DATE_NULL) }
|
||||
end
|
||||
|
||||
|
||||
@@ -480,8 +480,7 @@ when
|
||||
eval(completeRulesEnabled)
|
||||
$entity: CtbScad( (impAvere != null && impAvere == 0 ) || (impDare != null && impDare == 0 ))
|
||||
then
|
||||
Date dataNull = new Date(-2208992400000L);
|
||||
modify ( $entity ) { setDataPag(dataNull ) }//impostiamo la data a null
|
||||
modify ( $entity ) { setDataPag(EmsRestConstants.LOCAL_DATE_NULL ) }//impostiamo la data a null
|
||||
end
|
||||
|
||||
rule "completeInseritoDaCtbMovt"
|
||||
|
||||
@@ -591,7 +591,7 @@ end
|
||||
rule "completeFlagSetNumProtDtbTipi"
|
||||
when
|
||||
eval(completeRulesEnabled)
|
||||
$dTip : DtbTipi((gestione == "V" || codCcau != null) && flagSetNumProt)
|
||||
$dTip : DtbTipi((gestione == "V" || codCcau != null) && (flagSetNumProt == null || flagSetNumProt))
|
||||
then
|
||||
modify ( $dTip ) { setFlagSetNumProt(false) }
|
||||
end
|
||||
|
||||
@@ -195,12 +195,11 @@ when
|
||||
eval(postRulesEnabled)
|
||||
$ctbMovt: CtbMovt()
|
||||
$entity : EntityBase() from $ctbMovt
|
||||
//$iva: java.util.ArrayList(size > 0) from collect(EntityBase() from $ctbMovt.ctbMovi)
|
||||
$list: java.util.ArrayList(size > 0) from collect(EntityBase() from $ctbMovt.ctbMovr)
|
||||
then
|
||||
CommonRules.reloadRow(conn, $entity);
|
||||
/*Sulla ctb_movr abbiamo 2 campi riga da valorizzare*/
|
||||
CommonRules.completeRigaCtbMovr( $entity);
|
||||
CommonRules.completeRigaCtbMovr( $ctbMovt );
|
||||
AccountingRules.checkRigaMovCtbParr( $ctbMovt );
|
||||
AccountingRules.setImportoMov( $ctbMovt );
|
||||
AccountingRules.chkMovimentoBilanciato($ctbMovt);
|
||||
end
|
||||
|
||||
@@ -536,8 +536,8 @@ public class ContabilImportService {
|
||||
|
||||
if (ctbPart != null) {
|
||||
CtbScad ctbScad = new CtbScad();
|
||||
ctbScad.setDataScad(dataScad);
|
||||
ctbScad.setDataPag(dataScad);
|
||||
ctbScad.setDataScad(UtilityLocalDate.localDateFromDate(dataScad));
|
||||
ctbScad.setDataPag(UtilityLocalDate.localDateFromDate(dataScad));
|
||||
ctbScad.setDescrizPag(pagamento);
|
||||
|
||||
BigDecimal impRata = UtilityString.isNullOrEmpty(importoRata) ? null : new BigDecimal(importoRata);
|
||||
@@ -557,8 +557,8 @@ public class ContabilImportService {
|
||||
if (!impPagato.equals(impRata) && !UtilityString.isNullOrEmpty(stringResiduo)) {
|
||||
CtbScad ctbScadResiduo = new CtbScad();
|
||||
ctbScadResiduo.setOperation(OperationType.INSERT);
|
||||
ctbScadResiduo.setDataScad(dataScad);
|
||||
ctbScadResiduo.setDataPag(dataScad);
|
||||
ctbScadResiduo.setDataScad(UtilityLocalDate.localDateFromDate(dataScad));
|
||||
ctbScadResiduo.setDataPag(UtilityLocalDate.localDateFromDate(dataScad));
|
||||
ctbScadResiduo.setDescrizPag(pagamento);
|
||||
if (residuoIsNegative) {
|
||||
ctbScadResiduo.setImpAvere(positiveResiduo);
|
||||
|
||||
@@ -24,6 +24,7 @@ import java.io.File;
|
||||
import java.math.BigDecimal;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.LocalDate;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
@@ -73,8 +74,8 @@ public class ScadenzeImportService {
|
||||
impAvere = importo;
|
||||
}
|
||||
|
||||
Date dataScad = UtilityDate.StringToDate(line.substring(57, 65), "ddMMyyyy");
|
||||
Date dataDoc = UtilityDate.StringToDate(line.substring(267, 275), "ddMMyyyy");
|
||||
LocalDate dataScad = UtilityString.parseLocalDate(line.substring(57, 65), "ddMMyyyy");
|
||||
LocalDate dataDoc = UtilityString.parseLocalDate(line.substring(267, 275), "ddMMyyyy");
|
||||
String diacod = line.substring(92, 108).trim();
|
||||
Integer numDoc = UtilityString.isIntNumber(line.substring(185, 197).trim()) ? UtilityInteger.stringToInteger(line.substring(185, 197).trim()) : null;
|
||||
String intercode = line.substring(197, 223);
|
||||
@@ -137,7 +138,8 @@ public class ScadenzeImportService {
|
||||
forceIn2021 = true;
|
||||
}
|
||||
|
||||
if (forceIn2021 || (ctbPart == null && (anno != null && (anno < 2021 || dataDoc.before(UtilityDate.StringToDate("2021/07/01", "yyyy/MM/dd")))))) {
|
||||
if (forceIn2021 || (ctbPart == null && (anno != null && (anno < 2021 ||
|
||||
dataDoc.isBefore(UtilityString.parseLocalDate("2021/07/01", "yyyy/MM/dd")))))) {
|
||||
sql = Query.format(
|
||||
"SELECT *\n" +
|
||||
"FROM ctb_part\n" +
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package it.integry.ems.contabil.controller;
|
||||
|
||||
import it.integry.common.var.CommonConstants;
|
||||
import it.integry.ems.contabil.dto.MovimentiContabileDeleteDTO;
|
||||
import it.integry.ems.contabil.service.MovimentiContabiliService;
|
||||
import it.integry.ems.response.ServiceRestResponse;
|
||||
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
|
||||
@@ -42,9 +43,9 @@ public class MovimentiContabiliController {
|
||||
@PostMapping(value = "delete")
|
||||
public @ResponseBody
|
||||
ServiceRestResponse delete(HttpServletRequest request,
|
||||
@RequestParam String whereCond) throws Exception {
|
||||
@RequestBody MovimentiContabileDeleteDTO movimentiContabileDeleteDTO) throws Exception {
|
||||
|
||||
return ServiceRestResponse.createPositiveResponse(movimentiContabiliServices.delete(multiDBTransactionManager,whereCond));
|
||||
return ServiceRestResponse.createPositiveResponse(movimentiContabiliServices.delete(multiDBTransactionManager,movimentiContabileDeleteDTO));
|
||||
}
|
||||
|
||||
@PostMapping(value = "generateReverseCharge")
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
package it.integry.ems.contabil.dto;
|
||||
|
||||
public class MovimentiContabileDeleteDTO {
|
||||
private String whereCond;
|
||||
|
||||
public String getWhereCond() {
|
||||
return whereCond;
|
||||
}
|
||||
|
||||
public MovimentiContabileDeleteDTO setWhereCond(String whereCond) {
|
||||
this.whereCond = whereCond;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -1401,10 +1401,10 @@ public class ContabilService {
|
||||
if (UtilityBigDecimal.isNullOrZero(impIncasso)) {
|
||||
impIncasso = impIncasso.multiply(new BigDecimal(-1));
|
||||
CtbScad ctbScadInsoluto = new CtbScad()
|
||||
.setDataScad(ctbMovt.getDataCmov())
|
||||
.setDataScad(UtilityLocalDate.localDateFromDate(ctbMovt.getDataCmov()))
|
||||
.setImpDare(impIncasso)
|
||||
.setImpAvere(impIncasso)
|
||||
.setDataPag(ctbMovt.getDataCmov());
|
||||
.setDataPag(UtilityLocalDate.localDateFromDate(ctbMovt.getDataCmov()));
|
||||
ctbScadInsoluto.setOperation(OperationType.INSERT);
|
||||
|
||||
ctbScads.add(ctbScadInsoluto);
|
||||
@@ -1422,7 +1422,7 @@ public class ContabilService {
|
||||
}
|
||||
|
||||
ctbScadInsoluto = new CtbScad()
|
||||
.setDataScad(ctbMovt.getDataCmov())
|
||||
.setDataScad(UtilityLocalDate.localDateFromDate(ctbMovt.getDataCmov()))
|
||||
.setImpDare(impDareIns)
|
||||
.setImpAvere(impAvereIns);
|
||||
ctbScadInsoluto.setOperation(OperationType.INSERT);
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package it.integry.ems.contabil.service;
|
||||
|
||||
import it.integry.ems.contabil.dto.MovimentiContabileDeleteDTO;
|
||||
import it.integry.ems.rules.businessLogic.AccountingBusinessLogic;
|
||||
import it.integry.ems.service.EntityProcessor;
|
||||
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
|
||||
import it.integry.ems.utility.UtilityEntity;
|
||||
@@ -9,13 +11,11 @@ import it.integry.ems_model.entity.*;
|
||||
import it.integry.ems_model.types.OperationType;
|
||||
import it.integry.ems_model.utility.*;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
|
||||
@@ -27,6 +27,7 @@ public class MovimentiContabiliService {
|
||||
List<EntityBase> entitiesToSave = new ArrayList<>();
|
||||
|
||||
if (ctbMovt.getNumCmov() != null && ctbMovt.getOperation() != OperationType.DELETE) {
|
||||
|
||||
if (ctbMovt.getCodAnag() != null) {
|
||||
String sql =
|
||||
Query.format("SELECT cod_anag FROM ctb_movt WHERE num_cmov = %s", ctbMovt.getNumCmov());
|
||||
@@ -57,6 +58,60 @@ public class MovimentiContabiliService {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (ctbMovt.getCtbMovr() != null) {
|
||||
OperationType operationType = ctbMovt.getOperation();
|
||||
boolean existMov = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(multiDBTransactionManager.getPrimaryConnection(),
|
||||
Query.format("SELECT Cast(count(*) as bit) FROM ctb_movt WHERE num_cmov = %s", ctbMovt.getNumCmov()));
|
||||
|
||||
if ( existMov ) {
|
||||
ctbMovt.setOperation(OperationType.SELECT_OBJECT);
|
||||
entityProcessor.processEntity(ctbMovt, multiDBTransactionManager);
|
||||
ctbMovt.setOperation(operationType);
|
||||
}
|
||||
String sql = Query.format("SELECT azione_su_partita FROM ctb_caus WHERE cod_ccau = %s", ctbMovt.getCodCcau());
|
||||
Integer azioneSuPartita = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(multiDBTransactionManager.getPrimaryConnection(), sql);
|
||||
if (azioneSuPartita != null && azioneSuPartita == 0) {
|
||||
Integer annoPart = UtilityDate.datePart(Calendar.YEAR, ctbMovt.getDataDoc());
|
||||
|
||||
List<CtbMovr> righe =
|
||||
ctbMovt.getCtbMovr()
|
||||
.stream()
|
||||
.filter(x ->
|
||||
Objects.equals(x.getAnnoPart(),annoPart) &&
|
||||
x.getSerDoc().equalsIgnoreCase(ctbMovt.getSerDoc()) &&
|
||||
Objects.equals(x.getNumDoc(), ctbMovt.getNumDoc()))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
CtbMovr rigaPaga = righe.isEmpty() || righe.size() <= 1 ? null : righe.get(righe.size() - 1);
|
||||
|
||||
if (rigaPaga != null) {
|
||||
if (rigaPaga.getCtbScad() == null || rigaPaga.getCtbScad().isEmpty()) {
|
||||
List<CtbScad> elencoScad = ctbMovt.getCtbScad();
|
||||
BigDecimal importo = rigaPaga.getImpDare() == BigDecimal.ZERO ? rigaPaga.getImpAvere() : rigaPaga.getImpDare();
|
||||
AccountingBusinessLogic.pagaScadenze(ctbMovt.getDataCmov(), importo, elencoScad, rigaPaga.getIdRiga());
|
||||
rigaPaga.setCtbScad(elencoScad.stream().filter(x -> x.getIdRigaMov() == rigaPaga.getIdRiga()).collect(Collectors.toList()));
|
||||
} else {
|
||||
List<Integer> idRigaScad = rigaPaga.getCtbScad().stream()
|
||||
.filter(x ->
|
||||
Objects.equals(x.getAnnoPart(), annoPart) &&
|
||||
x.getSerDoc().equalsIgnoreCase(ctbMovt.getSerDoc()) &&
|
||||
Objects.equals(x.getNumDoc(), ctbMovt.getNumDoc()))
|
||||
.map(x -> x.getIdRiga()).distinct().collect(Collectors.toList());
|
||||
|
||||
List<CtbScad> elencoScad =
|
||||
ctbMovt.getCtbScad()
|
||||
.stream()
|
||||
.filter(x ->
|
||||
Objects.equals(x.getAnnoPart(),annoPart) &&
|
||||
x.getSerDoc().equalsIgnoreCase(ctbMovt.getSerDoc()) &&
|
||||
Objects.equals(x.getNumDoc(), ctbMovt.getNumDoc()) &&
|
||||
(x.getIdRiga() == null || !idRigaScad.contains(x.getIdRiga()))).collect(Collectors.toList());
|
||||
ctbMovt.setCtbScad(elencoScad);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
entitiesToSave.add(ctbMovt);
|
||||
} else {
|
||||
entitiesToSave = Collections.singletonList(ctbMovt);
|
||||
@@ -84,10 +139,10 @@ public class MovimentiContabiliService {
|
||||
return save(multiDBTransactionManager, ctbMovt);
|
||||
}
|
||||
|
||||
public List<CtbMovt> delete(MultiDBTransactionManager multiDBTransactionManager, String whereCond) throws Exception {
|
||||
public List<CtbMovt> delete(MultiDBTransactionManager multiDBTransactionManager, MovimentiContabileDeleteDTO movimentiContabileDeleteDTO) throws Exception {
|
||||
String sql = "SELECT num_cmov " +
|
||||
" FROM " + CtbMovt.ENTITY +
|
||||
" WHERE " + whereCond;
|
||||
" WHERE " + movimentiContabileDeleteDTO.getWhereCond();
|
||||
|
||||
List<CtbMovt> ctbMovts = UtilityDB.executeSimpleQueryDTO(multiDBTransactionManager.getPrimaryConnection(), sql, CtbMovt.class);
|
||||
|
||||
@@ -129,7 +184,7 @@ public class MovimentiContabiliService {
|
||||
|
||||
boolean flagReverseCharge = (boolean) datiMov.get("flag_reverse_charge");
|
||||
|
||||
if ( flagReverseCharge ) {
|
||||
if (flagReverseCharge) {
|
||||
CtbMovt ctbMovt = new CtbMovt()
|
||||
.setNumCmov(numCmov);
|
||||
ctbMovt.setOperation(OperationType.UPDATE);
|
||||
|
||||
@@ -1080,7 +1080,7 @@ public class RossoGarganoSyncService {
|
||||
|
||||
CtbPart ctbPart =
|
||||
new CtbPart()
|
||||
.setDataDoc(ctbMovt.getDataDoc())
|
||||
.setDataDoc(UtilityLocalDate.localDateFromDate(ctbMovt.getDataDoc()))
|
||||
.setSerDoc(ctbMovt.getSerDoc())
|
||||
.setAnnoPart(annoPart)
|
||||
.setNumDoc(ctbMovt.getNumDoc())
|
||||
|
||||
@@ -6,6 +6,7 @@ import it.integry.ems.customizations.production.service.ToscaProductionService;
|
||||
import it.integry.ems.response.EsitoType;
|
||||
import it.integry.ems.response.ServiceRestResponse;
|
||||
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
|
||||
import it.integry.ems_model.utility.UtilityLocalDate;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -13,6 +14,10 @@ import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.Date;
|
||||
|
||||
@RestController
|
||||
@Scope(value = "request")
|
||||
@@ -92,4 +97,26 @@ public class ToscaProductionController {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping(value = "ripubblicaUl", method = RequestMethod.POST)
|
||||
public @ResponseBody
|
||||
ServiceRestResponse ripubblicaUl(HttpServletRequest request,
|
||||
@RequestParam(CommonConstants.PROFILE_DB) String profileDB,
|
||||
@RequestParam String startDate) {
|
||||
try {
|
||||
toscaProductionService.ripubblicaUl(LocalDateTime.parse(startDate, DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
|
||||
return ServiceRestResponse.createPositiveResponse();
|
||||
|
||||
} catch (Exception e) {
|
||||
try {
|
||||
multiDBTransactionManager.rollbackAll();
|
||||
} catch (Exception ex) {
|
||||
logger.error(request.getRequestURI(), e);
|
||||
}
|
||||
|
||||
logger.error(request.getRequestURI(), e);
|
||||
return new ServiceRestResponse(EsitoType.KO, profileDB, e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -6,10 +6,7 @@ import it.integry.ems.service.EntityProcessor;
|
||||
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
|
||||
import it.integry.ems_model.entity.*;
|
||||
import it.integry.ems_model.types.OperationType;
|
||||
import it.integry.ems_model.utility.Query;
|
||||
import it.integry.ems_model.utility.UtilityDB;
|
||||
import it.integry.ems_model.utility.UtilityHashMap;
|
||||
import it.integry.ems_model.utility.UtilityLocalDate;
|
||||
import it.integry.ems_model.utility.*;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -19,9 +16,11 @@ import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
@Scope("request")
|
||||
@@ -193,4 +192,29 @@ public class ToscaProductionService {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void ripubblicaUl(LocalDateTime start) throws Exception {
|
||||
|
||||
|
||||
String sql = "SELECT * from mtb_colt where data_vers >= " + UtilityDB.valueToString(start);
|
||||
|
||||
|
||||
List<MtbColt> mtbColtList = UtilityDB.executeSimpleQueryDTO(multiDBTransactionManager.getPrimaryConnection(), sql, MtbColt.class);
|
||||
if (UtilityList.isNullOrEmpty(mtbColtList)) return;
|
||||
|
||||
for (MtbColt mtbColt : mtbColtList) {
|
||||
mtbColt.setOperation(OperationType.INSERT_OR_UPDATE);
|
||||
String rowsSql = "SELECT * from mtb_colr where " + mtbColt.getPkWhereCond();
|
||||
List<MtbColr> rows = UtilityDB.executeSimpleQueryDTO(multiDBTransactionManager.getPrimaryConnection(), rowsSql, MtbColr.class);
|
||||
if (!UtilityList.isNullOrEmpty(rows))
|
||||
mtbColt.setMtbColr(rows.stream().peek(x -> x.setOperation(OperationType.INSERT_OR_UPDATE)).collect(Collectors.toList()));
|
||||
|
||||
String colsSql = "SELECT * from mtb_cols where " + mtbColt.getPkWhereCond();
|
||||
List<MtbCols> cols = UtilityDB.executeSimpleQueryDTO(multiDBTransactionManager.getPrimaryConnection(), colsSql, MtbCols.class);
|
||||
if (!UtilityList.isNullOrEmpty(cols))
|
||||
mtbColt.setMtbCols(cols.stream().peek(x -> x.setOperation(OperationType.INSERT_OR_UPDATE)).collect(Collectors.toList()));
|
||||
|
||||
entityProcessor.processEntity(mtbColt, true, multiDBTransactionManager);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,4 +50,25 @@ public class ToscaSalesController {
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value = "ripubblicaImpegnato", method = RequestMethod.POST)
|
||||
public @ResponseBody
|
||||
ServiceRestResponse ripubblicaImpegnato(HttpServletRequest request,
|
||||
@RequestParam(CommonConstants.PROFILE_DB) String profileDB
|
||||
) {
|
||||
try {
|
||||
toscaSalesService.republishOrders();
|
||||
return ServiceRestResponse.createPositiveResponse();
|
||||
|
||||
} catch (Exception e) {
|
||||
try {
|
||||
multiDBTransactionManager.rollbackAll();
|
||||
} catch (Exception ex) {
|
||||
logger.error(request.getRequestURI(), e);
|
||||
}
|
||||
|
||||
logger.error(request.getRequestURI(), e);
|
||||
return new ServiceRestResponse(EsitoType.KO, profileDB, e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user