Merge branch 'develop' into feature/Popup_InfoArticolo

This commit is contained in:
Giuseppe Scorrano 2023-03-14 11:48:13 +01:00
commit d8c6464830
7 changed files with 28 additions and 14 deletions

View File

@ -10,8 +10,8 @@ apply plugin: 'com.google.gms.google-services'
android {
def appVersionCode = 346
def appVersionName = '1.32.06'
def appVersionCode = 348
def appVersionName = '1.32.08'
signingConfigs {
release {

View File

@ -97,7 +97,7 @@ public class InventarioRoomDTO extends BaseSyncDTO implements EntityModelInterfa
private String zona;
@ColumnInfo(name = Columns.IS_NEW)
private Boolean isNew;
private Boolean isNew = Boolean.TRUE;
@Ignore
private List<InventarioRowRoomDTO> inventarioRowList;

View File

@ -69,7 +69,8 @@ public class InventarioRepository extends _BaseRepository<MtbInvent, InventarioR
resolveFetch(remoteData, internalLiveData.getValue(),
(remoteItem, localItem) -> Objects.equals(remoteItem.getIdInventario(), localItem.getIdInventario()),
(remoteItem, localItem) -> {
remoteItem.setNew(true);
remoteItem.setRemoteSyncDate(localItem.getRemoteSyncDate());
remoteItem.setNew(false);
}, onComplete, onError);
} catch (Exception e) {

View File

@ -280,6 +280,12 @@ public class DocInterniEditFormActivity extends BaseActivity implements DocInter
this.closeEdit();
}
@Override
public void onDocDeleted() {
this.binding.closeActivityFab.close(true);
this.closeEdit();
}
@Override
public void onDocExported() {
runOnUiThread(() -> {

View File

@ -115,14 +115,11 @@ public class DocInterniEditFormViewModel {
public void deleteDocument() {
this.sendOnLoadingStarted();
docInterniRESTConsumer.saveDoc(this.getSaveDto(), () -> {
SqlMtbColt document = this.getDocument();
document.setCodDtip(document.getCodDtipProvv());
mtbColtRepository.update(document, doc -> {
mtbColtRepository.delete(document, () -> {
this.sendOnLoadingEnded();
this.listener.onDocExported();
this.listener.onDocDeleted();
}, this::sendError);
}, this::sendError);
}
public void holdDocument() {
@ -341,6 +338,8 @@ public class DocInterniEditFormViewModel {
void onDocumentHoldRequest();
void onDocDeleted();
void onDocExported();
}

View File

@ -75,6 +75,7 @@ public class PickingInventarioActivity extends BaseActivity implements PickingIn
getMenuInflater().inflate(R.menu.picking_inventario_menu, menu);
return true;
}
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@ -91,18 +92,19 @@ public class PickingInventarioActivity extends BaseActivity implements PickingIn
mViewModel.setListener(this);
mBindings.setViewmodel(mViewModel);
mViewModel.init(
DataCache.retrieveItem(getIntent().getStringExtra(KEY_INVENTARIO)),
DataCache.retrieveItem(getIntent().getStringExtra(KEY_INVENTARIO_ARTS)));
initToolbar();
initBarcodeReader();
}
@Override
protected void onStart() {
super.onStart();
mViewModel.init(
DataCache.retrieveItem(getIntent().getStringExtra(KEY_INVENTARIO)),
DataCache.retrieveItem(getIntent().getStringExtra(KEY_INVENTARIO_ARTS)));
initRecyclerView();
}
@ -189,7 +191,8 @@ public class PickingInventarioActivity extends BaseActivity implements PickingIn
public void requestExportConfirm() {
DialogYesNoView.newInstance("Esporta", "Vuoi confermare e chiudere l'inventario?", result -> {
mViewModel.exportAll(this::onBackPressed);
if (result == DialogConsts.Results.YES)
mViewModel.exportAll(this::onBackPressed);
})
.show(getSupportFragmentManager(), "tag");
}

View File

@ -111,6 +111,11 @@ public class PickingInventarioViewModel extends ViewModel {
public void exportAll(Runnable onComplete) {
if(this.currentInventarioRows.getValue().isEmpty()) {
this.sendError(new Exception("Impossibile esportare un inventario senza righe"));
return;
}
this.sendOnLoadingStarted();
currentInventario.getValue().setInventarioRowList(this.currentInventarioRows.getValue());