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() {
|
private void initRecoverColli() {
|
||||||
ColliDataRecover.init(mContext);
|
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 de.hdodenhof.circleimageview.CircleImageView;
|
||||||
import it.integry.integrywmsnative.MainActivity;
|
import it.integry.integrywmsnative.MainActivity;
|
||||||
import it.integry.integrywmsnative.R;
|
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.REST.watcher.ServerStatusChecker;
|
||||||
|
import it.integry.integrywmsnative.core.data_recover.ColliDataRecover;
|
||||||
import it.integry.integrywmsnative.core.interfaces.IScrollableFragment;
|
import it.integry.integrywmsnative.core.interfaces.IScrollableFragment;
|
||||||
import it.integry.integrywmsnative.core.interfaces.ITitledFragment;
|
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.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.core.wifi.WiFiCheckerViewHolder;
|
||||||
import it.integry.integrywmsnative.databinding.FragmentMainBinding;
|
import it.integry.integrywmsnative.databinding.FragmentMainBinding;
|
||||||
import it.integry.plugins.waterfalltoolbar.WaterfallToolbar;
|
import it.integry.plugins.waterfalltoolbar.WaterfallToolbar;
|
||||||
@ -90,6 +97,7 @@ public class MainFragment extends Fragment implements ITitledFragment, IScrollab
|
|||||||
|
|
||||||
initSessionData();
|
initSessionData();
|
||||||
|
|
||||||
|
initRecuperoCollo();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initSessionData() {
|
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(){
|
private void collapseNoConnectionLayout(){
|
||||||
if(getActivity() != null) getActivity().runOnUiThread(() -> mBindings.noConnectionTopLayout.collapse(true));
|
if(getActivity() != null) getActivity().runOnUiThread(() -> mBindings.noConnectionTopLayout.collapse(true));
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,16 +1,17 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<layout>
|
<layout>
|
||||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="wrap_content"
|
||||||
tools:context=".gest.main.MainFragment"
|
android:background="@color/full_white"
|
||||||
android:background="@color/full_white">
|
tools:context=".gest.main.MainFragment">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<net.cachapa.expandablelayout.ExpandableLayout
|
<net.cachapa.expandablelayout.ExpandableLayout
|
||||||
@ -24,17 +25,17 @@
|
|||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:background="@color/red_600"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:paddingTop="12dp"
|
|
||||||
android:paddingBottom="12dp"
|
|
||||||
android:paddingLeft="8dp"
|
android:paddingLeft="8dp"
|
||||||
android:background="@color/red_600">
|
android:paddingTop="12dp"
|
||||||
|
android:paddingBottom="12dp">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="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>
|
</LinearLayout>
|
||||||
|
|
||||||
@ -62,10 +63,10 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:background="@color/colorPrimary"
|
android:background="@color/colorPrimary"
|
||||||
android:paddingTop="16dp"
|
|
||||||
android:paddingBottom="24dp"
|
|
||||||
android:paddingLeft="16dp"
|
android:paddingLeft="16dp"
|
||||||
android:paddingRight="16dp">
|
android:paddingTop="16dp"
|
||||||
|
android:paddingRight="16dp"
|
||||||
|
android:paddingBottom="16dp">
|
||||||
|
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
@ -115,9 +116,6 @@
|
|||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<net.cachapa.expandablelayout.ExpandableLayout
|
<net.cachapa.expandablelayout.ExpandableLayout
|
||||||
android:id="@+id/recover_data_expandable_layout"
|
android:id="@+id/recover_data_expandable_layout"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
@ -129,6 +127,7 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="16dp"
|
android:layout_marginTop="16dp"
|
||||||
|
android:layout_marginBottom="8dp"
|
||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
android:orientation="horizontal">
|
android:orientation="horizontal">
|
||||||
|
|
||||||
@ -149,7 +148,7 @@
|
|||||||
style="@style/AppTheme.NewMaterial.Text.TextBoxDashboard"
|
style="@style/AppTheme.NewMaterial.Text.TextBoxDashboard"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="Recovering data"
|
android:text="@string/recovering_data"
|
||||||
android:textColor="@android:color/white" />
|
android:textColor="@android:color/white" />
|
||||||
|
|
||||||
|
|
||||||
@ -168,7 +167,7 @@
|
|||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="2dp"
|
android:layout_marginTop="2dp"
|
||||||
android:text="Attendi qualche istante" />
|
android:text="@string/wait_a_moment" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
@ -184,26 +183,20 @@
|
|||||||
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:clipToPadding="false"
|
android:clipToPadding="false"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:weightSum="1"
|
||||||
android:padding="8dp">
|
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
|
<LinearLayout
|
||||||
android:layout_width="0dp"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
app:layout_constraintEnd_toStartOf="@id/central_guideline_dashboard"
|
android:layout_weight="0.5">
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toTopOf="parent">
|
|
||||||
|
|
||||||
|
|
||||||
<com.google.android.material.card.MaterialCardView
|
<com.google.android.material.card.MaterialCardView
|
||||||
@ -213,8 +206,7 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_margin="8dp"
|
android:layout_margin="8dp"
|
||||||
app:cardBackgroundColor="@android:color/white"
|
app:cardBackgroundColor="@android:color/white"
|
||||||
app:cardCornerRadius="4dp"
|
app:cardCornerRadius="4dp">
|
||||||
>
|
|
||||||
|
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
@ -316,16 +308,13 @@
|
|||||||
</com.google.android.material.card.MaterialCardView>
|
</com.google.android.material.card.MaterialCardView>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="0dp"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
android:layout_weight="0.5">
|
||||||
app:layout_constraintStart_toStartOf="@id/central_guideline_dashboard"
|
|
||||||
app:layout_constraintTop_toTopOf="parent">
|
|
||||||
|
|
||||||
|
|
||||||
<com.google.android.material.card.MaterialCardView
|
<com.google.android.material.card.MaterialCardView
|
||||||
@ -403,7 +392,7 @@
|
|||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
@ -452,7 +441,6 @@
|
|||||||
<!--app:layout_constraintGuide_percent="0.40"/>-->
|
<!--app:layout_constraintGuide_percent="0.40"/>-->
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<!--</androidx.constraintlayout.widget.ConstraintLayout>-->
|
<!--</androidx.constraintlayout.widget.ConstraintLayout>-->
|
||||||
|
|
||||||
<!--<androidx.constraintlayout.widget.ConstraintLayout-->
|
<!--<androidx.constraintlayout.widget.ConstraintLayout-->
|
||||||
@ -671,5 +659,5 @@
|
|||||||
<!--</androidx.cardview.widget.CardView>-->
|
<!--</androidx.cardview.widget.CardView>-->
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</FrameLayout>
|
</FrameLayout>
|
||||||
</layout>
|
</layout>
|
||||||
@ -178,4 +178,7 @@
|
|||||||
<string name="free_picking_suggestion_2">Scansiona un articolo per iniziare</string>
|
<string name="free_picking_suggestion_2">Scansiona un articolo per iniziare</string>
|
||||||
<string name="free_picking_title_fragment">Picking libero</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>
|
</resources>
|
||||||
@ -179,5 +179,7 @@
|
|||||||
<string name="free_picking_suggestion_1">Please press + button to start with picking</string>
|
<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="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>
|
</resources>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user