Merge branch 'feature/RefactoringGestioneColli' into master-beta
All checks were successful
WMS - Android (New)/pipeline/head This commit looks good
All checks were successful
WMS - Android (New)/pipeline/head This commit looks good
This commit is contained in:
@@ -10,8 +10,8 @@ apply plugin: 'com.google.gms.google-services'
|
||||
|
||||
android {
|
||||
|
||||
def appVersionCode = 515
|
||||
def appVersionName = '1.47.02'
|
||||
def appVersionCode = 516
|
||||
def appVersionName = '1.47.03'
|
||||
|
||||
signingConfigs {
|
||||
release {
|
||||
|
||||
@@ -36,6 +36,7 @@ import it.integry.integrywmsnative.core.data_store.db.entity.TrasferimentoPedane
|
||||
import it.integry.integrywmsnative.core.expansion.BaseActivity;
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.PrinterRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityExceptions;
|
||||
import it.integry.integrywmsnative.databinding.ActivityTraferimentoPedaneEditBinding;
|
||||
import it.integry.integrywmsnative.databinding.ActivityTrasferimentoPedaneRowListItemBinding;
|
||||
@@ -94,7 +95,7 @@ public class TrasferimentoPedaneEditActivity extends BaseActivity implements Tra
|
||||
|
||||
mBindings.setViewModel(mViewModel);
|
||||
mViewModel.setListener(this);
|
||||
mViewModel.init(trasferimentoPedaneEntityId);
|
||||
mViewModel.init(trasferimentoPedaneEntityId, SettingsManager.i().getUserSession().getDepo().getCodMdep());
|
||||
|
||||
sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);
|
||||
documentsPrinterName = sharedPreferences.getString(MainSettingsFragment.KEY_DOCUMENTS_PRINTER, null);
|
||||
|
||||
@@ -6,6 +6,7 @@ import androidx.lifecycle.LiveData;
|
||||
import androidx.lifecycle.MutableLiveData;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.stream.Collectors;
|
||||
@@ -44,6 +45,8 @@ public class TrasferimentoPedaneEditViewModel {
|
||||
private MutableLiveData<Boolean> canBeModifiedLiveData = new MutableLiveData<>(false);
|
||||
private MutableLiveData<Boolean> canBePrintedLiveData = new MutableLiveData<>(false);
|
||||
|
||||
private List<MtbColt> cacheMtbColtList = new ArrayList<>();
|
||||
|
||||
private Listener listener;
|
||||
|
||||
private String defaultSourceCodMdep = null;
|
||||
@@ -66,7 +69,9 @@ public class TrasferimentoPedaneEditViewModel {
|
||||
this.trasferimentoPedaneRowRepository = trasferimentoPedaneRowRepository;
|
||||
}
|
||||
|
||||
public void init(long trasferimentoPedaneId) {
|
||||
public void init(long trasferimentoPedaneId, String sourceCodMdep) {
|
||||
defaultSourceCodMdep = sourceCodMdep;
|
||||
|
||||
executorService.execute(() -> {
|
||||
this.currentTrasferimentoPedane = trasferimentoPedaneRepository.retrieve(trasferimentoPedaneId);
|
||||
canBeModifiedLiveData.postValue(this.currentTrasferimentoPedane.getStatusEnum() == TrasferimentoPedaneStatusEnum.APERTO);
|
||||
@@ -113,25 +118,41 @@ public class TrasferimentoPedaneEditViewModel {
|
||||
}
|
||||
|
||||
private void fillTransferWithMtbColtDetails(List<TrasferimentoPedaneRowEntity> rowList) throws Exception {
|
||||
List<MtbColt> bySsccListSynchronized = colliMagazzinoRESTConsumer.getBySsccListSynchronized(rowList.stream()
|
||||
.filter(x -> x.getDetailMtbColt() == null)
|
||||
.map(TrasferimentoPedaneRowEntity::getBarcodeUl)
|
||||
.collect(Collectors.toUnmodifiableList()), true, false);
|
||||
|
||||
|
||||
rowList.forEach(row -> {
|
||||
MtbColt mtbColtDetail = bySsccListSynchronized.stream()
|
||||
.filter(x -> x.getBarcodeUl().equals(row.getBarcodeUl()))
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
|
||||
row.setDetailMtbColt(mtbColtDetail);
|
||||
if (row.getDetailMtbColt() == null) {
|
||||
row.setDetailMtbColt(cacheMtbColtList.stream()
|
||||
.filter(x -> x.getBarcodeUl().equalsIgnoreCase(row.getBarcodeUl()))
|
||||
.findFirst()
|
||||
.orElse(null));
|
||||
}
|
||||
});
|
||||
|
||||
List<String> ssccList = rowList.stream()
|
||||
.filter(x -> x.getDetailMtbColt() == null)
|
||||
.map(TrasferimentoPedaneRowEntity::getBarcodeUl)
|
||||
.collect(Collectors.toUnmodifiableList());
|
||||
|
||||
|
||||
if (!ssccList.isEmpty()) {
|
||||
|
||||
List<MtbColt> bySsccListSynchronized = colliMagazzinoRESTConsumer.getBySsccListSynchronized(ssccList, true, false);
|
||||
cacheMtbColtList.addAll(bySsccListSynchronized);
|
||||
|
||||
rowList
|
||||
.stream()
|
||||
.filter(x -> x.getDetailMtbColt() == null)
|
||||
.forEach(row -> {
|
||||
MtbColt mtbColtDetail = bySsccListSynchronized.stream()
|
||||
.filter(x -> x.getBarcodeUl().equals(row.getBarcodeUl()))
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
|
||||
row.setDetailMtbColt(mtbColtDetail);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private void checkDataConsistency(List<TrasferimentoPedaneRowEntity> rowList) throws
|
||||
Exception {
|
||||
private void checkDataConsistency(List<TrasferimentoPedaneRowEntity> rowList) throws Exception {
|
||||
rowList.forEach(x -> {
|
||||
x.setFlagInconsistent(x.getDetailMtbColt() == null);
|
||||
});
|
||||
@@ -145,7 +166,7 @@ public class TrasferimentoPedaneEditViewModel {
|
||||
|
||||
|
||||
public void processBarcodeDTO(BarcodeScanDTO barcodeScanDTO) throws Exception {
|
||||
if(!Boolean.TRUE.equals(canBeModifiedLiveData.getValue()))
|
||||
if (!Boolean.TRUE.equals(canBeModifiedLiveData.getValue()))
|
||||
return;
|
||||
|
||||
if (UtilityBarcode.isEtichettaAnonima(barcodeScanDTO)) {
|
||||
@@ -173,7 +194,7 @@ public class TrasferimentoPedaneEditViewModel {
|
||||
private void handleSSCCBarcode(String sscc) throws Exception {
|
||||
var mtbColt = this.colliMagazzinoRESTConsumer.getBySsccSynchronized(sscc, true, false);
|
||||
|
||||
if(defaultSourceCodMdep != null && !mtbColt.getCodMdep().equalsIgnoreCase(defaultSourceCodMdep))
|
||||
if (defaultSourceCodMdep != null && !mtbColt.getCodMdep().equalsIgnoreCase(defaultSourceCodMdep))
|
||||
throw new IllegalArgumentException("L'UL scansionata non appartiene al magazzino di partenza del trasferimento");
|
||||
|
||||
if (mtbColt == null) {
|
||||
@@ -198,13 +219,14 @@ public class TrasferimentoPedaneEditViewModel {
|
||||
|
||||
var insertedEntity = trasferimentoPedaneRowRepository.insertSynchronized(currentTrasferimentoPedane.getId(), barcodeUl, mtbColt.getProgressivoUl());
|
||||
|
||||
if(defaultSourceCodMdep == null)
|
||||
if (defaultSourceCodMdep == null)
|
||||
defaultSourceCodMdep = mtbColt.getCodMdep();
|
||||
}
|
||||
}
|
||||
|
||||
public void deleteRow(TrasferimentoPedaneRowEntity row) {
|
||||
trasferimentoPedaneRowRepository.deleteSynchronized(row);
|
||||
cacheMtbColtList.removeIf(x -> x.getBarcodeUl().equals(row.getBarcodeUl()));
|
||||
}
|
||||
|
||||
public void closeAndDelete() {
|
||||
@@ -220,7 +242,7 @@ public class TrasferimentoPedaneEditViewModel {
|
||||
|
||||
var documentKey = generatedMovement.getDocumentKey();
|
||||
|
||||
if(documentKey != null) {
|
||||
if (documentKey != null) {
|
||||
currentTrasferimentoPedane.setDocumentCodAnag(documentKey.getCodAnag());
|
||||
currentTrasferimentoPedane.setDocumentCodDtip(documentKey.getCodDtip());
|
||||
currentTrasferimentoPedane.setDocumentData(documentKey.getDataDoc());
|
||||
@@ -236,7 +258,7 @@ public class TrasferimentoPedaneEditViewModel {
|
||||
trasferimentoPedaneRepository.updateSynchronized(currentTrasferimentoPedane);
|
||||
trasferimentoPedaneRowRepository.updateAllSynchronized(rowsLiveData.getValue());
|
||||
|
||||
if(documentKey != null) {
|
||||
if (documentKey != null) {
|
||||
//Print the document if it was generated
|
||||
printDocument(printerName);
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
buildscript {
|
||||
ext {
|
||||
kotlin_version = '2.1.0'
|
||||
agp_version = '8.11.0'
|
||||
agp_version = '8.11.1'
|
||||
}
|
||||
|
||||
repositories {
|
||||
|
||||
Reference in New Issue
Block a user