[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 {
|
public class DialogScanOrCreateLU {
|
||||||
|
|
||||||
private Context currentContext;
|
private Context mContext;
|
||||||
|
|
||||||
private Dialog mDialog;
|
private Dialog mDialog;
|
||||||
|
|
||||||
@ -46,6 +46,7 @@ public class DialogScanOrCreateLU {
|
|||||||
|
|
||||||
|
|
||||||
private boolean mShouldCheckResiduo = false;
|
private boolean mShouldCheckResiduo = false;
|
||||||
|
private boolean mShouldCheckIfExistDoc = true;
|
||||||
|
|
||||||
|
|
||||||
public static Dialog make(final Context context, RunnableArgs<MtbColt> onDialogDismiss) {
|
public static Dialog make(final Context context, RunnableArgs<MtbColt> onDialogDismiss) {
|
||||||
@ -65,7 +66,7 @@ public class DialogScanOrCreateLU {
|
|||||||
currentMtbColt = null;
|
currentMtbColt = null;
|
||||||
mShouldCheckResiduo = checkResiduo;
|
mShouldCheckResiduo = checkResiduo;
|
||||||
|
|
||||||
currentContext = context;
|
mContext = context;
|
||||||
|
|
||||||
LayoutInflater inflater = (LayoutInflater) context.getSystemService( Context.LAYOUT_INFLATER_SERVICE );
|
LayoutInflater inflater = (LayoutInflater) context.getSystemService( Context.LAYOUT_INFLATER_SERVICE );
|
||||||
|
|
||||||
@ -88,12 +89,12 @@ public class DialogScanOrCreateLU {
|
|||||||
mOnDialogDismiss = onDialogDismiss;
|
mOnDialogDismiss = onDialogDismiss;
|
||||||
|
|
||||||
mBinding.createNewLuButton.setOnClickListener(v -> {
|
mBinding.createNewLuButton.setOnClickListener(v -> {
|
||||||
final ProgressDialog progressDialog = UtilityProgress.createDefaultProgressDialog(currentContext);
|
final ProgressDialog progressDialog = UtilityProgress.createDefaultProgressDialog(mContext);
|
||||||
|
|
||||||
ColliMagazzinoRESTConsumer.createColloLavorazione(+1, createdMtbColt -> {
|
ColliMagazzinoRESTConsumer.createColloLavorazione(+1, createdMtbColt -> {
|
||||||
sendMtbColt(createdMtbColt, progressDialog);
|
sendMtbColt(createdMtbColt, progressDialog);
|
||||||
}, ex -> {
|
}, ex -> {
|
||||||
UtilityExceptions.defaultException(currentContext, ex, progressDialog);
|
UtilityExceptions.defaultException(mContext, ex, progressDialog);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -118,7 +119,7 @@ public class DialogScanOrCreateLU {
|
|||||||
private RunnableArgs<BarcodeScanDTO> onScanSuccessfull = data -> {
|
private RunnableArgs<BarcodeScanDTO> onScanSuccessfull = data -> {
|
||||||
BarcodeManager.disable();
|
BarcodeManager.disable();
|
||||||
|
|
||||||
final ProgressDialog progressDialog = UtilityProgress.createDefaultProgressDialog(currentContext);
|
final ProgressDialog progressDialog = UtilityProgress.createDefaultProgressDialog(mContext);
|
||||||
|
|
||||||
if(UtilityBarcode.isEtichettaPosizione(data)){
|
if(UtilityBarcode.isEtichettaPosizione(data)){
|
||||||
this.executeEtichettaPosizione(data, progressDialog);
|
this.executeEtichettaPosizione(data, progressDialog);
|
||||||
@ -150,7 +151,7 @@ public class DialogScanOrCreateLU {
|
|||||||
ColliMagazzinoRESTConsumer.getByTestata(mtbColtList.get(0), mShouldCheckResiduo, false, mtbColt -> {
|
ColliMagazzinoRESTConsumer.getByTestata(mtbColtList.get(0), mShouldCheckResiduo, false, mtbColt -> {
|
||||||
sendMtbColt(mtbColt, progressDialog);
|
sendMtbColt(mtbColt, progressDialog);
|
||||||
}, ex -> {
|
}, ex -> {
|
||||||
UtilityExceptions.defaultException(currentContext, ex, progressDialog);
|
UtilityExceptions.defaultException(mContext, ex, progressDialog);
|
||||||
BarcodeManager.enable();
|
BarcodeManager.enable();
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -163,7 +164,7 @@ public class DialogScanOrCreateLU {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}, ex -> {
|
}, ex -> {
|
||||||
UtilityExceptions.defaultException(currentContext, ex, progressDialog);
|
UtilityExceptions.defaultException(mContext, ex, progressDialog);
|
||||||
BarcodeManager.enable();
|
BarcodeManager.enable();
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -180,21 +181,31 @@ public class DialogScanOrCreateLU {
|
|||||||
createdMtbColt.setDisablePrint(true);
|
createdMtbColt.setDisablePrint(true);
|
||||||
sendMtbColt(createdMtbColt, progressDialog);
|
sendMtbColt(createdMtbColt, progressDialog);
|
||||||
}, ex -> {
|
}, ex -> {
|
||||||
UtilityExceptions.defaultException(currentContext, ex, progressDialog);
|
UtilityExceptions.defaultException(mContext, ex, progressDialog);
|
||||||
BarcodeManager.enable();
|
BarcodeManager.enable();
|
||||||
});
|
});
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
BarcodeManager.enable();
|
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);
|
mtbColt.setDisablePrint(true);
|
||||||
sendMtbColt(mtbColt, progressDialog);
|
sendMtbColt(mtbColt, progressDialog);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}, ex -> {
|
}, ex -> {
|
||||||
UtilityExceptions.defaultException(currentContext, ex, progressDialog);
|
UtilityExceptions.defaultException(mContext, ex, progressDialog);
|
||||||
BarcodeManager.enable();
|
BarcodeManager.enable();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -209,8 +220,19 @@ public class DialogScanOrCreateLU {
|
|||||||
|
|
||||||
if(mtbColt != null) {
|
if(mtbColt != null) {
|
||||||
|
|
||||||
BarcodeManager.enable();
|
if(mtbColt.getCodDtip() != null && mShouldCheckIfExistDoc) {
|
||||||
sendMtbColt(mtbColt, progressDialog);
|
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 {
|
} else {
|
||||||
BarcodeManager.enable();
|
BarcodeManager.enable();
|
||||||
@ -219,7 +241,7 @@ public class DialogScanOrCreateLU {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}, ex -> {
|
}, ex -> {
|
||||||
UtilityExceptions.defaultException(currentContext, ex, progressDialog);
|
UtilityExceptions.defaultException(mContext, ex, progressDialog);
|
||||||
BarcodeManager.enable();
|
BarcodeManager.enable();
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -234,21 +256,21 @@ public class DialogScanOrCreateLU {
|
|||||||
|
|
||||||
|
|
||||||
}, ex -> {
|
}, ex -> {
|
||||||
UtilityExceptions.defaultException(currentContext, ex, progressDialog);
|
UtilityExceptions.defaultException(mContext, ex, progressDialog);
|
||||||
BarcodeManager.enable();
|
BarcodeManager.enable();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void showTooMuchULFound() {
|
private void showTooMuchULFound() {
|
||||||
DialogSimpleMessageHelper.makeWarningDialog(currentContext,
|
DialogSimpleMessageHelper.makeWarningDialog(mContext,
|
||||||
new SpannableString(currentContext.getResources().getText(R.string.too_much_lu_found_message)),
|
new SpannableString(mContext.getResources().getText(R.string.too_much_lu_found_message)),
|
||||||
null, null).show();
|
null, null).show();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void showNoULFound() {
|
private void showNoULFound() {
|
||||||
DialogSimpleMessageHelper.makeWarningDialog(currentContext,
|
DialogSimpleMessageHelper.makeWarningDialog(mContext,
|
||||||
new SpannableString(currentContext.getResources().getText(R.string.no_lu_found_message)),
|
new SpannableString(mContext.getResources().getText(R.string.no_lu_found_message)),
|
||||||
null, null).show();
|
null, null).show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user