Merge branch 'feature/RefactoringGestioneColli' into feature/GestioneMissioniMag
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:
@@ -0,0 +1,44 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.IntegryCustomerDB;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
public class Migration_20251001151805 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
List<HashMap<String,Object>> constraints = executeQuery("SELECT dc.name AS ConstraintName,\n" +
|
||||
" OBJECT_NAME(dc.parent_object_id) AS TableName,\n" +
|
||||
" c.name AS ColumnName\n" +
|
||||
"FROM sys.default_constraints dc\n" +
|
||||
"INNER JOIN sys.columns c ON dc.parent_object_id = c.object_id AND dc.parent_column_id = c.column_id\n" +
|
||||
"WHERE OBJECT_NAME(dc.parent_object_id) = 'wtb_depo'\n" +
|
||||
"AND c.name = 'default_depo';\n");
|
||||
if (constraints != null && !constraints.isEmpty()) {
|
||||
String constraint = constraints.get(0).get("ConstraintName").toString();
|
||||
executeStatement("alter table dbo.wtb_depo drop constraint " + constraint);
|
||||
}
|
||||
|
||||
executeStatement("drop index ux_wtb_depo_depo_default_utente on dbo.wtb_depo",
|
||||
"alter table dbo.wtb_depo ALTER column default_depo BIT NOT NULL",
|
||||
"alter table dbo.wtb_depo ADD constraint DF_wtb_depo_default DEFAULT 0 FOR default_depo",
|
||||
"create unique index ux_wtb_depo_depo_default_utente\n" +
|
||||
" on dbo.wtb_depo (user_name)\n" +
|
||||
" where default_depo = 1");
|
||||
|
||||
if (isCustomerDb(IntegryCustomerDB.Biolevante_Biolevante)){
|
||||
executeStatement("update wtb_depo set default_depo = 1 where cod_mdep = '01'");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.IntegryCustomer;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
import it.integry.ems_model.entity.JtbFasi;
|
||||
|
||||
public class Migration_20251002111947 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
createSetup("MES", "SETUP", "VINCOLA_DATA_PROD_AL_LOTTO", "N", "Se true, sulle linee su cui è impostata la data produzione della partita verrà calcolata in base alla partita stessa (es. dal giorno giuliano selezionato)", false, "SI_NO", false, false, false, false, false, JtbFasi.ENTITY, false, null);
|
||||
|
||||
if (isCustomer(IntegryCustomer.RossoGargano)){
|
||||
executeStatement("INSERT INTO stb_gest_setup_det (gest_name, section, key_section, tipo_setup, val_col_rif, value)\n" +
|
||||
"SELECT N'MES',\n" +
|
||||
" N'SETUP',\n" +
|
||||
" N'VINCOLA_DATA_PROD_AL_LOTTO',\n" +
|
||||
" N'" + JtbFasi.ENTITY + "',\n" +
|
||||
" cod_jfas,\n" +
|
||||
" 'S'\n" +
|
||||
"FROM jtb_fasi\n" +
|
||||
"WHERE cod_jfas IN ('E5')\n");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
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_20251002112352 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
|
||||
createOrUpdateFunction("f_suggestDataProdPartitaMag","CREATE FUNCTION [dbo].[f_suggestDataProdPartitaMag](@codMart VARCHAR(15),@partitaMag VARCHAR(20), @codJfas varchar(5))\n" +
|
||||
" RETURNS DATE\n" +
|
||||
"AS\n" +
|
||||
"BEGIN\n" +
|
||||
"\n" +
|
||||
"RETURN NULL\n" +
|
||||
"END\n"
|
||||
);
|
||||
|
||||
if (isCustomer(IntegryCustomer.RossoGargano)){
|
||||
createOrUpdateFunction("f_suggestDataProdPartitaMag","CREATE FUNCTION [dbo].[f_suggestDataProdPartitaMag](@codMart VARCHAR(15), @partitaMag VARCHAR(20), @codJfas varchar(5))\n" +
|
||||
" RETURNS DATE\n" +
|
||||
" AS\n" +
|
||||
" BEGIN\n" +
|
||||
"\n" +
|
||||
" DECLARE @idProduttore VARCHAR(10), @idProduttorePartita varchar(10);\n" +
|
||||
" DECLARE @idLottoLav VARCHAR(5);\n" +
|
||||
" DECLARE @codMdep VARCHAR(5);\n" +
|
||||
" DECLARE @annoLottoLav smallint;\n" +
|
||||
" DECLARE @ggGiuliano smallint;\n" +
|
||||
" DECLARE @dataProd date;\n" +
|
||||
"\n" +
|
||||
"\n" +
|
||||
" SELECT @codMdep = cod_mdep_lav from jtb_fasi where cod_jfas = @codJfas;\n" +
|
||||
"\n" +
|
||||
" SELECT @idProduttore = ISNULL(stb_gest_setup_depo.value, stb_gest_setup.value)\n" +
|
||||
" FROM stb_gest_setup\n" +
|
||||
" LEFT OUTER JOIN stb_gest_setup_depo ON stb_gest_setup.gest_name = stb_gest_setup_depo.gest_name AND\n" +
|
||||
" stb_gest_setup.section = stb_gest_setup_depo.section AND\n" +
|
||||
" stb_gest_setup.key_section = stb_gest_setup_depo.key_section\n" +
|
||||
" AND stb_gest_setup_depo.cod_mdep = @codMdep\n" +
|
||||
" WHERE stb_gest_setup.gest_name = 'DATI_AZIENDA'\n" +
|
||||
" AND stb_gest_setup.section = 'SETUP'\n" +
|
||||
" AND stb_gest_setup.key_section = 'COD_PRODUTTORE';\n" +
|
||||
"\n" +
|
||||
"\n" +
|
||||
" SELECT @idProduttorePartita = SUBSTRING(@partitaMag, 1, LEN(@idProduttore));\n" +
|
||||
"\n" +
|
||||
" if not @idProduttorePartita = @idProduttore\n" +
|
||||
" return null;\n" +
|
||||
"\n" +
|
||||
" select @partitaMag = REPLACE(@partitaMag, @idProduttore, '');\n" +
|
||||
"\n" +
|
||||
"\n" +
|
||||
" SELECT @idLottoLav = SUBSTRING(@partitaMag, 1, 1);\n" +
|
||||
" SELECT @annoLottoLav = anno from gtb_anni_divi where id_lotto_lav = @idLottoLav;\n" +
|
||||
"\n" +
|
||||
" if @annoLottoLav is null\n" +
|
||||
" return null;\n" +
|
||||
"\n" +
|
||||
" SELECT @ggGiuliano = SUBSTRING(@partitaMag, 2, 3);\n" +
|
||||
"\n" +
|
||||
"\n" +
|
||||
"\n" +
|
||||
" SELECT @dataProd = DATEADD(DAY, @ggGiuliano - 1, DATEFROMPARTS(@annoLottoLav, 1, 1));\n" +
|
||||
" return @dataProd\n" +
|
||||
"\n" +
|
||||
" END\n");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
}
|
||||
}
|
||||
@@ -1213,10 +1213,11 @@ public class MesProductionServiceV2 {
|
||||
|
||||
createUdcRequest.setCodJcom(ordineLav.getCodJcom())
|
||||
.setCodMart(ordineLav.getCodProd())
|
||||
.setPartitaMag(ordineLav.getPartitaMag())
|
||||
.setPartitaMag(UtilityString.isNull(dto.getPartitaMag(), ordineLav.getPartitaMag()))
|
||||
.setNumEtich(dto.getNumEtich())
|
||||
.setQta(dto.getQtaCollo())
|
||||
.setRigaOrd(UtilityInteger.isNull(dto.getRigaOrd(), 0))
|
||||
.setCodJcom(ordineLav.getCodJcom())
|
||||
.setAnnotazioni(dto.getNote());
|
||||
|
||||
|
||||
|
||||
@@ -489,8 +489,6 @@ public class ProductionService {
|
||||
HashMap<String, Object> group = new HashMap<>();
|
||||
|
||||
group.put("gestione", UtilityHashMap.<String>getValueIfExists(x, "gestione"));
|
||||
group.put("data_ord", UtilityHashMap.<Date>getValueIfExists(x, "data_ord"));
|
||||
group.put("num_ord", UtilityHashMap.<Integer>getValueIfExists(x, "num_ord"));
|
||||
group.put("cod_prod", UtilityHashMap.<String>getValueIfExists(x, "cod_prod"));
|
||||
group.put("partita_mag_prod", UtilityHashMap.<String>getValueIfExists(x, "partita_mag_prod"));
|
||||
group.put("cod_jfas", UtilityHashMap.<String>getValueIfExists(x, "cod_jfas"));
|
||||
@@ -1708,6 +1706,7 @@ public class ProductionService {
|
||||
return stbGestSetupDetOptional.orElse(null);
|
||||
}
|
||||
|
||||
|
||||
public List<EntityBase> insertPartitaMag(InsertPartitaMagRequestDTO dto, boolean saveEntity) throws Exception {
|
||||
String codMart = dto.getCodMart();
|
||||
String partitaMag = dto.getPartitaMag();
|
||||
@@ -1716,6 +1715,10 @@ public class ProductionService {
|
||||
|
||||
StbGestSetupDet configControlloScadenzaMultipla = this.getConfigControlloScadenzaMultipla(dto.getCodJfas());
|
||||
|
||||
boolean matchLottoSlToOrdine = setupGest.getSetupDetBoolean("MES", "SETUP", "VINCOLA_LOTTO_ORDINE_A_SL", dto.getCodJfas());
|
||||
boolean matchDataProdToLotto = setupGest.getSetupDetBoolean("MES", "SETUP", "VINCOLA_DATA_PROD_AL_LOTTO", dto.getCodJfas());
|
||||
|
||||
|
||||
if (configControlloScadenzaMultipla != null && configControlloScadenzaMultipla.getValue().equalsIgnoreCase("S")) {
|
||||
// Controllo se esiste partita con stesso lotto e scadenza
|
||||
// sql = Query.format(
|
||||
@@ -1760,6 +1763,15 @@ public class ProductionService {
|
||||
// }
|
||||
}
|
||||
|
||||
if (dto.getDataProd() == null && !matchLottoSlToOrdine && matchDataProdToLotto){
|
||||
String sql = Query.format("select dbo.f_suggestDataProdPartitaMag({},{},{}) ",dto.getCodMart(),dto.getPartitaMag(),dto.getCodJfas());
|
||||
|
||||
LocalDate dataProd = UtilityLocalDate.localDateFromDate(UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(multiDBTransactionManager.getPrimaryConnection(), sql));
|
||||
if (dataProd != null) {
|
||||
dto.setDataProd(dataProd);
|
||||
}
|
||||
}
|
||||
|
||||
MtbPartitaMag mtbPartitaMag = new MtbPartitaMag()
|
||||
.setPartitaMag(partitaMag)
|
||||
.setPartitaMagProd(partitaMagProd)
|
||||
|
||||
@@ -239,14 +239,16 @@ public class PvmAccettazioneService {
|
||||
|
||||
List<DtbOrdt> ordini = UtilityDB.executeSimpleQueryDTO(multiDBTransactionManager.getPrimaryConnection(), sql, DtbOrdt.class);
|
||||
|
||||
ordini.stream().forEach(x -> {
|
||||
x.setFlagEvasoForzato("S")
|
||||
.setModificatoDa("EVASIONE DA ACCETTAZIONE");
|
||||
x.setOperation(OperationType.UPDATE);
|
||||
}
|
||||
);
|
||||
if (ordini != null ) {
|
||||
ordini.stream().forEach(x -> {
|
||||
x.setFlagEvasoForzato("S")
|
||||
.setModificatoDa("EVASIONE DA ACCETTAZIONE");
|
||||
x.setOperation(OperationType.UPDATE);
|
||||
}
|
||||
);
|
||||
|
||||
entityList.addAll(ordini);
|
||||
entityList.addAll(ordini);
|
||||
}
|
||||
}
|
||||
|
||||
entityList = entityProcessor.processEntityList(entityList, true);
|
||||
|
||||
@@ -1385,6 +1385,7 @@ public class WMSGenericService {
|
||||
.setDataColloRif(mtbColtOrphan.getDataCollo())
|
||||
.setGestioneRif(mtbColtOrphan.getGestione())
|
||||
.setNumColloRif(mtbColtOrphan.getNumCollo())
|
||||
.setUtente(requestDataDTO.getUsername())
|
||||
.setCausale(MtbColr.Causale.RETTIFICA)
|
||||
.setPesoNettoKg(null)
|
||||
.setPesoLordoKg(null)
|
||||
@@ -1464,10 +1465,10 @@ public class WMSGenericService {
|
||||
}
|
||||
} else {
|
||||
MtbColt mtbColt = new MtbColt()
|
||||
.setNumCollo(sourceMtbColr.getNumCollo())
|
||||
.setDataCollo(sourceMtbColr.getDataCollo())
|
||||
.setSerCollo(sourceMtbColr.getSerCollo())
|
||||
.setGestione(sourceMtbColr.getGestione())
|
||||
.setNumCollo(anagUl.getNumCollo())
|
||||
.setDataCollo(anagUl.getDataCollo())
|
||||
.setSerCollo(anagUl.getSerCollo())
|
||||
.setGestione(anagUl.getGestione())
|
||||
.setMtbColr(new ArrayList<>());
|
||||
mtbColt.setOperation(OperationType.NO_OP);
|
||||
|
||||
@@ -1495,6 +1496,11 @@ public class WMSGenericService {
|
||||
.setPosizioneOut(null)
|
||||
.setOperation(OperationType.INSERT);
|
||||
|
||||
if (anagUl.getGestione().equalsIgnoreCase("L") && anagUl.getSegno() > 0 && anagUl.getOrdine() != null){
|
||||
mtbColrToSave.setDataOrd(anagUl.getDataOrd())
|
||||
.setNumOrd(anagUl.getNumOrd());
|
||||
}
|
||||
|
||||
mtbColt.getMtbColr().add(mtbColrToSave);
|
||||
|
||||
entityProcessor.processEntity(mtbColt, true, multiDBTransactionManager);
|
||||
|
||||
Reference in New Issue
Block a user