Sistemato update e delete delle righe collo

This commit is contained in:
Giuseppe Scorrano 2020-04-14 11:04:00 +02:00
parent c1918a7bfd
commit bfcaaa758a
16 changed files with 518 additions and 84 deletions

View File

@ -0,0 +1,36 @@
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);
}
}

View File

@ -5,10 +5,15 @@ import android.view.KeyEvent;
import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatActivity;
import it.integry.integrywmsnative.core.barcode_reader.BarcodeManager; import it.integry.integrywmsnative.core.barcode_reader.BarcodeManager;
import it.integry.integrywmsnative.core.exception.MyExceptionHandler;
public class BaseActivity extends AppCompatActivity { public class BaseActivity extends AppCompatActivity {
public BaseActivity() {
// Thread.setDefaultUncaughtExceptionHandler(new MyExceptionHandler(this, BaseActivity.class));
}
@Override @Override
public boolean dispatchKeyEvent(KeyEvent event) { public boolean dispatchKeyEvent(KeyEvent event) {
if (BarcodeManager.isEnabled() && BarcodeManager.isKeyboardEmulator()) { if (BarcodeManager.isEnabled() && BarcodeManager.isKeyboardEmulator()) {

View File

@ -77,6 +77,10 @@ public class MtbColr extends EntityBase {
return gestione; return gestione;
} }
public GestioneEnum getGestioneEnum() {
return GestioneEnum.fromString(gestione);
}
public MtbColr setGestione(GestioneEnum gestione) { public MtbColr setGestione(GestioneEnum gestione) {
@ -188,6 +192,10 @@ public class MtbColr extends EntityBase {
return gestioneRif; return gestioneRif;
} }
public GestioneEnum getGestioneRifEnum() {
return GestioneEnum.fromString(gestioneRif);
}
public MtbColr setGestioneRif(String gestioneRif) { public MtbColr setGestioneRif(String gestioneRif) {
this.gestioneRif = gestioneRif; this.gestioneRif = gestioneRif;
return this; return this;

View File

@ -500,6 +500,16 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
} }
} }
public void getByChiaveCollo(GestioneEnum gestione, int numCollo, String dataCollo, String serCollo, boolean onlyResiduo, boolean throwExcIfNull, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
MtbColt mtbColtToRetrieve = new MtbColt()
.setGestione(gestione)
.setNumCollo(numCollo)
.setDataCollo(dataCollo)
.setSerCollo(serCollo);
ColliMagazzinoRESTConsumer.getByTestataStatic(mtbColtToRetrieve, onlyResiduo, throwExcIfNull, onComplete, onFailed);
}
public void getByTestata(MtbColt testata, boolean onlyResiduo, boolean throwExcIfNull, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) { public void getByTestata(MtbColt testata, boolean onlyResiduo, boolean throwExcIfNull, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
ColliMagazzinoRESTConsumer.getByTestataStatic(testata, onlyResiduo, throwExcIfNull, onComplete, onFailed); ColliMagazzinoRESTConsumer.getByTestataStatic(testata, onlyResiduo, throwExcIfNull, onComplete, onFailed);
} }
@ -590,7 +600,11 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
} }
public static void updateRiga(MtbColr mtbColrToUpdate, Runnable onComplete, RunnableArgs<Exception> onFailed) { 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) {
mtbColrToUpdate.setOperation(CommonModelConsts.OPERATION.UPDATE); mtbColrToUpdate.setOperation(CommonModelConsts.OPERATION.UPDATE);
@ -622,7 +636,7 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
ColliMagazzinoRESTConsumer.saveColloStatic(cloneMtbColt, value -> { ColliMagazzinoRESTConsumer.saveColloStatic(cloneMtbColt, value -> {
onComplete.run(); onComplete.run();
}, ex -> { }, ex -> {
if(onFailed != null) onFailed.run(ex); if (onFailed != null) onFailed.run(ex);
}); });
} }
@ -679,8 +693,6 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
} }
public static void retrieveBasketColli(RunnableArgs<List<MtbColt>> onComplete, RunnableArgs<Exception> onFailed) { public static void retrieveBasketColli(RunnableArgs<List<MtbColt>> onComplete, RunnableArgs<Exception> onFailed) {
ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = RESTBuilder.getService(ColliMagazzinoRESTConsumerService.class); ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = RESTBuilder.getService(ColliMagazzinoRESTConsumerService.class);
colliMagazzinoRESTConsumerService.getColliInBasket(SettingsManager.i().getUserSession().getDepo().getCodMdep()).enqueue(new Callback<ServiceRESTResponse<List<MtbColt>>>() { colliMagazzinoRESTConsumerService.getColliInBasket(SettingsManager.i().getUserSession().getDepo().getCodMdep()).enqueue(new Callback<ServiceRESTResponse<List<MtbColt>>>() {
@ -693,7 +705,7 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
@Override @Override
public void onFailure(Call<ServiceRESTResponse<List<MtbColt>>> call, Throwable t) { public void onFailure(Call<ServiceRESTResponse<List<MtbColt>>> call, Throwable t) {
if(onFailed != null) onFailed.run(new Exception(t)); if (onFailed != null) onFailed.run(new Exception(t));
} }
}); });
} }

View File

@ -226,7 +226,7 @@ public class MainFragment extends Fragment implements ITitledFragment, IScrollab
private void initGestMenu() { private void initGestMenu() {
ICustomConfiguration customConfiguration = ClassRouter.getInstance(ClassRouter.PATH.CUSTOM_CONFIGURATION); ICustomConfiguration customConfiguration = ClassRouter.getInstance(ClassRouter.PATH.CUSTOM_CONFIGURATION);
if (customConfiguration == null) { if (customConfiguration == null) {
MainApplication.restart(); // MainApplication.exit();
} }
BaseMenuConfiguration menuConfiguration = customConfiguration.getConfig(BaseCustomConfiguration.Keys.MENU_CONFIGURATION); BaseMenuConfiguration menuConfiguration = customConfiguration.getConfig(BaseCustomConfiguration.Keys.MENU_CONFIGURATION);

View File

@ -32,7 +32,9 @@ import it.integry.integrywmsnative.core.class_router.interfaces.ICustomConfigura
import it.integry.integrywmsnative.core.data_cache.DataCache; import it.integry.integrywmsnative.core.data_cache.DataCache;
import it.integry.integrywmsnative.core.di.BindableBoolean; import it.integry.integrywmsnative.core.di.BindableBoolean;
import it.integry.integrywmsnative.core.expansion.AtomicBigDecimal; import it.integry.integrywmsnative.core.expansion.AtomicBigDecimal;
import it.integry.integrywmsnative.core.expansion.BaseActivity;
import it.integry.integrywmsnative.core.expansion.RunnableArgs; import it.integry.integrywmsnative.core.expansion.RunnableArgs;
import it.integry.integrywmsnative.core.expansion.RunnableArgss;
import it.integry.integrywmsnative.core.expansion.RunnableArgsss; import it.integry.integrywmsnative.core.expansion.RunnableArgsss;
import it.integry.integrywmsnative.core.model.MtbColr; import it.integry.integrywmsnative.core.model.MtbColr;
import it.integry.integrywmsnative.core.model.MtbColt; import it.integry.integrywmsnative.core.model.MtbColt;
@ -46,6 +48,7 @@ import it.integry.integrywmsnative.core.utility.UtilityString;
import it.integry.integrywmsnative.databinding.ActivitySpedizioneBinding; import it.integry.integrywmsnative.databinding.ActivitySpedizioneBinding;
import it.integry.integrywmsnative.gest.spedizione_new.core.SpedizioneListAdapter; import it.integry.integrywmsnative.gest.spedizione_new.core.SpedizioneListAdapter;
import it.integry.integrywmsnative.gest.spedizione_new.core.SpedizioneListModel; import it.integry.integrywmsnative.gest.spedizione_new.core.SpedizioneListModel;
import it.integry.integrywmsnative.gest.spedizione_new.model.PickedQuantityDTO;
import it.integry.integrywmsnative.gest.spedizione_new.model.PickingObjectDTO; import it.integry.integrywmsnative.gest.spedizione_new.model.PickingObjectDTO;
import it.integry.integrywmsnative.gest.vendita.dto.OrdineVenditaInevasoDTO; import it.integry.integrywmsnative.gest.vendita.dto.OrdineVenditaInevasoDTO;
import it.integry.integrywmsnative.view.bottom_sheet__lu_content.BottomSheetFragmentLUContentView; import it.integry.integrywmsnative.view.bottom_sheet__lu_content.BottomSheetFragmentLUContentView;
@ -59,7 +62,7 @@ import it.integry.integrywmsnative.view.dialogs.input_quantity_v2.DialogInputQua
import it.integry.integrywmsnative.view.dialogs.input_quantity_v2.DialogInputQuantityV2DTO; import it.integry.integrywmsnative.view.dialogs.input_quantity_v2.DialogInputQuantityV2DTO;
import it.integry.integrywmsnative.view.dialogs.input_quantity_v2.DialogInputQuantityV2ResultDTO; import it.integry.integrywmsnative.view.dialogs.input_quantity_v2.DialogInputQuantityV2ResultDTO;
public class SpedizioneActivity extends AppCompatActivity implements SpedizioneViewModel.Listeners, BottomSheetFragmentLUContentViewModel.Listener, BottomSheetFragmentLUContentView.Listener { public class SpedizioneActivity extends BaseActivity implements SpedizioneViewModel.Listeners, BottomSheetFragmentLUContentViewModel.Listener, BottomSheetFragmentLUContentView.Listener {
private ActivitySpedizioneBinding mBindings; private ActivitySpedizioneBinding mBindings;
@ -115,9 +118,10 @@ public class SpedizioneActivity extends AppCompatActivity implements SpedizioneV
mBindings.setLifecycleOwner(this); mBindings.setLifecycleOwner(this);
mBindings.setSpedizioneView(this); mBindings.setSpedizioneView(this);
mBindings.bottomSheetLuContent.setListener(this);
mBindings.bottomSheetLuContent.init(mBindings.bottomSheetLuContent, null); mBindings.bottomSheetLuContent.init(mBindings.bottomSheetLuContent, null);
mBottomSheetFragmentLUContentViewModel = mBindings.bottomSheetLuContent.getViewModelInstance(); mBottomSheetFragmentLUContentViewModel = mBindings.bottomSheetLuContent.getViewModelInstance();
mBindings.bottomSheetLuContent.setListener(this);
mBottomSheetFragmentLUContentViewModel.setListener(this);
this.initVars(); this.initVars();
@ -313,12 +317,11 @@ public class SpedizioneActivity extends AppCompatActivity implements SpedizioneV
private RunnableArgs<BarcodeScanDTO> onScanSuccessful = data -> { private RunnableArgs<BarcodeScanDTO> onScanSuccessful = data -> {
BarcodeManager.disable(); BarcodeManager.disable();
mCurrentProgress = UtilityProgress.createDefaultProgressDialog(this); this.openProgress();
this.mViewmodel.processBarcodeDTO(data, () -> { this.mViewmodel.processBarcodeDTO(data, () -> {
BarcodeManager.enable(); BarcodeManager.enable();
mCurrentProgress.dismiss(); this.closeProgress();
mCurrentProgress = null;
}); });
}; };
@ -348,7 +351,7 @@ public class SpedizioneActivity extends AppCompatActivity implements SpedizioneV
public void createNewUL() { public void createNewUL() {
this.mBindings.spedizioneFab.close(true); this.mBindings.spedizioneFab.close(true);
mCurrentProgress = UtilityProgress.createDefaultProgressDialog(this); this.openProgress();
this.mViewmodel.createNewLU(null, null, () -> { this.mViewmodel.createNewLU(null, null, () -> {
mCurrentProgress.dismiss(); mCurrentProgress.dismiss();
@ -363,10 +366,7 @@ public class SpedizioneActivity extends AppCompatActivity implements SpedizioneV
@Override @Override
public void onDatasetLoaded() { public void onDatasetLoaded() {
if (mCurrentProgress != null) { this.closeProgress();
mCurrentProgress.dismiss();
mCurrentProgress = null;
}
} }
@Override @Override
@ -375,19 +375,18 @@ public class SpedizioneActivity extends AppCompatActivity implements SpedizioneV
FBToast.successToast(this, getResources().getString(R.string.data_saved), FBToast.LENGTH_SHORT); FBToast.successToast(this, getResources().getString(R.string.data_saved), FBToast.LENGTH_SHORT);
this.mBottomSheetFragmentLUContentViewModel.setMtbColt(mtbColt); this.mBottomSheetFragmentLUContentViewModel.setMtbColt(mtbColt);
this.closeProgress();
} }
@Override @Override
public void onLUClosing() { public void onLUClosing() {
mCurrentProgress = UtilityProgress.createDefaultProgressDialog(this); this.openProgress();
} }
@Override @Override
public void onLUClosed() { public void onLUClosed() {
if (mCurrentProgress != null) { this.closeProgress();
mCurrentProgress.dismiss();
mCurrentProgress = null;
}
noLUPresent.set(true); noLUPresent.set(true);
this.mBottomSheetFragmentLUContentViewModel.setMtbColt(null); this.mBottomSheetFragmentLUContentViewModel.setMtbColt(null);
@ -409,6 +408,7 @@ public class SpedizioneActivity extends AppCompatActivity implements SpedizioneV
@Override @Override
public void onLUPrintError(Exception ex, Runnable onComplete) { public void onLUPrintError(Exception ex, Runnable onComplete) {
this.closeProgress();
DialogSimpleMessageHelper.makeErrorDialog( DialogSimpleMessageHelper.makeErrorDialog(
this, this,
new SpannableString(ex.getMessage()), new SpannableString(ex.getMessage()),
@ -431,18 +431,29 @@ public class SpedizioneActivity extends AppCompatActivity implements SpedizioneV
} }
@Override @Override
public void onError(Exception ex) { public void onMtbColrDeleteRequest(RunnableArgs<Boolean> onComplete) {
if (mCurrentProgress != null) { String text = getResources().getString(R.string.alert_delete_mtb_colr);
mCurrentProgress.dismiss(); DialogSimpleMessageHelper.makeWarningDialog(this,
mCurrentProgress = null; new SpannableString(text),
null,
() -> onComplete.run(true),
() -> onComplete.run(false)
).show();
} }
@Override
public void onError(Exception ex) {
this.closeProgress();
UtilityExceptions.defaultException(this, ex, mCurrentProgress); UtilityExceptions.defaultException(this, ex, mCurrentProgress);
BarcodeManager.enable(); BarcodeManager.enable();
} }
@Override @Override
public void onItemDispatched(PickingObjectDTO pickingObjectDTO, public void onItemDispatched(PickingObjectDTO pickingObjectDTO,
BigDecimal initialNumCnf,
BigDecimal initialQtaCnf,
BigDecimal initialQtaTot,
BigDecimal totalQtaOrd, BigDecimal totalQtaOrd,
BigDecimal totalNumCnfOrd, BigDecimal totalNumCnfOrd,
BigDecimal qtaCnfOrd, BigDecimal qtaCnfOrd,
@ -454,9 +465,13 @@ public class SpedizioneActivity extends AppCompatActivity implements SpedizioneV
BigDecimal qtaCnfAvailable, BigDecimal qtaCnfAvailable,
String partitaMag, String partitaMag,
Date dataScad, Date dataScad,
boolean canOverflowOrderQuantity) { boolean canOverflowOrderQuantity,
RunnableArgss<PickedQuantityDTO, Boolean> onComplete) {
DialogInputQuantityV2DTO dialogInputQuantityV2DTO = new DialogInputQuantityV2DTO() DialogInputQuantityV2DTO dialogInputQuantityV2DTO = new DialogInputQuantityV2DTO()
.setMtbAart(pickingObjectDTO.getMtbAart()) .setMtbAart(pickingObjectDTO.getMtbAart())
.setInitialNumCnf(initialNumCnf)
.setInitialQtaCnf(initialQtaCnf)
.setInitialQtaTot(initialQtaTot)
.setTotalQtaOrd(totalQtaOrd) .setTotalQtaOrd(totalQtaOrd)
.setTotalNumCnfOrd(totalNumCnfOrd) .setTotalNumCnfOrd(totalNumCnfOrd)
.setQtaCnfOrd(qtaCnfOrd) .setQtaCnfOrd(qtaCnfOrd)
@ -471,31 +486,23 @@ public class SpedizioneActivity extends AppCompatActivity implements SpedizioneV
.setCanOverflowOrderQuantity(canOverflowOrderQuantity); .setCanOverflowOrderQuantity(canOverflowOrderQuantity);
DialogInputQuantityV2 DialogInputQuantityV2
.newInstance(dialogInputQuantityV2DTO, (resultDTO, shouldCloseLU) -> this.onDialogInputQuantityResult(pickingObjectDTO, resultDTO, shouldCloseLU)) .newInstance(dialogInputQuantityV2DTO, (resultDTO, shouldCloseLU) -> {
PickedQuantityDTO pickedQuantityDTO = new PickedQuantityDTO()
.setNumCnf(resultDTO.getNumCnf())
.setQtaCnf(resultDTO.getQtaCnf())
.setQtaTot(resultDTO.getQtaTot())
.setPartitaMag(resultDTO.getPartitaMag())
.setDataScad(resultDTO.getDataScad());
this.openProgress();
onComplete.run(pickedQuantityDTO, shouldCloseLU);
})
.show(getSupportFragmentManager(), "tag"); .show(getSupportFragmentManager(), "tag");
} }
private void onDialogInputQuantityResult(PickingObjectDTO pickingObjectDTO, DialogInputQuantityV2ResultDTO resultDTO, boolean shouldCloseLU) {
mCurrentProgress = UtilityProgress.createDefaultProgressDialog(this);
this.mViewmodel.saveRow(
pickingObjectDTO,
resultDTO.getNumCnf(),
resultDTO.getQtaCnf(),
resultDTO.getQtaTot(),
resultDTO.getPartitaMag(),
resultDTO.getDataScad(),
shouldCloseLU
);
}
@Override @Override
public void onRowSaved() { public void onRowSaved() {
if (mCurrentProgress != null) { this.closeProgress();
mCurrentProgress.dismiss();
mCurrentProgress = null;
}
FBToast.successToast(this, getResources().getString(R.string.data_saved), FBToast.LENGTH_SHORT); FBToast.successToast(this, getResources().getString(R.string.data_saved), FBToast.LENGTH_SHORT);
} }
@ -506,11 +513,24 @@ public class SpedizioneActivity extends AppCompatActivity implements SpedizioneV
@Override @Override
public void onMtbColrEdit(MtbColr mtbColr) { public void onMtbColrEdit(MtbColr mtbColr) {
Toast.makeText(this, "Edit", Toast.LENGTH_SHORT).show(); this.mViewmodel.dispatchRowEdit(mtbColr);
} }
@Override @Override
public void onMtbColrDelete(MtbColr mtbColr) { public void onMtbColrDelete(MtbColr mtbColr) {
Toast.makeText(this, "Delete", Toast.LENGTH_SHORT).show(); this.mViewmodel.deleteRow(mtbColr);
}
private void openProgress() {
if (this.mCurrentProgress == null) {
this.mCurrentProgress = UtilityProgress.createDefaultProgressDialog(this);
}
}
private void closeProgress() {
if (mCurrentProgress != null) {
mCurrentProgress.dismiss();
mCurrentProgress = null;
}
} }
} }

View File

@ -24,6 +24,7 @@ import it.integry.integrywmsnative.core.class_router.interfaces.IOrdiniVendita;
import it.integry.integrywmsnative.core.data_recover.ColliDataRecoverService; import it.integry.integrywmsnative.core.data_recover.ColliDataRecoverService;
import it.integry.integrywmsnative.core.expansion.AtomicBigDecimal; import it.integry.integrywmsnative.core.expansion.AtomicBigDecimal;
import it.integry.integrywmsnative.core.expansion.RunnableArgs; import it.integry.integrywmsnative.core.expansion.RunnableArgs;
import it.integry.integrywmsnative.core.expansion.RunnableArgss;
import it.integry.integrywmsnative.core.expansion.RunnableArgsss; import it.integry.integrywmsnative.core.expansion.RunnableArgsss;
import it.integry.integrywmsnative.core.model.CommonModelConsts; import it.integry.integrywmsnative.core.model.CommonModelConsts;
import it.integry.integrywmsnative.core.model.FiltroOrdineDTO; import it.integry.integrywmsnative.core.model.FiltroOrdineDTO;
@ -57,6 +58,7 @@ import it.integry.integrywmsnative.gest.spedizione_new.exceptions.NoResultFromBa
import it.integry.integrywmsnative.gest.spedizione_new.exceptions.NotCurrentYearLUException; import it.integry.integrywmsnative.gest.spedizione_new.exceptions.NotCurrentYearLUException;
import it.integry.integrywmsnative.gest.spedizione_new.exceptions.ScannedPositionNotExistException; import it.integry.integrywmsnative.gest.spedizione_new.exceptions.ScannedPositionNotExistException;
import it.integry.integrywmsnative.gest.spedizione_new.model.PickDataDTO; import it.integry.integrywmsnative.gest.spedizione_new.model.PickDataDTO;
import it.integry.integrywmsnative.gest.spedizione_new.model.PickedQuantityDTO;
import it.integry.integrywmsnative.gest.spedizione_new.model.PickingObjectDTO; import it.integry.integrywmsnative.gest.spedizione_new.model.PickingObjectDTO;
import it.integry.integrywmsnative.gest.vendita.dto.OrdineVenditaInevasoDTO; import it.integry.integrywmsnative.gest.vendita.dto.OrdineVenditaInevasoDTO;
@ -266,46 +268,54 @@ public class SpedizioneViewModel {
private void sendDatasetLoaded() { private void sendDatasetLoaded() {
if(this.mListeners != null) mListeners.onDatasetLoaded(); if (this.mListeners != null) mListeners.onDatasetLoaded();
} }
private void sendError(Exception ex) { private void sendError(Exception ex) {
if(this.mListeners != null) mListeners.onError(ex); if (this.mListeners != null) mListeners.onError(ex);
} }
private void sendLUCreated(MtbColt mtbColt) { private void sendLUCreated(MtbColt mtbColt) {
if(this.mListeners != null) mListeners.onLUCreated(mtbColt); if (this.mListeners != null) mListeners.onLUCreated(mtbColt);
} }
private void sendLUPesoRequired(String codTcol, BigDecimal netWeightKG, BigDecimal grossWeightKG, RunnableArgsss<String, BigDecimal, BigDecimal> onComplete) { private void sendLUPesoRequired(String codTcol, BigDecimal netWeightKG, BigDecimal grossWeightKG, RunnableArgsss<String, BigDecimal, BigDecimal> onComplete) {
if(this.mListeners != null) mListeners.onLUPesoRequired(codTcol, netWeightKG, grossWeightKG, onComplete); if (this.mListeners != null)
mListeners.onLUPesoRequired(codTcol, netWeightKG, grossWeightKG, onComplete);
} }
private void sendLUPrintRequest(RunnableArgs<Boolean> onComplete) { private void sendLUPrintRequest(RunnableArgs<Boolean> onComplete) {
if(this.mListeners != null) mListeners.onLUPrintRequest(onComplete); if (this.mListeners != null) mListeners.onLUPrintRequest(onComplete);
} }
private void sendLUPrintError(Exception ex, Runnable onComplete) { private void sendLUPrintError(Exception ex, Runnable onComplete) {
if(this.mListeners != null) mListeners.onLUPrintError(ex, onComplete); if (this.mListeners != null) mListeners.onLUPrintError(ex, onComplete);
} }
private void sendLUClosing() { private void sendLUClosing() {
if(this.mListeners != null) mListeners.onLUClosing(); if (this.mListeners != null) mListeners.onLUClosing();
} }
private void sendLUClosed() { private void sendLUClosed() {
if(this.mListeners != null) mListeners.onLUClosed(); if (this.mListeners != null) mListeners.onLUClosed();
} }
private void sendFilterApplied(String newValue) { private void sendFilterApplied(String newValue) {
if(this.mListeners != null) mListeners.onFilterApplied(newValue); if (this.mListeners != null) mListeners.onFilterApplied(newValue);
} }
private void sendFilterRemoved() { private void sendFilterRemoved() {
if(this.mListeners != null) mListeners.onFilterRemoved(); if (this.mListeners != null) mListeners.onFilterRemoved();
}
private void sendMtbColrDeleteRequest(RunnableArgs<Boolean> onComplete) {
if (this.mListeners != null) mListeners.onMtbColrDeleteRequest(onComplete);
} }
private void sendOnItemDispatched(PickingObjectDTO pickingObjectDTO, private void sendOnItemDispatched(PickingObjectDTO pickingObjectDTO,
BigDecimal initialNumCnf,
BigDecimal initialQtaCnf,
BigDecimal initialQtaTot,
BigDecimal totalQtaOrd, BigDecimal totalQtaOrd,
BigDecimal totalNumCnfOrd, BigDecimal totalNumCnfOrd,
BigDecimal qtaCnfOrd, BigDecimal qtaCnfOrd,
@ -317,8 +327,12 @@ public class SpedizioneViewModel {
BigDecimal qtaCnfAvailable, BigDecimal qtaCnfAvailable,
String partitaMag, String partitaMag,
Date dataScad, Date dataScad,
boolean canOverflowOrderQuantity) { boolean canOverflowOrderQuantity,
if(this.mListeners != null) mListeners.onItemDispatched(pickingObjectDTO, RunnableArgss<PickedQuantityDTO, Boolean> onComplete) {
if (this.mListeners != null) mListeners.onItemDispatched(pickingObjectDTO,
initialNumCnf,
initialQtaCnf,
initialQtaTot,
totalQtaOrd, totalQtaOrd,
totalNumCnfOrd, totalNumCnfOrd,
qtaCnfOrd, qtaCnfOrd,
@ -330,11 +344,12 @@ public class SpedizioneViewModel {
qtaCnfAvailable, qtaCnfAvailable,
partitaMag, partitaMag,
dataScad, dataScad,
canOverflowOrderQuantity); canOverflowOrderQuantity,
onComplete);
} }
private void sendOnRowSaved() { private void sendOnRowSaved() {
if(this.mListeners != null) mListeners.onRowSaved(); if (this.mListeners != null) mListeners.onRowSaved();
} }
public void processBarcodeDTO(BarcodeScanDTO barcodeScanDTO, Runnable onComplete) { public void processBarcodeDTO(BarcodeScanDTO barcodeScanDTO, Runnable onComplete) {
@ -727,6 +742,7 @@ public class SpedizioneViewModel {
this.sendOnItemDispatched( this.sendOnItemDispatched(
pickingObjectDTO, pickingObjectDTO,
null, null, null,
qtaDaEvadere, qtaDaEvadere,
numCnfDaEvadere, numCnfDaEvadere,
qtaCnfDaEvadere, qtaCnfDaEvadere,
@ -738,10 +754,151 @@ public class SpedizioneViewModel {
qtaCnfAvailable, qtaCnfAvailable,
partitaMag, partitaMag,
dataScad, dataScad,
mCanOverflowOrderQuantity); mCanOverflowOrderQuantity,
(pickedQuantityDTO, shouldCloseLU) -> {
this.saveNewRow(pickingObjectDTO,
pickedQuantityDTO.getNumCnf(),
pickedQuantityDTO.getQtaCnf(),
pickedQuantityDTO.getQtaTot(),
pickedQuantityDTO.getPartitaMag(),
pickedQuantityDTO.getDataScad(),
shouldCloseLU);
});
} }
public void dispatchRowEdit(final MtbColr mtbColrToEdit) {
PickingObjectDTO pickingObjectDTO = Stream.of(this.mPickingList.getValue())
.filter(x -> Stream.of(x.getWithdrawMtbColr()).anyMatch(y -> y == mtbColrToEdit))
.single();
loadRifULFromMtbColr(mtbColrToEdit, mtbColtRif -> {
BigDecimal totalQtaOrd = pickingObjectDTO.getSitArtOrdDTO().getQtaOrd();
BigDecimal totalNumCnfOrd = pickingObjectDTO.getSitArtOrdDTO().getNumCnfOrd();
BigDecimal qtaCnfOrd = pickingObjectDTO.getSitArtOrdDTO().getQtaCnfOrd();
AtomicBigDecimal numCnfWithdrawRows = new AtomicBigDecimal();
AtomicBigDecimal qtaColWithdrawRows = new AtomicBigDecimal();
Stream.of(pickingObjectDTO.getWithdrawMtbColr())
.forEach(row -> {
numCnfWithdrawRows.addAndGet(row.getNumCnf());
qtaColWithdrawRows.addAndGet(row.getQtaCol());
});
BigDecimal numCnfDaEvadere = totalNumCnfOrd.subtract(numCnfWithdrawRows.getBigDecimalValue()).add(mtbColrToEdit.getNumCnf());
BigDecimal qtaDaEvadere = totalQtaOrd.subtract(qtaColWithdrawRows.getBigDecimalValue()).add(mtbColrToEdit.getQtaCol());
BigDecimal qtaCnfDaEvadere = mtbColrToEdit.getQtaCnf();
BigDecimal numCnfDaPrelevare = null;
BigDecimal qtaColDaPrelevare = null;
BigDecimal qtaCnfDaPrelevare = null;
BigDecimal totalQtaAvailable = null;
BigDecimal totalNumCnfAvailable = null;
BigDecimal qtaCnfAvailable = null;
String partitaMag = null;
Date dataScad = null;
List<MtbColr> mtbColrRifs = mtbColtRif != null &&
mtbColtRif.getMtbColr() != null ? mtbColtRif.getMtbColr() : null;
MtbColr mtbColrRif = null;
if (mtbColrRifs != null && mtbColrRifs.size() > 0) {
//TODO: Da capire se è necessario controllare anche il cod_jcom
mtbColrRif = Stream.of(mtbColrRifs)
.filter(x -> UtilityString.equalsIgnoreCase(x.getCodMart(), mtbColrToEdit.getCodMart()) &&
UtilityString.equalsIgnoreCase(x.getCodCol(), mtbColrToEdit.getCodCol()) &&
UtilityString.equalsIgnoreCase(x.getCodTagl(), mtbColrToEdit.getCodTagl()) &&
UtilityString.equalsIgnoreCase(x.getPartitaMag(), mtbColrToEdit.getPartitaMag()))
.single();
}
if (mtbColrRif != null) {
totalQtaAvailable = mtbColrRif.getQtaCol();
totalNumCnfAvailable = mtbColrRif.getNumCnf();
qtaCnfAvailable = mtbColrRif.getQtaCnf();
} else {
totalQtaAvailable = mtbColrToEdit.getQtaCol();
totalNumCnfAvailable = mtbColrToEdit.getNumCnf();
qtaCnfAvailable = mtbColrToEdit.getQtaCnf();
}
totalNumCnfAvailable = totalNumCnfAvailable.add(mtbColrToEdit.getNumCnf());
totalQtaAvailable = totalQtaAvailable.add(mtbColrToEdit.getQtaCol());
if (UtilityBigDecimal.lowerThan(numCnfDaPrelevare, BigDecimal.ZERO))
numCnfDaPrelevare = BigDecimal.ZERO;
if (UtilityBigDecimal.lowerThan(qtaColDaPrelevare, BigDecimal.ZERO))
qtaColDaPrelevare = BigDecimal.ZERO;
partitaMag = mtbColrToEdit.getPartitaMag();
dataScad = mtbColrToEdit.getDataScadPartitaD();
this.sendOnItemDispatched(
pickingObjectDTO,
mtbColrToEdit.getNumCnf(),
mtbColrToEdit.getQtaCnf(),
mtbColrToEdit.getQtaCol(),
qtaDaEvadere,
numCnfDaEvadere,
qtaCnfDaEvadere,
qtaColDaPrelevare,
numCnfDaPrelevare,
qtaCnfDaPrelevare,
totalQtaAvailable,
totalNumCnfAvailable,
qtaCnfAvailable,
partitaMag,
dataScad,
mCanOverflowOrderQuantity,
(pickedQuantityDTO, shouldCloseLU) -> {
this.saveEditedRow(mtbColrToEdit,
pickedQuantityDTO.getNumCnf(),
pickedQuantityDTO.getQtaCnf(),
pickedQuantityDTO.getQtaTot(),
pickedQuantityDTO.getPartitaMag(),
pickedQuantityDTO.getDataScad(),
shouldCloseLU);
});
});
}
private void loadRifULFromMtbColr(MtbColr mtbColr, RunnableArgs<MtbColt> onComplete) {
//Se ho dei riferimenti ad una UL devo leggere la QTA ancora disponibile sulla Ul
if (!UtilityString.isNullOrEmpty(mtbColr.getGestioneRif()) &&
!UtilityString.isNullOrEmpty(mtbColr.getSerColloRif()) &&
!UtilityString.isNullOrEmpty(mtbColr.getDataColloRifS()) &&
mtbColr.getNumColloRif() != null) {
mColliMagazzinoRESTConsumer.getByChiaveCollo(
mtbColr.getGestioneRifEnum(),
mtbColr.getNumColloRif(),
mtbColr.getDataColloRifS(),
mtbColr.getSerColloRif(),
true,
false,
onComplete,
this::sendError);
} else {
onComplete.run(null);
}
}
public void createNewLU(Integer customNumCollo, String customSerCollo, Runnable onComplete) { public void createNewLU(Integer customNumCollo, String customSerCollo, Runnable onComplete) {
MtbColt mtbColt = new MtbColt(); MtbColt mtbColt = new MtbColt();
mtbColt.initDefaultFields(); mtbColt.initDefaultFields();
@ -778,10 +935,11 @@ public class SpedizioneViewModel {
} }
public void saveRow(PickingObjectDTO pickingObjectDTO, BigDecimal numCnf, BigDecimal qtaCnf, BigDecimal qtaTot, String partitaMag, Date dataScad, boolean shouldCloseLU) { public void saveNewRow(PickingObjectDTO pickingObjectDTO, BigDecimal numCnf, BigDecimal qtaCnf, BigDecimal qtaTot, String partitaMag, Date dataScad, boolean shouldCloseLU) {
final MtbColr mtbColr = new MtbColr() final MtbColr mtbColr = new MtbColr()
.setCodMart(pickingObjectDTO.getSitArtOrdDTO().getCodMart()) .setCodMart(pickingObjectDTO.getSitArtOrdDTO().getCodMart())
.setPartitaMag(partitaMag) .setPartitaMag(partitaMag)
.setDataScadPartita(dataScad)
.setQtaCol(qtaTot) .setQtaCol(qtaTot)
.setQtaCnf(qtaCnf) .setQtaCnf(qtaCnf)
.setNumCnf(numCnf) .setNumCnf(numCnf)
@ -814,7 +972,7 @@ public class SpedizioneViewModel {
mCurrentMtbColt.setPesoNettoKg(sourceMtbColt.getPesoNettoKg()); mCurrentMtbColt.setPesoNettoKg(sourceMtbColt.getPesoNettoKg());
} }
} else if (mEnableGiacenza && pickingObjectDTO.getMtbColts() != null && pickingObjectDTO.getMtbColts().size() > 0) { } else if (mEnableGiacenza && pickingObjectDTO.getMtbColts() != null && pickingObjectDTO.getMtbColts().size() > 0) {
// Vecchia logica di aggancio UL // Vecchia logica di aggancio UL (se non ho sparato una etichetta UL comunque ti aggangio la prima UL suggerita)
// mtbColr // mtbColr
// .setCodJcom(UtilityString.empty2null(item.getCodJcom())) // .setCodJcom(UtilityString.empty2null(item.getCodJcom()))
// .setSerColloRif(UtilityString.empty2null(item.getSerCollo())) // .setSerColloRif(UtilityString.empty2null(item.getSerCollo()))
@ -867,6 +1025,89 @@ public class SpedizioneViewModel {
} }
public void saveEditedRow(MtbColr mtbColrToUpdate, BigDecimal numCnf, BigDecimal qtaCnf, BigDecimal qtaTot, String partitaMag, Date dataScad, boolean shouldCloseLU) {
MtbColt mtbColt = new MtbColt()
.setNumCollo(mtbColrToUpdate.getNumCollo())
.setDataCollo(mtbColrToUpdate.getDataColloS())
.setSerCollo(mtbColrToUpdate.getSerCollo())
.setGestione(mtbColrToUpdate.getGestione())
.setMtbColr(new ObservableArrayList<>());
mtbColt.setOperation(CommonModelConsts.OPERATION.NO_OP);
final MtbColr mtbColr = (MtbColr) mtbColrToUpdate.clone();
mtbColr.setOperation(CommonModelConsts.OPERATION.INSERT);
mtbColr.setRiga(null)
.setNumCnf(numCnf.subtract(mtbColrToUpdate.getNumCnf()))
.setQtaCnf(qtaCnf)
.setQtaCol(qtaTot.subtract(mtbColrToUpdate.getQtaCol()))
.setPartitaMag(partitaMag)
.setDataScadPartita(dataScad);
mtbColt.getMtbColr().add(mtbColr);
this.mColliMagazzinoRESTConsumer.saveCollo(mtbColt, (value) -> {
PickingObjectDTO pickingObjectDTO = Stream.of(this.mPickingList.getValue())
.filter(x -> Stream.of(x.getWithdrawMtbColr()).anyMatch(y -> y == mtbColrToUpdate))
.single();
mtbColr.setNumCnf(numCnf)
.setQtaCnf(qtaCnf)
.setQtaCol(qtaTot);
pickingObjectDTO.getWithdrawMtbColr().remove(mtbColrToUpdate);
pickingObjectDTO.getWithdrawMtbColr().add(mtbColr);
this.mCurrentMtbColt.getMtbColr().remove(mtbColrToUpdate);
this.mCurrentMtbColt.getMtbColr().add(mtbColr);
this.resetMatchedRows();
this.sendOnRowSaved();
}, this::sendError);
}
public void deleteRow(MtbColr mtbColrToDelete) {
this.sendMtbColrDeleteRequest(shouldDelete -> {
if (shouldDelete) {
MtbColt mtbColt = new MtbColt()
.setNumCollo(mtbColrToDelete.getNumCollo())
.setDataCollo(mtbColrToDelete.getDataColloS())
.setSerCollo(mtbColrToDelete.getSerCollo())
.setGestione(mtbColrToDelete.getGestione())
.setMtbColr(new ObservableArrayList<>());
mtbColt.setOperation(CommonModelConsts.OPERATION.NO_OP);
MtbColr mtbColr = (MtbColr) mtbColrToDelete.clone();
mtbColr.setOperation(CommonModelConsts.OPERATION.INSERT);
mtbColr.setQtaCol(mtbColr.getQtaCol().multiply(new BigDecimal(-1)))
.setNumCnf(mtbColr.getNumCnf().multiply(new BigDecimal(-1)))
.setRiga(null);
mtbColt.getMtbColr().add(mtbColr);
this.mColliMagazzinoRESTConsumer.saveCollo(mtbColt, (value) -> {
PickingObjectDTO pickingObjectDTO = Stream.of(this.mPickingList.getValue())
.filter(x -> Stream.of(x.getWithdrawMtbColr()).anyMatch(y -> y == mtbColrToDelete))
.single();
pickingObjectDTO.getWithdrawMtbColr().remove(mtbColrToDelete);
this.mCurrentMtbColt.getMtbColr().remove(mtbColrToDelete);
this.resetMatchedRows();
this.sendOnRowSaved();
}, this::sendError);
}
});
}
public void closeLU(boolean shouldPrint) { public void closeLU(boolean shouldPrint) {
if (mCurrentMtbColt == null) return; if (mCurrentMtbColt == null) return;
@ -976,15 +1217,15 @@ public class SpedizioneViewModel {
this.mCurrentMtbColt = null; this.mCurrentMtbColt = null;
for(PickingObjectDTO pickingObjectDTO : mPickingList.getValue()) { for (PickingObjectDTO pickingObjectDTO : mPickingList.getValue()) {
List<MtbColr> withdrawMtbColrList = pickingObjectDTO.getWithdrawMtbColr(); List<MtbColr> withdrawMtbColrList = pickingObjectDTO.getWithdrawMtbColr();
for(MtbColr withdrawMtbColr : withdrawMtbColrList) { for (MtbColr withdrawMtbColr : withdrawMtbColrList) {
pickingObjectDTO.getSitArtOrdDTO().setNumCnfOrd(pickingObjectDTO.getSitArtOrdDTO().getNumCnfOrd().subtract(withdrawMtbColr.getNumCnf())); pickingObjectDTO.getSitArtOrdDTO().setNumCnfOrd(pickingObjectDTO.getSitArtOrdDTO().getNumCnfOrd().subtract(withdrawMtbColr.getNumCnf()));
pickingObjectDTO.getSitArtOrdDTO().setQtaOrd(pickingObjectDTO.getSitArtOrdDTO().getQtaOrd().subtract(withdrawMtbColr.getQtaCol())); pickingObjectDTO.getSitArtOrdDTO().setQtaOrd(pickingObjectDTO.getSitArtOrdDTO().getQtaOrd().subtract(withdrawMtbColr.getQtaCol()));
if(pickingObjectDTO.getMtbColts() != null) { if (pickingObjectDTO.getMtbColts() != null) {
Stream.of(pickingObjectDTO.getMtbColts()) Stream.of(pickingObjectDTO.getMtbColts())
.filter(x -> Objects.equals(x.getNumCollo(), withdrawMtbColr.getNumColloRif()) && .filter(x -> Objects.equals(x.getNumCollo(), withdrawMtbColr.getNumColloRif()) &&
x.getDataColloS().equals(withdrawMtbColr.getDataColloRifS()) && x.getDataColloS().equals(withdrawMtbColr.getDataColloRifS()) &&
@ -1005,6 +1246,7 @@ public class SpedizioneViewModel {
} }
} }
pickingObjectDTO.setWithdrawMtbColr(new ArrayList<>());
} }
this.resetMatchedRows(); this.resetMatchedRows();
@ -1059,9 +1301,14 @@ public class SpedizioneViewModel {
void onFilterRemoved(); void onFilterRemoved();
void onMtbColrDeleteRequest(RunnableArgs<Boolean> onComplete);
void onError(Exception ex); void onError(Exception ex);
void onItemDispatched(PickingObjectDTO pickingObjectDTO, void onItemDispatched(PickingObjectDTO pickingObjectDTO,
BigDecimal initialNumCnf,
BigDecimal initialQtaCnf,
BigDecimal initialQtaTot,
BigDecimal totalQtaOrd, BigDecimal totalQtaOrd,
BigDecimal totalNumCnfOrd, BigDecimal totalNumCnfOrd,
BigDecimal qtaCnfOrd, BigDecimal qtaCnfOrd,
@ -1073,7 +1320,8 @@ public class SpedizioneViewModel {
BigDecimal qtaCnfAvailable, BigDecimal qtaCnfAvailable,
String partitaMag, String partitaMag,
Date dataScad, Date dataScad,
boolean canOverflowOrderQuantity); boolean canOverflowOrderQuantity,
RunnableArgss<PickedQuantityDTO, Boolean> onComplete);
void onRowSaved(); void onRowSaved();
} }

View File

@ -0,0 +1,59 @@
package it.integry.integrywmsnative.gest.spedizione_new.model;
import java.math.BigDecimal;
import java.util.Date;
public class PickedQuantityDTO {
private String partitaMag;
private Date dataScad;
private BigDecimal numCnf;
private BigDecimal qtaCnf;
private BigDecimal qtaTot;
public String getPartitaMag() {
return partitaMag;
}
public PickedQuantityDTO setPartitaMag(String partitaMag) {
this.partitaMag = partitaMag;
return this;
}
public Date getDataScad() {
return dataScad;
}
public PickedQuantityDTO setDataScad(Date dataScad) {
this.dataScad = dataScad;
return this;
}
public BigDecimal getNumCnf() {
return numCnf;
}
public PickedQuantityDTO setNumCnf(BigDecimal numCnf) {
this.numCnf = numCnf;
return this;
}
public BigDecimal getQtaCnf() {
return qtaCnf;
}
public PickedQuantityDTO setQtaCnf(BigDecimal qtaCnf) {
this.qtaCnf = qtaCnf;
return this;
}
public BigDecimal getQtaTot() {
return qtaTot;
}
public PickedQuantityDTO setQtaTot(BigDecimal qtaTot) {
this.qtaTot = qtaTot;
return this;
}
}

View File

@ -1,6 +1,5 @@
package it.integry.integrywmsnative.gest.spedizione_new.model; package it.integry.integrywmsnative.gest.spedizione_new.model;
import java.math.BigDecimal;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -18,9 +17,6 @@ public class PickingObjectDTO {
private PickDataDTO tempPickData; private PickDataDTO tempPickData;
private List<MtbColr> withdrawMtbColr = new ArrayList<>(); private List<MtbColr> withdrawMtbColr = new ArrayList<>();
// private BigDecimal qtaDisponibileCollo;
// private BigDecimal numCnfDisponibileCollo;
private boolean hidden = false; private boolean hidden = false;

View File

@ -3,17 +3,12 @@ package it.integry.integrywmsnative.view.bottom_sheet__lu_content;
import android.content.Context; import android.content.Context;
import android.util.AttributeSet; import android.util.AttributeSet;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.databinding.DataBindingUtil; import androidx.databinding.DataBindingUtil;
import androidx.databinding.Observable; import androidx.databinding.Observable;
import androidx.databinding.ObservableList; import androidx.databinding.ObservableList;
import com.google.android.material.bottomsheet.BottomSheetBehavior;
import com.linearlistview.LinearListView;
import java.util.List; import java.util.List;
import it.integry.integrywmsnative.R; import it.integry.integrywmsnative.R;

View File

@ -190,7 +190,7 @@ public class ArticoliInColloBottomSheetViewModel {
cloneItemToEdit.setQtaCol(quantityDTO.qtaTot.getBigDecimal()); cloneItemToEdit.setQtaCol(quantityDTO.qtaTot.getBigDecimal());
cloneItemToEdit.setNumCnf(quantityDTO.numCnf.getBigDecimal()); cloneItemToEdit.setNumCnf(quantityDTO.numCnf.getBigDecimal());
ColliMagazzinoRESTConsumer.updateRiga(cloneItemToEdit, () ->{ ColliMagazzinoRESTConsumer.updateRigaStatic(cloneItemToEdit, () ->{
mBottomSheetBehavior.setState(BottomSheetBehavior.STATE_COLLAPSED); mBottomSheetBehavior.setState(BottomSheetBehavior.STATE_COLLAPSED);
itemToEdit.setQtaCol(quantityDTO.qtaTot.getBigDecimal()); itemToEdit.setQtaCol(quantityDTO.qtaTot.getBigDecimal());

View File

@ -79,6 +79,9 @@ public class DialogInputQuantityV2 extends DialogFragment implements DialogInput
this.mViewModel = new DialogInputQuantityV2ViewModel() this.mViewModel = new DialogInputQuantityV2ViewModel()
.setMtbAart(mDialogInputQuantityV2DTO.getMtbAart()) .setMtbAart(mDialogInputQuantityV2DTO.getMtbAart())
.setInitialNumCnf(mDialogInputQuantityV2DTO.getInitialNumCnf())
.setInitialQtaCnf(mDialogInputQuantityV2DTO.getInitialQtaCnf())
.setInitialQtaTot(mDialogInputQuantityV2DTO.getInitialQtaTot())
.setTotalNumCnfOrd(mDialogInputQuantityV2DTO.getTotalNumCnfOrd()) .setTotalNumCnfOrd(mDialogInputQuantityV2DTO.getTotalNumCnfOrd())
.setTotalQtaOrd(mDialogInputQuantityV2DTO.getTotalQtaOrd()) .setTotalQtaOrd(mDialogInputQuantityV2DTO.getTotalQtaOrd())
.setQtaCnfOrd(mDialogInputQuantityV2DTO.getQtaCnfOrd()) .setQtaCnfOrd(mDialogInputQuantityV2DTO.getQtaCnfOrd())

View File

@ -9,6 +9,10 @@ public class DialogInputQuantityV2DTO {
private MtbAart mtbAart; private MtbAart mtbAart;
private BigDecimal initialNumCnf;
private BigDecimal initialQtaCnf;
private BigDecimal initialQtaTot;
private BigDecimal totalQtaOrd; private BigDecimal totalQtaOrd;
private BigDecimal totalNumCnfOrd; private BigDecimal totalNumCnfOrd;
private BigDecimal qtaCnfOrd; private BigDecimal qtaCnfOrd;
@ -35,6 +39,33 @@ public class DialogInputQuantityV2DTO {
return this; return this;
} }
public BigDecimal getInitialNumCnf() {
return initialNumCnf;
}
public DialogInputQuantityV2DTO setInitialNumCnf(BigDecimal initialNumCnf) {
this.initialNumCnf = initialNumCnf;
return this;
}
public BigDecimal getInitialQtaCnf() {
return initialQtaCnf;
}
public DialogInputQuantityV2DTO setInitialQtaCnf(BigDecimal initialQtaCnf) {
this.initialQtaCnf = initialQtaCnf;
return this;
}
public BigDecimal getInitialQtaTot() {
return initialQtaTot;
}
public DialogInputQuantityV2DTO setInitialQtaTot(BigDecimal initialQtaTot) {
this.initialQtaTot = initialQtaTot;
return this;
}
public BigDecimal getTotalQtaOrd() { public BigDecimal getTotalQtaOrd() {
return totalQtaOrd; return totalQtaOrd;
} }

View File

@ -39,6 +39,10 @@ public class DialogInputQuantityV2ViewModel {
public Boolean shouldAskDataScad; public Boolean shouldAskDataScad;
private BigDecimal initialNumCnf;
private BigDecimal initialQtaCnf;
private BigDecimal initialQtaTot;
private BigDecimal internalNumCnf; private BigDecimal internalNumCnf;
private BigDecimal internalQtaCnf; private BigDecimal internalQtaCnf;
private BigDecimal internalQtaTot; private BigDecimal internalQtaTot;
@ -51,7 +55,12 @@ public class DialogInputQuantityV2ViewModel {
private Listener mListener; private Listener mListener;
public void init() { public void init() {
if (totalQtaToBeTaken != null) { if(this.initialNumCnf != null && this.initialQtaTot != null && this.initialQtaCnf != null) {
this.internalNumCnf = this.initialNumCnf;
this.internalQtaCnf = this.initialQtaCnf;
this.internalQtaTot = this.initialQtaTot;
} else if (totalQtaToBeTaken != null) {
this.internalNumCnf = totalNumCnfToBeTaken; this.internalNumCnf = totalNumCnfToBeTaken;
this.internalQtaCnf = qtaCnfToBeTaken; this.internalQtaCnf = qtaCnfToBeTaken;
this.internalQtaTot = totalQtaToBeTaken; this.internalQtaTot = totalQtaToBeTaken;
@ -101,6 +110,21 @@ public class DialogInputQuantityV2ViewModel {
return this; return this;
} }
public DialogInputQuantityV2ViewModel setInitialNumCnf(BigDecimal initialNumCnf) {
this.initialNumCnf = initialNumCnf;
return this;
}
public DialogInputQuantityV2ViewModel setInitialQtaCnf(BigDecimal initialQtaCnf) {
this.initialQtaCnf = initialQtaCnf;
return this;
}
public DialogInputQuantityV2ViewModel setInitialQtaTot(BigDecimal initialQtaTot) {
this.initialQtaTot = initialQtaTot;
return this;
}
public DialogInputQuantityV2ViewModel setTotalQtaOrd(BigDecimal totalQtaOrd) { public DialogInputQuantityV2ViewModel setTotalQtaOrd(BigDecimal totalQtaOrd) {
this.totalQtaOrd = totalQtaOrd; this.totalQtaOrd = totalQtaOrd;
return this; return this;

View File

@ -49,9 +49,6 @@
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="66dp" android:layout_height="66dp"
android:background="@color/colorAccent" android:background="@color/colorAccent"
android:clickable="true"
android:focusable="true"
android:onClick="@{() -> view.toggle()}"
android:paddingStart="16dp" android:paddingStart="16dp"
android:paddingTop="8dp" android:paddingTop="8dp"
android:paddingEnd="8dp" android:paddingEnd="8dp"

View File

@ -175,7 +175,6 @@
android:layout_marginTop="8dp" android:layout_marginTop="8dp"
android:gravity="center" android:gravity="center"
android:orientation="horizontal" android:orientation="horizontal"
android:visibility="@{viewmodel.totalNumCnfToBeTaken != null || viewmodel.totalQtaToBeTaken != null ? View.VISIBLE : View.GONE}"
android:weightSum="1"> android:weightSum="1">
<androidx.appcompat.widget.LinearLayoutCompat <androidx.appcompat.widget.LinearLayoutCompat
@ -187,6 +186,7 @@
android:background="@drawable/badge_gray_round_corner" android:background="@drawable/badge_gray_round_corner"
android:backgroundTint="@color/green_600" android:backgroundTint="@color/green_600"
android:orientation="vertical" android:orientation="vertical"
android:visibility="@{viewmodel.totalNumCnfToBeTaken != null || viewmodel.totalQtaToBeTaken != null ? View.VISIBLE : View.GONE}"
android:padding="8dp"> android:padding="8dp">