Permettere la duplicazione delle uds
This commit is contained in:
parent
a5a9cb1c50
commit
da301ec6b2
@ -114,7 +114,6 @@ public class ColliAccettazioneRESTConsumer extends _BaseRESTConsumer implements
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void checkBarcodeUl(String barcodeUl, RunnableArgs<Boolean> onComplete, RunnableArgs<Exception> onFailed){
|
||||
ColliAccettazioneRESTConsumerService colliAccettazioneRESTConsumerService = RESTBuilder.getService(ColliAccettazioneRESTConsumerService.class);
|
||||
|
||||
|
||||
@ -264,22 +264,4 @@ public class ColliLavorazioneRESTConsumer extends _BaseRESTConsumer implements C
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void checkBarcodeUl(String barcodeUl, RunnableArgs<Boolean> onComplete, RunnableArgs<Exception> onFailed){
|
||||
ColliAccettazioneRESTConsumerService colliAccettazioneRESTConsumerService = RESTBuilder.getService(ColliAccettazioneRESTConsumerService.class);
|
||||
|
||||
colliAccettazioneRESTConsumerService.checkIfBarcodeUlAlreadyRegistered(barcodeUl)
|
||||
.enqueue(new Callback<>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<Boolean>> call, Response<ServiceRESTResponse<Boolean>> response) {
|
||||
analyzeAnswer(response, "accettazione/checkIfBarcodeUlAlreadyRegistered", onComplete, onFailed);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<ServiceRESTResponse<Boolean>> call, Throwable t) {
|
||||
onFailed.run(new Exception(t));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
package it.integry.integrywmsnative.core.rest.consumers;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
@ -13,6 +15,8 @@ import it.integry.integrywmsnative.core.rest.model.uds.CloseUDSResponseDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.CreateUDSRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.CreateUDSResponseDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.DeleteUDSRowRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.DuplicateUDSRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.DuplicateUDSResponseDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.EditUDSRowRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.EditUDSRowResponseDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.InsertUDSRowRequestDTO;
|
||||
@ -113,4 +117,21 @@ public class ColliSpedizioneRESTConsumer extends _BaseRESTConsumer implements Co
|
||||
|
||||
}
|
||||
|
||||
public void duplicateUDSRow(DuplicateUDSRequestDTO duplicateUDSRequestDTO, RunnableArgs<DuplicateUDSResponseDTO> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
ColliSpedizioneRESTConsumerService colliSpedizioneRESTConsumerService = RESTBuilder.getService(ColliSpedizioneRESTConsumerService.class);
|
||||
|
||||
colliSpedizioneRESTConsumerService.duplicateUDSRow(duplicateUDSRequestDTO)
|
||||
.enqueue(new Callback<>() {
|
||||
@Override
|
||||
public void onResponse(@NonNull Call<ServiceRESTResponse<DuplicateUDSResponseDTO>> call, @NonNull Response<ServiceRESTResponse<DuplicateUDSResponseDTO>> response) {
|
||||
analyzeAnswer(response, "spedizione/duplicateUDSRow", onComplete, onFailed);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(@NonNull Call<ServiceRESTResponse<DuplicateUDSResponseDTO>> call, @NonNull Throwable t) {
|
||||
onFailed.run(new Exception());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -6,6 +6,8 @@ import it.integry.integrywmsnative.core.rest.model.uds.CloseUDSResponseDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.CreateUDSRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.CreateUDSResponseDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.DeleteUDSRowRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.DuplicateUDSRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.DuplicateUDSResponseDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.EditUDSRowRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.EditUDSRowResponseDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.InsertUDSRowRequestDTO;
|
||||
@ -35,4 +37,7 @@ public interface ColliSpedizioneRESTConsumerService {
|
||||
@POST("wms/spedizione/deleteUDSRow")
|
||||
Call<ServiceRESTResponse<Void>> deleteUDSRow(@Body DeleteUDSRowRequestDTO deleteUDSRowRequestDTO);
|
||||
|
||||
@POST("wms/spedizione/duplicateUDSRow")
|
||||
Call<ServiceRESTResponse<DuplicateUDSResponseDTO>> duplicateUDSRow(@Body DuplicateUDSRequestDTO duplicateUDSRequestDTO);
|
||||
|
||||
}
|
||||
|
||||
@ -21,6 +21,4 @@ public interface ColliCaricoRESTConsumerInterface {
|
||||
void editUDCRow(EditUDCRowRequestDTO editUDCRowRequestDTO, RunnableArgs<MtbColr> onComplete, RunnableArgs<Exception> onFailed);
|
||||
|
||||
void deleteUDCRow(DeleteUDCRowRequestDTO deleteUDCRequestDTO, Runnable onComplete, RunnableArgs<Exception> onFailed);
|
||||
|
||||
void checkBarcodeUl(String barcodeUl, RunnableArgs<Boolean> onComplete, RunnableArgs<Exception> onFailed);
|
||||
}
|
||||
|
||||
@ -0,0 +1,28 @@
|
||||
package it.integry.integrywmsnative.core.rest.model.uds;
|
||||
|
||||
import it.integry.integrywmsnative.core.model.MtbColt;
|
||||
|
||||
public class DuplicateUDSRequestDTO {
|
||||
|
||||
private MtbColt mtbColt;
|
||||
|
||||
private int numOfDuplicates;
|
||||
|
||||
public MtbColt getMtbColt() {
|
||||
return mtbColt;
|
||||
}
|
||||
|
||||
public DuplicateUDSRequestDTO setMtbColt(MtbColt mtbColt) {
|
||||
this.mtbColt = mtbColt;
|
||||
return this;
|
||||
}
|
||||
|
||||
public int getNumOfDuplicates() {
|
||||
return numOfDuplicates;
|
||||
}
|
||||
|
||||
public DuplicateUDSRequestDTO setNumOfDuplicates(int numOfDuplicates) {
|
||||
this.numOfDuplicates = numOfDuplicates;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,19 @@
|
||||
package it.integry.integrywmsnative.core.rest.model.uds;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import it.integry.integrywmsnative.core.model.MtbColt;
|
||||
|
||||
public class DuplicateUDSResponseDTO {
|
||||
|
||||
private List<MtbColt> mtbColtList;
|
||||
|
||||
public List<MtbColt> getMtbColtList() {
|
||||
return mtbColtList;
|
||||
}
|
||||
|
||||
public DuplicateUDSResponseDTO setMtbColtList(List<MtbColt> mtbColtList) {
|
||||
this.mtbColtList = mtbColtList;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@ -79,6 +79,7 @@ public class DBSettingsModel {
|
||||
private boolean flagTracciamentoImballiCaricoEnabled = false;
|
||||
private boolean flagTracciamentoImballiScaricoEnabled = false;
|
||||
private boolean flagPickingLiberoEnableScanArt = false;
|
||||
private boolean flagAskDuplicateUDSSpedizione = false;
|
||||
|
||||
public boolean isFlagSpedizioneEnableFakeGiacenza() {
|
||||
return flagSpedizioneEnableFakeGiacenza;
|
||||
@ -664,4 +665,13 @@ public class DBSettingsModel {
|
||||
this.flagPickingLiberoEnableScanArt = flagPickingLiberoEnableScanArt;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isFlagAskDuplicateUDSSpedizione() {
|
||||
return flagAskDuplicateUDSSpedizione;
|
||||
}
|
||||
|
||||
public DBSettingsModel setFlagAskDuplicateUDSSpedizione(boolean flagAskDuplicateUDSSpedizione) {
|
||||
this.flagAskDuplicateUDSSpedizione = flagAskDuplicateUDSSpedizione;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
@ -388,6 +388,11 @@ public class SettingsManager {
|
||||
.setSection("SPEDIZIONE")
|
||||
.setKeySection("FLAG_ASK_INFO_AGGIUNTIVE")
|
||||
.setSetter(dbSettingsModelIstance::setFlagAskInfoAggiuntiveSpedizione));
|
||||
stbGestSetupReaderList.add(new StbGestSetupReader<>(Boolean.class)
|
||||
.setGestName("PICKING")
|
||||
.setSection("SPEDIZIONE")
|
||||
.setKeySection("FLAG_ASK_DUPLICATE_UDS")
|
||||
.setSetter(dbSettingsModelIstance::setFlagAskDuplicateUDSSpedizione));
|
||||
stbGestSetupReaderList.add(new StbGestSetupReader<>(String.class)
|
||||
.setGestName("PICKING")
|
||||
.setSection("SPEDIZIONE")
|
||||
|
||||
@ -1072,4 +1072,16 @@ public class SpedizioneActivity extends BaseActivity implements SpedizioneViewMo
|
||||
DialogInfoAggiuntiveLUView.newInstance(mtbColt, onComplete, this::onLoadingEnded)
|
||||
.show(getSupportFragmentManager(), DialogInfoAggiuntiveLUView.class.getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onInputDuplicate(RunnableArgs<Integer> onComplete){
|
||||
DialogSimpleInputHelper.makeInputDialog(this, "Numero pedane da duplicare", inputValue -> {
|
||||
try {
|
||||
Integer num = Integer.parseInt(inputValue);
|
||||
onComplete.run(num);
|
||||
} catch (NumberFormatException ex) {
|
||||
this.onError(new Exception("Inserire un numero di risorse valido"));
|
||||
}
|
||||
}, () -> {}).show();
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
package it.integry.integrywmsnative.gest.spedizione;
|
||||
|
||||
import androidx.annotation.IntegerRes;
|
||||
import androidx.databinding.ObservableArrayList;
|
||||
import androidx.lifecycle.MutableLiveData;
|
||||
|
||||
@ -13,6 +14,7 @@ import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
@ -72,6 +74,7 @@ import it.integry.integrywmsnative.core.rest.model.uds.CreateUDSRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.CreateUDSRequestOrderDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.DeleteUDSRowRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.DeleteULRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.DuplicateUDSRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.EditUDSRowRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.InsertUDSRowRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.PrintULRequestDTO;
|
||||
@ -1549,31 +1552,35 @@ public class SpedizioneViewModel {
|
||||
|
||||
this.closeLU(generatedMtbColts -> {
|
||||
|
||||
this.mColliMagazzinoRESTConsumer.fillMtbAartsOfMtbColts(generatedMtbColts, filledMtbColts -> {
|
||||
this.duplicateUDS(generatedMtbColts, duplicatedMtbColts -> {
|
||||
|
||||
this.askPositionChange(
|
||||
filledMtbColts,
|
||||
positionedMtbColts -> {
|
||||
generatedMtbColts.addAll(duplicatedMtbColts);
|
||||
|
||||
this.askPrint((shouldPrint && SettingsManager.iDB().isFlagPrintEtichetteOnLUClose()), positionedMtbColts, () -> {
|
||||
positionedMtbColts.stream()
|
||||
.filter(x -> !this.mColliRegistrati.contains(x))
|
||||
.forEach(x -> this.mColliRegistrati.add(x));
|
||||
this.mColliMagazzinoRESTConsumer.fillMtbAartsOfMtbColts(generatedMtbColts, filledMtbColts -> {
|
||||
|
||||
postCloseOperations(positionedMtbColts);
|
||||
this.askPositionChange(
|
||||
filledMtbColts,
|
||||
positionedMtbColts -> {
|
||||
|
||||
this.mIsNewLU = false;
|
||||
this.askPrint((shouldPrint && SettingsManager.iDB().isFlagPrintEtichetteOnLUClose()), positionedMtbColts, () -> {
|
||||
positionedMtbColts.stream()
|
||||
.filter(x -> !this.mColliRegistrati.contains(x))
|
||||
.forEach(x -> this.mColliRegistrati.add(x));
|
||||
|
||||
postCloseOperations(positionedMtbColts);
|
||||
|
||||
this.mIsNewLU = false;
|
||||
|
||||
this.resetMatchedRows();
|
||||
this.sendLUClosed();
|
||||
this.sendOnLoadingEnded();
|
||||
});
|
||||
|
||||
this.resetMatchedRows();
|
||||
this.sendLUClosed();
|
||||
this.sendOnLoadingEnded();
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
}, this::sendError);
|
||||
}, this::sendError);
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
});
|
||||
@ -1596,8 +1603,35 @@ public class SpedizioneViewModel {
|
||||
this.mColliScaricoRESTConsumer.closeUDS(closeUDSRequestDto, closeResponse -> {
|
||||
onComplete.run(closeResponse.getGeneratedMtbColts());
|
||||
}, this::sendError);
|
||||
}
|
||||
|
||||
private void duplicateUDS(List<MtbColt> mtbColtList, RunnableArgs<List<MtbColt>> onComplete) {
|
||||
var clonedLu = (MtbColt) this.mCurrentMtbColt.clone();
|
||||
|
||||
boolean noReference = clonedLu.getMtbColr().stream()
|
||||
.allMatch(
|
||||
x -> x.getGestioneRif() == null &&
|
||||
x.getDataColloRifD() == null &&
|
||||
x.getSerColloRif() == null &&
|
||||
x.getNumColloRif() == null
|
||||
);
|
||||
|
||||
if (mtbColtList.size() > 1 || !noReference || !SettingsManager.iDB().isFlagAskDuplicateUDSSpedizione()) {
|
||||
onComplete.run(new ArrayList<>());
|
||||
return;
|
||||
}
|
||||
|
||||
var savedMtbColt = mtbColtList.get(0);
|
||||
|
||||
sendInputDuplicate(inputNumber -> {
|
||||
var duplicateUDSRequestDTO = new DuplicateUDSRequestDTO()
|
||||
.setMtbColt(savedMtbColt)
|
||||
.setNumOfDuplicates(inputNumber);
|
||||
|
||||
this.mColliSpedizioneRESTConsumer.duplicateUDSRow(duplicateUDSRequestDTO, data -> {
|
||||
onComplete.run(data.getMtbColtList());
|
||||
}, this::sendError);
|
||||
});
|
||||
}
|
||||
|
||||
private void checkIfShouldBeDeleted(Runnable onDeleted, Runnable onContinue) {
|
||||
@ -1938,6 +1972,10 @@ public class SpedizioneViewModel {
|
||||
this.mDocumentRESTConsumer.createDocFromColli(loadCollidto, doc -> this.sendOnOrderClosed(), this::sendError);
|
||||
}
|
||||
|
||||
private void sendInputDuplicate(RunnableArgs<Integer> onComplete) {
|
||||
if (this.mListener != null) mListener.onInputDuplicate(onComplete);
|
||||
}
|
||||
|
||||
public SpedizioneViewModel setListeners(Listener listener) {
|
||||
this.mListener = listener;
|
||||
return this;
|
||||
@ -1970,6 +2008,8 @@ public class SpedizioneViewModel {
|
||||
void onChooseArtsRequest(List<MtbAart> artsList, RunnableArgs<List<MtbAart>> onComplete);
|
||||
|
||||
void onOrderClosed();
|
||||
|
||||
void onInputDuplicate(RunnableArgs<Integer> onComplete);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user