Compare commits

...

13 Commits

Author SHA1 Message Date
3ef69b8dd9 Merge branch 'feature/RefactoringGestioneColli' into master-beta
All checks were successful
WMS - Android (New)/pipeline/head This commit looks good
2025-12-10 18:55:31 +01:00
6b40bd1d60 Merge branch 'develop' into feature/RefactoringGestioneColli
# Conflicts:
#	app/src/main/java/it/integry/integrywmsnative/core/rest/consumers/GiacenzaPvRESTConsumer.java
#	app/src/main/java/it/integry/integrywmsnative/gest/accettazione_ordini_picking/AccettazioneOrdiniPickingModule.java
#	app/src/main/java/it/integry/integrywmsnative/gest/accettazione_ordini_picking/AccettazioneOrdiniPickingViewModel.java
2025-12-10 18:54:59 +01:00
ab230425c3 Finish v1.50.04(553) 2025-12-10 18:51:26 +01:00
2f54b375b9 Finish v1.50.04(553)
All checks were successful
WMS - Android (New)/pipeline/head This commit looks good
2025-12-10 18:51:24 +01:00
9aa9b9121f -> v1.50.04 (553) 2025-12-10 18:51:16 +01:00
268ce9fce9 Sistemato dialog caricamento in accettazione merce 2025-12-10 18:49:56 +01:00
eddecc165d Fix emptyView in contenuto bancale 2025-12-10 18:17:19 +01:00
45c64ad0ac Fix su onlyResiduo in recuperaUl accettazione 2025-12-10 18:00:27 +01:00
398f0a9523 Aggiornato DialogScanOrCreateLUView per utilizzare i metodi synchronized 2025-12-10 17:50:16 +01:00
4861d53031 Finish v1.50.03(552) 2025-12-10 13:38:02 +01:00
e27a4e840a Finish v1.50.03(552)
All checks were successful
WMS - Android (New)/pipeline/head This commit looks good
2025-12-10 13:38:01 +01:00
cc67ac5f47 -> v1.50.03 (552) 2025-12-10 13:37:53 +01:00
8e2d110792 Rimosso da VerificaGiacenze il carcamento di tutta la gacenza dopo aver scansionato il deposito 2025-12-10 13:33:44 +01:00
21 changed files with 258 additions and 357 deletions

View File

@ -11,8 +11,8 @@ apply plugin: 'com.google.gms.google-services'
android {
def appVersionCode = 551
def appVersionName = '1.50.02'
def appVersionCode = 553
def appVersionName = '1.50.04'
signingConfigs {
release {

View File

@ -276,8 +276,8 @@ public class MainApplicationModule {
@Provides
@Singleton
GiacenzaPvRESTConsumer provideGiacenzaPvRESTConsumer(RESTBuilder restBuilder, ExecutorService executorService) {
return new GiacenzaPvRESTConsumer(restBuilder, executorService);
GiacenzaPvRESTConsumer provideGiacenzaPvRESTConsumer(RESTBuilder restBuilder) {
return new GiacenzaPvRESTConsumer(restBuilder);
}
@Provides

View File

@ -34,7 +34,7 @@ public class ColliAccettazioneRESTConsumer extends _BaseRESTConsumer implements
}
@Override
public MtbColt synchronousCreateUDC(CreateUDCRequestDTO createUDCRequestDTO) throws Exception {
public MtbColt createUDCSynchronized(CreateUDCRequestDTO createUDCRequestDTO) throws Exception {
ColliAccettazioneRESTConsumerService colliAccettazioneRESTConsumerService = restBuilder.getService(ColliAccettazioneRESTConsumerService.class);
var response = colliAccettazioneRESTConsumerService.createUDC(createUDCRequestDTO)
@ -48,7 +48,7 @@ public class ColliAccettazioneRESTConsumer extends _BaseRESTConsumer implements
public void createUDC(CreateUDCRequestDTO createUDCRequestDTO, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
executorService.execute(() -> {
try {
MtbColt result = synchronousCreateUDC(createUDCRequestDTO);
MtbColt result = createUDCSynchronized(createUDCRequestDTO);
onComplete.run(result);
} catch (Exception e) {
onFailed.run(e);

View File

@ -50,7 +50,7 @@ public class ColliLavorazioneRESTConsumer extends _BaseRESTConsumer implements C
}
@Override
public MtbColt synchronousCreateUDC(CreateUDCRequestDTO createUDCRequestDTO) throws Exception {
public MtbColt createUDCSynchronized(CreateUDCRequestDTO createUDCRequestDTO) throws Exception {
ColliLavorazioneRESTConsumerService colliLavorazioneRESTConsumerService = restBuilder.getService(ColliLavorazioneRESTConsumerService.class);
var response = colliLavorazioneRESTConsumerService.createUDC(createUDCRequestDTO)
@ -64,7 +64,7 @@ public class ColliLavorazioneRESTConsumer extends _BaseRESTConsumer implements C
public void createUDC(CreateUDCRequestDTO createUDCRequestDTO, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
executorService.execute(() -> {
try {
MtbColt result = synchronousCreateUDC(createUDCRequestDTO);
MtbColt result = createUDCSynchronized(createUDCRequestDTO);
onComplete.run(result);
} catch (Exception e) {
onFailed.run(e);

View File

@ -13,23 +13,17 @@ import it.integry.integrywmsnative.core.rest.model.pv.UpdateRowVerificaRequestDT
public class GiacenzaPvRESTConsumer extends _BaseRESTConsumer {
private final RESTBuilder restBuilder;
private final ExecutorService executorService;
public GiacenzaPvRESTConsumer(RESTBuilder restBuilder, ExecutorService executorService) {
public GiacenzaPvRESTConsumer(RESTBuilder restBuilder) {
this.restBuilder = restBuilder;
this.executorService = executorService;
}
public List<GiacenzaPvDTO> retrieveGiacenzeSynchronized(String codMdep) throws Exception {
public List<GiacenzaPvDTO> retrieveGiacenzeSynchronized(String codMdep, String codMart) throws Exception {
GiacenzaPvRESTConsumerService giacenzaPvRESTConsumerService = restBuilder.getService(GiacenzaPvRESTConsumerService.class);
var response = giacenzaPvRESTConsumerService.retrieve(codMdep)
.execute();
var response = giacenzaPvRESTConsumerService.retrieve(codMdep, codMart).execute();
var giacenzeList = analyzeAnswer(response, "retrieve-giacenze-pv");
return giacenzeList != null ? giacenzeList : new ArrayList<>();
}
@ -64,5 +58,4 @@ public class GiacenzaPvRESTConsumer extends _BaseRESTConsumer {
analyzeAnswer(response, "close-verifica-pv");
}
}

View File

@ -17,8 +17,7 @@ import retrofit2.http.Query;
public interface GiacenzaPvRESTConsumerService {
@GET("wms/pv/verifica_giacenze/retrieve")
Call<ServiceRESTResponse<List<GiacenzaPvDTO>>> retrieve(@Query("codMdep") String codMdep);
Call<ServiceRESTResponse<List<GiacenzaPvDTO>>> retrieve(@Query("codMdep") String codMdep, @Query("codMart") String codMart);
@POST("wms/pv/verifica_giacenze/save_new_row")
Call<ServiceRESTResponse<Void>> saveNewRowVerifica(@Body SaveNewRowVerificaRequestDTO saveNewRowVerificaRequest);

View File

@ -12,7 +12,7 @@ import it.integry.integrywmsnative.core.rest.model.uds.InsertUDCRowRequestDTO;
public interface ColliCaricoRESTConsumerInterface {
MtbColt synchronousCreateUDC(CreateUDCRequestDTO createUDCRequestDTO) throws Exception;
MtbColt createUDCSynchronized(CreateUDCRequestDTO createUDCRequestDTO) throws Exception;
void createUDC(CreateUDCRequestDTO createUDCRequestDTO, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed);
CloseUDCResponseDTO synchronousCloseUDC(CloseUDCRequestDTO closeUDCRequestDTO) throws Exception;

View File

@ -78,7 +78,6 @@ public class MainAccettazioneOrdiniElencoFragment extends BaseFragment implement
@Override
public void onSaveInstanceState(@NonNull Bundle outState) {
onLoadingEnded();
outState.putString("mToolbar", DataCache.addItem(mToolbar));
super.onSaveInstanceState(outState);

View File

@ -11,7 +11,6 @@ import android.view.Gravity;
import android.view.Menu;
import android.view.MenuItem;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.widget.PopupMenu;
import androidx.databinding.DataBindingUtil;
import androidx.databinding.ObservableArrayList;
@ -159,7 +158,17 @@ public class AccettazioneOrdiniPickingActivity extends BaseActivity implements A
boolean useQtaOrd = SettingsManager.iDB().isFlagAccettazioneUseQtaOrd();
mViewModel.setListeners(this);
mViewModel.init(mOrders, mSitArts, useQtaOrd);
this.onLoadingStarted();
executorService.execute(() -> {
try {
mViewModel.init(mOrders, mSitArts, useQtaOrd);
this.onLoadingEnded();
} catch (Exception e) {
this.onError(e);
}
});
}
private void initFab() {
@ -376,7 +385,7 @@ public class AccettazioneOrdiniPickingActivity extends BaseActivity implements A
private void refreshList() {
runOnUiThread(() -> {
handler.post(() -> {
List<PickingObjectDTO> tmpList;
if (mAppliedFilterViewModel != null) {

View File

@ -1,59 +1,9 @@
package it.integry.integrywmsnative.gest.accettazione_ordini_picking;
import android.os.Handler;
import java.util.concurrent.ExecutorService;
import dagger.Module;
import dagger.Provides;
import it.integry.integrywmsnative.core.ean128.Ean128Service;
import it.integry.integrywmsnative.core.rest.RESTBuilder;
import it.integry.integrywmsnative.core.rest.consumers.ArticoloRESTConsumer;
import it.integry.integrywmsnative.core.rest.consumers.BarcodeRESTConsumer;
import it.integry.integrywmsnative.core.rest.consumers.ColliAccettazioneRESTConsumer;
import it.integry.integrywmsnative.core.rest.consumers.ColliLavorazioneRESTConsumer;
import it.integry.integrywmsnative.core.rest.consumers.ColliMagazzinoRESTConsumer;
import it.integry.integrywmsnative.core.rest.consumers.ImballiRESTConsumer;
import it.integry.integrywmsnative.core.rest.consumers.SystemRESTConsumer;
import it.integry.integrywmsnative.gest.accettazione_ordini_picking.rest.AccettazioneOrdiniPickingRESTConsumer;
import it.integry.integrywmsnative.view.bottom_sheet__lu_content.BottomSheetFragmentLUContentViewModel;
@Module(subcomponents = AccettazioneOrdiniPickingComponent.class)
public class AccettazioneOrdiniPickingModule {
@Provides
AccettazioneOrdiniPickingRESTConsumer providesAccettazionePickingRESTConsumer(RESTBuilder restBuilder, SystemRESTConsumer systemRESTConsumer) {
return new AccettazioneOrdiniPickingRESTConsumer(restBuilder, systemRESTConsumer);
}
@Provides
BottomSheetFragmentLUContentViewModel providesBottomSheetFragmentLUContentViewModel() {
return new BottomSheetFragmentLUContentViewModel();
}
@Provides
AccettazioneOrdiniPickingViewModel providesAccettazioneViewModel(
Handler handler,
ExecutorService executorService,
ArticoloRESTConsumer articoloRESTConsumer,
BarcodeRESTConsumer barcodeRESTConsumer,
ColliMagazzinoRESTConsumer colliMagazzinoRESTConsumer,
AccettazioneOrdiniPickingRESTConsumer accettazioneOrdiniPickingRESTConsumer,
ColliAccettazioneRESTConsumer colliAccettazioneRESTConsumer,
ColliLavorazioneRESTConsumer colliLavorazioneRESTConsumer,
Ean128Service ean128Service,
ImballiRESTConsumer imballiRESTConsumer) {
return new AccettazioneOrdiniPickingViewModel(
handler,
executorService,
articoloRESTConsumer,
barcodeRESTConsumer,
colliMagazzinoRESTConsumer,
accettazioneOrdiniPickingRESTConsumer,
colliAccettazioneRESTConsumer,
colliLavorazioneRESTConsumer,
ean128Service,
imballiRESTConsumer);
}
}

View File

@ -13,6 +13,7 @@ import java.math.BigDecimal;
import java.time.LocalDate;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.atomic.AtomicReference;
@ -126,7 +127,7 @@ public class AccettazioneOrdiniPickingViewModel {
}
public void init(List<OrdineAccettazioneInevasoDTO> orders, List<SitArtOrdDTO> sitArts, boolean useQtaOrd) {
public void init(List<OrdineAccettazioneInevasoDTO> orders, List<SitArtOrdDTO> sitArts, boolean useQtaOrd) throws Exception {
this.mOrders = orders;
this.mUseQtaOrd = useQtaOrd;
@ -136,13 +137,14 @@ public class AccettazioneOrdiniPickingViewModel {
UtilityBigDecimal.greaterThan(x.getQtaDaEvadere(), BigDecimal.ZERO))
.collect(Collectors.toList());
getEmptyPickingList(mSitArts, this.mPickingList::postValue);
var pickingList = getEmptyPickingList(mSitArts);
this.mPickingList.postValue(pickingList);
//Definizione della gestione collo di default
Boolean isOrdTrasf = Stream.of(mOrders)
Boolean isOrdTrasf = mOrders.stream()
.map(OrdineAccettazioneInevasoDTO::isOrdTrasf)
.withoutNulls()
.distinctBy(x -> x)
.filter(Objects::nonNull)
.distinct()
.findFirst()
.get();
@ -156,10 +158,10 @@ public class AccettazioneOrdiniPickingViewModel {
//Definizione della gestione collo di default
List<GestioneEnum> foundGestioni = Stream.of(mOrders)
List<GestioneEnum> foundGestioni = mOrders.stream()
.map(OrdineAccettazioneInevasoDTO::getGestioneEnum)
.withoutNulls()
.distinctBy(x -> x)
.filter(Objects::nonNull)
.distinct()
.toList();
if (foundGestioni.size() == 1) {
@ -168,7 +170,7 @@ public class AccettazioneOrdiniPickingViewModel {
} else
defaultGestioneOfUL = foundGestioni.get(0) == GestioneEnum.PRODUZIONE ? GestioneEnum.LAVORAZIONE : foundGestioni.get(0);
} else {
this.sendError(new InvalidLUMultiGestioneException());
throw new InvalidLUMultiGestioneException();
}
switch (defaultGestioneOfUL) {
@ -177,32 +179,31 @@ public class AccettazioneOrdiniPickingViewModel {
}
}
private void getEmptyPickingList(List<SitArtOrdDTO> sitArtOrdList, RunnableArgs<List<PickingObjectDTO>> onComplete) {
private List<PickingObjectDTO> getEmptyPickingList(List<SitArtOrdDTO> sitArtOrdList) throws Exception {
List<String> codMarts = Stream.of(sitArtOrdList)
List<String> codMarts = sitArtOrdList.stream()
.map(SitArtOrdDTO::getCodMart)
.toList();
.collect(Collectors.toList());
this.mArticoloRESTConsumer.getByCodMarts(codMarts, listMtbAarts -> {
List<PickingObjectDTO> pickingList = Stream.of(sitArtOrdList)
.map(sitArtOrdDTO -> {
MtbAart mtbAart = null;
var listMtbAarts = this.mArticoloRESTConsumer.getByCodMartsSynchronized(codMarts);
List<PickingObjectDTO> pickingList = sitArtOrdList.stream()
.map(sitArtOrdDTO -> {
MtbAart mtbAart = null;
for (MtbAart mtbAartItem : listMtbAarts) {
if (mtbAartItem.getCodMart().equalsIgnoreCase(sitArtOrdDTO.getCodMart())) {
mtbAart = mtbAartItem;
break;
}
for (MtbAart mtbAartItem : listMtbAarts) {
if (mtbAartItem.getCodMart().equalsIgnoreCase(sitArtOrdDTO.getCodMart())) {
mtbAart = mtbAartItem;
break;
}
}
return new PickingObjectDTO()
.setSitArtOrdDTO(sitArtOrdDTO)
.setMtbAart(mtbAart);
})
.toList();
return new PickingObjectDTO()
.setSitArtOrdDTO(sitArtOrdDTO)
.setMtbAart(mtbAart);
})
.collect(Collectors.toList());
onComplete.run(pickingList);
}, this::sendError);
return pickingList;
}
public MutableLiveData<List<PickingObjectDTO>> getPickingList() {
@ -784,9 +785,9 @@ public class AccettazioneOrdiniPickingViewModel {
pickingObjectDTO.get().getWithdrawMtbColrs().remove(mtbColrToDelete);
}
handler.post(() -> {
this.mCurrentMtbColt.getMtbColr().remove(mtbColrToDelete);
});
handler.post(() -> {
this.mCurrentMtbColt.getMtbColr().remove(mtbColrToDelete);
});
this.resetMatchedRows();
this.sendOnRowSaved();

View File

@ -49,7 +49,7 @@ public class ListaBancaliActivity extends BaseActivity implements ListaBancaliVi
public static Intent createIntent(Context context, List<MtbColt> items, RunnableArgsWithReturn<MtbColt, Boolean> canRecoverUlAction, String reportName) {
return createIntent(context, items, canRecoverUlAction, true, reportName);
return createIntent(context, items, canRecoverUlAction, false, reportName);
}
public static Intent createIntent(Context context, List<MtbColt> items, boolean canRecoverUl, boolean onlyResiduo) {

View File

@ -148,7 +148,7 @@ public class PickingResiViewModel {
public void createNewLU(Integer customNumCollo, String customSerCollo) throws Exception {
if (mTipologiaReso == Tipologia.VENDITA) {
var createdUdc = mColliAccettazioneRESTConsumer.synchronousCreateUDC(new CreateUDCRequestDTO()
var createdUdc = mColliAccettazioneRESTConsumer.createUDCSynchronized(new CreateUDCRequestDTO()
.setCodAnag(mDefaultCodAnagOfLU)
.setCodMdep(mDefaultCodMdepOfLU)
.setNumCollo(customNumCollo)

View File

@ -13,6 +13,7 @@ import com.ravikoradiya.liveadapter.Type;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.util.List;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.atomic.AtomicReference;
@ -38,6 +39,7 @@ import it.integry.integrywmsnative.view.bottom_sheet__item_edit.BottomSheetItemD
import it.integry.integrywmsnative.view.bottom_sheet__item_edit.BottomSheetItemEditView;
import it.integry.integrywmsnative.view.dialogs.DialogConsts;
import it.integry.integrywmsnative.view.dialogs.ask_deposito.DialogAskDepositoView;
import it.integry.integrywmsnative.view.dialogs.choose_art_from_lista_arts.DialogChooseArtFromListaArtsView;
import it.integry.integrywmsnative.view.dialogs.input_quantity_v2.DialogInputQuantityV2DTO;
import it.integry.integrywmsnative.view.dialogs.input_quantity_v2.DialogInputQuantityV2View;
import it.integry.integrywmsnative.view.dialogs.yes_no.DialogYesNoView;
@ -91,7 +93,6 @@ public class VerificaGiacenzeFragment extends BaseFragment implements ITitledFra
}
private void init() {
executorService.execute(() -> {
boolean recoveredSession = false;
@ -129,7 +130,6 @@ public class VerificaGiacenzeFragment extends BaseFragment implements ITitledFra
try {
this.onLoadingStarted();
mViewModel.loadDeposito(codMdep);
if (!recoveredSession) mViewModel.createNew(codMdep);
@ -162,7 +162,6 @@ public class VerificaGiacenzeFragment extends BaseFragment implements ITitledFra
CountDownLatch countDownLatch = new CountDownLatch(1);
AtomicReference<String> codMdepAtomic = new AtomicReference<>();
DialogAskDepositoView.newInstance(codMdep -> {
codMdepAtomic.set(codMdep);
countDownLatch.countDown();
@ -173,7 +172,6 @@ public class VerificaGiacenzeFragment extends BaseFragment implements ITitledFra
return codMdepAtomic.get();
}
private void initRecyclerView() {
var itemType = new Type<VerificaGiacenzeRowEntity, ListaVerificaGiacenzePickedItemListModelBinding>(R.layout.lista_verifica_giacenze_picked_item_list_model, BR.item);
@ -214,13 +212,12 @@ public class VerificaGiacenzeFragment extends BaseFragment implements ITitledFra
this.onLoadingEnded();
} catch (Exception e) {
this.onError(e);
} finally {
handler.post(this::onLoadingEnded);
}
});
this.onLoadingEnded();
};
private void openItemAction(VerificaGiacenzeRowEntity item) {
var anagrafica = mViewModel.searchAnagraficaByCodMart(item.getCodMart());
@ -262,7 +259,6 @@ public class VerificaGiacenzeFragment extends BaseFragment implements ITitledFra
});
}
public PickedQuantityDTO onItemDispatched(MtbAart mtbAart,
BigDecimal initialNumCnf,
BigDecimal initialQtaCnf,
@ -340,7 +336,6 @@ public class VerificaGiacenzeFragment extends BaseFragment implements ITitledFra
});
}
@Override
public void onDestroy() {
super.onDestroy();
@ -351,4 +346,10 @@ public class VerificaGiacenzeFragment extends BaseFragment implements ITitledFra
public void onCreateActionBar(AppCompatTextView titleText, Context context) {
titleText.setText(R.string.verifica_giacenze_menu);
}
@Override
public void onChooseArtRequest(List<MtbAart> artsList, RunnableArgs<MtbAart> onComplete) {
DialogChooseArtFromListaArtsView.newInstance(true, artsList, onComplete)
.show(requireActivity().getSupportFragmentManager(), "dialog-choose-art");
}
}

View File

@ -16,8 +16,8 @@ import it.integry.integrywmsnative.core.rest.consumers.GiacenzaPvRESTConsumer;
public class VerificaGiacenzeModule {
@Provides
VerificaGiacenzeViewModel providesVerificaGiacenzeViewModel(ExecutorService executorService, Handler handler, VerificaGiacenzeRowMapper verificaGiacenzeRowMapper, VerificaGiacenzeRepository verificaGiacenzeRepository, VerificaGiacenzeRowRepository verificaGiacenzeRowRepository, GiacenzaPvRESTConsumer giacenzaPvRESTConsumer, ArticoloRESTConsumer articoloRESTConsumer) {
return new VerificaGiacenzeViewModel(executorService, handler, verificaGiacenzeRowMapper, giacenzaPvRESTConsumer, verificaGiacenzeRepository, verificaGiacenzeRowRepository, articoloRESTConsumer);
VerificaGiacenzeViewModel providesVerificaGiacenzeViewModel(Handler handler, VerificaGiacenzeRowMapper verificaGiacenzeRowMapper, VerificaGiacenzeRepository verificaGiacenzeRepository, VerificaGiacenzeRowRepository verificaGiacenzeRowRepository, GiacenzaPvRESTConsumer giacenzaPvRESTConsumer, ArticoloRESTConsumer articoloRESTConsumer) {
return new VerificaGiacenzeViewModel(handler, verificaGiacenzeRowMapper, giacenzaPvRESTConsumer, verificaGiacenzeRepository, verificaGiacenzeRowRepository, articoloRESTConsumer);
}
}

View File

@ -11,8 +11,8 @@ import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.concurrent.ExecutorService;
import java.util.stream.Collectors;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.atomic.AtomicReference;
import javax.inject.Inject;
@ -22,8 +22,8 @@ import it.integry.integrywmsnative.core.data_store.db.entity.VerificaGiacenzeRow
import it.integry.integrywmsnative.core.data_store.db.respository_new.VerificaGiacenzeRepository;
import it.integry.integrywmsnative.core.data_store.db.respository_new.VerificaGiacenzeRowRepository;
import it.integry.integrywmsnative.core.exception.NoArtsFoundException;
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
import it.integry.integrywmsnative.core.interfaces.viewmodel_listeners.ILoadingListener;
import it.integry.integrywmsnative.core.mapper.VerificaGiacenzeMapper;
import it.integry.integrywmsnative.core.mapper.VerificaGiacenzeRowMapper;
import it.integry.integrywmsnative.core.model.MtbAart;
import it.integry.integrywmsnative.core.rest.consumers.ArticoloRESTConsumer;
@ -31,7 +31,6 @@ import it.integry.integrywmsnative.core.rest.consumers.GiacenzaPvRESTConsumer;
import it.integry.integrywmsnative.core.rest.model.Ean13PesoModel;
import it.integry.integrywmsnative.core.rest.model.pv.CloseVerificaRequestDTO;
import it.integry.integrywmsnative.core.rest.model.pv.DeleteRowVerificaRequestDTO;
import it.integry.integrywmsnative.core.rest.model.pv.GiacenzaPvDTO;
import it.integry.integrywmsnative.core.rest.model.pv.SaveNewRowVerificaRequestDTO;
import it.integry.integrywmsnative.core.rest.model.pv.UpdateRowVerificaRequestDTO;
import it.integry.integrywmsnative.core.utility.UtilityBarcode;
@ -39,8 +38,6 @@ import it.integry.integrywmsnative.core.utility.UtilityBigDecimal;
import it.integry.integrywmsnative.gest.spedizione.model.PickedQuantityDTO;
public class VerificaGiacenzeViewModel {
private final ExecutorService executorService;
private final Handler handler;
private final VerificaGiacenzeRowMapper verificaGiacenzeRowMapper;
private final GiacenzaPvRESTConsumer giacenzaPvRESTConsumer;
@ -50,21 +47,17 @@ public class VerificaGiacenzeViewModel {
private Listener listener;
private MutableLiveData<VerificaGiacenzeEntity> currentVerifica = new MutableLiveData<>();
private final MutableLiveData<VerificaGiacenzeEntity> currentVerifica = new MutableLiveData<>();
private final MutableLiveData<List<VerificaGiacenzeRowEntity>> currentVerificaRows = new MutableLiveData<>(new ArrayList<>());
private List<GiacenzaPvDTO> currentLoadedGiacenza = null;
private List<MtbAart> currentLoadedAnagrafiche = null;
private List<MtbAart> currentLoadedAnagrafiche = new ArrayList<>();
@Inject
public VerificaGiacenzeViewModel(ExecutorService executorService,
Handler handler,
public VerificaGiacenzeViewModel(Handler handler,
VerificaGiacenzeRowMapper verificaGiacenzeRowMapper,
GiacenzaPvRESTConsumer giacenzaPvRESTConsumer,
VerificaGiacenzeRepository verificaGiacenzeRepository,
VerificaGiacenzeRowRepository verificaGiacenzeRowRepository,
ArticoloRESTConsumer articoloRESTConsumer) {
this.executorService = executorService;
this.handler = handler;
this.verificaGiacenzeRowMapper = verificaGiacenzeRowMapper;
this.giacenzaPvRESTConsumer = giacenzaPvRESTConsumer;
@ -87,8 +80,7 @@ public class VerificaGiacenzeViewModel {
currentVerifica.postValue(null);
currentVerificaRows.postValue(new ArrayList<>());
currentLoadedGiacenza = null;
currentLoadedAnagrafiche = null;
currentLoadedAnagrafiche = new ArrayList<>();
}
public LiveData<VerificaGiacenzeEntity> getCurrentVerifica() {
@ -99,60 +91,6 @@ public class VerificaGiacenzeViewModel {
return currentVerificaRows;
}
public void loadDeposito(String codMdep) throws Exception {
currentLoadedGiacenza = this.giacenzaPvRESTConsumer.retrieveGiacenzeSynchronized(codMdep);
if (currentLoadedGiacenza == null) {
throw new Exception("Errore nel recupero delle giacenze");
}
var codMartsToRetrieve = currentLoadedGiacenza.parallelStream()
.map(GiacenzaPvDTO::getCodMart)
.collect(Collectors.toUnmodifiableList());
currentLoadedAnagrafiche = this.articoloRESTConsumer.getByCodMartsSynchronized(codMartsToRetrieve);
if (currentLoadedAnagrafiche == null) {
throw new Exception("Errore nel recupero delle anagrafiche");
}
currentLoadedAnagrafiche.forEach(x -> x.setFlagTracciabilita("N"));
}
public void randomizeElements(int elementsCount) {
for (int i = 0; i < elementsCount; i++) {
var randomIndex = (int) (Math.random() * currentLoadedAnagrafiche.size());
var randomAnagrafica = currentLoadedAnagrafiche.get(randomIndex);
var foundGiacenza = currentLoadedGiacenza.parallelStream()
.filter(x -> x.getCodMart().equalsIgnoreCase(randomAnagrafica.getCodMart()))
.findFirst()
.orElse(null);
var qtaGiacenza = foundGiacenza != null ? foundGiacenza.getQtaInv() : BigDecimal.ZERO;
var rowToInsert = new VerificaGiacenzeRowEntity();
rowToInsert.setParentId(currentVerifica.getValue().getId());
rowToInsert.setCodMart(randomAnagrafica.getCodMart());
rowToInsert.setDescrizione(randomAnagrafica.getDescrizione());
rowToInsert.setScanCodBarre(randomAnagrafica.getBarCode());
rowToInsert.setNumConf(BigDecimal.valueOf((int) (Math.random() * 100)));
rowToInsert.setQtaConf(randomAnagrafica.getQtaCnf());
rowToInsert.setQta(UtilityBigDecimal.multiply(rowToInsert.getNumConf(), randomAnagrafica.getQtaCnf()));
rowToInsert.setQtaInGiacenza(qtaGiacenza);
insertRow(rowToInsert);
try {
Thread.sleep(50);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
}
}
public void createNew(String codMdep) {
var verificaGiacenzeEntity = new VerificaGiacenzeEntity();
verificaGiacenzeEntity.setCodMdep(codMdep);
@ -172,7 +110,7 @@ public class VerificaGiacenzeViewModel {
}
public void close() throws Exception {
if (currentVerificaRows.getValue().isEmpty()) {
if (currentVerificaRows.getValue() == null || currentVerificaRows.getValue().isEmpty()) {
delete();
return;
}
@ -187,32 +125,52 @@ public class VerificaGiacenzeViewModel {
}
public void processBarcodeDTO(BarcodeScanDTO barcodeScanDTO) throws Exception {
if (UtilityBarcode.isEanPeso(barcodeScanDTO)) {
var ean13 = Ean13PesoModel.fromBarcode(barcodeScanDTO.getStringValue());
this.loadArticolo(ean13.getPrecode());
} else {
this.loadArticolo(barcodeScanDTO.getStringValue());
}
}
private void loadArticolo(String barcodeProd) throws Exception {
var mtbAartList = this.articoloRESTConsumer.searchByBarcodeSynchronized(barcodeProd);
private void loadArticolo(String barcodeProd) throws NoArtsFoundException, CloneNotSupportedException {
var foundMtbAart = searchAnagraficaByBarcode(barcodeProd);
if (mtbAartList != null && !mtbAartList.isEmpty()) {
MtbAart loadedArticolo;
if (foundMtbAart == null)
throw new NoArtsFoundException();
if (mtbAartList.size() == 1) loadedArticolo = mtbAartList.get(0);
else loadedArticolo = this.sendChooseArtRequest(mtbAartList);
loadArticolo(foundMtbAart);
if (loadedArticolo == null) return;
loadedArticolo.setFlagTracciabilita("N");
this.updateCurrentAnagrafiche(loadedArticolo);
this.loadArticolo(loadedArticolo);
} else throw new NoArtsFoundException();
}
public void loadArticolo(MtbAart mtbAart) throws NoArtsFoundException, CloneNotSupportedException {
var foundGiacenza = currentLoadedGiacenza.parallelStream()
.filter(x -> x.getCodMart().equalsIgnoreCase(mtbAart.getCodMart()))
private void updateCurrentAnagrafiche(MtbAart loadedArticolo) {
MtbAart mtbAart = currentLoadedAnagrafiche.stream()
.filter(x -> x.getCodMart().equalsIgnoreCase(loadedArticolo.getCodMart()))
.findFirst()
.orElse(null);
if (mtbAart != null) currentLoadedAnagrafiche.remove(mtbAart);
currentLoadedAnagrafiche.add(loadedArticolo);
}
public void loadArticolo(MtbAart mtbAart) throws Exception {
var foundGiacenzaList = giacenzaPvRESTConsumer.retrieveGiacenzeSynchronized(
Objects.requireNonNull(currentVerifica.getValue()).getCodMdep(),
mtbAart.getCodMart()
);
if (foundGiacenzaList == null || foundGiacenzaList.isEmpty() || foundGiacenzaList.stream().count() > 1)
throw new Exception("Errore nel recupero delle giacenze");
var foundGiacenza = foundGiacenzaList.get(0);
var numCnfGiacenza = foundGiacenza != null ? UtilityBigDecimal.divide(foundGiacenza.getQtaInv(), mtbAart.getQtaCnf()) : BigDecimal.ZERO;
var qtaCnfGiacenza = mtbAart.getQtaCnf();
var qtaGiacenza = foundGiacenza != null ? foundGiacenza.getQtaInv() : BigDecimal.ZERO;
@ -226,7 +184,7 @@ public class VerificaGiacenzeViewModel {
boolean isNewRow = false;
var rowToSave = currentVerificaRows.getValue().parallelStream()
var rowToSave = Objects.requireNonNull(currentVerificaRows.getValue()).parallelStream()
.filter(x -> x.getCodMart().equalsIgnoreCase(mtbAart.getCodMart()))
.findFirst()
.orElse(null);
@ -235,7 +193,7 @@ public class VerificaGiacenzeViewModel {
isNewRow = true;
rowToSave = new VerificaGiacenzeRowEntity();
rowToSave.setParentId(currentVerifica.getValue().getId());
rowToSave.setParentId(Objects.requireNonNull(currentVerifica.getValue()).getId());
rowToSave.setCodMart(mtbAart.getCodMart());
rowToSave.setPartitaMag(null);
rowToSave.setDescrizione(mtbAart.getDescrizione());
@ -246,21 +204,18 @@ public class VerificaGiacenzeViewModel {
initialQtaTot = rowToSave.getQta();
}
var pickedQuantity = this.sendOnItemDispatched(mtbAart,
var pickedQuantity = this.sendOnItemDispatched(
mtbAart,
initialNumCnf,
qtaCnfGiacenza,
initialQtaTot,
numCnfGiacenza,
qtaGiacenza,
incomingNumCnf,
incomingQta,
null,
null
incomingQta
);
if (pickedQuantity == null)
return;
if (pickedQuantity == null) return;
rowToSave.setNumConf(pickedQuantity.getNumCnf());
rowToSave.setQtaConf(pickedQuantity.getQtaCnf());
@ -272,7 +227,6 @@ public class VerificaGiacenzeViewModel {
} else {
updateRow(rowToSave);
}
}
public MtbAart searchAnagraficaByCodMart(String codMart) {
@ -282,24 +236,6 @@ public class VerificaGiacenzeViewModel {
.orElse(null);
}
public MtbAart searchAnagraficaByBarcode(String barcode) {
MtbAart mtbAart = currentLoadedAnagrafiche.parallelStream()
.filter(x -> barcode.equals(x.getBarCode()))
.findFirst()
.orElse(null);
if (mtbAart == null) {
mtbAart = currentLoadedAnagrafiche.parallelStream()
.filter(x -> x.getMtbAartBarCode() != null &&
x.getMtbAartBarCode().stream()
.anyMatch(y -> barcode.equals(y.getCodBarre())))
.findFirst()
.orElse(null);
}
return mtbAart;
}
public void insertRow(VerificaGiacenzeRowEntity rowEntity) {
this.sendOnLoadingStarted();
@ -316,7 +252,7 @@ public class VerificaGiacenzeViewModel {
verificaGiacenzeRowRepository.insert(rowEntity, insertedData -> {
handler.post(() -> {
currentVerificaRows.getValue().add(insertedData);
Objects.requireNonNull(currentVerificaRows.getValue()).add(insertedData);
notifyRowChanged();
});
}, this::sendError);
@ -339,7 +275,7 @@ public class VerificaGiacenzeViewModel {
var indexInList = -1;
List<VerificaGiacenzeRowEntity> value = currentVerificaRows.getValue();
for (int i = 0; i < value.size(); i++) {
for (int i = 0; i < Objects.requireNonNull(value).size(); i++) {
VerificaGiacenzeRowEntity entity = value.get(i);
if (Objects.equals(entity.getId(), rowEntity.getId())) {
@ -374,7 +310,7 @@ public class VerificaGiacenzeViewModel {
verificaGiacenzeRowRepository.delete(rowEntity, () -> {
handler.post(() -> {
currentVerificaRows.getValue().remove(rowEntity);
Objects.requireNonNull(currentVerificaRows.getValue()).remove(rowEntity);
notifyRowChanged();
});
@ -386,6 +322,25 @@ public class VerificaGiacenzeViewModel {
this.sendOnLoadingEnded();
}
private MtbAart sendChooseArtRequest(List<MtbAart> mtbAarts) {
final CountDownLatch latch = new CountDownLatch(1);
AtomicReference<MtbAart> result = new AtomicReference<>();
listener.onChooseArtRequest(mtbAarts, data -> {
result.set(data);
latch.countDown();
});
try {
latch.await();
return result.get();
} catch (InterruptedException e) {
this.sendError(e);
}
return null;
}
private PickedQuantityDTO sendOnItemDispatched(MtbAart mtbAart,
BigDecimal initialNumCnf,
BigDecimal initialQtaCnf,
@ -393,15 +348,13 @@ public class VerificaGiacenzeViewModel {
BigDecimal inWarehouseNumCnf,
BigDecimal inWarehouseQtaTot,
BigDecimal incomingNumCnf,
BigDecimal incomingQtaTot,
String partitaMag,
LocalDate dataScad) {
BigDecimal incomingQtaTot) {
if (listener != null)
return this.listener.onItemDispatched(mtbAart,
initialNumCnf, initialQtaCnf, initialQtaTot,
inWarehouseNumCnf, inWarehouseQtaTot,
incomingNumCnf, incomingQtaTot,
partitaMag, dataScad);
return this.listener.onItemDispatched(
mtbAart, initialNumCnf, initialQtaCnf,
initialQtaTot, inWarehouseNumCnf, inWarehouseQtaTot,
incomingNumCnf, incomingQtaTot, null, null
);
return null;
}
@ -435,5 +388,7 @@ public class VerificaGiacenzeViewModel {
LocalDate dataScad);
void onError(Exception ex);
void onChooseArtRequest(List<MtbAart> artsList, RunnableArgs<MtbAart> onComplete);
}
}

View File

@ -232,7 +232,7 @@ public class VersamentoMerceViewModel {
.setSerCollo(CommonConst.Config.DEFAULT_ANONYMOUS_UL_SERIE)
.setBarcodeUl(sscc);
var mtbColtAnonimo = this.mColliLavorazioneRESTConsumer.synchronousCreateUDC(createUDCRequestDTO);
var mtbColtAnonimo = this.mColliLavorazioneRESTConsumer.createUDCSynchronized(createUDCRequestDTO);
pickMerceULtoUL(mtbColtAnonimo);
} else {

View File

@ -29,7 +29,6 @@ import it.integry.integrywmsnative.databinding.BottomSheetFragmentLuContentBindi
import it.integry.integrywmsnative.databinding.BottomSheetFragmentLuContentListItemBinding;
import it.integry.integrywmsnative.view.bottom_sheet__base.BottomSheetFragmentBaseView;
import it.integry.integrywmsnative.view.bottom_sheet__mtb_colr_edit.BottomSheetMtbColrEditModalView;
import kotlin.Unit;
public class BottomSheetFragmentLUContentView extends BottomSheetFragmentBaseView implements BottomSheetMtbColrEditModalView.Listener {
@ -85,10 +84,10 @@ public class BottomSheetFragmentLUContentView extends BottomSheetFragmentBaseVie
new LiveAdapter(mViewModel.getObservableMtbColt().get().getMtbColr(), BR.item)
.map(MtbColr.class, itemType)
.onNoData(noData -> {
this.mBinding.emptyView.setVisibility(noData ? View.VISIBLE : View.GONE);
return Unit.INSTANCE;
})
// .onNoData(noData -> {
// this.mBinding.emptyView.setVisibility(noData ? View.VISIBLE : View.GONE);
// return Unit.INSTANCE;
// })
.into(this.mBinding.mtbColrRecyclerView);
}

View File

@ -154,7 +154,14 @@ public class DialogScanOrCreateLUView extends BaseDialogFragment implements Dial
private final RunnableArgs<BarcodeScanDTO> onScanSuccessfull = data -> {
this.onLoadingStarted();
this.mViewModel.processBarcodeDTO(data, this::onLoadingEnded);
executorService.execute(() -> {
try {
this.mViewModel.processBarcodeDTO(data);
this.onLoadingEnded();
} catch (Exception ex) {
this.onError(ex);
}
});
};
@ -182,10 +189,12 @@ public class DialogScanOrCreateLUView extends BaseDialogFragment implements Dial
@Override
public void onLUOpened(GetColloInGiacResponseDTO colloInGiac, boolean created) {
this.openedMtbColt = colloInGiac.getMtbColt();
mOnComplete.run(Result.completed(colloInGiac, created));
handler.post(() -> {
this.openedMtbColt = colloInGiac.getMtbColt();
mOnComplete.run(Result.completed(colloInGiac, created));
dismiss();
dismiss();
});
}

View File

@ -65,153 +65,138 @@ public class DialogScanOrCreateLUViewModel {
var createUdcRequest = new CreateUDCRequestDTO()
.setCodMdep(SettingsManager.i().getUserSession().getDepo().getCodMdep());
var createResponse = this.mColliLavorazioneRESTConsumer.synchronousCreateUDC(createUdcRequest);
var createResponse = this.mColliLavorazioneRESTConsumer.createUDCSynchronized(createUdcRequest);
this.sendOnLUCreated(createResponse);
}
public void processBarcodeDTO(BarcodeScanDTO barcodeScanDTO, Runnable onComplete) {
public void processBarcodeDTO(BarcodeScanDTO barcodeScanDTO) throws Exception {
if (UtilityBarcode.isEtichettaPosizione(barcodeScanDTO)) {
this.executeEtichettaPosizione(barcodeScanDTO, onComplete);
this.executeEtichettaPosizione(barcodeScanDTO);
} else if (UtilityBarcode.isEtichettaAnonima(barcodeScanDTO)) {
this.executeEtichettaAnonima(barcodeScanDTO, onComplete);
this.executeEtichettaAnonima(barcodeScanDTO);
} else if (UtilityBarcode.isEtichetta128(barcodeScanDTO)) {
this.executeEAN128(barcodeScanDTO, onComplete);
this.executeEAN128(barcodeScanDTO);
} else if (UtilityBarcode.isEan13(barcodeScanDTO)) {
this.executeEAN13(barcodeScanDTO, onComplete);
} else {
onComplete.run();
this.executeEAN13(barcodeScanDTO);
}
}
private void executeEtichettaPosizione(BarcodeScanDTO barcodeScanDTO, Runnable onComplete) {
private void executeEtichettaPosizione(BarcodeScanDTO barcodeScanDTO) throws Exception {
MtbDepoPosizione foundPosizione = Stream.of(SettingsManager.iDB().getAvailablePosizioni())
.filter(x -> x.getPosizione().equalsIgnoreCase(barcodeScanDTO.getStringValue()))
.single();
this.executePosizione(foundPosizione, onComplete);
this.executePosizione(foundPosizione);
}
private void executePosizione(MtbDepoPosizione posizione, Runnable onComplete) {
this.mPosizioniRESTConsumer.getBancaliInPosizione(posizione, barcodeUlInPosizioneList -> {
private void executePosizione(MtbDepoPosizione posizione) throws Exception {
var barcodeUlInPosizioneList = this.mPosizioniRESTConsumer.getBancaliInPosizioneSynchronized(posizione);
if (barcodeUlInPosizioneList == null || barcodeUlInPosizioneList.isEmpty()) {
this.sendError(new NoLUFoundException());
} else if (barcodeUlInPosizioneList.size() == 1) {
this.mColliMagazzinoRESTConsumer.getBySSCC(barcodeUlInPosizioneList.get(0), mShouldCheckResiduo, false, response -> {
onComplete.run();
this.sendOnLUOpened(response);
}, this::sendError);
} else {
this.sendError(new TooManyLUFoundInMonoLUPositionException());
}
}, this::sendError);
if (barcodeUlInPosizioneList == null || barcodeUlInPosizioneList.isEmpty()) {
this.sendError(new NoLUFoundException());
} else if (barcodeUlInPosizioneList.size() == 1) {
var response = this.mColliMagazzinoRESTConsumer.getBySsccSynchronized(barcodeUlInPosizioneList.get(0), mShouldCheckResiduo, false);
this.sendOnLUOpened(response);
} else {
throw new TooManyLUFoundInMonoLUPositionException();
}
}
private void executeEtichettaAnonima(BarcodeScanDTO barcodeScanDTO, Runnable onComplete) {
this.mColliMagazzinoRESTConsumer.getBySSCC(barcodeScanDTO.getStringValue(), mShouldCheckResiduo, false, response -> {
var mtbColt = response.getMtbColt();
private void executeEtichettaAnonima(BarcodeScanDTO barcodeScanDTO) throws Exception {
var response = this.mColliMagazzinoRESTConsumer.getBySsccSynchronized(barcodeScanDTO.getStringValue(), mShouldCheckResiduo, false);
var mtbColt = response.getMtbColt();
if (mtbColt == null) {
if (mEnableCreation) {
Integer customNumCollo = null;
if (mtbColt == null) {
if (mEnableCreation) {
Integer customNumCollo = null;
try {
customNumCollo = UtilityBarcode.getNumColloFromULAnonima(barcodeScanDTO.getStringValue());
} catch (Exception ex) {
this.sendError(ex);
}
var createUdcRequest = new CreateUDCRequestDTO()
.setBarcodeUl(barcodeScanDTO.getStringValue())
.setCodMdep(SettingsManager.i().getUserSession().getDepo().getCodMdep())
.setNumCollo(customNumCollo)
.setSerCollo(CommonConst.Config.DEFAULT_ANONYMOUS_UL_SERIE);
this.mColliLavorazioneRESTConsumer.createUDC(createUdcRequest, createdMtbColt -> {
onComplete.run();
this.sendOnLUCreated(createdMtbColt);
}, this::sendError);
} else {
this.sendError(new NoLUFoundException());
try {
customNumCollo = UtilityBarcode.getNumColloFromULAnonima(barcodeScanDTO.getStringValue());
} catch (Exception ex) {
this.sendError(ex);
}
} else {
if (mtbColt.getCodDtip() != null && mShouldCheckIfExistDoc) {
this.sendError(new AlreadyAttachedDocumentToLUException());
} else {
mtbColt.setDisablePrint(true);
onComplete.run();
this.sendOnLUOpened(response);
}
}
}, this::sendError);
var createUdcRequest = new CreateUDCRequestDTO()
.setBarcodeUl(barcodeScanDTO.getStringValue())
.setCodMdep(SettingsManager.i().getUserSession().getDepo().getCodMdep())
.setNumCollo(customNumCollo)
.setSerCollo(CommonConst.Config.DEFAULT_ANONYMOUS_UL_SERIE);
var createdMtbColt = this.mColliLavorazioneRESTConsumer.createUDCSynchronized(createUdcRequest);
this.sendOnLUCreated(createdMtbColt);
} else {
throw new NoLUFoundException();
}
} else {
if (mtbColt.getCodDtip() != null && mShouldCheckIfExistDoc) {
throw new AlreadyAttachedDocumentToLUException();
} else {
mtbColt.setDisablePrint(true);
this.sendOnLUOpened(response);
}
}
}
private void executeEAN128(BarcodeScanDTO barcodeScanDTO, Runnable onComplete) {
this.mBarcodeRESTConsumer.decodeEan128(barcodeScanDTO, ean128Model -> {
private void executeEAN128(BarcodeScanDTO barcodeScanDTO) throws Exception {
var ean128Model = this.mBarcodeRESTConsumer.decodeEan128Synchronized(barcodeScanDTO);
if (ean128Model != null && !UtilityString.isNullOrEmpty(ean128Model.Sscc)) {
if (ean128Model == null || UtilityString.isNullOrEmpty(ean128Model.Sscc)) {
throw new NoLUFoundException();
}
this.mColliMagazzinoRESTConsumer.getBySSCC(ean128Model.Sscc, mShouldCheckResiduo, false, response -> {
var mtbColt = response.getMtbColt();
var response = this.mColliMagazzinoRESTConsumer.getBySsccSynchronized(ean128Model.Sscc, mShouldCheckResiduo, false);
if (response == null)
throw new NoLUFoundException();
if (mtbColt != null) {
if (mtbColt.getCodDtip() != null && mShouldCheckIfExistDoc) {
this.sendError(new AlreadyAttachedDocumentToLUException());
} else {
if (mtbColt.getGestioneEnum() == GestioneEnum.VENDITA && mtbColt.getSegno() == -1 && mWarnOnOpeningVendita) {
this.sendOnLUVenditaConfirmRequired(confirmed -> {
if (confirmed) {
onComplete.run();
this.sendOnLUOpened(response);
} else {
onComplete.run();
}
});
} else {
onComplete.run();
this.sendOnLUOpened(response);
}
var mtbColt = response.getMtbColt();
if (mtbColt != null) {
if (mtbColt.getCodDtip() != null && mShouldCheckIfExistDoc) {
throw new AlreadyAttachedDocumentToLUException();
} else {
if (mtbColt.getGestioneEnum() == GestioneEnum.VENDITA && mtbColt.getSegno() == -1 && mWarnOnOpeningVendita) {
this.sendOnLUVenditaConfirmRequired(confirmed -> {
if (confirmed) {
this.sendOnLUOpened(response);
}
} else {
var createUdcRequest = new CreateUDCRequestDTO()
.setBarcodeUl(ean128Model.Sscc)
.setCodMdep(SettingsManager.i().getUserSession().getDepo().getCodMdep());
this.mColliLavorazioneRESTConsumer.createUDC(createUdcRequest, createdMtbColt -> {
onComplete.run();
this.sendOnLUCreated(createdMtbColt);
}, this::sendError);
}
}, this::sendError);
} else {
this.sendError(new NoLUFoundException());
});
} else {
this.sendOnLUOpened(response);
}
}
} else {
var createUdcRequest = new CreateUDCRequestDTO()
.setBarcodeUl(ean128Model.Sscc)
.setCodMdep(SettingsManager.i().getUserSession().getDepo().getCodMdep());
var createdMtbColt = this.mColliLavorazioneRESTConsumer.createUDCSynchronized(createUdcRequest);
this.sendOnLUCreated(createdMtbColt);
}
}, this::sendError);
}
private void executeEAN13(BarcodeScanDTO barcodeScanDTO, Runnable onComplete) {
this.mArticoloRESTConsumer.searchByBarcode(barcodeScanDTO.getStringValue(), articoli -> {
if (articoli != null && articoli.size() == 1) {
MtbAart articolo = articoli.get(0);
MtbDepoPosizione posizione = UtilityPosizione.getFromCache(articolo.getPosizione());
if (posizione != null && posizione.isFlagMonoCollo()) {
this.executePosizione(posizione, onComplete);
} else {
this.sendError(new NoLUFoundException());
}
private void executeEAN13(BarcodeScanDTO barcodeScanDTO) throws Exception {
var articoli = this.mArticoloRESTConsumer.searchByBarcodeSynchronized(barcodeScanDTO.getStringValue());
if (articoli != null && articoli.size() == 1) {
MtbAart articolo = articoli.get(0);
MtbDepoPosizione posizione = UtilityPosizione.getFromCache(articolo.getPosizione());
if (posizione != null && posizione.isFlagMonoCollo()) {
this.executePosizione(posizione);
} else {
this.sendError(new NoLUFoundException());
throw new NoLUFoundException();
}
}, this::sendError);
} else {
throw new NoLUFoundException();
}
}
private void sendOnLUVenditaConfirmRequired(RunnableArgs<Boolean> onConfirm) {

View File

@ -846,7 +846,8 @@
android:layout_marginBottom="16dp"
android:gravity="center"
android:orientation="vertical"
android:padding="16dp">
android:padding="16dp"
android:visibility="@{viewModel.mtbColt == null || viewModel.mtbColt.mtbColr.size() == 0 ? View.VISIBLE : View.GONE}">
<androidx.appcompat.widget.AppCompatImageView
android:layout_width="wrap_content"