Merge branch 'master' into feature/RefactoringGestioneColli
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
This commit is contained in:
19
.idea/copilot.data.migration.agent.xml
generated
Normal file
19
.idea/copilot.data.migration.agent.xml
generated
Normal file
@@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="AgentMigrationStateService">
|
||||
<option name="pendingSessionIds">
|
||||
<option value="c2adff55-0384-4ed3-8e89-6740a0a19622" />
|
||||
</option>
|
||||
<option name="pendingTurns">
|
||||
<map>
|
||||
<entry key="c2adff55-0384-4ed3-8e89-6740a0a19622">
|
||||
<value>
|
||||
<set>
|
||||
<option value="0ff64af0-e1e5-4e48-9056-263f3dd7e63f" />
|
||||
</set>
|
||||
</value>
|
||||
</entry>
|
||||
</map>
|
||||
</option>
|
||||
</component>
|
||||
</project>
|
||||
@@ -186,14 +186,14 @@ sleep 10''', execTimeout: 120000, flatten: false, makeEmptyDirs: false, noDefaul
|
||||
success {
|
||||
script {
|
||||
if (env.GIT_BRANCH == "master" || env.GIT_BRANCH == "develop") {
|
||||
office365ConnectorSend adaptiveCards: true, color: '#008000', message: 'EMS-API ` stato compilato con successo', status: 'SUCCESS', webhookUrl: 'https://prod-197.westeurope.logic.azure.com:443/workflows/69a7b8ee3c284175bd6da7127c7eb3cf/triggers/manual/paths/invoke?api-version=2016-06-01&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=_-eMfvsQGkIidHWzzlhGFgiZG28ujHZ41QqzuqD9YGw'
|
||||
office365ConnectorSend adaptiveCards: true, color: '#008000', message: 'EMS-API è stato compilato con successo', status: 'SUCCESS', webhookUrl: 'https://prod-197.westeurope.logic.azure.com:443/workflows/69a7b8ee3c284175bd6da7127c7eb3cf/triggers/manual/paths/invoke?api-version=2016-06-01&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=_-eMfvsQGkIidHWzzlhGFgiZG28ujHZ41QqzuqD9YGw'
|
||||
}
|
||||
}
|
||||
}
|
||||
unstable {
|
||||
script {
|
||||
if (env.GIT_BRANCH == "master" || env.GIT_BRANCH == "develop") {
|
||||
office365ConnectorSend adaptiveCards: true, color: '#FFDE21', message: 'EMS-API ` INSTABILE', status: 'UNSTABLE', webhookUrl: 'https://prod-197.westeurope.logic.azure.com:443/workflows/69a7b8ee3c284175bd6da7127c7eb3cf/triggers/manual/paths/invoke?api-version=2016-06-01&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=_-eMfvsQGkIidHWzzlhGFgiZG28ujHZ41QqzuqD9YGw'
|
||||
office365ConnectorSend adaptiveCards: true, color: '#FFDE21', message: 'EMS-API è INSTABILE', status: 'UNSTABLE', webhookUrl: 'https://prod-197.westeurope.logic.azure.com:443/workflows/69a7b8ee3c284175bd6da7127c7eb3cf/triggers/manual/paths/invoke?api-version=2016-06-01&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=_-eMfvsQGkIidHWzzlhGFgiZG28ujHZ41QqzuqD9YGw'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,7 +13,6 @@ import it.integry.ems.task.TaskExecutorService;
|
||||
import it.integry.ems.user.service.UserCacheService;
|
||||
import it.integry.ems_model.entity.Azienda;
|
||||
import it.integry.ems_model.service.SetupGest;
|
||||
import it.integry.ems_model.utility.UtilityDB;
|
||||
import it.integry.ems_model.utility.UtilityString;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
@@ -56,6 +55,7 @@ public class EmsCoreDBLoader {
|
||||
public void init() throws Exception {
|
||||
this.settingsController.addOnConfigUpdated(() -> {
|
||||
try {
|
||||
connectionPool.destroy();
|
||||
connectionPool.init();
|
||||
load(null);
|
||||
} catch (Exception e) {
|
||||
@@ -89,12 +89,7 @@ public class EmsCoreDBLoader {
|
||||
|
||||
futureTasks.add(() -> {
|
||||
try {
|
||||
Connection connection = connectionPool.getConnection(modelAtomicReference.get());
|
||||
String sql = "SELECT db_distributore FROM azienda";
|
||||
String dbDistributore = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(connection, sql);
|
||||
|
||||
multiDBTransactionManager.addConnection(connection, modelAtomicReference.get().getDbName().equalsIgnoreCase(dbDistributore));
|
||||
|
||||
multiDBTransactionManager.addConnection(modelAtomicReference.get());
|
||||
return null;
|
||||
} catch (Exception ex) {
|
||||
throw new Exception("[" + modelAtomicReference.get().getProfileName() + "] " + ex.getMessage(), ex.getCause());
|
||||
|
||||
@@ -750,6 +750,24 @@ public class EmsController {
|
||||
return ResponseEntity.notFound().build();
|
||||
}
|
||||
|
||||
@GetMapping(value = "downloadFileFromRefUuid")
|
||||
public ResponseEntity<byte[]> downloadFileFromRefUuid(@RequestParam(CommonConstants.PROFILE_DB) String config,
|
||||
@RequestParam() String refUuid,
|
||||
@RequestParam() String fileName) throws Exception {
|
||||
AttachmentDTO attached = emsServices.downloadFileFromRefUuid(refUuid, fileName);
|
||||
|
||||
if (attached == null) return ResponseEntity.notFound().build();
|
||||
|
||||
return ResponseEntity.ok()
|
||||
.contentType(MediaType.parseMediaType(attached.getMimeType()))
|
||||
.contentLength(attached.getFileSize())
|
||||
.header(HttpHeaders.CONTENT_DISPOSITION, ContentDisposition
|
||||
.attachment()
|
||||
.filename(attached.getFileName())
|
||||
.build()
|
||||
.toString())
|
||||
.body(attached.getFileContent());
|
||||
}
|
||||
|
||||
@RequestMapping(value = EmsRestConstants.PATH_DOWNLOAD_STB_FILE_ATTACHMENT, method = RequestMethod.GET)
|
||||
public ResponseEntity<byte[]> downloadStbFileAttachmentPath(
|
||||
|
||||
@@ -3,16 +3,13 @@ package it.integry.ems.datasource;
|
||||
import it.integry.ems.settings.Model.AvailableConnectionsModel;
|
||||
import it.integry.ems.settings.Model.SettingsModel;
|
||||
import it.integry.ems.sync.MultiDBTransaction.Connection;
|
||||
import it.integry.ems.utility.UtilityDebug;
|
||||
import it.integry.ems_model.config.EmsRestConstants;
|
||||
import it.integry.ems_model.utility.UtilityDB;
|
||||
import it.integry.ems_model.utility.UtilityHashMap;
|
||||
import it.integry.ems_model.utility.UtilityString;
|
||||
import org.apache.commons.dbcp2.BasicDataSource;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
public class DataSource extends BasicDataSource {
|
||||
|
||||
@@ -64,7 +61,17 @@ public class DataSource extends BasicDataSource {
|
||||
return connection;
|
||||
}
|
||||
|
||||
public synchronized void initialize(String profileDB) throws Exception {
|
||||
AvailableConnectionsModel connectionsModel = SettingsModel.getInstance().findConnectionModel(profileDB);
|
||||
|
||||
initialize(connectionsModel);
|
||||
}
|
||||
|
||||
public synchronized void initialize(AvailableConnectionsModel connectionModel) throws Exception {
|
||||
if (connectionModel == null) {
|
||||
throw new Exception("Configurazione DB non trovata");
|
||||
}
|
||||
|
||||
this.connectionModel = connectionModel;
|
||||
|
||||
this.setDriverClassName(connectionModel.getDriverClassName());
|
||||
@@ -72,6 +79,7 @@ public class DataSource extends BasicDataSource {
|
||||
this.setUrl(connectionModel.getDbConnectionString("EMS Connection"));
|
||||
this.setUsername(connectionModel.getUsername());
|
||||
this.setPassword(connectionModel.getPasswordDecrypted());
|
||||
this.setDefaultCatalog(connectionModel.getDbName());
|
||||
|
||||
this.setDefaultTransactionIsolation(java.sql.Connection.TRANSACTION_READ_UNCOMMITTED);
|
||||
this.setDefaultAutoCommit(false);
|
||||
@@ -81,14 +89,14 @@ public class DataSource extends BasicDataSource {
|
||||
// Pool sizing ottimizzato per READ_UNCOMMITTED (meno locking = più connessioni possibili)
|
||||
this.setInitialSize(5); // Inizia con più connessioni
|
||||
this.setMaxTotal(-1); // Aumentato il massimo
|
||||
this.setMaxIdle(-1); // Mantieni più connessioni idle
|
||||
this.setMinIdle(5); // Non scendere sotto 5
|
||||
this.setMaxIdle(-1); // Mantieni più connessioni idle
|
||||
|
||||
// Timeout ottimizzati per performance massime
|
||||
// this.setMaxWaitMillis(-1L); // Infinito (DEFAULT)
|
||||
|
||||
// Validazione veloce ed efficiente
|
||||
// this.setValidationQuery("SELECT 1");
|
||||
this.setValidationQuery("SELECT 1");
|
||||
// this.setValidationQueryTimeout(60); // Ridotto a 1 secondo
|
||||
// this.setTestWhileIdle(true); // Testa connessioni idle
|
||||
|
||||
@@ -98,16 +106,16 @@ public class DataSource extends BasicDataSource {
|
||||
// this.setNumTestsPerEvictionRun(5); // Testa più connessioni per volta
|
||||
|
||||
// Connection leak protection
|
||||
// this.setRemoveAbandonedOnBorrow(true);
|
||||
// this.setRemoveAbandonedOnMaintenance(true);
|
||||
// this.setRemoveAbandonedTimeout(60 * 10); // 60 secondi
|
||||
this.setLogAbandoned(UtilityDebug.isDebugExecution()); // Disabilita in produzione per performance
|
||||
this.setRemoveAbandonedOnBorrow(true);
|
||||
this.setRemoveAbandonedOnMaintenance(true);
|
||||
this.setRemoveAbandonedTimeout(3 * 60 * 10); // 3 minuti
|
||||
this.setLogAbandoned(true); // Disabilita in produzione per performance
|
||||
|
||||
// Performance boosts massimi
|
||||
// this.setPoolPreparedStatements(true);
|
||||
// this.setMaxOpenPreparedStatements(200);
|
||||
// this.setCacheState(true);
|
||||
// this.setFastFailValidation(true);
|
||||
this.setFastFailValidation(true);
|
||||
|
||||
// Ottimizzazioni specifiche per SQL Server con READ_UNCOMMITTED
|
||||
if (connectionModel.getConnectionType() == EmsRestConstants.DB_TYPE.MSSQL) {
|
||||
@@ -120,54 +128,27 @@ public class DataSource extends BasicDataSource {
|
||||
}
|
||||
|
||||
// Logging ottimizzato (disabilita in produzione)
|
||||
this.setLogExpiredConnections(UtilityDebug.isDebugExecution());
|
||||
// this.setAccessToUnderlyingConnectionAllowed(true); // Per performance avanzate
|
||||
this.setLogExpiredConnections(true);
|
||||
|
||||
// ==================== ULTERIORI OTTIMIZZAZIONI ====================
|
||||
|
||||
// Connection properties specifiche per performance
|
||||
this.setDefaultReadOnly(false);
|
||||
this.setDefaultCatalog(null); // Lascia che sia il driver a gestire
|
||||
|
||||
// Ottimizzazioni DBCP2 avanzate
|
||||
// this.setLifo(false); // FIFO per distribuzione equa delle connessioni
|
||||
// this.setSoftMinEvictableIdleTimeMillis(120000); // 2 minuti soft eviction
|
||||
|
||||
|
||||
if (!connectionModel.getInternalDb() ||
|
||||
UtilityDebug.isDebugExecution() ||
|
||||
UtilityDebug.isIntegryServerDev() ||
|
||||
!SettingsModel.getInstance().isPrimaryInstance()) {
|
||||
this.setInitialSize(0);
|
||||
// this.setMaxTotal(5);
|
||||
this.setMinIdle(0);
|
||||
this.setMaxIdle(1);
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized void initialize(String profileDB, String connectionName) throws Exception {
|
||||
if (UtilityString.isNullOrEmpty(profileDB)) {
|
||||
throw new Exception("Profile DB non valorizzato - controllare la chiamata del servizio");
|
||||
}
|
||||
|
||||
AvailableConnectionsModel connectionModel = null;
|
||||
List<AvailableConnectionsModel> availableConnectionsModels = SettingsModel.getInstance().getAvailableConnectionsWithoutDuplicatedProfiles(false);
|
||||
|
||||
for (AvailableConnectionsModel connectionsModel : availableConnectionsModels) {
|
||||
if (connectionsModel.getProfileName().equalsIgnoreCase(profileDB)) {
|
||||
connectionModel = connectionsModel;
|
||||
}
|
||||
}
|
||||
|
||||
if (connectionModel == null) {
|
||||
throw new Exception(String.format("Configurazione DB non trovata o dati mancanti (%s)", profileDB));
|
||||
}
|
||||
|
||||
initialize(connectionModel);
|
||||
}
|
||||
|
||||
public synchronized void initialize(String profileDB) throws Exception {
|
||||
initialize(profileDB, "EMS Connection");
|
||||
// if (!connectionModel.getInternalDb() ||
|
||||
// UtilityDebug.isDebugExecution() ||
|
||||
// UtilityDebug.isIntegryServerDev() ||
|
||||
// !SettingsModel.getInstance().isPrimaryInstance()) {
|
||||
// this.setInitialSize(0);
|
||||
//// this.setMaxTotal(5);
|
||||
// this.setMinIdle(0);
|
||||
// this.setMaxIdle(1);
|
||||
// }
|
||||
}
|
||||
|
||||
}
|
||||
@@ -2,15 +2,16 @@ package it.integry.ems.directory;
|
||||
|
||||
import com.fasterxml.jackson.databind.node.ArrayNode;
|
||||
import it.integry.common.var.CommonConstants;
|
||||
import it.integry.ems.datasource.DataSource;
|
||||
import it.integry.ems.json.ResponseJSONObjectMapper;
|
||||
import it.integry.ems.properties.EmsProperties;
|
||||
import it.integry.ems.response.EsitoType;
|
||||
import it.integry.ems.response.FileItem;
|
||||
import it.integry.ems.response.ServiceRestResponse;
|
||||
import it.integry.ems.sync.MultiDBTransaction.Connection;
|
||||
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
|
||||
import it.integry.ems_model.config.EmsRestConstants;
|
||||
import it.integry.ems_model.service.SetupGest;
|
||||
import it.integry.ems_model.utility.UtilityHashMap;
|
||||
import it.integry.ems_model.utility.UtilityString;
|
||||
import it.integry.security.utility.RestUtil;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
@@ -30,6 +31,7 @@ import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Properties;
|
||||
import java.util.TimerTask;
|
||||
|
||||
@@ -53,42 +55,44 @@ public class EmailWatcherListener extends TimerTask {
|
||||
|
||||
@Override
|
||||
public synchronized void run() {
|
||||
try {
|
||||
try (MultiDBTransactionManager multiDBTransactionManager = new MultiDBTransactionManager(emailListenerInfo.getDatabase())) {
|
||||
Connection conn = multiDBTransactionManager.getPrimaryConnection();
|
||||
|
||||
String flagAttivo = null, username = null, password = null,
|
||||
imap = null, pop3 = null, pop3Port = null, imapPort = null;
|
||||
|
||||
DataSource ds = new DataSource();
|
||||
ds.initialize(emailListenerInfo.getDatabase());
|
||||
|
||||
String[] params = emailListenerInfo.getSetupGestBranch().split("\\|");
|
||||
|
||||
if (params.length >= 2) {
|
||||
flagAttivo = setupGest.getSetup(ds.getConnection(), params[0], params[1], "ATTIVO");
|
||||
username = setupGest.getSetup(ds.getConnection(), params[0], params[1], "USERNAME");
|
||||
final HashMap<String, String> setupData = setupGest.getSetupSection(conn, params[0], params[1]);
|
||||
|
||||
flagAttivo = UtilityHashMap.getValueIfExists(setupData, "ATTIVO");
|
||||
username = UtilityHashMap.getValueIfExists(setupData, "USERNAME");
|
||||
if (UtilityString.isNullOrEmpty(username))
|
||||
throw new Exception(params[0] + "/" + params[1] + "/USERNAME non configurato correttamente");
|
||||
|
||||
password = setupGest.getSetup(ds.getConnection(), params[0], params[1], "PASSWORD");
|
||||
password = UtilityHashMap.getValueIfExists(setupData, "PASSWORD");
|
||||
if (UtilityString.isNullOrEmpty(password))
|
||||
throw new Exception(params[0] + "/" + params[1] + "/PASSWORD non configurato correttamente");
|
||||
|
||||
pop3 = setupGest.getSetup(ds.getConnection(), params[0], params[1], "POP3");
|
||||
pop3 = UtilityHashMap.getValueIfExists(setupData, "POP3");
|
||||
if (UtilityString.isNullOrEmpty(pop3))
|
||||
throw new Exception(params[0] + "/" + params[1] + "/POP3 non configurato correttamente");
|
||||
|
||||
pop3Port = setupGest.getSetup(ds.getConnection(), params[0], params[1], "POP3_PORT");
|
||||
pop3Port = UtilityHashMap.getValueIfExists(setupData, "POP3_PORT");
|
||||
if (UtilityString.isNullOrEmpty(pop3Port))
|
||||
throw new Exception(params[0] + "/" + params[1] + "/POP3_PORT non configurato correttamente");
|
||||
|
||||
imap = setupGest.getSetup(ds.getConnection(), params[0], params[1], "IMAP");
|
||||
imap = UtilityHashMap.getValueIfExists(setupData, "IMAP");
|
||||
if (UtilityString.isNullOrEmpty(imap))
|
||||
throw new Exception(params[0] + "/" + params[1] + "/IMAP non configurato correttamente");
|
||||
|
||||
imapPort = setupGest.getSetup(ds.getConnection(), params[0], params[1], "IMAP_PORT");
|
||||
imapPort = UtilityHashMap.getValueIfExists(setupData, "IMAP_PORT");
|
||||
if (UtilityString.isNullOrEmpty(imapPort))
|
||||
throw new Exception(params[0] + "/" + params[1] + "/IMAP_PORT non configurato correttamente");
|
||||
}
|
||||
ds.close();
|
||||
|
||||
if (!UtilityString.isNullOrEmpty(flagAttivo) && "S".equals(flagAttivo)) {
|
||||
Properties sysProperties = System.getProperties();
|
||||
Session session = Session.getDefaultInstance(sysProperties);
|
||||
@@ -160,7 +164,7 @@ public class EmailWatcherListener extends TimerTask {
|
||||
|
||||
String value = response.readEntity(String.class);
|
||||
|
||||
String emailDbg = setupGest.getSetup(ds.getConnection(), params[0], params[1], "EMAIL_DBG");
|
||||
String emailDbg = setupGest.getSetup(conn, params[0], params[1], "EMAIL_DBG");
|
||||
if (value.charAt(0) == '{') {
|
||||
ServiceRestResponse respWra = jsonObjectMapper.readValue(value, ServiceRestResponse.class);
|
||||
if (respWra.getEsito() == EsitoType.KO) {
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
package it.integry.ems.exception;
|
||||
|
||||
public class DistributoreDatabaseNotPresentException extends Exception {
|
||||
|
||||
public DistributoreDatabaseNotPresentException() {
|
||||
super("Distributore database not present yet");
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,6 @@
|
||||
package it.integry.ems.expansion;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Observable;
|
||||
import java.util.Observer;
|
||||
import java.util.*;
|
||||
|
||||
public class ObservableArrayList<T> extends Observable {
|
||||
|
||||
@@ -122,4 +119,16 @@ public class ObservableArrayList<T> extends Observable {
|
||||
notifyObservers();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (!(o instanceof ObservableArrayList)) return false;
|
||||
ObservableArrayList<?> that = (ObservableArrayList<?>) o;
|
||||
return Objects.equals(value, that.value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hashCode(value);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package it.integry.ems.expansion;
|
||||
|
||||
import java.util.Objects;
|
||||
import java.util.Observable;
|
||||
|
||||
public class ObservableField<T> extends Observable {
|
||||
@@ -34,4 +35,16 @@ public class ObservableField<T> extends Observable {
|
||||
|
||||
super.addObserver((o, arg) -> observerCallback.run());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (!(o instanceof ObservableField)) return false;
|
||||
ObservableField<?> that = (ObservableField<?>) o;
|
||||
return Objects.equals(value, that.value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hashCode(value);
|
||||
}
|
||||
}
|
||||
@@ -5,7 +5,6 @@ import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.core.JsonGenerator;
|
||||
import com.fasterxml.jackson.dataformat.csv.CsvSchema;
|
||||
import com.fasterxml.jackson.dataformat.csv.CsvSchema.Column;
|
||||
import it.integry.common.var.CommonConstants;
|
||||
import it.integry.ems_model.ImportExport.Interfaces.IExportFormat;
|
||||
import it.integry.ems_model.ImportExport.Interfaces.IImportFormat;
|
||||
import it.integry.ems_model.annotation.DtoField;
|
||||
@@ -64,7 +63,7 @@ public class CsvMapper<T> {
|
||||
builder.addColumn(new Column(i, columns[i]));
|
||||
}
|
||||
|
||||
builder.setLineSeparator(System.getProperty("line.separator"));
|
||||
builder.setLineSeparator(System.lineSeparator());
|
||||
CsvSchema schema = builder.build().withoutQuoteChar();
|
||||
|
||||
mapper.configure(JsonGenerator.Feature.IGNORE_UNKNOWN, true);
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20250904154412 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
executeStatement(
|
||||
"alter table dbo.ctb_amac add cod_mdep varchar(5)",
|
||||
"alter table dbo.ctb_amac add posizione varchar(40)",
|
||||
"alter table dbo.ctb_amac\n" +
|
||||
" add constraint FK_ctb_amac_mtb_depo_posizioni\n" +
|
||||
" foreign key (cod_mdep, posizione) references dbo.mtb_depo_posizioni",
|
||||
"create table dbo.ctb_amac_carat\n" +
|
||||
"(\n" +
|
||||
" id bigint identity\n" +
|
||||
" constraint pk_ctb_amac_carat\n" +
|
||||
" primary key,\n" +
|
||||
" cod_cmac varchar(20) not null\n" +
|
||||
" constraint fk_ctb_amac_carat_ctb_amac_cod_cmac\n" +
|
||||
" references dbo.ctb_amac,\n" +
|
||||
" nome_carat varchar(100) not null,\n" +
|
||||
" val_carat nvarchar(4000),\n" +
|
||||
" indice_ordinamento int default 0 not null,\n" +
|
||||
" field_bg varchar(15)\n" +
|
||||
")"
|
||||
);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
}
|
||||
}
|
||||
@@ -10,6 +10,7 @@ public class Migration_20250905092735 extends BaseMigration implements Migration
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
if (isDMS()) return;
|
||||
|
||||
createOrUpdateView("[vw_tracciabUDCProd]", "CREATE VIEW [dbo].[vw_tracciabUDCProd] AS\n" +
|
||||
"select mtb_colr.data_ord as dataOrdProd,\n" +
|
||||
|
||||
@@ -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_20250908150244 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
executeStatement("ALTER TABLE azienda ADD cod_sdi_ditta VARCHAR(7)");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,150 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20250908160026 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
|
||||
createOrUpdateView("cvw_marg_contr_com", "CREATE VIEW [dbo].[cvw_marg_contr_com] (cod_jcom,descrizione,costo_lavorazione,costo_materiali,costo_servizi,altri_costi,ricavi,ore_lavorazione, data) AS \n" +
|
||||
"SELECT jtb_rlavr.cod_jcom AS cod_jcom,\n" +
|
||||
" jtb_comt.descrizione,\n" +
|
||||
" Sum(jtb_rlavr.ore * jtb_rlavr.costo_ora / jtb_rlavr.cambio_divi_cont) AS costo_lavorazione,\n" +
|
||||
" CONVERT(NUMERIC(20, 5), 0) AS costo_materiali,\n" +
|
||||
" CONVERT(NUMERIC(20, 5), 0) AS costo_servizi,\n" +
|
||||
" CONVERT(NUMERIC(20, 5), 0) AS altri_costi,\n" +
|
||||
" CONVERT(NUMERIC(20, 5), 0) AS ricavi,\n" +
|
||||
" Sum(jtb_rlavr.ore) AS ore_lavorazione,\n" +
|
||||
" jtb_rlavr.data_lav AS data\n" +
|
||||
"FROM jtb_rlavr,\n" +
|
||||
" jtb_comt\n" +
|
||||
"WHERE jtb_rlavr.cod_jcom = jtb_comt.cod_jcom\n" +
|
||||
"GROUP BY jtb_rlavr.cod_jcom,\n" +
|
||||
" jtb_comt.descrizione,\n" +
|
||||
" jtb_rlavr.data_lav\n" +
|
||||
"UNION\n" +
|
||||
"SELECT dtb_docr.cod_jcom AS cod_jcom,\n" +
|
||||
" jtb_comt.descrizione,\n" +
|
||||
" CONVERT(NUMERIC(20, 5), 0),\n" +
|
||||
" Sum(dtb_docr.qta_doc * dtb_docr.costo_unt * (\n" +
|
||||
" dtb_tipi.segno_val_car - dtb_tipi.segno_val_scar ) * (\n" +
|
||||
" CASE dtb_tipi.gestione\n" +
|
||||
" WHEN 'A' THEN 1\n" +
|
||||
" ELSE-1\n" +
|
||||
" END ) / dtb_doct.cambio),\n" +
|
||||
" CONVERT(NUMERIC(20, 5), 0),\n" +
|
||||
" CONVERT(NUMERIC(20, 5), 0),\n" +
|
||||
" CONVERT(NUMERIC(20, 5), 0),\n" +
|
||||
" CONVERT(NUMERIC(20, 5), 0),\n" +
|
||||
" dtb_doct.data_reg\n" +
|
||||
"FROM dtb_docr,\n" +
|
||||
" jtb_comt,\n" +
|
||||
" dtb_doct,\n" +
|
||||
" dtb_tipi\n" +
|
||||
"WHERE ( dtb_doct.cod_anag = dtb_docr.cod_anag )\n" +
|
||||
" AND ( dtb_doct.cod_dtip = dtb_docr.cod_dtip )\n" +
|
||||
" AND ( dtb_doct.data_doc = dtb_docr.data_doc )\n" +
|
||||
" AND ( dtb_doct.ser_doc = dtb_docr.ser_doc )\n" +
|
||||
" AND ( dtb_doct.num_doc = dtb_docr.num_doc )\n" +
|
||||
" AND ( dtb_docr.cod_dtip = dtb_tipi.cod_dtip )\n" +
|
||||
" AND ( dtb_docr.cod_jcom = jtb_comt.cod_jcom )\n" +
|
||||
" AND ( dtb_tipi.flag_analisi_costi_com = 'S' )\n" +
|
||||
" AND ( dtb_tipi.tipo_emissione = 'DIRETTA' )\n" +
|
||||
"GROUP BY dtb_docr.cod_jcom,\n" +
|
||||
" jtb_comt.descrizione,\n" +
|
||||
" dtb_doct.data_reg\n" +
|
||||
"UNION\n" +
|
||||
"SELECT dtb_docs.cod_jcom,\n" +
|
||||
" jtb_comt.descrizione,\n" +
|
||||
" CONVERT(NUMERIC(20, 5), 0),\n" +
|
||||
" CONVERT(NUMERIC(20, 5), 0),\n" +
|
||||
" Sum(( dtb_docs.importo / dtb_doct.cambio )),\n" +
|
||||
" CONVERT(NUMERIC(20, 5), 0),\n" +
|
||||
" CONVERT(NUMERIC(20, 5), 0),\n" +
|
||||
" CONVERT(NUMERIC(20, 5), 0),\n" +
|
||||
" dtb_doct.data_reg\n" +
|
||||
"FROM dtb_docs,\n" +
|
||||
" jtb_comt,\n" +
|
||||
" dtb_doct,\n" +
|
||||
" dtb_tipi\n" +
|
||||
"WHERE ( dtb_doct.cod_anag = dtb_docs.cod_anag )\n" +
|
||||
" AND ( dtb_doct.cod_dtip = dtb_docs.cod_dtip )\n" +
|
||||
" AND ( dtb_doct.data_doc = dtb_docs.data_doc )\n" +
|
||||
" AND ( dtb_doct.ser_doc = dtb_docs.ser_doc )\n" +
|
||||
" AND ( dtb_doct.num_doc = dtb_docs.num_doc )\n" +
|
||||
" AND ( dtb_doct.cod_dtip = dtb_tipi.cod_dtip )\n" +
|
||||
" AND ( dtb_docs.cod_jcom = jtb_comt.cod_jcom )\n" +
|
||||
" AND ( dtb_tipi.flag_analisi_costi_com = 'S' )\n" +
|
||||
" AND ( dtb_tipi.tipo_emissione = 'DIFFERITA' )\n" +
|
||||
" AND ( dtb_tipi.gestione = 'L' )\n" +
|
||||
" AND ( dtb_tipi.segno_val_car = 1 )\n" +
|
||||
"GROUP BY dtb_docs.cod_jcom,\n" +
|
||||
" jtb_comt.descrizione,\n" +
|
||||
" dtb_doct.data_reg\n" +
|
||||
"UNION\n" +
|
||||
"SELECT ctb_movr_coan.cod_jcom,\n" +
|
||||
" jtb_comt.descrizione,\n" +
|
||||
" CONVERT(NUMERIC(20, 5), 0),\n" +
|
||||
" CONVERT(NUMERIC(20, 5), 0),\n" +
|
||||
" CONVERT(NUMERIC(20, 5), 0),\n" +
|
||||
" Sum(( ctb_movr_coan.imp_dare - ctb_movr_coan.imp_avere ) /\n" +
|
||||
" ctb_movr_coan.cambio_divi_cont),\n" +
|
||||
" CONVERT(NUMERIC(20, 5), 0),\n" +
|
||||
" CONVERT(NUMERIC(20, 5), 0),\n" +
|
||||
" ctb_movt.data_cmov\n" +
|
||||
"FROM ctb_movr_coan,\n" +
|
||||
" jtb_comt,\n" +
|
||||
" ctb_grup,\n" +
|
||||
" ctb_cont,\n" +
|
||||
" ctb_movr,\n" +
|
||||
" ctb_movt\n" +
|
||||
"WHERE ( ctb_movt.num_cmov = ctb_movr_coan.num_cmov )\n" +
|
||||
" AND ( ctb_movr_coan.cod_jcom = jtb_comt.cod_jcom )\n" +
|
||||
" AND ( ctb_grup.cod_cgrp = ctb_cont.cod_cgrp )\n" +
|
||||
" AND ( ctb_movr.cod_ccon = ctb_cont.cod_ccon )\n" +
|
||||
" AND ( ctb_movr.num_cmov = ctb_movr_coan.num_cmov )\n" +
|
||||
" AND ( ctb_movr_coan.id_riga = ctb_movr.id_riga )\n" +
|
||||
" AND ( ctb_grup.tipo = '4' )\n" +
|
||||
"GROUP BY ctb_movr_coan.cod_jcom,\n" +
|
||||
" jtb_comt.descrizione,\n" +
|
||||
" ctb_movt.data_cmov\n" +
|
||||
"UNION\n" +
|
||||
"SELECT ctb_movr_coan.cod_jcom,\n" +
|
||||
" jtb_comt.descrizione,\n" +
|
||||
" CONVERT(NUMERIC(20, 5), 0),\n" +
|
||||
" CONVERT(NUMERIC(20, 5), 0),\n" +
|
||||
" CONVERT(NUMERIC(20, 5), 0),\n" +
|
||||
" CONVERT(NUMERIC(20, 5), 0),\n" +
|
||||
" Sum(( ctb_movr_coan.imp_avere - ctb_movr_coan.imp_dare ) /\n" +
|
||||
" ctb_movr_coan.cambio_divi_cont),\n" +
|
||||
" CONVERT(NUMERIC(20, 5), 0),\n" +
|
||||
" ctb_movt.data_cmov\n" +
|
||||
"FROM ctb_movr_coan,\n" +
|
||||
" jtb_comt,\n" +
|
||||
" ctb_cont,\n" +
|
||||
" ctb_grup,\n" +
|
||||
" ctb_movr,\n" +
|
||||
" ctb_movt\n" +
|
||||
"WHERE ( ctb_movt.num_cmov = ctb_movr_coan.num_cmov )\n" +
|
||||
" AND ( ctb_movr_coan.cod_jcom = jtb_comt.cod_jcom )\n" +
|
||||
" AND ( ctb_grup.cod_cgrp = ctb_cont.cod_cgrp )\n" +
|
||||
" AND ( ctb_movr.cod_ccon = ctb_cont.cod_ccon )\n" +
|
||||
" AND ( ctb_movr.num_cmov = ctb_movr_coan.num_cmov )\n" +
|
||||
" AND ( ctb_movr_coan.id_riga = ctb_movr.id_riga )\n" +
|
||||
" AND ( ctb_grup.tipo = '5' )\n" +
|
||||
"GROUP BY ctb_movr_coan.cod_jcom,\n" +
|
||||
" jtb_comt.descrizione,\n" +
|
||||
" ctb_movt.data_cmov");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.IntegryCustomer;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20250908171146 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
createSetup("W_MSCHMOVART_PART_DISP", "DATAWINDOW", "D_MSCHMOVART_PART_DEP_REP", null,
|
||||
null, false, null, false, false,
|
||||
false, false, false, null, false, null);
|
||||
|
||||
|
||||
if(isCustomer(IntegryCustomer.RossoGargano)) {
|
||||
updateSetupValue("W_MSCHMOVART_PART_DISP", "DATAWINDOW", "D_MSCHMOVART_PART_DEP_REP", "d_mschmovart_part_dep_rossogargano_rep");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20250909104539 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
executeStatement("update ctb_amac\n" +
|
||||
"set ctb_amac.cod_mdep = jtb_fasi.cod_mdep_lav\n" +
|
||||
"from ctb_amac\n" +
|
||||
" left join jtb_fasi on ctb_amac.cod_jfas = jtb_fasi.cod_jfas");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.IntegryCustomer;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20250909125147 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("DATI_AZIENDA", "INVIO_EMAIL", "NEW", "[_azienda.ini|TEST_MAIL|NEW|N]",
|
||||
"Apre la mail in outlook con i nuovi oggetti", false, "SI_NO", false, false,
|
||||
false, false, false, null, false, "SELECT 'S' UNION ALL SELECT 'N'");
|
||||
|
||||
if (isCustomer(IntegryCustomer.RossoGargano))
|
||||
updateSetupValue("DATI_AZIENDA", "INVIO_EMAIL", "NEW", "S");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.IntegryCustomer;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20250909131006 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
deleteSetup("DATI_AZIENDA", "INVIO_EMAIL", "NEW");
|
||||
createSetupQuery("SI_NO", "SI_NO", "SELECT 'S' UNION ALL SELECT 'N'");
|
||||
createSetup("DATI_AZIENDA", "SETUP", "INVIO_EMAIL_NEW", "[_azienda.ini|TEST_MAIL|NEW|N]",
|
||||
"Apre la mail in outlook con i nuovi oggetti", false, "SI_NO", false, false,
|
||||
false, false, false, null, false, "SELECT 'S' UNION ALL SELECT 'N'");
|
||||
|
||||
if (isCustomer(IntegryCustomer.RossoGargano))
|
||||
updateSetupValue("DATI_AZIENDA", "SETUP", "INVIO_EMAIL_NEW", "S");
|
||||
}
|
||||
|
||||
@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.MigrationModelInterface;
|
||||
import it.integry.ems_model.utility.dto.IndexTableDTO;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
|
||||
public class Migration_20250909145813 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
IndexTableDTO indexTableDTO =
|
||||
new IndexTableDTO()
|
||||
.setTableName("ctb_amac_history")
|
||||
.setIndexName("ctb_amac_history_cod_cmac_index")
|
||||
.setColumnsIndex(Collections.singletonList(
|
||||
new IndexTableDTO.ColumnIndex("cod_cmac")
|
||||
))
|
||||
.setOverride(false);
|
||||
createIndex(indexTableDTO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,189 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.IntegryCustomer;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20250909162127 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
if (!isCustomer(IntegryCustomer.Biolevante))
|
||||
return;
|
||||
|
||||
executeStatement(
|
||||
"UPDATE Biolevante.dbo.ctb_amac SET posizione = N'0T' WHERE cod_cmac = N'TANK00T';",
|
||||
"UPDATE Biolevante.dbo.ctb_amac SET posizione = N'1' WHERE cod_cmac = N'TANK01';",
|
||||
"UPDATE Biolevante.dbo.ctb_amac SET posizione = N'1T' WHERE cod_cmac = N'TANK01T';",
|
||||
"UPDATE Biolevante.dbo.ctb_amac SET posizione = N'2' WHERE cod_cmac = N'TANK02';",
|
||||
"UPDATE Biolevante.dbo.ctb_amac SET posizione = N'2T' WHERE cod_cmac = N'TANK02T';",
|
||||
"UPDATE Biolevante.dbo.ctb_amac SET posizione = N'3' WHERE cod_cmac = N'TANK03';",
|
||||
"UPDATE Biolevante.dbo.ctb_amac SET posizione = N'3T' WHERE cod_cmac = N'TANK03T';",
|
||||
"UPDATE Biolevante.dbo.ctb_amac SET posizione = N'4' WHERE cod_cmac = N'TANK04';",
|
||||
"UPDATE Biolevante.dbo.ctb_amac SET posizione = N'4T' WHERE cod_cmac = N'TANK04T';",
|
||||
"UPDATE Biolevante.dbo.ctb_amac SET posizione = N'5' WHERE cod_cmac = N'TANK05';",
|
||||
"UPDATE Biolevante.dbo.ctb_amac SET posizione = N'5T' WHERE cod_cmac = N'TANK05T';",
|
||||
"UPDATE Biolevante.dbo.ctb_amac SET posizione = N'6' WHERE cod_cmac = N'TANK06';",
|
||||
"UPDATE Biolevante.dbo.ctb_amac SET posizione = N'6T' WHERE cod_cmac = N'TANK06T';",
|
||||
"UPDATE Biolevante.dbo.ctb_amac SET posizione = N'7' WHERE cod_cmac = N'TANK07';",
|
||||
"UPDATE Biolevante.dbo.ctb_amac SET posizione = N'7T' WHERE cod_cmac = N'TANK07T';",
|
||||
"UPDATE Biolevante.dbo.ctb_amac SET posizione = N'8T' WHERE cod_cmac = N'TANK08T';",
|
||||
"UPDATE Biolevante.dbo.ctb_amac SET posizione = N'9T' WHERE cod_cmac = N'TANK09T';",
|
||||
"UPDATE Biolevante.dbo.ctb_amac SET posizione = N'10T' WHERE cod_cmac = N'TANK10T';",
|
||||
"UPDATE Biolevante.dbo.ctb_amac SET posizione = N'11T' WHERE cod_cmac = N'TANK11T';",
|
||||
"UPDATE Biolevante.dbo.ctb_amac SET posizione = N'12T' WHERE cod_cmac = N'TANK12T';",
|
||||
"UPDATE Biolevante.dbo.ctb_amac SET posizione = N'13T' WHERE cod_cmac = N'TANK13T';",
|
||||
"UPDATE Biolevante.dbo.ctb_amac SET posizione = N'14T' WHERE cod_cmac = N'TANK14T';",
|
||||
"UPDATE Biolevante.dbo.ctb_amac SET posizione = N'15T' WHERE cod_cmac = N'TANK15T';",
|
||||
"UPDATE Biolevante.dbo.ctb_amac SET posizione = N'16T' WHERE cod_cmac = N'TANK16T';",
|
||||
"UPDATE Biolevante.dbo.ctb_amac SET posizione = N'17T' WHERE cod_cmac = N'TANK17T';",
|
||||
"UPDATE Biolevante.dbo.ctb_amac SET posizione = N'18T' WHERE cod_cmac = N'TANK18T';",
|
||||
"UPDATE Biolevante.dbo.ctb_amac SET posizione = N'19T' WHERE cod_cmac = N'TANK19T';",
|
||||
"UPDATE Biolevante.dbo.ctb_amac SET posizione = N'20T' WHERE cod_cmac = N'TANK20T';",
|
||||
"UPDATE Biolevante.dbo.ctb_amac SET posizione = N'22T' WHERE cod_cmac = N'TANK22T';",
|
||||
"UPDATE Biolevante.dbo.ctb_amac SET posizione = N'23T' WHERE cod_cmac = N'TANK23T';",
|
||||
"UPDATE Biolevante.dbo.ctb_amac SET posizione = N'24T' WHERE cod_cmac = N'TANK24T';",
|
||||
"UPDATE Biolevante.dbo.ctb_amac SET posizione = N'25T' WHERE cod_cmac = N'TANK25T';",
|
||||
"UPDATE Biolevante.dbo.ctb_amac SET posizione = N'26T' WHERE cod_cmac = N'TANK26T';",
|
||||
"UPDATE Biolevante.dbo.ctb_amac SET posizione = N'27T' WHERE cod_cmac = N'TANK27T';",
|
||||
"UPDATE Biolevante.dbo.ctb_amac SET posizione = N'28T' WHERE cod_cmac = N'TANK28T';",
|
||||
"UPDATE Biolevante.dbo.ctb_amac SET posizione = N'29T' WHERE cod_cmac = N'TANK29T';",
|
||||
"UPDATE Biolevante.dbo.ctb_amac SET posizione = N'30T' WHERE cod_cmac = N'TANK30T';",
|
||||
"UPDATE Biolevante.dbo.ctb_amac SET posizione = N'31T' WHERE cod_cmac = N'TANK31T';",
|
||||
"UPDATE Biolevante.dbo.ctb_amac SET posizione = N'32T' WHERE cod_cmac = N'TANK32T';",
|
||||
"UPDATE Biolevante.dbo.ctb_amac SET posizione = N'33T' WHERE cod_cmac = N'TANK33T';",
|
||||
"UPDATE Biolevante.dbo.ctb_amac SET posizione = N'34T' WHERE cod_cmac = N'TANK34T';",
|
||||
"UPDATE Biolevante.dbo.ctb_amac SET posizione = N'35T' WHERE cod_cmac = N'TANK35T';",
|
||||
"UPDATE Biolevante.dbo.ctb_amac SET posizione = N'36T' WHERE cod_cmac = N'TANK36T';",
|
||||
"UPDATE Biolevante.dbo.ctb_amac SET posizione = N'37T' WHERE cod_cmac = N'TANK37T';",
|
||||
"UPDATE Biolevante.dbo.ctb_amac SET posizione = N'38T' WHERE cod_cmac = N'TANK38T';",
|
||||
"UPDATE Biolevante.dbo.ctb_amac SET posizione = N'39T' WHERE cod_cmac = N'TANK39T';",
|
||||
"UPDATE Biolevante.dbo.ctb_amac SET posizione = N'40T' WHERE cod_cmac = N'TANK40T';",
|
||||
"UPDATE Biolevante.dbo.ctb_amac SET posizione = N'41T' WHERE cod_cmac = N'TANK41T';",
|
||||
"UPDATE Biolevante.dbo.ctb_amac SET posizione = N'42T' WHERE cod_cmac = N'TANK42T';",
|
||||
"UPDATE Biolevante.dbo.ctb_amac SET posizione = N'43T' WHERE cod_cmac = N'TANK43T';",
|
||||
"UPDATE Biolevante.dbo.ctb_amac SET posizione = N'V1' WHERE cod_cmac = N'TANKV01';",
|
||||
"UPDATE Biolevante.dbo.ctb_amac SET posizione = N'V1T' WHERE cod_cmac = N'TANKV01T';",
|
||||
"UPDATE Biolevante.dbo.ctb_amac SET posizione = N'V2' WHERE cod_cmac = N'TANKV02';",
|
||||
"UPDATE Biolevante.dbo.ctb_amac SET posizione = N'V2T' WHERE cod_cmac = N'TANKV02T';",
|
||||
"UPDATE Biolevante.dbo.ctb_amac SET posizione = N'V3' WHERE cod_cmac = N'TANKV03';",
|
||||
"UPDATE Biolevante.dbo.ctb_amac SET posizione = N'V3T' WHERE cod_cmac = N'TANKV03T';",
|
||||
"UPDATE Biolevante.dbo.ctb_amac SET posizione = N'V4' WHERE cod_cmac = N'TANKV04';",
|
||||
"UPDATE Biolevante.dbo.ctb_amac SET posizione = N'V4T' WHERE cod_cmac = N'TANKV04T';",
|
||||
"UPDATE Biolevante.dbo.ctb_amac SET posizione = N'V5' WHERE cod_cmac = N'TANKV05';",
|
||||
"UPDATE Biolevante.dbo.ctb_amac SET posizione = N'V5T' WHERE cod_cmac = N'TANKV05T';",
|
||||
"UPDATE Biolevante.dbo.ctb_amac SET posizione = N'V6' WHERE cod_cmac = N'TANKV06';",
|
||||
"UPDATE Biolevante.dbo.ctb_amac SET posizione = N'V6T' WHERE cod_cmac = N'TANKV06T';",
|
||||
"UPDATE Biolevante.dbo.ctb_amac SET posizione = N'V7' WHERE cod_cmac = N'TANKV07';",
|
||||
"UPDATE Biolevante.dbo.ctb_amac SET posizione = N'V7T' WHERE cod_cmac = N'TANKV07T';",
|
||||
"UPDATE Biolevante.dbo.ctb_amac SET posizione = N'V8' WHERE cod_cmac = N'TANKV08';",
|
||||
"UPDATE Biolevante.dbo.ctb_amac SET posizione = N'V8T' WHERE cod_cmac = N'TANKV08T';",
|
||||
"UPDATE Biolevante.dbo.ctb_amac SET posizione = N'V9' WHERE cod_cmac = N'TANKV09';",
|
||||
"UPDATE Biolevante.dbo.ctb_amac SET posizione = N'V9T' WHERE cod_cmac = N'TANKV09T';",
|
||||
"UPDATE Biolevante.dbo.ctb_amac SET posizione = N'V10' WHERE cod_cmac = N'TANKV10';",
|
||||
"UPDATE Biolevante.dbo.ctb_amac SET posizione = N'V0T' WHERE cod_cmac = N'TANKV10T';",
|
||||
"UPDATE Biolevante.dbo.ctb_amac SET posizione = N'V11' WHERE cod_cmac = N'TANKV11';",
|
||||
"UPDATE Biolevante.dbo.ctb_amac SET posizione = N'V12' WHERE cod_cmac = N'TANKV12';",
|
||||
"UPDATE Biolevante.dbo.ctb_amac SET posizione = N'V13' WHERE cod_cmac = N'TANKV13';",
|
||||
"UPDATE Biolevante.dbo.ctb_amac SET posizione = N'V14' WHERE cod_cmac = N'TANKV14';",
|
||||
"UPDATE Biolevante.dbo.ctb_amac SET posizione = N'V15' WHERE cod_cmac = N'TANKV15';",
|
||||
"UPDATE Biolevante.dbo.ctb_amac SET posizione = N'V16' WHERE cod_cmac = N'TANKV16';",
|
||||
"UPDATE Biolevante.dbo.ctb_amac SET posizione = N'V17' WHERE cod_cmac = N'TANKV17';",
|
||||
"UPDATE Biolevante.dbo.ctb_amac SET posizione = N'V18' WHERE cod_cmac = N'TANKV18';",
|
||||
"UPDATE Biolevante.dbo.ctb_amac SET posizione = N'V19' WHERE cod_cmac = N'TANKV19';",
|
||||
|
||||
"UPDATE mtb_depo_posizioni SET cod_area = N'Q4' WHERE cod_mdep = N'01' AND posizione = N'V6T'",
|
||||
"UPDATE mtb_depo_posizioni SET cod_area = N'Q4' WHERE cod_mdep = N'01' AND posizione = N'V0T'",
|
||||
"UPDATE mtb_depo_posizioni SET cod_area = N'Q4' WHERE cod_mdep = N'01' AND posizione = N'V1T'",
|
||||
"UPDATE mtb_depo_posizioni SET cod_area = N'Q4' WHERE cod_mdep = N'01' AND posizione = N'V8T'",
|
||||
"UPDATE mtb_depo_posizioni SET cod_area = N'Q4' WHERE cod_mdep = N'01' AND posizione = N'V7T'",
|
||||
"UPDATE mtb_depo_posizioni SET cod_area = N'Q4' WHERE cod_mdep = N'01' AND posizione = N'V3T'",
|
||||
"UPDATE mtb_depo_posizioni SET cod_area = N'Q4' WHERE cod_mdep = N'01' AND posizione = N'V4T'",
|
||||
"UPDATE mtb_depo_posizioni SET cod_area = N'Q4' WHERE cod_mdep = N'01' AND posizione = N'V5T'",
|
||||
"UPDATE mtb_depo_posizioni SET cod_area = N'Q4' WHERE cod_mdep = N'01' AND posizione = N'V9T'",
|
||||
"UPDATE mtb_depo_posizioni SET cod_area = N'Q4' WHERE cod_mdep = N'01' AND posizione = N'V2T'",
|
||||
|
||||
"UPDATE mtb_depo_posizioni SET cod_area = N'F' WHERE cod_mdep = N'01' AND posizione = N'32T'",
|
||||
"UPDATE mtb_depo_posizioni SET cod_area = N'F' WHERE cod_mdep = N'01' AND posizione = N'8T'",
|
||||
"UPDATE mtb_depo_posizioni SET cod_area = N'F' WHERE cod_mdep = N'01' AND posizione = N'17T'",
|
||||
"UPDATE mtb_depo_posizioni SET cod_area = N'F' WHERE cod_mdep = N'01' AND posizione = N'4T'",
|
||||
"UPDATE mtb_depo_posizioni SET cod_area = N'F' WHERE cod_mdep = N'01' AND posizione = N'19T'",
|
||||
"UPDATE mtb_depo_posizioni SET cod_area = N'F' WHERE cod_mdep = N'01' AND posizione = N'30T'",
|
||||
"UPDATE mtb_depo_posizioni SET cod_area = N'F' WHERE cod_mdep = N'01' AND posizione = N'43T'",
|
||||
"UPDATE mtb_depo_posizioni SET cod_area = N'F' WHERE cod_mdep = N'01' AND posizione = N'34T'",
|
||||
"UPDATE mtb_depo_posizioni SET cod_area = N'F' WHERE cod_mdep = N'01' AND posizione = N'13T'",
|
||||
"UPDATE mtb_depo_posizioni SET cod_area = N'F' WHERE cod_mdep = N'01' AND posizione = N'28T'",
|
||||
"UPDATE mtb_depo_posizioni SET cod_area = N'F' WHERE cod_mdep = N'01' AND posizione = N'15T'",
|
||||
"UPDATE mtb_depo_posizioni SET cod_area = N'F' WHERE cod_mdep = N'01' AND posizione = N'25T'",
|
||||
"UPDATE mtb_depo_posizioni SET cod_area = N'F' WHERE cod_mdep = N'01' AND posizione = N'2T'",
|
||||
"UPDATE mtb_depo_posizioni SET cod_area = N'F' WHERE cod_mdep = N'01' AND posizione = N'45T'",
|
||||
"UPDATE mtb_depo_posizioni SET cod_area = N'F' WHERE cod_mdep = N'01' AND posizione = N'9T'",
|
||||
"UPDATE mtb_depo_posizioni SET cod_area = N'F' WHERE cod_mdep = N'01' AND posizione = N'38T'",
|
||||
"UPDATE mtb_depo_posizioni SET cod_area = N'F' WHERE cod_mdep = N'01' AND posizione = N'44T'",
|
||||
"UPDATE mtb_depo_posizioni SET cod_area = N'F' WHERE cod_mdep = N'01' AND posizione = N'41T'",
|
||||
"UPDATE mtb_depo_posizioni SET cod_area = N'F' WHERE cod_mdep = N'01' AND posizione = N'12T'",
|
||||
"UPDATE mtb_depo_posizioni SET cod_area = N'F' WHERE cod_mdep = N'01' AND posizione = N'40T'",
|
||||
"UPDATE mtb_depo_posizioni SET cod_area = N'F' WHERE cod_mdep = N'01' AND posizione = N'37T'",
|
||||
"UPDATE mtb_depo_posizioni SET cod_area = N'F' WHERE cod_mdep = N'01' AND posizione = N'20T'",
|
||||
"UPDATE mtb_depo_posizioni SET cod_area = N'F' WHERE cod_mdep = N'01' AND posizione = N'33T'",
|
||||
"UPDATE mtb_depo_posizioni SET cod_area = N'F' WHERE cod_mdep = N'01' AND posizione = N'0T'",
|
||||
"UPDATE mtb_depo_posizioni SET cod_area = N'F' WHERE cod_mdep = N'01' AND posizione = N'23T'",
|
||||
"UPDATE mtb_depo_posizioni SET cod_area = N'F' WHERE cod_mdep = N'01' AND posizione = N'14T'",
|
||||
"UPDATE mtb_depo_posizioni SET cod_area = N'F' WHERE cod_mdep = N'01' AND posizione = N'27T'",
|
||||
"UPDATE mtb_depo_posizioni SET cod_area = N'F' WHERE cod_mdep = N'01' AND posizione = N'24T'",
|
||||
"UPDATE mtb_depo_posizioni SET cod_area = N'F' WHERE cod_mdep = N'01' AND posizione = N'22T'",
|
||||
"UPDATE mtb_depo_posizioni SET cod_area = N'F' WHERE cod_mdep = N'01' AND posizione = N'35T'",
|
||||
"UPDATE mtb_depo_posizioni SET cod_area = N'F' WHERE cod_mdep = N'01' AND posizione = N'31T'",
|
||||
"UPDATE mtb_depo_posizioni SET cod_area = N'F' WHERE cod_mdep = N'01' AND posizione = N'3T'",
|
||||
"UPDATE mtb_depo_posizioni SET cod_area = N'F' WHERE cod_mdep = N'01' AND posizione = N'18T'",
|
||||
"UPDATE mtb_depo_posizioni SET cod_area = N'F' WHERE cod_mdep = N'01' AND posizione = N'16T'",
|
||||
"UPDATE mtb_depo_posizioni SET cod_area = N'F' WHERE cod_mdep = N'01' AND posizione = N'7T'",
|
||||
"UPDATE mtb_depo_posizioni SET cod_area = N'F' WHERE cod_mdep = N'01' AND posizione = N'21T'",
|
||||
"UPDATE mtb_depo_posizioni SET cod_area = N'F' WHERE cod_mdep = N'01' AND posizione = N'5T'",
|
||||
"UPDATE mtb_depo_posizioni SET cod_area = N'F' WHERE cod_mdep = N'01' AND posizione = N'39T'",
|
||||
"UPDATE mtb_depo_posizioni SET cod_area = N'F' WHERE cod_mdep = N'01' AND posizione = N'1T'",
|
||||
"UPDATE mtb_depo_posizioni SET cod_area = N'F' WHERE cod_mdep = N'01' AND posizione = N'11T'",
|
||||
"UPDATE mtb_depo_posizioni SET cod_area = N'F' WHERE cod_mdep = N'01' AND posizione = N'10T'",
|
||||
"UPDATE mtb_depo_posizioni SET cod_area = N'F' WHERE cod_mdep = N'01' AND posizione = N'26T'",
|
||||
"UPDATE mtb_depo_posizioni SET cod_area = N'F' WHERE cod_mdep = N'01' AND posizione = N'6T'",
|
||||
"UPDATE mtb_depo_posizioni SET cod_area = N'F' WHERE cod_mdep = N'01' AND posizione = N'42T'",
|
||||
"UPDATE mtb_depo_posizioni SET cod_area = N'F' WHERE cod_mdep = N'01' AND posizione = N'36T'",
|
||||
"UPDATE mtb_depo_posizioni SET cod_area = N'F' WHERE cod_mdep = N'01' AND posizione = N'29T'",
|
||||
|
||||
"UPDATE mtb_depo_posizioni SET cod_area = N'Q6' WHERE cod_mdep = N'01' AND posizione = N'V18'",
|
||||
"UPDATE mtb_depo_posizioni SET cod_area = N'Q6' WHERE cod_mdep = N'01' AND posizione = N'V16'",
|
||||
"UPDATE mtb_depo_posizioni SET cod_area = N'Q6' WHERE cod_mdep = N'01' AND posizione = N'V14'",
|
||||
"UPDATE mtb_depo_posizioni SET cod_area = N'Q6' WHERE cod_mdep = N'01' AND posizione = N'V9'",
|
||||
"UPDATE mtb_depo_posizioni SET cod_area = N'Q6' WHERE cod_mdep = N'01' AND posizione = N'V7'",
|
||||
"UPDATE mtb_depo_posizioni SET cod_area = N'Q6' WHERE cod_mdep = N'01' AND posizione = N'V1'",
|
||||
"UPDATE mtb_depo_posizioni SET cod_area = N'Q6' WHERE cod_mdep = N'01' AND posizione = N'V17'",
|
||||
"UPDATE mtb_depo_posizioni SET cod_area = N'Q6' WHERE cod_mdep = N'01' AND posizione = N'V19'",
|
||||
"UPDATE mtb_depo_posizioni SET cod_area = N'Q6' WHERE cod_mdep = N'01' AND posizione = N'V13'",
|
||||
"UPDATE mtb_depo_posizioni SET cod_area = N'Q6' WHERE cod_mdep = N'01' AND posizione = N'V8'",
|
||||
"UPDATE mtb_depo_posizioni SET cod_area = N'Q6' WHERE cod_mdep = N'01' AND posizione = N'V6'",
|
||||
"UPDATE mtb_depo_posizioni SET cod_area = N'Q6' WHERE cod_mdep = N'01' AND posizione = N'V5'",
|
||||
"UPDATE mtb_depo_posizioni SET cod_area = N'Q6' WHERE cod_mdep = N'01' AND posizione = N'V3'",
|
||||
"UPDATE mtb_depo_posizioni SET cod_area = N'Q6' WHERE cod_mdep = N'01' AND posizione = N'V2'",
|
||||
"UPDATE mtb_depo_posizioni SET cod_area = N'Q6' WHERE cod_mdep = N'01' AND posizione = N'V4'",
|
||||
"UPDATE mtb_depo_posizioni SET cod_area = N'Q6' WHERE cod_mdep = N'01' AND posizione = N'V10'",
|
||||
"UPDATE mtb_depo_posizioni SET cod_area = N'Q6' WHERE cod_mdep = N'01' AND posizione = N'V15'",
|
||||
"UPDATE mtb_depo_posizioni SET cod_area = N'Q6' WHERE cod_mdep = N'01' AND posizione = N'V11'",
|
||||
"UPDATE mtb_depo_posizioni SET cod_area = N'Q6' WHERE cod_mdep = N'01' AND posizione = N'V12'",
|
||||
|
||||
"UPDATE mtb_depo_posizioni SET cod_area = N'Q5' WHERE cod_mdep = N'01' AND posizione = N'6'",
|
||||
"UPDATE mtb_depo_posizioni SET cod_area = N'Q5' WHERE cod_mdep = N'01' AND posizione = N'5'",
|
||||
"UPDATE mtb_depo_posizioni SET cod_area = N'Q5' WHERE cod_mdep = N'01' AND posizione = N'7'",
|
||||
"UPDATE mtb_depo_posizioni SET cod_area = N'Q5' WHERE cod_mdep = N'01' AND posizione = N'4'",
|
||||
"UPDATE mtb_depo_posizioni SET cod_area = N'Q5' WHERE cod_mdep = N'01' AND posizione = N'1'",
|
||||
"UPDATE mtb_depo_posizioni SET cod_area = N'Q5' WHERE cod_mdep = N'01' AND posizione = N'3'",
|
||||
"UPDATE mtb_depo_posizioni SET cod_area = N'Q5' WHERE cod_mdep = N'01' AND posizione = N'2'"
|
||||
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,225 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20250909175525 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
|
||||
createOrUpdateTrigger("t_UpdProgMagaR", "CREATE TRIGGER [dbo].[t_UpdProgMagaR] ON [dbo].[dtb_ordr] \n" +
|
||||
"FOR UPDATE, DELETE, INSERT\n" +
|
||||
"AS\n" +
|
||||
"/* Local Variables */\n" +
|
||||
"DECLARE @ls_codMart VARCHAR(15),\n" +
|
||||
" @ls_codComp VARCHAR(15),\n" +
|
||||
" @ls_codTagl VARCHAR(15),\n" +
|
||||
" @ls_codMdep VARCHAR(5),\n" +
|
||||
" @ls_codCol VARCHAR(5),\n" +
|
||||
" @ls_partitaMag VARCHAR(20),\n" +
|
||||
" @ls_gestione VARCHAR(1),\n" +
|
||||
" @ls_articoloComposto VARCHAR(1),\n" +
|
||||
" @ldt_dataOrd DATETIME,\n" +
|
||||
" @application_name VARCHAR(40),\n" +
|
||||
" @li_numOrd INTEGER, \n" +
|
||||
" @li_rigaOrd INTEGER,\n" +
|
||||
" @ls_rowType VARCHAR(1),\n" +
|
||||
" @aggiorna VARCHAR(1)\n" +
|
||||
"\n" +
|
||||
" /* Necessaria per connessione OLEDB */\n" +
|
||||
" set nocount on\n" +
|
||||
" \n" +
|
||||
" SELECT @application_name = application_name FROM azienda\n" +
|
||||
" IF @application_name = 'TEXTILES' \n" +
|
||||
" BEGIN\n" +
|
||||
" /* Aggiornamento progressivi dell'ordine: qta_acc, qta_col, qta_evasa */\n" +
|
||||
" IF EXISTS (SELECT * FROM inserted) \n" +
|
||||
" BEGIN\n" +
|
||||
" SELECT @ls_gestione = gestione,\n" +
|
||||
" @ldt_dataOrd = data_ord,\n" +
|
||||
" @li_numOrd = num_ord,\n" +
|
||||
" @li_rigaOrd = riga_ord\n" +
|
||||
" FROM inserted\n" +
|
||||
" END \n" +
|
||||
" ELSE\n" +
|
||||
" BEGIN\n" +
|
||||
" SELECT @ls_gestione = gestione,\n" +
|
||||
" @ldt_dataOrd = data_ord,\n" +
|
||||
" @li_numOrd = num_ord,\n" +
|
||||
" @li_rigaOrd = riga_ord\n" +
|
||||
" FROM deleted\n" +
|
||||
" END\n" +
|
||||
" \n" +
|
||||
" UPDATE dtb_ordr SET dtb_ordr.qta_col = Prog.qta_col,\n" +
|
||||
" dtb_ordr.qta_acc = Prog.qta_acc,\n" +
|
||||
" dtb_ordr.qta_evasa = Prog.qta_evasa\n" +
|
||||
" FROM dtb_ordr, dbo.ftx_getProgressiviOrd(@ls_gestione, @ldt_dataOrd, @li_numOrd, @li_rigaOrd) as Prog\n" +
|
||||
" WHERE dtb_ordr.gestione =Prog.gestione and \n" +
|
||||
" dtb_ordr.data_ord = Prog.data_ord and \n" +
|
||||
" dtb_ordr.num_ord = Prog.num_ord and \n" +
|
||||
" dtb_ordr.riga_ord = Prog.riga_ord \n" +
|
||||
" IF @@ERROR <> 0 RETURN\n" +
|
||||
" END\n" +
|
||||
" \n" +
|
||||
" /* Aggiornamento numero confezioni: */\n" +
|
||||
" UPDATE dtb_ordr \n" +
|
||||
" SET num_cnf = case when inserted.qta_cnf <> 0 then case when mtb_aart.flag_qta_cnf_fissa = 'N' then round(inserted.qta_ord / inserted.qta_cnf, 0, 1) else round(inserted.qta_ord / inserted.qta_cnf, 5) end else 0 end \n" +
|
||||
" FROM dtb_ordr, \n" +
|
||||
" inserted,\n" +
|
||||
" mtb_aart\n" +
|
||||
" WHERE ( dtb_ordr.gestione = inserted.gestione ) AND \n" +
|
||||
" ( dtb_ordr.data_ord = inserted.data_ord ) AND \n" +
|
||||
" ( dtb_ordr.num_ord = inserted.num_ord ) AND \n" +
|
||||
" ( dtb_ordr.riga_ord = inserted.riga_ord ) AND\n" +
|
||||
" ( inserted.cod_mart = mtb_aart.cod_mart ) AND\n" +
|
||||
" ( inserted.num_cnf = 0 );\n" +
|
||||
" IF @@ERROR <> 0 RETURN\n" +
|
||||
"\n" +
|
||||
" /*Aggiornamento flag_evaso*/\n" +
|
||||
" UPDATE dtb_ordr \n" +
|
||||
" SET flag_evaso = case when inserted.flag_evaso_forzato = 'S' then \n" +
|
||||
" 'E' \n" +
|
||||
" else\n" +
|
||||
" case when deleted.flag_evaso IS NULL AND inserted.qta_ord > 0 AND inserted.flag_evaso = 'I' AND inserted.qta_evasa >= inserted.qta_ord then\n" +
|
||||
" 'E'\n" +
|
||||
" else\n" +
|
||||
" case when deleted.flag_evaso = inserted.flag_evaso AND inserted.flag_evaso = 'I' AND \n" +
|
||||
" deleted.qta_ord = inserted.qta_ord AND deleted.qta_evasa = inserted.qta_evasa AND \n" +
|
||||
" deleted.unt_ord is null AND inserted.unt_ord is null AND \n" +
|
||||
" inserted.qta_ord = 0 AND inserted.qta_evasa = 0 then\n" +
|
||||
" 'E'\n" +
|
||||
" else\n" +
|
||||
" case when deleted.flag_evaso = inserted.flag_evaso AND deleted.flag_evaso = 'E' AND deleted.qta_ord > 0 AND \n" +
|
||||
" (deleted.qta_evasa >= deleted.qta_ord OR deleted.qta_evasa < deleted.qta_ord AND deleted.flag_evaso_forzato <> inserted.flag_evaso_forzato AND inserted.flag_evaso_forzato = 'N') AND \n" +
|
||||
" inserted.qta_ord > 0 AND inserted.qta_evasa < inserted.qta_ord then\n" +
|
||||
" 'I'\n" +
|
||||
" else\n" +
|
||||
" \n" +
|
||||
" case when deleted.flag_evaso = inserted.flag_evaso AND deleted.flag_evaso = 'I' AND \n" +
|
||||
" deleted.qta_ord > 0 AND deleted.qta_evasa < deleted.qta_ord AND \n" +
|
||||
" inserted.qta_ord > 0 AND inserted.qta_evasa >= inserted.qta_ord then\n" +
|
||||
" 'E'\n" +
|
||||
" else\n" +
|
||||
" case when deleted.flag_evaso <> inserted.flag_evaso AND inserted.flag_evaso = 'I' AND \n" +
|
||||
" deleted.qta_ord > 0 AND inserted.qta_ord > 0 AND inserted.qta_evasa >= inserted.qta_ord then \n" +
|
||||
" deleted.flag_evaso\n" +
|
||||
" else\n" +
|
||||
" inserted.flag_evaso\n" +
|
||||
" end\n" +
|
||||
" end\n" +
|
||||
" end \n" +
|
||||
" end \n" +
|
||||
" end\n" +
|
||||
" end\n" +
|
||||
" FROM dtb_ordr left outer join deleted on dtb_ordr.gestione = deleted.gestione AND\n" +
|
||||
" dtb_ordr.data_ord = deleted.data_ord AND \n" +
|
||||
" dtb_ordr.num_ord = deleted.num_ord AND \n" +
|
||||
" dtb_ordr.riga_ord = deleted.riga_ord\n" +
|
||||
" inner join inserted on dtb_ordr.gestione = inserted.gestione AND \n" +
|
||||
" dtb_ordr.data_ord = inserted.data_ord AND \n" +
|
||||
" dtb_ordr.num_ord = inserted.num_ord AND \n" +
|
||||
" dtb_ordr.riga_ord = inserted.riga_ord;\n" +
|
||||
"\n" +
|
||||
" IF @@ERROR <> 0 RETURN\n" +
|
||||
"\n" +
|
||||
" /* Dichiarazione Cursore delle righe degli ordini sulle quali avrà effetto il trigger */\n" +
|
||||
" DECLARE csr_ordr CURSOR FOR \n" +
|
||||
" SELECT 'D' as row_type, \n" +
|
||||
" deleted.cod_mart, \n" +
|
||||
" dtb_ordt.cod_mdep, \n" +
|
||||
" deleted.cod_col, \n" +
|
||||
" deleted.cod_tagl, \n" +
|
||||
" deleted.partita_mag, \n" +
|
||||
" mtb_aart.articolo_composto, \n" +
|
||||
" CASE WHEN inserted.cod_mdep IS NULL OR ISNULL(inserted.cod_mdep,'') <> deleted.cod_mdep THEN 'S' ELSE 'N' END as aggiorna\n" +
|
||||
" FROM dtb_ordt, \n" +
|
||||
" deleted FULL OUTER JOIN inserted ON deleted.gestione = inserted.gestione and\n" +
|
||||
" deleted.data_ord = inserted.data_ord and\n" +
|
||||
" deleted.num_ord = inserted.num_ord and\n" +
|
||||
" deleted.riga_ord = inserted.riga_ord, \n" +
|
||||
" mtb_aart\n" +
|
||||
" WHERE dtb_ordt.gestione=deleted.gestione AND \n" +
|
||||
" dtb_ordt.data_ord=deleted.data_ord AND \n" +
|
||||
" dtb_ordt.num_ord=deleted.num_ord AND \n" +
|
||||
" mtb_aart.cod_mart=deleted.cod_mart\n" +
|
||||
" UNION ALL\n" +
|
||||
" SELECT 'I' as row_type, \n" +
|
||||
" inserted.cod_mart, \n" +
|
||||
" dtb_ordt.cod_mdep, \n" +
|
||||
" inserted.cod_col, \n" +
|
||||
" inserted.cod_tagl, \n" +
|
||||
" inserted.partita_mag, \n" +
|
||||
" mtb_aart.articolo_composto, \n" +
|
||||
" 'S' as aggiorna\n" +
|
||||
" FROM dtb_ordt, inserted, mtb_aart, dtb_ordr\n" +
|
||||
" WHERE dtb_ordt.gestione=inserted.gestione AND \n" +
|
||||
" dtb_ordt.data_ord=inserted.data_ord AND \n" +
|
||||
" dtb_ordt.num_ord=inserted.num_ord AND \n" +
|
||||
" dtb_ordr.gestione=inserted.gestione AND \n" +
|
||||
" dtb_ordr.data_ord=inserted.data_ord AND \n" +
|
||||
" dtb_ordr.num_ord=inserted.num_ord AND \n" +
|
||||
" dtb_ordr.riga_ord=inserted.riga_ord AND \n" +
|
||||
" mtb_aart.cod_mart=inserted.cod_mart\n" +
|
||||
"\n" +
|
||||
" OPEN csr_ordr\n" +
|
||||
" FETCH NEXT FROM csr_ordr INTO @ls_rowType, @ls_codMart, @ls_codMdep, @ls_codCol, @ls_codTagl, @ls_partitaMag,@ls_articoloComposto, @aggiorna\n" +
|
||||
" WHILE @@FETCH_STATUS = 0 BEGIN\n" +
|
||||
" \n" +
|
||||
" IF @aggiorna = 'S'\n" +
|
||||
" BEGIN \n" +
|
||||
" IF @ls_articoloComposto = 'N' \n" +
|
||||
" BEGIN\n" +
|
||||
" /* Aggiornamento progressivi articolo NON composto */\n" +
|
||||
" EXECUTE UpdDispArti\n" +
|
||||
" @ls_codMart,\n" +
|
||||
" @ls_codCol,\n" +
|
||||
" @ls_codTagl,\n" +
|
||||
" @ls_partitaMag,\n" +
|
||||
" @ls_codMdep\n" +
|
||||
" IF @@ERROR <> 0 RETURN \n" +
|
||||
" END\n" +
|
||||
" ELSE \n" +
|
||||
" BEGIN\n" +
|
||||
" /* Aggiornamento progressivi articolo composto */\n" +
|
||||
" DECLARE csr_comp CURSOR FOR \n" +
|
||||
" SELECT cod_comp\n" +
|
||||
" FROM mtb_comp\n" +
|
||||
" WHERE cod_mart=@ls_codMart\n" +
|
||||
"\n" +
|
||||
" OPEN csr_comp\n" +
|
||||
" FETCH NEXT FROM csr_comp INTO @ls_codComp\n" +
|
||||
" WHILE @@FETCH_STATUS = 0 BEGIN\n" +
|
||||
" EXECUTE UpdDispArti\n" +
|
||||
" @ls_codComp,\n" +
|
||||
" @ls_codCol,\n" +
|
||||
" @ls_codTagl,\n" +
|
||||
" @ls_partitaMag,\n" +
|
||||
" @ls_codMdep\n" +
|
||||
" IF @@ERROR <> 0 RETURN\n" +
|
||||
" FETCH NEXT FROM csr_comp INTO @ls_codComp\n" +
|
||||
" END\n" +
|
||||
" CLOSE csr_comp\n" +
|
||||
" DEALLOCATE csr_comp\n" +
|
||||
" END\n" +
|
||||
" END\n" +
|
||||
"\n" +
|
||||
" FETCH NEXT FROM csr_ordr INTO @ls_rowType, @ls_codMart, @ls_codMdep, @ls_codCol, @ls_codTagl, @ls_partitaMag,@ls_articoloComposto, @aggiorna\n" +
|
||||
" END\n" +
|
||||
" CLOSE csr_ordr\n" +
|
||||
" DEALLOCATE csr_ordr\n" +
|
||||
"\n" +
|
||||
"\n" +
|
||||
" /* Necessaria per connessione OLEDB */\n" +
|
||||
" set nocount off");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,354 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20250910105805 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
executeStatement(
|
||||
"ALTER TABLE dbo.vtb_offt\n" +
|
||||
" ADD CONSTRAINT vtb_offt_gtb_porto_porto_fk\n" +
|
||||
" FOREIGN KEY (incoterms) REFERENCES dbo.gtb_porto;"
|
||||
);
|
||||
|
||||
createOrUpdateView("vvw_contratti_vendita", "CREATE VIEW [dbo].[vvw_contratti_vendita] AS\n" +
|
||||
"WITH depo AS (SELECT TOP 1 cod_mdep\n" +
|
||||
" FROM mtb_depo\n" +
|
||||
" WHERE mtb_depo.flag_movimentabile = 'S'\n" +
|
||||
" AND (cod_anag IS NULL OR cod_anag IN (SELECT gtb_anag.cod_anag\n" +
|
||||
" FROM gtb_anag,\n" +
|
||||
" azienda\n" +
|
||||
" WHERE gtb_anag.part_iva = azienda.part_iva))),\n" +
|
||||
" contratto AS (SELECT vtb_offt.cod_anag,\n" +
|
||||
" vtb_offt.cod_vdes,\n" +
|
||||
" vtb_offt.note,\n" +
|
||||
" vtb_offr.id_offerta,\n" +
|
||||
" vtb_offr.cod_mart,\n" +
|
||||
" vtb_offr.unt_mis,\n" +
|
||||
" vtb_offr.descrizione,\n" +
|
||||
" vtb_offr.descrizione_html,\n" +
|
||||
" vtb_offr.json_costi,\n" +
|
||||
" vtb_offr.costo_unt,\n" +
|
||||
" vtb_offr.unt_mis_vend,\n" +
|
||||
" vtb_offr.prz_unt,\n" +
|
||||
" vtb_offr.qta_off,\n" +
|
||||
" vtb_offr.data_iniz_contr,\n" +
|
||||
" vtb_offr.data_fine_contr,\n" +
|
||||
" vtb_offt.cod_paga,\n" +
|
||||
" vtb_offt.descrizione_paga,\n" +
|
||||
" vtb_offr.perc_sco1,\n" +
|
||||
" vtb_offr.perc_sco2,\n" +
|
||||
" vtb_offr.perc_sco3,\n" +
|
||||
" vtb_offr.perc_sco4,\n" +
|
||||
" vtb_offr.rap_conv_vend,\n" +
|
||||
" vtb_offr.qta_ord,\n" +
|
||||
" vtb_offr.qta_doc,\n" +
|
||||
" vtb_offr.qta_fatt,\n" +
|
||||
" vtb_offr.note AS note_riga,\n" +
|
||||
" vtb_offt.condizioni_commerciali,\n" +
|
||||
" vtb_offt.incoterms,\n" +
|
||||
" vtb_offt.note_incoterms,\n" +
|
||||
" vtb_offt.data_rif_scad,\n" +
|
||||
" vtb_offt.perc_prov,\n" +
|
||||
" vtb_offt.note_carico,\n" +
|
||||
" vtb_offt.term_cons\n" +
|
||||
" FROM vtb_offt\n" +
|
||||
" INNER JOIN vtb_offr ON vtb_offt.id_offerta = vtb_offr.id_offerta\n" +
|
||||
" CROSS APPLY [dbo].[getUntMisArticolo](vtb_offr.cod_mart, vtb_offr.unt_mis_vend) um\n" +
|
||||
" WHERE stato_offerta = 3)\n" +
|
||||
"\n" +
|
||||
"SELECT contratto.data_iniz_contr AS data_iniz,\n" +
|
||||
" contratto.data_fine_contr AS data_fine,\n" +
|
||||
" contratto.id_offerta AS id_contratto,\n" +
|
||||
" contratto.note,\n" +
|
||||
" contratto.cod_mart,\n" +
|
||||
" contratto.descrizione AS descrizione_articolo,\n" +
|
||||
" contratto.unt_mis_vend AS unt_mis_ven,\n" +
|
||||
" contratto.qta_off AS qta_vend_contratto,\n" +
|
||||
" contratto.prz_unt AS prz_vend,\n" +
|
||||
" contratto.perc_sco1,\n" +
|
||||
" contratto.perc_sco2,\n" +
|
||||
" contratto.perc_sco3,\n" +
|
||||
" contratto.perc_sco4,\n" +
|
||||
" ISNULL(contratto.qta_ord, 0) AS qta_ord,\n" +
|
||||
" ISNULL(contratto.qta_doc, 0) AS qta_doc,\n" +
|
||||
" gtb_anag.cod_anag,\n" +
|
||||
" gtb_anag.rag_soc,\n" +
|
||||
" gtb_anag.indirizzo,\n" +
|
||||
" gtb_anag.cap,\n" +
|
||||
" gtb_anag.citta,\n" +
|
||||
" gtb_anag.prov,\n" +
|
||||
" gtb_anag.nazione,\n" +
|
||||
" gtb_anag.e_mail,\n" +
|
||||
" gtb_anag.telefono,\n" +
|
||||
" gtb_anag.part_iva,\n" +
|
||||
" ISNULL(giacenza.qta_disp * rap_conv_vend, 0) AS qta_disp,\n" +
|
||||
" (SELECT cod_mdep FROM depo) AS cod_mdep,\n" +
|
||||
" contratto.prz_unt * (1 - contratto.perc_sco1 / 100) * (1 - contratto.perc_sco2 / 100) -\n" +
|
||||
" (1 * contratto.perc_sco3 / 100) *\n" +
|
||||
" (1 - contratto.perc_sco4 / 100) AS prz_vend_netto,\n" +
|
||||
" contratto.cod_paga,\n" +
|
||||
" ISNULL(contratto.descrizione_paga, gtb_paga.descrizione) AS descrizione_paga,\n" +
|
||||
" contratto.qta_off -\n" +
|
||||
" ISNULL(contratto.qta_ord, 0) -\n" +
|
||||
" ISNULL(contratto.qta_doc, 0) AS qta_residua,\n" +
|
||||
" ISNULL(contratto.qta_ord + contratto.qta_doc, 0) AS qta_usata,\n" +
|
||||
" contratto.rap_conv_vend AS rap_conv,\n" +
|
||||
" contratto.cod_vdes,\n" +
|
||||
" vd.destinatario,\n" +
|
||||
" vd.indirizzo AS indirizzo_dest,\n" +
|
||||
" vc.cod_vlis,\n" +
|
||||
" contratto.qta_fatt,\n" +
|
||||
" contratto.note_riga,\n" +
|
||||
" contratto.condizioni_commerciali,\n" +
|
||||
" contratto.incoterms,\n" +
|
||||
" gp.descrizione AS desc_incoterms,\n" +
|
||||
" contratto.note_incoterms,\n" +
|
||||
" contratto.data_rif_scad,\n" +
|
||||
" contratto.perc_prov,\n" +
|
||||
" contratto.note_carico,\n" +
|
||||
" contratto.term_cons\n" +
|
||||
"FROM contratto\n" +
|
||||
" INNER JOIN gtb_anag ON contratto.cod_anag = gtb_anag.cod_anag\n" +
|
||||
" INNER JOIN vtb_clie vc ON contratto.cod_anag = vc.cod_anag\n" +
|
||||
" LEFT OUTER JOIN vtb_dest vd ON contratto.cod_anag = vd.cod_anag AND contratto.cod_vdes = vd.cod_vdes\n" +
|
||||
" LEFT OUTER JOIN gtb_paga ON contratto.cod_paga = gtb_paga.cod_paga\n" +
|
||||
" LEFT OUTER JOIN gtb_porto gp ON contratto.incoterms = gp.porto\n" +
|
||||
" OUTER APPLY (SELECT SUM(mtb_part.qta_esistente + mtb_part.qta_imp_lav - mtb_part.qta_imp_cli) AS qta_disp\n" +
|
||||
" FROM mtb_part\n" +
|
||||
" INNER JOIN mtb_depo ON mtb_part.cod_mdep = mtb_depo.cod_mdep\n" +
|
||||
" WHERE mtb_depo.flag_movimentabile = 'S'\n" +
|
||||
" AND mtb_part.cod_mart = contratto.cod_mart) giacenza");
|
||||
|
||||
createOrUpdateFunction("pvm_getassortimentoClientePedane", "CREATE FUNCTION [dbo].[pvm_getassortimentoClientePedane](\n" +
|
||||
" @codAnag VARCHAR(5), @codVlis VARCHAR(5), @codVdes VARCHAR(5), @dataValidita DATETIME, @viewPromo BIT,\n" +
|
||||
" @pedane INT = 0\n" +
|
||||
")\n" +
|
||||
" RETURNS TABLE\n" +
|
||||
" AS\n" +
|
||||
" RETURN( /*\n" +
|
||||
"\n" +
|
||||
" declare @codAnag VARCHAR(5), @codVlis VARCHAR(5), @dataValidita DATETIME, @viewPromo BIT\n" +
|
||||
" set @codAnag = 'C3355'\n" +
|
||||
" set @codVlis = 'C3355'\n" +
|
||||
" set @dataValidita = '2023/04/04'\n" +
|
||||
" set @viewPromo = 1;\n" +
|
||||
" */\n" +
|
||||
" WITH assortimento AS (SELECT vtb_griglia_art.cod_mart\n" +
|
||||
" FROM vtb_clie\n" +
|
||||
" INNER JOIN vtb_griglia ON vtb_clie.cod_griglia = vtb_griglia.cod_griglia\n" +
|
||||
" INNER JOIN vtb_griglia_art\n" +
|
||||
" ON vtb_griglia.cod_griglia = vtb_griglia_art.cod_griglia AND\n" +
|
||||
" vtb_griglia.data_validita = vtb_griglia_art.data_validita\n" +
|
||||
" WHERE vtb_clie.cod_anag = @codAnag\n" +
|
||||
" AND vtb_griglia.data_validita = (SELECT MAX(g.data_validita)\n" +
|
||||
" FROM vtb_griglia g\n" +
|
||||
" WHERE g.cod_griglia = vtb_clie.cod_griglia\n" +
|
||||
" AND g.data_validita <= ISNULL(@dataValidita, CAST(GETDATE() AS DATE)))),\n" +
|
||||
" lisv AS (SELECT cod_vlis, cod_vlis AS cod_vlis_rif\n" +
|
||||
" FROM vtb_list\n" +
|
||||
" WHERE cod_vlis_rif IS NULL\n" +
|
||||
" UNION ALL\n" +
|
||||
" SELECT cod_vlis, cod_vlis_rif\n" +
|
||||
" FROM vtb_list\n" +
|
||||
" WHERE cod_vlis_rif IS NOT NULL),\n" +
|
||||
" listino AS (SELECT DISTINCT cod_mart, tipo_variazione\n" +
|
||||
" FROM (SELECT lisv.cod_vlis,\n" +
|
||||
" mtb_lisv.cod_mart,\n" +
|
||||
" LAST_VALUE(CASE\n" +
|
||||
" WHEN vtb_list_data.data_iniz IS NULL THEN NULL\n" +
|
||||
" ELSE mtb_lisv_data.tipo_variazione END)\n" +
|
||||
" OVER (PARTITION BY lisv.cod_vlis, mtb_lisv.cod_mart\n" +
|
||||
" ORDER BY vtb_list_data.data_iniz, CASE WHEN vtb_list_data.cod_promo IS NULL THEN 0 ELSE 1 END, vtb_list_data.versione\n" +
|
||||
" RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS tipo_variazione\n" +
|
||||
" FROM lisv\n" +
|
||||
" INNER JOIN mtb_lisv ON lisv.cod_vlis_rif = mtb_lisv.cod_vlis\n" +
|
||||
" INNER JOIN mtb_lisv_data ON mtb_lisv.cod_vlis = mtb_lisv_data.cod_vlis AND\n" +
|
||||
" mtb_lisv.cod_mart = mtb_lisv_data.cod_mart\n" +
|
||||
" LEFT OUTER JOIN vtb_list_data\n" +
|
||||
" ON mtb_lisv_data.cod_vlis = vtb_list_data.cod_vlis AND\n" +
|
||||
" mtb_lisv_data.versione = vtb_list_data.versione AND\n" +
|
||||
" vtb_list_data.data_iniz <=\n" +
|
||||
" ISNULL(@dataValidita, CAST(GETDATE() AS DATE))\n" +
|
||||
" WHERE lisv.cod_vlis = @codVlis\n" +
|
||||
" AND NOT EXISTS(SELECT cod_mart FROM assortimento)) t\n" +
|
||||
" WHERE (t.tipo_variazione IS NULL OR t.tipo_variazione <> 'D')),\n" +
|
||||
" tmp_lisv AS (SELECT l.cod_mart,\n" +
|
||||
" l.cod_vlis,\n" +
|
||||
" ISNULL(p.data_iniz, l.data_iniz) AS data_iniz,\n" +
|
||||
" l.da,\n" +
|
||||
" l.a,\n" +
|
||||
" ISNULL(p.prz_vend, l.prz_vend_trasp) AS prz_vend,\n" +
|
||||
" ISNULL(p.prz_vend_netto, l.prz_vend_trasp_netto) AS prz_vend_netto,\n" +
|
||||
" ISNULL(p.perc_sco1, l.perc_sco1) AS perc_sco1,\n" +
|
||||
" ISNULL(p.perc_sco2, l.perc_sco2) AS perc_sco2,\n" +
|
||||
" ISNULL(p.perc_sco3, l.perc_sco3) AS perc_sco3,\n" +
|
||||
" ISNULL(p.perc_sco4, l.perc_sco4) AS perc_sco4,\n" +
|
||||
" p.perc_prov,\n" +
|
||||
" CONVERT(NUMERIC(20, 5), 0) AS qta_residua,\n" +
|
||||
" CONVERT(BIGINT, NULL) AS id_contratto,\n" +
|
||||
" ISNULL(p.rap_conv, l.rap_conv) AS rap_conv,\n" +
|
||||
" ISNULL(p.note, l.note) AS note,\n" +
|
||||
" CAST(NULL AS VARCHAR(5)) AS cod_vdes,\n" +
|
||||
" l.cod_tcol_ul AS cod_tcol_ul,\n" +
|
||||
" ISNULL(p.unt_mis_ven, l.unt_mis_ven) AS unt_mis_ven,\n" +
|
||||
" l.colli_pedana AS colli_pedana,\n" +
|
||||
" ISNULL(p.tipo_variazione, l.tipo_variazione) AS tipo_variazione,\n" +
|
||||
" CONVERT(VARCHAR(1), CASE\n" +
|
||||
" WHEN p.cod_promo IS NULL THEN NULL\n" +
|
||||
" ELSE 'P' END) AS tipo_promo,\n" +
|
||||
" CONVERT(VARCHAR(5), NULL) AS cod_paga,\n" +
|
||||
" CONVERT(VARCHAR(5), NULL) AS descr_paga,\n" +
|
||||
" l.porto,\n" +
|
||||
" l.qta_cnf,\n" +
|
||||
" NULL AS note_incoterms,\n" +
|
||||
" NULL AS data_rif_scad,\n" +
|
||||
" NULL AS note_carico,\n" +
|
||||
" NULL AS term_cons\n" +
|
||||
" FROM dbo.getListinoVenditaPedane(@dataValidita, @codVlis, NULL, @pedane) l\n" +
|
||||
" LEFT OUTER JOIN dbo.getPromozioneVendita(@dataValidita, @dataValidita,\n" +
|
||||
" @codVlis, NULL, NULL) p\n" +
|
||||
" ON l.cod_vlis = p.cod_vlis AND l.cod_mart = p.cod_mart AND\n" +
|
||||
" ISNULL(@viewPromo, 0) = 1\n" +
|
||||
" WHERE l.cod_vlis = @codVlis\n" +
|
||||
" AND l.cod_mart IN (SELECT cod_mart\n" +
|
||||
" FROM assortimento\n" +
|
||||
" UNION ALL\n" +
|
||||
" SELECT cod_mart\n" +
|
||||
" FROM listino)\n" +
|
||||
" AND l.tipo_variazione <> 'D'\n" +
|
||||
" AND l.tipo_variazione IS NOT NULL\n" +
|
||||
" AND l.flag_attivo = 'S'\n" +
|
||||
" UNION ALL\n" +
|
||||
" SELECT l.cod_mart,\n" +
|
||||
" l.cod_vlis,\n" +
|
||||
" NULL AS data_iniz,\n" +
|
||||
" NULL AS da,\n" +
|
||||
" NULL AS a,\n" +
|
||||
" NULL AS prz_vend,\n" +
|
||||
" NULL AS prz_vend_netto,\n" +
|
||||
" NULL AS perc_sco1,\n" +
|
||||
" NULL AS perc_sco2,\n" +
|
||||
" NULL AS perc_sco3,\n" +
|
||||
" NULL AS perc_sco4,\n" +
|
||||
" NULL AS perc_prov,\n" +
|
||||
" NULL AS qta_residua,\n" +
|
||||
" NULL AS id_contratto,\n" +
|
||||
" um.rap_conv AS rap_conv,\n" +
|
||||
" NULL AS note,\n" +
|
||||
" CAST(NULL AS VARCHAR(5)) AS cod_vdes,\n" +
|
||||
" NULL AS cod_tcol_ul,\n" +
|
||||
" l.unt_mis_ven AS unt_mis_ven,\n" +
|
||||
" NULL AS colli_pedana,\n" +
|
||||
" NULL AS tipo_variazione,\n" +
|
||||
" NULL AS tipo_promo,\n" +
|
||||
" CONVERT(VARCHAR(5), NULL) AS cod_paga,\n" +
|
||||
" CONVERT(VARCHAR(5), NULL) AS descr_paga,\n" +
|
||||
" NULL porto,\n" +
|
||||
" mtb_aart.qta_cnf,\n" +
|
||||
" NULL AS note_incoterms,\n" +
|
||||
" NULL AS data_rif_scad,\n" +
|
||||
" NULL AS note_carico,\n" +
|
||||
" NULL AS term_cons\n" +
|
||||
" FROM mtb_lisv l\n" +
|
||||
" INNER JOIN listino ON l.cod_mart = listino.cod_mart\n" +
|
||||
" INNER JOIN mtb_aart ON l.cod_mart = mtb_aart.cod_mart\n" +
|
||||
" CROSS APPLY dbo.getUntMisArticolo(l.cod_mart, l.unt_mis_ven) um\n" +
|
||||
" WHERE l.cod_vlis = @codVlis\n" +
|
||||
" AND listino.tipo_variazione IS NULL\n" +
|
||||
" UNION ALL\n" +
|
||||
" SELECT vvw_contratti_vendita.cod_mart,\n" +
|
||||
" NULL AS cod_vlis,\n" +
|
||||
" vvw_contratti_vendita.data_iniz,\n" +
|
||||
" NULL AS da,\n" +
|
||||
" NULL AS a,\n" +
|
||||
" vvw_contratti_vendita.prz_vend,\n" +
|
||||
" ROUND(vvw_contratti_vendita.prz_vend *\n" +
|
||||
" (1 - ISNULL(vvw_contratti_vendita.perc_sco1, 0))\n" +
|
||||
" * (1 - ISNULL(vvw_contratti_vendita.perc_sco2, 0))\n" +
|
||||
" * (1 - ISNULL(vvw_contratti_vendita.perc_sco3, 0))\n" +
|
||||
" * (1 - ISNULL(vvw_contratti_vendita.perc_sco4, 0)),\n" +
|
||||
" 5) AS prz_vend_netto,\n" +
|
||||
" vvw_contratti_vendita.perc_sco1,\n" +
|
||||
" vvw_contratti_vendita.perc_sco2,\n" +
|
||||
" vvw_contratti_vendita.perc_sco3,\n" +
|
||||
" vvw_contratti_vendita.perc_sco4,\n" +
|
||||
" vvw_contratti_vendita.perc_prov,\n" +
|
||||
" vvw_contratti_vendita.qta_residua,\n" +
|
||||
" vvw_contratti_vendita.id_contratto,\n" +
|
||||
" vvw_contratti_vendita.rap_conv,\n" +
|
||||
" vvw_contratti_vendita.note,\n" +
|
||||
" vvw_contratti_vendita.cod_vdes,\n" +
|
||||
" NULL,\n" +
|
||||
" vvw_contratti_vendita.unt_mis_ven,\n" +
|
||||
" NULL,\n" +
|
||||
" NULL,\n" +
|
||||
" 'C' AS tipo_promo,\n" +
|
||||
" vvw_contratti_vendita.cod_paga,\n" +
|
||||
" vvw_contratti_vendita.descrizione_paga AS descr_paga,\n" +
|
||||
" vvw_contratti_vendita.incoterms AS porto,\n" +
|
||||
" mtb_aart.qta_cnf,\n" +
|
||||
" vvw_contratti_vendita.note_incoterms,\n" +
|
||||
" vvw_contratti_vendita.data_rif_scad,\n" +
|
||||
" vvw_contratti_vendita.note_carico,\n" +
|
||||
" vvw_contratti_vendita.term_cons\n" +
|
||||
" FROM vvw_contratti_vendita\n" +
|
||||
" INNER JOIN mtb_aart ON vvw_contratti_vendita.cod_mart = mtb_aart.cod_mart\n" +
|
||||
" WHERE vvw_contratti_vendita.cod_anag = @codAnag\n" +
|
||||
" AND (@codVdes IS NULL OR vvw_contratti_vendita.cod_vdes IS NULL OR\n" +
|
||||
" vvw_contratti_vendita.cod_vdes = @codVdes)\n" +
|
||||
" AND (ISNULL(@dataValidita, CAST(GETDATE() AS DATE)) BETWEEN\n" +
|
||||
" vvw_contratti_vendita.data_iniz AND vvw_contratti_vendita.data_fine)\n" +
|
||||
"-- AND vvw_contratti_vendita.qta_residua >= 0\n" +
|
||||
" )\n" +
|
||||
"\n" +
|
||||
" SELECT tmp_lisv.cod_mart,\n" +
|
||||
" ISNULL(maa.cod_mart_anag, tmp_lisv.cod_mart) AS cod_mart_anag,\n" +
|
||||
" cod_vlis,\n" +
|
||||
" data_iniz,\n" +
|
||||
" da,\n" +
|
||||
" a,\n" +
|
||||
" prz_vend,\n" +
|
||||
" prz_vend_netto,\n" +
|
||||
" perc_sco1,\n" +
|
||||
" perc_sco2,\n" +
|
||||
" perc_sco3,\n" +
|
||||
" perc_sco4,\n" +
|
||||
" perc_prov,\n" +
|
||||
" qta_residua,\n" +
|
||||
" id_contratto,\n" +
|
||||
" rap_conv,\n" +
|
||||
" ISNULL(maa.note, tmp_lisv.note) AS note,\n" +
|
||||
" cod_tcol_ul,\n" +
|
||||
" unt_mis_ven,\n" +
|
||||
" CASE\n" +
|
||||
" WHEN maa.colli_pedana IS NULL OR maa.colli_pedana = 0 THEN tmp_lisv.colli_pedana\n" +
|
||||
" ELSE maa.colli_pedana END AS colli_pedana,\n" +
|
||||
" tipo_variazione,\n" +
|
||||
" tipo_promo,\n" +
|
||||
" cod_paga,\n" +
|
||||
" descr_paga,\n" +
|
||||
" porto,\n" +
|
||||
" qta_cnf,\n" +
|
||||
" CAST(CASE WHEN tmp_lisv.data_iniz IS NULL THEN 0 ELSE 1 END AS BIT) AS art_lisv,\n" +
|
||||
" cod_vdes,\n" +
|
||||
" note_incoterms,\n" +
|
||||
" data_rif_scad,\n" +
|
||||
" note_carico,\n" +
|
||||
" term_cons\n" +
|
||||
" FROM tmp_lisv\n" +
|
||||
" LEFT OUTER JOIN mtb_aart_anag maa\n" +
|
||||
" ON tmp_lisv.cod_mart = maa.cod_mart AND maa.cod_anag = @codAnag)");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.IntegryCustomer;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20250910150954 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
createSetup("W_TORIEPORDINI_DISP", "DATAWINDOW", "D_TORIEPORDINI_COMP_REP", null,
|
||||
null, false, null, false, false,
|
||||
false, false, false, null, false, null);
|
||||
|
||||
if ( isCustomer(IntegryCustomer.TwoBrothers)) {
|
||||
updateSetupValue("W_TORIEPORDINI_DISP","DATAWINDOW","D_TORIEPORDINI_COMP_REP", "D_TORIEPORDINI_COMP_TWOB_REP");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20250911095911 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
executeStatement(
|
||||
"alter table dbo.crl_amac_art add id_ricetta varchar(25)",
|
||||
"insert into crl_amac_art (cod_cmac, cod_mgrp, cod_msgr, cod_msfa, cod_mtip, cod_mstp, cod_mart, id_ricetta)\n" +
|
||||
"select cod_cmac,\n" +
|
||||
" null as cod_mgrp,\n" +
|
||||
" null as cod_msgr,\n" +
|
||||
" null as cod_msfa,\n" +
|
||||
" a.cod_mtip,\n" +
|
||||
" a.cod_mstp,\n" +
|
||||
" null as cod_mart,\n" +
|
||||
" id_ricetta\n" +
|
||||
"from ctb_amac\n" +
|
||||
" cross apply (select cod_mtip,\n" +
|
||||
" cod_mstp,\n" +
|
||||
" ROW_NUMBER() over (partition by null order by cod_mtip) - 1 as id_ricetta\n" +
|
||||
" from mtb_stip\n" +
|
||||
" where cod_mstp in (\n" +
|
||||
" '0101',\n" +
|
||||
" '0102',\n" +
|
||||
" '0103',\n" +
|
||||
" '0104',\n" +
|
||||
" '0105',\n" +
|
||||
" '0106',\n" +
|
||||
" '0107',\n" +
|
||||
" '0108',\n" +
|
||||
" '0109',\n" +
|
||||
" '0110',\n" +
|
||||
" '0111',\n" +
|
||||
" '0112',\n" +
|
||||
" '0113',\n" +
|
||||
" '0114',\n" +
|
||||
" '0115',\n" +
|
||||
" '0116',\n" +
|
||||
" '0201',\n" +
|
||||
" '0202',\n" +
|
||||
" '0203',\n" +
|
||||
" '0301',\n" +
|
||||
" '0302',\n" +
|
||||
" '0303',\n" +
|
||||
" '0304',\n" +
|
||||
" '0305',\n" +
|
||||
" '0306',\n" +
|
||||
" '0307',\n" +
|
||||
" '0308',\n" +
|
||||
" '0309',\n" +
|
||||
" '0310',\n" +
|
||||
" '0311',\n" +
|
||||
" '0312',\n" +
|
||||
" '0313',\n" +
|
||||
" '0314',\n" +
|
||||
" '0315',\n" +
|
||||
" '0401',\n" +
|
||||
" '0402',\n" +
|
||||
" '0403',\n" +
|
||||
" '0404',\n" +
|
||||
" '0405',\n" +
|
||||
" '0501',\n" +
|
||||
" '0502',\n" +
|
||||
" '0503'\n" +
|
||||
" )) a\n" +
|
||||
"where cod_jfas = 'stock'\n" +
|
||||
"order by cod_cmac"
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.IntegryCustomer;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20250911113026 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
createSetup("w_vriepfattagecomp_disp", "EXPORT_EXCEL", "PATH_FILE", null,
|
||||
null, false, null, false, false,
|
||||
false, false, false, null, false, null);
|
||||
createSetup("w_vriepfattagecomp_disp", "EXPORT_EXCEL", "REPORT_NAME", null,
|
||||
null, false, null, false, false,
|
||||
false, false, false, null, false, null);
|
||||
if ( isCustomer(IntegryCustomer.Smetar)) {
|
||||
updateSetupValue("w_vriepfattagecomp_disp","EXPORT_EXCEL","PATH_FILE", "C:\\");
|
||||
updateSetupValue("w_vriepfattagecomp_disp","EXPORT_EXCEL","REPORT_NAME", "FatturatoAgentiClientiComparato");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.IntegryCustomer;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20250911113148 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
createSetup("w_vriepfattagecomp_disp", "CB_EXPORT_EXCEL", "VISIBLE", "N",
|
||||
null, false, null, false, false,
|
||||
false, false, false, null, false, null);
|
||||
|
||||
if ( isCustomer(IntegryCustomer.Smetar)) {
|
||||
updateSetupValue("w_vriepfattagecomp_disp","CB_EXPORT_EXCEL","VISIBLE", "S");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
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_20250911133439 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
if (!isCustomerDb(IntegryCustomerDB.Carelli_Winact)) return;
|
||||
|
||||
createOrUpdateFunction("steup_getGrigliaVendita", "CREATE FUNCTION [dbo].[steup_getGrigliaVendita](\n" +
|
||||
" @codMdep VARCHAR(5), @codJfas VARCHAR(5), @dataIspezione datetime\n" +
|
||||
")\n" +
|
||||
" RETURNS TABLE\n" +
|
||||
" AS\n" +
|
||||
" RETURN(WITH tipiArt AS (SELECT value_string AS cod_mtip\n" +
|
||||
" FROM dbo.ParseStringIntoArray((SELECT value\n" +
|
||||
" FROM stb_gest_setup\n" +
|
||||
" WHERE gest_name = 'PVM'\n" +
|
||||
" AND section = 'RILEVAZIONI_STEUP'\n" +
|
||||
" AND key_section = 'EXCLUDE_COD_MTIP'), '|') t)\n" +
|
||||
" , art AS (SELECT DISTINCT cod_griglia, cod_mart\n" +
|
||||
" FROM carelli.dbo.vtb_griglia_art\n" +
|
||||
" WHERE cod_griglia = @codMdep\n" +
|
||||
" AND data_validita =\n" +
|
||||
" (SELECT MAX(data_validita) FROM carelli.dbo.vtb_griglia_art WHERE cod_griglia = @codMdep AND data_validita <=@dataIspezione)\n" +
|
||||
" )\n" +
|
||||
" \n" +
|
||||
" SELECT DISTINCT case when @codJfas = '01' then art_det.cod_mart_griglia else mtb_aart.cod_mart end as cod_mart,\n" +
|
||||
" mtb_aart.descrizione,\n" +
|
||||
" mtb_aart.bar_code,\n" +
|
||||
" mtb_aart.cod_msgr,\n" +
|
||||
" mtb_aart.plu,\n" +
|
||||
" art_det.cod_mart AS cod_mart_kit \n" +
|
||||
" FROM carelli.dbo.mtb_aart\n" +
|
||||
" INNER JOIN jrl_fasi_mtb_grup ON\n" +
|
||||
" mtb_aart.cod_mgrp = jrl_fasi_mtb_grup.cod_mgrp\n" +
|
||||
" INNER JOIN (SELECT cod_mart, cod_comp AS cod_mart_griglia\n" +
|
||||
" FROM carelli.dbo.mtb_comp\n" +
|
||||
" UNION ALL\n" +
|
||||
" SELECT cod_comp AS cod_mart, cod_mart AS cod_mart_griglia\n" +
|
||||
" FROM carelli.dbo.mtb_comp \n" +
|
||||
" where @codJfas <> '01'\n" +
|
||||
" UNION ALL\n" +
|
||||
" SELECT cod_mart, cod_mart AS cod_mart_griglia\n" +
|
||||
" FROM carelli.dbo.mtb_aart\n" +
|
||||
" WHERE cod_mart NOT IN (SELECT cod_mart FROM carelli.dbo.mtb_comp)) AS art_det\n" +
|
||||
" ON mtb_aart.cod_mart = art_det.cod_mart\n" +
|
||||
" INNER JOIN art ON art_det.cod_mart_griglia = art.cod_mart\n" +
|
||||
" WHERE jrl_fasi_mtb_grup.cod_jfas = @codJfas\n" +
|
||||
" AND flag_stato = 'A'\n" +
|
||||
" AND (mtb_aart.cod_mtip IS NULL OR mtb_aart.cod_mtip NOT IN (SELECT cod_mtip FROM tipiArt))\n" +
|
||||
" UNION ALL\n" +
|
||||
" SELECT DISTINCT mtb_aart.cod_mart as cod_mart,\n" +
|
||||
" mtb_aart.descrizione,\n" +
|
||||
" mtb_aart.bar_code,\n" +
|
||||
" mtb_aart.cod_msgr,\n" +
|
||||
" mtb_aart.plu,\n" +
|
||||
" mtb_aart.cod_mart AS cod_madre \n" +
|
||||
" FROM carelli.dbo.mtb_aart\n" +
|
||||
" INNER JOIN jrl_fasi_mtb_grup ON\n" +
|
||||
" mtb_aart.cod_mgrp = jrl_fasi_mtb_grup.cod_mgrp\n" +
|
||||
" INNER JOIN (SELECT DISTINCT cod_mdep, cod_mart \n" +
|
||||
" FROM carelli.dbo.[getGrigliaAcquisto](null, null, @codMdep, null, null) griglia \n" +
|
||||
" where griglia.tipo_variazione <> 'D' AND \n" +
|
||||
" EXISTS( select cod_mart from carelli.dbo.mtb_aart WHERE mtb_aart.cod_mart = griglia.cod_mart AND mtb_aart.cod_mgrp = '03')) art ON \n" +
|
||||
" mtb_aart.cod_mart = art.cod_mart\n" +
|
||||
" WHERE jrl_fasi_mtb_grup.cod_jfas = @codJfas\n" +
|
||||
" AND flag_stato = 'A'\n" +
|
||||
" AND (mtb_aart.cod_mtip IS NULL OR mtb_aart.cod_mtip NOT IN (SELECT cod_mtip FROM tipiArt))\n" +
|
||||
" \n" +
|
||||
" )");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,113 @@
|
||||
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_20250911191115 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
createOrUpdateFunction("getDettMatricoleDaOrdine", "CREATE Function [dbo].[getDettMatricoleDaOrdine] (@codJcom varchar(10)) \n" +
|
||||
"RETURNS @dettMatricole TABLE( cod_prod varchar(15),\n" +
|
||||
" descrizione_prod varchar(255), \n" +
|
||||
" unt_mis_prod varchar(3),\n" +
|
||||
" qta_inevasa numeric(20,5),\n" +
|
||||
" qta_da_prod numeric(20,5),\n" +
|
||||
" data_ord datetime, \n" +
|
||||
" num_ord integer, \n" +
|
||||
"matricola varchar(20)) AS\n" +
|
||||
"Begin\n" +
|
||||
" declare @codProd varchar(15),\n" +
|
||||
" @descrizioneProd varchar(255), \n" +
|
||||
" @untMisProd varchar(3), \n" +
|
||||
" @qtaInevasa numeric(20,5), \n" +
|
||||
" @qtaProd numeric(20,5), \n" +
|
||||
" @dataOrd datetime, \n" +
|
||||
" @numOrd integer,\n" +
|
||||
" @existMatricola integer,\n" +
|
||||
" @matricola varchar(20),\n" +
|
||||
" @termCons varchar(1024);\n" +
|
||||
"\n" +
|
||||
" Declare crs_prod Cursor LOCAL SCROLL FOR\n" +
|
||||
" select dtb_ordt.cod_prod, \n" +
|
||||
" dtb_ordt.descrizione_prod, \n" +
|
||||
" dtb_ordt.unt_mis_prod, \n" +
|
||||
" dtb_ordt.qta_prod - dtb_ordt.qta_evasa_prod as qta_inevasa, \n" +
|
||||
" convert(numeric(20,5), 0) as qta_da_prod, \n" +
|
||||
" dtb_ordt.data_ord, \n" +
|
||||
" dtb_ordt.num_ord,\n" +
|
||||
" dtb_ordt.term_cons\n" +
|
||||
" from dtb_ordt \n" +
|
||||
" where gestione = 'L' and \n" +
|
||||
" livello = 1 and\n" +
|
||||
" flag_evaso_forzato = 'N' and\n" +
|
||||
" flag_evaso_prod = 'I' and \n" +
|
||||
" dtb_ordt.cod_jcom = @codJcom\n" +
|
||||
"\n" +
|
||||
" OPEN crs_prod \n" +
|
||||
" FETCH NEXT FROM crs_prod INTO @codProd, @descrizioneProd, @untMisProd, @qtaInevasa, @qtaProd, @dataOrd, @numOrd, @termCons\n" +
|
||||
" WHILE @@FETCH_STATUS = 0\n" +
|
||||
" Begin \n" +
|
||||
" IF @termCons IS NOT NULL\n" +
|
||||
" BEGIN\n" +
|
||||
" Declare crs_matricole Cursor LOCAL SCROLL FOR\n" +
|
||||
" select value_string\n" +
|
||||
" from parseStringIntoArray(@termcons, '|') \n" +
|
||||
"\n" +
|
||||
" OPEN crs_matricole \n" +
|
||||
" FETCH NEXT FROM crs_matricole INTO @matricola\n" +
|
||||
" WHILE @@FETCH_STATUS = 0\n" +
|
||||
" Begin\n" +
|
||||
" select @existMatricola = 0\n" +
|
||||
" select @existMatricola = COUNT(*)\n" +
|
||||
" from dtb_ordt, \n" +
|
||||
" dtb_docr inner join (select cod_prod, \n" +
|
||||
" partita_mag \n" +
|
||||
" from dtb_doct \n" +
|
||||
" where cod_dtip = dbo.getGestSetup('IMPORT_DOCUMENTI', 'CARICO_SCARICO_DA_FABB', 'COD_DTIP_SCAR_GIROC'))giroc on giroc.cod_prod = dtb_docr.cod_mart and\n" +
|
||||
" giroc.partita_mag = dtb_docr.matricola, \n" +
|
||||
" dtb_tipi\n" +
|
||||
" where dtb_docr.data_ord = dtb_ordt.data_ord and\n" +
|
||||
" dtb_docr.num_ord = dtb_ordt.num_ord and\n" +
|
||||
" dtb_ordt.gestione = 'L' and \n" +
|
||||
" dtb_docr.cod_dtip = dtb_tipi.cod_dtip and\n" +
|
||||
" dtb_tipi.tipo_emissione = 'DIRETTA' and\n" +
|
||||
" dtb_tipi.segno_qta_car = 1 and\n" +
|
||||
" dtb_ordt.livello = 1 and\n" +
|
||||
" dtb_ordt.data_ord = @dataOrd and\n" +
|
||||
" dtb_ordt.num_ord = @numOrd and\n" +
|
||||
" dtb_docr.matricola = @matricola;\n" +
|
||||
" \n" +
|
||||
"\n" +
|
||||
" IF @existMatricola = 0\n" +
|
||||
" insert into @dettMatricole \n" +
|
||||
" select @codProd, @descrizioneProd, @untMisProd, @qtaInevasa, @qtaProd, @dataOrd, @numOrd, @matricola\n" +
|
||||
"\n" +
|
||||
" FETCH NEXT FROM crs_matricole INTO @matricola\n" +
|
||||
" end \n" +
|
||||
" close crs_matricole\n" +
|
||||
" deallocate crs_matricole \n" +
|
||||
" END\n" +
|
||||
" ELSE\n" +
|
||||
" insert into @dettMatricole \n" +
|
||||
" select @codProd, @descrizioneProd, @untMisProd, @qtaInevasa, @qtaProd, @dataOrd, @numOrd, null\n" +
|
||||
"\n" +
|
||||
" FETCH NEXT FROM crs_prod INTO @codProd, @descrizioneProd, @untMisProd, @qtaInevasa, @qtaProd, @dataOrd, @numOrd, @termCons\n" +
|
||||
" end \n" +
|
||||
" close crs_prod\n" +
|
||||
" deallocate crs_prod \n" +
|
||||
"\n" +
|
||||
" return\n" +
|
||||
"end");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.IntegryCustomer;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20250912130045 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
if ( isCustomer(IntegryCustomer.RossoGargano)) {
|
||||
executeStatement(";with moduli as (\n" +
|
||||
"select *\n" +
|
||||
"from dtb_mod_stampa\n" +
|
||||
"where mod_stampa in ('CMR', 'PACK', 'PACKC') )\n" +
|
||||
"insert into drl_tipi_report ( cod_dtip, report_id, sort_id, report_type)\n" +
|
||||
"select cod_dtip, moduli.report_id, \n" +
|
||||
"ROW_NUMBER() over (partition by cod_dtip order by moduli.mod_stampa desc) as sort_id,\n" +
|
||||
"IIF(moduli.mod_stampa ='CMR',2, 1) as report_type\n" +
|
||||
"from dtb_tipi,\n" +
|
||||
"moduli\n" +
|
||||
"where dtb_tipi.tipo_emissione = 'DIRETTA'\n" +
|
||||
"and ((gestione = 'A' AND moduli.mod_stampa = 'PACKC') OR\n" +
|
||||
"(gestione = 'V' AND moduli.mod_stampa IN( 'CMR','PACK') ) OR \n" +
|
||||
"(gestione = 'L' AND segno_qta_car - segno_val_scar > 0 AND moduli.mod_stampa = 'PACKC') OR\n" +
|
||||
"(gestione = 'L' AND segno_qta_car - segno_val_scar < 0 AND moduli.mod_stampa = 'PACK')\n" +
|
||||
")\n" +
|
||||
"order by 1");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.IntegryCustomer;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20250912152309 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_ddocu_rc", "SETUP", "INVIO_EMAIL", "N",
|
||||
"Attiva invio email direttamente dalla gestione", false, "SI_NO", false, false,
|
||||
false, false, false, null, false, "SELECT 'S' UNION ALL SELECT 'N'");
|
||||
|
||||
if (isCustomer(IntegryCustomer.RossoGargano))
|
||||
updateSetupValue("w_ddocu_rc", "SETUP", "INVIO_EMAIL", "S");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.IntegryCustomer;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20250912170747 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
if(isCustomer(IntegryCustomer.Gramm))
|
||||
return;
|
||||
|
||||
if(isCustomer(IntegryCustomer.Smetar)) {
|
||||
updateSetupValue("w_cscadfor_disp", "DATAWINDOW", "d_cscadfor_nobanca_rep", "d_cscadfor_nobanca_orizzontale_rep");
|
||||
return;
|
||||
}
|
||||
|
||||
if(isCustomer(IntegryCustomer.Auricchio)) {
|
||||
updateSetupValue("w_cscadfor_disp", "DATAWINDOW", "d_cscadfor_nobanca_rep", "d_cscadfor_nobanca_auricchio_rep");
|
||||
return;
|
||||
}
|
||||
|
||||
if(isCustomer(IntegryCustomer.Carelli)) {
|
||||
updateSetupValue("w_cscadfor_disp", "DATAWINDOW", "d_cscadfor_nobanca_rep", "d_cscadfor_nobanca_carelli_rep");
|
||||
return;
|
||||
}
|
||||
|
||||
if(isCustomer(IntegryCustomer.Suit)) {
|
||||
updateSetupValue("w_cscadfor_disp", "DATAWINDOW", "d_cscadfor_nobanca_rep", "d_cscadfor_nobanca_suit_rep");
|
||||
return;
|
||||
}
|
||||
|
||||
updateSetupValue("w_cscadfor_disp", "DATAWINDOW", "d_cscadfor_nobanca_rep", "");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.IntegryCustomer;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
import it.integry.ems_model.entity.JtbFasi;
|
||||
|
||||
public class Migration_20250912182624 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
|
||||
createSetup("PVM","MACCHINARI_PROD","REPORT_NAME_INFO_LINEA",null, "Nome report stampa Dettaglio macchine reparto", false, "REPORT_NAME", false, false, false, false, false, JtbFasi.ENTITY, false, null);
|
||||
|
||||
|
||||
if (isCustomer(IntegryCustomer.Biolevante)){
|
||||
executeInsertStatement("INSERT INTO stb_gest_setup_det VALUES ('PVM', 'MACCHINARI_PROD', 'REPORT_NAME_INFO_LINEA', 'jtb_fasi', 'STOCK', 'ReportDettaglioContenutoTank')");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,6 @@ package it.integry.ems.rules.completing;
|
||||
|
||||
import it.integry.ems.sync.MultiDBTransaction.Connection;
|
||||
import it.integry.ems_model.entity.JtbComt;
|
||||
import it.integry.ems_model.service.SetupGest;
|
||||
import it.integry.ems_model.utility.UtilityDB;
|
||||
import it.integry.ems_model.utility.UtilityString;
|
||||
|
||||
@@ -46,20 +45,19 @@ public class CommesseRules extends QueryRules {
|
||||
public static String getNextCodJcom(Connection conn, JtbComt jtbComt) throws Exception {
|
||||
String className = "W_JCOMMT_RC", generazioneAutomatica = "N", aggiungiGestione = "N";
|
||||
String codJcom = null;
|
||||
SetupGest setup = new SetupGest();
|
||||
|
||||
// Acquisizione configurazioni commessa
|
||||
if ("V".equals(jtbComt.getGestione())) {
|
||||
generazioneAutomatica = (String) setup.getSetup(conn, className, "SETUP", "GEN_AUTOMATICA_COMM_VEN");
|
||||
generazioneAutomatica = setupGest.getSetup(conn, className, "SETUP", "GEN_AUTOMATICA_COMM_VEN");
|
||||
if (UtilityString.isNullOrEmpty(generazioneAutomatica)) {
|
||||
generazioneAutomatica = "N";
|
||||
}
|
||||
aggiungiGestione = (String) setup.getSetup(conn, className, "SETUP", "AGGIUNGI_GEST_VEN");
|
||||
aggiungiGestione = setupGest.getSetup(conn, className, "SETUP", "AGGIUNGI_GEST_VEN");
|
||||
if (UtilityString.isNullOrEmpty(aggiungiGestione)) {
|
||||
aggiungiGestione = "N";
|
||||
}
|
||||
} else if ("L".equals(jtbComt.getGestione()) || "A".equals(jtbComt.getGestione())) {
|
||||
generazioneAutomatica = (String) setup.getSetup(conn, className, "SETUP", "GEN_AUTOMATICA_COMM_LAV");
|
||||
generazioneAutomatica = setupGest.getSetup(conn, className, "SETUP", "GEN_AUTOMATICA_COMM_LAV");
|
||||
if (UtilityString.isNullOrEmpty(generazioneAutomatica)) {
|
||||
generazioneAutomatica = "N";
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@ package it.integry.ems.rules.completing;
|
||||
import it.integry.ems.sync.MultiDBTransaction.Connection;
|
||||
import it.integry.ems_model.base.EntityBase;
|
||||
import it.integry.ems_model.rules.util.DroolsUtil;
|
||||
import it.integry.ems_model.service.SetupGest;
|
||||
import it.integry.ems_model.utility.UtilityDB;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
@@ -14,7 +13,6 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
public class DistBaseRules extends QueryRules {
|
||||
protected static SetupGest setupGest = new SetupGest();
|
||||
|
||||
public static String completeUntMisProd(Connection connection, String codProd) throws SQLException {
|
||||
String sql = "SELECT mtb_aart.unt_mis FROM mtb_aart " + " WHERE mtb_aart.cod_mart = '" + codProd + "'";
|
||||
|
||||
@@ -14,7 +14,6 @@ import it.integry.ems_model.entity.common.DtbBaseDocR;
|
||||
import it.integry.ems_model.entity.common.DtbDocOrdR;
|
||||
import it.integry.ems_model.entity.common.DtbDocOrdT;
|
||||
import it.integry.ems_model.rules.util.DroolsUtil;
|
||||
import it.integry.ems_model.service.SetupGest;
|
||||
import it.integry.ems_model.types.OperationType;
|
||||
import it.integry.ems_model.utility.*;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
@@ -475,8 +474,6 @@ public class DocOrdCalTotaliRules extends QueryRules {
|
||||
Date dataDocBolla = null;
|
||||
Integer numDocBolla = null;
|
||||
|
||||
SetupGest setup = new SetupGest();
|
||||
|
||||
if (testata.getOperation() == OperationType.NO_OP) {
|
||||
testata.setOperation(OperationType.UPDATE);
|
||||
}
|
||||
@@ -543,7 +540,7 @@ public class DocOrdCalTotaliRules extends QueryRules {
|
||||
String whereCondTestata = testata.getEntityHolder().getWherePK(testata);
|
||||
String sql = "select mtb_colt.gestione, mtb_colt.data_collo, mtb_colt.ser_collo, mtb_colt.num_collo from mtb_colt where " + whereCondTestata;
|
||||
colliFromDB = new ResultSetMapper().mapQuerySetToList(conn, sql, MtbColt.class);
|
||||
calcColli = setup.getSetupBoolean(conn, "DATI_AZIENDA", "DOCU_ORD", "CALC_COLLI");
|
||||
calcColli = setupGest.getSetupBoolean(conn, "DATI_AZIENDA", "DOCU_ORD", "CALC_COLLI");
|
||||
|
||||
/*20-04-20 (FABIO): commentato la lettura dei colli da MtbColt al momento, ma è una logica che non dovrebbe più essere utilizzata,
|
||||
* ma in tal caso dovremmo valuare delle poche aziende che hanno il flag calc_colli = 'N' se è giusto che calcoli il numero dei colli
|
||||
|
||||
@@ -14,7 +14,6 @@ import it.integry.ems_model.entity.common.DtbDocOrdR;
|
||||
import it.integry.ems_model.entity.common.DtbDocOrdT;
|
||||
import it.integry.ems_model.exception.DataConverterNotFoundException;
|
||||
import it.integry.ems_model.rules.util.DroolsUtil;
|
||||
import it.integry.ems_model.service.SetupGest;
|
||||
import it.integry.ems_model.types.OperationType;
|
||||
import it.integry.ems_model.utility.*;
|
||||
|
||||
@@ -961,8 +960,7 @@ public class DocOrdRules extends QueryRules {
|
||||
}
|
||||
|
||||
public static DtbOrdt completeDatiOrdProd(Connection connection, DtbOrdt dtbOrdt) throws Exception {
|
||||
SetupGest setup = new SetupGest();
|
||||
boolean disableTriggerOrdl = setup.getSetupBoolean(connection, "DTB_ORDT", "SETUP", "DISABLE_TRIGGER_ORDL");
|
||||
boolean disableTriggerOrdl = setupGest.getSetupBoolean(connection, "DTB_ORDT", "SETUP", "DISABLE_TRIGGER_ORDL");
|
||||
|
||||
if (!disableTriggerOrdl || (dtbOrdt.isGeneraOrdLavDaProd() && dtbOrdt.getParent() != null)) return null;
|
||||
|
||||
|
||||
@@ -2,11 +2,11 @@ package it.integry.ems.rules.completing;
|
||||
|
||||
import com.annimon.stream.Stream;
|
||||
import it.integry.common.var.CommonConstants;
|
||||
import it.integry.ems.sync.MultiDBTransaction.Connection;
|
||||
import it.integry.ems_model.db.ResultSetMapper;
|
||||
import it.integry.ems_model.entity.*;
|
||||
import it.integry.ems_model.entity.common.*;
|
||||
import it.integry.ems_model.rules.util.DroolsUtil;
|
||||
import it.integry.ems_model.service.SetupGest;
|
||||
import it.integry.ems_model.types.OperationType;
|
||||
import it.integry.ems_model.utility.*;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
@@ -14,13 +14,15 @@ import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import it.integry.ems.sync.MultiDBTransaction.Connection;
|
||||
|
||||
import java.sql.*;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.ResultSetMetaData;
|
||||
import java.sql.SQLException;
|
||||
import java.time.LocalDate;
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class PurchasesRules extends QueryRules {
|
||||
@@ -504,32 +506,26 @@ public class PurchasesRules extends QueryRules {
|
||||
}
|
||||
|
||||
public static Boolean checkChangeDataInizLisa(Connection conn, AtbListData entity) throws Exception {
|
||||
Boolean ret = false;
|
||||
Logger logger = LogManager.getLogger();
|
||||
String sql = "SELECT data_iniz FROM atb_list_data "
|
||||
+ "WHERE cod_alis = " + UtilityDB.valueToString(entity.getCodAlis()) + " AND "
|
||||
+ "versione = " + UtilityDB.valueToString(entity.getVersione()) + " AND "
|
||||
+ "data_iniz <> " + UtilityDB.valueToString(entity.getDataIniz()) + " AND "
|
||||
+ "cod_promo is null ";
|
||||
PreparedStatement ps = conn.prepareStatement(sql);
|
||||
ResultSet rs = ps.executeQuery();
|
||||
|
||||
if (rs.next()) {
|
||||
final Date dataIniz = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(conn, sql);
|
||||
|
||||
if (dataIniz != null) {
|
||||
String ls_message = "Data inizio modificata sul listino " + entity.getCodAlis() + " versione " + entity.getVersione().toString() + " Utente " + entity.getUsername();
|
||||
logger.error(ls_message);
|
||||
SetupGest setup = new SetupGest();
|
||||
String blocca = (String) setup.getSetup(conn, "W_ALISTDATA_RC", "DATA_INIZ", "CHK_VARIAZIONE");
|
||||
|
||||
if ("S".equals(blocca)) {
|
||||
ret = true;
|
||||
boolean blocca = setupGest.getSetupBoolean(conn, "W_ALISTDATA_RC", "DATA_INIZ", "CHK_VARIAZIONE");
|
||||
if (blocca) {
|
||||
throw new Exception("Impossibile modificare la data del listino " + entity.getCodAlis() + " versione " + entity.getVersione().toString());
|
||||
}
|
||||
}
|
||||
|
||||
rs.close();
|
||||
ps.close();
|
||||
|
||||
return ret;
|
||||
return false;
|
||||
}
|
||||
|
||||
public static Boolean checkScontiPromoAcq(Connection conn, AtbListData entity) throws Exception {
|
||||
|
||||
@@ -28,6 +28,7 @@ import it.integry.ems.json.ResponseJSONObjectMapper;
|
||||
import it.integry.ems.media.MediaImageService;
|
||||
import it.integry.ems.media.MediaVideoService;
|
||||
import it.integry.ems.media.MimeTypesHandler;
|
||||
import it.integry.ems.object_storage.minio.MinIOService;
|
||||
import it.integry.ems.properties.EmsProperties;
|
||||
import it.integry.ems.properties.EnvProperties;
|
||||
import it.integry.ems.response.EsitoType;
|
||||
@@ -138,6 +139,9 @@ public class EmsServices {
|
||||
@Autowired
|
||||
private BasicConnectionPool basicConnectionPool;
|
||||
|
||||
@Autowired
|
||||
private MinIOService minIOService;
|
||||
|
||||
public EntityImportResponse<List<EntityBase>> importEntity(String type, String format, ImportRequestDTO body, boolean headless) throws Exception {
|
||||
logger.debug("Starting import [Type: " + type + ", Format: " + format + "]");
|
||||
String gestName = "IMPORT_" + type;
|
||||
@@ -587,8 +591,6 @@ public class EmsServices {
|
||||
}
|
||||
|
||||
public AttachmentDTO downloadStbFileAttachment(String idAttach, boolean requestThumbnail) throws Exception {
|
||||
|
||||
|
||||
StbFilesAttached stbFilesAttached = new StbFilesAttached();
|
||||
stbFilesAttached.setIdAttach(idAttach);
|
||||
stbFilesAttached.setOperation(OperationType.SELECT_OBJECT);
|
||||
@@ -631,6 +633,17 @@ public class EmsServices {
|
||||
return null;
|
||||
}
|
||||
|
||||
public AttachmentDTO downloadFileFromRefUuid(String refUuid, String fileName) throws Exception {
|
||||
byte[] bytes = minIOService.downloadObject(refUuid, multiDBTransactionManager.getPrimaryConnection());
|
||||
String mimeType = mimeTypesHandler.getContentType(fileName).toString();
|
||||
|
||||
return new AttachmentDTO()
|
||||
.setFileContent(bytes)
|
||||
.setFileSize(bytes != null ? bytes.length : 0)
|
||||
.setMimeType(mimeType)
|
||||
.setFileName(fileName);
|
||||
}
|
||||
|
||||
public String createZipFromFiles(CreateZipDTO createZipDTO) throws Exception {
|
||||
if (createZipDTO == null) {
|
||||
throw new MissingDataException("createZipFromFiles");
|
||||
|
||||
@@ -255,8 +255,10 @@ public class EntityProcessor {
|
||||
entity.manageWithParentConnection(primaryDB);
|
||||
} else {
|
||||
|
||||
String profileDbDistributore = syncManager.getDistributoreProfileDb(currentProfileDb);
|
||||
// String profileDbDistributore = syncManager.getDistributoreProfileDb(currentProfileDb);
|
||||
String profileDbDistributore = multiDBTransactionManager.getDistributoreProfileName();
|
||||
List<StbSubscription> syncDetails = syncManager.getSyncDetailIfPresent(currentDB.getProfileName(), profileDbDistributore, entity.getTableName());
|
||||
|
||||
boolean isSyncActive = syncDetails != null && !syncDetails.isEmpty();
|
||||
boolean isCurrentlyOnDistributore = UtilityString.isNullOrEmpty(profileDbDistributore) || profileDbDistributore.equalsIgnoreCase(currentProfileDb);
|
||||
|
||||
@@ -264,11 +266,11 @@ public class EntityProcessor {
|
||||
logger.info("SINCRONIZZAZIONE su entity " + entity.getTableName() + " ONLINE: " + isSyncActive);
|
||||
|
||||
if (!isCurrentlyOnDistributore) {
|
||||
if (!multiDBTransactionManager.containsDB(profileDbDistributore)) {
|
||||
multiDBTransactionManager.addConnection(profileDbDistributore, true);
|
||||
}
|
||||
// if (!multiDBTransactionManager.containsDB(profileDbDistributore)) {
|
||||
// multiDBTransactionManager.addConnection(profileDbDistributore, true);
|
||||
// }
|
||||
|
||||
currentDB = multiDBTransactionManager.getDatabaseConnection(profileDbDistributore);
|
||||
currentDB = multiDBTransactionManager.addAndGetDistributoreConnection();
|
||||
}
|
||||
|
||||
StbSubscription syncDetail = syncDetails.stream()
|
||||
|
||||
@@ -40,7 +40,7 @@ public class MrpConsumiHandlerService {
|
||||
|
||||
|
||||
@Scheduled(fixedDelay = 1, timeUnit = TimeUnit.MINUTES, initialDelay = 60, zone = "Europe/Rome")
|
||||
private void updateData() throws Exception {
|
||||
private void updateData() {
|
||||
final List<AvailableConnectionsModel> availableConnections = settingsModel.getAvailableConnectionsWithoutDuplicatedProfiles(true);
|
||||
|
||||
for (AvailableConnectionsModel connectionModel : availableConnections) {
|
||||
|
||||
@@ -5,6 +5,8 @@ import it.integry.ems.expansion.ObservableField;
|
||||
import it.integry.ems_model.utility.UtilityString;
|
||||
import org.apache.logging.log4j.Level;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public class LoggerConfigurationModel {
|
||||
|
||||
|
||||
@@ -61,4 +63,15 @@ public class LoggerConfigurationModel {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (!(o instanceof LoggerConfigurationModel)) return false;
|
||||
LoggerConfigurationModel that = (LoggerConfigurationModel) o;
|
||||
return Objects.equals(getLevel(), that.getLevel()) && Objects.equals(getDeleteDays(), that.getDeleteDays()) && Objects.equals(getDbDeleteDays(), that.getDbDeleteDays()) && Objects.equals(getDbMaxSize(), that.getDbMaxSize());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(getLevel(), getDeleteDays(), getDbDeleteDays(), getDbMaxSize());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,15 +2,17 @@ package it.integry.ems.settings.Model;
|
||||
|
||||
import it.integry.ems.expansion.ObservableField;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public class MailConfigurationModel {
|
||||
|
||||
private ObservableField<String> from = new ObservableField<>();
|
||||
private ObservableField<String> smtp = new ObservableField<>();
|
||||
private ObservableField<Integer> port = new ObservableField<>();
|
||||
private ObservableField<Boolean> enableSSL = new ObservableField<>();
|
||||
private ObservableField<String> username = new ObservableField<>();
|
||||
private ObservableField<String> password = new ObservableField<>();
|
||||
private ObservableField<Boolean> encryptedPassword = new ObservableField<>();
|
||||
private final ObservableField<String> from = new ObservableField<>();
|
||||
private final ObservableField<String> smtp = new ObservableField<>();
|
||||
private final ObservableField<Integer> port = new ObservableField<>();
|
||||
private final ObservableField<Boolean> enableSSL = new ObservableField<>();
|
||||
private final ObservableField<String> username = new ObservableField<>();
|
||||
private final ObservableField<String> password = new ObservableField<>();
|
||||
private final ObservableField<Boolean> encryptedPassword = new ObservableField<>();
|
||||
|
||||
public String getFrom() {
|
||||
return from.get();
|
||||
@@ -69,4 +71,15 @@ public class MailConfigurationModel {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (!(o instanceof MailConfigurationModel)) return false;
|
||||
MailConfigurationModel that = (MailConfigurationModel) o;
|
||||
return Objects.equals(getFrom(), that.getFrom()) && Objects.equals(getSmtp(), that.getSmtp()) && Objects.equals(getPort(), that.getPort()) && Objects.equals(isEnableSSL(), that.isEnableSSL()) && Objects.equals(getUsername(), that.getUsername()) && Objects.equals(getPassword(), that.getPassword()) && Objects.equals(isEncryptedPassword(), that.isEncryptedPassword());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(getFrom(), getSmtp(), getPort(), isEnableSSL(), getUsername(), getPassword(), isEncryptedPassword());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,16 +5,17 @@ import it.integry.ems.expansion.ObservableArrayList;
|
||||
import it.integry.ems.expansion.ObservableField;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Objects;
|
||||
|
||||
public class MinIOSettingsModel {
|
||||
|
||||
private ObservableField<String> host = new ObservableField<>();
|
||||
private ObservableField<Integer> port = new ObservableField<>();
|
||||
private ObservableField<String> accessKey = new ObservableField<>();
|
||||
private ObservableField<String> secretKey = new ObservableField<>();
|
||||
private ObservableField<Boolean> enabled = new ObservableField<>();
|
||||
private ObservableField<Boolean> enableOldSave = new ObservableField<>();
|
||||
private ObservableArrayList<String> excludedEntities = new ObservableArrayList<>();
|
||||
private final ObservableField<String> host = new ObservableField<>();
|
||||
private final ObservableField<Integer> port = new ObservableField<>();
|
||||
private final ObservableField<String> accessKey = new ObservableField<>();
|
||||
private final ObservableField<String> secretKey = new ObservableField<>();
|
||||
private final ObservableField<Boolean> enabled = new ObservableField<>();
|
||||
private final ObservableField<Boolean> enableOldSave = new ObservableField<>();
|
||||
private final ObservableArrayList<String> excludedEntities = new ObservableArrayList<>();
|
||||
|
||||
public static MinIOSettingsModel getDefault() {
|
||||
return new MinIOSettingsModel()
|
||||
@@ -27,6 +28,18 @@ public class MinIOSettingsModel {
|
||||
.setExcludedEntities(new ArrayList<>());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (!(o instanceof MinIOSettingsModel)) return false;
|
||||
MinIOSettingsModel that = (MinIOSettingsModel) o;
|
||||
return Objects.equals(getHost(), that.getHost()) && Objects.equals(getPort(), that.getPort()) && Objects.equals(getAccessKey(), that.getAccessKey()) && Objects.equals(getSecretKey(), that.getSecretKey()) && Objects.equals(isEnabled(), that.isEnabled()) && Objects.equals(isEnableOldSave(), that.isEnableOldSave()) && Objects.equals(getExcludedEntities(), that.getExcludedEntities());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(getHost(), getPort(), getAccessKey(), getSecretKey(), isEnabled(), isEnableOldSave(), getExcludedEntities());
|
||||
}
|
||||
|
||||
public String getHost() {
|
||||
return host.get();
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import com.fasterxml.jackson.databind.DeserializationFeature;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import it.integry.ems.expansion.ObservableArrayList;
|
||||
import it.integry.ems.expansion.ObservableField;
|
||||
import it.integry.ems.settings.SettingsHelper;
|
||||
import it.integry.ems_model.utility.UtilityReflection;
|
||||
import it.integry.ems_model.utility.UtilityString;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
@@ -247,6 +248,7 @@ public class SettingsModel implements InitializingBean {
|
||||
if (getMinioConfiguration().getExcludedEntities() == null)
|
||||
getMinioConfiguration().setExcludedEntities(new ArrayList<>());
|
||||
|
||||
SettingsHelper.updateEMSSettings(this);
|
||||
this.saveOnFile();
|
||||
|
||||
String availableProfiles = System.getenv("AVAILABLE_PROFILES");
|
||||
@@ -289,4 +291,27 @@ public class SettingsModel implements InitializingBean {
|
||||
logger.error("SettingsModel", ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (!(o instanceof SettingsModel)) return false;
|
||||
SettingsModel that = (SettingsModel) o;
|
||||
return getAccessTokenExpireMinutes() == that.getAccessTokenExpireMinutes() &&
|
||||
getRefreshTokenExpireDays() == that.getRefreshTokenExpireDays() &&
|
||||
Objects.equals(getDefaultProfile(), that.getDefaultProfile()) &&
|
||||
Objects.equals(isPrimaryInstance(), that.isPrimaryInstance()) &&
|
||||
Objects.equals(isEnableTokenCaching(), that.isEnableTokenCaching()) &&
|
||||
Objects.equals(getSystemPassword(), that.getSystemPassword()) &&
|
||||
Objects.equals(getAvailableConnections(), that.getAvailableConnections()) &&
|
||||
Objects.equals(getDefaultMailConfiguration(), that.getDefaultMailConfiguration()) &&
|
||||
Objects.equals(getLoggerConfiguration(), that.getLoggerConfiguration()) &&
|
||||
Objects.equals(enablePermissionCheck, that.enablePermissionCheck) &&
|
||||
Objects.equals(getMinioConfiguration(), that.getMinioConfiguration());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(getAccessTokenExpireMinutes(), getRefreshTokenExpireDays(), getDefaultProfile(), isPrimaryInstance(), isEnableTokenCaching(), getSystemPassword(), getAvailableConnections(), getDefaultMailConfiguration(), getLoggerConfiguration(), enablePermissionCheck, getMinioConfiguration());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -117,6 +117,11 @@ public class SettingsController implements IFileWatcherEvents {
|
||||
public void onChange(File file) {
|
||||
try {
|
||||
SettingsModel newSettingsModel = objectMapper.readValue(settingsModel.getConfigurationFile(), SettingsModel.class);
|
||||
|
||||
if (newSettingsModel.equals(settingsModel))
|
||||
return;
|
||||
|
||||
|
||||
UtilityReflection.copyFields(newSettingsModel, settingsModel);
|
||||
|
||||
SettingsHelper.updateEMSSettings(settingsModel);
|
||||
|
||||
@@ -1,91 +0,0 @@
|
||||
package it.integry.ems.sync.MultiDBTransaction;
|
||||
|
||||
import it.integry.ems.datasource.DataSource;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Savepoint;
|
||||
|
||||
|
||||
public class AdvancedDataSource {
|
||||
|
||||
private String profileName;
|
||||
|
||||
private DataSource dataSource;
|
||||
|
||||
private boolean isDistributore;
|
||||
private boolean isInternalDb;
|
||||
|
||||
private Savepoint lastSavePoint;
|
||||
|
||||
public AdvancedDataSource(String profileName, DataSource dataSource, boolean isDistributore, boolean isInternalDb) {
|
||||
this.profileName = profileName;
|
||||
this.dataSource = dataSource;
|
||||
this.isDistributore = isDistributore;
|
||||
this.isInternalDb = isInternalDb;
|
||||
}
|
||||
|
||||
public void makeSavePoint() throws SQLException, IOException {
|
||||
if (!dataSource.isClosed()) {
|
||||
lastSavePoint = dataSource.getConnection().setSavepoint();
|
||||
}
|
||||
}
|
||||
|
||||
public void rollbackNow() throws SQLException, IOException {
|
||||
if (!dataSource.isClosed()) {
|
||||
if (lastSavePoint != null) {
|
||||
dataSource.getConnection().rollback(lastSavePoint);
|
||||
} else {
|
||||
dataSource.getConnection().rollback();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void commit() throws SQLException, IOException {
|
||||
if (!dataSource.isClosed()) {
|
||||
dataSource.getConnection().commit();
|
||||
}
|
||||
}
|
||||
|
||||
void close() throws SQLException, IOException {
|
||||
if (!dataSource.isClosed()) {
|
||||
dataSource.getConnection().close();
|
||||
}
|
||||
}
|
||||
|
||||
boolean isClosed() throws SQLException {
|
||||
return dataSource.isClosed();
|
||||
}
|
||||
|
||||
public Connection getConnection() throws IOException, SQLException {
|
||||
return dataSource.getConnection();
|
||||
}
|
||||
|
||||
public DataSource getDataSource() {
|
||||
return dataSource;
|
||||
}
|
||||
|
||||
public void setDataSource(DataSource dataSource) {
|
||||
this.dataSource = dataSource;
|
||||
}
|
||||
|
||||
public boolean getIsDistributore() {
|
||||
return isDistributore;
|
||||
}
|
||||
|
||||
public void setDistributore(boolean distributore) {
|
||||
isDistributore = distributore;
|
||||
}
|
||||
|
||||
public String getProfileName() {
|
||||
return profileName;
|
||||
}
|
||||
|
||||
public void setProfileName(String profileName) {
|
||||
this.profileName = profileName;
|
||||
}
|
||||
|
||||
public boolean isInternalDb() {
|
||||
return isInternalDb;
|
||||
}
|
||||
}
|
||||
@@ -10,9 +10,8 @@ import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.annotation.PreDestroy;
|
||||
import java.util.HashMap;
|
||||
import java.sql.SQLException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
@Component
|
||||
@@ -66,22 +65,14 @@ public class BasicConnectionPool {
|
||||
final List<AvailableConnectionsModel> availableConnections =
|
||||
settingsModel.getAvailableConnectionsWithoutDuplicatedProfiles(false);
|
||||
|
||||
// Inizializzazione parallela per performance massime
|
||||
availableConnections.parallelStream().forEach(model -> {
|
||||
for (AvailableConnectionsModel model : availableConnections) {
|
||||
try {
|
||||
String dbName = model.getDbName();
|
||||
registeredDatasources.computeIfAbsent(dbName, k -> {
|
||||
try {
|
||||
return createNewDataSource(model);
|
||||
} catch (Exception e) {
|
||||
logger.error("Errore creazione DataSource per {}", dbName, e);
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
});
|
||||
registerDataSourceIfNotExists(model);
|
||||
|
||||
} catch (Exception e) {
|
||||
logger.error("Errore durante inizializzazione connessione per {}", model.getDbName(), e);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private DataSource createNewDataSource(AvailableConnectionsModel connectionModel) throws Exception {
|
||||
@@ -90,36 +81,45 @@ public class BasicConnectionPool {
|
||||
return ds;
|
||||
}
|
||||
|
||||
public Connection getConnection(AvailableConnectionsModel connectionsModel) throws Exception {
|
||||
public Connection getConnection(AvailableConnectionsModel connectionsModel) throws SQLException {
|
||||
if (connectionsModel == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
String dbName = connectionsModel.getDbName();
|
||||
try {
|
||||
registerDataSourceIfNotExists(connectionsModel);
|
||||
|
||||
DataSource ds = registeredDatasources.get(dbName);
|
||||
String dbName = connectionsModel.getDbName();
|
||||
DataSource ds = registeredDatasources.get(dbName);
|
||||
|
||||
if (ds == null) {
|
||||
// Lazy initialization se il DataSource non esiste ancora
|
||||
ds = registeredDatasources.computeIfAbsent(dbName, k -> {
|
||||
try {
|
||||
return createNewDataSource(connectionsModel);
|
||||
} catch (Exception e) {
|
||||
logger.error("Errore creazione lazy DataSource per {}", dbName, e);
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
});
|
||||
if (ds == null) {
|
||||
throw new IllegalArgumentException("No datasource registered for profile: " + connectionsModel.getProfileName());
|
||||
}
|
||||
|
||||
Connection connection = ds.getConnection();
|
||||
if (!connection.getCatalog().equalsIgnoreCase(dbName)) {
|
||||
throw new IllegalArgumentException("Connection for profile " + connectionsModel.getProfileName() + " is not for database " + dbName);
|
||||
}
|
||||
|
||||
return connection;
|
||||
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
if (ds == null) {
|
||||
throw new IllegalArgumentException("No datasource registered for profile: " + connectionsModel.getProfileName());
|
||||
}
|
||||
|
||||
return ds.getConnection();
|
||||
}
|
||||
|
||||
public Map<String, DataSource> getRegisteredDataSources() {
|
||||
return new HashMap<>(registeredDatasources); // Return defensive copy
|
||||
|
||||
private void registerDataSourceIfNotExists(AvailableConnectionsModel connectionModel) throws Exception {
|
||||
String dbName = connectionModel.getDbName();
|
||||
registeredDatasources.computeIfAbsent(dbName, k -> {
|
||||
try {
|
||||
return createNewDataSource(connectionModel);
|
||||
} catch (Exception e) {
|
||||
logger.error("Errore creazione lazy DataSource per {}", dbName, e);
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -18,7 +18,6 @@ public class Connection implements java.sql.Connection {
|
||||
private long sessionId;
|
||||
|
||||
private String profileName;
|
||||
private boolean isDistributore;
|
||||
private boolean isInternalDb;
|
||||
|
||||
|
||||
@@ -347,16 +346,6 @@ public class Connection implements java.sql.Connection {
|
||||
this.profileName = profileName;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isDistributore() {
|
||||
return isDistributore;
|
||||
}
|
||||
|
||||
public Connection setDistributore(boolean distributore) {
|
||||
isDistributore = distributore;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isInternalDb() {
|
||||
return isInternalDb;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package it.integry.ems.sync.MultiDBTransaction;
|
||||
|
||||
import it.integry.common.var.EmsDBConst;
|
||||
import it.integry.ems._context.ApplicationContextProvider;
|
||||
import it.integry.ems.exception.DistributoreDatabaseNotPresentException;
|
||||
import it.integry.ems.exception.PrimaryDatabaseNotPresentException;
|
||||
import it.integry.ems.javabeans.RequestDataDTO;
|
||||
import it.integry.ems.properties.EmsProperties;
|
||||
@@ -20,7 +22,6 @@ import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
@Scope("request")
|
||||
@@ -42,6 +43,9 @@ public class MultiDBTransactionManager implements AutoCloseable {
|
||||
@Autowired
|
||||
private RequestDataDTO requestData;
|
||||
|
||||
@Autowired
|
||||
private EmsDBConst emsDBConst;
|
||||
|
||||
|
||||
private boolean enableLog = true;
|
||||
|
||||
@@ -91,21 +95,17 @@ public class MultiDBTransactionManager implements AutoCloseable {
|
||||
}
|
||||
|
||||
|
||||
public void addConnection(AvailableConnectionsModel availableConnectionsModel) throws Exception {
|
||||
this.addConnection(availableConnectionsModel.getProfileName());
|
||||
}
|
||||
|
||||
public void addConnection(String profileName) throws Exception {
|
||||
this.addConnection(profileName, false);
|
||||
}
|
||||
|
||||
public void addConnection(String profileName, boolean isDistributore) throws Exception {
|
||||
public void addConnection(String profileName) throws SQLException {
|
||||
AvailableConnectionsModel availableConnectionsModel = settingsModel.findConnectionModel(profileName);
|
||||
Connection connection = connectionPool.getConnection(availableConnectionsModel);
|
||||
this.addConnection(connection, isDistributore);
|
||||
this.addConnection(availableConnectionsModel);
|
||||
}
|
||||
|
||||
public void addConnection(Connection connection, boolean isDistributore) {
|
||||
public void addConnection(AvailableConnectionsModel availableConnectionsModel) throws SQLException {
|
||||
Connection connection = connectionPool.getConnection(availableConnectionsModel);
|
||||
this.addConnection(connection);
|
||||
}
|
||||
|
||||
private void addConnection(Connection connection) {
|
||||
if (allConnections != null) {
|
||||
if (requestData != null && requestData.getRequestURI() != null) {
|
||||
String methodName = " [" + requestData.getRequestURI() + "]";
|
||||
@@ -118,39 +118,24 @@ public class MultiDBTransactionManager implements AutoCloseable {
|
||||
connectionListLock.lock();
|
||||
try {
|
||||
allConnections.add(connection);
|
||||
|
||||
if (isDistributore) {
|
||||
allConnections = allConnections.stream()
|
||||
.sorted((o1, o2) -> {
|
||||
if (o1.isDistributore() && !o2.isDistributore()) return -1;
|
||||
else if (!o1.isDistributore() && o2.isDistributore()) return 1;
|
||||
else return 0;
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
} finally {
|
||||
connectionListLock.unlock();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean containsDB(final String dbName) {
|
||||
public boolean containsDB(final String profileDb) {
|
||||
if (allConnections != null) {
|
||||
return allConnections.stream()
|
||||
.anyMatch(advancedDataSource -> advancedDataSource.getProfileName().equalsIgnoreCase(dbName));
|
||||
.anyMatch(advancedDataSource -> advancedDataSource.getProfileName().equalsIgnoreCase(profileDb));
|
||||
} else return false;
|
||||
}
|
||||
|
||||
public Connection getDatabaseConnection(final String profileName) throws Exception {
|
||||
List<Connection> resultList = allConnections.stream()
|
||||
public Connection getDatabaseConnection(final String profileName) {
|
||||
return allConnections.stream()
|
||||
.filter(advancedDataSource -> advancedDataSource.getProfileName().equalsIgnoreCase(profileName))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
if (!resultList.isEmpty()) {
|
||||
return resultList.get(0);
|
||||
} else {
|
||||
throw new Exception("Database not present in connections list");
|
||||
}
|
||||
.findFirst()
|
||||
.orElseThrow(() -> new RuntimeException("Database not present in connections list"));
|
||||
}
|
||||
|
||||
|
||||
@@ -163,16 +148,23 @@ public class MultiDBTransactionManager implements AutoCloseable {
|
||||
}
|
||||
|
||||
public String getDistributoreProfileName() throws PrimaryDatabaseNotPresentException {
|
||||
for (Connection connection : allConnections) {
|
||||
if (connection.isDistributore()) {
|
||||
return connection.getProfileName();
|
||||
}
|
||||
}
|
||||
return getPrimaryConnection().getProfileName();
|
||||
|
||||
return emsDBConst.getConsts(getPrimaryConnection().getDbName())
|
||||
.getAzienda()
|
||||
.getDbDistributore();
|
||||
|
||||
}
|
||||
|
||||
public Connection getDistributoreConnection() throws Exception {
|
||||
return connectionPool.getConnection(settingsModel.findConnectionModel(getDistributoreProfileName()));
|
||||
public Connection addAndGetDistributoreConnection() throws DistributoreDatabaseNotPresentException, SQLException, PrimaryDatabaseNotPresentException {
|
||||
final String distributoreProfileName = getDistributoreProfileName();
|
||||
|
||||
if (distributoreProfileName == null)
|
||||
throw new DistributoreDatabaseNotPresentException();
|
||||
|
||||
if (!containsDB(distributoreProfileName))
|
||||
addConnection(distributoreProfileName);
|
||||
|
||||
return getDatabaseConnection(distributoreProfileName);
|
||||
}
|
||||
|
||||
|
||||
@@ -208,14 +200,9 @@ public class MultiDBTransactionManager implements AutoCloseable {
|
||||
|
||||
@Override
|
||||
public void close() throws Exception {
|
||||
connectionListLock.lock();
|
||||
try {
|
||||
this.commitAll();
|
||||
this.internalClose();
|
||||
this.primaryConnection = null;
|
||||
} finally {
|
||||
connectionListLock.unlock();
|
||||
}
|
||||
this.commitAll();
|
||||
this.internalClose();
|
||||
this.primaryConnection = null;
|
||||
}
|
||||
|
||||
private void internalClose() throws Exception {
|
||||
@@ -295,7 +282,7 @@ public class MultiDBTransactionManager implements AutoCloseable {
|
||||
primaryConnection = connectionPool.getConnection(connectionModel);
|
||||
|
||||
this.allConnections = new ArrayList<>();
|
||||
this.addConnection(primaryConnection, false);
|
||||
this.addConnection(primaryConnection);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -70,37 +70,36 @@ public class SyncManager {
|
||||
|
||||
try {
|
||||
logger.debug("Avvio sincronizzazione per " + entitySource.getTableName() + " su " + multiDBTransactionManager.getDistributoreProfileName());
|
||||
|
||||
Connection connection;
|
||||
EntityInterface entityToSave;
|
||||
|
||||
if (multiDBTransactionManager.getPrimaryConnection().getProfileName().equalsIgnoreCase(multiDBTransactionManager.getDistributoreProfileName())) {
|
||||
try {
|
||||
entitySource.manageWithParentConnection(multiDBTransactionManager.getPrimaryConnection());
|
||||
proceedSyncronization(entitySource, entityCloned, lastProfileUsed, multiDBTransactionManager);
|
||||
multiDBTransactionManager.getPrimaryConnection().commit();
|
||||
} catch (Exception e) {
|
||||
multiDBTransactionManager.getPrimaryConnection().rollback();
|
||||
throw e;
|
||||
}
|
||||
connection = multiDBTransactionManager.getPrimaryConnection();
|
||||
entityToSave = entitySource;
|
||||
} else {
|
||||
try (Connection distributoreConnection = multiDBTransactionManager.getDistributoreConnection()) {
|
||||
try {
|
||||
entityCloned.dataCompleting(distributoreConnection);
|
||||
entityCloned.manageWithParentConnection(distributoreConnection);
|
||||
connection = multiDBTransactionManager.addAndGetDistributoreConnection();
|
||||
entityToSave = entityCloned;
|
||||
|
||||
proceedSyncronization(entitySource, entityCloned, lastProfileUsed, multiDBTransactionManager);
|
||||
|
||||
distributoreConnection.commit();
|
||||
} catch (Exception e) {
|
||||
distributoreConnection.rollback();
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
entityToSave.dataCompleting(connection);
|
||||
}
|
||||
|
||||
entityToSave.manageWithParentConnection(connection);
|
||||
proceedSyncronization(entitySource, entityCloned, lastProfileUsed, multiDBTransactionManager);
|
||||
|
||||
multiDBTransactionManager.commitAll();
|
||||
|
||||
logger.debug("Fine sincronizzazione per " + entitySource.getTableName() + " su " + multiDBTransactionManager.getDistributoreProfileName());
|
||||
} catch (Exception e) {
|
||||
multiDBTransactionManager.rollbackAll();
|
||||
|
||||
String subscriptor = null;
|
||||
if (e instanceof SyncException) subscriptor = ((SyncException) e).getProfileDb();
|
||||
else {
|
||||
if (UtilityString.isNullOrEmpty(lastProfileUsed[0].toString())) subscriptor = "";
|
||||
else subscriptor = lastProfileUsed[0].toString();
|
||||
}
|
||||
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
objectMapper.writeValue(baos, entitySource);
|
||||
baos.close();
|
||||
@@ -226,7 +225,8 @@ public class SyncManager {
|
||||
|
||||
public String getDistributoreProfileDb(String profileDb) {
|
||||
return emsDBConst.getConstsByProfile(profileDb)
|
||||
.getAzienda().getDbDistributore();
|
||||
.getAzienda()
|
||||
.getDbDistributore();
|
||||
}
|
||||
|
||||
public List<StbSubscription> getSyncDetailIfPresent(String profileDb, String profileDbDistributore, String tableName) {
|
||||
|
||||
@@ -456,12 +456,6 @@ public class EmsRestConstants {
|
||||
public static final String PATH_ACCISE_GET_DATI = PATH + "acciseGetDati";
|
||||
public static final String PATH_ACCISE_GET_DATI_NEW = PATH + "get";
|
||||
public static final String PATH_ACCISE_WRITE_FILE = PATH + "acciseWriteFile";
|
||||
//amazon wrapper
|
||||
public static final String PATH_IMPORT_ORDERS_AMAZON = PATH + "importOrdersAmazon";
|
||||
public static final String PATH_ACK_ORDERS = PATH + "ackOrders";
|
||||
public static final String PATH_CONFIRM_FEED_WITH_TRACKID = PATH + "confirmFeedWithTracknumberId";
|
||||
public static final String PATH_FEED_SUBMISSION_RESULT = PATH + "feedSubmissionResult";
|
||||
public static final String PATH_UPDATE_QUANTITY_FEED = PATH + "updateQuantityFeed";
|
||||
// EMS CONTABIL
|
||||
public static final String PATH_SEPA_XML = PATH + "sepaXml";
|
||||
public static final String PATH_SEPA_SDD_XML = PATH + "sepaSDDXml";
|
||||
|
||||
@@ -344,7 +344,7 @@ public class ResultSetMapper {
|
||||
CsvSchema.Builder builder = new CsvSchema.Builder();
|
||||
builder.setColumnSeparator(separatorChar);
|
||||
builder.setUseHeader(useHeader);
|
||||
builder.setLineSeparator(System.getProperty("line.separator"));
|
||||
builder.setLineSeparator(System.lineSeparator());
|
||||
|
||||
ResultSetMetaData rsmd = rs.getMetaData();
|
||||
for (int i = 0; i < rsmd.getColumnCount(); i++) {
|
||||
|
||||
@@ -37,7 +37,7 @@ public class AtbForn extends EntityBase implements EquatableEntityInterface<AtbF
|
||||
@SqlField(value = "cod_paga", maxLength = 5)
|
||||
private String codPaga;
|
||||
|
||||
@SqlField(value = "porto", maxLength = 40)
|
||||
@SqlField(value = "porto", maxLength = 20)
|
||||
private String porto;
|
||||
|
||||
@SqlField(value = "mezzo", maxLength = 20)
|
||||
|
||||
@@ -231,6 +231,9 @@ public class Azienda extends EntityBase {
|
||||
@SqlField(value = "progressivo_sscc", nullable = false)
|
||||
private Long progressivoSscc;
|
||||
|
||||
@SqlField(value = "cod_sdi_ditta", maxLength = 7)
|
||||
private String codSdiDitta;
|
||||
|
||||
/**
|
||||
* Regime Fiscale
|
||||
*/
|
||||
@@ -977,4 +980,13 @@ public class Azienda extends EntityBase {
|
||||
this.progressivoSscc = progressivoSscc;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getCodSdiDitta() {
|
||||
return codSdiDitta;
|
||||
}
|
||||
|
||||
public Azienda setCodSdiDitta(String codSdiDitta) {
|
||||
this.codSdiDitta = codSdiDitta;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,6 +45,9 @@ public class CrlAmacArt extends EntityBase {
|
||||
@SqlField(value = "cod_mart", maxLength = 15)
|
||||
private String codMart;
|
||||
|
||||
@SqlField(value = "id_ricetta", maxLength = 25)
|
||||
private String idRicetta;
|
||||
|
||||
public CrlAmacArt() {
|
||||
super(logger);
|
||||
}
|
||||
@@ -112,4 +115,13 @@ public class CrlAmacArt extends EntityBase {
|
||||
public void setCodMart(String codMart) {
|
||||
this.codMart = codMart;
|
||||
}
|
||||
|
||||
public String getIdRicetta() {
|
||||
return idRicetta;
|
||||
}
|
||||
|
||||
public CrlAmacArt setIdRicetta(String idRicetta) {
|
||||
this.idRicetta = idRicetta;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,6 +74,9 @@ public class CtbAmac extends EntityBase {
|
||||
@EntityChild
|
||||
private List<CtbAmacManutenzioni> ctbAmacManutenzioni = new ArrayList<>();
|
||||
|
||||
@EntityChild
|
||||
private List<CtbAmacCarat> ctbAmacCarat = new ArrayList<>();
|
||||
|
||||
public CtbAmac() {
|
||||
super(logger);
|
||||
}
|
||||
@@ -204,6 +207,15 @@ public class CtbAmac extends EntityBase {
|
||||
return this;
|
||||
}
|
||||
|
||||
public List<CtbAmacCarat> getCtbAmacCarat() {
|
||||
return ctbAmacCarat;
|
||||
}
|
||||
|
||||
public CtbAmac setCtbAmacCarat(List<CtbAmacCarat> ctbAmacCarat) {
|
||||
this.ctbAmacCarat = ctbAmacCarat;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getNote() {
|
||||
return note;
|
||||
}
|
||||
@@ -233,6 +245,11 @@ public class CtbAmac extends EntityBase {
|
||||
for (CtbAmacManutenzioni ctbAmacManutenzione : getCtbAmacManutenzioni()) {
|
||||
ctbAmacManutenzione.manageWithParentConnection(connection, ctbAmacManutenzione.getOperation(), dataCompleting, entityHolder);
|
||||
}
|
||||
|
||||
for (CtbAmacCarat caratteristiche : getCtbAmacCarat()) {
|
||||
caratteristiche.manageWithParentConnection(connection, caratteristiche.getOperation(), dataCompleting, entityHolder);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -248,6 +265,8 @@ public class CtbAmac extends EntityBase {
|
||||
ctbAmacHistory.deleteAllEntities(connection, this);
|
||||
CtbAmacManutenzioni manutenzioni = new CtbAmacManutenzioni();
|
||||
manutenzioni.deleteAllEntities(connection, this);
|
||||
CtbAmacCarat caratteristiche = new CtbAmacCarat();
|
||||
caratteristiche.deleteAllEntities(connection, this);
|
||||
DtbOrdMacc dtbOrdMacc = new DtbOrdMacc();
|
||||
dtbOrdMacc.deleteAllEntities(connection, this);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,106 @@
|
||||
package it.integry.ems_model.entity;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonTypeName;
|
||||
import com.fasterxml.jackson.annotation.JsonValue;
|
||||
import it.integry.ems_model.annotation.*;
|
||||
import it.integry.ems_model.base.EntityBase;
|
||||
import it.integry.ems_model.entity._enum.IBaseEnum;
|
||||
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.Date;
|
||||
import java.util.List;
|
||||
|
||||
@PropertyReactive
|
||||
@Table(CtbAmacCarat.ENTITY)
|
||||
@JsonTypeName(CtbAmacCarat.ENTITY)
|
||||
public class CtbAmacCarat extends EntityBase {
|
||||
|
||||
private final static Logger logger = LogManager.getLogger();
|
||||
|
||||
public static final String ENTITY = "ctb_amac_carat";
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public CtbAmacCarat() {
|
||||
super(logger);
|
||||
}
|
||||
|
||||
|
||||
@Identity
|
||||
@PK
|
||||
@SqlField(value = "id", nullable = false)
|
||||
private long id;
|
||||
|
||||
@SqlField(value = "cod_cmac", maxLength = 20, nullable = false)
|
||||
private String codCmac;
|
||||
|
||||
@SqlField(value = "nome_carat", nullable = false, maxLength = 100)
|
||||
private String nomeCarat;
|
||||
|
||||
@SqlField(value = "val_carat", maxLength = 4000)
|
||||
private String valCarat;
|
||||
|
||||
@SqlField(value = "indice_ordinamento")
|
||||
private int indiceOrdinamento;
|
||||
|
||||
@SqlField(value = "field_bg", maxLength = 15)
|
||||
private String fieldBg;
|
||||
|
||||
|
||||
public long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public CtbAmacCarat setId(long id) {
|
||||
this.id = id;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getCodCmac() {
|
||||
return codCmac;
|
||||
}
|
||||
|
||||
public CtbAmacCarat setCodCmac(String codCmac) {
|
||||
this.codCmac = codCmac;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getNomeCarat() {
|
||||
return nomeCarat;
|
||||
}
|
||||
|
||||
public CtbAmacCarat setNomeCarat(String nomeCarat) {
|
||||
this.nomeCarat = nomeCarat;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getValCarat() {
|
||||
return valCarat;
|
||||
}
|
||||
|
||||
public CtbAmacCarat setValCarat(String valCarat) {
|
||||
this.valCarat = valCarat;
|
||||
return this;
|
||||
}
|
||||
|
||||
public int getIndiceOrdinamento() {
|
||||
return indiceOrdinamento;
|
||||
}
|
||||
|
||||
public CtbAmacCarat setIndiceOrdinamento(int indiceOrdinamento) {
|
||||
this.indiceOrdinamento = indiceOrdinamento;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getFieldBg() {
|
||||
return fieldBg;
|
||||
}
|
||||
|
||||
public CtbAmacCarat setFieldBg(String fieldBg) {
|
||||
this.fieldBg = fieldBg;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -25,7 +25,7 @@ public class GtbPorto extends EntityBase {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@PK
|
||||
@SqlField(value = "porto", maxLength = 40, nullable = false)
|
||||
@SqlField(value = "porto", maxLength = 20, nullable = false)
|
||||
private String porto;
|
||||
|
||||
@SqlField(value = "descrizione", maxLength = 40)
|
||||
|
||||
@@ -63,7 +63,7 @@ public class VtbClie extends EntityBase implements EquatableEntityInterface<VtbC
|
||||
@SqlField(value = "period_fat", maxLength = 20)
|
||||
private String periodFat;
|
||||
|
||||
@SqlField(value = "porto", maxLength = 40)
|
||||
@SqlField(value = "porto", maxLength = 20)
|
||||
private String porto;
|
||||
|
||||
@SqlField(value = "mezzo", maxLength = 20)
|
||||
|
||||
@@ -68,7 +68,7 @@ public class VtbListData extends EntityBase {
|
||||
@SqlField(value = "data_trasmissione_fine_promo")
|
||||
private Date dataTrasmissioneFinePromo;
|
||||
|
||||
@SqlField(value = "porto", maxLength = 40)
|
||||
@SqlField(value = "porto", maxLength = 20)
|
||||
private String porto;
|
||||
|
||||
private Integer cifreDec;
|
||||
|
||||
@@ -25,7 +25,7 @@ public class VtbVettLettPorto extends EntityBase {
|
||||
private String codLettVett;
|
||||
|
||||
@PK
|
||||
@SqlField(value = "porto", maxLength = 40, nullable = false)
|
||||
@SqlField(value = "porto", maxLength = 20, nullable = false)
|
||||
private String porto;
|
||||
|
||||
@SqlField(value = "cod_servizio", maxLength = 10)
|
||||
|
||||
@@ -82,7 +82,7 @@ public class VtbViaggi extends EntityBase {
|
||||
@SqlField(value = "cod_forn_trasp", maxLength = 5)
|
||||
private String codFornTrasp;
|
||||
|
||||
@SqlField(value = "incoterms", maxLength = 40)
|
||||
@SqlField(value = "incoterms", maxLength = 20)
|
||||
private String incoterms;
|
||||
|
||||
@SqlField(value = "note_incoterms", maxLength = 20)
|
||||
|
||||
@@ -112,7 +112,7 @@ public class WdtbNewCliOrd extends EntityBase {
|
||||
@SqlField(value = "mezzo", maxLength = 20)
|
||||
private String mezzo;
|
||||
|
||||
@SqlField(value = "porto", maxLength = 40)
|
||||
@SqlField(value = "porto", maxLength = 20)
|
||||
private String porto;
|
||||
|
||||
@SqlField(value = "tipo_azienda", maxLength = 5)
|
||||
|
||||
@@ -12,8 +12,10 @@ import it.integry.ems_model.config.EmsRestConstants;
|
||||
import it.integry.ems_model.utility.UtilityDB;
|
||||
import it.integry.firebase.service.FirebaseService;
|
||||
import org.kie.api.definition.type.PropertyReactive;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
@@ -99,32 +101,36 @@ public class WtbNotification extends EntityBase {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
public WtbNotification setId(Long id) {
|
||||
this.id = id;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
public WtbNotification setTitle(String title) {
|
||||
this.title = title;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getBody() {
|
||||
return body;
|
||||
}
|
||||
|
||||
public void setBody(String body) {
|
||||
public WtbNotification setBody(String body) {
|
||||
this.body = body;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getImageUrl() {
|
||||
return imageUrl;
|
||||
}
|
||||
|
||||
public void setImageUrl(String imageUrl) {
|
||||
public WtbNotification setImageUrl(String imageUrl) {
|
||||
this.imageUrl = imageUrl;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Map<String, String> getNotificationData() {
|
||||
@@ -136,7 +142,7 @@ public class WtbNotification extends EntityBase {
|
||||
}
|
||||
}
|
||||
|
||||
public void setNotificationData(Object notificationData) {
|
||||
public WtbNotification setNotificationData(Object notificationData) {
|
||||
try {
|
||||
if (notificationData != null) {
|
||||
Map<String, String> notificationDataMap = (Map<String, String>) notificationData;
|
||||
@@ -147,30 +153,34 @@ public class WtbNotification extends EntityBase {
|
||||
} catch (JsonProcessingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public Date getStartDate() {
|
||||
return startDate;
|
||||
}
|
||||
|
||||
public void setStartDate(Date startDate) {
|
||||
public WtbNotification setStartDate(Date startDate) {
|
||||
this.startDate = startDate;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Date getEndDate() {
|
||||
return endDate;
|
||||
}
|
||||
|
||||
public void setEndDate(Date endDate) {
|
||||
public WtbNotification setEndDate(Date endDate) {
|
||||
this.endDate = endDate;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Boolean isPersistent() {
|
||||
return persistent;
|
||||
}
|
||||
|
||||
public void setPersistent(Boolean persistent) {
|
||||
public WtbNotification setPersistent(Boolean persistent) {
|
||||
this.persistent = persistent;
|
||||
return this;
|
||||
}
|
||||
|
||||
public List<String> getTopics() {
|
||||
@@ -180,28 +190,31 @@ public class WtbNotification extends EntityBase {
|
||||
return Arrays.asList(topics.split(","));
|
||||
}
|
||||
|
||||
public void setTopics(List<String> topics) {
|
||||
public WtbNotification setTopics(List<String> topics) {
|
||||
if (topics != null) {
|
||||
this.topics = String.join(",", topics);
|
||||
} else {
|
||||
this.topics = "";
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public WtbNotificationImage getImageFile() {
|
||||
return imageFile;
|
||||
}
|
||||
|
||||
public void setImageFile(WtbNotificationImage imageFile) {
|
||||
public WtbNotification setImageFile(WtbNotificationImage imageFile) {
|
||||
this.imageFile = imageFile;
|
||||
return this;
|
||||
}
|
||||
|
||||
public List<WtbNotificationImage> getAttachments() {
|
||||
return attachments;
|
||||
}
|
||||
|
||||
public void setAttachments(List<WtbNotificationImage> attachments) {
|
||||
public WtbNotification setAttachments(List<WtbNotificationImage> attachments) {
|
||||
this.attachments = attachments;
|
||||
return this;
|
||||
}
|
||||
|
||||
public List<WtbDeviceNotification> getWtbDeviceNotifications() {
|
||||
@@ -214,8 +227,9 @@ public class WtbNotification extends EntityBase {
|
||||
}
|
||||
}
|
||||
|
||||
public void setWtbDeviceNotifications(List<WtbDeviceNotification> wtbDeviceNotifications) {
|
||||
public WtbNotification setWtbDeviceNotifications(List<WtbDeviceNotification> wtbDeviceNotifications) {
|
||||
this.wtbDeviceNotifications = wtbDeviceNotifications;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,14 +1,22 @@
|
||||
package it.integry.ems_model.utility;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonGenerator;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.dataformat.csv.CsvMapper;
|
||||
import com.fasterxml.jackson.dataformat.csv.CsvSchema;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.StringReader;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
public class UtilityCSV {
|
||||
|
||||
private final static CsvMapper mapper = new CsvMapper();
|
||||
|
||||
/**
|
||||
* Reads a CSV content from a string and returns its content as a list of lists of strings.
|
||||
*
|
||||
@@ -49,4 +57,31 @@ public class UtilityCSV {
|
||||
|
||||
return records;
|
||||
}
|
||||
|
||||
|
||||
public static String mapHashMapToCSV(List<HashMap<String, Object>> map, char separatorChar, Boolean useHeader, Boolean titleUpperCase, List<String> excludeColumn) throws JsonProcessingException {
|
||||
CsvSchema.Builder builder = new CsvSchema.Builder();
|
||||
builder.setColumnSeparator(separatorChar);
|
||||
builder.setUseHeader(useHeader);
|
||||
builder.setLineSeparator(System.lineSeparator());
|
||||
|
||||
String[] columnNames = map.get(0).keySet().toArray(new String[0]);
|
||||
|
||||
for (int i = 0; i < columnNames.length; i++) {
|
||||
String columnName = columnNames[i];
|
||||
if (excludeColumn == null || !excludeColumn.contains(columnName)) {
|
||||
if (titleUpperCase) {
|
||||
columnName = columnName.toUpperCase();
|
||||
}
|
||||
builder.addColumn(new CsvSchema.Column(i, columnName));
|
||||
}
|
||||
}
|
||||
CsvSchema schema = builder.build().withoutQuoteChar();
|
||||
|
||||
mapper.configure(JsonGenerator.Feature.IGNORE_UNKNOWN, true);
|
||||
return mapper
|
||||
.writer(schema)
|
||||
.writeValueAsString(map);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -4,7 +4,6 @@ import com.fasterxml.jackson.core.JsonGenerator;
|
||||
import com.fasterxml.jackson.dataformat.csv.CsvMapper;
|
||||
import com.fasterxml.jackson.dataformat.csv.CsvSchema;
|
||||
import it.integry.ems_model.db.ResultSetMapper;
|
||||
import org.apache.poi.hssf.record.crypto.Biff8DecryptingStream;
|
||||
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
||||
import org.apache.poi.ss.usermodel.Font;
|
||||
import org.apache.poi.ss.usermodel.Row;
|
||||
@@ -49,7 +48,7 @@ public class UtilityResultSet {
|
||||
CsvSchema.Builder builder = new CsvSchema.Builder();
|
||||
builder.setColumnSeparator(separatorChar);
|
||||
builder.setUseHeader(useHeader);
|
||||
builder.setLineSeparator(System.getProperty("line.separator"));
|
||||
builder.setLineSeparator(System.lineSeparator());
|
||||
|
||||
ResultSetMetaData rsmd = rs.getMetaData();
|
||||
for (int i = 0; i < rsmd.getColumnCount(); i++) {
|
||||
|
||||
@@ -12,6 +12,7 @@ import it.integry.ems_model.utility.UtilityDB;
|
||||
import it.integry.ems_model.utility.UtilityString;
|
||||
import it.integry.firebase.dto.CreateNotificationDTO;
|
||||
import it.integry.firebase.dto.MessageDTO;
|
||||
import it.integry.firebase.dto.ReadNotificationRequestDTO;
|
||||
import it.integry.firebase.enums.GetMode;
|
||||
import it.integry.firebase.service.DeviceTokenService;
|
||||
import it.integry.firebase.service.FirebaseService;
|
||||
@@ -52,127 +53,81 @@ public class NotificationController {
|
||||
private SetupGest setupGest;
|
||||
|
||||
@RequestMapping(method = RequestMethod.GET)
|
||||
public ServiceRestResponse get(HttpServletRequest request,
|
||||
@RequestParam(CommonConstants.PROFILE_DB) String configuration,
|
||||
public ServiceRestResponse get(@RequestParam(CommonConstants.PROFILE_DB) String configuration,
|
||||
@RequestParam(value = "mode", required = false, defaultValue = "ALL") GetMode mode,
|
||||
@RequestParam(value = "loadAttachedFiles", required = false, defaultValue = "false") Boolean loadAttachedFiles,
|
||||
@RequestParam(value = "forUser", required = false) String forUser) {
|
||||
try {
|
||||
return ServiceRestResponse.createPositiveResponse(notificationService.get(mode, loadAttachedFiles, forUser));
|
||||
} catch (Exception e) {
|
||||
logger.error(request.getRequestURI(), e);
|
||||
return ServiceRestResponse.createNegativeResponse(configuration, e);
|
||||
}
|
||||
@RequestParam(value = "forUser", required = false) String forUser) throws Exception {
|
||||
|
||||
return ServiceRestResponse.createPositiveResponse(notificationService.get(mode, loadAttachedFiles, forUser));
|
||||
}
|
||||
|
||||
@RequestMapping(method = RequestMethod.POST)
|
||||
public ServiceRestResponse create(HttpServletRequest request,
|
||||
@RequestParam(CommonConstants.PROFILE_DB) String configuration,
|
||||
@RequestBody CreateNotificationDTO createNotification) {
|
||||
try {
|
||||
return ServiceRestResponse.createEntityPositiveResponse(notificationService.create(createNotification));
|
||||
} catch (Exception e) {
|
||||
logger.error(request.getRequestURI(), e);
|
||||
return ServiceRestResponse.createNegativeResponse(configuration, e);
|
||||
}
|
||||
public ServiceRestResponse create(@RequestParam(CommonConstants.PROFILE_DB) String configuration,
|
||||
@RequestBody CreateNotificationDTO createNotification) throws Exception {
|
||||
|
||||
return ServiceRestResponse.createEntityPositiveResponse(notificationService.create(createNotification));
|
||||
|
||||
}
|
||||
|
||||
@RequestMapping(method = RequestMethod.PUT)
|
||||
public ServiceRestResponse update(HttpServletRequest request,
|
||||
@RequestParam(CommonConstants.PROFILE_DB) String configuration,
|
||||
@RequestBody CreateNotificationDTO createNotification) {
|
||||
try {
|
||||
return ServiceRestResponse.createEntityPositiveResponse(notificationService.update(createNotification));
|
||||
} catch (Exception e) {
|
||||
logger.error(request.getRequestURI(), e);
|
||||
return ServiceRestResponse.createNegativeResponse(configuration, e);
|
||||
}
|
||||
public ServiceRestResponse update(@RequestParam(CommonConstants.PROFILE_DB) String configuration,
|
||||
@RequestBody CreateNotificationDTO createNotification) throws Exception {
|
||||
|
||||
return ServiceRestResponse.createEntityPositiveResponse(notificationService.update(createNotification));
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/{id}", method = RequestMethod.DELETE)
|
||||
public ServiceRestResponse delete(HttpServletRequest request,
|
||||
@RequestParam(CommonConstants.PROFILE_DB) String configuration,
|
||||
@PathVariable("id") Long id) {
|
||||
try {
|
||||
notificationService.delete(id);
|
||||
@DeleteMapping(value = "/{id}")
|
||||
public ServiceRestResponse delete(@RequestParam(CommonConstants.PROFILE_DB) String configuration,
|
||||
@PathVariable("id") Long id) throws Exception {
|
||||
|
||||
return ServiceRestResponse.createPositiveResponse();
|
||||
} catch (Exception e) {
|
||||
logger.error(request.getRequestURI(), e);
|
||||
return ServiceRestResponse.createNegativeResponse(configuration, e);
|
||||
}
|
||||
notificationService.delete(id);
|
||||
return ServiceRestResponse.createPositiveResponse();
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/{id}/{attachId}", method = RequestMethod.DELETE)
|
||||
public ServiceRestResponse deleteAttachment(HttpServletRequest request,
|
||||
@RequestParam(CommonConstants.PROFILE_DB) String configuration,
|
||||
@DeleteMapping(value = "/all/{userName}")
|
||||
public ServiceRestResponse deleteAll(@RequestParam(CommonConstants.PROFILE_DB) String configuration,
|
||||
@PathVariable("userName") String userName) throws Exception {
|
||||
|
||||
notificationService.deleteByUser(configuration, userName);
|
||||
return ServiceRestResponse.createPositiveResponse();
|
||||
}
|
||||
|
||||
@DeleteMapping(value = "/{id}/{attachId}")
|
||||
public ServiceRestResponse deleteAttachment(@RequestParam(CommonConstants.PROFILE_DB) String configuration,
|
||||
@PathVariable("id") Long notificationId,
|
||||
@PathVariable("attachId") String attachId) {
|
||||
try {
|
||||
notificationService.deleteAttachment(notificationId, attachId);
|
||||
@PathVariable("attachId") String attachId) throws Exception {
|
||||
|
||||
return ServiceRestResponse.createPositiveResponse();
|
||||
} catch (Exception e) {
|
||||
logger.error(request.getRequestURI(), e);
|
||||
return ServiceRestResponse.createNegativeResponse(configuration, e);
|
||||
}
|
||||
notificationService.deleteAttachment(notificationId, attachId);
|
||||
return ServiceRestResponse.createPositiveResponse();
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/send/{id}", method = RequestMethod.GET)
|
||||
public ServiceRestResponse send(HttpServletRequest request,
|
||||
@RequestParam(CommonConstants.PROFILE_DB) String configuration,
|
||||
@PathVariable("id") Long id) {
|
||||
try {
|
||||
if (UtilityString.isNullOrEmpty(id)) {
|
||||
throw new Exception("Necessario l'id per identificare la notifica da mandare");
|
||||
}
|
||||
@GetMapping(value = "/send/{id}")
|
||||
public ServiceRestResponse send(@RequestParam(CommonConstants.PROFILE_DB) String configuration,
|
||||
@PathVariable("id") Long id) throws Exception {
|
||||
|
||||
return ServiceRestResponse.createEntityPositiveResponse(notificationService.send(id));
|
||||
} catch (Exception e) {
|
||||
logger.error(request.getRequestURI(), e);
|
||||
return ServiceRestResponse.createNegativeResponse(configuration, e);
|
||||
}
|
||||
return ServiceRestResponse.createEntityPositiveResponse(notificationService.send(id));
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/read", method = RequestMethod.POST)
|
||||
public ServiceRestResponse read(HttpServletRequest request,
|
||||
@RequestParam(CommonConstants.PROFILE_DB) String configuration,
|
||||
@RequestBody Map<String, Object> body) {
|
||||
try {
|
||||
String deviceToken = (String) body.get("deviceToken");
|
||||
long notificationId = ((Integer) body.get("notificationId")).longValue();
|
||||
@PostMapping(value = "/read")
|
||||
public ServiceRestResponse read(@RequestParam(CommonConstants.PROFILE_DB) String configuration,
|
||||
@RequestBody ReadNotificationRequestDTO body) throws Exception {
|
||||
|
||||
if (deviceToken == null || notificationId == 0) {
|
||||
throw new Exception("Necessario device token e notification id");
|
||||
}
|
||||
|
||||
return ServiceRestResponse.createEntityPositiveResponse(notificationService.read(deviceToken, notificationId));
|
||||
} catch (Exception e) {
|
||||
logger.error(request.getRequestURI(), e);
|
||||
return ServiceRestResponse.createNegativeResponse(configuration, e);
|
||||
}
|
||||
return ServiceRestResponse.createEntityPositiveResponse(notificationService.read(body));
|
||||
}
|
||||
|
||||
@RequestMapping(value = EmsRestConstants.PATH_NOTIF_SEND, method = RequestMethod.POST)
|
||||
@PostMapping(value = EmsRestConstants.PATH_NOTIF_SEND)
|
||||
public @ResponseBody
|
||||
ServiceRestResponse sendNotification(HttpServletRequest request,
|
||||
@RequestParam(CommonConstants.PROFILE_DB) String configuration,
|
||||
@RequestBody MessageDTO messageDTO) {
|
||||
ServiceRestResponse sendNotification(@RequestParam(CommonConstants.PROFILE_DB) String configuration,
|
||||
@RequestBody MessageDTO messageDTO) throws Exception {
|
||||
|
||||
try {
|
||||
Message.Builder builder = messageDTO.toBuilder();
|
||||
|
||||
if (messageDTO.getUserName() != null) {
|
||||
builder.setTopic(firebaseService.getUserTopic(multiDBTransactionManager.getPrimaryConnection(), messageDTO.getUserName()));
|
||||
}
|
||||
|
||||
firebaseService.sendMessage(multiDBTransactionManager.getPrimaryConnection(), builder.build());
|
||||
return ServiceRestResponse.createPositiveResponse("Notifica inviata.");
|
||||
} catch (Exception e) {
|
||||
logger.error(request.getRequestURI(), e);
|
||||
|
||||
return ServiceRestResponse.createNegativeResponse(e);
|
||||
Message.Builder builder = messageDTO.toBuilder();
|
||||
if (messageDTO.getUserName() != null) {
|
||||
builder.setTopic(firebaseService.getUserTopic(multiDBTransactionManager.getPrimaryConnection(), messageDTO.getUserName()));
|
||||
}
|
||||
|
||||
firebaseService.sendMessage(multiDBTransactionManager.getPrimaryConnection(), builder.build());
|
||||
return ServiceRestResponse.createPositiveResponse("Notifica inviata.");
|
||||
|
||||
}
|
||||
|
||||
@RequestMapping(value = EmsRestConstants.PATH_NOTIF_SEND_USER_DEVICES, method = RequestMethod.POST)
|
||||
|
||||
@@ -16,23 +16,26 @@ public class CreateNotificationDTO {
|
||||
return wtbNotification;
|
||||
}
|
||||
|
||||
public void setWtbNotification(WtbNotification wtbNotification) {
|
||||
public CreateNotificationDTO setWtbNotification(WtbNotification wtbNotification) {
|
||||
this.wtbNotification = wtbNotification;
|
||||
return this;
|
||||
}
|
||||
|
||||
public StbFilesAttached getImageFile() {
|
||||
return imageFile;
|
||||
}
|
||||
|
||||
public void setImageFile(StbFilesAttached imageFile) {
|
||||
public CreateNotificationDTO setImageFile(StbFilesAttached imageFile) {
|
||||
this.imageFile = imageFile;
|
||||
return this;
|
||||
}
|
||||
|
||||
public List<StbFilesAttached> getAttachments() {
|
||||
return attachments;
|
||||
}
|
||||
|
||||
public void setAttachments(List<StbFilesAttached> attachments) {
|
||||
public CreateNotificationDTO setAttachments(List<StbFilesAttached> attachments) {
|
||||
this.attachments = attachments;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
package it.integry.firebase.dto;
|
||||
|
||||
public class ReadNotificationRequestDTO {
|
||||
|
||||
private String deviceToken;
|
||||
private String username;
|
||||
private long notificationId;
|
||||
|
||||
public String getDeviceToken() {
|
||||
return deviceToken;
|
||||
}
|
||||
|
||||
public ReadNotificationRequestDTO setDeviceToken(String deviceToken) {
|
||||
this.deviceToken = deviceToken;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getUsername() {
|
||||
return username;
|
||||
}
|
||||
|
||||
public ReadNotificationRequestDTO setUsername(String username) {
|
||||
this.username = username;
|
||||
return this;
|
||||
}
|
||||
|
||||
public long getNotificationId() {
|
||||
return notificationId;
|
||||
}
|
||||
|
||||
public ReadNotificationRequestDTO setNotificationId(long notificationId) {
|
||||
this.notificationId = notificationId;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -97,9 +97,10 @@ public class FirebaseService {
|
||||
}
|
||||
|
||||
public String sendMessage(Connection connection, Message message) throws Exception {
|
||||
if (!this.isInitialized(connection)) {
|
||||
throw new FirebaseNotReadyException();
|
||||
}
|
||||
if (!this.isInitialized(connection)) throw new FirebaseNotReadyException();
|
||||
|
||||
if (this.isDryRun(connection))
|
||||
logger.debug("Invio notifica Firebase in dry run: \n{}", message);
|
||||
|
||||
return getFirebaseMessaging(connection).send(message, this.isDryRun(connection));
|
||||
}
|
||||
|
||||
@@ -11,11 +11,13 @@ import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
|
||||
import it.integry.ems_model.config.EmsRestConstants;
|
||||
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.UtilityString;
|
||||
import it.integry.firebase.dto.CreateNotificationDTO;
|
||||
import it.integry.firebase.dto.MessageDTO;
|
||||
import it.integry.firebase.dto.ReadNotificationRequestDTO;
|
||||
import it.integry.firebase.enums.GetMode;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
@@ -345,6 +347,30 @@ public class NotificationService {
|
||||
entityProcessor.processEntity(notification, multiDBTransactionManager);
|
||||
}
|
||||
|
||||
public void deleteByUser(String profileDb, String userName) throws Exception {
|
||||
if (UtilityString.isNullOrEmpty(userName)) throw new Exception("Impossibile eliminare le notifiche!");
|
||||
|
||||
String topic = String.format("user_%s_%s", userName.toLowerCase(), profileDb.toLowerCase());
|
||||
|
||||
String sql = Query.format(
|
||||
"SELECT id\n" +
|
||||
"FROM wtb_notification\n" +
|
||||
"WHERE topics = %s",
|
||||
topic
|
||||
);
|
||||
List<HashMap<String, Object>> notifications = UtilityDB.executeSimpleQuery(multiDBTransactionManager.getPrimaryConnection(), sql);
|
||||
|
||||
if (!notifications.isEmpty()) {
|
||||
for (HashMap<String, Object> notification : notifications) {
|
||||
Long id = UtilityHashMap.getValueIfExists(notification, "id");
|
||||
|
||||
if (id != null) {
|
||||
this.delete(id);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void deleteAttachment(Long notificationId, String attachId) throws Exception {
|
||||
if (UtilityString.isNullOrEmpty(notificationId) || UtilityString.isNullOrEmpty(attachId)) {
|
||||
throw new Exception("Impossibile eliminare allegato senza id della notifica ed id dell'allegato");
|
||||
@@ -374,6 +400,9 @@ public class NotificationService {
|
||||
}
|
||||
|
||||
public WtbNotification send(Long id) throws Exception {
|
||||
if (UtilityString.isNullOrEmpty(id))
|
||||
throw new Exception("Necessario l'id per identificare la notifica da mandare");
|
||||
|
||||
WtbNotification notification = new WtbNotification();
|
||||
|
||||
notification.setOperation(OperationType.SELECT_OBJECT);
|
||||
@@ -401,10 +430,6 @@ public class NotificationService {
|
||||
builder.setToken(deviceToken);
|
||||
|
||||
try {
|
||||
if (firebaseService.isDryRun(multiDBTransactionManager.getPrimaryConnection())) {
|
||||
logger.debug("Invio notifica Firebase in dry run: \n" + notification);
|
||||
}
|
||||
|
||||
firebaseService.sendMessage(multiDBTransactionManager.getPrimaryConnection(), builder.build());
|
||||
|
||||
deviceNotification = new WtbDeviceNotification();
|
||||
@@ -431,12 +456,21 @@ public class NotificationService {
|
||||
return notification;
|
||||
}
|
||||
|
||||
public WtbNotification read(String deviceToken, long notificationId) throws Exception {
|
||||
String sql = String.format(
|
||||
"select id, device_token, user_name, app_name, platform " +
|
||||
"from %s where device_token = '%s'",
|
||||
WtbUserDeviceToken.ENTITY,
|
||||
deviceToken
|
||||
public WtbNotification read(ReadNotificationRequestDTO readRequest) throws Exception {
|
||||
if ((readRequest.getDeviceToken() == null && readRequest.getUsername() == null) || readRequest.getNotificationId() == 0)
|
||||
throw new Exception("Necessario device token o username e notification id");
|
||||
|
||||
String sql = Query.format(
|
||||
"SELECT id,\n" +
|
||||
" device_token,\n" +
|
||||
" user_name,\n" +
|
||||
" app_name,\n" +
|
||||
" platform\n" +
|
||||
"FROM wtb_user_device_tokens\n" +
|
||||
"WHERE (%s IS NULL OR device_token = %s)\n" +
|
||||
" OR (%s IS NULL OR user_name = %s)",
|
||||
readRequest.getDeviceToken(), readRequest.getDeviceToken(),
|
||||
readRequest.getUsername(), readRequest.getUsername()
|
||||
);
|
||||
|
||||
List<WtbUserDeviceToken> userDeviceTokens = UtilityDB.executeSimpleQueryDTO(
|
||||
@@ -448,54 +482,52 @@ public class NotificationService {
|
||||
WtbNotification notification = new WtbNotification();
|
||||
|
||||
notification.setOperation(OperationType.SELECT_OBJECT);
|
||||
notification.setId(notificationId);
|
||||
notification.setId(readRequest.getNotificationId());
|
||||
|
||||
notification = entityProcessor.processEntity(notification, multiDBTransactionManager);
|
||||
|
||||
if (userDeviceTokens != null && !userDeviceTokens.isEmpty()) {
|
||||
WtbUserDeviceToken userDeviceToken = userDeviceTokens.get(0);
|
||||
for (WtbUserDeviceToken userDeviceToken : userDeviceTokens) {
|
||||
sql = Query.format(
|
||||
"SELECT user_device_id,\n" +
|
||||
" notification_id,\n" +
|
||||
" read_date\n" +
|
||||
"FROM wtb_device_notification\n" +
|
||||
"WHERE user_device_id = %s\n" +
|
||||
" AND notification_id = %s",
|
||||
userDeviceToken.getId(),
|
||||
readRequest.getNotificationId()
|
||||
);
|
||||
|
||||
sql = String.format(
|
||||
"select " +
|
||||
"user_device_id," +
|
||||
"notification_id," +
|
||||
"read_date " +
|
||||
"from %s where " +
|
||||
"user_device_id = %s and " +
|
||||
"notification_id = %s",
|
||||
WtbDeviceNotification.ENTITY,
|
||||
userDeviceToken.getId(),
|
||||
notificationId
|
||||
);
|
||||
List<WtbDeviceNotification> deviceNotifications =
|
||||
UtilityDB.executeSimpleQueryDTO(multiDBTransactionManager.getPrimaryConnection(), sql, WtbDeviceNotification.class);
|
||||
|
||||
List<WtbDeviceNotification> deviceNotifications =
|
||||
UtilityDB.executeSimpleQueryDTO(multiDBTransactionManager.getPrimaryConnection(), sql, WtbDeviceNotification.class);
|
||||
WtbDeviceNotification deviceNotification;
|
||||
|
||||
WtbDeviceNotification deviceNotification;
|
||||
if (deviceNotifications != null && !deviceNotifications.isEmpty()) {
|
||||
deviceNotification = deviceNotifications.get(0);
|
||||
|
||||
if (deviceNotifications != null && !deviceNotifications.isEmpty()) {
|
||||
deviceNotification = deviceNotifications.get(0);
|
||||
deviceNotification.setOperation(OperationType.UPDATE);
|
||||
deviceNotification.setReadNow();
|
||||
|
||||
deviceNotification.setOperation(OperationType.UPDATE);
|
||||
deviceNotification.setReadNow();
|
||||
notification.setWtbDeviceNotifications(deviceNotifications);
|
||||
} else {
|
||||
deviceNotification = new WtbDeviceNotification();
|
||||
|
||||
notification.setWtbDeviceNotifications(deviceNotifications);
|
||||
} else {
|
||||
deviceNotification = new WtbDeviceNotification();
|
||||
deviceNotification.setOperation(OperationType.INSERT_OR_UPDATE);
|
||||
deviceNotification.setUserDeviceId(userDeviceToken.getId());
|
||||
deviceNotification.setNotificationId(readRequest.getNotificationId());
|
||||
deviceNotification.setReadNow();
|
||||
|
||||
deviceNotification.setOperation(OperationType.INSERT_OR_UPDATE);
|
||||
deviceNotification.setUserDeviceId(userDeviceToken.getId());
|
||||
deviceNotification.setNotificationId(notificationId);
|
||||
deviceNotification.setReadNow();
|
||||
notification.addWtbDeviceNotification(deviceNotification);
|
||||
}
|
||||
|
||||
notification.addWtbDeviceNotification(deviceNotification);
|
||||
notification.setOperation(OperationType.NO_OP);
|
||||
entityProcessor.processEntity(notification, multiDBTransactionManager);
|
||||
|
||||
notification.setOperation(OperationType.SELECT_OBJECT);
|
||||
Stream.of(notification.getWtbDeviceNotifications()).forEach(wtbDeviceNotification -> wtbDeviceNotification.setOperation(OperationType.SELECT_OBJECT));
|
||||
}
|
||||
|
||||
notification.setOperation(OperationType.NO_OP);
|
||||
entityProcessor.processEntity(notification, multiDBTransactionManager);
|
||||
|
||||
notification.setOperation(OperationType.SELECT_OBJECT);
|
||||
Stream.of(notification.getWtbDeviceNotifications()).forEach(wtbDeviceNotification -> wtbDeviceNotification.setOperation(OperationType.SELECT_OBJECT));
|
||||
}
|
||||
|
||||
return notification;
|
||||
|
||||
@@ -105,7 +105,6 @@
|
||||
</excludeClasses>
|
||||
<excludeClassPatterns>
|
||||
<excludeClassPattern>it.integry.ems.contabil.**</excludeClassPattern>
|
||||
<excludeClassPattern>it.integry.ems.order.amazon.**</excludeClassPattern>
|
||||
</excludeClassPatterns>
|
||||
<outputFile>../ts/ems-engine.module.ts</outputFile>
|
||||
<outputKind>module</outputKind>
|
||||
@@ -142,25 +141,6 @@
|
||||
<version>${spring.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- AMAZON -->
|
||||
<dependency>
|
||||
<groupId>com.amazonservices.mws</groupId>
|
||||
<artifactId>MWSOrders_2013-09-01</artifactId>
|
||||
<version>1.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.amazonservices.mws</groupId>
|
||||
<artifactId>MaWSJavaClientLibrary</artifactId>
|
||||
<version>1.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.amazonservices.mws</groupId>
|
||||
<artifactId>MWSClientJavaRuntime</artifactId>
|
||||
<version>1.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.ancientprogramming.fixedformat4j</groupId>
|
||||
<artifactId>fixedformat4j</artifactId>
|
||||
|
||||
@@ -864,7 +864,7 @@ public class SteUPService {
|
||||
"descrizione, \n" +
|
||||
(chkRotturaStock ? "mvw_barcode.cod_barre" : "griglia.bar_code") + " as barcode, \n" +
|
||||
"cod_msgr\n " +
|
||||
" from steup_getGrigliaVendita(" + UtilityDB.valueToString(codMdep) + "," + UtilityDB.valueToString(codJfas) + ") griglia " +
|
||||
" from steup_getGrigliaVendita(" + UtilityDB.valueToString(codMdep) + "," + UtilityDB.valueToString(codJfas) + ", " + UtilityDB.valueToString(dataCreation) + ") griglia " +
|
||||
(chkRotturaStock ? " INNER JOIN mvw_barcode on griglia.cod_mart_kit = mvw_barcode.cod_mart " : "") +
|
||||
" WHERE griglia.cod_mart NOT IN (SELECT cod_mart\n" +
|
||||
" FROM (SELECT cod_mart,\n" +
|
||||
|
||||
@@ -3,12 +3,12 @@ package it.integry.ems.contabil.Import.service;
|
||||
import com.annimon.stream.ComparatorCompat;
|
||||
import com.annimon.stream.Stream;
|
||||
import it.integry.common.var.CommonConstants;
|
||||
import it.integry.common.var.EmsDBConst;
|
||||
import it.integry.ems.Import.dto.AnomalieDTO;
|
||||
import it.integry.ems.Import.dto.ImportRequestDTO;
|
||||
import it.integry.ems.contabil.Import.dto.MovPagheDTO;
|
||||
import it.integry.ems.contabil.Import.dto.MovimentiContabiliDocfinanceDTO;
|
||||
import it.integry.ems.contabil.bancaditalia.service.TassiDiCambioService;
|
||||
import it.integry.ems.datasource.DataSource;
|
||||
import it.integry.ems.file_formatter.csv.CsvMapper;
|
||||
import it.integry.ems.file_formatter.txt.TxtMapper;
|
||||
import it.integry.ems.rules.businessLogic.AccountingBusinessLogic;
|
||||
@@ -37,38 +37,45 @@ import java.util.stream.Collectors;
|
||||
public class ContabilImportService {
|
||||
@Autowired
|
||||
private EntityProcessor entityProcessor;
|
||||
|
||||
@Autowired
|
||||
private MultiDBTransactionManager multiDBTransactionManager;
|
||||
|
||||
@Autowired
|
||||
private SetupGest setupGest;
|
||||
|
||||
@Autowired
|
||||
private MailService mailService;
|
||||
|
||||
@Autowired
|
||||
private TassiDiCambioService tassiDiCambioService;
|
||||
|
||||
@Autowired
|
||||
private EmsDBConst emsDBConst;
|
||||
|
||||
public List<EntityBase> importMovIngragruppo(String type, String format, String whereCond) throws Exception {
|
||||
List<EntityBase> movimenti = new ArrayList<>();
|
||||
|
||||
DataSource dbPrimary = new DataSource();
|
||||
String dbDistriburtore = null;
|
||||
HashMap<String, Object> datiAzienda = Azienda.getDatiAzienda(multiDBTransactionManager.getPrimaryConnection());
|
||||
if (datiAzienda == null || UtilityString.isNullOrEmpty(datiAzienda.get("db_distributore"))) {
|
||||
|
||||
String dbDistriburtore = multiDBTransactionManager.getDistributoreProfileName();
|
||||
if (UtilityString.isNullOrEmpty(dbDistriburtore))
|
||||
throw new Exception("DB Distributore non trovato.");
|
||||
} else {
|
||||
dbDistriburtore = (String) datiAzienda.get("db_distributore");
|
||||
dbPrimary.initialize(dbDistriburtore);
|
||||
}
|
||||
|
||||
|
||||
Azienda datiAzienda = Azienda.getDefaultAzienda(multiDBTransactionManager.getPrimaryConnection());
|
||||
|
||||
Connection dbDistributoreConnectin = multiDBTransactionManager.addAndGetDistributoreConnection();
|
||||
|
||||
String sql =
|
||||
"SELECT aziende_gruppo.cod_anag " +
|
||||
" FROM aziende_gruppo, gtb_anag " +
|
||||
" WHERE aziende_gruppo.cod_anag = gtb_anag.cod_anag and " +
|
||||
" gtb_anag.part_iva = " + UtilityDB.valueToString(datiAzienda.get("part_iva"));
|
||||
String codAnagAzienda = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(dbPrimary.getConnection(), sql);
|
||||
" gtb_anag.part_iva = " + UtilityDB.valueToString(datiAzienda.getPartIva());
|
||||
String codAnagAzienda = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(dbDistributoreConnectin, sql);
|
||||
|
||||
if (UtilityString.isNullOrEmpty(codAnagAzienda)) {
|
||||
if (UtilityString.isNullOrEmpty(codAnagAzienda))
|
||||
throw new Exception("Azienda non appartenente al gruppo o db distributore errato.");
|
||||
}
|
||||
|
||||
|
||||
|
||||
String selectMov =
|
||||
@@ -93,7 +100,7 @@ public class ContabilImportService {
|
||||
" FROM ctb_movt " +
|
||||
" WHERE ctb_movt.stam_gio = 'N' AND ctb_movt.num_cmov in (" + selectMov + ")";
|
||||
ResultSetMapper ctbMovtMapper = new ResultSetMapper();
|
||||
List<CtbMovt> listaMov = ctbMovtMapper.mapQuerySetToList(dbPrimary.getConnection(), sql, CtbMovt.class, OperationType.INSERT);
|
||||
List<CtbMovt> listaMov = ctbMovtMapper.mapQuerySetToList(dbDistributoreConnectin, sql, CtbMovt.class, OperationType.INSERT);
|
||||
|
||||
for (CtbMovt ctbMovt : listaMov) {
|
||||
Integer numCmovOrig = ctbMovt.getNumCmov();
|
||||
@@ -105,7 +112,7 @@ public class ContabilImportService {
|
||||
"SELECT * FROM ctb_movi WHERE ctb_movi.num_cmov = " + UtilityDB.valueToString(numCmovOrig);
|
||||
|
||||
ResultSetMapper ctbMoviMapper = new ResultSetMapper();
|
||||
List<CtbMovi> ctbMovi = ctbMoviMapper.mapQuerySetToList(dbPrimary.getConnection(), sqlRighe, CtbMovi.class, OperationType.INSERT);
|
||||
List<CtbMovi> ctbMovi = ctbMoviMapper.mapQuerySetToList(dbDistributoreConnectin, sqlRighe, CtbMovi.class, OperationType.INSERT);
|
||||
|
||||
if (ctbMovi != null) {
|
||||
ctbMovt.setCtbMovi(ctbMovi);
|
||||
@@ -115,7 +122,7 @@ public class ContabilImportService {
|
||||
"SELECT * FROM ctb_movr WHERE ctb_movr.num_cmov = " + UtilityDB.valueToString(numCmovOrig);
|
||||
|
||||
ResultSetMapper ctbMovrMapper = new ResultSetMapper();
|
||||
List<CtbMovr> ctbMovr = ctbMovrMapper.mapQuerySetToList(dbPrimary.getConnection(), sqlRighe, CtbMovr.class, OperationType.INSERT);
|
||||
List<CtbMovr> ctbMovr = ctbMovrMapper.mapQuerySetToList(dbDistributoreConnectin, sqlRighe, CtbMovr.class, OperationType.INSERT);
|
||||
|
||||
if (ctbMovr != null) {
|
||||
ctbMovt.setCtbMovr(ctbMovr);
|
||||
@@ -133,7 +140,7 @@ public class ContabilImportService {
|
||||
" ORDER BY ctb_scad.id_riga";
|
||||
|
||||
ResultSetMapper ctbScadMapper = new ResultSetMapper();
|
||||
List<CtbScad> ctbScad = ctbScadMapper.mapQuerySetToList(dbPrimary.getConnection(), sqlRighe, CtbScad.class, OperationType.INSERT);
|
||||
List<CtbScad> ctbScad = ctbScadMapper.mapQuerySetToList(dbDistributoreConnectin, sqlRighe, CtbScad.class, OperationType.INSERT);
|
||||
|
||||
if (ctbScad != null) {
|
||||
ctbMovt.setCtbScad(ctbScad);
|
||||
@@ -144,10 +151,10 @@ public class ContabilImportService {
|
||||
movimenti.add(ctbMovt);
|
||||
try {
|
||||
String sqlUpdate = "UPDATE ctb_movt SET ctb_movt.stam_gio = 'S' WHERE ctb_movt.num_cmov = " + UtilityDB.valueToString(numCmovOrig);
|
||||
dbPrimary.getConnection().createStatement().executeUpdate(sqlUpdate);
|
||||
dbPrimary.getConnection().commit();
|
||||
dbDistributoreConnectin.createStatement().executeUpdate(sqlUpdate);
|
||||
dbDistributoreConnectin.commit();
|
||||
} catch (Exception e) {
|
||||
dbPrimary.getConnection().rollback();
|
||||
dbDistributoreConnectin.rollback();
|
||||
throw new Exception("Errore durante l'aggiornametno del movimento contabile sul db " + dbDistriburtore + "." + e.getMessage());
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -2,7 +2,6 @@ package it.integry.ems.contabil.service;
|
||||
|
||||
import it.integry.common.var.CommonConstants;
|
||||
import it.integry.ems.contabil.dto.AutofatturaDTO;
|
||||
import it.integry.ems.datasource.DataSource;
|
||||
import it.integry.ems.rules.businessLogic.AccountingBusinessLogic;
|
||||
import it.integry.ems.service.EntityProcessor;
|
||||
import it.integry.ems.service.MailService;
|
||||
|
||||
@@ -24,6 +24,8 @@ public class DocumentiProdDaFabbDTO {
|
||||
|
||||
private String generaScarico;
|
||||
|
||||
private String generaCaricoMatricola;
|
||||
|
||||
public String getGestione() {
|
||||
return gestione;
|
||||
}
|
||||
@@ -94,4 +96,12 @@ public class DocumentiProdDaFabbDTO {
|
||||
public void setGeneraScarico(String generaScarico) {
|
||||
this.generaScarico = generaScarico;
|
||||
}
|
||||
|
||||
public String getGeneraCaricoMatricola() {
|
||||
return generaCaricoMatricola;
|
||||
}
|
||||
|
||||
public void setGeneraCaricoMatricola(String generaCaricoMatricola) {
|
||||
this.generaCaricoMatricola = generaCaricoMatricola;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@ package it.integry.ems.document.Import.service;
|
||||
|
||||
import it.integry.common.var.CommonConstants;
|
||||
import it.integry.ems.Import.dto.AnomalieDTO;
|
||||
import it.integry.ems.datasource.DataSource;
|
||||
import it.integry.ems.document.Import.dto.ConsortileFilterDTO;
|
||||
import it.integry.ems.javabeans.RequestDataDTO;
|
||||
import it.integry.ems.rules.completing.DocumentRules;
|
||||
@@ -371,8 +370,6 @@ public class DocumentiConsortileService {
|
||||
|
||||
// Connessione al database dell'azienda agricola
|
||||
if (j == 0) {
|
||||
DataSource dsSync = new DataSource();
|
||||
dsSync.initialize(profileDB);
|
||||
multiDBTransactionManagerAzAgr.setPrimaryDB(profileDB);
|
||||
}
|
||||
|
||||
|
||||
@@ -327,13 +327,15 @@ public class DocumentiProdDaFabb {
|
||||
List<EntityBase> entityList = new ArrayList<EntityBase>();
|
||||
Connection connect = multiDBTransactionManager.getPrimaryConnection();
|
||||
|
||||
if (!ordini.isEmpty()) {
|
||||
/*Non più utilizzato (VECCHIA VERSIONE)*/
|
||||
/* if (!ordini.isEmpty()) {
|
||||
String generaScarico = ordini.get(0).getGeneraScarico();
|
||||
if (generaScarico.compareTo("S") == 0) {
|
||||
entityList = generateCaricoScaricoDaFabbOld(type, format, ordini, anomalie);
|
||||
return entityList;
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
// Configurazione dati
|
||||
Date dataDoc = UtilityDate.StringToDate(UtilityDate.formatDate(new Date(), CommonConstants.DATE_FORMAT_YMD), CommonConstants.DATE_FORMAT_YMD);
|
||||
String codDtipCar = setupGest.getImportSetup(connect, type, format, "COD_DTIP_CAR");
|
||||
@@ -342,7 +344,12 @@ public class DocumentiProdDaFabb {
|
||||
String codiceManodopera = setupGest.getImportSetup(connect, type, format, "CODICE_MANODOPERA'");
|
||||
String codDtipCarGiroc = setupGest.getImportSetup(connect, type, format, "COD_DTIP_CAR_GIROC");
|
||||
String codDtipScarGiroc = setupGest.getImportSetup(connect, type, format, "COD_DTIP_SCAR_GIROC");
|
||||
String generaCaricProdPadre = setupGest.getImportSetup(connect, type, format, "GENERA_CARICO_PROD_PADRE");
|
||||
|
||||
/*Per il momento devono poter scegliere da WINGEST*/
|
||||
/*String generaCaricProdPadre = setupGest.getImportSetup(connect, type, format, "GENERA_CARICO_PROD_PADRE");*/
|
||||
|
||||
String generaCaricProdPadre = ordini.get(0).getGeneraCaricoMatricola();
|
||||
|
||||
|
||||
if (!ordini.isEmpty()) {
|
||||
chiudiCommessa = ordini.get(0).getChiudiCommessa();
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
package it.integry.ems.document.data_sheet.controller;
|
||||
|
||||
import it.integry.common.var.CommonConstants;
|
||||
import it.integry.ems.activity.controller.ActivityController;
|
||||
import it.integry.ems.document.data_sheet.service.DataSheetServices;
|
||||
import it.integry.ems.response.StatusResponse;
|
||||
import it.integry.ems.response.ServiceRestResponse;
|
||||
import it.integry.ems.service.dto.AttachmentDTO;
|
||||
import it.integry.ems.status.ServiceChecker;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -13,8 +12,6 @@ import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@Scope(value = "request")
|
||||
@@ -27,30 +24,19 @@ public class DataSheetController {
|
||||
@Autowired
|
||||
private DataSheetServices dataSheetServices;
|
||||
|
||||
@RequestMapping(value = "status", method = RequestMethod.GET)
|
||||
public @ResponseBody
|
||||
List<StatusResponse> status(HttpServletRequest request) {
|
||||
Method[] methods = ActivityController.class.getDeclaredMethods();
|
||||
return serviceChecker.getServiceStatus(methods, ActivityController.class);
|
||||
}
|
||||
@GetMapping(value = "compileWordFile")
|
||||
public ResponseEntity<byte[]> compileWordFile(HttpServletRequest request,
|
||||
@RequestParam(CommonConstants.PROFILE_DB) String config,
|
||||
@RequestParam String codMart) throws Exception {
|
||||
|
||||
@RequestMapping(value = "compileWordFile", method = RequestMethod.GET)
|
||||
public ResponseEntity<byte[]> compileWordFile (HttpServletRequest request,
|
||||
@RequestParam(CommonConstants.PROFILE_DB) String config,
|
||||
@RequestParam String codMart) {
|
||||
AttachmentDTO attachmentDTO = dataSheetServices.compileWordFile(codMart);
|
||||
|
||||
try{
|
||||
AttachmentDTO attachmentDTO = dataSheetServices.compileWordFile(codMart);
|
||||
|
||||
if (attachmentDTO != null) {
|
||||
return ResponseEntity.ok()
|
||||
.contentType(MediaType.parseMediaType(attachmentDTO.getMimeType()))
|
||||
.contentLength(attachmentDTO.getFileSize())
|
||||
.header("Content-Disposition", "attachment; filename=\"" + attachmentDTO.getFileName() + "\"")
|
||||
.body(attachmentDTO.getFileContent());
|
||||
}
|
||||
} catch (Exception e){
|
||||
return ResponseEntity.status(420).body(e.toString().getBytes());
|
||||
if (attachmentDTO != null) {
|
||||
return ResponseEntity.ok()
|
||||
.contentType(MediaType.parseMediaType(attachmentDTO.getMimeType()))
|
||||
.contentLength(attachmentDTO.getFileSize())
|
||||
.header("Content-Disposition", "attachment; filename=\"" + attachmentDTO.getFileName() + "\"")
|
||||
.body(attachmentDTO.getFileContent());
|
||||
}
|
||||
|
||||
return ResponseEntity.notFound().build();
|
||||
|
||||
@@ -32,7 +32,7 @@ public class DataSheetServices {
|
||||
Connection conn = multiDBTransactionManager.getPrimaryConnection();
|
||||
|
||||
StbFilesAttached filesAttached = getDocument(codMart);
|
||||
byte[] bytes = minIOService.downloadObject(filesAttached.getRefUuid(), conn);
|
||||
byte[] bytes = downloadFile(filesAttached);
|
||||
XWPFDocument document = UtilityDocx.readDocxFile(bytes, filesAttached.getFileName());
|
||||
|
||||
HashMap<String, String> variableValues = getVariableValues(codMart, UtilityDocx.findAllVariables(document));
|
||||
@@ -119,7 +119,7 @@ public class DataSheetServices {
|
||||
|
||||
allVariables.forEach(variable -> {
|
||||
if (mtb_aart.containsKey(variable)) {
|
||||
resultMap.put(variable, (String) mtb_aart.get(variable));
|
||||
resultMap.put(variable, String.valueOf(mtb_aart.get(variable)));
|
||||
}
|
||||
|
||||
Optional<HashMap<String, Object>> optionalMap = hashMaps.stream()
|
||||
@@ -158,7 +158,7 @@ public class DataSheetServices {
|
||||
for (StbFilesAttached stbFilesAttached : stbFilesAttacheds) {
|
||||
String key = String.format("%02d", counter);
|
||||
|
||||
byte[] fileData = minIOService.downloadObject(stbFilesAttached.getRefUuid(), conn);
|
||||
byte[] fileData = downloadFile(stbFilesAttached);
|
||||
Map<String, Object> innerMap = new HashMap<>();
|
||||
innerMap.put("fileName", stbFilesAttached.getFileName());
|
||||
innerMap.put("byte", fileData);
|
||||
@@ -182,4 +182,12 @@ public class DataSheetServices {
|
||||
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
private byte[] downloadFile(StbFilesAttached stbFilesAttached) throws Exception {
|
||||
try {
|
||||
return minIOService.downloadObject(stbFilesAttached.getRefUuid(), multiDBTransactionManager.getPrimaryConnection());
|
||||
} catch (Exception e){
|
||||
throw new Exception("Errore nel download del file: " + stbFilesAttached.getFileName());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -84,9 +84,6 @@ public class DocumentiExporter extends BaseEntityExporter implements IEntityExpo
|
||||
CsvINVOICExportService INVOICservice = context.getBean(CsvINVOICExportService.class);
|
||||
entityExportResponse = INVOICservice.exportCsvINVOICC(type, format, whereCond, username, jsonBody);
|
||||
break;
|
||||
case PLURIMA:
|
||||
entityExportResponse = documentiExportManagerService.exportDocumentiPlurima(type, format, jsonBody, wtbUserInfo, anomalie);
|
||||
break;
|
||||
case COOP_PDF:
|
||||
DocumentiCoopPdfExportService documentiCoopExportService = context.getBean(DocumentiCoopPdfExportService.class);
|
||||
entityExportResponse = documentiCoopExportService.export(type, format, whereCond);
|
||||
@@ -228,7 +225,6 @@ public class DocumentiExporter extends BaseEntityExporter implements IEntityExpo
|
||||
INVOIC_CSV("INVOIC_CSV"),
|
||||
SICILIANI_ORGCONS("SICILIANI_ORGCONS"),
|
||||
SICILIANI_TAGLIACUCI("SICILIANI_TAGLIACUCI"),
|
||||
PLURIMA("PLURIMA"),
|
||||
COOP_PDF("COOP_PDF"),
|
||||
COOP("COOP"),
|
||||
SIAN("SIAN"),
|
||||
|
||||
@@ -1,382 +0,0 @@
|
||||
package it.integry.ems.document.export.dto;
|
||||
|
||||
import it.integry.ems_model.annotation.SqlField;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
public class PlurimaDocumentDTO {
|
||||
|
||||
@SqlField("cod_anag")
|
||||
private String codAnag;
|
||||
|
||||
@SqlField("cod_dtip")
|
||||
private String codDtip;
|
||||
|
||||
@SqlField("data_doc")
|
||||
private Date dataDoc;
|
||||
|
||||
@SqlField("ser_doc")
|
||||
private String serDoc;
|
||||
|
||||
@SqlField("num_doc")
|
||||
private Integer numDoc;
|
||||
|
||||
@SqlField("cod_vdes")
|
||||
private String codVdes;
|
||||
|
||||
@SqlField("data_reg")
|
||||
private Date dataReg;
|
||||
|
||||
@SqlField("RIGO")
|
||||
private Integer rigo;
|
||||
|
||||
@SqlField("PROGRGENERALE")
|
||||
private Long progrGenerale;
|
||||
|
||||
@SqlField("NUMDOCMAGAZZINO")
|
||||
private String numDocMagazzino;
|
||||
|
||||
@SqlField("MCAUSALE")
|
||||
private String mCausale;
|
||||
|
||||
@SqlField("MARTICOLO")
|
||||
private String mArticolo;
|
||||
|
||||
@SqlField("MDESCRARTICOLO")
|
||||
private String mDescrArticolo;
|
||||
|
||||
@SqlField("MUNITA")
|
||||
private String mUnita;
|
||||
|
||||
@SqlField("MQUANTITA")
|
||||
private BigDecimal mQuantita;
|
||||
|
||||
@SqlField("MQUANTITAV")
|
||||
private BigDecimal mQuantitaV;
|
||||
|
||||
@SqlField("VALORE")
|
||||
private BigDecimal valore;
|
||||
|
||||
@SqlField("VALOREUNITARIO")
|
||||
private BigDecimal valoreUnitario;
|
||||
|
||||
@SqlField("PREZZO")
|
||||
private BigDecimal prezzo;
|
||||
|
||||
@SqlField("SCONTOARTICOLO")
|
||||
private BigDecimal scontoArticolo;
|
||||
|
||||
@SqlField("SCONTOC1")
|
||||
private BigDecimal scontoC1;
|
||||
|
||||
@SqlField("SCONTOC2")
|
||||
private BigDecimal scontoC2;
|
||||
|
||||
@SqlField("SCONTOP")
|
||||
private BigDecimal scontoP;
|
||||
|
||||
@SqlField("LOTTOMAG")
|
||||
private String lottoMag;
|
||||
|
||||
@SqlField("IVAMAG")
|
||||
private String ivaMag;
|
||||
|
||||
@SqlField("MAGENTE")
|
||||
private String mAgente;
|
||||
|
||||
@SqlField("MCOLLI")
|
||||
private BigDecimal mColli;
|
||||
|
||||
@SqlField("DATAINSERIMENTO")
|
||||
private Date dataInserimento;
|
||||
|
||||
@SqlField("USERNAME")
|
||||
private String username;
|
||||
|
||||
@SqlField("SYS_UPDATEUSER")
|
||||
private String sysUpdateUser;
|
||||
|
||||
@SqlField("DATAMODIFICA")
|
||||
private Date dataModifica;
|
||||
|
||||
|
||||
public String getCodAnag() {
|
||||
return codAnag;
|
||||
}
|
||||
|
||||
public PlurimaDocumentDTO setCodAnag(String codAnag) {
|
||||
this.codAnag = codAnag;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getCodDtip() {
|
||||
return codDtip;
|
||||
}
|
||||
|
||||
public PlurimaDocumentDTO setCodDtip(String codDtip) {
|
||||
this.codDtip = codDtip;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Date getDataDoc() {
|
||||
return dataDoc;
|
||||
}
|
||||
|
||||
public PlurimaDocumentDTO setDataDoc(Date dataDoc) {
|
||||
this.dataDoc = dataDoc;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getSerDoc() {
|
||||
return serDoc;
|
||||
}
|
||||
|
||||
public PlurimaDocumentDTO setSerDoc(String serDoc) {
|
||||
this.serDoc = serDoc;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Integer getNumDoc() {
|
||||
return numDoc;
|
||||
}
|
||||
|
||||
public PlurimaDocumentDTO setNumDoc(Integer numDoc) {
|
||||
this.numDoc = numDoc;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getCodVdes() {
|
||||
return codVdes;
|
||||
}
|
||||
|
||||
public PlurimaDocumentDTO setCodVdes(String codVdes) {
|
||||
this.codVdes = codVdes;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Date getDataReg() {
|
||||
return dataReg;
|
||||
}
|
||||
|
||||
public PlurimaDocumentDTO setDataReg(Date dataReg) {
|
||||
this.dataReg = dataReg;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Integer getRigo() {
|
||||
return rigo;
|
||||
}
|
||||
|
||||
public PlurimaDocumentDTO setRigo(Integer rigo) {
|
||||
this.rigo = rigo;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Long getProgrGenerale() {
|
||||
return progrGenerale;
|
||||
}
|
||||
|
||||
public PlurimaDocumentDTO setProgrGenerale(Long progrGenerale) {
|
||||
this.progrGenerale = progrGenerale;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getNumDocMagazzino() {
|
||||
return numDocMagazzino;
|
||||
}
|
||||
|
||||
public PlurimaDocumentDTO setNumDocMagazzino(String numDocMagazzino) {
|
||||
this.numDocMagazzino = numDocMagazzino;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getmCausale() {
|
||||
return mCausale;
|
||||
}
|
||||
|
||||
public PlurimaDocumentDTO setmCausale(String mCausale) {
|
||||
this.mCausale = mCausale;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getmArticolo() {
|
||||
return mArticolo;
|
||||
}
|
||||
|
||||
public PlurimaDocumentDTO setmArticolo(String mArticolo) {
|
||||
this.mArticolo = mArticolo;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getmDescrArticolo() {
|
||||
return mDescrArticolo;
|
||||
}
|
||||
|
||||
public PlurimaDocumentDTO setmDescrArticolo(String mDescrArticolo) {
|
||||
this.mDescrArticolo = mDescrArticolo;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getmUnita() {
|
||||
return mUnita;
|
||||
}
|
||||
|
||||
public PlurimaDocumentDTO setmUnita(String mUnita) {
|
||||
this.mUnita = mUnita;
|
||||
return this;
|
||||
}
|
||||
|
||||
public BigDecimal getmQuantita() {
|
||||
return mQuantita;
|
||||
}
|
||||
|
||||
public PlurimaDocumentDTO setmQuantita(BigDecimal mQuantita) {
|
||||
this.mQuantita = mQuantita;
|
||||
return this;
|
||||
}
|
||||
|
||||
public BigDecimal getmQuantitaV() {
|
||||
return mQuantitaV;
|
||||
}
|
||||
|
||||
public PlurimaDocumentDTO setmQuantitaV(BigDecimal mQuantitaV) {
|
||||
this.mQuantitaV = mQuantitaV;
|
||||
return this;
|
||||
}
|
||||
|
||||
public BigDecimal getValore() {
|
||||
return valore;
|
||||
}
|
||||
|
||||
public PlurimaDocumentDTO setValore(BigDecimal valore) {
|
||||
this.valore = valore;
|
||||
return this;
|
||||
}
|
||||
|
||||
public BigDecimal getValoreUnitario() {
|
||||
return valoreUnitario;
|
||||
}
|
||||
|
||||
public PlurimaDocumentDTO setValoreUnitario(BigDecimal valoreUnitario) {
|
||||
this.valoreUnitario = valoreUnitario;
|
||||
return this;
|
||||
}
|
||||
|
||||
public BigDecimal getPrezzo() {
|
||||
return prezzo;
|
||||
}
|
||||
|
||||
public PlurimaDocumentDTO setPrezzo(BigDecimal prezzo) {
|
||||
this.prezzo = prezzo;
|
||||
return this;
|
||||
}
|
||||
|
||||
public BigDecimal getScontoArticolo() {
|
||||
return scontoArticolo;
|
||||
}
|
||||
|
||||
public PlurimaDocumentDTO setScontoArticolo(BigDecimal scontoArticolo) {
|
||||
this.scontoArticolo = scontoArticolo;
|
||||
return this;
|
||||
}
|
||||
|
||||
public BigDecimal getScontoC1() {
|
||||
return scontoC1;
|
||||
}
|
||||
|
||||
public PlurimaDocumentDTO setScontoC1(BigDecimal scontoC1) {
|
||||
this.scontoC1 = scontoC1;
|
||||
return this;
|
||||
}
|
||||
|
||||
public BigDecimal getScontoC2() {
|
||||
return scontoC2;
|
||||
}
|
||||
|
||||
public PlurimaDocumentDTO setScontoC2(BigDecimal scontoC2) {
|
||||
this.scontoC2 = scontoC2;
|
||||
return this;
|
||||
}
|
||||
|
||||
public BigDecimal getScontoP() {
|
||||
return scontoP;
|
||||
}
|
||||
|
||||
public PlurimaDocumentDTO setScontoP(BigDecimal scontoP) {
|
||||
this.scontoP = scontoP;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getLottoMag() {
|
||||
return lottoMag;
|
||||
}
|
||||
|
||||
public PlurimaDocumentDTO setLottoMag(String lottoMag) {
|
||||
this.lottoMag = lottoMag;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getIvaMag() {
|
||||
return ivaMag;
|
||||
}
|
||||
|
||||
public PlurimaDocumentDTO setIvaMag(String ivaMag) {
|
||||
this.ivaMag = ivaMag;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getmAgente() {
|
||||
return mAgente;
|
||||
}
|
||||
|
||||
public PlurimaDocumentDTO setmAgente(String mAgente) {
|
||||
this.mAgente = mAgente;
|
||||
return this;
|
||||
}
|
||||
|
||||
public BigDecimal getmColli() {
|
||||
return mColli;
|
||||
}
|
||||
|
||||
public PlurimaDocumentDTO setmColli(BigDecimal mColli) {
|
||||
this.mColli = mColli;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Date getDataInserimento() {
|
||||
return dataInserimento;
|
||||
}
|
||||
|
||||
public PlurimaDocumentDTO setDataInserimento(Date dataInserimento) {
|
||||
this.dataInserimento = dataInserimento;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getUsername() {
|
||||
return username;
|
||||
}
|
||||
|
||||
public PlurimaDocumentDTO setUsername(String username) {
|
||||
this.username = username;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getSysUpdateUser() {
|
||||
return sysUpdateUser;
|
||||
}
|
||||
|
||||
public PlurimaDocumentDTO setSysUpdateUser(String sysUpdateUser) {
|
||||
this.sysUpdateUser = sysUpdateUser;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Date getDataModifica() {
|
||||
return dataModifica;
|
||||
}
|
||||
|
||||
public PlurimaDocumentDTO setDataModifica(Date dataModifica) {
|
||||
this.dataModifica = dataModifica;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,6 @@ package it.integry.ems.document.export.service;
|
||||
|
||||
import com.ancientprogramming.fixedformat4j.format.FixedFormatManager;
|
||||
import com.ancientprogramming.fixedformat4j.format.impl.FixedFormatManagerImpl;
|
||||
import com.annimon.stream.Stream;
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
@@ -11,10 +10,8 @@ import com.google.common.io.Files;
|
||||
import it.integry.common.var.CommonConstants;
|
||||
import it.integry.ems.Import.dto.AnomalieDTO;
|
||||
import it.integry.ems._context.ApplicationContextProvider;
|
||||
import it.integry.ems.datasource.DataSource;
|
||||
import it.integry.ems.document.export.dto.DocumentiDialogoDTO;
|
||||
import it.integry.ems.document.export.dto.EssegrandeIntercodeFornitoriDTO;
|
||||
import it.integry.ems.document.export.dto.PlurimaDocumentDTO;
|
||||
import it.integry.ems.document.export.dto.swingerDTO.AsnFooter;
|
||||
import it.integry.ems.document.export.dto.swingerDTO.AsnHeader;
|
||||
import it.integry.ems.document.export.dto.swingerDTO.AsnItem;
|
||||
@@ -41,10 +38,11 @@ import org.springframework.stereotype.Service;
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.math.BigDecimal;
|
||||
import java.sql.*;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.Timestamp;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
import java.util.Date;
|
||||
|
||||
import static it.integry.ems_model.coollection.Coollection.eq;
|
||||
|
||||
@@ -53,11 +51,14 @@ import static it.integry.ems_model.coollection.Coollection.eq;
|
||||
public class DocumentiExportManagerService {
|
||||
|
||||
@Autowired
|
||||
EntityProcessor entityProcessor;
|
||||
private EntityProcessor entityProcessor;
|
||||
|
||||
@Autowired
|
||||
private MultiDBTransactionManager multiDBTransactionManager;
|
||||
|
||||
@Autowired
|
||||
private SetupGest setupGest;
|
||||
|
||||
@Autowired
|
||||
private EmsProperties emsProperties;
|
||||
|
||||
@@ -70,490 +71,6 @@ public class DocumentiExportManagerService {
|
||||
}
|
||||
}
|
||||
|
||||
public EntityExportResponse exportDocumentiPlurima(String type, String format, JsonNode body, final WtbUsersInfo user, List<AnomalieDTO> anomalieList) throws Exception {
|
||||
List<DtbDoct> estremiTestateDocumenti = null;
|
||||
List<DtbDoct> elencoDocSalvati = new ArrayList<>();
|
||||
|
||||
PreparedStatement info;
|
||||
|
||||
Date dataDoc = new Date();
|
||||
Date dataReg = new Date();
|
||||
|
||||
|
||||
String whereCond = "", gestione = "", codAnag = "", serDoc = "", codDtip = "",
|
||||
codVdes = "", message = "", profileSource = "", queryPlurima = "", codFornPlurima = "", queryInsert = "", queryUpdate = "";
|
||||
|
||||
//CAMPI FISSI DA INSERIRE SU DB PLURIMA
|
||||
String SERIEMAG = "", MMAGAZZINO = "B", FLAGTRASFERITO = "N";
|
||||
|
||||
Integer numDoc = new Integer(0);
|
||||
Integer countRows = new Integer(0);
|
||||
|
||||
Integer progressivoMag = new Integer(0);
|
||||
Long progrGenerale = 0L;
|
||||
Integer RIGOGIORNALE = new Integer(0);
|
||||
Integer BFRIGO = new Integer(0);
|
||||
Integer PID = new Integer(0);
|
||||
Integer RIF_RIGA_COMMESSA = new Integer(0);
|
||||
Integer PARTITACDEPOSITO = new Integer(0);
|
||||
|
||||
Connection connect = multiDBTransactionManager.getPrimaryConnection();
|
||||
|
||||
Map<String, String> setup = setupGest.getExportSetupSection(connect, type, format);
|
||||
|
||||
profileSource = setup.get("PROFILEDB");
|
||||
if (UtilityString.isNullOrEmpty(profileSource)) {
|
||||
throw new Exception("CONFIGURARE PROFILEDB PLURIMA IN STB_GEST_SETUP.");
|
||||
}
|
||||
codFornPlurima = setup.get("COD_FORN_PLURIMA");
|
||||
if (UtilityString.isNullOrEmpty(codFornPlurima)) {
|
||||
throw new Exception("CONFIGURARE CODICE FORNITORE PLURIMA IN STB_GEST_SETUP.");
|
||||
}
|
||||
|
||||
if (body == null) throw new Exception("Non è possibile continuare poichè il body della richiesta è vuoto");
|
||||
|
||||
Connection connectPlurima = null;
|
||||
try {
|
||||
DataSource dsPlurima = new DataSource();
|
||||
dsPlurima.initialize(profileSource);
|
||||
connectPlurima = dsPlurima.getConnection();
|
||||
} catch (Exception ex) {
|
||||
throw new Exception("Impossibile collegarsi al db di PLURIMA. " + ex.getMessage());
|
||||
}
|
||||
|
||||
if (body.has("gestione") && !UtilityString.isNullOrEmpty(body.get("gestione").asText())) {
|
||||
gestione = body.get("gestione").asText();
|
||||
}
|
||||
|
||||
if (UtilityString.isNullOrEmpty(gestione)) {
|
||||
throw new Exception("Non è possibile esportare documenti senza passare il parametro gestione.");
|
||||
} else {
|
||||
SERIEMAG = "I" + gestione;
|
||||
|
||||
if (body.has("whereCond") && !UtilityString.isNullOrEmpty(body.get("whereCond").asText())) {
|
||||
whereCond = body.get("whereCond").asText();
|
||||
}
|
||||
if (body.has("codDtip") && !UtilityString.isNullOrEmpty(body.get("codDtip").asText())) {
|
||||
codDtip = body.get("codDtip").asText();
|
||||
}
|
||||
if (body.has("codAnag") && !UtilityString.isNullOrEmpty(body.get("codAnag").asText())) {
|
||||
codAnag = body.get("codAnag").asText();
|
||||
}
|
||||
if (body.has("serDoc") && !UtilityString.isNullOrEmpty(body.get("serDoc").asText())) {
|
||||
serDoc = body.get("serDoc").asText();
|
||||
}
|
||||
if (body.has("numDoc") && !UtilityString.isNullOrEmpty(body.get("numDoc").asText())) {
|
||||
numDoc = Integer.valueOf(body.get("numDoc").asText());
|
||||
}
|
||||
if (body.has("dataDoc") && !UtilityString.isNullOrEmpty(body.get("dataDoc").asText())) {
|
||||
dataDoc = UtilityDate.StringToDate(body.get("dataDoc").asText(), CommonConstants.DATE_FORMAT_YMD);
|
||||
}
|
||||
|
||||
if (!UtilityString.isNullOrEmpty(codDtip) && !UtilityString.isNullOrEmpty(codAnag) && !UtilityString.isNullOrEmpty(serDoc) && numDoc != 0) {
|
||||
whereCond = "dtb_doct.cod_Dtip = " + UtilityDB.valueToString(codDtip) + " AND dtb_doct.cod_anag = " + UtilityDB.valueToString(codAnag) + " AND dtb_doct.data_doc = " + UtilityDB.valueDateToString(dataDoc, CommonConstants.DATE_FORMAT_YMD) + " AND dtb_doct.ser_Doc = " + UtilityDB.valueToString(serDoc) + " AND dtb_doct.num_doc = " + UtilityDB.valueToString(numDoc);
|
||||
}
|
||||
|
||||
|
||||
String sql = "SELECT dtb_doct.cod_anag, " +
|
||||
" dtb_doct.cod_dtip, " +
|
||||
" dtb_doct.data_doc, " +
|
||||
" dtb_doct.ser_doc, " +
|
||||
" dtb_doct.num_doc, " +
|
||||
" dtb_doct.cod_vdes," +
|
||||
" dtb_doct.data_reg, " +
|
||||
" dtb_docr.id_riga as RIGO," +
|
||||
" ROW_NUMBER() over (order by dtb_doct.gestione, dtb_doct.cod_dtip, dtb_doct.ser_doc, dtb_doct.num_doc) as PROGRGENERALE,--Inserire Progressivo da 400.001 a 1.000.000 \n" +
|
||||
" CONVERT(varchar(8),dtb_doct.num_doc)+ case When dtb_doct.ser_doc <> '/' then '/'+dtb_doct.ser_doc else '' end as NUMDOCMAGAZZINO," +
|
||||
" dtb_tipi_anag.inter_code as MCAUSALE, " +
|
||||
" dtb_docr.cod_mart as MARTICOLO, " +
|
||||
" left(dtb_docr.descrizione_estesa,60) as MDESCRARTICOLO," +
|
||||
" dtb_docr.unt_doc as MUNITA, 0 as MCOEFFICIENTE," +
|
||||
" dtb_docr.qta_doc*dtb_docr.rap_conv as MQUANTITA," +
|
||||
" dtb_docr.qta_doc*dtb_docr.rap_conv as MQUANTITAV," +
|
||||
" round(dtb_docr.qta_doc*dtb_docr.val_unt*(1-sconto1/100)*(1-sconto2/100)*(1-sconto3/100)*(1-sconto5/100)*(1-sconto6/100)*(1-sconto7/100)*(1-sconto8/100),2) *dtb_doct.cambio as VALORE," +
|
||||
" (dtb_docr.qta_doc*dtb_docr.val_unt*(1-sconto1/100)*(1-sconto2/100)*(1-sconto3/100)*(1-sconto5/100)*(1-sconto6/100)*(1-sconto7/100)*(1-sconto8/100) *dtb_doct.cambio)/(dtb_docr.qta_doc*dtb_docr.rap_conv) as VALOREUNITARIO," +
|
||||
" CASE WHEN dtb_docr.val_unt = 0 THEN 0 ELSE dtb_docr.val_unt/dtb_docr.rap_conv END as PREZZO," +
|
||||
" dtb_docr.sconto5 as SCONTOARTICOLO," +
|
||||
" dtb_doct.sconto1 as SCONTOC1," +
|
||||
" dtb_doct.sconto2 as SCONTOC2," +
|
||||
" dtb_doct.sconto4 as SCONTOP," +
|
||||
" LEFT(dtb_docr.partita_mag, 10) as LOTTOMAG," +
|
||||
" dtb_docr.cod_aliq as IVAMAG," +
|
||||
" isNull(dtb_doct.cod_vage,'') as MAGENTE," +
|
||||
" dtb_docr.num_cnf as MCOLLI," +
|
||||
" dtb_doct.data_ins as DATAINSERIMENTO," +
|
||||
" left(dtb_doct.compilato_Da,20) as USERNAME," +
|
||||
" dtb_doct.data_ult_mod as DATAMODIFICA, " +
|
||||
" left(dtb_doct.modificato_da,20) as SYS_UPDATEUSER " +
|
||||
" FROM dtb_docr, dtb_tipi_anag, dtb_doct LEFT OUTER JOIN dtb_docu_log ON dtb_doct.cod_anag = dtb_docu_log.cod_anag AND " +
|
||||
" dtb_doct.cod_dtip = dtb_docu_log.cod_dtip AND " +
|
||||
" dtb_doct.data_doc = dtb_docu_log.data_doc AND " +
|
||||
" dtb_doct.ser_doc = dtb_docu_log.ser_doc AND " +
|
||||
" dtb_doct.num_doc = dtb_docu_log.num_doc " +
|
||||
" WHERE dtb_doct.cod_anag = dtb_docr.cod_anag and " +
|
||||
" dtb_doct.cod_dtip = dtb_docr.cod_dtip and " +
|
||||
" dtb_doct.data_doc = dtb_docr.data_doc and " +
|
||||
" dtb_doct.ser_doc = dtb_docr.ser_doc and " +
|
||||
" dtb_doct.num_doc = dtb_docr.num_doc and " +
|
||||
" dtb_doct.cod_dtip = dtb_tipi_anag.cod_dtip and " +
|
||||
" dtb_tipi_anag.cod_anag = " + UtilityDB.valueToString(codFornPlurima) + " and " +
|
||||
" dtb_doct.gestione = " + UtilityDB.valueToString(gestione) + " AND " +
|
||||
" dtb_docu_log.cod_anag IS NULL " +
|
||||
" ORDER BY dtb_doct.cod_anag, " +
|
||||
" dtb_doct.cod_dtip, " +
|
||||
" dtb_doct.data_doc, " +
|
||||
" dtb_doct.ser_doc, " +
|
||||
" dtb_doct.num_doc, " +
|
||||
" dtb_docr.id_riga ";
|
||||
|
||||
sql = UtilityDB.addwhereCond(sql, whereCond, true);
|
||||
|
||||
info = connect.prepareStatement(sql);
|
||||
ResultSet rs = info.executeQuery();
|
||||
|
||||
List<PlurimaDocumentDTO> plurimaDocumentDTOList = new ResultSetMapper()
|
||||
.mapResultSetToList(rs, PlurimaDocumentDTO.class);
|
||||
|
||||
rs.close();
|
||||
info.close();
|
||||
|
||||
countRows = plurimaDocumentDTOList != null ? plurimaDocumentDTOList.size() : 0;
|
||||
|
||||
if (countRows > 0) {
|
||||
|
||||
estremiTestateDocumenti = Stream.of(plurimaDocumentDTOList)
|
||||
.map(plurimaDocumentDTO -> {
|
||||
DtbDoct dtbDoct = new DtbDoct();
|
||||
dtbDoct.setCodAnag(plurimaDocumentDTO.getCodAnag());
|
||||
dtbDoct.setCodDtip(plurimaDocumentDTO.getCodDtip());
|
||||
dtbDoct.setDataDoc(plurimaDocumentDTO.getDataDoc());
|
||||
dtbDoct.setSerDoc(plurimaDocumentDTO.getSerDoc());
|
||||
dtbDoct.setNumDoc(plurimaDocumentDTO.getNumDoc());
|
||||
dtbDoct.setCodVdes(plurimaDocumentDTO.getCodVdes());
|
||||
dtbDoct.setUsername(user.getUserName());
|
||||
dtbDoct.setDataReg(plurimaDocumentDTO.getDataReg());
|
||||
|
||||
return dtbDoct;
|
||||
})
|
||||
.distinctBy(dtbDoct -> dtbDoct.getCodAnag() + " - " +
|
||||
dtbDoct.getCodDtip() + " - " +
|
||||
UtilityDate.formatDate(dtbDoct.getDataDoc(), CommonConstants.DATETIME_FORMAT_YMD) + " - " +
|
||||
dtbDoct.getSerDoc() + " - " +
|
||||
dtbDoct.getNumDoc())
|
||||
.toList();
|
||||
|
||||
for (final DtbDoct testataDoc : estremiTestateDocumenti) {
|
||||
codAnag = testataDoc.getCodAnag();
|
||||
codDtip = testataDoc.getCodDtip();
|
||||
dataDoc = testataDoc.getDataDoc();
|
||||
serDoc = testataDoc.getSerDoc();
|
||||
numDoc = testataDoc.getNumDoc();
|
||||
codVdes = testataDoc.getCodVdes();
|
||||
String numDocPlurima = String.valueOf(numDoc);
|
||||
|
||||
if (!serDoc.equalsIgnoreCase("/")) {
|
||||
numDocPlurima += "/" + serDoc;
|
||||
}
|
||||
|
||||
queryPlurima =
|
||||
"SELECT count(*) FROM MAGAZZINO " +
|
||||
" WHERE seriemagazzino = " + UtilityDB.valueToString(SERIEMAG) + " AND " +
|
||||
" numdocmagazzino = " + UtilityDB.valueToString(numDocPlurima) + " AND " +
|
||||
" datadocmag = " + UtilityDB.valueDateToString(dataDoc, CommonConstants.DATE_FORMAT_DMY) + " AND " +
|
||||
" contomag like '%" + codAnag.substring(1, 5) + "'";
|
||||
Integer rowDocPlurima = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(connectPlurima, queryPlurima);
|
||||
|
||||
if (rowDocPlurima == 0) {
|
||||
try {
|
||||
queryPlurima = "Select isNull(MAX(progrgenerale),400000) from MAGAZZINO where progrGenerale between 400000 and 1000000 ";
|
||||
Integer maxProgGen = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(connectPlurima, queryPlurima);
|
||||
|
||||
queryPlurima = "Select isNull(MAX(PROGRESSIVOMAG),0) from MAGAZZINO where SERIEMAGAZZINO = 'IA' and anno = YEAR(" + UtilityDB.valueDateToString(dataReg, CommonConstants.DATE_FORMAT_YMD) + ")";
|
||||
Integer maxProgMag = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(connectPlurima, queryPlurima);
|
||||
|
||||
queryPlurima = "Select ISNULL(dest.GRUPPOCONTO, anag.GRUPPOCONTO) as GRUPPOMAG," +
|
||||
" ISNULL(dest.SOTTOCONTO, anag.SOTTOCONTO) as CONTOMAG," +
|
||||
" anag.DGRUPPOFATTURA as GRUPPOFATTURA, " +
|
||||
" anag.DCONTOFATTURA as CONTOFATTURA " +
|
||||
" FROM [PIANOCONTI] anag Left Outer Join PIANOCONTI dest ON dest.SOTTOCONTO like '%'+RIGHT(" + UtilityDB.valueToString(codVdes) + ",4) and dest.CLIFOR = LEFT(" + UtilityDB.valueToString(codAnag) + ",1) " +
|
||||
" WHERE anag.SOTTOCONTO like '0%'+RIGHT(" + UtilityDB.valueToString(codAnag) + ",4) and anag.CLIFOR = LEFT(" + UtilityDB.valueToString(codAnag) + ",1) ";
|
||||
|
||||
HashMap<String, Object> result = UtilityDB.executeSimpleQueryOnlyFirstRow(connectPlurima, queryPlurima);
|
||||
|
||||
String contoMag = "";
|
||||
String contoFattura = "";
|
||||
Integer gruppoMag = 0;
|
||||
Integer gruppoFattura = 0;
|
||||
|
||||
if (result != null) {
|
||||
gruppoMag = UtilityHashMap.getValueIfExists(result, "GRUPPOMAG");
|
||||
contoMag = UtilityHashMap.getValueIfExists(result, "CONTOMAG");
|
||||
gruppoFattura = UtilityHashMap.getValueIfExists(result, "GRUPPOFATTURA");
|
||||
contoFattura = UtilityHashMap.getValueIfExists(result, "CONTOFATTURA");
|
||||
}
|
||||
|
||||
|
||||
List<PlurimaDocumentDTO> singlePlurimaDocumentRows = Stream.of(plurimaDocumentDTOList)
|
||||
.filter(plurimaDocumentDTO -> testataDoc.getCodAnag().equalsIgnoreCase(plurimaDocumentDTO.getCodAnag()) &&
|
||||
testataDoc.getCodDtip().equalsIgnoreCase(plurimaDocumentDTO.getCodDtip()) &&
|
||||
testataDoc.getDataDoc().equals(plurimaDocumentDTO.getDataDoc()) &&
|
||||
testataDoc.getSerDoc().equalsIgnoreCase(plurimaDocumentDTO.getSerDoc()) &&
|
||||
testataDoc.getNumDoc().equals(plurimaDocumentDTO.getNumDoc()))
|
||||
.toList();
|
||||
|
||||
|
||||
for (PlurimaDocumentDTO plurimaDocumentDTO : singlePlurimaDocumentRows) {
|
||||
|
||||
progressivoMag = maxProgMag + 1;
|
||||
progrGenerale = plurimaDocumentDTO.getProgrGenerale() + maxProgGen;
|
||||
|
||||
queryInsert = "INSERT INTO MAGAZZINO ([ANNO]" +
|
||||
",[SERIEMAGAZZINO]" +
|
||||
",[PROGRESSIVOMAG]" +
|
||||
",[FLAGCONTROMAG]" +
|
||||
",[RIGO]" +
|
||||
",[PROGRGENERALE]" +
|
||||
",[DATAOPMAGAZZINO]" +
|
||||
",[NUMDOCMAGAZZINO]" +
|
||||
",[DATADOCMAG]" +
|
||||
",[NUMFATTURAMAG]" +
|
||||
",[DATAFATTURAMAG]" +
|
||||
",[MCAUSALE]" +
|
||||
",[MMAGAZZINO]" +
|
||||
",[GRUPPOMAG]" +
|
||||
",[CONTOMAG]" +
|
||||
",[GRUPPOPROP]" +
|
||||
",[CONTOPROP]" +
|
||||
",[GRUPPOFATTURA]" +
|
||||
",[CONTOFATTURA]" +
|
||||
",[CONTROMAG]" +
|
||||
",[TIPORIGOMAG]" +
|
||||
",[MARTICOLO]" +
|
||||
",[CODICEEAN]" +
|
||||
",[VARIANTE1]" +
|
||||
",[VARIANTE2]" +
|
||||
",[VARIANTE3]" +
|
||||
",[VARIANTE4]" +
|
||||
",[VARIANTE5]" +
|
||||
",[MDESCRARTICOLO]" +
|
||||
",[MUNITA]" +
|
||||
",[MCOEFFICIENTE]" +
|
||||
",[MQUANTITA]" +
|
||||
",[MQUANTITAV]" +
|
||||
",[MQUANTITA2]" +
|
||||
",[VALORE]" +
|
||||
",[VALOREUNITARIO]" +
|
||||
",[PREZZO]" +
|
||||
",[PREZZOEXTRA]" +
|
||||
",[MVALUTA]" +
|
||||
",[MCAMBIO]" +
|
||||
",[SCONTOARTICOLO]" +
|
||||
",[SCONTOC1]" +
|
||||
",[SCONTOC2]" +
|
||||
",[SCONTOP]" +
|
||||
",[MPROVVARTICOLO]" +
|
||||
",[MPROVVCLIENTE]" +
|
||||
",[LOTTOMAG]" +
|
||||
",[CONDPAGMAG]" +
|
||||
",[IVAMAG]" +
|
||||
",[MAGENTE]" +
|
||||
",[DATAPRIMAMAG]" +
|
||||
",[MCOMMESSA]" +
|
||||
",[MCOLLI]" +
|
||||
",[MMODOCONSEGNA]" +
|
||||
",[MVETTORE]" +
|
||||
",[VALOREUSER]" +
|
||||
",[DESCRUSER1]" +
|
||||
",[DESCRUSER2]" +
|
||||
",[DESCRUSER3]" +
|
||||
",[DESCRUSER4]" +
|
||||
",[DESCRUSER5]" +
|
||||
",[QUANTITAUSER01]" +
|
||||
",[QUANTITAUSER02]" +
|
||||
",[QUANTITAUSER03]" +
|
||||
",[QUANTITAUSER04]" +
|
||||
",[QUANTITAUSER05]" +
|
||||
",[FLAGTRASFERITO]" +
|
||||
",[NOTEMAG]" +
|
||||
",[PROVENIENZA]" +
|
||||
",[PID]" +
|
||||
",[RIF_RIGA_COMMESSA]" +
|
||||
",[PARTITACDEPOSITO]" +
|
||||
",[CONTROLLOBF]" +
|
||||
",[DATAINSERIMENTO]" +
|
||||
",[USERNAME]" +
|
||||
",[DATAMODIFICA]" +
|
||||
",[COSTOMEDIO]" +
|
||||
",[SETTORE]" +
|
||||
",[OGGETTO]" +
|
||||
",[RIGOGIORNALE]" +
|
||||
",[SYS_CREATEDATE]" +
|
||||
",[SYS_CREATEUSER]" +
|
||||
",[SYS_UPDATEDATE]" +
|
||||
",[SYS_UPDATEUSER]" +
|
||||
",[MCENTROCOSTO]" +
|
||||
",[MVOCESPESA]" +
|
||||
",[MCIG]" +
|
||||
",[MCUP]" +
|
||||
",[BFRIGO]" +
|
||||
",[BFVERIFICA]) VALUES (" +
|
||||
UtilityDate.formatDate(dataDoc, "YYYY") + "," +
|
||||
UtilityDB.valueToString(SERIEMAG) + "," +
|
||||
progressivoMag + "," +
|
||||
"''," +
|
||||
plurimaDocumentDTO.getRigo() + "," +
|
||||
progrGenerale + "," +
|
||||
UtilityDB.valueDateToString(plurimaDocumentDTO.getDataReg(), CommonConstants.DATETIME_FORMAT_DMY) + "," +
|
||||
UtilityDB.valueToString(plurimaDocumentDTO.getNumDocMagazzino()) + "," +
|
||||
UtilityDB.valueDateToString(dataDoc, CommonConstants.DATETIME_FORMAT_DMY) + "," +
|
||||
"''," +
|
||||
" null, " +
|
||||
UtilityDB.valueToString(plurimaDocumentDTO.getmCausale()) + "," +
|
||||
UtilityDB.valueToString(MMAGAZZINO) + "," +
|
||||
UtilityDB.valueToString(gruppoMag) + "," +
|
||||
UtilityDB.valueToString(contoMag) + "," +
|
||||
"0, " +
|
||||
"''," +
|
||||
UtilityDB.valueToString(gruppoFattura) + "," +
|
||||
UtilityDB.valueToString(contoFattura) + "," +
|
||||
"''," +
|
||||
"''," +
|
||||
UtilityDB.valueToString(plurimaDocumentDTO.getmArticolo()) + "," +
|
||||
"''," +
|
||||
"''," +
|
||||
"''," +
|
||||
"''," +
|
||||
"''," +
|
||||
"''," +
|
||||
UtilityDB.valueToString(plurimaDocumentDTO.getmDescrArticolo()) + "," +
|
||||
UtilityDB.valueToString(plurimaDocumentDTO.getmUnita()) + "," +
|
||||
UtilityDB.valueToString(BigDecimal.ZERO) + "," + //MCOEFFICIENTE
|
||||
UtilityDB.valueToString(plurimaDocumentDTO.getmQuantita()) + "," +
|
||||
UtilityDB.valueToString(plurimaDocumentDTO.getmQuantitaV()) + "," +
|
||||
UtilityDB.valueToString(BigDecimal.ZERO) + "," +
|
||||
UtilityDB.valueToString(plurimaDocumentDTO.getValore()) + "," +
|
||||
UtilityDB.valueToString(plurimaDocumentDTO.getValoreUnitario()) + "," +
|
||||
UtilityDB.valueToString(plurimaDocumentDTO.getPrezzo()) + "," +
|
||||
UtilityDB.valueToString(BigDecimal.ZERO) + "," + //PREZZOEXTRA
|
||||
"''," + //MVALUTA
|
||||
UtilityDB.valueToString(BigDecimal.ZERO) + "," + //MCAMBIO
|
||||
UtilityDB.valueToString(plurimaDocumentDTO.getScontoArticolo()) + "," +
|
||||
UtilityDB.valueToString(plurimaDocumentDTO.getScontoC1()) + "," +
|
||||
UtilityDB.valueToString(plurimaDocumentDTO.getScontoC2()) + "," +
|
||||
UtilityDB.valueToString(plurimaDocumentDTO.getScontoP()) + "," +
|
||||
UtilityDB.valueToString(BigDecimal.ZERO) + "," + //MPROVVARTICOLO
|
||||
UtilityDB.valueToString(BigDecimal.ZERO) + "," + //MPROVVCLIENTE
|
||||
(UtilityString.isNullOrEmpty(plurimaDocumentDTO.getLottoMag()) ? "''" : UtilityDB.valueToString(plurimaDocumentDTO.getLottoMag())) + "," +
|
||||
"''," +
|
||||
UtilityDB.valueToString(plurimaDocumentDTO.getIvaMag()) + "," +
|
||||
(UtilityString.isNullOrEmpty(plurimaDocumentDTO.getmAgente()) ? "''" : UtilityDB.valueToString(plurimaDocumentDTO.getmAgente())) + "," +
|
||||
"NULL," +
|
||||
"''," +
|
||||
UtilityDB.valueToString(plurimaDocumentDTO.getmColli()) + "," +
|
||||
"''," +
|
||||
"''," +
|
||||
UtilityDB.valueToString(BigDecimal.ZERO) + "," + //VALOREUSER
|
||||
"''," +
|
||||
"''," +
|
||||
"''," +
|
||||
"''," +
|
||||
"''," +
|
||||
UtilityDB.valueToString(BigDecimal.ZERO) + "," + //QUANTITAUSER01
|
||||
UtilityDB.valueToString(BigDecimal.ZERO) + "," + //QUANTITAUSER02
|
||||
UtilityDB.valueToString(BigDecimal.ZERO) + "," + //QUANTITAUSER03
|
||||
UtilityDB.valueToString(BigDecimal.ZERO) + "," + //QUANTITAUSER04
|
||||
UtilityDB.valueToString(BigDecimal.ZERO) + "," + //QUANTITAUSER05
|
||||
UtilityDB.valueToString(FLAGTRASFERITO) + "," +
|
||||
"''," +
|
||||
"''," +
|
||||
PID + "," +
|
||||
RIF_RIGA_COMMESSA + "," +
|
||||
PARTITACDEPOSITO + "," +
|
||||
"''," +
|
||||
UtilityDB.valueDateToString(plurimaDocumentDTO.getDataInserimento(), CommonConstants.DATETIME_FORMAT_DMY) + "," +
|
||||
UtilityDB.valueToString(plurimaDocumentDTO.getUsername()) + "," +
|
||||
UtilityDB.valueDateToString(plurimaDocumentDTO.getDataModifica(), CommonConstants.DATETIME_FORMAT_DMY) + "," +
|
||||
UtilityDB.valueToString(BigDecimal.ZERO) + "," + //COSTOMEDIO
|
||||
"''," +
|
||||
"''," +
|
||||
RIGOGIORNALE + "," +
|
||||
UtilityDB.valueDateToString(plurimaDocumentDTO.getDataInserimento(), CommonConstants.DATETIME_FORMAT_DMY) + "," +
|
||||
UtilityDB.valueToString(plurimaDocumentDTO.getUsername()) + "," +
|
||||
UtilityDB.valueDateToString(plurimaDocumentDTO.getDataModifica(), CommonConstants.DATETIME_FORMAT_DMY) + "," +
|
||||
UtilityDB.valueToString(plurimaDocumentDTO.getSysUpdateUser()) + "," +
|
||||
"''," +
|
||||
"''," +
|
||||
"''," +
|
||||
"''," +
|
||||
BFRIGO + "," +
|
||||
"'')";
|
||||
|
||||
PreparedStatement ps = connectPlurima.prepareStatement(queryInsert);
|
||||
ps.execute();
|
||||
ps.close();
|
||||
}
|
||||
|
||||
|
||||
queryUpdate = "Update SALDIMAGAZZINO " +
|
||||
" set SALDIMAGAZZINO.qGiacenza += SaldiDoc.qGiacenza," +
|
||||
" SALDIMAGAZZINO.qCarichi += SaldiDoc.qCarichi," +
|
||||
" SALDIMAGAZZINO.VCarichi += SaldiDoc.VCarichi," +
|
||||
" SALDIMAGAZZINO.qScarichi += SaldiDoc.qScarichi," +
|
||||
" SALDIMAGAZZINO.VScarichi += SaldiDoc.VSCarichi," +
|
||||
" SALDIMAGAZZINO.qFiscale += SaldiDoc.qFiscale," +
|
||||
" SALDIMAGAZZINO.VFiscale += SaldiDoc.VFiscale " +
|
||||
" from SALDIMAGAZZINO," +
|
||||
"(select mmagazzino, marticolo, sum(MQUANTITA*TMMC.GIACENZA) as qGiacenza," +
|
||||
" sum(MQUANTITA*TMMC.CARICHI) as qCarichi," +
|
||||
" sum(VALORE*TMMC.CARICHI*TMMC.FISCALE) as VCarichi," +
|
||||
" sum(MQUANTITA*TMMC.SCARICHI) as qScarichi," +
|
||||
" sum(VALORE*TMMC.SCARICHI*TMMC.FISCALE) as VSCarichi," +
|
||||
" sum(MQUANTITA*TMMC.GIACENZA*TMMC.FISCALE) as QFiscale," +
|
||||
" sum(VALORE*TMMC.GIACENZA*TMMC.FISCALE) as VFiscale " +
|
||||
" from MAGAZZINO, TMMC " +
|
||||
" where anno = YEAR(" + UtilityDB.valueDateToString(testataDoc.getDataReg(), CommonConstants.DATE_FORMAT_YMD) + ") and " +
|
||||
" SERIEMAGAZZINO = " + UtilityDB.valueToString(SERIEMAG) + " and " +
|
||||
" PROGRESSIVOMAG = " + progressivoMag + " and " +
|
||||
" MAGAZZINO.MCAUSALE = TMMC.MCAUSALE " +
|
||||
" group by MMAGAZZINO, marticolo" +
|
||||
" )SaldiDoc" +
|
||||
" Where SALDIMAGAZZINO.MARTICOLO = SaldiDoc.MARTICOLO and " +
|
||||
" SALDIMAGAZZINO.MMAGAZZINO = SaldiDoc.MMAGAZZINO";
|
||||
|
||||
Statement cmd = connectPlurima.createStatement();
|
||||
cmd.executeUpdate(queryUpdate);
|
||||
cmd.close();
|
||||
connectPlurima.commit();
|
||||
DtbDoct docSaved = (DtbDoct) testataDoc.clone();
|
||||
elencoDocSalvati.add(docSaved);
|
||||
} catch (Exception ep) {
|
||||
connectPlurima.rollback();
|
||||
String error = "Impossibile salvare il documento n. " + numDocPlurima + " del " + new SimpleDateFormat(CommonConstants.DATE_FORMAT_DMY).format(dataDoc) + " fornitore " + codAnag + CommonConstants.A_CAPO +
|
||||
ep.getMessage();
|
||||
if (ep instanceof SQLException) {
|
||||
error += CommonConstants.A_CAPO + queryInsert;
|
||||
}
|
||||
|
||||
anomalieList.add(AnomalieDTO.error(error));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!elencoDocSalvati.isEmpty()) {
|
||||
message += elencoDocSalvati.size() + " documenti esportati con successo";
|
||||
} else {
|
||||
message += "Nessun documento esportato.";
|
||||
}
|
||||
|
||||
EntityExportResponse<List<File>> entityResponse = new EntityExportResponse<>();
|
||||
entityResponse.setExtraInfo(elencoDocSalvati);
|
||||
entityResponse.setMessageContent(message);
|
||||
|
||||
return entityResponse;
|
||||
}
|
||||
|
||||
public EntityExportResponse exportDocumentiBonMarket(String type, String format, String whereCond) throws Exception {
|
||||
|
||||
Connection conn = multiDBTransactionManager.getPrimaryConnection();
|
||||
@@ -885,7 +402,7 @@ public class DocumentiExportManagerService {
|
||||
//GENERAZIONE CONDIZIONE PER CREAZIONE FILE
|
||||
String whereCondFile =
|
||||
"dtb_doct.cod_anag = " + UtilityDB.valueToString(codAnag) + " AND " +
|
||||
"dtb_doct.cod_dtip = " + UtilityDB.valueToString(codDtip) + " AND " +
|
||||
"( " + UtilityDB.valueToString(codDtip) + " is null or dtb_doct.cod_dtip = " + UtilityDB.valueToString(codDtip) + ") AND " +
|
||||
"( " + UtilityDB.valueToString(codFornTD) + " is null or IsNull(dtb_doct.cod_forn_td,'') = IsNull(" + UtilityDB.valueToString(codFornTD) + ", '')) AND " +
|
||||
"( " + UtilityDB.valueToString(codVdes) + " is null or IsNull(dtb_doct.cod_vdes,'') = IsNull(" + UtilityDB.valueToString(codVdes) + ", '')) AND " +
|
||||
"( " + UtilityDB.valueDateToString(dataDoc, CommonConstants.DATE_FORMAT_YMD) + " is null or dtb_doct.data_doc = " + UtilityDB.valueDateToString(dataDoc, CommonConstants.DATE_FORMAT_YMD) + " ) AND " +
|
||||
@@ -1686,7 +1203,7 @@ public class DocumentiExportManagerService {
|
||||
ResultSet rsCheckComp = psCheckComposizione.executeQuery();
|
||||
String errorComposizione = "";
|
||||
while (rsCheckComp.next()) {
|
||||
errorComposizione += rsCheckComp.getString("cod_mart") + "-" + rsCheckComp.getString("descrizione") + System.getProperty("line.separator");
|
||||
errorComposizione += rsCheckComp.getString("cod_mart") + "-" + rsCheckComp.getString("descrizione") + System.lineSeparator();
|
||||
}
|
||||
rsCheckComp.close();
|
||||
psCheckComposizione.close();
|
||||
|
||||
@@ -212,19 +212,6 @@ public class SicilianiDMSExportService {
|
||||
|
||||
public EntityExportResponse syncOrgCons(String whereCond, String queryDettPesoViaggio, String dataCons, String userNAme) throws Exception {
|
||||
EntityExportResponse<List<File>> response = new EntityExportResponse<List<File>>();
|
||||
|
||||
String trasmissioneNew = setupGest.getSetup("W_VORGCONS_DISP", "SETUP", "TRAMISSIONE_NEW");
|
||||
if (trasmissioneNew.equalsIgnoreCase("S")){
|
||||
response = syncOrgCons_new(whereCond, queryDettPesoViaggio, dataCons, userNAme);
|
||||
} else {
|
||||
response = syncOrgCons_old(whereCond, queryDettPesoViaggio, dataCons, userNAme);
|
||||
}
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
public EntityExportResponse syncOrgCons_new(String whereCond, String queryDettPesoViaggio, String dataCons, String userNAme) throws Exception {
|
||||
EntityExportResponse<List<File>> response = new EntityExportResponse<List<File>>();
|
||||
response.setResponse(new ArrayList<File>());
|
||||
String profileDBAlyante = setupGest.getSetup("DMS", "PROFILE", "ALYANTE");
|
||||
String visualizzaCosti = setupGest.getSetup("W_VORGCONS_DISP", "SETUP", "GESTIONE_COSTI");
|
||||
@@ -283,7 +270,8 @@ public class SicilianiDMSExportService {
|
||||
" case when dtb_ordt_local.piattaforma1 is null then null else id_riga_contratto_piatt1 end , " +
|
||||
" case when dtb_ordt_local.piattaforma2 is null then null else id_riga_contratto_piatt2 end , " +
|
||||
" case when dtb_ordt_local.piattaforma1 is null then 0 else round(costo_kg_con_piatt1 " + columnPercPesoOrdine + ", 5) end , " +
|
||||
" case when dtb_ordt_local.piattaforma2 is null then 0 else round(costo_kg_con_piatt2 " + columnPercPesoOrdine + ", 5) end " +
|
||||
" case when dtb_ordt_local.piattaforma2 is null then 0 else round(costo_kg_con_piatt2 " + columnPercPesoOrdine + ", 5) end, " +
|
||||
" dtb_ordt_local.id_scarico " +
|
||||
" from dtb_ordt_local INNER JOIN " + serverObject + ".dtb_ordt ON dtb_ordt_local.key_ord_alyante = dtb_ordt.key_ord COLLATE Latin1_General_100_CI_AS " +
|
||||
" LEFT OUTER JOIN (select distinct * from vtb_vett_orgcons_local )vtb_vett_orgcons_local ON dtb_ordt_local.id_viaggio = vtb_vett_orgcons_local.id_viaggio and " +
|
||||
" ISNULL(dtb_ordt_local.cod_vvet, '') = ISNULL(vtb_vett_orgcons_local.cod_vvet, '') and " +
|
||||
@@ -335,6 +323,7 @@ public class SicilianiDMSExportService {
|
||||
Integer idRigacontrattoPiatt2 = res.getInt(28);
|
||||
BigDecimal importoConPiatt1 = res.getBigDecimal(29);
|
||||
BigDecimal importoConPiatt2 = res.getBigDecimal(30);
|
||||
Integer idScarico = res.getInt(31);
|
||||
|
||||
// Verifica esistenza ordine
|
||||
Integer flagExistOrd = 0;
|
||||
@@ -407,7 +396,8 @@ public class SicilianiDMSExportService {
|
||||
" importoPiat1, " +
|
||||
" importoPiat2, " +
|
||||
" importoforfaitPiat1, " +
|
||||
" importoForfaitPiat2)" +
|
||||
" importoForfaitPiat2, " +
|
||||
" id_scarico)" +
|
||||
"VALUES (" + UtilityDB.valueToString(codiceDitta) + ", " +
|
||||
" " + UtilityDB.valueToString(keyOrdAlyante) + ", " +
|
||||
" " + UtilityDB.valueToString(keyOrd) + ", " +
|
||||
@@ -438,7 +428,8 @@ public class SicilianiDMSExportService {
|
||||
" " + UtilityDB.valueToString(importoPiatt1) + ", " +
|
||||
" " + UtilityDB.valueToString(importoPiatt2) + ", " +
|
||||
" " + UtilityDB.valueToString(importoConPiatt1) + ", " +
|
||||
" " + UtilityDB.valueToString(importoConPiatt2) + ")"; /*Al momento per motivi di Alyante abbiamo dovuto valorizzare a 1 tutti gli importi*/
|
||||
" " + UtilityDB.valueToString(importoConPiatt2) + ", " +
|
||||
" " + UtilityDB.valueToString(idScarico) + ")"; /*Al momento per motivi di Alyante abbiamo dovuto valorizzare a 1 tutti gli importi*/
|
||||
} else {
|
||||
sql = "UPDATE dtb_infoviaggi " +
|
||||
" SET ditta = " + UtilityDB.valueToString(codiceDitta) + ", " +
|
||||
@@ -471,7 +462,8 @@ public class SicilianiDMSExportService {
|
||||
" importoPiat1 = " + UtilityDB.valueToString(importoPiatt1) + ", " +
|
||||
" importoPiat2 = " + UtilityDB.valueToString(importoPiatt2) + ", " +
|
||||
" importoForfaitPiat1 = " + UtilityDB.valueToString(importoConPiatt1) + ", " +
|
||||
" importoForfaitPiat2 = " + UtilityDB.valueToString(importoConPiatt2) + " " +
|
||||
" importoForfaitPiat2 = " + UtilityDB.valueToString(importoConPiatt2) + ", " +
|
||||
" id_scarico = " + UtilityDB.valueToString(idScarico) +
|
||||
" WHERE key_ord = " + UtilityDB.valueToString(keyOrdAlyante);
|
||||
}
|
||||
PreparedStatement infoUpd = conAlyante.prepareStatement(sql, ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
|
||||
@@ -527,301 +519,5 @@ public class SicilianiDMSExportService {
|
||||
return response;
|
||||
}
|
||||
|
||||
public EntityExportResponse syncOrgCons_old(String whereCond, String queryDettPesoViaggio, String dataCons, String userNAme) throws Exception {
|
||||
EntityExportResponse<List<File>> response = new EntityExportResponse<List<File>>();
|
||||
response.setResponse(new ArrayList<File>());
|
||||
String profileDBAlyante = setupGest.getSetup("DMS", "PROFILE", "ALYANTE");
|
||||
String visualizzaCosti = setupGest.getSetup("W_VORGCONS_DISP", "SETUP", "GESTIONE_COSTI");
|
||||
String disbableCheckCostiAlyante = setupGest.getSetup("W_VORGCONS_DISP", "SETUP", "DISABLE_CHECK_COSTI_ALYANTE");
|
||||
Connection conn = multiDBTransactionManager.getPrimaryConnection();
|
||||
|
||||
// Acquisizione Connection DB ALYANTE
|
||||
multiDBTransactionManager.addConnection(profileDBAlyante);
|
||||
Connection conAlyante = multiDBTransactionManager.getDatabaseConnection(profileDBAlyante);
|
||||
|
||||
try {
|
||||
String codiceDitta = setupGest.getSetup("DMS", "SETUP", "CODICE_DITTA");
|
||||
String serverObject = setupGest.getSetup("DMS", "PROFILE", "DB_INTERSCAMBIO");
|
||||
String userUnlockIDViaggio = setupGest.getSetupUser(conn, "W_VORGCONS_DISP", "SETUP","ABILITA_SBLOCCO_ID_VIAGGIO", userNAme);
|
||||
|
||||
String columnPercPesoOrdine = "";
|
||||
String tableCostoViaggi = "";
|
||||
if (visualizzaCosti.compareTo("S") == 0) {
|
||||
columnPercPesoOrdine = " * percPesoOrd.as_perc_peso_ordine";
|
||||
tableCostoViaggi = "LEFT OUTER JOIN (" + queryDettPesoViaggio + ")percPesoOrd ON dtb_ordt_local.key_ord = percPesoOrd.key_ord";
|
||||
}
|
||||
|
||||
sql = "SELECT id_viaggio, " +
|
||||
" lockIdViaggio " +
|
||||
"from dbo.getStatoIdViaggio4DtCons(" + UtilityDB.valueToString(dataCons) + ")";
|
||||
List<HashMap<String, Object>> resultMap = UtilityDB.executeSimpleQuery(multiDBTransactionManager.getPrimaryConnection(), sql);
|
||||
|
||||
sql = "select dtb_ordt_local.key_ord_alyante," +
|
||||
" dtb_ordt_local.key_ord, " +
|
||||
" dtb_ordt_local.id_viaggio, " +
|
||||
" dtb_ordt_local.cod_giro," +
|
||||
" dtb_ordt_local.cod_vvet, " +
|
||||
" dtb_ordt_local.cod_vvet2, " +
|
||||
" dtb_ordt_local.cod_vvet3, " +
|
||||
" dtb_ordt_local.targa, " +
|
||||
" CASE WHEN dtb_infoviaggi.key_ord IS NULL THEN 'N' ELSE 'S' END as flag_exist_ord, " +
|
||||
" dtb_ordt_local.piattaforma1," +
|
||||
" dtb_ordt_local.piattaforma2, " +
|
||||
" round(costo_kg_std_vett " + columnPercPesoOrdine + ", 5), " + /*Alyante vuole che venga impostato 1 segli importi se non valorizzati*/
|
||||
" case when dtb_ordt_local.cod_vvet2 is null then 0 else round(costo_kg_std_vett2 " + columnPercPesoOrdine + ", 5) end , " +
|
||||
" case when dtb_ordt_local.cod_vvet3 is null then 0 else round(costo_kg_std_vett3 " + columnPercPesoOrdine + ", 5) end , " +
|
||||
" round(costo_kg_con_vett " + columnPercPesoOrdine + ", 5), " +
|
||||
" case when dtb_ordt_local.cod_vvet2 is null then 0 else round(costo_kg_con_vett2 " + columnPercPesoOrdine + ", 5) end , " +
|
||||
" case when dtb_ordt_local.cod_vvet3 is null then 0 else round(costo_kg_con_vett3 " + columnPercPesoOrdine + ", 5) end , " +
|
||||
" case when dtb_ordt_local.piattaforma1 is null then 0 else round(costo_kg_std_piattaforma1 " + columnPercPesoOrdine + ", 5) end , " +
|
||||
" case when dtb_ordt_local.piattaforma2 is null then 0 else round(costo_kg_std_piattaforma2 " + columnPercPesoOrdine + ", 5) end , " +
|
||||
" id_contratto_vett1, " +
|
||||
" case when dtb_ordt_local.cod_vvet2 is null then null else id_contratto_vett2 end , " +
|
||||
" case when dtb_ordt_local.cod_vvet3 is null then null else id_contratto_vett3 end , " +
|
||||
" case when dtb_ordt_local.piattaforma1 is null then null else id_contratto_piatt1 end , " +
|
||||
" case when dtb_ordt_local.piattaforma2 is null then null else id_contratto_piatt2 end , " +
|
||||
" id_riga_contratto_vett1, " +
|
||||
" case when dtb_ordt_local.cod_vvet2 is null then null else id_riga_contratto_vett2 end , " +
|
||||
" case when dtb_ordt_local.cod_vvet3 is null then null else id_riga_contratto_vett3 end , " +
|
||||
" case when dtb_ordt_local.piattaforma1 is null then null else id_riga_contratto_piatt1 end , " +
|
||||
" case when dtb_ordt_local.piattaforma2 is null then null else id_riga_contratto_piatt2 end , " +
|
||||
" case when dtb_ordt_local.piattaforma1 is null then 0 else round(costo_kg_con_piatt1 " + columnPercPesoOrdine + ", 5) end , " +
|
||||
" case when dtb_ordt_local.piattaforma2 is null then 0 else round(costo_kg_con_piatt2 " + columnPercPesoOrdine + ", 5) end " +
|
||||
" from dtb_ordt_local LEFT OUTER JOIN " + serverObject + ".dtb_infoviaggi ON dtb_ordt_local.key_ord_alyante = dtb_infoviaggi.key_ord COLLATE Latin1_General_100_CI_AS" +
|
||||
" INNER JOIN " + serverObject + ".dtb_ordt ON dtb_ordt_local.key_ord_alyante = dtb_ordt.key_ord COLLATE Latin1_General_100_CI_AS " +
|
||||
" LEFT OUTER JOIN vtb_vett_orgcons_local ON dtb_ordt_local.id_viaggio = vtb_vett_orgcons_local.id_viaggio and " +
|
||||
" ISNULL(dtb_ordt_local.cod_vvet, '') = ISNULL(vtb_vett_orgcons_local.cod_vvet, '') and " +
|
||||
" dtb_ordt_local.targa = vtb_vett_orgcons_local.targa and " +
|
||||
" dtb_ordt_local.cod_giro = vtb_vett_orgcons_local.cod_giro AND " +
|
||||
" ISNULL(dtb_ordt_local.cod_vvet2, '') = ISNULL(vtb_vett_orgcons_local.cod_vvet2, '') AND " +
|
||||
" ISNULL(dtb_ordt_local.cod_vvet3, '') = ISNULL(vtb_vett_orgcons_local.cod_vvet3, '') AND " +
|
||||
" ISNULL(dtb_ordt_local.piattaforma1, '') = ISNULL(vtb_vett_orgcons_local.piattaforma1, '') AND " +
|
||||
" ISNULL(dtb_ordt_local.piattaforma2, '') = ISNULL(vtb_vett_orgcons_local.piattaforma2, '')" +
|
||||
" " + tableCostoViaggi + " " +
|
||||
" where dtb_ordt_local.id_viaggio is not null " +
|
||||
"order by dtb_ordt_local.id_viaggio, dtb_ordt_local.key_ord";
|
||||
|
||||
whereCond = UtilityString.replaceSubString(whereCond, "dtb_ordr", "dtb_ordt_local");
|
||||
sql = UtilityDB.addwhereCond(sql, whereCond, true);
|
||||
PreparedStatement ps = conn.prepareStatement(sql, ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
|
||||
ResultSet res = ps.executeQuery();
|
||||
while (res.next()) {
|
||||
String keyOrdAlyante = res.getString(1);
|
||||
String keyOrd = res.getString(2);
|
||||
Integer idViaggio = res.getInt(3);
|
||||
String codGiro = res.getString(4);
|
||||
String codVvet = res.getString(5);
|
||||
String codVvet2 = res.getString(6);
|
||||
String codVvet3 = res.getString(7);
|
||||
String targa = res.getString(8);
|
||||
String flagExistOrd = res.getString(9);
|
||||
String piattaforma1 = res.getString(10);
|
||||
String piattaforma2 = res.getString(11);
|
||||
BigDecimal importoVett1 = res.getBigDecimal(12);
|
||||
BigDecimal importoVett2 = res.getBigDecimal(13);
|
||||
BigDecimal importoVett3 = res.getBigDecimal(14);
|
||||
BigDecimal importoConVett1 = res.getBigDecimal(15);
|
||||
BigDecimal importoConVett2 = res.getBigDecimal(16);
|
||||
BigDecimal importoConVett3 = res.getBigDecimal(17);
|
||||
BigDecimal importoPiatt1 = res.getBigDecimal(18);
|
||||
BigDecimal importoPiatt2 = res.getBigDecimal(19);
|
||||
String idContrattoVett1 = res.getString(20);
|
||||
String idContrattoVett2 = res.getString(21);
|
||||
String idContrattoVett3 = res.getString(22);
|
||||
String contrattoPiatt1 = res.getString(23);
|
||||
String contrattoPiatt2 = res.getString(24);
|
||||
Integer idRigaContrattoVett1 = res.getInt(25);
|
||||
Integer idRigaContrattoVett2 = res.getInt(26);
|
||||
Integer idRigaContrattoVett3 = res.getInt(27);
|
||||
Integer idRigacontrattoPiatt1 = res.getInt(28);
|
||||
Integer idRigacontrattoPiatt2 = res.getInt(29);
|
||||
BigDecimal importoConPiatt1 = res.getBigDecimal(30);
|
||||
BigDecimal importoConPiatt2 = res.getBigDecimal(31);
|
||||
|
||||
if (visualizzaCosti.compareTo("N") == 0) {
|
||||
importoConVett1 = BigDecimal.ONE;
|
||||
importoConVett2 = BigDecimal.ONE;
|
||||
importoConVett3 = BigDecimal.ONE;
|
||||
importoConPiatt1 = BigDecimal.ONE;
|
||||
importoConPiatt2 = BigDecimal.ONE;
|
||||
} else {
|
||||
if (disbableCheckCostiAlyante.equalsIgnoreCase("S")) {
|
||||
if (codVvet != null && idContrattoVett1 == null && (importoConVett1 == null || importoConVett1.compareTo(BigDecimal.ZERO) == 0)) {
|
||||
importoConVett1 = BigDecimal.ONE;
|
||||
}
|
||||
if (codVvet2 != null && idContrattoVett2 == null && (importoConVett2 == null || importoConVett2.compareTo(BigDecimal.ZERO) == 0)) {
|
||||
importoConVett2 = BigDecimal.ONE;
|
||||
}
|
||||
if (codVvet3 != null && idContrattoVett3 == null && (importoConVett3 == null || importoConVett3.compareTo(BigDecimal.ZERO) == 0)) {
|
||||
importoConVett3 = BigDecimal.ONE;
|
||||
}
|
||||
if (piattaforma1 != null && contrattoPiatt1 == null && (importoConPiatt1 == null || importoConPiatt1.compareTo(BigDecimal.ZERO) == 0)) {
|
||||
importoConPiatt1 = BigDecimal.ONE;
|
||||
}
|
||||
if (piattaforma2 != null && contrattoPiatt2 == null && (importoConPiatt2 == null || importoConPiatt2.compareTo(BigDecimal.ZERO) == 0)) {
|
||||
importoConPiatt2 = BigDecimal.ONE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Verifica se l'id_viaggio è bloccato
|
||||
Optional<HashMap<String, Object>> lockIdViaggio = Stream.of(resultMap)
|
||||
.filter(x ->
|
||||
((Integer) UtilityHashMap.getValueIfExists(x, "id_viaggio")).equals(idViaggio) &&
|
||||
((String) UtilityHashMap.getValueIfExists(x, "lockIdViaggio")).equalsIgnoreCase("S")).findFirst();
|
||||
|
||||
|
||||
if (!lockIdViaggio.isPresent() || userUnlockIDViaggio.equalsIgnoreCase("S")) {
|
||||
if (flagExistOrd.compareTo("N") == 0) {
|
||||
sql = "INSERT INTO dtb_infoviaggi " +
|
||||
"( ditta, " +
|
||||
" key_ord," +
|
||||
" chiave_traxal," +
|
||||
" id_viaggio," +
|
||||
" giro," +
|
||||
" cod_vvet1," +
|
||||
" cod_vvet2," +
|
||||
" cod_vvet3," +
|
||||
" targa1, " +
|
||||
" contrattoVet1, " +
|
||||
" contrattoVet2, " +
|
||||
" contrattoVet3, " +
|
||||
" rigacontrattoVet1, " +
|
||||
" rigacontrattoVet2, " +
|
||||
" rigacontrattoVet3, " +
|
||||
" importoVet1, " +
|
||||
" importoVet2, " +
|
||||
" importoVet3, " +
|
||||
" importoForfaitVet1, " +
|
||||
" importoForfaitVet2, " +
|
||||
" importoForfaitVet3, " +
|
||||
" cod_piatt1, " +
|
||||
" cod_piatt2, " +
|
||||
" contrattoPiat1, " +
|
||||
" contrattoPiat2, " +
|
||||
" rigacontrattoPiat1, " +
|
||||
" rigacontrattoPiat2, " +
|
||||
" importoPiat1, " +
|
||||
" importoPiat2, " +
|
||||
" importoforfaitPiat1, " +
|
||||
" importoForfaitPiat2)" +
|
||||
"VALUES (" + UtilityDB.valueToString(codiceDitta) + ", " +
|
||||
" " + UtilityDB.valueToString(keyOrdAlyante) + ", " +
|
||||
" " + UtilityDB.valueToString(keyOrd) + ", " +
|
||||
" " + UtilityDB.valueToString(idViaggio) + ", " +
|
||||
" " + UtilityDB.valueToString(codGiro) + ", " +
|
||||
" " + UtilityDB.valueToString(codVvet) + ", " +
|
||||
" " + UtilityDB.valueToString(codVvet2) + ", " +
|
||||
" " + UtilityDB.valueToString(codVvet3) + ", " +
|
||||
" " + UtilityDB.valueToString(targa) + ", " +
|
||||
" " + UtilityDB.valueToString(idContrattoVett1) + ", " +
|
||||
" " + UtilityDB.valueToString(idContrattoVett2) + ", " +
|
||||
" " + UtilityDB.valueToString(idContrattoVett3) + ", " +
|
||||
" " + UtilityDB.valueToString(idRigaContrattoVett1) + ", " +
|
||||
" " + UtilityDB.valueToString(idRigaContrattoVett2) + ", " +
|
||||
" " + UtilityDB.valueToString(idRigaContrattoVett3) + ", " +
|
||||
" " + UtilityDB.valueToString(importoVett1) + ", " +
|
||||
" " + UtilityDB.valueToString(importoVett2) + ", " +
|
||||
" " + UtilityDB.valueToString(importoVett3) + ", " +
|
||||
" " + UtilityDB.valueToString(importoConVett1) + ", " +
|
||||
" " + UtilityDB.valueToString(importoConVett2) + ", " +
|
||||
" " + UtilityDB.valueToString(importoConVett3) + ", " +
|
||||
" " + UtilityDB.valueToString(piattaforma1) + ", " +
|
||||
" " + UtilityDB.valueToString(piattaforma2) + ", " +
|
||||
" " + UtilityDB.valueToString(contrattoPiatt1) + ", " +
|
||||
" " + UtilityDB.valueToString(contrattoPiatt2) + ", " +
|
||||
" " + UtilityDB.valueToString(idRigacontrattoPiatt1) + ", " +
|
||||
" " + UtilityDB.valueToString(idRigacontrattoPiatt2) + ", " +
|
||||
" " + UtilityDB.valueToString(importoPiatt1) + ", " +
|
||||
" " + UtilityDB.valueToString(importoPiatt2) + ", " +
|
||||
" " + UtilityDB.valueToString(importoConPiatt1) + ", " +
|
||||
" " + UtilityDB.valueToString(importoConPiatt2) + ")"; /*Al momento per motivi di Alyante abbiamo dovuto valorizzare a 1 tutti gli importi*/
|
||||
} else {
|
||||
sql = "UPDATE dtb_infoviaggi " +
|
||||
" SET ditta = " + UtilityDB.valueToString(codiceDitta) + ", " +
|
||||
" key_ord =" + UtilityDB.valueToString(keyOrdAlyante) + ", " +
|
||||
" chiave_traxal = " + UtilityDB.valueToString(keyOrd) + ", " +
|
||||
" id_viaggio = " + UtilityDB.valueToString(idViaggio) + ", " +
|
||||
" giro = " + UtilityDB.valueToString(codGiro) + ", " +
|
||||
" cod_vvet1 = " + UtilityDB.valueToString(codVvet) + ", " +
|
||||
" cod_vvet2 = " + UtilityDB.valueToString(codVvet2) + ", " +
|
||||
" cod_vvet3 = " + UtilityDB.valueToString(codVvet3) + ", " +
|
||||
" targa1 = " + UtilityDB.valueToString(targa) + ", " +
|
||||
" cod_piatt1 = " + UtilityDB.valueToString(piattaforma1) + ", " +
|
||||
" cod_piatt2 = " + UtilityDB.valueToString(piattaforma2) + ", " +
|
||||
" contrattoVet1 = " + UtilityDB.valueToString(idContrattoVett1) + ", " +
|
||||
" contrattoVet2 = " + UtilityDB.valueToString(idContrattoVett2) + ", " +
|
||||
" contrattoVet3 = " + UtilityDB.valueToString(idContrattoVett3) + ", " +
|
||||
" rigaContrattoVet1 = " + UtilityDB.valueToString(idRigaContrattoVett1) + ", " +
|
||||
" rigaContrattoVet2 = " + UtilityDB.valueToString(idRigaContrattoVett2) + ", " +
|
||||
" rigaContrattoVet3 = " + UtilityDB.valueToString(idRigaContrattoVett3) + ", " +
|
||||
" importoVet1 = " + UtilityDB.valueToString(importoVett1) + ", " +
|
||||
" importoVet2 = " + UtilityDB.valueToString(importoVett2) + ", " +
|
||||
" importoVet3 = " + UtilityDB.valueToString(importoVett3) + ", " +
|
||||
" importoForfaitVet1 = " + UtilityDB.valueToString(importoConVett1) + ", " +
|
||||
" importoForfaitVet2 = " + UtilityDB.valueToString(importoConVett2) + ", " +
|
||||
" importoForfaitVet3 = " + UtilityDB.valueToString(importoConVett3) + ", " +
|
||||
" contrattoPiat1 = " + UtilityDB.valueToString(contrattoPiatt1) + ", " +
|
||||
" contrattoPiat2 = " + UtilityDB.valueToString(contrattoPiatt2) + ", " +
|
||||
" rigaContrattoPiat1 = " + UtilityDB.valueToString(idRigacontrattoPiatt1) + ", " +
|
||||
" rigaContrattoPiat2 = " + UtilityDB.valueToString(idRigacontrattoPiatt2) + ", " +
|
||||
" importoPiat1 = " + UtilityDB.valueToString(importoPiatt1) + ", " +
|
||||
" importoPiat2 = " + UtilityDB.valueToString(importoPiatt2) + ", " +
|
||||
" importoForfaitPiat1 = " + UtilityDB.valueToString(importoConPiatt1) + ", " +
|
||||
" importoForfaitPiat2 = " + UtilityDB.valueToString(importoConPiatt2) + " " +
|
||||
" WHERE key_ord = " + UtilityDB.valueToString(keyOrdAlyante);
|
||||
}
|
||||
PreparedStatement infoUpd = conAlyante.prepareStatement(sql, ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
|
||||
infoUpd.executeUpdate();
|
||||
infoUpd.close();
|
||||
|
||||
}
|
||||
}
|
||||
res.close();
|
||||
ps.close();
|
||||
|
||||
// Cancellazione ID_Viaggio inviati ad Alyante, ma non più presenti in DMS
|
||||
sql = "select dtb_ordt_local.key_ord, " +
|
||||
" dtb_infoviaggi.id_viaggio " +
|
||||
" from dtb_ordt_local INNER JOIN " + serverObject + ".dtb_infoviaggi ON dtb_ordt_local.key_ord_alyante = dtb_infoviaggi.key_ord COLLATE Latin1_General_100_CI_AS " +
|
||||
" where dtb_ordt_local.id_viaggio is null ";
|
||||
|
||||
whereCond = UtilityString.replaceSubString(whereCond, "dtb_ordr", "dtb_ordt_local");
|
||||
sql = UtilityDB.addwhereCond(sql, whereCond, true);
|
||||
ps = conn.prepareStatement(sql, ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
|
||||
res = ps.executeQuery();
|
||||
while (res.next()) {
|
||||
String keyOrd = res.getString(1);
|
||||
String idViaggio = res.getString(2);
|
||||
|
||||
// Verifica se l'id_viaggio è bloccato
|
||||
Optional<HashMap<String, Object>> lockIdViaggio = Stream.of(resultMap)
|
||||
.filter(x ->
|
||||
((Integer) UtilityHashMap.getValueIfExists(x, "id_viaggio")).equals(idViaggio) &&
|
||||
((String) UtilityHashMap.getValueIfExists(x, "lockIdViaggio")).equalsIgnoreCase("S")).findFirst();
|
||||
|
||||
if (!lockIdViaggio.isPresent() || userUnlockIDViaggio.equalsIgnoreCase("S")) {
|
||||
sql = "delete from dtb_infoviaggi " +
|
||||
" from dtb_infoviaggi " +
|
||||
" where chiave_traxal = " + UtilityDB.valueToString(keyOrd);
|
||||
|
||||
PreparedStatement infoUpd = conAlyante.prepareStatement(sql, ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
|
||||
infoUpd.executeUpdate();
|
||||
infoUpd.close();
|
||||
}
|
||||
}
|
||||
res.close();
|
||||
ps.close();
|
||||
|
||||
conAlyante.commit();
|
||||
} catch (Exception e) {
|
||||
//conAlyante.rollback();
|
||||
if (sql != null) {
|
||||
logger.error("[SYNC_ORGCONS]" + sql);
|
||||
}
|
||||
throw new Exception(e.getMessage());
|
||||
}
|
||||
return response;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -155,7 +155,6 @@ public class CambioTipoDocPlanService {
|
||||
|
||||
if (error) {
|
||||
mLastProcedureStartTime.remove(profileDb);
|
||||
throw new Exception("Errore, controllare il log");
|
||||
} else
|
||||
multiDBTransactionManager.commitAll();
|
||||
}
|
||||
|
||||
@@ -163,6 +163,7 @@ public class GeneraCorrispettiviService {
|
||||
" pv. " + dtbDoct.getCodMdep()
|
||||
));
|
||||
entityReturn.add(dtbDoct);
|
||||
multiDBTransactionManager.commitAll();
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
||||
@@ -43,7 +43,7 @@ public class Slim2kLogisticController {
|
||||
try {
|
||||
multiDBTransactionManager.setPrimaryDB(configuration);
|
||||
logger.debug(requestDataDTO.getUsername() + " " + requestDataDTO.getPassword() + " " + requestDataDTO.getProfileDB());
|
||||
list = slim2kLogisticService.importListeDiScarico(listType, listCode);
|
||||
list.add(ServiceRestResponse.createEntityPositiveResponse(slim2kLogisticService.importListeDiScarico(listType, listCode)));
|
||||
} catch (Exception e) {
|
||||
logger.error(request.getRequestURI(), e);
|
||||
list.add(new ServiceRestResponse(EsitoType.KO, configuration, e));
|
||||
@@ -63,9 +63,8 @@ public class Slim2kLogisticController {
|
||||
@RequestParam(value = "doctype", required = false) String doctype) {
|
||||
List<ServiceRestResponse> list = new ArrayList<ServiceRestResponse>();
|
||||
try {
|
||||
multiDBTransactionManager.setPrimaryDB(configuration);
|
||||
logger.debug(requestDataDTO.getUsername() + " " + requestDataDTO.getPassword() + " " + requestDataDTO.getProfileDB());
|
||||
list = slim2kLogisticService.importListeDiCarico(scode, dcode, docdate, docnum, refdoc);
|
||||
list.add(ServiceRestResponse.createEntityPositiveResponse(slim2kLogisticService.importListeDiCarico(scode, dcode, docdate, docnum, refdoc)));
|
||||
} catch (Exception e) {
|
||||
logger.error(request.getRequestURI(), e);
|
||||
list.add(new ServiceRestResponse(EsitoType.KO, configuration, e));
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -50,9 +50,6 @@ public class OrdiniImporter extends BaseEntityImporter<List<EntityBase>> impleme
|
||||
case SLAV2ORDL:
|
||||
result = getContextBean(ProductionSincroService.class).scaricoVsOrd(requestDto.getWhereCond());
|
||||
break;
|
||||
case BIOLEXCH:
|
||||
result = getContextBean(OrdiniBiolevanteExchService.class).importOrdiniBiolevExch();
|
||||
break;
|
||||
case MAXIDATA:
|
||||
result = getContextBean(ProduzioniLamonarcaMaxidataService.class).importProduzioniLamonarca();
|
||||
break;
|
||||
@@ -106,7 +103,6 @@ public class OrdiniImporter extends BaseEntityImporter<List<EntityBase>> impleme
|
||||
PUDDY("PUDDY"),
|
||||
PUDDY_INCASSI_PREV("PUDDY_INCASSI_PREV"),
|
||||
SLAV2ORDL("SLAV2ORDL"),
|
||||
BIOLEXCH("BIOLEXCH"),
|
||||
CONSORTILE("CONSORTILE"),
|
||||
ORDINIDAAPPROV("ORDINIDAAPPROV"),
|
||||
MAXIDATA("MAXIDATA"),
|
||||
|
||||
@@ -3,7 +3,6 @@ package it.integry.ems.order.Import;
|
||||
|
||||
import it.integry.ems.Import.base.BaseEntityImporter;
|
||||
import it.integry.ems.Import.base.IEntityImporter;
|
||||
import it.integry.ems.order.Import.service.OrdiniVirtuemartService;
|
||||
import it.integry.ems.order.Import.service.OrdiniWebImportService;
|
||||
import it.integry.ems_model.base.EntityBase;
|
||||
import org.springframework.web.context.ContextLoader;
|
||||
@@ -19,10 +18,6 @@ public class OrdiniWebImporter extends BaseEntityImporter implements IEntityImpo
|
||||
|
||||
if (enumFormat != null) {
|
||||
switch (enumFormat) {
|
||||
case VIRTUEMART:
|
||||
OrdiniVirtuemartService OrdiniVirtuemartService = ContextLoader.getCurrentWebApplicationContext().getBean(OrdiniVirtuemartService.class);
|
||||
entities = OrdiniVirtuemartService.importOrdini(username, type, format, (String) requestDto.getRawContent());
|
||||
break;
|
||||
case YOCABE:
|
||||
OrdiniWebImportService ordiniWebImportService = ContextLoader.getCurrentWebApplicationContext().getBean(OrdiniWebImportService.class);
|
||||
entities = ordiniWebImportService.importOrdiniWebYocabe(type, format, requestDto);
|
||||
@@ -39,7 +34,6 @@ public class OrdiniWebImporter extends BaseEntityImporter implements IEntityImpo
|
||||
|
||||
|
||||
public enum Format {
|
||||
VIRTUEMART("VIRTUEMART"),
|
||||
YOCABE("YOCABE");
|
||||
|
||||
private String text;
|
||||
|
||||
@@ -1,492 +0,0 @@
|
||||
package it.integry.ems.order.Import.service;
|
||||
|
||||
import it.integry.ems._context.ApplicationContextProvider;
|
||||
import it.integry.ems.datasource.DataSource;
|
||||
import it.integry.ems.product.importaz.service.ImportAnagListiniService;
|
||||
import it.integry.ems.service.EntityProcessor;
|
||||
import it.integry.ems.sync.MultiDBTransaction.Connection;
|
||||
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
|
||||
import it.integry.ems_model.base.EntityBase;
|
||||
import it.integry.ems_model.entity.*;
|
||||
import it.integry.ems_model.entity._enum.FlagEvaso;
|
||||
import it.integry.ems_model.service.SetupGest;
|
||||
import it.integry.ems_model.types.OperationType;
|
||||
import it.integry.ems_model.utility.UtilityDB;
|
||||
import it.integry.ems_model.utility.UtilityString;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.context.ContextLoader;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.Statement;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Service
|
||||
public class OrdiniBiolevanteExchService {
|
||||
|
||||
private final Logger logger = LogManager.getLogger();
|
||||
@Autowired
|
||||
private SetupGest setupGest;
|
||||
private Date mLastProcedureStartTime = null;
|
||||
|
||||
public List<EntityBase> importOrdiniBiolevExch() throws Exception {
|
||||
ImportAnagListiniService importAnagListiniService = ContextLoader.getCurrentWebApplicationContext().getBean(ImportAnagListiniService.class);
|
||||
MultiDBTransactionManager multiDBTransactionManager = ContextLoader.getCurrentWebApplicationContext().getBean(MultiDBTransactionManager.class);
|
||||
EntityProcessor entityProcessor = ApplicationContextProvider.getApplicationContext().getBean(EntityProcessor.class);
|
||||
|
||||
String profileSource, sql, codJcom, descrCommessaFormato, ragSoc, destinatario, descrCommessa = "", codTcol,
|
||||
gestione = "V", rifOrd, codAnag, codVdes, untOrd, codTcolUl, codMart, codMdep, diacod,
|
||||
addressId, codMdepDefault, serie, serieOld = "", note, noteOrd, noteRigaOrd, termCons;
|
||||
Date dataOrd, dataCons, dataOrdOld = null, dataConsOld = null;
|
||||
BigDecimal qtaOrd;
|
||||
BigDecimal prezzo;
|
||||
BigDecimal numCnf;
|
||||
BigDecimal colliPedana;
|
||||
Integer numOrd;
|
||||
Integer rigaOrd;
|
||||
Integer numOrdProv;
|
||||
Integer numOrdProvOld = 0;
|
||||
|
||||
PreparedStatement info;
|
||||
ResultSet res;
|
||||
List<EntityBase> entityList = new ArrayList<EntityBase>();
|
||||
List<EntityBase> toBeProcessed = new ArrayList<EntityBase>();
|
||||
List<DtbOrdr> dtbOrdrList = new ArrayList<DtbOrdr>();
|
||||
DtbOrdt dtbOrdt = new DtbOrdt();
|
||||
List<EntityBase> arrayLisv = new ArrayList<EntityBase>();
|
||||
Connection conn = multiDBTransactionManager.getPrimaryConnection();
|
||||
|
||||
Map<String, String> setup = setupGest.getImportSetupSection(conn, "ORDINI VENDITA", "BIOLEXCH");
|
||||
|
||||
profileSource = setup.get("PROFILEDB");
|
||||
if (UtilityString.isNullOrEmpty(profileSource)) {
|
||||
throw new Exception("CONFIGURARE PROFILEDB EXCH2WINGEST IN STB_GEST_SETUP.");
|
||||
}
|
||||
|
||||
DataSource dsExch2Wingest = new DataSource();
|
||||
dsExch2Wingest.initialize(profileSource);
|
||||
Connection connExch2Wingest = dsExch2Wingest.getConnection();
|
||||
|
||||
if (mLastProcedureStartTime != null)
|
||||
throw new Exception("Non è possibile far partire la procedura di importazione ordini in quanto già lanciata alle " + UtilityDB.valueDateToString(mLastProcedureStartTime, "yyyy-MM-dd HH:mm:ss"));
|
||||
|
||||
try {
|
||||
codMdepDefault = setup.get("COD_MDEP_DEFAULT");
|
||||
descrCommessaFormato = setupGest.getSetup(conn, "w_dordi_rc", "CREA_COMMESSA", "FORMATO_DESCRIZIONE");
|
||||
if (UtilityString.isNullOrEmpty(descrCommessaFormato)) {
|
||||
throw new Exception("CONFIGURARE UN FORMATO DI DESCRIZIONE PER LA CREAZIONE DELLA COMMESSA IN STB_GEST_SETUP.");
|
||||
}
|
||||
|
||||
// QUERY PER CONTROLLARE SE LA PROCEDURA E' GIA' IN ESECUZIONE
|
||||
mLastProcedureStartTime = new Date();
|
||||
|
||||
// QUERY aggiunta per annullare ordini non presenti su db di scambio
|
||||
// " and rif_ord like '20[1-2][0-9][A-Z] [0-9][0-9][0-9][0-9][0-9][0-9]'" +
|
||||
//
|
||||
sql = "update Biolevante.dbo.dtb_ordt set flag_annulla = 'S' " +
|
||||
" where gestione = 'V' " +
|
||||
" and num_ord_provv is not null " +
|
||||
" and serie is not null " +
|
||||
" and flag_annulla = 'N' " +
|
||||
" and Convert(varchar(4), Year(data_ord))+serie +' '+replicate('0', 6 - Len(num_ord_provv))+Convert(varchar(6),num_ord_provv) not in (select distinct OrdNum from BiolevanteExch.dbo.ShippingOrders)";
|
||||
Statement cmd = multiDBTransactionManager.getPrimaryConnection().createStatement();
|
||||
cmd.executeUpdate(sql);
|
||||
multiDBTransactionManager.getPrimaryConnection().commit();
|
||||
cmd.close();
|
||||
|
||||
|
||||
// COMMESSE
|
||||
sql = "select distinct PlurimaShippingOrders.CommissionID as cod_jcom, " +
|
||||
" Companies.compName as rag_soc, " +
|
||||
" Addresses.address as destinatario" +
|
||||
" from PlurimaShippingOrders LEFT OUTER JOIN Addresses ON PlurimaShippingOrders.compId = Addresses.compId AND PlurimaShippingOrders.addressId = Addresses.addressId, Companies " +
|
||||
"where PlurimaShippingOrders.compId = Companies.CompId and isnull(PlurimaShippingOrders.CommissionID,'') <>''";
|
||||
|
||||
info = connExch2Wingest.prepareStatement(sql, ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
|
||||
res = info.executeQuery();
|
||||
while (res.next()) {
|
||||
codJcom = res.getString("cod_jcom");
|
||||
ragSoc = res.getString("rag_soc");
|
||||
destinatario = res.getString("destinatario");
|
||||
|
||||
if (descrCommessaFormato.compareTo("RAG_SOC") == 0) {
|
||||
descrCommessa = ragSoc;
|
||||
} else if (descrCommessaFormato.compareTo("RAG_SOC+DEST") == 0) {
|
||||
descrCommessa = ragSoc + " " + destinatario;
|
||||
}
|
||||
JtbComt jtbComt = new JtbComt();
|
||||
jtbComt.setOperation(OperationType.INSERT_OR_UPDATE);
|
||||
jtbComt.setCodJcom(codJcom);
|
||||
jtbComt.setDescrizione(descrCommessa);
|
||||
|
||||
toBeProcessed.add(jtbComt);
|
||||
}
|
||||
res.close();
|
||||
info.close();
|
||||
sql = "select distinct PlurimaShippingOrders.palletType as cod_tcol " +
|
||||
" from PlurimaShippingOrders " +
|
||||
"where isnull(PlurimaShippingOrders.palletType,'') <>''";
|
||||
|
||||
info = connExch2Wingest.prepareStatement(sql, ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
|
||||
res = info.executeQuery();
|
||||
while (res.next()) {
|
||||
codTcol = res.getString("cod_tcol");
|
||||
|
||||
MtbTcol mtbTcol = new MtbTcol();
|
||||
mtbTcol.setOperation(OperationType.INSERT_OR_UPDATE);
|
||||
mtbTcol.setCodTcol(codTcol);
|
||||
mtbTcol.setFlagUiUl("UL");
|
||||
|
||||
toBeProcessed.add(mtbTcol);
|
||||
}
|
||||
res.close();
|
||||
info.close();
|
||||
sql = "select PlurimaShippingOrders.OrdDate as data_ord, " +
|
||||
" PlurimaShippingOrders.OrdNum as num_ord, " +
|
||||
" PlurimaShippingOrders.OrdRow as riga_ord, " +
|
||||
" PlurimaShippingOrders.CompId as diacod, " +
|
||||
" PlurimaShippingOrders.addressId as cod_vdes, " +
|
||||
" PlurimaShippingOrders.WareHouse as cod_mdep, " +
|
||||
" PlurimaShippingOrders.ShipDate as data_cons, " +
|
||||
" PlurimaShippingOrders.itemId as cod_mart, " +
|
||||
" CASE WHEN isnull(PlurimaShippingOrders.UM,'') = '' THEN Biolevante.dbo.mtb_aart.unt_mis ELSE PlurimaShippingOrders.UM END as unt_ord, " +
|
||||
" PlurimaShippingOrders.qty as qta_ord, " +
|
||||
" PlurimaShippingOrders.NumPack as num_cnf, " +
|
||||
" PlurimaShippingOrders.commissionId as cod_jcom, " +
|
||||
" PlurimaShippingOrders.custNpackPallet as colli_pedana, " +
|
||||
" PlurimaShippingOrders.palletType as cod_tcol_ul, " +
|
||||
" PlurimaShippingOrders.prezzo," +
|
||||
" PlurimaShippingOrders.serie, " +
|
||||
" PlurimaShippingOrders.num_ord_prov, " +
|
||||
" PlurimaShippingOrders.rifOrd, " +
|
||||
" PlurimaShippingOrders.note, " +
|
||||
" PlurimaShippingOrders.NoteOrd, " +
|
||||
" PlurimaShippingOrders.NoteRigaOrd, " +
|
||||
" PlurimaShippingOrders.TermCons, " +
|
||||
" PlurimaShippingOrders.pedane " +
|
||||
" from PlurimaShippingOrders, Items LEFT OUTER JOIN Biolevante.dbo.mtb_aart ON Items.ItemId = Biolevante.dbo.mtb_aart.cod_mart, ItemGroups, ItemSgroups " +
|
||||
"where PlurimaShippingOrders.ItemId = Items.ItemID AND " +
|
||||
" Items.GroupId = ItemGroups.GroupId AND " +
|
||||
" Items.SgroupId = ItemSgroups.SgroupId AND " +
|
||||
" PlurimaShippingOrders.CompId not in (SELECT value_string FROM Biolevante.dbo.parseStringIntoArray(" + UtilityDB.valueToString(setup.get("ESLCUDI_CLIENTI")) + ", '|')) " +
|
||||
" order by PlurimaShippingOrders.OrdDate, " +
|
||||
" PlurimaShippingOrders.OrdNum," +
|
||||
" PlurimaShippingOrders.ShipDate, " +
|
||||
" PlurimaShippingOrders.OrdRow ";
|
||||
|
||||
info = connExch2Wingest.prepareStatement(sql, ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
|
||||
res = info.executeQuery();
|
||||
while (res.next()) {
|
||||
dataOrd = res.getDate("data_ord");
|
||||
rigaOrd = res.getInt("riga_ord");
|
||||
diacod = res.getString("diacod");
|
||||
addressId = res.getString("cod_vdes");
|
||||
codMdep = res.getString("cod_mdep");
|
||||
dataCons = res.getDate("data_cons");
|
||||
codMart = res.getString("cod_mart");
|
||||
untOrd = res.getString("unt_ord");
|
||||
qtaOrd = res.getBigDecimal("qta_ord");
|
||||
numCnf = res.getBigDecimal("num_cnf");
|
||||
codJcom = res.getString("cod_jcom").trim();
|
||||
colliPedana = res.getBigDecimal("colli_pedana");
|
||||
codTcolUl = res.getString("cod_tcol_ul");
|
||||
prezzo = res.getBigDecimal("prezzo");
|
||||
serie = res.getString("serie");
|
||||
numOrdProv = res.getInt("num_ord_prov");
|
||||
rifOrd = UtilityString.left(UtilityString.streNull(res.getString("rifOrd")).trim(), 40);
|
||||
note = UtilityString.left(res.getString("note"), 255);
|
||||
String flagStato = isArticoloAttivo(conn, codMart);
|
||||
noteOrd = res.getString("NoteOrd");
|
||||
noteRigaOrd = res.getString("NoteRigaOrd");
|
||||
termCons = res.getString("TermCons");
|
||||
Integer pedane = res.getInt("pedane");
|
||||
|
||||
String untMisVen = getUntMisVen(conn, codMart, untOrd);
|
||||
|
||||
final VtbDest vtbDest = findAnag(conn, diacod, addressId);
|
||||
|
||||
if (vtbDest.getCodAnag() != null) {
|
||||
if (UtilityString.streNull(flagStato).compareTo("A") == 0 && !UtilityString.isNullOrEmpty(untMisVen)) {
|
||||
|
||||
VtbList vtbListRet = findCodVlis(conn, vtbDest.getCodAnag());
|
||||
if (vtbListRet.getCodVlis() == null) {
|
||||
VtbList vtbList = new VtbList();
|
||||
vtbList.setOperation(OperationType.INSERT_OR_UPDATE);
|
||||
vtbList.setCodVlis(vtbDest.getCodAnag());
|
||||
vtbList.setDescrizione(vtbListRet.getDescrizione());
|
||||
arrayLisv.add(vtbList);
|
||||
|
||||
GtbAnag gtbAnag = new GtbAnag();
|
||||
gtbAnag.setCodAnag(vtbDest.getCodAnag());
|
||||
VtbClie vtbClie = new VtbClie();
|
||||
vtbClie.setOperation(OperationType.UPDATE);
|
||||
vtbClie.setCodAnag(vtbDest.getCodAnag());
|
||||
vtbClie.setCodVlis(vtbDest.getCodAnag());
|
||||
gtbAnag.setVtbClie(vtbClie);
|
||||
toBeProcessed.add(gtbAnag);
|
||||
}
|
||||
if (findCodMartMtbLisv(conn, vtbDest.getCodAnag(), codMart) == 0) {
|
||||
MtbLisvData mtbLisvData = new MtbLisvData();
|
||||
mtbLisvData.setOperation(OperationType.INSERT_OR_UPDATE);
|
||||
mtbLisvData.setCodVlis(vtbDest.getCodAnag());
|
||||
mtbLisvData.setUntMisVen(untMisVen);
|
||||
mtbLisvData.setRapConv(BigDecimal.ONE);
|
||||
mtbLisvData.setDataIniz(dataOrd);
|
||||
mtbLisvData.setCodMart(codMart);
|
||||
mtbLisvData.setPrzBase(BigDecimal.ZERO);
|
||||
|
||||
arrayLisv.add(mtbLisvData);
|
||||
}
|
||||
}
|
||||
|
||||
if (serie.compareTo(serieOld) != 0 || dataOrd.compareTo(dataOrdOld) != 0 || numOrdProv.compareTo(numOrdProvOld) != 0) {
|
||||
if (!dtbOrdrList.isEmpty()) {
|
||||
dtbOrdt.setDtbOrdr(dtbOrdrList);
|
||||
toBeProcessed.add(dtbOrdt);
|
||||
}
|
||||
|
||||
numOrd = findOrder(conn, dataOrd, serie, numOrdProv);
|
||||
codAnag = vtbDest.getCodAnag();
|
||||
codVdes = vtbDest.getCodVdes();
|
||||
|
||||
dtbOrdrList = new ArrayList<>();
|
||||
|
||||
dtbOrdt = new DtbOrdt();
|
||||
if (numOrd == 0) {
|
||||
dtbOrdt.setOperation(OperationType.INSERT);
|
||||
} else {
|
||||
dtbOrdt.setOperation(OperationType.DELETE_THEN_INSERT);
|
||||
}
|
||||
dtbOrdt.setNumOrd(numOrd);
|
||||
dtbOrdt.setDataOrd(dataOrd);
|
||||
if (UtilityString.streNull(rifOrd).compareTo("") == 0) {
|
||||
rifOrd = "[NULL]";
|
||||
}
|
||||
dtbOrdt.setRifOrd(rifOrd);
|
||||
dtbOrdt.setFlagAnnulla("N");
|
||||
dtbOrdt.setNumOrdProvv(numOrdProv);
|
||||
dtbOrdt.setSerie(serie);
|
||||
|
||||
if (!UtilityString.isNullOrEmpty(codMdepDefault)) {
|
||||
dtbOrdt.setCodMdep(codMdepDefault);
|
||||
} else {
|
||||
dtbOrdt.setCodMdep(codMdep);
|
||||
}
|
||||
|
||||
dtbOrdt.setCodAnag(codAnag);
|
||||
dtbOrdt.setCodVdes(codVdes);
|
||||
dtbOrdt.setGestione(gestione);
|
||||
dtbOrdt.setPostiPallet(pedane);
|
||||
dtbOrdt.setDataInizTrasp(dataCons);
|
||||
if (!UtilityString.isNullOrEmpty(codJcom)) {
|
||||
dtbOrdt.setCodJcom(codJcom);
|
||||
}
|
||||
if (!UtilityString.isNullOrEmpty(noteOrd)) {
|
||||
dtbOrdt.setNote(noteOrd);
|
||||
}
|
||||
if (!UtilityString.isNullOrEmpty(termCons)) {
|
||||
dtbOrdt.setTermCons(termCons);
|
||||
}
|
||||
}
|
||||
|
||||
DtbOrdr dtbOrdr = new DtbOrdr();
|
||||
if (dtbOrdt.getOperation() == OperationType.INSERT) {
|
||||
dtbOrdr.setOperation(OperationType.INSERT);
|
||||
} else {
|
||||
dtbOrdr.setOperation(OperationType.DELETE_THEN_INSERT);
|
||||
}
|
||||
dtbOrdr.setCodMart(codMart);
|
||||
dtbOrdr.setDescrizione(null);
|
||||
dtbOrdr.setDescrizioneEstesa(null);
|
||||
dtbOrdr.setUntOrd(untOrd);
|
||||
dtbOrdr.setQtaOrd(qtaOrd);
|
||||
dtbOrdr.setValUnt(prezzo);
|
||||
dtbOrdr.setRigaOrd(rigaOrd);
|
||||
if (numCnf.equals(BigDecimal.ZERO)) {
|
||||
numCnf = BigDecimal.ONE;
|
||||
}
|
||||
dtbOrdr.setNumCnf(numCnf);
|
||||
dtbOrdr.setNote(note);
|
||||
if (codJcom.compareTo("") != 0) {
|
||||
dtbOrdr.setCodJcom(codJcom);
|
||||
}
|
||||
dtbOrdr.setColliPedana(colliPedana);
|
||||
dtbOrdr.setCodTcolUl(codTcolUl);
|
||||
dtbOrdr.setDataCons(dataCons);
|
||||
if (UtilityString.streNull(flagStato).compareTo("I") == 0) {
|
||||
dtbOrdr.setFlagEvaso(FlagEvaso.ANNULLATO);
|
||||
}
|
||||
if (!UtilityString.isNullOrEmpty(noteRigaOrd)) {
|
||||
dtbOrdr.setNote(noteRigaOrd);
|
||||
}
|
||||
dtbOrdrList.add(dtbOrdr);
|
||||
}
|
||||
|
||||
dataOrdOld = dataOrd;
|
||||
dataConsOld = dataCons;
|
||||
serieOld = serie;
|
||||
numOrdProvOld = numOrdProv;
|
||||
}
|
||||
res.close();
|
||||
info.close();
|
||||
if (!dtbOrdrList.isEmpty()) {
|
||||
dtbOrdt.setDtbOrdr(dtbOrdrList);
|
||||
toBeProcessed.add(dtbOrdt);
|
||||
}
|
||||
|
||||
|
||||
if (!arrayLisv.isEmpty()) {
|
||||
|
||||
arrayLisv = importAnagListiniService.importAnagListinoAcq(arrayLisv, "V", null, null);
|
||||
|
||||
for (EntityBase entityBase : arrayLisv) {
|
||||
if (entityBase.getException() != null) {
|
||||
throw entityBase.getException();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!toBeProcessed.isEmpty()) {
|
||||
entityList = entityProcessor.processEntityList(toBeProcessed, false);
|
||||
for (EntityBase entityBase : entityList) {
|
||||
if (entityBase.getException() != null) {
|
||||
throw entityBase.getException();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
mLastProcedureStartTime = null;
|
||||
|
||||
} catch (Exception ex) {
|
||||
mLastProcedureStartTime = null;
|
||||
|
||||
logger.error(ex);
|
||||
throw ex;
|
||||
} finally {
|
||||
mLastProcedureStartTime = null;
|
||||
}
|
||||
return entityList;
|
||||
}
|
||||
|
||||
private Integer findOrder(Connection connect, Date dataOrd, String serie, Integer numOrdProv) throws Exception {
|
||||
Integer numOrd = 0;
|
||||
ResultSet res;
|
||||
PreparedStatement info;
|
||||
String sql;
|
||||
|
||||
sql = "SELECT num_ord " +
|
||||
" FROM dtb_ordt " +
|
||||
" WHERE gestione = 'V' and serie = " + UtilityDB.valueToString(serie) + " and num_ord_provv = " + UtilityDB.valueToString(numOrdProv) + " and data_ord = " + UtilityDB.valueDateToString(dataOrd, "yyyy-MM-dd");
|
||||
|
||||
info = connect.prepareStatement(sql, ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
|
||||
res = info.executeQuery();
|
||||
while (res.next()) {
|
||||
numOrd = res.getInt("num_ord");
|
||||
}
|
||||
res.close();
|
||||
info.close();
|
||||
|
||||
return numOrd;
|
||||
}
|
||||
|
||||
private VtbDest findAnag(Connection connect, String diacod, String addressId) throws Exception {
|
||||
String codAnag = null, codVdes = null;
|
||||
VtbDest entity = new VtbDest();
|
||||
ResultSet res;
|
||||
PreparedStatement info;
|
||||
String sql;
|
||||
|
||||
sql = "SELECT gtb_anag.cod_anag, cod_vdes " +
|
||||
" FROM gtb_anag LEFT OUTER JOIN vtb_dest ON gtb_anag.cod_anag = vtb_dest.cod_anag AND vtb_dest.cod_ean = " + UtilityDB.valueToString(addressId) +
|
||||
" WHERE diacod = " + UtilityDB.valueToString(diacod);
|
||||
|
||||
info = connect.prepareStatement(sql, ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
|
||||
res = info.executeQuery();
|
||||
while (res.next()) {
|
||||
codAnag = res.getString("cod_anag");
|
||||
codVdes = res.getString("cod_vdes");
|
||||
}
|
||||
res.close();
|
||||
info.close();
|
||||
entity.setCodAnag(codAnag);
|
||||
entity.setCodVdes(codVdes);
|
||||
|
||||
return entity;
|
||||
}
|
||||
|
||||
private VtbList findCodVlis(Connection connect, String codAnag) throws Exception {
|
||||
String codVlis = null, descrizione = null;
|
||||
Integer count = 0;
|
||||
VtbList entity = new VtbList();
|
||||
ResultSet res;
|
||||
PreparedStatement info;
|
||||
String sql;
|
||||
|
||||
sql = "SELECT count(vtb_list.cod_vlis), gtb_anag.rag_soc " +
|
||||
" FROM gtb_anag LEFT OUTER JOIN vtb_list ON vtb_list.cod_vlis = gtb_anag.cod_anag " +
|
||||
" WHERE gtb_anag.cod_anag = " + UtilityDB.valueToString(codAnag) +
|
||||
" GROUP BY gtb_anag.rag_soc";
|
||||
|
||||
info = connect.prepareStatement(sql, ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
|
||||
res = info.executeQuery();
|
||||
while (res.next()) {
|
||||
count = res.getInt(1);
|
||||
descrizione = res.getString(2);
|
||||
}
|
||||
res.close();
|
||||
info.close();
|
||||
if (count > 0) {
|
||||
codVlis = codAnag;
|
||||
}
|
||||
entity.setCodVlis(codVlis);
|
||||
entity.setDescrizione(descrizione);
|
||||
|
||||
return entity;
|
||||
}
|
||||
|
||||
private Integer findCodMartMtbLisv(Connection connect, String codAnag, String codMart) throws Exception {
|
||||
Integer count = 0;
|
||||
ResultSet res;
|
||||
PreparedStatement info;
|
||||
String sql;
|
||||
|
||||
sql = "SELECT count(mtb_lisv_data.cod_mart) " +
|
||||
" FROM mtb_lisv_data " +
|
||||
" WHERE mtb_lisv_data.cod_vlis = " + UtilityDB.valueToString(codAnag) + " AND " +
|
||||
" mtb_lisv_data.cod_mart = " + UtilityDB.valueToString(codMart);
|
||||
|
||||
info = connect.prepareStatement(sql, ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
|
||||
res = info.executeQuery();
|
||||
while (res.next()) {
|
||||
count = res.getInt(1);
|
||||
}
|
||||
res.close();
|
||||
info.close();
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
private String isArticoloAttivo(Connection connect, String codMart) throws Exception {
|
||||
String sql = "SELECT flag_stato " +
|
||||
" FROM mtb_aart " +
|
||||
" WHERE cod_mart = " + UtilityDB.valueToString(codMart);
|
||||
|
||||
return UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(connect, sql);
|
||||
}
|
||||
|
||||
private String getUntMisVen(Connection connect, String codMart, String untOrd) throws Exception {
|
||||
String sql = "SELECT CASE WHEN '" + untOrd + "' = mtb_aart.unt_mis THEN mtb_aart.unt_mis ELSE (CASE WHEN '" + untOrd + "' = mtb_aart.unt_mis2 THEN mtb_aart.unt_mis2 ELSE (CASE WHEN '" + untOrd + "' = mtb_aart.unt_mis3 THEN mtb_aart.unt_mis3 ELSE '' END) END) END as untMisVen " +
|
||||
" FROM mtb_aart " +
|
||||
" WHERE cod_mart = " + UtilityDB.valueToString(codMart);
|
||||
|
||||
return UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(connect, sql);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,400 +0,0 @@
|
||||
package it.integry.ems.order.Import.service;
|
||||
|
||||
import it.integry.common.var.CommonConstants;
|
||||
import it.integry.ems.file_formatter.csv.CsvMapper;
|
||||
import it.integry.ems.properties.EmsProperties;
|
||||
import it.integry.ems.service.EntityProcessor;
|
||||
import it.integry.ems.service.MailService;
|
||||
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
|
||||
import it.integry.ems.system.imports.dto.OrdineDTO;
|
||||
import it.integry.ems.system.service.AnagImportService;
|
||||
import it.integry.ems_model.base.EntityBase;
|
||||
import it.integry.ems_model.config.EmsRestConstants;
|
||||
import it.integry.ems_model.coollection.Coollection;
|
||||
import it.integry.ems_model.db.ResultSetMapper;
|
||||
import it.integry.ems_model.entity.*;
|
||||
import it.integry.ems_model.service.SetupGest;
|
||||
import it.integry.ems_model.types.OperationType;
|
||||
import it.integry.ems_model.utility.UtilityDB;
|
||||
import it.integry.ems_model.utility.UtilityHashMap;
|
||||
import it.integry.ems_model.utility.UtilityString;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.math.BigDecimal;
|
||||
import java.net.URL;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.util.*;
|
||||
|
||||
@Service
|
||||
@Scope(value = "request")
|
||||
public class OrdiniVirtuemartService {
|
||||
|
||||
@Autowired
|
||||
private SetupGest setupGest;
|
||||
|
||||
@Autowired
|
||||
private EntityProcessor entityProcessor;
|
||||
|
||||
@Autowired
|
||||
private EmsProperties emsProperties;
|
||||
|
||||
@Autowired
|
||||
private MailService mailService;
|
||||
|
||||
@Autowired
|
||||
private AnagImportService anagImportService;
|
||||
|
||||
@Autowired
|
||||
private MultiDBTransactionManager multiDBTransactionManager;
|
||||
|
||||
public List<EntityBase> importOrdini(String username, String type, String format, String rawContent) throws Exception {
|
||||
|
||||
List<EntityBase> entities = new ArrayList<EntityBase>();
|
||||
|
||||
|
||||
CsvMapper<OrdineDTO> mapper = new CsvMapper<OrdineDTO>();
|
||||
List<OrdineDTO> ordini = mapper.deserialize(rawContent, OrdineDTO.class, "\t");
|
||||
if (ordini == null) throw new Exception("Nessun ordine da importare");
|
||||
|
||||
Map<String, String> mapCurrency = new HashMap<String, String>();
|
||||
|
||||
Date dataOrdOld = new Date();
|
||||
Integer numOrdOld = 0;
|
||||
Integer productId = 0;
|
||||
GtbAnag anag = null;
|
||||
|
||||
|
||||
HashMap<String, String> setupGestImportMap = (HashMap<String, String>) setupGest.getImportSetupSection(multiDBTransactionManager.getPrimaryConnection(), type, format);
|
||||
|
||||
String codMdep = UtilityHashMap.getValueIfExists(setupGestImportMap, "COD_MDEP");
|
||||
String codPagaContr = UtilityHashMap.getValueIfExists(setupGestImportMap, "COD_PAGA_CONTR");
|
||||
String codVage = UtilityHashMap.getValueIfExists(setupGestImportMap, "COD_VAGE");
|
||||
String serie = UtilityHashMap.getValueIfExists(setupGestImportMap, "SERIE");
|
||||
String defaultCodAnag = UtilityHashMap.getValueIfExists(setupGestImportMap, "COD_ANAG");
|
||||
|
||||
|
||||
String from = UtilityHashMap.getValueIfExists(setupGestImportMap, "MAIL_FROM");
|
||||
String ccn = UtilityHashMap.getValueIfExists(setupGestImportMap, "MAIL_CCN");
|
||||
String mailTemplateUrl = UtilityHashMap.getValueIfExists(setupGestImportMap, "MAIL_TEMPLATE_URL");
|
||||
|
||||
if (UtilityString.isNullOrEmpty(mailTemplateUrl))
|
||||
throw new Exception("IMPORT_ORDINI WEB/CONQUIST/MAIL_TEMPLATE_URL non configurato correttamente");
|
||||
URL url = new URL(mailTemplateUrl + "/mail_presa_ordine.html");
|
||||
InputStream is = url.openStream();
|
||||
String mailText = IOUtils.toString(is);
|
||||
is.close();
|
||||
|
||||
if (UtilityString.isNullOrEmpty(codMdep))
|
||||
throw new Exception("IMPORT_ORDINI WEB/CONQUIST/COD_MDEP non configurato correttamente");
|
||||
|
||||
if (UtilityString.isNullOrEmpty(serie))
|
||||
throw new Exception("IMPORT_ORDINI WEB/CONQUIST/SERIE non configurato correttamente");
|
||||
|
||||
if (UtilityString.isNullOrEmpty(defaultCodAnag))
|
||||
throw new Exception("IMPORT_ORDINI WEB/CONQUIST/COD_ANAG non configurato correttamente");
|
||||
|
||||
|
||||
ordini = Coollection.from(ordini).orderBy("orderNumber").all();
|
||||
|
||||
WdtbOrdt ordineWeb = null;
|
||||
Date dateNow;
|
||||
|
||||
String negozioScelto = "";
|
||||
String email = "";
|
||||
|
||||
boolean existOrd = false;
|
||||
boolean rigaDestPresente = false;
|
||||
|
||||
for (int i = 0; i < ordini.size(); i++) {
|
||||
|
||||
OrdineDTO ordine = ordini.get(i);
|
||||
if (ordine.getCreatedOn() != null & dataOrdOld.compareTo(ordine.getCreatedOn()) != 0 &&
|
||||
!numOrdOld.equals(ordine.getVirtuemartOrderId())) {
|
||||
|
||||
dateNow = new Date();
|
||||
negozioScelto = "";
|
||||
rigaDestPresente = false;
|
||||
email = "";
|
||||
|
||||
//controllo esistenza ordine
|
||||
String sql =
|
||||
"SELECT count(*) as count_ords" +
|
||||
" FROM wdtb_ordt " +
|
||||
" WHERE wdtb_ordt.rif_ord = " + UtilityDB.valueToString(ordine.getOrderNumber()) + " AND " +
|
||||
"wdtb_ordt.num_ord_rif = " + UtilityDB.valueToString(ordine.getVirtuemartOrderId()) + " AND " +
|
||||
"wdtb_ordt.data_ord_rif = " + UtilityDB.valueDateToString(ordine.getCreatedOn(), CommonConstants.DATE_FORMAT_YMD);
|
||||
|
||||
HashMap<String, Object> resultCountOrdini = UtilityDB.executeSimpleQueryOnlyFirstRow(multiDBTransactionManager.getPrimaryConnection(), sql);
|
||||
|
||||
existOrd = false;
|
||||
if (resultCountOrdini != null) {
|
||||
Integer countOrds = UtilityHashMap.getValueIfExists(resultCountOrdini, "count_ords");
|
||||
existOrd = countOrds != null && countOrds > 0;
|
||||
}
|
||||
|
||||
if (!existOrd) {
|
||||
ordineWeb = new WdtbOrdt();
|
||||
ordineWeb.setOperation(OperationType.INSERT_OR_UPDATE);
|
||||
ordineWeb.setWdtbOrdr(new ArrayList<WdtbOrdr>());
|
||||
ordineWeb.setGestione("V");
|
||||
ordineWeb.setCodVage(codVage);
|
||||
|
||||
if (mapCurrency.get(ordine.getUserCurrency()) == null) {
|
||||
sql = "SELECT cod_divi FROM gtb_divi "
|
||||
+ "where cod_divi_iso = " + UtilityDB.valueToString(ordine.getUserCurrency());
|
||||
|
||||
HashMap<String, Object> resultCodDivi = UtilityDB.executeSimpleQueryOnlyFirstRow(multiDBTransactionManager.getPrimaryConnection(), sql);
|
||||
|
||||
if (resultCodDivi != null) {
|
||||
String codDivi = UtilityHashMap.getValueIfExists(resultCodDivi, "cod_divi");
|
||||
mapCurrency.put(ordine.getUserCurrency(), codDivi);
|
||||
}
|
||||
}
|
||||
|
||||
ordineWeb.setCodDivi(mapCurrency.get(ordine.getUserCurrency()));
|
||||
ordineWeb.setCodMdep(codMdep);
|
||||
|
||||
ordineWeb.setDataOrd(dateNow);
|
||||
ordineWeb.setRifOrd(ordine.getOrderNumber());
|
||||
ordineWeb.setDataOrdRif(ordine.getCreatedOn());
|
||||
ordineWeb.setNumOrdRif(ordine.getVirtuemartOrderId());
|
||||
ordineWeb.setSerie(serie);
|
||||
ordineWeb.setDataInsOrd(dateNow);
|
||||
ordineWeb.setCompilatoDa("IMPORT_CONQUIST");
|
||||
ordineWeb.setNote(ordine.getCustomerNote());
|
||||
if (ordine.getOrderPayment().compareTo(BigDecimal.ZERO) > 0) {
|
||||
ordineWeb.setCodPaga(codPagaContr);
|
||||
}
|
||||
|
||||
entities.add(ordineWeb);
|
||||
|
||||
dataOrdOld = ordine.getCreatedOn();
|
||||
numOrdOld = ordine.getVirtuemartOrderId();
|
||||
//annullamento del product ID
|
||||
productId = -1;
|
||||
}
|
||||
}
|
||||
|
||||
if (!existOrd) {
|
||||
if (rigaDestPresente && UtilityString.isNullOrEmpty(negozioScelto)) {
|
||||
createOrGetDestMerce(ordineWeb, ordine, negozioScelto, email, defaultCodAnag, multiDBTransactionManager);
|
||||
}
|
||||
|
||||
if (dataOrdOld.compareTo(ordine.getCreatedOn()) == 0 && numOrdOld.equals(ordine.getVirtuemartOrderId()) &&
|
||||
!productId.equals(ordine.getVirtuemartProductId())) {
|
||||
|
||||
dataOrdOld = ordine.getCreatedOn();
|
||||
numOrdOld = ordine.getVirtuemartOrderId();
|
||||
productId = ordine.getVirtuemartProductId();
|
||||
negozioScelto = ordine.getNegozioScelto();
|
||||
email = ordine.getEmail();
|
||||
|
||||
WdtbOrdr row = new WdtbOrdr();
|
||||
row.setOperation(OperationType.INSERT_OR_UPDATE);
|
||||
ordineWeb.getWdtbOrdr().add(row);
|
||||
|
||||
String sql = "select ttb_bar_code.cod_style, ttb_bar_code.cod_col, "
|
||||
+ " ttb_bar_code.cod_tagl, mtb_aart.descrizione, mtb_aart.cod_aliq, aliq.perc_aliq"
|
||||
+ " from mtb_aart, ttb_bar_code, gtb_aliq aliq"
|
||||
+ " where cod_barre = " + UtilityDB.valueToString(ordine.getOrderItemSku())
|
||||
+ " and mtb_aart.cod_mart = ttb_bar_code.cod_style and mtb_aart.cod_aliq = aliq.cod_aliq";
|
||||
|
||||
HashMap<String, Object> resultQuery = UtilityDB.executeSimpleQueryOnlyFirstRow(multiDBTransactionManager.getPrimaryConnection(), sql);
|
||||
|
||||
if (resultQuery != null) {
|
||||
row.setCodMart((String) UtilityHashMap.getValueIfExists(resultQuery, "cod_style"));
|
||||
row.setCodCol((String) UtilityHashMap.getValueIfExists(resultQuery, "cod_col"));
|
||||
row.setCodTagl((String) UtilityHashMap.getValueIfExists(resultQuery, "cod_tagl"));
|
||||
row.setDescrizione((String) UtilityHashMap.getValueIfExists(resultQuery, "descrizione"));
|
||||
row.setCodAliq((String) UtilityHashMap.getValueIfExists(resultQuery, "cod_aliq"));
|
||||
row.setPercAliq((BigDecimal) UtilityHashMap.getValueIfExists(resultQuery, "perc_aliq"));
|
||||
}
|
||||
|
||||
row.setQtaOrd(BigDecimal.valueOf(ordine.getProductQuantity()));
|
||||
row.setValUnt(ordine.getProductFinalPrice().subtract(ordine.getProductTax()).
|
||||
setScale(EmsRestConstants.cifreDecMax, BigDecimal.ROUND_HALF_UP));
|
||||
|
||||
if (i + 1 < ordini.size() && productId.equals(ordini.get(i + 1).getVirtuemartProductId())) {
|
||||
rigaDestPresente = true;
|
||||
}
|
||||
|
||||
if ("1".equals(ordine.getRichiestaFattura())) {
|
||||
anag = new GtbAnag();
|
||||
if (!UtilityString.isNullOrEmpty(ordine.getEmail())) {
|
||||
anag.seteMail(ordine.getEmail());
|
||||
|
||||
if (!UtilityString.isNullOrEmpty(ordine.getPartitaIva()))
|
||||
anag.setPartIva(ordine.getPartitaIva());
|
||||
|
||||
if (!UtilityString.isNullOrEmpty(ordine.getCodiceFiscale()))
|
||||
anag.setCodFisc(ordine.getCodiceFiscale());
|
||||
}
|
||||
|
||||
EntityBase anagFound = checkClieDestExists(multiDBTransactionManager, anag);
|
||||
if (anagFound != null && anagFound instanceof GtbAnag) {
|
||||
ordineWeb.setCodAnag(((GtbAnag) anagFound).getCodAnag());
|
||||
} else {
|
||||
anag.setRagSoc(ordine.getFullName());
|
||||
anag.setIndirizzo(ordine.getIndirizzoFattura() + " " + ordine.getCivicoFattura());
|
||||
anag.setCap(ordine.getCapFattura());
|
||||
anag.setCitta(ordine.getCittaFattura());
|
||||
anag.setProv(ordine.getProvinciaFattura());
|
||||
anag.setPrecode("Q");
|
||||
anag.setOperation(OperationType.INSERT);
|
||||
VtbClie clie = new VtbClie();
|
||||
clie.setOperation(OperationType.INSERT);
|
||||
clie.setGtbAnag(anag);
|
||||
|
||||
entityProcessor.processEntity(clie, multiDBTransactionManager);
|
||||
ordineWeb.setCodAnag(clie.getCodAnag());
|
||||
}
|
||||
if (!rigaDestPresente) {
|
||||
// aggancio destinazione
|
||||
createOrGetDestMerce(ordineWeb, ordine, negozioScelto, email, defaultCodAnag, multiDBTransactionManager);
|
||||
}
|
||||
} else {
|
||||
ordineWeb.setCodAnag(defaultCodAnag);
|
||||
if (!rigaDestPresente) {
|
||||
createOrGetDestMerce(ordineWeb, ordine, negozioScelto, email, defaultCodAnag, multiDBTransactionManager);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!entities.isEmpty()) {
|
||||
List<EntityBase> processedEntities = entityProcessor.processEntityList(entities, true);
|
||||
|
||||
if (processedEntities != null && !processedEntities.isEmpty()) {
|
||||
|
||||
for (EntityBase entityOrdT : processedEntities) {
|
||||
WdtbOrdt ordT = (WdtbOrdt) entityOrdT;
|
||||
|
||||
String sql;
|
||||
if (ordT.getCodAnag().equals(defaultCodAnag)) {
|
||||
sql = "select e_mail from vtb_dest where cod_vdes = " + UtilityDB.valueToString(ordT.getCodVdes())
|
||||
+ " and cod_anag = " + UtilityDB.valueToString(ordT.getCodAnag());
|
||||
} else {
|
||||
sql = "select e_mail from gtb_anag where cod_anag = " + UtilityDB.valueToString(ordT.getCodAnag());
|
||||
}
|
||||
|
||||
mailText = mailText.replace("%%NUM_ORD_CQ%%", ordT.getNumOrdRif().toString());
|
||||
|
||||
HashMap<String, Object> resultMail = UtilityDB.executeSimpleQueryOnlyFirstRow(multiDBTransactionManager.getPrimaryConnection(), sql);
|
||||
|
||||
if (resultMail != null) {
|
||||
String emailCliente = UtilityHashMap.getValueIfExists(resultMail, "e_mail");
|
||||
String subject = "Quore - Conferma d'ordine";
|
||||
|
||||
if (!UtilityString.isNullOrEmpty(emailCliente)) {
|
||||
|
||||
mailService.sendMailPrimary(multiDBTransactionManager.getPrimaryConnection(), from, null, emailCliente, null, ccn,
|
||||
subject, mailText, true, false, null, null, null, false, null);
|
||||
|
||||
StbEmailRecovery emailRecovery = new StbEmailRecovery();
|
||||
emailRecovery.setOperation(OperationType.INSERT);
|
||||
emailRecovery.setFromMail(from);
|
||||
emailRecovery.setToMail(emailCliente);
|
||||
emailRecovery.setDataIns(new Date());
|
||||
emailRecovery.setSubject(subject);
|
||||
emailRecovery.setMsgtext(mailText);
|
||||
entityProcessor.processEntity(emailRecovery, multiDBTransactionManager);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return entities;
|
||||
}
|
||||
|
||||
private void createOrGetDestMerce(WdtbOrdt ordineWeb, OrdineDTO ordine,
|
||||
String negozioScelto, String email, String defaultCodAnag,
|
||||
MultiDBTransactionManager multiDBTransactionManager) throws Exception {
|
||||
|
||||
if (UtilityString.isNullOrEmpty(negozioScelto)) {
|
||||
//destinarario fisico
|
||||
List<VtbDest> listDest = new ArrayList<VtbDest>();
|
||||
GtbAnag anagSearch = new GtbAnag();
|
||||
anagSearch.setCodAnag(ordineWeb.getCodAnag());
|
||||
VtbDest dest = new VtbDest();
|
||||
dest.setDestinatario(ordine.getFullName());
|
||||
dest.setIndirizzo(ordine.getAddress1() + " " + ordine.getCivico());
|
||||
dest.setCitta(ordine.getCity());
|
||||
dest.setCap(ordine.getZip());
|
||||
dest.setOperation(OperationType.INSERT);
|
||||
|
||||
listDest.add(dest);
|
||||
anagSearch.setVtbDest(listDest);
|
||||
|
||||
EntityBase destFound = checkClieDestExists(multiDBTransactionManager, anagSearch);
|
||||
if (destFound != null && destFound instanceof VtbDest) {
|
||||
((VtbDest) destFound).seteMail(email);
|
||||
((VtbDest) destFound).setTel(ordine.getPhone1());
|
||||
destFound.setOperation(OperationType.UPDATE);
|
||||
entityProcessor.processEntity(destFound, multiDBTransactionManager);
|
||||
|
||||
ordineWeb.setCodVdes(((VtbDest) destFound).getCodVdes());
|
||||
}
|
||||
|
||||
//gestire eccezione anagrafica non presente
|
||||
} else {
|
||||
//ritiro da negozio
|
||||
String sql = "SELECT * FROM vtb_dest WHERE cod_affiliazione = " + UtilityDB.valueToString(negozioScelto)
|
||||
+ " AND cod_anag = " + UtilityDB.valueToString(defaultCodAnag);
|
||||
|
||||
PreparedStatement ps = multiDBTransactionManager.prepareStatement(sql);
|
||||
ResultSet rs = ps.executeQuery();
|
||||
|
||||
List<VtbDest> listVtbDest = new ResultSetMapper()
|
||||
.mapResultSetToList(rs, VtbDest.class, OperationType.SELECT_OBJECT);
|
||||
|
||||
if (listVtbDest != null && !listVtbDest.isEmpty()) {
|
||||
VtbDest dest = listVtbDest.get(0);
|
||||
|
||||
//se il destinatario è un negozio, ma il cliente richiede fattura, copio il destinarario nel cliente anagrafato
|
||||
if (!dest.getCodAnag().equals(ordineWeb.getCodAnag())) {
|
||||
dest.setCodAnag(ordineWeb.getCodAnag());
|
||||
dest.setOperation(OperationType.INSERT_OR_UPDATE);
|
||||
entityProcessor.processEntity(dest, multiDBTransactionManager);
|
||||
}
|
||||
ordineWeb.setCodVdes(dest.getCodVdes());
|
||||
}
|
||||
rs.close();
|
||||
ps.close();
|
||||
}
|
||||
|
||||
String sql = "select ean_fidelity from vtb_fidelity_anag "
|
||||
+ "where e_mail = " + UtilityDB.valueToString(email);
|
||||
|
||||
HashMap<String, Object> resultEanFidelity = UtilityDB.executeSimpleQueryOnlyFirstRow(multiDBTransactionManager.getPrimaryConnection(), sql);
|
||||
|
||||
if (resultEanFidelity != null) {
|
||||
ordineWeb.setEanFidelity((String) UtilityHashMap.getValueIfExists(resultEanFidelity, "ean_fidelity"));
|
||||
}
|
||||
}
|
||||
|
||||
private EntityBase checkClieDestExists(MultiDBTransactionManager multiDBTransactionManager, GtbAnag gtbAnag) throws Exception {
|
||||
|
||||
EntityBase destToReturn = null;
|
||||
|
||||
List<? extends EntityBase> destResult = anagImportService.importClieAnagInternal(gtbAnag, "Q");
|
||||
|
||||
if (destResult != null && !destResult.isEmpty()) {
|
||||
destToReturn = destResult.get(0);
|
||||
}
|
||||
|
||||
return destToReturn;
|
||||
}
|
||||
}
|
||||
@@ -1,406 +0,0 @@
|
||||
package it.integry.ems.order.amazon.controller;
|
||||
|
||||
import com.fasterxml.jackson.databind.node.ArrayNode;
|
||||
import it.integry.common.var.CommonConstants;
|
||||
import it.integry.ems.json.ResponseJSONObjectMapper;
|
||||
import it.integry.ems.order.amazon.dto.OrderTrackingDTO;
|
||||
import it.integry.ems.order.amazon.service.MarketplaceFactory;
|
||||
import it.integry.ems.order.amazon.service.OrderImportFromAmazon;
|
||||
import it.integry.ems.order.conquist.dto.TrackingDTO;
|
||||
import it.integry.ems.properties.EmsProperties;
|
||||
import it.integry.ems.response.EsitoType;
|
||||
import it.integry.ems.response.ServiceRestResponse;
|
||||
import it.integry.ems.settings.Model.SettingsModel;
|
||||
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
|
||||
import it.integry.ems_model.config.EmsRestConstants;
|
||||
import it.integry.ems_model.service.SetupGest;
|
||||
import it.integry.ems_model.utility.UtilityDB;
|
||||
import it.integry.ems_model.utility.UtilityString;
|
||||
import it.integry.security.utility.RestUtil;
|
||||
import org.apache.commons.codec.binary.Base64;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.activation.DataHandler;
|
||||
import javax.mail.*;
|
||||
import javax.mail.internet.InternetAddress;
|
||||
import javax.mail.search.FlagTerm;
|
||||
import javax.mail.search.MessageIDTerm;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.ws.rs.client.Client;
|
||||
import javax.ws.rs.client.ClientBuilder;
|
||||
import javax.ws.rs.client.Entity;
|
||||
import javax.ws.rs.client.WebTarget;
|
||||
import javax.ws.rs.core.Response;
|
||||
import java.io.*;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Properties;
|
||||
|
||||
@RestController
|
||||
@Scope("request")
|
||||
|
||||
@Deprecated
|
||||
public class AmazonOrderImportController {
|
||||
|
||||
private final Logger logger = LogManager.getLogger();
|
||||
|
||||
@Autowired
|
||||
private EmsProperties properties;
|
||||
|
||||
@Autowired
|
||||
private SettingsModel settingsModel;
|
||||
|
||||
@Autowired
|
||||
private MultiDBTransactionManager multiDBTransactionManager;
|
||||
|
||||
@Autowired
|
||||
private OrderImportFromAmazon orderImportFromAmazon;
|
||||
|
||||
@Autowired
|
||||
private MarketplaceFactory marketPlaceConfig;
|
||||
|
||||
@Autowired
|
||||
private SetupGest setupGest;
|
||||
|
||||
@Autowired
|
||||
private ResponseJSONObjectMapper jsonObjectMapper;
|
||||
|
||||
@RequestMapping(value = EmsRestConstants.PATH_IMPORT_ORDERS_AMAZON, method = RequestMethod.POST)
|
||||
public @ResponseBody
|
||||
Object importOrder(HttpServletRequest request,
|
||||
@RequestParam(CommonConstants.PROFILE_DB) String configuration,
|
||||
@RequestParam(value = "orderStatus", required = false) List<String> orderStatus) {
|
||||
|
||||
String response = null;
|
||||
try {
|
||||
|
||||
marketPlaceConfig.init(multiDBTransactionManager.getPrimaryConnection());
|
||||
|
||||
if (marketPlaceConfig.isEnabled()) {
|
||||
if (orderStatus == null || orderStatus.isEmpty()) {
|
||||
orderStatus = new ArrayList<String>();
|
||||
orderStatus.add("Unshipped");
|
||||
orderStatus.add("PartiallyShipped");
|
||||
}
|
||||
response = orderImportFromAmazon.importOrders(orderStatus, configuration);
|
||||
} else {
|
||||
throw new Exception("[WARN] Parametri amazon non configurati, impossibile procedere.");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error(request.getRequestURI(), e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
return response;
|
||||
}
|
||||
|
||||
@RequestMapping(value = EmsRestConstants.PATH_UPDATE_QUANTITY_FEED, method = RequestMethod.POST)
|
||||
public @ResponseBody
|
||||
ServiceRestResponse updateQtyFeed(HttpServletRequest request,
|
||||
@RequestParam(CommonConstants.PROFILE_DB) String configuration) {
|
||||
ServiceRestResponse response = null;
|
||||
try {
|
||||
marketPlaceConfig.init(multiDBTransactionManager.getPrimaryConnection());
|
||||
|
||||
if (marketPlaceConfig.isEnabled()) {
|
||||
orderImportFromAmazon.updateQtyFeed();
|
||||
response = new ServiceRestResponse(EsitoType.OK);
|
||||
} else {
|
||||
throw new Exception("[WARN] Parametri amazon non configurati, impossibile procedere.");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error(request.getRequestURI(), e);
|
||||
e.printStackTrace();
|
||||
response = new ServiceRestResponse(EsitoType.KO, configuration, e);
|
||||
}
|
||||
return response;
|
||||
}
|
||||
|
||||
@RequestMapping(value = EmsRestConstants.PATH_ACK_ORDERS, method = RequestMethod.POST)
|
||||
public @ResponseBody
|
||||
ServiceRestResponse ackOrders(HttpServletRequest request,
|
||||
@RequestParam(CommonConstants.PROFILE_DB) String configuration,
|
||||
@RequestParam("orderIds") List<String> ordersIds) {
|
||||
|
||||
ServiceRestResponse response;
|
||||
try {
|
||||
marketPlaceConfig.init(multiDBTransactionManager.getPrimaryConnection());
|
||||
orderImportFromAmazon.ackOrders(ordersIds);
|
||||
response = ServiceRestResponse.createPositiveResponse();
|
||||
} catch (Exception e) {
|
||||
logger.error(request.getRequestURI(), e);
|
||||
e.printStackTrace();
|
||||
response = new ServiceRestResponse(EsitoType.KO, configuration, e);
|
||||
}
|
||||
return response;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@RequestMapping(value = EmsRestConstants.PATH_CONFIRM_FEED_WITH_TRACKID, method = RequestMethod.POST)
|
||||
public @ResponseBody
|
||||
ServiceRestResponse confirmOrders(HttpServletRequest request,
|
||||
@RequestParam(CommonConstants.PROFILE_DB) String configuration,
|
||||
@RequestParam("domain") String domain,
|
||||
@RequestParam("user") String user,
|
||||
@RequestParam("password") String passwd) {
|
||||
|
||||
ServiceRestResponse response = null;
|
||||
try {
|
||||
|
||||
String enabled = setupGest.getSetup(multiDBTransactionManager.getPrimaryConnection(), "w_tmtntracodisk_ft", "TRACK_ID_READER_BRT", "ENABLED");
|
||||
if (!UtilityString.isNullOrEmpty(enabled) && Boolean.parseBoolean(enabled)) {
|
||||
marketPlaceConfig.init(multiDBTransactionManager.getPrimaryConnection());
|
||||
|
||||
logger.debug("SCHEDULER ACTIVED ON " + user);
|
||||
|
||||
Properties sysProperties = System.getProperties();
|
||||
Session session = Session.getDefaultInstance(sysProperties);
|
||||
Store storePop = null;
|
||||
Folder inboxPop3 = null;
|
||||
|
||||
Store store = session.getStore("imap");
|
||||
store.connect("imap." + domain, user, passwd);
|
||||
Folder inbox = store.getFolder("inbox");
|
||||
inbox.open(Folder.READ_WRITE);
|
||||
|
||||
// search for all "unseen" messages
|
||||
Flags seen = new Flags(Flags.Flag.SEEN);
|
||||
FlagTerm unseenFlagTerm = new FlagTerm(seen, false);
|
||||
Message messages[] = inbox.search(unseenFlagTerm);
|
||||
|
||||
logger.debug(messages.length + " NUOVE MAIL TROVATE");
|
||||
|
||||
if (messages.length > 0) {
|
||||
storePop = session.getStore("pop3");
|
||||
storePop.connect("pop3." + domain, user, passwd);
|
||||
inboxPop3 = storePop.getFolder("inbox");
|
||||
inboxPop3.open(Folder.READ_ONLY);
|
||||
}
|
||||
|
||||
for (Message message : messages) {
|
||||
Message[] msgPopList = inboxPop3.search(new MessageIDTerm(message.getHeader("Message-Id")[0]));
|
||||
|
||||
if (msgPopList.length == 1) {
|
||||
Message msgSingle = msgPopList[0];
|
||||
InternetAddress[] froms = (InternetAddress[]) msgSingle.getFrom();
|
||||
|
||||
Boolean finded = false;
|
||||
for (InternetAddress internetAddress : froms) {
|
||||
if (internetAddress.getAddress().contains("@brt.it")) {
|
||||
finded = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (finded) {
|
||||
Multipart multipart = (Multipart) msgSingle.getContent();
|
||||
for (int x = 0; x < multipart.getCount(); x++) {
|
||||
BodyPart bodyPart = multipart.getBodyPart(x);
|
||||
String disposition = bodyPart.getDisposition();
|
||||
|
||||
if ((disposition != null)
|
||||
&& ((disposition.equals(BodyPart.ATTACHMENT) || (disposition
|
||||
.equals(BodyPart.INLINE))))) {
|
||||
DataHandler handler = bodyPart.getDataHandler();
|
||||
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
handler.writeTo(baos);
|
||||
baos.close();
|
||||
|
||||
String csv = new String(baos.toByteArray());
|
||||
StringReader sr = new StringReader(csv);
|
||||
BufferedReader reader = new BufferedReader(sr);
|
||||
String line;
|
||||
|
||||
List<OrderTrackingDTO> list = new ArrayList<OrderTrackingDTO>();
|
||||
Boolean firstLine = true;
|
||||
|
||||
while ((line = reader.readLine()) != null) {
|
||||
|
||||
if (firstLine) {
|
||||
firstLine = false;
|
||||
continue;
|
||||
}
|
||||
String[] array = line.split(";");
|
||||
String trackNumberId = UtilityString.leftPad(array[2], 3, '0') + array[5] + UtilityString.leftPad(array[6], 7, '0');
|
||||
String numVettura = array[32].replaceAll("\"", "");
|
||||
OrderTrackingDTO dto = new OrderTrackingDTO();
|
||||
Integer numVettInt = Integer.parseInt(numVettura);
|
||||
numVettura = UtilityString.leftPad(numVettInt.toString(), 7, '0');
|
||||
|
||||
String sql = "select dtb_doct.cod_vage, dtb_doct.rif_ord, dtb_doct.cod_anag, dtb_doct.cod_dtip, dtb_doct.data_doc, dtb_doct.num_doc, dtb_doct.ser_doc "
|
||||
+ " from dtb_doct, vtb_vett, vtb_vett_lett "
|
||||
+ " where vtb_vett_lett.formato = 'BRT' AND dtb_doct.num_vettura = " + UtilityDB.valueToString(numVettura)
|
||||
+ " AND dtb_doct.cod_vvet = vtb_vett.cod_vvet "
|
||||
+ " and vtb_vett.cod_lett_vett = vtb_vett_lett.cod_lett_vett";
|
||||
PreparedStatement psAgente = multiDBTransactionManager.prepareStatement(sql);
|
||||
ResultSet rsAgente = psAgente.executeQuery();
|
||||
String codVage = "", rifOrd = "", codAnag = null, codDtip = null, serDoc = null;
|
||||
Integer numDoc = null;
|
||||
Date dataDoc = null;
|
||||
if (rsAgente.next()) {
|
||||
codVage = rsAgente.getString("cod_vage");
|
||||
rifOrd = rsAgente.getString("rif_ord");
|
||||
codAnag = rsAgente.getString("cod_anag");
|
||||
codDtip = rsAgente.getString("cod_dtip");
|
||||
dataDoc = rsAgente.getDate("data_doc");
|
||||
numDoc = rsAgente.getInt("num_doc");
|
||||
serDoc = rsAgente.getString("ser_doc");
|
||||
}
|
||||
rsAgente.close();
|
||||
psAgente.close();
|
||||
|
||||
String codVageAmazon = setupGest.getSetup(multiDBTransactionManager.getPrimaryConnection(), "AMAZON", "ORDINI_WEB", "COD_VAGE");
|
||||
String codVageCQ = setupGest.getSetup(multiDBTransactionManager.getPrimaryConnection(), "IMPORT_ORDINI WEB", "CONQUIST", "COD_VAGE");
|
||||
|
||||
if (codVage.equals(codVageCQ)) {
|
||||
String folder = setupGest.getSetup(multiDBTransactionManager.getPrimaryConnection(), "IMPORT_ORDINI WEB", "CONQUIST", "FOLDER");
|
||||
|
||||
if (UtilityString.isNullOrEmpty(folder))
|
||||
throw new Exception("IMPORT_ORDINI WEB/CONQUIST/FOLDER non configurato correttamente");
|
||||
|
||||
sql = "select b.cod_barre, case o.flag_evaso when 'E' then 'S' when 'A' then 'X' end as flag_evaso"
|
||||
+ " from dtb_ordr o, dtb_docr r, ttb_bar_code b"
|
||||
+ " where r.cod_dtip = " + UtilityDB.valueToString(codDtip) + " and r.cod_anag = " + UtilityDB.valueToString(codAnag)
|
||||
+ " and r.num_doc = " + numDoc + " and r.ser_doc = " + UtilityDB.valueToString(serDoc)
|
||||
+ " and r.data_doc = " + UtilityDB.valueDateToString(dataDoc, CommonConstants.DATE_FORMAT_YMD)
|
||||
+ " and r.cod_mart = b.cod_style and r.cod_tagl = b.cod_tagl and r.cod_col = b.cod_col"
|
||||
+ " and r.num_ord = o.num_ord and r.data_ord = o.data_ord and r.riga_ord = o.riga_ord";
|
||||
PreparedStatement psTrack = multiDBTransactionManager.prepareStatement(sql);
|
||||
ResultSet rsTrack = psTrack.executeQuery();
|
||||
ArrayNode listTrack = jsonObjectMapper.createArrayNode();
|
||||
while (rsTrack.next()) {
|
||||
TrackingDTO dtoTracking = new TrackingDTO();
|
||||
dtoTracking.setVirtuemartOrderId(rifOrd);
|
||||
dtoTracking.setVirtuemartProductSku(rsTrack.getString("cod_barre"));
|
||||
dtoTracking.setOrderStatus(rsTrack.getString("flag_evaso"));
|
||||
listTrack.addPOJO(dtoTracking);
|
||||
}
|
||||
rsTrack.close();
|
||||
psTrack.close();
|
||||
StringWriter out = new StringWriter();
|
||||
jsonObjectMapper.writeValue(out, listTrack);
|
||||
String jsonBody = out.toString();
|
||||
|
||||
String database = settingsModel.getDefaultProfile();
|
||||
|
||||
String auth = RestUtil.generateAuth(database, database, "POST", jsonBody,
|
||||
"application/json", properties.getRootApi() + EmsRestConstants.PATH_EXPORT_TRACKING_CQ);
|
||||
|
||||
Client client = ClientBuilder.newClient();
|
||||
WebTarget resource = client.target(properties.getEndPointWS()).path(
|
||||
properties.getRootApi() + EmsRestConstants.PATH_EXPORT_TRACKING_CQ);
|
||||
Response responseEms = resource.queryParam(CommonConstants.PROFILE_DB, database)
|
||||
.request().header("Authorization", database + ":" + auth)
|
||||
.post(Entity.json(jsonBody));
|
||||
|
||||
String value = responseEms.readEntity(String.class);
|
||||
ServiceRestResponse resp = jsonObjectMapper.readValue(value, ServiceRestResponse.class);
|
||||
value = null;
|
||||
if (resp.getEsito() == EsitoType.OK) {
|
||||
String b64 = resp.getXml().getFileb64Content();
|
||||
String data = new String(Base64.decodeBase64(b64));
|
||||
File f = new File(folder + "/export/" + resp.getXml().getFileName());
|
||||
|
||||
FileWriter fw = new FileWriter(f, true);
|
||||
BufferedWriter bw = new BufferedWriter(fw);
|
||||
bw.write(data);
|
||||
bw.close();
|
||||
fw.close();
|
||||
b64 = null;
|
||||
data = null;
|
||||
}
|
||||
responseEms.close();
|
||||
client.close();
|
||||
|
||||
//update num vettura con track id
|
||||
String update = "UPDATE dtb_doct SET dtb_doct.num_vettura=" + UtilityDB.valueToString(trackNumberId)
|
||||
+ " from vtb_vett, vtb_vett_lett "
|
||||
+ " where vtb_vett_lett.formato = 'BRT' AND dtb_doct.num_vettura = " + UtilityDB.valueToString(numVettura) + " AND dtb_doct.cod_vvet = vtb_vett.cod_vvet "
|
||||
+ " and vtb_vett.cod_lett_vett = vtb_vett_lett.cod_lett_vett";
|
||||
logger.debug(update);
|
||||
PreparedStatement ps = multiDBTransactionManager.prepareStatement(update);
|
||||
ps.executeUpdate();
|
||||
ps.close();
|
||||
} else if (codVage.equals(codVageAmazon)) {
|
||||
//update num vettura con track id
|
||||
String update = "UPDATE dtb_doct SET dtb_doct.num_vettura=" + UtilityDB.valueToString(trackNumberId)
|
||||
+ " from vtb_vett, vtb_vett_lett "
|
||||
+ " where vtb_vett_lett.formato = 'BRT' AND dtb_doct.num_vettura = " + UtilityDB.valueToString(numVettura) + " AND dtb_doct.cod_vvet = vtb_vett.cod_vvet "
|
||||
+ " and vtb_vett.cod_lett_vett = vtb_vett_lett.cod_lett_vett";
|
||||
logger.debug(update);
|
||||
PreparedStatement ps = multiDBTransactionManager.prepareStatement(update);
|
||||
int rowAffected = ps.executeUpdate();
|
||||
ps.close();
|
||||
//retrive amazon order id
|
||||
if (rowAffected == 1) {
|
||||
dto.setTrackNumberId(trackNumberId);
|
||||
dto.setCarrierCode("Other");
|
||||
dto.setCarrierName("BRT");
|
||||
sql = "select rif_ord from dtb_doct where num_vettura = " + UtilityDB.valueToString(trackNumberId);
|
||||
logger.debug(sql);
|
||||
ps = multiDBTransactionManager.prepareStatement(sql);
|
||||
ResultSet rs = ps.executeQuery();
|
||||
if (rs.next()) {
|
||||
dto.setAmazonOrderId(rs.getString("rif_ord"));
|
||||
list.add(dto);
|
||||
}
|
||||
multiDBTransactionManager.getPrimaryConnection().commit();
|
||||
} else if (rowAffected > 1) {
|
||||
multiDBTransactionManager.getPrimaryConnection().rollback();
|
||||
}
|
||||
} else {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// invio track id ad amazon
|
||||
if (!list.isEmpty())
|
||||
orderImportFromAmazon.confirmOrders(list);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
message.setFlag(Flags.Flag.SEEN, true);
|
||||
}
|
||||
if (inboxPop3 != null)
|
||||
inboxPop3.close(true);
|
||||
if (storePop != null)
|
||||
storePop.close();
|
||||
|
||||
inbox.close(true);
|
||||
store.close();
|
||||
}
|
||||
response = new ServiceRestResponse(EsitoType.OK);
|
||||
} catch (Exception e) {
|
||||
logger.error(request.getRequestURI(), e);
|
||||
response = new ServiceRestResponse(EsitoType.KO, configuration, e);
|
||||
}
|
||||
return response;
|
||||
}
|
||||
|
||||
@RequestMapping(value = EmsRestConstants.PATH_FEED_SUBMISSION_RESULT, method = RequestMethod.POST)
|
||||
public @ResponseBody
|
||||
ServiceRestResponse feedSubmissionResult(HttpServletRequest request,
|
||||
@RequestParam(CommonConstants.PROFILE_DB) String configuration,
|
||||
@RequestParam("feedSubmissionId") String feedSubmissionId) {
|
||||
|
||||
ServiceRestResponse response;
|
||||
try {
|
||||
marketPlaceConfig.init(multiDBTransactionManager.getPrimaryConnection());
|
||||
orderImportFromAmazon.feedSubmissionResult(feedSubmissionId);
|
||||
response = new ServiceRestResponse(EsitoType.OK);
|
||||
} catch (Exception e) {
|
||||
logger.error(request.getRequestURI(), e);
|
||||
response = new ServiceRestResponse(EsitoType.KO, configuration, e);
|
||||
}
|
||||
|
||||
return response;
|
||||
}
|
||||
}
|
||||
@@ -1,455 +0,0 @@
|
||||
//
|
||||
// Questo file è stato generato dall'architettura JavaTM per XML Binding (JAXB) Reference Implementation, v2.2.7
|
||||
// Vedere <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
|
||||
// Qualsiasi modifica a questo file andrà persa durante la ricompilazione dello schema di origine.
|
||||
// Generato il: 2015.09.16 alle 04:39:51 PM CEST
|
||||
//
|
||||
|
||||
|
||||
package it.integry.ems.order.amazon.dto;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlType;
|
||||
import javax.xml.bind.annotation.adapters.NormalizedStringAdapter;
|
||||
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* <p>Classe Java per AddressType complex type.
|
||||
*
|
||||
* <p>Il seguente frammento di schema specifica il contenuto previsto contenuto in questa classe.
|
||||
*
|
||||
* <pre>
|
||||
* <complexType name="AddressType">
|
||||
* <complexContent>
|
||||
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
|
||||
* <sequence>
|
||||
* <element name="Name" type="{}String"/>
|
||||
* <element name="FormalTitle" minOccurs="0">
|
||||
* <simpleType>
|
||||
* <restriction base="{http://www.w3.org/2001/XMLSchema}normalizedString">
|
||||
* <maxLength value="10"/>
|
||||
* </restriction>
|
||||
* </simpleType>
|
||||
* </element>
|
||||
* <element name="GivenName" type="{}String" minOccurs="0"/>
|
||||
* <element name="FamilyName" type="{}String" minOccurs="0"/>
|
||||
* <element name="AddressFieldOne" type="{}AddressLine"/>
|
||||
* <element name="AddressFieldTwo" type="{}AddressLine" minOccurs="0"/>
|
||||
* <element name="AddressFieldThree" type="{}AddressLine" minOccurs="0"/>
|
||||
* <element name="City" type="{}String" minOccurs="0"/>
|
||||
* <element name="County" type="{}String" minOccurs="0"/>
|
||||
* <element name="StateOrRegion" type="{}String" minOccurs="0"/>
|
||||
* <element name="PostalCode" type="{}String" minOccurs="0"/>
|
||||
* <element name="CountryCode">
|
||||
* <simpleType>
|
||||
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
|
||||
* <minLength value="2"/>
|
||||
* <maxLength value="2"/>
|
||||
* </restriction>
|
||||
* </simpleType>
|
||||
* </element>
|
||||
* <element name="PhoneNumber" type="{}PhoneNumberType" maxOccurs="3" minOccurs="0"/>
|
||||
* <element name="isDefaultShipping" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/>
|
||||
* <element name="isDefaultBilling" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/>
|
||||
* <element name="isDefaultOneClick" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/>
|
||||
* </sequence>
|
||||
* </restriction>
|
||||
* </complexContent>
|
||||
* </complexType>
|
||||
* </pre>
|
||||
*/
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
@XmlType(name = "AddressType", propOrder = {
|
||||
"name",
|
||||
"formalTitle",
|
||||
"givenName",
|
||||
"familyName",
|
||||
"addressFieldOne",
|
||||
"addressFieldTwo",
|
||||
"addressFieldThree",
|
||||
"city",
|
||||
"county",
|
||||
"stateOrRegion",
|
||||
"postalCode",
|
||||
"countryCode",
|
||||
"phoneNumber",
|
||||
"isDefaultShipping",
|
||||
"isDefaultBilling",
|
||||
"isDefaultOneClick"
|
||||
})
|
||||
public class AddressType {
|
||||
|
||||
@XmlElement(name = "Name", required = true)
|
||||
@XmlJavaTypeAdapter(NormalizedStringAdapter.class)
|
||||
protected String name;
|
||||
@XmlElement(name = "FormalTitle")
|
||||
@XmlJavaTypeAdapter(NormalizedStringAdapter.class)
|
||||
protected String formalTitle;
|
||||
@XmlElement(name = "GivenName")
|
||||
@XmlJavaTypeAdapter(NormalizedStringAdapter.class)
|
||||
protected String givenName;
|
||||
@XmlElement(name = "FamilyName")
|
||||
@XmlJavaTypeAdapter(NormalizedStringAdapter.class)
|
||||
protected String familyName;
|
||||
@XmlElement(name = "AddressFieldOne", required = true)
|
||||
@XmlJavaTypeAdapter(NormalizedStringAdapter.class)
|
||||
protected String addressFieldOne;
|
||||
@XmlElement(name = "AddressFieldTwo")
|
||||
@XmlJavaTypeAdapter(NormalizedStringAdapter.class)
|
||||
protected String addressFieldTwo;
|
||||
@XmlElement(name = "AddressFieldThree")
|
||||
@XmlJavaTypeAdapter(NormalizedStringAdapter.class)
|
||||
protected String addressFieldThree;
|
||||
@XmlElement(name = "City")
|
||||
@XmlJavaTypeAdapter(NormalizedStringAdapter.class)
|
||||
protected String city;
|
||||
@XmlElement(name = "County")
|
||||
@XmlJavaTypeAdapter(NormalizedStringAdapter.class)
|
||||
protected String county;
|
||||
@XmlElement(name = "StateOrRegion")
|
||||
@XmlJavaTypeAdapter(NormalizedStringAdapter.class)
|
||||
protected String stateOrRegion;
|
||||
@XmlElement(name = "PostalCode")
|
||||
@XmlJavaTypeAdapter(NormalizedStringAdapter.class)
|
||||
protected String postalCode;
|
||||
@XmlElement(name = "CountryCode", required = true)
|
||||
protected String countryCode;
|
||||
@XmlElement(name = "PhoneNumber")
|
||||
protected List<PhoneNumberType> phoneNumber;
|
||||
protected Boolean isDefaultShipping;
|
||||
protected Boolean isDefaultBilling;
|
||||
protected Boolean isDefaultOneClick;
|
||||
|
||||
/**
|
||||
* Recupera il valore della proprietà name.
|
||||
*
|
||||
* @return possible object is
|
||||
* {@link String }
|
||||
*/
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Imposta il valore della proprietà name.
|
||||
*
|
||||
* @param value allowed object is
|
||||
* {@link String }
|
||||
*/
|
||||
public void setName(String value) {
|
||||
this.name = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Recupera il valore della proprietà formalTitle.
|
||||
*
|
||||
* @return possible object is
|
||||
* {@link String }
|
||||
*/
|
||||
public String getFormalTitle() {
|
||||
return formalTitle;
|
||||
}
|
||||
|
||||
/**
|
||||
* Imposta il valore della proprietà formalTitle.
|
||||
*
|
||||
* @param value allowed object is
|
||||
* {@link String }
|
||||
*/
|
||||
public void setFormalTitle(String value) {
|
||||
this.formalTitle = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Recupera il valore della proprietà givenName.
|
||||
*
|
||||
* @return possible object is
|
||||
* {@link String }
|
||||
*/
|
||||
public String getGivenName() {
|
||||
return givenName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Imposta il valore della proprietà givenName.
|
||||
*
|
||||
* @param value allowed object is
|
||||
* {@link String }
|
||||
*/
|
||||
public void setGivenName(String value) {
|
||||
this.givenName = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Recupera il valore della proprietà familyName.
|
||||
*
|
||||
* @return possible object is
|
||||
* {@link String }
|
||||
*/
|
||||
public String getFamilyName() {
|
||||
return familyName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Imposta il valore della proprietà familyName.
|
||||
*
|
||||
* @param value allowed object is
|
||||
* {@link String }
|
||||
*/
|
||||
public void setFamilyName(String value) {
|
||||
this.familyName = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Recupera il valore della proprietà addressFieldOne.
|
||||
*
|
||||
* @return possible object is
|
||||
* {@link String }
|
||||
*/
|
||||
public String getAddressFieldOne() {
|
||||
return addressFieldOne;
|
||||
}
|
||||
|
||||
/**
|
||||
* Imposta il valore della proprietà addressFieldOne.
|
||||
*
|
||||
* @param value allowed object is
|
||||
* {@link String }
|
||||
*/
|
||||
public void setAddressFieldOne(String value) {
|
||||
this.addressFieldOne = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Recupera il valore della proprietà addressFieldTwo.
|
||||
*
|
||||
* @return possible object is
|
||||
* {@link String }
|
||||
*/
|
||||
public String getAddressFieldTwo() {
|
||||
return addressFieldTwo;
|
||||
}
|
||||
|
||||
/**
|
||||
* Imposta il valore della proprietà addressFieldTwo.
|
||||
*
|
||||
* @param value allowed object is
|
||||
* {@link String }
|
||||
*/
|
||||
public void setAddressFieldTwo(String value) {
|
||||
this.addressFieldTwo = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Recupera il valore della proprietà addressFieldThree.
|
||||
*
|
||||
* @return possible object is
|
||||
* {@link String }
|
||||
*/
|
||||
public String getAddressFieldThree() {
|
||||
return addressFieldThree;
|
||||
}
|
||||
|
||||
/**
|
||||
* Imposta il valore della proprietà addressFieldThree.
|
||||
*
|
||||
* @param value allowed object is
|
||||
* {@link String }
|
||||
*/
|
||||
public void setAddressFieldThree(String value) {
|
||||
this.addressFieldThree = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Recupera il valore della proprietà city.
|
||||
*
|
||||
* @return possible object is
|
||||
* {@link String }
|
||||
*/
|
||||
public String getCity() {
|
||||
return city;
|
||||
}
|
||||
|
||||
/**
|
||||
* Imposta il valore della proprietà city.
|
||||
*
|
||||
* @param value allowed object is
|
||||
* {@link String }
|
||||
*/
|
||||
public void setCity(String value) {
|
||||
this.city = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Recupera il valore della proprietà county.
|
||||
*
|
||||
* @return possible object is
|
||||
* {@link String }
|
||||
*/
|
||||
public String getCounty() {
|
||||
return county;
|
||||
}
|
||||
|
||||
/**
|
||||
* Imposta il valore della proprietà county.
|
||||
*
|
||||
* @param value allowed object is
|
||||
* {@link String }
|
||||
*/
|
||||
public void setCounty(String value) {
|
||||
this.county = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Recupera il valore della proprietà stateOrRegion.
|
||||
*
|
||||
* @return possible object is
|
||||
* {@link String }
|
||||
*/
|
||||
public String getStateOrRegion() {
|
||||
return stateOrRegion;
|
||||
}
|
||||
|
||||
/**
|
||||
* Imposta il valore della proprietà stateOrRegion.
|
||||
*
|
||||
* @param value allowed object is
|
||||
* {@link String }
|
||||
*/
|
||||
public void setStateOrRegion(String value) {
|
||||
this.stateOrRegion = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Recupera il valore della proprietà postalCode.
|
||||
*
|
||||
* @return possible object is
|
||||
* {@link String }
|
||||
*/
|
||||
public String getPostalCode() {
|
||||
return postalCode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Imposta il valore della proprietà postalCode.
|
||||
*
|
||||
* @param value allowed object is
|
||||
* {@link String }
|
||||
*/
|
||||
public void setPostalCode(String value) {
|
||||
this.postalCode = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Recupera il valore della proprietà countryCode.
|
||||
*
|
||||
* @return possible object is
|
||||
* {@link String }
|
||||
*/
|
||||
public String getCountryCode() {
|
||||
return countryCode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Imposta il valore della proprietà countryCode.
|
||||
*
|
||||
* @param value allowed object is
|
||||
* {@link String }
|
||||
*/
|
||||
public void setCountryCode(String value) {
|
||||
this.countryCode = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the phoneNumber property.
|
||||
*
|
||||
* <p>
|
||||
* This accessor method returns a reference to the live list,
|
||||
* not a snapshot. Therefore any modification you make to the
|
||||
* returned list will be present inside the JAXB object.
|
||||
* This is why there is not a <CODE>set</CODE> method for the phoneNumber property.
|
||||
*
|
||||
* <p>
|
||||
* For example, to add a new item, do as follows:
|
||||
* <pre>
|
||||
* getPhoneNumber().add(newItem);
|
||||
* </pre>
|
||||
*
|
||||
*
|
||||
* <p>
|
||||
* Objects of the following type(s) are allowed in the list
|
||||
* {@link PhoneNumberType }
|
||||
*/
|
||||
public List<PhoneNumberType> getPhoneNumber() {
|
||||
if (phoneNumber == null) {
|
||||
phoneNumber = new ArrayList<PhoneNumberType>();
|
||||
}
|
||||
return this.phoneNumber;
|
||||
}
|
||||
|
||||
/**
|
||||
* Recupera il valore della proprietà isDefaultShipping.
|
||||
*
|
||||
* @return possible object is
|
||||
* {@link Boolean }
|
||||
*/
|
||||
public Boolean isIsDefaultShipping() {
|
||||
return isDefaultShipping;
|
||||
}
|
||||
|
||||
/**
|
||||
* Imposta il valore della proprietà isDefaultShipping.
|
||||
*
|
||||
* @param value allowed object is
|
||||
* {@link Boolean }
|
||||
*/
|
||||
public void setIsDefaultShipping(Boolean value) {
|
||||
this.isDefaultShipping = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Recupera il valore della proprietà isDefaultBilling.
|
||||
*
|
||||
* @return possible object is
|
||||
* {@link Boolean }
|
||||
*/
|
||||
public Boolean isIsDefaultBilling() {
|
||||
return isDefaultBilling;
|
||||
}
|
||||
|
||||
/**
|
||||
* Imposta il valore della proprietà isDefaultBilling.
|
||||
*
|
||||
* @param value allowed object is
|
||||
* {@link Boolean }
|
||||
*/
|
||||
public void setIsDefaultBilling(Boolean value) {
|
||||
this.isDefaultBilling = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Recupera il valore della proprietà isDefaultOneClick.
|
||||
*
|
||||
* @return possible object is
|
||||
* {@link Boolean }
|
||||
*/
|
||||
public Boolean isIsDefaultOneClick() {
|
||||
return isDefaultOneClick;
|
||||
}
|
||||
|
||||
/**
|
||||
* Imposta il valore della proprietà isDefaultOneClick.
|
||||
*
|
||||
* @param value allowed object is
|
||||
* {@link Boolean }
|
||||
*/
|
||||
public void setIsDefaultOneClick(Boolean value) {
|
||||
this.isDefaultOneClick = value;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,322 +0,0 @@
|
||||
//
|
||||
// Questo file è stato generato dall'architettura JavaTM per XML Binding (JAXB) Reference Implementation, v2.2.7
|
||||
// Vedere <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
|
||||
// Qualsiasi modifica a questo file andrà persa durante la ricompilazione dello schema di origine.
|
||||
// Generato il: 2015.09.16 alle 04:39:51 PM CEST
|
||||
//
|
||||
|
||||
|
||||
package it.integry.ems.order.amazon.dto;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlType;
|
||||
import javax.xml.bind.annotation.adapters.NormalizedStringAdapter;
|
||||
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
|
||||
|
||||
|
||||
/**
|
||||
* <p>Classe Java per AddressTypeSupportNonCity complex type.
|
||||
*
|
||||
* <p>Il seguente frammento di schema specifica il contenuto previsto contenuto in questa classe.
|
||||
*
|
||||
* <pre>
|
||||
* <complexType name="AddressTypeSupportNonCity">
|
||||
* <complexContent>
|
||||
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
|
||||
* <sequence>
|
||||
* <element name="Name" type="{}String"/>
|
||||
* <element name="AddressFieldOne" type="{}AddressLine"/>
|
||||
* <element name="AddressFieldTwo" type="{}AddressLine" minOccurs="0"/>
|
||||
* <element name="AddressFieldThree" type="{}AddressLine" minOccurs="0"/>
|
||||
* <element name="City" type="{}String" minOccurs="0"/>
|
||||
* <element name="DistrictOrCounty" type="{}String" minOccurs="0"/>
|
||||
* <element name="County" type="{}String" minOccurs="0"/>
|
||||
* <element name="StateOrRegion" type="{}String" minOccurs="0"/>
|
||||
* <element name="PostalCode" type="{}String" minOccurs="0"/>
|
||||
* <element name="CountryCode">
|
||||
* <simpleType>
|
||||
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
|
||||
* <minLength value="2"/>
|
||||
* <maxLength value="2"/>
|
||||
* </restriction>
|
||||
* </simpleType>
|
||||
* </element>
|
||||
* <element name="PhoneNumber" type="{}String" minOccurs="0"/>
|
||||
* </sequence>
|
||||
* </restriction>
|
||||
* </complexContent>
|
||||
* </complexType>
|
||||
* </pre>
|
||||
*/
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
@XmlType(name = "AddressTypeSupportNonCity", propOrder = {
|
||||
"name",
|
||||
"addressFieldOne",
|
||||
"addressFieldTwo",
|
||||
"addressFieldThree",
|
||||
"city",
|
||||
"districtOrCounty",
|
||||
"county",
|
||||
"stateOrRegion",
|
||||
"postalCode",
|
||||
"countryCode",
|
||||
"phoneNumber"
|
||||
})
|
||||
public class AddressTypeSupportNonCity {
|
||||
|
||||
@XmlElement(name = "Name", required = true)
|
||||
@XmlJavaTypeAdapter(NormalizedStringAdapter.class)
|
||||
protected String name;
|
||||
@XmlElement(name = "AddressFieldOne", required = true)
|
||||
@XmlJavaTypeAdapter(NormalizedStringAdapter.class)
|
||||
protected String addressFieldOne;
|
||||
@XmlElement(name = "AddressFieldTwo")
|
||||
@XmlJavaTypeAdapter(NormalizedStringAdapter.class)
|
||||
protected String addressFieldTwo;
|
||||
@XmlElement(name = "AddressFieldThree")
|
||||
@XmlJavaTypeAdapter(NormalizedStringAdapter.class)
|
||||
protected String addressFieldThree;
|
||||
@XmlElement(name = "City")
|
||||
@XmlJavaTypeAdapter(NormalizedStringAdapter.class)
|
||||
protected String city;
|
||||
@XmlElement(name = "DistrictOrCounty")
|
||||
@XmlJavaTypeAdapter(NormalizedStringAdapter.class)
|
||||
protected String districtOrCounty;
|
||||
@XmlElement(name = "County")
|
||||
@XmlJavaTypeAdapter(NormalizedStringAdapter.class)
|
||||
protected String county;
|
||||
@XmlElement(name = "StateOrRegion")
|
||||
@XmlJavaTypeAdapter(NormalizedStringAdapter.class)
|
||||
protected String stateOrRegion;
|
||||
@XmlElement(name = "PostalCode")
|
||||
@XmlJavaTypeAdapter(NormalizedStringAdapter.class)
|
||||
protected String postalCode;
|
||||
@XmlElement(name = "CountryCode", required = true)
|
||||
protected String countryCode;
|
||||
@XmlElement(name = "PhoneNumber")
|
||||
@XmlJavaTypeAdapter(NormalizedStringAdapter.class)
|
||||
protected String phoneNumber;
|
||||
|
||||
/**
|
||||
* Recupera il valore della proprietà name.
|
||||
*
|
||||
* @return possible object is
|
||||
* {@link String }
|
||||
*/
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Imposta il valore della proprietà name.
|
||||
*
|
||||
* @param value allowed object is
|
||||
* {@link String }
|
||||
*/
|
||||
public void setName(String value) {
|
||||
this.name = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Recupera il valore della proprietà addressFieldOne.
|
||||
*
|
||||
* @return possible object is
|
||||
* {@link String }
|
||||
*/
|
||||
public String getAddressFieldOne() {
|
||||
return addressFieldOne;
|
||||
}
|
||||
|
||||
/**
|
||||
* Imposta il valore della proprietà addressFieldOne.
|
||||
*
|
||||
* @param value allowed object is
|
||||
* {@link String }
|
||||
*/
|
||||
public void setAddressFieldOne(String value) {
|
||||
this.addressFieldOne = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Recupera il valore della proprietà addressFieldTwo.
|
||||
*
|
||||
* @return possible object is
|
||||
* {@link String }
|
||||
*/
|
||||
public String getAddressFieldTwo() {
|
||||
return addressFieldTwo;
|
||||
}
|
||||
|
||||
/**
|
||||
* Imposta il valore della proprietà addressFieldTwo.
|
||||
*
|
||||
* @param value allowed object is
|
||||
* {@link String }
|
||||
*/
|
||||
public void setAddressFieldTwo(String value) {
|
||||
this.addressFieldTwo = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Recupera il valore della proprietà addressFieldThree.
|
||||
*
|
||||
* @return possible object is
|
||||
* {@link String }
|
||||
*/
|
||||
public String getAddressFieldThree() {
|
||||
return addressFieldThree;
|
||||
}
|
||||
|
||||
/**
|
||||
* Imposta il valore della proprietà addressFieldThree.
|
||||
*
|
||||
* @param value allowed object is
|
||||
* {@link String }
|
||||
*/
|
||||
public void setAddressFieldThree(String value) {
|
||||
this.addressFieldThree = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Recupera il valore della proprietà city.
|
||||
*
|
||||
* @return possible object is
|
||||
* {@link String }
|
||||
*/
|
||||
public String getCity() {
|
||||
return city;
|
||||
}
|
||||
|
||||
/**
|
||||
* Imposta il valore della proprietà city.
|
||||
*
|
||||
* @param value allowed object is
|
||||
* {@link String }
|
||||
*/
|
||||
public void setCity(String value) {
|
||||
this.city = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Recupera il valore della proprietà districtOrCounty.
|
||||
*
|
||||
* @return possible object is
|
||||
* {@link String }
|
||||
*/
|
||||
public String getDistrictOrCounty() {
|
||||
return districtOrCounty;
|
||||
}
|
||||
|
||||
/**
|
||||
* Imposta il valore della proprietà districtOrCounty.
|
||||
*
|
||||
* @param value allowed object is
|
||||
* {@link String }
|
||||
*/
|
||||
public void setDistrictOrCounty(String value) {
|
||||
this.districtOrCounty = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Recupera il valore della proprietà county.
|
||||
*
|
||||
* @return possible object is
|
||||
* {@link String }
|
||||
*/
|
||||
public String getCounty() {
|
||||
return county;
|
||||
}
|
||||
|
||||
/**
|
||||
* Imposta il valore della proprietà county.
|
||||
*
|
||||
* @param value allowed object is
|
||||
* {@link String }
|
||||
*/
|
||||
public void setCounty(String value) {
|
||||
this.county = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Recupera il valore della proprietà stateOrRegion.
|
||||
*
|
||||
* @return possible object is
|
||||
* {@link String }
|
||||
*/
|
||||
public String getStateOrRegion() {
|
||||
return stateOrRegion;
|
||||
}
|
||||
|
||||
/**
|
||||
* Imposta il valore della proprietà stateOrRegion.
|
||||
*
|
||||
* @param value allowed object is
|
||||
* {@link String }
|
||||
*/
|
||||
public void setStateOrRegion(String value) {
|
||||
this.stateOrRegion = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Recupera il valore della proprietà postalCode.
|
||||
*
|
||||
* @return possible object is
|
||||
* {@link String }
|
||||
*/
|
||||
public String getPostalCode() {
|
||||
return postalCode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Imposta il valore della proprietà postalCode.
|
||||
*
|
||||
* @param value allowed object is
|
||||
* {@link String }
|
||||
*/
|
||||
public void setPostalCode(String value) {
|
||||
this.postalCode = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Recupera il valore della proprietà countryCode.
|
||||
*
|
||||
* @return possible object is
|
||||
* {@link String }
|
||||
*/
|
||||
public String getCountryCode() {
|
||||
return countryCode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Imposta il valore della proprietà countryCode.
|
||||
*
|
||||
* @param value allowed object is
|
||||
* {@link String }
|
||||
*/
|
||||
public void setCountryCode(String value) {
|
||||
this.countryCode = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Recupera il valore della proprietà phoneNumber.
|
||||
*
|
||||
* @return possible object is
|
||||
* {@link String }
|
||||
*/
|
||||
public String getPhoneNumber() {
|
||||
return phoneNumber;
|
||||
}
|
||||
|
||||
/**
|
||||
* Imposta il valore della proprietà phoneNumber.
|
||||
*
|
||||
* @param value allowed object is
|
||||
* {@link String }
|
||||
*/
|
||||
public void setPhoneNumber(String value) {
|
||||
this.phoneNumber = value;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,198 +0,0 @@
|
||||
//
|
||||
// Questo file è stato generato dall'architettura JavaTM per XML Binding (JAXB) Reference Implementation, v2.2.7
|
||||
// Vedere <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
|
||||
// Qualsiasi modifica a questo file andrà persa durante la ricompilazione dello schema di origine.
|
||||
// Generato il: 2015.09.16 alle 04:39:51 PM CEST
|
||||
//
|
||||
|
||||
|
||||
package it.integry.ems.order.amazon.dto;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlType;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* <p>Classe Java per AdjustmentBuyerPrice complex type.
|
||||
*
|
||||
* <p>Il seguente frammento di schema specifica il contenuto previsto contenuto in questa classe.
|
||||
*
|
||||
* <pre>
|
||||
* <complexType name="AdjustmentBuyerPrice">
|
||||
* <complexContent>
|
||||
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
|
||||
* <sequence>
|
||||
* <element name="Component" maxOccurs="unbounded">
|
||||
* <complexType>
|
||||
* <complexContent>
|
||||
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
|
||||
* <sequence>
|
||||
* <element name="Type">
|
||||
* <simpleType>
|
||||
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
|
||||
* <enumeration value="Principal"/>
|
||||
* <enumeration value="Shipping"/>
|
||||
* <enumeration value="Tax"/>
|
||||
* <enumeration value="ShippingTax"/>
|
||||
* <enumeration value="RestockingFee"/>
|
||||
* <enumeration value="RestockingFeeTax"/>
|
||||
* <enumeration value="GiftWrap"/>
|
||||
* <enumeration value="GiftWrapTax"/>
|
||||
* <enumeration value="Surcharge"/>
|
||||
* <enumeration value="ReturnShipping"/>
|
||||
* <enumeration value="Goodwill"/>
|
||||
* <enumeration value="ExportCharge"/>
|
||||
* <enumeration value="COD"/>
|
||||
* <enumeration value="CODTax"/>
|
||||
* <enumeration value="Other"/>
|
||||
* <enumeration value="FreeReplacementReturnShipping"/>
|
||||
* </restriction>
|
||||
* </simpleType>
|
||||
* </element>
|
||||
* <element name="Amount" type="{}AdjustmentCurrencyAmount"/>
|
||||
* </sequence>
|
||||
* </restriction>
|
||||
* </complexContent>
|
||||
* </complexType>
|
||||
* </element>
|
||||
* </sequence>
|
||||
* </restriction>
|
||||
* </complexContent>
|
||||
* </complexType>
|
||||
* </pre>
|
||||
*/
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
@XmlType(name = "AdjustmentBuyerPrice", propOrder = {
|
||||
"component"
|
||||
})
|
||||
public class AdjustmentBuyerPrice {
|
||||
|
||||
@XmlElement(name = "Component", required = true)
|
||||
protected List<AdjustmentBuyerPrice.Component> component;
|
||||
|
||||
/**
|
||||
* Gets the value of the component property.
|
||||
*
|
||||
* <p>
|
||||
* This accessor method returns a reference to the live list,
|
||||
* not a snapshot. Therefore any modification you make to the
|
||||
* returned list will be present inside the JAXB object.
|
||||
* This is why there is not a <CODE>set</CODE> method for the component property.
|
||||
*
|
||||
* <p>
|
||||
* For example, to add a new item, do as follows:
|
||||
* <pre>
|
||||
* getComponent().add(newItem);
|
||||
* </pre>
|
||||
*
|
||||
*
|
||||
* <p>
|
||||
* Objects of the following type(s) are allowed in the list
|
||||
* {@link AdjustmentBuyerPrice.Component }
|
||||
*/
|
||||
public List<AdjustmentBuyerPrice.Component> getComponent() {
|
||||
if (component == null) {
|
||||
component = new ArrayList<AdjustmentBuyerPrice.Component>();
|
||||
}
|
||||
return this.component;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* <p>Classe Java per anonymous complex type.
|
||||
*
|
||||
* <p>Il seguente frammento di schema specifica il contenuto previsto contenuto in questa classe.
|
||||
*
|
||||
* <pre>
|
||||
* <complexType>
|
||||
* <complexContent>
|
||||
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
|
||||
* <sequence>
|
||||
* <element name="Type">
|
||||
* <simpleType>
|
||||
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
|
||||
* <enumeration value="Principal"/>
|
||||
* <enumeration value="Shipping"/>
|
||||
* <enumeration value="Tax"/>
|
||||
* <enumeration value="ShippingTax"/>
|
||||
* <enumeration value="RestockingFee"/>
|
||||
* <enumeration value="RestockingFeeTax"/>
|
||||
* <enumeration value="GiftWrap"/>
|
||||
* <enumeration value="GiftWrapTax"/>
|
||||
* <enumeration value="Surcharge"/>
|
||||
* <enumeration value="ReturnShipping"/>
|
||||
* <enumeration value="Goodwill"/>
|
||||
* <enumeration value="ExportCharge"/>
|
||||
* <enumeration value="COD"/>
|
||||
* <enumeration value="CODTax"/>
|
||||
* <enumeration value="Other"/>
|
||||
* <enumeration value="FreeReplacementReturnShipping"/>
|
||||
* </restriction>
|
||||
* </simpleType>
|
||||
* </element>
|
||||
* <element name="Amount" type="{}AdjustmentCurrencyAmount"/>
|
||||
* </sequence>
|
||||
* </restriction>
|
||||
* </complexContent>
|
||||
* </complexType>
|
||||
* </pre>
|
||||
*/
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
@XmlType(name = "", propOrder = {
|
||||
"type",
|
||||
"amount"
|
||||
})
|
||||
public static class Component {
|
||||
|
||||
@XmlElement(name = "Type", required = true)
|
||||
protected String type;
|
||||
@XmlElement(name = "Amount", required = true)
|
||||
protected AdjustmentCurrencyAmount amount;
|
||||
|
||||
/**
|
||||
* Recupera il valore della proprietà type.
|
||||
*
|
||||
* @return possible object is
|
||||
* {@link String }
|
||||
*/
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Imposta il valore della proprietà type.
|
||||
*
|
||||
* @param value allowed object is
|
||||
* {@link String }
|
||||
*/
|
||||
public void setType(String value) {
|
||||
this.type = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Recupera il valore della proprietà amount.
|
||||
*
|
||||
* @return possible object is
|
||||
* {@link AdjustmentCurrencyAmount }
|
||||
*/
|
||||
public AdjustmentCurrencyAmount getAmount() {
|
||||
return amount;
|
||||
}
|
||||
|
||||
/**
|
||||
* Imposta il valore della proprietà amount.
|
||||
*
|
||||
* @param value allowed object is
|
||||
* {@link AdjustmentCurrencyAmount }
|
||||
*/
|
||||
public void setAmount(AdjustmentCurrencyAmount value) {
|
||||
this.amount = value;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,81 +0,0 @@
|
||||
//
|
||||
// Questo file è stato generato dall'architettura JavaTM per XML Binding (JAXB) Reference Implementation, v2.2.7
|
||||
// Vedere <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
|
||||
// Qualsiasi modifica a questo file andrà persa durante la ricompilazione dello schema di origine.
|
||||
// Generato il: 2015.09.16 alle 04:39:51 PM CEST
|
||||
//
|
||||
|
||||
|
||||
package it.integry.ems.order.amazon.dto;
|
||||
|
||||
import javax.xml.bind.annotation.*;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
|
||||
/**
|
||||
* <p>Classe Java per AdjustmentCurrencyAmount complex type.
|
||||
*
|
||||
* <p>Il seguente frammento di schema specifica il contenuto previsto contenuto in questa classe.
|
||||
*
|
||||
* <pre>
|
||||
* <complexType name="AdjustmentCurrencyAmount">
|
||||
* <simpleContent>
|
||||
* <extension base="<>BaseCurrencyAmount">
|
||||
* <attribute name="currency" type="{}BaseCurrencyCode" />
|
||||
* </extension>
|
||||
* </simpleContent>
|
||||
* </complexType>
|
||||
* </pre>
|
||||
*/
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
@XmlType(name = "AdjustmentCurrencyAmount", propOrder = {
|
||||
"value"
|
||||
})
|
||||
public class AdjustmentCurrencyAmount {
|
||||
|
||||
@XmlValue
|
||||
protected BigDecimal value;
|
||||
@XmlAttribute(name = "currency")
|
||||
protected BaseCurrencyCode currency;
|
||||
|
||||
/**
|
||||
* Recupera il valore della proprietà value.
|
||||
*
|
||||
* @return possible object is
|
||||
* {@link BigDecimal }
|
||||
*/
|
||||
public BigDecimal getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Imposta il valore della proprietà value.
|
||||
*
|
||||
* @param value allowed object is
|
||||
* {@link BigDecimal }
|
||||
*/
|
||||
public void setValue(BigDecimal value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Recupera il valore della proprietà currency.
|
||||
*
|
||||
* @return possible object is
|
||||
* {@link BaseCurrencyCode }
|
||||
*/
|
||||
public BaseCurrencyCode getCurrency() {
|
||||
return currency;
|
||||
}
|
||||
|
||||
/**
|
||||
* Imposta il valore della proprietà currency.
|
||||
*
|
||||
* @param value allowed object is
|
||||
* {@link BaseCurrencyCode }
|
||||
*/
|
||||
public void setCurrency(BaseCurrencyCode value) {
|
||||
this.currency = value;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,156 +0,0 @@
|
||||
//
|
||||
// Questo file è stato generato dall'architettura JavaTM per XML Binding (JAXB) Reference Implementation, v2.2.7
|
||||
// Vedere <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
|
||||
// Qualsiasi modifica a questo file andrà persa durante la ricompilazione dello schema di origine.
|
||||
// Generato il: 2015.09.16 alle 04:39:51 PM CEST
|
||||
//
|
||||
|
||||
|
||||
package it.integry.ems.order.amazon.dto;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlType;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* <p>Classe Java per AdjustmentDirectPaymentType complex type.
|
||||
*
|
||||
* <p>Il seguente frammento di schema specifica il contenuto previsto contenuto in questa classe.
|
||||
*
|
||||
* <pre>
|
||||
* <complexType name="AdjustmentDirectPaymentType">
|
||||
* <complexContent>
|
||||
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
|
||||
* <sequence>
|
||||
* <element name="Component" maxOccurs="unbounded">
|
||||
* <complexType>
|
||||
* <complexContent>
|
||||
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
|
||||
* <sequence>
|
||||
* <element name="Type" type="{http://www.w3.org/2001/XMLSchema}string"/>
|
||||
* <element name="Amount" type="{}AdjustmentCurrencyAmount"/>
|
||||
* </sequence>
|
||||
* </restriction>
|
||||
* </complexContent>
|
||||
* </complexType>
|
||||
* </element>
|
||||
* </sequence>
|
||||
* </restriction>
|
||||
* </complexContent>
|
||||
* </complexType>
|
||||
* </pre>
|
||||
*/
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
@XmlType(name = "AdjustmentDirectPaymentType", propOrder = {
|
||||
"component"
|
||||
})
|
||||
public class AdjustmentDirectPaymentType {
|
||||
|
||||
@XmlElement(name = "Component", required = true)
|
||||
protected List<AdjustmentDirectPaymentType.Component> component;
|
||||
|
||||
/**
|
||||
* Gets the value of the component property.
|
||||
*
|
||||
* <p>
|
||||
* This accessor method returns a reference to the live list,
|
||||
* not a snapshot. Therefore any modification you make to the
|
||||
* returned list will be present inside the JAXB object.
|
||||
* This is why there is not a <CODE>set</CODE> method for the component property.
|
||||
*
|
||||
* <p>
|
||||
* For example, to add a new item, do as follows:
|
||||
* <pre>
|
||||
* getComponent().add(newItem);
|
||||
* </pre>
|
||||
*
|
||||
*
|
||||
* <p>
|
||||
* Objects of the following type(s) are allowed in the list
|
||||
* {@link AdjustmentDirectPaymentType.Component }
|
||||
*/
|
||||
public List<AdjustmentDirectPaymentType.Component> getComponent() {
|
||||
if (component == null) {
|
||||
component = new ArrayList<AdjustmentDirectPaymentType.Component>();
|
||||
}
|
||||
return this.component;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* <p>Classe Java per anonymous complex type.
|
||||
*
|
||||
* <p>Il seguente frammento di schema specifica il contenuto previsto contenuto in questa classe.
|
||||
*
|
||||
* <pre>
|
||||
* <complexType>
|
||||
* <complexContent>
|
||||
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
|
||||
* <sequence>
|
||||
* <element name="Type" type="{http://www.w3.org/2001/XMLSchema}string"/>
|
||||
* <element name="Amount" type="{}AdjustmentCurrencyAmount"/>
|
||||
* </sequence>
|
||||
* </restriction>
|
||||
* </complexContent>
|
||||
* </complexType>
|
||||
* </pre>
|
||||
*/
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
@XmlType(name = "", propOrder = {
|
||||
"type",
|
||||
"amount"
|
||||
})
|
||||
public static class Component {
|
||||
|
||||
@XmlElement(name = "Type", required = true)
|
||||
protected String type;
|
||||
@XmlElement(name = "Amount", required = true)
|
||||
protected AdjustmentCurrencyAmount amount;
|
||||
|
||||
/**
|
||||
* Recupera il valore della proprietà type.
|
||||
*
|
||||
* @return possible object is
|
||||
* {@link String }
|
||||
*/
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Imposta il valore della proprietà type.
|
||||
*
|
||||
* @param value allowed object is
|
||||
* {@link String }
|
||||
*/
|
||||
public void setType(String value) {
|
||||
this.type = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Recupera il valore della proprietà amount.
|
||||
*
|
||||
* @return possible object is
|
||||
* {@link AdjustmentCurrencyAmount }
|
||||
*/
|
||||
public AdjustmentCurrencyAmount getAmount() {
|
||||
return amount;
|
||||
}
|
||||
|
||||
/**
|
||||
* Imposta il valore della proprietà amount.
|
||||
*
|
||||
* @param value allowed object is
|
||||
* {@link AdjustmentCurrencyAmount }
|
||||
*/
|
||||
public void setAmount(AdjustmentCurrencyAmount value) {
|
||||
this.amount = value;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,133 +0,0 @@
|
||||
//
|
||||
// Questo file è stato generato dall'architettura JavaTM per XML Binding (JAXB) Reference Implementation, v2.2.7
|
||||
// Vedere <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
|
||||
// Qualsiasi modifica a questo file andrà persa durante la ricompilazione dello schema di origine.
|
||||
// Generato il: 2015.09.16 alle 04:39:51 PM CEST
|
||||
//
|
||||
|
||||
|
||||
package it.integry.ems.order.amazon.dto;
|
||||
|
||||
import javax.xml.bind.annotation.*;
|
||||
|
||||
|
||||
/**
|
||||
* <p>Classe Java per anonymous complex type.
|
||||
*
|
||||
* <p>Il seguente frammento di schema specifica il contenuto previsto contenuto in questa classe.
|
||||
*
|
||||
* <pre>
|
||||
* <complexType>
|
||||
* <complexContent>
|
||||
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
|
||||
* <sequence>
|
||||
* <element name="MinimumManufacturerAgeRecommended" type="{}MinimumAgeRecommendedDimension" minOccurs="0"/>
|
||||
* <element name="MaximumManufacturerAgeRecommended" type="{}AgeRecommendedDimension" minOccurs="0"/>
|
||||
* <element name="MinimumMerchantAgeRecommended" type="{}MinimumAgeRecommendedDimension" minOccurs="0"/>
|
||||
* <element name="MaximumMerchantAgeRecommended" type="{}AgeRecommendedDimension" minOccurs="0"/>
|
||||
* </sequence>
|
||||
* </restriction>
|
||||
* </complexContent>
|
||||
* </complexType>
|
||||
* </pre>
|
||||
*/
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
@XmlType(name = "", propOrder = {
|
||||
"minimumManufacturerAgeRecommended",
|
||||
"maximumManufacturerAgeRecommended",
|
||||
"minimumMerchantAgeRecommended",
|
||||
"maximumMerchantAgeRecommended"
|
||||
})
|
||||
@XmlRootElement(name = "AgeRecommendation")
|
||||
public class AgeRecommendation {
|
||||
|
||||
@XmlElement(name = "MinimumManufacturerAgeRecommended")
|
||||
protected MinimumAgeRecommendedDimension minimumManufacturerAgeRecommended;
|
||||
@XmlElement(name = "MaximumManufacturerAgeRecommended")
|
||||
protected AgeRecommendedDimension maximumManufacturerAgeRecommended;
|
||||
@XmlElement(name = "MinimumMerchantAgeRecommended")
|
||||
protected MinimumAgeRecommendedDimension minimumMerchantAgeRecommended;
|
||||
@XmlElement(name = "MaximumMerchantAgeRecommended")
|
||||
protected AgeRecommendedDimension maximumMerchantAgeRecommended;
|
||||
|
||||
/**
|
||||
* Recupera il valore della proprietà minimumManufacturerAgeRecommended.
|
||||
*
|
||||
* @return possible object is
|
||||
* {@link MinimumAgeRecommendedDimension }
|
||||
*/
|
||||
public MinimumAgeRecommendedDimension getMinimumManufacturerAgeRecommended() {
|
||||
return minimumManufacturerAgeRecommended;
|
||||
}
|
||||
|
||||
/**
|
||||
* Imposta il valore della proprietà minimumManufacturerAgeRecommended.
|
||||
*
|
||||
* @param value allowed object is
|
||||
* {@link MinimumAgeRecommendedDimension }
|
||||
*/
|
||||
public void setMinimumManufacturerAgeRecommended(MinimumAgeRecommendedDimension value) {
|
||||
this.minimumManufacturerAgeRecommended = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Recupera il valore della proprietà maximumManufacturerAgeRecommended.
|
||||
*
|
||||
* @return possible object is
|
||||
* {@link AgeRecommendedDimension }
|
||||
*/
|
||||
public AgeRecommendedDimension getMaximumManufacturerAgeRecommended() {
|
||||
return maximumManufacturerAgeRecommended;
|
||||
}
|
||||
|
||||
/**
|
||||
* Imposta il valore della proprietà maximumManufacturerAgeRecommended.
|
||||
*
|
||||
* @param value allowed object is
|
||||
* {@link AgeRecommendedDimension }
|
||||
*/
|
||||
public void setMaximumManufacturerAgeRecommended(AgeRecommendedDimension value) {
|
||||
this.maximumManufacturerAgeRecommended = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Recupera il valore della proprietà minimumMerchantAgeRecommended.
|
||||
*
|
||||
* @return possible object is
|
||||
* {@link MinimumAgeRecommendedDimension }
|
||||
*/
|
||||
public MinimumAgeRecommendedDimension getMinimumMerchantAgeRecommended() {
|
||||
return minimumMerchantAgeRecommended;
|
||||
}
|
||||
|
||||
/**
|
||||
* Imposta il valore della proprietà minimumMerchantAgeRecommended.
|
||||
*
|
||||
* @param value allowed object is
|
||||
* {@link MinimumAgeRecommendedDimension }
|
||||
*/
|
||||
public void setMinimumMerchantAgeRecommended(MinimumAgeRecommendedDimension value) {
|
||||
this.minimumMerchantAgeRecommended = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Recupera il valore della proprietà maximumMerchantAgeRecommended.
|
||||
*
|
||||
* @return possible object is
|
||||
* {@link AgeRecommendedDimension }
|
||||
*/
|
||||
public AgeRecommendedDimension getMaximumMerchantAgeRecommended() {
|
||||
return maximumMerchantAgeRecommended;
|
||||
}
|
||||
|
||||
/**
|
||||
* Imposta il valore della proprietà maximumMerchantAgeRecommended.
|
||||
*
|
||||
* @param value allowed object is
|
||||
* {@link AgeRecommendedDimension }
|
||||
*/
|
||||
public void setMaximumMerchantAgeRecommended(AgeRecommendedDimension value) {
|
||||
this.maximumMerchantAgeRecommended = value;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,82 +0,0 @@
|
||||
//
|
||||
// Questo file è stato generato dall'architettura JavaTM per XML Binding (JAXB) Reference Implementation, v2.2.7
|
||||
// Vedere <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
|
||||
// Qualsiasi modifica a questo file andrà persa durante la ricompilazione dello schema di origine.
|
||||
// Generato il: 2015.09.16 alle 04:39:51 PM CEST
|
||||
//
|
||||
|
||||
|
||||
package it.integry.ems.order.amazon.dto;
|
||||
|
||||
import javax.xml.bind.annotation.*;
|
||||
import java.math.BigInteger;
|
||||
|
||||
|
||||
/**
|
||||
* <p>Classe Java per AgeRecommendedDimension complex type.
|
||||
*
|
||||
* <p>Il seguente frammento di schema specifica il contenuto previsto contenuto in questa classe.
|
||||
*
|
||||
* <pre>
|
||||
* <complexType name="AgeRecommendedDimension">
|
||||
* <simpleContent>
|
||||
* <extension base="<http://www.w3.org/2001/XMLSchema>positiveInteger">
|
||||
* <attribute name="unitOfMeasure" use="required" type="{}AgeRecommendedUnitOfMeasure" />
|
||||
* </extension>
|
||||
* </simpleContent>
|
||||
* </complexType>
|
||||
* </pre>
|
||||
*/
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
@XmlType(name = "AgeRecommendedDimension", propOrder = {
|
||||
"value"
|
||||
})
|
||||
public class AgeRecommendedDimension {
|
||||
|
||||
@XmlValue
|
||||
@XmlSchemaType(name = "positiveInteger")
|
||||
protected BigInteger value;
|
||||
@XmlAttribute(name = "unitOfMeasure", required = true)
|
||||
protected AgeRecommendedUnitOfMeasure unitOfMeasure;
|
||||
|
||||
/**
|
||||
* Recupera il valore della proprietà value.
|
||||
*
|
||||
* @return possible object is
|
||||
* {@link BigInteger }
|
||||
*/
|
||||
public BigInteger getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Imposta il valore della proprietà value.
|
||||
*
|
||||
* @param value allowed object is
|
||||
* {@link BigInteger }
|
||||
*/
|
||||
public void setValue(BigInteger value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Recupera il valore della proprietà unitOfMeasure.
|
||||
*
|
||||
* @return possible object is
|
||||
* {@link AgeRecommendedUnitOfMeasure }
|
||||
*/
|
||||
public AgeRecommendedUnitOfMeasure getUnitOfMeasure() {
|
||||
return unitOfMeasure;
|
||||
}
|
||||
|
||||
/**
|
||||
* Imposta il valore della proprietà unitOfMeasure.
|
||||
*
|
||||
* @param value allowed object is
|
||||
* {@link AgeRecommendedUnitOfMeasure }
|
||||
*/
|
||||
public void setUnitOfMeasure(AgeRecommendedUnitOfMeasure value) {
|
||||
this.unitOfMeasure = value;
|
||||
}
|
||||
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user