Implementato recover colli all'avvio dell'app
This commit is contained in:
parent
a2f719441f
commit
1928e81423
@ -88,20 +88,6 @@ public class AppContext {
|
||||
|
||||
private void initRecoverColli() {
|
||||
ColliDataRecover.init(mContext);
|
||||
|
||||
if(ColliDataRecover.thereIsAnExistantSession()){
|
||||
Integer recoveredMtbColtID = ColliDataRecover.getFirstSessionID();
|
||||
MtbColt recoveredMtbColt = ColliDataRecover.getSession(recoveredMtbColtID);
|
||||
|
||||
if(recoveredMtbColt != null && recoveredMtbColt.getGestioneEnum() == GestioneEnum.VENDITA && !UtilityString.isNullOrEmpty(recoveredMtbColt.getFiltroOrdini())) {
|
||||
ColliMagazzinoRESTConsumer.distribuisciCollo(recoveredMtbColt, DistribuzioneColloDTO.CriterioDistribuzione.UPDATE,
|
||||
mtbColts -> {
|
||||
ColliDataRecover.closeSession(recoveredMtbColtID);
|
||||
|
||||
},
|
||||
ex -> UtilityExceptions.defaultException(mContext, ex));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -23,10 +23,17 @@ import butterknife.OnClick;
|
||||
import de.hdodenhof.circleimageview.CircleImageView;
|
||||
import it.integry.integrywmsnative.MainActivity;
|
||||
import it.integry.integrywmsnative.R;
|
||||
import it.integry.integrywmsnative.core.REST.consumers.ColliMagazzinoRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.REST.model.DistribuzioneColloDTO;
|
||||
import it.integry.integrywmsnative.core.REST.watcher.ServerStatusChecker;
|
||||
import it.integry.integrywmsnative.core.data_recover.ColliDataRecover;
|
||||
import it.integry.integrywmsnative.core.interfaces.IScrollableFragment;
|
||||
import it.integry.integrywmsnative.core.interfaces.ITitledFragment;
|
||||
import it.integry.integrywmsnative.core.model.MtbColt;
|
||||
import it.integry.integrywmsnative.core.model.secondary.GestioneEnum;
|
||||
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityExceptions;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityString;
|
||||
import it.integry.integrywmsnative.core.wifi.WiFiCheckerViewHolder;
|
||||
import it.integry.integrywmsnative.databinding.FragmentMainBinding;
|
||||
import it.integry.plugins.waterfalltoolbar.WaterfallToolbar;
|
||||
@ -90,6 +97,7 @@ public class MainFragment extends Fragment implements ITitledFragment, IScrollab
|
||||
|
||||
initSessionData();
|
||||
|
||||
initRecuperoCollo();
|
||||
}
|
||||
|
||||
private void initSessionData() {
|
||||
@ -101,6 +109,30 @@ public class MainFragment extends Fragment implements ITitledFragment, IScrollab
|
||||
}
|
||||
}
|
||||
|
||||
private void initRecuperoCollo() {
|
||||
if(ColliDataRecover.thereIsAnExistantSession()){
|
||||
startRecoverMode();
|
||||
|
||||
Integer recoveredMtbColtID = ColliDataRecover.getFirstSessionID();
|
||||
MtbColt recoveredMtbColt = ColliDataRecover.getSession(recoveredMtbColtID);
|
||||
|
||||
if(recoveredMtbColt != null && recoveredMtbColt.getGestioneEnum() == GestioneEnum.VENDITA && !UtilityString.isNullOrEmpty(recoveredMtbColt.getFiltroOrdini())) {
|
||||
ColliMagazzinoRESTConsumer.distribuisciCollo(recoveredMtbColt, DistribuzioneColloDTO.CriterioDistribuzione.UPDATE,
|
||||
mtbColts -> {
|
||||
ColliDataRecover.closeSession(recoveredMtbColtID);
|
||||
endRecoverMode();
|
||||
},
|
||||
ex -> {
|
||||
UtilityExceptions.defaultException(getActivity(), ex);
|
||||
endRecoverMode();
|
||||
});
|
||||
} else {
|
||||
ColliDataRecover.closeSession(recoveredMtbColtID);
|
||||
endRecoverMode();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void collapseNoConnectionLayout(){
|
||||
if(getActivity() != null) getActivity().runOnUiThread(() -> mBindings.noConnectionTopLayout.collapse(true));
|
||||
}
|
||||
|
||||
@ -1,16 +1,17 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layout>
|
||||
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".gest.main.MainFragment"
|
||||
android:background="@color/full_white">
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/full_white"
|
||||
tools:context=".gest.main.MainFragment">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<net.cachapa.expandablelayout.ExpandableLayout
|
||||
@ -24,17 +25,17 @@
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/red_600"
|
||||
android:orientation="vertical"
|
||||
android:paddingTop="12dp"
|
||||
android:paddingBottom="12dp"
|
||||
android:paddingLeft="8dp"
|
||||
android:background="@color/red_600">
|
||||
android:paddingTop="12dp"
|
||||
android:paddingBottom="12dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/white"
|
||||
android:text="NESSUNA CONNESSIONE DISPONIBILE, RIPROVA"/>
|
||||
android:text="NESSUNA CONNESSIONE DISPONIBILE, RIPROVA"
|
||||
android:textColor="@color/white" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
@ -62,10 +63,10 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/colorPrimary"
|
||||
android:paddingTop="16dp"
|
||||
android:paddingBottom="24dp"
|
||||
android:paddingLeft="16dp"
|
||||
android:paddingRight="16dp">
|
||||
android:paddingTop="16dp"
|
||||
android:paddingRight="16dp"
|
||||
android:paddingBottom="16dp">
|
||||
|
||||
|
||||
<LinearLayout
|
||||
@ -115,9 +116,6 @@
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<net.cachapa.expandablelayout.ExpandableLayout
|
||||
android:id="@+id/recover_data_expandable_layout"
|
||||
android:layout_width="match_parent"
|
||||
@ -129,6 +127,7 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="16dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal">
|
||||
|
||||
@ -149,7 +148,7 @@
|
||||
style="@style/AppTheme.NewMaterial.Text.TextBoxDashboard"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Recovering data"
|
||||
android:text="@string/recovering_data"
|
||||
android:textColor="@android:color/white" />
|
||||
|
||||
|
||||
@ -168,7 +167,7 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="2dp"
|
||||
android:text="Attendi qualche istante" />
|
||||
android:text="@string/wait_a_moment" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
@ -184,26 +183,20 @@
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:clipToPadding="false"
|
||||
android:orientation="horizontal"
|
||||
android:weightSum="1"
|
||||
android:padding="8dp">
|
||||
|
||||
<androidx.constraintlayout.widget.Guideline
|
||||
android:id="@+id/central_guideline_dashboard"
|
||||
android:layout_width="1dp"
|
||||
android:layout_height="1dp"
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintGuide_percent="0.5" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintEnd_toStartOf="@id/central_guideline_dashboard"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
android:layout_weight="0.5">
|
||||
|
||||
|
||||
<com.google.android.material.card.MaterialCardView
|
||||
@ -213,8 +206,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="8dp"
|
||||
app:cardBackgroundColor="@android:color/white"
|
||||
app:cardCornerRadius="4dp"
|
||||
>
|
||||
app:cardCornerRadius="4dp">
|
||||
|
||||
|
||||
<LinearLayout
|
||||
@ -316,16 +308,13 @@
|
||||
</com.google.android.material.card.MaterialCardView>
|
||||
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="@id/central_guideline_dashboard"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
android:layout_weight="0.5">
|
||||
|
||||
|
||||
<com.google.android.material.card.MaterialCardView
|
||||
@ -403,7 +392,7 @@
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
@ -452,7 +441,6 @@
|
||||
<!--app:layout_constraintGuide_percent="0.40"/>-->
|
||||
|
||||
|
||||
|
||||
<!--</androidx.constraintlayout.widget.ConstraintLayout>-->
|
||||
|
||||
<!--<androidx.constraintlayout.widget.ConstraintLayout-->
|
||||
|
||||
@ -178,4 +178,7 @@
|
||||
<string name="free_picking_suggestion_2">Scansiona un articolo per iniziare</string>
|
||||
<string name="free_picking_title_fragment">Picking libero</string>
|
||||
|
||||
<string name="recovering_data">Recupero dati</string>
|
||||
<string name="wait_a_moment">Attendi qualche istante</string>
|
||||
|
||||
</resources>
|
||||
@ -179,5 +179,7 @@
|
||||
<string name="free_picking_suggestion_1">Please press + button to start with picking</string>
|
||||
<string name="free_picking_suggestion_2">Scan an item to start</string>
|
||||
|
||||
<string name="recovering_data">Recovering data</string>
|
||||
<string name="wait_a_moment">Wait a moment</string>
|
||||
|
||||
</resources>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user