Permettere la duplicazione delle uds

This commit is contained in:
Marco Elefante 2024-06-21 17:55:37 +02:00
parent a5a9cb1c50
commit da301ec6b2
11 changed files with 157 additions and 38 deletions

View File

@ -114,7 +114,6 @@ public class ColliAccettazioneRESTConsumer extends _BaseRESTConsumer implements
}); });
} }
@Override
public void checkBarcodeUl(String barcodeUl, RunnableArgs<Boolean> onComplete, RunnableArgs<Exception> onFailed){ public void checkBarcodeUl(String barcodeUl, RunnableArgs<Boolean> onComplete, RunnableArgs<Exception> onFailed){
ColliAccettazioneRESTConsumerService colliAccettazioneRESTConsumerService = RESTBuilder.getService(ColliAccettazioneRESTConsumerService.class); ColliAccettazioneRESTConsumerService colliAccettazioneRESTConsumerService = RESTBuilder.getService(ColliAccettazioneRESTConsumerService.class);

View File

@ -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));
}
});
}
} }

View File

@ -1,5 +1,7 @@
package it.integry.integrywmsnative.core.rest.consumers; package it.integry.integrywmsnative.core.rest.consumers;
import androidx.annotation.NonNull;
import javax.inject.Singleton; import javax.inject.Singleton;
import it.integry.integrywmsnative.core.expansion.RunnableArgs; 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.CreateUDSRequestDTO;
import it.integry.integrywmsnative.core.rest.model.uds.CreateUDSResponseDTO; 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.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.EditUDSRowRequestDTO;
import it.integry.integrywmsnative.core.rest.model.uds.EditUDSRowResponseDTO; import it.integry.integrywmsnative.core.rest.model.uds.EditUDSRowResponseDTO;
import it.integry.integrywmsnative.core.rest.model.uds.InsertUDSRowRequestDTO; 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());
}
});
}
} }

View File

@ -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.CreateUDSRequestDTO;
import it.integry.integrywmsnative.core.rest.model.uds.CreateUDSResponseDTO; 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.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.EditUDSRowRequestDTO;
import it.integry.integrywmsnative.core.rest.model.uds.EditUDSRowResponseDTO; import it.integry.integrywmsnative.core.rest.model.uds.EditUDSRowResponseDTO;
import it.integry.integrywmsnative.core.rest.model.uds.InsertUDSRowRequestDTO; import it.integry.integrywmsnative.core.rest.model.uds.InsertUDSRowRequestDTO;
@ -35,4 +37,7 @@ public interface ColliSpedizioneRESTConsumerService {
@POST("wms/spedizione/deleteUDSRow") @POST("wms/spedizione/deleteUDSRow")
Call<ServiceRESTResponse<Void>> deleteUDSRow(@Body DeleteUDSRowRequestDTO deleteUDSRowRequestDTO); Call<ServiceRESTResponse<Void>> deleteUDSRow(@Body DeleteUDSRowRequestDTO deleteUDSRowRequestDTO);
@POST("wms/spedizione/duplicateUDSRow")
Call<ServiceRESTResponse<DuplicateUDSResponseDTO>> duplicateUDSRow(@Body DuplicateUDSRequestDTO duplicateUDSRequestDTO);
} }

View File

@ -21,6 +21,4 @@ public interface ColliCaricoRESTConsumerInterface {
void editUDCRow(EditUDCRowRequestDTO editUDCRowRequestDTO, RunnableArgs<MtbColr> onComplete, RunnableArgs<Exception> onFailed); void editUDCRow(EditUDCRowRequestDTO editUDCRowRequestDTO, RunnableArgs<MtbColr> onComplete, RunnableArgs<Exception> onFailed);
void deleteUDCRow(DeleteUDCRowRequestDTO deleteUDCRequestDTO, Runnable onComplete, RunnableArgs<Exception> onFailed); void deleteUDCRow(DeleteUDCRowRequestDTO deleteUDCRequestDTO, Runnable onComplete, RunnableArgs<Exception> onFailed);
void checkBarcodeUl(String barcodeUl, RunnableArgs<Boolean> onComplete, RunnableArgs<Exception> onFailed);
} }

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -79,6 +79,7 @@ public class DBSettingsModel {
private boolean flagTracciamentoImballiCaricoEnabled = false; private boolean flagTracciamentoImballiCaricoEnabled = false;
private boolean flagTracciamentoImballiScaricoEnabled = false; private boolean flagTracciamentoImballiScaricoEnabled = false;
private boolean flagPickingLiberoEnableScanArt = false; private boolean flagPickingLiberoEnableScanArt = false;
private boolean flagAskDuplicateUDSSpedizione = false;
public boolean isFlagSpedizioneEnableFakeGiacenza() { public boolean isFlagSpedizioneEnableFakeGiacenza() {
return flagSpedizioneEnableFakeGiacenza; return flagSpedizioneEnableFakeGiacenza;
@ -664,4 +665,13 @@ public class DBSettingsModel {
this.flagPickingLiberoEnableScanArt = flagPickingLiberoEnableScanArt; this.flagPickingLiberoEnableScanArt = flagPickingLiberoEnableScanArt;
return this; return this;
} }
public boolean isFlagAskDuplicateUDSSpedizione() {
return flagAskDuplicateUDSSpedizione;
}
public DBSettingsModel setFlagAskDuplicateUDSSpedizione(boolean flagAskDuplicateUDSSpedizione) {
this.flagAskDuplicateUDSSpedizione = flagAskDuplicateUDSSpedizione;
return this;
}
} }

View File

@ -388,6 +388,11 @@ public class SettingsManager {
.setSection("SPEDIZIONE") .setSection("SPEDIZIONE")
.setKeySection("FLAG_ASK_INFO_AGGIUNTIVE") .setKeySection("FLAG_ASK_INFO_AGGIUNTIVE")
.setSetter(dbSettingsModelIstance::setFlagAskInfoAggiuntiveSpedizione)); .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) stbGestSetupReaderList.add(new StbGestSetupReader<>(String.class)
.setGestName("PICKING") .setGestName("PICKING")
.setSection("SPEDIZIONE") .setSection("SPEDIZIONE")

View File

@ -1072,4 +1072,16 @@ public class SpedizioneActivity extends BaseActivity implements SpedizioneViewMo
DialogInfoAggiuntiveLUView.newInstance(mtbColt, onComplete, this::onLoadingEnded) DialogInfoAggiuntiveLUView.newInstance(mtbColt, onComplete, this::onLoadingEnded)
.show(getSupportFragmentManager(), DialogInfoAggiuntiveLUView.class.getName()); .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();
}
} }

View File

@ -1,5 +1,6 @@
package it.integry.integrywmsnative.gest.spedizione; package it.integry.integrywmsnative.gest.spedizione;
import androidx.annotation.IntegerRes;
import androidx.databinding.ObservableArrayList; import androidx.databinding.ObservableArrayList;
import androidx.lifecycle.MutableLiveData; import androidx.lifecycle.MutableLiveData;
@ -13,6 +14,7 @@ import java.util.List;
import java.util.Objects; import java.util.Objects;
import java.util.Optional; import java.util.Optional;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import java.util.stream.Stream;
import javax.inject.Inject; 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.CreateUDSRequestOrderDTO;
import it.integry.integrywmsnative.core.rest.model.uds.DeleteUDSRowRequestDTO; 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.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.EditUDSRowRequestDTO;
import it.integry.integrywmsnative.core.rest.model.uds.InsertUDSRowRequestDTO; import it.integry.integrywmsnative.core.rest.model.uds.InsertUDSRowRequestDTO;
import it.integry.integrywmsnative.core.rest.model.uds.PrintULRequestDTO; import it.integry.integrywmsnative.core.rest.model.uds.PrintULRequestDTO;
@ -1549,6 +1552,10 @@ public class SpedizioneViewModel {
this.closeLU(generatedMtbColts -> { this.closeLU(generatedMtbColts -> {
this.duplicateUDS(generatedMtbColts, duplicatedMtbColts -> {
generatedMtbColts.addAll(duplicatedMtbColts);
this.mColliMagazzinoRESTConsumer.fillMtbAartsOfMtbColts(generatedMtbColts, filledMtbColts -> { this.mColliMagazzinoRESTConsumer.fillMtbAartsOfMtbColts(generatedMtbColts, filledMtbColts -> {
this.askPositionChange( this.askPositionChange(
@ -1573,7 +1580,7 @@ public class SpedizioneViewModel {
}, this::sendError); }, this::sendError);
}); });
});
}); });
}); });
}); });
@ -1596,8 +1603,35 @@ public class SpedizioneViewModel {
this.mColliScaricoRESTConsumer.closeUDS(closeUDSRequestDto, closeResponse -> { this.mColliScaricoRESTConsumer.closeUDS(closeUDSRequestDto, closeResponse -> {
onComplete.run(closeResponse.getGeneratedMtbColts()); onComplete.run(closeResponse.getGeneratedMtbColts());
}, this::sendError); }, 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) { private void checkIfShouldBeDeleted(Runnable onDeleted, Runnable onContinue) {
@ -1938,6 +1972,10 @@ public class SpedizioneViewModel {
this.mDocumentRESTConsumer.createDocFromColli(loadCollidto, doc -> this.sendOnOrderClosed(), this::sendError); 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) { public SpedizioneViewModel setListeners(Listener listener) {
this.mListener = listener; this.mListener = listener;
return this; return this;
@ -1970,6 +2008,8 @@ public class SpedizioneViewModel {
void onChooseArtsRequest(List<MtbAart> artsList, RunnableArgs<List<MtbAart>> onComplete); void onChooseArtsRequest(List<MtbAart> artsList, RunnableArgs<List<MtbAart>> onComplete);
void onOrderClosed(); void onOrderClosed();
void onInputDuplicate(RunnableArgs<Integer> onComplete);
} }
} }