[FEAT] Implementato controllo per evitare l'apertura/modifica di UL già agganciate a documento.
This commit is contained in:
parent
ec38ae675f
commit
43ff3b1856
@ -34,7 +34,7 @@ import it.integry.plugins.barcode_base_library.model.BarcodeScanDTO;
|
||||
|
||||
public class DialogScanOrCreateLU {
|
||||
|
||||
private Context currentContext;
|
||||
private Context mContext;
|
||||
|
||||
private Dialog mDialog;
|
||||
|
||||
@ -46,6 +46,7 @@ public class DialogScanOrCreateLU {
|
||||
|
||||
|
||||
private boolean mShouldCheckResiduo = false;
|
||||
private boolean mShouldCheckIfExistDoc = true;
|
||||
|
||||
|
||||
public static Dialog make(final Context context, RunnableArgs<MtbColt> onDialogDismiss) {
|
||||
@ -65,7 +66,7 @@ public class DialogScanOrCreateLU {
|
||||
currentMtbColt = null;
|
||||
mShouldCheckResiduo = checkResiduo;
|
||||
|
||||
currentContext = context;
|
||||
mContext = context;
|
||||
|
||||
LayoutInflater inflater = (LayoutInflater) context.getSystemService( Context.LAYOUT_INFLATER_SERVICE );
|
||||
|
||||
@ -88,12 +89,12 @@ public class DialogScanOrCreateLU {
|
||||
mOnDialogDismiss = onDialogDismiss;
|
||||
|
||||
mBinding.createNewLuButton.setOnClickListener(v -> {
|
||||
final ProgressDialog progressDialog = UtilityProgress.createDefaultProgressDialog(currentContext);
|
||||
final ProgressDialog progressDialog = UtilityProgress.createDefaultProgressDialog(mContext);
|
||||
|
||||
ColliMagazzinoRESTConsumer.createColloLavorazione(+1, createdMtbColt -> {
|
||||
sendMtbColt(createdMtbColt, progressDialog);
|
||||
}, ex -> {
|
||||
UtilityExceptions.defaultException(currentContext, ex, progressDialog);
|
||||
UtilityExceptions.defaultException(mContext, ex, progressDialog);
|
||||
});
|
||||
});
|
||||
}
|
||||
@ -118,7 +119,7 @@ public class DialogScanOrCreateLU {
|
||||
private RunnableArgs<BarcodeScanDTO> onScanSuccessfull = data -> {
|
||||
BarcodeManager.disable();
|
||||
|
||||
final ProgressDialog progressDialog = UtilityProgress.createDefaultProgressDialog(currentContext);
|
||||
final ProgressDialog progressDialog = UtilityProgress.createDefaultProgressDialog(mContext);
|
||||
|
||||
if(UtilityBarcode.isEtichettaPosizione(data)){
|
||||
this.executeEtichettaPosizione(data, progressDialog);
|
||||
@ -150,7 +151,7 @@ public class DialogScanOrCreateLU {
|
||||
ColliMagazzinoRESTConsumer.getByTestata(mtbColtList.get(0), mShouldCheckResiduo, false, mtbColt -> {
|
||||
sendMtbColt(mtbColt, progressDialog);
|
||||
}, ex -> {
|
||||
UtilityExceptions.defaultException(currentContext, ex, progressDialog);
|
||||
UtilityExceptions.defaultException(mContext, ex, progressDialog);
|
||||
BarcodeManager.enable();
|
||||
});
|
||||
|
||||
@ -163,7 +164,7 @@ public class DialogScanOrCreateLU {
|
||||
}
|
||||
|
||||
}, ex -> {
|
||||
UtilityExceptions.defaultException(currentContext, ex, progressDialog);
|
||||
UtilityExceptions.defaultException(mContext, ex, progressDialog);
|
||||
BarcodeManager.enable();
|
||||
});
|
||||
|
||||
@ -180,21 +181,31 @@ public class DialogScanOrCreateLU {
|
||||
createdMtbColt.setDisablePrint(true);
|
||||
sendMtbColt(createdMtbColt, progressDialog);
|
||||
}, ex -> {
|
||||
UtilityExceptions.defaultException(currentContext, ex, progressDialog);
|
||||
UtilityExceptions.defaultException(mContext, ex, progressDialog);
|
||||
BarcodeManager.enable();
|
||||
});
|
||||
|
||||
} else {
|
||||
|
||||
if(mtbColt.getCodDtip() != null && mShouldCheckIfExistDoc) {
|
||||
DialogSimpleMessageHelper.makeWarningDialog(mContext,
|
||||
new SpannableString(mContext.getResources().getText(R.string.lu_already_attache_to_doc)),
|
||||
null, () -> {
|
||||
BarcodeManager.enable();
|
||||
progressDialog.dismiss();
|
||||
})
|
||||
.show();
|
||||
} else {
|
||||
BarcodeManager.enable();
|
||||
|
||||
mtbColt.setDisablePrint(true);
|
||||
sendMtbColt(mtbColt, progressDialog);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}, ex -> {
|
||||
UtilityExceptions.defaultException(currentContext, ex, progressDialog);
|
||||
UtilityExceptions.defaultException(mContext, ex, progressDialog);
|
||||
BarcodeManager.enable();
|
||||
});
|
||||
}
|
||||
@ -209,8 +220,19 @@ public class DialogScanOrCreateLU {
|
||||
|
||||
if(mtbColt != null) {
|
||||
|
||||
if(mtbColt.getCodDtip() != null && mShouldCheckIfExistDoc) {
|
||||
DialogSimpleMessageHelper.makeWarningDialog(mContext,
|
||||
new SpannableString(mContext.getResources().getText(R.string.lu_already_attache_to_doc)),
|
||||
null, () -> {
|
||||
BarcodeManager.enable();
|
||||
progressDialog.dismiss();
|
||||
})
|
||||
.show();
|
||||
} else {
|
||||
BarcodeManager.enable();
|
||||
sendMtbColt(mtbColt, progressDialog);
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
BarcodeManager.enable();
|
||||
@ -219,7 +241,7 @@ public class DialogScanOrCreateLU {
|
||||
}
|
||||
|
||||
}, ex -> {
|
||||
UtilityExceptions.defaultException(currentContext, ex, progressDialog);
|
||||
UtilityExceptions.defaultException(mContext, ex, progressDialog);
|
||||
BarcodeManager.enable();
|
||||
});
|
||||
|
||||
@ -234,21 +256,21 @@ public class DialogScanOrCreateLU {
|
||||
|
||||
|
||||
}, ex -> {
|
||||
UtilityExceptions.defaultException(currentContext, ex, progressDialog);
|
||||
UtilityExceptions.defaultException(mContext, ex, progressDialog);
|
||||
BarcodeManager.enable();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private void showTooMuchULFound() {
|
||||
DialogSimpleMessageHelper.makeWarningDialog(currentContext,
|
||||
new SpannableString(currentContext.getResources().getText(R.string.too_much_lu_found_message)),
|
||||
DialogSimpleMessageHelper.makeWarningDialog(mContext,
|
||||
new SpannableString(mContext.getResources().getText(R.string.too_much_lu_found_message)),
|
||||
null, null).show();
|
||||
}
|
||||
|
||||
private void showNoULFound() {
|
||||
DialogSimpleMessageHelper.makeWarningDialog(currentContext,
|
||||
new SpannableString(currentContext.getResources().getText(R.string.no_lu_found_message)),
|
||||
DialogSimpleMessageHelper.makeWarningDialog(mContext,
|
||||
new SpannableString(mContext.getResources().getText(R.string.no_lu_found_message)),
|
||||
null, null).show();
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user