Sistemato update e delete delle righe collo
This commit is contained in:
parent
c1918a7bfd
commit
bfcaaa758a
@ -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);
|
||||
}
|
||||
}
|
||||
@ -5,10 +5,15 @@ import android.view.KeyEvent;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import it.integry.integrywmsnative.core.barcode_reader.BarcodeManager;
|
||||
import it.integry.integrywmsnative.core.exception.MyExceptionHandler;
|
||||
|
||||
public class BaseActivity extends AppCompatActivity {
|
||||
|
||||
|
||||
public BaseActivity() {
|
||||
// Thread.setDefaultUncaughtExceptionHandler(new MyExceptionHandler(this, BaseActivity.class));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean dispatchKeyEvent(KeyEvent event) {
|
||||
if (BarcodeManager.isEnabled() && BarcodeManager.isKeyboardEmulator()) {
|
||||
|
||||
@ -77,6 +77,10 @@ public class MtbColr extends EntityBase {
|
||||
return gestione;
|
||||
}
|
||||
|
||||
public GestioneEnum getGestioneEnum() {
|
||||
return GestioneEnum.fromString(gestione);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public MtbColr setGestione(GestioneEnum gestione) {
|
||||
@ -188,6 +192,10 @@ public class MtbColr extends EntityBase {
|
||||
return gestioneRif;
|
||||
}
|
||||
|
||||
public GestioneEnum getGestioneRifEnum() {
|
||||
return GestioneEnum.fromString(gestioneRif);
|
||||
}
|
||||
|
||||
public MtbColr setGestioneRif(String gestioneRif) {
|
||||
this.gestioneRif = gestioneRif;
|
||||
return this;
|
||||
|
||||
@ -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) {
|
||||
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);
|
||||
|
||||
@ -622,7 +636,7 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
||||
ColliMagazzinoRESTConsumer.saveColloStatic(cloneMtbColt, value -> {
|
||||
onComplete.run();
|
||||
}, 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) {
|
||||
ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = RESTBuilder.getService(ColliMagazzinoRESTConsumerService.class);
|
||||
colliMagazzinoRESTConsumerService.getColliInBasket(SettingsManager.i().getUserSession().getDepo().getCodMdep()).enqueue(new Callback<ServiceRESTResponse<List<MtbColt>>>() {
|
||||
@ -693,7 +705,7 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
||||
|
||||
@Override
|
||||
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));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@ -226,7 +226,7 @@ public class MainFragment extends Fragment implements ITitledFragment, IScrollab
|
||||
private void initGestMenu() {
|
||||
ICustomConfiguration customConfiguration = ClassRouter.getInstance(ClassRouter.PATH.CUSTOM_CONFIGURATION);
|
||||
if (customConfiguration == null) {
|
||||
MainApplication.restart();
|
||||
// MainApplication.exit();
|
||||
}
|
||||
|
||||
BaseMenuConfiguration menuConfiguration = customConfiguration.getConfig(BaseCustomConfiguration.Keys.MENU_CONFIGURATION);
|
||||
|
||||
@ -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.di.BindableBoolean;
|
||||
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.RunnableArgss;
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgsss;
|
||||
import it.integry.integrywmsnative.core.model.MtbColr;
|
||||
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.gest.spedizione_new.core.SpedizioneListAdapter;
|
||||
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.vendita.dto.OrdineVenditaInevasoDTO;
|
||||
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.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;
|
||||
|
||||
@ -115,9 +118,10 @@ public class SpedizioneActivity extends AppCompatActivity implements SpedizioneV
|
||||
mBindings.setLifecycleOwner(this);
|
||||
mBindings.setSpedizioneView(this);
|
||||
|
||||
mBindings.bottomSheetLuContent.setListener(this);
|
||||
mBindings.bottomSheetLuContent.init(mBindings.bottomSheetLuContent, null);
|
||||
mBottomSheetFragmentLUContentViewModel = mBindings.bottomSheetLuContent.getViewModelInstance();
|
||||
mBindings.bottomSheetLuContent.setListener(this);
|
||||
mBottomSheetFragmentLUContentViewModel.setListener(this);
|
||||
|
||||
|
||||
this.initVars();
|
||||
@ -313,12 +317,11 @@ public class SpedizioneActivity extends AppCompatActivity implements SpedizioneV
|
||||
private RunnableArgs<BarcodeScanDTO> onScanSuccessful = data -> {
|
||||
BarcodeManager.disable();
|
||||
|
||||
mCurrentProgress = UtilityProgress.createDefaultProgressDialog(this);
|
||||
this.openProgress();
|
||||
|
||||
this.mViewmodel.processBarcodeDTO(data, () -> {
|
||||
BarcodeManager.enable();
|
||||
mCurrentProgress.dismiss();
|
||||
mCurrentProgress = null;
|
||||
this.closeProgress();
|
||||
});
|
||||
};
|
||||
|
||||
@ -348,7 +351,7 @@ public class SpedizioneActivity extends AppCompatActivity implements SpedizioneV
|
||||
public void createNewUL() {
|
||||
this.mBindings.spedizioneFab.close(true);
|
||||
|
||||
mCurrentProgress = UtilityProgress.createDefaultProgressDialog(this);
|
||||
this.openProgress();
|
||||
|
||||
this.mViewmodel.createNewLU(null, null, () -> {
|
||||
mCurrentProgress.dismiss();
|
||||
@ -363,10 +366,7 @@ public class SpedizioneActivity extends AppCompatActivity implements SpedizioneV
|
||||
|
||||
@Override
|
||||
public void onDatasetLoaded() {
|
||||
if (mCurrentProgress != null) {
|
||||
mCurrentProgress.dismiss();
|
||||
mCurrentProgress = null;
|
||||
}
|
||||
this.closeProgress();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -375,19 +375,18 @@ public class SpedizioneActivity extends AppCompatActivity implements SpedizioneV
|
||||
FBToast.successToast(this, getResources().getString(R.string.data_saved), FBToast.LENGTH_SHORT);
|
||||
|
||||
this.mBottomSheetFragmentLUContentViewModel.setMtbColt(mtbColt);
|
||||
|
||||
this.closeProgress();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLUClosing() {
|
||||
mCurrentProgress = UtilityProgress.createDefaultProgressDialog(this);
|
||||
this.openProgress();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLUClosed() {
|
||||
if (mCurrentProgress != null) {
|
||||
mCurrentProgress.dismiss();
|
||||
mCurrentProgress = null;
|
||||
}
|
||||
this.closeProgress();
|
||||
|
||||
noLUPresent.set(true);
|
||||
this.mBottomSheetFragmentLUContentViewModel.setMtbColt(null);
|
||||
@ -409,6 +408,7 @@ public class SpedizioneActivity extends AppCompatActivity implements SpedizioneV
|
||||
|
||||
@Override
|
||||
public void onLUPrintError(Exception ex, Runnable onComplete) {
|
||||
this.closeProgress();
|
||||
DialogSimpleMessageHelper.makeErrorDialog(
|
||||
this,
|
||||
new SpannableString(ex.getMessage()),
|
||||
@ -431,18 +431,29 @@ public class SpedizioneActivity extends AppCompatActivity implements SpedizioneV
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Exception ex) {
|
||||
if (mCurrentProgress != null) {
|
||||
mCurrentProgress.dismiss();
|
||||
mCurrentProgress = null;
|
||||
public void onMtbColrDeleteRequest(RunnableArgs<Boolean> onComplete) {
|
||||
String text = getResources().getString(R.string.alert_delete_mtb_colr);
|
||||
DialogSimpleMessageHelper.makeWarningDialog(this,
|
||||
new SpannableString(text),
|
||||
null,
|
||||
() -> onComplete.run(true),
|
||||
() -> onComplete.run(false)
|
||||
).show();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Exception ex) {
|
||||
this.closeProgress();
|
||||
|
||||
UtilityExceptions.defaultException(this, ex, mCurrentProgress);
|
||||
BarcodeManager.enable();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onItemDispatched(PickingObjectDTO pickingObjectDTO,
|
||||
BigDecimal initialNumCnf,
|
||||
BigDecimal initialQtaCnf,
|
||||
BigDecimal initialQtaTot,
|
||||
BigDecimal totalQtaOrd,
|
||||
BigDecimal totalNumCnfOrd,
|
||||
BigDecimal qtaCnfOrd,
|
||||
@ -454,9 +465,13 @@ public class SpedizioneActivity extends AppCompatActivity implements SpedizioneV
|
||||
BigDecimal qtaCnfAvailable,
|
||||
String partitaMag,
|
||||
Date dataScad,
|
||||
boolean canOverflowOrderQuantity) {
|
||||
boolean canOverflowOrderQuantity,
|
||||
RunnableArgss<PickedQuantityDTO, Boolean> onComplete) {
|
||||
DialogInputQuantityV2DTO dialogInputQuantityV2DTO = new DialogInputQuantityV2DTO()
|
||||
.setMtbAart(pickingObjectDTO.getMtbAart())
|
||||
.setInitialNumCnf(initialNumCnf)
|
||||
.setInitialQtaCnf(initialQtaCnf)
|
||||
.setInitialQtaTot(initialQtaTot)
|
||||
.setTotalQtaOrd(totalQtaOrd)
|
||||
.setTotalNumCnfOrd(totalNumCnfOrd)
|
||||
.setQtaCnfOrd(qtaCnfOrd)
|
||||
@ -471,31 +486,23 @@ public class SpedizioneActivity extends AppCompatActivity implements SpedizioneV
|
||||
.setCanOverflowOrderQuantity(canOverflowOrderQuantity);
|
||||
|
||||
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");
|
||||
}
|
||||
|
||||
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
|
||||
public void onRowSaved() {
|
||||
if (mCurrentProgress != null) {
|
||||
mCurrentProgress.dismiss();
|
||||
mCurrentProgress = null;
|
||||
}
|
||||
|
||||
this.closeProgress();
|
||||
FBToast.successToast(this, getResources().getString(R.string.data_saved), FBToast.LENGTH_SHORT);
|
||||
}
|
||||
|
||||
@ -506,11 +513,24 @@ public class SpedizioneActivity extends AppCompatActivity implements SpedizioneV
|
||||
|
||||
@Override
|
||||
public void onMtbColrEdit(MtbColr mtbColr) {
|
||||
Toast.makeText(this, "Edit", Toast.LENGTH_SHORT).show();
|
||||
this.mViewmodel.dispatchRowEdit(mtbColr);
|
||||
}
|
||||
|
||||
@Override
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -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.expansion.AtomicBigDecimal;
|
||||
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.model.CommonModelConsts;
|
||||
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.ScannedPositionNotExistException;
|
||||
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.vendita.dto.OrdineVenditaInevasoDTO;
|
||||
|
||||
@ -266,46 +268,54 @@ public class SpedizioneViewModel {
|
||||
|
||||
|
||||
private void sendDatasetLoaded() {
|
||||
if(this.mListeners != null) mListeners.onDatasetLoaded();
|
||||
if (this.mListeners != null) mListeners.onDatasetLoaded();
|
||||
}
|
||||
|
||||
private void sendError(Exception ex) {
|
||||
if(this.mListeners != null) mListeners.onError(ex);
|
||||
if (this.mListeners != null) mListeners.onError(ex);
|
||||
}
|
||||
|
||||
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) {
|
||||
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) {
|
||||
if(this.mListeners != null) mListeners.onLUPrintRequest(onComplete);
|
||||
if (this.mListeners != null) mListeners.onLUPrintRequest(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() {
|
||||
if(this.mListeners != null) mListeners.onLUClosing();
|
||||
if (this.mListeners != null) mListeners.onLUClosing();
|
||||
}
|
||||
|
||||
private void sendLUClosed() {
|
||||
if(this.mListeners != null) mListeners.onLUClosed();
|
||||
if (this.mListeners != null) mListeners.onLUClosed();
|
||||
}
|
||||
|
||||
private void sendFilterApplied(String newValue) {
|
||||
if(this.mListeners != null) mListeners.onFilterApplied(newValue);
|
||||
if (this.mListeners != null) mListeners.onFilterApplied(newValue);
|
||||
}
|
||||
|
||||
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,
|
||||
BigDecimal initialNumCnf,
|
||||
BigDecimal initialQtaCnf,
|
||||
BigDecimal initialQtaTot,
|
||||
BigDecimal totalQtaOrd,
|
||||
BigDecimal totalNumCnfOrd,
|
||||
BigDecimal qtaCnfOrd,
|
||||
@ -317,8 +327,12 @@ public class SpedizioneViewModel {
|
||||
BigDecimal qtaCnfAvailable,
|
||||
String partitaMag,
|
||||
Date dataScad,
|
||||
boolean canOverflowOrderQuantity) {
|
||||
if(this.mListeners != null) mListeners.onItemDispatched(pickingObjectDTO,
|
||||
boolean canOverflowOrderQuantity,
|
||||
RunnableArgss<PickedQuantityDTO, Boolean> onComplete) {
|
||||
if (this.mListeners != null) mListeners.onItemDispatched(pickingObjectDTO,
|
||||
initialNumCnf,
|
||||
initialQtaCnf,
|
||||
initialQtaTot,
|
||||
totalQtaOrd,
|
||||
totalNumCnfOrd,
|
||||
qtaCnfOrd,
|
||||
@ -330,11 +344,12 @@ public class SpedizioneViewModel {
|
||||
qtaCnfAvailable,
|
||||
partitaMag,
|
||||
dataScad,
|
||||
canOverflowOrderQuantity);
|
||||
canOverflowOrderQuantity,
|
||||
onComplete);
|
||||
}
|
||||
|
||||
private void sendOnRowSaved() {
|
||||
if(this.mListeners != null) mListeners.onRowSaved();
|
||||
if (this.mListeners != null) mListeners.onRowSaved();
|
||||
}
|
||||
|
||||
public void processBarcodeDTO(BarcodeScanDTO barcodeScanDTO, Runnable onComplete) {
|
||||
@ -727,6 +742,7 @@ public class SpedizioneViewModel {
|
||||
|
||||
this.sendOnItemDispatched(
|
||||
pickingObjectDTO,
|
||||
null, null, null,
|
||||
qtaDaEvadere,
|
||||
numCnfDaEvadere,
|
||||
qtaCnfDaEvadere,
|
||||
@ -738,10 +754,151 @@ public class SpedizioneViewModel {
|
||||
qtaCnfAvailable,
|
||||
partitaMag,
|
||||
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) {
|
||||
MtbColt mtbColt = new MtbColt();
|
||||
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()
|
||||
.setCodMart(pickingObjectDTO.getSitArtOrdDTO().getCodMart())
|
||||
.setPartitaMag(partitaMag)
|
||||
.setDataScadPartita(dataScad)
|
||||
.setQtaCol(qtaTot)
|
||||
.setQtaCnf(qtaCnf)
|
||||
.setNumCnf(numCnf)
|
||||
@ -814,7 +972,7 @@ public class SpedizioneViewModel {
|
||||
mCurrentMtbColt.setPesoNettoKg(sourceMtbColt.getPesoNettoKg());
|
||||
}
|
||||
} 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
|
||||
// .setCodJcom(UtilityString.empty2null(item.getCodJcom()))
|
||||
// .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) {
|
||||
if (mCurrentMtbColt == null) return;
|
||||
|
||||
@ -976,15 +1217,15 @@ public class SpedizioneViewModel {
|
||||
this.mCurrentMtbColt = null;
|
||||
|
||||
|
||||
for(PickingObjectDTO pickingObjectDTO : mPickingList.getValue()) {
|
||||
for (PickingObjectDTO pickingObjectDTO : mPickingList.getValue()) {
|
||||
|
||||
List<MtbColr> withdrawMtbColrList = pickingObjectDTO.getWithdrawMtbColr();
|
||||
|
||||
for(MtbColr withdrawMtbColr : withdrawMtbColrList) {
|
||||
for (MtbColr withdrawMtbColr : withdrawMtbColrList) {
|
||||
pickingObjectDTO.getSitArtOrdDTO().setNumCnfOrd(pickingObjectDTO.getSitArtOrdDTO().getNumCnfOrd().subtract(withdrawMtbColr.getNumCnf()));
|
||||
pickingObjectDTO.getSitArtOrdDTO().setQtaOrd(pickingObjectDTO.getSitArtOrdDTO().getQtaOrd().subtract(withdrawMtbColr.getQtaCol()));
|
||||
|
||||
if(pickingObjectDTO.getMtbColts() != null) {
|
||||
if (pickingObjectDTO.getMtbColts() != null) {
|
||||
Stream.of(pickingObjectDTO.getMtbColts())
|
||||
.filter(x -> Objects.equals(x.getNumCollo(), withdrawMtbColr.getNumColloRif()) &&
|
||||
x.getDataColloS().equals(withdrawMtbColr.getDataColloRifS()) &&
|
||||
@ -1005,6 +1246,7 @@ public class SpedizioneViewModel {
|
||||
}
|
||||
}
|
||||
|
||||
pickingObjectDTO.setWithdrawMtbColr(new ArrayList<>());
|
||||
}
|
||||
|
||||
this.resetMatchedRows();
|
||||
@ -1059,9 +1301,14 @@ public class SpedizioneViewModel {
|
||||
|
||||
void onFilterRemoved();
|
||||
|
||||
void onMtbColrDeleteRequest(RunnableArgs<Boolean> onComplete);
|
||||
|
||||
void onError(Exception ex);
|
||||
|
||||
void onItemDispatched(PickingObjectDTO pickingObjectDTO,
|
||||
BigDecimal initialNumCnf,
|
||||
BigDecimal initialQtaCnf,
|
||||
BigDecimal initialQtaTot,
|
||||
BigDecimal totalQtaOrd,
|
||||
BigDecimal totalNumCnfOrd,
|
||||
BigDecimal qtaCnfOrd,
|
||||
@ -1073,7 +1320,8 @@ public class SpedizioneViewModel {
|
||||
BigDecimal qtaCnfAvailable,
|
||||
String partitaMag,
|
||||
Date dataScad,
|
||||
boolean canOverflowOrderQuantity);
|
||||
boolean canOverflowOrderQuantity,
|
||||
RunnableArgss<PickedQuantityDTO, Boolean> onComplete);
|
||||
|
||||
void onRowSaved();
|
||||
}
|
||||
|
||||
@ -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;
|
||||
}
|
||||
}
|
||||
@ -1,6 +1,5 @@
|
||||
package it.integry.integrywmsnative.gest.spedizione_new.model;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@ -18,9 +17,6 @@ public class PickingObjectDTO {
|
||||
private PickDataDTO tempPickData;
|
||||
private List<MtbColr> withdrawMtbColr = new ArrayList<>();
|
||||
|
||||
// private BigDecimal qtaDisponibileCollo;
|
||||
// private BigDecimal numCnfDisponibileCollo;
|
||||
|
||||
private boolean hidden = false;
|
||||
|
||||
|
||||
|
||||
@ -3,17 +3,12 @@ package it.integry.integrywmsnative.view.bottom_sheet__lu_content;
|
||||
import android.content.Context;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.databinding.DataBindingUtil;
|
||||
import androidx.databinding.Observable;
|
||||
import androidx.databinding.ObservableList;
|
||||
|
||||
import com.google.android.material.bottomsheet.BottomSheetBehavior;
|
||||
import com.linearlistview.LinearListView;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import it.integry.integrywmsnative.R;
|
||||
|
||||
@ -190,7 +190,7 @@ public class ArticoliInColloBottomSheetViewModel {
|
||||
cloneItemToEdit.setQtaCol(quantityDTO.qtaTot.getBigDecimal());
|
||||
cloneItemToEdit.setNumCnf(quantityDTO.numCnf.getBigDecimal());
|
||||
|
||||
ColliMagazzinoRESTConsumer.updateRiga(cloneItemToEdit, () ->{
|
||||
ColliMagazzinoRESTConsumer.updateRigaStatic(cloneItemToEdit, () ->{
|
||||
mBottomSheetBehavior.setState(BottomSheetBehavior.STATE_COLLAPSED);
|
||||
|
||||
itemToEdit.setQtaCol(quantityDTO.qtaTot.getBigDecimal());
|
||||
|
||||
@ -79,6 +79,9 @@ public class DialogInputQuantityV2 extends DialogFragment implements DialogInput
|
||||
|
||||
this.mViewModel = new DialogInputQuantityV2ViewModel()
|
||||
.setMtbAart(mDialogInputQuantityV2DTO.getMtbAart())
|
||||
.setInitialNumCnf(mDialogInputQuantityV2DTO.getInitialNumCnf())
|
||||
.setInitialQtaCnf(mDialogInputQuantityV2DTO.getInitialQtaCnf())
|
||||
.setInitialQtaTot(mDialogInputQuantityV2DTO.getInitialQtaTot())
|
||||
.setTotalNumCnfOrd(mDialogInputQuantityV2DTO.getTotalNumCnfOrd())
|
||||
.setTotalQtaOrd(mDialogInputQuantityV2DTO.getTotalQtaOrd())
|
||||
.setQtaCnfOrd(mDialogInputQuantityV2DTO.getQtaCnfOrd())
|
||||
|
||||
@ -9,6 +9,10 @@ public class DialogInputQuantityV2DTO {
|
||||
|
||||
private MtbAart mtbAart;
|
||||
|
||||
private BigDecimal initialNumCnf;
|
||||
private BigDecimal initialQtaCnf;
|
||||
private BigDecimal initialQtaTot;
|
||||
|
||||
private BigDecimal totalQtaOrd;
|
||||
private BigDecimal totalNumCnfOrd;
|
||||
private BigDecimal qtaCnfOrd;
|
||||
@ -35,6 +39,33 @@ public class DialogInputQuantityV2DTO {
|
||||
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() {
|
||||
return totalQtaOrd;
|
||||
}
|
||||
|
||||
@ -39,6 +39,10 @@ public class DialogInputQuantityV2ViewModel {
|
||||
|
||||
public Boolean shouldAskDataScad;
|
||||
|
||||
private BigDecimal initialNumCnf;
|
||||
private BigDecimal initialQtaCnf;
|
||||
private BigDecimal initialQtaTot;
|
||||
|
||||
private BigDecimal internalNumCnf;
|
||||
private BigDecimal internalQtaCnf;
|
||||
private BigDecimal internalQtaTot;
|
||||
@ -51,7 +55,12 @@ public class DialogInputQuantityV2ViewModel {
|
||||
private Listener mListener;
|
||||
|
||||
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.internalQtaCnf = qtaCnfToBeTaken;
|
||||
this.internalQtaTot = totalQtaToBeTaken;
|
||||
@ -101,6 +110,21 @@ public class DialogInputQuantityV2ViewModel {
|
||||
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) {
|
||||
this.totalQtaOrd = totalQtaOrd;
|
||||
return this;
|
||||
|
||||
@ -49,9 +49,6 @@
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="66dp"
|
||||
android:background="@color/colorAccent"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:onClick="@{() -> view.toggle()}"
|
||||
android:paddingStart="16dp"
|
||||
android:paddingTop="8dp"
|
||||
android:paddingEnd="8dp"
|
||||
|
||||
@ -175,7 +175,6 @@
|
||||
android:layout_marginTop="8dp"
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal"
|
||||
android:visibility="@{viewmodel.totalNumCnfToBeTaken != null || viewmodel.totalQtaToBeTaken != null ? View.VISIBLE : View.GONE}"
|
||||
android:weightSum="1">
|
||||
|
||||
<androidx.appcompat.widget.LinearLayoutCompat
|
||||
@ -187,6 +186,7 @@
|
||||
android:background="@drawable/badge_gray_round_corner"
|
||||
android:backgroundTint="@color/green_600"
|
||||
android:orientation="vertical"
|
||||
android:visibility="@{viewmodel.totalNumCnfToBeTaken != null || viewmodel.totalQtaToBeTaken != null ? View.VISIBLE : View.GONE}"
|
||||
android:padding="8dp">
|
||||
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user