Aggiunto servizio per creazione colli con righe già agganciate
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good

This commit is contained in:
2025-07-07 12:13:44 +02:00
parent 502dc5e7a9
commit 0b1310646c
7 changed files with 75 additions and 138 deletions

View File

@@ -6,6 +6,8 @@ import groovy.lang.Tuple2;
import it.integry.ems._context.ApplicationContextProvider;
import it.integry.ems.exception.MissingDataException;
import it.integry.ems.javabeans.RequestDataDTO;
import it.integry.ems.retail.wms.dto.CreateUDCWithRowsDTO;
import it.integry.ems.retail.wms.dto.CreateUDCRequestDTO;
import it.integry.ems.retail.wms.dto.InsertUDCRowRequestDTO;
import it.integry.ems.retail.wms.dto.InsertUDCRowResponseDTO;
import it.integry.ems.retail.wms.exceptions.InvalidArticoloException;
@@ -21,6 +23,8 @@ import it.integry.ems.utility.UtilityEntity;
import it.integry.ems_model.entity.*;
import it.integry.ems_model.types.OperationType;
import it.integry.ems_model.utility.*;
import it.integry.ems_model.utility.BarcodeEan128.Ean128Model;
import it.integry.ems_model.utility.BarcodeEan128.UtilityBarcodeEan128;
import org.apache.commons.lang3.StringUtils;
import org.jetbrains.annotations.NotNull;
@@ -467,6 +471,22 @@ public class WMSUtility {
.setSavedMtbColr(targetMtbColr);
}
public static CreateUDCRequestDTO createUDCFromSSCCRequestDTO(CreateUDCWithRowsDTO dto) {
Ean128Model model;
try {
model = UtilityBarcodeEan128.decode(dto.getBarcodeUl().getBytes());
} catch (Exception e) {
model = new Ean128Model();
}
String sscc = UtilityString.isNull(model.Sscc, dto.getBarcodeUl());
return new CreateUDCRequestDTO()
.setBarcodeUl(sscc)
.setPosizione(dto.getPosizione())
.setCodMdep(dto.getCodMdep());
}
public static MtbAart getArticoloByCodMart(String codMart, Connection connection) throws Exception {
if (UtilityString.isNullOrEmpty(codMart))
return null;

View File

@@ -85,8 +85,8 @@ public class WMSAccettazioneController {
@RequestMapping(value = EmsRestConstants.PATH_ACCETTAZIONE_MERCE_SILOS, method = RequestMethod.POST)
public @ResponseBody ServiceRestResponse accettazioneMerceSilos(HttpServletRequest request,
@RequestParam(CommonConstants.PROFILE_DB) String profileDB,
@RequestBody MtbColt colloCarico
) throws Exception {
@RequestBody MtbColt colloCarico) throws Exception {
return ServiceRestResponse.createPositiveResponse(wmsAccettazioneService.accettazioneMerceSilos(colloCarico));
}
@@ -94,8 +94,16 @@ public class WMSAccettazioneController {
@RequestMapping(value = "checkIfBarcodeUlAlreadyRegistered", method = RequestMethod.GET)
public @ResponseBody
ServiceRestResponse checkBarcodeUl(@RequestParam(CommonConstants.PROFILE_DB) String profileDB,
@RequestParam String barcodeUl ) throws Exception {
@RequestParam String barcodeUl) throws Exception {
return ServiceRestResponse.createPositiveResponse(wmsAccettazioneService.checkIfBarcodeUlAlreadyRegistered(barcodeUl));
}
@PostMapping(value = "createUDCWithRows")
public @ResponseBody
ServiceRestResponse createUDCFromArt(@RequestParam(CommonConstants.PROFILE_DB) String profileDB,
@RequestBody CreateUDCWithRowsDTO createUDCWithRows) throws Exception {
return ServiceRestResponse.createPositiveResponse(wmsAccettazioneService.createUDCFromArt(createUDCWithRows));
}
}

View File

@@ -73,7 +73,7 @@ public class WMSAccettazioneService {
throw new UsernameNotFoundException("Utente " + userSession.getUsername() + " non riconoscuto!");
}
if(!UtilityString.isNullOrEmpty(createUDCRequestDTO.getBarcodeUl()) &&
if (!UtilityString.isNullOrEmpty(createUDCRequestDTO.getBarcodeUl()) &&
WMSUtility.checkIfBarcodeUlIsAlreadyDeclared(multiDBTransactionManager.getPrimaryConnection(), createUDCRequestDTO.getBarcodeUl())) {
throw new Exception("Il barcode " + createUDCRequestDTO.getBarcodeUl() + " è già stato dichiarato in un collo di carico");
}
@@ -755,4 +755,19 @@ public class WMSAccettazioneService {
return UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(multiDBTransactionManager.getPrimaryConnection(), sql);
}
public CreateUDCResponseDTO createUDCFromArt(CreateUDCWithRowsDTO dto) throws Exception {
if (!userSession.isAttivo()) {
throw new UsernameNotFoundException("Utente " + userSession.getUsername() + " non riconosciuto!");
}
CreateUDCRequestDTO createUdcRequest = WMSUtility.createUDCFromSSCCRequestDTO(dto);
MtbColt udc = this.createUDC(createUdcRequest);
for (InsertUDCRowRequestDTO row : dto.getUdcRows()){
WMSUtility.insertUDCRow(row, entityProcessor, multiDBTransactionManager);
}
return new CreateUDCResponseDTO().setMtbColt(udc);
}
}

View File

@@ -1,98 +0,0 @@
package it.integry.ems.retail.wms.dto;
import java.math.BigDecimal;
public class CreateUDCFromArtRequestDTO {
private String codMart;
private String partitaMag;
private String codMdep;
private String posizione;
private String codJfas;
private BigDecimal qta;
private BigDecimal qtaCnf;
private BigDecimal numCnf;
private String barcodeUl;
public String getCodMart() {
return codMart;
}
public CreateUDCFromArtRequestDTO setCodMart(String codMart) {
this.codMart = codMart;
return this;
}
public String getPartitaMag() {
return partitaMag;
}
public CreateUDCFromArtRequestDTO setPartitaMag(String partitaMag) {
this.partitaMag = partitaMag;
return this;
}
public String getCodMdep() {
return codMdep;
}
public CreateUDCFromArtRequestDTO setCodMdep(String codMdep) {
this.codMdep = codMdep;
return this;
}
public String getPosizione() {
return posizione;
}
public CreateUDCFromArtRequestDTO setPosizione(String posizione) {
this.posizione = posizione;
return this;
}
public String getCodJfas() {
return codJfas;
}
public CreateUDCFromArtRequestDTO setCodJfas(String codJfas) {
this.codJfas = codJfas;
return this;
}
public BigDecimal getQta() {
return qta;
}
public CreateUDCFromArtRequestDTO setQta(BigDecimal qta) {
this.qta = qta;
return this;
}
public BigDecimal getQtaCnf() {
return qtaCnf;
}
public CreateUDCFromArtRequestDTO setQtaCnf(BigDecimal qtaCnf) {
this.qtaCnf = qtaCnf;
return this;
}
public BigDecimal getNumCnf() {
return numCnf;
}
public CreateUDCFromArtRequestDTO setNumCnf(BigDecimal numCnf) {
this.numCnf = numCnf;
return this;
}
public String getBarcodeUl() {
return barcodeUl;
}
public CreateUDCFromArtRequestDTO setBarcodeUl(String barcodeUl) {
this.barcodeUl = barcodeUl;
return this;
}
}

View File

@@ -0,0 +1,17 @@
package it.integry.ems.retail.wms.dto;
import java.util.List;
public class CreateUDCWithRowsDTO extends CreateUDCRequestDTO {
List<InsertUDCRowRequestDTO> udcRows;
public List<InsertUDCRowRequestDTO> getUdcRows() {
return udcRows;
}
public CreateUDCWithRowsDTO setUdcRows(List<InsertUDCRowRequestDTO> udcRows) {
this.udcRows = udcRows;
return this;
}
}

View File

@@ -116,13 +116,11 @@ public class WMSLavorazioneController {
}
@RequestMapping(value = "createUDCFromArt", method = RequestMethod.POST)
@PostMapping(value = "createUDCWithRows")
public @ResponseBody
ServiceRestResponse createUDCFromArt(@RequestParam(CommonConstants.PROFILE_DB) String profileDB,
@RequestBody CreateUDCFromArtRequestDTO createUDCRequestDTO) throws Exception {
CreateUDCResponseDTO responseDto = new CreateUDCResponseDTO()
.setMtbColt(wmsLavorazioneService.createUDCFromArt(createUDCRequestDTO));
return ServiceRestResponse.createPositiveResponse(responseDto);
}
@RequestBody CreateUDCWithRowsDTO createUDCWithRows) throws Exception {
return ServiceRestResponse.createPositiveResponse(wmsLavorazioneService.createUDCFromArt(createUDCWithRows));
}
}

View File

@@ -28,8 +28,6 @@ import it.integry.ems_model.entity.*;
import it.integry.ems_model.entity._enum.GestioneEnum;
import it.integry.ems_model.service.SetupGest;
import it.integry.ems_model.types.OperationType;
import it.integry.ems_model.utility.BarcodeEan128.Ean128Model;
import it.integry.ems_model.utility.BarcodeEan128.UtilityBarcodeEan128;
import it.integry.ems_model.utility.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
@@ -826,40 +824,19 @@ public class WMSLavorazioneService {
.setNumCnf(createUDSFromArtRequestDTO.getNumCnf()));
}
public MtbColt createUDCFromArt(CreateUDCFromArtRequestDTO dto) throws Exception {
public CreateUDCResponseDTO createUDCFromArt(CreateUDCWithRowsDTO dto) throws Exception {
if (!userSession.isAttivo()) {
throw new UsernameNotFoundException("Utente " + userSession.getUsername() + " non riconosciuto!");
}
Ean128Model model;
try {
model = UtilityBarcodeEan128.decode(dto.getBarcodeUl().getBytes());
} catch (Exception e) {
model = new Ean128Model();
CreateUDCRequestDTO createUdcRequest = WMSUtility.createUDCFromSSCCRequestDTO(dto);
MtbColt udc = this.createUDC(createUdcRequest);
for (InsertUDCRowRequestDTO row : dto.getUdcRows()){
WMSUtility.insertUDCRow(row, entityProcessor, multiDBTransactionManager);
}
String sscc = UtilityString.isNull(model.Sscc, dto.getBarcodeUl());
CreateUDCRequestDTO createUdcRequest = new CreateUDCRequestDTO();
createUdcRequest
.setBarcodeUl(sscc)
.setPosizione(dto.getPosizione())
.setCodMdep(dto.getCodMdep());
MtbColt udc = createUDC(createUdcRequest);
InsertUDCRowRequestDTO insertRowDto = new InsertUDCRowRequestDTO();
insertRowDto.setTargetMtbColt(udc);
insertRowDto.setCodMart(dto.getCodMart());
insertRowDto.setQtaTot(dto.getQta());
insertRowDto.setQtaCnf(dto.getQtaCnf());
insertRowDto.setNumCnf(dto.getNumCnf());
insertRowDto.setPartitaMag(dto.getPartitaMag());
insertRowDto.setFullName(userSession.getUsername());
WMSUtility.insertUDCRow(insertRowDto, entityProcessor, multiDBTransactionManager);
return udc;
return new CreateUDCResponseDTO().setMtbColt(udc);
}
public void riproporzionaScarichiLavorazione(List<ArticoloProdottoDTO> articoliProdotti, List<MtbColt> udsMateriaPrima) throws Exception {