Iniziato refactoring servizi di versamento materiali
This commit is contained in:
@@ -6,6 +6,7 @@ public class RetrieveArtsInGiacenzaByArtRequestDTO {
|
||||
private String codMart;
|
||||
private String partitaMag;
|
||||
|
||||
private String barcodeUl;
|
||||
private String posizione;
|
||||
|
||||
public String getCodMdep() {
|
||||
@@ -35,6 +36,15 @@ public class RetrieveArtsInGiacenzaByArtRequestDTO {
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getBarcodeUl() {
|
||||
return barcodeUl;
|
||||
}
|
||||
|
||||
public RetrieveArtsInGiacenzaByArtRequestDTO setBarcodeUl(String barcodeUl) {
|
||||
this.barcodeUl = barcodeUl;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getPosizione() {
|
||||
return posizione;
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ public class WMSGiacenzaService {
|
||||
.setCodMdep(x.getCodMdep()))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
final List<MvwSitArtUdcDetInventarioDTO> availableItems = wmsGiacenzaULService.retrieveArtsInGiacenzaByArticoli(multiDBTransactionManager.getPrimaryConnection(),
|
||||
final List<MvwSitArtUdcDetInventarioDTO> availableItems = wmsGiacenzaULService.retrieveArtsInGiacenzaByArticolo(multiDBTransactionManager.getPrimaryConnection(),
|
||||
retrieveArtsInGiacenzaByArtRequestDTOList);
|
||||
|
||||
|
||||
|
||||
@@ -15,10 +15,7 @@ import org.springframework.stereotype.Service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
@@ -49,6 +46,7 @@ public class WMSGiacenzaULService {
|
||||
" sit_art.peso_netto_kg,\n" +
|
||||
" sit_art.peso_lordo_kg,\n" +
|
||||
" sit_art.cod_jfas,\n" +
|
||||
" sit_art.barcode_ul,\n" +
|
||||
(withTestataCollo ? "mtb_colt.num_ord,\n" : "") +
|
||||
(withTestataCollo ? "mtb_colt.data_ord,\n" : "") +
|
||||
(withTestataCollo ? "mtb_colt.barcode_ul,\n" : "") +
|
||||
@@ -252,7 +250,11 @@ public class WMSGiacenzaULService {
|
||||
return UtilityDB.executeSimpleQueryDTO(connection, sql, MvwSitArtUdcDetInventarioDTO.class);
|
||||
}
|
||||
|
||||
public List<MvwSitArtUdcDetInventarioDTO> retrieveArtsInGiacenzaByArticoli(Connection connection, List<RetrieveArtsInGiacenzaByArtRequestDTO> inputData) throws Exception {
|
||||
public List<MvwSitArtUdcDetInventarioDTO> retrieveArtsInGiacenzaByArticolo(Connection connection, RetrieveArtsInGiacenzaByArtRequestDTO inputData) throws Exception {
|
||||
return retrieveArtsInGiacenzaByArticolo(connection, Collections.singletonList(inputData));
|
||||
}
|
||||
|
||||
public List<MvwSitArtUdcDetInventarioDTO> retrieveArtsInGiacenzaByArticolo(Connection connection, List<RetrieveArtsInGiacenzaByArtRequestDTO> inputData) throws Exception {
|
||||
|
||||
List<HashMap<String, Object>> whereCondMaps = inputData.stream()
|
||||
.map(x -> {
|
||||
@@ -269,6 +271,9 @@ public class WMSGiacenzaULService {
|
||||
if (!UtilityString.isNullOrEmpty(x.getCodMdep()))
|
||||
map.put("sit_art.cod_mdep", x.getCodMdep());
|
||||
|
||||
if (!UtilityString.isNullOrEmpty(x.getBarcodeUl()))
|
||||
map.put("sit_art.barcode_ul", x.getBarcodeUl());
|
||||
|
||||
return map;
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ package it.integry.ems.retail.wms.lavorazione.controller;
|
||||
import it.integry.common.var.CommonConstants;
|
||||
import it.integry.ems.response.ServiceRestResponse;
|
||||
import it.integry.ems.retail.wms.lavorazione.dto.RecuperaMaterialiRequestDTO;
|
||||
import it.integry.ems.retail.wms.lavorazione.dto.RecuperaMaterialiResponseDTO;
|
||||
import it.integry.ems.retail.wms.lavorazione.dto.VersaMaterialiRequestDTO;
|
||||
import it.integry.ems.retail.wms.lavorazione.service.WMSMaterialiService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
@@ -20,13 +20,17 @@ public class WMSMaterialiController {
|
||||
|
||||
|
||||
|
||||
@RequestMapping(value = "recupera", method = RequestMethod.POST)
|
||||
public @ResponseBody
|
||||
ServiceRestResponse recupera(@RequestParam(CommonConstants.PROFILE_DB) String profileDB,
|
||||
@RequestBody RecuperaMaterialiRequestDTO recuperaMaterialiRequestDTO) throws Exception {
|
||||
RecuperaMaterialiResponseDTO responseDto = new RecuperaMaterialiResponseDTO()
|
||||
.setUpdatedMtbColtScarico(wmsMaterialiService.recupera(recuperaMaterialiRequestDTO));
|
||||
@PostMapping(value = "versa")
|
||||
public @ResponseBody ServiceRestResponse versa(@RequestParam(CommonConstants.PROFILE_DB) String profileDB,
|
||||
@RequestBody VersaMaterialiRequestDTO versaMaterialiRequestDTO) throws Exception {
|
||||
return ServiceRestResponse.createPositiveResponse(wmsMaterialiService.versa(versaMaterialiRequestDTO));
|
||||
}
|
||||
|
||||
return ServiceRestResponse.createPositiveResponse(responseDto);
|
||||
|
||||
@PostMapping(value = "recupera")
|
||||
public @ResponseBody ServiceRestResponse recupera(@RequestParam(CommonConstants.PROFILE_DB) String profileDB,
|
||||
@RequestBody RecuperaMaterialiRequestDTO recuperaMaterialiRequestDTO) throws Exception {
|
||||
|
||||
return ServiceRestResponse.createPositiveResponse(wmsMaterialiService.recupera(recuperaMaterialiRequestDTO));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,14 +4,14 @@ import it.integry.ems_model.entity.MtbColt;
|
||||
|
||||
public class RecuperaMaterialiResponseDTO {
|
||||
|
||||
private MtbColt updatedMtbColtScarico;
|
||||
private final MtbColt updatedMtbColtScarico;
|
||||
|
||||
public RecuperaMaterialiResponseDTO(MtbColt updatedMtbColtScarico) {
|
||||
this.updatedMtbColtScarico = updatedMtbColtScarico;
|
||||
}
|
||||
|
||||
public MtbColt getUpdatedMtbColtScarico() {
|
||||
return updatedMtbColtScarico;
|
||||
}
|
||||
|
||||
public RecuperaMaterialiResponseDTO setUpdatedMtbColtScarico(MtbColt updatedMtbColtScarico) {
|
||||
this.updatedMtbColtScarico = updatedMtbColtScarico;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,110 @@
|
||||
package it.integry.ems.retail.wms.lavorazione.dto;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
|
||||
public class VersaMaterialiRequestDTO {
|
||||
|
||||
private String codMart;
|
||||
private String partitaMag;
|
||||
private BigDecimal numCnf;
|
||||
private BigDecimal qtaCnf;
|
||||
private BigDecimal qtaTot;
|
||||
|
||||
private Integer numCollo;
|
||||
private LocalDate dataCollo;
|
||||
private String gestione;
|
||||
private String serCollo;
|
||||
private String barcodeUl;
|
||||
|
||||
|
||||
public String getCodMart() {
|
||||
return codMart;
|
||||
}
|
||||
|
||||
public VersaMaterialiRequestDTO setCodMart(String codMart) {
|
||||
this.codMart = codMart;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getPartitaMag() {
|
||||
return partitaMag;
|
||||
}
|
||||
|
||||
public VersaMaterialiRequestDTO setPartitaMag(String partitaMag) {
|
||||
this.partitaMag = partitaMag;
|
||||
return this;
|
||||
}
|
||||
|
||||
public BigDecimal getNumCnf() {
|
||||
return numCnf;
|
||||
}
|
||||
|
||||
public VersaMaterialiRequestDTO setNumCnf(BigDecimal numCnf) {
|
||||
this.numCnf = numCnf;
|
||||
return this;
|
||||
}
|
||||
|
||||
public BigDecimal getQtaCnf() {
|
||||
return qtaCnf;
|
||||
}
|
||||
|
||||
public VersaMaterialiRequestDTO setQtaCnf(BigDecimal qtaCnf) {
|
||||
this.qtaCnf = qtaCnf;
|
||||
return this;
|
||||
}
|
||||
|
||||
public BigDecimal getQtaTot() {
|
||||
return qtaTot;
|
||||
}
|
||||
|
||||
public VersaMaterialiRequestDTO setQtaTot(BigDecimal qtaTot) {
|
||||
this.qtaTot = qtaTot;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Integer getNumCollo() {
|
||||
return numCollo;
|
||||
}
|
||||
|
||||
public VersaMaterialiRequestDTO setNumCollo(Integer numCollo) {
|
||||
this.numCollo = numCollo;
|
||||
return this;
|
||||
}
|
||||
|
||||
public LocalDate getDataCollo() {
|
||||
return dataCollo;
|
||||
}
|
||||
|
||||
public VersaMaterialiRequestDTO setDataCollo(LocalDate dataCollo) {
|
||||
this.dataCollo = dataCollo;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getGestione() {
|
||||
return gestione;
|
||||
}
|
||||
|
||||
public VersaMaterialiRequestDTO setGestione(String gestione) {
|
||||
this.gestione = gestione;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getSerCollo() {
|
||||
return serCollo;
|
||||
}
|
||||
|
||||
public VersaMaterialiRequestDTO setSerCollo(String serCollo) {
|
||||
this.serCollo = serCollo;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getBarcodeUl() {
|
||||
return barcodeUl;
|
||||
}
|
||||
|
||||
public VersaMaterialiRequestDTO setBarcodeUl(String barcodeUl) {
|
||||
this.barcodeUl = barcodeUl;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
package it.integry.ems.retail.wms.lavorazione.dto;
|
||||
|
||||
public class VersaMaterialiResponseDTO {
|
||||
}
|
||||
@@ -3,7 +3,11 @@ package it.integry.ems.retail.wms.lavorazione.service;
|
||||
import it.integry.ems.product.importaz.service.ProductServices;
|
||||
import it.integry.ems.retail.wms.Utility.WMSUtility;
|
||||
import it.integry.ems.retail.wms.exceptions.InvalidArticoloException;
|
||||
import it.integry.ems.retail.wms.generic.service.WMSGiacenzaULService;
|
||||
import it.integry.ems.retail.wms.lavorazione.dto.RecuperaMaterialiRequestDTO;
|
||||
import it.integry.ems.retail.wms.lavorazione.dto.RecuperaMaterialiResponseDTO;
|
||||
import it.integry.ems.retail.wms.lavorazione.dto.VersaMaterialiRequestDTO;
|
||||
import it.integry.ems.retail.wms.lavorazione.dto.VersaMaterialiResponseDTO;
|
||||
import it.integry.ems.service.EntityProcessor;
|
||||
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
|
||||
import it.integry.ems.utility.UtilityEntity;
|
||||
@@ -14,6 +18,7 @@ import it.integry.ems_model.types.OperationType;
|
||||
import it.integry.ems_model.utility.UtilityBigDecimal;
|
||||
import it.integry.ems_model.utility.UtilityLocalDate;
|
||||
import it.integry.ems_model.utility.UtilityString;
|
||||
import org.apache.commons.lang3.NotImplementedException;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -41,9 +46,47 @@ public class WMSMaterialiService {
|
||||
@Autowired
|
||||
private EntityProcessor entityProcessor;
|
||||
|
||||
@Autowired
|
||||
private WMSGiacenzaULService wmsGiacenzaULService;
|
||||
|
||||
private final Logger logger = LogManager.getLogger();
|
||||
|
||||
public MtbColt recupera(RecuperaMaterialiRequestDTO request) throws Exception {
|
||||
public VersaMaterialiResponseDTO versa(VersaMaterialiRequestDTO request) throws Exception {
|
||||
throw new NotImplementedException();
|
||||
|
||||
/*
|
||||
final boolean versamentoDirettoEnabled = setupGest.getSetupBoolean(multiDBTransactionManager.getPrimaryConnection(), "PICKING", "PRODUZIONE", "FLAG_VERSAMENTO_DIRETTO");
|
||||
final boolean forceAllToColli = setupGest.getSetupBoolean(multiDBTransactionManager.getPrimaryConnection(), "PICKING", "SETUP", "FLAG_FORCE_ALL_TO_COLLI");
|
||||
|
||||
MtbAart mtbAart = WMSUtility.getArticoloByCodMart(request.getCodMart(),multiDBTransactionManager);
|
||||
if (mtbAart == null)
|
||||
throw new InvalidArticoloException(request.getCodMart());
|
||||
|
||||
if (request.getBarcodeUl() == null )
|
||||
throw new Exception("Indicare una UL in cui effettuare il carico del materiale");
|
||||
|
||||
|
||||
List<MvwSitArtUdcDetInventarioDTO> artsInGiacenza =
|
||||
wmsGiacenzaULService.retrieveArtsInGiacenzaByArticolo(multiDBTransactionManager.getPrimaryConnection(), new RetrieveArtsInGiacenzaByArtRequestDTO()
|
||||
.setCodMart(request.getCodMart())
|
||||
.setPartitaMag(request.getPartitaMag())
|
||||
.setBarcodeUl(request.getBarcodeUl()));
|
||||
|
||||
if(artsInGiacenza == null || artsInGiacenza.isEmpty())
|
||||
throw new Exception("L'UL non contiene articoli (" + request.getBarcodeUl() + ")");
|
||||
|
||||
if (!versamentoDirettoEnabled) {
|
||||
// createColloScarico(mtbDepoPosizione);
|
||||
} else {
|
||||
|
||||
}
|
||||
|
||||
|
||||
return new VersaMaterialiResponseDTO();
|
||||
*/
|
||||
}
|
||||
|
||||
public RecuperaMaterialiResponseDTO recupera(RecuperaMaterialiRequestDTO request) throws Exception {
|
||||
|
||||
final boolean versamentoDirettoEnabled = setupGest.getSetupBoolean(multiDBTransactionManager.getPrimaryConnection(), "PICKING", "PRODUZIONE", "FLAG_VERSAMENTO_DIRETTO");
|
||||
final boolean forceAllToColli = setupGest.getSetupBoolean(multiDBTransactionManager.getPrimaryConnection(), "PICKING", "SETUP", "FLAG_FORCE_ALL_TO_COLLI");
|
||||
@@ -267,7 +310,7 @@ public class WMSMaterialiService {
|
||||
|
||||
final List<EntityBase> savedEntities = entityProcessor.processEntityList(entitiesToSave, true);
|
||||
UtilityEntity.throwEntitiesException(savedEntities);
|
||||
return mtbColtScarico;
|
||||
return new RecuperaMaterialiResponseDTO(mtbColtScarico);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user