Compare commits
26 Commits
fb6a68e6d4
...
master-bet
| Author | SHA1 | Date | |
|---|---|---|---|
| 3ef69b8dd9 | |||
| 6b40bd1d60 | |||
| ab230425c3 | |||
| 2f54b375b9 | |||
| 9aa9b9121f | |||
| 268ce9fce9 | |||
| eddecc165d | |||
| 45c64ad0ac | |||
| 398f0a9523 | |||
| 4861d53031 | |||
| e27a4e840a | |||
| cc67ac5f47 | |||
| 8e2d110792 | |||
| 5cdf33950d | |||
| 2727c1b01c | |||
| 9924165362 | |||
| 0904388ffe | |||
| f86296d2a1 | |||
| cfe2b85886 | |||
| d57a7a53f0 | |||
| 1c9d9bfc8f | |||
| 3614192ea9 | |||
| 4d01a52590 | |||
| 638e8650ee | |||
| 36061faeeb | |||
| 83a183c5a6 |
@@ -11,8 +11,8 @@ apply plugin: 'com.google.gms.google-services'
|
|||||||
|
|
||||||
android {
|
android {
|
||||||
|
|
||||||
def appVersionCode = 549
|
def appVersionCode = 553
|
||||||
def appVersionName = '1.50.00'
|
def appVersionName = '1.50.04'
|
||||||
|
|
||||||
signingConfigs {
|
signingConfigs {
|
||||||
release {
|
release {
|
||||||
|
|||||||
@@ -276,8 +276,8 @@ public class MainApplicationModule {
|
|||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
@Singleton
|
@Singleton
|
||||||
GiacenzaPvRESTConsumer provideGiacenzaPvRESTConsumer(RESTBuilder restBuilder, ExecutorService executorService) {
|
GiacenzaPvRESTConsumer provideGiacenzaPvRESTConsumer(RESTBuilder restBuilder) {
|
||||||
return new GiacenzaPvRESTConsumer(restBuilder, executorService);
|
return new GiacenzaPvRESTConsumer(restBuilder);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ public class ColliAccettazioneRESTConsumer extends _BaseRESTConsumer implements
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public MtbColt synchronousCreateUDC(CreateUDCRequestDTO createUDCRequestDTO) throws Exception {
|
public MtbColt createUDCSynchronized(CreateUDCRequestDTO createUDCRequestDTO) throws Exception {
|
||||||
ColliAccettazioneRESTConsumerService colliAccettazioneRESTConsumerService = restBuilder.getService(ColliAccettazioneRESTConsumerService.class);
|
ColliAccettazioneRESTConsumerService colliAccettazioneRESTConsumerService = restBuilder.getService(ColliAccettazioneRESTConsumerService.class);
|
||||||
|
|
||||||
var response = colliAccettazioneRESTConsumerService.createUDC(createUDCRequestDTO)
|
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) {
|
public void createUDC(CreateUDCRequestDTO createUDCRequestDTO, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
executorService.execute(() -> {
|
executorService.execute(() -> {
|
||||||
try {
|
try {
|
||||||
MtbColt result = synchronousCreateUDC(createUDCRequestDTO);
|
MtbColt result = createUDCSynchronized(createUDCRequestDTO);
|
||||||
onComplete.run(result);
|
onComplete.run(result);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
onFailed.run(e);
|
onFailed.run(e);
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ public class ColliLavorazioneRESTConsumer extends _BaseRESTConsumer implements C
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public MtbColt synchronousCreateUDC(CreateUDCRequestDTO createUDCRequestDTO) throws Exception {
|
public MtbColt createUDCSynchronized(CreateUDCRequestDTO createUDCRequestDTO) throws Exception {
|
||||||
ColliLavorazioneRESTConsumerService colliLavorazioneRESTConsumerService = restBuilder.getService(ColliLavorazioneRESTConsumerService.class);
|
ColliLavorazioneRESTConsumerService colliLavorazioneRESTConsumerService = restBuilder.getService(ColliLavorazioneRESTConsumerService.class);
|
||||||
|
|
||||||
var response = colliLavorazioneRESTConsumerService.createUDC(createUDCRequestDTO)
|
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) {
|
public void createUDC(CreateUDCRequestDTO createUDCRequestDTO, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
executorService.execute(() -> {
|
executorService.execute(() -> {
|
||||||
try {
|
try {
|
||||||
MtbColt result = synchronousCreateUDC(createUDCRequestDTO);
|
MtbColt result = createUDCSynchronized(createUDCRequestDTO);
|
||||||
onComplete.run(result);
|
onComplete.run(result);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
onFailed.run(e);
|
onFailed.run(e);
|
||||||
|
|||||||
@@ -13,23 +13,17 @@ import it.integry.integrywmsnative.core.rest.model.pv.UpdateRowVerificaRequestDT
|
|||||||
|
|
||||||
public class GiacenzaPvRESTConsumer extends _BaseRESTConsumer {
|
public class GiacenzaPvRESTConsumer extends _BaseRESTConsumer {
|
||||||
|
|
||||||
|
|
||||||
private final RESTBuilder restBuilder;
|
private final RESTBuilder restBuilder;
|
||||||
private final ExecutorService executorService;
|
|
||||||
|
|
||||||
public GiacenzaPvRESTConsumer(RESTBuilder restBuilder, ExecutorService executorService) {
|
public GiacenzaPvRESTConsumer(RESTBuilder restBuilder) {
|
||||||
this.restBuilder = restBuilder;
|
this.restBuilder = restBuilder;
|
||||||
this.executorService = executorService;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<GiacenzaPvDTO> retrieveGiacenzeSynchronized(String codMdep, String codMart) throws Exception {
|
||||||
public List<GiacenzaPvDTO> retrieveGiacenzeSynchronized(String codMdep) throws Exception {
|
|
||||||
GiacenzaPvRESTConsumerService giacenzaPvRESTConsumerService = restBuilder.getService(GiacenzaPvRESTConsumerService.class);
|
GiacenzaPvRESTConsumerService giacenzaPvRESTConsumerService = restBuilder.getService(GiacenzaPvRESTConsumerService.class);
|
||||||
var response = giacenzaPvRESTConsumerService.retrieve(codMdep)
|
var response = giacenzaPvRESTConsumerService.retrieve(codMdep, codMart).execute();
|
||||||
.execute();
|
|
||||||
|
|
||||||
var giacenzeList = analyzeAnswer(response, "retrieve-giacenze-pv");
|
var giacenzeList = analyzeAnswer(response, "retrieve-giacenze-pv");
|
||||||
|
|
||||||
return giacenzeList != null ? giacenzeList : new ArrayList<>();
|
return giacenzeList != null ? giacenzeList : new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -64,5 +58,4 @@ public class GiacenzaPvRESTConsumer extends _BaseRESTConsumer {
|
|||||||
|
|
||||||
analyzeAnswer(response, "close-verifica-pv");
|
analyzeAnswer(response, "close-verifica-pv");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,8 +17,7 @@ import retrofit2.http.Query;
|
|||||||
public interface GiacenzaPvRESTConsumerService {
|
public interface GiacenzaPvRESTConsumerService {
|
||||||
|
|
||||||
@GET("wms/pv/verifica_giacenze/retrieve")
|
@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")
|
@POST("wms/pv/verifica_giacenze/save_new_row")
|
||||||
Call<ServiceRESTResponse<Void>> saveNewRowVerifica(@Body SaveNewRowVerificaRequestDTO saveNewRowVerificaRequest);
|
Call<ServiceRESTResponse<Void>> saveNewRowVerifica(@Body SaveNewRowVerificaRequestDTO saveNewRowVerificaRequest);
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import it.integry.integrywmsnative.core.rest.model.uds.InsertUDCRowRequestDTO;
|
|||||||
|
|
||||||
public interface ColliCaricoRESTConsumerInterface {
|
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);
|
void createUDC(CreateUDCRequestDTO createUDCRequestDTO, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed);
|
||||||
|
|
||||||
CloseUDCResponseDTO synchronousCloseUDC(CloseUDCRequestDTO closeUDCRequestDTO) throws Exception;
|
CloseUDCResponseDTO synchronousCloseUDC(CloseUDCRequestDTO closeUDCRequestDTO) throws Exception;
|
||||||
|
|||||||
@@ -16,10 +16,10 @@ public class GetColloInGiacResponseDTO {
|
|||||||
private String descrizioneLivelloAnomalia;
|
private String descrizioneLivelloAnomalia;
|
||||||
|
|
||||||
@SerializedName("escludiPickingVendita")
|
@SerializedName("escludiPickingVendita")
|
||||||
private Boolean escludiPickingVendita;
|
private Boolean escludiPickingVendita = false;
|
||||||
|
|
||||||
@SerializedName("escludiPickingLavorazione")
|
@SerializedName("escludiPickingLavorazione")
|
||||||
private Boolean escludiPickingLavorazione;
|
private Boolean escludiPickingLavorazione = false;
|
||||||
|
|
||||||
public MtbColt getMtbColt() {
|
public MtbColt getMtbColt() {
|
||||||
return mtbColt;
|
return mtbColt;
|
||||||
|
|||||||
@@ -78,7 +78,6 @@ public class MainAccettazioneOrdiniElencoFragment extends BaseFragment implement
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSaveInstanceState(@NonNull Bundle outState) {
|
public void onSaveInstanceState(@NonNull Bundle outState) {
|
||||||
onLoadingEnded();
|
|
||||||
outState.putString("mToolbar", DataCache.addItem(mToolbar));
|
outState.putString("mToolbar", DataCache.addItem(mToolbar));
|
||||||
|
|
||||||
super.onSaveInstanceState(outState);
|
super.onSaveInstanceState(outState);
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ import android.view.Gravity;
|
|||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
|
|
||||||
import androidx.appcompat.app.AlertDialog;
|
|
||||||
import androidx.appcompat.widget.PopupMenu;
|
import androidx.appcompat.widget.PopupMenu;
|
||||||
import androidx.databinding.DataBindingUtil;
|
import androidx.databinding.DataBindingUtil;
|
||||||
import androidx.databinding.ObservableArrayList;
|
import androidx.databinding.ObservableArrayList;
|
||||||
@@ -159,7 +158,17 @@ public class AccettazioneOrdiniPickingActivity extends BaseActivity implements A
|
|||||||
boolean useQtaOrd = SettingsManager.iDB().isFlagAccettazioneUseQtaOrd();
|
boolean useQtaOrd = SettingsManager.iDB().isFlagAccettazioneUseQtaOrd();
|
||||||
|
|
||||||
mViewModel.setListeners(this);
|
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() {
|
private void initFab() {
|
||||||
@@ -376,7 +385,7 @@ public class AccettazioneOrdiniPickingActivity extends BaseActivity implements A
|
|||||||
|
|
||||||
private void refreshList() {
|
private void refreshList() {
|
||||||
|
|
||||||
runOnUiThread(() -> {
|
handler.post(() -> {
|
||||||
List<PickingObjectDTO> tmpList;
|
List<PickingObjectDTO> tmpList;
|
||||||
|
|
||||||
if (mAppliedFilterViewModel != null) {
|
if (mAppliedFilterViewModel != null) {
|
||||||
@@ -817,7 +826,13 @@ public class AccettazioneOrdiniPickingActivity extends BaseActivity implements A
|
|||||||
this.mViewModel.resetMatchedRows();
|
this.mViewModel.resetMatchedRows();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
PickedQuantityDTO pickedQuantityDTO = new PickedQuantityDTO().setNumCnf(resultDTO.getNumCnf()).setQtaCnf(resultDTO.getQtaCnf()).setQtaTot(resultDTO.getQtaTot()).setPartitaMag(resultDTO.getPartitaMag()).setDataScad(resultDTO.getDataScad());
|
PickedQuantityDTO pickedQuantityDTO = new PickedQuantityDTO()
|
||||||
|
.setNumCnf(resultDTO.getNumCnf())
|
||||||
|
.setQtaCnf(resultDTO.getQtaCnf())
|
||||||
|
.setQtaTot(resultDTO.getQtaTot())
|
||||||
|
.setPartitaMag(resultDTO.getPartitaMag())
|
||||||
|
.setDataScad(resultDTO.getDataScad())
|
||||||
|
.setShouldCloseLu(resultDTO.isShouldCloseLu());
|
||||||
onComplete.run(pickedQuantityDTO, pickedQuantityDTO.isShouldCloseLu());
|
onComplete.run(pickedQuantityDTO, pickedQuantityDTO.isShouldCloseLu());
|
||||||
})
|
})
|
||||||
.show(getSupportFragmentManager(), "tag");
|
.show(getSupportFragmentManager(), "tag");
|
||||||
|
|||||||
@@ -1,59 +1,9 @@
|
|||||||
package it.integry.integrywmsnative.gest.accettazione_ordini_picking;
|
package it.integry.integrywmsnative.gest.accettazione_ordini_picking;
|
||||||
|
|
||||||
import android.os.Handler;
|
|
||||||
|
|
||||||
import java.util.concurrent.ExecutorService;
|
|
||||||
|
|
||||||
import dagger.Module;
|
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)
|
@Module(subcomponents = AccettazioneOrdiniPickingComponent.class)
|
||||||
public class AccettazioneOrdiniPickingModule {
|
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,7 +13,10 @@ import java.math.BigDecimal;
|
|||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.concurrent.CountDownLatch;
|
||||||
import java.util.concurrent.ExecutorService;
|
import java.util.concurrent.ExecutorService;
|
||||||
|
import java.util.concurrent.atomic.AtomicReference;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
@@ -124,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.mOrders = orders;
|
||||||
this.mUseQtaOrd = useQtaOrd;
|
this.mUseQtaOrd = useQtaOrd;
|
||||||
|
|
||||||
@@ -134,13 +137,14 @@ public class AccettazioneOrdiniPickingViewModel {
|
|||||||
UtilityBigDecimal.greaterThan(x.getQtaDaEvadere(), BigDecimal.ZERO))
|
UtilityBigDecimal.greaterThan(x.getQtaDaEvadere(), BigDecimal.ZERO))
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
getEmptyPickingList(mSitArts, this.mPickingList::postValue);
|
var pickingList = getEmptyPickingList(mSitArts);
|
||||||
|
this.mPickingList.postValue(pickingList);
|
||||||
|
|
||||||
//Definizione della gestione collo di default
|
//Definizione della gestione collo di default
|
||||||
Boolean isOrdTrasf = Stream.of(mOrders)
|
Boolean isOrdTrasf = mOrders.stream()
|
||||||
.map(OrdineAccettazioneInevasoDTO::isOrdTrasf)
|
.map(OrdineAccettazioneInevasoDTO::isOrdTrasf)
|
||||||
.withoutNulls()
|
.filter(Objects::nonNull)
|
||||||
.distinctBy(x -> x)
|
.distinct()
|
||||||
.findFirst()
|
.findFirst()
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
@@ -154,10 +158,10 @@ public class AccettazioneOrdiniPickingViewModel {
|
|||||||
|
|
||||||
|
|
||||||
//Definizione della gestione collo di default
|
//Definizione della gestione collo di default
|
||||||
List<GestioneEnum> foundGestioni = Stream.of(mOrders)
|
List<GestioneEnum> foundGestioni = mOrders.stream()
|
||||||
.map(OrdineAccettazioneInevasoDTO::getGestioneEnum)
|
.map(OrdineAccettazioneInevasoDTO::getGestioneEnum)
|
||||||
.withoutNulls()
|
.filter(Objects::nonNull)
|
||||||
.distinctBy(x -> x)
|
.distinct()
|
||||||
.toList();
|
.toList();
|
||||||
|
|
||||||
if (foundGestioni.size() == 1) {
|
if (foundGestioni.size() == 1) {
|
||||||
@@ -166,7 +170,7 @@ public class AccettazioneOrdiniPickingViewModel {
|
|||||||
} else
|
} else
|
||||||
defaultGestioneOfUL = foundGestioni.get(0) == GestioneEnum.PRODUZIONE ? GestioneEnum.LAVORAZIONE : foundGestioni.get(0);
|
defaultGestioneOfUL = foundGestioni.get(0) == GestioneEnum.PRODUZIONE ? GestioneEnum.LAVORAZIONE : foundGestioni.get(0);
|
||||||
} else {
|
} else {
|
||||||
this.sendError(new InvalidLUMultiGestioneException());
|
throw new InvalidLUMultiGestioneException();
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (defaultGestioneOfUL) {
|
switch (defaultGestioneOfUL) {
|
||||||
@@ -175,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)
|
.map(SitArtOrdDTO::getCodMart)
|
||||||
.toList();
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
this.mArticoloRESTConsumer.getByCodMarts(codMarts, listMtbAarts -> {
|
var listMtbAarts = this.mArticoloRESTConsumer.getByCodMartsSynchronized(codMarts);
|
||||||
List<PickingObjectDTO> pickingList = Stream.of(sitArtOrdList)
|
List<PickingObjectDTO> pickingList = sitArtOrdList.stream()
|
||||||
.map(sitArtOrdDTO -> {
|
.map(sitArtOrdDTO -> {
|
||||||
MtbAart mtbAart = null;
|
MtbAart mtbAart = null;
|
||||||
|
|
||||||
for (MtbAart mtbAartItem : listMtbAarts) {
|
for (MtbAart mtbAartItem : listMtbAarts) {
|
||||||
if (mtbAartItem.getCodMart().equalsIgnoreCase(sitArtOrdDTO.getCodMart())) {
|
if (mtbAartItem.getCodMart().equalsIgnoreCase(sitArtOrdDTO.getCodMart())) {
|
||||||
mtbAart = mtbAartItem;
|
mtbAart = mtbAartItem;
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return new PickingObjectDTO()
|
return new PickingObjectDTO()
|
||||||
.setSitArtOrdDTO(sitArtOrdDTO)
|
.setSitArtOrdDTO(sitArtOrdDTO)
|
||||||
.setMtbAart(mtbAart);
|
.setMtbAart(mtbAart);
|
||||||
})
|
})
|
||||||
.toList();
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
onComplete.run(pickingList);
|
return pickingList;
|
||||||
}, this::sendError);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public MutableLiveData<List<PickingObjectDTO>> getPickingList() {
|
public MutableLiveData<List<PickingObjectDTO>> getPickingList() {
|
||||||
@@ -767,22 +770,24 @@ public class AccettazioneOrdiniPickingViewModel {
|
|||||||
if (!shouldDelete)
|
if (!shouldDelete)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
this.sendOnLoadingStarted();
|
this.sendOnLoadingStarted();
|
||||||
|
|
||||||
var deleteUDCRowRequest = new DeleteUDCRowRequestDTO()
|
var deleteUDCRowRequest = new DeleteUDCRowRequestDTO()
|
||||||
.setMtbColrToDelete(mtbColrToDelete);
|
.setMtbColrToDelete(mtbColrToDelete);
|
||||||
|
|
||||||
this.mColliCaricoRESTConsumer.deleteUDCRow(deleteUDCRowRequest,
|
this.mColliCaricoRESTConsumer.deleteUDCRow(deleteUDCRowRequest,
|
||||||
() -> {
|
() -> {
|
||||||
Optional<PickingObjectDTO> pickingObjectDTO = Stream.of(this.mPickingList.getValue())
|
Optional<PickingObjectDTO> pickingObjectDTO = Stream.of(this.mPickingList.getValue())
|
||||||
.filter(x -> Stream.of(x.getWithdrawMtbColrs()).anyMatch(y -> y == mtbColrToDelete))
|
.filter(x -> Stream.of(x.getWithdrawMtbColrs()).anyMatch(y -> y == mtbColrToDelete))
|
||||||
.findSingle();
|
.findSingle();
|
||||||
|
|
||||||
if (pickingObjectDTO.isPresent()) {
|
if (pickingObjectDTO.isPresent()) {
|
||||||
pickingObjectDTO.get().getWithdrawMtbColrs().remove(mtbColrToDelete);
|
pickingObjectDTO.get().getWithdrawMtbColrs().remove(mtbColrToDelete);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.mCurrentMtbColt.getMtbColr().remove(mtbColrToDelete);
|
handler.post(() -> {
|
||||||
|
this.mCurrentMtbColt.getMtbColr().remove(mtbColrToDelete);
|
||||||
|
});
|
||||||
|
|
||||||
this.resetMatchedRows();
|
this.resetMatchedRows();
|
||||||
this.sendOnRowSaved();
|
this.sendOnRowSaved();
|
||||||
|
|||||||
@@ -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) {
|
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) {
|
public static Intent createIntent(Context context, List<MtbColt> items, boolean canRecoverUl, boolean onlyResiduo) {
|
||||||
|
|||||||
@@ -54,6 +54,8 @@ public class ListaBancaliViewModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public List<MtbColt> fillMtbColtWithMtbColr(List<MtbColt> mtbColts, boolean onlyResiduo) throws Exception {
|
public List<MtbColt> fillMtbColtWithMtbColr(List<MtbColt> mtbColts, boolean onlyResiduo) throws Exception {
|
||||||
|
if (mtbColts == null || mtbColts.isEmpty()) return mtbColts;
|
||||||
|
|
||||||
List<String> ssccList = mtbColts.stream()
|
List<String> ssccList = mtbColts.stream()
|
||||||
.map(MtbColt::getBarcodeUl)
|
.map(MtbColt::getBarcodeUl)
|
||||||
.collect(Collectors.toUnmodifiableList());
|
.collect(Collectors.toUnmodifiableList());
|
||||||
|
|||||||
@@ -902,7 +902,7 @@ public class PickingLiberoViewModel {
|
|||||||
this.sendError(new AnomaliaUlException(colloInGiac));
|
this.sendError(new AnomaliaUlException(colloInGiac));
|
||||||
} else if (colloInGiac.getEscludiPickingLavorazione() && mDefaultGestione == GestioneEnum.LAVORAZIONE) {
|
} else if (colloInGiac.getEscludiPickingLavorazione() && mDefaultGestione == GestioneEnum.LAVORAZIONE) {
|
||||||
this.sendError(new AnomaliaUlException(colloInGiac));
|
this.sendError(new AnomaliaUlException(colloInGiac));
|
||||||
} else {
|
} else if (colloInGiac.getMessageAnomalia() != null) {
|
||||||
this.onWarning(colloInGiac.getMessageAnomalia(), () -> {
|
this.onWarning(colloInGiac.getMessageAnomalia(), () -> {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -148,7 +148,7 @@ public class PickingResiViewModel {
|
|||||||
|
|
||||||
public void createNewLU(Integer customNumCollo, String customSerCollo) throws Exception {
|
public void createNewLU(Integer customNumCollo, String customSerCollo) throws Exception {
|
||||||
if (mTipologiaReso == Tipologia.VENDITA) {
|
if (mTipologiaReso == Tipologia.VENDITA) {
|
||||||
var createdUdc = mColliAccettazioneRESTConsumer.synchronousCreateUDC(new CreateUDCRequestDTO()
|
var createdUdc = mColliAccettazioneRESTConsumer.createUDCSynchronized(new CreateUDCRequestDTO()
|
||||||
.setCodAnag(mDefaultCodAnagOfLU)
|
.setCodAnag(mDefaultCodAnagOfLU)
|
||||||
.setCodMdep(mDefaultCodMdepOfLU)
|
.setCodMdep(mDefaultCodMdepOfLU)
|
||||||
.setNumCollo(customNumCollo)
|
.setNumCollo(customNumCollo)
|
||||||
|
|||||||
@@ -428,7 +428,7 @@ public class ProdVersamentoMaterialeViewModel {
|
|||||||
private void checkAnomaliaUl(GetColloInGiacResponseDTO colloInGiac) {
|
private void checkAnomaliaUl(GetColloInGiacResponseDTO colloInGiac) {
|
||||||
if (colloInGiac.getEscludiPickingLavorazione()) {
|
if (colloInGiac.getEscludiPickingLavorazione()) {
|
||||||
this.sendError(new AnomaliaUlException(colloInGiac));
|
this.sendError(new AnomaliaUlException(colloInGiac));
|
||||||
} else {
|
} else if (colloInGiac.getMessageAnomalia() != null) {
|
||||||
this.sendWarning(colloInGiac.getMessageAnomalia(), () -> {
|
this.sendWarning(colloInGiac.getMessageAnomalia(), () -> {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ import com.ravikoradiya.liveadapter.Type;
|
|||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
|
import java.util.List;
|
||||||
import java.util.concurrent.CountDownLatch;
|
import java.util.concurrent.CountDownLatch;
|
||||||
import java.util.concurrent.atomic.AtomicReference;
|
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.bottom_sheet__item_edit.BottomSheetItemEditView;
|
||||||
import it.integry.integrywmsnative.view.dialogs.DialogConsts;
|
import it.integry.integrywmsnative.view.dialogs.DialogConsts;
|
||||||
import it.integry.integrywmsnative.view.dialogs.ask_deposito.DialogAskDepositoView;
|
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.DialogInputQuantityV2DTO;
|
||||||
import it.integry.integrywmsnative.view.dialogs.input_quantity_v2.DialogInputQuantityV2View;
|
import it.integry.integrywmsnative.view.dialogs.input_quantity_v2.DialogInputQuantityV2View;
|
||||||
import it.integry.integrywmsnative.view.dialogs.yes_no.DialogYesNoView;
|
import it.integry.integrywmsnative.view.dialogs.yes_no.DialogYesNoView;
|
||||||
@@ -91,7 +93,6 @@ public class VerificaGiacenzeFragment extends BaseFragment implements ITitledFra
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void init() {
|
private void init() {
|
||||||
|
|
||||||
executorService.execute(() -> {
|
executorService.execute(() -> {
|
||||||
|
|
||||||
boolean recoveredSession = false;
|
boolean recoveredSession = false;
|
||||||
@@ -129,7 +130,6 @@ public class VerificaGiacenzeFragment extends BaseFragment implements ITitledFra
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
this.onLoadingStarted();
|
this.onLoadingStarted();
|
||||||
mViewModel.loadDeposito(codMdep);
|
|
||||||
|
|
||||||
if (!recoveredSession) mViewModel.createNew(codMdep);
|
if (!recoveredSession) mViewModel.createNew(codMdep);
|
||||||
|
|
||||||
@@ -162,7 +162,6 @@ public class VerificaGiacenzeFragment extends BaseFragment implements ITitledFra
|
|||||||
CountDownLatch countDownLatch = new CountDownLatch(1);
|
CountDownLatch countDownLatch = new CountDownLatch(1);
|
||||||
AtomicReference<String> codMdepAtomic = new AtomicReference<>();
|
AtomicReference<String> codMdepAtomic = new AtomicReference<>();
|
||||||
|
|
||||||
|
|
||||||
DialogAskDepositoView.newInstance(codMdep -> {
|
DialogAskDepositoView.newInstance(codMdep -> {
|
||||||
codMdepAtomic.set(codMdep);
|
codMdepAtomic.set(codMdep);
|
||||||
countDownLatch.countDown();
|
countDownLatch.countDown();
|
||||||
@@ -173,7 +172,6 @@ public class VerificaGiacenzeFragment extends BaseFragment implements ITitledFra
|
|||||||
return codMdepAtomic.get();
|
return codMdepAtomic.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void initRecyclerView() {
|
private void initRecyclerView() {
|
||||||
var itemType = new Type<VerificaGiacenzeRowEntity, ListaVerificaGiacenzePickedItemListModelBinding>(R.layout.lista_verifica_giacenze_picked_item_list_model, BR.item);
|
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();
|
this.onLoadingEnded();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
this.onError(e);
|
this.onError(e);
|
||||||
|
} finally {
|
||||||
|
handler.post(this::onLoadingEnded);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
this.onLoadingEnded();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
private void openItemAction(VerificaGiacenzeRowEntity item) {
|
private void openItemAction(VerificaGiacenzeRowEntity item) {
|
||||||
var anagrafica = mViewModel.searchAnagraficaByCodMart(item.getCodMart());
|
var anagrafica = mViewModel.searchAnagraficaByCodMart(item.getCodMart());
|
||||||
|
|
||||||
@@ -262,7 +259,6 @@ public class VerificaGiacenzeFragment extends BaseFragment implements ITitledFra
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public PickedQuantityDTO onItemDispatched(MtbAart mtbAart,
|
public PickedQuantityDTO onItemDispatched(MtbAart mtbAart,
|
||||||
BigDecimal initialNumCnf,
|
BigDecimal initialNumCnf,
|
||||||
BigDecimal initialQtaCnf,
|
BigDecimal initialQtaCnf,
|
||||||
@@ -340,7 +336,6 @@ public class VerificaGiacenzeFragment extends BaseFragment implements ITitledFra
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDestroy() {
|
public void onDestroy() {
|
||||||
super.onDestroy();
|
super.onDestroy();
|
||||||
@@ -351,4 +346,10 @@ public class VerificaGiacenzeFragment extends BaseFragment implements ITitledFra
|
|||||||
public void onCreateActionBar(AppCompatTextView titleText, Context context) {
|
public void onCreateActionBar(AppCompatTextView titleText, Context context) {
|
||||||
titleText.setText(R.string.verifica_giacenze_menu);
|
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");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -16,8 +16,8 @@ import it.integry.integrywmsnative.core.rest.consumers.GiacenzaPvRESTConsumer;
|
|||||||
public class VerificaGiacenzeModule {
|
public class VerificaGiacenzeModule {
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
VerificaGiacenzeViewModel providesVerificaGiacenzeViewModel(ExecutorService executorService, Handler handler, VerificaGiacenzeRowMapper verificaGiacenzeRowMapper, VerificaGiacenzeRepository verificaGiacenzeRepository, VerificaGiacenzeRowRepository verificaGiacenzeRowRepository, GiacenzaPvRESTConsumer giacenzaPvRESTConsumer, ArticoloRESTConsumer articoloRESTConsumer) {
|
VerificaGiacenzeViewModel providesVerificaGiacenzeViewModel(Handler handler, VerificaGiacenzeRowMapper verificaGiacenzeRowMapper, VerificaGiacenzeRepository verificaGiacenzeRepository, VerificaGiacenzeRowRepository verificaGiacenzeRowRepository, GiacenzaPvRESTConsumer giacenzaPvRESTConsumer, ArticoloRESTConsumer articoloRESTConsumer) {
|
||||||
return new VerificaGiacenzeViewModel(executorService, handler, verificaGiacenzeRowMapper, giacenzaPvRESTConsumer, verificaGiacenzeRepository, verificaGiacenzeRowRepository, articoloRESTConsumer);
|
return new VerificaGiacenzeViewModel(handler, verificaGiacenzeRowMapper, giacenzaPvRESTConsumer, verificaGiacenzeRepository, verificaGiacenzeRowRepository, articoloRESTConsumer);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -11,8 +11,8 @@ import java.time.LocalDateTime;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.concurrent.ExecutorService;
|
import java.util.concurrent.CountDownLatch;
|
||||||
import java.util.stream.Collectors;
|
import java.util.concurrent.atomic.AtomicReference;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
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.VerificaGiacenzeRepository;
|
||||||
import it.integry.integrywmsnative.core.data_store.db.respository_new.VerificaGiacenzeRowRepository;
|
import it.integry.integrywmsnative.core.data_store.db.respository_new.VerificaGiacenzeRowRepository;
|
||||||
import it.integry.integrywmsnative.core.exception.NoArtsFoundException;
|
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.interfaces.viewmodel_listeners.ILoadingListener;
|
||||||
import it.integry.integrywmsnative.core.mapper.VerificaGiacenzeMapper;
|
|
||||||
import it.integry.integrywmsnative.core.mapper.VerificaGiacenzeRowMapper;
|
import it.integry.integrywmsnative.core.mapper.VerificaGiacenzeRowMapper;
|
||||||
import it.integry.integrywmsnative.core.model.MtbAart;
|
import it.integry.integrywmsnative.core.model.MtbAart;
|
||||||
import it.integry.integrywmsnative.core.rest.consumers.ArticoloRESTConsumer;
|
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.Ean13PesoModel;
|
||||||
import it.integry.integrywmsnative.core.rest.model.pv.CloseVerificaRequestDTO;
|
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.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.SaveNewRowVerificaRequestDTO;
|
||||||
import it.integry.integrywmsnative.core.rest.model.pv.UpdateRowVerificaRequestDTO;
|
import it.integry.integrywmsnative.core.rest.model.pv.UpdateRowVerificaRequestDTO;
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityBarcode;
|
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;
|
import it.integry.integrywmsnative.gest.spedizione.model.PickedQuantityDTO;
|
||||||
|
|
||||||
public class VerificaGiacenzeViewModel {
|
public class VerificaGiacenzeViewModel {
|
||||||
|
|
||||||
private final ExecutorService executorService;
|
|
||||||
private final Handler handler;
|
private final Handler handler;
|
||||||
private final VerificaGiacenzeRowMapper verificaGiacenzeRowMapper;
|
private final VerificaGiacenzeRowMapper verificaGiacenzeRowMapper;
|
||||||
private final GiacenzaPvRESTConsumer giacenzaPvRESTConsumer;
|
private final GiacenzaPvRESTConsumer giacenzaPvRESTConsumer;
|
||||||
@@ -50,21 +47,17 @@ public class VerificaGiacenzeViewModel {
|
|||||||
|
|
||||||
private Listener listener;
|
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 final MutableLiveData<List<VerificaGiacenzeRowEntity>> currentVerificaRows = new MutableLiveData<>(new ArrayList<>());
|
||||||
|
private List<MtbAart> currentLoadedAnagrafiche = new ArrayList<>();
|
||||||
private List<GiacenzaPvDTO> currentLoadedGiacenza = null;
|
|
||||||
private List<MtbAart> currentLoadedAnagrafiche = null;
|
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public VerificaGiacenzeViewModel(ExecutorService executorService,
|
public VerificaGiacenzeViewModel(Handler handler,
|
||||||
Handler handler,
|
|
||||||
VerificaGiacenzeRowMapper verificaGiacenzeRowMapper,
|
VerificaGiacenzeRowMapper verificaGiacenzeRowMapper,
|
||||||
GiacenzaPvRESTConsumer giacenzaPvRESTConsumer,
|
GiacenzaPvRESTConsumer giacenzaPvRESTConsumer,
|
||||||
VerificaGiacenzeRepository verificaGiacenzeRepository,
|
VerificaGiacenzeRepository verificaGiacenzeRepository,
|
||||||
VerificaGiacenzeRowRepository verificaGiacenzeRowRepository,
|
VerificaGiacenzeRowRepository verificaGiacenzeRowRepository,
|
||||||
ArticoloRESTConsumer articoloRESTConsumer) {
|
ArticoloRESTConsumer articoloRESTConsumer) {
|
||||||
this.executorService = executorService;
|
|
||||||
this.handler = handler;
|
this.handler = handler;
|
||||||
this.verificaGiacenzeRowMapper = verificaGiacenzeRowMapper;
|
this.verificaGiacenzeRowMapper = verificaGiacenzeRowMapper;
|
||||||
this.giacenzaPvRESTConsumer = giacenzaPvRESTConsumer;
|
this.giacenzaPvRESTConsumer = giacenzaPvRESTConsumer;
|
||||||
@@ -87,8 +80,7 @@ public class VerificaGiacenzeViewModel {
|
|||||||
currentVerifica.postValue(null);
|
currentVerifica.postValue(null);
|
||||||
currentVerificaRows.postValue(new ArrayList<>());
|
currentVerificaRows.postValue(new ArrayList<>());
|
||||||
|
|
||||||
currentLoadedGiacenza = null;
|
currentLoadedAnagrafiche = new ArrayList<>();
|
||||||
currentLoadedAnagrafiche = null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public LiveData<VerificaGiacenzeEntity> getCurrentVerifica() {
|
public LiveData<VerificaGiacenzeEntity> getCurrentVerifica() {
|
||||||
@@ -99,60 +91,6 @@ public class VerificaGiacenzeViewModel {
|
|||||||
return currentVerificaRows;
|
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) {
|
public void createNew(String codMdep) {
|
||||||
var verificaGiacenzeEntity = new VerificaGiacenzeEntity();
|
var verificaGiacenzeEntity = new VerificaGiacenzeEntity();
|
||||||
verificaGiacenzeEntity.setCodMdep(codMdep);
|
verificaGiacenzeEntity.setCodMdep(codMdep);
|
||||||
@@ -172,7 +110,7 @@ public class VerificaGiacenzeViewModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void close() throws Exception {
|
public void close() throws Exception {
|
||||||
if (currentVerificaRows.getValue().isEmpty()) {
|
if (currentVerificaRows.getValue() == null || currentVerificaRows.getValue().isEmpty()) {
|
||||||
delete();
|
delete();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -187,32 +125,52 @@ public class VerificaGiacenzeViewModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void processBarcodeDTO(BarcodeScanDTO barcodeScanDTO) throws Exception {
|
public void processBarcodeDTO(BarcodeScanDTO barcodeScanDTO) throws Exception {
|
||||||
|
|
||||||
if (UtilityBarcode.isEanPeso(barcodeScanDTO)) {
|
if (UtilityBarcode.isEanPeso(barcodeScanDTO)) {
|
||||||
var ean13 = Ean13PesoModel.fromBarcode(barcodeScanDTO.getStringValue());
|
var ean13 = Ean13PesoModel.fromBarcode(barcodeScanDTO.getStringValue());
|
||||||
this.loadArticolo(ean13.getPrecode());
|
this.loadArticolo(ean13.getPrecode());
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
this.loadArticolo(barcodeScanDTO.getStringValue());
|
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 {
|
if (mtbAartList != null && !mtbAartList.isEmpty()) {
|
||||||
var foundMtbAart = searchAnagraficaByBarcode(barcodeProd);
|
MtbAart loadedArticolo;
|
||||||
|
|
||||||
if (foundMtbAart == null)
|
if (mtbAartList.size() == 1) loadedArticolo = mtbAartList.get(0);
|
||||||
throw new NoArtsFoundException();
|
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 {
|
private void updateCurrentAnagrafiche(MtbAart loadedArticolo) {
|
||||||
var foundGiacenza = currentLoadedGiacenza.parallelStream()
|
MtbAart mtbAart = currentLoadedAnagrafiche.stream()
|
||||||
.filter(x -> x.getCodMart().equalsIgnoreCase(mtbAart.getCodMart()))
|
.filter(x -> x.getCodMart().equalsIgnoreCase(loadedArticolo.getCodMart()))
|
||||||
.findFirst()
|
.findFirst()
|
||||||
.orElse(null);
|
.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 numCnfGiacenza = foundGiacenza != null ? UtilityBigDecimal.divide(foundGiacenza.getQtaInv(), mtbAart.getQtaCnf()) : BigDecimal.ZERO;
|
||||||
var qtaCnfGiacenza = mtbAart.getQtaCnf();
|
var qtaCnfGiacenza = mtbAart.getQtaCnf();
|
||||||
var qtaGiacenza = foundGiacenza != null ? foundGiacenza.getQtaInv() : BigDecimal.ZERO;
|
var qtaGiacenza = foundGiacenza != null ? foundGiacenza.getQtaInv() : BigDecimal.ZERO;
|
||||||
@@ -226,7 +184,7 @@ public class VerificaGiacenzeViewModel {
|
|||||||
|
|
||||||
boolean isNewRow = false;
|
boolean isNewRow = false;
|
||||||
|
|
||||||
var rowToSave = currentVerificaRows.getValue().parallelStream()
|
var rowToSave = Objects.requireNonNull(currentVerificaRows.getValue()).parallelStream()
|
||||||
.filter(x -> x.getCodMart().equalsIgnoreCase(mtbAart.getCodMart()))
|
.filter(x -> x.getCodMart().equalsIgnoreCase(mtbAart.getCodMart()))
|
||||||
.findFirst()
|
.findFirst()
|
||||||
.orElse(null);
|
.orElse(null);
|
||||||
@@ -235,7 +193,7 @@ public class VerificaGiacenzeViewModel {
|
|||||||
isNewRow = true;
|
isNewRow = true;
|
||||||
|
|
||||||
rowToSave = new VerificaGiacenzeRowEntity();
|
rowToSave = new VerificaGiacenzeRowEntity();
|
||||||
rowToSave.setParentId(currentVerifica.getValue().getId());
|
rowToSave.setParentId(Objects.requireNonNull(currentVerifica.getValue()).getId());
|
||||||
rowToSave.setCodMart(mtbAart.getCodMart());
|
rowToSave.setCodMart(mtbAart.getCodMart());
|
||||||
rowToSave.setPartitaMag(null);
|
rowToSave.setPartitaMag(null);
|
||||||
rowToSave.setDescrizione(mtbAart.getDescrizione());
|
rowToSave.setDescrizione(mtbAart.getDescrizione());
|
||||||
@@ -246,21 +204,18 @@ public class VerificaGiacenzeViewModel {
|
|||||||
initialQtaTot = rowToSave.getQta();
|
initialQtaTot = rowToSave.getQta();
|
||||||
}
|
}
|
||||||
|
|
||||||
var pickedQuantity = this.sendOnItemDispatched(mtbAart,
|
var pickedQuantity = this.sendOnItemDispatched(
|
||||||
|
mtbAart,
|
||||||
initialNumCnf,
|
initialNumCnf,
|
||||||
qtaCnfGiacenza,
|
qtaCnfGiacenza,
|
||||||
initialQtaTot,
|
initialQtaTot,
|
||||||
numCnfGiacenza,
|
numCnfGiacenza,
|
||||||
qtaGiacenza,
|
qtaGiacenza,
|
||||||
incomingNumCnf,
|
incomingNumCnf,
|
||||||
incomingQta,
|
incomingQta
|
||||||
null,
|
|
||||||
null
|
|
||||||
);
|
);
|
||||||
|
|
||||||
if (pickedQuantity == null)
|
if (pickedQuantity == null) return;
|
||||||
return;
|
|
||||||
|
|
||||||
|
|
||||||
rowToSave.setNumConf(pickedQuantity.getNumCnf());
|
rowToSave.setNumConf(pickedQuantity.getNumCnf());
|
||||||
rowToSave.setQtaConf(pickedQuantity.getQtaCnf());
|
rowToSave.setQtaConf(pickedQuantity.getQtaCnf());
|
||||||
@@ -272,7 +227,6 @@ public class VerificaGiacenzeViewModel {
|
|||||||
} else {
|
} else {
|
||||||
updateRow(rowToSave);
|
updateRow(rowToSave);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public MtbAart searchAnagraficaByCodMart(String codMart) {
|
public MtbAart searchAnagraficaByCodMart(String codMart) {
|
||||||
@@ -282,24 +236,6 @@ public class VerificaGiacenzeViewModel {
|
|||||||
.orElse(null);
|
.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) {
|
public void insertRow(VerificaGiacenzeRowEntity rowEntity) {
|
||||||
this.sendOnLoadingStarted();
|
this.sendOnLoadingStarted();
|
||||||
|
|
||||||
@@ -316,7 +252,7 @@ public class VerificaGiacenzeViewModel {
|
|||||||
|
|
||||||
verificaGiacenzeRowRepository.insert(rowEntity, insertedData -> {
|
verificaGiacenzeRowRepository.insert(rowEntity, insertedData -> {
|
||||||
handler.post(() -> {
|
handler.post(() -> {
|
||||||
currentVerificaRows.getValue().add(insertedData);
|
Objects.requireNonNull(currentVerificaRows.getValue()).add(insertedData);
|
||||||
notifyRowChanged();
|
notifyRowChanged();
|
||||||
});
|
});
|
||||||
}, this::sendError);
|
}, this::sendError);
|
||||||
@@ -339,7 +275,7 @@ public class VerificaGiacenzeViewModel {
|
|||||||
var indexInList = -1;
|
var indexInList = -1;
|
||||||
|
|
||||||
List<VerificaGiacenzeRowEntity> value = currentVerificaRows.getValue();
|
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);
|
VerificaGiacenzeRowEntity entity = value.get(i);
|
||||||
|
|
||||||
if (Objects.equals(entity.getId(), rowEntity.getId())) {
|
if (Objects.equals(entity.getId(), rowEntity.getId())) {
|
||||||
@@ -374,7 +310,7 @@ public class VerificaGiacenzeViewModel {
|
|||||||
verificaGiacenzeRowRepository.delete(rowEntity, () -> {
|
verificaGiacenzeRowRepository.delete(rowEntity, () -> {
|
||||||
|
|
||||||
handler.post(() -> {
|
handler.post(() -> {
|
||||||
currentVerificaRows.getValue().remove(rowEntity);
|
Objects.requireNonNull(currentVerificaRows.getValue()).remove(rowEntity);
|
||||||
notifyRowChanged();
|
notifyRowChanged();
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -386,6 +322,25 @@ public class VerificaGiacenzeViewModel {
|
|||||||
this.sendOnLoadingEnded();
|
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,
|
private PickedQuantityDTO sendOnItemDispatched(MtbAart mtbAart,
|
||||||
BigDecimal initialNumCnf,
|
BigDecimal initialNumCnf,
|
||||||
BigDecimal initialQtaCnf,
|
BigDecimal initialQtaCnf,
|
||||||
@@ -393,15 +348,13 @@ public class VerificaGiacenzeViewModel {
|
|||||||
BigDecimal inWarehouseNumCnf,
|
BigDecimal inWarehouseNumCnf,
|
||||||
BigDecimal inWarehouseQtaTot,
|
BigDecimal inWarehouseQtaTot,
|
||||||
BigDecimal incomingNumCnf,
|
BigDecimal incomingNumCnf,
|
||||||
BigDecimal incomingQtaTot,
|
BigDecimal incomingQtaTot) {
|
||||||
String partitaMag,
|
|
||||||
LocalDate dataScad) {
|
|
||||||
if (listener != null)
|
if (listener != null)
|
||||||
return this.listener.onItemDispatched(mtbAart,
|
return this.listener.onItemDispatched(
|
||||||
initialNumCnf, initialQtaCnf, initialQtaTot,
|
mtbAart, initialNumCnf, initialQtaCnf,
|
||||||
inWarehouseNumCnf, inWarehouseQtaTot,
|
initialQtaTot, inWarehouseNumCnf, inWarehouseQtaTot,
|
||||||
incomingNumCnf, incomingQtaTot,
|
incomingNumCnf, incomingQtaTot, null, null
|
||||||
partitaMag, dataScad);
|
);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -435,5 +388,7 @@ public class VerificaGiacenzeViewModel {
|
|||||||
LocalDate dataScad);
|
LocalDate dataScad);
|
||||||
|
|
||||||
void onError(Exception ex);
|
void onError(Exception ex);
|
||||||
|
|
||||||
|
void onChooseArtRequest(List<MtbAart> artsList, RunnableArgs<MtbAart> onComplete);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1884,8 +1884,9 @@ public class SpedizioneViewModel {
|
|||||||
this.sendError(new AnomaliaUlException(colloInGiac));
|
this.sendError(new AnomaliaUlException(colloInGiac));
|
||||||
} else if (colloInGiac.getEscludiPickingVendita() && mDefaultGestioneOfUL == GestioneEnum.VENDITA) {
|
} else if (colloInGiac.getEscludiPickingVendita() && mDefaultGestioneOfUL == GestioneEnum.VENDITA) {
|
||||||
this.sendError(new AnomaliaUlException(colloInGiac));
|
this.sendError(new AnomaliaUlException(colloInGiac));
|
||||||
} else {
|
} else if (colloInGiac.getMessageAnomalia() != null) {
|
||||||
this.onWarning(colloInGiac.getMessageAnomalia(), () -> {});
|
this.onWarning(colloInGiac.getMessageAnomalia(), () -> {
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -232,7 +232,7 @@ public class VersamentoMerceViewModel {
|
|||||||
.setSerCollo(CommonConst.Config.DEFAULT_ANONYMOUS_UL_SERIE)
|
.setSerCollo(CommonConst.Config.DEFAULT_ANONYMOUS_UL_SERIE)
|
||||||
.setBarcodeUl(sscc);
|
.setBarcodeUl(sscc);
|
||||||
|
|
||||||
var mtbColtAnonimo = this.mColliLavorazioneRESTConsumer.synchronousCreateUDC(createUDCRequestDTO);
|
var mtbColtAnonimo = this.mColliLavorazioneRESTConsumer.createUDCSynchronized(createUDCRequestDTO);
|
||||||
pickMerceULtoUL(mtbColtAnonimo);
|
pickMerceULtoUL(mtbColtAnonimo);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -29,7 +29,6 @@ import it.integry.integrywmsnative.databinding.BottomSheetFragmentLuContentBindi
|
|||||||
import it.integry.integrywmsnative.databinding.BottomSheetFragmentLuContentListItemBinding;
|
import it.integry.integrywmsnative.databinding.BottomSheetFragmentLuContentListItemBinding;
|
||||||
import it.integry.integrywmsnative.view.bottom_sheet__base.BottomSheetFragmentBaseView;
|
import it.integry.integrywmsnative.view.bottom_sheet__base.BottomSheetFragmentBaseView;
|
||||||
import it.integry.integrywmsnative.view.bottom_sheet__mtb_colr_edit.BottomSheetMtbColrEditModalView;
|
import it.integry.integrywmsnative.view.bottom_sheet__mtb_colr_edit.BottomSheetMtbColrEditModalView;
|
||||||
import kotlin.Unit;
|
|
||||||
|
|
||||||
public class BottomSheetFragmentLUContentView extends BottomSheetFragmentBaseView implements BottomSheetMtbColrEditModalView.Listener {
|
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)
|
new LiveAdapter(mViewModel.getObservableMtbColt().get().getMtbColr(), BR.item)
|
||||||
.map(MtbColr.class, itemType)
|
.map(MtbColr.class, itemType)
|
||||||
.onNoData(noData -> {
|
// .onNoData(noData -> {
|
||||||
this.mBinding.emptyView.setVisibility(noData ? View.VISIBLE : View.GONE);
|
// this.mBinding.emptyView.setVisibility(noData ? View.VISIBLE : View.GONE);
|
||||||
return Unit.INSTANCE;
|
// return Unit.INSTANCE;
|
||||||
})
|
// })
|
||||||
.into(this.mBinding.mtbColrRecyclerView);
|
.into(this.mBinding.mtbColrRecyclerView);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -154,7 +154,14 @@ public class DialogScanOrCreateLUView extends BaseDialogFragment implements Dial
|
|||||||
private final RunnableArgs<BarcodeScanDTO> onScanSuccessfull = data -> {
|
private final RunnableArgs<BarcodeScanDTO> onScanSuccessfull = data -> {
|
||||||
this.onLoadingStarted();
|
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
|
@Override
|
||||||
public void onLUOpened(GetColloInGiacResponseDTO colloInGiac, boolean created) {
|
public void onLUOpened(GetColloInGiacResponseDTO colloInGiac, boolean created) {
|
||||||
this.openedMtbColt = colloInGiac.getMtbColt();
|
handler.post(() -> {
|
||||||
mOnComplete.run(Result.completed(colloInGiac, created));
|
this.openedMtbColt = colloInGiac.getMtbColt();
|
||||||
|
mOnComplete.run(Result.completed(colloInGiac, created));
|
||||||
|
|
||||||
dismiss();
|
dismiss();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -65,153 +65,138 @@ public class DialogScanOrCreateLUViewModel {
|
|||||||
var createUdcRequest = new CreateUDCRequestDTO()
|
var createUdcRequest = new CreateUDCRequestDTO()
|
||||||
.setCodMdep(SettingsManager.i().getUserSession().getDepo().getCodMdep());
|
.setCodMdep(SettingsManager.i().getUserSession().getDepo().getCodMdep());
|
||||||
|
|
||||||
var createResponse = this.mColliLavorazioneRESTConsumer.synchronousCreateUDC(createUdcRequest);
|
var createResponse = this.mColliLavorazioneRESTConsumer.createUDCSynchronized(createUdcRequest);
|
||||||
this.sendOnLUCreated(createResponse);
|
this.sendOnLUCreated(createResponse);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void processBarcodeDTO(BarcodeScanDTO barcodeScanDTO, Runnable onComplete) {
|
public void processBarcodeDTO(BarcodeScanDTO barcodeScanDTO) throws Exception {
|
||||||
if (UtilityBarcode.isEtichettaPosizione(barcodeScanDTO)) {
|
if (UtilityBarcode.isEtichettaPosizione(barcodeScanDTO)) {
|
||||||
this.executeEtichettaPosizione(barcodeScanDTO, onComplete);
|
this.executeEtichettaPosizione(barcodeScanDTO);
|
||||||
|
|
||||||
} else if (UtilityBarcode.isEtichettaAnonima(barcodeScanDTO)) {
|
} else if (UtilityBarcode.isEtichettaAnonima(barcodeScanDTO)) {
|
||||||
this.executeEtichettaAnonima(barcodeScanDTO, onComplete);
|
this.executeEtichettaAnonima(barcodeScanDTO);
|
||||||
|
|
||||||
} else if (UtilityBarcode.isEtichetta128(barcodeScanDTO)) {
|
} else if (UtilityBarcode.isEtichetta128(barcodeScanDTO)) {
|
||||||
this.executeEAN128(barcodeScanDTO, onComplete);
|
this.executeEAN128(barcodeScanDTO);
|
||||||
|
|
||||||
} else if (UtilityBarcode.isEan13(barcodeScanDTO)) {
|
} else if (UtilityBarcode.isEan13(barcodeScanDTO)) {
|
||||||
this.executeEAN13(barcodeScanDTO, onComplete);
|
this.executeEAN13(barcodeScanDTO);
|
||||||
} else {
|
|
||||||
onComplete.run();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void executeEtichettaPosizione(BarcodeScanDTO barcodeScanDTO, Runnable onComplete) {
|
private void executeEtichettaPosizione(BarcodeScanDTO barcodeScanDTO) throws Exception {
|
||||||
|
|
||||||
MtbDepoPosizione foundPosizione = Stream.of(SettingsManager.iDB().getAvailablePosizioni())
|
MtbDepoPosizione foundPosizione = Stream.of(SettingsManager.iDB().getAvailablePosizioni())
|
||||||
.filter(x -> x.getPosizione().equalsIgnoreCase(barcodeScanDTO.getStringValue()))
|
.filter(x -> x.getPosizione().equalsIgnoreCase(barcodeScanDTO.getStringValue()))
|
||||||
.single();
|
.single();
|
||||||
this.executePosizione(foundPosizione, onComplete);
|
|
||||||
|
|
||||||
|
this.executePosizione(foundPosizione);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void executePosizione(MtbDepoPosizione posizione, Runnable onComplete) {
|
private void executePosizione(MtbDepoPosizione posizione) throws Exception {
|
||||||
this.mPosizioniRESTConsumer.getBancaliInPosizione(posizione, barcodeUlInPosizioneList -> {
|
var barcodeUlInPosizioneList = this.mPosizioniRESTConsumer.getBancaliInPosizioneSynchronized(posizione);
|
||||||
|
|
||||||
if (barcodeUlInPosizioneList == null || barcodeUlInPosizioneList.isEmpty()) {
|
if (barcodeUlInPosizioneList == null || barcodeUlInPosizioneList.isEmpty()) {
|
||||||
this.sendError(new NoLUFoundException());
|
this.sendError(new NoLUFoundException());
|
||||||
} else if (barcodeUlInPosizioneList.size() == 1) {
|
} else if (barcodeUlInPosizioneList.size() == 1) {
|
||||||
this.mColliMagazzinoRESTConsumer.getBySSCC(barcodeUlInPosizioneList.get(0), mShouldCheckResiduo, false, response -> {
|
var response = this.mColliMagazzinoRESTConsumer.getBySsccSynchronized(barcodeUlInPosizioneList.get(0), mShouldCheckResiduo, false);
|
||||||
onComplete.run();
|
this.sendOnLUOpened(response);
|
||||||
this.sendOnLUOpened(response);
|
} else {
|
||||||
}, this::sendError);
|
throw new TooManyLUFoundInMonoLUPositionException();
|
||||||
} else {
|
}
|
||||||
this.sendError(new TooManyLUFoundInMonoLUPositionException());
|
|
||||||
}
|
|
||||||
|
|
||||||
}, this::sendError);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void executeEtichettaAnonima(BarcodeScanDTO barcodeScanDTO, Runnable onComplete) {
|
private void executeEtichettaAnonima(BarcodeScanDTO barcodeScanDTO) throws Exception {
|
||||||
this.mColliMagazzinoRESTConsumer.getBySSCC(barcodeScanDTO.getStringValue(), mShouldCheckResiduo, false, response -> {
|
var response = this.mColliMagazzinoRESTConsumer.getBySsccSynchronized(barcodeScanDTO.getStringValue(), mShouldCheckResiduo, false);
|
||||||
var mtbColt = response.getMtbColt();
|
var mtbColt = response.getMtbColt();
|
||||||
|
|
||||||
if (mtbColt == null) {
|
if (mtbColt == null) {
|
||||||
if (mEnableCreation) {
|
if (mEnableCreation) {
|
||||||
Integer customNumCollo = null;
|
Integer customNumCollo = null;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
customNumCollo = UtilityBarcode.getNumColloFromULAnonima(barcodeScanDTO.getStringValue());
|
customNumCollo = UtilityBarcode.getNumColloFromULAnonima(barcodeScanDTO.getStringValue());
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
this.sendError(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());
|
|
||||||
}
|
}
|
||||||
} 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) {
|
private void executeEAN128(BarcodeScanDTO barcodeScanDTO) throws Exception {
|
||||||
this.mBarcodeRESTConsumer.decodeEan128(barcodeScanDTO, ean128Model -> {
|
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 response = this.mColliMagazzinoRESTConsumer.getBySsccSynchronized(ean128Model.Sscc, mShouldCheckResiduo, false);
|
||||||
var mtbColt = response.getMtbColt();
|
if (response == null)
|
||||||
|
throw new NoLUFoundException();
|
||||||
|
|
||||||
if (mtbColt != null) {
|
var mtbColt = response.getMtbColt();
|
||||||
if (mtbColt.getCodDtip() != null && mShouldCheckIfExistDoc) {
|
|
||||||
this.sendError(new AlreadyAttachedDocumentToLUException());
|
if (mtbColt != null) {
|
||||||
} else {
|
if (mtbColt.getCodDtip() != null && mShouldCheckIfExistDoc) {
|
||||||
if (mtbColt.getGestioneEnum() == GestioneEnum.VENDITA && mtbColt.getSegno() == -1 && mWarnOnOpeningVendita) {
|
throw new AlreadyAttachedDocumentToLUException();
|
||||||
this.sendOnLUVenditaConfirmRequired(confirmed -> {
|
} else {
|
||||||
if (confirmed) {
|
if (mtbColt.getGestioneEnum() == GestioneEnum.VENDITA && mtbColt.getSegno() == -1 && mWarnOnOpeningVendita) {
|
||||||
onComplete.run();
|
this.sendOnLUVenditaConfirmRequired(confirmed -> {
|
||||||
this.sendOnLUOpened(response);
|
if (confirmed) {
|
||||||
} else {
|
this.sendOnLUOpened(response);
|
||||||
onComplete.run();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
onComplete.run();
|
|
||||||
this.sendOnLUOpened(response);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else {
|
});
|
||||||
var createUdcRequest = new CreateUDCRequestDTO()
|
} else {
|
||||||
.setBarcodeUl(ean128Model.Sscc)
|
this.sendOnLUOpened(response);
|
||||||
.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 {
|
||||||
|
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) {
|
private void executeEAN13(BarcodeScanDTO barcodeScanDTO) throws Exception {
|
||||||
this.mArticoloRESTConsumer.searchByBarcode(barcodeScanDTO.getStringValue(), articoli -> {
|
var articoli = this.mArticoloRESTConsumer.searchByBarcodeSynchronized(barcodeScanDTO.getStringValue());
|
||||||
if (articoli != null && articoli.size() == 1) {
|
if (articoli != null && articoli.size() == 1) {
|
||||||
MtbAart articolo = articoli.get(0);
|
MtbAart articolo = articoli.get(0);
|
||||||
MtbDepoPosizione posizione = UtilityPosizione.getFromCache(articolo.getPosizione());
|
MtbDepoPosizione posizione = UtilityPosizione.getFromCache(articolo.getPosizione());
|
||||||
if (posizione != null && posizione.isFlagMonoCollo()) {
|
if (posizione != null && posizione.isFlagMonoCollo()) {
|
||||||
this.executePosizione(posizione, onComplete);
|
this.executePosizione(posizione);
|
||||||
} else {
|
|
||||||
this.sendError(new NoLUFoundException());
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
this.sendError(new NoLUFoundException());
|
throw new NoLUFoundException();
|
||||||
}
|
}
|
||||||
}, this::sendError);
|
} else {
|
||||||
|
throw new NoLUFoundException();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void sendOnLUVenditaConfirmRequired(RunnableArgs<Boolean> onConfirm) {
|
private void sendOnLUVenditaConfirmRequired(RunnableArgs<Boolean> onConfirm) {
|
||||||
|
|||||||
@@ -846,7 +846,8 @@
|
|||||||
android:layout_marginBottom="16dp"
|
android:layout_marginBottom="16dp"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:orientation="vertical"
|
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
|
<androidx.appcompat.widget.AppCompatImageView
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
|
|||||||
@@ -9,6 +9,8 @@
|
|||||||
<import type="it.integry.integrywmsnative.core.utility.data.UntMisUtils" />
|
<import type="it.integry.integrywmsnative.core.utility.data.UntMisUtils" />
|
||||||
<import type="it.integry.integrywmsnative.core.utility.data.MtbColrUtils" />
|
<import type="it.integry.integrywmsnative.core.utility.data.MtbColrUtils" />
|
||||||
|
|
||||||
|
<import type="android.view.View" />
|
||||||
|
|
||||||
<variable
|
<variable
|
||||||
name="item"
|
name="item"
|
||||||
type="it.integry.integrywmsnative.core.model.MtbColr" />
|
type="it.integry.integrywmsnative.core.model.MtbColr" />
|
||||||
@@ -52,6 +54,7 @@
|
|||||||
android:layout_marginStart="6dp"
|
android:layout_marginStart="6dp"
|
||||||
android:clickable="false"
|
android:clickable="false"
|
||||||
android:focusable="false"
|
android:focusable="false"
|
||||||
|
android:visibility="@{item.getPartitaMag() != null ? View.VISIBLE : View.GONE}"
|
||||||
app:layout_constraintBaseline_toBaselineOf="@id/articolo_textview"
|
app:layout_constraintBaseline_toBaselineOf="@id/articolo_textview"
|
||||||
app:layout_constraintStart_toEndOf="@id/articolo_textview"
|
app:layout_constraintStart_toEndOf="@id/articolo_textview"
|
||||||
app:text='@{"Lotto: " + item.partitaMag}'
|
app:text='@{"Lotto: " + item.partitaMag}'
|
||||||
|
|||||||
Reference in New Issue
Block a user