Merge remote-tracking branch 'origin/develop' into develop
This commit is contained in:
@@ -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_20240618123104 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
if( isTextiles())
|
||||
executeStatement("alter table ttb_style add flag_min_ord_linea_col bit default 1 not null;");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20240618155823 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
createOrUpdateView("mvw_articoli_esclusi_wms", "CREATE VIEW dbo.mvw_articoli_esclusi_wms AS\n" +
|
||||
"SELECT DISTINCT mrl_depo_art_esclusi_wms.cod_mdep,\n" +
|
||||
" ma.cod_mart,\n" +
|
||||
" ma.cod_mgrp,\n" +
|
||||
" ma.cod_msgr,\n" +
|
||||
" ma.cod_msfa,\n" +
|
||||
" ma.cod_mtip,\n" +
|
||||
" ma.cod_mstp\n" +
|
||||
"FROM mrl_depo_art_esclusi_wms\n" +
|
||||
" INNER JOIN mtb_aart ma\n" +
|
||||
" ON (ISNULL(mrl_depo_art_esclusi_wms.cod_mgrp, ma.cod_mgrp) = ma.cod_mgrp AND\n" +
|
||||
" ISNULL(mrl_depo_art_esclusi_wms.cod_msgr, ma.cod_msgr) = ma.cod_msgr AND\n" +
|
||||
" ISNULL(ISNULL(mrl_depo_art_esclusi_wms.cod_msfa, ma.cod_msfa), '') = ISNULL(ma.cod_msfa, '') AND\n" +
|
||||
" ISNULL(ISNULL(mrl_depo_art_esclusi_wms.cod_mtip, ma.cod_mtip), '') = ISNULL(ma.cod_mtip, '') AND\n" +
|
||||
" ISNULL(ISNULL(mrl_depo_art_esclusi_wms.cod_mstp, ma.cod_mstp), '') = ISNULL(ma.cod_mstp, '') AND\n" +
|
||||
" ISNULL(mrl_depo_art_esclusi_wms.cod_mart, ma.cod_mart) = ma.cod_mart)");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -110,7 +110,7 @@ public class SalesRules extends QueryRules {
|
||||
if (vtbListData.getCheckDataFine() != null && vtbListData.getCheckDataFine()) {
|
||||
Date dataFineOld = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(
|
||||
conn,
|
||||
Query.format("SELECT data_fine FROM vtb_list_data WHERE cod_vlis = %s AND versione = %S", vtbListData.getCodVlis(),vtbListData.getVersione()));
|
||||
Query.format("SELECT data_fine FROM vtb_list_data WHERE cod_vlis = %s AND versione = %S", vtbListData.getCodVlis(), vtbListData.getVersione()));
|
||||
|
||||
if (dataFineOld != null && vtbListData.getDataFine().after(dataFineOld))
|
||||
throw new Exception("Impossibile posticipare la data fine di una promozione.");
|
||||
@@ -1162,11 +1162,9 @@ public class SalesRules extends QueryRules {
|
||||
String sql = Query.format(
|
||||
"SELECT id_viaggio, posizione\n" +
|
||||
"FROM vtb_viaggi\n" +
|
||||
"WHERE id_viaggio != %s\n" +
|
||||
" AND posizione != 0\n" +
|
||||
"WHERE posizione != 0\n" +
|
||||
" AND CAST(data_ora_iniz_trasp AS DATE) = %s\n" +
|
||||
"ORDER BY posizione",
|
||||
vtbViaggi.getIdViaggio(),
|
||||
vtbViaggi.getDataOraInizTrasp()
|
||||
);
|
||||
|
||||
@@ -1176,7 +1174,8 @@ public class SalesRules extends QueryRules {
|
||||
return;
|
||||
}
|
||||
|
||||
int indexOfLastPosizione = viaggiGiorno.indexOf(viaggiGiorno.stream().filter(viaggio -> viaggio.getPosizione() == vtbViaggi.getPosizione()).findFirst().orElse(null));
|
||||
int indexOfLastPosizione = viaggiGiorno.indexOf(viaggiGiorno.stream()
|
||||
.filter(viaggio -> !viaggio.getIdViaggio().equalsIgnoreCase(vtbViaggi.getIdViaggio()) && viaggio.getPosizione() == vtbViaggi.getPosizione()).findFirst().orElse(null));
|
||||
|
||||
if (indexOfLastPosizione != -1) {
|
||||
viaggiGiorno.add(indexOfLastPosizione, vtbViaggi);
|
||||
@@ -1195,7 +1194,7 @@ public class SalesRules extends QueryRules {
|
||||
viaggio.setOperation(OperationType.UPDATE);
|
||||
});
|
||||
|
||||
viaggiGiorno.remove(vtbViaggi);
|
||||
viaggiGiorno = viaggiGiorno.stream().filter(viaggio -> !viaggio.getIdViaggio().equalsIgnoreCase(vtbViaggi.getIdViaggio())).collect(Collectors.toList());
|
||||
|
||||
vtbViaggi.setVtbViaggiList(viaggiGiorno);
|
||||
}
|
||||
|
||||
@@ -115,6 +115,8 @@ public class TtbStyle extends EntityBase {
|
||||
private String temaEstero;
|
||||
@SqlField(value = "path_file_img")
|
||||
private String pathFileImg;
|
||||
@SqlField(value = "flag_min_ord_linea_col")
|
||||
private Boolean flagMinOrdLineaCol;
|
||||
|
||||
@Priority(value = 1, copyPk = false)
|
||||
private MtbAart mtbAart;
|
||||
@@ -527,6 +529,14 @@ public class TtbStyle extends EntityBase {
|
||||
return this;
|
||||
}
|
||||
|
||||
public Boolean getFlagMinOrdLineaCol() {
|
||||
return flagMinOrdLineaCol;
|
||||
}
|
||||
|
||||
public TtbStyle setFlagMinOrdLineaCol(Boolean flagMinOrdLineaCol) {
|
||||
this.flagMinOrdLineaCol = flagMinOrdLineaCol;
|
||||
return this;
|
||||
}
|
||||
|
||||
public List<TtbStyleColori> getTtbStyleColori() {
|
||||
return ttbStyleColori;
|
||||
|
||||
@@ -52,10 +52,10 @@ public class VtbViaggi extends EntityBase {
|
||||
private Mezzo mezzo;
|
||||
|
||||
@SqlField(value = "posizione", defaultObjectValue = "0")
|
||||
private short posizione;
|
||||
private Short posizione;
|
||||
|
||||
@SqlField(value = "confermato", defaultObjectValue = "0")
|
||||
private boolean confermato;
|
||||
private Boolean confermato;
|
||||
|
||||
@Priority(value = 101, copyPk = false)
|
||||
private List<VtbViaggi> vtbViaggiList;
|
||||
@@ -150,20 +150,20 @@ public class VtbViaggi extends EntityBase {
|
||||
return this;
|
||||
}
|
||||
|
||||
public short getPosizione() {
|
||||
public Short getPosizione() {
|
||||
return posizione;
|
||||
}
|
||||
|
||||
public VtbViaggi setPosizione(short posizione) {
|
||||
public VtbViaggi setPosizione(Short posizione) {
|
||||
this.posizione = posizione;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isConfermato() {
|
||||
public Boolean getConfermato() {
|
||||
return confermato;
|
||||
}
|
||||
|
||||
public VtbViaggi setConfermato(boolean confermato) {
|
||||
public VtbViaggi setConfermato(Boolean confermato) {
|
||||
this.confermato = confermato;
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -4,7 +4,6 @@ import com.annimon.stream.Stream;
|
||||
import it.integry.common.var.CommonConstants;
|
||||
import it.integry.ems.activity.dto.*;
|
||||
import it.integry.ems.datasource.DataSource;
|
||||
import it.integry.ems.exception.PrimaryDatabaseNotPresentException;
|
||||
import it.integry.ems.javabeans.RequestDataDTO;
|
||||
import it.integry.ems.media.MediaImageService;
|
||||
import it.integry.ems.media.MediaVideoService;
|
||||
@@ -19,7 +18,6 @@ import it.integry.ems_model.db.ResultSetMapper;
|
||||
import it.integry.ems_model.entity.*;
|
||||
import it.integry.ems_model.types.OperationType;
|
||||
import it.integry.ems_model.utility.*;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -27,9 +25,7 @@ import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.Instant;
|
||||
import java.util.*;
|
||||
@@ -421,6 +417,39 @@ public class ActivityService {
|
||||
if (!sottoAttivita.isEmpty())
|
||||
entityBaseList.addAll(sottoAttivita);
|
||||
|
||||
|
||||
sql =
|
||||
Query.format(
|
||||
"SELECT jtb_rlavr.cod_jflav, jtb_rlavr.data_lav, jtb_rlavr.id_riga, %s as cod_jfas " +
|
||||
" FROM stb_activity INNER JOIN jtb_rlavr ON stb_activity.activity_id = jtb_rlavr.activity_id " +
|
||||
" WHERE parent_activity_id = %s AND stb_activity.cod_jfas <> %s\n" +
|
||||
" AND NOT EXISTS(SELECT * from stb_activity_check WHERE stb_activity.cod_jcom = stb_activity_check.cod_jcom AND stb_activity.effective_date between stb_activity_check.data_iniz AND stb_activity_check.data_fine )",
|
||||
codjfas,
|
||||
stbActivity.getActivityId(),
|
||||
codjfas);
|
||||
|
||||
List<JtbRLavr> righeRapportini = new ResultSetMapper().mapQuerySetToList(multiDBTransactionManager.getPrimaryConnection(), sql, JtbRLavr.class, OperationType.UPDATE);
|
||||
if (!righeRapportini.isEmpty()) {
|
||||
List<Map.Entry<JtbRLavt, List<JtbRLavr>>> list = Stream.of(righeRapportini).groupBy(
|
||||
x -> {
|
||||
JtbRLavt jtbRLavt = new JtbRLavt();
|
||||
jtbRLavt.setCodJflav(x.getCodJflav());
|
||||
jtbRLavt.setDataLav(x.getDataLav());
|
||||
jtbRLavt.setOperation(OperationType.NO_OP);
|
||||
jtbRLavt.setJtbRlavr(new ArrayList<>());
|
||||
return jtbRLavt;
|
||||
}
|
||||
).toList();
|
||||
|
||||
|
||||
List<JtbRLavt> rapportini = new ArrayList<>();
|
||||
for (Map.Entry<JtbRLavt, List<JtbRLavr>> entry:list ) {
|
||||
rapportini.add(entry.getKey().setJtbRlavr(entry.getValue()));
|
||||
}
|
||||
|
||||
entityBaseList.addAll(rapportini);
|
||||
}
|
||||
|
||||
List<EntityBase> entityRet = entityProcessor.processEntityList(entityBaseList, true);
|
||||
|
||||
UtilityEntity.throwEntitiesException(entityRet);
|
||||
@@ -429,55 +458,77 @@ public class ActivityService {
|
||||
}
|
||||
|
||||
public ActivityTaskDTO insSubactivity(StbActivity stbActivity) throws Exception {
|
||||
String sql =
|
||||
Query.format(
|
||||
"SELECT activity_id " +
|
||||
" FROM stb_activity " +
|
||||
" WHERE stb_activity.parent_activity_id = %s AND " +
|
||||
"stb_activity.user_name = %s AND " +
|
||||
"( stb_activity.estimated_time = %s OR (stb_activity.effective_date is null AND stb_activity.activity_result_id = 'DA FARE'))",
|
||||
stbActivity.getParentActivityId(),
|
||||
stbActivity.getUserName(),
|
||||
stbActivity.getEstimatedTime());
|
||||
try {
|
||||
String sql =
|
||||
Query.format(
|
||||
"SELECT activity_id " +
|
||||
" FROM stb_activity " +
|
||||
" WHERE stb_activity.parent_activity_id = %s AND " +
|
||||
"stb_activity.user_name = %s AND " +
|
||||
"( stb_activity.estimated_time = %s OR (stb_activity.effective_date is null AND stb_activity.activity_result_id = 'DA FARE'))",
|
||||
stbActivity.getParentActivityId(),
|
||||
stbActivity.getUserName(),
|
||||
stbActivity.getEstimatedTime());
|
||||
|
||||
String activityId = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(multiDBTransactionManager.getPrimaryConnection(), sql);
|
||||
String activityId = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(multiDBTransactionManager.getPrimaryConnection(), sql);
|
||||
|
||||
long seconds = (long) (stbActivity.getOreRapportino().floatValue() * 60L * 60L);
|
||||
long seconds = (long) (stbActivity.getOreRapportino().floatValue() * 60L * 60L);
|
||||
|
||||
if (stbActivity.getEffectiveTime() != null) {
|
||||
Instant endTimeInstant = stbActivity.getEffectiveTime().toInstant().plusSeconds(seconds);
|
||||
Date endTime = Date.from(endTimeInstant);
|
||||
if (stbActivity.getEffectiveTime() != null) {
|
||||
Instant endTimeInstant = stbActivity.getEffectiveTime().toInstant().plusSeconds(seconds);
|
||||
Date endTime = Date.from(endTimeInstant);
|
||||
|
||||
stbActivity.setEffectiveEndtime(endTime);
|
||||
}
|
||||
|
||||
if (UtilityString.isNullOrEmpty(activityId)) {
|
||||
stbActivity.setOperation(OperationType.INSERT);
|
||||
if (UtilityString.isNullOrEmpty(stbActivity.getActivityDescription())) {
|
||||
sql = Query.format("SELECT activity_description FROM stb_activity WHERE stb_activity.activity_id = %s", stbActivity.getParentActivityId());
|
||||
String activityDescr = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(multiDBTransactionManager.getPrimaryConnection(), sql);
|
||||
stbActivity.setActivityDescription(activityDescr);
|
||||
stbActivity.setEffectiveEndtime(endTime);
|
||||
}
|
||||
} else {
|
||||
stbActivity.setActivityId(activityId);
|
||||
stbActivity.setOperation(OperationType.UPDATE);
|
||||
|
||||
if (UtilityString.isNullOrEmpty(activityId)) {
|
||||
stbActivity.setOperation(OperationType.INSERT);
|
||||
if (UtilityString.isNullOrEmpty(stbActivity.getActivityDescription())) {
|
||||
sql = Query.format("SELECT activity_description FROM stb_activity WHERE stb_activity.activity_id = %s", stbActivity.getParentActivityId());
|
||||
String activityDescr = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(multiDBTransactionManager.getPrimaryConnection(), sql);
|
||||
stbActivity.setActivityDescription(activityDescr);
|
||||
}
|
||||
} else {
|
||||
stbActivity.setActivityId(activityId);
|
||||
stbActivity.setOperation(OperationType.UPDATE);
|
||||
}
|
||||
entityProcessor.processEntity(stbActivity, true, multiDBTransactionManager);
|
||||
UtilityEntity.throwEntityException(stbActivity);
|
||||
|
||||
sql = String.format(
|
||||
"SELECT * FROM stb_activity WHERE activity_id = %s AND user_name in (%s)",
|
||||
UtilityDB.valueToString(stbActivity.getParentActivityId()),
|
||||
"'DEV', 'T0001', 'T0003'");
|
||||
|
||||
StbActivity processo = UtilityDB.executeSimpleQueryOnlyFirstRowDTO(multiDBTransactionManager.getPrimaryConnection(), sql, StbActivity.class);
|
||||
|
||||
if (processo != null) {
|
||||
processo
|
||||
.setUserName(stbActivity.getUserName())
|
||||
.setOperation(OperationType.UPDATE);
|
||||
entityProcessor.processEntity(processo, true, multiDBTransactionManager);
|
||||
UtilityEntity.throwEntityException(processo);
|
||||
}
|
||||
|
||||
multiDBTransactionManager.commitAll();
|
||||
|
||||
return new ActivityTaskDTO()
|
||||
.setActivityId(stbActivity.getActivityId())
|
||||
.setActivityTypeId(stbActivity.getActivityTypeId())
|
||||
.setActivityDescription(stbActivity.getActivityDescription())
|
||||
.setUserName(stbActivity.getUserName())
|
||||
.setEffectiveDate(stbActivity.getEffectiveDate())
|
||||
.setActivityResultId(stbActivity.getActivityResultId())
|
||||
.setResultDescription(stbActivity.getResultDescription())
|
||||
.setOreLav(stbActivity.getOreRapportino())
|
||||
.setEstimatedDate(stbActivity.getEstimatedDate())
|
||||
.setEffectiveTime(stbActivity.getEffectiveTime())
|
||||
.setEffectiveEndtime(stbActivity.getEffectiveEndtime())
|
||||
.setNote(stbActivity.getNote());
|
||||
} catch (Exception e){
|
||||
multiDBTransactionManager.rollbackAll();
|
||||
throw e;
|
||||
}
|
||||
|
||||
entityProcessor.processEntity(stbActivity, multiDBTransactionManager);
|
||||
|
||||
return new ActivityTaskDTO()
|
||||
.setActivityId(stbActivity.getActivityId())
|
||||
.setActivityTypeId(stbActivity.getActivityTypeId())
|
||||
.setActivityDescription(stbActivity.getActivityDescription())
|
||||
.setUserName(stbActivity.getUserName())
|
||||
.setEffectiveDate(stbActivity.getEffectiveDate())
|
||||
.setActivityResultId(stbActivity.getActivityResultId())
|
||||
.setResultDescription(stbActivity.getResultDescription())
|
||||
.setOreLav(stbActivity.getOreRapportino())
|
||||
.setEstimatedDate(stbActivity.getEstimatedDate())
|
||||
.setEffectiveTime(stbActivity.getEffectiveTime())
|
||||
.setEffectiveEndtime(stbActivity.getEffectiveEndtime())
|
||||
.setNote(stbActivity.getNote());
|
||||
}
|
||||
|
||||
|
||||
@@ -800,14 +851,14 @@ public class ActivityService {
|
||||
" THEN stb_activity.activity_description\n" +
|
||||
" ELSE NULL END) AS activity_description,\n" +
|
||||
" MAX(CASE\n" +
|
||||
" WHEN IsNull(estimated_date, effective_date) BETWEEN dbo.f_getfirstdayofweek(GETDATE()) AND dbo.f_getlastdayofweek(GETDATE())\n" +
|
||||
" WHEN IsNull(effective_date, estimated_date) BETWEEN dbo.f_getfirstdayofweek(GETDATE()) AND dbo.f_getlastdayofweek(GETDATE())\n" +
|
||||
" THEN 1\n" +
|
||||
" ELSE 0 END) AS planned_this_week,\n" +
|
||||
" MAX(CASE\n" +
|
||||
" WHEN estimated_date between dbo.f_getfirstdayofweek(DateAdd(week, -1, GETDATE())) AND dbo.f_getLastDayOfWeek(DateAdd(week, -1, GETDATE())) THEN 1\n" +
|
||||
" WHEN IsNull(effective_date, estimated_date) between dbo.f_getfirstdayofweek(DateAdd(week, -1, GETDATE())) AND dbo.f_getLastDayOfWeek(DateAdd(week, -1, GETDATE())) THEN 1\n" +
|
||||
" ELSE 0 END) AS planned_previous_week,\n" +
|
||||
" MAX(CASE\n" +
|
||||
" WHEN estimated_date between dbo.f_getfirstdayofweek(DateAdd(week, 1, GETDATE())) AND dbo.f_getLastDayOfWeek(DateAdd(week, 1, GETDATE())) THEN 1\n" +
|
||||
" WHEN IsNull(effective_date, estimated_date) between dbo.f_getfirstdayofweek(DateAdd(week, 1, GETDATE())) AND dbo.f_getLastDayOfWeek(DateAdd(week, 1, GETDATE())) THEN 1\n" +
|
||||
" ELSE 0 END) AS planned_next_week,\n" +
|
||||
" SUM(jtb_rlavr.ore) AS ore\n" +
|
||||
" FROM stb_activity\n" +
|
||||
|
||||
@@ -357,7 +357,7 @@ public class LicorProductionService {
|
||||
" AND mtb_colt.data_ord = %s\n" +
|
||||
" AND mtb_colt.num_ord = %s\n" +
|
||||
" AND mtb_colr.riga_ord IS NOT NULL\n" +
|
||||
" AND NOT EXISTS(SELECT cod_mart\n" +
|
||||
" AND EXISTS(SELECT cod_mart\n" +
|
||||
" FROM mvw_articoli_esclusi_wms\n" +
|
||||
" WHERE cod_mdep = mtb_colt.cod_mdep\n" +
|
||||
" AND mtb_colr.cod_mart = mvw_articoli_esclusi_wms.cod_mart)",
|
||||
@@ -397,7 +397,7 @@ public class LicorProductionService {
|
||||
|
||||
int countArticoloEscluso = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(multiDBTransactionManager.getPrimaryConnection(), sql);
|
||||
|
||||
if (countArticoloEscluso != 0) {
|
||||
if (countArticoloEscluso == 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -397,7 +397,7 @@ public class OrdikidsService {
|
||||
" mtb_aart.cod_sco_art, " +
|
||||
" ttb_style.prezzo_base, " +
|
||||
" ttb_style.val_scatto, " +
|
||||
" ttb_line.num_min_art_col " +
|
||||
" ttb_line.num_min_art_col * ttb_style.flag_min_ord_linea_col as num_min_art_col " +
|
||||
"FROM tvvw_agen_line INNER JOIN ttb_style ON tvvw_agen_line.cod_line = ttb_style.cod_line and ttb_style.anno_stag = tvvw_agen_line.anno_stag " +
|
||||
" INNER JOIN mtb_aart ON ttb_style.cod_style = mtb_aart.cod_mart " +
|
||||
" INNER JOIN ttb_line ON ttb_style.cod_line = ttb_line.cod_line " +
|
||||
|
||||
Reference in New Issue
Block a user