Merge branch 'feature/RefactoringGestioneColli' into master-beta
Some checks failed
WMS - Android (New)/pipeline/head There was a failure building this commit
Some checks failed
WMS - Android (New)/pipeline/head There was a failure building this commit
This commit is contained in:
@@ -45,7 +45,9 @@ pipeline {
|
||||
success {
|
||||
script {
|
||||
bat "curl -k https://devservices.studioml.it/ems-api/updateWMSApp?overrideForced=false"
|
||||
bat 'curl -k https://devservices.studioml.it/ems-api/updateWMSApp?overrideForced=false&suffix=beta'
|
||||
bat "curl -k https://services.studioml.it/ems-api/updateWMSApp?overrideForced=false"
|
||||
bat 'curl -k https://services.studioml.it/ems-api/updateWMSApp?overrideForced=false&suffix=beta'
|
||||
if (env.GIT_BRANCH == "master" || env.GIT_BRANCH == "master-beta") {
|
||||
office365ConnectorSend adaptiveCards: true, color: '#008000', message: 'WMS è stato compilato con successo', status: 'SUCCESS', webhookUrl: 'https://prod-89.westeurope.logic.azure.com:443/workflows/260580715a9d4447a54dea861a865536/triggers/manual/paths/invoke?api-version=2016-06-01&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=EMqPHohvE5o5IGj_gir_iQaAufR4r8ZJxlFx52jklSE'
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ android {
|
||||
buildTypes {
|
||||
debug {
|
||||
ext.enableCrashlytics = false
|
||||
minifyEnabled true // Abilita la minimizzazione del codice
|
||||
// minifyEnabled true // Abilita la minimizzazione del codice
|
||||
// shrinkResources true // Rimuove risorse non utilizzate
|
||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
|
||||
@@ -156,11 +156,11 @@ public class SplashActivity extends BaseActivity implements MainContext.Listener
|
||||
@Override
|
||||
public void onError(Spanned message) {
|
||||
handler.post(() -> {
|
||||
DialogSimpleMessageView.makeErrorDialog(
|
||||
DialogSimpleMessageView.makeErrorDialog(this,
|
||||
message, null, this::finish, R.string.logout, () -> {
|
||||
this.mainContext.logout(MainApplication::exit);
|
||||
})
|
||||
.show(this.getSupportFragmentManager(), "tag");
|
||||
.show();
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
@@ -47,8 +47,8 @@ import java.util.Locale;
|
||||
|
||||
import it.integry.integrywmsnative.MainApplication;
|
||||
import it.integry.integrywmsnative.R;
|
||||
import it.integry.integrywmsnative.core.expansion.BaseDialogFragment;
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
import it.integry.integrywmsnative.core.helper.ContextHelper;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityBigDecimal;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityDate;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityNumber;
|
||||
@@ -475,8 +475,8 @@ public class Converters {
|
||||
}
|
||||
|
||||
|
||||
@BindingAdapter(value = {"binding", "parentView", "warningOnOldDates"}, requireAll = false)
|
||||
public static void bindTextInputEditTextDate(TextInputEditText view, final ObservableField<Date> observableDate, BaseDialogFragment parentFragment, boolean warningOnOldDates) {
|
||||
@BindingAdapter(value = {"binding", "warningOnOldDates"}, requireAll = false)
|
||||
public static void bindTextInputEditTextDate(TextInputEditText view, final ObservableField<Date> observableDate, boolean warningOnOldDates) {
|
||||
Pair<ObservableField<Date>, TextWatcherAdapter> pair = (Pair) view.getTag(R.id.bound_observable);
|
||||
if (pair == null || pair.first != observableDate) {
|
||||
if (pair != null) {
|
||||
@@ -511,15 +511,15 @@ public class Converters {
|
||||
var calendar = UtilityDate.getCalendarInstance();
|
||||
calendar.setTimeInMillis(timeInMillis);
|
||||
|
||||
if (parentFragment != null && warningOnOldDates && calendar.before(UtilityDate.getCalendarInstance())) {
|
||||
if (warningOnOldDates && calendar.before(UtilityDate.getCalendarInstance())) {
|
||||
DialogSimpleMessageView
|
||||
.makeWarningDialog(new SpannableString("Hai scelto una data precedente a quella odierna. Continuare?"), null, () -> {
|
||||
.makeWarningDialog(view.getContext(), new SpannableString("Hai scelto una data precedente a quella odierna. Continuare?"), null, () -> {
|
||||
view.setText(UtilityDate.formatDate(calendar.getTime(), UtilityDate.COMMONS_DATE_FORMATS.DMY_HUMAN));
|
||||
observableDate.set(calendar.getTime());
|
||||
}, () -> {
|
||||
|
||||
})
|
||||
.show(parentFragment.requireActivity().getSupportFragmentManager(), "tag");
|
||||
.show();
|
||||
} else {
|
||||
view.setText(UtilityDate.formatDate(calendar.getTime(), UtilityDate.COMMONS_DATE_FORMATS.DMY_HUMAN));
|
||||
observableDate.set(calendar.getTime());
|
||||
@@ -531,7 +531,7 @@ public class Converters {
|
||||
}
|
||||
});
|
||||
|
||||
datePicker.show(parentFragment.requireActivity().getSupportFragmentManager(), "tag");
|
||||
datePicker.show(ContextHelper.getFragmentManagerFromContext(view.getContext()), "tag");
|
||||
};
|
||||
|
||||
//Adding click-listener
|
||||
@@ -546,8 +546,8 @@ public class Converters {
|
||||
}
|
||||
|
||||
|
||||
@BindingAdapter(value = {"binding", "parentView", "warningOnOldDates"}, requireAll = false)
|
||||
public static void bindTextInputEditTextDate(TextInputEditText view, final MutableLiveData<Date> liveDataDate, BaseDialogFragment parentFragment, boolean warningOnOldDates) {
|
||||
@BindingAdapter(value = {"binding", "warningOnOldDates"}, requireAll = false)
|
||||
public static void bindTextInputEditTextDate(TextInputEditText view, final MutableLiveData<Date> liveDataDate, boolean warningOnOldDates) {
|
||||
// Ottieni il LifecycleOwner dalla view
|
||||
LifecycleOwner lifecycleOwner = ViewTreeLifecycleOwner.get(view);
|
||||
if (lifecycleOwner == null) {
|
||||
@@ -591,14 +591,14 @@ public class Converters {
|
||||
calendar.setTimeInMillis(selection);
|
||||
Date selectedDate = calendar.getTime();
|
||||
|
||||
if (parentFragment != null && warningOnOldDates && calendar.before(UtilityDate.getCalendarInstance())) {
|
||||
if (warningOnOldDates && calendar.before(UtilityDate.getCalendarInstance())) {
|
||||
DialogSimpleMessageView
|
||||
.makeWarningDialog(new SpannableString("Hai scelto una data precedente a quella odierna. Continuare?"), null, () -> {
|
||||
.makeWarningDialog(view.getContext(), new SpannableString("Hai scelto una data precedente a quella odierna. Continuare?"), null, () -> {
|
||||
liveDataDate.postValue(selectedDate);
|
||||
}, () -> {
|
||||
// Non fare nulla se l'utente annulla
|
||||
})
|
||||
.show(parentFragment.requireActivity().getSupportFragmentManager(), "DatePickerWarningDialog");
|
||||
.show();
|
||||
} else {
|
||||
liveDataDate.postValue(selectedDate);
|
||||
}
|
||||
@@ -611,7 +611,7 @@ public class Converters {
|
||||
});
|
||||
|
||||
|
||||
datePicker.show(parentFragment.requireActivity().getSupportFragmentManager(), "MaterialDatePicker");
|
||||
datePicker.show(ContextHelper.getFragmentManagerFromContext(view.getContext()), "MaterialDatePicker");
|
||||
};
|
||||
|
||||
view.setOnClickListener(onClick::run);
|
||||
@@ -663,8 +663,8 @@ public class Converters {
|
||||
}
|
||||
|
||||
|
||||
@BindingAdapter(value = {"binding", "parentView", "warningOnOldDates"}, requireAll = false)
|
||||
public static void bindEditTextDate(EditText view, final ObservableField<LocalDate> observableDate, BaseDialogFragment parentFragment, boolean warningOnOldDates) {
|
||||
@BindingAdapter(value = {"binding", "warningOnOldDates"}, requireAll = false)
|
||||
public static void bindEditTextDate(EditText view, final ObservableField<LocalDate> observableDate, boolean warningOnOldDates) {
|
||||
Pair<ObservableField<LocalDate>, TextWatcherAdapter> pair = (Pair) view.getTag(R.id.bound_observable);
|
||||
if (pair == null || pair.first != observableDate) {
|
||||
if (pair != null) {
|
||||
@@ -695,15 +695,15 @@ public class Converters {
|
||||
var nowTime = UtilityDate.millisTimeToLocalDate(selectedTimeInMillis, null);
|
||||
|
||||
|
||||
if (parentFragment != null && warningOnOldDates && nowTime.isBefore(UtilityDate.getNow())) {
|
||||
if (warningOnOldDates && nowTime.isBefore(UtilityDate.getNow())) {
|
||||
DialogSimpleMessageView
|
||||
.makeWarningDialog(new SpannableString("Hai scelto una data precedente a quella odierna. Continuare?"), null, () -> {
|
||||
.makeWarningDialog(view.getContext(), new SpannableString("Hai scelto una data precedente a quella odierna. Continuare?"), null, () -> {
|
||||
view.setText(UtilityDate.formatDate(nowTime, UtilityDate.COMMONS_DATE_FORMATS.DMY_HUMAN));
|
||||
observableDate.set(nowTime);
|
||||
}, () -> {
|
||||
|
||||
})
|
||||
.show(parentFragment.requireActivity().getSupportFragmentManager(), "tag");
|
||||
.show();
|
||||
} else {
|
||||
view.setText(UtilityDate.formatDate(nowTime, UtilityDate.COMMONS_DATE_FORMATS.DMY_HUMAN));
|
||||
observableDate.set(nowTime);
|
||||
@@ -715,7 +715,7 @@ public class Converters {
|
||||
}
|
||||
});
|
||||
|
||||
datePicker.show(parentFragment.requireActivity().getSupportFragmentManager(), "tag");
|
||||
datePicker.show(ContextHelper.getFragmentManagerFromContext(view.getContext()), "tag");
|
||||
};
|
||||
|
||||
//Adding click-listener
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package it.integry.integrywmsnative.core.model;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
@@ -9,6 +10,8 @@ import java.util.Objects;
|
||||
|
||||
import it.integry.integrywmsnative.core.exception.DateNotRecognizedException;
|
||||
import it.integry.integrywmsnative.core.exception.TimeNotRecognizedException;
|
||||
import it.integry.integrywmsnative.core.model.key.DtbDocrKey;
|
||||
import it.integry.integrywmsnative.core.model.key.DtbDoctKey;
|
||||
import it.integry.integrywmsnative.core.model.key.MtbColrKey;
|
||||
import it.integry.integrywmsnative.core.model.secondary.GestioneEnum;
|
||||
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
||||
@@ -84,7 +87,7 @@ public class MtbColr extends EntityBase {
|
||||
@SerializedName("codDtipDoc")
|
||||
private String codDtipDoc;
|
||||
@SerializedName("dataDoc")
|
||||
private String dataDoc;
|
||||
private LocalDate dataDoc;
|
||||
@SerializedName("serDoc")
|
||||
private String serDoc;
|
||||
@SerializedName("numDoc")
|
||||
@@ -186,9 +189,39 @@ public class MtbColr extends EntityBase {
|
||||
}
|
||||
|
||||
public MtbColrKey getKey() {
|
||||
if (UtilityString.isNullOrEmpty(gestione) ||
|
||||
UtilityString.isNullOrEmpty(serCollo) ||
|
||||
getDataColloLD() == null ||
|
||||
numCollo == null ||
|
||||
riga == null)
|
||||
return null;
|
||||
|
||||
return new MtbColrKey(gestione, serCollo, getDataColloLD(), numCollo, riga);
|
||||
}
|
||||
|
||||
public DtbDoctKey getDocumentKey() {
|
||||
if (UtilityString.isNullOrEmpty(codAnagDoc) ||
|
||||
UtilityString.isNullOrEmpty(codDtipDoc) ||
|
||||
UtilityString.isNullOrEmpty(serDoc) ||
|
||||
dataDoc == null ||
|
||||
numDoc == null)
|
||||
return null;
|
||||
|
||||
return new DtbDoctKey(codAnagDoc, codDtipDoc, dataDoc, numDoc, serDoc);
|
||||
}
|
||||
|
||||
public DtbDocrKey getDocumentRowKey() {
|
||||
if (UtilityString.isNullOrEmpty(codAnagDoc) ||
|
||||
UtilityString.isNullOrEmpty(codDtipDoc) ||
|
||||
UtilityString.isNullOrEmpty(serDoc) ||
|
||||
dataDoc == null ||
|
||||
numDoc == null ||
|
||||
idRigaDoc == null)
|
||||
return null;
|
||||
|
||||
return new DtbDocrKey(codAnagDoc, codDtipDoc, dataDoc, numDoc, serDoc, idRigaDoc);
|
||||
}
|
||||
|
||||
public static class Causale {
|
||||
public static final int DEFAULT = 0;
|
||||
public static final int RETTIFICA = 1;
|
||||
@@ -561,11 +594,11 @@ public class MtbColr extends EntityBase {
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getDataDoc() {
|
||||
public LocalDate getDataDoc() {
|
||||
return dataDoc;
|
||||
}
|
||||
|
||||
public MtbColr setDataDoc(String dataDoc) {
|
||||
public MtbColr setDataDoc(LocalDate dataDoc) {
|
||||
this.dataDoc = dataDoc;
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -19,6 +19,8 @@ import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import it.integry.integrywmsnative.core.model.dto.InternalCodAnagsDTO;
|
||||
import it.integry.integrywmsnative.core.model.key.DtbDoctKey;
|
||||
import it.integry.integrywmsnative.core.model.key.MtbColtKey;
|
||||
import it.integry.integrywmsnative.core.model.observable.ObservableMtbTcol;
|
||||
import it.integry.integrywmsnative.core.model.secondary.GestioneEnum;
|
||||
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
||||
@@ -73,7 +75,7 @@ public class MtbColt extends EntityBase {
|
||||
@SerializedName("dataOrd")
|
||||
private String dataOrd;
|
||||
@SerializedName("dataDoc")
|
||||
private String dataDoc;
|
||||
private LocalDate dataDoc;
|
||||
@SerializedName("oraInizPrep")
|
||||
private String oraInizPrep;
|
||||
@SerializedName("oraFinePrep")
|
||||
@@ -135,6 +137,27 @@ public class MtbColt extends EntityBase {
|
||||
}
|
||||
}
|
||||
|
||||
public MtbColtKey getKey() {
|
||||
if (UtilityString.isNullOrEmpty(gestione) ||
|
||||
UtilityString.isNullOrEmpty(serCollo) ||
|
||||
getDataColloLD() == null ||
|
||||
numCollo == null)
|
||||
return null;
|
||||
|
||||
return new MtbColtKey(gestione, serCollo, getDataColloLD(), numCollo);
|
||||
}
|
||||
|
||||
public DtbDoctKey getDocumentKey() {
|
||||
if (UtilityString.isNullOrEmpty(codAnag) ||
|
||||
UtilityString.isNullOrEmpty(codDtip) ||
|
||||
UtilityString.isNullOrEmpty(serDoc) ||
|
||||
dataDoc == null ||
|
||||
numDoc == null)
|
||||
return null;
|
||||
|
||||
return new DtbDoctKey(codAnag, codDtip, dataDoc, numDoc, serDoc);
|
||||
}
|
||||
|
||||
public MtbColt initDefaultFields(GestioneEnum gestioneEnum) {
|
||||
setGestione(gestioneEnum);
|
||||
setCodMdep(SettingsManager.i().getUserSession().getDepo().getCodMdep());
|
||||
@@ -410,11 +433,11 @@ public class MtbColt extends EntityBase {
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getDataDoc() {
|
||||
public LocalDate getDataDoc() {
|
||||
return dataDoc;
|
||||
}
|
||||
|
||||
public MtbColt setDataDoc(String dataDoc) {
|
||||
public MtbColt setDataDoc(LocalDate dataDoc) {
|
||||
this.dataDoc = dataDoc;
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ public class DtbDoctKey {
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
if (o == null || (getClass() != o.getClass() && !getClass().isAssignableFrom(o.getClass()))) return false;
|
||||
DtbDoctKey that = (DtbDoctKey) o;
|
||||
return Objects.equals(codAnag, that.codAnag) &&
|
||||
Objects.equals(codDtip, that.codDtip) &&
|
||||
@@ -45,6 +45,7 @@ public class DtbDoctKey {
|
||||
Objects.equals(serDoc, that.serDoc);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(codAnag, codDtip, dataDoc, numDoc, serDoc);
|
||||
|
||||
@@ -132,7 +132,7 @@ public class ArticoloRESTConsumer extends _BaseRESTConsumer {
|
||||
var codMarts = codMartToFind.parallelStream()
|
||||
.filter(Objects::nonNull)
|
||||
.distinct()
|
||||
.collect(Collectors.toUnmodifiableList());
|
||||
.collect(Collectors.toUnmodifiableList());
|
||||
ArticoloRESTConsumerService articoloRESTConsumer = restBuilder.getService(ArticoloRESTConsumerService.class);
|
||||
var response = articoloRESTConsumer
|
||||
.getByCodMart(new RetrieveArticoloByCodMartRequestDTO()
|
||||
|
||||
@@ -16,7 +16,6 @@ import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
||||
import it.integry.integrywmsnative.core.rest.model.udc.CloseUDCRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.udc.CloseUDCResponseDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.udc.CreateUDCRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.udc.CreateUDCResponseDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.udc.DeleteUDCRowRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.udc.EditUDCRowRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.InsertUDCRowRequestDTO;
|
||||
@@ -35,21 +34,21 @@ public class ColliAccettazioneRESTConsumer extends _BaseRESTConsumer implements
|
||||
}
|
||||
|
||||
@Override
|
||||
public CreateUDCResponseDTO synchronousCreateUDC(CreateUDCRequestDTO createUDCRequestDTO) throws Exception {
|
||||
public MtbColt synchronousCreateUDC(CreateUDCRequestDTO createUDCRequestDTO) throws Exception {
|
||||
ColliAccettazioneRESTConsumerService colliAccettazioneRESTConsumerService = restBuilder.getService(ColliAccettazioneRESTConsumerService.class);
|
||||
|
||||
var response = colliAccettazioneRESTConsumerService.createUDC(createUDCRequestDTO)
|
||||
.execute();
|
||||
|
||||
var data = analyzeAnswer(response, "accettazione/createUDC");
|
||||
return data;
|
||||
return data.getMtbColt();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createUDC(CreateUDCRequestDTO createUDCRequestDTO, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
executorService.execute(() -> {
|
||||
try {
|
||||
MtbColt result = synchronousCreateUDC(createUDCRequestDTO).getMtbColt();
|
||||
MtbColt result = synchronousCreateUDC(createUDCRequestDTO);
|
||||
onComplete.run(result);
|
||||
} catch (Exception e) {
|
||||
onFailed.run(e);
|
||||
|
||||
@@ -20,7 +20,6 @@ import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
||||
import it.integry.integrywmsnative.core.rest.model.udc.CloseUDCRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.udc.CloseUDCResponseDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.udc.CreateUDCRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.udc.CreateUDCResponseDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.udc.DeleteUDCRowRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.udc.EditUDCRowRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.CloseUDSRequestDTO;
|
||||
@@ -51,21 +50,21 @@ public class ColliLavorazioneRESTConsumer extends _BaseRESTConsumer implements C
|
||||
}
|
||||
|
||||
@Override
|
||||
public CreateUDCResponseDTO synchronousCreateUDC(CreateUDCRequestDTO createUDCRequestDTO) throws Exception {
|
||||
public MtbColt synchronousCreateUDC(CreateUDCRequestDTO createUDCRequestDTO) throws Exception {
|
||||
ColliLavorazioneRESTConsumerService colliLavorazioneRESTConsumerService = restBuilder.getService(ColliLavorazioneRESTConsumerService.class);
|
||||
|
||||
var response = colliLavorazioneRESTConsumerService.createUDC(createUDCRequestDTO)
|
||||
.execute();
|
||||
|
||||
var data = analyzeAnswer(response, "lavorazione/createUDC");
|
||||
return data;
|
||||
return data.getMtbColt();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createUDC(CreateUDCRequestDTO createUDCRequestDTO, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
executorService.execute(() -> {
|
||||
try {
|
||||
MtbColt result = synchronousCreateUDC(createUDCRequestDTO).getMtbColt();
|
||||
MtbColt result = synchronousCreateUDC(createUDCRequestDTO);
|
||||
onComplete.run(result);
|
||||
} catch (Exception e) {
|
||||
onFailed.run(e);
|
||||
|
||||
@@ -290,6 +290,8 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
public List<MtbColr> fillMtbAartsOfMtbColrsSynchronized(List<MtbColr> mtbColrs) throws Exception {
|
||||
|
||||
List<String> codMarts = new ArrayList<>(mtbColrs.stream()
|
||||
|
||||
@@ -6,14 +6,13 @@ import it.integry.integrywmsnative.core.model.MtbColt;
|
||||
import it.integry.integrywmsnative.core.rest.model.udc.CloseUDCRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.udc.CloseUDCResponseDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.udc.CreateUDCRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.udc.CreateUDCResponseDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.udc.DeleteUDCRowRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.udc.EditUDCRowRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.InsertUDCRowRequestDTO;
|
||||
|
||||
public interface ColliCaricoRESTConsumerInterface {
|
||||
|
||||
CreateUDCResponseDTO synchronousCreateUDC(CreateUDCRequestDTO createUDCRequestDTO) throws Exception;
|
||||
MtbColt synchronousCreateUDC(CreateUDCRequestDTO createUDCRequestDTO) throws Exception;
|
||||
void createUDC(CreateUDCRequestDTO createUDCRequestDTO, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed);
|
||||
|
||||
CloseUDCResponseDTO synchronousCloseUDC(CloseUDCRequestDTO closeUDCRequestDTO) throws Exception;
|
||||
|
||||
@@ -43,6 +43,9 @@ public class CreateUDSRequestDTO {
|
||||
@SerializedName("orderRequired")
|
||||
private boolean orderRequired;
|
||||
|
||||
@SerializedName("reso")
|
||||
private boolean reso;
|
||||
|
||||
@SerializedName("orders")
|
||||
private List<CreateUDSRequestOrderDTO> orders;
|
||||
|
||||
@@ -145,6 +148,15 @@ public class CreateUDSRequestDTO {
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isReso() {
|
||||
return reso;
|
||||
}
|
||||
|
||||
public CreateUDSRequestDTO setReso(boolean reso) {
|
||||
this.reso = reso;
|
||||
return this;
|
||||
}
|
||||
|
||||
public List<CreateUDSRequestOrderDTO> getOrders() {
|
||||
return orders;
|
||||
}
|
||||
|
||||
@@ -49,10 +49,14 @@ public class InsertUDCRowRequestDTO {
|
||||
@SerializedName("codDtip")
|
||||
private String codDtip;
|
||||
|
||||
@SerializedName("pesoNettoKg")
|
||||
private BigDecimal pesoNettoKg;
|
||||
@SerializedName("pesoLordoKg")
|
||||
private BigDecimal pesoLordoKg;
|
||||
|
||||
|
||||
@SerializedName("customBarcodeUlIn")
|
||||
private String customBarcodeUlIn;
|
||||
@SerializedName("customCodMdepIn")
|
||||
private String customCodMdepIn;
|
||||
@SerializedName("customPosizioneIn")
|
||||
private String customPosizioneIn;
|
||||
|
||||
@SerializedName("documentReso")
|
||||
private DtbDocrKey documentReso;
|
||||
@@ -220,20 +224,31 @@ public class InsertUDCRowRequestDTO {
|
||||
return this;
|
||||
}
|
||||
|
||||
public BigDecimal getPesoNettoKg() {
|
||||
return pesoNettoKg;
|
||||
public String getCustomBarcodeUlIn() {
|
||||
return customBarcodeUlIn;
|
||||
}
|
||||
|
||||
public void setPesoNettoKg(BigDecimal pesoNettoKg) {
|
||||
this.pesoNettoKg = pesoNettoKg;
|
||||
public InsertUDCRowRequestDTO setCustomBarcodeUlIn(String customBarcodeUlIn) {
|
||||
this.customBarcodeUlIn = customBarcodeUlIn;
|
||||
return this;
|
||||
}
|
||||
|
||||
public BigDecimal getPesoLordoKg() {
|
||||
return pesoLordoKg;
|
||||
public String getCustomCodMdepIn() {
|
||||
return customCodMdepIn;
|
||||
}
|
||||
|
||||
public void setPesoLordoKg(BigDecimal pesoLordoKg) {
|
||||
this.pesoLordoKg = pesoLordoKg;
|
||||
public InsertUDCRowRequestDTO setCustomCodMdepIn(String customCodMdepIn) {
|
||||
this.customCodMdepIn = customCodMdepIn;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getCustomPosizioneIn() {
|
||||
return customPosizioneIn;
|
||||
}
|
||||
|
||||
public InsertUDCRowRequestDTO setCustomPosizioneIn(String customPosizioneIn) {
|
||||
this.customPosizioneIn = customPosizioneIn;
|
||||
return this;
|
||||
}
|
||||
|
||||
public DtbDocrKey getDocumentReso() {
|
||||
|
||||
@@ -7,6 +7,7 @@ import java.time.LocalDate;
|
||||
|
||||
import it.integry.integrywmsnative.core.model.MtbColr;
|
||||
import it.integry.integrywmsnative.core.model.MtbColt;
|
||||
import it.integry.integrywmsnative.core.model.key.DtbDocrKey;
|
||||
|
||||
public class InsertUDSRowRequestDTO {
|
||||
|
||||
@@ -31,6 +32,9 @@ public class InsertUDSRowRequestDTO {
|
||||
@SerializedName("codJcom")
|
||||
private String codJcom;
|
||||
|
||||
@SerializedName("documentReso")
|
||||
private DtbDocrKey documentReso;
|
||||
|
||||
public MtbColr getSourceMtbColr() {
|
||||
return sourceMtbColr;
|
||||
}
|
||||
@@ -111,4 +115,13 @@ public class InsertUDSRowRequestDTO {
|
||||
this.codJcom = codJcom;
|
||||
return this;
|
||||
}
|
||||
|
||||
public DtbDocrKey getDocumentReso() {
|
||||
return documentReso;
|
||||
}
|
||||
|
||||
public InsertUDSRowRequestDTO setDocumentReso(DtbDocrKey documentReso) {
|
||||
this.documentReso = documentReso;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -141,7 +141,7 @@ public class UpdatesManager {
|
||||
try {
|
||||
fileDownloader.download();
|
||||
} catch (Exception e) {
|
||||
progressDialogBuilder.dismissAllowingStateLoss();
|
||||
progressDialogBuilder.dismiss();
|
||||
UtilityExceptions.defaultException(context, e);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -1,25 +1,27 @@
|
||||
package it.integry.integrywmsnative.core.utility;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.text.Html;
|
||||
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
|
||||
import com.annimon.stream.Stream;
|
||||
import com.google.firebase.crashlytics.FirebaseCrashlytics;
|
||||
import com.orhanobut.logger.Logger;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import it.integry.integrywmsnative.BuildConfig;
|
||||
import it.integry.integrywmsnative.core.barcode_reader.BarcodeManager;
|
||||
import it.integry.integrywmsnative.core.exception.InvalidConnectionException;
|
||||
import it.integry.integrywmsnative.core.exception.InvalidLUException;
|
||||
import it.integry.integrywmsnative.core.exception.InvalidLUGestioneException;
|
||||
import it.integry.integrywmsnative.core.helper.ContextHelper;
|
||||
import it.integry.integrywmsnative.core.rest.CommonRESTException;
|
||||
import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleMessageView;
|
||||
|
||||
public class UtilityExceptions {
|
||||
|
||||
private static Handler handler = new Handler(Looper.getMainLooper());
|
||||
|
||||
private static final Class<?>[] FIREBASE_IGNORED_EXCEPTIONS = new Class[]{
|
||||
InvalidConnectionException.class,
|
||||
InvalidLUGestioneException.class,
|
||||
@@ -46,19 +48,24 @@ public class UtilityExceptions {
|
||||
if (ex.getCause() != null) errorMessage += "<br />" + ex.getCause().getMessage();
|
||||
}
|
||||
|
||||
FragmentManager fm = ContextHelper.getFragmentManagerFromContext(context);
|
||||
|
||||
if (fm != null) {
|
||||
boolean isBarcodeEnabled = BarcodeManager.isLastCallbackEnabled();
|
||||
if (isBarcodeEnabled) BarcodeManager.disableLastCallback();
|
||||
DialogSimpleMessageView.makeErrorDialog(Html.fromHtml(errorMessage), null, () -> {
|
||||
// FragmentManager fm = ContextHelper.getFragmentManagerFromContext(context);
|
||||
|
||||
// if (fm != null) {
|
||||
boolean isBarcodeEnabled = BarcodeManager.isLastCallbackEnabled();
|
||||
if (isBarcodeEnabled) BarcodeManager.disableLastCallback();
|
||||
|
||||
String finalErrorMessage = errorMessage;
|
||||
handler.post(() -> {
|
||||
DialogSimpleMessageView.makeErrorDialog(context, Html.fromHtml(finalErrorMessage), null, () -> {
|
||||
if (isBarcodeEnabled) BarcodeManager.enableLastCallback();
|
||||
})
|
||||
.show(fm, "tag");
|
||||
}
|
||||
.show();
|
||||
});
|
||||
// }
|
||||
|
||||
boolean toIgnore = ex.getClass().getName().startsWith("it.integry.integrywmsnative") ||
|
||||
Stream.of(FIREBASE_IGNORED_EXCEPTIONS).anyMatch(x -> x.isAssignableFrom(ex.getClass()));
|
||||
Arrays.stream(FIREBASE_IGNORED_EXCEPTIONS).anyMatch(x -> x.isAssignableFrom(ex.getClass()));
|
||||
|
||||
if (!BuildConfig.DEBUG && !toIgnore) {
|
||||
if (sendEmail) UtilityLogger.error(ex);
|
||||
|
||||
@@ -3,6 +3,8 @@ package it.integry.integrywmsnative.core.utility;
|
||||
import android.content.Context;
|
||||
import android.content.pm.PackageInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.res.ColorStateList;
|
||||
import android.util.TypedValue;
|
||||
|
||||
import androidx.annotation.RawRes;
|
||||
import androidx.annotation.StringRes;
|
||||
@@ -69,4 +71,19 @@ public class UtilityResources {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// Funzione di utilità per ottenere un colore da un attributo del tema
|
||||
public static int getColorResourceFromAttr(Context context, int attrRes) {
|
||||
TypedValue typedValue = new TypedValue();
|
||||
context.getTheme().resolveAttribute(attrRes, typedValue, true);
|
||||
return typedValue.data;
|
||||
}
|
||||
|
||||
public static ColorStateList getColorStateListFromAttr(Context context, int attrRes) {
|
||||
return ColorStateList.valueOf(getColorResourceFromAttr(context, attrRes));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -478,13 +478,13 @@ public class AccettazioneBollaPickingActivity extends BaseActivity implements Ac
|
||||
|
||||
@Override
|
||||
public void onMtbColrDeleteRequest(RunnableArgs<Boolean> onComplete) {
|
||||
runOnUiThread(() -> {
|
||||
handler.post(() -> {
|
||||
String text = getResources().getString(R.string.alert_delete_mtb_colr);
|
||||
DialogSimpleMessageView.makeWarningDialog(new SpannableString(text),
|
||||
DialogSimpleMessageView.makeWarningDialog(this, new SpannableString(text),
|
||||
null,
|
||||
() -> onComplete.run(true),
|
||||
() -> onComplete.run(false)
|
||||
).show(getSupportFragmentManager(), "tag");
|
||||
).show();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -522,11 +522,13 @@ public class AccettazioneBollaPickingActivity extends BaseActivity implements Ac
|
||||
|
||||
@Override
|
||||
public void onLUSuccessullyPrinted() {
|
||||
Resources res = getResources();
|
||||
String errorMessage = res.getText(R.string.alert_print_completed_message).toString();
|
||||
DialogSimpleMessageView
|
||||
.makeSuccessDialog(res.getText(R.string.completed).toString(), new SpannableString(errorMessage), null, null)
|
||||
.show(getSupportFragmentManager(), "tag");
|
||||
handler.post(() -> {
|
||||
Resources res = getResources();
|
||||
String errorMessage = res.getText(R.string.alert_print_completed_message).toString();
|
||||
DialogSimpleMessageView
|
||||
.makeSuccessDialog(this, res.getText(R.string.completed).toString(), new SpannableString(errorMessage), null, null)
|
||||
.show();
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -538,13 +540,15 @@ public class AccettazioneBollaPickingActivity extends BaseActivity implements Ac
|
||||
@Override
|
||||
public void onLUPrintError(Exception ex, Runnable onComplete) {
|
||||
this.onLoadingEnded();
|
||||
DialogSimpleMessageView.makeErrorDialog(
|
||||
new SpannableString(ex.getMessage()),
|
||||
null,
|
||||
null,
|
||||
R.string.button_ignore_print,
|
||||
onComplete)
|
||||
.show(getSupportFragmentManager(), "tag");
|
||||
handler.post(() -> {
|
||||
DialogSimpleMessageView.makeErrorDialog(this,
|
||||
new SpannableString(ex.getMessage()),
|
||||
null,
|
||||
null,
|
||||
R.string.button_ignore_print,
|
||||
onComplete)
|
||||
.show();
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -704,12 +708,14 @@ public class AccettazioneBollaPickingActivity extends BaseActivity implements Ac
|
||||
|
||||
@Override
|
||||
public void onConfirmAnomalie(int anomalie, RunnableArgs<Boolean> onConfirm) {
|
||||
DialogSimpleMessageView.makeWarningDialog(new SpannableString(Html.fromHtml(String.format(getString(R.string.confirm_anomalie), anomalie))),
|
||||
null, () -> {
|
||||
onConfirm.run(true);
|
||||
}, () -> {
|
||||
onConfirm.run(false);
|
||||
})
|
||||
.show(getSupportFragmentManager(), "tag");
|
||||
handler.post(() -> {
|
||||
DialogSimpleMessageView.makeWarningDialog(this, new SpannableString(Html.fromHtml(String.format(getString(R.string.confirm_anomalie), anomalie))),
|
||||
null, () -> {
|
||||
onConfirm.run(true);
|
||||
}, () -> {
|
||||
onConfirm.run(false);
|
||||
})
|
||||
.show();
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -275,32 +275,35 @@ public class MainAccettazioneOrdiniElencoFragment extends BaseFragment implement
|
||||
|
||||
@Override
|
||||
public void onOrdersDispatched(List<OrdineAccettazioneInevasoDTO> orders, List<SitArtOrdDTO> sitArts) {
|
||||
long artsCounter = Stream.of(sitArts)
|
||||
.filter(x -> UtilityBigDecimal.greaterThan(x.getQtaDaEvadere(), BigDecimal.ZERO))
|
||||
.map(SitArtOrdDTO::getCodMart)
|
||||
.distinct()
|
||||
.count();
|
||||
handler.post(() -> {
|
||||
|
||||
long ordsCounter = Stream.of(sitArts)
|
||||
.distinctBy(x -> x.getDataOrd() + " " + x.getNumOrd() + " " + x.getGestione())
|
||||
.count();
|
||||
long artsCounter = sitArts.stream()
|
||||
.filter(x -> UtilityBigDecimal.greaterThan(x.getQtaDaEvadere(), BigDecimal.ZERO))
|
||||
.map(SitArtOrdDTO::getCodMart)
|
||||
.distinct()
|
||||
.count();
|
||||
|
||||
long ordsCounter = Stream.of(sitArts)
|
||||
.distinctBy(x -> x.getDataOrd() + " " + x.getNumOrd() + " " + x.getGestione())
|
||||
.count();
|
||||
|
||||
|
||||
DialogSimpleMessageView.makeInfoDialog(getText(R.string.orders).toString(),
|
||||
Html.fromHtml(String.format(getActivity().getResources().getQuantityString(R.plurals.loaded_orders_message, (int) ordsCounter), ordsCounter)
|
||||
+ "<br /><br />" +
|
||||
"<b>" + artsCounter + "</b> " + getActivity().getResources().getQuantityString(R.plurals.ordered_articles, (int) artsCounter)),
|
||||
null,
|
||||
() -> {
|
||||
DialogSimpleMessageView.makeInfoDialog(requireContext(), getText(R.string.orders).toString(),
|
||||
Html.fromHtml(String.format(getActivity().getResources().getQuantityString(R.plurals.loaded_orders_message, (int) ordsCounter), ordsCounter)
|
||||
+ "<br /><br />" +
|
||||
"<b>" + artsCounter + "</b> " + getActivity().getResources().getQuantityString(R.plurals.ordered_articles, (int) artsCounter)),
|
||||
null,
|
||||
() -> {
|
||||
|
||||
String cacheSitArtItemID = DataCache.addItem(sitArts);
|
||||
String cacheOrdersItemID = DataCache.addItem(orders);
|
||||
String cacheSitArtItemID = DataCache.addItem(sitArts);
|
||||
String cacheOrdersItemID = DataCache.addItem(orders);
|
||||
|
||||
Intent myIntent = new Intent(getActivity(), AccettazioneOrdiniPickingActivity.class);
|
||||
myIntent.putExtra("keyOrders", cacheOrdersItemID);
|
||||
myIntent.putExtra("keySitArts", cacheSitArtItemID);
|
||||
getActivity().startActivity(myIntent);
|
||||
Intent myIntent = new Intent(getActivity(), AccettazioneOrdiniPickingActivity.class);
|
||||
myIntent.putExtra("keyOrders", cacheOrdersItemID);
|
||||
myIntent.putExtra("keySitArts", cacheSitArtItemID);
|
||||
getActivity().startActivity(myIntent);
|
||||
|
||||
}).show(getActivity().getSupportFragmentManager(), "tag");
|
||||
}).show();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -719,7 +719,12 @@ public class AccettazioneOrdiniPickingActivity extends BaseActivity implements A
|
||||
public void onLUSuccessullyPrinted() {
|
||||
Resources res = getResources();
|
||||
String errorMessage = res.getText(R.string.alert_print_completed_message).toString();
|
||||
DialogSimpleMessageView.makeSuccessDialog(res.getText(R.string.completed).toString(), new SpannableString(errorMessage), null, null).show(getSupportFragmentManager(), "tag");
|
||||
handler.post(() -> {
|
||||
DialogSimpleMessageView.makeSuccessDialog(this,
|
||||
res.getText(R.string.completed).toString(),
|
||||
new SpannableString(errorMessage), null, null)
|
||||
.show();
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -730,7 +735,9 @@ public class AccettazioneOrdiniPickingActivity extends BaseActivity implements A
|
||||
@Override
|
||||
public void onLUPrintError(Exception ex, Runnable onComplete) {
|
||||
this.onLoadingEnded();
|
||||
DialogSimpleMessageView.makeErrorDialog(new SpannableString(ex.getMessage()), null, null, R.string.button_ignore_print, onComplete).show(getSupportFragmentManager(), "tag");
|
||||
handler.post(() -> {
|
||||
DialogSimpleMessageView.makeErrorDialog(this, new SpannableString(ex.getMessage()), null, null, R.string.button_ignore_print, onComplete).show();
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -785,11 +792,11 @@ public class AccettazioneOrdiniPickingActivity extends BaseActivity implements A
|
||||
|
||||
@Override
|
||||
public void onWarning(String warningText, Runnable action) {
|
||||
this.runOnUiThread(() -> {
|
||||
handler.post(() -> {
|
||||
this.onLoadingEnded();
|
||||
DialogSimpleMessageView
|
||||
.makeWarningDialog(new SpannableString(Html.fromHtml(warningText)), null, action)
|
||||
.show(getSupportFragmentManager(), "tag");
|
||||
.makeWarningDialog(this, new SpannableString(Html.fromHtml(warningText)), null, action)
|
||||
.show();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -850,9 +857,14 @@ public class AccettazioneOrdiniPickingActivity extends BaseActivity implements A
|
||||
|
||||
@Override
|
||||
public void onMtbColrDeleteRequest(RunnableArgs<Boolean> onComplete) {
|
||||
runOnUiThread(() -> {
|
||||
handler.post(() -> {
|
||||
String text = getResources().getString(R.string.alert_delete_mtb_colr);
|
||||
DialogSimpleMessageView.makeWarningDialog(new SpannableString(text), null, () -> onComplete.run(true), () -> onComplete.run(false)).show(getSupportFragmentManager(), "tag");
|
||||
DialogSimpleMessageView.makeWarningDialog(this,
|
||||
new SpannableString(text),
|
||||
null,
|
||||
() -> onComplete.run(true),
|
||||
() -> onComplete.run(false))
|
||||
.show();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -125,11 +125,12 @@ public class DocInterniFragment extends BaseFragment implements ITitledFragment,
|
||||
|
||||
@Override
|
||||
public void onWarning(String warningText, Runnable action) {
|
||||
this.requireActivity().runOnUiThread(() -> {
|
||||
handler.post(() -> {
|
||||
this.onLoadingEnded();
|
||||
DialogSimpleMessageView
|
||||
.makeWarningDialog(new SpannableString(Html.fromHtml(warningText)), null, action)
|
||||
.show(requireActivity().getSupportFragmentManager(), "tag");
|
||||
.makeWarningDialog(requireContext(),
|
||||
new SpannableString(Html.fromHtml(warningText)), null, action)
|
||||
.show();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -380,7 +380,7 @@ public class DocInterniEditFormActivity extends BaseActivity implements DocInter
|
||||
|
||||
@Override
|
||||
public void onDocExported() {
|
||||
runOnUiThread(() -> {
|
||||
handler.post(() -> {
|
||||
DialogCommon.showDataSaved(this, this::closeEdit);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -142,7 +142,7 @@ public class ContenutoBancaleActivity extends BaseActivity implements ContenutoB
|
||||
fabPopupMenu.getMenu().removeItem(R.id.delete_ul);
|
||||
}
|
||||
|
||||
if(!recoverFabMenuVisible) {
|
||||
if (!recoverFabMenuVisible) {
|
||||
fabPopupMenu.getMenu().removeItem(R.id.recover_ul);
|
||||
}
|
||||
|
||||
@@ -176,12 +176,14 @@ public class ContenutoBancaleActivity extends BaseActivity implements ContenutoB
|
||||
this.mPrinterRESTConsumer.printCollo(mtbColt.get(),
|
||||
() -> {
|
||||
this.onLoadingEnded();
|
||||
|
||||
Resources res = this.getResources();
|
||||
String errorMessage = res.getText(R.string.alert_print_completed_message).toString();
|
||||
DialogSimpleMessageView
|
||||
.makeSuccessDialog(res.getText(R.string.completed).toString(), new SpannableString(errorMessage), null, null)
|
||||
.show(getSupportFragmentManager(), "tag");
|
||||
handler.post(() -> {
|
||||
Resources res = this.getResources();
|
||||
String errorMessage = res.getText(R.string.alert_print_completed_message).toString();
|
||||
DialogSimpleMessageView
|
||||
.makeSuccessDialog(this,
|
||||
res.getText(R.string.completed).toString(), new SpannableString(errorMessage), null, null)
|
||||
.show();
|
||||
});
|
||||
}, this::onError);
|
||||
|
||||
} catch (Exception ex) {
|
||||
@@ -192,29 +194,32 @@ public class ContenutoBancaleActivity extends BaseActivity implements ContenutoB
|
||||
public void deleteUL() {
|
||||
String text = getResources().getString(R.string.alert_delete_UL);
|
||||
|
||||
DialogSimpleMessageView.makeWarningDialog(new SpannableString(Html.fromHtml(text)), null, () -> this.runOnUiThread(() -> {
|
||||
this.onLoadingStarted();
|
||||
handler.post(() -> {
|
||||
DialogSimpleMessageView.makeWarningDialog(this,
|
||||
new SpannableString(Html.fromHtml(text)), null, () -> this.runOnUiThread(() -> {
|
||||
this.onLoadingStarted();
|
||||
|
||||
try {
|
||||
DeleteULRequestDTO deleteULRequestDTO = new DeleteULRequestDTO()
|
||||
.setMtbColt(this.mtbColt.get());
|
||||
try {
|
||||
DeleteULRequestDTO deleteULRequestDTO = new DeleteULRequestDTO()
|
||||
.setMtbColt(this.mtbColt.get());
|
||||
|
||||
mColliMagazzinoRESTConsumer.deleteUL(deleteULRequestDTO, () -> {
|
||||
Intent data = new Intent();
|
||||
String key = DataCache.addItem(this.mtbColt.get());
|
||||
String keyDeleteUL = DataCache.addItem(true);
|
||||
data.putExtra("key", key)
|
||||
.putExtra("keyDeleteUL", keyDeleteUL);
|
||||
mColliMagazzinoRESTConsumer.deleteUL(deleteULRequestDTO, () -> {
|
||||
Intent data = new Intent();
|
||||
String key = DataCache.addItem(this.mtbColt.get());
|
||||
String keyDeleteUL = DataCache.addItem(true);
|
||||
data.putExtra("key", key)
|
||||
.putExtra("keyDeleteUL", keyDeleteUL);
|
||||
|
||||
this.onLoadingEnded();
|
||||
this.setResult(RESULT_OK, data);
|
||||
this.finish();
|
||||
}, this::onError);
|
||||
} catch (Exception ex) {
|
||||
this.onError(ex);
|
||||
}
|
||||
}), () -> {
|
||||
}).show(this.getSupportFragmentManager(), "tag");
|
||||
this.onLoadingEnded();
|
||||
this.setResult(RESULT_OK, data);
|
||||
this.finish();
|
||||
}, this::onError);
|
||||
} catch (Exception ex) {
|
||||
this.onError(ex);
|
||||
}
|
||||
}), () -> {
|
||||
}).show();
|
||||
});
|
||||
}
|
||||
|
||||
public void showFabMenu() {
|
||||
|
||||
@@ -6,8 +6,6 @@ import android.text.Html;
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.databinding.DataBindingUtil;
|
||||
|
||||
import com.google.firebase.installations.FirebaseInstallations;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.inject.Inject;
|
||||
@@ -108,12 +106,12 @@ public class LoginActivity extends BaseActivity implements LoginViewModel.Listen
|
||||
public void onLoginCompleted(String fullName) {
|
||||
|
||||
this.onLoadingEnded();
|
||||
runOnUiThread(() -> DialogSimpleMessageView.makeSuccessDialog(
|
||||
handler.post(() -> DialogSimpleMessageView.makeSuccessDialog(this,
|
||||
"Benvenuto",
|
||||
Html.fromHtml("Ciao <b>" + fullName + "</b>, la Integry le augura di svolgere al meglio il suo lavoro"),
|
||||
null,
|
||||
this::startSplashActivity)
|
||||
.show(getSupportFragmentManager(), "tag"));
|
||||
.show());
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -832,31 +832,34 @@ public class OrdiniUscitaElencoFragment extends BaseFragment implements ITitledF
|
||||
|
||||
@Override
|
||||
public void onOrdersDispatched(List<OrdineUscitaInevasoDTO> orders, List<SitArtOrdDTO> sitArts, List<AlreadyRegisteredUlDTO> alreadyRegisteredMtbColts) {
|
||||
List<String> codMarts = Stream.of(sitArts)
|
||||
.distinctBy(SitArtOrdDTO::getCodMart)
|
||||
.map(SitArtOrdDTO::getCodMart)
|
||||
.toList();
|
||||
handler.post(() -> {
|
||||
|
||||
int alreadyRegisteredUL = alreadyRegisteredMtbColts.size();
|
||||
List<String> codMarts = sitArts.stream()
|
||||
.map(SitArtOrdDTO::getCodMart)
|
||||
.distinct()
|
||||
.toList();
|
||||
|
||||
boolean divideByGrpMerc = SettingsManager.iDB().isGroupShippingByCommodityGroup();
|
||||
int alreadyRegisteredUL = alreadyRegisteredMtbColts.size();
|
||||
|
||||
DialogSimpleMessageView.makeInfoDialog(getText(R.string.orders).toString(),
|
||||
Html.fromHtml(String.format(getActivity().getResources().getQuantityString(R.plurals.loaded_orders_message, orders.size()), orders.size())
|
||||
+ "<br />" +
|
||||
"<b>" + codMarts.size() + "</b> " + getActivity().getResources().getQuantityString(R.plurals.ordered_articles, codMarts.size())
|
||||
+ "<br />" +
|
||||
"<b>" + alreadyRegisteredUL + "</b> " + getActivity().getResources().getQuantityString(R.plurals.already_registered_lu, alreadyRegisteredUL)),
|
||||
null,
|
||||
() -> SpedizioneActivity.startActivity(getActivity(),
|
||||
sitArts,
|
||||
orders,
|
||||
mCurrentGestioneCol,
|
||||
mCurrentSegnoCol,
|
||||
MtbColr.Causale.DEFAULT,
|
||||
mDialogRowInfo,
|
||||
divideByGrpMerc)
|
||||
).show(getActivity().getSupportFragmentManager(), "tag");
|
||||
boolean divideByGrpMerc = SettingsManager.iDB().isGroupShippingByCommodityGroup();
|
||||
|
||||
DialogSimpleMessageView.makeInfoDialog(requireContext(), getText(R.string.orders).toString(),
|
||||
Html.fromHtml(String.format(getActivity().getResources().getQuantityString(R.plurals.loaded_orders_message, orders.size()), orders.size())
|
||||
+ "<br />" +
|
||||
"<b>" + codMarts.size() + "</b> " + getActivity().getResources().getQuantityString(R.plurals.ordered_articles, codMarts.size())
|
||||
+ "<br />" +
|
||||
"<b>" + alreadyRegisteredUL + "</b> " + getActivity().getResources().getQuantityString(R.plurals.already_registered_lu, alreadyRegisteredUL)),
|
||||
null,
|
||||
() -> SpedizioneActivity.startActivity(getActivity(),
|
||||
sitArts,
|
||||
orders,
|
||||
mCurrentGestioneCol,
|
||||
mCurrentSegnoCol,
|
||||
MtbColr.Causale.DEFAULT,
|
||||
mDialogRowInfo,
|
||||
divideByGrpMerc)
|
||||
).show();
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -60,7 +60,7 @@ import it.integry.integrywmsnative.view.dialogs.ask_commessa.DialogAskCommessaVi
|
||||
import it.integry.integrywmsnative.view.dialogs.ask_linea_prod.DialogAskLineaProdView;
|
||||
import it.integry.integrywmsnative.view.dialogs.ask_linea_prod.dto.DialogAskLineaProdResponse;
|
||||
import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleMessageView;
|
||||
import it.integry.integrywmsnative.view.dialogs.choose_arts_from_mtbcolr_list.DialogChooseArtsFromMtbColrList;
|
||||
import it.integry.integrywmsnative.view.dialogs.choose_arts_from_mtbcolr_list.DialogChooseArtsFromMtbColrListView;
|
||||
import it.integry.integrywmsnative.view.dialogs.input_quantity_v2.DialogInputQuantityV2DTO;
|
||||
import it.integry.integrywmsnative.view.dialogs.input_quantity_v2.DialogInputQuantityV2View;
|
||||
|
||||
@@ -299,12 +299,15 @@ public class PickingLiberoFragment extends BaseFragment implements ITitledFragme
|
||||
|
||||
@Override
|
||||
public void onMtbColrDeleteRequest(RunnableArgs<Boolean> onComplete) {
|
||||
String text = getResources().getString(R.string.alert_delete_mtb_colr);
|
||||
DialogSimpleMessageView.makeWarningDialog(new SpannableString(text),
|
||||
null,
|
||||
() -> onComplete.run(true),
|
||||
() -> onComplete.run(false)
|
||||
).show(requireActivity().getSupportFragmentManager(), DialogSimpleMessageView.class.getName());
|
||||
handler.post(() -> {
|
||||
String text = getResources().getString(R.string.alert_delete_mtb_colr);
|
||||
DialogSimpleMessageView.makeWarningDialog(requireContext(),
|
||||
new SpannableString(text),
|
||||
null,
|
||||
() -> onComplete.run(true),
|
||||
() -> onComplete.run(false)
|
||||
).show();
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -342,12 +345,17 @@ public class PickingLiberoFragment extends BaseFragment implements ITitledFragme
|
||||
|
||||
@Override
|
||||
public void onArtSelectionRequest(List<MtbColr> mtbColrsToPick, MtbAart mtbAart, RunnableArgs<List<MtbColr>> onComplete, Runnable onAbort) {
|
||||
DialogChooseArtsFromMtbColrList
|
||||
.newInstance(mtbColrsToPick, mtbAart, onComplete, () -> {
|
||||
onAbort.run();
|
||||
BarcodeManager.enable(mBarcodeScannerInstanceID);
|
||||
DialogChooseArtsFromMtbColrListView
|
||||
.newInstance(mtbColrsToPick, mtbAart, result -> {
|
||||
if (result == null || result.isAborted()) {
|
||||
onAbort.run();
|
||||
BarcodeManager.enable(mBarcodeScannerInstanceID);
|
||||
return;
|
||||
}
|
||||
|
||||
onComplete.run(result.getMtbColrList());
|
||||
})
|
||||
.show(requireActivity().getSupportFragmentManager(), DialogChooseArtsFromMtbColrList.class.getName());
|
||||
.show(requireActivity().getSupportFragmentManager(), DialogChooseArtsFromMtbColrListView.class.getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -94,7 +94,7 @@ public class PickingResiActivity extends BaseActivity implements BottomSheetFrag
|
||||
|
||||
private boolean mShouldCloseActivity;
|
||||
|
||||
public static void startActivity(Context context, String activityTitle, List<DocumentoResoDTO> documentoResoDTOList, Integer segno) {
|
||||
public static void startActivity(Context context, String activityTitle, List<DocumentoResoDTO> documentoResoDTOList, PickingResiViewModel.Tipologia tipoReso) {
|
||||
Intent intent = new Intent(context, PickingResiActivity.class);
|
||||
|
||||
intent.putExtra("activity_title", activityTitle);
|
||||
@@ -102,7 +102,7 @@ public class PickingResiActivity extends BaseActivity implements BottomSheetFrag
|
||||
String consegneCacheKey = DataCache.addItem(documentoResoDTOList);
|
||||
intent.putExtra("key", consegneCacheKey);
|
||||
|
||||
intent.putExtra("segno", segno);
|
||||
intent.putExtra("tipologia", tipoReso.getValue());
|
||||
|
||||
context.startActivity(intent);
|
||||
}
|
||||
@@ -114,7 +114,8 @@ public class PickingResiActivity extends BaseActivity implements BottomSheetFrag
|
||||
|
||||
mTitle = getIntent().getStringExtra("activity_title");
|
||||
mDocumentiResiList = DataCache.retrieveItem(getIntent().getStringExtra("key"));
|
||||
int defaultSegnoLU = getIntent().getIntExtra("segno", +1);
|
||||
PickingResiViewModel.Tipologia tipoReso =
|
||||
PickingResiViewModel.Tipologia.fromShort(getIntent().getShortExtra("tipologia", PickingResiViewModel.Tipologia.VENDITA.getValue()));
|
||||
|
||||
mBindings = DataBindingUtil.setContentView(this, R.layout.activity_picking_resi);
|
||||
|
||||
@@ -150,7 +151,7 @@ public class PickingResiActivity extends BaseActivity implements BottomSheetFrag
|
||||
|
||||
this.onLoadingStarted();
|
||||
try {
|
||||
this.mViewmodel.init(mDocumentiResiList, defaultSegnoLU, codMdep);
|
||||
this.mViewmodel.init(mDocumentiResiList, tipoReso, codMdep);
|
||||
this.onLoadingEnded();
|
||||
} catch (Exception ex) {
|
||||
this.onError(ex);
|
||||
@@ -219,7 +220,7 @@ public class PickingResiActivity extends BaseActivity implements BottomSheetFrag
|
||||
if (!noLUPresent.get()) {
|
||||
executorService.execute(() -> {
|
||||
try {
|
||||
this.mViewmodel.dispatchOrdineRow(clickedItem, refMtbColt);
|
||||
this.mViewmodel.dispatchDocumentRow(clickedItem, refMtbColt);
|
||||
} catch (Exception e) {
|
||||
this.onError(e);
|
||||
}
|
||||
@@ -244,6 +245,7 @@ public class PickingResiActivity extends BaseActivity implements BottomSheetFrag
|
||||
|
||||
pickingResiListModel.setGroupTitle(x.getCodDtip() + " - N° " + x.getNumDoc() + " del " + UtilityDate.formatDate(x.getDataDoc(), UtilityDate.COMMONS_DATE_FORMATS.DM_HUMAN));
|
||||
pickingResiListModel.setBadge1(x.getCodMart());
|
||||
pickingResiListModel.setBadge2(x.getPartitaMag());
|
||||
pickingResiListModel.setDescrizione(UtilityString.isNull(x.getDescrizioneEstesa(), x.getDescrizione()));
|
||||
pickingResiListModel.setActive(true);
|
||||
pickingResiListModel.setOriginalModel(x);
|
||||
@@ -472,14 +474,18 @@ public class PickingResiActivity extends BaseActivity implements BottomSheetFrag
|
||||
|
||||
@Override
|
||||
public void onFilterApplied(String newValue) {
|
||||
this.mBindings.filteredArtsInListExpandableLayout.expand(true);
|
||||
this.mBindings.descriptionFilterText.setText(!UtilityString.isNullOrEmpty(newValue) ? newValue : "");
|
||||
handler.post(() -> {
|
||||
this.mBindings.filteredArtsInListExpandableLayout.expand(true);
|
||||
this.mBindings.descriptionFilterText.setText(!UtilityString.isNullOrEmpty(newValue) ? newValue : "");
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFilterRemoved() {
|
||||
this.mBindings.filteredArtsInListExpandableLayout.collapse(true);
|
||||
this.mBindings.descriptionFilterText.setText("");
|
||||
handler.post(() -> {
|
||||
this.mBindings.filteredArtsInListExpandableLayout.collapse(true);
|
||||
this.mBindings.descriptionFilterText.setText("");
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -493,11 +499,11 @@ public class PickingResiActivity extends BaseActivity implements BottomSheetFrag
|
||||
public void onMtbColrDeleteRequest(RunnableArgs<Boolean> onComplete) {
|
||||
handler.post(() -> {
|
||||
String text = getResources().getString(R.string.alert_delete_mtb_colr);
|
||||
DialogSimpleMessageView.makeWarningDialog(new SpannableString(text),
|
||||
DialogSimpleMessageView.makeWarningDialog(this, new SpannableString(text),
|
||||
null,
|
||||
() -> onComplete.run(true),
|
||||
() -> onComplete.run(false)
|
||||
).show(getSupportFragmentManager(), "delete-row-dialog");
|
||||
).show();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -530,8 +536,10 @@ public class PickingResiActivity extends BaseActivity implements BottomSheetFrag
|
||||
Resources res = getResources();
|
||||
String errorMessage = res.getText(R.string.alert_print_completed_message).toString();
|
||||
DialogSimpleMessageView
|
||||
.makeSuccessDialog(res.getText(R.string.completed).toString(), new SpannableString(errorMessage), null, null)
|
||||
.show(getSupportFragmentManager(), "dialog-print-completed");
|
||||
.makeSuccessDialog(this,
|
||||
res.getText(R.string.completed).toString(),
|
||||
new SpannableString(errorMessage), null, null)
|
||||
.show();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -561,12 +569,15 @@ public class PickingResiActivity extends BaseActivity implements BottomSheetFrag
|
||||
@Override
|
||||
public void onLUPrintError(Exception ex, Runnable onComplete) {
|
||||
this.onLoadingEnded();
|
||||
DialogSimpleMessageView.makeErrorDialog(new SpannableString(ex.getMessage()),
|
||||
null,
|
||||
null,
|
||||
R.string.button_ignore_print,
|
||||
onComplete != null ? onComplete : () -> {
|
||||
})
|
||||
.show(getSupportFragmentManager(), "tag");
|
||||
handler.post(() -> {
|
||||
DialogSimpleMessageView.makeErrorDialog(this,
|
||||
new SpannableString(ex.getMessage()),
|
||||
null,
|
||||
null,
|
||||
R.string.button_ignore_print,
|
||||
onComplete != null ? onComplete : () -> {
|
||||
})
|
||||
.show();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,12 +5,12 @@ import android.os.Handler;
|
||||
import dagger.Module;
|
||||
import dagger.Provides;
|
||||
import it.integry.integrywmsnative.core.data_recover.ColliDataRecoverService;
|
||||
import it.integry.integrywmsnative.core.rest.RESTBuilder;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.ArticoloRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.BarcodeRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.ColliAccettazioneRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.ColliMagazzinoRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.ColliSpedizioneRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.OrdiniRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.PrinterRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.SystemRESTConsumer;
|
||||
import it.integry.integrywmsnative.gest.picking_resi.rest.PickingResiRESTConsumer;
|
||||
@@ -20,8 +20,8 @@ import it.integry.integrywmsnative.view.bottom_sheet__lu_content.BottomSheetFrag
|
||||
public class PickingResiModule {
|
||||
|
||||
@Provides
|
||||
PickingResiRESTConsumer providesPickingResiRESTConsumer(SystemRESTConsumer systemRESTConsumer, ArticoloRESTConsumer articoloRESTConsumer) {
|
||||
return new PickingResiRESTConsumer(systemRESTConsumer, articoloRESTConsumer);
|
||||
PickingResiRESTConsumer providesPickingResiRESTConsumer(RESTBuilder restBuilder, SystemRESTConsumer systemRESTConsumer, ArticoloRESTConsumer articoloRESTConsumer) {
|
||||
return new PickingResiRESTConsumer(restBuilder, systemRESTConsumer, articoloRESTConsumer);
|
||||
}
|
||||
|
||||
@Provides
|
||||
@@ -33,7 +33,6 @@ public class PickingResiModule {
|
||||
PickingResiViewModel providesPickingResiViewModel(Handler handler,
|
||||
ArticoloRESTConsumer articoloRESTConsumer,
|
||||
ColliDataRecoverService colliDataRecoverService,
|
||||
OrdiniRESTConsumer ordiniRESTConsumer,
|
||||
ColliAccettazioneRESTConsumer colliAccettazioneRESTConsumer,
|
||||
ColliSpedizioneRESTConsumer colliSpedizioneRESTConsumer,
|
||||
ColliMagazzinoRESTConsumer colliMagazzinoRESTConsumer,
|
||||
@@ -44,7 +43,6 @@ public class PickingResiModule {
|
||||
articoloRESTConsumer,
|
||||
barcodeRESTConsumer,
|
||||
colliDataRecoverService,
|
||||
ordiniRESTConsumer,
|
||||
colliAccettazioneRESTConsumer,
|
||||
colliSpedizioneRESTConsumer,
|
||||
colliMagazzinoRESTConsumer,
|
||||
|
||||
@@ -15,6 +15,7 @@ import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
@@ -38,20 +39,24 @@ import it.integry.integrywmsnative.core.rest.consumers.BarcodeRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.ColliAccettazioneRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.ColliMagazzinoRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.ColliSpedizioneRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.OrdiniRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.PrinterRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.model.DocumentoResoDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.udc.CreateUDCRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.udc.DeleteUDCRowRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.udc.EditUDCRowRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.CreateUDSRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.DeleteUDSRowRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.DeleteULRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.EditUDSRowRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.InsertUDCRowRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.InsertUDSRowRequestDTO;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityBarcode;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityBigDecimal;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityString;
|
||||
import it.integry.integrywmsnative.gest.picking_resi.exceptions.DocumentsLoadException;
|
||||
import it.integry.integrywmsnative.gest.picking_resi.rest.PickingResiRESTConsumer;
|
||||
import it.integry.integrywmsnative.gest.picking_resi.rest.WithdrawableDtbDocr;
|
||||
import it.integry.integrywmsnative.gest.picking_resi.rest.dto.ScaricoUdcInDocumentDTO;
|
||||
import it.integry.integrywmsnative.gest.spedizione.exceptions.NotCurrentYearLUException;
|
||||
import it.integry.integrywmsnative.gest.spedizione.model.PickedQuantityDTO;
|
||||
|
||||
@@ -65,16 +70,14 @@ public class PickingResiViewModel {
|
||||
|
||||
private MtbColt mCurrentMtbColt = null;
|
||||
|
||||
private String mDefaultGestioneOfLU;
|
||||
private String mDefaultCodAnagOfLU;
|
||||
private int mDefaultSegnoOfLU;
|
||||
private Tipologia mTipologiaReso;
|
||||
private String mDefaultCodMdepOfLU;
|
||||
|
||||
private final Handler mHandler;
|
||||
private final ArticoloRESTConsumer mArticoloRESTConsumer;
|
||||
private final BarcodeRESTConsumer mBarcodeRESTConsumer;
|
||||
private final ColliDataRecoverService mColliDataRecoverService;
|
||||
private final OrdiniRESTConsumer mOrdiniRestConsumerService;
|
||||
private final ColliAccettazioneRESTConsumer mColliAccettazioneRESTConsumer;
|
||||
private final ColliSpedizioneRESTConsumer mColliSpedizioneRESTConsumer;
|
||||
private final ColliMagazzinoRESTConsumer mColliMagazzinoRESTConsumer;
|
||||
@@ -87,7 +90,6 @@ public class PickingResiViewModel {
|
||||
ArticoloRESTConsumer articoloRESTConsumer,
|
||||
BarcodeRESTConsumer barcodeRESTConsumer,
|
||||
ColliDataRecoverService colliDataRecoverService,
|
||||
OrdiniRESTConsumer ordiniRESTConsumer,
|
||||
ColliAccettazioneRESTConsumer colliAccettazioneRESTConsumer,
|
||||
ColliSpedizioneRESTConsumer colliSpedizioneRESTConsumer,
|
||||
ColliMagazzinoRESTConsumer colliMagazzinoRESTConsumer,
|
||||
@@ -97,7 +99,6 @@ public class PickingResiViewModel {
|
||||
this.mArticoloRESTConsumer = articoloRESTConsumer;
|
||||
this.mBarcodeRESTConsumer = barcodeRESTConsumer;
|
||||
this.mColliDataRecoverService = colliDataRecoverService;
|
||||
this.mOrdiniRestConsumerService = ordiniRESTConsumer;
|
||||
this.mColliAccettazioneRESTConsumer = colliAccettazioneRESTConsumer;
|
||||
this.mColliSpedizioneRESTConsumer = colliSpedizioneRESTConsumer;
|
||||
this.mColliMagazzinoRESTConsumer = colliMagazzinoRESTConsumer;
|
||||
@@ -105,8 +106,8 @@ public class PickingResiViewModel {
|
||||
this.mPickingResiRESTConsumer = mPickingResiRESTConsumer;
|
||||
}
|
||||
|
||||
public void init(List<DocumentoResoDTO> documentList, int defaultSegnoLU, String codMdep) throws Exception {
|
||||
this.mDefaultSegnoOfLU = defaultSegnoLU;
|
||||
public void init(List<DocumentoResoDTO> documentList, Tipologia tipologiaReso, String codMdep) throws Exception {
|
||||
this.mTipologiaReso = tipologiaReso;
|
||||
this.mDefaultCodMdepOfLU = codMdep;
|
||||
|
||||
|
||||
@@ -132,8 +133,6 @@ public class PickingResiViewModel {
|
||||
throw new Exception("Sono stati caricati documenti con diverse gestioni");
|
||||
}
|
||||
|
||||
mDefaultGestioneOfLU = foundGestioni.get(0);
|
||||
|
||||
|
||||
List<String> foundCodAnags = Stream.of(documentList)
|
||||
.map(DocumentoResoDTO::getCodAnag)
|
||||
@@ -148,23 +147,38 @@ public class PickingResiViewModel {
|
||||
}
|
||||
|
||||
public void createNewLU(Integer customNumCollo, String customSerCollo) throws Exception {
|
||||
// mColliAccettazioneRESTConsumer.createUDC(new Cre);
|
||||
if (mTipologiaReso == Tipologia.VENDITA) {
|
||||
var createdUdc = mColliAccettazioneRESTConsumer.synchronousCreateUDC(new CreateUDCRequestDTO()
|
||||
.setCodAnag(mDefaultCodAnagOfLU)
|
||||
.setCodMdep(mDefaultCodMdepOfLU)
|
||||
.setNumCollo(customNumCollo)
|
||||
.setSerCollo(customSerCollo)
|
||||
.setReso(true));
|
||||
|
||||
var createUdcResponse = mColliAccettazioneRESTConsumer.synchronousCreateUDC(new CreateUDCRequestDTO()
|
||||
.setCodAnag(mDefaultCodAnagOfLU)
|
||||
.setCodMdep(mDefaultCodMdepOfLU)
|
||||
.setNumCollo(customNumCollo)
|
||||
.setSerCollo(customSerCollo)
|
||||
.setReso(true));
|
||||
this.mCurrentMtbColt = createdUdc;
|
||||
|
||||
this.mCurrentMtbColt = createUdcResponse.getMtbColt();
|
||||
this.sendLUOpened(createUdcResponse.getMtbColt());
|
||||
} else if (mTipologiaReso == Tipologia.ACQUISTO) {
|
||||
var createdUds = mColliSpedizioneRESTConsumer.createUDSSynchronized(new CreateUDSRequestDTO()
|
||||
.setCodAnag(mDefaultCodAnagOfLU)
|
||||
.setCodMdep(mDefaultCodMdepOfLU)
|
||||
.setNumCollo(customNumCollo)
|
||||
.setSerCollo(customSerCollo)
|
||||
.setReso(true));
|
||||
|
||||
this.mCurrentMtbColt = createdUds;
|
||||
|
||||
} else
|
||||
throw new UnsupportedOperationException("Tipologia di reso non supportata: " + mTipologiaReso);
|
||||
|
||||
this.sendLUOpened(this.mCurrentMtbColt);
|
||||
}
|
||||
|
||||
|
||||
public void closeLU(boolean shouldPrint) throws Exception {
|
||||
if (mCurrentMtbColt == null) return;
|
||||
|
||||
resetMatchedRows();
|
||||
|
||||
var canBeDeleted = mColliMagazzinoRESTConsumer.canULBeDeletedSynchronized(mCurrentMtbColt);
|
||||
|
||||
if (canBeDeleted) {
|
||||
@@ -222,11 +236,6 @@ public class PickingResiViewModel {
|
||||
}
|
||||
}
|
||||
|
||||
private void singlePrint(MtbColt mtbColtToPrint) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void postCloseOperations(MtbColt mtbColt) {
|
||||
this.mColliRegistrati.add(mtbColt);
|
||||
|
||||
@@ -319,16 +328,53 @@ public class PickingResiViewModel {
|
||||
}
|
||||
|
||||
private void executeEtichettaLU(String SSCC) throws Exception {
|
||||
var mtbColt = mColliMagazzinoRESTConsumer.getBySsccSynchronized(SSCC, true, false);
|
||||
MtbColt mtbColt = null;
|
||||
|
||||
mtbColt = mColliMagazzinoRESTConsumer.getBySsccSynchronized(SSCC, true, false);
|
||||
|
||||
if (mTipologiaReso == Tipologia.VENDITA) {
|
||||
//Leggere i colli in cui ho barcode_ul_out uguale a SSCC scansionato (nel caso di reso da cliente)
|
||||
//per sapere cosa ho venduto di preciso
|
||||
|
||||
var data = mPickingResiRESTConsumer.makeSynchronousRetrieveScarichiUdcInDocument(SSCC, null);
|
||||
|
||||
var mtbAarts = mArticoloRESTConsumer.getByCodMartsSynchronized(data.stream().map(ScaricoUdcInDocumentDTO::getCodMart).collect(Collectors.toUnmodifiableList()));
|
||||
|
||||
mtbColt.setMtbColr(new ObservableArrayList<>());
|
||||
mtbColt.getMtbColr().addAll(data.stream()
|
||||
.map(x -> {
|
||||
MtbColr mtbColr = new MtbColr()
|
||||
.setCodMart(x.getCodMart())
|
||||
.setPartitaMag(x.getPartitaMag())
|
||||
.setCodJcom(x.getCodJcom())
|
||||
.setQtaCol(x.getQtaCol())
|
||||
.setQtaCnf(x.getQtaCnf())
|
||||
.setNumCnf(x.getNumCnf())
|
||||
.setBarcodeUlOut(SSCC)
|
||||
.setSerDoc(x.getSerDoc())
|
||||
.setCodAnagDoc(x.getCodAnag())
|
||||
.setCodDtipDoc(x.getCodDtip())
|
||||
.setNumDoc(x.getNumDoc())
|
||||
.setDataDoc(x.getDataDoc())
|
||||
.setMtbAart(mtbAarts.stream().filter(y -> y.getCodMart().equalsIgnoreCase(x.getCodMart())).findFirst().get());
|
||||
|
||||
mtbColr.setUntMis(mtbColr.getMtbAart().getUntMis());
|
||||
|
||||
return mtbColr;
|
||||
})
|
||||
.collect(Collectors.toList()));
|
||||
}
|
||||
|
||||
if (mtbColt != null && mtbColt.getMtbColr() != null && !mtbColt.getMtbColr().isEmpty()) {
|
||||
if (mtbColt.getSegno() != -1) {
|
||||
searchArtFromUL(mtbColt);
|
||||
|
||||
} else
|
||||
throw new InvalidLUException();
|
||||
} else {
|
||||
|
||||
} else
|
||||
throw new NoResultFromBarcodeException(SSCC);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -369,8 +415,10 @@ public class PickingResiViewModel {
|
||||
for (WithdrawableDtbDocr pickingObject : pickingList) {
|
||||
//Da verificare se il controllo per partita deve essere sempre effettuato
|
||||
if (UtilityString.equalsIgnoreCase(x.getCodMart(), pickingObject.getCodMart()) &&
|
||||
UtilityString.equalsIgnoreCase(x.getPartitaMag(), pickingObject.getPartitaMag()) &&
|
||||
UtilityString.equalsIgnoreCase(x.getCodTagl(), pickingObject.getCodTagl()) &&
|
||||
UtilityString.equalsIgnoreCase(x.getCodCol(), pickingObject.getCodCol())) {
|
||||
UtilityString.equalsIgnoreCase(x.getCodCol(), pickingObject.getCodCol()) &&
|
||||
(mTipologiaReso == Tipologia.ACQUISTO || x.getDocumentKey().equals(pickingObject.getKey()))) {
|
||||
|
||||
if (!matchPickingObject.contains(pickingObject)) {
|
||||
matchPickingObject.add(pickingObject);
|
||||
@@ -387,8 +435,10 @@ public class PickingResiViewModel {
|
||||
|
||||
cloneMtbColt.getMtbColr().stream()
|
||||
.filter(x -> !(UtilityString.equalsIgnoreCase(x.getCodMart(), matchedObject.getCodMart()) &&
|
||||
UtilityString.equalsIgnoreCase(x.getPartitaMag(), matchedObject.getPartitaMag()) &&
|
||||
UtilityString.equalsIgnoreCase(x.getCodTagl(), matchedObject.getCodTagl()) &&
|
||||
UtilityString.equalsIgnoreCase(x.getCodCol(), matchedObject.getCodCol())))
|
||||
UtilityString.equalsIgnoreCase(x.getCodCol(), matchedObject.getCodCol())) &&
|
||||
(mTipologiaReso == Tipologia.ACQUISTO || x.getDocumentKey().equals(matchedObject.getKey())))
|
||||
.forEach(cloneMtbColrs::remove);
|
||||
|
||||
cloneMtbColt.setMtbColr(cloneMtbColrs);
|
||||
@@ -414,14 +464,14 @@ public class PickingResiViewModel {
|
||||
|
||||
List<WithdrawableDtbDocr> pickingList = mPickingList.getValue();
|
||||
|
||||
Stream.of(pickingList)
|
||||
pickingList.stream()
|
||||
.filter(x -> x != matchedItem)
|
||||
.forEach(x -> x.setHidden(true));
|
||||
|
||||
this.sendFilterApplied(null);
|
||||
this.getPickingList().postValue(pickingList);
|
||||
} else {
|
||||
this.dispatchOrdineRow(matchedItem, matchedItem.getRefMtbColt());
|
||||
this.dispatchDocumentRow(matchedItem, matchedItem.getRefMtbColt());
|
||||
}
|
||||
|
||||
} else {
|
||||
@@ -440,7 +490,7 @@ public class PickingResiViewModel {
|
||||
}
|
||||
|
||||
|
||||
public void dispatchOrdineRow(final WithdrawableDtbDocr withdrawableDtbDocr, final MtbColt refMtbColt) throws Exception {
|
||||
public void dispatchDocumentRow(final WithdrawableDtbDocr withdrawableDtbDocr, final MtbColt refMtbColt) throws Exception {
|
||||
BigDecimal totalQtaDoc = withdrawableDtbDocr.getQtaDoc();
|
||||
BigDecimal totalNumCnfDoc = withdrawableDtbDocr.getNumCnf();
|
||||
BigDecimal qtaCnfDoc = withdrawableDtbDocr.getQtaCnf();
|
||||
@@ -456,10 +506,18 @@ public class PickingResiViewModel {
|
||||
BigDecimal totalAvailableQtaCnf;
|
||||
BigDecimal totalAvailableNumCnf;
|
||||
|
||||
BigDecimal initialQtaCol = BigDecimal.ZERO;
|
||||
BigDecimal initialQtaCnf = BigDecimal.ZERO;
|
||||
BigDecimal initialNumCnf = BigDecimal.ZERO;
|
||||
|
||||
if (mtbColrToDispatch != null) {
|
||||
totalAvailableQtaCol = mtbColrToDispatch.getQtaCol();
|
||||
totalAvailableQtaCnf = mtbColrToDispatch.getQtaCnf();
|
||||
totalAvailableNumCnf = mtbColrToDispatch.getNumCnf();
|
||||
|
||||
initialQtaCol = mtbColrToDispatch.getQtaCol();
|
||||
initialQtaCnf = mtbColrToDispatch.getQtaCnf();
|
||||
initialNumCnf = mtbColrToDispatch.getNumCnf();
|
||||
} else {
|
||||
totalAvailableQtaCol = totalQtaDoc;
|
||||
totalAvailableQtaCnf = qtaCnfDoc;
|
||||
@@ -468,9 +526,9 @@ public class PickingResiViewModel {
|
||||
|
||||
var pickedQuantityDTO = this.sendOnItemDispatched(
|
||||
withdrawableDtbDocr.getMtbAart(),
|
||||
totalAvailableNumCnf,
|
||||
totalAvailableQtaCnf,
|
||||
totalAvailableQtaCol,
|
||||
initialNumCnf,
|
||||
initialQtaCnf,
|
||||
initialQtaCol,
|
||||
totalAvailableQtaCol,
|
||||
totalAvailableNumCnf,
|
||||
totalAvailableQtaCnf,
|
||||
@@ -524,18 +582,39 @@ public class PickingResiViewModel {
|
||||
public void saveNewRow(WithdrawableDtbDocr withdrawableDtbDocr, MtbColt refMtbColt, BigDecimal numCnf, BigDecimal qtaCnf, BigDecimal qtaTot, String partitaMag, LocalDate dataScad, boolean shouldCloseLU) throws Exception {
|
||||
this.sendOnLoadingStarted();
|
||||
|
||||
InsertUDCRowRequestDTO insertUDCRowRequestDTO = new InsertUDCRowRequestDTO()
|
||||
.setTargetMtbColt(mCurrentMtbColt)
|
||||
.setCodMart(withdrawableDtbDocr.getMtbAart().getCodMart())
|
||||
.setPartitaMag(partitaMag)
|
||||
.setDataScad(dataScad)
|
||||
.setQtaTot(qtaTot)
|
||||
.setQtaCnf(qtaCnf)
|
||||
.setNumCnf(numCnf)
|
||||
.setDescrizione(withdrawableDtbDocr.getMtbAart().getDescrizioneEstesa())
|
||||
var cloneMtbColt = (MtbColt) mCurrentMtbColt.clone();
|
||||
|
||||
.setDocumentReso(withdrawableDtbDocr.getKey());
|
||||
InsertUDCRowRequestDTO insertUDCRowRequestDTO = null;
|
||||
InsertUDSRowRequestDTO insertUDSRowRequestDTO = null;
|
||||
|
||||
if (mTipologiaReso == Tipologia.VENDITA) {
|
||||
|
||||
insertUDCRowRequestDTO = new InsertUDCRowRequestDTO()
|
||||
.setTargetMtbColt(cloneMtbColt)
|
||||
.setCodMart(withdrawableDtbDocr.getMtbAart().getCodMart())
|
||||
.setPartitaMag(partitaMag)
|
||||
.setDataScad(dataScad)
|
||||
.setQtaTot(qtaTot)
|
||||
.setQtaCnf(qtaCnf)
|
||||
.setNumCnf(numCnf)
|
||||
.setDescrizione(withdrawableDtbDocr.getMtbAart().getDescrizioneEstesa())
|
||||
|
||||
.setDocumentReso(withdrawableDtbDocr.getKey());
|
||||
|
||||
} else if (mTipologiaReso == Tipologia.ACQUISTO) {
|
||||
insertUDSRowRequestDTO = new InsertUDSRowRequestDTO()
|
||||
.setTargetMtbColt(cloneMtbColt)
|
||||
.setCodMart(withdrawableDtbDocr.getMtbAart().getCodMart())
|
||||
.setPartitaMag(partitaMag)
|
||||
.setDataScad(dataScad)
|
||||
.setQtaTot(qtaTot)
|
||||
.setQtaCnf(qtaCnf)
|
||||
.setNumCnf(numCnf)
|
||||
|
||||
.setDocumentReso(withdrawableDtbDocr.getKey());
|
||||
|
||||
} else
|
||||
throw new UnsupportedOperationException("Tipologia di reso non supportata: " + mTipologiaReso);
|
||||
|
||||
//TODO: Al posto di prelevare la prima riga bisognerebbe controllare se c'è ne una che corrisponde con la partita richiesta
|
||||
MtbColr mtbColrToDispatch = withdrawableDtbDocr.getTempPickData() != null &&
|
||||
@@ -552,25 +631,15 @@ public class PickingResiViewModel {
|
||||
mCurrentMtbColt.setCodTcol(newCodTcol);
|
||||
}
|
||||
|
||||
// insertUDCRowRequestDTO
|
||||
// .setCodJcom(UtilityString.empty2null(mtbColrToDispatch.getCodJcom()))
|
||||
// .setSerColloRif(UtilityString.empty2null(mtbColrToDispatch.getSerCollo()))
|
||||
// .setNumColloRif(mtbColrToDispatch.getNumCollo())
|
||||
// .setGestioneRif(UtilityString.empty2null(mtbColrToDispatch.getGestione()))
|
||||
// .setDataColloRif(UtilityString.empty2null(mtbColrToDispatch.getDataColloS()));
|
||||
|
||||
|
||||
if (mtbColrToDispatch.getPesoNettoKg() != null) {
|
||||
//Proporzione
|
||||
BigDecimal pesoNettoKg = UtilityBigDecimal.divide(UtilityBigDecimal.multiply(qtaTot, mtbColrToDispatch.getPesoNettoKg()), mtbColrToDispatch.getQtaCol());
|
||||
insertUDCRowRequestDTO.setPesoNettoKg(pesoNettoKg);
|
||||
if (mTipologiaReso == Tipologia.ACQUISTO) {
|
||||
insertUDSRowRequestDTO
|
||||
.setSourceMtbColr(mtbColrToDispatch);
|
||||
} else if (mTipologiaReso == Tipologia.VENDITA) {
|
||||
//Nel caso in cui ho scansionato un SSCC che è esistito a magazzino allora forzo il barcode_ul_in
|
||||
//uguale a barcode_ul_out in modo che il servizio lo metta in barcode_ul_in
|
||||
insertUDCRowRequestDTO.setCustomBarcodeUlIn(mtbColrToDispatch.getBarcodeUlOut());
|
||||
}
|
||||
|
||||
if (mtbColrToDispatch.getPesoLordoKg() != null) {
|
||||
//Proporzione
|
||||
BigDecimal pesoLordoKg = UtilityBigDecimal.divide(UtilityBigDecimal.multiply(qtaTot, mtbColrToDispatch.getPesoLordoKg()), mtbColrToDispatch.getQtaCol());
|
||||
insertUDCRowRequestDTO.setPesoLordoKg(pesoLordoKg);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -589,7 +658,15 @@ public class PickingResiViewModel {
|
||||
}
|
||||
|
||||
boolean finalShouldPrint = shouldPrint;
|
||||
MtbColr insertedULRow = this.mColliAccettazioneRESTConsumer.synchronousInsertUDCRow(insertUDCRowRequestDTO);
|
||||
MtbColr insertedULRow;
|
||||
|
||||
if (mTipologiaReso == Tipologia.VENDITA) {
|
||||
insertedULRow = this.mColliAccettazioneRESTConsumer.synchronousInsertUDCRow(insertUDCRowRequestDTO);
|
||||
} else if (mTipologiaReso == Tipologia.ACQUISTO) {
|
||||
insertedULRow = this.mColliSpedizioneRESTConsumer.insertUDSRowSynchronized(insertUDSRowRequestDTO);
|
||||
} else {
|
||||
throw new UnsupportedOperationException("Tipologia di reso non supportata: " + mTipologiaReso);
|
||||
}
|
||||
|
||||
insertedULRow
|
||||
.setUntMis(withdrawableDtbDocr.getMtbAart().getUntMis())
|
||||
@@ -602,6 +679,7 @@ public class PickingResiViewModel {
|
||||
|
||||
this.mPickingList.postValue(this.mPickingList.getValue());
|
||||
|
||||
this.resetMatchedRows();
|
||||
this.sendOnRowSaved();
|
||||
this.sendOnLoadingEnded();
|
||||
|
||||
@@ -610,15 +688,29 @@ public class PickingResiViewModel {
|
||||
|
||||
private void saveEditedRow(MtbColr mtbColrToUpdate, BigDecimal numCnf, BigDecimal qtaCnf, BigDecimal qtaTot, String partitaMag, LocalDate dataScad, boolean shouldCloseLU) throws Exception {
|
||||
|
||||
EditUDCRowRequestDTO editUDCRowRequest = new EditUDCRowRequestDTO()
|
||||
.setSourceMtbColr(mtbColrToUpdate)
|
||||
.setNewNumCnf(numCnf)
|
||||
.setNewQtaCnf(qtaCnf)
|
||||
.setNewQtaTot(qtaTot)
|
||||
.setNewPartitaMag(partitaMag)
|
||||
.setNewDataScad(dataScad);
|
||||
MtbColr updatedMtbColr;
|
||||
|
||||
MtbColr updatedMtbColr = this.mColliAccettazioneRESTConsumer.synchronousEditUDCRow(editUDCRowRequest);
|
||||
if (mTipologiaReso == Tipologia.VENDITA) {
|
||||
EditUDCRowRequestDTO editUDCRowRequest = new EditUDCRowRequestDTO()
|
||||
.setSourceMtbColr(mtbColrToUpdate)
|
||||
.setNewNumCnf(numCnf)
|
||||
.setNewQtaCnf(qtaCnf)
|
||||
.setNewQtaTot(qtaTot)
|
||||
.setNewPartitaMag(partitaMag)
|
||||
.setNewDataScad(dataScad);
|
||||
|
||||
updatedMtbColr = this.mColliAccettazioneRESTConsumer.synchronousEditUDCRow(editUDCRowRequest);
|
||||
} else if (mTipologiaReso == Tipologia.ACQUISTO) {
|
||||
EditUDSRowRequestDTO editUDSRowRequest = new EditUDSRowRequestDTO()
|
||||
.setSourceMtbColr(mtbColrToUpdate)
|
||||
.setNewNumCnf(numCnf)
|
||||
.setNewQtaCnf(qtaCnf)
|
||||
.setNewQtaTot(qtaTot);
|
||||
|
||||
updatedMtbColr = this.mColliSpedizioneRESTConsumer.editUDSRowSynchronized(editUDSRowRequest);
|
||||
} else {
|
||||
throw new UnsupportedOperationException("Tipologia di reso non supportata: " + mTipologiaReso);
|
||||
}
|
||||
|
||||
updatedMtbColr
|
||||
.setUntMis(mtbColrToUpdate.getUntMis())
|
||||
@@ -647,10 +739,16 @@ public class PickingResiViewModel {
|
||||
var canDelete = this.sendMtbColrDeleteRequest();
|
||||
|
||||
if (canDelete) {
|
||||
DeleteUDCRowRequestDTO deleteUDCRowRequest = new DeleteUDCRowRequestDTO()
|
||||
.setMtbColrToDelete(mtbColrToDelete);
|
||||
if (mTipologiaReso == Tipologia.VENDITA) {
|
||||
this.mColliAccettazioneRESTConsumer.synchronousDeleteUDCRow(new DeleteUDCRowRequestDTO()
|
||||
.setMtbColrToDelete(mtbColrToDelete));
|
||||
|
||||
this.mColliAccettazioneRESTConsumer.synchronousDeleteUDCRow(deleteUDCRowRequest);
|
||||
} else if (mTipologiaReso == Tipologia.ACQUISTO) {
|
||||
this.mColliSpedizioneRESTConsumer.deleteUDSRowSynchronized(new DeleteUDSRowRequestDTO()
|
||||
.setMtbColrToDelete(mtbColrToDelete));
|
||||
|
||||
} else
|
||||
throw new UnsupportedOperationException("Tipologia di reso non supportata: " + mTipologiaReso);
|
||||
|
||||
|
||||
Optional<WithdrawableDtbDocr> pickingObjectDTO = this.mPickingList.getValue().stream()
|
||||
@@ -840,4 +938,26 @@ public class PickingResiViewModel {
|
||||
void onFilterRemoved();
|
||||
|
||||
}
|
||||
|
||||
public enum Tipologia {
|
||||
ACQUISTO((short) -1),
|
||||
VENDITA((short) +1);
|
||||
|
||||
private final short value;
|
||||
|
||||
Tipologia(short value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public short getValue() {
|
||||
return this.value;
|
||||
}
|
||||
|
||||
public static Tipologia fromShort(short value) {
|
||||
for (Tipologia b : Tipologia.values()) {
|
||||
if (b.value == value) return b;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,20 +13,27 @@ import javax.inject.Singleton;
|
||||
|
||||
import it.integry.integrywmsnative.core.model.DtbDocr;
|
||||
import it.integry.integrywmsnative.core.model.MtbAart;
|
||||
import it.integry.integrywmsnative.core.model.key.DtbDoctKey;
|
||||
import it.integry.integrywmsnative.core.rest.RESTBuilder;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.ArticoloRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.SystemRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers._BaseRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.model.DocumentoResoDTO;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityQuery;
|
||||
import it.integry.integrywmsnative.gest.picking_resi.rest.dto.RetrieveScarichiUdcInDocumentRequestDTO;
|
||||
import it.integry.integrywmsnative.gest.picking_resi.rest.dto.ScaricoUdcInDocumentDTO;
|
||||
|
||||
@Singleton
|
||||
public class PickingResiRESTConsumer {
|
||||
public class PickingResiRESTConsumer extends _BaseRESTConsumer {
|
||||
|
||||
|
||||
private final RESTBuilder restBuilder;
|
||||
private final SystemRESTConsumer mSystemRestConsumer;
|
||||
private final ArticoloRESTConsumer mArticoloRESTConsumer;
|
||||
|
||||
@Inject
|
||||
public PickingResiRESTConsumer(SystemRESTConsumer systemRESTConsumer, ArticoloRESTConsumer articoloRESTConsumer) {
|
||||
public PickingResiRESTConsumer(RESTBuilder restBuilder, SystemRESTConsumer systemRESTConsumer, ArticoloRESTConsumer articoloRESTConsumer) {
|
||||
this.restBuilder = restBuilder;
|
||||
this.mSystemRestConsumer = systemRESTConsumer;
|
||||
this.mArticoloRESTConsumer = articoloRESTConsumer;
|
||||
}
|
||||
@@ -93,4 +100,17 @@ public class PickingResiRESTConsumer {
|
||||
|
||||
}
|
||||
|
||||
|
||||
public List<ScaricoUdcInDocumentDTO> makeSynchronousRetrieveScarichiUdcInDocument(String barcodeUdc, List<DtbDoctKey> documents) throws Exception {
|
||||
var service = restBuilder.getService(PickingResiRESTConsumerService.class);
|
||||
|
||||
var response = service.retrieveScarichiUdcInDocuments(barcodeUdc, new RetrieveScarichiUdcInDocumentRequestDTO()
|
||||
.setDocuments(documents))
|
||||
.execute();
|
||||
|
||||
var data = analyzeAnswer(response, "retrieve-scarichi-udc-in-documents");
|
||||
|
||||
return data.getScarichiUdc() != null ? data.getScarichiUdc() : new ArrayList<>();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
package it.integry.integrywmsnative.gest.picking_resi.rest;
|
||||
|
||||
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
||||
import it.integry.integrywmsnative.gest.picking_resi.rest.dto.RetrieveScarichiUdcInDocumentRequestDTO;
|
||||
import it.integry.integrywmsnative.gest.picking_resi.rest.dto.RetrieveScarichiUdcInDocumentResponseDTO;
|
||||
import retrofit2.Call;
|
||||
import retrofit2.http.Body;
|
||||
import retrofit2.http.POST;
|
||||
import retrofit2.http.Query;
|
||||
|
||||
public interface PickingResiRESTConsumerService {
|
||||
|
||||
@POST("wms/resi-clienti/retrieve-scarichi-udc-in-document")
|
||||
Call<ServiceRESTResponse<RetrieveScarichiUdcInDocumentResponseDTO>> retrieveScarichiUdcInDocuments(
|
||||
@Query("barcodeUdc") String barcodeUdc,
|
||||
@Body RetrieveScarichiUdcInDocumentRequestDTO requestBody
|
||||
);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package it.integry.integrywmsnative.gest.picking_resi.rest.dto;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import it.integry.integrywmsnative.core.model.key.DtbDoctKey;
|
||||
|
||||
public class RetrieveScarichiUdcInDocumentRequestDTO {
|
||||
|
||||
@SerializedName("documents")
|
||||
private List<DtbDoctKey> documents;
|
||||
|
||||
public List<DtbDoctKey> getDocuments() {
|
||||
return documents;
|
||||
}
|
||||
|
||||
public RetrieveScarichiUdcInDocumentRequestDTO setDocuments(List<DtbDoctKey> documents) {
|
||||
this.documents = documents;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package it.integry.integrywmsnative.gest.picking_resi.rest.dto;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class RetrieveScarichiUdcInDocumentResponseDTO {
|
||||
|
||||
@SerializedName("scarichiUdc")
|
||||
private List<ScaricoUdcInDocumentDTO> scarichiUdc;
|
||||
|
||||
public List<ScaricoUdcInDocumentDTO> getScarichiUdc() {
|
||||
return scarichiUdc;
|
||||
}
|
||||
|
||||
public RetrieveScarichiUdcInDocumentResponseDTO setScarichiUdc(List<ScaricoUdcInDocumentDTO> scarichiUdc) {
|
||||
this.scarichiUdc = scarichiUdc;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,143 @@
|
||||
package it.integry.integrywmsnative.gest.picking_resi.rest.dto;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
|
||||
public class ScaricoUdcInDocumentDTO {
|
||||
@SerializedName("codAnag")
|
||||
private String codAnag;
|
||||
|
||||
@SerializedName("codDtip")
|
||||
private String codDtip;
|
||||
|
||||
@SerializedName("dataDoc")
|
||||
private LocalDate dataDoc;
|
||||
|
||||
@SerializedName("numDoc")
|
||||
private int numDoc;
|
||||
|
||||
@SerializedName("serDoc")
|
||||
private String serDoc;
|
||||
|
||||
|
||||
@SerializedName("codMart")
|
||||
private String codMart;
|
||||
|
||||
@SerializedName("partitaMag")
|
||||
private String partitaMag;
|
||||
|
||||
@SerializedName("codJcom")
|
||||
private String codJcom;
|
||||
|
||||
|
||||
|
||||
@SerializedName("qtaCol")
|
||||
private BigDecimal qtaCol;
|
||||
|
||||
@SerializedName("qtaCnf")
|
||||
private BigDecimal qtaCnf;
|
||||
|
||||
@SerializedName("numCnf")
|
||||
private BigDecimal numCnf;
|
||||
|
||||
public String getCodAnag() {
|
||||
return codAnag;
|
||||
}
|
||||
|
||||
public ScaricoUdcInDocumentDTO setCodAnag(String codAnag) {
|
||||
this.codAnag = codAnag;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getCodDtip() {
|
||||
return codDtip;
|
||||
}
|
||||
|
||||
public ScaricoUdcInDocumentDTO setCodDtip(String codDtip) {
|
||||
this.codDtip = codDtip;
|
||||
return this;
|
||||
}
|
||||
|
||||
public LocalDate getDataDoc() {
|
||||
return dataDoc;
|
||||
}
|
||||
|
||||
public ScaricoUdcInDocumentDTO setDataDoc(LocalDate dataDoc) {
|
||||
this.dataDoc = dataDoc;
|
||||
return this;
|
||||
}
|
||||
|
||||
public int getNumDoc() {
|
||||
return numDoc;
|
||||
}
|
||||
|
||||
public ScaricoUdcInDocumentDTO setNumDoc(int numDoc) {
|
||||
this.numDoc = numDoc;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getSerDoc() {
|
||||
return serDoc;
|
||||
}
|
||||
|
||||
public ScaricoUdcInDocumentDTO setSerDoc(String serDoc) {
|
||||
this.serDoc = serDoc;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getCodMart() {
|
||||
return codMart;
|
||||
}
|
||||
|
||||
public ScaricoUdcInDocumentDTO setCodMart(String codMart) {
|
||||
this.codMart = codMart;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getPartitaMag() {
|
||||
return partitaMag;
|
||||
}
|
||||
|
||||
public ScaricoUdcInDocumentDTO setPartitaMag(String partitaMag) {
|
||||
this.partitaMag = partitaMag;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getCodJcom() {
|
||||
return codJcom;
|
||||
}
|
||||
|
||||
public ScaricoUdcInDocumentDTO setCodJcom(String codJcom) {
|
||||
this.codJcom = codJcom;
|
||||
return this;
|
||||
}
|
||||
|
||||
public BigDecimal getQtaCol() {
|
||||
return qtaCol;
|
||||
}
|
||||
|
||||
public ScaricoUdcInDocumentDTO setQtaCol(BigDecimal qtaCol) {
|
||||
this.qtaCol = qtaCol;
|
||||
return this;
|
||||
}
|
||||
|
||||
public BigDecimal getQtaCnf() {
|
||||
return qtaCnf;
|
||||
}
|
||||
|
||||
public ScaricoUdcInDocumentDTO setQtaCnf(BigDecimal qtaCnf) {
|
||||
this.qtaCnf = qtaCnf;
|
||||
return this;
|
||||
}
|
||||
|
||||
public BigDecimal getNumCnf() {
|
||||
return numCnf;
|
||||
}
|
||||
|
||||
public ScaricoUdcInDocumentDTO setNumCnf(BigDecimal numCnf) {
|
||||
this.numCnf = numCnf;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -23,6 +23,7 @@ import it.integry.integrywmsnative.core.expansion.OnListGeneralChangedCallback;
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgss;
|
||||
import it.integry.integrywmsnative.core.model.MtbColt;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityNumber;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityResources;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityString;
|
||||
import it.integry.integrywmsnative.databinding.PickingResiMainListItemBinding;
|
||||
import it.integry.integrywmsnative.databinding.PickingResiMainListItemHeaderBinding;
|
||||
@@ -107,15 +108,31 @@ public class PickingResiListAdapter extends SectionedRecyclerViewAdapter<Picking
|
||||
|
||||
holder.mBinding.deactivatedOverBg.setVisibility(!pickingResiListModel.isActive() ? View.VISIBLE : View.GONE);
|
||||
holder.mBinding.getRoot().setAlpha(!pickingResiListModel.isActive() ? 0.8f : 1);
|
||||
holder.mBinding.badge1.setBackground(ResourcesCompat.getDrawable(mContext.getResources(), !pickingResiListModel.isActive() ? R.drawable.badge_round_corner : R.drawable.badge1_round_corner, null));
|
||||
//holder.mBinding.badge1.setBackground(ResourcesCompat.getDrawable(mContext.getResources(), !pickingResiListModel.isActive() ? R.drawable.badge_round_corner : R.drawable.badge1_round_corner, null));
|
||||
|
||||
|
||||
holder.mBinding.badge1.setBackgroundTintList(UtilityResources.getColorStateListFromAttr(mContext,
|
||||
!pickingResiListModel.isActive() ? R.color.gray_700 : com.google.android.material.R.attr.colorPrimaryContainer));
|
||||
holder.mBinding.badge1.setTextColor(UtilityResources.getColorResourceFromAttr(mContext,
|
||||
!pickingResiListModel.isActive() ? R.color.white : com.google.android.material.R.attr.colorOnPrimaryContainer));
|
||||
|
||||
holder.mBinding.badge2.setBackgroundTintList(UtilityResources.getColorStateListFromAttr(mContext,
|
||||
!pickingResiListModel.isActive() ? R.color.gray_500 : com.google.android.material.R.attr.colorSecondaryContainer));
|
||||
holder.mBinding.badge2.setTextColor(UtilityResources.getColorResourceFromAttr(mContext,
|
||||
!pickingResiListModel.isActive() ? R.color.white : com.google.android.material.R.attr.colorOnSecondaryContainer));
|
||||
|
||||
holder.mBinding.qtaEvasa.setTextColor(ResourcesCompat.getColor(mContext.getResources(), !pickingResiListModel.isActive() ? R.color.gray_600 : R.color.green_700, null));
|
||||
|
||||
|
||||
holder.mBinding.descrizione.setText(pickingResiListModel.getDescrizione());
|
||||
holder.mBinding.descrizione.setTextColor(pickingResiListModel.isDescrizionePresente() ? Color.BLACK : Color.GRAY);
|
||||
|
||||
|
||||
holder.mBinding.badge1.setText(pickingResiListModel.getBadge1());
|
||||
|
||||
holder.mBinding.badge2.setVisibility(UtilityString.isNullOrEmpty(pickingResiListModel.getBadge2()) ? View.GONE : View.VISIBLE);
|
||||
holder.mBinding.badge2.setText(pickingResiListModel.getBadge2());
|
||||
|
||||
holder.mBinding.qtaEvasa.setText(UtilityNumber.decimalToString(pickingResiListModel.getQtaEvasa()));
|
||||
holder.mBinding.qtaTot.setText(UtilityNumber.decimalToString(pickingResiListModel.getQtaTot()));
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ public class PickingResiListModel {
|
||||
private String groupTitle;
|
||||
|
||||
private String badge1;
|
||||
private String badge2;
|
||||
|
||||
private String descrizione;
|
||||
private boolean descrizionePresente;
|
||||
@@ -40,6 +41,15 @@ public class PickingResiListModel {
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getBadge2() {
|
||||
return badge2;
|
||||
}
|
||||
|
||||
public PickingResiListModel setBadge2(String badge2) {
|
||||
this.badge2 = badge2;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getDescrizione() {
|
||||
return descrizione;
|
||||
}
|
||||
|
||||
@@ -348,33 +348,36 @@ public class ProdOrdineProduzioneElencoFragment extends BaseFragment implements
|
||||
|
||||
@Override
|
||||
public void onOrdersDispatched(List<OrdineAccettazioneInevasoDTO> orders, List<SitArtOrdDTO> sitArts) {
|
||||
long artsCounter = Stream.of(sitArts)
|
||||
.filter(x -> UtilityBigDecimal.greaterThan(x.getQtaDaEvadere(), BigDecimal.ZERO))
|
||||
.map(SitArtOrdDTO::getCodMart)
|
||||
.distinct()
|
||||
.count();
|
||||
handler.post(() -> {
|
||||
|
||||
long ordsCounter = Stream.of(sitArts)
|
||||
.distinctBy(x -> x.getDataOrd() + " " + x.getNumOrd() + " " + x.getGestione())
|
||||
.count();
|
||||
long artsCounter = Stream.of(sitArts)
|
||||
.filter(x -> UtilityBigDecimal.greaterThan(x.getQtaDaEvadere(), BigDecimal.ZERO))
|
||||
.map(SitArtOrdDTO::getCodMart)
|
||||
.distinct()
|
||||
.count();
|
||||
|
||||
long ordsCounter = Stream.of(sitArts)
|
||||
.distinctBy(x -> x.getDataOrd() + " " + x.getNumOrd() + " " + x.getGestione())
|
||||
.count();
|
||||
|
||||
|
||||
DialogSimpleMessageView.makeInfoDialog(getText(R.string.orders).toString(),
|
||||
Html.fromHtml(String.format(getActivity().getResources().getQuantityString(R.plurals.loaded_orders_message, (int) ordsCounter), ordsCounter)
|
||||
+ "<br /><br />" +
|
||||
"<b>" + artsCounter + "</b> " + getActivity().getResources().getQuantityString(R.plurals.ordered_articles, (int) artsCounter)),
|
||||
null,
|
||||
() -> {
|
||||
DialogSimpleMessageView.makeInfoDialog(requireContext(), getText(R.string.orders).toString(),
|
||||
Html.fromHtml(String.format(getActivity().getResources().getQuantityString(R.plurals.loaded_orders_message, (int) ordsCounter), ordsCounter)
|
||||
+ "<br /><br />" +
|
||||
"<b>" + artsCounter + "</b> " + getActivity().getResources().getQuantityString(R.plurals.ordered_articles, (int) artsCounter)),
|
||||
null,
|
||||
() -> {
|
||||
|
||||
String cacheSitArtItemID = DataCache.addItem(sitArts);
|
||||
String cacheOrdersItemID = DataCache.addItem(orders);
|
||||
String cacheSitArtItemID = DataCache.addItem(sitArts);
|
||||
String cacheOrdersItemID = DataCache.addItem(orders);
|
||||
|
||||
Intent myIntent = new Intent(getActivity(), AccettazioneOrdiniPickingActivity.class);
|
||||
myIntent.putExtra("keyOrders", cacheOrdersItemID);
|
||||
myIntent.putExtra("keySitArts", cacheSitArtItemID);
|
||||
getActivity().startActivity(myIntent);
|
||||
Intent myIntent = new Intent(getActivity(), AccettazioneOrdiniPickingActivity.class);
|
||||
myIntent.putExtra("keyOrders", cacheOrdersItemID);
|
||||
myIntent.putExtra("keySitArts", cacheSitArtItemID);
|
||||
getActivity().startActivity(myIntent);
|
||||
|
||||
}).show(getActivity().getSupportFragmentManager(), "tag");
|
||||
}).show();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -157,8 +157,8 @@ public class ProdDettaglioLineaActivity extends BaseActivity implements ProdDett
|
||||
|
||||
@Override
|
||||
public void confirmInconsistentDeposit(Runnable onConfirm) {
|
||||
this.runOnUiThread(() -> {
|
||||
DialogSimpleMessageView.makeWarningDialog(
|
||||
handler.post(() -> {
|
||||
DialogSimpleMessageView.makeWarningDialog(this,
|
||||
Html.fromHtml("L'articolo che si vuole versare non è compatibile con nessun ordine presente sulla linea!"
|
||||
+ "<br /> <br/>" +
|
||||
"Vuoi versarlo comunque?"),
|
||||
@@ -168,7 +168,7 @@ public class ProdDettaglioLineaActivity extends BaseActivity implements ProdDett
|
||||
onLoadingEnded();
|
||||
BarcodeManager.enable(mBarcodeScannerInstanceID);
|
||||
}
|
||||
).show(getSupportFragmentManager(), "confirmOrderClose");
|
||||
).show();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -295,8 +295,11 @@ public class ProdDettaglioLineaActivity extends BaseActivity implements ProdDett
|
||||
public void successDialog(String message, Runnable onComplete) {
|
||||
BarcodeManager.disable(mBarcodeScannerInstanceID);
|
||||
|
||||
this.runOnUiThread(() -> DialogSimpleMessageView.makeSuccessDialog(getResources().getString(R.string.success),
|
||||
new SpannableString(message), null, onComplete).show(getSupportFragmentManager(), "successDialog"));
|
||||
handler.post(() -> DialogSimpleMessageView.makeSuccessDialog(
|
||||
this,
|
||||
getResources().getString(R.string.success),
|
||||
new SpannableString(message), null, onComplete)
|
||||
.show());
|
||||
|
||||
}
|
||||
|
||||
@@ -318,14 +321,14 @@ public class ProdDettaglioLineaActivity extends BaseActivity implements ProdDett
|
||||
@Override
|
||||
public void confirmOrderClose(Runnable onConfirm) {
|
||||
this.onLoadingEnded();
|
||||
this.runOnUiThread(() -> {
|
||||
DialogSimpleMessageView.makeWarningDialog(
|
||||
handler.post(() -> {
|
||||
DialogSimpleMessageView.makeWarningDialog(this,
|
||||
Html.fromHtml("Per completare l'operazione è necessario chiudere gli ordini attualmente aperti sulla linea."
|
||||
+ "<br /> <br/>" +
|
||||
"Continuare?"),
|
||||
null,
|
||||
() -> {
|
||||
DialogSimpleMessageView.makeInfoDialog(
|
||||
DialogSimpleMessageView.makeInfoDialog(this,
|
||||
null,
|
||||
Html.fromHtml("Vuoi recuperare del materiale prima di chiudere gli ordini?"),
|
||||
null,
|
||||
@@ -334,10 +337,10 @@ public class ProdDettaglioLineaActivity extends BaseActivity implements ProdDett
|
||||
this.requestMaterialRecover();
|
||||
},
|
||||
onConfirm
|
||||
).show(getSupportFragmentManager(), "confirmOrderClose");
|
||||
).show();
|
||||
},
|
||||
() -> BarcodeManager.enable(mBarcodeScannerInstanceID)
|
||||
).show(getSupportFragmentManager(), "confirmOrderClose");
|
||||
).show();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -132,8 +132,11 @@ public class ProdLineeProduzioneFragment extends BaseFragment implements ITitled
|
||||
@Override
|
||||
public void successDialog(String message, Runnable onComplete) {
|
||||
BarcodeManager.disable(mBarcodeScannerInstanceID);
|
||||
requireActivity().runOnUiThread(() -> DialogSimpleMessageView.makeSuccessDialog(getResources().getString(R.string.success),
|
||||
new SpannableString(message), null, onComplete).show(getChildFragmentManager(), "successDialog"));
|
||||
handler.post(() -> DialogSimpleMessageView.makeSuccessDialog(
|
||||
requireContext(),
|
||||
getResources().getString(R.string.success),
|
||||
new SpannableString(message), null, onComplete)
|
||||
.show());
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -241,7 +241,7 @@ public class ProdRecuperoMaterialeFragment extends BaseFragment implements ITitl
|
||||
return null;
|
||||
});
|
||||
itemType.areItemSame((item1, item2) ->
|
||||
Objects.equals(item1.getNumCollo(), item2.getNumCollo()) &&
|
||||
Objects.equals(item1.getNumCollo(), item2.getNumCollo()) &&
|
||||
Objects.equals(item1.getDataCollo(), item2.getDataCollo()) &&
|
||||
Objects.equals(item1.getSerCollo(), item2.getSerCollo()) &&
|
||||
Objects.equals(item1.getGestione(), item2.getGestione()) &&
|
||||
@@ -251,7 +251,7 @@ public class ProdRecuperoMaterialeFragment extends BaseFragment implements ITitl
|
||||
Objects.equals(item1.getCodTagl(), item2.getCodTagl()) &&
|
||||
Objects.equals(item1.getCodJcom(), item2.getCodJcom()) &&
|
||||
Objects.equals(item1.getCodJfas(), item2.getCodJfas())
|
||||
);
|
||||
);
|
||||
itemType.areContentsTheSame(HistoryVersamentoProdULDTO::equals);
|
||||
|
||||
new LiveAdapter(this.filteredList, this) // Observe filteredList
|
||||
@@ -565,28 +565,32 @@ public class ProdRecuperoMaterialeFragment extends BaseFragment implements ITitl
|
||||
@Override
|
||||
public void onLUPrintError(Exception ex, Runnable onComplete) {
|
||||
this.onLoadingEnded();
|
||||
DialogSimpleMessageView.makeErrorDialog(
|
||||
new SpannableString(ex.getMessage()),
|
||||
null,
|
||||
null,
|
||||
R.string.button_ignore_print,
|
||||
onComplete)
|
||||
.show(requireActivity().getSupportFragmentManager(), "tag");
|
||||
handler.post(() -> {
|
||||
DialogSimpleMessageView.makeErrorDialog(requireContext(),
|
||||
new SpannableString(ex.getMessage()),
|
||||
null,
|
||||
null,
|
||||
R.string.button_ignore_print,
|
||||
onComplete)
|
||||
.show();
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNoLUFound(Runnable onComplete) {
|
||||
String errorMessage = "Nessuna stampante configurata";
|
||||
DialogSimpleMessageView
|
||||
.makeWarningDialog(new SpannableString(errorMessage), null, onComplete)
|
||||
.show(requireActivity().getSupportFragmentManager(), "tag");
|
||||
handler.post(() -> {
|
||||
String errorMessage = "Nessuna stampante configurata";
|
||||
DialogSimpleMessageView
|
||||
.makeWarningDialog(requireContext(), new SpannableString(errorMessage), null, onComplete)
|
||||
.show();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onDataSaved() {
|
||||
this.onLoadingEnded();
|
||||
this.requireActivity().runOnUiThread(() -> {
|
||||
handler.post(() -> {
|
||||
DialogCommon.showDataSaved(requireActivity(), this::popMe);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -181,7 +181,7 @@ public class ProdRientroMerceFragment extends BaseFragment implements
|
||||
x.getGestione().equalsIgnoreCase(orderToRefresh.getGestione()))
|
||||
.findFirst();
|
||||
|
||||
if(foundOrder.isPresent())
|
||||
if (foundOrder.isPresent())
|
||||
mProdRientroMerceOrderDetailFragment.setOrder(foundOrder.get());
|
||||
else
|
||||
mProdRientroMerceOrderDetailFragment.setOrder(null);
|
||||
@@ -201,13 +201,15 @@ public class ProdRientroMerceFragment extends BaseFragment implements
|
||||
|
||||
@Override
|
||||
public void onMtbColrDelete(MtbColr mtbColr) {
|
||||
String text = getResources().getString(R.string.alert_delete_mtb_colr);
|
||||
DialogSimpleMessageView.makeWarningDialog(new SpannableString(text),
|
||||
null,
|
||||
() -> mProdRientroMerceOrderDetailFragment.deleteMtbColr(mtbColr),
|
||||
() -> {
|
||||
}
|
||||
).show(requireActivity().getSupportFragmentManager(), "tag");
|
||||
handler.post(() -> {
|
||||
String text = getResources().getString(R.string.alert_delete_mtb_colr);
|
||||
DialogSimpleMessageView.makeWarningDialog(requireContext(), new SpannableString(text),
|
||||
null,
|
||||
() -> mProdRientroMerceOrderDetailFragment.deleteMtbColr(mtbColr),
|
||||
() -> {
|
||||
}
|
||||
).show();
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -430,15 +430,17 @@ public class ProdVersamentoMaterialeFragment extends BaseFragment implements Pro
|
||||
handler.post(() -> {
|
||||
this.onLoadingEnded();
|
||||
DialogSimpleMessageView
|
||||
.makeWarningDialog(new SpannableString(Html.fromHtml(warningText)), null, action)
|
||||
.show(requireActivity().getSupportFragmentManager(), "tag");
|
||||
.makeWarningDialog(
|
||||
requireContext(),
|
||||
new SpannableString(Html.fromHtml(warningText)), null, action)
|
||||
.show();
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDataSaved() {
|
||||
this.onLoadingEnded();
|
||||
this.requireActivity().runOnUiThread(() -> {
|
||||
handler.post(() -> {
|
||||
DialogCommon.showDataSaved(requireActivity(), this::popMe);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -80,10 +80,13 @@ public class ProdVersamentoMaterialeInBufferFragment extends BaseFragment implem
|
||||
mtbColt.getSegno() == 1) {
|
||||
|
||||
if (mtbColt.getMtbColr() == null || mtbColt.getMtbColr().isEmpty()) {
|
||||
DialogSimpleMessageView.makeWarningDialog(
|
||||
new SpannableString(Html.fromHtml("E' stata scansionata una UL già vuota")),
|
||||
null, this::openLU)
|
||||
.show((requireActivity()).getSupportFragmentManager(), "tag");
|
||||
handler.post(() -> {
|
||||
DialogSimpleMessageView.makeWarningDialog(
|
||||
requireContext(),
|
||||
new SpannableString(Html.fromHtml("E' stata scansionata una UL già vuota")),
|
||||
null, this::openLU)
|
||||
.show();
|
||||
});
|
||||
|
||||
} else {
|
||||
mViewModel.setMtbColt(mtbColt);
|
||||
|
||||
@@ -175,13 +175,16 @@ public class PVOrdineAcquistoEditActivity extends BaseActivity implements PVOrdi
|
||||
}
|
||||
|
||||
private void deleteArticolo(ArticoloOrdine articoloOrdine) {
|
||||
String text = "Stai per eliminare l'articolo <b> " + articoloOrdine.getDescrizione() + "</b> dall'ordine, <br> sei sicuro?";
|
||||
handler.post(() -> {
|
||||
String text = "Stai per eliminare l'articolo <b> " + articoloOrdine.getDescrizione() + "</b> dall'ordine, <br> sei sicuro?";
|
||||
|
||||
DialogSimpleMessageView.makeWarningDialog(new SpannableString(Html.fromHtml(text)), null, () -> {
|
||||
this.mViewModel.deleteArticolo(articoloOrdine);
|
||||
}, () -> {
|
||||
DialogSimpleMessageView.makeWarningDialog(this,
|
||||
new SpannableString(Html.fromHtml(text)), null, () -> {
|
||||
this.mViewModel.deleteArticolo(articoloOrdine);
|
||||
}, () -> {
|
||||
|
||||
}).show(getSupportFragmentManager(), "tag");
|
||||
}).show();
|
||||
});
|
||||
}
|
||||
|
||||
private final RunnableArgs<BarcodeScanDTO> onScanSuccessful = data -> {
|
||||
@@ -201,20 +204,26 @@ public class PVOrdineAcquistoEditActivity extends BaseActivity implements PVOrdi
|
||||
|
||||
@Override
|
||||
public void confirmExceedingQtyOrder(Runnable onSuccess) {
|
||||
DialogSimpleMessageView.makeInfoDialog(getText(R.string.warning).toString(),
|
||||
Html.fromHtml(getResources().getString(R.string.confirm_orderable_qty_exceeded)),
|
||||
null,
|
||||
onSuccess, this::onLoadingEnded).show(getSupportFragmentManager(), "confirmExceedingQtyOrder");
|
||||
handler.post(() -> {
|
||||
DialogSimpleMessageView.makeInfoDialog(this, getText(R.string.warning).toString(),
|
||||
Html.fromHtml(getResources().getString(R.string.confirm_orderable_qty_exceeded)),
|
||||
null,
|
||||
onSuccess, this::onLoadingEnded).show();
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void confirmCheckForUnlistedProduct(String barcode, Runnable onComplete) {
|
||||
DialogSimpleMessageView.makeInfoDialog(getText(R.string.info).toString(),
|
||||
Html.fromHtml(getResources().getString(R.string.confirm_order_unlisted_item)),
|
||||
null,
|
||||
() -> {
|
||||
this.mViewModel.loadArticolo(barcode, onComplete);
|
||||
}, this::onLoadingEnded).show(getSupportFragmentManager(), "confirmExceedingQtyOrder");
|
||||
handler.post(() -> {
|
||||
|
||||
|
||||
DialogSimpleMessageView.makeInfoDialog(this, getText(R.string.info).toString(),
|
||||
Html.fromHtml(getResources().getString(R.string.confirm_order_unlisted_item)),
|
||||
null,
|
||||
() -> {
|
||||
this.mViewModel.loadArticolo(barcode, onComplete);
|
||||
}, this::onLoadingEnded).show();
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -253,11 +262,13 @@ public class PVOrdineAcquistoEditActivity extends BaseActivity implements PVOrdi
|
||||
|
||||
@Override
|
||||
public void confirmExportInvalidProducts(Runnable onConfirm) {
|
||||
DialogSimpleMessageView.makeInfoDialog(getText(R.string.warning).toString(),
|
||||
Html.fromHtml(getResources().getString(R.string.confirm_export_invalid_product)),
|
||||
null,
|
||||
onConfirm,
|
||||
this::onLoadingEnded).show(getSupportFragmentManager(), "confirmExportInvalidProducts");
|
||||
handler.post(() -> {
|
||||
DialogSimpleMessageView.makeInfoDialog(this, getText(R.string.warning).toString(),
|
||||
Html.fromHtml(getResources().getString(R.string.confirm_export_invalid_product)),
|
||||
null,
|
||||
onConfirm,
|
||||
this::onLoadingEnded).show();
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -189,12 +189,15 @@ public class DialogEditArticoloView extends BaseDialogFragment implements Dialog
|
||||
|
||||
public void saveAndExit() {
|
||||
if (!UtilityBigDecimal.isNullOrZero(this.getArticolo().getCtMaxOrd()) && UtilityBigDecimal.greaterThan(this.mViewModel.getNumCnf(), this.getArticolo().getCtMaxOrd())) {
|
||||
DialogSimpleMessageView.makeInfoDialog(getText(R.string.warning).toString(),
|
||||
Html.fromHtml(getActivity().getResources().getString(R.string.confirm_orderable_qty_exceeded)),
|
||||
null,
|
||||
this::save, () -> {
|
||||
this.mBindings.inputNumCnfText.requestFocus();
|
||||
}).show(getActivity().getSupportFragmentManager(), "confirmExceedingQtyOrder");
|
||||
handler.post(() -> {
|
||||
|
||||
DialogSimpleMessageView.makeInfoDialog(requireContext(), getText(R.string.warning).toString(),
|
||||
Html.fromHtml(getActivity().getResources().getString(R.string.confirm_orderable_qty_exceeded)),
|
||||
null,
|
||||
this::save, () -> {
|
||||
this.mBindings.inputNumCnfText.requestFocus();
|
||||
}).show();
|
||||
});
|
||||
} else {
|
||||
save();
|
||||
}
|
||||
|
||||
@@ -129,19 +129,21 @@ public class PVOrdiniAcquistoGrigliaFragment extends BaseFragment implements ITi
|
||||
Map<String, Long> downloadedGrids = Stream.of(mListArticoli).collect(Collectors.groupingBy(ArticoloOrdinabileDTO::getCodAlis, Collectors.counting()));
|
||||
if (downloadedGrids != null && !downloadedGrids.isEmpty()) {
|
||||
|
||||
List<String> gridsDetails = Stream.of(downloadedGrids)
|
||||
.map((el) -> "<b>" + el.getKey() + ":</b> " + el.getValue() + " " + getResources().getQuantityString(R.plurals.available_articles, el.getValue().intValue()))
|
||||
.toList();
|
||||
handler.post(() -> {
|
||||
List<String> gridsDetails = Stream.of(downloadedGrids)
|
||||
.map((el) -> "<b>" + el.getKey() + ":</b> " + el.getValue() + " " + getResources().getQuantityString(R.plurals.available_articles, el.getValue().intValue()))
|
||||
.toList();
|
||||
|
||||
|
||||
DialogSimpleMessageView.makeInfoDialog(getText(R.string.grid_details).toString(),
|
||||
Html.fromHtml(
|
||||
String.format(getResources().getQuantityString(R.plurals.loaded_grids_message, (int) downloadedGrids.size()), downloadedGrids.size())
|
||||
+ "<br /><br />" +
|
||||
StringUtils.join(gridsDetails, "<br/>")),
|
||||
null,
|
||||
this::fetchOrders)
|
||||
.show(requireActivity().getSupportFragmentManager(), "downloadedGridDetails");
|
||||
DialogSimpleMessageView.makeInfoDialog(requireContext(), getText(R.string.grid_details).toString(),
|
||||
Html.fromHtml(
|
||||
String.format(getResources().getQuantityString(R.plurals.loaded_grids_message, (int) downloadedGrids.size()), downloadedGrids.size())
|
||||
+ "<br /><br />" +
|
||||
StringUtils.join(gridsDetails, "<br/>")),
|
||||
null,
|
||||
this::fetchOrders)
|
||||
.show();
|
||||
});
|
||||
} else {
|
||||
fetchOrders();
|
||||
}
|
||||
@@ -229,19 +231,22 @@ public class PVOrdiniAcquistoGrigliaFragment extends BaseFragment implements ITi
|
||||
}
|
||||
|
||||
private void deleteOrdine(Ordine ordine) {
|
||||
String text = "Stai per eliminare un ordine sei sicuro?";
|
||||
handler.post(() -> {
|
||||
String text = "Stai per eliminare un ordine sei sicuro?";
|
||||
|
||||
DialogSimpleMessageView.makeWarningDialog(new SpannableString(Html.fromHtml(text)), null, () -> requireActivity().runOnUiThread(() -> {
|
||||
this.onLoadingStarted();
|
||||
mPvOrdiniAcquistoGrigliaViewModel.deleteOrder(ordine, () -> {
|
||||
requireActivity().runOnUiThread(() -> {
|
||||
this.onLoadingEnded();
|
||||
Toast.makeText(requireActivity(), "Ordine eliminato!", Toast.LENGTH_SHORT).show();
|
||||
fetchOrders();
|
||||
});
|
||||
}, this::onError);
|
||||
}), () -> {
|
||||
}).show(requireActivity().getSupportFragmentManager(), "tag");
|
||||
DialogSimpleMessageView.makeWarningDialog(requireContext(),
|
||||
new SpannableString(Html.fromHtml(text)), null, () -> requireActivity().runOnUiThread(() -> {
|
||||
this.onLoadingStarted();
|
||||
mPvOrdiniAcquistoGrigliaViewModel.deleteOrder(ordine, () -> {
|
||||
requireActivity().runOnUiThread(() -> {
|
||||
this.onLoadingEnded();
|
||||
Toast.makeText(requireActivity(), "Ordine eliminato!", Toast.LENGTH_SHORT).show();
|
||||
fetchOrders();
|
||||
});
|
||||
}, this::onError);
|
||||
}), () -> {
|
||||
}).show();
|
||||
});
|
||||
}
|
||||
|
||||
private void refreshRenderedOrdini(List<OrdineWrapper> ordini) {
|
||||
|
||||
@@ -373,13 +373,16 @@ public class RettificaGiacenzeFragment extends BaseFragment implements ITitledFr
|
||||
|
||||
@Override
|
||||
public void onMtbColrDeleteRequest(RunnableArgs<Boolean> onComplete) {
|
||||
String text = getResources().getString(R.string.alert_delete_mtb_colr);
|
||||
DialogSimpleMessageView.makeWarningDialog(new SpannableString(text),
|
||||
null,
|
||||
() -> onComplete.run(true),
|
||||
() -> onComplete.run(false)
|
||||
)
|
||||
.show(requireActivity().getSupportFragmentManager(), "tag");
|
||||
handler.post(() -> {
|
||||
String text = getResources().getString(R.string.alert_delete_mtb_colr);
|
||||
DialogSimpleMessageView.makeWarningDialog(requireContext(),
|
||||
new SpannableString(text),
|
||||
null,
|
||||
() -> onComplete.run(true),
|
||||
() -> onComplete.run(false)
|
||||
)
|
||||
.show();
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -459,12 +462,15 @@ public class RettificaGiacenzeFragment extends BaseFragment implements ITitledFr
|
||||
|
||||
private void checkIfItemIsActive(String flagStato, String codMart, Runnable onContinue, Runnable onNegativeClick) {
|
||||
if (flagStato.equalsIgnoreCase("I")) {
|
||||
DialogSimpleMessageView.makeWarningDialog(
|
||||
new SpannableString(Html.fromHtml(String.format(UtilityResources.getString(R.string.item_not_enabled), codMart))),
|
||||
null,
|
||||
onContinue,
|
||||
onNegativeClick)
|
||||
.show(getActivity().getSupportFragmentManager(), "tag");
|
||||
handler.post(() -> {
|
||||
DialogSimpleMessageView.makeWarningDialog(
|
||||
requireContext(),
|
||||
new SpannableString(Html.fromHtml(String.format(UtilityResources.getString(R.string.item_not_enabled), codMart))),
|
||||
null,
|
||||
onContinue,
|
||||
onNegativeClick)
|
||||
.show();
|
||||
});
|
||||
} else {
|
||||
onContinue.run();
|
||||
}
|
||||
@@ -512,32 +518,38 @@ public class RettificaGiacenzeFragment extends BaseFragment implements ITitledFr
|
||||
|
||||
@Override
|
||||
public void onLUSuccessullyPrinted() {
|
||||
Resources res = getResources();
|
||||
String errorMessage = res.getText(R.string.alert_print_completed_message).toString();
|
||||
DialogSimpleMessageView
|
||||
.makeSuccessDialog(res.getText(R.string.completed).toString(), new SpannableString(errorMessage), null, null)
|
||||
.show(getActivity().getSupportFragmentManager(), "tag");
|
||||
handler.post(() -> {
|
||||
Resources res = getResources();
|
||||
String errorMessage = res.getText(R.string.alert_print_completed_message).toString();
|
||||
DialogSimpleMessageView
|
||||
.makeSuccessDialog(requireContext(),
|
||||
res.getText(R.string.completed).toString(), new SpannableString(errorMessage), null, null)
|
||||
.show();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean onLUPrintRequest() {
|
||||
AtomicReference<Boolean> resultPrintPackingList = new AtomicReference<>();
|
||||
CountDownLatch countDownLatch = new CountDownLatch(1);
|
||||
handler.post(() -> {
|
||||
|
||||
DialogSimpleMessageView.makeInfoDialog(
|
||||
getActivity().getResources().getString(R.string.action_print_ul),
|
||||
new SpannableString(getActivity().getResources().getString(R.string.ask_print_message)),
|
||||
null,
|
||||
() -> {
|
||||
resultPrintPackingList.set(true);
|
||||
countDownLatch.countDown();
|
||||
},
|
||||
() -> {
|
||||
resultPrintPackingList.set(false);
|
||||
countDownLatch.countDown();
|
||||
})
|
||||
.show(getActivity().getSupportFragmentManager(), "dialog-print");
|
||||
|
||||
DialogSimpleMessageView.makeInfoDialog(requireContext(),
|
||||
getActivity().getResources().getString(R.string.action_print_ul),
|
||||
new SpannableString(getActivity().getResources().getString(R.string.ask_print_message)),
|
||||
null,
|
||||
() -> {
|
||||
resultPrintPackingList.set(true);
|
||||
countDownLatch.countDown();
|
||||
},
|
||||
() -> {
|
||||
resultPrintPackingList.set(false);
|
||||
countDownLatch.countDown();
|
||||
})
|
||||
.show();
|
||||
|
||||
});
|
||||
|
||||
try {
|
||||
countDownLatch.await();
|
||||
@@ -551,39 +563,43 @@ public class RettificaGiacenzeFragment extends BaseFragment implements ITitledFr
|
||||
|
||||
@Override
|
||||
public void onLUPrintError(Exception ex, Runnable onComplete) {
|
||||
DialogSimpleMessageView.makeErrorDialog(
|
||||
new SpannableString(ex.getMessage()),
|
||||
null,
|
||||
null,
|
||||
R.string.button_ignore_print,
|
||||
onComplete)
|
||||
.show(requireActivity().getSupportFragmentManager(), "tag");
|
||||
handler.post(() -> {
|
||||
DialogSimpleMessageView.makeErrorDialog(requireContext(),
|
||||
new SpannableString(ex.getMessage()),
|
||||
null,
|
||||
null,
|
||||
R.string.button_ignore_print,
|
||||
onComplete)
|
||||
.show();
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLUPositionChangeRequest(RunnableArgss<Boolean, MtbDepoPosizione> onComplete) {
|
||||
DialogYesNoView.newInstance(null, "Vuoi cambiare la posizione della UL corrente?", result -> {
|
||||
switch (result) {
|
||||
case YES:
|
||||
DialogAskPositionOfLUView.newInstance(false, (status, mtbDepoPosizione) -> {
|
||||
if (status == DialogConsts.Results.ABORT) {
|
||||
onComplete.run(false, null);
|
||||
} else {
|
||||
if (mtbDepoPosizione != null) {
|
||||
onComplete.run(true, mtbDepoPosizione);
|
||||
handler.post(() -> {
|
||||
DialogYesNoView.newInstance(null, "Vuoi cambiare la posizione della UL corrente?", result -> {
|
||||
switch (result) {
|
||||
case YES:
|
||||
DialogAskPositionOfLUView.newInstance(false, (status, mtbDepoPosizione) -> {
|
||||
if (status == DialogConsts.Results.ABORT) {
|
||||
onComplete.run(false, null);
|
||||
} else {
|
||||
onComplete.run(true, null);
|
||||
if (mtbDepoPosizione != null) {
|
||||
onComplete.run(true, mtbDepoPosizione);
|
||||
} else {
|
||||
onComplete.run(true, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
.show(requireActivity().getSupportFragmentManager(), "tag");
|
||||
break;
|
||||
})
|
||||
.show(requireActivity().getSupportFragmentManager(), "tag");
|
||||
break;
|
||||
|
||||
case NO:
|
||||
onComplete.run(false, null);
|
||||
break;
|
||||
}
|
||||
}).show(requireActivity().getSupportFragmentManager(), "tag");
|
||||
case NO:
|
||||
onComplete.run(false, null);
|
||||
break;
|
||||
}
|
||||
}).show(requireActivity().getSupportFragmentManager(), "tag");
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -268,7 +268,7 @@ public class SpedizioneActivity extends BaseActivity implements SpedizioneViewMo
|
||||
});
|
||||
|
||||
mViewmodel.isFilterApplied().observe(this, newValue -> {
|
||||
if(newValue) {
|
||||
if (newValue) {
|
||||
this.mBindings.filteredArtsInListExpandableLayout.expand(true);
|
||||
} else {
|
||||
this.mBindings.filteredArtsInListExpandableLayout.collapse(true);
|
||||
@@ -912,8 +912,9 @@ public class SpedizioneActivity extends BaseActivity implements SpedizioneViewMo
|
||||
Resources res = getResources();
|
||||
String errorMessage = res.getText(R.string.alert_print_completed_message).toString();
|
||||
DialogSimpleMessageView
|
||||
.makeSuccessDialog(res.getText(R.string.completed).toString(), new SpannableString(errorMessage), null, null)
|
||||
.show(getSupportFragmentManager(), "tag");
|
||||
.makeSuccessDialog(this,
|
||||
res.getText(R.string.completed).toString(), new SpannableString(errorMessage), null, null)
|
||||
.show();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -945,13 +946,15 @@ public class SpedizioneActivity extends BaseActivity implements SpedizioneViewMo
|
||||
@Override
|
||||
public void onLUPrintError(Exception ex, Runnable onComplete) {
|
||||
this.onLoadingEnded();
|
||||
DialogSimpleMessageView.makeErrorDialog(
|
||||
new SpannableString(ex.getMessage()),
|
||||
null,
|
||||
null,
|
||||
R.string.button_ignore_print,
|
||||
onComplete)
|
||||
.show(getSupportFragmentManager(), "tag");
|
||||
handler.post(() -> {
|
||||
DialogSimpleMessageView.makeErrorDialog(this,
|
||||
new SpannableString(ex.getMessage()),
|
||||
null,
|
||||
null,
|
||||
R.string.button_ignore_print,
|
||||
onComplete)
|
||||
.show();
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -972,12 +975,13 @@ public class SpedizioneActivity extends BaseActivity implements SpedizioneViewMo
|
||||
public void onMtbColrDeleteRequest(RunnableArgs<Boolean> onComplete) {
|
||||
handler.post(() -> {
|
||||
String text = getResources().getString(R.string.alert_delete_mtb_colr);
|
||||
DialogSimpleMessageView.makeWarningDialog(new SpannableString(text),
|
||||
DialogSimpleMessageView.makeWarningDialog(this,
|
||||
new SpannableString(text),
|
||||
null,
|
||||
() -> onComplete.run(true),
|
||||
() -> onComplete.run(false)
|
||||
)
|
||||
.show(getSupportFragmentManager(), "tag");
|
||||
.show();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1103,7 +1107,7 @@ public class SpedizioneActivity extends BaseActivity implements SpedizioneViewMo
|
||||
CountDownLatch countDownLatch = new CountDownLatch(1);
|
||||
|
||||
handler.post(() -> {
|
||||
DialogSimpleMessageView.makeInfoDialog(
|
||||
DialogSimpleMessageView.makeInfoDialog(this,
|
||||
getResources().getString(R.string.action_close_order),
|
||||
new SpannableString(getResources().getString(R.string.message_print_packing_list_on_close_order)),
|
||||
null,
|
||||
@@ -1116,7 +1120,7 @@ public class SpedizioneActivity extends BaseActivity implements SpedizioneViewMo
|
||||
countDownLatch.countDown();
|
||||
}
|
||||
)
|
||||
.show(getSupportFragmentManager(), "tag");
|
||||
.show();
|
||||
});
|
||||
|
||||
|
||||
@@ -1294,10 +1298,13 @@ public class SpedizioneActivity extends BaseActivity implements SpedizioneViewMo
|
||||
dialogInputQuantityToDuplicate(inputNumber -> {
|
||||
if (qtaTot != null && qtaEvasa != null && UtilityBigDecimal.equalsOrGreaterThan(qtaEvasa.multiply(BigDecimal.valueOf(inputNumber)), qtaTot)) {
|
||||
|
||||
DialogSimpleMessageView.makeWarningDialog(new SpannableString(Html.fromHtml(textWarning)),
|
||||
null,
|
||||
() -> this.onInputDuplicate(qtaTot, qtaEvasa, onComplete, onNegativeClick)
|
||||
).show(getSupportFragmentManager(), "tag");
|
||||
handler.post(() -> {
|
||||
DialogSimpleMessageView.makeWarningDialog(this,
|
||||
new SpannableString(Html.fromHtml(textWarning)),
|
||||
null,
|
||||
() -> this.onInputDuplicate(qtaTot, qtaEvasa, onComplete, onNegativeClick)
|
||||
).show();
|
||||
});
|
||||
} else {
|
||||
onComplete.run(inputNumber);
|
||||
}
|
||||
|
||||
@@ -41,6 +41,7 @@ import it.integry.integrywmsnative.databinding.FragmentMainUltimeConsegneCliente
|
||||
import it.integry.integrywmsnative.databinding.FragmentMainUltimeConsegneClienteListHeaderBinding;
|
||||
import it.integry.integrywmsnative.databinding.FragmentMainUltimeConsegneClienteListSingleItemBinding;
|
||||
import it.integry.integrywmsnative.gest.picking_resi.PickingResiActivity;
|
||||
import it.integry.integrywmsnative.gest.picking_resi.PickingResiViewModel;
|
||||
import it.integry.integrywmsnative.gest.ultime_consegne_cliente.dialog.DialogUltimeConsegneFiltroAvanzatoView;
|
||||
import it.integry.integrywmsnative.ui.ElevatedToolbar;
|
||||
import kotlin.Unit;
|
||||
@@ -122,7 +123,7 @@ public class UltimeConsegneClienteFragment extends BaseFragment implements Ultim
|
||||
|
||||
handler.post(() -> {
|
||||
|
||||
DialogUltimeConsegneFiltroAvanzatoView.newInstance(gtbAnags, filterResult -> {
|
||||
DialogUltimeConsegneFiltroAvanzatoView.newInstance(requireContext(), gtbAnags, filterResult -> {
|
||||
if (filterResult == null || filterResult.isAborted())
|
||||
popMe();
|
||||
|
||||
@@ -131,7 +132,8 @@ public class UltimeConsegneClienteFragment extends BaseFragment implements Ultim
|
||||
refreshConsegne(filterResult.getGtbAnag());
|
||||
});
|
||||
})
|
||||
.show(requireActivity().getSupportFragmentManager(), "dialog-filtro-ultime-consegne");
|
||||
.show();
|
||||
// .show(requireActivity().getSupportFragmentManager(), "dialog-filtro-ultime-consegne");
|
||||
|
||||
});
|
||||
} catch (Exception e) {
|
||||
@@ -296,7 +298,10 @@ public class UltimeConsegneClienteFragment extends BaseFragment implements Ultim
|
||||
private void dispatchConsegne() {
|
||||
List<DocumentoResoDTO> selectedConsegne = getSelectedItems();
|
||||
|
||||
PickingResiActivity.startActivity(getActivity(), getActivity().getText(R.string.ultime_consegne_cliente_title).toString(), selectedConsegne, +1);
|
||||
PickingResiActivity.startActivity(getActivity(),
|
||||
requireActivity().getText(R.string.ultime_consegne_cliente_title).toString(),
|
||||
selectedConsegne,
|
||||
PickingResiViewModel.Tipologia.VENDITA);
|
||||
}
|
||||
|
||||
public void removeBarcodeFilter() {
|
||||
|
||||
@@ -77,6 +77,9 @@ public class UltimeConsegneClienteViewModel {
|
||||
|
||||
var result = this.mUltimeConsegneClienteRESTConsumer.makeSynchronousRetrieveDocumentiFromBarcodeUdcRequest(barcodeUl);
|
||||
|
||||
if(result == null)
|
||||
throw new Exception("Nessun documento trovato per il codice barcode: <b>" + barcodeUl + "</b>");
|
||||
|
||||
var filteredDocumentList = originalDocumentList.stream()
|
||||
.filter(x -> result.stream().anyMatch(y -> x.getDtbDoctKey().equals(y)))
|
||||
.collect(Collectors.toUnmodifiableList());
|
||||
|
||||
@@ -1,15 +1,13 @@
|
||||
package it.integry.integrywmsnative.gest.ultime_consegne_cliente.dialog;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.WindowManager;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.lifecycle.LifecycleOwner;
|
||||
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
||||
|
||||
@@ -20,31 +18,28 @@ import javax.inject.Inject;
|
||||
|
||||
import it.integry.integrywmsnative.MainApplication;
|
||||
import it.integry.integrywmsnative.R;
|
||||
import it.integry.integrywmsnative.core.expansion.BaseDialogFragment;
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
import it.integry.integrywmsnative.core.model.GtbAnag;
|
||||
import it.integry.integrywmsnative.databinding.DialogUltimeConsegneFiltroAvanzatoBinding;
|
||||
import it.integry.integrywmsnative.ui.adapter.SimpleAutoCompleteDropdownAdapter;
|
||||
|
||||
public class DialogUltimeConsegneFiltroAvanzatoView extends BaseDialogFragment {
|
||||
public class DialogUltimeConsegneFiltroAvanzatoView extends MaterialAlertDialogBuilder {
|
||||
|
||||
@Inject
|
||||
DialogUltimeConsegneFiltroAvanzatoViewModel mViewModel;
|
||||
|
||||
private DialogUltimeConsegneFiltroAvanzatoBinding mBindings;
|
||||
private Context mContext;
|
||||
private final DialogUltimeConsegneFiltroAvanzatoBinding mBindings;
|
||||
private final Context mContext;
|
||||
private SimpleAutoCompleteDropdownAdapter<String> arrayAdapterRagSoc;
|
||||
|
||||
private final RunnableArgs<Result> onConfirm;
|
||||
|
||||
|
||||
public static DialogUltimeConsegneFiltroAvanzatoView newInstance(final List<GtbAnag> items, RunnableArgs<Result> onConfirm) {
|
||||
return new DialogUltimeConsegneFiltroAvanzatoView(items, onConfirm);
|
||||
public static DialogUltimeConsegneFiltroAvanzatoView newInstance(Context context, final List<GtbAnag> items, RunnableArgs<Result> onConfirm) {
|
||||
return new DialogUltimeConsegneFiltroAvanzatoView(context, items, onConfirm);
|
||||
}
|
||||
|
||||
private DialogUltimeConsegneFiltroAvanzatoView(final List<GtbAnag> items, RunnableArgs<Result> onConfirm) {
|
||||
super();
|
||||
|
||||
public DialogUltimeConsegneFiltroAvanzatoView(@NonNull Context context, final List<GtbAnag> items, RunnableArgs<Result> onConfirm) {
|
||||
super(context);
|
||||
this.mContext = context;
|
||||
this.onConfirm = onConfirm;
|
||||
|
||||
MainApplication.appComponent
|
||||
@@ -52,55 +47,41 @@ public class DialogUltimeConsegneFiltroAvanzatoView extends BaseDialogFragment {
|
||||
.create()
|
||||
.inject(this);
|
||||
mViewModel.init(items);
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) {
|
||||
this.mContext = requireContext();
|
||||
|
||||
mBindings = DialogUltimeConsegneFiltroAvanzatoBinding.inflate(LayoutInflater.from(this.mContext), null, false);
|
||||
mBindings.setLifecycleOwner(this); // Necessario per LiveData e binding
|
||||
if (mContext instanceof LifecycleOwner) {
|
||||
mBindings.setLifecycleOwner((LifecycleOwner) mContext); // Necessario per LiveData e binding
|
||||
}
|
||||
mBindings.setView(this);
|
||||
mBindings.setViewmodel(mViewModel);
|
||||
|
||||
setCancelable(false);
|
||||
|
||||
var alertDialog = new MaterialAlertDialogBuilder(this.mContext)
|
||||
.setView(mBindings.getRoot())
|
||||
.setCancelable(isCancelable())
|
||||
.setPositiveButton(R.string.ok, (dialog, which) -> onOk())
|
||||
.setNegativeButton(R.string.abort, (dialog, which) -> {
|
||||
if (onConfirm != null) onConfirm.run(Result.aborted());
|
||||
})
|
||||
.setNeutralButton(R.string.reset, (dialog, which) -> {})
|
||||
.create();
|
||||
|
||||
alertDialog.setCanceledOnTouchOutside(isCancelable());
|
||||
alertDialog.setOnShowListener(this); // Rimosso se non specificamente necessario per altro
|
||||
alertDialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
|
||||
setView(mBindings.getRoot());
|
||||
setPositiveButton(R.string.ok, (dialog, which) -> onOk());
|
||||
setNegativeButton(R.string.abort, (dialog, which) -> {
|
||||
if (onConfirm != null) onConfirm.run(Result.aborted());
|
||||
});
|
||||
setNeutralButton(R.string.reset, (dialog, which) -> {
|
||||
});
|
||||
|
||||
this.initDropDowns();
|
||||
|
||||
return alertDialog;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public void onShow(DialogInterface dialogInterface) {
|
||||
super.onShow(dialogInterface);
|
||||
public AlertDialog create() {
|
||||
AlertDialog alertDialog = super.create();
|
||||
alertDialog.setCanceledOnTouchOutside(false);
|
||||
alertDialog.setOnShowListener(dialogInterface -> {
|
||||
alertDialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN);
|
||||
|
||||
var alertDialog = ((AlertDialog) dialogInterface);
|
||||
|
||||
var neutralButton = alertDialog.getButton(DialogInterface.BUTTON_NEUTRAL);
|
||||
neutralButton.setOnClickListener(view -> {
|
||||
reset();
|
||||
var neutralButton = alertDialog.getButton(DialogInterface.BUTTON_NEUTRAL);
|
||||
neutralButton.setOnClickListener(view -> {
|
||||
reset();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dismiss() {
|
||||
if (getDialog() != null) getDialog().dismiss();
|
||||
super.dismiss();
|
||||
return alertDialog;
|
||||
}
|
||||
|
||||
private void initDropDowns() {
|
||||
@@ -109,7 +90,7 @@ public class DialogUltimeConsegneFiltroAvanzatoView extends BaseDialogFragment {
|
||||
mContext,
|
||||
R.layout.dialog_vendita_filtro_avanzato__single_item, // Assicurati che questo layout sia un semplice TextView
|
||||
mViewModel.getAvailableRagSocsStrings(), // LiveData<List<String>>
|
||||
this // LifecycleOwner
|
||||
(LifecycleOwner) mContext // Assumendo che il contesto sia un LifecycleOwner
|
||||
);
|
||||
mBindings.filledExposedDropdownRagSoc.setAdapter(arrayAdapterRagSoc);
|
||||
|
||||
@@ -134,16 +115,8 @@ public class DialogUltimeConsegneFiltroAvanzatoView extends BaseDialogFragment {
|
||||
public void onOk() {
|
||||
if (onConfirm != null)
|
||||
onConfirm.run(Result.completed(mViewModel.getRagSocBindable().getValue(), mViewModel.getDataDocBindable().getValue()));
|
||||
// dismiss();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroyView() {
|
||||
super.onDestroyView();
|
||||
mBindings = null; // Per evitare memory leaks
|
||||
}
|
||||
|
||||
|
||||
public static class Result {
|
||||
private final GtbAnag gtbAnag;
|
||||
private final Date dataDoc;
|
||||
|
||||
@@ -44,9 +44,10 @@ import it.integry.integrywmsnative.databinding.FragmentUltimiArriviFornitoreBind
|
||||
import it.integry.integrywmsnative.databinding.FragmentUltimiArriviFornitoreListHeaderBinding;
|
||||
import it.integry.integrywmsnative.databinding.FragmentUltimiArriviFornitoreListSingleItemBinding;
|
||||
import it.integry.integrywmsnative.gest.picking_resi.PickingResiActivity;
|
||||
import it.integry.integrywmsnative.gest.picking_resi.PickingResiViewModel;
|
||||
import it.integry.integrywmsnative.gest.ultime_consegne_cliente.dialog.DialogUltimeConsegneFiltroAvanzatoView;
|
||||
import it.integry.integrywmsnative.ui.ElevatedToolbar;
|
||||
import it.integry.integrywmsnative.view.dialogs.choose_arts_from_mtbcolr_list.DialogChooseArtsFromMtbColrList;
|
||||
import it.integry.integrywmsnative.view.dialogs.choose_arts_from_mtbcolr_list.DialogChooseArtsFromMtbColrListView;
|
||||
import kotlin.Unit;
|
||||
|
||||
/**
|
||||
@@ -128,17 +129,16 @@ public class UltimiArriviFornitoreFragment extends BaseFragment implements ITitl
|
||||
this.onLoadingEnded();
|
||||
|
||||
handler.post(() -> {
|
||||
DialogUltimeConsegneFiltroAvanzatoView.newInstance(gtbAnags, filterResult -> {
|
||||
if (filterResult == null || filterResult.isAborted())
|
||||
popMe();
|
||||
DialogUltimeConsegneFiltroAvanzatoView.newInstance(requireContext(), gtbAnags, filterResult -> {
|
||||
if (filterResult == null || filterResult.isAborted())
|
||||
popMe();
|
||||
|
||||
else
|
||||
executorService.execute(() -> {
|
||||
refreshArrivi(filterResult.getGtbAnag());
|
||||
resetSelected();
|
||||
});
|
||||
})
|
||||
.show(requireActivity().getSupportFragmentManager(), "dialog-filtro-ultimi-arrivi");
|
||||
else
|
||||
executorService.execute(() -> {
|
||||
refreshArrivi(filterResult.getGtbAnag(), null);
|
||||
resetSelected();
|
||||
});
|
||||
}).show();
|
||||
});
|
||||
} catch (Exception e) {
|
||||
this.onError(e);
|
||||
@@ -252,12 +252,12 @@ public class UltimiArriviFornitoreFragment extends BaseFragment implements ITitl
|
||||
this.mDocumentiMutableData.addAll(sort(documentList));
|
||||
}
|
||||
|
||||
private void refreshArrivi(GtbAnag gtbAnagToFilter) {
|
||||
private void refreshArrivi(GtbAnag gtbAnagToFilter, List<MtbAart> mtbAartsToFilter) {
|
||||
this.onLoadingStarted();
|
||||
|
||||
try {
|
||||
this.mViewModel.loadArriviFornitori(gtbAnagToFilter != null ? gtbAnagToFilter.getCodAnag() : null,
|
||||
null,
|
||||
mtbAartsToFilter,
|
||||
null,
|
||||
365
|
||||
);
|
||||
@@ -300,7 +300,10 @@ public class UltimiArriviFornitoreFragment extends BaseFragment implements ITitl
|
||||
private void dispatchArrivi() {
|
||||
List<DocumentoResoDTO> selectedConsegne = getSelectedItems();
|
||||
|
||||
PickingResiActivity.startActivity(getActivity(), requireActivity().getText(R.string.ultime_arrivi_fornitore_title).toString(), selectedConsegne, -1);
|
||||
PickingResiActivity.startActivity(getActivity(),
|
||||
requireActivity().getText(R.string.ultime_arrivi_fornitore_title).toString(),
|
||||
selectedConsegne,
|
||||
PickingResiViewModel.Tipologia.ACQUISTO);
|
||||
}
|
||||
|
||||
|
||||
@@ -339,19 +342,25 @@ public class UltimiArriviFornitoreFragment extends BaseFragment implements ITitl
|
||||
@Override
|
||||
public void onMtbColtScanned(MtbColt scannedMtbColt) {
|
||||
|
||||
DialogChooseArtsFromMtbColrList
|
||||
.newInstance(scannedMtbColt.getMtbColr(), items -> {
|
||||
List<MtbAart> mtbAarts = new ArrayList<>();
|
||||
|
||||
if (items != null && !items.isEmpty()) {
|
||||
mtbAarts = items.stream()
|
||||
.map(MtbColr::getMtbAart)
|
||||
.toList();
|
||||
DialogChooseArtsFromMtbColrListView
|
||||
.newInstance(scannedMtbColt.getMtbColr(), result -> {
|
||||
if (result == null || result.isAborted()) {
|
||||
return;
|
||||
}
|
||||
|
||||
throw new UnsupportedOperationException("Not implemented yet");
|
||||
// filterItems(mtbAarts);
|
||||
}, null)
|
||||
|
||||
if (result.getMtbColrList() == null || result.getMtbColrList().isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
List<MtbAart> mtbAarts = result.getMtbColrList().stream()
|
||||
.map(MtbColr::getMtbAart)
|
||||
.toList();
|
||||
|
||||
executorService.execute(() -> {
|
||||
refreshArrivi(null, mtbAarts);
|
||||
});
|
||||
})
|
||||
.show(requireActivity().getSupportFragmentManager(), "tag");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -73,38 +73,16 @@ public class UltimiArriviFornitoreViewModel {
|
||||
}
|
||||
|
||||
|
||||
private void executeEtichettaLU(String SSCC) {
|
||||
this.mColliMagazzinoRESTConsumer.getBySSCC(SSCC, true, false, mtbColt -> {
|
||||
private void executeEtichettaLU(String SSCC) throws Exception {
|
||||
var mtbColt = this.mColliMagazzinoRESTConsumer.getBySsccSynchronized(SSCC, true, false);
|
||||
|
||||
if (mtbColt != null && mtbColt.getMtbColr() != null && !mtbColt.getMtbColr().isEmpty()) {
|
||||
if (mtbColt.getSegno() > 0) {
|
||||
if (mtbColt != null && mtbColt.getMtbColr() != null && !mtbColt.getMtbColr().isEmpty()) {
|
||||
if (mtbColt.getSegno() > 0) {
|
||||
this.sendOnMtbColtScanned(mtbColt);
|
||||
|
||||
this.sendOnMtbColtScanned(mtbColt);
|
||||
} else throw new InvalidLUException();
|
||||
|
||||
// this.mOrdiniUscitaElencoRESTConsumer.getOrdiniFromCommessaCollo(mCurrentCodMdep, mtbColt, orderList -> {
|
||||
//
|
||||
// if(orderList != null && orderList.size() > 0) {
|
||||
// List<Integer> numOrds = Stream.of(orderList)
|
||||
// .map(DtbOrdt::getNumOrd)
|
||||
// .toList();
|
||||
//
|
||||
// List<OrdiniUscitaElencoDTO> filteredOrders = Stream.of(mOrderList.getValue())
|
||||
// .filter(x -> numOrds.contains(x.getNumOrd())).toList();
|
||||
//
|
||||
// onComplete.run(filteredOrders);
|
||||
// } else {
|
||||
// this.sendError(new NoOrderFoundException());
|
||||
// }
|
||||
//
|
||||
// }, this::sendError);
|
||||
} else {
|
||||
this.sendError(new InvalidLUException());
|
||||
}
|
||||
} else {
|
||||
this.sendError(new NoLUFoundException());
|
||||
}
|
||||
|
||||
}, this::sendError);
|
||||
} else throw new NoLUFoundException();
|
||||
}
|
||||
|
||||
private void executeEtichettaEan128(BarcodeScanDTO barcodeScanDTO) throws Exception {
|
||||
@@ -122,13 +100,10 @@ public class UltimiArriviFornitoreViewModel {
|
||||
|
||||
if (!UtilityString.isNullOrEmpty(ean128Model.Sscc)) {
|
||||
this.executeEtichettaLU(ean128Model.Sscc);
|
||||
}
|
||||
|
||||
} else throw new NoLUFoundException();
|
||||
} else
|
||||
//EAN 128 non completo o comunque mancano i riferimenti al prodotto
|
||||
throw new NoLUFoundException();
|
||||
}
|
||||
|
||||
//EAN 128 non completo o comunque mancano i riferimenti al prodotto
|
||||
throw new NoLUFoundException();
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,15 +1,13 @@
|
||||
package it.integry.integrywmsnative.gest.ultimi_arrivi_fornitore.dialog;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.WindowManager;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.lifecycle.LifecycleOwner;
|
||||
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
||||
|
||||
@@ -20,13 +18,12 @@ import javax.inject.Inject;
|
||||
|
||||
import it.integry.integrywmsnative.MainApplication;
|
||||
import it.integry.integrywmsnative.R;
|
||||
import it.integry.integrywmsnative.core.expansion.BaseDialogFragment;
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
import it.integry.integrywmsnative.core.model.GtbAnag;
|
||||
import it.integry.integrywmsnative.databinding.DialogUltimiArriviFornitoreFiltroAvanzatoBinding;
|
||||
import it.integry.integrywmsnative.ui.adapter.SimpleAutoCompleteDropdownAdapter;
|
||||
|
||||
public class DialogUltimiArriviFornitoreFiltroAvanzatoView extends BaseDialogFragment {
|
||||
public class DialogUltimiArriviFornitoreFiltroAvanzatoView extends MaterialAlertDialogBuilder {
|
||||
|
||||
@Inject
|
||||
DialogUltimiArriviFornitoreFiltroAvanzatoViewModel mViewModel;
|
||||
@@ -38,13 +35,13 @@ public class DialogUltimiArriviFornitoreFiltroAvanzatoView extends BaseDialogFra
|
||||
private final RunnableArgs<Result> onConfirm;
|
||||
|
||||
|
||||
public static DialogUltimiArriviFornitoreFiltroAvanzatoView newInstance(final List<GtbAnag> items, RunnableArgs<Result> onConfirm) {
|
||||
return new DialogUltimiArriviFornitoreFiltroAvanzatoView(items, onConfirm);
|
||||
public static DialogUltimiArriviFornitoreFiltroAvanzatoView newInstance(Context context, final List<GtbAnag> items, RunnableArgs<Result> onConfirm) {
|
||||
return new DialogUltimiArriviFornitoreFiltroAvanzatoView(context, items, onConfirm);
|
||||
}
|
||||
|
||||
private DialogUltimiArriviFornitoreFiltroAvanzatoView(final List<GtbAnag> items, RunnableArgs<Result> onConfirm) {
|
||||
super();
|
||||
|
||||
private DialogUltimiArriviFornitoreFiltroAvanzatoView(@NonNull Context context, final List<GtbAnag> items, RunnableArgs<Result> onConfirm) {
|
||||
super(context);
|
||||
this.mContext = context;
|
||||
this.onConfirm = onConfirm;
|
||||
|
||||
MainApplication.appComponent
|
||||
@@ -53,59 +50,41 @@ public class DialogUltimiArriviFornitoreFiltroAvanzatoView extends BaseDialogFra
|
||||
.inject(this);
|
||||
|
||||
mViewModel.init(items);
|
||||
}
|
||||
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) {
|
||||
this.mContext = requireContext();
|
||||
|
||||
mBindings = DialogUltimiArriviFornitoreFiltroAvanzatoBinding.inflate(LayoutInflater.from(this.mContext), null, false);
|
||||
mBindings.setLifecycleOwner(this);
|
||||
if (mContext instanceof LifecycleOwner) {
|
||||
mBindings.setLifecycleOwner((LifecycleOwner) mContext); // Necessario per LiveData e binding
|
||||
}
|
||||
mBindings.setView(this);
|
||||
mBindings.setViewmodel(mViewModel);
|
||||
|
||||
|
||||
setCancelable(false);
|
||||
|
||||
var alertDialog = new MaterialAlertDialogBuilder(this.mContext)
|
||||
.setView(mBindings.getRoot())
|
||||
.setCancelable(isCancelable())
|
||||
.setPositiveButton(R.string.ok, (dialog, which) -> onOk())
|
||||
.setNegativeButton(R.string.abort, (dialog, which) -> {
|
||||
if (onConfirm != null) onConfirm.run(Result.aborted());
|
||||
})
|
||||
.setNeutralButton(R.string.reset, (dialog, which) -> {})
|
||||
.create();
|
||||
|
||||
|
||||
alertDialog.setCanceledOnTouchOutside(isCancelable());
|
||||
alertDialog.setOnShowListener(this); // Rimosso se non specificamente necessario per altro
|
||||
alertDialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
|
||||
setView(mBindings.getRoot());
|
||||
setPositiveButton(R.string.ok, (dialog, which) -> onOk());
|
||||
setNegativeButton(R.string.abort, (dialog, which) -> {
|
||||
if (onConfirm != null) onConfirm.run(Result.aborted());
|
||||
});
|
||||
setNeutralButton(R.string.reset, (dialog, which) -> {
|
||||
});
|
||||
|
||||
this.initDropDowns();
|
||||
|
||||
return alertDialog;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public void onShow(DialogInterface dialogInterface) {
|
||||
super.onShow(dialogInterface);
|
||||
public AlertDialog create() {
|
||||
AlertDialog alertDialog = super.create();
|
||||
alertDialog.setCanceledOnTouchOutside(false);
|
||||
alertDialog.setOnShowListener(dialogInterface -> {
|
||||
alertDialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN);
|
||||
|
||||
var alertDialog = ((AlertDialog) dialogInterface);
|
||||
|
||||
var neutralButton = alertDialog.getButton(DialogInterface.BUTTON_NEUTRAL);
|
||||
neutralButton.setOnClickListener(view -> {
|
||||
reset();
|
||||
var neutralButton = alertDialog.getButton(DialogInterface.BUTTON_NEUTRAL);
|
||||
neutralButton.setOnClickListener(view -> {
|
||||
reset();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void dismiss() {
|
||||
if (getDialog() != null) getDialog().dismiss();
|
||||
super.dismiss();
|
||||
return alertDialog;
|
||||
}
|
||||
|
||||
private void initDropDowns() {
|
||||
@@ -114,7 +93,7 @@ public class DialogUltimiArriviFornitoreFiltroAvanzatoView extends BaseDialogFra
|
||||
mContext,
|
||||
R.layout.dialog_vendita_filtro_avanzato__single_item, // Assicurati che questo layout sia un semplice TextView
|
||||
mViewModel.getAvailableRagSocsStrings(), // LiveData<List<String>>
|
||||
this // LifecycleOwner
|
||||
(LifecycleOwner) mContext // Assumendo che il contesto sia un LifecycleOwner
|
||||
);
|
||||
mBindings.filledExposedDropdownRagSoc.setAdapter(arrayAdapterRagSoc);
|
||||
|
||||
@@ -139,16 +118,8 @@ public class DialogUltimiArriviFornitoreFiltroAvanzatoView extends BaseDialogFra
|
||||
public void onOk() {
|
||||
if (onConfirm != null)
|
||||
onConfirm.run(Result.completed(mViewModel.getRagSocBindable().getValue(), mViewModel.getDataDocBindable().getValue()));
|
||||
// dismiss();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroyView() {
|
||||
super.onDestroyView();
|
||||
mBindings = null; // Per evitare memory leaks
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static class Result {
|
||||
private final GtbAnag gtbAnag;
|
||||
|
||||
@@ -38,7 +38,7 @@ import it.integry.integrywmsnative.gest.spedizione.model.PickedQuantityDTO;
|
||||
import it.integry.integrywmsnative.view.dialogs.DialogCommon;
|
||||
import it.integry.integrywmsnative.view.dialogs.ask_livello_posizione.DialogAskLivelloPosizioneView;
|
||||
import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleMessageView;
|
||||
import it.integry.integrywmsnative.view.dialogs.choose_arts_from_mtbcolr_list.DialogChooseArtsFromMtbColrList;
|
||||
import it.integry.integrywmsnative.view.dialogs.choose_arts_from_mtbcolr_list.DialogChooseArtsFromMtbColrListView;
|
||||
import it.integry.integrywmsnative.view.dialogs.input_quantity_v2.DialogInputQuantityV2DTO;
|
||||
import it.integry.integrywmsnative.view.dialogs.input_quantity_v2.DialogInputQuantityV2View;
|
||||
import it.integry.integrywmsnative.view.dialogs.scan_or_create_lu.DialogScanOrCreateLUView;
|
||||
@@ -118,10 +118,13 @@ public class VersamentoMerceFragment extends BaseFragment implements ITitledFrag
|
||||
} else if (mtbColt.getGestioneEnum() == GestioneEnum.VENDITA) {
|
||||
this.mViewModel.getCurrentMtbColt().postValue(mtbColt);
|
||||
} else {
|
||||
DialogSimpleMessageView
|
||||
.makeWarningDialog(new SpannableString(Html.fromHtml("Sono accettate solamente UL di <b>Acquisto</b> o <b>Lavorazione</b> di <b>CARICO</b>")),
|
||||
null, this::openLU)
|
||||
.show(getActivity().getSupportFragmentManager(), "tag");
|
||||
handler.post(() -> {
|
||||
DialogSimpleMessageView
|
||||
.makeWarningDialog(requireContext(),
|
||||
new SpannableString(Html.fromHtml("Sono accettate solamente UL di <b>Acquisto</b> o <b>Lavorazione</b> di <b>CARICO</b>")),
|
||||
null, this::openLU)
|
||||
.show();
|
||||
});
|
||||
}
|
||||
}).show(requireActivity().getSupportFragmentManager(), "tag");
|
||||
}
|
||||
@@ -167,23 +170,29 @@ public class VersamentoMerceFragment extends BaseFragment implements ITitledFrag
|
||||
@Override
|
||||
public void onSpostamentoTraDepConfirmRequired(String sourceCodMdep, String destinationCodMdep, RunnableArgs<Boolean> onComplete) {
|
||||
handler.post(() -> {
|
||||
DialogSimpleMessageView.makeWarningDialog(Html.fromHtml("Stai spostando una UL dal deposito <b>" + sourceCodMdep + "</b> al deposito <b>" + destinationCodMdep + "</b>"),
|
||||
DialogSimpleMessageView.makeWarningDialog(
|
||||
requireContext(),
|
||||
Html.fromHtml("Stai spostando una UL dal deposito <b>" + sourceCodMdep + "</b> al deposito <b>" + destinationCodMdep + "</b>"),
|
||||
null,
|
||||
() -> onComplete.run(true),
|
||||
() -> onComplete.run(false))
|
||||
.show(requireActivity().getSupportFragmentManager(), "tag");
|
||||
.show();
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onArtsChooseRequired(List<MtbColr> mtbColrList, RunnableArgs<List<MtbColr>> onComplete, Runnable onAbort) {
|
||||
handler.post(() -> {
|
||||
DialogChooseArtsFromMtbColrList
|
||||
.newInstance(mtbColrList, data -> {
|
||||
if (data == null || data.isEmpty()) {
|
||||
DialogChooseArtsFromMtbColrListView
|
||||
.newInstance(mtbColrList, result -> {
|
||||
if (result == null || result.isAborted() || result.getMtbColrList() == null || result.getMtbColrList().isEmpty()) {
|
||||
onAbort.run();
|
||||
} else onComplete.run(data);
|
||||
}, onAbort)
|
||||
return;
|
||||
}
|
||||
|
||||
List<MtbColr> data = result.getMtbColrList();
|
||||
onComplete.run(data);
|
||||
})
|
||||
.show(requireActivity().getSupportFragmentManager(), "tag");
|
||||
});
|
||||
}
|
||||
@@ -243,7 +252,7 @@ public class VersamentoMerceFragment extends BaseFragment implements ITitledFrag
|
||||
|
||||
@Override
|
||||
public void onDataSaved() {
|
||||
this.requireActivity().runOnUiThread(() -> {
|
||||
handler.post(() -> {
|
||||
DialogCommon.showDataSaved(requireActivity(), this::popMe);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -3,11 +3,11 @@ package it.integry.integrywmsnative.ui.filter_chips;
|
||||
import android.content.Context;
|
||||
import android.content.res.ColorStateList;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.TypedValue;
|
||||
|
||||
import com.google.android.material.chip.Chip;
|
||||
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityResources;
|
||||
|
||||
public class FilterChipView extends Chip {
|
||||
|
||||
@@ -67,9 +67,9 @@ public class FilterChipView extends Chip {
|
||||
setCloseIconVisible(true);
|
||||
|
||||
// Utilizza gli attributi del tema Material 3 per lo stato attivo/checked
|
||||
setChipBackgroundColor(getColorFromAttr(getContext(), com.google.android.material.R.attr.colorPrimaryContainer));
|
||||
setTextColor(getColorFromAttr(getContext(), com.google.android.material.R.attr.colorOnPrimaryContainer));
|
||||
setCloseIconTint(getColorFromAttr(getContext(), com.google.android.material.R.attr.colorOnPrimaryContainer));
|
||||
setChipBackgroundColor(UtilityResources.getColorStateListFromAttr(getContext(), com.google.android.material.R.attr.colorPrimaryContainer));
|
||||
setTextColor(UtilityResources.getColorStateListFromAttr(getContext(), com.google.android.material.R.attr.colorOnPrimaryContainer));
|
||||
setCloseIconTint(UtilityResources.getColorStateListFromAttr(getContext(), com.google.android.material.R.attr.colorOnPrimaryContainer));
|
||||
// Se vuoi un bordo specifico per lo stato attivo, puoi impostarlo qui.
|
||||
// Altrimenti, potrebbe ereditare o non avere un bordo a seconda dello stile di base.
|
||||
// Esempio: setChipStrokeColor(getColorFromAttr(getContext(), com.google.android.material.R.attr.colorOnPrimaryContainer));
|
||||
@@ -100,15 +100,4 @@ public class FilterChipView extends Chip {
|
||||
this.onClicked = onClicked;
|
||||
return this;
|
||||
}
|
||||
|
||||
// Funzione di utilità per ottenere un colore da un attributo del tema
|
||||
private int getColorResourceFromAttr(Context context, int attrRes) {
|
||||
TypedValue typedValue = new TypedValue();
|
||||
context.getTheme().resolveAttribute(attrRes, typedValue, true);
|
||||
return typedValue.data;
|
||||
}
|
||||
|
||||
private ColorStateList getColorFromAttr(Context context, int attrRes) {
|
||||
return ColorStateList.valueOf(getColorResourceFromAttr(context, attrRes));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@ package it.integry.integrywmsnative.view.dialogs;
|
||||
import android.content.Context;
|
||||
import android.text.SpannableString;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -17,33 +16,33 @@ public class DialogCommon {
|
||||
|
||||
public static void showNoArtFoundDialog(@NotNull Context context, @Nullable Runnable onPositiveClick) {
|
||||
DialogSimpleMessageView
|
||||
.makeWarningDialog(new SpannableString(context.getResources().getText(R.string.no_result_from_barcode)),
|
||||
.makeWarningDialog(context, new SpannableString(context.getResources().getText(R.string.no_result_from_barcode)),
|
||||
null, onPositiveClick)
|
||||
.show(((AppCompatActivity) context).getSupportFragmentManager(), "tag");
|
||||
.show();
|
||||
}
|
||||
|
||||
public static void showNoULFound(@NotNull Context context, @Nullable Runnable onPositiveClick) {
|
||||
DialogSimpleMessageView.makeWarningDialog(new SpannableString(context.getResources().getText(R.string.no_lu_found_message)),
|
||||
DialogSimpleMessageView.makeWarningDialog(context, new SpannableString(context.getResources().getText(R.string.no_lu_found_message)),
|
||||
null, onPositiveClick)
|
||||
.show(((AppCompatActivity) context).getSupportFragmentManager(), "tag");
|
||||
.show();
|
||||
}
|
||||
|
||||
|
||||
public static void showNoOrderFound(@NotNull Context context, @Nullable Runnable onPositiveClick) {
|
||||
DialogSimpleMessageView.makeWarningDialog(new SpannableString(context.getResources().getText(R.string.no_orders_found_message)),
|
||||
DialogSimpleMessageView.makeWarningDialog(context, new SpannableString(context.getResources().getText(R.string.no_orders_found_message)),
|
||||
null, onPositiveClick)
|
||||
.show(((AppCompatActivity) context).getSupportFragmentManager(), "tag");
|
||||
.show();
|
||||
;
|
||||
}
|
||||
|
||||
|
||||
public static void showDataSaved(@NotNull FragmentActivity context, @Nullable Runnable onPositiveClick) {
|
||||
context.runOnUiThread(() -> {
|
||||
DialogSimpleMessageView.makeSuccessDialog(
|
||||
DialogSimpleMessageView.makeSuccessDialog(context,
|
||||
context.getResources().getString(R.string.completed),
|
||||
new SpannableString(context.getResources().getString(R.string.data_saved)),
|
||||
null, onPositiveClick)
|
||||
.show(context.getSupportFragmentManager(), "tag");
|
||||
.show();
|
||||
});
|
||||
|
||||
}
|
||||
@@ -51,7 +50,7 @@ public class DialogCommon {
|
||||
|
||||
public static void showRestError(@NotNull Context context, Exception ex, @Nullable Runnable onPositiveClick) {
|
||||
DialogSimpleMessageView
|
||||
.makeErrorDialog(new SpannableString(ex.getMessage()), null, onPositiveClick)
|
||||
.show(((AppCompatActivity) context).getSupportFragmentManager(), "tag");
|
||||
.makeErrorDialog(context, new SpannableString(ex.getMessage()), null, onPositiveClick)
|
||||
.show();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
package it.integry.integrywmsnative.view.dialogs.base;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.content.res.ColorStateList;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.text.Spanned;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.annotation.StringRes;
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.appcompat.widget.LinearLayoutCompat;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.core.content.res.ResourcesCompat;
|
||||
@@ -22,8 +22,6 @@ import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
||||
import java.util.HashMap;
|
||||
|
||||
import it.integry.integrywmsnative.R;
|
||||
import it.integry.integrywmsnative.core.expansion.BaseDialogFragment;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityDialog;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityResources;
|
||||
import it.integry.integrywmsnative.databinding.DialogBaseBinding;
|
||||
|
||||
@@ -31,7 +29,7 @@ import it.integry.integrywmsnative.databinding.DialogBaseBinding;
|
||||
* Created by GiuseppeS on 22/03/2018.
|
||||
*/
|
||||
|
||||
public class DialogSimpleMessageView extends BaseDialogFragment {
|
||||
public class DialogSimpleMessageView extends MaterialAlertDialogBuilder {
|
||||
|
||||
public enum TYPE {
|
||||
INFO(1),
|
||||
@@ -58,6 +56,7 @@ public class DialogSimpleMessageView extends BaseDialogFragment {
|
||||
}
|
||||
|
||||
|
||||
private final Context mContext;
|
||||
private final TYPE mType;
|
||||
private final String mTitleText;
|
||||
private final Spanned mMessageText;
|
||||
@@ -68,21 +67,22 @@ public class DialogSimpleMessageView extends BaseDialogFragment {
|
||||
Integer mRNeutralButtonString;
|
||||
private final Runnable mOnNeutralClick;
|
||||
|
||||
private final Handler mHandler = new Handler(Looper.getMainLooper());
|
||||
|
||||
private String positiveButtonText;
|
||||
private String neutralButtonText;
|
||||
private String negativeButtonText;
|
||||
|
||||
// private AlertDialog dialog;
|
||||
|
||||
private DialogBaseBinding mBindings;
|
||||
|
||||
public static DialogSimpleMessageView newInstance(@NonNull TYPE type, @NonNull String titleText, @NonNull Spanned messageText, HashMap<String, String> hashmapContent, Runnable onPositiveClick, Runnable onNegativeClick, @StringRes Integer rNeutralButtonString, Runnable onNeutralClick) {
|
||||
return new DialogSimpleMessageView(type, titleText, messageText, hashmapContent, onPositiveClick, onNegativeClick, rNeutralButtonString, onNeutralClick);
|
||||
private static DialogSimpleMessageView newInstance(@NonNull Context context, @NonNull TYPE type, @NonNull String titleText, @NonNull Spanned messageText, HashMap<String, String> hashmapContent, Runnable onPositiveClick, Runnable onNegativeClick, @StringRes Integer rNeutralButtonString, Runnable onNeutralClick) {
|
||||
return new DialogSimpleMessageView(context, type, titleText, messageText, hashmapContent, onPositiveClick, onNegativeClick, rNeutralButtonString, onNeutralClick);
|
||||
}
|
||||
|
||||
private DialogSimpleMessageView(@NonNull TYPE type, @NonNull String titleText, @NonNull Spanned messageText, HashMap<String, String> hashmapContent, Runnable onPositiveClick, Runnable onNegativeClick, @StringRes Integer rNeutralButtonString, Runnable onNeutralClick) {
|
||||
super();
|
||||
|
||||
private DialogSimpleMessageView(@NonNull Context context, @NonNull TYPE type, @NonNull String titleText, @NonNull Spanned messageText, HashMap<String, String> hashmapContent, Runnable onPositiveClick, Runnable onNegativeClick, @StringRes Integer rNeutralButtonString, Runnable onNeutralClick) {
|
||||
super(context);
|
||||
this.mContext = context;
|
||||
this.mType = type;
|
||||
this.mTitleText = titleText;
|
||||
this.mMessageText = messageText;
|
||||
@@ -91,73 +91,99 @@ public class DialogSimpleMessageView extends BaseDialogFragment {
|
||||
this.mOnNegativeClick = onNegativeClick;
|
||||
this.mRNeutralButtonString = rNeutralButtonString;
|
||||
this.mOnNeutralClick = onNeutralClick;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart() {
|
||||
super.onStart();
|
||||
DialogBaseBinding bindings = DialogBaseBinding.inflate(LayoutInflater.from(getContext()), null, false);
|
||||
|
||||
setCancelable(false);
|
||||
|
||||
this.initContent(bindings);
|
||||
|
||||
setView(bindings.getRoot());
|
||||
|
||||
if (isPositiveVisible())
|
||||
setPositiveButton(getPositiveButtonText(), (dialog, which) -> {
|
||||
if (this.mOnPositiveClick != null) this.mOnPositiveClick.run();
|
||||
});
|
||||
|
||||
if (isNeutralVisible())
|
||||
setNeutralButton(getNeutralButtonText(), (dialog, which) -> {
|
||||
if (this.mOnNeutralClick != null) this.mOnNeutralClick.run();
|
||||
});
|
||||
|
||||
if (isNegativeVisible())
|
||||
setNegativeButton(getNegativeButtonText(), (dialog, which) -> {
|
||||
if (this.mOnNegativeClick != null) this.mOnNegativeClick.run();
|
||||
});
|
||||
|
||||
UtilityDialog.setTo90PercentWidth(this.requireContext(), this);
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) {
|
||||
mBindings = DialogBaseBinding.inflate(LayoutInflater.from(requireContext()), null, false);
|
||||
public AlertDialog create() {
|
||||
// var createdDialog = super.create();
|
||||
|
||||
mBindings.setView(this);
|
||||
mBindings.setLifecycleOwner(this);
|
||||
setCancelable(false);
|
||||
|
||||
this.initContent();
|
||||
var createdDialog = super.create();
|
||||
|
||||
var alertDialogBuilder = new MaterialAlertDialogBuilder(requireContext())
|
||||
.setView(mBindings.getRoot())
|
||||
.setCancelable(isCancelable());
|
||||
|
||||
if (isPositiveVisible())
|
||||
alertDialogBuilder.setPositiveButton(getPositiveButtonText(), (dialog, which) -> {
|
||||
if(this.mOnPositiveClick != null) this.mOnPositiveClick.run();
|
||||
});
|
||||
|
||||
if (isNeutralVisible())
|
||||
alertDialogBuilder.setNeutralButton(getNeutralButtonText(), (dialog, which) -> {
|
||||
this.mOnNeutralClick.run();
|
||||
});
|
||||
|
||||
if (isNegativeVisible())
|
||||
alertDialogBuilder.setNegativeButton(getNegativeButtonText(), (dialog, which) -> {
|
||||
this.mOnNegativeClick.run();
|
||||
});
|
||||
|
||||
var alertDialog = alertDialogBuilder.create();
|
||||
alertDialog.setCanceledOnTouchOutside(isCancelable());
|
||||
return alertDialog;
|
||||
// dialog.setCanceledOnTouchOutside(isCancelable());
|
||||
// createdDialog.setOnShowListener(d -> {
|
||||
// if (mContext instanceof Activity) {
|
||||
// Dialog dialogToShow = (Dialog) d;
|
||||
// if (dialogToShow.getWindow() != null) {
|
||||
// DisplayMetrics displayMetrics = new DisplayMetrics();
|
||||
// ((Activity) mContext).getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
|
||||
// int displayWidth = displayMetrics.widthPixels;
|
||||
// WindowManager.LayoutParams layoutParams = new WindowManager.LayoutParams();
|
||||
// layoutParams.copyFrom(dialogToShow.getWindow().getAttributes());
|
||||
// int dialogWindowWidth = (int) (displayWidth * 0.9f);
|
||||
// layoutParams.width = dialogWindowWidth;
|
||||
// dialogToShow.getWindow().setAttributes(layoutParams);
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
return createdDialog;
|
||||
}
|
||||
|
||||
private void initContent() {
|
||||
// @Override
|
||||
// public AlertDialog show() {
|
||||
// if (dialog == null) {
|
||||
// dialog = create();
|
||||
// }
|
||||
// if (!dialog.isShowing()) {
|
||||
// dialog.show();
|
||||
// }
|
||||
// return dialog;
|
||||
// }
|
||||
|
||||
// public void dismiss() {
|
||||
// if (dialog != null && dialog.isShowing()) {
|
||||
// dialog.dismiss();
|
||||
// }
|
||||
// }
|
||||
|
||||
private void initContent(DialogBaseBinding mBindings) {
|
||||
int colorBackgroundTitle = -1;
|
||||
Drawable titleIconRes = switch (mType) {
|
||||
case INFO -> {
|
||||
colorBackgroundTitle = ContextCompat.getColor(requireContext(), R.color.colorPrimary);
|
||||
yield ResourcesCompat.getDrawable(requireContext().getResources(), R.drawable.ic_info_78dp, null);
|
||||
colorBackgroundTitle = ContextCompat.getColor(mContext, R.color.colorPrimary);
|
||||
yield ResourcesCompat.getDrawable(mContext.getResources(), R.drawable.ic_info_78dp, null);
|
||||
}
|
||||
case SUCCESS -> {
|
||||
colorBackgroundTitle = ContextCompat.getColor(requireContext(), R.color.green_300);
|
||||
yield ResourcesCompat.getDrawable(requireContext().getResources(), R.drawable.ic_done_white_24dp, null);
|
||||
colorBackgroundTitle = ContextCompat.getColor(mContext, R.color.green_300);
|
||||
yield ResourcesCompat.getDrawable(mContext.getResources(), R.drawable.ic_done_white_24dp, null);
|
||||
}
|
||||
case WARNING -> {
|
||||
colorBackgroundTitle = ContextCompat.getColor(requireContext(), R.color.yellow_600);
|
||||
yield ResourcesCompat.getDrawable(requireContext().getResources(), R.drawable.ic_warning_white_24dp, null);
|
||||
colorBackgroundTitle = ContextCompat.getColor(mContext, R.color.yellow_600);
|
||||
yield ResourcesCompat.getDrawable(mContext.getResources(), R.drawable.ic_warning_white_24dp, null);
|
||||
}
|
||||
case ERROR -> {
|
||||
colorBackgroundTitle = ContextCompat.getColor(requireContext(), R.color.red_300);
|
||||
yield ResourcesCompat.getDrawable(requireContext().getResources(), R.drawable.ic_mood_bad_24dp, null);
|
||||
colorBackgroundTitle = ContextCompat.getColor(mContext, R.color.red_300);
|
||||
yield ResourcesCompat.getDrawable(mContext.getResources(), R.drawable.ic_mood_bad_24dp, null);
|
||||
}
|
||||
};
|
||||
|
||||
this.positiveButtonText = requireContext().getText(mOnNegativeClick != null ? R.string.yes : R.string.ok).toString();
|
||||
this.negativeButtonText = requireContext().getText(R.string.no).toString();
|
||||
this.positiveButtonText = mContext.getText(mOnNegativeClick != null ? R.string.yes : R.string.ok).toString();
|
||||
this.negativeButtonText = mContext.getText(R.string.no).toString();
|
||||
|
||||
//Title VIEW
|
||||
mBindings.titleText.setText(mTitleText);
|
||||
@@ -177,7 +203,7 @@ public class DialogSimpleMessageView extends BaseDialogFragment {
|
||||
String currentKey = mHashmapContent.keySet().toArray()[i].toString();
|
||||
String currentValue = mHashmapContent.get(currentKey);
|
||||
|
||||
RelativeLayout singleMapContent = (RelativeLayout) LayoutInflater.from(requireContext()).inflate(R.layout.dialog_custom_content_hashmap_viewmodel, hashMapContainer);
|
||||
View singleMapContent = LayoutInflater.from(mContext).inflate(R.layout.dialog_custom_content_hashmap_viewmodel, hashMapContainer, false);
|
||||
((TextView) singleMapContent.findViewById(R.id.dialog_content_hashmap_key)).setText(currentKey);
|
||||
((TextView) singleMapContent.findViewById(R.id.dialog_content_hashmap_value)).setText(currentValue);
|
||||
|
||||
@@ -189,8 +215,6 @@ public class DialogSimpleMessageView extends BaseDialogFragment {
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public boolean isPositiveVisible() {
|
||||
return mOnPositiveClick != null || (!isNeutralVisible() && !isNegativeVisible());
|
||||
}
|
||||
@@ -209,7 +233,7 @@ public class DialogSimpleMessageView extends BaseDialogFragment {
|
||||
}
|
||||
|
||||
public String getNeutralButtonText() {
|
||||
return mRNeutralButtonString != null && mRNeutralButtonString != -1 ? requireContext().getText(mRNeutralButtonString).toString() : null;
|
||||
return mRNeutralButtonString != null && mRNeutralButtonString != -1 ? mContext.getText(mRNeutralButtonString).toString() : null;
|
||||
}
|
||||
|
||||
public String getNegativeButtonText() {
|
||||
@@ -217,22 +241,22 @@ public class DialogSimpleMessageView extends BaseDialogFragment {
|
||||
}
|
||||
|
||||
public void onPositiveClick() {
|
||||
dismiss();
|
||||
// dismiss();
|
||||
if (mOnPositiveClick != null) mOnPositiveClick.run();
|
||||
}
|
||||
|
||||
public void onNeutralClick() {
|
||||
dismiss();
|
||||
// dismiss();
|
||||
if (mOnNeutralClick != null) mOnNeutralClick.run();
|
||||
}
|
||||
|
||||
public void onNegativeClick() {
|
||||
dismiss();
|
||||
// dismiss();
|
||||
if (mOnNegativeClick != null) mOnNegativeClick.run();
|
||||
}
|
||||
|
||||
public static DialogSimpleMessageView makeInfoDialog(String titleText, Spanned messageText, HashMap<String, String> hashmapContent, Runnable onPositiveClick) {
|
||||
return newInstance(TYPE.INFO,
|
||||
public static DialogSimpleMessageView makeInfoDialog(Context context, String titleText, Spanned messageText, HashMap<String, String> hashmapContent, Runnable onPositiveClick) {
|
||||
return newInstance(context, TYPE.INFO,
|
||||
titleText,
|
||||
messageText,
|
||||
hashmapContent,
|
||||
@@ -241,8 +265,8 @@ public class DialogSimpleMessageView extends BaseDialogFragment {
|
||||
}
|
||||
|
||||
|
||||
public static DialogSimpleMessageView makeInfoDialog(String titleText, Spanned messageText, HashMap<String, String> hashmapContent, Runnable onPositiveClick, Runnable onNegativeClick) {
|
||||
return newInstance(TYPE.INFO,
|
||||
public static DialogSimpleMessageView makeInfoDialog(Context context, String titleText, Spanned messageText, HashMap<String, String> hashmapContent, Runnable onPositiveClick, Runnable onNegativeClick) {
|
||||
return newInstance(context, TYPE.INFO,
|
||||
titleText,
|
||||
messageText,
|
||||
hashmapContent,
|
||||
@@ -251,8 +275,8 @@ public class DialogSimpleMessageView extends BaseDialogFragment {
|
||||
}
|
||||
|
||||
|
||||
public static DialogSimpleMessageView makeSuccessDialog(String titleText, Spanned messageText, HashMap<String, String> hashmapContent, Runnable onPositiveClick) {
|
||||
return newInstance(TYPE.SUCCESS,
|
||||
public static DialogSimpleMessageView makeSuccessDialog(Context context, String titleText, Spanned messageText, HashMap<String, String> hashmapContent, Runnable onPositiveClick) {
|
||||
return newInstance(context, TYPE.SUCCESS,
|
||||
titleText,
|
||||
messageText,
|
||||
hashmapContent,
|
||||
@@ -261,8 +285,8 @@ public class DialogSimpleMessageView extends BaseDialogFragment {
|
||||
}
|
||||
|
||||
|
||||
public static DialogSimpleMessageView makeWarningDialog(Spanned messageText, HashMap<String, String> hashmapContent, Runnable onPositiveClick, Runnable onNegativeClick) {
|
||||
return newInstance(TYPE.WARNING,
|
||||
public static DialogSimpleMessageView makeWarningDialog(Context context, Spanned messageText, HashMap<String, String> hashmapContent, Runnable onPositiveClick, Runnable onNegativeClick) {
|
||||
return newInstance(context, TYPE.WARNING,
|
||||
UtilityResources.getString(R.string.warning),
|
||||
messageText,
|
||||
hashmapContent,
|
||||
@@ -273,8 +297,8 @@ public class DialogSimpleMessageView extends BaseDialogFragment {
|
||||
}
|
||||
|
||||
|
||||
public static DialogSimpleMessageView makeWarningDialog(Spanned messageText, HashMap<String, String> hashmapContent, Runnable onPositiveClick) {
|
||||
return newInstance(TYPE.WARNING,
|
||||
public static DialogSimpleMessageView makeWarningDialog(Context context, Spanned messageText, HashMap<String, String> hashmapContent, Runnable onPositiveClick) {
|
||||
return newInstance(context, TYPE.WARNING,
|
||||
UtilityResources.getString(R.string.warning),
|
||||
messageText,
|
||||
hashmapContent,
|
||||
@@ -282,9 +306,9 @@ public class DialogSimpleMessageView extends BaseDialogFragment {
|
||||
null, -1, null);
|
||||
}
|
||||
|
||||
public static DialogSimpleMessageView makeErrorDialog(Spanned messageText, HashMap<String, String> hashmapContent, Runnable onPositiveClick) {
|
||||
public static DialogSimpleMessageView makeErrorDialog(Context context, Spanned messageText, HashMap<String, String> hashmapContent, Runnable onPositiveClick) {
|
||||
|
||||
return newInstance(TYPE.ERROR,
|
||||
return newInstance(context, TYPE.ERROR,
|
||||
UtilityResources.getString(R.string.ops),
|
||||
messageText,
|
||||
hashmapContent,
|
||||
@@ -292,9 +316,9 @@ public class DialogSimpleMessageView extends BaseDialogFragment {
|
||||
null, -1, null);
|
||||
}
|
||||
|
||||
public static DialogSimpleMessageView makeErrorDialog(Spanned messageText, HashMap<String, String> hashmapContent, Runnable onPositiveClick, @StringRes int rNeutralButtonString, Runnable onNeutralClick) {
|
||||
public static DialogSimpleMessageView makeErrorDialog(Context context, Spanned messageText, HashMap<String, String> hashmapContent, Runnable onPositiveClick, @StringRes int rNeutralButtonString, Runnable onNeutralClick) {
|
||||
|
||||
return newInstance(TYPE.ERROR,
|
||||
return newInstance(context, TYPE.ERROR,
|
||||
UtilityResources.getString(R.string.ops),
|
||||
messageText,
|
||||
hashmapContent,
|
||||
@@ -304,4 +328,4 @@ public class DialogSimpleMessageView extends BaseDialogFragment {
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -10,6 +10,6 @@ public interface DialogChooseArtsFromMtbColrListComponent {
|
||||
DialogChooseArtsFromMtbColrListComponent create();
|
||||
}
|
||||
|
||||
void inject(DialogChooseArtsFromMtbColrList dialogChooseArtsFromMtbColrList);
|
||||
void inject(DialogChooseArtsFromMtbColrListView dialogChooseArtsFromMtbColrListView);
|
||||
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ import com.ravikoradiya.liveadapter.LiveAdapter;
|
||||
import com.ravikoradiya.liveadapter.Type;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import javax.inject.Inject;
|
||||
@@ -43,7 +44,7 @@ import it.integry.integrywmsnative.databinding.DialogChooseArtsFromMtbColrListLa
|
||||
import it.integry.integrywmsnative.view.dialogs.DialogCommon;
|
||||
import kotlin.Unit;
|
||||
|
||||
public class DialogChooseArtsFromMtbColrList extends BaseDialogFragment implements DialogInterface.OnShowListener {
|
||||
public class DialogChooseArtsFromMtbColrListView extends BaseDialogFragment implements DialogInterface.OnShowListener {
|
||||
|
||||
@Inject
|
||||
DialogChooseArtsFromMtbColrListViewModel mViewModel;
|
||||
@@ -56,8 +57,7 @@ public class DialogChooseArtsFromMtbColrList extends BaseDialogFragment implemen
|
||||
private int mBarcodeScannerInstanceID;
|
||||
private final List<MtbColr> inputMtbColrList;
|
||||
private MtbAart selectedArt;
|
||||
private final RunnableArgs<List<MtbColr>> onConfirmed;
|
||||
private final Runnable onAbort;
|
||||
private final RunnableArgs<Result> onConfirmed;
|
||||
|
||||
|
||||
private DialogChooseArtsFromMtbColrListLayoutBinding mBindings;
|
||||
@@ -66,12 +66,12 @@ public class DialogChooseArtsFromMtbColrList extends BaseDialogFragment implemen
|
||||
private final MutableLiveData<List<DialogChooseArtsFromMtbColrListItemModel>> hiddenMtbColrItemModels = new MutableLiveData<>();
|
||||
private Context mContext;
|
||||
|
||||
public static DialogChooseArtsFromMtbColrList newInstance(List<MtbColr> listaMtbColr, RunnableArgs<List<MtbColr>> onItemsChoosed, Runnable onAbort) {
|
||||
return new DialogChooseArtsFromMtbColrList(listaMtbColr, onItemsChoosed, onAbort);
|
||||
public static DialogChooseArtsFromMtbColrListView newInstance(List<MtbColr> listaMtbColr, RunnableArgs<Result> onItemsChoosed) {
|
||||
return new DialogChooseArtsFromMtbColrListView(listaMtbColr, onItemsChoosed);
|
||||
}
|
||||
|
||||
public static DialogChooseArtsFromMtbColrList newInstance(List<MtbColr> listaMtbColr, MtbAart mtbAart, RunnableArgs<List<MtbColr>> onItemsChoosed, Runnable onAbort) {
|
||||
DialogChooseArtsFromMtbColrList dialog = newInstance(listaMtbColr, onItemsChoosed, onAbort);
|
||||
public static DialogChooseArtsFromMtbColrListView newInstance(List<MtbColr> listaMtbColr, MtbAart mtbAart, RunnableArgs<Result> onItemsChoosed) {
|
||||
DialogChooseArtsFromMtbColrListView dialog = newInstance(listaMtbColr, onItemsChoosed);
|
||||
dialog.setSelectedArt(mtbAart);
|
||||
return dialog;
|
||||
}
|
||||
@@ -80,13 +80,12 @@ public class DialogChooseArtsFromMtbColrList extends BaseDialogFragment implemen
|
||||
this.selectedArt = mtbAart;
|
||||
}
|
||||
|
||||
private DialogChooseArtsFromMtbColrList(List<MtbColr> listaMtbColr, RunnableArgs<List<MtbColr>> onConfirmed, Runnable onAbort) {
|
||||
private DialogChooseArtsFromMtbColrListView(List<MtbColr> listaMtbColr, RunnableArgs<Result> onConfirmed) {
|
||||
super();
|
||||
|
||||
this.inputMtbColrList = listaMtbColr;
|
||||
|
||||
this.onConfirmed = onConfirmed;
|
||||
this.onAbort = onAbort;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@@ -108,21 +107,10 @@ public class DialogChooseArtsFromMtbColrList extends BaseDialogFragment implemen
|
||||
.setView(mBindings.getRoot())
|
||||
.setCancelable(isCancelable())
|
||||
.setPositiveButton(R.string.ok, (dialog, which) -> {
|
||||
var selectedArts = Stream.of(this.mtbColrItemModels)
|
||||
.filter(x -> x.getChecked().get())
|
||||
.map(DialogChooseArtsFromMtbColrListItemModel::getMtbColr)
|
||||
.toList();
|
||||
|
||||
// if (selectedArts.isEmpty()) {
|
||||
// if (this.onAbort != null) this.onAbort.run();
|
||||
// return;
|
||||
// }
|
||||
|
||||
if (this.onConfirmed != null)
|
||||
this.onConfirmed.run(selectedArts);
|
||||
onOk();
|
||||
})
|
||||
.setNegativeButton(R.string.abort, (dialog, which) -> {
|
||||
if (this.onAbort != null) this.onAbort.run();
|
||||
onKo();
|
||||
})
|
||||
.create();
|
||||
|
||||
@@ -141,7 +129,16 @@ public class DialogChooseArtsFromMtbColrList extends BaseDialogFragment implemen
|
||||
this.setupBarcode();
|
||||
|
||||
if (selectedArt != null) {
|
||||
this.loadArticolo(selectedArt.getBarCode(), null);
|
||||
executorService.execute(() -> {
|
||||
try {
|
||||
onLoadingStarted();
|
||||
this.loadArticolo(selectedArt.getBarCode(), null);
|
||||
onLoadingEnded();
|
||||
} catch (Exception e) {
|
||||
onError(e);
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -241,11 +238,28 @@ public class DialogChooseArtsFromMtbColrList extends BaseDialogFragment implemen
|
||||
}
|
||||
|
||||
|
||||
private void onOk() {
|
||||
var selectedArts = this.mtbColrItemModels.stream()
|
||||
.filter(x -> x.getChecked().get())
|
||||
.map(DialogChooseArtsFromMtbColrListItemModel::getMtbColr)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
|
||||
if (onConfirmed != null)
|
||||
onConfirmed.run(Result.completed(selectedArts));
|
||||
}
|
||||
|
||||
private void onKo() {
|
||||
if (onConfirmed != null)
|
||||
onConfirmed.run(Result.aborted());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onDismiss(@NonNull DialogInterface dialog) {
|
||||
public void dismiss() {
|
||||
BarcodeManager.removeCallback(mBarcodeScannerInstanceID);
|
||||
this.onAbort.run();
|
||||
super.onDismiss(dialog);
|
||||
if (getDialog() != null) getDialog().dismiss();
|
||||
super.dismiss();
|
||||
}
|
||||
|
||||
|
||||
@@ -253,68 +267,75 @@ public class DialogChooseArtsFromMtbColrList extends BaseDialogFragment implemen
|
||||
onLoadingStarted();
|
||||
|
||||
|
||||
if (UtilityBarcode.isEan13(data)) {
|
||||
this.loadArticolo(data.getStringValue(), null);
|
||||
} else if (UtilityBarcode.isEtichetta128(data)) {
|
||||
this.executeEtichettaEan128(data);
|
||||
} else {
|
||||
onLoadingEnded();
|
||||
}
|
||||
executorService.execute(() -> {
|
||||
try {
|
||||
|
||||
if (UtilityBarcode.isEan13(data)) {
|
||||
this.loadArticolo(data.getStringValue(), null);
|
||||
|
||||
} else if (UtilityBarcode.isEtichetta128(data)) {
|
||||
this.executeEtichettaEan128(data);
|
||||
|
||||
} else
|
||||
onLoadingEnded();
|
||||
|
||||
|
||||
} catch (Exception e) {
|
||||
this.onError(e);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
private void executeEtichettaEan128(BarcodeScanDTO barcodeScanDTO) {
|
||||
this.barcodeRESTConsumer.decodeEan128(barcodeScanDTO, ean128Model -> {
|
||||
private void executeEtichettaEan128(BarcodeScanDTO barcodeScanDTO) throws Exception {
|
||||
var ean128Model = this.barcodeRESTConsumer.decodeEan128Synchronized(barcodeScanDTO);
|
||||
|
||||
String barcodeProd = null;
|
||||
String barcodeProd = null;
|
||||
|
||||
if (!UtilityString.isNullOrEmpty(ean128Model.Sscc)) barcodeProd = ean128Model.Sscc;
|
||||
if (!UtilityString.isNullOrEmpty(ean128Model.Gtin)) barcodeProd = ean128Model.Gtin;
|
||||
if (!UtilityString.isNullOrEmpty(ean128Model.Content))
|
||||
barcodeProd = ean128Model.Content;
|
||||
if (!UtilityString.isNullOrEmpty(ean128Model.Sscc)) barcodeProd = ean128Model.Sscc;
|
||||
if (!UtilityString.isNullOrEmpty(ean128Model.Gtin)) barcodeProd = ean128Model.Gtin;
|
||||
if (!UtilityString.isNullOrEmpty(ean128Model.Content))
|
||||
barcodeProd = ean128Model.Content;
|
||||
|
||||
|
||||
if (!UtilityString.isNullOrEmpty(barcodeProd)) {
|
||||
|
||||
if (!UtilityString.isNullOrEmpty(ean128Model.Gtin) || !UtilityString.isNullOrEmpty(ean128Model.Content)) {
|
||||
this.loadArticolo(barcodeProd, ean128Model);
|
||||
} else {
|
||||
DialogCommon.showNoArtFoundDialog(mContext, this::onLoadingEnded);
|
||||
|
||||
}
|
||||
|
||||
if (!UtilityString.isNullOrEmpty(barcodeProd)) {
|
||||
|
||||
if (!UtilityString.isNullOrEmpty(ean128Model.Gtin) || !UtilityString.isNullOrEmpty(ean128Model.Content)) {
|
||||
this.loadArticolo(barcodeProd, ean128Model);
|
||||
} else {
|
||||
//EAN 128 non completo o comunque mancano i riferimenti al prodotto
|
||||
DialogCommon.showNoArtFoundDialog(mContext, this::onLoadingEnded);
|
||||
showNoArtFoundDialog();
|
||||
|
||||
}
|
||||
}, this::onError);
|
||||
|
||||
|
||||
} else {
|
||||
//EAN 128 non completo o comunque mancano i riferimenti al prodotto
|
||||
showNoArtFoundDialog();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void loadArticolo(String barcodeProd, Ean128Model ean128Model) {
|
||||
this.articoloRESTConsumer.searchByBarcode(barcodeProd, mtbAartList -> {
|
||||
private void loadArticolo(String barcodeProd, Ean128Model ean128Model) throws Exception {
|
||||
var mtbAartList = this.articoloRESTConsumer.searchByBarcodeSynchronized(barcodeProd);
|
||||
|
||||
if (mtbAartList != null && !mtbAartList.isEmpty()) {
|
||||
MtbAart articolo = mtbAartList.get(0);
|
||||
this.mBindings.mainSearch.setQuery(articolo.getCodMart(), false);
|
||||
|
||||
this.searchArtInList(mtbAartList.get(0), ean128Model);
|
||||
if (mtbAartList != null && !mtbAartList.isEmpty()) {
|
||||
MtbAart articolo = mtbAartList.get(0);
|
||||
this.mBindings.mainSearch.setQuery(articolo.getCodMart(), false);
|
||||
|
||||
onLoadingEnded();
|
||||
} else {
|
||||
this.searchArtInList(mtbAartList.get(0), ean128Model);
|
||||
} else {
|
||||
|
||||
DialogCommon.showNoArtFoundDialog(mContext, this::onLoadingEnded);
|
||||
}
|
||||
|
||||
}, this::onError);
|
||||
showNoArtFoundDialog();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void searchArtInList(MtbAart mtbAart, Ean128Model ean128Model) {
|
||||
private void searchArtInList(MtbAart mtbAart, Ean128Model ean128Model) throws InterruptedException {
|
||||
removeListFilter();
|
||||
|
||||
List<DialogChooseArtsFromMtbColrListItemModel> foundRowsList = Stream.of(mtbColrItemModels)
|
||||
@@ -323,7 +344,7 @@ public class DialogChooseArtsFromMtbColrList extends BaseDialogFragment implemen
|
||||
.toList();
|
||||
|
||||
if (foundRowsList.isEmpty()) {
|
||||
DialogCommon.showNoArtFoundDialog(mContext, null);
|
||||
showNoArtFoundDialog();
|
||||
} else {
|
||||
|
||||
for (int i = 0; i < mtbColrItemModels.size(); i++) {
|
||||
@@ -333,4 +354,39 @@ public class DialogChooseArtsFromMtbColrList extends BaseDialogFragment implemen
|
||||
}
|
||||
|
||||
|
||||
private void showNoArtFoundDialog() throws InterruptedException {
|
||||
CountDownLatch countDownLatch = new CountDownLatch(1);
|
||||
|
||||
handler.post(() -> {
|
||||
DialogCommon.showNoArtFoundDialog(mContext, countDownLatch::countDown);
|
||||
});
|
||||
|
||||
countDownLatch.await();
|
||||
}
|
||||
|
||||
public static class Result {
|
||||
private final List<MtbColr> mtbColrList;
|
||||
private final boolean isAborted;
|
||||
|
||||
private Result(List<MtbColr> mtbColrList, boolean isAborted) {
|
||||
this.mtbColrList = mtbColrList;
|
||||
this.isAborted = isAborted;
|
||||
}
|
||||
|
||||
public static Result completed(List<MtbColr> mtbAartList) {
|
||||
return new Result(mtbAartList, false);
|
||||
}
|
||||
|
||||
public static Result aborted() {
|
||||
return new Result(null, true);
|
||||
}
|
||||
|
||||
public boolean isAborted() {
|
||||
return isAborted;
|
||||
}
|
||||
|
||||
public List<MtbColr> getMtbColrList() {
|
||||
return mtbColrList;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -339,10 +339,12 @@ public class DialogInputQuantityV2View extends BaseDialogFragment implements Dia
|
||||
|
||||
LocalDate minDataScad = UtilityDate.getNow().plusDays(mtbAart.getGgScadPartita());
|
||||
if (minDataScad.isAfter(value) && value.isAfter(UtilityDate.getNow())) {
|
||||
DialogSimpleMessageView
|
||||
.makeWarningDialog(new SpannableString("La data selezionata è precedente alla data di scadenza consigliata per l'articolo scelto ( " + mtbAart.getGgScadPartita() + " giorni) . Continuare?"), null,
|
||||
() -> this.mViewModel.setDataScad(value), () -> this.currentDataScad.set(null))
|
||||
.show(requireActivity().getSupportFragmentManager(), "tag");
|
||||
handler.post(() -> {
|
||||
DialogSimpleMessageView
|
||||
.makeWarningDialog(context, new SpannableString("La data selezionata è precedente alla data di scadenza consigliata per l'articolo scelto ( " + mtbAart.getGgScadPartita() + " giorni) . Continuare?"), null,
|
||||
() -> this.mViewModel.setDataScad(value), () -> this.currentDataScad.set(null))
|
||||
.show();
|
||||
});
|
||||
} else {
|
||||
this.mViewModel.setDataScad(value);
|
||||
}
|
||||
@@ -563,11 +565,11 @@ public class DialogInputQuantityV2View extends BaseDialogFragment implements Dia
|
||||
public void onWarning(String text, RunnableArgs<Boolean> result) {
|
||||
handler.post(() -> {
|
||||
|
||||
DialogSimpleMessageView.makeWarningDialog(new SpannableString(Html.fromHtml(text)),
|
||||
DialogSimpleMessageView.makeWarningDialog(context, new SpannableString(Html.fromHtml(text)),
|
||||
null,
|
||||
() -> result.run(true),
|
||||
() -> result.run(false)
|
||||
).show(requireActivity().getSupportFragmentManager(), "tag");
|
||||
).show();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -167,13 +167,16 @@ public class DialogScanOrCreateLUView extends BaseDialogFragment implements Dial
|
||||
|
||||
@Override
|
||||
public void onLUVenditaConfirmRequired(RunnableArgs<Boolean> onConfirm) {
|
||||
DialogSimpleMessageView.makeWarningDialog(new SpannableString(getString(R.string.lu_gest_v_loading_alert)),
|
||||
null, () -> {
|
||||
onConfirm.run(true);
|
||||
}, () -> {
|
||||
onConfirm.run(false);
|
||||
})
|
||||
.show(requireActivity().getSupportFragmentManager(), "tag");
|
||||
handler.post(() -> {
|
||||
DialogSimpleMessageView.makeWarningDialog(requireContext(),
|
||||
new SpannableString(getString(R.string.lu_gest_v_loading_alert)),
|
||||
null, () -> {
|
||||
onConfirm.run(true);
|
||||
}, () -> {
|
||||
onConfirm.run(false);
|
||||
})
|
||||
.show();
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -65,7 +65,7 @@ public class DialogScanOrCreateLUViewModel {
|
||||
.setCodMdep(SettingsManager.i().getUserSession().getDepo().getCodMdep());
|
||||
|
||||
var createResponse = this.mColliLavorazioneRESTConsumer.synchronousCreateUDC(createUdcRequest);
|
||||
this.sendOnLUOpened(createResponse.getMtbColt(), true);
|
||||
this.sendOnLUOpened(createResponse, true);
|
||||
}
|
||||
|
||||
public void processBarcodeDTO(BarcodeScanDTO barcodeScanDTO, Runnable onComplete) {
|
||||
|
||||
@@ -8,5 +8,5 @@
|
||||
android:right="6dp"
|
||||
android:top="1dp" />
|
||||
|
||||
<corners android:radius="5dp" />
|
||||
<corners android:radius="4dp" />
|
||||
</shape>
|
||||
@@ -10,7 +10,7 @@
|
||||
android:right="6dp"
|
||||
android:top="1dp" />
|
||||
|
||||
<corners android:radius="6dp" />
|
||||
<corners android:radius="4dp" />
|
||||
</shape>
|
||||
</item>
|
||||
</level-list>
|
||||
@@ -10,8 +10,8 @@
|
||||
android:right="6dp"
|
||||
android:top="1dp" />
|
||||
|
||||
<corners android:topLeftRadius="6dp"
|
||||
android:topRightRadius="6dp"/>
|
||||
<corners android:topLeftRadius="4dp"
|
||||
android:topRightRadius="4dp"/>
|
||||
</shape>
|
||||
</item>
|
||||
</level-list>
|
||||
@@ -3,6 +3,6 @@
|
||||
|
||||
<solid android:color="@color/white" />
|
||||
|
||||
<corners android:radius="6dp" />
|
||||
<corners android:radius="4dp" />
|
||||
|
||||
</shape>
|
||||
@@ -751,7 +751,6 @@
|
||||
android:hint="@string/expire_date"
|
||||
android:inputType="text"
|
||||
app:binding="@{view.currentDataScad}"
|
||||
app:parentView="@{view}"
|
||||
app:warningOnOldDates="@{true}" />
|
||||
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
|
||||
@@ -193,7 +193,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="4dp"
|
||||
android:textColor="@android:color/black"
|
||||
android:text="@{Html.fromHtml(context.getString(R.string.doc_testata, view.mtbColt.getNumDoc(), view.mtbColt.getDataDoc()))}"
|
||||
android:text="@{Html.fromHtml(@string/doc_testata(view.mtbColt.numDoc, UtilityDate.formatDate(view.mtbColt.dataDoc, UtilityDate.COMMONS_DATE_FORMATS.DMY_HUMAN)))}"
|
||||
tools:text="n. 123 del 29/03/2023" />
|
||||
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||
|
||||
|
||||
@@ -762,7 +762,6 @@
|
||||
android:hint="@string/expire_date"
|
||||
android:inputType="text"
|
||||
app:binding="@{view.currentDataScad}"
|
||||
app:parentView="@{view}"
|
||||
app:warningOnOldDates="@{true}" />
|
||||
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
|
||||
@@ -142,8 +142,7 @@
|
||||
android:focusableInTouchMode="false"
|
||||
android:hint="@string/document_date"
|
||||
android:inputType="none"
|
||||
app:binding="@{view.selectedDataDoc}"
|
||||
app:parentView="@{view}" />
|
||||
app:binding="@{view.selectedDataDoc}" />
|
||||
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
|
||||
|
||||
@@ -48,16 +48,14 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="@string/rag_soc"
|
||||
android:imeOptions="actionNext"
|
||||
android:nextFocusDown="@id/input_data_doc">
|
||||
android:imeOptions="actionDone">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatAutoCompleteTextView
|
||||
<com.google.android.material.textfield.MaterialAutoCompleteTextView
|
||||
android:id="@+id/filled_exposed_dropdown_rag_soc"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:ellipsize="end"
|
||||
android:imeOptions="actionNext"
|
||||
android:nextFocusDown="@id/input_data_doc"
|
||||
android:imeOptions="actionDone"
|
||||
android:singleLine="true"
|
||||
android:text="@={viewmodel.ragSocTextBindable}" /> <!-- Binding bidirezionale -->
|
||||
|
||||
@@ -82,7 +80,7 @@
|
||||
android:textAppearance="?attr/textAppearanceSubtitle1"
|
||||
android:minHeight="?attr/listPreferredItemHeightSmall"
|
||||
app:binding="@{viewmodel.dataDocBindable}"
|
||||
app:parentView="@{view}" />
|
||||
/>
|
||||
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
|
||||
|
||||
@@ -48,17 +48,15 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="@string/rag_soc"
|
||||
android:imeOptions="actionNext"
|
||||
android:nextFocusDown="@id/input_data_doc">
|
||||
android:imeOptions="actionDone">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatAutoCompleteTextView
|
||||
<com.google.android.material.textfield.MaterialAutoCompleteTextView
|
||||
android:id="@+id/filled_exposed_dropdown_rag_soc"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:ellipsize="end"
|
||||
android:imeOptions="actionNext"
|
||||
android:nextFocusDown="@id/input_data_doc"
|
||||
android:singleLine="true"
|
||||
android:imeOptions="actionDone"
|
||||
android:text="@={viewmodel.ragSocTextBindable}" /> <!-- Binding bidirezionale -->
|
||||
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
@@ -81,8 +79,7 @@
|
||||
android:singleLine="true"
|
||||
android:textAppearance="?attr/textAppearanceSubtitle1"
|
||||
android:minHeight="?attr/listPreferredItemHeightSmall"
|
||||
app:binding="@{viewmodel.dataDocBindable}"
|
||||
app:parentView="@{view}" />
|
||||
app:binding="@{viewmodel.dataDocBindable}" />
|
||||
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
|
||||
|
||||
@@ -42,6 +42,8 @@
|
||||
android:id="@+id/checkbox"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:clickable="false"
|
||||
android:focusable="false"
|
||||
app:checked="@{selected}" />
|
||||
|
||||
<RelativeLayout
|
||||
|
||||
@@ -38,6 +38,8 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:minHeight="0dp"
|
||||
android:minWidth="0dp"
|
||||
android:clickable="false"
|
||||
android:focusable="false"
|
||||
app:checked="@{item.selectedProperty}"
|
||||
app:layout_constraintStart_toEndOf="@id/empty_view"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
|
||||
@@ -1,110 +1,128 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layout>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:background="?attr/selectableItemBackground"
|
||||
android:clickable="true"
|
||||
android:focusable="true">
|
||||
<layout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/content_view_child"
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:padding="8dp">
|
||||
android:background="?attr/selectableItemBackground"
|
||||
android:clickable="true"
|
||||
android:focusable="true">
|
||||
|
||||
<LinearLayout
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
android:padding="8dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/badge1"
|
||||
style="@style/AppTheme.NewMaterial.Text.Small"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
tools:text="BADGE 1"
|
||||
android:background="@drawable/badge_round_corner"
|
||||
android:textColor="@android:color/white"
|
||||
android:paddingTop="2dp"
|
||||
android:paddingBottom="2dp"
|
||||
android:paddingLeft="6dp"
|
||||
android:paddingTop="2dp"
|
||||
android:paddingRight="6dp"
|
||||
android:paddingBottom="2dp"
|
||||
android:textColor="?colorOnPrimaryContainer"
|
||||
android:textStyle="bold"
|
||||
style="@style/AppTheme.NewMaterial.Text.Small"/>
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:backgroundTint="?colorPrimaryContainer"
|
||||
tools:text="BADGE 1" />
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
<TextView
|
||||
android:id="@+id/badge2"
|
||||
style="@style/AppTheme.NewMaterial.Text.Small"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:gravity="end">
|
||||
android:background="@drawable/badge_round_corner"
|
||||
android:paddingLeft="6dp"
|
||||
android:paddingTop="2dp"
|
||||
android:paddingRight="6dp"
|
||||
android:paddingBottom="2dp"
|
||||
android:layout_marginStart="4dp"
|
||||
android:textColor="?colorOnSecondaryContainer"
|
||||
android:textStyle="bold"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintStart_toEndOf="@id/badge1"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:backgroundTint="?colorSecondaryContainer"
|
||||
tools:visibility="visible"
|
||||
tools:text="BADGE 2" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/qta_evasa"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="4dp"
|
||||
android:textStyle="bold"
|
||||
android:textColor="@color/green_700"
|
||||
style="@style/AppTheme.NewMaterial.Text.Medium"
|
||||
tools:text="QTA"/>
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/unt_mis"
|
||||
style="@style/AppTheme.NewMaterial.Text.Small"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="4dp"
|
||||
android:textAllCaps="true"
|
||||
android:textColor="@android:color/black"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintBottom_toBottomOf="@id/qta_tot"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
tools:text="cnf" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textStyle="bold"
|
||||
android:textColor="@android:color/black"
|
||||
style="@style/AppTheme.NewMaterial.Text.Medium"
|
||||
android:text=" / "/>
|
||||
<TextView
|
||||
android:id="@+id/qta_tot"
|
||||
style="@style/AppTheme.NewMaterial.Text.Medium"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@android:color/black"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintEnd_toStartOf="@id/unt_mis"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:text="QTA" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/qta_tot"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textStyle="bold"
|
||||
android:textColor="@android:color/black"
|
||||
style="@style/AppTheme.NewMaterial.Text.Medium"
|
||||
tools:text="QTA"/>
|
||||
<TextView
|
||||
android:id="@+id/qta_separator"
|
||||
style="@style/AppTheme.NewMaterial.Text.Medium"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text=" / "
|
||||
android:textColor="@android:color/black"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintEnd_toStartOf="@id/qta_tot"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/unt_mis"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textStyle="bold"
|
||||
android:textColor="@android:color/black"
|
||||
android:layout_marginStart="4dp"
|
||||
android:textAllCaps="true"
|
||||
style="@style/AppTheme.NewMaterial.Text.Small"
|
||||
tools:text="cnf"/>
|
||||
<TextView
|
||||
android:id="@+id/qta_evasa"
|
||||
style="@style/AppTheme.NewMaterial.Text.Medium"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="4dp"
|
||||
android:textColor="@color/green_700"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintEnd_toStartOf="@id/qta_separator"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:text="QTA" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
<TextView
|
||||
android:id="@+id/descrizione"
|
||||
style="@style/AppTheme.NewMaterial.Text.Small"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="4dp"
|
||||
android:textColor="@android:color/black"
|
||||
android:textSize="16sp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/badge1"
|
||||
tools:text="DESCRIZIONE" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/descrizione"
|
||||
android:layout_width="wrap_content"
|
||||
<View
|
||||
android:id="@+id/deactivated_over_bg"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="4dp"
|
||||
android:textSize="16sp"
|
||||
android:textColor="@android:color/black"
|
||||
style="@style/AppTheme.NewMaterial.Text.Small"
|
||||
tools:text="DESCRIZIONE"/>
|
||||
android:alpha="0.15"
|
||||
android:background="@android:color/black"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentEnd="true"/>
|
||||
|
||||
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:id="@+id/deactivated_over_bg"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignTop="@id/content_view_child"
|
||||
android:layout_alignBottom="@id/content_view_child"
|
||||
android:background="@android:color/black"
|
||||
android:alpha="0.15" />
|
||||
|
||||
</RelativeLayout>
|
||||
</RelativeLayout>
|
||||
</layout>
|
||||
|
||||
@@ -37,5 +37,7 @@
|
||||
<item name="materialCalendarTheme">@style/ThemeOverlay.MaterialComponents.MaterialCalendar</item>
|
||||
|
||||
<item name="bottomSheetDialogTheme">@style/CustomBottomSheetDialog</item>
|
||||
|
||||
<item name="android:windowActivityTransitions">true</item>
|
||||
</style>
|
||||
</resources>
|
||||
|
||||
Reference in New Issue
Block a user