diff --git a/ems-engine/src/main/java/it/integry/ems/customizations/production/service/GrammProductionService.java b/ems-engine/src/main/java/it/integry/ems/customizations/production/service/GrammProductionService.java index a3a76adf55..fd7c3c67c9 100644 --- a/ems-engine/src/main/java/it/integry/ems/customizations/production/service/GrammProductionService.java +++ b/ems-engine/src/main/java/it/integry/ems/customizations/production/service/GrammProductionService.java @@ -143,7 +143,7 @@ public class GrammProductionService { BigDecimal newQtaCol = mtbColrCarichiGiac.get(0).getQtaCol().add(qtaDaRettificare); BigDecimal newNumCnf = UtilityBigDecimal.divide(newQtaCol, mtbColrCarichiGiac.get(0).getQtaCnf()); - wmsGenericService.creaRettificaCollo(codMdep, mtbColrCarichiGiac.get(0), newNumCnf, newQtaCol, false, false, null); + wmsGenericService.creaRettificaCollo(codMdep, mtbColrCarichiGiac.get(0), newNumCnf, newQtaCol, false, false); } else if (isNegativeUpdate) { BigDecimal qtaDaRettificare = caricoTotale.subtract(chiusuraLavorazioneSemoleRequestDTO.getQtaPastaSeccaProdotta()); @@ -154,7 +154,7 @@ public class GrammProductionService { BigDecimal newQtaCol = mtbColrCarichiGiac.get(i).getQtaCol().subtract(qtaToTake); BigDecimal newNumCnf = UtilityBigDecimal.divide(newQtaCol, mtbColrCarichiGiac.get(i).getQtaCnf()); - wmsGenericService.creaRettificaCollo(codMdep, mtbColrCarichiGiac.get(i), newNumCnf, newQtaCol, false, false, null); + wmsGenericService.creaRettificaCollo(codMdep, mtbColrCarichiGiac.get(i), newNumCnf, newQtaCol, false, false); counterQta = counterQta.add(qtaToTake); } } @@ -449,7 +449,7 @@ public class GrammProductionService { BigDecimal newQtaCol = mtbColrCarichi.get(0).getQtaCol().add(qtaDaRettificare); BigDecimal newNumCnf = UtilityBigDecimal.divide(newQtaCol, mtbColrCarichi.get(0).getQtaCnf()); - wmsGenericService.creaRettificaCollo(codMdep, mtbColrCarichi.get(0).toMtbColr(), newNumCnf, newQtaCol, false, false, null); + wmsGenericService.creaRettificaCollo(codMdep, mtbColrCarichi.get(0).toMtbColr(), newNumCnf, newQtaCol, false, false); } else { BigDecimal qtaDaRettificare = residuoCalc.subtract(chiusuraLavorazioneFornoRequestDTO.getQtaResiduo()); @@ -462,7 +462,7 @@ public class GrammProductionService { BigDecimal newQtaCol = mtbColrCarichiGiac.get(i).getQtaCol().subtract(qtaToTake); BigDecimal newNumCnf = UtilityBigDecimal.divide(newQtaCol, mtbColrCarichiGiac.get(i).getQtaCnf()); - wmsGenericService.creaRettificaCollo(codMdep, mtbColrCarichiGiac.get(i).toMtbColr(), newNumCnf, newQtaCol, false, false, null); + wmsGenericService.creaRettificaCollo(codMdep, mtbColrCarichiGiac.get(i).toMtbColr(), newNumCnf, newQtaCol, false, false); counterQta = counterQta.add(qtaToTake); } } diff --git a/ems-engine/src/main/java/it/integry/ems/production/service/ProductionWarehouseService.java b/ems-engine/src/main/java/it/integry/ems/production/service/ProductionWarehouseService.java index a35851c0fb..078dc84831 100644 --- a/ems-engine/src/main/java/it/integry/ems/production/service/ProductionWarehouseService.java +++ b/ems-engine/src/main/java/it/integry/ems/production/service/ProductionWarehouseService.java @@ -57,8 +57,7 @@ public class ProductionWarehouseService { rettificaDto.getNewNumCnf(), rettificaDto.getNewQtaCol(), true, - true, - null)); + true)); MtbColt testata = new MtbColt(); testata.setNumCollo(rettifica.getNumCollo()); testata.setDataCollo(rettifica.getDataCollo()); diff --git a/ems-engine/src/main/java/it/integry/ems/retail/wms/generic/controller/WMSGenericController.java b/ems-engine/src/main/java/it/integry/ems/retail/wms/generic/controller/WMSGenericController.java index 6f80afdaa7..22d2acd28c 100644 --- a/ems-engine/src/main/java/it/integry/ems/retail/wms/generic/controller/WMSGenericController.java +++ b/ems-engine/src/main/java/it/integry/ems/retail/wms/generic/controller/WMSGenericController.java @@ -435,7 +435,6 @@ public class WMSGenericController { @RequestParam String codMdep, @RequestParam(required = false, defaultValue = "false") Boolean forceNewCollo, @RequestParam(required = false, defaultValue = "false") Boolean returnRettifica, - @RequestParam(required = false) Boolean shouldCreateMovFiscale, @RequestBody RettificaULDTO rettificaULDTO) throws Exception { MtbColr mtbColr = wmsGenericService.creaRettificaCollo( @@ -443,9 +442,9 @@ public class WMSGenericController { rettificaULDTO.getSourceMtbColr(), rettificaULDTO.getNewNumCnf(), rettificaULDTO.getNewQtaCol(), + rettificaULDTO.getNewDataVers(), forceNewCollo != null ? forceNewCollo : false, - returnRettifica != null ? returnRettifica : false, - shouldCreateMovFiscale); + returnRettifica != null ? returnRettifica : false); return ServiceRestResponse.createEntityPositiveResponse(mtbColr); } diff --git a/ems-engine/src/main/java/it/integry/ems/retail/wms/generic/dto/RettificaULDTO.java b/ems-engine/src/main/java/it/integry/ems/retail/wms/generic/dto/RettificaULDTO.java index 0772384fea..20372d4d11 100644 --- a/ems-engine/src/main/java/it/integry/ems/retail/wms/generic/dto/RettificaULDTO.java +++ b/ems-engine/src/main/java/it/integry/ems/retail/wms/generic/dto/RettificaULDTO.java @@ -3,12 +3,14 @@ package it.integry.ems.retail.wms.generic.dto; import it.integry.ems_model.entity.MtbColr; import java.math.BigDecimal; +import java.time.LocalDateTime; public class RettificaULDTO { private MtbColr sourceMtbColr; private BigDecimal newNumCnf; private BigDecimal newQtaCol; + private LocalDateTime newDataVers; public MtbColr getSourceMtbColr() { return sourceMtbColr; @@ -36,4 +38,13 @@ public class RettificaULDTO { this.newQtaCol = newQtaCol; return this; } + + public LocalDateTime getNewDataVers() { + return newDataVers; + } + + public RettificaULDTO setNewDataVers(LocalDateTime newDataVers) { + this.newDataVers = newDataVers; + return this; + } } 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 c7ee1349f5..12b00f520c 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 @@ -57,6 +57,7 @@ import java.math.RoundingMode; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.time.LocalDate; +import java.time.LocalDateTime; import java.util.*; import java.util.stream.Collectors; @@ -1191,7 +1192,11 @@ public class WMSGenericService { return shoudBeDeleted; } - public MtbColr creaRettificaCollo(String codMdep, MtbColr sourceMtbColr, BigDecimal newNumCnf, BigDecimal newQtaCol, boolean createNewCollo, boolean returnRettifica, Boolean shouldCreateMovFiscale) throws Exception { + 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); + } + + public MtbColr creaRettificaCollo(String codMdep, MtbColr sourceMtbColr, BigDecimal newNumCnf, BigDecimal newQtaCol, LocalDateTime newDataVers, boolean createNewCollo, boolean returnRettifica) throws Exception { /* 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. @@ -1224,6 +1229,16 @@ public class WMSGenericService { BigDecimal qtaCnf = null; if (UtilityBigDecimal.equalsTo(differenceQtaCol, BigDecimal.ZERO) && UtilityBigDecimal.equalsTo(differenceNumCnf, BigDecimal.ZERO)) { + if (newDataVers != null) { + MtbColt mtbColt = MtbColt.fromMtbColr(sourceMtbColr); + + mtbColt + .setDataVers(newDataVers) + .setOperation(OperationType.UPDATE); + + entityProcessor.processEntity(mtbColt, multiDBTransactionManager); + } + return null; } else if (UtilityBigDecimal.equalsTo(differenceQtaCol, BigDecimal.ZERO) || UtilityBigDecimal.equalsTo(differenceNumCnf, BigDecimal.ZERO)) { //qtaCnf = BigDecimal.ZERO; @@ -1410,6 +1425,12 @@ public class WMSGenericService { .setMtbColr(new ArrayList<>()); mtbColt.setOperation(OperationType.NO_OP); + if (newDataVers != null) { + mtbColt + .setDataVers(newDataVers) + .setOperation(OperationType.UPDATE); + } + mtbColrToSave = (MtbColr) sourceMtbColr.clone(); mtbColrToSave .setRiga(null)