Merge branch 'develop' into feature/FastPickingSpedizione

This commit is contained in:
Giuseppe Scorrano 2025-03-14 18:20:18 +01:00
commit 4613f13eae
12 changed files with 90 additions and 51 deletions

View File

@ -10,8 +10,8 @@ apply plugin: 'com.google.gms.google-services'
android { android {
def appVersionCode = 481 def appVersionCode = 482
def appVersionName = '1.44.12' def appVersionName = '1.45.00'
signingConfigs { signingConfigs {
release { release {

View File

@ -2,7 +2,7 @@
"formatVersion": 1, "formatVersion": 1,
"database": { "database": {
"version": 18, "version": 18,
"identityHash": "68c96a8a7f0f544255553297d0206576", "identityHash": "720c67adcc3f947a0c0ce04d4d04fbe9",
"entities": [ "entities": [
{ {
"tableName": "articoli_griglia", "tableName": "articoli_griglia",
@ -1208,7 +1208,7 @@
}, },
{ {
"tableName": "verifica_giacenze_rows", "tableName": "verifica_giacenze_rows",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`parent_id` INTEGER, `created_at` INTEGER DEFAULT CURRENT_TIMESTAMP, `cod_mart` TEXT, `partita_mag` TEXT, `descrizione` TEXT, `qta` REAL NOT NULL DEFAULT 0, `num_cnf` REAL NOT NULL DEFAULT 0, `qta_cnf` REAL NOT NULL DEFAULT 0, `scan_cod_barre` TEXT, `_id` INTEGER PRIMARY KEY AUTOINCREMENT, `remote_sync_date` INTEGER, FOREIGN KEY(`parent_id`) REFERENCES `verifica_giacenze`(`_id`) ON UPDATE NO ACTION ON DELETE CASCADE )", "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`parent_id` INTEGER, `created_at` INTEGER DEFAULT CURRENT_TIMESTAMP, `cod_mart` TEXT, `partita_mag` TEXT, `descrizione` TEXT, `qta_in_giacenza` REAL NOT NULL DEFAULT 0, `qta` REAL NOT NULL DEFAULT 0, `num_cnf` REAL NOT NULL DEFAULT 0, `qta_cnf` REAL NOT NULL DEFAULT 0, `scan_cod_barre` TEXT, `_id` INTEGER PRIMARY KEY AUTOINCREMENT, `remote_sync_date` INTEGER, FOREIGN KEY(`parent_id`) REFERENCES `verifica_giacenze`(`_id`) ON UPDATE NO ACTION ON DELETE CASCADE )",
"fields": [ "fields": [
{ {
"fieldPath": "parentId", "fieldPath": "parentId",
@ -1241,6 +1241,13 @@
"affinity": "TEXT", "affinity": "TEXT",
"notNull": false "notNull": false
}, },
{
"fieldPath": "qtaInGiacenza",
"columnName": "qta_in_giacenza",
"affinity": "REAL",
"notNull": true,
"defaultValue": "0"
},
{ {
"fieldPath": "qta", "fieldPath": "qta",
"columnName": "qta", "columnName": "qta",
@ -1325,7 +1332,7 @@
"views": [], "views": [],
"setupQueries": [ "setupQueries": [
"CREATE TABLE IF NOT EXISTS room_master_table (id INTEGER PRIMARY KEY,identity_hash TEXT)", "CREATE TABLE IF NOT EXISTS room_master_table (id INTEGER PRIMARY KEY,identity_hash TEXT)",
"INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, '68c96a8a7f0f544255553297d0206576')" "INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, '720c67adcc3f947a0c0ce04d4d04fbe9')"
] ]
} }
} }

View File

@ -54,14 +54,14 @@ public class MainContext {
//this.initAuthSession(() -> { //this.initAuthSession(() -> {
this.initDeviceId(() -> { // this.initDeviceId(() -> {
this.initDBData(() -> { this.initDBData(() -> {
this.initMenu(() -> { this.initMenu(() -> {
if (mListener != null) mListener.onContextInitialized(); if (mListener != null) mListener.onContextInitialized();
}); });
}); });
}); // });
//}); //});
@ -101,9 +101,9 @@ public class MainContext {
SettingsManager.i().getUserSession().setDeviceId(fid.getResult()); SettingsManager.i().getUserSession().setDeviceId(fid.getResult());
SettingsManager.update(); SettingsManager.update();
systemRESTConsumer.registerDevice(onComplete, ex -> { // systemRESTConsumer.registerDevice(onComplete, ex -> {
if (mListener != null) mListener.onError(new SpannedString(ex.getMessage())); // if (mListener != null) mListener.onError(new SpannedString(ex.getMessage()));
}); // });
}); });
} }

View File

@ -206,6 +206,7 @@ public abstract class AppDatabase extends RoomDatabase {
"cod_mart TEXT, " + "cod_mart TEXT, " +
"partita_mag TEXT, " + "partita_mag TEXT, " +
"descrizione TEXT, " + "descrizione TEXT, " +
"qta_in_giacenza REAL NOT NULL DEFAULT 0, " +
"qta REAL NOT NULL DEFAULT 0, " + "qta REAL NOT NULL DEFAULT 0, " +
"num_cnf REAL NOT NULL DEFAULT 0, " + "num_cnf REAL NOT NULL DEFAULT 0, " +
"qta_cnf REAL NOT NULL DEFAULT 0, " + "qta_cnf REAL NOT NULL DEFAULT 0, " +

View File

@ -33,6 +33,7 @@ public class VerificaGiacenzeRowEntity extends BaseSyncDTO implements EntityMode
public static final String COD_MART = "cod_mart"; public static final String COD_MART = "cod_mart";
public static final String PARTITA_MAG = "partita_mag"; public static final String PARTITA_MAG = "partita_mag";
public static final String DESCRIZIONE = "descrizione"; public static final String DESCRIZIONE = "descrizione";
public static final String QTA_IN_GIACENZA = "qta_in_giacenza";
public static final String QTA = "qta"; public static final String QTA = "qta";
public static final String NUM_CNF = "num_cnf"; public static final String NUM_CNF = "num_cnf";
public static final String QTA_CNF = "qta_cnf"; public static final String QTA_CNF = "qta_cnf";
@ -54,6 +55,10 @@ public class VerificaGiacenzeRowEntity extends BaseSyncDTO implements EntityMode
@ColumnInfo(name = Columns.DESCRIZIONE) @ColumnInfo(name = Columns.DESCRIZIONE)
private String descrizione; private String descrizione;
@NonNull
@ColumnInfo(name = Columns.QTA_IN_GIACENZA, defaultValue = "0")
private BigDecimal qtaInGiacenza;
@NonNull @NonNull
@ColumnInfo(name = Columns.QTA, defaultValue = "0") @ColumnInfo(name = Columns.QTA, defaultValue = "0")
private BigDecimal qta; private BigDecimal qta;
@ -110,6 +115,15 @@ public class VerificaGiacenzeRowEntity extends BaseSyncDTO implements EntityMode
this.descrizione = descrizione; this.descrizione = descrizione;
} }
@NonNull
public BigDecimal getQtaInGiacenza() {
return qtaInGiacenza;
}
public void setQtaInGiacenza(@NonNull BigDecimal qtaInGiacenza) {
this.qtaInGiacenza = qtaInGiacenza;
}
@NonNull @NonNull
public BigDecimal getQta() { public BigDecimal getQta() {
return qta; return qta;

View File

@ -15,6 +15,7 @@ public class VerificaGiacenzeRowMapper extends BaseMapper<VerificaGiacenzeRowDTO
var data = new VerificaGiacenzeRowEntity(); var data = new VerificaGiacenzeRowEntity();
data.setCodMart(inputData.getCodMart()); data.setCodMart(inputData.getCodMart());
data.setPartitaMag(inputData.getPartitaMag()); data.setPartitaMag(inputData.getPartitaMag());
data.setQtaInGiacenza(inputData.getQtaInGiacenza());
data.setQta(inputData.getQta()); data.setQta(inputData.getQta());
data.setNumConf(inputData.getNumCnf()); data.setNumConf(inputData.getNumCnf());
data.setQtaConf(inputData.getQtaCnf()); data.setQtaConf(inputData.getQtaCnf());
@ -29,6 +30,7 @@ public class VerificaGiacenzeRowMapper extends BaseMapper<VerificaGiacenzeRowDTO
var data = new VerificaGiacenzeRowDTO(); var data = new VerificaGiacenzeRowDTO();
data.setCodMart(inputData.getCodMart()); data.setCodMart(inputData.getCodMart());
data.setPartitaMag(inputData.getPartitaMag()); data.setPartitaMag(inputData.getPartitaMag());
data.setQtaInGiacenza(inputData.getQtaInGiacenza());
data.setQta(inputData.getQta()); data.setQta(inputData.getQta());
data.setNumCnf(inputData.getNumConf()); data.setNumCnf(inputData.getNumConf());
data.setQtaCnf(inputData.getQtaConf()); data.setQtaCnf(inputData.getQtaConf());

View File

@ -27,7 +27,6 @@ import it.integry.integrywmsnative.core.rest.model.MailRequestDTO;
import it.integry.integrywmsnative.core.rest.model.NativeSqlRequestDTO; import it.integry.integrywmsnative.core.rest.model.NativeSqlRequestDTO;
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse; import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
import it.integry.integrywmsnative.core.rest.model.system.LatestAppVersionInfoDTO; import it.integry.integrywmsnative.core.rest.model.system.LatestAppVersionInfoDTO;
import it.integry.integrywmsnative.core.rest.model.system.RegisterDeviceRequestDTO;
import it.integry.integrywmsnative.core.settings.SettingsManager; import it.integry.integrywmsnative.core.settings.SettingsManager;
import it.integry.integrywmsnative.core.utility.UtilityGson; import it.integry.integrywmsnative.core.utility.UtilityGson;
import it.integry.integrywmsnative.core.utility.UtilityString; import it.integry.integrywmsnative.core.utility.UtilityString;
@ -57,27 +56,6 @@ public class SystemRESTConsumer extends _BaseRESTConsumer {
return analyzeAnswerGeneric(response, "updates"); return analyzeAnswerGeneric(response, "updates");
} }
public void registerDevice(final Runnable onSuccess, final RunnableArgs<Exception> onFailed) {
RegisterDeviceRequestDTO registerDeviceRequestDTO = new RegisterDeviceRequestDTO()
.setApp("WMS");
SystemRESTConsumerService systemRESTConsumerService = restBuilder.getService(SystemRESTConsumerService.class);
systemRESTConsumerService.registerDevice(registerDeviceRequestDTO)
.enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<Void>> call, Response<ServiceRESTResponse<Void>> response) {
analyzeAnswer(response, "device/register", Void -> onSuccess.run(), onFailed);
}
@Override
public void onFailure(Call<ServiceRESTResponse<Void>> call, @NonNull final Exception e) {
onFailed.run(e);
}
});
}
public <T> T processSqlSynchronized(String nativeSql, final Type clazz) throws Exception { public <T> T processSqlSynchronized(String nativeSql, final Type clazz) throws Exception {
NativeSqlRequestDTO nativeSqlDTO = new NativeSqlRequestDTO() NativeSqlRequestDTO nativeSqlDTO = new NativeSqlRequestDTO()
.setNativeSql(nativeSql); .setNativeSql(nativeSql);

View File

@ -7,7 +7,6 @@ import it.integry.integrywmsnative.core.rest.model.MailRequestDTO;
import it.integry.integrywmsnative.core.rest.model.NativeSqlRequestDTO; import it.integry.integrywmsnative.core.rest.model.NativeSqlRequestDTO;
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse; import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
import it.integry.integrywmsnative.core.rest.model.system.LatestAppVersionInfoDTO; import it.integry.integrywmsnative.core.rest.model.system.LatestAppVersionInfoDTO;
import it.integry.integrywmsnative.core.rest.model.system.RegisterDeviceRequestDTO;
import retrofit2.Call; import retrofit2.Call;
import retrofit2.http.Body; import retrofit2.http.Body;
import retrofit2.http.GET; import retrofit2.http.GET;
@ -19,9 +18,6 @@ public interface SystemRESTConsumerService {
@GET("wms/currentVersion") @GET("wms/currentVersion")
Call<LatestAppVersionInfoDTO> retrieveUpdatesInfo(@Query("suffix") String suffix); Call<LatestAppVersionInfoDTO> retrieveUpdatesInfo(@Query("suffix") String suffix);
@POST("device/register")
Call<ServiceRESTResponse<Void>> registerDevice(@Body RegisterDeviceRequestDTO registerDeviceRequestDTO);
@POST("processSql") @POST("processSql")
Call<ServiceRESTResponse<Object>> processSql(@Body NativeSqlRequestDTO nativeSqlDTO); Call<ServiceRESTResponse<Object>> processSql(@Body NativeSqlRequestDTO nativeSqlDTO);

View File

@ -8,6 +8,7 @@ public class VerificaGiacenzeRowDTO extends BaseRestDTO {
private String codMart; private String codMart;
private String partitaMag; private String partitaMag;
private BigDecimal qtaInGiacenza;
private BigDecimal qta; private BigDecimal qta;
private BigDecimal qtaCnf; private BigDecimal qtaCnf;
private BigDecimal numCnf; private BigDecimal numCnf;
@ -31,6 +32,14 @@ public class VerificaGiacenzeRowDTO extends BaseRestDTO {
return this; return this;
} }
public BigDecimal getQtaInGiacenza() {
return qtaInGiacenza;
}
public void setQtaInGiacenza(BigDecimal qtaInGiacenza) {
this.qtaInGiacenza = qtaInGiacenza;
}
public BigDecimal getQta() { public BigDecimal getQta() {
return qta; return qta;
} }

View File

@ -1,15 +0,0 @@
package it.integry.integrywmsnative.core.rest.model.system;
public class RegisterDeviceRequestDTO {
private String app;
public String getApp() {
return app;
}
public RegisterDeviceRequestDTO setApp(String app) {
this.app = app;
return this;
}
}

View File

@ -141,6 +141,13 @@ public class VerificaGiacenzeFragment extends BaseFragment implements ITitledFra
this.initRecyclerView(); this.initRecyclerView();
this.initBarcodeReader(); this.initBarcodeReader();
this.onLoadingStarted();
executorService.execute(() -> {
mViewModel.randomizeElements(2000);
this.onLoadingEnded();
});
}); });
} }

View File

@ -114,6 +114,40 @@ public class VerificaGiacenzeViewModel {
currentLoadedAnagrafiche.forEach(x -> x.setFlagTracciabilita("N")); 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);
@ -134,6 +168,11 @@ public class VerificaGiacenzeViewModel {
public void save() throws Exception { public void save() throws Exception {
if(currentVerificaRows.getValue().isEmpty()) {
delete();
return;
}
currentVerifica.getValue().setVerificaGiacenzeRowList(currentVerificaRows.getValue()); currentVerifica.getValue().setVerificaGiacenzeRowList(currentVerificaRows.getValue());
SaveNewVerificaRequestDTO saveRequest = new SaveNewVerificaRequestDTO() SaveNewVerificaRequestDTO saveRequest = new SaveNewVerificaRequestDTO()
@ -223,6 +262,7 @@ public class VerificaGiacenzeViewModel {
rowToSave.setNumConf(pickedQuantity.getNumCnf()); rowToSave.setNumConf(pickedQuantity.getNumCnf());
rowToSave.setQtaConf(pickedQuantity.getQtaCnf()); rowToSave.setQtaConf(pickedQuantity.getQtaCnf());
rowToSave.setQta(pickedQuantity.getQtaTot()); rowToSave.setQta(pickedQuantity.getQtaTot());
rowToSave.setQtaInGiacenza(qtaGiacenza);
if (isNewRow) { if (isNewRow) {
insertRow(rowToSave); insertRow(rowToSave);