Implementato cambio deposito in Spedizione (basandosi sulla prima UDC scansionata).

Aggiornata icona app.
This commit is contained in:
2025-01-16 16:47:18 +01:00
parent cb77c21656
commit 778fdff69a
42 changed files with 324 additions and 122 deletions

View File

@@ -53,16 +53,16 @@ public class BaseActivity extends AppCompatActivity {
private void openProgress() {
BarcodeManager.disable();
//executorService.execute(() -> {
// executorService.execute(() -> {
this.mCurrentProgress.show(getSupportFragmentManager());
//});
// });
}
private void closeProgress() {
BarcodeManager.enable();
//executorService.execute(() -> {
// executorService.execute(() -> {
mCurrentProgress.dismiss();
//});
// });
}
@Override

View File

@@ -11,6 +11,7 @@ import org.jetbrains.annotations.NotNull;
import java.lang.reflect.Type;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
@@ -31,6 +32,8 @@ import it.integry.integrywmsnative.core.rest.RESTBuilder;
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.UpdateTipoULRequestDTO;
import it.integry.integrywmsnative.core.rest.model.VersamentoAutomaticoULResponseDTO;
import it.integry.integrywmsnative.core.rest.model.uds.CanULBeDeletedRequestDTO;
import it.integry.integrywmsnative.core.rest.model.uds.DeleteULRequestDTO;
@@ -404,11 +407,7 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
});
}
public void changePosizione(MtbColt mtbColtToMove, MtbDepoPosizione posizione, Runnable onComplete, RunnableArgs<Exception> onFailed) {
String codMdep = posizione.getCodMdep();
String posizioneString = posizione.getPosizione();
public void spostaUL(MtbColt mtbColtToMove, String codMdep, String posizione, boolean createDocAutomatically, Runnable onComplete, RunnableArgs<Exception> onFailed) {
MtbColt mtbColtToMoveClone = (MtbColt) mtbColtToMove.clone();
for (int i = 0; i < mtbColtToMoveClone.getMtbColr().size(); i++) {
@@ -417,26 +416,66 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
.setMtbPartitaMag(null);
}
SpostaULRequestDTO spostaUlRequestDTO = new SpostaULRequestDTO()
.setCodMdep(codMdep)
.setPosizione(posizione)
.setMtbColtsToMove(Collections.singletonList(mtbColtToMoveClone))
.setCreateDocAutomatically(createDocAutomatically);
ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = RESTBuilder.getService(ColliMagazzinoRESTConsumerService.class);
colliMagazzinoRESTConsumerService
.spostaULInPosizione(codMdep,
posizioneString,
mtbColtToMoveClone)
.enqueue(new Callback<ServiceRESTResponse<Object>>() {
.spostaUL(spostaUlRequestDTO)
.enqueue(new Callback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<Object>> call, Response<ServiceRESTResponse<Object>> response) {
analyzeAnswer(response, "changePosizione", mtbColts -> {
public void onResponse(Call<ServiceRESTResponse<Void>> call, Response<ServiceRESTResponse<Void>> response) {
analyzeAnswer(response, "spostaUL", mtbColts -> {
onComplete.run();
}, onFailed);
}
@Override
public void onFailure(Call<ServiceRESTResponse<Object>> call, Throwable t) {
public void onFailure(Call<ServiceRESTResponse<Void>> call, Throwable t) {
if (onFailed != null) onFailed.run(new Exception(t));
}
});
}
public void spostaUL(MtbColt mtbColtToMove, MtbDepoPosizione posizione, Runnable onComplete, RunnableArgs<Exception> onFailed) {
String codMdep = posizione.getCodMdep();
String posizioneString = posizione.getPosizione();
spostaUL(mtbColtToMove, codMdep, posizioneString, true, onComplete, onFailed);
}
public void updateTipoUL(MtbColt mtbColt, String codTcol, Runnable onComplete, RunnableArgs<Exception> onFailed) {
MtbColt mtbColtClone = (MtbColt) mtbColt.clone();
mtbColtClone.setMtbColr(new ObservableArrayList<>());
UpdateTipoULRequestDTO updateTipoULRequest = new UpdateTipoULRequestDTO()
.setMtbColt(mtbColtClone)
.setCodTcol(codTcol);
ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = RESTBuilder.getService(ColliMagazzinoRESTConsumerService.class);
colliMagazzinoRESTConsumerService
.updateTipoUL(updateTipoULRequest)
.enqueue(new Callback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<Void>> call, Response<ServiceRESTResponse<Void>> response) {
analyzeAnswer(response, "updateTipoUL", mtbColts -> {
onComplete.run();
}, onFailed);
}
@Override
public void onFailure(Call<ServiceRESTResponse<Void>> call, Throwable t) {
if (onFailed != null) onFailed.run(new Exception(t));
}
});
}
public void updateDataFine(MtbColt mtbColt, Runnable onComplete, RunnableArgs<Exception> onFailed) {
MtbColt cloneMtbColt = (MtbColt) mtbColt.clone();
@@ -517,14 +556,14 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = RESTBuilder.getService(ColliMagazzinoRESTConsumerService.class);
colliMagazzinoRESTConsumerService.spostaArtsTraUL(spostaArtsTraULRequestDTO).enqueue(new Callback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<Object>> call, Response<ServiceRESTResponse<Object>> response) {
public void onResponse(Call<ServiceRESTResponse<Void>> call, Response<ServiceRESTResponse<Void>> response) {
analyzeAnswer(response, "spostaArtsTraUL", data -> {
onComplete.run();
}, onFailed);
}
@Override
public void onFailure(Call<ServiceRESTResponse<Object>> call, Throwable t) {
public void onFailure(Call<ServiceRESTResponse<Void>> call, Throwable t) {
if (onFailed != null) onFailed.run(new Exception(t));
}
});

View File

@@ -7,6 +7,8 @@ import it.integry.integrywmsnative.core.model.MtbColt;
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.UpdateTipoULRequestDTO;
import it.integry.integrywmsnative.core.rest.model.VersamentoAutomaticoULResponseDTO;
import it.integry.integrywmsnative.core.rest.model.uds.CanULBeDeletedRequestDTO;
import it.integry.integrywmsnative.core.rest.model.uds.DeleteULRequestDTO;
@@ -31,11 +33,14 @@ public interface ColliMagazzinoRESTConsumerService {
@POST("creaRettificaCollo")
Call<ServiceRESTResponse<MtbColr>> creaRettificaCollo(@Query("codMdep") String codMdep, @Body RettificaULDTO rettificaULDTO);
@POST("wms/spostaULInPosizione")
Call<ServiceRESTResponse<Object>> spostaULInPosizione(@Query("codMdep") String codMdep, @Query("posizione") String posizione, @Body MtbColt mtbColtToMove);
@POST("wms/updateTipoUL")
Call<ServiceRESTResponse<Void>> updateTipoUL(@Body UpdateTipoULRequestDTO requestDto);
@POST("wms/spostaUL")
Call<ServiceRESTResponse<Void>> spostaUL(@Body SpostaULRequestDTO requestDto);
@POST("wms/spostaArtsTraUL")
Call<ServiceRESTResponse<Object>> spostaArtsTraUL(@Body SpostaArtsTraULRequestDTO spostaArtsTraULRequestDTO);
Call<ServiceRESTResponse<Void>> spostaArtsTraUL(@Body SpostaArtsTraULRequestDTO spostaArtsTraULRequestDTO);
@POST("wms/assegnaLottoSuColloScarico")
Call<ServiceRESTResponse<MtbColt>> assegnaLottoSuColloScarico(@Body MtbColt mtbColt);

View File

@@ -0,0 +1,61 @@
package it.integry.integrywmsnative.core.rest.model;
import java.util.ArrayList;
import java.util.List;
import it.integry.integrywmsnative.core.model.MtbColt;
public class SpostaULRequestDTO {
private String codMdep;
private String posizione;
private String annotazioni;
private boolean createDocAutomatically = true;
private List<MtbColt> mtbColtsToMove = new ArrayList<>();
public String getCodMdep() {
return codMdep;
}
public SpostaULRequestDTO setCodMdep(String codMdep) {
this.codMdep = codMdep;
return this;
}
public String getPosizione() {
return posizione;
}
public SpostaULRequestDTO setPosizione(String posizione) {
this.posizione = posizione;
return this;
}
public String getAnnotazioni() {
return annotazioni;
}
public SpostaULRequestDTO setAnnotazioni(String annotazioni) {
this.annotazioni = annotazioni;
return this;
}
public boolean isCreateDocAutomatically() {
return createDocAutomatically;
}
public SpostaULRequestDTO setCreateDocAutomatically(boolean createDocAutomatically) {
this.createDocAutomatically = createDocAutomatically;
return this;
}
public List<MtbColt> getMtbColtsToMove() {
return mtbColtsToMove;
}
public SpostaULRequestDTO setMtbColtsToMove(List<MtbColt> mtbColtsToMove) {
this.mtbColtsToMove = mtbColtsToMove;
return this;
}
}

View File

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

View File

@@ -143,7 +143,7 @@ public class ProdRiposizionamentoDaProdViewModel {
this.sendError(new ScannedPositionNotExistException());
} else {
if (mtbColt != null) {
mColliMagazzinoRESTConsumer.changePosizione(mtbColt, mtbDepoPosizione, () -> {
mColliMagazzinoRESTConsumer.spostaUL(mtbColt, mtbDepoPosizione, () -> {
List<MvwSitArtUdcDetInventario> mvwSitArtUdcDetInventarioList = mMvwSitArtUdcDetInventarioLiveData.getValue();
if (mvwSitArtUdcDetInventarioList != null) {

View File

@@ -855,7 +855,7 @@ public class SpedizioneViewModel {
private void loadMatchedRows(List<PickingObjectDTO> matchedRows) {
if (matchedRows == null || matchedRows.size() == 0) {
if (matchedRows == null || matchedRows.isEmpty()) {
this.sendError(new NoArtsFoundException());
} else if (matchedRows.size() == 1) {
PickingObjectDTO matchedItem = matchedRows.get(0);
@@ -898,9 +898,6 @@ public class SpedizioneViewModel {
public void dispatchOrdineRow(final PickingObjectDTO pickingObjectDTO, MtbColt refMtbColt, MtbColr refMtbColr, boolean canPartitaMagBeChanged) {
//TODO: Al posto di prelevare la prima riga bisognerebbe controllare se c'è ne una che corrisponde con la partita richiesta
// MtbColr refMtbColr = refMtbColt != null ? refMtbColt.getMtbColr().get(0) : null;
if (pickingObjectDTO.getTempPickData() != null && pickingObjectDTO.getTempPickData().getSourceMtbColt() != null && pickingObjectDTO.getTempPickData().getSourceMtbColt().getMtbColr() != null) {
@@ -1100,8 +1097,12 @@ public class SpedizioneViewModel {
BigDecimal initialQtaTot = mUseColliPedana ? initialNumCnf.multiply(initialQtaCnf) : mUseQtaOrd ? qtaColDaPrelevare : null;
MtbColt finalRefMtbColt = refMtbColt;
this.onItemDispatched(pickingObjectDTO, pickingObjectDTO.getMtbAart(), initialNumCnf, initialQtaCnf, initialQtaTot, qtaDaEvadere, numCnfDaEvadere, qtaCnfDaEvadere, qtaColDaPrelevare, numCnfDaPrelevare, qtaCnfDaPrelevare, totalQtaAvailable, totalNumCnfAvailable, qtaCnfAvailable, partitaMag, dataScad, mCanOverflowOrderQuantity, canPartitaMagBeChanged, (pickedQuantityDTO, shouldCloseLU) -> {
this.saveNewRow(pickingObjectDTO, finalRefMtbColt, pickedQuantityDTO.getNumCnf(), pickedQuantityDTO.getQtaCnf(), pickedQuantityDTO.getQtaTot(), pickedQuantityDTO.getPartitaMag(), pickedQuantityDTO.getDataScad(), shouldCloseLU);
});
}
@@ -1430,50 +1431,80 @@ public class SpedizioneViewModel {
insertUDSRowRequestDto
.setDataScad(dataScad);
this.mColliScaricoRESTConsumer.insertUDSRow(insertUDSRowRequestDto, createdMtbColr -> {
pickingObjectDTO.getWithdrawMtbColrs().add(createdMtbColr);
this.mCurrentMtbColt.getMtbColr().add(createdMtbColr);
executeDepositChangeIfNeeded(refMtbColt,
() -> executeTipoUlChangeIfNeeded(refMtbColt,
() -> this.mColliScaricoRESTConsumer.insertUDSRow(insertUDSRowRequestDto, createdMtbColr -> {
pickingObjectDTO.getWithdrawMtbColrs().add(createdMtbColr);
this.mCurrentMtbColt.getMtbColr().add(createdMtbColr);
createdMtbColr
.setUntMis(pickingObjectDTO.getMtbAart().getUntMis())
.setMtbAart(pickingObjectDTO.getMtbAart());
createdMtbColr
.setUntMis(pickingObjectDTO.getMtbAart().getUntMis())
.setMtbAart(pickingObjectDTO.getMtbAart());
if (mEnableGiacenza) {
MtbColr refMtbColr = new MtbColr()
.setCodMart(createdMtbColr.getCodMart())
.setPartitaMag(createdMtbColr.getPartitaMag())
.setCodTagl(createdMtbColr.getCodTagl())
.setCodCol(createdMtbColr.getCodCol());
if (mEnableGiacenza) {
MtbColr refMtbColr = new MtbColr()
.setCodMart(createdMtbColr.getCodMart())
.setPartitaMag(createdMtbColr.getPartitaMag())
.setCodTagl(createdMtbColr.getCodTagl())
.setCodCol(createdMtbColr.getCodCol());
if (refMtbColt != null) {
if (refMtbColt != null) {
MtbColr originalRefMtbColr = refMtbColt.getMtbColr() != null && refMtbColt.getMtbColr().size() > 0 ? refMtbColt.getMtbColr().get(0) : null;
MtbColr originalRefMtbColr = refMtbColt.getMtbColr() != null && !refMtbColt.getMtbColr().isEmpty() ? refMtbColt.getMtbColr().get(0) : null;
if (originalRefMtbColr != null) {
refMtbColr.setId(originalRefMtbColr.getId());
}
if (originalRefMtbColr != null) {
refMtbColr.setId(originalRefMtbColr.getId());
}
refMtbColr.setNumCollo(refMtbColt.getNumCollo())
.setDataCollo(refMtbColt.getDataColloS())
.setSerCollo(refMtbColt.getSerCollo())
.setGestione(refMtbColt.getGestione());
}
createdMtbColr.setRefMtbColr(refMtbColr);
}
refMtbColr.setNumCollo(refMtbColt.getNumCollo())
.setDataCollo(refMtbColt.getDataColloS())
.setSerCollo(refMtbColt.getSerCollo())
.setGestione(refMtbColt.getGestione());
}
createdMtbColr.setRefMtbColr(refMtbColr);
}
//Chiamato removeListFilter perché cosi mi cancella tutti i dati di pick temporanei
resetMatchedRows();
//Chiamato removeListFilter perché cosi mi cancella tutti i dati di pick temporanei
resetMatchedRows();
this.sendOnRowSaved();
this.sendOnLoadingEnded();
this.sendOnRowSaved();
this.sendOnLoadingEnded();
if (shouldCloseLU) requestCloseLU(shouldPrint);
if (shouldCloseLU) requestCloseLU(shouldPrint);
}, this::sendError);
}, this::sendError)));
}
private void executeDepositChangeIfNeeded(MtbColt refMtbColt, Runnable onComplete) {
//Considero solo la prima UDC scansionata
boolean shouldChangeCodMdep = refMtbColt != null && !refMtbColt.getCodMdep().equalsIgnoreCase(mCurrentMtbColt.getCodMdep()) &&
mCurrentMtbColt.getMtbColr().isEmpty();
String newCodMdep = shouldChangeCodMdep ? refMtbColt.getCodMdep() : null;
if (shouldChangeCodMdep) {
mColliMagazzinoRESTConsumer.spostaUL(mCurrentMtbColt, newCodMdep, null, false, () -> {
mCurrentMtbColt.setCodMdep(newCodMdep);
onComplete.run();
}, this::sendError);
} else onComplete.run();
}
private void executeTipoUlChangeIfNeeded(MtbColt refMtbColt, Runnable onComplete) {
boolean shouldChangeCodTcol = refMtbColt != null && refMtbColt.getCodTcol() != null &&
!refMtbColt.getCodTcol().equalsIgnoreCase(mCurrentMtbColt.getCodTcol()) &&
mCurrentMtbColt.getMtbColr().isEmpty();
String newTipoUL = shouldChangeCodTcol ? refMtbColt.getCodTcol() : null;
if (shouldChangeCodTcol) {
mColliMagazzinoRESTConsumer.updateTipoUL(mCurrentMtbColt, newTipoUL, () -> {
mCurrentMtbColt.setCodTcol(newTipoUL);
onComplete.run();
}, this::sendError);
} else onComplete.run();
}
private void saveEditedRow(MtbColr mtbColrToUpdate, BigDecimal numCnf, BigDecimal qtaCnf, BigDecimal qtaTot, String partitaMag, LocalDate dataScad, boolean shouldCloseLU) {
this.sendOnLoadingStarted();
@@ -1732,7 +1763,7 @@ public class SpedizioneViewModel {
}
private void askInfoAggiuntive(Runnable onComplete) {
if (mDefaultSegnoCol != -1 || !SettingsManager.iDB().isFlagAskInfoAggiuntiveSpedizione()) {
if (!SettingsManager.iDB().isFlagAskInfoAggiuntiveSpedizione()) {
onComplete.run();
return;
}

View File

@@ -302,7 +302,7 @@ public class VersamentoMerceViewModel {
public void updatePosizione(MtbDepoPosizione mtbDepoPosizione) {
this.sendOnLoadingStarted();
mColliMagazzinoRESTConsumer.changePosizione(mCurrentMtbColt.getValue(), mtbDepoPosizione, () -> {
mColliMagazzinoRESTConsumer.spostaUL(mCurrentMtbColt.getValue(), mtbDepoPosizione, () -> {
this.sendOnLoadingEnded();
this.sendOnDataSaved();
}, this::sendError);

View File

@@ -136,31 +136,26 @@ public class DialogSimpleMessageView extends BaseDialogFragment {
private void initContent() {
int colorBackgroundTitle = -1;
Drawable titleIconRes = null;
switch (mType) {
case INFO:
Drawable titleIconRes = switch (mType) {
case INFO -> {
colorBackgroundTitle = ContextCompat.getColor(requireContext(), R.color.colorPrimary);
titleIconRes = ResourcesCompat.getDrawable(requireContext().getResources(), R.drawable.ic_info_78dp, null);
break;
case SUCCESS:
yield ResourcesCompat.getDrawable(requireContext().getResources(), R.drawable.ic_info_78dp, null);
}
case SUCCESS -> {
colorBackgroundTitle = ContextCompat.getColor(requireContext(), R.color.green_300);
titleIconRes = ResourcesCompat.getDrawable(requireContext().getResources(), R.drawable.ic_done_white_24dp, null);
break;
case WARNING:
yield ResourcesCompat.getDrawable(requireContext().getResources(), R.drawable.ic_done_white_24dp, null);
}
case WARNING -> {
colorBackgroundTitle = ContextCompat.getColor(requireContext(), R.color.yellow_600);
titleIconRes = ResourcesCompat.getDrawable(requireContext().getResources(), R.drawable.ic_warning_white_24dp, null);
break;
case ERROR:
yield ResourcesCompat.getDrawable(requireContext().getResources(), R.drawable.ic_warning_white_24dp, null);
}
case ERROR -> {
colorBackgroundTitle = ContextCompat.getColor(requireContext(), R.color.red_300);
titleIconRes = ResourcesCompat.getDrawable(requireContext().getResources(), R.drawable.ic_mood_bad_24dp, null);
break;
}
yield ResourcesCompat.getDrawable(requireContext().getResources(), R.drawable.ic_mood_bad_24dp, null);
}
};
this.positiveButtonText = requireContext().getText(R.string.ok).toString();
this.positiveButtonText = requireContext().getText(mOnNegativeClick != null ? R.string.yes : R.string.ok).toString();
this.negativeButtonText = requireContext().getText(R.string.no).toString();
//Title VIEW