Migliorata gestione errori in versamento merce
This commit is contained in:
parent
c012c54805
commit
80842e49e5
@ -22,8 +22,6 @@ public abstract class BaseFragment extends Fragment {
|
|||||||
protected final List<Runnable> mOnPreDestroyList = new ArrayList<>();
|
protected final List<Runnable> mOnPreDestroyList = new ArrayList<>();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public void setScrollToolbar(ElevatedToolbar toolbar) {
|
public void setScrollToolbar(ElevatedToolbar toolbar) {
|
||||||
mToolbar = toolbar;
|
mToolbar = toolbar;
|
||||||
}
|
}
|
||||||
@ -34,10 +32,6 @@ public abstract class BaseFragment extends Fragment {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public void onLoadingStarted() {
|
public void onLoadingStarted() {
|
||||||
new Thread(() -> {
|
new Thread(() -> {
|
||||||
BarcodeManager.disable();
|
BarcodeManager.disable();
|
||||||
@ -71,23 +65,25 @@ public abstract class BaseFragment extends Fragment {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected void openProgress() {
|
protected void openProgress() {
|
||||||
getActivity().runOnUiThread(() -> {
|
getActivity().runOnUiThread(() -> {
|
||||||
if (this.mCurrentProgress == null) {
|
if (this.mCurrentProgress == null) {
|
||||||
this.mCurrentProgress = UtilityProgress.createDefaultProgressDialog(getActivity());
|
this.mCurrentProgress = UtilityProgress.createDefaultProgressDialog(getActivity());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void closeProgress() {
|
protected void closeProgress() {
|
||||||
getActivity().runOnUiThread(() -> {
|
getActivity().runOnUiThread(() -> {
|
||||||
if (mCurrentProgress != null) {
|
if (mCurrentProgress != null) {
|
||||||
mCurrentProgress.dismiss();
|
mCurrentProgress.dismiss();
|
||||||
mCurrentProgress = null;
|
mCurrentProgress = null;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void popMe() {
|
protected void popMe() {
|
||||||
((IPoppableActivity) requireActivity()).pop();
|
getActivity().runOnUiThread(() -> {
|
||||||
|
((IPoppableActivity) requireActivity()).pop();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -319,6 +319,12 @@ public class ProdVersamentoMaterialeFragment extends BaseFragment implements Pro
|
|||||||
this.openLU();
|
this.openLU();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onError(Exception ex, boolean requestClose) {
|
||||||
|
super.onError(ex);
|
||||||
|
if(requestClose) popMe();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onWarning(String warningText, Runnable action) {
|
public void onWarning(String warningText, Runnable action) {
|
||||||
this.requireActivity().runOnUiThread(() -> {
|
this.requireActivity().runOnUiThread(() -> {
|
||||||
|
|||||||
@ -77,8 +77,13 @@ public class ProdVersamentoMaterialeViewModel {
|
|||||||
mtbDepoPosizione.getPosizione(),
|
mtbDepoPosizione.getPosizione(),
|
||||||
getIdMaterialeFromCollo(mtbColt),
|
getIdMaterialeFromCollo(mtbColt),
|
||||||
ordini -> {
|
ordini -> {
|
||||||
setCurrentOrders(ordini, mtbColt.getMtbColr().get(0));
|
if(ordini == null || ordini.isEmpty())
|
||||||
this.sendOnLoadingEnded();
|
this.sendError(new Exception("Nessun ordine compatibile con " + getIdMaterialeFromCollo(mtbColt) + " sulla linea " + mtbDepoPosizione.getPosizione()), true);
|
||||||
|
else {
|
||||||
|
setCurrentOrders(ordini, mtbColt.getMtbColr().get(0));
|
||||||
|
this.sendOnLoadingEnded();
|
||||||
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
e -> this.sendWarning(e.getMessage(), this::sendRequestLUOpen));
|
e -> this.sendWarning(e.getMessage(), this::sendRequestLUOpen));
|
||||||
}
|
}
|
||||||
@ -194,7 +199,11 @@ public class ProdVersamentoMaterialeViewModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void sendError(Exception ex) {
|
private void sendError(Exception ex) {
|
||||||
if (this.mListener != null) mListener.onError(ex);
|
if (this.mListener != null) mListener.onError(ex, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void sendError(Exception ex, boolean requestClose) {
|
||||||
|
if (this.mListener != null) mListener.onError(ex, requestClose);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void sendOnDataSaved() {
|
private void sendOnDataSaved() {
|
||||||
@ -205,7 +214,7 @@ public class ProdVersamentoMaterialeViewModel {
|
|||||||
|
|
||||||
void requestLUOpen();
|
void requestLUOpen();
|
||||||
|
|
||||||
void onError(Exception ex);
|
void onError(Exception ex, boolean requestClose);
|
||||||
|
|
||||||
void onWarning(String warningText, Runnable action);
|
void onWarning(String warningText, Runnable action);
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user