Merge branch 'develop' into feature/SpostaUl
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:
@@ -6,19 +6,23 @@ import it.integry.ems.menu.dto.MenuConfigDTO;
|
|||||||
import it.integry.ems.menu.dto.StbMenuDTO;
|
import it.integry.ems.menu.dto.StbMenuDTO;
|
||||||
import it.integry.ems.menu.dto.StbMenuOpzDTO;
|
import it.integry.ems.menu.dto.StbMenuOpzDTO;
|
||||||
import it.integry.ems.menu.dto.StbTipoAziendaDTO;
|
import it.integry.ems.menu.dto.StbTipoAziendaDTO;
|
||||||
|
import it.integry.ems.sync.MultiDBTransaction.Connection;
|
||||||
import it.integry.ems.utility.UtilityDirs;
|
import it.integry.ems.utility.UtilityDirs;
|
||||||
|
import it.integry.ems_model.base.EntityPropertyHolder;
|
||||||
|
import it.integry.ems_model.entity.StbMenu;
|
||||||
|
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.UtilityDB;
|
||||||
import it.integry.ems_model.utility.UtilityLocalDate;
|
import it.integry.ems_model.utility.UtilityLocalDate;
|
||||||
|
import it.integry.ems_model.utility.UtilityQuery;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileOutputStream;
|
import java.io.FileOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.OutputStreamWriter;
|
import java.io.OutputStreamWriter;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
|
|
||||||
import it.integry.ems.sync.MultiDBTransaction.Connection;
|
|
||||||
|
|
||||||
import java.sql.DriverManager;
|
import java.sql.DriverManager;
|
||||||
|
import java.sql.SQLException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
@@ -32,14 +36,73 @@ public class MenuStaticCreator {
|
|||||||
String username = "sa";
|
String username = "sa";
|
||||||
String password = "sa";
|
String password = "sa";
|
||||||
|
|
||||||
|
EntityPropertyHolder entityPropertyHolder = new EntityPropertyHolder();
|
||||||
|
entityPropertyHolder.init();
|
||||||
|
|
||||||
try (Connection connection = Connection.fromConnection(DriverManager.getConnection(connectionString, username, password))) {
|
try (Connection connection = Connection.fromConnection(DriverManager.getConnection(connectionString, username, password))) {
|
||||||
connection.setTransactionIsolation(java.sql.Connection.TRANSACTION_READ_UNCOMMITTED);
|
connection.setTransactionIsolation(java.sql.Connection.TRANSACTION_READ_UNCOMMITTED);
|
||||||
connection.setAutoCommit(false);
|
connection.setAutoCommit(false);
|
||||||
|
|
||||||
|
copyWmsMenuFromGenericaConfig(connection, entityPropertyHolder);
|
||||||
createMenu(connection, UtilityDirs.getDevelopmentMenusFolder());
|
createMenu(connection, UtilityDirs.getDevelopmentMenusFolder());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void copyWmsMenuFromGenericaConfig(Connection connection, EntityPropertyHolder entityPropertyHolder) throws SQLException {
|
||||||
|
final String wmsRootCodOpz = "MM007";
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
String sql = Query.format("WITH MenuCTE AS (\n" +
|
||||||
|
" -- Ancoraggio della ricorsione: Seleziona tutte le opzioni di menu di alto livello (che non hanno un cod_parent)\n" +
|
||||||
|
" SELECT *,\n" +
|
||||||
|
" 0 AS Livello -- Livello iniziale\n" +
|
||||||
|
" FROM " + StbMenu.ENTITY + "\n" +
|
||||||
|
" WHERE cod_opz = {} AND tipo_azienda = 'GENERICA'\n" +
|
||||||
|
"\n" +
|
||||||
|
" UNION ALL\n" +
|
||||||
|
"\n" +
|
||||||
|
" -- Ricorsione: Seleziona tutte le opzioni di menu figlie\n" +
|
||||||
|
" SELECT m.*,\n" +
|
||||||
|
" c.Livello + 1 AS Livello -- Incrementa il livello per il menu figlio\n" +
|
||||||
|
" FROM " + StbMenu.ENTITY + " m\n" +
|
||||||
|
" INNER JOIN\n" +
|
||||||
|
" MenuCTE c ON m.cod_parent = c.cod_opz AND m.tipo_azienda = c.tipo_azienda)\n" +
|
||||||
|
"-- Seleziona tutti i risultati dalla CTE ricorsiva\n" +
|
||||||
|
"SELECT *\n" +
|
||||||
|
"FROM MenuCTE\n" +
|
||||||
|
"ORDER BY Livello", wmsRootCodOpz);
|
||||||
|
|
||||||
|
final List<StbMenu> stbMenus = UtilityDB.executeSimpleQueryDTO(connection, sql, StbMenu.class);
|
||||||
|
|
||||||
|
|
||||||
|
final List<String> idsToDelete = stbMenus.stream().map(StbMenu::getCodOpz)
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
|
String deleteInOtherAziendaTypes = String.format("DELETE FROM " + StbMenu.ENTITY +
|
||||||
|
" WHERE cod_opz IN (%s) AND tipo_azienda <> 'GENERICA'", UtilityQuery.concatStringFieldsWithSeparator(idsToDelete, ","));
|
||||||
|
|
||||||
|
connection.prepareStatement(deleteInOtherAziendaTypes).executeUpdate();
|
||||||
|
|
||||||
|
List<String> tipiAzienda = retrieveTipiAzienda(connection);
|
||||||
|
|
||||||
|
for (String tipoAzienda : tipiAzienda) {
|
||||||
|
for (StbMenu stbMenu : stbMenus) {
|
||||||
|
stbMenu.setTipoAzienda(tipoAzienda);
|
||||||
|
stbMenu.setOperation(OperationType.INSERT);
|
||||||
|
|
||||||
|
stbMenu.manageWithParentConnection(connection, OperationType.INSERT, null, entityPropertyHolder);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
connection.commit();
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
|
||||||
|
connection.rollback();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static void createMenu(Connection connection, String menuJsonResourceFolder) throws Exception {
|
public static void createMenu(Connection connection, String menuJsonResourceFolder) throws Exception {
|
||||||
ObjectMapper jsonObjectMapper = new ObjectMapper();
|
ObjectMapper jsonObjectMapper = new ObjectMapper();
|
||||||
@@ -51,7 +114,9 @@ public class MenuStaticCreator {
|
|||||||
final List<StbMenuDTO> stbMenus = UtilityDB.executeSimpleQueryDTO(connection, "SELECT * FROM stb_menu", StbMenuDTO.class);
|
final List<StbMenuDTO> stbMenus = UtilityDB.executeSimpleQueryDTO(connection, "SELECT * FROM stb_menu", StbMenuDTO.class);
|
||||||
final Map<String, List<StbMenuDTO>> menusByAzienda = stbMenus.stream().collect(Collectors.groupingBy(StbMenuDTO::getTipoAzienda));
|
final Map<String, List<StbMenuDTO>> menusByAzienda = stbMenus.stream().collect(Collectors.groupingBy(StbMenuDTO::getTipoAzienda));
|
||||||
|
|
||||||
MenuConfigDTO menuConfigDTO = new MenuConfigDTO(Integer.parseInt(CommonConstants.DATESTAMP_YMD_FORMATTER.format(UtilityLocalDate.getNow())))
|
final long menuVersion = Long.parseLong(CommonConstants.TIMESTAMP_FORMATTER.format(UtilityLocalDate.getNowTime()));
|
||||||
|
|
||||||
|
MenuConfigDTO menuConfigDTO = new MenuConfigDTO(menuVersion)
|
||||||
.setStbMenuOpz(stbMenuOpzs)
|
.setStbMenuOpz(stbMenuOpzs)
|
||||||
.setStbTipoAzienda(stbTipoAziendas)
|
.setStbTipoAzienda(stbTipoAziendas)
|
||||||
.setMenusByAzienda(menusByAzienda);
|
.setMenusByAzienda(menusByAzienda);
|
||||||
@@ -72,4 +137,12 @@ public class MenuStaticCreator {
|
|||||||
outputStream.close();
|
outputStream.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private static List<String> retrieveTipiAzienda(Connection connection) throws SQLException {
|
||||||
|
return UtilityDB.executeSimpleQueryOnlyFirstColumn(connection, "SELECT DISTINCT tipo_azienda\n" +
|
||||||
|
"FROM stb_menu\n" +
|
||||||
|
"WHERE tipo_azienda <> 'GENERICA'\n" +
|
||||||
|
"ORDER BY tipo_azienda");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import java.util.Map;
|
|||||||
|
|
||||||
public class MenuConfigDTO {
|
public class MenuConfigDTO {
|
||||||
|
|
||||||
private int version;
|
private long version;
|
||||||
private List<StbMenuOpzDTO> stbMenuOpz;
|
private List<StbMenuOpzDTO> stbMenuOpz;
|
||||||
private List<StbTipoAziendaDTO> stbTipoAzienda;
|
private List<StbTipoAziendaDTO> stbTipoAzienda;
|
||||||
private Map<String, List<StbMenuDTO>> menusByAzienda;
|
private Map<String, List<StbMenuDTO>> menusByAzienda;
|
||||||
@@ -13,15 +13,15 @@ public class MenuConfigDTO {
|
|||||||
public MenuConfigDTO() {
|
public MenuConfigDTO() {
|
||||||
}
|
}
|
||||||
|
|
||||||
public MenuConfigDTO(int version) {
|
public MenuConfigDTO(long version) {
|
||||||
this.version = version;
|
this.version = version;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getVersion() {
|
public long getVersion() {
|
||||||
return version;
|
return version;
|
||||||
}
|
}
|
||||||
|
|
||||||
public MenuConfigDTO setVersion(int version) {
|
public MenuConfigDTO setVersion(long version) {
|
||||||
this.version = version;
|
this.version = version;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import it.integry.ems.menu.dto.StbTipoAziendaDTO;
|
|||||||
import it.integry.ems.service.MailService;
|
import it.integry.ems.service.MailService;
|
||||||
import it.integry.ems.settings.SettingsController;
|
import it.integry.ems.settings.SettingsController;
|
||||||
import it.integry.ems.sync.MultiDBTransaction.AdvancedDataSource;
|
import it.integry.ems.sync.MultiDBTransaction.AdvancedDataSource;
|
||||||
|
import it.integry.ems.sync.MultiDBTransaction.Connection;
|
||||||
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
|
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
|
||||||
import it.integry.ems.utility.UtilityDirs;
|
import it.integry.ems.utility.UtilityDirs;
|
||||||
import it.integry.ems_model.entity.Azienda;
|
import it.integry.ems_model.entity.Azienda;
|
||||||
@@ -27,9 +28,6 @@ import org.springframework.stereotype.Service;
|
|||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
|
|
||||||
import it.integry.ems.sync.MultiDBTransaction.Connection;
|
|
||||||
|
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -105,7 +103,7 @@ public class MenuConfigurationService {
|
|||||||
private void internalRefresh(Connection connection, MenuConfigDTO menuConfig, boolean forceRefresh) throws Exception {
|
private void internalRefresh(Connection connection, MenuConfigDTO menuConfig, boolean forceRefresh) throws Exception {
|
||||||
final Azienda azienda = Azienda.getDefaultAzienda(connection);
|
final Azienda azienda = Azienda.getDefaultAzienda(connection);
|
||||||
|
|
||||||
int lastMenuUpd = Integer.parseInt(azienda.getLastUpgDbMenu().replace("QM", ""));
|
final long lastMenuUpd = Long.parseLong(azienda.getLastUpgDbMenu().replace("QM", ""));
|
||||||
|
|
||||||
if (!forceRefresh && lastMenuUpd > 0 && lastMenuUpd >= menuConfig.getVersion())
|
if (!forceRefresh && lastMenuUpd > 0 && lastMenuUpd >= menuConfig.getVersion())
|
||||||
return;
|
return;
|
||||||
@@ -198,6 +196,13 @@ public class MenuConfigurationService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
short aziendaUpdDbColumnLength = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(connection,
|
||||||
|
"SELECT COL_LENGTH('azienda','last_upg_db_menu') AS column_length");
|
||||||
|
|
||||||
|
if(aziendaUpdDbColumnLength != 16) {
|
||||||
|
executeStatement(connection, "ALTER TABLE azienda ALTER COLUMN last_upg_db_menu VARCHAR(16)");
|
||||||
|
}
|
||||||
|
|
||||||
executeStatement(connection, "ALTER TABLE azienda ADD CONSTRAINT FK_azienda_stb_tipo_azienda FOREIGN KEY (tipo_azienda) REFERENCES stb_tipo_azienda ( tipo_azienda )",
|
executeStatement(connection, "ALTER TABLE azienda ADD CONSTRAINT FK_azienda_stb_tipo_azienda FOREIGN KEY (tipo_azienda) REFERENCES stb_tipo_azienda ( tipo_azienda )",
|
||||||
"DELETE FROM stb_abil WHERE cod_opz not in (select cod_opz from stb_menu_opz )",
|
"DELETE FROM stb_abil WHERE cod_opz not in (select cod_opz from stb_menu_opz )",
|
||||||
"INSERT INTO stb_Abil SELECT opz2Abil.cod_parent AS cod_opz, opz2Abil.user_name, 'S' flag_Abil, NULL gest_name\n" +
|
"INSERT INTO stb_Abil SELECT opz2Abil.cod_parent AS cod_opz, opz2Abil.user_name, 'S' flag_Abil, NULL gest_name\n" +
|
||||||
@@ -213,7 +218,7 @@ public class MenuConfigurationService {
|
|||||||
" AND abil.flag_Abil <> 'N') Opz2Abil\n" +
|
" AND abil.flag_Abil <> 'N') Opz2Abil\n" +
|
||||||
" LEFT OUTER JOIN stb_Abil ON stb_Abil.cod_opz = Opz2Abil.cod_parent AND stb_abil.user_name = Opz2Abil.user_name\n" +
|
" LEFT OUTER JOIN stb_Abil ON stb_Abil.cod_opz = Opz2Abil.cod_parent AND stb_abil.user_name = Opz2Abil.user_name\n" +
|
||||||
"WHERE stb_abil.cod_opz IS NULL",
|
"WHERE stb_abil.cod_opz IS NULL",
|
||||||
"UPDATE azienda SET last_upg_db_menu = " + UtilityDB.valueToString(menuConfig.getVersion()));
|
"UPDATE azienda SET last_upg_db_menu = " + UtilityDB.valueToString(String.valueOf(menuConfig.getVersion())));
|
||||||
|
|
||||||
connection.commit();
|
connection.commit();
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
|
|||||||
@@ -177,16 +177,8 @@ public abstract class BaseMigration implements MigrationModelInterface {
|
|||||||
return val != null && val == 1;
|
return val != null && val == 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean existColumn(String tableName, String columnName) throws SQLException, IOException {
|
|
||||||
return UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(advancedDataSource.getConnection(),
|
|
||||||
Query.format("SELECT CAST(COUNT(*) AS BIT)\n" +
|
|
||||||
"FROM sys.syscolumns\n" +
|
|
||||||
"WHERE name = %s\n" +
|
|
||||||
" AND OBJECT_NAME(id) = %s", columnName, tableName));
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void renameColumn(String tableName, String oldColumnname, String newColumnName) throws SQLException, IOException {
|
protected void renameColumn(String tableName, String oldColumnname, String newColumnName) throws SQLException, IOException {
|
||||||
if (existColumn(tableName, oldColumnname)) {
|
if (existsColumn(tableName, oldColumnname)) {
|
||||||
String sql =
|
String sql =
|
||||||
"exec sp_rename 'dbo." + tableName + "." + oldColumnname + "', " + newColumnName + ", 'COLUMN'";
|
"exec sp_rename 'dbo." + tableName + "." + oldColumnname + "', " + newColumnName + ", 'COLUMN'";
|
||||||
executeStatement(sql);
|
executeStatement(sql);
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ public enum IntegryCustomer {
|
|||||||
IntegryCustomerDB.Igood_ShopService),
|
IntegryCustomerDB.Igood_ShopService),
|
||||||
Ime(IntegryCustomerDB.Ime_ImeTe),
|
Ime(IntegryCustomerDB.Ime_ImeTe),
|
||||||
Integry(IntegryCustomerDB.Integry_Studioml),
|
Integry(IntegryCustomerDB.Integry_Studioml),
|
||||||
Integry_Demo(IntegryCustomerDB.IntegryDemo_OFDemo),
|
Integry_Demo(IntegryCustomerDB.IntegryDemo_OFDemo, IntegryCustomerDB.IntegryDemo_Menu),
|
||||||
Ivr(IntegryCustomerDB.Ivr_Vetta, IntegryCustomerDB.Ivr_Varci),
|
Ivr(IntegryCustomerDB.Ivr_Vetta, IntegryCustomerDB.Ivr_Varci),
|
||||||
Lamonarca(IntegryCustomerDB.Lamonarca_Lamonarca),
|
Lamonarca(IntegryCustomerDB.Lamonarca_Lamonarca),
|
||||||
Lippolis(IntegryCustomerDB.Lippolis_SGSRL),
|
Lippolis(IntegryCustomerDB.Lippolis_SGSRL),
|
||||||
|
|||||||
@@ -100,6 +100,7 @@ public enum IntegryCustomerDB {
|
|||||||
|
|
||||||
|
|
||||||
Integry_Studioml("studioml"),
|
Integry_Studioml("studioml"),
|
||||||
|
IntegryDemo_Menu("menu"),
|
||||||
IntegryDemo_OFDemo("of_demo"),
|
IntegryDemo_OFDemo("of_demo"),
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ public class Migration_20241202145553 extends BaseMigration implements Migration
|
|||||||
if (isCustomerDb(IntegryCustomerDB.Siciliani_DMS))
|
if (isCustomerDb(IntegryCustomerDB.Siciliani_DMS))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!existColumn("mtb_lisa_costo_data", "part_iva" ))
|
if (!existsColumn("mtb_lisa_costo_data", "part_iva" ))
|
||||||
executeStatement("ALTER TABLE mtb_lisa_costo_data ADD part_iva varchar(20)");
|
executeStatement("ALTER TABLE mtb_lisa_costo_data ADD part_iva varchar(20)");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ public class Migration_20250224114817 extends BaseMigration implements Migration
|
|||||||
if (isHistoryDB())
|
if (isHistoryDB())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (existsTable("apuliac_agg_prz_csv") && !existColumn("apuliac_agg_prz_csv", "altro")){
|
if (existsTable("apuliac_agg_prz_csv") && !existsColumn("apuliac_agg_prz_csv", "altro")){
|
||||||
executeStatement("alter table apuliac_agg_prz_csv add altro varchar(max)");
|
executeStatement("alter table apuliac_agg_prz_csv add altro varchar(max)");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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_20250224174207 extends BaseMigration implements MigrationModelInterface {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void up() throws Exception {
|
||||||
|
if (isHistoryDB())
|
||||||
|
return;
|
||||||
|
executeStatement("alter table dbo.ctb_amac_manutenzioni add esito_positivo BIT default 1");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void down() throws Exception {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -15,7 +15,7 @@ public class Migration_20250225124406 extends BaseMigration implements Migration
|
|||||||
if (isCustomerDb(IntegryCustomerDB.Siciliani_DMS))
|
if (isCustomerDb(IntegryCustomerDB.Siciliani_DMS))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!existColumn("mtb_aart", "flag_stampa_docu_vend"))
|
if (!existsColumn("mtb_aart", "flag_stampa_docu_vend"))
|
||||||
executeStatement(
|
executeStatement(
|
||||||
"alter table mtb_aart add flag_stampa_docu_vend bit not null default 1");
|
"alter table mtb_aart add flag_stampa_docu_vend bit not null default 1");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,182 @@
|
|||||||
|
package it.integry.ems.migration.model;
|
||||||
|
|
||||||
|
import it.integry.ems.migration._base.BaseMigration;
|
||||||
|
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||||
|
|
||||||
|
public class Migration_20250225173549 extends BaseMigration implements MigrationModelInterface {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void up() throws Exception {
|
||||||
|
if (isHistoryDB())
|
||||||
|
return;
|
||||||
|
|
||||||
|
createOrUpdateFunction("f_getEAN128UL","CREATE FUNCTION [dbo].[f_getEAN128UL](@gestione VARCHAR(1), @dataCollo DATETIME, @serCollo VARCHAR(2), @numCollo int, @customPrefissoEan VARCHAR(7))\n" +
|
||||||
|
" RETURNS TABLE AS\n" +
|
||||||
|
" RETURN\n" +
|
||||||
|
"\n" +
|
||||||
|
"-- DECLARE @gestione AS VARCHAR(1) = 'L'\n" +
|
||||||
|
"-- DECLARE @serCollo AS VARCHAR(10) = '/'\n" +
|
||||||
|
"-- DECLARE @numCollo AS INT = 4427\n" +
|
||||||
|
"-- DECLARE @dataCollo AS DATETIME = '2024-02-05';\n" +
|
||||||
|
"-- DECLARE @customPrefissoEan AS VARCHAR(7);-- = '8017596';\n" +
|
||||||
|
"\n" +
|
||||||
|
"WITH barcodes AS (\n" +
|
||||||
|
" SELECT CONCAT(CASE WHEN @customPrefissoEan IS NULL THEN azienda.prefisso_ean ELSE @customPrefissoEan END,\n" +
|
||||||
|
" CAST(CAST(mtb_colt.num_collo / 100000 AS INT) AS varchar),\n" +
|
||||||
|
" CASE mtb_colt.gestione\n" +
|
||||||
|
" WHEN 'A' THEN '1'\n" +
|
||||||
|
" WHEN 'L' THEN '2'\n" +
|
||||||
|
" WHEN 'V' THEN '3' END,\n" +
|
||||||
|
" RIGHT(CAST(DATEPART(YEAR, mtb_colt.data_collo) AS varchar), 2),\n" +
|
||||||
|
" RIGHT(FORMAT(mtb_colt.num_collo, REPLICATE('0', 5)), 5)) AS AI_00,\n" +
|
||||||
|
" CASE\n" +
|
||||||
|
" WHEN mtb_aart.cod_barre_imb IS NOT NULL AND LEN(mtb_aart.cod_barre_imb) < 14 THEN\n" +
|
||||||
|
" FORMAT(CONVERT(NUMERIC, ISNULL(NULLIF(mtb_aart.cod_barre_imb, ''), '0')), REPLICATE('0', 14))\n" +
|
||||||
|
" ELSE mtb_aart.cod_barre_imb\n" +
|
||||||
|
" END AS AI_01,\n" +
|
||||||
|
" CASE\n" +
|
||||||
|
" WHEN mtb_aart.bar_code IS NOT NULL AND LEN(mtb_aart.bar_code) < 14\n" +
|
||||||
|
" THEN\n" +
|
||||||
|
" FORMAT(CONVERT(BIGINT, mtb_aart.bar_code), REPLICATE('0', 14))\n" +
|
||||||
|
" ELSE mtb_aart.bar_code\n" +
|
||||||
|
" END AS AI_02,\n" +
|
||||||
|
" CASE\n" +
|
||||||
|
" WHEN mtb_colr.partita_mag IS NOT NULL THEN\n" +
|
||||||
|
" mtb_colr.partita_mag + CHAR(29)\n" +
|
||||||
|
" END AS AI_10,\n" +
|
||||||
|
" CASE\n" +
|
||||||
|
" WHEN mtb_partita_mag.data_scad IS NOT NULL THEN\n" +
|
||||||
|
" REPLACE(CONVERT(varchar(10), mtb_partita_mag.data_scad, 2), '.', '')\n" +
|
||||||
|
" END AS AI_15,\n" +
|
||||||
|
" CASE\n" +
|
||||||
|
" WHEN LEN(CAST(mtb_aart.peso_kg * mtb_colr.qta_cnf AS INTEGER)) <= 6 THEN\n" +
|
||||||
|
" REPLACE(FORMAT(mtb_aart.peso_kg * mtb_colr.qta_cnf, '000000'), '.', '')\n" +
|
||||||
|
" END AS AI_3100,\n" +
|
||||||
|
" CASE\n" +
|
||||||
|
" WHEN LEN(CAST(mtb_aart.peso_kg * mtb_colr.qta_cnf AS INTEGER)) <= 5 THEN\n" +
|
||||||
|
" REPLACE(FORMAT(mtb_aart.peso_kg * mtb_colr.qta_cnf, '00000.0'), '.', '')\n" +
|
||||||
|
" END AS AI_3101,\n" +
|
||||||
|
" CASE\n" +
|
||||||
|
" WHEN LEN(CAST(mtb_aart.peso_kg * mtb_colr.qta_cnf AS INTEGER)) <= 4 THEN\n" +
|
||||||
|
" REPLACE(FORMAT(mtb_aart.peso_kg * mtb_colr.qta_cnf, '0000.00'), '.', '')\n" +
|
||||||
|
" END AS AI_3102,\n" +
|
||||||
|
" CASE\n" +
|
||||||
|
" WHEN LEN(CAST(mtb_aart.peso_kg * mtb_colr.qta_cnf AS INTEGER)) <= 3 THEN\n" +
|
||||||
|
" REPLACE(FORMAT(mtb_aart.peso_kg * mtb_colr.qta_cnf, '000.000'), '.', '')\n" +
|
||||||
|
" END AS AI_3103,\n" +
|
||||||
|
" CASE\n" +
|
||||||
|
" WHEN LEN(CAST(mtb_aart.peso_kg * mtb_colr.qta_cnf AS INTEGER)) <= 2 THEN\n" +
|
||||||
|
" REPLACE(FORMAT(mtb_aart.peso_kg * mtb_colr.qta_cnf, '00.0000'), '.', '')\n" +
|
||||||
|
" END AS AI_3104,\n" +
|
||||||
|
" CASE\n" +
|
||||||
|
" WHEN LEN(CAST(mtb_aart.peso_kg * mtb_colr.qta_cnf AS INTEGER)) <= 1 THEN\n" +
|
||||||
|
" REPLACE(FORMAT(mtb_aart.peso_kg * mtb_colr.qta_cnf, '0.00000'), '.', '')\n" +
|
||||||
|
" END AS AI_3105,\n" +
|
||||||
|
" CASE\n" +
|
||||||
|
" WHEN LEN(CAST(mtb_colt.peso_kg AS INTEGER)) <= 6 THEN\n" +
|
||||||
|
" REPLACE(FORMAT(mtb_colt.peso_kg, '000000'), '.', '')\n" +
|
||||||
|
" END AS AI_3300,\n" +
|
||||||
|
" CASE\n" +
|
||||||
|
" WHEN LEN(CAST(mtb_colt.peso_kg AS INTEGER)) <= 5 THEN\n" +
|
||||||
|
" REPLACE(FORMAT(mtb_colt.peso_kg, '00000.0'), '.', '')\n" +
|
||||||
|
" END AS AI_3301,\n" +
|
||||||
|
" CASE\n" +
|
||||||
|
" WHEN LEN(CAST(mtb_colt.peso_kg AS INTEGER)) <= 4 THEN\n" +
|
||||||
|
" REPLACE(FORMAT(mtb_colt.peso_kg, '0000.00'), '.', '')\n" +
|
||||||
|
" END AS AI_3302,\n" +
|
||||||
|
" CASE\n" +
|
||||||
|
" WHEN LEN(CAST(mtb_colt.peso_kg AS INTEGER)) <= 3 THEN\n" +
|
||||||
|
" REPLACE(FORMAT(mtb_colt.peso_kg, '000.000'), '.', '')\n" +
|
||||||
|
" END AS AI_3303,\n" +
|
||||||
|
" CASE\n" +
|
||||||
|
" WHEN LEN(CAST(mtb_colt.peso_kg AS INTEGER)) <= 2 THEN\n" +
|
||||||
|
" REPLACE(FORMAT(mtb_colt.peso_kg, '00.0000'), '.', '')\n" +
|
||||||
|
" END AS AI_3304,\n" +
|
||||||
|
" CASE\n" +
|
||||||
|
" WHEN LEN(CAST(mtb_colt.peso_kg AS INTEGER)) <= 1 THEN\n" +
|
||||||
|
" REPLACE(FORMAT(mtb_colt.peso_kg, '0.00000'), '.', '')\n" +
|
||||||
|
" END AS AI_3305,\n" +
|
||||||
|
" CONVERT(varchar, CONVERT(integer, SUM(mtb_colr.qta_col / mtb_colr.qta_cnf))) AS AI_37\n" +
|
||||||
|
" FROM mtb_colt\n" +
|
||||||
|
" INNER JOIN mtb_colr\n" +
|
||||||
|
" ON mtb_colt.gestione = mtb_colr.gestione and mtb_colt.data_collo = mtb_colr.data_collo and\n" +
|
||||||
|
" mtb_colt.ser_collo = mtb_colr.ser_collo and mtb_colt.num_collo = mtb_colr.num_collo\n" +
|
||||||
|
" INNER JOIN mtb_aart ON mtb_colr.cod_mart = mtb_aart.cod_mart\n" +
|
||||||
|
" LEFT outer JOIN mtb_partita_mag ON mtb_colr.cod_mart = mtb_partita_mag.cod_mart AND\n" +
|
||||||
|
" mtb_colr.partita_mag = mtb_partita_mag.partita_mag,\n" +
|
||||||
|
" azienda\n" +
|
||||||
|
" WHERE mtb_colt.gestione = @gestione\n" +
|
||||||
|
" AND mtb_colt.data_collo = @dataCollo\n" +
|
||||||
|
" AND mtb_colt.ser_collo = @serCollo\n" +
|
||||||
|
" AND mtb_colt.num_collo = @numCollo\n" +
|
||||||
|
" GROUP BY \n" +
|
||||||
|
" mtb_colr.qta_cnf,\n" +
|
||||||
|
" mtb_colt.data_vers,\n" +
|
||||||
|
" nome_ditta,\n" +
|
||||||
|
" azienda.indirizzo,\n" +
|
||||||
|
" azienda.cap,\n" +
|
||||||
|
" azienda.citta,\n" +
|
||||||
|
" azienda.prov,\n" +
|
||||||
|
" prefisso_ean,\n" +
|
||||||
|
" mtb_colt.data_collo,\n" +
|
||||||
|
" mtb_colt.num_collo,\n" +
|
||||||
|
" mtb_aart.cod_barre_imb,\n" +
|
||||||
|
" mtb_aart.bar_code,\n" +
|
||||||
|
" mtb_aart.descrizione_estesa,\n" +
|
||||||
|
" mtb_colr.partita_mag,\n" +
|
||||||
|
" mtb_partita_mag.data_scad,\n" +
|
||||||
|
" mtb_colt.peso_netto_kg,\n" +
|
||||||
|
" mtb_colr.cod_mart, \n" +
|
||||||
|
"\t\t\t mtb_colt.gestione,\n" +
|
||||||
|
"\t\t\t mtb_colt.peso_kg,\n" +
|
||||||
|
"\t\t\t mtb_aart.peso_kg\n" +
|
||||||
|
"),\n" +
|
||||||
|
" appoggio AS (\n" +
|
||||||
|
" SELECT CONCAT(\n" +
|
||||||
|
" REPLICATE('0', 17 - LEN(AI_00)),\n" +
|
||||||
|
" AI_00) AS AI_00,\n" +
|
||||||
|
" CASE WHEN AI_01 IS NOT NULL AND LEN(AI_01) = 13 THEN CONCAT(AI_01, dbo.getCheckDigitITF14(AI_01)) ELSE AI_01 END AS AI_01,\n" +
|
||||||
|
" AI_02,\n" +
|
||||||
|
" AI_10,\n" +
|
||||||
|
" AI_15,\n" +
|
||||||
|
" AI_3100,\n" +
|
||||||
|
" AI_3101,\n" +
|
||||||
|
" AI_3102,\n" +
|
||||||
|
" AI_3103,\n" +
|
||||||
|
" AI_3104,\n" +
|
||||||
|
" AI_3105,\n" +
|
||||||
|
" AI_3300,\n" +
|
||||||
|
" AI_3301,\n" +
|
||||||
|
" AI_3302,\n" +
|
||||||
|
" AI_3303,\n" +
|
||||||
|
" AI_3304,\n" +
|
||||||
|
" AI_3305,\n" +
|
||||||
|
" AI_37\n" +
|
||||||
|
" FROM barcodes\n" +
|
||||||
|
" )\n" +
|
||||||
|
"SELECT CONCAT(AI_00,\n" +
|
||||||
|
" dbo.getCheckDigitSSCC(AI_00)) AS AI_00,\n" +
|
||||||
|
" AI_01,\n" +
|
||||||
|
" AI_02,\n" +
|
||||||
|
" AI_10,\n" +
|
||||||
|
" AI_15,\n" +
|
||||||
|
" AI_3100,\n" +
|
||||||
|
" AI_3101,\n" +
|
||||||
|
" AI_3102,\n" +
|
||||||
|
" AI_3103,\n" +
|
||||||
|
" AI_3104,\n" +
|
||||||
|
" AI_3105,\n" +
|
||||||
|
" AI_3300,\n" +
|
||||||
|
" AI_3301,\n" +
|
||||||
|
" AI_3302,\n" +
|
||||||
|
" AI_3303,\n" +
|
||||||
|
" AI_3304,\n" +
|
||||||
|
" AI_3305,\n" +
|
||||||
|
" AI_37\n" +
|
||||||
|
"FROM appoggio\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void down() throws Exception {
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
package it.integry.ems.migration.model;
|
||||||
|
|
||||||
|
import it.integry.ems.migration._base.BaseMigration;
|
||||||
|
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||||
|
|
||||||
|
public class Migration_20250226121941 extends BaseMigration implements MigrationModelInterface {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void up() throws Exception {
|
||||||
|
if (isHistoryDB())
|
||||||
|
return;
|
||||||
|
|
||||||
|
executeStatement("alter table dbo.ctb_amac_manutenzioni add manutenzione_ordinaria BIT default 1");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@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.MigrationModelInterface;
|
||||||
|
|
||||||
|
public class Migration_20250226162435 extends BaseMigration implements MigrationModelInterface {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void up() throws Exception {
|
||||||
|
if (isHistoryDB())
|
||||||
|
return;
|
||||||
|
|
||||||
|
executeStatement("create table dbo.crl_amac_manutenzioni_files\n" +
|
||||||
|
"(\n" +
|
||||||
|
" id_manutenzione BIGINT not null\n" +
|
||||||
|
" constraint fk_crl_amac_manutenzioni_files_ctb_amac_manutenzioni\n" +
|
||||||
|
" references dbo.ctb_amac_manutenzioni,\n" +
|
||||||
|
" id_attach VARCHAR(40) not null\n" +
|
||||||
|
" constraint fk_crl_amac_manutenzioni_files_stb_files_attached\n" +
|
||||||
|
" references dbo.stb_files_attached,\n" +
|
||||||
|
" constraint pk_crl_amac_manutenzioni_files\n" +
|
||||||
|
" primary key (id_manutenzione, id_attach)\n" +
|
||||||
|
")\n");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void down() throws Exception {
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
package it.integry.ems.migration.model;
|
||||||
|
|
||||||
|
import it.integry.ems.migration._base.BaseMigration;
|
||||||
|
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||||
|
|
||||||
|
public class Migration_20250226174347 extends BaseMigration implements MigrationModelInterface {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void up() throws Exception {
|
||||||
|
if (isHistoryDB())
|
||||||
|
return;
|
||||||
|
|
||||||
|
createSetup("PVM","MACCHINARI_PROD","REPORT_NAME_MANUTENZIONI",null,"Nome report stampa riepilogo manutenzioni macchina","REPORT_NAME");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void down() throws Exception {
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
package it.integry.ems.migration.model;
|
||||||
|
|
||||||
|
import it.integry.ems.migration._base.BaseMigration;
|
||||||
|
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||||
|
|
||||||
|
public class Migration_20250226175035 extends BaseMigration implements MigrationModelInterface {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void up() throws Exception {
|
||||||
|
if (isHistoryDB())
|
||||||
|
return;
|
||||||
|
|
||||||
|
createSetup("PVM","MONITORAGGIO_LINEE_V2","ENABLE_MODIFICA_LOTTO_SUGGERITO","N","Se abilitato permette la modifica del lotto proposto in fase di assegnazione lotto all'ordine","SI_NO",false,true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void down() throws Exception {
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
package it.integry.ems.migration.model;
|
||||||
|
|
||||||
|
import it.integry.ems.migration._base.BaseMigration;
|
||||||
|
import it.integry.ems.migration._base.IntegryCustomer;
|
||||||
|
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||||
|
|
||||||
|
public class Migration_20250228114017 extends BaseMigration implements MigrationModelInterface {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void up() throws Exception {
|
||||||
|
if (isHistoryDB())
|
||||||
|
return;
|
||||||
|
|
||||||
|
String value = null;
|
||||||
|
if (isCustomer(IntegryCustomer.RossoGargano))
|
||||||
|
value = "StampaColloAccettazione";
|
||||||
|
|
||||||
|
createSetup("PVM","GESTIONE_RICAMBISTICA","REPORT_NAME_ETICHETTA_UDC",value,"nome report etichetta udc","REPORT_NAME");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void down() throws Exception {
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,55 @@
|
|||||||
|
package it.integry.ems.migration.model;
|
||||||
|
|
||||||
|
import it.integry.ems.migration._base.BaseMigration;
|
||||||
|
import it.integry.ems.migration._base.IntegryCustomerDB;
|
||||||
|
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||||
|
import it.integry.ems_model.utility.UtilityDB;
|
||||||
|
|
||||||
|
public class Migration_20250303123610 extends BaseMigration implements MigrationModelInterface {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void up() throws Exception {
|
||||||
|
if (isHistoryDB())
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (isCustomerDb(IntegryCustomerDB.Siciliani_DMS))
|
||||||
|
return;
|
||||||
|
|
||||||
|
Boolean exist = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(advancedDataSource.getConnection(),
|
||||||
|
"SELECT Cast( COUNT(*) as bit)\n" +
|
||||||
|
"FROM \n" +
|
||||||
|
" INFORMATION_SCHEMA.KEY_COLUMN_USAGE c\n" +
|
||||||
|
"JOIN \n" +
|
||||||
|
" INFORMATION_SCHEMA.TABLE_CONSTRAINTS t \n" +
|
||||||
|
" ON c.CONSTRAINT_NAME = t.CONSTRAINT_NAME\n" +
|
||||||
|
"WHERE \n" +
|
||||||
|
" t.TABLE_NAME = 'mtb_movi'\n" +
|
||||||
|
" AND t.CONSTRAINT_TYPE = 'PRIMARY KEY'\n" +
|
||||||
|
"\tand c.COLUMN_NAME = 'cod_anag'");
|
||||||
|
|
||||||
|
if ( exist ){
|
||||||
|
Boolean newSp = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(advancedDataSource.getConnection(),
|
||||||
|
"SELECT cast(IIF(value='S',1,0) as bit) FROM stb_gest_setup where gest_name = 'DATI_AZIENDA' AND section = 'PROGRESSIVI_MAG' and key_section = 'NUOVA_PROCEDURA'"
|
||||||
|
);
|
||||||
|
Boolean existMov = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(advancedDataSource.getConnection(),
|
||||||
|
"SELECT cast(count(*) as bit) from mtb_movi"
|
||||||
|
);
|
||||||
|
|
||||||
|
if ( newSp || !existMov ) {
|
||||||
|
executeStatement(
|
||||||
|
"EXEC DropPrimaryKey 'mtb_movi'" +
|
||||||
|
"ALTER TABLE mtb_movi ADD PRIMARY KEY (num_mov, cod_mdep, id_riga);\n"
|
||||||
|
);
|
||||||
|
if ( !existMov )
|
||||||
|
updateSetupValue("DATI_AZIENDA", "PROGRESSIVI_MAG", "NUOVA_PROCEDURA", "S");
|
||||||
|
} else {
|
||||||
|
|
||||||
|
// throw new Exception(String.format("Sull'azienda %s è ancora attiva la vecchia stored procedure di aggioramento progressivi di magazzino", advancedDataSource.getDataSource().getDbName()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void down() throws Exception {
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
package it.integry.ems.migration.model;
|
||||||
|
|
||||||
|
import it.integry.ems.migration._base.BaseMigration;
|
||||||
|
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||||
|
|
||||||
|
public class Migration_20250304101253 extends BaseMigration implements MigrationModelInterface {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void up() throws Exception {
|
||||||
|
if (isHistoryDB())
|
||||||
|
return;
|
||||||
|
|
||||||
|
executeStatement( "alter table ctb_beni add residuo_alien numeric(20,5) null");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void down() throws Exception {
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
package it.integry.ems.migration.model;
|
||||||
|
|
||||||
|
import it.integry.ems.migration._base.BaseMigration;
|
||||||
|
import it.integry.ems.migration._base.IntegryCustomer;
|
||||||
|
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||||
|
|
||||||
|
public class Migration_20250304104653 extends BaseMigration implements MigrationModelInterface {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void up() throws Exception {
|
||||||
|
if (isHistoryDB())
|
||||||
|
return;
|
||||||
|
|
||||||
|
createSetup("W_VARTVENDTOT_DISP", "DATAWINDOW", "D_VARTVENDTOT_REP", null,
|
||||||
|
null, false, null, false, false,
|
||||||
|
false, false, false, null, false, null);
|
||||||
|
createSetup("W_VARTVENDTOT_DISP", "DATAWINDOW", "D_VARTVENDTOT_GRP_REP", null,
|
||||||
|
null, false, null, false, false,
|
||||||
|
false, false, false, null, false, null);
|
||||||
|
|
||||||
|
if(isCustomer(IntegryCustomer.Maggio)) {
|
||||||
|
updateSetupValue("W_VARTVENDTOT_DISP", "DATAWINDOW", "D_VARTVENDTOT_REP", "D_VARTVENDTOT_MAGGIO_REP");
|
||||||
|
updateSetupValue("W_VARTVENDTOT_DISP", "DATAWINDOW", "D_VARTVENDTOT_GRP_REP", "D_VARTVENDTOT_GRP_MAGGIO_REP");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void down() throws Exception {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
package it.integry.ems.migration.model;
|
||||||
|
|
||||||
|
import it.integry.ems.migration._base.BaseMigration;
|
||||||
|
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||||
|
|
||||||
|
public class Migration_20250304115259 extends BaseMigration implements MigrationModelInterface {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void up() throws Exception {
|
||||||
|
if (isHistoryDB())
|
||||||
|
return;
|
||||||
|
|
||||||
|
executeStatement("alter table ctb_varbeni add valore_vend_var numeric (20,5) null",
|
||||||
|
"alter table ctb_varbeni add residuo_vend_var numeric (20,5) null");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void down() throws Exception {
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -132,7 +132,7 @@ public class Azienda extends EntityBase {
|
|||||||
@SqlField(value = "last_upg_sp", maxLength = 40)
|
@SqlField(value = "last_upg_sp", maxLength = 40)
|
||||||
private String lastUpgSp;
|
private String lastUpgSp;
|
||||||
|
|
||||||
@SqlField(value = "last_upg_db_menu", maxLength = 10)
|
@SqlField(value = "last_upg_db_menu", maxLength = 16)
|
||||||
private String lastUpgDbMenu;
|
private String lastUpgDbMenu;
|
||||||
|
|
||||||
@SqlField(value = "sito_web", maxLength = 255)
|
@SqlField(value = "sito_web", maxLength = 255)
|
||||||
|
|||||||
@@ -0,0 +1,52 @@
|
|||||||
|
package it.integry.ems_model.entity;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonTypeName;
|
||||||
|
import it.integry.ems_model.annotation.PK;
|
||||||
|
import it.integry.ems_model.annotation.SqlField;
|
||||||
|
import it.integry.ems_model.annotation.Table;
|
||||||
|
import it.integry.ems_model.base.EntityBase;
|
||||||
|
import org.apache.logging.log4j.LogManager;
|
||||||
|
import org.apache.logging.log4j.Logger;
|
||||||
|
import org.kie.api.definition.type.PropertyReactive;
|
||||||
|
|
||||||
|
@PropertyReactive
|
||||||
|
@Table(CrlAmacManutenzioniFiles.ENTITY)
|
||||||
|
@JsonTypeName(CrlAmacManutenzioniFiles.ENTITY)
|
||||||
|
public class CrlAmacManutenzioniFiles extends EntityBase {
|
||||||
|
|
||||||
|
public CrlAmacManutenzioniFiles() {
|
||||||
|
super(logger);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
private final static Logger logger = LogManager.getLogger();
|
||||||
|
|
||||||
|
public static final String ENTITY = "crl_amac_manutenzioni_files";
|
||||||
|
|
||||||
|
@PK
|
||||||
|
@SqlField(value = "id_manutenzione", nullable = false)
|
||||||
|
private Integer idManutenzione;
|
||||||
|
|
||||||
|
@PK
|
||||||
|
@SqlField(value = "id_attach", maxLength = 40, nullable = false)
|
||||||
|
private String idAttach;
|
||||||
|
|
||||||
|
public Integer getIdManutenzione() {
|
||||||
|
return idManutenzione;
|
||||||
|
}
|
||||||
|
|
||||||
|
public CrlAmacManutenzioniFiles setIdManutenzione(Integer idManutenzione) {
|
||||||
|
this.idManutenzione = idManutenzione;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getIdAttach() {
|
||||||
|
return idAttach;
|
||||||
|
}
|
||||||
|
|
||||||
|
public CrlAmacManutenzioniFiles setIdAttach(String idAttach) {
|
||||||
|
this.idAttach = idAttach;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -56,6 +56,7 @@ public class CtbAmacHistory extends EntityBase {
|
|||||||
@SqlField(value = "value", maxLength = 8000, nullable = false)
|
@SqlField(value = "value", maxLength = 8000, nullable = false)
|
||||||
private String value;
|
private String value;
|
||||||
|
|
||||||
|
@ImportFromParent
|
||||||
@SqlField(value = "id_attach", maxLength = 40)
|
@SqlField(value = "id_attach", maxLength = 40)
|
||||||
private String idAttach;
|
private String idAttach;
|
||||||
|
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ public class CtbAmacManutenzioni extends EntityBase {
|
|||||||
private Date dataFine;
|
private Date dataFine;
|
||||||
|
|
||||||
@SqlField(value = "stato", nullable = false)
|
@SqlField(value = "stato", nullable = false)
|
||||||
private int stato;
|
private MaintenanceStatus stato;
|
||||||
|
|
||||||
@SqlField(value = "esito", maxLength = 8000)
|
@SqlField(value = "esito", maxLength = 8000)
|
||||||
private String esito;
|
private String esito;
|
||||||
@@ -58,6 +58,12 @@ public class CtbAmacManutenzioni extends EntityBase {
|
|||||||
@SqlField(value = "ore_lavoro")
|
@SqlField(value = "ore_lavoro")
|
||||||
private Float oreLavoro;
|
private Float oreLavoro;
|
||||||
|
|
||||||
|
@SqlField(value = "esito_positivo")
|
||||||
|
private Boolean esitoPositivo = true;
|
||||||
|
|
||||||
|
@SqlField(value = "manutenzione_ordinaria")
|
||||||
|
private Boolean manutenzioneOrdinaria = true;
|
||||||
|
|
||||||
public CtbAmacManutenzioni() {
|
public CtbAmacManutenzioni() {
|
||||||
super(logger);
|
super(logger);
|
||||||
}
|
}
|
||||||
@@ -125,11 +131,11 @@ public class CtbAmacManutenzioni extends EntityBase {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getStato() {
|
public MaintenanceStatus getStato() {
|
||||||
return stato;
|
return stato;
|
||||||
}
|
}
|
||||||
|
|
||||||
public CtbAmacManutenzioni setStato(int stato) {
|
public CtbAmacManutenzioni setStato(MaintenanceStatus stato) {
|
||||||
this.stato = stato;
|
this.stato = stato;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
@@ -174,18 +180,36 @@ public class CtbAmacManutenzioni extends EntityBase {
|
|||||||
protected void deleteChilds() throws Exception {
|
protected void deleteChilds() throws Exception {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Boolean getEsitoPositivo() {
|
||||||
|
return esitoPositivo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public CtbAmacManutenzioni setEsitoPositivo(Boolean esitoPositivo) {
|
||||||
|
this.esitoPositivo = esitoPositivo;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Boolean getManutenzioneOrdinaria() {
|
||||||
|
return manutenzioneOrdinaria;
|
||||||
|
}
|
||||||
|
|
||||||
|
public CtbAmacManutenzioni setManutenzioneOrdinaria(Boolean manutenzioneOrdinaria) {
|
||||||
|
this.manutenzioneOrdinaria = manutenzioneOrdinaria;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
public enum MaintenanceStatus implements IBaseEnum<MaintenanceStatus> {
|
public enum MaintenanceStatus implements IBaseEnum<MaintenanceStatus> {
|
||||||
|
|
||||||
PROGRAMMATA((short) 0), AVVIATA((short) 1), TERMINATA((short) 2), ANNULLATA((short) 3);
|
PROGRAMMATA(0), AVVIATA(1), TERMINATA(2), ANNULLATA(3);
|
||||||
|
|
||||||
private final short value;
|
private final int value;
|
||||||
|
|
||||||
MaintenanceStatus(short value) {
|
MaintenanceStatus(int value) {
|
||||||
this.value = value;
|
this.value = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static MaintenanceStatus from(Object value) {
|
public static MaintenanceStatus from(Object value) {
|
||||||
short castValue = (short) value;
|
int castValue = (int) value;
|
||||||
for (MaintenanceStatus b : MaintenanceStatus.values()) {
|
for (MaintenanceStatus b : MaintenanceStatus.values()) {
|
||||||
if (b.value == castValue)
|
if (b.value == castValue)
|
||||||
return b;
|
return b;
|
||||||
|
|||||||
@@ -111,6 +111,9 @@ public class StbFilesAttached extends EntityBase {
|
|||||||
@EntityChild
|
@EntityChild
|
||||||
private SrlUserAttached srlUserAttached;
|
private SrlUserAttached srlUserAttached;
|
||||||
|
|
||||||
|
@EntityChild
|
||||||
|
private CrlAmacManutenzioniFiles crlAmacManutenzioniFiles;
|
||||||
|
|
||||||
public StbFilesAttached() {
|
public StbFilesAttached() {
|
||||||
super(logger);
|
super(logger);
|
||||||
}
|
}
|
||||||
@@ -358,6 +361,15 @@ public class StbFilesAttached extends EntityBase {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public CrlAmacManutenzioniFiles getCrlAmacManutenzioniFiles() {
|
||||||
|
return crlAmacManutenzioniFiles;
|
||||||
|
}
|
||||||
|
|
||||||
|
public StbFilesAttached setCrlAmacManutenzioniFiles(CrlAmacManutenzioniFiles crlAmacManutenzioniFiles) {
|
||||||
|
this.crlAmacManutenzioniFiles = crlAmacManutenzioniFiles;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
public String getRefUuid() {
|
public String getRefUuid() {
|
||||||
return refUuid;
|
return refUuid;
|
||||||
}
|
}
|
||||||
@@ -385,6 +397,8 @@ public class StbFilesAttached extends EntityBase {
|
|||||||
grlAnagNoteFiles.deleteAllEntities(connection, this);
|
grlAnagNoteFiles.deleteAllEntities(connection, this);
|
||||||
CtbAmacHistory ctbAmacHistory = new CtbAmacHistory();
|
CtbAmacHistory ctbAmacHistory = new CtbAmacHistory();
|
||||||
ctbAmacHistory.deleteAllEntities(connection, this);
|
ctbAmacHistory.deleteAllEntities(connection, this);
|
||||||
|
CrlAmacManutenzioniFiles crlAmacManutenzioniFiles1 = new CrlAmacManutenzioniFiles();
|
||||||
|
crlAmacManutenzioniFiles1.deleteAllEntities(connection, this);
|
||||||
WtbNotificationImage wtbNotificationImage = new WtbNotificationImage();
|
WtbNotificationImage wtbNotificationImage = new WtbNotificationImage();
|
||||||
String whereCond = "attach_id = " + UtilityDB.valueToString(idAttach);
|
String whereCond = "attach_id = " + UtilityDB.valueToString(idAttach);
|
||||||
wtbNotificationImage.deleteAllEntities(connection, whereCond);
|
wtbNotificationImage.deleteAllEntities(connection, whereCond);
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -5,9 +5,11 @@ import it.integry.ems.order.dto.OrderKeyDTO;
|
|||||||
import it.integry.ems.production.machine.dto.MachineOrderEventDTO;
|
import it.integry.ems.production.machine.dto.MachineOrderEventDTO;
|
||||||
import it.integry.ems.production.machine.service.MachineProductionService;
|
import it.integry.ems.production.machine.service.MachineProductionService;
|
||||||
import it.integry.ems.response.ServiceRestResponse;
|
import it.integry.ems.response.ServiceRestResponse;
|
||||||
|
import it.integry.ems_model.entity.CtbAmacManutenzioni;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.context.annotation.Scope;
|
import org.springframework.context.annotation.Scope;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
package it.integry.ems.retail.wms.vendita.service;
|
package it.integry.ems.retail.wms.vendita.service;
|
||||||
|
|
||||||
import com.annimon.stream.Stream;
|
|
||||||
import it.integry.ems.javabeans.RequestDataDTO;
|
import it.integry.ems.javabeans.RequestDataDTO;
|
||||||
import it.integry.ems.logistic.dto.sm2.FiltroDistribuzioneColloDTO;
|
import it.integry.ems.logistic.dto.sm2.FiltroDistribuzioneColloDTO;
|
||||||
import it.integry.ems.product.importaz.service.ProductServices;
|
import it.integry.ems.product.importaz.service.ProductServices;
|
||||||
@@ -26,7 +25,10 @@ import it.integry.ems_model.entity.MtbColt;
|
|||||||
import it.integry.ems_model.entity._enum.GestioneEnum;
|
import it.integry.ems_model.entity._enum.GestioneEnum;
|
||||||
import it.integry.ems_model.service.SetupGest;
|
import it.integry.ems_model.service.SetupGest;
|
||||||
import it.integry.ems_model.types.OperationType;
|
import it.integry.ems_model.types.OperationType;
|
||||||
import it.integry.ems_model.utility.*;
|
import it.integry.ems_model.utility.MtbColtUtils;
|
||||||
|
import it.integry.ems_model.utility.UtilityBigDecimal;
|
||||||
|
import it.integry.ems_model.utility.UtilityLocalDate;
|
||||||
|
import it.integry.ems_model.utility.UtilityString;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.context.annotation.Scope;
|
import org.springframework.context.annotation.Scope;
|
||||||
import org.springframework.security.core.userdetails.UsernameNotFoundException;
|
import org.springframework.security.core.userdetails.UsernameNotFoundException;
|
||||||
@@ -205,20 +207,19 @@ public class WMSSpedizioneService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void generaDoc(List<MtbColt> distributedUDS) throws Exception {
|
private void generaDoc(List<MtbColt> distributedUDS) throws Exception {
|
||||||
List<DocFromPickingDTO.DatiCollo> colli = Stream.of(distributedUDS)
|
List<DocFromPickingDTO.DatiCollo> colli = distributedUDS.stream()
|
||||||
.map(c -> {
|
.map(c -> new DocFromPickingDTO.DatiCollo()
|
||||||
DocFromPickingDTO.DatiCollo dati =
|
.setGestione(c.getGestione())
|
||||||
new DocFromPickingDTO.DatiCollo();
|
|
||||||
dati.setGestione(c.getGestione())
|
|
||||||
.setDataCollo(c.getDataCollo())
|
.setDataCollo(c.getDataCollo())
|
||||||
.setSerCollo(c.getSerCollo())
|
.setSerCollo(c.getSerCollo())
|
||||||
.setNumCollo(c.getNumCollo());
|
.setNumCollo(c.getNumCollo()))
|
||||||
return dati;
|
.collect(Collectors.toList());
|
||||||
}).toList();
|
|
||||||
DocFromPickingDTO docFromPickingDTO = new DocFromPickingDTO();
|
DocFromPickingDTO docFromPickingDTO = new DocFromPickingDTO();
|
||||||
docFromPickingDTO
|
docFromPickingDTO
|
||||||
.setDataDoc(new Date())
|
.setDataDoc(new Date())
|
||||||
.setColli(colli);
|
.setColli(colli);
|
||||||
|
|
||||||
List<EntityBase> entityRet = pvmServiceSave.saveDocFromPicking(docFromPickingDTO);
|
List<EntityBase> entityRet = pvmServiceSave.saveDocFromPicking(docFromPickingDTO);
|
||||||
UtilityEntity.throwEntitiesException(entityRet);
|
UtilityEntity.throwEntitiesException(entityRet);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user