[rettifica colli]

- se la udc in rettifica ha subito già delle movimentazioni, è obbligatorio eseguire la rettifica in un nuovo movimento
This commit is contained in:
2025-08-25 10:34:16 +02:00
parent 8abb7c2842
commit 7eac47b3b7

View File

@@ -1221,6 +1221,10 @@ public class WMSGenericService {
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");
MtbColt anagUl = WMSUtility.retrieveBarcodeUlAnag(multiDBTransactionManager.getPrimaryConnection(),sourceMtbColr.getBarcodeUlIn());
if (anagUl == null)
throw new Exception("Il barcode UL in input non esiste nel sistema");
/*
Warning: il campo sourceMtbColr potrebbe non essere una reale mtb_colr ma potrebbe essere la somma delle
qta delle mtb_colr con stesso cod_mart, partita_mag, cod_col, cod_tagl.
@@ -1248,6 +1252,12 @@ public class WMSGenericService {
boolean shouldCreateMovimentoFiscale = createDocsAutomatically && setupGest.getSetupBoolean(multiDBTransactionManager.getPrimaryConnection(), "PICKING", "RETTIFICA_GIACENZE", "FLAG_ENABLE_MOVIMENTO_FISCALE");
//<editor-fold desc="se il collo che voglio rettificare ha già altri movimenti agganciati forzo la creazione di un nuovo collo">
Integer movimentiBarcode = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(multiDBTransactionManager.getPrimaryConnection(), "SELECT COUNT(*) FROM mtb_colr WHERE barcode_ul_out = "+UtilityDB.valueToString(sourceMtbColr.getBarcodeUlIn()));
createNewCollo = movimentiBarcode > 0 || createNewCollo;
//</editor-fold>
BigDecimal differenceQtaCol = newQtaCol.subtract(sourceMtbColr.getQtaCol());
BigDecimal differenceNumCnf = newNumCnf.subtract(sourceMtbColr.getNumCnf());
BigDecimal qtaCnf = null;