Compare commits
52 Commits
v1.16.16(1
...
v1.16.28(2
| Author | SHA1 | Date | |
|---|---|---|---|
| ac446d953c | |||
| 407ff0b264 | |||
| 10e748b9d4 | |||
| e30273fe42 | |||
| 44564245a7 | |||
| 920f306907 | |||
| 90aa52ab55 | |||
| 93f3eb65f0 | |||
| eb94944928 | |||
| 28698ba306 | |||
| c713bbebbc | |||
| 38e2a02766 | |||
| dd8bf264a4 | |||
| 9488c1994d | |||
| 16099cdaf6 | |||
| f061f2bfc9 | |||
| f7253fd44c | |||
| e12d371567 | |||
| 5596f71c03 | |||
| 8669b812f5 | |||
| 3243484dd0 | |||
| 37114dc4d1 | |||
| d5af79abba | |||
| b50aa7a9d2 | |||
| cc333c3147 | |||
| fc5044134c | |||
| 93a3e39332 | |||
| 3eaf187136 | |||
| 36f9fa1e36 | |||
| 0f89913609 | |||
| 4cda247ddc | |||
| e88ea0a45c | |||
| 726cf80dc0 | |||
| a779d8b94d | |||
| f41e1f3a02 | |||
| aa75a77913 | |||
| 639be21ab5 | |||
| dfc241e7f6 | |||
| 7948c7fa97 | |||
| 2ae311c28a | |||
| 56ba43183c | |||
| b93b309ea8 | |||
| f5a2d012e5 | |||
| bf07e3d0f0 | |||
| 91f075976d | |||
| ee70faefa9 | |||
| 13cca99b09 | |||
| e55b6f4934 | |||
| 62d4b6f724 | |||
| 19b0465569 | |||
| d4f44c1ab7 | |||
| a939f0ba08 |
@@ -6,8 +6,8 @@ apply plugin: 'com.google.gms.google-services'
|
||||
|
||||
android {
|
||||
|
||||
def appVersionCode = 198
|
||||
def appVersionName = '1.16.16'
|
||||
def appVersionCode = 210
|
||||
def appVersionName = '1.16.28'
|
||||
|
||||
signingConfigs {
|
||||
release {
|
||||
@@ -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'
|
||||
|
||||
@@ -31,10 +31,14 @@ import it.integry.integrywmsnative.gest.ultime_consegne_cliente.UltimeConsegneCl
|
||||
import it.integry.integrywmsnative.gest.ultime_consegne_cliente.UltimeConsegneClienteModule;
|
||||
import it.integry.integrywmsnative.gest.ultimi_arrivi_fornitore.UltimiArriviFornitoreComponent;
|
||||
import it.integry.integrywmsnative.gest.ultimi_arrivi_fornitore.UltimiArriviFornitoreModule;
|
||||
import it.integry.integrywmsnative.gest.versamento_merce.VersamentoMerceComponent;
|
||||
import it.integry.integrywmsnative.gest.versamento_merce.VersamentoMerceModule;
|
||||
import it.integry.integrywmsnative.view.dialogs.input_quantity_v2.DialogInputQuantityV2Component;
|
||||
import it.integry.integrywmsnative.view.dialogs.input_quantity_v2.DialogInputQuantityV2Module;
|
||||
import it.integry.integrywmsnative.view.dialogs.scan_art.DialogScanArtComponent;
|
||||
import it.integry.integrywmsnative.view.dialogs.scan_art.DialogScanArtModule;
|
||||
import it.integry.integrywmsnative.view.dialogs.scan_or_create_lu.DialogScanOrCreateLUComponent;
|
||||
import it.integry.integrywmsnative.view.dialogs.scan_or_create_lu.DialogScanOrCreateLUModule;
|
||||
|
||||
// Definition of the Application graph
|
||||
@Singleton
|
||||
@@ -54,7 +58,9 @@ import it.integry.integrywmsnative.view.dialogs.scan_art.DialogScanArtModule;
|
||||
OrdiniUscitaElencoModule.class,
|
||||
DialogInputQuantityV2Module.class,
|
||||
DialogScanArtModule.class,
|
||||
DialogScanOrCreateLUModule.class,
|
||||
ProdFabbisognoLineeProdModule.class,
|
||||
VersamentoMerceModule.class,
|
||||
DialogAskMagazzinoProssimitaModule.class,
|
||||
DialogRowInfoProdFabbisognoLineeProdModule.class})
|
||||
public interface MainApplicationComponent {
|
||||
@@ -72,7 +78,9 @@ public interface MainApplicationComponent {
|
||||
OrdiniUscitaElencoComponent.Factory prodOrdineLavorazioneElencoComponent();
|
||||
DialogInputQuantityV2Component.Factory dialogInputQuantityV2Component();
|
||||
DialogScanArtComponent.Factory dialogScanArtComponent();
|
||||
DialogScanOrCreateLUComponent.Factory dialogScanOrCreateLUComponent();
|
||||
ProdFabbisognoLineeProdComponent.Factory prodFabbisognoLineeProdComponent();
|
||||
VersamentoMerceComponent.Factory versamentoMerceComponent();
|
||||
DialogAskMagazzinoProssimitaComponent.Factory dialogAskMagazzinoProssimitaComponent();
|
||||
DialogRowInfoProdFabbisognoLineeProdComponent.Factory dialogRowInfoProdFabbisognoLineeProdComponent();
|
||||
|
||||
|
||||
@@ -6,7 +6,6 @@ import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import com.annimon.stream.Optional;
|
||||
import com.annimon.stream.Stream;
|
||||
import com.google.android.gms.common.util.IOUtils;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
|
||||
@@ -122,7 +121,7 @@ public class ColliDataRecover {
|
||||
}
|
||||
|
||||
public static boolean thereIsAnExistantSession() {
|
||||
return mtbColtsSessions.size() > 0;
|
||||
return mtbColtsSessions != null && mtbColtsSessions.size() > 0;
|
||||
}
|
||||
|
||||
public static List<Integer> getAllSessionIDs() {
|
||||
@@ -193,13 +192,16 @@ public class ColliDataRecover {
|
||||
try {
|
||||
inputStream = mContext.openFileInput(CommonConst.Files.RECOVER_COLLO_FILE);
|
||||
|
||||
byte[] bytes = IOUtils.readInputStreamFully(inputStream);
|
||||
byte[] bytes = new byte[inputStream.available()];
|
||||
inputStream.read(bytes);
|
||||
inputStream.close();
|
||||
|
||||
String jsonString = new String(bytes);
|
||||
|
||||
Type listType = new TypeToken<ArrayList<RecoverDTO>>(){}.getType();
|
||||
mtbColtsSessions = gson.fromJson(jsonString, listType);
|
||||
|
||||
inputStream.close();
|
||||
if(mtbColtsSessions == null) mtbColtsSessions = new ArrayList<>();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
UtilityExceptions.defaultException(mContext, e);
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
package it.integry.integrywmsnative.core.exception;
|
||||
|
||||
import it.integry.integrywmsnative.R;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityResources;
|
||||
|
||||
public class AlreadyAttachedDocumentToLUException extends Exception {
|
||||
|
||||
public AlreadyAttachedDocumentToLUException() {
|
||||
super(UtilityResources.getString(R.string.lu_already_attache_to_doc));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
package it.integry.integrywmsnative.core.exception;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
import java.io.StringWriter;
|
||||
|
||||
public class MyExceptionHandler implements
|
||||
java.lang.Thread.UncaughtExceptionHandler {
|
||||
private final Context myContext;
|
||||
private final Class<?> myActivityClass;
|
||||
|
||||
public MyExceptionHandler(Context context, Class<?> c) {
|
||||
|
||||
myContext = context;
|
||||
myActivityClass = c;
|
||||
}
|
||||
|
||||
public void uncaughtException(Thread thread, Throwable exception) {
|
||||
|
||||
StringWriter stackTrace = new StringWriter();
|
||||
exception.printStackTrace(new PrintWriter(stackTrace));
|
||||
System.err.println(stackTrace);// You can use LogCat too
|
||||
// Intent intent = new Intent(myContext, myActivityClass);
|
||||
// String s = stackTrace.toString();
|
||||
// //you can use this String to know what caused the exception and in which Activity
|
||||
// intent.putExtra("uncaughtException",
|
||||
// "Exception is: " + stackTrace.toString());
|
||||
// intent.putExtra("stacktrace", s);
|
||||
// myContext.startActivity(intent);
|
||||
//for restarting the Activity
|
||||
// Process.killProcess(Process.myPid());
|
||||
// System.exit(0);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package it.integry.integrywmsnative.core.exception;
|
||||
|
||||
import it.integry.integrywmsnative.R;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityResources;
|
||||
|
||||
public class NoArtsInLUException extends Exception {
|
||||
|
||||
public NoArtsInLUException() {
|
||||
super(UtilityResources.getString(R.string.no_items_found_message));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package it.integry.integrywmsnative.core.exception;
|
||||
|
||||
import it.integry.integrywmsnative.R;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityResources;
|
||||
|
||||
public class TooManyLUFoundInMonoLUPositionException extends Exception {
|
||||
|
||||
public TooManyLUFoundInMonoLUPositionException() {
|
||||
super(UtilityResources.getString(R.string.too_much_lu_found_message_in_mono_lu));
|
||||
}
|
||||
}
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
import it.integry.integrywmsnative.core.model.secondary.GestioneEnum;
|
||||
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityDate;
|
||||
|
||||
public class MtbColr extends EntityBase {
|
||||
@@ -56,6 +57,10 @@ public class MtbColr extends EntityBase {
|
||||
|
||||
public MtbColr() {
|
||||
type = "mtb_colr";
|
||||
|
||||
if(SettingsManager.i().isUserLoggedIn()) {
|
||||
setUtente(SettingsManager.i().getUser().getFullname());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -99,6 +99,10 @@ public class MtbColt extends EntityBase {
|
||||
type = "mtb_colt";
|
||||
setDataCollo(UtilityDate.getDateInstance());
|
||||
setSerCollo("/");
|
||||
|
||||
if(SettingsManager.i().isUserLoggedIn()) {
|
||||
setPreparatoDa(SettingsManager.i().getUser().getFullname());
|
||||
}
|
||||
}
|
||||
|
||||
public MtbColt initDefaultFields() {
|
||||
|
||||
@@ -32,6 +32,7 @@ import it.integry.integrywmsnative.core.rest.RESTBuilder;
|
||||
import it.integry.integrywmsnative.core.rest.model.DistribuzioneColloDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.RettificaULDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
||||
import it.integry.integrywmsnative.core.rest.model.SpostaArtsTraULRequestDTO;
|
||||
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityBarcode;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityDate;
|
||||
@@ -125,7 +126,7 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
||||
|
||||
}
|
||||
|
||||
public static void createColloLavorazione(int segno, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
public void createColloLavorazione(int segno, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
MtbColt mtbColtToCreate = new MtbColt()
|
||||
.setSegno(segno)
|
||||
.setGestione(GestioneEnum.LAVORAZIONE);
|
||||
@@ -136,16 +137,10 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
||||
.setOperation(CommonModelConsts.OPERATION.INSERT);
|
||||
|
||||
|
||||
saveColloStatic(mtbColtToCreate, new ISimpleOperationCallback<MtbColt>() {
|
||||
@Override
|
||||
public void onSuccess(MtbColt value) {
|
||||
if (onComplete != null) onComplete.run(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailed(Exception ex) {
|
||||
if (onFailed != null) onFailed.run(ex);
|
||||
}
|
||||
saveCollo(mtbColtToCreate, value -> {
|
||||
if (onComplete != null) onComplete.run(value);
|
||||
}, ex -> {
|
||||
if (onFailed != null) onFailed.run(ex);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -212,7 +207,7 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
||||
});
|
||||
}
|
||||
|
||||
public static void createColliScaricoDaOrdineLavorazione(MtbColt sourceMtbColt,MtbColr sourceMtbColr, MtbDepoPosizione posizione, List<OrdineLavorazioneDTO> ordini, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
public static void createColliScaricoDaOrdineLavorazione(MtbColt sourceMtbColt, MtbColr sourceMtbColr, MtbDepoPosizione posizione, List<OrdineLavorazioneDTO> ordini, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
|
||||
MtbColt newMtbColt = new MtbColt()
|
||||
.initDefaultFields()
|
||||
@@ -262,7 +257,7 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
||||
.setPartitaMag(original.getPartitaMag())
|
||||
.setOperation(CommonModelConsts.OPERATION.INSERT);
|
||||
for (OrdineLavorazioneDTO ordLav : ordini) {
|
||||
if (ordLav.getQtaColVersamento().getBigDecimal().compareTo(BigDecimal.ZERO) > 0){
|
||||
if (ordLav.getQtaColVersamento().getBigDecimal().compareTo(BigDecimal.ZERO) > 0) {
|
||||
MtbColr ordColr = (MtbColr) mtbColrClone.clone();
|
||||
ordColr.setQtaCol(ordLav.getQtaColVersamento().getBigDecimal());
|
||||
ordColr.setNumCnf(ordLav.getNumCnfVersamento().getBigDecimal());
|
||||
@@ -290,12 +285,11 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
||||
}
|
||||
|
||||
|
||||
public static void createColloFromEtichettaAnonima(BarcodeScanDTO barcodeScanDTO, GestioneEnum gestione, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
public void createColloFromEtichettaAnonima(BarcodeScanDTO barcodeScanDTO, GestioneEnum gestione, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
createColloFromEtichettaAnonima(barcodeScanDTO.getStringValue(), gestione, onComplete, onFailed);
|
||||
}
|
||||
|
||||
|
||||
public static void createColloFromEtichettaAnonima(String barcode, GestioneEnum gestione, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
public void createColloFromEtichettaAnonima(String barcode, GestioneEnum gestione, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
|
||||
MtbColt mtbColtToCreate = new MtbColt()
|
||||
.setGestione(gestione);
|
||||
@@ -321,39 +315,22 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
||||
mtbColtToCreate
|
||||
.setOperation(CommonModelConsts.OPERATION.INSERT);
|
||||
|
||||
saveColloStatic(mtbColtToCreate, new ISimpleOperationCallback<MtbColt>() {
|
||||
@Override
|
||||
public void onSuccess(MtbColt value) {
|
||||
if (onComplete != null) onComplete.run(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailed(Exception ex) {
|
||||
if (onFailed != null) onFailed.run(ex);
|
||||
}
|
||||
saveCollo(mtbColtToCreate, value -> {
|
||||
if (onComplete != null) onComplete.run(value);
|
||||
}, ex -> {
|
||||
if (onFailed != null) onFailed.run(ex);
|
||||
});
|
||||
}
|
||||
|
||||
public void deleteCollo(MtbColt mtbColtToDelete, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||
ColliMagazzinoRESTConsumer.deleteColloStatic(mtbColtToDelete, onComplete, onFailed);
|
||||
}
|
||||
|
||||
public static void deleteColloStatic(MtbColt mtbColtToDelete, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||
|
||||
mtbColtToDelete.setOperation(CommonModelConsts.OPERATION.DELETE);
|
||||
|
||||
saveColloStatic(mtbColtToDelete, new ISimpleOperationCallback<MtbColt>() {
|
||||
@Override
|
||||
public void onSuccess(MtbColt value) {
|
||||
if (onComplete != null) onComplete.run();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailed(Exception ex) {
|
||||
if (onFailed != null) onFailed.run(ex);
|
||||
}
|
||||
saveCollo(mtbColtToDelete, value -> {
|
||||
if (onComplete != null) onComplete.run();
|
||||
}, ex -> {
|
||||
if (onFailed != null) onFailed.run(ex);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
public static void distribuisciCollo(MtbColt mtbColtToDistribute, DistribuzioneColloDTO.CriterioDistribuzione criterioDistribuzione, RunnableArgs<List<MtbColt>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
@@ -411,7 +388,7 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
||||
if (mtbColt != null && mtbColt.getMtbColr() != null && mtbColt.getMtbColr().size() > 0) {
|
||||
List<MtbColt> mtbColtList = new ArrayList<>();
|
||||
mtbColtList.add(mtbColt);
|
||||
fillMtbAartsOfMtbColts(mtbColtList, mtbColts -> onComplete.run(mtbColts.get(0)), onFailed);
|
||||
fillMtbAartsOfMtbColtsStatic(mtbColtList, mtbColts -> onComplete.run(mtbColts.get(0)), onFailed);
|
||||
} else {
|
||||
onComplete.run(mtbColt);
|
||||
}
|
||||
@@ -426,8 +403,11 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
||||
});
|
||||
}
|
||||
|
||||
public void fillMtbAartsOfMtbColts(List<MtbColt> mtbColts, RunnableArgs<List<MtbColt>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
fillMtbAartsOfMtbColtsStatic(mtbColts, onComplete, onFailed);
|
||||
}
|
||||
|
||||
public static void fillMtbAartsOfMtbColts(List<MtbColt> mtbColts, RunnableArgs<List<MtbColt>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
public static void fillMtbAartsOfMtbColtsStatic(List<MtbColt> mtbColts, RunnableArgs<List<MtbColt>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
List<String> codMarts = new ArrayList<>();
|
||||
|
||||
for (MtbColt mtbColt : mtbColts) {
|
||||
@@ -542,46 +522,37 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
||||
}
|
||||
|
||||
|
||||
public static void changePosizione(MtbColt mtbColtToSave, MtbDepoPosizione posizione, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||
MtbColt mtbColtToSaveClone = (MtbColt) mtbColtToSave.clone();
|
||||
public void changePosizione(MtbColt mtbColtToMove, MtbDepoPosizione posizione, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||
|
||||
mtbColtToSaveClone.setOperation(CommonModelConsts.OPERATION.UPDATE);
|
||||
mtbColtToSaveClone.setMtbColr(new ObservableArrayList<>());
|
||||
String codMdep = posizione.getCodMdep();
|
||||
String posizioneString = posizione.getPosizione();
|
||||
|
||||
if (posizione == null) mtbColtToSaveClone.setPosizione(null);
|
||||
else mtbColtToSaveClone
|
||||
.setPosizione(posizione.getPosizione())
|
||||
.setCodMdep(posizione.getCodMdep());
|
||||
MtbColt mtbColtToMoveClone = (MtbColt) mtbColtToMove.clone();
|
||||
|
||||
ColliMagazzinoRESTConsumer.saveColloStatic(mtbColtToSaveClone, mtbColt -> {
|
||||
if (onComplete != null) onComplete.run();
|
||||
}, ex -> {
|
||||
if (onFailed != null) onFailed.run(ex);
|
||||
});
|
||||
for (int i = 0; i < mtbColtToMoveClone.getMtbColr().size(); i++) {
|
||||
mtbColtToMoveClone.getMtbColr().get(i)
|
||||
.setMtbAart(null)
|
||||
.setMtbPartitaMag(null);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void updateRiga(MtbColr mtbColrToUpdate, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||
updateRigaStatic(mtbColrToUpdate, onComplete, onFailed);
|
||||
}
|
||||
|
||||
public static void updateRigaStatic(MtbColr mtbColrToUpdate, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||
MtbColt mtbColt = new MtbColt()
|
||||
.setGestione(mtbColrToUpdate.getGestioneEnum())
|
||||
.setNumCollo(mtbColrToUpdate.getNumCollo())
|
||||
.setSerCollo(mtbColrToUpdate.getSerCollo())
|
||||
.setDataCollo(mtbColrToUpdate.getDataColloS());
|
||||
|
||||
mtbColt.getMtbColr().add(mtbColrToUpdate);
|
||||
|
||||
mtbColt.setOperation(CommonModelConsts.OPERATION.NO_OP);
|
||||
mtbColrToUpdate.setOperation(CommonModelConsts.OPERATION.UPDATE);
|
||||
|
||||
EntityRESTConsumer.processEntity(mtbColt, value -> {
|
||||
if(onComplete != null) onComplete.run();
|
||||
}, onFailed, MtbColt.class);
|
||||
ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = RESTBuilder.getService(ColliMagazzinoRESTConsumerService.class);
|
||||
colliMagazzinoRESTConsumerService
|
||||
.spostaULInPosizione(codMdep,
|
||||
posizioneString,
|
||||
mtbColtToMoveClone)
|
||||
.enqueue(new Callback<ServiceRESTResponse<Object>>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<Object>> call, Response<ServiceRESTResponse<Object>> response) {
|
||||
analyzeAnswer(response, "changePosizione", mtbColts -> {
|
||||
onComplete.run();
|
||||
}, onFailed);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<ServiceRESTResponse<Object>> call, Throwable t) {
|
||||
if (onFailed != null) onFailed.run(new Exception(t));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void updateDataFine(MtbColt mtbColt, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||
@@ -661,7 +632,7 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<List<MtbColt>>> call, Response<ServiceRESTResponse<List<MtbColt>>> response) {
|
||||
analyzeAnswer(response, "getColliInBasket", mtbColts -> {
|
||||
fillMtbAartsOfMtbColts(mtbColts, onComplete, onFailed);
|
||||
fillMtbAartsOfMtbColtsStatic(mtbColts, onComplete, onFailed);
|
||||
}, onFailed);
|
||||
}
|
||||
|
||||
@@ -672,12 +643,7 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public static void creaRettificaColloStatic(MtbColr sourceMtbColrOriginal, BigDecimal newNumCnf, BigDecimal newQtaTot, RunnableArgs<MtbColr> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
public void creaRettificaCollo(MtbColr sourceMtbColrOriginal, BigDecimal newNumCnf, BigDecimal newQtaTot, RunnableArgs<MtbColr> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
MtbColr sourceMtbColr = (MtbColr) sourceMtbColrOriginal.clone();
|
||||
sourceMtbColr.setMtbPartitaMag(null);
|
||||
sourceMtbColr.setMtbAart(null);
|
||||
@@ -694,22 +660,48 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
||||
).enqueue(new Callback<ServiceRESTResponse<MtbColr>>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<MtbColr>> call, Response<ServiceRESTResponse<MtbColr>> response) {
|
||||
analyzeAnswer(response, "creaRettificaCollo", data -> {
|
||||
onComplete.run(data);
|
||||
}, onFailed);
|
||||
analyzeAnswer(response, "creaRettificaCollo", onComplete, onFailed);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<ServiceRESTResponse<MtbColr>> call, Throwable t) {
|
||||
if(onFailed != null) onFailed.run(new Exception(t));
|
||||
if (onFailed != null) onFailed.run(new Exception(t));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void spostaArtsTraUL(MtbColt sourceMtbColt, MtbColt destMtbColt, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||
MtbColt mtbColtToMoveClone = (MtbColt) sourceMtbColt.clone();
|
||||
MtbColt mtbColtDestClone = (MtbColt) destMtbColt.clone();
|
||||
|
||||
for (int i = 0; i < mtbColtToMoveClone.getMtbColr().size(); i++) {
|
||||
mtbColtToMoveClone.getMtbColr().get(i)
|
||||
.setMtbAart(null)
|
||||
.setMtbPartitaMag(null);
|
||||
}
|
||||
|
||||
public void creaRettificaCollo(MtbColr sourceMtbColrOriginal, BigDecimal newNumCnf, BigDecimal newQtaTot, RunnableArgs<MtbColr> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
creaRettificaColloStatic(sourceMtbColrOriginal, newNumCnf, newQtaTot, onComplete, onFailed);
|
||||
mtbColtDestClone.setMtbColr(null);
|
||||
|
||||
SpostaArtsTraULRequestDTO spostaArtsTraULRequestDTO = new SpostaArtsTraULRequestDTO()
|
||||
.setSourceMtbColt(mtbColtToMoveClone)
|
||||
.setDestinationMtbColt(mtbColtDestClone);
|
||||
|
||||
ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = RESTBuilder.getService(ColliMagazzinoRESTConsumerService.class);
|
||||
colliMagazzinoRESTConsumerService.spostaArtsTraUL(
|
||||
spostaArtsTraULRequestDTO
|
||||
).enqueue(new Callback<ServiceRESTResponse<Object>>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<Object>> call, Response<ServiceRESTResponse<Object>> response) {
|
||||
analyzeAnswer(response, "spostaArtsTraUL", data -> {
|
||||
onComplete.run();
|
||||
}, onFailed);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<ServiceRESTResponse<Object>> call, Throwable t) {
|
||||
if (onFailed != null) onFailed.run(new Exception(t));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ import it.integry.integrywmsnative.core.model.MtbColt;
|
||||
import it.integry.integrywmsnative.core.rest.model.DistribuzioneColloDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.RettificaULDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
||||
import it.integry.integrywmsnative.core.rest.model.SpostaArtsTraULRequestDTO;
|
||||
import retrofit2.Call;
|
||||
import retrofit2.http.Body;
|
||||
import retrofit2.http.GET;
|
||||
@@ -29,4 +30,10 @@ public interface ColliMagazzinoRESTConsumerService {
|
||||
@POST("creaRettificaCollo")
|
||||
Call<ServiceRESTResponse<MtbColr>> creaRettificaCollo(@Query("codMdep") String codMdep, @Body RettificaULDTO rettificaULDTO);
|
||||
|
||||
@POST("wms/spostaULInPosizione")
|
||||
Call<ServiceRESTResponse<Object>> spostaULInPosizione(@Query("codMdep") String codMdep, @Query("posizione") String posizione, @Body MtbColt mtbColtToMove);
|
||||
|
||||
@POST("wms/spostaArtsTraUL")
|
||||
Call<ServiceRESTResponse<Object>> spostaArtsTraUL(@Body SpostaArtsTraULRequestDTO spostaArtsTraULRequestDTO);
|
||||
|
||||
}
|
||||
|
||||
@@ -68,11 +68,8 @@ public class PosizioniRESTConsumer extends _BaseRESTConsumer{
|
||||
});
|
||||
}
|
||||
|
||||
public void getBancaliInPosizione(MtbDepoPosizione mtbDepoPosizione, RunnableArgs<List<MtbColt>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
getBancaliInPosizioneStatic(mtbDepoPosizione, onComplete, onFailed);
|
||||
}
|
||||
|
||||
public static void getBancaliInPosizioneStatic(MtbDepoPosizione mtbDepoPosizione, RunnableArgs<List<MtbColt>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
public void getBancaliInPosizione(MtbDepoPosizione mtbDepoPosizione, RunnableArgs<List<MtbColt>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
String sql = "SELECT * FROM mtb_colt WHERE segno > 0 AND cod_mdep = " + UtilityDB.valueToString(mtbDepoPosizione.getCodMdep()) + " AND posizione = " + UtilityDB.valueToString(mtbDepoPosizione.getPosizione());
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
package it.integry.integrywmsnative.core.rest.model;
|
||||
|
||||
import it.integry.integrywmsnative.core.model.MtbColt;
|
||||
|
||||
public class SpostaArtsTraULRequestDTO {
|
||||
|
||||
|
||||
private MtbColt sourceMtbColt;
|
||||
|
||||
private MtbColt destinationMtbColt;
|
||||
|
||||
public MtbColt getSourceMtbColt() {
|
||||
return sourceMtbColt;
|
||||
}
|
||||
|
||||
public SpostaArtsTraULRequestDTO setSourceMtbColt(MtbColt sourceMtbColt) {
|
||||
this.sourceMtbColt = sourceMtbColt;
|
||||
return this;
|
||||
}
|
||||
|
||||
public MtbColt getDestinationMtbColt() {
|
||||
return destinationMtbColt;
|
||||
}
|
||||
|
||||
public SpostaArtsTraULRequestDTO setDestinationMtbColt(MtbColt destinationMtbColt) {
|
||||
this.destinationMtbColt = destinationMtbColt;
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -303,6 +312,8 @@ public class SettingsManager {
|
||||
return clazz.cast(value.getValue());
|
||||
} else if(clazz == Boolean.class) {
|
||||
return clazz.cast("S".equalsIgnoreCase(value.getValue()));
|
||||
} else if(clazz == Integer.class) {
|
||||
return clazz.cast(Integer.parseInt(value.getValue()));
|
||||
} else return null;
|
||||
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -173,7 +173,7 @@ public class AccettazionePickingViewModel {
|
||||
public void retrieveExistentLU(RunnableArgs<ArrayList<RecoverMtbColt>> onComplete) {
|
||||
this.sendOnLoadingStarted();
|
||||
|
||||
this.mAccettazionePickingRESTConsumer.getBancaliGiaRegistrati(this.mSitArts, mtbColtList -> {
|
||||
this.mAccettazionePickingRESTConsumer.getBancaliGiaRegistrati(this.mOrders, mtbColtList -> {
|
||||
this.sendOnLoadingEnded();
|
||||
onComplete.run(mtbColtList);
|
||||
}, this::sendError);
|
||||
|
||||
@@ -16,7 +16,7 @@ import it.integry.integrywmsnative.core.rest.consumers.SystemRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityDate;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityLogger;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityQuery;
|
||||
import it.integry.integrywmsnative.gest.accettazione.dto.SitArtOrdDTO;
|
||||
import it.integry.integrywmsnative.gest.accettazione.dto.OrdineAccettazioneInevasoDTO;
|
||||
|
||||
@Singleton
|
||||
public class AccettazionePickingRESTConsumer {
|
||||
@@ -28,18 +28,18 @@ public class AccettazionePickingRESTConsumer {
|
||||
this.mSystemRestConsumer = systemRESTConsumer;
|
||||
}
|
||||
|
||||
public void getBancaliGiaRegistrati(List<SitArtOrdDTO> ordiniToShow, RunnableArgs<ArrayList<RecoverMtbColt>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
public void getBancaliGiaRegistrati(List<OrdineAccettazioneInevasoDTO> ordiniToShow, RunnableArgs<ArrayList<RecoverMtbColt>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
List<HashMap<String, Object>> whereCondListMap = new ArrayList<>();
|
||||
|
||||
Stream
|
||||
.of(ordiniToShow)
|
||||
.distinctBy(x -> x.getDataOrd() + " " + x.getGestione() + " " + x.getNumOrd())
|
||||
.distinctBy(x -> x.getData() + " " + x.getGestione() + " " + x.getNumero())
|
||||
.forEach(x -> {
|
||||
try {
|
||||
HashMap<String, Object> whereCondMap = new HashMap<>();
|
||||
whereCondMap.put("mtb_colr.data_ord", UtilityDate.recognizeDate(x.getDataOrd()));
|
||||
whereCondMap.put("mtb_colr.data_ord", UtilityDate.recognizeDate(x.getData()));
|
||||
whereCondMap.put("mtb_colr.gestione", x.getGestione().equalsIgnoreCase("P") ? "L" : x.getGestione());
|
||||
whereCondMap.put("mtb_colr.num_ord", x.getNumOrd());
|
||||
whereCondMap.put("mtb_colr.num_ord", x.getNumero());
|
||||
|
||||
whereCondListMap.add(whereCondMap);
|
||||
} catch (Exception ex) {
|
||||
|
||||
@@ -63,7 +63,7 @@ public class ListaBancaliViewModel implements IRecyclerItemClicked<MtbColt> {
|
||||
ColliMagazzinoRESTConsumer.getByTestataStatic(item, mLoadOnlyResiduo, false, mtbColt -> {
|
||||
|
||||
ObservableArrayList<MtbColr> mtbColrObservableArrayList = new ObservableArrayList<>();
|
||||
mtbColrObservableArrayList.addAll(mtbColt.getMtbColr());
|
||||
if(mtbColt != null && mtbColt.getMtbColr() != null) mtbColrObservableArrayList.addAll(mtbColt.getMtbColr());
|
||||
item.setMtbColr(mtbColrObservableArrayList);
|
||||
|
||||
progress.dismiss();
|
||||
|
||||
@@ -125,6 +125,9 @@ public class OrdiniUscitaElencoFragment extends BaseFragment implements ITitledF
|
||||
this.initRecyclerView();
|
||||
this.initBarcodeReader();
|
||||
|
||||
String codMdep = SettingsManager.i().getUserSession().getDepo().getCodMdep();
|
||||
mViewModel.init(codMdep, mCurrentGestioneOrd, mCurrentGestioneCol, mCurrentSegnoCol);
|
||||
|
||||
return mBindings.getRoot();
|
||||
}
|
||||
|
||||
@@ -132,8 +135,9 @@ public class OrdiniUscitaElencoFragment extends BaseFragment implements ITitledF
|
||||
public void onStart() {
|
||||
super.onStart();
|
||||
|
||||
String codMdep = SettingsManager.i().getUserSession().getDepo().getCodMdep();
|
||||
mViewModel.init(codMdep, mCurrentGestioneOrd, mCurrentGestioneCol, mCurrentSegnoCol);
|
||||
if(mAppliedFilterViewModel != null) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -132,17 +132,25 @@ public class OrdiniUscitaElencoAdapter extends SectionedRecyclerViewAdapter<Ordi
|
||||
holder.mBinding.emptyView.setBackgroundColor(listModel.getEtichettaColor());
|
||||
else holder.mBinding.emptyView.setBackgroundColor(ResourcesCompat.getColor(mContext.getResources(), android.R.color.transparent, null));
|
||||
|
||||
if(!UtilityString.isNullOrEmpty(listModel.getDescription()))
|
||||
if(!UtilityString.isNullOrEmpty(listModel.getDescription())) {
|
||||
holder.mBinding.descrizione.setText(Html.fromHtml(listModel.getDescription()));
|
||||
holder.mBinding.descrizione.setVisibility(View.VISIBLE);
|
||||
} else holder.mBinding.descrizione.setVisibility(View.GONE);
|
||||
|
||||
if(!UtilityString.isNullOrEmpty(listModel.getSubDescription()))
|
||||
if(!UtilityString.isNullOrEmpty(listModel.getSubDescription())) {
|
||||
holder.mBinding.subDescrizione.setText(Html.fromHtml(listModel.getSubDescription()));
|
||||
holder.mBinding.subDescrizione.setVisibility(View.VISIBLE);
|
||||
} else holder.mBinding.subDescrizione.setVisibility(View.GONE);
|
||||
|
||||
if(!UtilityString.isNullOrEmpty(listModel.getRightDescription()))
|
||||
if(!UtilityString.isNullOrEmpty(listModel.getRightDescription())) {
|
||||
holder.mBinding.rightDescrizione.setText(Html.fromHtml(listModel.getRightDescription()));
|
||||
holder.mBinding.rightDescrizione.setVisibility(View.VISIBLE);
|
||||
} else holder.mBinding.rightDescrizione.setVisibility(View.GONE);
|
||||
|
||||
if(!UtilityString.isNullOrEmpty(listModel.getRightSubDescription()))
|
||||
if(!UtilityString.isNullOrEmpty(listModel.getRightSubDescription())) {
|
||||
holder.mBinding.rightSubDescrizione.setText(Html.fromHtml(listModel.getRightSubDescription()));
|
||||
holder.mBinding.rightSubDescrizione.setVisibility(View.VISIBLE);
|
||||
} else holder.mBinding.rightSubDescrizione.setVisibility(View.GONE);
|
||||
|
||||
holder.mBinding.setSelected(listModel.getSelectedObservable());
|
||||
holder.mBinding.executePendingBindings();
|
||||
|
||||
@@ -53,8 +53,7 @@ import it.integry.integrywmsnative.gest.spedizione.model.PickedQuantityDTO;
|
||||
import it.integry.integrywmsnative.gest.spedizione.model.PickingObjectDTO;
|
||||
import it.integry.integrywmsnative.ui.ElevatedToolbar;
|
||||
import it.integry.integrywmsnative.view.bottom_sheet__mtb_colr_edit.BottomSheetMtbColrEditView;
|
||||
import it.integry.integrywmsnative.view.dialogs.DialogConsts;
|
||||
import it.integry.integrywmsnative.view.dialogs.ask_cliente.DialogAskCliente;
|
||||
import it.integry.integrywmsnative.view.dialogs.ask_cliente.DialogAskClienteView;
|
||||
import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleMessageView;
|
||||
import it.integry.integrywmsnative.view.dialogs.choose_arts_from_lista_arts.DialogChooseArtsFromListaArts;
|
||||
import it.integry.integrywmsnative.view.dialogs.input_quantity_v2.DialogInputQuantityV2DTO;
|
||||
@@ -290,13 +289,8 @@ public class PickingLiberoFragment extends BaseFragment implements ITitledFragme
|
||||
|
||||
@Override
|
||||
public void onLUClienteRequired(RunnableArgss<VtbDest, String> onComplete, Runnable onAbort) {
|
||||
DialogAskCliente.makeBase(getActivity(), (status, result, codJcom) -> {
|
||||
if (status == DialogConsts.Results.YES) {
|
||||
onComplete.run(result, codJcom);
|
||||
} else {
|
||||
onAbort.run();
|
||||
}
|
||||
}).show();
|
||||
DialogAskClienteView.newInstance(onComplete, onAbort)
|
||||
.show(getActivity().getSupportFragmentManager(), "tag");
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -305,7 +299,7 @@ public class PickingLiberoFragment extends BaseFragment implements ITitledFragme
|
||||
onAbort.run();
|
||||
BarcodeManager.enable();
|
||||
})
|
||||
.show();
|
||||
.show();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -368,7 +362,6 @@ public class PickingLiberoFragment extends BaseFragment implements ITitledFragme
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void onMtbColrEdit(MtbColr mtbColr) {
|
||||
this.mViewModel.dispatchRowEdit(mtbColr);
|
||||
@@ -382,7 +375,7 @@ public class PickingLiberoFragment extends BaseFragment implements ITitledFragme
|
||||
@Override
|
||||
public void onPreDestroy(Runnable onComplete) {
|
||||
BarcodeManager.removeCallback(barcodeScannerIstanceID);
|
||||
if(thereIsAnOpenedUL.get()) mViewModel.closeLU(onComplete);
|
||||
if (thereIsAnOpenedUL.get()) mViewModel.closeLU(onComplete);
|
||||
else onComplete.run();
|
||||
}
|
||||
|
||||
|
||||
@@ -179,7 +179,9 @@ public class PickingLiberoViewModel {
|
||||
|
||||
public void createNewLU(Integer customNumCollo, String customSerCollo, Runnable onComplete) {
|
||||
if (this.mFlagAskCliente) {
|
||||
this.sendOnLoadingEnded();
|
||||
this.sendLUClienteRequired((vtbDest, codJcom) -> {
|
||||
this.sendOnLoadingStarted();
|
||||
createNewLU_PostClienteAsk(customNumCollo, customSerCollo, vtbDest, codJcom, onComplete);
|
||||
}, onComplete);
|
||||
} else {
|
||||
@@ -646,8 +648,6 @@ public class PickingLiberoViewModel {
|
||||
.setQtaCol(qtaTot)
|
||||
.setPartitaMag(partitaMag)
|
||||
.setDataScadPartita(dataScad)
|
||||
.setUtente(SettingsManager.i().getUser().getFullname())
|
||||
.setCausale(MtbColr.Causale.RETTIFICA)
|
||||
.setDatetimeRow(UtilityDate.getDateInstance());
|
||||
|
||||
mtbColt.getMtbColr().add(mtbColr);
|
||||
|
||||
@@ -45,7 +45,7 @@ import it.integry.integrywmsnative.view.dialogs.DialogCommon;
|
||||
import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleMessageView;
|
||||
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.DialogScanOrCreateLU;
|
||||
import it.integry.integrywmsnative.view.dialogs.scan_or_create_lu.DialogScanOrCreateLUView;
|
||||
|
||||
public class ProdRecuperoMaterialeViewModel {
|
||||
|
||||
@@ -369,7 +369,8 @@ public class ProdRecuperoMaterialeViewModel {
|
||||
};
|
||||
|
||||
if (sourceMtbColt != null) saveRunnable.run(sourceMtbColt, false);
|
||||
else DialogScanOrCreateLU.make(mContext, true, false, saveRunnable).show();
|
||||
else DialogScanOrCreateLUView.newInstance(true, false, saveRunnable)
|
||||
.show(mContext.getSupportFragmentManager(), "tag");
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
package it.integry.integrywmsnative.gest.prod_versamento_materiale.viewmodel;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.text.Html;
|
||||
import android.text.SpannableString;
|
||||
import android.view.View;
|
||||
@@ -10,6 +8,7 @@ import android.widget.Toast;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.databinding.ObservableField;
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -46,13 +45,13 @@ import it.integry.integrywmsnative.view.dialogs.DialogCommon;
|
||||
import it.integry.integrywmsnative.view.dialogs.DialogConsts;
|
||||
import it.integry.integrywmsnative.view.dialogs.ask_position_of_lu.DialogAskPositionOfLU;
|
||||
import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleMessageView;
|
||||
import it.integry.integrywmsnative.view.dialogs.scan_or_create_lu.DialogScanOrCreateLU;
|
||||
import it.integry.integrywmsnative.view.dialogs.scan_or_create_lu.DialogScanOrCreateLUView;
|
||||
|
||||
|
||||
public class ProdVersamentoMaterialViewModel {
|
||||
|
||||
|
||||
private Context mContext;
|
||||
private FragmentActivity mContext;
|
||||
|
||||
private FragmentProdVersamentoMaterialeBinding mBinding;
|
||||
private ProdVersamentoMaterialHelper mHelper;
|
||||
@@ -63,7 +62,7 @@ public class ProdVersamentoMaterialViewModel {
|
||||
public MtbColr mMtbColr;
|
||||
|
||||
|
||||
public void init(Activity context, FragmentProdVersamentoMaterialeBinding binding, ProdVersamentoMaterialHelper helper, Runnable onVersamentoCompleted) {
|
||||
public void init(FragmentActivity context, FragmentProdVersamentoMaterialeBinding binding, ProdVersamentoMaterialHelper helper, Runnable onVersamentoCompleted) {
|
||||
mContext = context;
|
||||
mBinding = binding;
|
||||
mHelper = helper;
|
||||
@@ -91,7 +90,7 @@ public class ProdVersamentoMaterialViewModel {
|
||||
}
|
||||
|
||||
public void openLU() {
|
||||
DialogScanOrCreateLU.make(mContext, false, false, true, false, (mtbColt, created) -> {
|
||||
DialogScanOrCreateLUView.newInstance(false, false, true, false, (mtbColt, created) -> {
|
||||
if (mtbColt == null) {
|
||||
((IPoppableActivity) mContext).pop();
|
||||
} else if ((mtbColt.getGestioneEnum() == GestioneEnum.ACQUISTO || mtbColt.getGestioneEnum() == GestioneEnum.LAVORAZIONE || mtbColt.getGestioneEnum() == GestioneEnum.VENDITA) && mtbColt.getSegno().equals(+1)) {
|
||||
@@ -100,7 +99,7 @@ public class ProdVersamentoMaterialViewModel {
|
||||
DialogSimpleMessageView.makeWarningDialog(
|
||||
new SpannableString(Html.fromHtml("E' stata scansionata una UL già vuota")),
|
||||
null, this::openLU)
|
||||
.show(((AppCompatActivity) mContext).getSupportFragmentManager(), "tag");
|
||||
.show((mContext).getSupportFragmentManager(), "tag");
|
||||
|
||||
} else {
|
||||
setMtbColt(mtbColt);
|
||||
@@ -110,9 +109,9 @@ public class ProdVersamentoMaterialViewModel {
|
||||
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(((AppCompatActivity) mContext).getSupportFragmentManager(), "tag");
|
||||
.show((mContext).getSupportFragmentManager(), "tag");
|
||||
}
|
||||
}).show();
|
||||
}).show(mContext.getSupportFragmentManager(), "tag");
|
||||
}
|
||||
|
||||
private void choosePosition() {
|
||||
|
||||
@@ -64,7 +64,7 @@ import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleMessageView;
|
||||
import it.integry.integrywmsnative.view.dialogs.choose_art_from_lista_arts.DialogChooseArtFromListaArts;
|
||||
import it.integry.integrywmsnative.view.dialogs.input_quantity_v2.DialogInputQuantityV2View;
|
||||
import it.integry.integrywmsnative.view.dialogs.input_quantity_v2.DialogInputQuantityV2DTO;
|
||||
import it.integry.integrywmsnative.view.dialogs.scan_or_create_lu.DialogScanOrCreateLU;
|
||||
import it.integry.integrywmsnative.view.dialogs.scan_or_create_lu.DialogScanOrCreateLUView;
|
||||
import it.integry.integrywmsnative.view.dialogs.yes_no.DialogYesNo;
|
||||
|
||||
public class RettificaGiacenzeFragment extends Fragment implements ITitledFragment, ILifecycleFragment, RettificaGiacenzeViewModel.Listener, BottomSheetMtbColrEditView.Listener {
|
||||
@@ -329,13 +329,13 @@ public class RettificaGiacenzeFragment extends Fragment implements ITitledFragme
|
||||
|
||||
@Override
|
||||
public void onLUOpenRequest(RunnableArgss<MtbColt, Boolean> onComplete) {
|
||||
DialogScanOrCreateLU.make(getActivity(), true, false, (mtbColt, created) -> {
|
||||
DialogScanOrCreateLUView.newInstance(true, false, (mtbColt, created) -> {
|
||||
if (mtbColt == null) {
|
||||
((IPoppableActivity) getActivity()).pop();
|
||||
} else {
|
||||
onComplete.run(mtbColt, created);
|
||||
}
|
||||
}).show();
|
||||
}).show(getActivity().getSupportFragmentManager(), "tag");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1594,7 +1594,8 @@ public class SpedizioneViewModel {
|
||||
|
||||
IOrdiniVendita ordiniVendita = ClassRouter.getInstance(ClassRouter.PATH.ORDINI_VENDITA);
|
||||
ordiniVendita.distribuisciCollo(cloneMtbColt, mTestateOrdini, mtbColts -> {
|
||||
mColliMagazzinoRESTConsumer.getMultipleByTestate(mtbColts, false, onComplete, this::sendError);
|
||||
mColliMagazzinoRESTConsumer.fillMtbAartsOfMtbColts(mtbColts, onComplete, this::sendError);
|
||||
// mColliMagazzinoRESTConsumer.getMultipleByTestate(mtbColts, false, onComplete, this::sendError);
|
||||
}, this::sendError);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
package it.integry.integrywmsnative.gest.versamento_merce;
|
||||
|
||||
import dagger.Subcomponent;
|
||||
|
||||
@Subcomponent
|
||||
public interface VersamentoMerceComponent {
|
||||
|
||||
@Subcomponent.Factory
|
||||
interface Factory {
|
||||
VersamentoMerceComponent create();
|
||||
}
|
||||
|
||||
|
||||
void inject(VersamentoMerceFragment versamentoMerceFragment);
|
||||
|
||||
}
|
||||
@@ -2,90 +2,143 @@ package it.integry.integrywmsnative.gest.versamento_merce;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.text.Html;
|
||||
import android.text.SpannableString;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.appcompat.widget.AppCompatTextView;
|
||||
import androidx.databinding.DataBindingUtil;
|
||||
import androidx.fragment.app.Fragment;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import it.integry.barcode_base_android_library.model.BarcodeScanDTO;
|
||||
import it.integry.integrywmsnative.MainApplication;
|
||||
import it.integry.integrywmsnative.R;
|
||||
import it.integry.integrywmsnative.core.barcode_reader.BarcodeCallbackDTO;
|
||||
import it.integry.integrywmsnative.core.barcode_reader.BarcodeManager;
|
||||
import it.integry.integrywmsnative.core.expansion.BaseFragment;
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
import it.integry.integrywmsnative.core.interfaces.IPoppableActivity;
|
||||
import it.integry.integrywmsnative.core.interfaces.ITitledFragment;
|
||||
import it.integry.integrywmsnative.core.model.MtbAart;
|
||||
import it.integry.integrywmsnative.core.model.MtbColr;
|
||||
import it.integry.integrywmsnative.core.model.MtbDepoPosizione;
|
||||
import it.integry.integrywmsnative.core.model.secondary.GestioneEnum;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityExceptions;
|
||||
import it.integry.integrywmsnative.databinding.FragmentMainVersamentoMerceBinding;
|
||||
import it.integry.integrywmsnative.gest.versamento_merce.core.VersamentoMerceHelper;
|
||||
import it.integry.integrywmsnative.gest.versamento_merce.viewmodel.VersamentoMerceViewModel;
|
||||
import it.integry.integrywmsnative.gest.spedizione.model.PickedQuantityDTO;
|
||||
import it.integry.integrywmsnative.view.dialogs.DialogAskLivelloPosizione;
|
||||
import it.integry.integrywmsnative.view.dialogs.DialogCommon;
|
||||
import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleMessageView;
|
||||
import it.integry.integrywmsnative.view.dialogs.choose_arts_from_lista_arts.DialogChooseArtsFromListaArts;
|
||||
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;
|
||||
|
||||
public class VersamentoMerceFragment extends Fragment implements ITitledFragment {
|
||||
public class VersamentoMerceFragment extends BaseFragment implements ITitledFragment, VersamentoMerceViewModel.Listener {
|
||||
|
||||
private FragmentMainVersamentoMerceBinding mBinding;
|
||||
private VersamentoMerceViewModel mVersamentoMerceViewModel;
|
||||
private VersamentoMerceHelper mHelper;
|
||||
|
||||
@Inject
|
||||
VersamentoMerceViewModel mViewModel;
|
||||
|
||||
private FragmentMainVersamentoMerceBinding mBindings = null;
|
||||
|
||||
private final List<Runnable> mOnPreDestroyList = new ArrayList<>();
|
||||
|
||||
private int barcodeScannerIstanceID = -1;
|
||||
|
||||
public VersamentoMerceFragment() {
|
||||
// Required empty public constructor
|
||||
}
|
||||
|
||||
|
||||
public static VersamentoMerceFragment newInstance() {
|
||||
VersamentoMerceFragment fragment = new VersamentoMerceFragment();
|
||||
return fragment;
|
||||
return new VersamentoMerceFragment();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
mVersamentoMerceViewModel = new VersamentoMerceViewModel();
|
||||
barcodeScannerIstanceID = BarcodeManager.addCallback(new BarcodeCallbackDTO()
|
||||
.setOnScanSuccessfull(mVersamentoMerceViewModel.onScanSuccessfull)
|
||||
.setOnScanFailed(ex -> UtilityExceptions.defaultException(getActivity(), ex, false)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
mBinding = DataBindingUtil.inflate(inflater, R.layout.fragment_main_versamento_merce, container, false);
|
||||
|
||||
mBinding.setView(this);
|
||||
mBinding.setViewmodel(mVersamentoMerceViewModel);
|
||||
mBindings = DataBindingUtil.inflate(inflater, R.layout.fragment_main_versamento_merce, container, false);
|
||||
|
||||
init();
|
||||
return mBinding.getRoot();
|
||||
}
|
||||
MainApplication.appComponent
|
||||
.versamentoMerceComponent()
|
||||
.create()
|
||||
.inject(this);
|
||||
|
||||
private void init() {
|
||||
mHelper = new VersamentoMerceHelper(getActivity());
|
||||
mVersamentoMerceViewModel.init(getActivity(), mBinding, mHelper, () -> {
|
||||
((IPoppableActivity) getActivity()).pop();
|
||||
});
|
||||
mViewModel.setListener(this);
|
||||
|
||||
mVersamentoMerceViewModel.openLU();
|
||||
mBindings.setLifecycleOwner(this);
|
||||
mBindings.setView(this);
|
||||
mBindings.setViewmodel(mViewModel);
|
||||
|
||||
this.initBarcodeReader();
|
||||
|
||||
this.openLU();
|
||||
|
||||
return mBindings.getRoot();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
BarcodeManager.removeCallback(barcodeScannerIstanceID);
|
||||
|
||||
for(Runnable onPreDestroy : mOnPreDestroyList) {
|
||||
for (Runnable onPreDestroy : mOnPreDestroyList) {
|
||||
onPreDestroy.run();
|
||||
}
|
||||
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void openLU() {
|
||||
DialogScanOrCreateLUView.newInstance(true, false, true, false, (mtbColt, created) -> {
|
||||
if (mtbColt == null) {
|
||||
((IPoppableActivity) getActivity()).pop();
|
||||
} else if ((mtbColt.getGestioneEnum() == GestioneEnum.ACQUISTO || mtbColt.getGestioneEnum() == GestioneEnum.LAVORAZIONE) && mtbColt.getSegno().equals(+1)) {
|
||||
this.mViewModel.getCurrentMtbColt().postValue(mtbColt);
|
||||
} 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");
|
||||
}
|
||||
}).show(getActivity().getSupportFragmentManager(), "tag");
|
||||
}
|
||||
|
||||
|
||||
private void initBarcodeReader() {
|
||||
barcodeScannerIstanceID = BarcodeManager.addCallback(new BarcodeCallbackDTO()
|
||||
.setOnScanSuccessfull(onScanSuccessful)
|
||||
.setOnScanFailed(ex -> UtilityExceptions.defaultException(getActivity(), ex, false)));
|
||||
|
||||
BarcodeManager.enable();
|
||||
}
|
||||
|
||||
private final RunnableArgs<BarcodeScanDTO> onScanSuccessful = data -> {
|
||||
BarcodeManager.disable();
|
||||
this.openProgress();
|
||||
|
||||
this.mViewModel.processBarcodeDTO(data, () -> {
|
||||
BarcodeManager.enable();
|
||||
this.closeProgress();
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@Override
|
||||
public void onCreateActionBar(AppCompatTextView titleText, Context context) {
|
||||
titleText.setText(context.getText(R.string.versamento_merce_fragment_title).toString());
|
||||
@@ -95,4 +148,93 @@ public class VersamentoMerceFragment extends Fragment implements ITitledFragment
|
||||
public void addOnPreDestroy(Runnable onPreDestroy) {
|
||||
this.mOnPreDestroyList.add(onPreDestroy);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadingStarted() {
|
||||
BarcodeManager.disable();
|
||||
this.openProgress();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadingEnded() {
|
||||
this.closeProgress();
|
||||
BarcodeManager.enable();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLivelloPosizioneRequired(MtbDepoPosizione posizione, RunnableArgs<MtbDepoPosizione> onComplete) {
|
||||
DialogAskLivelloPosizione.make(getActivity(), posizione, false, onComplete, this::onError);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSpostamentoTraDepConfirmRequired(String sourceCodMdep, String destinationCodMdep, RunnableArgs<Boolean> onComplete) {
|
||||
DialogSimpleMessageView.makeWarningDialog(Html.fromHtml("Stai spostando una UL dal deposito <b>" + sourceCodMdep + "</b> al deposito <b>" + destinationCodMdep + "</b>"),
|
||||
null,
|
||||
() -> onComplete.run(true),
|
||||
() -> onComplete.run(false))
|
||||
.show(getActivity().getSupportFragmentManager(), "tag");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onArtsChooseRequired(List<MtbColr> mtbColrList, RunnableArgs<List<MtbColr>> onComplete, Runnable onAbort) {
|
||||
|
||||
DialogChooseArtsFromListaArts.make(getActivity(), mtbColrList, onComplete, onAbort).show();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onItemDispatched(MtbAart mtbAart,
|
||||
BigDecimal initialNumCnf,
|
||||
BigDecimal initialQtaCnf,
|
||||
BigDecimal initialQtaTot,
|
||||
BigDecimal totalQtaAvailable,
|
||||
BigDecimal totalNumCnfAvailable,
|
||||
BigDecimal qtaCnfAvailable,
|
||||
String partitaMag,
|
||||
Date dataScad,
|
||||
boolean canOverflowOrderQuantity,
|
||||
boolean canBatchLotBeChanged,
|
||||
RunnableArgs<PickedQuantityDTO> onComplete) {
|
||||
DialogInputQuantityV2DTO dialogInputQuantityV2DTO = new DialogInputQuantityV2DTO()
|
||||
.setMtbAart(mtbAart)
|
||||
.setInitialNumCnf(initialNumCnf)
|
||||
.setInitialQtaCnf(initialQtaCnf)
|
||||
.setInitialQtaTot(initialQtaTot)
|
||||
.setTotalQtaAvailable(totalQtaAvailable)
|
||||
.setTotalNumCnfAvailable(totalNumCnfAvailable)
|
||||
.setQtaCnfAvailable(qtaCnfAvailable)
|
||||
.setPartitaMag(partitaMag)
|
||||
.setDataScad(dataScad)
|
||||
.setCanOverflowOrderQuantity(canOverflowOrderQuantity)
|
||||
.setCanPartitaMagBeChanged(canBatchLotBeChanged)
|
||||
.setCanLUBeClosed(false);
|
||||
|
||||
DialogInputQuantityV2View
|
||||
.newInstance(dialogInputQuantityV2DTO, (resultDTO, shouldCloseLU) -> {
|
||||
|
||||
PickedQuantityDTO pickedQuantityDTO = new PickedQuantityDTO()
|
||||
.setNumCnf(resultDTO.getNumCnf())
|
||||
.setQtaCnf(resultDTO.getQtaCnf())
|
||||
.setQtaTot(resultDTO.getQtaTot())
|
||||
.setPartitaMag(resultDTO.getPartitaMag())
|
||||
.setDataScad(resultDTO.getDataScad());
|
||||
|
||||
onComplete.run(pickedQuantityDTO);
|
||||
|
||||
}, this::onLoadingEnded)
|
||||
.show(getActivity().getSupportFragmentManager(), "tag");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDataSaved() {
|
||||
DialogCommon.showDataSaved(getActivity(), () -> {
|
||||
((IPoppableActivity) getActivity()).pop();
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Exception ex) {
|
||||
this.closeProgress();
|
||||
UtilityExceptions.defaultException(getActivity(), ex, mCurrentProgress);
|
||||
BarcodeManager.enable();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
package it.integry.integrywmsnative.gest.versamento_merce;
|
||||
|
||||
import dagger.Module;
|
||||
import dagger.Provides;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.BarcodeRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.ColliMagazzinoRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.PosizioniRESTConsumer;
|
||||
|
||||
@Module(subcomponents = VersamentoMerceComponent.class)
|
||||
public class VersamentoMerceModule {
|
||||
|
||||
@Provides
|
||||
VersamentoMerceViewModel providesVersamentoMerceViewModel(ColliMagazzinoRESTConsumer colliMagazzinoRESTConsumer, BarcodeRESTConsumer barcodeRESTConsumer, PosizioniRESTConsumer posizioniRESTConsumer) {
|
||||
return new VersamentoMerceViewModel(colliMagazzinoRESTConsumer, barcodeRESTConsumer, posizioniRESTConsumer);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,359 @@
|
||||
package it.integry.integrywmsnative.gest.versamento_merce;
|
||||
|
||||
import androidx.databinding.ObservableArrayList;
|
||||
import androidx.lifecycle.MutableLiveData;
|
||||
|
||||
import com.annimon.stream.Stream;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import it.integry.barcode_base_android_library.model.BarcodeScanDTO;
|
||||
import it.integry.integrywmsnative.core.exception.InvalidLUGestioneException;
|
||||
import it.integry.integrywmsnative.core.exception.NoArtsInLUException;
|
||||
import it.integry.integrywmsnative.core.exception.NoLUFoundException;
|
||||
import it.integry.integrywmsnative.core.exception.TooManyLUFoundInMonoLUPositionException;
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
import it.integry.integrywmsnative.core.interfaces.viewmodel_listeners.ILoadingListener;
|
||||
import it.integry.integrywmsnative.core.model.MtbAart;
|
||||
import it.integry.integrywmsnative.core.model.MtbColr;
|
||||
import it.integry.integrywmsnative.core.model.MtbColt;
|
||||
import it.integry.integrywmsnative.core.model.MtbDepoPosizione;
|
||||
import it.integry.integrywmsnative.core.model.secondary.GestioneEnum;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.BarcodeRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.ColliMagazzinoRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.PosizioniRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityBarcode;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityDate;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityPosizione;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityString;
|
||||
import it.integry.integrywmsnative.gest.spedizione.model.PickedQuantityDTO;
|
||||
|
||||
public class VersamentoMerceViewModel {
|
||||
|
||||
private final MutableLiveData<MtbColt> mCurrentMtbColt = new MutableLiveData<>();
|
||||
|
||||
private Listener mListener;
|
||||
|
||||
private final ColliMagazzinoRESTConsumer mColliMagazzinoRESTConsumer;
|
||||
private final BarcodeRESTConsumer mBarcodeRESTConsumer;
|
||||
private final PosizioniRESTConsumer mPosizioniRESTConsumer;
|
||||
|
||||
@Inject
|
||||
public VersamentoMerceViewModel(ColliMagazzinoRESTConsumer colliMagazzinoRESTConsumer, BarcodeRESTConsumer barcodeRESTConsumer, PosizioniRESTConsumer posizioniRESTConsumer) {
|
||||
this.mColliMagazzinoRESTConsumer = colliMagazzinoRESTConsumer;
|
||||
this.mBarcodeRESTConsumer = barcodeRESTConsumer;
|
||||
this.mPosizioniRESTConsumer = posizioniRESTConsumer;
|
||||
}
|
||||
|
||||
|
||||
public void processBarcodeDTO(BarcodeScanDTO barcodeScanDTO, Runnable onComplete) {
|
||||
|
||||
if (UtilityBarcode.isEtichettaPosizione(barcodeScanDTO, false)) {
|
||||
this.executeEtichettaPosizione(barcodeScanDTO, onComplete);
|
||||
} else if (UtilityBarcode.isEtichettaAnonima(barcodeScanDTO)) {
|
||||
this.executeEtichettaLU(barcodeScanDTO.getStringValue(), true, onComplete);
|
||||
} else if (UtilityBarcode.isEtichetta128(barcodeScanDTO)) {
|
||||
this.executeEtichettaEan128(barcodeScanDTO, onComplete);
|
||||
} else {
|
||||
onComplete.run();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void executeEtichettaPosizione(BarcodeScanDTO barcodeScanDTO, Runnable onComplete) {
|
||||
MtbDepoPosizione foundPosizione = Stream.of(SettingsManager.iDB().getAvailablePosizioni())
|
||||
.filter(x -> x.getPosizione().equalsIgnoreCase(barcodeScanDTO.getStringValue()))
|
||||
.single();
|
||||
|
||||
if (foundPosizione.isFlagMonoCollo()) {
|
||||
this.mPosizioniRESTConsumer.getBancaliInPosizione(foundPosizione, mtbColtList -> {
|
||||
|
||||
if (mtbColtList == null || mtbColtList.size() == 0) {
|
||||
this.sendError(new NoLUFoundException());
|
||||
} else if (mtbColtList.size() == 1) {
|
||||
mColliMagazzinoRESTConsumer.getByTestata(mtbColtList.get(0), true, false, mtbColt -> {
|
||||
|
||||
onComplete.run();
|
||||
//TAKE HERE
|
||||
pickMerceULtoUL(mtbColt);
|
||||
|
||||
}, this::sendError);
|
||||
} else {
|
||||
this.sendError(new TooManyLUFoundInMonoLUPositionException());
|
||||
}
|
||||
}, this::sendError);
|
||||
} else {
|
||||
|
||||
if (!UtilityString.equalsIgnoreCase(mCurrentMtbColt.getValue().getCodMdep(), foundPosizione.getCodMdep())) {
|
||||
this.sendOnSpostamentoTraDepConfirmRequired(mCurrentMtbColt.getValue().getCodMdep(), foundPosizione.getCodMdep(), canContinue -> {
|
||||
if (canContinue) {
|
||||
updatePosizione(foundPosizione, UtilityPosizione.isPosizioneWithLivello(foundPosizione));
|
||||
} else {
|
||||
onComplete.run();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
updatePosizione(foundPosizione, UtilityPosizione.isPosizioneWithLivello(foundPosizione));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void executeEtichettaEan128(BarcodeScanDTO barcodeScanDTO, Runnable onBarcodeScanComplete) {
|
||||
this.mBarcodeRESTConsumer.decodeEan128(barcodeScanDTO, ean128Model -> {
|
||||
|
||||
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(barcodeProd)) {
|
||||
|
||||
if (!UtilityString.isNullOrEmpty(ean128Model.Sscc)) {
|
||||
this.executeEtichettaLU(ean128Model.Sscc, false, onBarcodeScanComplete);
|
||||
} else {
|
||||
this.sendError(new NoLUFoundException());
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
//EAN 128 non completo o comunque mancano i riferimenti al prodotto
|
||||
onBarcodeScanComplete.run();
|
||||
}
|
||||
}, this::sendError);
|
||||
}
|
||||
|
||||
|
||||
private void executeEtichettaLU(String sscc, boolean isAnonima, Runnable onComplete) {
|
||||
this.mColliMagazzinoRESTConsumer.getBySSCC(sscc, true, false, mtbColt -> {
|
||||
|
||||
if (mtbColt == null && !isAnonima) {
|
||||
this.sendError(new NoLUFoundException());
|
||||
} else if (mtbColt != null && (/*mtbColt.getGestioneEnum() == GestioneEnum.ACQUISTO ||*/ mtbColt.getGestioneEnum() == GestioneEnum.VENDITA)) {
|
||||
this.sendError(new InvalidLUGestioneException(GestioneEnum.VENDITA));
|
||||
} else {
|
||||
if (mtbColt == null) {
|
||||
this.mColliMagazzinoRESTConsumer.createColloFromEtichettaAnonima(sscc, GestioneEnum.LAVORAZIONE, mtbColtAnonimo -> {
|
||||
onComplete.run();
|
||||
pickMerceULtoUL(mtbColtAnonimo);
|
||||
}, this::sendError);
|
||||
|
||||
} else {
|
||||
onComplete.run();
|
||||
pickMerceULtoUL(mtbColt);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}, this::sendError);
|
||||
}
|
||||
|
||||
|
||||
private void pickMerceULtoUL(MtbColt destMtbColt) {
|
||||
MtbColt sourceMtbColt = mCurrentMtbColt.getValue();
|
||||
|
||||
if (!UtilityString.equalsIgnoreCase(sourceMtbColt.getCodMdep(), destMtbColt.getCodMdep())) {
|
||||
this.sendError(new Exception("Impossibile spostare la merce tra UL di due depositi differenti"));
|
||||
return;
|
||||
}
|
||||
|
||||
List<MtbColr> mtbColrsToPick = Stream.of(sourceMtbColt.getMtbColr())
|
||||
.filter(x -> x.getQtaCol().floatValue() > 0)
|
||||
.toList();
|
||||
|
||||
if (mtbColrsToPick.size() == 0) {
|
||||
this.sendError(new NoArtsInLUException());
|
||||
return;
|
||||
}
|
||||
|
||||
this.sendOnArtsChooseRequired(mtbColrsToPick, pickedAarts -> {
|
||||
List<MtbColr> destNewMtbColr = new ArrayList<>();
|
||||
|
||||
askQuantities(pickedAarts.iterator(), destNewMtbColr, () -> {
|
||||
|
||||
MtbColt clonedSourceTestata = (MtbColt) sourceMtbColt.clone();
|
||||
clonedSourceTestata.setMtbColr(new ObservableArrayList<>());
|
||||
clonedSourceTestata.getMtbColr().addAll(destNewMtbColr);
|
||||
|
||||
this.sendOnLoadingStarted();
|
||||
|
||||
this.mColliMagazzinoRESTConsumer.spostaArtsTraUL(
|
||||
clonedSourceTestata,
|
||||
destMtbColt,
|
||||
this::sendOnDataSaved,
|
||||
this::sendError
|
||||
);
|
||||
|
||||
}, this::sendOnLoadingEnded);
|
||||
|
||||
}, this::sendOnLoadingEnded);
|
||||
}
|
||||
|
||||
|
||||
private void askQuantities(Iterator<MtbColr> sourceMtbColrs, List<MtbColr> destMtbColr, Runnable onComplete, Runnable onAbort) {
|
||||
|
||||
if (sourceMtbColrs.hasNext()) {
|
||||
askSingleQuantity(sourceMtbColrs.next(), mtbColr -> {
|
||||
destMtbColr.add(mtbColr);
|
||||
askQuantities(sourceMtbColrs, destMtbColr, onComplete, onAbort);
|
||||
}, onAbort);
|
||||
} else {
|
||||
onComplete.run();
|
||||
}
|
||||
}
|
||||
|
||||
private void askSingleQuantity(MtbColr mtbColr, RunnableArgs<MtbColr> onComplete, Runnable onAbort) {
|
||||
this.sendOnItemDispatched(mtbColr.getMtbAart(),
|
||||
mtbColr.getNumCnf(),
|
||||
mtbColr.getQtaCnf(),
|
||||
mtbColr.getQtaCol(),
|
||||
mtbColr.getQtaCol(),
|
||||
mtbColr.getNumCnf(),
|
||||
mtbColr.getQtaCnf(),
|
||||
mtbColr.getPartitaMag(),
|
||||
mtbColr.getDataScadPartitaD(),
|
||||
false,
|
||||
false,
|
||||
pickedQuantity -> {
|
||||
mtbColr
|
||||
.setQtaCol(pickedQuantity.getQtaTot())
|
||||
.setQtaCnf(pickedQuantity.getQtaCnf())
|
||||
.setNumCnf(pickedQuantity.getNumCnf())
|
||||
.setDatetimeRow(UtilityDate.getDateInstance());
|
||||
|
||||
onComplete.run(mtbColr);
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
public void updatePosizione(MtbDepoPosizione mtbDepoPosizione, boolean shouldAskLivello) {
|
||||
|
||||
if (shouldAskLivello) {
|
||||
this.sendOnLivelloPosizioneRequired(mtbDepoPosizione, newPosizione -> {
|
||||
|
||||
if (newPosizione == null) {
|
||||
updatePosizione(mtbDepoPosizione, shouldAskLivello);
|
||||
} else {
|
||||
updatePosizione(newPosizione, false);
|
||||
}
|
||||
|
||||
});
|
||||
} else {
|
||||
this.sendOnLoadingStarted();
|
||||
mColliMagazzinoRESTConsumer.changePosizione(mCurrentMtbColt.getValue(), mtbDepoPosizione, () -> {
|
||||
this.sendOnLoadingEnded();
|
||||
this.sendOnDataSaved();
|
||||
}, this::sendError);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
public MutableLiveData<MtbColt> getCurrentMtbColt() {
|
||||
return mCurrentMtbColt;
|
||||
}
|
||||
|
||||
public VersamentoMerceViewModel setListener(Listener listener) {
|
||||
this.mListener = listener;
|
||||
return this;
|
||||
}
|
||||
|
||||
private void sendOnDataSaved() {
|
||||
if (this.mListener != null) mListener.onDataSaved();
|
||||
}
|
||||
|
||||
private void sendOnLivelloPosizioneRequired(MtbDepoPosizione posizione, RunnableArgs<MtbDepoPosizione> onComplete) {
|
||||
if (this.mListener != null)
|
||||
mListener.onLivelloPosizioneRequired(posizione, onComplete);
|
||||
}
|
||||
|
||||
private void sendOnArtsChooseRequired(List<MtbColr> mtbColrList, RunnableArgs<List<MtbColr>> onComplete, Runnable onAbort) {
|
||||
if (this.mListener != null)
|
||||
mListener.onArtsChooseRequired(mtbColrList, onComplete, onAbort);
|
||||
}
|
||||
|
||||
private void sendOnSpostamentoTraDepConfirmRequired(String sourceCodMdep, String destinationCodMdep, RunnableArgs<Boolean> onComplete) {
|
||||
if (this.mListener != null)
|
||||
mListener.onSpostamentoTraDepConfirmRequired(sourceCodMdep, destinationCodMdep, onComplete);
|
||||
}
|
||||
|
||||
private void sendOnItemDispatched(MtbAart mtbAart,
|
||||
BigDecimal initialNumCnf,
|
||||
BigDecimal initialQtaCnf,
|
||||
BigDecimal initialQtaTot,
|
||||
BigDecimal totalQtaAvailable,
|
||||
BigDecimal totalNumCnfAvailable,
|
||||
BigDecimal qtaCnfAvailable,
|
||||
String partitaMag,
|
||||
Date dataScad,
|
||||
boolean canOverflowOrderQuantity,
|
||||
boolean canBatchLotBeChanged,
|
||||
RunnableArgs<PickedQuantityDTO> onComplete) {
|
||||
if (this.mListener != null) mListener.onItemDispatched(
|
||||
mtbAart,
|
||||
initialNumCnf,
|
||||
initialQtaCnf,
|
||||
initialQtaTot,
|
||||
totalQtaAvailable,
|
||||
totalNumCnfAvailable,
|
||||
qtaCnfAvailable,
|
||||
partitaMag,
|
||||
dataScad,
|
||||
canOverflowOrderQuantity,
|
||||
canBatchLotBeChanged,
|
||||
onComplete);
|
||||
}
|
||||
|
||||
private void sendOnLoadingStarted() {
|
||||
if (this.mListener != null) mListener.onLoadingStarted();
|
||||
}
|
||||
|
||||
private void sendOnLoadingEnded() {
|
||||
if (this.mListener != null) mListener.onLoadingEnded();
|
||||
}
|
||||
|
||||
private void sendError(Exception ex) {
|
||||
if (this.mListener != null) mListener.onError(ex);
|
||||
}
|
||||
|
||||
public interface Listener extends ILoadingListener {
|
||||
|
||||
void onLivelloPosizioneRequired(MtbDepoPosizione posizione, RunnableArgs<MtbDepoPosizione> onComplete);
|
||||
|
||||
void onSpostamentoTraDepConfirmRequired(String sourceCodMdep, String destinationCodMdep, RunnableArgs<Boolean> onComplete);
|
||||
|
||||
void onArtsChooseRequired(List<MtbColr> mtbColrList, RunnableArgs<List<MtbColr>> onComplete, Runnable onAbort);
|
||||
|
||||
void onItemDispatched(MtbAart mtbAart,
|
||||
BigDecimal initialNumCnf,
|
||||
BigDecimal initialQtaCnf,
|
||||
BigDecimal initialQtaTot,
|
||||
BigDecimal totalQtaAvailable,
|
||||
BigDecimal totalNumCnfAvailable,
|
||||
BigDecimal qtaCnfAvailable,
|
||||
String partitaMag,
|
||||
Date dataScad,
|
||||
boolean canOverflowOrderQuantity,
|
||||
boolean canBatchLotBeChanged,
|
||||
RunnableArgs<PickedQuantityDTO> onComplete);
|
||||
|
||||
void onDataSaved();
|
||||
|
||||
void onError(Exception ex);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
package it.integry.integrywmsnative.gest.versamento_merce.core;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
public class VersamentoMerceHelper {
|
||||
|
||||
private Context mContext;
|
||||
|
||||
public VersamentoMerceHelper(Context context) {
|
||||
this.mContext = context;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,477 +0,0 @@
|
||||
package it.integry.integrywmsnative.gest.versamento_merce.viewmodel;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.text.Html;
|
||||
import android.text.SpannableString;
|
||||
|
||||
import androidx.databinding.ObservableArrayList;
|
||||
import androidx.databinding.ObservableField;
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
|
||||
import com.annimon.stream.Stream;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import it.integry.barcode_base_android_library.model.BarcodeScanDTO;
|
||||
import it.integry.barcode_base_android_library.model.BarcodeType;
|
||||
import it.integry.integrywmsnative.R;
|
||||
import it.integry.integrywmsnative.core.barcode_reader.BarcodeManager;
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
import it.integry.integrywmsnative.core.interfaces.IPoppableActivity;
|
||||
import it.integry.integrywmsnative.core.model.CommonModelConsts;
|
||||
import it.integry.integrywmsnative.core.model.MtbColr;
|
||||
import it.integry.integrywmsnative.core.model.MtbColt;
|
||||
import it.integry.integrywmsnative.core.model.MtbDepoPosizione;
|
||||
import it.integry.integrywmsnative.core.model.secondary.GestioneEnum;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.BarcodeRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.ColliMagazzinoRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.PosizioniRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityBarcode;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityDate;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityExceptions;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityPosizione;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityProgress;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityString;
|
||||
import it.integry.integrywmsnative.databinding.FragmentMainVersamentoMerceBinding;
|
||||
import it.integry.integrywmsnative.gest.versamento_merce.core.VersamentoMerceHelper;
|
||||
import it.integry.integrywmsnative.view.dialogs.DialogAskLivelloPosizione;
|
||||
import it.integry.integrywmsnative.view.dialogs.DialogCommon;
|
||||
import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleMessageView;
|
||||
import it.integry.integrywmsnative.view.dialogs.choose_arts_from_lista_arts.DialogChooseArtsFromListaArts;
|
||||
import it.integry.integrywmsnative.view.dialogs.input_quantity_v2.DialogInputQuantityV2View;
|
||||
import it.integry.integrywmsnative.view.dialogs.input_quantity_v2.DialogInputQuantityV2DTO;
|
||||
import it.integry.integrywmsnative.view.dialogs.scan_or_create_lu.DialogScanOrCreateLU;
|
||||
|
||||
public class VersamentoMerceViewModel {
|
||||
|
||||
|
||||
private FragmentActivity mContext;
|
||||
private FragmentMainVersamentoMerceBinding mBinding;
|
||||
private VersamentoMerceHelper mHelper;
|
||||
|
||||
public ObservableField<MtbColt> mtbColt = new ObservableField<>();
|
||||
|
||||
|
||||
private Runnable mOnVersamentoCompleted;
|
||||
|
||||
public void init(FragmentActivity context, FragmentMainVersamentoMerceBinding binding, VersamentoMerceHelper helper, Runnable onVersamentoCompleted) {
|
||||
mContext = context;
|
||||
mBinding = binding;
|
||||
mHelper = helper;
|
||||
mOnVersamentoCompleted = onVersamentoCompleted;
|
||||
|
||||
BarcodeManager.enable();
|
||||
}
|
||||
|
||||
public void openLU() {
|
||||
DialogScanOrCreateLU.make(mContext, true, false, true, false, (mtbColt, created) -> {
|
||||
if (mtbColt == null) {
|
||||
((IPoppableActivity) mContext).pop();
|
||||
} else if ((mtbColt.getGestioneEnum() == GestioneEnum.ACQUISTO || mtbColt.getGestioneEnum() == GestioneEnum.LAVORAZIONE) && mtbColt.getSegno().equals(+1)) {
|
||||
setMtbColt(mtbColt);
|
||||
} else if (mtbColt.getGestioneEnum() == GestioneEnum.VENDITA) {
|
||||
setMtbColt(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(mContext.getSupportFragmentManager(), "tag");;
|
||||
}
|
||||
}).show();
|
||||
}
|
||||
|
||||
public void setMtbColt(MtbColt mtbColt) {
|
||||
this.mtbColt.set(mtbColt);
|
||||
}
|
||||
|
||||
public void resetMtbColt() {
|
||||
this.mtbColt.set(null);
|
||||
openLU();
|
||||
}
|
||||
|
||||
public RunnableArgs<BarcodeScanDTO> onScanSuccessfull = data -> {
|
||||
BarcodeManager.disable();
|
||||
Dialog progressDialog = UtilityProgress.createDefaultProgressDialog(mContext);
|
||||
|
||||
if (UtilityBarcode.isEtichettaPosizione(data, false)) {
|
||||
progressDialog.show();
|
||||
this.executeEtichettaPosizione(data, progressDialog);
|
||||
} else if (data.getType() == BarcodeType.EAN8 || data.getType() == BarcodeType.EAN13 || data.getType() == BarcodeType.UPCA) {
|
||||
//searchArtInt(data.getStringValue());
|
||||
} else if (UtilityBarcode.isEtichettaAnonima(data)) {
|
||||
this.executeEtichettaLU(data.getStringValue(), true, progressDialog);
|
||||
} else if (UtilityBarcode.isEtichetta128(data)) {
|
||||
this.executeEtichettaEan128(data, progressDialog);
|
||||
} else {
|
||||
BarcodeManager.enable();
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
||||
private void executeEtichettaPosizione(BarcodeScanDTO barcodeScanDTO, Dialog progressDialog) {
|
||||
MtbDepoPosizione foundPosizione = Stream.of(SettingsManager.iDB().getAvailablePosizioni())
|
||||
.filter(x -> x.getPosizione().equalsIgnoreCase(barcodeScanDTO.getStringValue()))
|
||||
.single();
|
||||
|
||||
if (foundPosizione.isFlagMonoCollo()) {
|
||||
|
||||
PosizioniRESTConsumer.getBancaliInPosizioneStatic(foundPosizione, mtbColtList -> {
|
||||
|
||||
if (mtbColtList == null || mtbColtList.size() == 0) {
|
||||
progressDialog.dismiss();
|
||||
BarcodeManager.enable();
|
||||
DialogCommon.showNoULFound(mContext, null);
|
||||
} else if (mtbColtList.size() == 1) {
|
||||
ColliMagazzinoRESTConsumer.getByTestataStatic(mtbColtList.get(0), true, false, mtbColt -> {
|
||||
|
||||
//TAKE HERE
|
||||
pickMerceULtoUL(mtbColt, progressDialog);
|
||||
|
||||
}, ex -> {
|
||||
UtilityExceptions.defaultException(mContext, ex, progressDialog);
|
||||
BarcodeManager.enable();
|
||||
});
|
||||
} else {
|
||||
progressDialog.dismiss();
|
||||
BarcodeManager.enable();
|
||||
showTooMuchULFound();
|
||||
}
|
||||
|
||||
}, ex -> {
|
||||
UtilityExceptions.defaultException(mContext, ex, progressDialog);
|
||||
BarcodeManager.enable();
|
||||
});
|
||||
} else {
|
||||
updatePosizione(foundPosizione, UtilityPosizione.isPosizioneWithLivello(foundPosizione), progressDialog);
|
||||
}
|
||||
}
|
||||
|
||||
private void showTooMuchULFound() {
|
||||
DialogSimpleMessageView.makeWarningDialog(
|
||||
new SpannableString(mContext.getResources().getText(R.string.too_much_lu_found_message_in_mono_lu)),
|
||||
null, null)
|
||||
.show(mContext.getSupportFragmentManager(), "tag");
|
||||
}
|
||||
|
||||
private void executeEtichettaEan128(BarcodeScanDTO barcodeScanDTO, Dialog progressDialog) {
|
||||
BarcodeRESTConsumer.decodeEan128Static(barcodeScanDTO, ean128Model -> {
|
||||
|
||||
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(barcodeProd)) {
|
||||
|
||||
if (!UtilityString.isNullOrEmpty(ean128Model.Sscc)) {
|
||||
this.executeEtichettaLU(ean128Model.Sscc, false, progressDialog);
|
||||
} else {
|
||||
DialogCommon.showNoULFound(mContext, null);
|
||||
progressDialog.dismiss();
|
||||
BarcodeManager.enable();
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
//EAN 128 non completo o comunque mancano i riferimenti al prodotto
|
||||
progressDialog.dismiss();
|
||||
BarcodeManager.enable();
|
||||
}
|
||||
}, ex -> {
|
||||
UtilityExceptions.defaultException(mContext, ex, progressDialog);
|
||||
BarcodeManager.enable();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private void executeEtichettaLU(String sscc, boolean isAnonima, Dialog progressDialog) {
|
||||
ColliMagazzinoRESTConsumer.getBySSCCStatic(sscc, true, false, mtbColt -> {
|
||||
|
||||
if (mtbColt == null && !isAnonima) {
|
||||
DialogCommon.showNoULFound(mContext, null);
|
||||
BarcodeManager.enable();
|
||||
progressDialog.dismiss();
|
||||
} else if(mtbColt != null && (/*mtbColt.getGestioneEnum() == GestioneEnum.ACQUISTO ||*/ mtbColt.getGestioneEnum() == GestioneEnum.VENDITA)) {
|
||||
showWrongGestioneUL();
|
||||
BarcodeManager.enable();
|
||||
progressDialog.dismiss();
|
||||
} else {
|
||||
if (mtbColt == null && isAnonima) {
|
||||
ColliMagazzinoRESTConsumer.createColloFromEtichettaAnonima(sscc, GestioneEnum.LAVORAZIONE, mtbColtAnonimo -> {
|
||||
pickMerceULtoUL(mtbColtAnonimo, progressDialog);
|
||||
}, ex -> {
|
||||
UtilityExceptions.defaultException(mContext, ex, progressDialog);
|
||||
BarcodeManager.enable();
|
||||
});
|
||||
|
||||
} else {
|
||||
pickMerceULtoUL(mtbColt, progressDialog);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}, ex -> {
|
||||
UtilityExceptions.defaultException(mContext, ex, progressDialog);
|
||||
BarcodeManager.enable();
|
||||
});
|
||||
}
|
||||
|
||||
private void updatePosizione(MtbDepoPosizione mtbDepoPosizione, boolean shouldAskLivello, Dialog progressDialog) {
|
||||
|
||||
if (shouldAskLivello) {
|
||||
DialogAskLivelloPosizione.make(mContext, mtbDepoPosizione, false, newPosizione -> {
|
||||
|
||||
if (newPosizione == null) {
|
||||
updatePosizione(mtbDepoPosizione, shouldAskLivello, progressDialog);
|
||||
} else {
|
||||
updatePosizione(newPosizione, false, progressDialog);
|
||||
}
|
||||
|
||||
}, ex -> {
|
||||
UtilityExceptions.defaultException(mContext, ex, progressDialog);
|
||||
BarcodeManager.enable();
|
||||
});
|
||||
} else {
|
||||
ColliMagazzinoRESTConsumer.changePosizione(mtbColt.get(), mtbDepoPosizione, () -> {
|
||||
progressDialog.dismiss();
|
||||
BarcodeManager.enable();
|
||||
|
||||
DialogCommon.showDataSaved(mContext, mOnVersamentoCompleted);
|
||||
}, ex -> {
|
||||
UtilityExceptions.defaultException(mContext, ex, progressDialog);
|
||||
BarcodeManager.enable();
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void pickMerceULtoUL(MtbColt destMtbColt, Dialog progressDialog) {
|
||||
MtbColt sourceMtbColt = mtbColt.get();
|
||||
|
||||
List<MtbColr> mtbColrsToPick = Stream.of(mtbColt.get().getMtbColr())
|
||||
.filter(x -> x.getQtaCol().floatValue() > 0)
|
||||
.toList();
|
||||
|
||||
DialogChooseArtsFromListaArts.make(mContext, mtbColrsToPick, pickedAarts -> {
|
||||
|
||||
progressDialog.dismiss();
|
||||
|
||||
List<MtbColr> destNewMtbColr = new ArrayList<>();
|
||||
|
||||
askQuantities(pickedAarts.iterator(), destNewMtbColr, () -> {
|
||||
BarcodeManager.enable();
|
||||
|
||||
if (destNewMtbColr != null && destNewMtbColr.size() > 0) {
|
||||
MtbColt clonedSourceTestata = (MtbColt) sourceMtbColt.clone();
|
||||
MtbColt clonedDestTestata = (MtbColt) destMtbColt.clone();
|
||||
|
||||
ObservableArrayList<MtbColr> mtbColrSourceObservableField = new ObservableArrayList<>();
|
||||
ObservableArrayList<MtbColr> mtbColrDestObservableField = new ObservableArrayList<>();
|
||||
|
||||
for (int i = 0; i < destNewMtbColr.size(); i++) {
|
||||
MtbColr cloneMtbColr = (MtbColr) destNewMtbColr.get(i).clone();
|
||||
|
||||
boolean destroyMtbColrReferences = false;
|
||||
|
||||
//Se le gestioni sono uguali faccio uno storno sulla sorgente e non lavoro con
|
||||
//i riferimenti
|
||||
if ((sourceMtbColt.getGestioneEnum() == destMtbColt.getGestioneEnum() && sourceMtbColt.getGestioneEnum() == GestioneEnum.VENDITA) ||
|
||||
(sourceMtbColt.getGestioneEnum() == GestioneEnum.VENDITA && sourceMtbColt.getSegno() == -1 && destMtbColt.getGestioneEnum() == GestioneEnum.LAVORAZIONE)) {
|
||||
destroyMtbColrReferences = true;
|
||||
|
||||
MtbColr stornoSourceMtbColr = (MtbColr) destNewMtbColr.get(i).clone();
|
||||
|
||||
stornoSourceMtbColr
|
||||
.setGestione((String) null)
|
||||
.setNumCollo(null)
|
||||
.setSerCollo(null)
|
||||
.setDataCollo(null)
|
||||
.setGestioneRif(null)
|
||||
.setNumColloRif(null)
|
||||
.setSerColloRif(null)
|
||||
.setDataColloRif((String) null)
|
||||
.setCausale(MtbColr.Causale.VERSAMENTO)
|
||||
.setUtente(SettingsManager.i().getUser().getFullname())
|
||||
|
||||
.setQtaCol(stornoSourceMtbColr.getQtaCol().multiply(new BigDecimal(-1)))
|
||||
.setNumCnf(stornoSourceMtbColr.getNumCnf().multiply(new BigDecimal(-1)));
|
||||
|
||||
mtbColrSourceObservableField.add(stornoSourceMtbColr);
|
||||
}
|
||||
|
||||
if (!destroyMtbColrReferences) {
|
||||
cloneMtbColr
|
||||
.setGestioneRif(cloneMtbColr.getGestione())
|
||||
.setSerColloRif(cloneMtbColr.getSerCollo())
|
||||
.setNumColloRif(cloneMtbColr.getNumCollo())
|
||||
.setDataColloRif(cloneMtbColr.getDataColloS());
|
||||
}
|
||||
|
||||
if (sourceMtbColt.getGestioneEnum() == GestioneEnum.VENDITA && sourceMtbColt.getSegno() == +1) {
|
||||
cloneMtbColr.setCodJcom(null);
|
||||
}
|
||||
|
||||
cloneMtbColr
|
||||
.setGestione((String) null)
|
||||
.setSerCollo(null)
|
||||
.setNumCollo(null)
|
||||
.setDataCollo(null)
|
||||
.setCausale(MtbColr.Causale.VERSAMENTO)
|
||||
.setUtente(SettingsManager.i().getUser().getFullname());
|
||||
|
||||
mtbColrDestObservableField.add(cloneMtbColr);
|
||||
}
|
||||
|
||||
clonedSourceTestata.setMtbColr(mtbColrSourceObservableField);
|
||||
clonedDestTestata.setMtbColr(mtbColrDestObservableField);
|
||||
|
||||
|
||||
saveLUs(clonedSourceTestata, clonedDestTestata);
|
||||
}
|
||||
|
||||
}, () -> {
|
||||
progressDialog.dismiss();
|
||||
BarcodeManager.enable();
|
||||
});
|
||||
|
||||
}, () -> {
|
||||
progressDialog.dismiss();
|
||||
BarcodeManager.enable();
|
||||
}).show();
|
||||
}
|
||||
|
||||
|
||||
private void askQuantities(Iterator<MtbColr> sourceMtbColrs, List<MtbColr> destMtbColr, Runnable onComplete, Runnable onAbort) {
|
||||
|
||||
if (sourceMtbColrs.hasNext()) {
|
||||
|
||||
askSingleQuantity(sourceMtbColrs.next(), mtbColr -> {
|
||||
|
||||
|
||||
destMtbColr.add(mtbColr);
|
||||
askQuantities(sourceMtbColrs, destMtbColr, onComplete, onAbort);
|
||||
}, onAbort);
|
||||
} else {
|
||||
onComplete.run();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void askSingleQuantity(MtbColr mtbColr, RunnableArgs<MtbColr> onComplete, Runnable onAbort) {
|
||||
DialogInputQuantityV2DTO dialogInputQuantityV2DTO = new DialogInputQuantityV2DTO()
|
||||
.setMtbAart(mtbColr.getMtbAart())
|
||||
.setInitialNumCnf(mtbColr.getNumCnf())
|
||||
.setInitialQtaCnf(mtbColr.getQtaCnf())
|
||||
.setInitialQtaTot(mtbColr.getQtaCol())
|
||||
.setTotalQtaAvailable(mtbColr.getQtaCol())
|
||||
.setTotalNumCnfAvailable(mtbColr.getNumCnf())
|
||||
.setQtaCnfAvailable(mtbColr.getQtaCnf())
|
||||
.setPartitaMag(mtbColr.getPartitaMag())
|
||||
.setDataScad(mtbColr.getDataScadPartitaD())
|
||||
.setCanOverflowOrderQuantity(false)
|
||||
.setCanPartitaMagBeChanged(false)
|
||||
.setCanLUBeClosed(false);
|
||||
|
||||
DialogInputQuantityV2View
|
||||
.newInstance(dialogInputQuantityV2DTO, (resultDTO, shouldCloseLU) -> {
|
||||
// PickedQuantityDTO pickedQuantityDTO = new PickedQuantityDTO()
|
||||
// .setNumCnf(resultDTO.getNumCnf())
|
||||
// .setQtaCnf(resultDTO.getQtaCnf())
|
||||
// .setQtaTot(resultDTO.getQtaTot())
|
||||
// .setPartitaMag(resultDTO.getPartitaMag())
|
||||
// .setDataScad(resultDTO.getDataScad());
|
||||
//
|
||||
// onComplete.run(pickedQuantityDTO, shouldCloseLU);
|
||||
|
||||
mtbColr
|
||||
.setQtaCol(resultDTO.getQtaTot())
|
||||
.setQtaCnf(resultDTO.getQtaCnf())
|
||||
.setNumCnf(resultDTO.getNumCnf())
|
||||
.setDatetimeRow(UtilityDate.getDateInstance());
|
||||
|
||||
onComplete.run(mtbColr);
|
||||
}, onAbort)
|
||||
.show(mContext.getSupportFragmentManager(), "tag");
|
||||
|
||||
|
||||
|
||||
|
||||
// DialogInputQuantity.DTO dto = new DialogInputQuantity.DTO()
|
||||
// .setBatchLot(mtbColr.getPartitaMag())
|
||||
// .setDataScad(mtbColr.getDataScadPartitaD())
|
||||
// .setMtbAart(mtbColr.getMtbAart())
|
||||
// .setQtaTot(mtbColr.getQtaCol())
|
||||
// .setQtaOrd(mtbColr.getQtaCol())
|
||||
// .setQtaDaEvadere(new BigDecimal(-1))
|
||||
// .setQtaEvasa(BigDecimal.ZERO)
|
||||
// .setCanPartitaMagBeChanged(false)
|
||||
// .setCanDataScadBeChanged(false)
|
||||
// .setMaxQta(mtbColr.getQtaCol());
|
||||
//
|
||||
// DialogInputQuantity.makeBase(mContext, dto, false, quantityDTO -> {
|
||||
// mtbColr
|
||||
// .setQtaCol(quantityDTO.qtaTot.getBigDecimal())
|
||||
// .setQtaCnf(quantityDTO.qtaCnf.getBigDecimal())
|
||||
// .setNumCnf(quantityDTO.numCnf.getBigDecimal())
|
||||
// .setDatetimeRow(UtilityDate.getDateInstance());
|
||||
//
|
||||
// onComplete.run(mtbColr);
|
||||
// }, onAbort).show();
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void askULVenditaConfirm(RunnableArgs<Boolean> callback) {
|
||||
DialogSimpleMessageView.makeWarningDialog(
|
||||
new SpannableString(mContext.getResources().getString(R.string.lu_gest_v_loading_alert)),
|
||||
null,
|
||||
() -> callback.run(true),
|
||||
() -> callback.run(false))
|
||||
.show(mContext.getSupportFragmentManager(), "tag");
|
||||
}
|
||||
|
||||
private void showWrongGestioneUL() {
|
||||
DialogSimpleMessageView.makeWarningDialog(
|
||||
new SpannableString(Html.fromHtml(mContext.getResources().getText(R.string.gestione_V_not_accepted_message).toString())),
|
||||
null, null)
|
||||
.show(mContext.getSupportFragmentManager(), "tag");
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void saveLUs(MtbColt mtbColt1, MtbColt mtbColt2) {
|
||||
|
||||
ArrayList<MtbColt> mtbColts = new ArrayList<>();
|
||||
mtbColts.add(mtbColt1);
|
||||
mtbColts.add(mtbColt2);
|
||||
|
||||
for (MtbColt mtbColt : mtbColts) {
|
||||
mtbColt.setOperation(CommonModelConsts.OPERATION.INSERT_OR_UPDATE);
|
||||
|
||||
for (int i = 0; i < mtbColt.getMtbColr().size(); i++) {
|
||||
mtbColt.getMtbColr().get(i)
|
||||
.setOperation(CommonModelConsts.OPERATION.INSERT_OR_UPDATE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ColliMagazzinoRESTConsumer.saveColliStatic(mtbColts, value -> {
|
||||
DialogCommon.showDataSaved(mContext, () -> {
|
||||
mOnVersamentoCompleted.run();
|
||||
});
|
||||
}, ex -> {
|
||||
UtilityExceptions.defaultException(mContext, ex);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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");
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,109 +0,0 @@
|
||||
package it.integry.integrywmsnative.view.dialogs.ask_cliente;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.WindowManager;
|
||||
|
||||
import androidx.databinding.DataBindingUtil;
|
||||
|
||||
import java.util.AbstractMap;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import it.integry.integrywmsnative.R;
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgsss;
|
||||
import it.integry.integrywmsnative.core.model.VtbDest;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityDialog;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityString;
|
||||
import it.integry.integrywmsnative.databinding.DialogAskClienteBinding;
|
||||
import it.integry.integrywmsnative.view.dialogs.DialogConsts;
|
||||
import it.integry.integrywmsnative.view.dialogs.ask_cliente.dto.DialogAskClienteDestinatarioDTO;
|
||||
import it.integry.integrywmsnative.view.dialogs.ask_cliente.viewmodel.DialogAskCliente_Page1ViewModel;
|
||||
import it.integry.integrywmsnative.view.dialogs.ask_cliente.viewmodel.DialogAskCliente_Page2ViewModel;
|
||||
|
||||
public class DialogAskCliente {
|
||||
|
||||
private Context mContext;
|
||||
|
||||
private Dialog mDialog;
|
||||
|
||||
private DialogAskClienteBinding mBinding;
|
||||
|
||||
|
||||
public static Dialog makeBase(final Context context, RunnableArgsss<DialogConsts.Results, VtbDest, String> onComplete) {
|
||||
return new DialogAskCliente(context, onComplete).mDialog;
|
||||
}
|
||||
|
||||
public DialogAskCliente(Context context, RunnableArgsss<DialogConsts.Results, VtbDest, String> onComplete) {
|
||||
mContext = context;
|
||||
|
||||
|
||||
LayoutInflater inflater = (LayoutInflater) context.getSystemService( Context.LAYOUT_INFLATER_SERVICE );
|
||||
mBinding = DataBindingUtil.inflate(inflater, R.layout.dialog_ask_cliente, null, false);
|
||||
|
||||
List<Map.Entry<Integer, Class>> views = new ArrayList<>();
|
||||
views.add(new AbstractMap.SimpleEntry<>(R.layout.dialog_ask_cliente__page1, DialogAskCliente_Page1ViewModel.class));
|
||||
views.add(new AbstractMap.SimpleEntry<>(R.layout.dialog_ask_cliente__page2, DialogAskCliente_Page2ViewModel.class));
|
||||
|
||||
|
||||
|
||||
DialogAskClienteAdapter adapter = new DialogAskClienteAdapter(mContext, views);
|
||||
mBinding.viewpager.setAdapter(adapter);
|
||||
mBinding.viewpager.beginFakeDrag();
|
||||
mBinding.viewpager.addOnPageChangeListener(adapter);
|
||||
|
||||
|
||||
|
||||
mDialog = new Dialog(mContext);
|
||||
mDialog.setContentView(mBinding.getRoot());
|
||||
mDialog.setCanceledOnTouchOutside(false);
|
||||
// mDialog.setCancelable(false);
|
||||
UtilityDialog.setTo90PercentWidth(mContext, mDialog);
|
||||
mDialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
|
||||
mDialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
|
||||
|
||||
|
||||
mDialog.setOnShowListener(dialog -> {
|
||||
|
||||
DialogAskCliente_Page1ViewModel viewModel1 = (DialogAskCliente_Page1ViewModel) adapter.getViewModel(R.layout.dialog_ask_cliente__page1);
|
||||
DialogAskCliente_Page2ViewModel viewModel2 = (DialogAskCliente_Page2ViewModel) adapter.getViewModel(R.layout.dialog_ask_cliente__page2);
|
||||
|
||||
viewModel1
|
||||
.setOnConfirmClickListener(() -> {
|
||||
String codAnag = viewModel1.getCurrentCliente();
|
||||
|
||||
if(UtilityString.isNullOrEmpty(codAnag)) {
|
||||
mDialog.dismiss();
|
||||
onComplete.run(DialogConsts.Results.YES, null, null);
|
||||
}
|
||||
|
||||
viewModel2.setCodAnag(codAnag);
|
||||
|
||||
mBinding.viewpager.setCurrentItem(mBinding.viewpager.getCurrentItem() + 1, true);
|
||||
});
|
||||
|
||||
viewModel1.setOnAbortClickListener(() -> {
|
||||
mDialog.dismiss();
|
||||
onComplete.run(DialogConsts.Results.ABORT, null, null);
|
||||
});
|
||||
|
||||
viewModel2.setOnConfirmClickListener(() -> {
|
||||
DialogAskClienteDestinatarioDTO cliente = viewModel2.getCurrentDestinatario();
|
||||
|
||||
onComplete.run(DialogConsts.Results.YES, cliente != null ? cliente.toVtbDestModel() : null, viewModel1.getCurrentCommessa());
|
||||
mDialog.dismiss();
|
||||
});
|
||||
|
||||
viewModel2.setOnAbortClickListener(() -> {
|
||||
mDialog.dismiss();
|
||||
onComplete.run(DialogConsts.Results.ABORT, null, null);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,6 @@
|
||||
package it.integry.integrywmsnative.view.dialogs.ask_cliente;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
@@ -15,13 +14,10 @@ import androidx.viewpager.widget.ViewPager;
|
||||
|
||||
import java.util.AbstractMap;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import it.integry.integrywmsnative.BR;
|
||||
import it.integry.integrywmsnative.R;
|
||||
import it.integry.integrywmsnative.ui.DeactivatableViewPager;
|
||||
import it.integry.integrywmsnative.view.dialogs.ask_cliente.viewmodel.IDialogAskClienteViewModel;
|
||||
|
||||
@@ -58,9 +54,7 @@ public class DialogAskClienteAdapter extends PagerAdapter implements ViewPager.O
|
||||
viewModel = (IDialogAskClienteViewModel) viewModelClass.newInstance();
|
||||
viewModel.setBinding(mBinding);
|
||||
viewModel.setContext(mContext);
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
} catch (InstantiationException e) {
|
||||
} catch (IllegalAccessException | InstantiationException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,142 @@
|
||||
package it.integry.integrywmsnative.view.dialogs.ask_cliente;
|
||||
|
||||
import android.content.DialogInterface;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.WindowManager;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.databinding.DataBindingUtil;
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.AbstractMap;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import it.integry.integrywmsnative.R;
|
||||
import it.integry.integrywmsnative.core.expansion.BaseDialogFragment;
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgss;
|
||||
import it.integry.integrywmsnative.core.model.VtbDest;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityDialog;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityString;
|
||||
import it.integry.integrywmsnative.databinding.DialogAskClienteBinding;
|
||||
import it.integry.integrywmsnative.view.dialogs.ask_cliente.dto.DialogAskClienteDestinatarioDTO;
|
||||
import it.integry.integrywmsnative.view.dialogs.ask_cliente.viewmodel.DialogAskCliente_Page1ViewModel;
|
||||
import it.integry.integrywmsnative.view.dialogs.ask_cliente.viewmodel.DialogAskCliente_Page2ViewModel;
|
||||
|
||||
public class DialogAskClienteView extends BaseDialogFragment {
|
||||
|
||||
private final RunnableArgss<VtbDest, String> mOnComplete;
|
||||
private final Runnable mOnAbort;
|
||||
|
||||
private DialogAskClienteAdapter mAdapter;
|
||||
|
||||
private FragmentActivity mContext;
|
||||
private DialogAskClienteBinding mBindings;
|
||||
|
||||
private boolean mIsClienteSelected = false;
|
||||
|
||||
public static DialogAskClienteView newInstance(@NotNull RunnableArgss<VtbDest, String> onComplete, @NotNull Runnable onAbort) {
|
||||
return new DialogAskClienteView( onComplete, onAbort);
|
||||
}
|
||||
|
||||
private DialogAskClienteView(@NotNull RunnableArgss<VtbDest, String> onComplete, @NotNull Runnable onAbort) {
|
||||
super();
|
||||
|
||||
this.mOnComplete = onComplete;
|
||||
this.mOnAbort = onAbort;
|
||||
}
|
||||
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
this.mContext = getActivity();
|
||||
|
||||
mBindings = DataBindingUtil.inflate(inflater, R.layout.dialog_ask_cliente, container, false);
|
||||
mBindings.setLifecycleOwner(this);
|
||||
|
||||
getDialog().setCanceledOnTouchOutside(false);
|
||||
getDialog().getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
|
||||
getDialog().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
|
||||
|
||||
|
||||
List<Map.Entry<Integer, Class>> views = new ArrayList<>();
|
||||
views.add(new AbstractMap.SimpleEntry<>(R.layout.dialog_ask_cliente__page1, DialogAskCliente_Page1ViewModel.class));
|
||||
views.add(new AbstractMap.SimpleEntry<>(R.layout.dialog_ask_cliente__page2, DialogAskCliente_Page2ViewModel.class));
|
||||
|
||||
mAdapter = new DialogAskClienteAdapter(mContext, views);
|
||||
mBindings.viewpager.setAdapter(mAdapter);
|
||||
mBindings.viewpager.beginFakeDrag();
|
||||
mBindings.viewpager.addOnPageChangeListener(mAdapter);
|
||||
mBindings.viewpager.setCurrentItem(0, false);
|
||||
|
||||
getDialog().setOnShowListener(d -> {
|
||||
this.initView();
|
||||
});
|
||||
|
||||
return mBindings.getRoot();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart() {
|
||||
super.onStart();
|
||||
UtilityDialog.setTo90PercentWidth(this.mContext, this);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
}
|
||||
|
||||
private void initView() {
|
||||
DialogAskCliente_Page1ViewModel viewModel1 = (DialogAskCliente_Page1ViewModel) mAdapter.getViewModel(R.layout.dialog_ask_cliente__page1);
|
||||
DialogAskCliente_Page2ViewModel viewModel2 = (DialogAskCliente_Page2ViewModel) mAdapter.getViewModel(R.layout.dialog_ask_cliente__page2);
|
||||
|
||||
viewModel1
|
||||
.setOnConfirmClickListener(() -> {
|
||||
String codAnag = viewModel1.getCurrentCliente();
|
||||
|
||||
if(UtilityString.isNullOrEmpty(codAnag)) {
|
||||
this.mIsClienteSelected = true;
|
||||
dismiss();
|
||||
mOnComplete.run(null, null);
|
||||
}
|
||||
|
||||
viewModel2.setCodAnag(codAnag);
|
||||
|
||||
mBindings.viewpager.setCurrentItem(mBindings.viewpager.getCurrentItem() + 1, true);
|
||||
});
|
||||
|
||||
viewModel2.setOnConfirmClickListener(() -> {
|
||||
DialogAskClienteDestinatarioDTO cliente = viewModel2.getCurrentDestinatario();
|
||||
|
||||
this.mIsClienteSelected = true;
|
||||
dismiss();
|
||||
mOnComplete.run(cliente != null ? cliente.toVtbDestModel() : null, viewModel1.getCurrentCommessa());
|
||||
});
|
||||
|
||||
|
||||
viewModel1.setOnAbortClickListener(this::dismiss);
|
||||
viewModel2.setOnAbortClickListener(this::dismiss);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onDismiss(@NonNull DialogInterface dialog) {
|
||||
if(!mIsClienteSelected) {
|
||||
this.mOnAbort.run();
|
||||
}
|
||||
super.onDismiss(dialog);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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;
|
||||
@@ -145,12 +146,11 @@ public class DialogInputQuantityV2View extends BaseDialogFragment implements Dia
|
||||
|
||||
private final RunnableArgs<BarcodeScanDTO> onScanSuccessful = data -> {
|
||||
BarcodeManager.disable();
|
||||
|
||||
this.openProgress();
|
||||
|
||||
this.mViewModel.processBarcodeDTO(data, () -> {
|
||||
BarcodeManager.enable();
|
||||
this.closeProgress();
|
||||
BarcodeManager.enable();
|
||||
});
|
||||
};
|
||||
|
||||
@@ -180,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() {
|
||||
|
||||
@@ -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;
|
||||
@@ -125,6 +131,9 @@ public class DialogInputQuantityV2ViewModel {
|
||||
this.setNumCnf(BigDecimal.ONE);
|
||||
this.setQtaCnf(UtilityBigDecimal.divide(this.getQtaTot(), this.getNumCnf()));
|
||||
}
|
||||
|
||||
this.unlockNumCnf();
|
||||
this.unlockQtaCnf();
|
||||
}
|
||||
|
||||
onComplete.run();
|
||||
@@ -301,10 +310,21 @@ public class DialogInputQuantityV2ViewModel {
|
||||
// return;
|
||||
}
|
||||
|
||||
if (!this.blockedQtaCnf.get() && !this.mtbAart.get().isFlagQtaCnfFissaBoolean() && this.internalQtaTot != null)
|
||||
this.internalQtaCnf = UtilityBigDecimal.divide(newValue, internalQtaTot);
|
||||
else if (!this.blockedQtaTot.get() && this.internalQtaCnf != null)
|
||||
this.internalQtaTot = UtilityBigDecimal.multiply(newValue, this.internalQtaCnf);
|
||||
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();
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package it.integry.integrywmsnative.view.dialogs.scan_art;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
@@ -38,8 +37,6 @@ public class DialogScanArtView extends BaseDialogFragment implements DialogScanA
|
||||
@Inject
|
||||
DialogScanArtViewModel mViewModel;
|
||||
|
||||
private Context mContext;
|
||||
|
||||
private DialogScanArtBinding mBindings;
|
||||
|
||||
private int mBarcodeScannerIstanceID;
|
||||
@@ -59,10 +56,10 @@ public class DialogScanArtView extends BaseDialogFragment implements DialogScanA
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
this.mContext = getActivity();
|
||||
this.initBarcode();
|
||||
|
||||
mBindings = DataBindingUtil.inflate(inflater, R.layout.dialog_scan_art, container, false);
|
||||
mBindings.setLifecycleOwner(this);
|
||||
|
||||
MainApplication.appComponent
|
||||
.dialogScanArtComponent()
|
||||
@@ -96,7 +93,7 @@ public class DialogScanArtView extends BaseDialogFragment implements DialogScanA
|
||||
private void initBarcode() {
|
||||
mBarcodeScannerIstanceID = BarcodeManager.addCallback(new BarcodeCallbackDTO()
|
||||
.setOnScanSuccessfull(onScanSuccessfull)
|
||||
.setOnScanFailed(ex -> UtilityExceptions.defaultException(this.mContext, ex, false)));
|
||||
.setOnScanFailed(this::onError));
|
||||
|
||||
setBarcodeListener(true);
|
||||
}
|
||||
@@ -108,7 +105,7 @@ public class DialogScanArtView extends BaseDialogFragment implements DialogScanA
|
||||
|
||||
this.mViewModel.processBarcodeDTO(data, (status, mtbAart, ean128Model, mtbColrList) -> {
|
||||
if(mtbColrList != null && mtbColrList.size() > 0) {
|
||||
DialogChooseArtFromListaMtbColrView.make(mContext, mtbColrList, mtbColrChose -> {
|
||||
DialogChooseArtFromListaMtbColrView.make(getActivity(), mtbColrList, mtbColrChose -> {
|
||||
mOnItemChoosed.run(status, mtbAart, ean128Model, mtbColrChose);
|
||||
}).show();
|
||||
} else {
|
||||
@@ -126,7 +123,7 @@ public class DialogScanArtView extends BaseDialogFragment implements DialogScanA
|
||||
@Override
|
||||
public void onError(Exception ex) {
|
||||
this.closeProgress();
|
||||
UtilityExceptions.defaultException(mContext, ex);
|
||||
UtilityExceptions.defaultException(getActivity(), ex);
|
||||
BarcodeManager.enable();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,302 +0,0 @@
|
||||
package it.integry.integrywmsnative.view.dialogs.scan_or_create_lu;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.text.SpannableString;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.databinding.DataBindingUtil;
|
||||
|
||||
import com.annimon.stream.Stream;
|
||||
|
||||
import it.integry.barcode_base_android_library.model.BarcodeScanDTO;
|
||||
import it.integry.integrywmsnative.R;
|
||||
import it.integry.integrywmsnative.core.barcode_reader.BarcodeCallbackDTO;
|
||||
import it.integry.integrywmsnative.core.barcode_reader.BarcodeManager;
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgss;
|
||||
import it.integry.integrywmsnative.core.model.MtbColt;
|
||||
import it.integry.integrywmsnative.core.model.MtbDepoPosizione;
|
||||
import it.integry.integrywmsnative.core.model.secondary.GestioneEnum;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.BarcodeRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.ColliMagazzinoRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.PosizioniRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityBarcode;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityExceptions;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityProgress;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityString;
|
||||
import it.integry.integrywmsnative.databinding.DialogScanOrCreateLuBinding;
|
||||
import it.integry.integrywmsnative.view.dialogs.DialogCommon;
|
||||
import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleMessageView;
|
||||
import it.integry.integrywmsnative.view.dialogs.basket_lu.DialogBasketLU;
|
||||
|
||||
public class DialogScanOrCreateLU {
|
||||
|
||||
private Context mContext;
|
||||
|
||||
private Dialog mDialog;
|
||||
|
||||
private DialogScanOrCreateLuBinding mBinding;
|
||||
|
||||
private RunnableArgss<MtbColt, Boolean> mOnDialogDismiss;
|
||||
|
||||
private MtbColt currentMtbColt;
|
||||
|
||||
|
||||
private boolean mShouldCheckResiduo = false;
|
||||
private boolean mShouldCheckIfExistDoc = true;
|
||||
|
||||
|
||||
public static Dialog make(final Context context, RunnableArgss<MtbColt, Boolean> onDialogDismiss) {
|
||||
return new DialogScanOrCreateLU(context, false, true, true, true, onDialogDismiss).mDialog;
|
||||
}
|
||||
|
||||
public static Dialog make(final Context context, boolean enableCreation, boolean shouldCheckIfExistDoc, RunnableArgss<MtbColt, Boolean> onDialogDismiss) {
|
||||
return new DialogScanOrCreateLU(context, false, enableCreation, true, shouldCheckIfExistDoc, onDialogDismiss).mDialog;
|
||||
}
|
||||
|
||||
public static Dialog make(final Context context, boolean enableBasket, boolean enableCreation, boolean checkResiduo, boolean shouldCheckIfExistDoc, RunnableArgss<MtbColt, Boolean> onDialogDismiss) {
|
||||
return new DialogScanOrCreateLU(context, enableBasket, enableCreation, checkResiduo, shouldCheckIfExistDoc, onDialogDismiss).mDialog;
|
||||
}
|
||||
|
||||
private DialogScanOrCreateLU(Context context, boolean enableBasket, boolean enableCreation, boolean checkResiduo, boolean shouldCheckIfExistDoc, RunnableArgss<MtbColt, Boolean> onDialogDismiss) {
|
||||
mOnDialogDismiss = null;
|
||||
currentMtbColt = null;
|
||||
mShouldCheckResiduo = checkResiduo;
|
||||
mShouldCheckIfExistDoc = shouldCheckIfExistDoc;
|
||||
|
||||
mContext = context;
|
||||
|
||||
LayoutInflater inflater = (LayoutInflater) context.getSystemService( Context.LAYOUT_INFLATER_SERVICE );
|
||||
|
||||
mBinding = DataBindingUtil.inflate(inflater, R.layout.dialog_scan_or_create_lu, null, false);
|
||||
|
||||
mBinding.dialogScanOrCreateLuCreationLayout.setVisibility(enableCreation ? View.VISIBLE : View.GONE);
|
||||
mBinding.dialogScanOrCreateLuBasketLayout.setVisibility(enableBasket ? View.VISIBLE : View.GONE);
|
||||
|
||||
mDialog = new Dialog(context);
|
||||
mDialog.setContentView(mBinding.getRoot());
|
||||
mDialog.setCanceledOnTouchOutside(false);
|
||||
// mDialog.setCancelable(false);
|
||||
mDialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
|
||||
|
||||
init(onDialogDismiss);
|
||||
initBarcode(context);
|
||||
}
|
||||
|
||||
|
||||
private void init(RunnableArgss<MtbColt, Boolean> onDialogDismiss) {
|
||||
mOnDialogDismiss = onDialogDismiss;
|
||||
|
||||
mBinding.createNewLuButton.setOnClickListener(v -> {
|
||||
final Dialog progressDialog = UtilityProgress.createDefaultProgressDialog(mContext);
|
||||
|
||||
ColliMagazzinoRESTConsumer.createColloLavorazione(+1, createdMtbColt -> {
|
||||
sendMtbColt(createdMtbColt, progressDialog, true);
|
||||
}, ex -> {
|
||||
UtilityExceptions.defaultException(mContext, ex, progressDialog);
|
||||
});
|
||||
});
|
||||
|
||||
mBinding.viewBasket.setOnClickListener(v -> {
|
||||
DialogBasketLU.make(mContext, mtbColt -> {
|
||||
sendMtbColt(mtbColt, null, false);
|
||||
}).show();
|
||||
});
|
||||
}
|
||||
|
||||
private void initBarcode(Context context) {
|
||||
|
||||
int barcodeIstanceID = BarcodeManager.addCallback(new BarcodeCallbackDTO()
|
||||
.setOnScanSuccessfull(onScanSuccessfull)
|
||||
.setOnScanFailed(ex -> UtilityExceptions.defaultException(context, ex, false)));
|
||||
|
||||
mDialog.setOnDismissListener(dialog -> {
|
||||
BarcodeManager.removeCallback(barcodeIstanceID);
|
||||
BarcodeManager.enable();
|
||||
if(currentMtbColt == null) {
|
||||
mOnDialogDismiss.run(null, false);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
private final RunnableArgs<BarcodeScanDTO> onScanSuccessfull = data -> {
|
||||
BarcodeManager.disable();
|
||||
|
||||
final Dialog progressDialog = UtilityProgress.createDefaultProgressDialog(mContext);
|
||||
|
||||
if(UtilityBarcode.isEtichettaPosizione(data)){
|
||||
this.executeEtichettaPosizione(data, progressDialog);
|
||||
} else if(UtilityBarcode.isEtichettaAnonima(data)) {
|
||||
this.executeEtichettaAnonima(data, progressDialog);
|
||||
} else if(UtilityBarcode.isEtichetta128(data)) {
|
||||
this.executeEAN128(data, progressDialog);
|
||||
} else {
|
||||
progressDialog.dismiss();
|
||||
BarcodeManager.enable();
|
||||
DialogCommon.showNoULFound(mContext, null);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
private void executeEtichettaPosizione(BarcodeScanDTO barcodeScanDTO, Dialog progressDialog) {
|
||||
|
||||
MtbDepoPosizione foundPosizione = Stream.of(SettingsManager.iDB().getAvailablePosizioni())
|
||||
.filter(x -> x.getPosizione().equalsIgnoreCase(barcodeScanDTO.getStringValue()))
|
||||
.single();
|
||||
|
||||
PosizioniRESTConsumer.getBancaliInPosizioneStatic(foundPosizione, mtbColtList -> {
|
||||
|
||||
if(mtbColtList == null || mtbColtList.size() == 0){
|
||||
progressDialog.dismiss();
|
||||
BarcodeManager.enable();
|
||||
DialogCommon.showNoULFound(mContext, null);
|
||||
} else if (mtbColtList.size() == 1) {
|
||||
ColliMagazzinoRESTConsumer.getByTestataStatic(mtbColtList.get(0), mShouldCheckResiduo, false, mtbColt -> {
|
||||
sendMtbColt(mtbColt, progressDialog, false);
|
||||
}, ex -> {
|
||||
UtilityExceptions.defaultException(mContext, ex, progressDialog);
|
||||
BarcodeManager.enable();
|
||||
});
|
||||
|
||||
|
||||
|
||||
} else {
|
||||
progressDialog.dismiss();
|
||||
BarcodeManager.enable();
|
||||
showTooMuchULFound();
|
||||
}
|
||||
|
||||
}, ex -> {
|
||||
UtilityExceptions.defaultException(mContext, ex, progressDialog);
|
||||
BarcodeManager.enable();
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void executeEtichettaAnonima(BarcodeScanDTO barcodeScanDTO, Dialog progressDialog) {
|
||||
ColliMagazzinoRESTConsumer.getBySSCCStatic(barcodeScanDTO.getStringValue(), mShouldCheckResiduo, false, mtbColt -> {
|
||||
|
||||
if(mtbColt == null) {
|
||||
|
||||
ColliMagazzinoRESTConsumer.createColloFromEtichettaAnonima(barcodeScanDTO, GestioneEnum.LAVORAZIONE, createdMtbColt -> {
|
||||
BarcodeManager.enable();
|
||||
createdMtbColt.setDisablePrint(true);
|
||||
sendMtbColt(createdMtbColt, progressDialog, true);
|
||||
}, ex -> {
|
||||
UtilityExceptions.defaultException(mContext, ex, progressDialog);
|
||||
BarcodeManager.enable();
|
||||
});
|
||||
|
||||
} else {
|
||||
|
||||
if(mtbColt.getCodDtip() != null && mShouldCheckIfExistDoc) {
|
||||
DialogSimpleMessageView.makeWarningDialog(
|
||||
new SpannableString(mContext.getResources().getText(R.string.lu_already_attache_to_doc)),
|
||||
null, () -> {
|
||||
BarcodeManager.enable();
|
||||
progressDialog.dismiss();
|
||||
})
|
||||
.show(((AppCompatActivity) mContext).getSupportFragmentManager(), "tag");
|
||||
} else {
|
||||
BarcodeManager.enable();
|
||||
|
||||
mtbColt.setDisablePrint(true);
|
||||
sendMtbColt(mtbColt, progressDialog, false);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}, ex -> {
|
||||
UtilityExceptions.defaultException(mContext, ex, progressDialog);
|
||||
BarcodeManager.enable();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private void executeEAN128(BarcodeScanDTO barcodeScanDTO, Dialog progressDialog) {
|
||||
BarcodeRESTConsumer.decodeEan128Static(barcodeScanDTO, ean128Model -> {
|
||||
|
||||
if(ean128Model != null && !UtilityString.isNullOrEmpty(ean128Model.Sscc)) {
|
||||
|
||||
ColliMagazzinoRESTConsumer.getBySSCCStatic(ean128Model.Sscc, mShouldCheckResiduo, false, mtbColt -> {
|
||||
|
||||
if(mtbColt != null) {
|
||||
|
||||
if(mtbColt.getCodDtip() != null && mShouldCheckIfExistDoc) {
|
||||
DialogSimpleMessageView.makeWarningDialog(new SpannableString(mContext.getResources().getText(R.string.lu_already_attache_to_doc)),
|
||||
null, () -> {
|
||||
BarcodeManager.enable();
|
||||
progressDialog.dismiss();
|
||||
})
|
||||
.show(((AppCompatActivity) mContext).getSupportFragmentManager(), "tag");
|
||||
} else {
|
||||
if(mtbColt.getGestioneEnum() == GestioneEnum.VENDITA && mtbColt.getSegno() == -1) {
|
||||
DialogSimpleMessageView.makeWarningDialog(new SpannableString(mContext.getResources().getText(R.string.lu_gest_v_loading_alert)),
|
||||
null, () -> {
|
||||
BarcodeManager.enable();
|
||||
sendMtbColt(mtbColt, progressDialog, false);
|
||||
}, () -> {
|
||||
BarcodeManager.enable();
|
||||
progressDialog.dismiss();
|
||||
})
|
||||
.show(((AppCompatActivity) mContext).getSupportFragmentManager(), "tag");
|
||||
} else {
|
||||
|
||||
BarcodeManager.enable();
|
||||
sendMtbColt(mtbColt, progressDialog, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
BarcodeManager.enable();
|
||||
progressDialog.dismiss();
|
||||
DialogCommon.showNoULFound(mContext, null);
|
||||
}
|
||||
|
||||
}, ex -> {
|
||||
UtilityExceptions.defaultException(mContext, ex, progressDialog);
|
||||
BarcodeManager.enable();
|
||||
});
|
||||
|
||||
} else {
|
||||
BarcodeManager.enable();
|
||||
progressDialog.dismiss();
|
||||
|
||||
DialogCommon.showNoULFound(mContext, null);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}, ex -> {
|
||||
UtilityExceptions.defaultException(mContext, ex, progressDialog);
|
||||
BarcodeManager.enable();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private void showTooMuchULFound() {
|
||||
DialogSimpleMessageView.makeWarningDialog(
|
||||
new SpannableString(mContext.getResources().getText(R.string.too_much_lu_found_message_in_mono_lu)),
|
||||
null, null)
|
||||
.show(((AppCompatActivity) mContext).getSupportFragmentManager(), "tag");
|
||||
}
|
||||
|
||||
private void sendMtbColt(MtbColt mtbColtToSend, Dialog progressDialog, boolean created) {
|
||||
currentMtbColt = mtbColtToSend;
|
||||
if(progressDialog != null) progressDialog.dismiss();
|
||||
mDialog.dismiss();
|
||||
mOnDialogDismiss.run(mtbColtToSend, created);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package it.integry.integrywmsnative.view.dialogs.scan_or_create_lu;
|
||||
|
||||
import dagger.Subcomponent;
|
||||
|
||||
@Subcomponent
|
||||
public interface DialogScanOrCreateLUComponent {
|
||||
|
||||
@Subcomponent.Factory
|
||||
interface Factory {
|
||||
DialogScanOrCreateLUComponent create();
|
||||
}
|
||||
|
||||
void inject(DialogScanOrCreateLUView dialogScanOrCreateLUView);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package it.integry.integrywmsnative.view.dialogs.scan_or_create_lu;
|
||||
|
||||
import dagger.Module;
|
||||
import dagger.Provides;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.ArticoloRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.BarcodeRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.ColliMagazzinoRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.PosizioniRESTConsumer;
|
||||
|
||||
@Module(subcomponents = DialogScanOrCreateLUComponent.class)
|
||||
public class DialogScanOrCreateLUModule {
|
||||
|
||||
@Provides
|
||||
DialogScanOrCreateLUViewModel providesDialogScanOrCreateLUViewModel(PosizioniRESTConsumer posizioniRESTConsumer, BarcodeRESTConsumer barcodeRESTConsumer, ColliMagazzinoRESTConsumer colliMagazzinoRESTConsumer, ArticoloRESTConsumer articoloRESTConsumer) {
|
||||
return new DialogScanOrCreateLUViewModel(posizioniRESTConsumer, barcodeRESTConsumer, colliMagazzinoRESTConsumer, articoloRESTConsumer);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,189 @@
|
||||
package it.integry.integrywmsnative.view.dialogs.scan_or_create_lu;
|
||||
|
||||
import android.content.DialogInterface;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.os.Bundle;
|
||||
import android.text.SpannableString;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.databinding.DataBindingUtil;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import it.integry.barcode_base_android_library.model.BarcodeScanDTO;
|
||||
import it.integry.integrywmsnative.MainApplication;
|
||||
import it.integry.integrywmsnative.R;
|
||||
import it.integry.integrywmsnative.core.barcode_reader.BarcodeCallbackDTO;
|
||||
import it.integry.integrywmsnative.core.barcode_reader.BarcodeManager;
|
||||
import it.integry.integrywmsnative.core.di.BindableBoolean;
|
||||
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.MtbColt;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityExceptions;
|
||||
import it.integry.integrywmsnative.databinding.DialogScanOrCreateLuBinding;
|
||||
import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleMessageView;
|
||||
import it.integry.integrywmsnative.view.dialogs.basket_lu.DialogBasketLU;
|
||||
|
||||
public class DialogScanOrCreateLUView extends BaseDialogFragment implements DialogScanOrCreateLUViewModel.Listener {
|
||||
|
||||
@Inject
|
||||
DialogScanOrCreateLUViewModel mViewModel;
|
||||
|
||||
private DialogScanOrCreateLuBinding mBindings;
|
||||
private int mBarcodeScannerIstanceID;
|
||||
|
||||
private RunnableArgss<MtbColt, Boolean> mOnComplete;
|
||||
private MtbColt openedMtbColt;
|
||||
|
||||
private boolean mShouldCheckResiduo;
|
||||
private boolean mShouldCheckIfExistDoc;
|
||||
private boolean mEnableCreation;
|
||||
|
||||
private final BindableBoolean basketEnabled = new BindableBoolean();
|
||||
private final BindableBoolean creationEnabled = new BindableBoolean();
|
||||
|
||||
|
||||
public static DialogScanOrCreateLUView newInstance(@NotNull RunnableArgss<MtbColt, Boolean> onComplete) {
|
||||
return new DialogScanOrCreateLUView(false, true, true, true, onComplete);
|
||||
}
|
||||
|
||||
public static DialogScanOrCreateLUView newInstance(boolean enableCreation, boolean shouldCheckIfExistDoc, @NotNull RunnableArgss<MtbColt, Boolean> onComplete) {
|
||||
return new DialogScanOrCreateLUView(false, enableCreation, true, shouldCheckIfExistDoc, onComplete);
|
||||
}
|
||||
|
||||
public static DialogScanOrCreateLUView newInstance(boolean enableBasket, boolean enableCreation, boolean checkResiduo, boolean shouldCheckIfExistDoc, @NotNull RunnableArgss<MtbColt, Boolean> onComplete) {
|
||||
return new DialogScanOrCreateLUView(enableBasket, enableCreation, checkResiduo, shouldCheckIfExistDoc, onComplete);
|
||||
}
|
||||
|
||||
private DialogScanOrCreateLUView(boolean enableBasket, boolean enableCreation, boolean checkResiduo, boolean shouldCheckIfExistDoc, @NotNull RunnableArgss<MtbColt, Boolean> onComplete) {
|
||||
super();
|
||||
mShouldCheckResiduo = checkResiduo;
|
||||
mShouldCheckIfExistDoc = shouldCheckIfExistDoc;
|
||||
|
||||
this.basketEnabled.set(enableBasket);
|
||||
this.creationEnabled.set(enableCreation);
|
||||
|
||||
mEnableCreation = enableCreation;
|
||||
mOnComplete = onComplete;
|
||||
}
|
||||
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
this.initBarcode();
|
||||
|
||||
mBindings = DataBindingUtil.inflate(inflater, R.layout.dialog_scan_or_create_lu, container, false);
|
||||
mBindings.setLifecycleOwner(this);
|
||||
mBindings.setView(this);
|
||||
|
||||
MainApplication.appComponent
|
||||
.dialogScanOrCreateLUComponent()
|
||||
.create()
|
||||
.inject(this);
|
||||
|
||||
this.mViewModel
|
||||
.setListener(this);
|
||||
|
||||
getDialog().setCanceledOnTouchOutside(false);
|
||||
getDialog().getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
|
||||
|
||||
this.mViewModel.init(mShouldCheckResiduo, mShouldCheckIfExistDoc, mEnableCreation);
|
||||
|
||||
mBindings.createNewLuButton.setOnClickListener(v -> {
|
||||
this.mViewModel.createNewLU();
|
||||
});
|
||||
|
||||
mBindings.viewBasket.setOnClickListener(v -> {
|
||||
DialogBasketLU.make(getActivity(), mtbColt -> {
|
||||
onLUOpened(mtbColt, false);
|
||||
}).show();
|
||||
});
|
||||
|
||||
return mBindings.getRoot();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onDismiss(@NonNull DialogInterface dialog) {
|
||||
BarcodeManager.removeCallback(mBarcodeScannerIstanceID);
|
||||
BarcodeManager.enable();
|
||||
if(openedMtbColt == null) {
|
||||
mOnComplete.run(null, false);
|
||||
}
|
||||
super.onDismiss(dialog);
|
||||
}
|
||||
|
||||
|
||||
private void initBarcode() {
|
||||
mBarcodeScannerIstanceID = BarcodeManager.addCallback(new BarcodeCallbackDTO()
|
||||
.setOnScanSuccessfull(onScanSuccessfull)
|
||||
.setOnScanFailed(this::onError));
|
||||
|
||||
setBarcodeListener(true);
|
||||
}
|
||||
|
||||
private final RunnableArgs<BarcodeScanDTO> onScanSuccessfull = data -> {
|
||||
BarcodeManager.disable();
|
||||
this.openProgress();
|
||||
|
||||
this.mViewModel.processBarcodeDTO(data, () -> {
|
||||
BarcodeManager.enable();
|
||||
this.closeProgress();
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
public BindableBoolean getBasketEnabled() {
|
||||
return basketEnabled;
|
||||
}
|
||||
|
||||
public BindableBoolean getCreationEnabled() {
|
||||
return creationEnabled;
|
||||
}
|
||||
|
||||
@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(((AppCompatActivity) getActivity()).getSupportFragmentManager(), "tag");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLUOpened(MtbColt mtbColt, boolean created) {
|
||||
this.openedMtbColt = mtbColt;
|
||||
mOnComplete.run(mtbColt, created);
|
||||
dismiss();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Exception ex) {
|
||||
this.closeProgress();
|
||||
UtilityExceptions.defaultException(getActivity(), ex);
|
||||
BarcodeManager.enable();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadingStarted() {
|
||||
this.openProgress();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadingEnded() {
|
||||
this.closeProgress();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,195 @@
|
||||
package it.integry.integrywmsnative.view.dialogs.scan_or_create_lu;
|
||||
|
||||
import com.annimon.stream.Stream;
|
||||
|
||||
import it.integry.barcode_base_android_library.model.BarcodeScanDTO;
|
||||
import it.integry.integrywmsnative.core.exception.AlreadyAttachedDocumentToLUException;
|
||||
import it.integry.integrywmsnative.core.exception.NoLUFoundException;
|
||||
import it.integry.integrywmsnative.core.exception.TooManyLUFoundInMonoLUPositionException;
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
import it.integry.integrywmsnative.core.interfaces.viewmodel_listeners.ILoadingListener;
|
||||
import it.integry.integrywmsnative.core.model.MtbColt;
|
||||
import it.integry.integrywmsnative.core.model.MtbDepoPosizione;
|
||||
import it.integry.integrywmsnative.core.model.secondary.GestioneEnum;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.ArticoloRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.BarcodeRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.ColliMagazzinoRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.PosizioniRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityBarcode;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityString;
|
||||
|
||||
public class DialogScanOrCreateLUViewModel {
|
||||
|
||||
|
||||
private final PosizioniRESTConsumer mPosizioniRESTConsumer;
|
||||
private final BarcodeRESTConsumer mBarcodeRESTConsumer;
|
||||
private final ColliMagazzinoRESTConsumer mColliMagazzinoRESTConsumer;
|
||||
private final ArticoloRESTConsumer mArticoloRESTConsumer;
|
||||
|
||||
private boolean mShouldCheckResiduo = false;
|
||||
private boolean mShouldCheckIfExistDoc = true;
|
||||
private boolean mEnableCreation = false;
|
||||
|
||||
private Listener mListener;
|
||||
|
||||
public DialogScanOrCreateLUViewModel(PosizioniRESTConsumer mPosizioniRESTConsumer, BarcodeRESTConsumer barcodeRESTConsumer, ColliMagazzinoRESTConsumer colliMagazzinoRESTConsumer, ArticoloRESTConsumer articoloRESTConsumer) {
|
||||
this.mPosizioniRESTConsumer = mPosizioniRESTConsumer;
|
||||
this.mBarcodeRESTConsumer = barcodeRESTConsumer;
|
||||
this.mColliMagazzinoRESTConsumer = colliMagazzinoRESTConsumer;
|
||||
this.mArticoloRESTConsumer = articoloRESTConsumer;
|
||||
}
|
||||
|
||||
|
||||
public void init(boolean checkResiduo, boolean shouldCheckIfExistDoc, boolean enableCreation) {
|
||||
this.mShouldCheckResiduo = checkResiduo;
|
||||
this.mShouldCheckIfExistDoc = shouldCheckIfExistDoc;
|
||||
this.mEnableCreation = enableCreation;
|
||||
}
|
||||
|
||||
public void createNewLU() {
|
||||
this.sendOnLoadingStarted();
|
||||
this.mColliMagazzinoRESTConsumer.createColloLavorazione(+1, createdMtbColt -> {
|
||||
this.sendOnLoadingEnded();
|
||||
this.sendOnLUOpened(createdMtbColt, true);
|
||||
}, this::sendError);
|
||||
}
|
||||
|
||||
public void processBarcodeDTO(BarcodeScanDTO barcodeScanDTO, Runnable onComplete) {
|
||||
if (UtilityBarcode.isEtichettaPosizione(barcodeScanDTO)) {
|
||||
this.executeEtichettaPosizione(barcodeScanDTO, onComplete);
|
||||
} else if (UtilityBarcode.isEtichettaAnonima(barcodeScanDTO)) {
|
||||
this.executeEtichettaAnonima(barcodeScanDTO, onComplete);
|
||||
} else if (UtilityBarcode.isEtichetta128(barcodeScanDTO)) {
|
||||
this.executeEAN128(barcodeScanDTO, onComplete);
|
||||
} else {
|
||||
onComplete.run();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void executeEtichettaPosizione(BarcodeScanDTO barcodeScanDTO, Runnable onComplete) {
|
||||
|
||||
MtbDepoPosizione foundPosizione = Stream.of(SettingsManager.iDB().getAvailablePosizioni())
|
||||
.filter(x -> x.getPosizione().equalsIgnoreCase(barcodeScanDTO.getStringValue()))
|
||||
.single();
|
||||
|
||||
this.mPosizioniRESTConsumer.getBancaliInPosizione(foundPosizione, mtbColtList -> {
|
||||
|
||||
if (mtbColtList == null || mtbColtList.size() == 0) {
|
||||
this.sendError(new NoLUFoundException());
|
||||
} else if (mtbColtList.size() == 1) {
|
||||
this.mColliMagazzinoRESTConsumer.getByTestata(mtbColtList.get(0), mShouldCheckResiduo, false, mtbColt -> {
|
||||
onComplete.run();
|
||||
this.sendOnLUOpened(mtbColt, false);
|
||||
}, this::sendError);
|
||||
} else {
|
||||
this.sendError(new TooManyLUFoundInMonoLUPositionException());
|
||||
}
|
||||
|
||||
}, this::sendError);
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void executeEtichettaAnonima(BarcodeScanDTO barcodeScanDTO, Runnable onComplete) {
|
||||
this.mColliMagazzinoRESTConsumer.getBySSCC(barcodeScanDTO.getStringValue(), mShouldCheckResiduo, false, mtbColt -> {
|
||||
|
||||
if (mtbColt == null) {
|
||||
if(mEnableCreation) {
|
||||
this.mColliMagazzinoRESTConsumer.createColloFromEtichettaAnonima(barcodeScanDTO, GestioneEnum.LAVORAZIONE, createdMtbColt -> {
|
||||
onComplete.run();
|
||||
this.sendOnLUOpened(createdMtbColt, true);
|
||||
}, this::sendError);
|
||||
} else {
|
||||
this.sendError(new NoLUFoundException());
|
||||
}
|
||||
} else {
|
||||
if (mtbColt.getCodDtip() != null && mShouldCheckIfExistDoc) {
|
||||
this.sendError(new AlreadyAttachedDocumentToLUException());
|
||||
} else {
|
||||
mtbColt.setDisablePrint(true);
|
||||
onComplete.run();
|
||||
this.sendOnLUOpened(mtbColt, false);
|
||||
}
|
||||
}
|
||||
|
||||
}, this::sendError);
|
||||
}
|
||||
|
||||
|
||||
private void executeEAN128(BarcodeScanDTO barcodeScanDTO, Runnable onComplete) {
|
||||
this.mBarcodeRESTConsumer.decodeEan128(barcodeScanDTO, ean128Model -> {
|
||||
|
||||
if (ean128Model != null && !UtilityString.isNullOrEmpty(ean128Model.Sscc)) {
|
||||
|
||||
this.mColliMagazzinoRESTConsumer.getBySSCC(ean128Model.Sscc, mShouldCheckResiduo, false, mtbColt -> {
|
||||
|
||||
if (mtbColt != null) {
|
||||
|
||||
if (mtbColt.getCodDtip() != null && mShouldCheckIfExistDoc) {
|
||||
this.sendError(new AlreadyAttachedDocumentToLUException());
|
||||
} else {
|
||||
if (mtbColt.getGestioneEnum() == GestioneEnum.VENDITA && mtbColt.getSegno() == -1) {
|
||||
this.sendOnLUVenditaConfirmRequired(confirmed -> {
|
||||
if (confirmed) {
|
||||
onComplete.run();
|
||||
this.sendOnLUOpened(mtbColt, false);
|
||||
} else {
|
||||
onComplete.run();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
onComplete.run();
|
||||
this.sendOnLUOpened(mtbColt, false);
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
this.sendError(new NoLUFoundException());
|
||||
}
|
||||
|
||||
}, this::sendError);
|
||||
|
||||
} else {
|
||||
this.sendError(new NoLUFoundException());
|
||||
}
|
||||
|
||||
}, this::sendError);
|
||||
}
|
||||
|
||||
private void sendOnLUVenditaConfirmRequired(RunnableArgs<Boolean> onConfirm) {
|
||||
if (this.mListener != null) mListener.onLUVenditaConfirmRequired(onConfirm);
|
||||
}
|
||||
|
||||
private void sendOnLUOpened(MtbColt mtbColt, boolean created) {
|
||||
if (this.mListener != null) mListener.onLUOpened(mtbColt, created);
|
||||
}
|
||||
|
||||
private void sendOnLoadingStarted() {
|
||||
if (this.mListener != null) mListener.onLoadingStarted();
|
||||
}
|
||||
|
||||
private void sendOnLoadingEnded() {
|
||||
if (this.mListener != null) mListener.onLoadingEnded();
|
||||
}
|
||||
|
||||
private void sendError(Exception ex) {
|
||||
if (this.mListener != null) mListener.onError(ex);
|
||||
}
|
||||
|
||||
public void setListener(Listener listener) {
|
||||
this.mListener = listener;
|
||||
}
|
||||
|
||||
interface Listener extends ILoadingListener {
|
||||
|
||||
void onLUVenditaConfirmRequired(RunnableArgs<Boolean> onConfirm);
|
||||
|
||||
void onLUOpened(MtbColt mtbColt, boolean created);
|
||||
|
||||
void onError(Exception ex);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -2,6 +2,12 @@
|
||||
<layout xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools">
|
||||
|
||||
<data>
|
||||
<variable
|
||||
name="view"
|
||||
type="it.integry.integrywmsnative.view.dialogs.scan_or_create_lu.DialogScanOrCreateLUView" />
|
||||
</data>
|
||||
|
||||
<androidx.cardview.widget.CardView
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/base_root"
|
||||
@@ -95,7 +101,8 @@
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/dialog_scan_or_create_lu__creation_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
android:layout_height="wrap_content"
|
||||
app:visibility="@{view.creationEnabled}">
|
||||
|
||||
|
||||
|
||||
@@ -138,7 +145,8 @@
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/dialog_scan_or_create_lu__basket_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
android:layout_height="wrap_content"
|
||||
app:visibility="@{view.basketEnabled}">
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
<variable
|
||||
name="viewmodel"
|
||||
type="it.integry.integrywmsnative.gest.versamento_merce.viewmodel.VersamentoMerceViewModel" />
|
||||
type="it.integry.integrywmsnative.gest.versamento_merce.VersamentoMerceViewModel" />
|
||||
|
||||
</data>
|
||||
|
||||
@@ -21,12 +21,12 @@
|
||||
android:background="@color/full_white">
|
||||
|
||||
|
||||
<LinearLayout
|
||||
<androidx.appcompat.widget.LinearLayoutCompat
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
<androidx.appcompat.widget.LinearLayoutCompat
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/gray_detail_background_round8"
|
||||
@@ -35,7 +35,7 @@
|
||||
android:layout_marginRight="8dp"
|
||||
android:padding="16dp">
|
||||
|
||||
<LinearLayout
|
||||
<androidx.appcompat.widget.LinearLayoutCompat
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
@@ -50,14 +50,14 @@
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@{viewmodel.mtbColt.getDataColloHumanLong()}"
|
||||
android:text="@{viewmodel.currentMtbColt.getDataColloHumanLong()}"
|
||||
tools:text="22 ottobre 2018"
|
||||
android:textColor="@android:color/black"
|
||||
android:textSize="16sp"
|
||||
android:textStyle="bold" />
|
||||
</LinearLayout>
|
||||
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||
|
||||
<LinearLayout
|
||||
<androidx.appcompat.widget.LinearLayoutCompat
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
@@ -72,14 +72,14 @@
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@{viewmodel.mtbColt.getPreparatoDa() != null ? viewmodel.mtbColt.getPreparatoDa() : `N/D`}"
|
||||
android:text="@{viewmodel.currentMtbColt.getPreparatoDa() != null ? viewmodel.currentMtbColt.getPreparatoDa() : `N/D`}"
|
||||
tools:text="Vito Falagario"
|
||||
android:textColor="@android:color/black"
|
||||
android:textSize="14sp"
|
||||
android:textStyle="italic" />
|
||||
</LinearLayout>
|
||||
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||
|
||||
<LinearLayout
|
||||
<androidx.appcompat.widget.LinearLayoutCompat
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
@@ -95,14 +95,14 @@
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@{viewmodel.mtbColt.getPosizione() != null ? viewmodel.mtbColt.getPosizione() : `N/D`}"
|
||||
android:text="@{viewmodel.currentMtbColt.getPosizione() != null ? viewmodel.currentMtbColt.getPosizione() : `N/D`}"
|
||||
tools:text="A00F00C00L00"
|
||||
android:textColor="@android:color/black"
|
||||
android:textSize="14sp"
|
||||
android:textStyle="bold" />
|
||||
</LinearLayout>
|
||||
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||
|
||||
<LinearLayout
|
||||
<androidx.appcompat.widget.LinearLayoutCompat
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
@@ -117,7 +117,7 @@
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@{viewmodel.mtbColt.getCodMdep()}"
|
||||
android:text="@{viewmodel.currentMtbColt.getCodMdep()}"
|
||||
tools:text="10"
|
||||
android:textColor="@android:color/black"
|
||||
android:textSize="14sp"
|
||||
@@ -132,13 +132,13 @@
|
||||
android:textColor="@android:color/black"
|
||||
android:textSize="14sp"
|
||||
android:textStyle="bold" />-->
|
||||
</LinearLayout>
|
||||
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||
|
||||
|
||||
<LinearLayout
|
||||
<androidx.appcompat.widget.LinearLayoutCompat
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
@@ -146,7 +146,7 @@
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginEnd="16dp">
|
||||
|
||||
<LinearLayout
|
||||
<androidx.appcompat.widget.LinearLayoutCompat
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
@@ -168,10 +168,10 @@
|
||||
android:layout_gravity="center_vertical"
|
||||
android:gravity="center_horizontal"
|
||||
android:text="Scansiona il codice a barre di destinazione"/>
|
||||
</LinearLayout>
|
||||
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||
|
||||
</FrameLayout>
|
||||
</layout>
|
||||
@@ -10,7 +10,7 @@ buildscript {
|
||||
google()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:4.1.2'
|
||||
classpath 'com.android.tools.build:gradle:4.1.3'
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||
classpath 'com.google.gms:google-services:4.3.5'
|
||||
classpath 'com.google.firebase:perf-plugin:1.3.5'
|
||||
|
||||
Reference in New Issue
Block a user