Fix e updates
This commit is contained in:
@@ -30,6 +30,7 @@ import it.integry.integrywmsnative.core.class_router.configs.BaseMenuConfigurati
|
||||
import it.integry.integrywmsnative.core.class_router.configs.MenuConfiguration;
|
||||
import it.integry.integrywmsnative.core.class_router.interfaces.ICustomConfiguration;
|
||||
import it.integry.integrywmsnative.core.expansion.BaseActivity;
|
||||
import it.integry.integrywmsnative.core.expansion.OnSingleClickListener;
|
||||
import it.integry.integrywmsnative.core.rest.watcher.ServerStatusChecker;
|
||||
import it.integry.integrywmsnative.core.interfaces.IFilterableFragment;
|
||||
import it.integry.integrywmsnative.core.interfaces.IPoppableActivity;
|
||||
@@ -278,7 +279,12 @@ public class MainActivity extends BaseActivity
|
||||
|
||||
if(fragment instanceof ISelectAllFragment && ((ISelectAllFragment)fragment).isEnabled()) {
|
||||
mBinding.appBarMain.mainSelectAll.setVisibility(View.VISIBLE);
|
||||
mBinding.appBarMain.mainSelectAll.setOnClickListener(v -> ((ISelectAllFragment)fragment).onSelectAll());
|
||||
mBinding.appBarMain.mainSelectAll.setOnClickListener(new OnSingleClickListener() {
|
||||
@Override
|
||||
public void onSingleClick(View v) {
|
||||
((ISelectAllFragment)fragment).onSelectAll();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
mBinding.appBarMain.mainSelectAll.setVisibility(View.GONE);
|
||||
mBinding.appBarMain.mainSelectAll.setOnClickListener(null);
|
||||
@@ -286,7 +292,12 @@ public class MainActivity extends BaseActivity
|
||||
|
||||
if(fragment instanceof IFilterableFragment) {
|
||||
mBinding.appBarMain.mainFilter.setVisibility(View.VISIBLE);
|
||||
mBinding.appBarMain.mainFilter.setOnClickListener(v -> ((IFilterableFragment)fragment).onFilterClick());
|
||||
mBinding.appBarMain.mainFilter.setOnClickListener(new OnSingleClickListener() {
|
||||
@Override
|
||||
public void onSingleClick(View v) {
|
||||
((IFilterableFragment)fragment).onFilterClick();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
mBinding.appBarMain.mainFilter.setVisibility(View.GONE);
|
||||
mBinding.appBarMain.mainFilter.setOnClickListener(null);
|
||||
|
||||
@@ -117,25 +117,6 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
||||
|
||||
}
|
||||
|
||||
public static void saveRigaCollo(MtbColr mtbColrToSave, RunnableArgs<MtbColr> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
|
||||
mtbColrToSave.setMtbAart(null);
|
||||
mtbColrToSave.setRifPartitaMag(null);
|
||||
|
||||
EntityRESTConsumer.processEntity(mtbColrToSave, new ISimpleOperationCallback<MtbColr>() {
|
||||
@Override
|
||||
public void onSuccess(MtbColr value) {
|
||||
if (onComplete != null) onComplete.run(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailed(Exception ex) {
|
||||
if (onFailed != null) onFailed.run(ex);
|
||||
}
|
||||
}, MtbColr.class);
|
||||
|
||||
}
|
||||
|
||||
public static void createColloLavorazione(int segno, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
MtbColt mtbColtToCreate = new MtbColt()
|
||||
.setSegno(segno)
|
||||
@@ -574,51 +555,25 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
||||
}
|
||||
|
||||
|
||||
public static void deleteRiga(MtbColr mtbColrToDelete, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||
MtbColr newMtbColr = new MtbColr();
|
||||
|
||||
newMtbColr.setNumCollo(mtbColrToDelete.getNumCollo());
|
||||
newMtbColr.setDataCollo(mtbColrToDelete.getDataColloS());
|
||||
newMtbColr.setSerCollo(mtbColrToDelete.getSerCollo());
|
||||
newMtbColr.setGestione(mtbColrToDelete.getGestione());
|
||||
newMtbColr.setRiga(mtbColrToDelete.getRiga());
|
||||
|
||||
|
||||
newMtbColr.setOperation(CommonModelConsts.OPERATION.DELETE);
|
||||
|
||||
EntityRESTConsumer.processEntity(newMtbColr, new ISimpleOperationCallback<MtbColr>() {
|
||||
@Override
|
||||
public void onSuccess(MtbColr value) {
|
||||
if (onComplete != null) onComplete.run();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailed(Exception ex) {
|
||||
if (onFailed != null) onFailed.run(ex);
|
||||
}
|
||||
}, MtbColr.class);
|
||||
|
||||
}
|
||||
|
||||
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(mtbColrToUpdate, new ISimpleOperationCallback<MtbColr>() {
|
||||
@Override
|
||||
public void onSuccess(MtbColr value) {
|
||||
if (onComplete != null) onComplete.run();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailed(Exception ex) {
|
||||
if (onFailed != null) onFailed.run(ex);
|
||||
}
|
||||
}, MtbColr.class);
|
||||
EntityRESTConsumer.processEntity(mtbColt, value -> {
|
||||
if(onComplete != null) onComplete.run();
|
||||
}, onFailed, MtbColt.class);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -22,6 +22,23 @@ import retrofit2.Response;
|
||||
|
||||
public class EntityRESTConsumer {
|
||||
|
||||
public static <T extends EntityBase> void processEntity(T entityToSave, RunnableArgs<T> onComplete, RunnableArgs<Exception> onFailed, Class<T> type) {
|
||||
|
||||
processEntity(entityToSave, new ISimpleOperationCallback<T>() {
|
||||
@Override
|
||||
public void onSuccess(T value) {
|
||||
if(onComplete != null) onComplete.run(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailed(Exception ex) {
|
||||
if(onFailed != null) onFailed.run(ex);
|
||||
}
|
||||
}, type);
|
||||
|
||||
}
|
||||
|
||||
|
||||
public static <T extends EntityBase> void processEntity(T entityToSave, final ISimpleOperationCallback<T> callback, Class<T> type) {
|
||||
|
||||
RunnableArgs<Exception> tmpFailed = ex -> {
|
||||
|
||||
@@ -730,7 +730,11 @@ public class SpedizioneViewModel {
|
||||
|
||||
if (qtaColDaPrelevare != null && numCnfDaPrelevare == null) {
|
||||
numCnfDaPrelevare = UtilityBigDecimal.divideToInteger(qtaColDaPrelevare, mtbAart.getQtaCnf());
|
||||
qtaCnfDaPrelevare = UtilityBigDecimal.divide(qtaColDaPrelevare, numCnfDaPrelevare);
|
||||
|
||||
if(!mtbAart.isFlagQtaCnfFissaBoolean()) {
|
||||
if(UtilityBigDecimal.equalsTo(numCnfDaPrelevare, BigDecimal.ZERO)) numCnfDaPrelevare = BigDecimal.ONE;
|
||||
qtaCnfDaPrelevare = UtilityBigDecimal.divide(qtaColDaPrelevare, numCnfDaPrelevare);
|
||||
}
|
||||
} else if (numCnfDaPrelevare != null && qtaColDaPrelevare == null) {
|
||||
qtaCnfDaPrelevare = mtbAart.getQtaCnf();
|
||||
qtaColDaPrelevare = UtilityBigDecimal.multiply(numCnfDaPrelevare, qtaCnfDaPrelevare);
|
||||
|
||||
@@ -342,7 +342,7 @@ public class MainVenditaFragment extends Fragment implements ITitledFragment, IS
|
||||
.toList();
|
||||
|
||||
if (foundGestioni != null && foundGestioni.size() > 1) {
|
||||
DialogSimpleMessageHelper.makeErrorDialog(getContext(), new SpannableString(getString(R.string.error_multiple_gest)), null, onFailed::run).show();
|
||||
DialogSimpleMessageHelper.makeErrorDialog(getContext(), new SpannableString(getString(R.string.error_multiple_gest)), null, onFailed).show();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -354,7 +354,7 @@ public class MainVenditaFragment extends Fragment implements ITitledFragment, IS
|
||||
.toList();
|
||||
|
||||
if (foundCodMdep != null && foundCodMdep.size() > 1) {
|
||||
DialogSimpleMessageHelper.makeErrorDialog(getContext(), new SpannableString(getString(R.string.error_multiple_cod_mdep_ordv)), null, onFailed::run).show();
|
||||
DialogSimpleMessageHelper.makeErrorDialog(getContext(), new SpannableString(getString(R.string.error_multiple_cod_mdep_ordv)), null, onFailed).show();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user