Gestito parametro data collo in scarico da collo

This commit is contained in:
2025-05-23 18:39:28 +02:00
parent c343ec70ad
commit 3f2ad37ff9
2 changed files with 28 additions and 12 deletions

View File

@@ -4,6 +4,7 @@ import it.integry.ems_model.entity.DtbOrdr;
import it.integry.ems_model.entity.MtbColt; import it.integry.ems_model.entity.MtbColt;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.time.LocalDateTime;
public class ScaricoMateriaPrimaDaColloDTO { public class ScaricoMateriaPrimaDaColloDTO {
@@ -12,6 +13,7 @@ public class ScaricoMateriaPrimaDaColloDTO {
private String codMdep; private String codMdep;
private MtbColt sourceUl; private MtbColt sourceUl;
private BigDecimal quantity; private BigDecimal quantity;
private LocalDateTime dataVers;
private DtbOrdr order; private DtbOrdr order;
private boolean createNewUl = false; private boolean createNewUl = false;
private Integer idLotto; private Integer idLotto;
@@ -43,6 +45,15 @@ public class ScaricoMateriaPrimaDaColloDTO {
return this; return this;
} }
public LocalDateTime getDataVers() {
return dataVers;
}
public ScaricoMateriaPrimaDaColloDTO setDataVers(LocalDateTime dataVers) {
this.dataVers = dataVers;
return this;
}
public DtbOrdr getOrder() { public DtbOrdr getOrder() {
return order; return order;
} }

View File

@@ -2861,27 +2861,32 @@ public class WMSGenericService {
} }
} }
LocalDate maxDataCollo = UtilityLocalDate.getNow(); LocalDate dataCollo = UtilityLocalDate.getNow();
if (mtbColt == null || scarico.isCreateNewUl()) { if (mtbColt == null || scarico.isCreateNewUl()) {
String queryMaxDataCollo = "SELECT MAX(data_collo)" + if (scarico.getDataVers() != null) {
" FROM mtb_colt" + dataCollo = scarico.getDataVers().toLocalDate();
" WHERE segno = 1 " + } else {
" AND data_ord = " + UtilityDB.valueToString(order.getDataOrd()) + String queryMaxDataCollo = "SELECT MAX(data_collo)" +
" AND num_ord = " + UtilityDB.valueToString(order.getNumOrd()) + " FROM mtb_colt" +
" AND gestione = " + UtilityDB.valueToString(order.getGestione()); " WHERE segno = 1 " +
" AND data_ord = " + UtilityDB.valueToString(order != null ? order.getDataOrd() : null) +
" AND num_ord = " + UtilityDB.valueToString(order != null ? order.getNumOrd() : null) +
" AND gestione = " + UtilityDB.valueToString(order != null ? order.getGestione() : null);
Date dateMaxDataCollo = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(multiDBTransactionManager.getPrimaryConnection(), queryMaxDataCollo); Date dateMaxDataCollo = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(multiDBTransactionManager.getPrimaryConnection(), queryMaxDataCollo);
if (dateMaxDataCollo != null) { if (dateMaxDataCollo != null) {
maxDataCollo = UtilityLocalDate.localDateFromDate(dateMaxDataCollo); dataCollo = UtilityLocalDate.localDateFromDate(dateMaxDataCollo);
}
} }
mtbColt = WMSUtility.createInternalMovement(codMdep) mtbColt = WMSUtility.createInternalMovement(codMdep, dataCollo)
.setDataOrd(order != null ? UtilityLocalDate.localDateFromDate(order.getDataOrd()) : null) .setDataOrd(order != null ? UtilityLocalDate.localDateFromDate(order.getDataOrd()) : null)
.setNumOrd(order != null ? order.getNumOrd() : null) .setNumOrd(order != null ? order.getNumOrd() : null)
.setCodJfas(order != null ? order.getCodJfas() : null) .setCodJfas(order != null ? order.getCodJfas() : null)
.setIdLotto(scarico.getIdLotto()) .setIdLotto(scarico.getIdLotto())
.setDataVers(scarico.getDataVers())
.setCodAnag(codAnag) .setCodAnag(codAnag)
.setSegno(-1); .setSegno(-1);
@@ -2910,7 +2915,7 @@ public class WMSGenericService {
.setDataColloRif(giacenza.getDataCollo()) .setDataColloRif(giacenza.getDataCollo())
.setSerColloRif(giacenza.getSerCollo()) .setSerColloRif(giacenza.getSerCollo())
.setGestioneRif(giacenza.getGestione()) .setGestioneRif(giacenza.getGestione())
.setDatetimeRow(UtilityLocalDate.localDateTimeFromLocalDate(maxDataCollo)) .setDatetimeRow(UtilityLocalDate.localDateTimeFromLocalDate(dataCollo))
.setBarcodeUlOut(sourceBarcodeUl) .setBarcodeUlOut(sourceBarcodeUl)
.setCodMdepOut(giacenza.getCodMdep()) .setCodMdepOut(giacenza.getCodMdep())
.setPosizioneOut(giacenza.getPosizione()); .setPosizioneOut(giacenza.getPosizione());