From 7eac47b3b76792b3e33c730643f6037b7e86fabb Mon Sep 17 00:00:00 2001 From: Valerio Castellana Date: Mon, 25 Aug 2025 10:34:16 +0200 Subject: [PATCH] =?UTF-8?q?[rettifica=20colli]=20-=20se=20la=20udc=20in=20?= =?UTF-8?q?rettifica=20ha=20subito=20gi=C3=A0=20delle=20movimentazioni,=20?= =?UTF-8?q?=C3=A8=20obbligatorio=20eseguire=20la=20rettifica=20in=20un=20n?= =?UTF-8?q?uovo=20movimento?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../retail/wms/generic/service/WMSGenericService.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/ems-engine/src/main/java/it/integry/ems/retail/wms/generic/service/WMSGenericService.java b/ems-engine/src/main/java/it/integry/ems/retail/wms/generic/service/WMSGenericService.java index 2ffa72b6bd..28848093a6 100644 --- a/ems-engine/src/main/java/it/integry/ems/retail/wms/generic/service/WMSGenericService.java +++ b/ems-engine/src/main/java/it/integry/ems/retail/wms/generic/service/WMSGenericService.java @@ -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"); + + // + Integer movimentiBarcode = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(multiDBTransactionManager.getPrimaryConnection(), "SELECT COUNT(*) FROM mtb_colr WHERE barcode_ul_out = "+UtilityDB.valueToString(sourceMtbColr.getBarcodeUlIn())); + createNewCollo = movimentiBarcode > 0 || createNewCollo; + // + BigDecimal differenceQtaCol = newQtaCol.subtract(sourceMtbColr.getQtaCol()); BigDecimal differenceNumCnf = newNumCnf.subtract(sourceMtbColr.getNumCnf()); BigDecimal qtaCnf = null;