Implementata setup per ricalcolo qta

This commit is contained in:
Giuseppe Scorrano 2021-04-09 16:51:02 +02:00
parent a779d8b94d
commit 726cf80dc0
9 changed files with 74 additions and 53 deletions

View File

@ -101,7 +101,7 @@ dependencies {
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'com.google.android.material:material:1.3.0-rc01'
implementation 'com.google.android.material:material:1.3.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.recyclerview:recyclerview:1.1.0'

View File

@ -12,19 +12,24 @@ public class BaseFragment extends Fragment {
protected void openProgress() {
if (this.mCurrentProgress == null) {
new Thread(() -> {
getActivity().runOnUiThread(() -> {
this.mCurrentProgress = UtilityProgress.createDefaultProgressDialog(getActivity());
if (this.mCurrentProgress == null) {
this.mCurrentProgress = UtilityProgress.createDefaultProgressDialog(getActivity());
}
});
}
}).start();
}
protected void closeProgress() {
if (mCurrentProgress != null) {
new Thread(() -> {
getActivity().runOnUiThread(() -> {
mCurrentProgress.dismiss();
mCurrentProgress = null;
if (mCurrentProgress != null) {
mCurrentProgress.dismiss();
mCurrentProgress = null;
}
});
}
}).start();
}
}

View File

@ -36,6 +36,7 @@ public class DBSettingsModel {
private boolean flagSpedizioneUseQtaOrd;
private String produzioneDefaultCodAnag;
private String reportNameSpedizionChiudiOrdine;
private int onNumCnfInputChanged = 1;
public boolean isFlagSpedizioneEnableFakeGiacenza() {
return flagSpedizioneEnableFakeGiacenza;
@ -261,4 +262,13 @@ public class DBSettingsModel {
this.reportNameSpedizionChiudiOrdine = reportNameSpedizionChiudiOrdine;
return this;
}
public int getOnNumCnfInputChanged() {
return onNumCnfInputChanged;
}
public DBSettingsModel setOnNumCnfInputChanged(int onNumCnfInputChanged) {
this.onNumCnfInputChanged = onNumCnfInputChanged;
return this;
}
}

View File

@ -262,6 +262,10 @@ public class SettingsManager {
.setGestName("PICKING")
.setSection("SPEDIZIONE")
.setKeySection("FLAG_USE_QTA_ORD"));
stbGestSetupList.add(new StbGestSetup()
.setGestName("PICKING")
.setSection("SETUP")
.setKeySection("ON_NUM_CNF_INPUT_CHANGED"));
GestSetupRESTConsumer.getValues(stbGestSetupList, list -> {
@ -287,6 +291,11 @@ public class SettingsManager {
dbSettingsModelIstance.setReportNameSpedizionChiudiOrdine(getValueFromList(list, "SPEDIZIONE", "REPORT_PACKING_LIST", String.class));
dbSettingsModelIstance.setFlagSpedizioneUseQtaOrd(getValueFromList(list, "SPEDIZIONE", "FLAG_USE_QTA_ORD", Boolean.class));
Integer onNumCnfInputChanged = getValueFromList(list, "SETUP", "ON_NUM_CNF_INPUT_CHANGED", Integer.class);
if(onNumCnfInputChanged != null) {
dbSettingsModelIstance.setOnNumCnfInputChanged(onNumCnfInputChanged);
}
if(onComplete != null) onComplete.run();
}, onFailed);

View File

@ -1,11 +1,8 @@
package it.integry.integrywmsnative.core.utility;
import android.app.Dialog;
import android.app.ProgressDialog;
import android.content.Context;
import android.widget.ProgressBar;
import it.integry.integrywmsnative.R;
import it.integry.integrywmsnative.view.dialogs.DialogProgress;
public class UtilityProgress {
@ -26,27 +23,4 @@ public class UtilityProgress {
return progress;
}
public static Thread makeProgressBarIndeterminate(ProgressBar progressBar) {
progressBar.setMax(100);
Thread updateProgressThread = new Thread(() -> {
try {
while (true) {
for (int i = 0; i < 100; i++) {
progressBar.setProgress(i);
Thread.sleep(10);
}
}
} catch (Exception ex) {
// String message = ex.toString();
}
});
updateProgressThread.start();
return updateProgressThread;
}
}

View File

@ -93,9 +93,9 @@ public class VersamentoMerceViewModel {
}, this::sendError);
} else {
if(!UtilityString.equalsIgnoreCase(mCurrentMtbColt.getValue().getCodMdep(), foundPosizione.getCodMdep())) {
if (!UtilityString.equalsIgnoreCase(mCurrentMtbColt.getValue().getCodMdep(), foundPosizione.getCodMdep())) {
this.sendOnSpostamentoTraDepConfirmRequired(mCurrentMtbColt.getValue().getCodMdep(), foundPosizione.getCodMdep(), canContinue -> {
if(canContinue) {
if (canContinue) {
updatePosizione(foundPosizione, UtilityPosizione.isPosizioneWithLivello(foundPosizione));
} else {
onComplete.run();
@ -165,7 +165,7 @@ public class VersamentoMerceViewModel {
private void pickMerceULtoUL(MtbColt destMtbColt) {
MtbColt sourceMtbColt = mCurrentMtbColt.getValue();
if(!UtilityString.equalsIgnoreCase(sourceMtbColt.getCodMdep(), destMtbColt.getCodMdep())) {
if (!UtilityString.equalsIgnoreCase(sourceMtbColt.getCodMdep(), destMtbColt.getCodMdep())) {
this.sendError(new Exception("Impossibile spostare la merce tra UL di due depositi differenti"));
return;
}
@ -174,7 +174,7 @@ public class VersamentoMerceViewModel {
.filter(x -> x.getQtaCol().floatValue() > 0)
.toList();
if(mtbColrsToPick.size() == 0) {
if (mtbColrsToPick.size() == 0) {
this.sendError(new NoArtsInLUException());
return;
}

View File

@ -4,6 +4,7 @@ import android.content.Context;
import android.text.SpannableString;
import androidx.appcompat.app.AppCompatActivity;
import androidx.fragment.app.FragmentActivity;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@ -17,7 +18,7 @@ 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)),
null, onPositiveClick)
null, onPositiveClick)
.show(((AppCompatActivity) context).getSupportFragmentManager(), "tag");
}
@ -31,17 +32,19 @@ public class DialogCommon {
public static void showNoOrderFound(@NotNull Context context, @Nullable Runnable onPositiveClick) {
DialogSimpleMessageView.makeWarningDialog(new SpannableString(context.getResources().getText(R.string.no_orders_found_message)),
null, onPositiveClick)
.show(((AppCompatActivity) context).getSupportFragmentManager(), "tag");;
.show(((AppCompatActivity) context).getSupportFragmentManager(), "tag");
;
}
public static void showDataSaved(@NotNull Context context, @Nullable Runnable onPositiveClick) {
DialogSimpleMessageView.makeSuccessDialog(
context.getResources().getString(R.string.completed),
new SpannableString(context.getResources().getString(R.string.data_saved)),
null, onPositiveClick)
.show(((AppCompatActivity) context).getSupportFragmentManager(), "tag");
public static void showDataSaved(@NotNull FragmentActivity context, @Nullable Runnable onPositiveClick) {
context.runOnUiThread(() -> {
DialogSimpleMessageView.makeSuccessDialog(
context.getResources().getString(R.string.completed),
new SpannableString(context.getResources().getString(R.string.data_saved)),
null, onPositiveClick)
.show(context.getSupportFragmentManager(), "tag");
});
}

View File

@ -38,6 +38,7 @@ import it.integry.integrywmsnative.core.expansion.BaseDialogFragment;
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
import it.integry.integrywmsnative.core.expansion.RunnableArgss;
import it.integry.integrywmsnative.core.model.MtbUntMis;
import it.integry.integrywmsnative.core.settings.SettingsManager;
import it.integry.integrywmsnative.core.utility.UtilityExceptions;
import it.integry.integrywmsnative.core.utility.UtilityObservable;
import it.integry.integrywmsnative.databinding.DialogInputQuantityV2Binding;
@ -179,8 +180,10 @@ public class DialogInputQuantityV2View extends BaseDialogFragment implements Dia
super.onStart();
this.init();
int onNumCnfInputChanged = SettingsManager.iDB().getOnNumCnfInputChanged();
this.mViewModel.setListener(this);
this.mViewModel.init();
this.mViewModel.init(onNumCnfInputChanged);
}
private void init() {

View File

@ -26,6 +26,9 @@ import it.integry.integrywmsnative.view.dialogs.input_quantity_v2.exception.Over
public class DialogInputQuantityV2ViewModel {
private final int UPDATE_QTA_CNF = 1;
private final int UPDATE_QTA_TOT = 2;
public ObservableField<MtbAart> mtbAart = new ObservableField<>();
public ObservableField<Boolean> blockedNumCnf = new ObservableField<>();
@ -60,6 +63,7 @@ public class DialogInputQuantityV2ViewModel {
private boolean canOverflowOrderQuantity;
private boolean canPartitaMagBeChanged;
private int onNumCnfInputChanged;
private Listener mListener;
@ -70,7 +74,9 @@ public class DialogInputQuantityV2ViewModel {
this.mBarcodeRESTConsumer = barcodeRESTConsumer;
}
public void init() {
public void init(int onNumCnfInputChanged) {
this.onNumCnfInputChanged = onNumCnfInputChanged;
if (this.initialNumCnf != null && this.initialQtaTot != null && this.initialQtaCnf != null) {
this.internalNumCnf = this.initialNumCnf;
this.internalQtaCnf = this.initialQtaCnf;
@ -304,10 +310,21 @@ public class DialogInputQuantityV2ViewModel {
// return;
}
if (!this.blockedQtaTot.get() && this.internalQtaCnf != null)
this.internalQtaTot = UtilityBigDecimal.multiply(newValue, this.internalQtaCnf);
else if (!this.blockedQtaCnf.get() && !this.mtbAart.get().isFlagQtaCnfFissaBoolean() && this.internalQtaTot != null)
this.internalQtaCnf = UtilityBigDecimal.divide(internalQtaTot, newValue);
switch (onNumCnfInputChanged) {
case UPDATE_QTA_CNF:
if (!this.blockedQtaCnf.get() && !this.mtbAart.get().isFlagQtaCnfFissaBoolean() && this.internalQtaTot != null)
this.internalQtaCnf = UtilityBigDecimal.divide(internalQtaTot, newValue);
else if (!this.blockedQtaTot.get() && this.internalQtaCnf != null)
this.internalQtaTot = UtilityBigDecimal.multiply(newValue, this.internalQtaCnf);
break;
case UPDATE_QTA_TOT:if (!this.blockedQtaTot.get() && this.internalQtaCnf != null)
this.internalQtaTot = UtilityBigDecimal.multiply(newValue, this.internalQtaCnf);
else if (!this.blockedQtaCnf.get() && !this.mtbAart.get().isFlagQtaCnfFissaBoolean() && this.internalQtaTot != null)
this.internalQtaCnf = UtilityBigDecimal.divide(internalQtaTot, newValue);
break;
}
this.mListener.onDataChanged();
}