Gestite anomalie ul in VersamentoMerce e Spedizione

This commit is contained in:
2025-12-09 12:34:13 +01:00
parent f612e1c402
commit cc89441f0a
11 changed files with 155 additions and 78 deletions

View File

@@ -0,0 +1,9 @@
package it.integry.integrywmsnative.core.exception;
import it.integry.integrywmsnative.core.rest.model.giacenza.GetColloInGiacResponseDTO;
public class AnomaliaUlException extends RuntimeException {
public AnomaliaUlException(GetColloInGiacResponseDTO colloInGiac) {
super(String.format("%s: %s", colloInGiac.getDescrizioneLivelloAnomalia(), colloInGiac.getDescrizioneAnomalia()));
}
}

View File

@@ -16,6 +16,7 @@ import it.integry.integrywmsnative.core.expansion.RunnableArgs;
import it.integry.integrywmsnative.core.interfaces.viewmodel_listeners.ILoadingListener;
import it.integry.integrywmsnative.core.model.MtbColt;
import it.integry.integrywmsnative.core.rest.consumers.ColliMagazzinoRESTConsumer;
import it.integry.integrywmsnative.core.rest.model.giacenza.GetColloInGiacResponseDTO;
public class ListaBancaliViewModel {
@@ -57,7 +58,8 @@ public class ListaBancaliViewModel {
.map(MtbColt::getBarcodeUl)
.collect(Collectors.toUnmodifiableList());
return mColliMagazzinoRESTConsumer.getBySsccListSynchronized(ssccList, onlyResiduo, false);
var bySsccListSynchronized = mColliMagazzinoRESTConsumer.getBySsccListSynchronized(ssccList, onlyResiduo, false);
return bySsccListSynchronized.stream().map(GetColloInGiacResponseDTO::getMtbColt).toList();
}
private void sendOnLoadingStarted() {

View File

@@ -774,12 +774,12 @@ public class SpedizioneActivity extends BaseActivity implements SpedizioneViewMo
public void addExtraItem() {
handler.post(() -> {
DialogScanArtView
.newInstance(!mEnableFakeGiacenza, (status, mtbAart, ean128Model, mtbColt) -> {
.newInstance(!mEnableFakeGiacenza, (status, mtbAart, ean128Model, colloInGiac) -> {
if (status == DialogConsts.Results.YES) {
executorService.execute(() -> {
try {
this.mViewmodel.dispatchExtraItem(mtbAart, ean128Model, mtbColt);
this.mViewmodel.dispatchExtraItem(mtbAart, ean128Model, colloInGiac);
} catch (Exception e) {
onError(e);
}
@@ -1033,6 +1033,15 @@ public class SpedizioneActivity extends BaseActivity implements SpedizioneViewMo
});
}
@Override
public void onWarning(String warningText, Runnable action) {
handler.post(() -> {
DialogSimpleMessageView
.makeWarningDialog(this, new SpannableString(Html.fromHtml(warningText)), null, action)
.show();
});
}
@Override
public void onFullItemDispatched(PickingObjectDTO pickingObjectDTO,
MtbAart mtbAart,

View File

@@ -27,6 +27,7 @@ import javax.inject.Inject;
import it.integry.barcode_base_android_library.model.BarcodeScanDTO;
import it.integry.integrywmsnative.core.CommonConst;
import it.integry.integrywmsnative.core.data_recover.ColliDataRecoverService;
import it.integry.integrywmsnative.core.exception.AnomaliaUlException;
import it.integry.integrywmsnative.core.exception.EmptyLUException;
import it.integry.integrywmsnative.core.exception.InvalidCodMdepException;
import it.integry.integrywmsnative.core.exception.InvalidLUException;
@@ -71,9 +72,11 @@ import it.integry.integrywmsnative.core.rest.consumers.interfaces.ColliScaricoRE
import it.integry.integrywmsnative.core.rest.model.CriterioDistribuzioneEnum;
import it.integry.integrywmsnative.core.rest.model.Ean128Model;
import it.integry.integrywmsnative.core.rest.model.Ean13PesoModel;
import it.integry.integrywmsnative.core.rest.model.GetColliByBarcodesRequestDTO;
import it.integry.integrywmsnative.core.rest.model.LoadColliDTO;
import it.integry.integrywmsnative.core.rest.model.OrdineUscitaInevasoDTO;
import it.integry.integrywmsnative.core.rest.model.SitArtOrdDTO;
import it.integry.integrywmsnative.core.rest.model.giacenza.GetColloInGiacResponseDTO;
import it.integry.integrywmsnative.core.rest.model.imballi.ImballoQuantityDTO;
import it.integry.integrywmsnative.core.rest.model.magazzino_automatico.MagazzinoAutomaticoPickItemRequestDTO;
import it.integry.integrywmsnative.core.rest.model.magazzino_automatico.MagazzinoAutomaticoPickItemsRequestDTO;
@@ -615,7 +618,9 @@ public class SpedizioneViewModel {
throw new NoLUFoundException();
}
var mtbColt = mColliMagazzinoRESTConsumer.getBySsccSynchronized(barcodeUlInPosizioneList.get(0), true, false);
var response = mColliMagazzinoRESTConsumer.getBySsccSynchronized(barcodeUlInPosizioneList.get(0), true, false);
this.checkAnomaliaUl(response);
var mtbColt = response.getMtbColt();
if (mtbColt.getSegno() != mDefaultSegnoCol) {
throw new InvalidLUException();
@@ -660,7 +665,9 @@ public class SpedizioneViewModel {
private void executeEtichettaAnonimaNotOpenedLU(BarcodeScanDTO barcodeScanDTO) throws Exception {
var mtbColt = mColliMagazzinoRESTConsumer.getBySsccSynchronized(barcodeScanDTO.getStringValue(), true, false);
var response = mColliMagazzinoRESTConsumer.getBySsccSynchronized(barcodeScanDTO.getStringValue(), true, false);
this.checkAnomaliaUl(response);
var mtbColt = response.getMtbColt();
if (mtbColt == null) {
if (!UtilityBarcode.isEtichettaAnonimaOfCurrentYear(barcodeScanDTO.getStringValue())) {
@@ -710,7 +717,9 @@ public class SpedizioneViewModel {
throw new NoLUFoundException();
}
var mtbColt = mColliMagazzinoRESTConsumer.getBySsccSynchronized(barcodeUlInPosizioneList.get(0), true, false);
var response = mColliMagazzinoRESTConsumer.getBySsccSynchronized(barcodeUlInPosizioneList.get(0), true, false);
this.checkAnomaliaUl(response);
var mtbColt = response.getMtbColt();
if (mtbColt != null && mtbColt.getMtbColr() != null && !mtbColt.getMtbColr().isEmpty()) {
@@ -727,7 +736,9 @@ public class SpedizioneViewModel {
}
private void executeEtichettaLU(String SSCC) throws Exception {
var mtbColt = mColliMagazzinoRESTConsumer.getBySsccSynchronized(SSCC, true, false);
var response = mColliMagazzinoRESTConsumer.getBySsccSynchronized(SSCC, true, false);
this.checkAnomaliaUl(response);
var mtbColt = response.getMtbColt();
if (mtbColt != null && mtbColt.getMtbColr() != null && !mtbColt.getMtbColr().isEmpty()) {
if (mtbColt.getSegno() != -1) {
@@ -896,10 +907,10 @@ public class SpedizioneViewModel {
for (PickingObjectDTO pickingObject : pickingList) {
//Da verificare se il controllo per partita deve essere sempre effettuato
if (UtilityString.equalsIgnoreCase(x.getCodMart(), pickingObject.getSitArtOrdDTO().getCodMart()) &&
UtilityString.equalsIgnoreCase(x.getCodTagl(), pickingObject.getSitArtOrdDTO().getCodTagl()) &&
UtilityString.equalsIgnoreCase(x.getCodCol(), pickingObject.getSitArtOrdDTO().getCodCol()) &&
(!mEnableCheckPartitaMag || UtilityString.equalsIgnoreCase(x.getPartitaMag(), pickingObject.getSitArtOrdDTO().getPartitaMag()) || UtilityString.isNullOrEmpty(pickingObject.getSitArtOrdDTO().getPartitaMag()))) {
if (UtilityString.equalsIgnoreCase(x.getCodMart(), pickingObject.getSitArtOrdDTO().getCodMart()) &&
UtilityString.equalsIgnoreCase(x.getCodTagl(), pickingObject.getSitArtOrdDTO().getCodTagl()) &&
UtilityString.equalsIgnoreCase(x.getCodCol(), pickingObject.getSitArtOrdDTO().getCodCol()) &&
(!mEnableCheckPartitaMag || UtilityString.equalsIgnoreCase(x.getPartitaMag(), pickingObject.getSitArtOrdDTO().getPartitaMag()) || UtilityString.isNullOrEmpty(pickingObject.getSitArtOrdDTO().getPartitaMag()))) {
if (!matchPickingObject.contains(pickingObject)) {
matchPickingObject.add(pickingObject);
@@ -1282,7 +1293,8 @@ public class SpedizioneViewModel {
return !stati.isEmpty() ? stati.get(0) : null;
}
public void dispatchExtraItem(MtbAart mtbAart, Ean128Model ean128Model, MtbColt refMtbColt) throws Exception {
public void dispatchExtraItem(MtbAart mtbAart, Ean128Model ean128Model, GetColloInGiacResponseDTO colloInGiac) throws Exception {
this.checkAnomaliaUl(colloInGiac);
PickingObjectDTO pickingObjectDTO = new PickingObjectDTO().setMtbAart(mtbAart).setTempPickData(PickDataDTO.fromEan128(ean128Model));
@@ -1301,7 +1313,7 @@ public class SpedizioneViewModel {
String partitaMag = null;
LocalDate dataScad = null;
// MtbColt refMtbColt = null;
MtbColt refMtbColt = colloInGiac.getMtbColt();
if (refMtbColt != null && refMtbColt.getMtbColr() != null && !refMtbColt.getMtbColr().isEmpty()) {
MtbColr mtbColrToUse = refMtbColt.getMtbColr().get(0);
@@ -1525,7 +1537,7 @@ public class SpedizioneViewModel {
private MtbColt loadRifULFromMtbColr(MtbColr mtbColr) throws Exception {
//Se ho dei riferimenti ad una UL devo leggere la QTA ancora disponibile sulla Ul
if (mtbColr != null && !UtilityString.isNullOrEmpty(mtbColr.getGestioneRif()) && !UtilityString.isNullOrEmpty(mtbColr.getSerColloRif()) && !UtilityString.isNullOrEmpty(mtbColr.getDataColloRifS()) && mtbColr.getNumColloRif() != null) {
return mColliMagazzinoRESTConsumer.getBySsccSynchronized(mtbColr.getBarcodeUlOut(), true, false);
return mColliMagazzinoRESTConsumer.getBySsccSynchronized(mtbColr.getBarcodeUlOut(), true, false).getMtbColt();
}
return null;
}
@@ -1867,6 +1879,16 @@ public class SpedizioneViewModel {
return closeResponse.getGeneratedMtbColts();
}
private void checkAnomaliaUl(GetColloInGiacResponseDTO colloInGiac) {
if (colloInGiac.getEscludiPickingLavorazione() && mDefaultGestioneOfUL == GestioneEnum.LAVORAZIONE) {
this.sendError(new AnomaliaUlException(colloInGiac));
} else if (colloInGiac.getEscludiPickingVendita() && mDefaultGestioneOfUL == GestioneEnum.VENDITA) {
this.sendError(new AnomaliaUlException(colloInGiac));
} else {
this.onWarning(colloInGiac.getMessageAnomalia(), () -> {});
}
}
private List<MtbColt> validateTheUdsToBeDuplicated(List<MtbColt> mtbColtList) throws Exception {
var clonedLu = (MtbColt) this.mCurrentMtbColt.clone();
@@ -2077,7 +2099,7 @@ public class SpedizioneViewModel {
private void moveLUtoLU(List<MtbColt> sourceMtbColts, String destBarcodeUl) throws Exception {
for (MtbColt sourceMtbColt : sourceMtbColts) {
if(mIsApprovLinee) {
if (mIsApprovLinee) {
//Scambio i campi barcode_ul_in e barcode_ul_out per far funzionare il posizionamento dell'L+
sourceMtbColt.getMtbColr()
.forEach(x -> {
@@ -2354,8 +2376,11 @@ public class SpedizioneViewModel {
return this;
}
public interface Listener extends ILUPrintListener, ILoadingListener, ILUBaseOperationsListener {
private void onWarning(String warningText, Runnable action) {
if (mListener != null) mListener.onWarning(warningText, action);
}
public interface Listener extends ILUPrintListener, ILoadingListener, ILUBaseOperationsListener {
void onLUPesoRequired(String codTcol, BigDecimal netWeightKG, BigDecimal grossWeightKG, RunnableArgsss<String, BigDecimal, BigDecimal> onComplete);
void onFilterApplied(String newValue);
@@ -2364,6 +2389,8 @@ public class SpedizioneViewModel {
void onError(Exception ex, boolean useSnackbar);
void onWarning(String warningText, Runnable action);
void onFullItemDispatched(PickingObjectDTO pickingObjectDTO, MtbAart mtbAart, BigDecimal initialNumCnf, BigDecimal initialQtaCnf, BigDecimal initialQtaTot, BigDecimal totalQtaOrd, BigDecimal totalNumCnfOrd, BigDecimal qtaCnfOrd, BigDecimal totalQtaToBeTaken, BigDecimal totalNumCnfToBeTaken, BigDecimal qtaCnfToBeTaken, BigDecimal totalQtaAvailable, BigDecimal totalNumCnfAvailable, BigDecimal qtaCnfAvailable, String partitaMag, LocalDate dataScad, boolean canOverflowOrderQuantity, boolean canBatchLotBeChanged, RunnableArgs<PickedQuantityDTO> onComplete, Runnable onAbort);
void onInfoAggiuntiveRequired(MtbColt currentMtbColt, RunnableArgss<String, ObservableMtbTcol> onComplete);

View File

@@ -74,7 +74,7 @@ public class UltimiArriviFornitoreViewModel {
private void executeEtichettaLU(String SSCC) throws Exception {
var mtbColt = this.mColliMagazzinoRESTConsumer.getBySsccSynchronized(SSCC, true, false);
var mtbColt = this.mColliMagazzinoRESTConsumer.getBySsccSynchronized(SSCC, true, false).getMtbColt();
if (mtbColt != null && mtbColt.getMtbColr() != null && !mtbColt.getMtbColr().isEmpty()) {
if (mtbColt.getSegno() > 0) {

View File

@@ -146,8 +146,18 @@ public class VersamentoMerceFragment extends BaseFragment implements ITitledFrag
public void openLU() {
DialogScanOrCreateLUView.newInstance(true, false, true, false, true, scanOrCreateResult -> {
var colloInGiac = scanOrCreateResult.getColloInGiac();
var mtbColt = scanOrCreateResult.getMtbColt();
if (colloInGiac.getMessageAnomalia() != null) {
DialogSimpleMessageView.makeWarningDialog(requireContext(),
new SpannableString(
Html.fromHtml(colloInGiac.getMessageAnomalia())),
null, () -> {
}
).show();
}
if (scanOrCreateResult.isAborted() || scanOrCreateResult.getMtbColt() == null) {
((IPoppableActivity) getActivity()).pop();
} else if (((mtbColt.getGestioneEnum() == GestioneEnum.ACQUISTO || mtbColt.getGestioneEnum() == GestioneEnum.LAVORAZIONE) && mtbColt.getSegno().equals(+1)) ||
@@ -156,7 +166,7 @@ public class VersamentoMerceFragment extends BaseFragment implements ITitledFrag
executorService.execute(() -> {
this.onLoadingStarted();
try {
mViewModel.initUL(mtbColt);
mViewModel.initUL(colloInGiac);
this.onLoadingEnded();
} catch (Exception e) {
this.onError(e);

View File

@@ -37,6 +37,7 @@ import it.integry.integrywmsnative.core.rest.consumers.ColliLavorazioneRESTConsu
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.giacenza.GetColloInGiacResponseDTO;
import it.integry.integrywmsnative.core.rest.model.magazzino_automatico.MagazzinoAutomaticoPutItemsRequestDTO;
import it.integry.integrywmsnative.core.rest.model.udc.CreateUDCRequestDTO;
import it.integry.integrywmsnative.core.settings.SettingsManager;
@@ -50,6 +51,7 @@ import it.integry.integrywmsnative.gest.spedizione.model.PickedQuantityDTO;
public class VersamentoMerceViewModel {
private final MutableLiveData<MtbColt> mCurrentMtbColt = new MutableLiveData<>();
private final MutableLiveData<GetColloInGiacResponseDTO> mCurrentMtbColtWithAnomalia = new MutableLiveData<>();
private final MutableLiveData<List<SuggestedULPositionDTO>> mSuggestedULPositions = new MutableLiveData<>();
private Listener mListener;
@@ -69,16 +71,17 @@ public class VersamentoMerceViewModel {
this.mMagazzinoAutomaticoRESTConsumer = mMagazzinoAutomaticoRESTConsumer;
}
public void initUL(MtbColt mtbColt) throws Exception {
this.mCurrentMtbColt.postValue(mtbColt);
public void initUL(GetColloInGiacResponseDTO response) throws Exception {
this.mCurrentMtbColtWithAnomalia.postValue(response);
this.mCurrentMtbColt.postValue(response.getMtbColt());
refreshSuggestedULPositions(mtbColt);
refreshSuggestedULPositions(response.getMtbColt());
}
private void refreshSuggestedULPositions(MtbColt mtbColt) throws Exception {
List<SuggestedULPositionDTO> suggestedULPositionDTOS = this.mPosizioniRESTConsumer.suggestUlPositionSynchronized(mtbColt.getBarcodeUl());
// Handle the suggested positions if needed
if(suggestedULPositionDTOS == null || suggestedULPositionDTOS.isEmpty()) {
if (suggestedULPositionDTOS == null || suggestedULPositionDTOS.isEmpty()) {
// If no positions are suggested, we can either throw an exception or handle it gracefully
return;
}
@@ -159,12 +162,12 @@ public class VersamentoMerceViewModel {
private void executePosizioneMonocollo(MtbDepoPosizione foundPosizione) throws Exception {
var barcodeUlInPosizioneList = this.mPosizioniRESTConsumer.getBancaliInPosizioneSynchronized(foundPosizione);
if (barcodeUlInPosizioneList == null || barcodeUlInPosizioneList.isEmpty()) {
throw new NoLUFoundException();
} else if (barcodeUlInPosizioneList.size() == 1) {
var mtbColt = mColliMagazzinoRESTConsumer.getBySsccSynchronized(barcodeUlInPosizioneList.get(0), true, false);
var mtbColt = mColliMagazzinoRESTConsumer.getBySsccSynchronized(
barcodeUlInPosizioneList.get(0), true, false
).getMtbColt();
//TAKE HERE
boolean codMdepIsValid = SettingsManager.iDB().getAvailableDepos().stream()
@@ -174,11 +177,9 @@ public class VersamentoMerceViewModel {
pickMerceULtoUL(mtbColt);
} else throw new InvalidCodMdepException();
} else {
throw new TooManyLUFoundInMonoLUPositionException();
}
}
@@ -210,8 +211,9 @@ public class VersamentoMerceViewModel {
private void executeEtichettaLU(String sscc, boolean isAnonima) throws Exception {
var mtbColt = this.mColliMagazzinoRESTConsumer.getBySsccSynchronized(sscc, true, false);
var mtbColt = this.mColliMagazzinoRESTConsumer.getBySsccSynchronized(
sscc, true, false
).getMtbColt();
if (mtbColt == null && !isAnonima) {
throw new NoLUFoundException();
@@ -249,9 +251,8 @@ public class VersamentoMerceViewModel {
this.sendOnLoadingStarted();
MtbColt sourceMtbColt = mCurrentMtbColt.getValue();
if (!UtilityString.equalsIgnoreCase(sourceMtbColt.getCodMdep(), destMtbColt.getCodMdep())) {
if (!UtilityString.equalsIgnoreCase(sourceMtbColt.getCodMdep(), destMtbColt.getCodMdep()))
throw new Exception("Impossibile spostare la merce tra UL di due depositi differenti");
}
List<MtbColr> mtbColrsToPick = sourceMtbColt.getMtbColr().stream()
.filter(x -> UtilityBigDecimal.greaterThan(x.getQtaCol(), BigDecimal.ZERO))

View File

@@ -34,6 +34,7 @@ import it.integry.integrywmsnative.core.model.MtbColr;
import it.integry.integrywmsnative.core.model.MtbColt;
import it.integry.integrywmsnative.core.model.MtbDepoPosizione;
import it.integry.integrywmsnative.core.rest.model.Ean128Model;
import it.integry.integrywmsnative.core.rest.model.giacenza.GetColloInGiacResponseDTO;
import it.integry.integrywmsnative.databinding.DialogScanArtBinding;
import it.integry.integrywmsnative.view.dialogs.DialogConsts;
import it.integry.integrywmsnative.view.dialogs.choose_art_from_lista_mtb_colr.DialogChooseArtFromListaMtbColrView;
@@ -54,15 +55,15 @@ public class DialogScanArtView extends BaseDialogFragment implements DialogScanA
private int mBarcodeScannerInstanceID;
private RunnableArgssss<DialogConsts.Results, MtbAart, Ean128Model, MtbColt> onPickingCompleted = null;
private RunnableArgssss<DialogConsts.Results, MtbAart, Ean128Model, GetColloInGiacResponseDTO> onPickingCompleted = null;
private RunnableArgs<MtbDepoPosizione> onMagazzinoAutomaticoPickingRequest = null;
public static DialogScanArtView newInstance(boolean forceOnlyUL, @NotNull RunnableArgssss<DialogConsts.Results, MtbAart, Ean128Model, MtbColt> onPickingCompleted, RunnableArgs<MtbDepoPosizione> onMagazzinoAutomaticoPickingRequest) {
public static DialogScanArtView newInstance(boolean forceOnlyUL, @NotNull RunnableArgssss<DialogConsts.Results, MtbAart, Ean128Model, GetColloInGiacResponseDTO> onPickingCompleted, RunnableArgs<MtbDepoPosizione> onMagazzinoAutomaticoPickingRequest) {
return new DialogScanArtView(forceOnlyUL, onPickingCompleted, onMagazzinoAutomaticoPickingRequest);
}
private DialogScanArtView(boolean forceOnlyUL, RunnableArgssss<DialogConsts.Results, MtbAart, Ean128Model, MtbColt> onItemChoosed, RunnableArgs<MtbDepoPosizione> onMagazzinoAutomaticoPickingRequest) {
private DialogScanArtView(boolean forceOnlyUL, RunnableArgssss<DialogConsts.Results, MtbAart, Ean128Model, GetColloInGiacResponseDTO> onItemChoosed, RunnableArgs<MtbDepoPosizione> onMagazzinoAutomaticoPickingRequest) {
super();
mForceOnlyUL = forceOnlyUL;
@@ -136,7 +137,7 @@ public class DialogScanArtView extends BaseDialogFragment implements DialogScanA
try {
Quartet<DialogConsts.Results, MtbAart, Ean128Model, MtbColt> result = this.mViewModel.processBarcodeDTO(data, pickMagazzinoAutomaticoPosizione -> {
Quartet<DialogConsts.Results, MtbAart, Ean128Model, GetColloInGiacResponseDTO> result = this.mViewModel.processBarcodeDTO(data, pickMagazzinoAutomaticoPosizione -> {
handler.post(() -> {
this.onMagazzinoAutomaticoPickingRequest.run(pickMagazzinoAutomaticoPosizione);
@@ -148,9 +149,9 @@ public class DialogScanArtView extends BaseDialogFragment implements DialogScanA
var status = result.getValue0();
var mtbAart = result.getValue1();
var ean128Model = result.getValue2();
var mtbColt = result.getValue3();
var colloInGiac = result.getValue3();
List<MtbColr> filteredMtbColrList = mtbColt.getMtbColr();
List<MtbColr> filteredMtbColrList = colloInGiac.getMtbColt().getMtbColr();
if (mtbAart != null && filteredMtbColrList != null) {
filteredMtbColrList = filteredMtbColrList.stream()
@@ -164,15 +165,15 @@ public class DialogScanArtView extends BaseDialogFragment implements DialogScanA
if (finalFilteredMtbColrList != null && finalFilteredMtbColrList.size() > 1) {
DialogChooseArtFromListaMtbColrView.make(getActivity(), finalFilteredMtbColrList, mtbColrChose -> {
mtbColt.setMtbColr(new ObservableArrayList<>());
mtbColt.getMtbColr().add(mtbColrChose);
onPickingCompleted.run(status, mtbAart, ean128Model, mtbColt);
colloInGiac.getMtbColt().setMtbColr(new ObservableArrayList<>());
colloInGiac.getMtbColt().getMtbColr().add(mtbColrChose);
onPickingCompleted.run(status, mtbAart, ean128Model, colloInGiac);
}).show();
} else if (finalFilteredMtbColrList != null && finalFilteredMtbColrList.size() == 1) {
mtbColt.setMtbColr(new ObservableArrayList<>());
mtbColt.getMtbColr().add(finalFilteredMtbColrList.get(0));
onPickingCompleted.run(status, mtbAart, ean128Model, mtbColt);
colloInGiac.getMtbColt().setMtbColr(new ObservableArrayList<>());
colloInGiac.getMtbColt().getMtbColr().add(finalFilteredMtbColrList.get(0));
onPickingCompleted.run(status, mtbAart, ean128Model, colloInGiac);
} else {
onPickingCompleted.run(status, mtbAart, ean128Model, null);

View File

@@ -21,6 +21,7 @@ import it.integry.integrywmsnative.core.rest.consumers.MagazzinoAutomaticoRESTCo
import it.integry.integrywmsnative.core.rest.consumers.PosizioniRESTConsumer;
import it.integry.integrywmsnative.core.rest.model.Ean128Model;
import it.integry.integrywmsnative.core.rest.model.Ean13PesoModel;
import it.integry.integrywmsnative.core.rest.model.giacenza.GetColloInGiacResponseDTO;
import it.integry.integrywmsnative.core.settings.SettingsManager;
import it.integry.integrywmsnative.core.utility.UtilityBarcode;
import it.integry.integrywmsnative.core.utility.UtilityPosizione;
@@ -57,7 +58,7 @@ public class DialogScanArtViewModel {
return this;
}
public Quartet<DialogConsts.Results, MtbAart, Ean128Model, MtbColt> processBarcodeDTO(BarcodeScanDTO barcodeScanDTO, RunnableArgs<MtbDepoPosizione> onMagazzinoAutomaticoPickingRequest) throws Exception {
public Quartet<DialogConsts.Results, MtbAart, Ean128Model, GetColloInGiacResponseDTO> processBarcodeDTO(BarcodeScanDTO barcodeScanDTO, RunnableArgs<MtbDepoPosizione> onMagazzinoAutomaticoPickingRequest) throws Exception {
if (UtilityBarcode.isEtichettaAnonima(barcodeScanDTO)) {
//Cerco gli articoli presenti nell'ul dell'etichetta anonima
return this.executeEtichettaLU(barcodeScanDTO.getStringValue());
@@ -82,7 +83,7 @@ public class DialogScanArtViewModel {
}
private Quartet<DialogConsts.Results, MtbAart, Ean128Model, MtbColt> executeEtichettaEan128(BarcodeScanDTO barcodeScanDTO) throws Exception {
private Quartet<DialogConsts.Results, MtbAart, Ean128Model, GetColloInGiacResponseDTO> executeEtichettaEan128(BarcodeScanDTO barcodeScanDTO) throws Exception {
var ean128Model = this.mBarcodeRESTConsumer.decodeEan128Synchronized(barcodeScanDTO);
@@ -109,27 +110,28 @@ public class DialogScanArtViewModel {
}
}
private Quartet<DialogConsts.Results, MtbAart, Ean128Model, MtbColt> executeEtichettaEanPeso(BarcodeScanDTO barcodeScanDTO) throws Exception {
private Quartet<DialogConsts.Results, MtbAart, Ean128Model, GetColloInGiacResponseDTO> executeEtichettaEanPeso(BarcodeScanDTO barcodeScanDTO) throws Exception {
Ean13PesoModel ean13PesoModel = Ean13PesoModel.fromBarcode(barcodeScanDTO.getStringValue());
return this.loadArticolo(ean13PesoModel.getPrecode(), ean13PesoModel.toEan128());
}
private Quartet<DialogConsts.Results, MtbAart, Ean128Model, MtbColt> executeEtichettaLU(String SSCC) throws Exception {
var mtbColt = mColliMagazzinoRESTConsumer.getBySsccSynchronized(SSCC, true, false);
private Quartet<DialogConsts.Results, MtbAart, Ean128Model, GetColloInGiacResponseDTO> executeEtichettaLU(String SSCC) throws Exception {
var response = mColliMagazzinoRESTConsumer.getBySsccSynchronized(SSCC, true, false);
var mtbColt = response.getMtbColt();
if (mtbColt == null || mtbColt.getMtbColr() == null || mtbColt.getMtbColr().isEmpty())
throw new NoLUFoundException();
if (mtbColt.getSegno() == -1) throw new InvalidLUException();
return new Quartet<>(DialogConsts.Results.YES, null, null, mtbColt);
return new Quartet<>(DialogConsts.Results.YES, null, null, response);
}
private Quartet<DialogConsts.Results, MtbAart, Ean128Model, MtbColt> executeEtichettaPosizione(String stringValue, RunnableArgs<MtbDepoPosizione> onMagazzinoAutomaticoPickingRequest) throws Exception {
private Quartet<DialogConsts.Results, MtbAart, Ean128Model, GetColloInGiacResponseDTO> executeEtichettaPosizione(String stringValue, RunnableArgs<MtbDepoPosizione> onMagazzinoAutomaticoPickingRequest) throws Exception {
MtbDepoPosizione foundPosizione = SettingsManager.iDB().getAvailablePosizioni().stream()
.filter(x -> x.getPosizione().equalsIgnoreCase(stringValue))
.findFirst()
@@ -150,7 +152,7 @@ public class DialogScanArtViewModel {
return null;
}
private Quartet<DialogConsts.Results, MtbAart, Ean128Model, MtbColt> executePosizione(MtbDepoPosizione posizione, MtbAart articolo) throws Exception {
private Quartet<DialogConsts.Results, MtbAart, Ean128Model, GetColloInGiacResponseDTO> executePosizione(MtbDepoPosizione posizione, MtbAart articolo) throws Exception {
var barcodeUlInPosizioneList = this.mPosizioniRESTConsumer.getBancaliInPosizioneSynchronized(posizione);
if (barcodeUlInPosizioneList == null || barcodeUlInPosizioneList.isEmpty())
@@ -160,12 +162,12 @@ public class DialogScanArtViewModel {
throw new TooManyLUFoundInMonoLUPositionException();
}
var mtbColt = this.mColliMagazzinoRESTConsumer.getBySsccSynchronized(barcodeUlInPosizioneList.get(0), true, false);
return new Quartet<>(DialogConsts.Results.YES, articolo, null, mtbColt);
var response = this.mColliMagazzinoRESTConsumer.getBySsccSynchronized(barcodeUlInPosizioneList.get(0), true, false);
return new Quartet<>(DialogConsts.Results.YES, articolo, null, response);
}
private Quartet<DialogConsts.Results, MtbAart, Ean128Model, MtbColt> loadArticolo(@NotNull String barcodeProd, Ean128Model ean128Model) throws Exception {
private Quartet<DialogConsts.Results, MtbAart, Ean128Model, GetColloInGiacResponseDTO> loadArticolo(@NotNull String barcodeProd, Ean128Model ean128Model) throws Exception {
var mtbAartList = this.mArticoloRESTConsumer.searchByBarcodeSynchronized(barcodeProd);
if (mtbAartList == null || mtbAartList.isEmpty())

View File

@@ -24,6 +24,7 @@ import it.integry.integrywmsnative.core.di.BindableBoolean;
import it.integry.integrywmsnative.core.expansion.BaseDialogFragment;
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
import it.integry.integrywmsnative.core.model.MtbColt;
import it.integry.integrywmsnative.core.rest.model.giacenza.GetColloInGiacResponseDTO;
import it.integry.integrywmsnative.databinding.DialogScanOrCreateLuBinding;
import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleMessageView;
import it.integry.integrywmsnative.view.dialogs.basket_lu.DialogBasketLUView;
@@ -110,7 +111,7 @@ public class DialogScanOrCreateLUView extends BaseDialogFragment implements Dial
mBindings.viewBasket.setOnClickListener(v -> {
new DialogBasketLUView(mtbColt -> {
onLUOpened(mtbColt, false);
onLUOpened(new GetColloInGiacResponseDTO().setMtbColt(mtbColt), false);
}).show(requireActivity().getSupportFragmentManager(), "tag");
});
@@ -180,30 +181,32 @@ public class DialogScanOrCreateLUView extends BaseDialogFragment implements Dial
}
@Override
public void onLUOpened(MtbColt mtbColt, boolean created) {
this.openedMtbColt = mtbColt;
mOnComplete.run(Result.completed(mtbColt, created));
public void onLUOpened(GetColloInGiacResponseDTO colloInGiac, boolean created) {
this.openedMtbColt = colloInGiac.getMtbColt();
mOnComplete.run(Result.completed(colloInGiac, created));
dismiss();
}
public static class Result {
private final GetColloInGiacResponseDTO colloInGiac;
private final MtbColt mtbColt;
private final boolean newLU;
private boolean aborted = false;
private Result(MtbColt mtbColt, boolean isNewLU) {
this.mtbColt = mtbColt;
private Result(GetColloInGiacResponseDTO colloInGiac, boolean isNewLU) {
this.mtbColt = colloInGiac.getMtbColt();
this.colloInGiac = colloInGiac;
this.newLU = isNewLU;
}
public static Result completed(MtbColt mtbColt, boolean isNewLU) {
return new Result(mtbColt, isNewLU);
public static Result completed(GetColloInGiacResponseDTO colloInGiac, boolean isNewLU) {
return new Result(colloInGiac, isNewLU);
}
public static Result aborted() {
Result result = new Result(null, false);
Result result = new Result(new GetColloInGiacResponseDTO().setMtbColt(null), false);
result.aborted = true;
return result;
}
@@ -212,6 +215,10 @@ public class DialogScanOrCreateLUView extends BaseDialogFragment implements Dial
return mtbColt;
}
public GetColloInGiacResponseDTO getColloInGiac() {
return colloInGiac;
}
public boolean isNewLU() {
return newLU;
}

View File

@@ -20,6 +20,7 @@ import it.integry.integrywmsnative.core.rest.consumers.BarcodeRESTConsumer;
import it.integry.integrywmsnative.core.rest.consumers.ColliLavorazioneRESTConsumer;
import it.integry.integrywmsnative.core.rest.consumers.ColliMagazzinoRESTConsumer;
import it.integry.integrywmsnative.core.rest.consumers.PosizioniRESTConsumer;
import it.integry.integrywmsnative.core.rest.model.giacenza.GetColloInGiacResponseDTO;
import it.integry.integrywmsnative.core.rest.model.udc.CreateUDCRequestDTO;
import it.integry.integrywmsnative.core.settings.SettingsManager;
import it.integry.integrywmsnative.core.utility.UtilityBarcode;
@@ -65,7 +66,7 @@ public class DialogScanOrCreateLUViewModel {
.setCodMdep(SettingsManager.i().getUserSession().getDepo().getCodMdep());
var createResponse = this.mColliLavorazioneRESTConsumer.synchronousCreateUDC(createUdcRequest);
this.sendOnLUOpened(createResponse, true);
this.sendOnLUCreated(createResponse);
}
public void processBarcodeDTO(BarcodeScanDTO barcodeScanDTO, Runnable onComplete) {
@@ -98,9 +99,9 @@ public class DialogScanOrCreateLUViewModel {
if (barcodeUlInPosizioneList == null || barcodeUlInPosizioneList.isEmpty()) {
this.sendError(new NoLUFoundException());
} else if (barcodeUlInPosizioneList.size() == 1) {
this.mColliMagazzinoRESTConsumer.getBySSCC(barcodeUlInPosizioneList.get(0), mShouldCheckResiduo, false, mtbColt -> {
this.mColliMagazzinoRESTConsumer.getBySSCC(barcodeUlInPosizioneList.get(0), mShouldCheckResiduo, false, response -> {
onComplete.run();
this.sendOnLUOpened(mtbColt, false);
this.sendOnLUOpened(response);
}, this::sendError);
} else {
this.sendError(new TooManyLUFoundInMonoLUPositionException());
@@ -111,7 +112,8 @@ public class DialogScanOrCreateLUViewModel {
private void executeEtichettaAnonima(BarcodeScanDTO barcodeScanDTO, Runnable onComplete) {
this.mColliMagazzinoRESTConsumer.getBySSCC(barcodeScanDTO.getStringValue(), mShouldCheckResiduo, false, mtbColt -> {
this.mColliMagazzinoRESTConsumer.getBySSCC(barcodeScanDTO.getStringValue(), mShouldCheckResiduo, false, response -> {
var mtbColt = response.getMtbColt();
if (mtbColt == null) {
if (mEnableCreation) {
@@ -131,7 +133,7 @@ public class DialogScanOrCreateLUViewModel {
this.mColliLavorazioneRESTConsumer.createUDC(createUdcRequest, createdMtbColt -> {
onComplete.run();
this.sendOnLUOpened(createdMtbColt, true);
this.sendOnLUCreated(createdMtbColt);
}, this::sendError);
} else {
this.sendError(new NoLUFoundException());
@@ -142,7 +144,7 @@ public class DialogScanOrCreateLUViewModel {
} else {
mtbColt.setDisablePrint(true);
onComplete.run();
this.sendOnLUOpened(mtbColt, false);
this.sendOnLUOpened(response);
}
}
@@ -155,10 +157,10 @@ public class DialogScanOrCreateLUViewModel {
if (ean128Model != null && !UtilityString.isNullOrEmpty(ean128Model.Sscc)) {
this.mColliMagazzinoRESTConsumer.getBySSCC(ean128Model.Sscc, mShouldCheckResiduo, false, mtbColt -> {
this.mColliMagazzinoRESTConsumer.getBySSCC(ean128Model.Sscc, mShouldCheckResiduo, false, response -> {
var mtbColt = response.getMtbColt();
if (mtbColt != null) {
if (mtbColt.getCodDtip() != null && mShouldCheckIfExistDoc) {
this.sendError(new AlreadyAttachedDocumentToLUException());
} else {
@@ -166,17 +168,16 @@ public class DialogScanOrCreateLUViewModel {
this.sendOnLUVenditaConfirmRequired(confirmed -> {
if (confirmed) {
onComplete.run();
this.sendOnLUOpened(mtbColt, false);
this.sendOnLUOpened(response);
} else {
onComplete.run();
}
});
} else {
onComplete.run();
this.sendOnLUOpened(mtbColt, false);
this.sendOnLUOpened(response);
}
}
} else {
var createUdcRequest = new CreateUDCRequestDTO()
.setBarcodeUl(ean128Model.Sscc)
@@ -184,7 +185,7 @@ public class DialogScanOrCreateLUViewModel {
this.mColliLavorazioneRESTConsumer.createUDC(createUdcRequest, createdMtbColt -> {
onComplete.run();
this.sendOnLUOpened(createdMtbColt, true);
this.sendOnLUCreated(createdMtbColt);
}, this::sendError);
}
@@ -217,8 +218,16 @@ public class DialogScanOrCreateLUViewModel {
if (this.mListener != null) mListener.onLUVenditaConfirmRequired(onConfirm);
}
private void sendOnLUOpened(MtbColt mtbColt, boolean created) {
if (this.mListener != null) mListener.onLUOpened(mtbColt, created);
private void sendOnLUCreated(MtbColt mtbColt) {
if (this.mListener != null) {
mListener.onLUOpened(
new GetColloInGiacResponseDTO().setMtbColt(mtbColt), true
);
}
}
private void sendOnLUOpened(GetColloInGiacResponseDTO colloInGiac) {
if (this.mListener != null) mListener.onLUOpened(colloInGiac, false);
}
private void sendOnLoadingStarted() {
@@ -241,7 +250,7 @@ public class DialogScanOrCreateLUViewModel {
void onLUVenditaConfirmRequired(RunnableArgs<Boolean> onConfirm);
void onLUOpened(MtbColt mtbColt, boolean created);
void onLUOpened(GetColloInGiacResponseDTO colloInGiac, boolean created);
void onError(Exception ex);