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;
@@ -72,9 +74,9 @@ public class UtilityLocalDate {
}
public static LocalDate localDateFromDate(Date dateToConvert) {
if(dateToConvert == null) return null;
if (dateToConvert == null) return null;
if (dateToConvert instanceof java.sql.Date){
if (dateToConvert instanceof java.sql.Date) {
dateToConvert = new Date(dateToConvert.getTime());
}
return dateToConvert.toInstant()
@@ -83,7 +85,7 @@ public class UtilityLocalDate {
}
public static LocalDateTime localDateTimeFromDate(Date dateToConvert) {
if(dateToConvert == null) return null;
if (dateToConvert == null) return null;
return dateToConvert.toInstant()
.atZone(currentZone)
@@ -91,7 +93,7 @@ public class UtilityLocalDate {
}
public static LocalDateTime localDateTimeFromLocalDate(LocalDate dateToConvert) {
if(dateToConvert == null) return null;
if (dateToConvert == null) return null;
return dateToConvert
.atStartOfDay();
@@ -121,7 +123,7 @@ public class UtilityLocalDate {
}
public static Date localDateTimeToDate(LocalDateTime localDateTime) {
if(localDateTime == null) return null;
if (localDateTime == null) return null;
long seconds = localDateTimeToTime(localDateTime, null);
return new Date(seconds * 1000);
@@ -138,7 +140,7 @@ public class UtilityLocalDate {
return new Date(seconds * 1000);
}
public static long daysAfterDate (LocalDate dataIniz, LocalDate dataFine) {
public static long daysAfterDate(LocalDate dataIniz, LocalDate dataFine) {
return DAYS.between(dataIniz, dataFine);
}
@@ -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

@@ -1216,10 +1216,10 @@ public class WMSGenericService {
}
public MtbColr creaRettificaCollo(String codMdep, MtbColr sourceMtbColr, BigDecimal newNumCnf, BigDecimal newQtaCol, boolean createNewCollo, boolean returnRettifica) throws Exception {
return creaRettificaCollo(codMdep, sourceMtbColr, newNumCnf, newQtaCol, null, createNewCollo, returnRettifica,true);
return creaRettificaCollo(codMdep, sourceMtbColr, newNumCnf, newQtaCol, null, createNewCollo, returnRettifica, true);
}
public MtbColr creaRettificaCollo(String codMdep, MtbColr sourceMtbColr, BigDecimal newNumCnf, BigDecimal newQtaCol, LocalDateTime newDataVers, boolean createNewCollo, boolean returnRettifica,boolean createDocsAutomatically) throws Exception {
public MtbColr creaRettificaCollo(String codMdep, MtbColr sourceMtbColr, BigDecimal newNumCnf, BigDecimal newQtaCol, LocalDateTime newDataVers, boolean createNewCollo, boolean returnRettifica, boolean createDocsAutomatically) throws Exception {
if (UtilityString.isNullOrEmpty(sourceMtbColr.getBarcodeUlIn()))
throw new MissingDataException("Il barcode UL in input non può essere nullo");
/*
@@ -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());
}
@@ -3121,10 +3134,10 @@ public class WMSGenericService {
public String getEtichettaUL(MtbColt ul) throws Exception {
ul.setOperation(OperationType.SELECT_OBJECT);
entityProcessor.processEntity(ul,true,multiDBTransactionManager);
entityProcessor.processEntity(ul, true, multiDBTransactionManager);
//<editor-fold desc="Etichetta SSCC per le ul create da ordine di lavorazione">
if (ul.getGestione().equalsIgnoreCase("L")&& ul.getSegno() == 1 && ul.getOrdine() != null){
if (ul.getGestione().equalsIgnoreCase("L") && ul.getSegno() == 1 && ul.getOrdine() != null) {
String reportName = wmsLavorazioneService.getEtichettaSSCCOrdine(ul.getOrdine());
if (UtilityString.hasContent(reportName))
return reportName;
@@ -3132,8 +3145,8 @@ public class WMSGenericService {
//</editor-fold>
//<editor-fold desc="Etichetta anonima per colli con serie UL">
if (ul.getSerCollo().equalsIgnoreCase("UL")){
String reportName = setupGest.getSetup(multiDBTransactionManager.getPrimaryConnection(),"PICKING","SETUP","REPORT_NAME_ETICHETTA_ANONIMA");
if (ul.getSerCollo().equalsIgnoreCase("UL")) {
String reportName = setupGest.getSetup(multiDBTransactionManager.getPrimaryConnection(), "PICKING", "SETUP", "REPORT_NAME_ETICHETTA_ANONIMA");
if (UtilityString.hasContent(reportName))
return reportName;
}

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);
@@ -919,7 +920,7 @@ public class WMSLavorazioneService {
public String getEtichettaSSCCOrdine(DtbOrdt ordine) throws Exception {
ordine.setOperation(OperationType.SELECT_OBJECT);
entityProcessor.processEntity(ordine,true,multiDBTransactionManager);
entityProcessor.processEntity(ordine, true, multiDBTransactionManager);
if (UtilityString.isNullOrEmpty(ordine.getCodProd())) {
return null;
}