Finish v1.33.11(382)

This commit is contained in:
Valerio Castellana 2023-05-25 12:41:34 +02:00
commit 43df6fc9f5
8 changed files with 79 additions and 39 deletions

View File

@ -10,8 +10,8 @@ apply plugin: 'com.google.gms.google-services'
android {
def appVersionCode = 380
def appVersionName = '1.33.09'
def appVersionCode = 382
def appVersionName = '1.33.11'
signingConfigs {
release {

View File

@ -21,6 +21,7 @@ import it.integry.integrywmsnative.core.data_store.db.dao.InventarioRowDao;
import it.integry.integrywmsnative.core.data_store.db.dao.MtbColrDao;
import it.integry.integrywmsnative.core.data_store.db.dao.MtbColtDao;
import it.integry.integrywmsnative.core.data_store.db.dao.OrdineDao;
import it.integry.integrywmsnative.core.data_store.db.dao.RawDao;
import it.integry.integrywmsnative.core.data_store.db.entity.ArticoloGriglia;
import it.integry.integrywmsnative.core.data_store.db.entity.ArticoloOrdine;
import it.integry.integrywmsnative.core.data_store.db.entity.Griglia;
@ -76,6 +77,8 @@ public abstract class AppDatabase extends RoomDatabase {
return sInstance;
}
public abstract RawDao rawDao();
public abstract ArticoloGrigliaDao articoloGrigliaDao();
public abstract GrigliaDao grigliaDao();
@ -93,6 +96,7 @@ public abstract class AppDatabase extends RoomDatabase {
public abstract InventarioRowDao inventarioRowDao();
static final Migration MIGRATION_10_11 = new Migration(10, 11) {
@Override
public void migrate(SupportSQLiteDatabase database) {

View File

@ -17,6 +17,7 @@ import it.integry.integrywmsnative.core.data_store.db.dao.InventarioRowDao;
import it.integry.integrywmsnative.core.data_store.db.dao.MtbColrDao;
import it.integry.integrywmsnative.core.data_store.db.dao.MtbColtDao;
import it.integry.integrywmsnative.core.data_store.db.dao.OrdineDao;
import it.integry.integrywmsnative.core.data_store.db.dao.RawDao;
import it.integry.integrywmsnative.core.data_store.db.repository.ArticoliOrdineRepository;
import it.integry.integrywmsnative.core.data_store.db.repository.ArticoloGrigliaRepository;
import it.integry.integrywmsnative.core.data_store.db.repository.GrigliaRepository;
@ -53,7 +54,11 @@ public class RoomModule {
}
@Singleton
@Provides
RawDao providesRawDao(AppDatabase appDatabase) {
return appDatabase.rawDao();
}
@Singleton
@Provides
@ -104,12 +109,6 @@ public class RoomModule {
}
@Singleton
@Provides
InventarioRowMapper providesInventarioRowMapper() {
@ -123,62 +122,50 @@ public class RoomModule {
}
@Singleton
@Provides
InventarioLocalDataSource providesInventarioLocalDataSource(ExecutorService executorService, InventarioDao inventarioDao) {
return new InventarioLocalDataSource(executorService, inventarioDao);
}
@Singleton
@Provides
InventarioRowLocalDataSource providesInventarioRowLocalDataSource(ExecutorService executorService, InventarioRowDao inventarioRowDao) {
return new InventarioRowLocalDataSource(executorService, inventarioRowDao);
}
@Singleton
@Provides
ArticoloGrigliaRepository providesArticoloGrigliaRepository(ExecutorService executorService, Handler handler, ArticoloGrigliaDao articoloGrigliaDao) {
return new ArticoliGrigliaDataSource(executorService, handler, articoloGrigliaDao);
}
@Singleton
@Provides
ArticoliOrdineRepository providesArticoliOrdineRepository(ExecutorService executorService, Handler handler, ArticoloOrdineDao articoloOrdineDao) {
return new ArticoliOrdineDataSource(executorService, handler, articoloOrdineDao);
}
@Singleton
@Provides
GrigliaRepository providesGrigliaRepository(ExecutorService executorService, Handler handler, GrigliaDao grigliaDao) {
return new GrigliaDataSource(executorService, handler, grigliaDao);
}
@Singleton
@Provides
OrdineRepository providesOrdineRepository(ExecutorService executorService, Handler handler, OrdineDao ordineDao) {
return new OrdineDataSource(executorService, handler, ordineDao);
}
@Singleton
@Provides
MtbColtRepository providesMtbColtRepository(ExecutorService executorService, Handler handler, MtbColtDao mtbColtDao) {
return new SqlMtbColtDataSource(executorService, handler, mtbColtDao);
}
@Singleton
@Provides
MtbColrDataSource providesMtbColrRepository(ExecutorService executorService, Handler handler, MtbColrDao mtbColrDao) {
return new SqlMtbColrDataSource(executorService, handler, mtbColrDao);
}
@Singleton
@Provides
InventarioRepository providesInventarioRepository(ExecutorService executorService, Handler handler,
InventarioLocalDataSource inventarioLocalDataSource,
@ -187,7 +174,6 @@ public class RoomModule {
return new InventarioRepository(inventarioLocalDataSource, inventarioRESTConsumer, inventarioMapper, handler, executorService);
}
@Singleton
@Provides
InventarioRowRepository providesInventarioRowRepository(ExecutorService executorService, Handler handler,
InventarioRowLocalDataSource inventarioRowLocalDataSource,

View File

@ -0,0 +1,13 @@
package it.integry.integrywmsnative.core.data_store.db.dao;
import androidx.room.Dao;
import androidx.room.RawQuery;
import androidx.sqlite.db.SupportSQLiteQuery;
@Dao
public interface RawDao {
@RawQuery
int vacuumDb(SupportSQLiteQuery supportSQLiteQuery);
}

View File

@ -62,7 +62,7 @@ public class InventarioRepository extends _BaseRepository<MtbInvent, InventarioR
try {
var startRetrieve = new Date();
var remoteData = remoteDataSource.makeSynchronousRetrieveRequest();
Log.d("Timing [INVENTORIES RETRIEVE]", ((new Date().getTime() - startRetrieve.getTime()) / 1000) + " secs");
Log.d("Time INVENTORY RETRIEVE", ((new Date().getTime() - startRetrieve.getTime()) / 1000) + " secs");
if (remoteData == null) remoteData = new ArrayList<>();

View File

@ -169,7 +169,7 @@ public class PickingInventarioViewModel extends ViewModel {
private List<InventarioRowRoomDTO> searchArtInAlreadyScannedItems(InventarioArtDTO inventarioArtDTO) {
final List<InventarioRowRoomDTO> inventarioRows = this.currentInventarioRows.getValue();
if (inventarioRows == null) return null;
if (inventarioRows == null || inventarioRows.isEmpty()) return null;
return Stream.of(inventarioRows).filter(x -> x.getCodMart() != null ? x.getCodMart().equalsIgnoreCase(inventarioArtDTO.getCodMart()) : inventarioArtDTO.getBarcode().contains(x.getScanCodBarre())).toList();
}

View File

@ -28,8 +28,9 @@ public class ProdRientroMerceViewModel {
}
public void refreshOrderList() {
new Thread(this::sendOnOrdersLoadingStarted).start();
this.sendOnOrdersLoadingStarted();
String codAnag = SettingsManager.iDB().getFilterFornitoreProd();
this.mMesRESTConsumer.getOrdiniLavorazione("I", null, codAnag, ordiniLavorazioneList -> {
this.mOrdiniLavorazioneAperti.postValue(ordiniLavorazioneList);
this.sendOnOrdersLoadingEnded();

View File

@ -15,16 +15,19 @@ import androidx.preference.EditTextPreference;
import androidx.preference.ListPreference;
import androidx.preference.Preference;
import androidx.preference.PreferenceFragmentCompat;
import androidx.sqlite.db.SimpleSQLiteQuery;
import com.annimon.stream.Stream;
import com.harrysoft.androidbluetoothserial.BluetoothManager;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.concurrent.ExecutorService;
import javax.inject.Inject;
@ -34,6 +37,7 @@ import it.integry.integrywmsnative.MainApplication;
import it.integry.integrywmsnative.R;
import it.integry.integrywmsnative.core.barcode_reader.BarcodeManager;
import it.integry.integrywmsnative.core.context.AppContext;
import it.integry.integrywmsnative.core.data_store.db.dao.RawDao;
import it.integry.integrywmsnative.core.interfaces.ITitledFragment;
import it.integry.integrywmsnative.core.rest.consumers.SystemRESTConsumer;
import it.integry.integrywmsnative.core.rest.model.MailAttachmentDTO;
@ -48,6 +52,9 @@ public class MainSettingsFragment extends PreferenceFragmentCompat implements IT
@Inject
public AppContext appContext;
@Inject
public RawDao rawDao;
@Inject
public SystemRESTConsumer systemRESTConsumer;
@ -226,29 +233,52 @@ public class MainSettingsFragment extends PreferenceFragmentCompat implements IT
executorService.execute(() -> {
File yourFile = appContext.getLogFilePath();
var files = yourFile.listFiles();
File logFilePath = appContext.getLogFilePath();
var files = logFilePath.listFiles();
var fileToShare = Stream.of(files)
.sortBy(x -> -1 * x.lastModified())
.findFirstOrElse(null);
try {
List<MailAttachmentDTO> attachmentDTOList = new ArrayList<>();
if(fileToShare != null) {
var htmlContent = createAppLogAttachment(fileToShare);
byte[] buffer = htmlContent.getBytes();//specify the size to allow.
String base64 = Base64.encodeToString(buffer, Base64.NO_WRAP);
var attachment = new MailAttachmentDTO()
var logAttachment = new MailAttachmentDTO()
.setFileName("wms_log.html")
.setFileb64Content(base64);
attachmentDTOList.add(logAttachment);
}
rawDao.vacuumDb(new SimpleSQLiteQuery("pragma wal_checkpoint(full)"));
File[] dbFiles = new File[3];
dbFiles[0] = requireContext().getDatabasePath("integry_wms");
dbFiles[1] = requireContext().getDatabasePath("integry_wms-shm");
dbFiles[2] = requireContext().getDatabasePath("integry_wms-wal");
for(int i = 0; i < dbFiles.length; i++){
byte[] dbFileBytes = new byte[(int) dbFiles[i].length()];
FileInputStream inputStream = new FileInputStream(dbFiles[i]);
final int read = inputStream.read(dbFileBytes);
inputStream.close();
var dbAttachment = new MailAttachmentDTO()
.setFileName(dbFiles[i].getName())
.setFileb64Content(Base64.encodeToString(dbFileBytes, Base64.NO_WRAP));
attachmentDTOList.add(dbAttachment);
}
var mailRequest = new MailRequestDTO()
.setTo("developer@integry.it")
.setMsgText("Questo è una mail che contiene il log del WMS")
.setSubject("U vuemmeess")
.setAttachments(new ArrayList<>());
.setAttachments(attachmentDTOList);
mailRequest.getAttachments().add(attachment);
systemRESTConsumer.sendMail(mailRequest, this::closeProgress, ex -> {
this.closeProgress();
@ -370,7 +400,13 @@ public class MainSettingsFragment extends PreferenceFragmentCompat implements IT
htmlContent.append("<hr/>");
}
htmlContent.append("\n" + "<script type=\"text/javascript\">\n" + " document.querySelectorAll(\".message\").forEach(el => el.innerHTML = el.innerHTML.replaceAll(/at it\\.integry.*?(?:<br>)/g, '<b>$&</b>'));\n" + "</script>\n" + "</body>\n" + "</html>");
htmlContent.append("""
<script type="text/javascript">
document.querySelectorAll(".message").forEach(el => el.innerHTML = el.innerHTML.replaceAll(/at it\\.integry.*?(?:<br>)/g, '<b>$&</b>'));
</script>
</body>
</html>""");
return htmlContent.toString();
}