Gestita possibilità di indicare la data del trasferimento in sposta ul
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good

This commit is contained in:
2025-05-23 09:37:39 +02:00
parent 585771cb2e
commit 4bb59eee38
6 changed files with 66 additions and 22 deletions

View File

@@ -43,6 +43,7 @@ public class UtilityLocalDate {
public static boolean isAfterToday(LocalDate inputDate) {
return inputDate != null && inputDate.isAfter(getNow());
}
public static boolean isSameDay(LocalDateTime date1, LocalDateTime date2) {
if (date1 == null && date2 == null) {
@@ -55,6 +56,7 @@ public class UtilityLocalDate {
return date1.toLocalDate().equals(date2.toLocalDate());
}
public static boolean isSameDay(LocalDate date1, LocalDate date2) {
if (date1 == null && date2 == null) {
return true;
@@ -154,6 +156,11 @@ public class UtilityLocalDate {
.toLocalDateTime();
}
public static LocalDate isNull(LocalDate dateToCheck, LocalDate fallbackValue) {
if (dateToCheck == null) return fallbackValue;
return dateToCheck;
}
public static LocalDateTime isNull(LocalDateTime dateToCheck, LocalDateTime fallbackValue) {
if (dateToCheck == null) return fallbackValue;
return dateToCheck;

View File

@@ -497,11 +497,14 @@ public class WMSUtility {
}
public static MtbColt createInternalMovement(String codMdep) {
return createInternalMovement(codMdep, null);
}
public static MtbColt createInternalMovement(String codMdep, LocalDate dataCollo) {
MtbColt mtbColt = new MtbColt()
.setGestione("L")
.setSegno(1)
.setDataCollo(LocalDate.now())
.setDataCollo(UtilityLocalDate.isNull(dataCollo, LocalDate.now()))
.setCodMdep(codMdep);
mtbColt.setOperation(OperationType.INSERT);

View File

@@ -4,6 +4,7 @@ import it.integry.ems_model.entity.MtbColr;
import it.integry.ems_model.entity.MtbColt;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.Date;
public class InsertUDSRowRequestDTO {
@@ -21,7 +22,7 @@ public class InsertUDSRowRequestDTO {
private Date dataOrd;
private Integer numOrd;
private Integer rigaOrd;
private LocalDateTime datetimeRow;
private String codJcom;
private String contrassegnoDa;
@@ -128,6 +129,15 @@ public class InsertUDSRowRequestDTO {
return this;
}
public LocalDateTime getDatetimeRow() {
return datetimeRow;
}
public InsertUDSRowRequestDTO setDatetimeRow(LocalDateTime datetimeRow) {
this.datetimeRow = datetimeRow;
return this;
}
public String getCodJcom() {
return codJcom;
}

View File

@@ -2,14 +2,15 @@ package it.integry.ems.retail.wms.generic.dto;
import com.fasterxml.jackson.annotation.JsonValue;
import it.integry.ems_model.entity.MtbColt;
import it.integry.ems_model.entity.StbActivityPlan;
import it.integry.ems_model.entity._enum.IBaseEnum;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
public class SpostaUlRequestDTO {
private LocalDateTime dataTrasf;
private String codMdep;
private String posizione;
private String annotazioni;
@@ -18,6 +19,15 @@ public class SpostaUlRequestDTO {
private TransferGroupPolicy groupingPolicy = TransferGroupPolicy.NONE;
private List<MtbColt> mtbColtsToMove = new ArrayList<>();
public LocalDateTime getDataTrasf() {
return dataTrasf;
}
public SpostaUlRequestDTO setDataTrasf(LocalDateTime dataTrasf) {
this.dataTrasf = dataTrasf;
return this;
}
public String getCodMdep() {
return codMdep;
}

View File

@@ -2132,8 +2132,11 @@ public class WMSGenericService {
codVdes = mtbDepoPartenza.getCodVdes();
}
LocalDate dataDoc = UtilityLocalDate.isNull(requestDTO.getDataTrasf(), UtilityLocalDate.getNowTime()).toLocalDate();
docTrasfRequest = new LoadColliDTO();
docTrasfRequest
.setDataDoc(UtilityLocalDate.localDateToDate(dataDoc))
.setCodDtip(codDtipToUse)
.setCodMdep(codMdepDoc)
.setCodAnag(codAnag)
@@ -2147,7 +2150,7 @@ public class WMSGenericService {
" and data_doc = {}\n" +
" and cod_mdep = {}\n" +
" and cod_anag = {}\n" +
" and cod_vdes = {}", codDtipToUse, UtilityLocalDate.getNow(), codMdepDoc, codAnag, codVdes);
" and cod_vdes = {}", codDtipToUse, dataDoc, codMdepDoc, codAnag, codVdes);
switch (requestDTO.getGroupingPolicy()) {
case BY_USER:
queryDoc = UtilityDB.addwhereCond(queryDoc, Query.format("user_name = {}", requestDataDTO.getUsername()), true);
@@ -2179,19 +2182,28 @@ public class WMSGenericService {
//<editor-fold desc="Creazione movimento di magazzino">
if (gestisciColli) {
movimento = WMSUtility.createInternalMovement(codMdepDoc);
// entitiesToSave.add(movimento);
movimento = WMSUtility.createInternalMovement(codMdepDoc, requestDTO.getDataTrasf() != null ? requestDTO.getDataTrasf().toLocalDate() : null);
final List<MtbColr> cambiaPosizioneUlMovements =
WMSUtility.createCambiaPosizioneUlMovements(multiDBTransactionManager.getPrimaryConnection(),
ulToMove, codMdepPartenza != null && !codMdepPartenza.equalsIgnoreCase(requestDTO.getCodMdep()),
requestDTO.getCodMdep(), requestDTO.getPosizione());
movimento.getMtbColr().addAll(cambiaPosizioneUlMovements);
cambiaPosizioneUlMovements.forEach(mtbColr -> mtbColr.setDatetimeRow(requestDTO.getDataTrasf()));
movimento
.setDataVers(requestDTO.getDataTrasf())
.getMtbColr().addAll(cambiaPosizioneUlMovements);
} else { //se non gestisco i colli sul deposito creo il movimento di solo scarico
CreateUDSRequestDTO createUDSRequest = new CreateUDSRequestDTO();
createUDSRequest.setCodMdep(codMdepDoc)
.setCausaleCollo(CreateUDSRequestDTO.Causale.SCARICO);
if (requestDTO.getDataTrasf() != null) {
createUDSRequest
.setDataCollo(requestDTO.getDataTrasf().toLocalDate());
}
movimento = wmsLavorazioneService.createUDS(createUDSRequest);
for (MvwSitArtUdcDetInventarioDTO rowToMove : currentItemSituationList) {
final MtbColr mtbColr = WMSUtility.convertMvwItemToMtbColr(rowToMove);
@@ -2205,7 +2217,8 @@ public class WMSGenericService {
.setNumCnf(rowToMove.getNumCnf())
.setPartitaMag(rowToMove.getPartitaMag())
.setDataScad(rowToMove.getDataScad())
.setTargetMtbColt(movimento);
.setTargetMtbColt(movimento)
.setDatetimeRow(requestDTO.getDataTrasf());
movimento.getMtbColr().add(wmsLavorazioneService.insertUDSRow(insertUDSRowRequest).getSavedMtbColr());
}

View File

@@ -97,6 +97,7 @@ public class WMSLavorazioneService {
MtbColt udsMtbColt = new MtbColt()
.setGestione(GestioneEnum.LAVORAZIONE.getText())
.setDataCollo(createUDSRequestDTO.getDataCollo())
.setNumCollo(createUDSRequestDTO.getNumCollo())
.setSerCollo(createUDSRequestDTO.getSerCollo())
.setCodMdep(createUDSRequestDTO.getCodMdep())
@@ -289,7 +290,7 @@ public class WMSLavorazioneService {
.setDataOrd(UtilityLocalDate.localDateFromDate(insertUDSRowRequestDTO.getDataOrd()))
.setNumOrd(insertUDSRowRequestDTO.getNumOrd())
.setRigaOrd(insertUDSRowRequestDTO.getRigaOrd())
.setDatetimeRow(UtilityLocalDate.getNowTime())
.setDatetimeRow(UtilityLocalDate.isNull(insertUDSRowRequestDTO.getDatetimeRow(), UtilityLocalDate.getNowTime()))
.setCodJcom(insertUDSRowRequestDTO.getCodJcom())
.setMtbColrInfoProd(mtbColrInfoProd);
targetMtbColr.setOperation(OperationType.INSERT);