Implementato servizio di changePosizione

This commit is contained in:
Giuseppe Scorrano 2025-04-01 16:52:17 +02:00
parent 184d1f759c
commit 68bf6767b9
6 changed files with 80 additions and 38 deletions

View File

@ -38,6 +38,7 @@ import it.integry.integrywmsnative.core.rest.model.RettificaULDTO;
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
import it.integry.integrywmsnative.core.rest.model.SpostaArtsTraULRequestDTO;
import it.integry.integrywmsnative.core.rest.model.SpostaULRequestDTO;
import it.integry.integrywmsnative.core.rest.model.UpdatePosizioneULRequestDTO;
import it.integry.integrywmsnative.core.rest.model.UpdateTipoULRequestDTO;
import it.integry.integrywmsnative.core.rest.model.VersamentoAutomaticoULResponseDTO;
import it.integry.integrywmsnative.core.rest.model.uds.CanULBeDeletedRequestDTO;
@ -113,36 +114,6 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
return this.mEntityRESTConsumer.processEntityListSynchronized(mtbColtsToSave, true, MtbColt.class);
}
public void saveColli(List<MtbColt> mtbColtsToSave, RunnableArgs<List<MtbColt>> onComplete, RunnableArgs<Exception> onFailed) {
for (MtbColt mtbColt : mtbColtsToSave) {
for (int i = 0; i < mtbColt.getMtbColr().size(); i++) {
mtbColt.getMtbColr().get(i)
.setMtbAart(null)
.setMtbPartitaMag(null);
}
}
this.mEntityRESTConsumer.processEntityList(mtbColtsToSave, true, MtbColt.class, onComplete, onFailed);
}
public void createColloLavorazione(int segno, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
MtbColt mtbColtToCreate = new MtbColt()
.setSegno(segno);
mtbColtToCreate.initDefaultFields(GestioneEnum.LAVORAZIONE);
mtbColtToCreate
.setOperation(CommonModelConsts.OPERATION.INSERT);
saveCollo(mtbColtToCreate, value -> {
if (onComplete != null) onComplete.run(value);
}, ex -> {
if (onFailed != null) onFailed.run(ex);
});
}
public void createColloScaricoDaCarico(MtbColt sourceMtbColt, MtbDepoPosizione posizione, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
@ -545,6 +516,35 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
});
}
public void updatePosizioneULSynchronized(MtbColt mtbColt, String posizione) throws Exception {
MtbColt mtbColtClone = (MtbColt) mtbColt.clone();
mtbColtClone.setMtbColr(new ObservableArrayList<>());
UpdatePosizioneULRequestDTO updateTipoULRequest = new UpdatePosizioneULRequestDTO()
.setMtbColt(mtbColtClone)
.setPosizione(posizione);
ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = restBuilder.getService(ColliMagazzinoRESTConsumerService.class);
Response<ServiceRESTResponse<Void>> response = colliMagazzinoRESTConsumerService
.updatePosizioneUL(updateTipoULRequest)
.execute();
analyzeAnswer(response, "updatePosizioneUL");
}
public void updatePosizioneUL(MtbColt mtbColt, String posizione, Runnable onComplete, RunnableArgs<Exception> onFailed) {
executorService.execute(() -> {
try {
updatePosizioneULSynchronized(mtbColt, posizione);
if (onComplete != null) onComplete.run();
} catch (Exception ex) {
if (onFailed != null) onFailed.run(ex);
}
});
}
public void updateDataFine(MtbColt mtbColt, Runnable onComplete, RunnableArgs<Exception> onFailed) {
MtbColt cloneMtbColt = (MtbColt) mtbColt.clone();

View File

@ -9,6 +9,7 @@ import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
import it.integry.integrywmsnative.core.rest.model.SpostaArtsTraULRequestDTO;
import it.integry.integrywmsnative.core.rest.model.SpostaArtsTraULResponseDTO;
import it.integry.integrywmsnative.core.rest.model.SpostaULRequestDTO;
import it.integry.integrywmsnative.core.rest.model.UpdatePosizioneULRequestDTO;
import it.integry.integrywmsnative.core.rest.model.UpdateTipoULRequestDTO;
import it.integry.integrywmsnative.core.rest.model.VersamentoAutomaticoULResponseDTO;
import it.integry.integrywmsnative.core.rest.model.uds.CanULBeDeletedRequestDTO;
@ -37,6 +38,9 @@ public interface ColliMagazzinoRESTConsumerService {
@POST("wms/updateTipoUL")
Call<ServiceRESTResponse<Void>> updateTipoUL(@Body UpdateTipoULRequestDTO requestDto);
@POST("wms/updatePosizioneUL")
Call<ServiceRESTResponse<Void>> updatePosizioneUL(@Body UpdatePosizioneULRequestDTO requestDto);
@POST("wms/spostaUL")
Call<ServiceRESTResponse<Void>> spostaUL(@Body SpostaULRequestDTO requestDto);

View File

@ -0,0 +1,27 @@
package it.integry.integrywmsnative.core.rest.model;
import it.integry.integrywmsnative.core.model.MtbColt;
public class UpdatePosizioneULRequestDTO {
private MtbColt mtbColt;
private String posizione;
public MtbColt getMtbColt() {
return mtbColt;
}
public UpdatePosizioneULRequestDTO setMtbColt(MtbColt mtbColt) {
this.mtbColt = mtbColt;
return this;
}
public String getPosizione() {
return posizione;
}
public UpdatePosizioneULRequestDTO setPosizione(String posizione) {
this.posizione = posizione;
return this;
}
}

View File

@ -2,7 +2,6 @@ package it.integry.integrywmsnative.core.utility;
import android.graphics.Bitmap;
import com.annimon.stream.Stream;
import com.google.zxing.BarcodeFormat;
import com.google.zxing.EncodeHintType;
import com.google.zxing.MultiFormatWriter;
@ -12,6 +11,7 @@ import com.journeyapps.barcodescanner.BarcodeEncoder;
import java.util.Calendar;
import java.util.HashMap;
import java.util.Map;
import java.util.stream.Stream;
import it.integry.barcode_base_android_library.model.BarcodeScanDTO;
import it.integry.barcode_base_android_library.model.BarcodeType;
@ -61,7 +61,7 @@ public class UtilityBarcode {
boolean isPosizione = false;
if (SettingsManager.iDB().getAvailablePosizioni() != null) {
Stream<MtbDepoPosizione> tmpStream = Stream.of(SettingsManager.iDB().getAvailablePosizioni())
Stream<MtbDepoPosizione> tmpStream = SettingsManager.iDB().getAvailablePosizioni().stream()
.filter(x -> x.getPosizione().equalsIgnoreCase(barcode) && (!enableCheckCodMdep || currentCodMdep.equalsIgnoreCase(x.getCodMdep())));
if (tmpStream.count() > 0) {

View File

@ -475,9 +475,10 @@ public class RettificaGiacenzeViewModel {
MtbColt cloneMtbColt = (MtbColt) mCurrentMtbColt.clone();
cloneMtbColt.setOperation(CommonModelConsts.OPERATION.UPDATE);
cloneMtbColt.setMtbColr(null);
cloneMtbColt.setPosizione(mtbDepoPosizione != null ? mtbDepoPosizione.getPosizione() : CommonModelConsts.ENTITY_NULL_STRING);
this.mColliMagazzinoRESTConsumer.saveCollo(cloneMtbColt, mtbColt -> onComplete.run(), this::sendError);
this.mColliMagazzinoRESTConsumer.updatePosizioneUL(cloneMtbColt, mtbDepoPosizione != null ? mtbDepoPosizione.getPosizione() : CommonModelConsts.ENTITY_NULL_STRING,
onComplete,
this::sendError);
}
private void postSaveBehaviour(Runnable onComplete) {

View File

@ -4,6 +4,7 @@ import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.os.Bundle;
import android.os.Handler;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.LayoutInflater;
@ -43,6 +44,10 @@ public class DialogAskPositionOfLUView extends BaseDialogFragment {
@Inject
DialogAskPositionOfLUViewModel mViewModel;
@Inject
Handler handler;
private DialogAskPositionOfLuBinding mBindings;
private DialogAskPositionOfLUAdapter viewpagerAdapter;
private Context mContext;
@ -201,12 +206,17 @@ public class DialogAskPositionOfLUView extends BaseDialogFragment {
} else {
BarcodeManager.enable(mBarcodeScannerInstanceID);
handler.post(() -> {
Toast.makeText(requireContext(), "Barcode non riconosciuto", Toast.LENGTH_SHORT)
.show();
});
}
} else {
handler.post(() -> {
Toast.makeText(requireContext(), "Barcode non riconosciuto", Toast.LENGTH_SHORT)
.show();
});
BarcodeManager.enable(mBarcodeScannerInstanceID);
}
};