Implementata gestione del magazzino automatico in posizionamento merce
This commit is contained in:
parent
e25cc9e825
commit
a49aab1fb0
8
.idea/inspectionProfiles/Project_Default.xml
generated
Normal file
8
.idea/inspectionProfiles/Project_Default.xml
generated
Normal file
@ -0,0 +1,8 @@
|
||||
<component name="InspectionProjectProfileManager">
|
||||
<profile version="1.0">
|
||||
<option name="myName" value="Project Default" />
|
||||
<inspection_tool class="AutoCloseableResource" enabled="true" level="WARNING" enabled_by_default="true">
|
||||
<option name="METHOD_MATCHER_CONFIG" value="java.util.Formatter,format,java.io.Writer,append,com.google.common.base.Preconditions,checkNotNull,org.hibernate.Session,close,java.io.PrintWriter,printf,java.io.PrintStream,printf,com.annimon.stream.Stream,of" />
|
||||
</inspection_tool>
|
||||
</profile>
|
||||
</component>
|
||||
@ -3,9 +3,11 @@ package it.integry.integrywmsnative.core.rest.consumers;
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
import it.integry.integrywmsnative.core.model.MtbDepoPosizione;
|
||||
import it.integry.integrywmsnative.core.rest.RESTBuilder;
|
||||
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
||||
import it.integry.integrywmsnative.core.rest.model.magazzino_automatico.MagazzinoAutomaticoPickItemsRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.magazzino_automatico.MagazzinoAutomaticoPutItemsRequestDTO;
|
||||
import retrofit2.Call;
|
||||
import retrofit2.Callback;
|
||||
import retrofit2.Response;
|
||||
@ -13,10 +15,9 @@ import retrofit2.Response;
|
||||
@Singleton
|
||||
public class MagazzinoAutomaticoRESTConsumer extends _BaseRESTConsumer {
|
||||
|
||||
public void pickItems(String posizione, MagazzinoAutomaticoPickItemsRequestDTO magazzinoAutomaticoPickItemsRequestDTO, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||
public void pickItems(MtbDepoPosizione posizione, MagazzinoAutomaticoPickItemsRequestDTO magazzinoAutomaticoPickItemsRequestDTO, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||
MagazzinoAutomaticoRESTConsumerService magazzinoAutomaticoRESTConsumerService = RESTBuilder.getService(MagazzinoAutomaticoRESTConsumerService.class);
|
||||
|
||||
magazzinoAutomaticoRESTConsumerService.pickItems(posizione, magazzinoAutomaticoPickItemsRequestDTO)
|
||||
magazzinoAutomaticoRESTConsumerService.pickItems(posizione.getPosizione(), magazzinoAutomaticoPickItemsRequestDTO)
|
||||
.enqueue(new Callback<>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<Void>> call, Response<ServiceRESTResponse<Void>> response) {
|
||||
@ -31,4 +32,21 @@ public class MagazzinoAutomaticoRESTConsumer extends _BaseRESTConsumer {
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void putItems(MtbDepoPosizione posizione, MagazzinoAutomaticoPutItemsRequestDTO magazzinoAutomaticoPutItemsRequestDTO, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||
MagazzinoAutomaticoRESTConsumerService magazzinoAutomaticoRESTConsumerService = RESTBuilder.getService(MagazzinoAutomaticoRESTConsumerService.class);
|
||||
magazzinoAutomaticoRESTConsumerService.putItems(posizione.getPosizione(), magazzinoAutomaticoPutItemsRequestDTO)
|
||||
.enqueue(new Callback<>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<Void>> call, Response<ServiceRESTResponse<Void>> response) {
|
||||
analyzeAnswer(response, "magazzino-automatico/putItems", data -> onComplete.run(), onFailed);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<ServiceRESTResponse<Void>> call, Throwable t) {
|
||||
onFailed.run(new Exception(t));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -2,6 +2,7 @@ package it.integry.integrywmsnative.core.rest.consumers;
|
||||
|
||||
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
||||
import it.integry.integrywmsnative.core.rest.model.magazzino_automatico.MagazzinoAutomaticoPickItemsRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.magazzino_automatico.MagazzinoAutomaticoPutItemsRequestDTO;
|
||||
import retrofit2.Call;
|
||||
import retrofit2.http.Body;
|
||||
import retrofit2.http.POST;
|
||||
@ -13,4 +14,9 @@ public interface MagazzinoAutomaticoRESTConsumerService {
|
||||
Call<ServiceRESTResponse<Void>> pickItems(
|
||||
@Path("posizione") String posizione,
|
||||
@Body MagazzinoAutomaticoPickItemsRequestDTO magazzinoAutomaticoPickItemsRequestDTO);
|
||||
|
||||
@POST("wms/magazzino-automatico/{posizione}/putItems")
|
||||
Call<ServiceRESTResponse<Void>> putItems(
|
||||
@Path("posizione") String posizione,
|
||||
@Body MagazzinoAutomaticoPutItemsRequestDTO magazzinoAutomaticoPutItemsRequestDTO);
|
||||
}
|
||||
|
||||
@ -0,0 +1,18 @@
|
||||
package it.integry.integrywmsnative.core.rest.model.magazzino_automatico;
|
||||
|
||||
import it.integry.integrywmsnative.core.model.MtbColt;
|
||||
|
||||
public class MagazzinoAutomaticoPutItemsRequestDTO {
|
||||
|
||||
private MtbColt inputMtbColt;
|
||||
|
||||
|
||||
public MtbColt getInputMtbColt() {
|
||||
return inputMtbColt;
|
||||
}
|
||||
|
||||
public MagazzinoAutomaticoPutItemsRequestDTO setInputMtbColt(MtbColt inputMtbColt) {
|
||||
this.inputMtbColt = inputMtbColt;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@ -171,7 +171,7 @@ public class PickingLiberoViewModel {
|
||||
.setDefaultGestioneOfNewUDS(mDefaultGestione.getText())
|
||||
.setItemsToPick(magazzinoAutomaticoPickItemRequestDTOList);
|
||||
|
||||
mMagazzinoAutomaticoRESTConsumer.pickItems(mtbDepoPosizione.getPosizione(),
|
||||
mMagazzinoAutomaticoRESTConsumer.pickItems(mtbDepoPosizione,
|
||||
magazzinoAutomaticoPickRequest, onComplete, this::sendError);
|
||||
}, this::sendOnLoadingEnded);
|
||||
|
||||
|
||||
@ -632,7 +632,7 @@ public class SpedizioneViewModel {
|
||||
.setOrdersOfNewUDS(orders)
|
||||
.setItemsToPick(magazzinoAutomaticoPickItemRequestDTOList);
|
||||
|
||||
mMagazzinoAutomaticoRESTConsumer.pickItems(mtbDepoPosizione.getPosizione(),
|
||||
mMagazzinoAutomaticoRESTConsumer.pickItems(mtbDepoPosizione,
|
||||
magazzinoAutomaticoPickRequest, onComplete, this::sendError);
|
||||
});
|
||||
}
|
||||
|
||||
@ -4,14 +4,18 @@ import dagger.Module;
|
||||
import dagger.Provides;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.BarcodeRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.ColliMagazzinoRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.MagazzinoAutomaticoRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.PosizioniRESTConsumer;
|
||||
|
||||
@Module(subcomponents = VersamentoMerceComponent.class)
|
||||
public class VersamentoMerceModule {
|
||||
|
||||
@Provides
|
||||
VersamentoMerceViewModel providesVersamentoMerceViewModel(ColliMagazzinoRESTConsumer colliMagazzinoRESTConsumer, BarcodeRESTConsumer barcodeRESTConsumer, PosizioniRESTConsumer posizioniRESTConsumer) {
|
||||
return new VersamentoMerceViewModel(colliMagazzinoRESTConsumer, barcodeRESTConsumer, posizioniRESTConsumer);
|
||||
VersamentoMerceViewModel providesVersamentoMerceViewModel(ColliMagazzinoRESTConsumer colliMagazzinoRESTConsumer,
|
||||
BarcodeRESTConsumer barcodeRESTConsumer,
|
||||
PosizioniRESTConsumer posizioniRESTConsumer,
|
||||
MagazzinoAutomaticoRESTConsumer magazzinoAutomaticoRESTConsumer) {
|
||||
return new VersamentoMerceViewModel(colliMagazzinoRESTConsumer, barcodeRESTConsumer, posizioniRESTConsumer, magazzinoAutomaticoRESTConsumer);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -17,6 +17,7 @@ import it.integry.barcode_base_android_library.model.BarcodeScanDTO;
|
||||
import it.integry.integrywmsnative.core.exception.InvalidLUGestioneException;
|
||||
import it.integry.integrywmsnative.core.exception.NoArtsInLUException;
|
||||
import it.integry.integrywmsnative.core.exception.NoLUFoundException;
|
||||
import it.integry.integrywmsnative.core.exception.ScannedPositionNotExistException;
|
||||
import it.integry.integrywmsnative.core.exception.TooManyLUFoundInMonoLUPositionException;
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
import it.integry.integrywmsnative.core.interfaces.viewmodel_listeners.ILoadingListener;
|
||||
@ -27,7 +28,9 @@ import it.integry.integrywmsnative.core.model.MtbDepoPosizione;
|
||||
import it.integry.integrywmsnative.core.model.secondary.GestioneEnum;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.BarcodeRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.ColliMagazzinoRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.MagazzinoAutomaticoRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.PosizioniRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.model.magazzino_automatico.MagazzinoAutomaticoPutItemsRequestDTO;
|
||||
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityBarcode;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityDate;
|
||||
@ -44,12 +47,14 @@ public class VersamentoMerceViewModel {
|
||||
private final ColliMagazzinoRESTConsumer mColliMagazzinoRESTConsumer;
|
||||
private final BarcodeRESTConsumer mBarcodeRESTConsumer;
|
||||
private final PosizioniRESTConsumer mPosizioniRESTConsumer;
|
||||
private final MagazzinoAutomaticoRESTConsumer mMagazzinoAutomaticoRESTConsumer;
|
||||
|
||||
@Inject
|
||||
public VersamentoMerceViewModel(ColliMagazzinoRESTConsumer colliMagazzinoRESTConsumer, BarcodeRESTConsumer barcodeRESTConsumer, PosizioniRESTConsumer posizioniRESTConsumer) {
|
||||
public VersamentoMerceViewModel(ColliMagazzinoRESTConsumer colliMagazzinoRESTConsumer, BarcodeRESTConsumer barcodeRESTConsumer, PosizioniRESTConsumer posizioniRESTConsumer, MagazzinoAutomaticoRESTConsumer mMagazzinoAutomaticoRESTConsumer) {
|
||||
this.mColliMagazzinoRESTConsumer = colliMagazzinoRESTConsumer;
|
||||
this.mBarcodeRESTConsumer = barcodeRESTConsumer;
|
||||
this.mPosizioniRESTConsumer = posizioniRESTConsumer;
|
||||
this.mMagazzinoAutomaticoRESTConsumer = mMagazzinoAutomaticoRESTConsumer;
|
||||
}
|
||||
|
||||
|
||||
@ -71,22 +76,19 @@ public class VersamentoMerceViewModel {
|
||||
.filter(x -> x.getPosizione().equalsIgnoreCase(barcodeScanDTO.getStringValue()))
|
||||
.single();
|
||||
|
||||
if (foundPosizione.isFlagMonoCollo()) {
|
||||
this.mPosizioniRESTConsumer.getBancaliInPosizione(foundPosizione, mtbColtList -> {
|
||||
|
||||
if (mtbColtList == null || mtbColtList.size() == 0) {
|
||||
this.sendError(new NoLUFoundException());
|
||||
} else if (mtbColtList.size() == 1) {
|
||||
mColliMagazzinoRESTConsumer.getByTestata(mtbColtList.get(0), true, false, mtbColt -> {
|
||||
if (foundPosizione == null) {
|
||||
//Nessuna posizione trovata con questo barcode
|
||||
this.sendError(new ScannedPositionNotExistException());
|
||||
return;
|
||||
}
|
||||
|
||||
//TAKE HERE
|
||||
pickMerceULtoUL(mtbColt, onComplete);
|
||||
if (foundPosizione.isMagazzinoAutomatico()) {
|
||||
//La posizione è di un magazzino automatico
|
||||
this.executePosizioneMagazzinoAutomatico(foundPosizione, onComplete);
|
||||
|
||||
}, this::sendError);
|
||||
} else {
|
||||
this.sendError(new TooManyLUFoundInMonoLUPositionException());
|
||||
}
|
||||
}, this::sendError);
|
||||
} else if (foundPosizione.isFlagMonoCollo()) {
|
||||
this.executePosizioneMonocollo(onComplete, foundPosizione);
|
||||
} else {
|
||||
|
||||
if (!UtilityString.equalsIgnoreCase(mCurrentMtbColt.getValue().getCodMdep(), foundPosizione.getCodMdep())) {
|
||||
@ -113,6 +115,36 @@ public class VersamentoMerceViewModel {
|
||||
}
|
||||
|
||||
|
||||
private void executePosizioneMagazzinoAutomatico(MtbDepoPosizione mtbDepoPosizione, Runnable onComplete) {
|
||||
var magazzinoAutomaticoPickRequest = new MagazzinoAutomaticoPutItemsRequestDTO()
|
||||
.setInputMtbColt(this.mCurrentMtbColt.getValue());
|
||||
|
||||
mMagazzinoAutomaticoRESTConsumer.putItems(mtbDepoPosizione,
|
||||
magazzinoAutomaticoPickRequest, () -> {
|
||||
onComplete.run();
|
||||
this.sendOnDataSaved();
|
||||
}, this::sendError);
|
||||
}
|
||||
|
||||
private void executePosizioneMonocollo(Runnable onComplete, MtbDepoPosizione foundPosizione) {
|
||||
this.mPosizioniRESTConsumer.getBancaliInPosizione(foundPosizione, mtbColtList -> {
|
||||
|
||||
if (mtbColtList == null || mtbColtList.size() == 0) {
|
||||
this.sendError(new NoLUFoundException());
|
||||
} else if (mtbColtList.size() == 1) {
|
||||
mColliMagazzinoRESTConsumer.getByTestata(mtbColtList.get(0), true, false, mtbColt -> {
|
||||
|
||||
//TAKE HERE
|
||||
pickMerceULtoUL(mtbColt, onComplete);
|
||||
|
||||
}, this::sendError);
|
||||
} else {
|
||||
this.sendError(new TooManyLUFoundInMonoLUPositionException());
|
||||
}
|
||||
}, this::sendError);
|
||||
}
|
||||
|
||||
|
||||
private void executeEtichettaEan128(BarcodeScanDTO barcodeScanDTO, Runnable onBarcodeScanComplete) {
|
||||
this.mBarcodeRESTConsumer.decodeEan128(barcodeScanDTO, ean128Model -> {
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user