Fix su thread in posizionamento merce

This commit is contained in:
Giuseppe Scorrano 2021-06-08 15:57:39 +02:00
parent 21137b1224
commit e811514764

View File

@ -60,7 +60,6 @@ public class VersamentoMerceFragment extends BaseFragment implements ITitledFrag
} }
@Override @Override
public void onCreate(Bundle savedInstanceState) { public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
@ -101,7 +100,6 @@ public class VersamentoMerceFragment extends BaseFragment implements ITitledFrag
} }
public void openLU() { public void openLU() {
DialogScanOrCreateLUView.newInstance(true, false, true, false, (mtbColt, created) -> { DialogScanOrCreateLUView.newInstance(true, false, true, false, (mtbColt, created) -> {
if (mtbColt == null) { if (mtbColt == null) {
@ -163,21 +161,27 @@ public class VersamentoMerceFragment extends BaseFragment implements ITitledFrag
@Override @Override
public void onLivelloPosizioneRequired(MtbDepoPosizione posizione, RunnableArgs<MtbDepoPosizione> onComplete) { public void onLivelloPosizioneRequired(MtbDepoPosizione posizione, RunnableArgs<MtbDepoPosizione> onComplete) {
DialogAskLivelloPosizione.make(getActivity(), posizione, false, onComplete, this::onError); this.getActivity().runOnUiThread(() -> {
DialogAskLivelloPosizione.make(getActivity(), posizione, false, onComplete, this::onError);
});
} }
@Override @Override
public void onSpostamentoTraDepConfirmRequired(String sourceCodMdep, String destinationCodMdep, RunnableArgs<Boolean> onComplete) { public void onSpostamentoTraDepConfirmRequired(String sourceCodMdep, String destinationCodMdep, RunnableArgs<Boolean> onComplete) {
DialogSimpleMessageView.makeWarningDialog(Html.fromHtml("Stai spostando una UL dal deposito <b>" + sourceCodMdep + "</b> al deposito <b>" + destinationCodMdep + "</b>"), this.getActivity().runOnUiThread(() -> {
null, DialogSimpleMessageView.makeWarningDialog(Html.fromHtml("Stai spostando una UL dal deposito <b>" + sourceCodMdep + "</b> al deposito <b>" + destinationCodMdep + "</b>"),
() -> onComplete.run(true), null,
() -> onComplete.run(false)) () -> onComplete.run(true),
.show(getActivity().getSupportFragmentManager(), "tag"); () -> onComplete.run(false))
.show(getActivity().getSupportFragmentManager(), "tag");
});
} }
@Override @Override
public void onArtsChooseRequired(List<MtbColr> mtbColrList, RunnableArgs<List<MtbColr>> onComplete, Runnable onAbort) { public void onArtsChooseRequired(List<MtbColr> mtbColrList, RunnableArgs<List<MtbColr>> onComplete, Runnable onAbort) {
DialogChooseArtsFromListaArts.make(getActivity(), mtbColrList, onComplete, onAbort); this.getActivity().runOnUiThread(() -> {
DialogChooseArtsFromListaArts.make(getActivity(), mtbColrList, onComplete, onAbort);
});
} }
@Override @Override
@ -207,33 +211,39 @@ public class VersamentoMerceFragment extends BaseFragment implements ITitledFrag
.setCanPartitaMagBeChanged(canBatchLotBeChanged) .setCanPartitaMagBeChanged(canBatchLotBeChanged)
.setCanLUBeClosed(false); .setCanLUBeClosed(false);
DialogInputQuantityV2View this.getActivity().runOnUiThread(() -> {
.newInstance(dialogInputQuantityV2DTO, (resultDTO, shouldCloseLU) -> { DialogInputQuantityV2View
.newInstance(dialogInputQuantityV2DTO, (resultDTO, shouldCloseLU) -> {
PickedQuantityDTO pickedQuantityDTO = new PickedQuantityDTO() PickedQuantityDTO pickedQuantityDTO = new PickedQuantityDTO()
.setNumCnf(resultDTO.getNumCnf()) .setNumCnf(resultDTO.getNumCnf())
.setQtaCnf(resultDTO.getQtaCnf()) .setQtaCnf(resultDTO.getQtaCnf())
.setQtaTot(resultDTO.getQtaTot()) .setQtaTot(resultDTO.getQtaTot())
.setPartitaMag(resultDTO.getPartitaMag()) .setPartitaMag(resultDTO.getPartitaMag())
.setDataScad(resultDTO.getDataScad()); .setDataScad(resultDTO.getDataScad());
onComplete.run(pickedQuantityDTO); onComplete.run(pickedQuantityDTO);
}, this::onLoadingEnded) }, this::onLoadingEnded)
.show(getActivity().getSupportFragmentManager(), "tag"); .show(getActivity().getSupportFragmentManager(), "tag");
});
} }
@Override @Override
public void onDataSaved() { public void onDataSaved() {
DialogCommon.showDataSaved(getActivity(), () -> { this.getActivity().runOnUiThread(() -> {
((IPoppableActivity) getActivity()).pop(); DialogCommon.showDataSaved(getActivity(), () -> {
((IPoppableActivity) getActivity()).pop();
});
}); });
} }
@Override @Override
public void onError(Exception ex) { public void onError(Exception ex) {
this.closeProgress(); this.getActivity().runOnUiThread(() -> {
UtilityExceptions.defaultException(getActivity(), ex, mCurrentProgress); this.closeProgress();
BarcodeManager.enable(); UtilityExceptions.defaultException(getActivity(), ex, mCurrentProgress);
BarcodeManager.enable();
});
} }
} }