diff --git a/app/schemas/it.integry.integrywmsnative.core.data_store.db.AppDatabase/13.json b/app/schemas/it.integry.integrywmsnative.core.data_store.db.AppDatabase/13.json index 960fed8f..4aeb2ff1 100644 --- a/app/schemas/it.integry.integrywmsnative.core.data_store.db.AppDatabase/13.json +++ b/app/schemas/it.integry.integrywmsnative.core.data_store.db.AppDatabase/13.json @@ -2,7 +2,7 @@ "formatVersion": 1, "database": { "version": 13, - "identityHash": "bc3841159bac7a7731fe39a5fa4f0f4e", + "identityHash": "bef89b513f0a4d5ecd9c2111e2e614a4", "entities": [ { "tableName": "articoli_griglia", @@ -112,10 +112,10 @@ } ], "primaryKey": { + "autoGenerate": true, "columnNames": [ "articolo_griglia_id" - ], - "autoGenerate": true + ] }, "indices": [ { @@ -172,10 +172,10 @@ } ], "primaryKey": { + "autoGenerate": true, "columnNames": [ "griglia_id" - ], - "autoGenerate": true + ] }, "indices": [ { @@ -262,10 +262,10 @@ } ], "primaryKey": { + "autoGenerate": true, "columnNames": [ "ordine_id" - ], - "autoGenerate": true + ] }, "indices": [], "foreignKeys": [] @@ -366,10 +366,10 @@ } ], "primaryKey": { + "autoGenerate": true, "columnNames": [ "articolo_ordine_id" - ], - "autoGenerate": true + ] }, "indices": [ { @@ -580,10 +580,10 @@ } ], "primaryKey": { + "autoGenerate": true, "columnNames": [ "id" - ], - "autoGenerate": true + ] }, "indices": [ { @@ -829,10 +829,10 @@ } ], "primaryKey": { + "autoGenerate": true, "columnNames": [ "id" - ], - "autoGenerate": true + ] }, "indices": [ { @@ -874,7 +874,7 @@ }, { "tableName": "inventari", - "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`_id` INTEGER PRIMARY KEY AUTOINCREMENT, `id_inventario` INTEGER, `cod_mdep` TEXT NOT NULL, `data_inventario` INTEGER, `data_reg` INTEGER, `data_ver` INTEGER, `filtro` TEXT, `flag_stato` TEXT, `flag_operazione` TEXT, `cod_anag` TEXT, `cod_dtip` TEXT, `inserito_da` TEXT, `registrato_da` TEXT, `verificato_da` TEXT, `data_ora_inizio` INTEGER, `data_ora_fine` INTEGER, `causale` TEXT, `zona` TEXT, `remote_sync_date` INTEGER)", + "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`_id` INTEGER PRIMARY KEY AUTOINCREMENT, `id_inventario` INTEGER, `cod_mdep` TEXT NOT NULL, `data_inventario` INTEGER, `data_reg` INTEGER, `data_ver` INTEGER, `filtro` TEXT, `flag_stato` TEXT, `flag_operazione` TEXT, `cod_anag` TEXT, `cod_dtip` TEXT, `inserito_da` TEXT, `registrato_da` TEXT, `verificato_da` TEXT, `data_ora_inizio` INTEGER, `data_ora_fine` INTEGER, `causale` TEXT, `zona` TEXT, `new` INTEGER, `remote_sync_date` INTEGER)", "fields": [ { "fieldPath": "id", @@ -984,6 +984,12 @@ "affinity": "TEXT", "notNull": false }, + { + "fieldPath": "isNew", + "columnName": "new", + "affinity": "INTEGER", + "notNull": false + }, { "fieldPath": "remoteSyncDate", "columnName": "remote_sync_date", @@ -992,10 +998,10 @@ } ], "primaryKey": { + "autoGenerate": true, "columnNames": [ "_id" - ], - "autoGenerate": true + ] }, "indices": [ { @@ -1107,10 +1113,10 @@ } ], "primaryKey": { + "autoGenerate": true, "columnNames": [ "_id" - ], - "autoGenerate": true + ] }, "indices": [ { @@ -1150,7 +1156,7 @@ "views": [], "setupQueries": [ "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, 'bc3841159bac7a7731fe39a5fa4f0f4e')" + "INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, 'bef89b513f0a4d5ecd9c2111e2e614a4')" ] } } \ No newline at end of file diff --git a/app/schemas/it.integry.integrywmsnative.core.data_store.db.AppDatabase/14.json b/app/schemas/it.integry.integrywmsnative.core.data_store.db.AppDatabase/14.json new file mode 100644 index 00000000..7efee603 --- /dev/null +++ b/app/schemas/it.integry.integrywmsnative.core.data_store.db.AppDatabase/14.json @@ -0,0 +1,1162 @@ +{ + "formatVersion": 1, + "database": { + "version": 14, + "identityHash": "bef89b513f0a4d5ecd9c2111e2e614a4", + "entities": [ + { + "tableName": "articoli_griglia", + "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`articolo_griglia_id` INTEGER PRIMARY KEY AUTOINCREMENT, `cod_mart` TEXT, `descrizione` TEXT, `unt_mis` TEXT, `qta_cnf` REAL NOT NULL, `bar_code` TEXT, `merce_da_ric` REAL NOT NULL, `media_sett` REAL NOT NULL, `flag_qta_multipla` TEXT, `qta_min_ordinabile` REAL NOT NULL, `gg_scadenza` INTEGER NOT NULL, `giacenza` REAL NOT NULL, `qta_prevista_vendita` REAL NOT NULL, `qta_proposta` REAL NOT NULL, `qta_ord` REAL NOT NULL, `id_griglia` INTEGER NOT NULL, `new_no_promo` INTEGER NOT NULL, FOREIGN KEY(`id_griglia`) REFERENCES `griglie`(`griglia_id`) ON UPDATE NO ACTION ON DELETE CASCADE )", + "fields": [ + { + "fieldPath": "articoloGrigliaId", + "columnName": "articolo_griglia_id", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "codMart", + "columnName": "cod_mart", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "descrizione", + "columnName": "descrizione", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "untMis", + "columnName": "unt_mis", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "qtaCnf", + "columnName": "qta_cnf", + "affinity": "REAL", + "notNull": true + }, + { + "fieldPath": "barCode", + "columnName": "bar_code", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "merceDaRic", + "columnName": "merce_da_ric", + "affinity": "REAL", + "notNull": true + }, + { + "fieldPath": "mediaSett", + "columnName": "media_sett", + "affinity": "REAL", + "notNull": true + }, + { + "fieldPath": "flagQtaMultipla", + "columnName": "flag_qta_multipla", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "qtaMinOrdinabile", + "columnName": "qta_min_ordinabile", + "affinity": "REAL", + "notNull": true + }, + { + "fieldPath": "ggScadenza", + "columnName": "gg_scadenza", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "giacenza", + "columnName": "giacenza", + "affinity": "REAL", + "notNull": true + }, + { + "fieldPath": "qtaPrevistaVendita", + "columnName": "qta_prevista_vendita", + "affinity": "REAL", + "notNull": true + }, + { + "fieldPath": "qtaProposta", + "columnName": "qta_proposta", + "affinity": "REAL", + "notNull": true + }, + { + "fieldPath": "qtaOrd", + "columnName": "qta_ord", + "affinity": "REAL", + "notNull": true + }, + { + "fieldPath": "idGriglia", + "columnName": "id_griglia", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "newNoPromo", + "columnName": "new_no_promo", + "affinity": "INTEGER", + "notNull": true + } + ], + "primaryKey": { + "autoGenerate": true, + "columnNames": [ + "articolo_griglia_id" + ] + }, + "indices": [ + { + "name": "index_articoli_griglia_id_griglia", + "unique": false, + "columnNames": [ + "id_griglia" + ], + "orders": [], + "createSql": "CREATE INDEX IF NOT EXISTS `index_articoli_griglia_id_griglia` ON `${TABLE_NAME}` (`id_griglia`)" + } + ], + "foreignKeys": [ + { + "table": "griglie", + "onDelete": "CASCADE", + "onUpdate": "NO ACTION", + "columns": [ + "id_griglia" + ], + "referencedColumns": [ + "griglia_id" + ] + } + ] + }, + { + "tableName": "griglie", + "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`griglia_id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `cod_alis` TEXT, `descr_lisa` TEXT, `descr_depo` TEXT)", + "fields": [ + { + "fieldPath": "grigliaId", + "columnName": "griglia_id", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "codAlis", + "columnName": "cod_alis", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "descrLisa", + "columnName": "descr_lisa", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "descrDepo", + "columnName": "descr_depo", + "affinity": "TEXT", + "notNull": false + } + ], + "primaryKey": { + "autoGenerate": true, + "columnNames": [ + "griglia_id" + ] + }, + "indices": [ + { + "name": "index_griglie_cod_alis", + "unique": true, + "columnNames": [ + "cod_alis" + ], + "orders": [], + "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_griglie_cod_alis` ON `${TABLE_NAME}` (`cod_alis`)" + } + ], + "foreignKeys": [] + }, + { + "tableName": "ordini", + "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`ordine_id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `data_ins` INTEGER, `annotazioni` TEXT, `transmitted` INTEGER NOT NULL, `transmission_date` INTEGER, `gestione` TEXT, `data_ord` INTEGER, `num_ord` INTEGER, `cod_mdep` TEXT, `id_griglia` INTEGER NOT NULL, `cod_alis` TEXT NOT NULL)", + "fields": [ + { + "fieldPath": "ordineId", + "columnName": "ordine_id", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "dataIns", + "columnName": "data_ins", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "annotazioni", + "columnName": "annotazioni", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "transmitted", + "columnName": "transmitted", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "transmissionDate", + "columnName": "transmission_date", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "gestione", + "columnName": "gestione", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "dataOrd", + "columnName": "data_ord", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "numOrd", + "columnName": "num_ord", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "codMdep", + "columnName": "cod_mdep", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "idGriglia", + "columnName": "id_griglia", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "codAlis", + "columnName": "cod_alis", + "affinity": "TEXT", + "notNull": true + } + ], + "primaryKey": { + "autoGenerate": true, + "columnNames": [ + "ordine_id" + ] + }, + "indices": [], + "foreignKeys": [] + }, + { + "tableName": "articoli_ordine", + "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`articolo_ordine_id` INTEGER PRIMARY KEY AUTOINCREMENT, `cod_mart` TEXT, `descrizione` TEXT, `unt_mis` TEXT, `qta_cnf` REAL NOT NULL, `bar_code` TEXT, `merce_da_ric` REAL NOT NULL, `media_sett` REAL NOT NULL, `flag_qta_multipla` TEXT, `qta_min_ordinabile` REAL NOT NULL, `id_ordine` INTEGER NOT NULL, `qta_ord` REAL NOT NULL, `data_ins` INTEGER, `new_no_promo` INTEGER NOT NULL, `system_note` TEXT, FOREIGN KEY(`id_ordine`) REFERENCES `ordini`(`ordine_id`) ON UPDATE NO ACTION ON DELETE CASCADE )", + "fields": [ + { + "fieldPath": "articoloOrdineId", + "columnName": "articolo_ordine_id", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "codMart", + "columnName": "cod_mart", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "descrizione", + "columnName": "descrizione", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "untMis", + "columnName": "unt_mis", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "qtaCnf", + "columnName": "qta_cnf", + "affinity": "REAL", + "notNull": true + }, + { + "fieldPath": "barCode", + "columnName": "bar_code", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "merceDaRic", + "columnName": "merce_da_ric", + "affinity": "REAL", + "notNull": true + }, + { + "fieldPath": "mediaSett", + "columnName": "media_sett", + "affinity": "REAL", + "notNull": true + }, + { + "fieldPath": "flagQtaMultipla", + "columnName": "flag_qta_multipla", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "qtaMinOrdinabile", + "columnName": "qta_min_ordinabile", + "affinity": "REAL", + "notNull": true + }, + { + "fieldPath": "idOrdine", + "columnName": "id_ordine", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "qtaOrd", + "columnName": "qta_ord", + "affinity": "REAL", + "notNull": true + }, + { + "fieldPath": "dataIns", + "columnName": "data_ins", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "newNoPromo", + "columnName": "new_no_promo", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "systemNote", + "columnName": "system_note", + "affinity": "TEXT", + "notNull": false + } + ], + "primaryKey": { + "autoGenerate": true, + "columnNames": [ + "articolo_ordine_id" + ] + }, + "indices": [ + { + "name": "index_articoli_ordine_id_ordine", + "unique": false, + "columnNames": [ + "id_ordine" + ], + "orders": [], + "createSql": "CREATE INDEX IF NOT EXISTS `index_articoli_ordine_id_ordine` ON `${TABLE_NAME}` (`id_ordine`)" + }, + { + "name": "index_articoli_ordine_id_ordine_cod_mart", + "unique": true, + "columnNames": [ + "id_ordine", + "cod_mart" + ], + "orders": [], + "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_articoli_ordine_id_ordine_cod_mart` ON `${TABLE_NAME}` (`id_ordine`, `cod_mart`)" + } + ], + "foreignKeys": [ + { + "table": "ordini", + "onDelete": "CASCADE", + "onUpdate": "NO ACTION", + "columns": [ + "id_ordine" + ], + "referencedColumns": [ + "ordine_id" + ] + } + ] + }, + { + "tableName": "mtb_colt", + "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `username` TEXT, `gestione` TEXT, `data_collo` INTEGER, `ser_collo` TEXT, `num_collo` INTEGER, `rif_ord` TEXT, `cod_anag` TEXT, `cod_vdes` TEXT, `cod_mdep` TEXT, `cod_vlis` TEXT, `cod_dtip` TEXT, `cod_tcol` TEXT, `ser_doc` TEXT, `annotazioni` TEXT, `posizione` TEXT, `cod_dtip_provv` TEXT, `ser_doc_provv` TEXT, `cod_jfas` TEXT, `data_ord` INTEGER, `data_doc` INTEGER, `data_doc_provv` INTEGER, `cod_mgrp` TEXT, `data_vers` INTEGER, `segno` INTEGER, `num_ord` INTEGER, `num_doc` INTEGER, `num_doc_provv` INTEGER)", + "fields": [ + { + "fieldPath": "id", + "columnName": "id", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "username", + "columnName": "username", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "gestione", + "columnName": "gestione", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "dataCollo", + "columnName": "data_collo", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "serCollo", + "columnName": "ser_collo", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "numCollo", + "columnName": "num_collo", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "rifOrd", + "columnName": "rif_ord", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "codAnag", + "columnName": "cod_anag", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "codVdes", + "columnName": "cod_vdes", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "codMdep", + "columnName": "cod_mdep", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "codVlis", + "columnName": "cod_vlis", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "codDtip", + "columnName": "cod_dtip", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "codTcol", + "columnName": "cod_tcol", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "serDoc", + "columnName": "ser_doc", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "annotazioni", + "columnName": "annotazioni", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "posizione", + "columnName": "posizione", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "codDtipProvv", + "columnName": "cod_dtip_provv", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "serDocProvv", + "columnName": "ser_doc_provv", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "codJfas", + "columnName": "cod_jfas", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "dataOrd", + "columnName": "data_ord", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "dataDoc", + "columnName": "data_doc", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "dataDocProvv", + "columnName": "data_doc_provv", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "codMgrp", + "columnName": "cod_mgrp", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "dataVers", + "columnName": "data_vers", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "segno", + "columnName": "segno", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "numOrd", + "columnName": "num_ord", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "numDoc", + "columnName": "num_doc", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "numDocProvv", + "columnName": "num_doc_provv", + "affinity": "INTEGER", + "notNull": false + } + ], + "primaryKey": { + "autoGenerate": true, + "columnNames": [ + "id" + ] + }, + "indices": [ + { + "name": "index_mtb_colt_data_collo_ser_collo_num_collo_gestione", + "unique": true, + "columnNames": [ + "data_collo", + "ser_collo", + "num_collo", + "gestione" + ], + "orders": [], + "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_mtb_colt_data_collo_ser_collo_num_collo_gestione` ON `${TABLE_NAME}` (`data_collo`, `ser_collo`, `num_collo`, `gestione`)" + } + ], + "foreignKeys": [] + }, + { + "tableName": "mtb_colr", + "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `id_collo` INTEGER NOT NULL, `data_collo` INTEGER, `gestione` TEXT, `ser_collo` TEXT, `descrizione` TEXT, `num_collo` INTEGER, `riga` INTEGER, `riga_ord` INTEGER, `cod_mart` TEXT, `cod_barre` TEXT, `cod_col` TEXT, `cod_tagl` TEXT, `partita_mag` TEXT, `gestione_rif` TEXT, `ser_collo_rif` TEXT, `note` TEXT, `data_ord` INTEGER, `data_collo_rif` INTEGER, `qta_cnf` REAL, `qta_col` REAL, `num_ord` INTEGER, `num_etich` INTEGER, `num_collo_rif` INTEGER, `datetime_row` INTEGER, `cod_jcom` TEXT, `num_cnf` REAL, `causale` TEXT, `utente` TEXT, `cod_anag_doc` TEXT, `cod_dtip_doc` TEXT, `data_doc` INTEGER, `ser_doc` TEXT, `num_doc` INTEGER, `id_riga_doc` INTEGER, `unt_mis` TEXT, `data_scad` INTEGER, FOREIGN KEY(`id_collo`) REFERENCES `mtb_colt`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )", + "fields": [ + { + "fieldPath": "id", + "columnName": "id", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "idCollo", + "columnName": "id_collo", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "dataCollo", + "columnName": "data_collo", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "gestione", + "columnName": "gestione", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "serCollo", + "columnName": "ser_collo", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "descrizione", + "columnName": "descrizione", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "numCollo", + "columnName": "num_collo", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "riga", + "columnName": "riga", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "rigaOrd", + "columnName": "riga_ord", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "codMart", + "columnName": "cod_mart", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "codBarre", + "columnName": "cod_barre", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "codCol", + "columnName": "cod_col", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "codTagl", + "columnName": "cod_tagl", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "partitaMag", + "columnName": "partita_mag", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "gestioneRif", + "columnName": "gestione_rif", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "serColloRif", + "columnName": "ser_collo_rif", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "note", + "columnName": "note", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "dataOrd", + "columnName": "data_ord", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "dataColloRif", + "columnName": "data_collo_rif", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "qtaCnf", + "columnName": "qta_cnf", + "affinity": "REAL", + "notNull": false + }, + { + "fieldPath": "qtaCol", + "columnName": "qta_col", + "affinity": "REAL", + "notNull": false + }, + { + "fieldPath": "numOrd", + "columnName": "num_ord", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "numEtich", + "columnName": "num_etich", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "numColloRif", + "columnName": "num_collo_rif", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "datetimeRow", + "columnName": "datetime_row", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "codJcom", + "columnName": "cod_jcom", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "numCnf", + "columnName": "num_cnf", + "affinity": "REAL", + "notNull": false + }, + { + "fieldPath": "causale", + "columnName": "causale", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "utente", + "columnName": "utente", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "codAnagDoc", + "columnName": "cod_anag_doc", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "codDtipDoc", + "columnName": "cod_dtip_doc", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "dataDoc", + "columnName": "data_doc", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "serDoc", + "columnName": "ser_doc", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "numDoc", + "columnName": "num_doc", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "idRigaDoc", + "columnName": "id_riga_doc", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "untMis", + "columnName": "unt_mis", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "dataScad", + "columnName": "data_scad", + "affinity": "INTEGER", + "notNull": false + } + ], + "primaryKey": { + "autoGenerate": true, + "columnNames": [ + "id" + ] + }, + "indices": [ + { + "name": "index_mtb_colr_data_collo_ser_collo_num_collo_gestione_riga", + "unique": true, + "columnNames": [ + "data_collo", + "ser_collo", + "num_collo", + "gestione", + "riga" + ], + "orders": [], + "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_mtb_colr_data_collo_ser_collo_num_collo_gestione_riga` ON `${TABLE_NAME}` (`data_collo`, `ser_collo`, `num_collo`, `gestione`, `riga`)" + }, + { + "name": "index_mtb_colr_id_collo", + "unique": false, + "columnNames": [ + "id_collo" + ], + "orders": [], + "createSql": "CREATE INDEX IF NOT EXISTS `index_mtb_colr_id_collo` ON `${TABLE_NAME}` (`id_collo`)" + } + ], + "foreignKeys": [ + { + "table": "mtb_colt", + "onDelete": "CASCADE", + "onUpdate": "NO ACTION", + "columns": [ + "id_collo" + ], + "referencedColumns": [ + "id" + ] + } + ] + }, + { + "tableName": "inventari", + "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`_id` INTEGER PRIMARY KEY AUTOINCREMENT, `id_inventario` INTEGER, `cod_mdep` TEXT NOT NULL, `data_inventario` INTEGER, `data_reg` INTEGER, `data_ver` INTEGER, `filtro` TEXT, `flag_stato` TEXT, `flag_operazione` TEXT, `cod_anag` TEXT, `cod_dtip` TEXT, `inserito_da` TEXT, `registrato_da` TEXT, `verificato_da` TEXT, `data_ora_inizio` INTEGER, `data_ora_fine` INTEGER, `causale` TEXT, `zona` TEXT, `new` INTEGER, `remote_sync_date` INTEGER)", + "fields": [ + { + "fieldPath": "id", + "columnName": "_id", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "idInventario", + "columnName": "id_inventario", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "codMdep", + "columnName": "cod_mdep", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "dataInventario", + "columnName": "data_inventario", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "dataReg", + "columnName": "data_reg", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "dataVer", + "columnName": "data_ver", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "filtro", + "columnName": "filtro", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "flagStato", + "columnName": "flag_stato", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "flagOperazione", + "columnName": "flag_operazione", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "codAnag", + "columnName": "cod_anag", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "codDtip", + "columnName": "cod_dtip", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "inseritoDa", + "columnName": "inserito_da", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "registratoDa", + "columnName": "registrato_da", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "verificatoDa", + "columnName": "verificato_da", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "dataOraInizio", + "columnName": "data_ora_inizio", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "dataOraFine", + "columnName": "data_ora_fine", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "causale", + "columnName": "causale", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "zona", + "columnName": "zona", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "isNew", + "columnName": "new", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "remoteSyncDate", + "columnName": "remote_sync_date", + "affinity": "INTEGER", + "notNull": false + } + ], + "primaryKey": { + "autoGenerate": true, + "columnNames": [ + "_id" + ] + }, + "indices": [ + { + "name": "index_inventari__id", + "unique": false, + "columnNames": [ + "_id" + ], + "orders": [], + "createSql": "CREATE INDEX IF NOT EXISTS `index_inventari__id` ON `${TABLE_NAME}` (`_id`)" + }, + { + "name": "index_inventari_id_inventario", + "unique": false, + "columnNames": [ + "id_inventario" + ], + "orders": [], + "createSql": "CREATE INDEX IF NOT EXISTS `index_inventari_id_inventario` ON `${TABLE_NAME}` (`id_inventario`)" + } + ], + "foreignKeys": [] + }, + { + "tableName": "inventario_rows", + "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`_id` INTEGER PRIMARY KEY AUTOINCREMENT, `parent_id` INTEGER, `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, `unt_mis` TEXT NOT NULL DEFAULT '0', `data_ora_inv` INTEGER, `scan_cod_barre` TEXT, `zona` TEXT, `remote_sync_date` INTEGER, FOREIGN KEY(`parent_id`) REFERENCES `inventari`(`_id`) ON UPDATE NO ACTION ON DELETE NO ACTION )", + "fields": [ + { + "fieldPath": "id", + "columnName": "_id", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "parentId", + "columnName": "parent_id", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "codMart", + "columnName": "cod_mart", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "partitaMag", + "columnName": "partita_mag", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "descrizione", + "columnName": "descrizione", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "qta", + "columnName": "qta", + "affinity": "REAL", + "notNull": true, + "defaultValue": "0" + }, + { + "fieldPath": "numConf", + "columnName": "num_cnf", + "affinity": "REAL", + "notNull": true, + "defaultValue": "0" + }, + { + "fieldPath": "qtaConf", + "columnName": "qta_cnf", + "affinity": "REAL", + "notNull": true, + "defaultValue": "0" + }, + { + "fieldPath": "untMis", + "columnName": "unt_mis", + "affinity": "TEXT", + "notNull": true, + "defaultValue": "'0'" + }, + { + "fieldPath": "dataOraInv", + "columnName": "data_ora_inv", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "scanCodBarre", + "columnName": "scan_cod_barre", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "zona", + "columnName": "zona", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "remoteSyncDate", + "columnName": "remote_sync_date", + "affinity": "INTEGER", + "notNull": false + } + ], + "primaryKey": { + "autoGenerate": true, + "columnNames": [ + "_id" + ] + }, + "indices": [ + { + "name": "index_inventario_rows__id", + "unique": false, + "columnNames": [ + "_id" + ], + "orders": [], + "createSql": "CREATE INDEX IF NOT EXISTS `index_inventario_rows__id` ON `${TABLE_NAME}` (`_id`)" + }, + { + "name": "index_inventario_rows_parent_id", + "unique": false, + "columnNames": [ + "parent_id" + ], + "orders": [], + "createSql": "CREATE INDEX IF NOT EXISTS `index_inventario_rows_parent_id` ON `${TABLE_NAME}` (`parent_id`)" + } + ], + "foreignKeys": [ + { + "table": "inventari", + "onDelete": "NO ACTION", + "onUpdate": "NO ACTION", + "columns": [ + "parent_id" + ], + "referencedColumns": [ + "_id" + ] + } + ] + } + ], + "views": [], + "setupQueries": [ + "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, 'bef89b513f0a4d5ecd9c2111e2e614a4')" + ] + } +} \ No newline at end of file diff --git a/app/src/main/java/it/integry/integrywmsnative/core/data_store/db/AppDatabase.java b/app/src/main/java/it/integry/integrywmsnative/core/data_store/db/AppDatabase.java index 661fbdb9..f2f5d5e9 100644 --- a/app/src/main/java/it/integry/integrywmsnative/core/data_store/db/AppDatabase.java +++ b/app/src/main/java/it/integry/integrywmsnative/core/data_store/db/AppDatabase.java @@ -40,7 +40,7 @@ import it.integry.integrywmsnative.core.data_store.db.entity.SqlMtbColt; InventarioRoomDTO.class, InventarioRowRoomDTO.class }, - version = 13, + version = 14, exportSchema = true) @TypeConverters({ DateConverter.class, @@ -66,7 +66,8 @@ public abstract class AppDatabase extends RoomDatabase { AppDatabase.class, "integry_wms") .addMigrations(MIGRATION_10_11) .addMigrations(MIGRATION_11_12) - .addMigrations(MIGRATION_12_13); + .addMigrations(MIGRATION_12_13) + .addMigrations(MIGRATION_13_14); sInstance = builder.build(); } @@ -126,4 +127,12 @@ public abstract class AppDatabase extends RoomDatabase { database.execSQL("CREATE INDEX IF NOT EXISTS index_inventario_rows__parent_id ON inventario_rows (parent_id)"); } }; + + static final Migration MIGRATION_13_14 = new Migration(13, 14) { + @Override + public void migrate(@NonNull SupportSQLiteDatabase database) { + database.execSQL("ALTER TABLE inventari" + + " ADD COLUMN new INTEGER"); + } + }; } diff --git a/app/src/main/java/it/integry/integrywmsnative/core/data_store/db/RoomModule.java b/app/src/main/java/it/integry/integrywmsnative/core/data_store/db/RoomModule.java index e9b8f6e8..cebe960b 100644 --- a/app/src/main/java/it/integry/integrywmsnative/core/data_store/db/RoomModule.java +++ b/app/src/main/java/it/integry/integrywmsnative/core/data_store/db/RoomModule.java @@ -184,7 +184,7 @@ public class RoomModule { InventarioLocalDataSource inventarioLocalDataSource, InventarioRESTConsumer inventarioRESTConsumer, InventarioMapper inventarioMapper) { - return new InventarioRepository(inventarioLocalDataSource, inventarioRESTConsumer, inventarioMapper, handler); + return new InventarioRepository(inventarioLocalDataSource, inventarioRESTConsumer, inventarioMapper, handler, executorService); } @Singleton diff --git a/app/src/main/java/it/integry/integrywmsnative/core/data_store/db/entity/InventarioRoomDTO.java b/app/src/main/java/it/integry/integrywmsnative/core/data_store/db/entity/InventarioRoomDTO.java index 93a69d30..cb8c25bc 100644 --- a/app/src/main/java/it/integry/integrywmsnative/core/data_store/db/entity/InventarioRoomDTO.java +++ b/app/src/main/java/it/integry/integrywmsnative/core/data_store/db/entity/InventarioRoomDTO.java @@ -35,6 +35,7 @@ public class InventarioRoomDTO extends BaseSyncDTO implements EntityModelInterfa public static final String DATA_ORA_FINE = "data_ora_fine"; public static final String CAUSALE = "causale"; public static final String ZONA = "zona"; + public static final String IS_NEW = "new"; } /** The unique ID of the cheese. */ @@ -95,6 +96,9 @@ public class InventarioRoomDTO extends BaseSyncDTO implements EntityModelInterfa @ColumnInfo(name = Columns.ZONA) private String zona; + @ColumnInfo(name = Columns.IS_NEW) + private Boolean isNew; + @Ignore private List inventarioRowList; @@ -235,6 +239,14 @@ public class InventarioRoomDTO extends BaseSyncDTO implements EntityModelInterfa this.zona = zona; } + public Boolean isNew() { + return isNew; + } + + public void setNew(Boolean aNew) { + isNew = aNew; + } + public List getInventarioRowList() { return inventarioRowList; } diff --git a/app/src/main/java/it/integry/integrywmsnative/core/data_store/db/respository_new/InventarioRepository.java b/app/src/main/java/it/integry/integrywmsnative/core/data_store/db/respository_new/InventarioRepository.java index bc729191..416b99b3 100644 --- a/app/src/main/java/it/integry/integrywmsnative/core/data_store/db/respository_new/InventarioRepository.java +++ b/app/src/main/java/it/integry/integrywmsnative/core/data_store/db/respository_new/InventarioRepository.java @@ -1,12 +1,16 @@ package it.integry.integrywmsnative.core.data_store.db.respository_new; import android.os.Handler; +import android.util.Log; import androidx.lifecycle.LiveData; import androidx.lifecycle.MutableLiveData; +import java.util.ArrayList; import java.util.Date; import java.util.List; +import java.util.Objects; +import java.util.concurrent.ExecutorService; import javax.inject.Inject; @@ -17,9 +21,12 @@ import it.integry.integrywmsnative.core.expansion.RunnableArgs; import it.integry.integrywmsnative.core.mapper.InventarioMapper; import it.integry.integrywmsnative.core.model.MtbInvent; import it.integry.integrywmsnative.core.rest.consumers.InventarioRESTConsumer; +import it.integry.integrywmsnative.core.utility.UtilityLiveData; public class InventarioRepository extends _BaseRepository { + private final ExecutorService executorService; + private final Handler handler; private final MutableLiveData> internalLiveData = new MutableLiveData<>(); @@ -28,22 +35,49 @@ public class InventarioRepository extends _BaseRepository> retrieve() { + public LiveData> retrieve(Runnable onComplete, RunnableArgs onError) { localDataSource.makeSynchronousRetrieveAllLive(false) .observeOn(Schedulers.io()) .subscribe(internalLiveData::postValue); -// refresh(onComplete, onError); + + UtilityLiveData.observeOnce(internalLiveData, inventories -> { + refresh(onComplete, onError); + }); + return internalLiveData; } + public void refresh(Runnable onComplete, RunnableArgs onError) { + executorService.execute(() -> { + try { + var startRetrieve = new Date(); + var remoteData = remoteDataSource.makeSynchronousRetrieveRequest(); + Log.d("Timing [INVENTORIES RETRIEVE]", ((new Date().getTime() - startRetrieve.getTime()) / 1000) + " secs"); + + if (remoteData == null) remoteData = new ArrayList<>(); + + resolveFetch(remoteData, internalLiveData.getValue(), + (remoteItem, localItem) -> Objects.equals(remoteItem.getIdInventario(), localItem.getIdInventario()), + (remoteItem, localItem) -> { + remoteItem.setNew(true); + }, onComplete, onError); + + } catch (Exception e) { + onError.run(e); + } + }); + } + public void insert(InventarioRoomDTO inventarioDTO, Runnable onComplete, RunnableArgs onError) { localDataSource.makeInsertRequest(inventarioDTO, localResult -> { if (onComplete != null) handler.post(onComplete); @@ -60,7 +94,7 @@ public class InventarioRepository extends _BaseRepository onError){ + public void delete(InventarioRoomDTO inventarioDTO, Runnable onComplete, RunnableArgs onError) { localDataSource.makeDeleteRequest(inventarioDTO, onComplete, onError); } diff --git a/app/src/main/java/it/integry/integrywmsnative/core/rest/consumers/ColliMagazzinoRESTConsumerService.java b/app/src/main/java/it/integry/integrywmsnative/core/rest/consumers/ColliMagazzinoRESTConsumerService.java index 1f32a985..ba96d4fc 100644 --- a/app/src/main/java/it/integry/integrywmsnative/core/rest/consumers/ColliMagazzinoRESTConsumerService.java +++ b/app/src/main/java/it/integry/integrywmsnative/core/rest/consumers/ColliMagazzinoRESTConsumerService.java @@ -1,12 +1,9 @@ package it.integry.integrywmsnative.core.rest.consumers; -import com.google.gson.JsonObject; - import java.util.List; import it.integry.integrywmsnative.core.model.MtbColr; import it.integry.integrywmsnative.core.model.MtbColt; -import it.integry.integrywmsnative.core.rest.model.DistribuzioneColloDTO; import it.integry.integrywmsnative.core.rest.model.RettificaULDTO; import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse; import it.integry.integrywmsnative.core.rest.model.SpostaArtsTraULRequestDTO; @@ -19,9 +16,6 @@ import retrofit2.http.Query; public interface ColliMagazzinoRESTConsumerService { - @POST("wms/distribuzioneRigheCollo") - Call> distribuisciCollo(@Body DistribuzioneColloDTO distribuzioneCollo); - @POST("getColloByBarcode") Call> getColloByBarcode(@Query("codBarreCollo") String sscc, @Query("onlyResiduo") boolean onlyResiduo, @Query("throwExcIfNull") boolean throwExcIfNull); diff --git a/app/src/main/java/it/integry/integrywmsnative/core/rest/consumers/GestSetupRESTConsumer.java b/app/src/main/java/it/integry/integrywmsnative/core/rest/consumers/GestSetupRESTConsumer.java index acd1f047..58b6bc72 100644 --- a/app/src/main/java/it/integry/integrywmsnative/core/rest/consumers/GestSetupRESTConsumer.java +++ b/app/src/main/java/it/integry/integrywmsnative/core/rest/consumers/GestSetupRESTConsumer.java @@ -20,12 +20,10 @@ import retrofit2.Response; public class GestSetupRESTConsumer extends _BaseRESTConsumer { public void getValue(String gestName, String sectionName, String keySection, RunnableArgs onComplete, RunnableArgs onFailed) { - getValueStatic(gestName, sectionName, keySection, onComplete, onFailed); - } - - public static void getValueStatic(String gestName, String sectionName, String keySection, RunnableArgs onComplete, RunnableArgs onFailed) { GestSetupRESTConsumerService service = RESTBuilder.getService(GestSetupRESTConsumerService.class); - service.getGestSetupValue(gestName, sectionName, keySection).enqueue(new Callback>() { + + service.getGestSetupValue(gestName, sectionName, keySection) + .enqueue(new Callback<>() { @Override public void onResponse(Call> call, Response> response) { analyzeAnswer(response, "GestSetup", onComplete, onFailed); @@ -40,8 +38,8 @@ public class GestSetupRESTConsumer extends _BaseRESTConsumer { }); } - public static void getBooleanValue(String gestName, String sectionName, String keySection, RunnableArgs onComplete, RunnableArgs onFailed) { - getValueStatic(gestName, sectionName, keySection, value -> { + public void getBooleanValue(String gestName, String sectionName, String keySection, RunnableArgs onComplete, RunnableArgs onFailed) { + getValue(gestName, sectionName, keySection, value -> { if (value != null) { onComplete.run("S".equalsIgnoreCase(value.value)); } else onComplete.run(false); @@ -50,7 +48,7 @@ public class GestSetupRESTConsumer extends _BaseRESTConsumer { }); } - public static void getValueStatic(String gestName, String sectionName, String keySection, String codMdep, RunnableArgs onComplete, RunnableArgs onFailed) { + public void getValue(String gestName, String sectionName, String keySection, String codMdep, RunnableArgs onComplete, RunnableArgs onFailed) { GestSetupRESTConsumerService service = RESTBuilder.getService(GestSetupRESTConsumerService.class); service.getGestSetupValue(gestName, sectionName, keySection, codMdep).enqueue(new Callback>() { @Override @@ -67,8 +65,8 @@ public class GestSetupRESTConsumer extends _BaseRESTConsumer { }); } - public static void getBooleanValue(String gestName, String sectionName, String keySection, String codMdep, RunnableArgs onComplete, RunnableArgs onFailed) { - getValueStatic(gestName, sectionName, keySection, codMdep, value -> { + public void getBooleanValue(String gestName, String sectionName, String keySection, String codMdep, RunnableArgs onComplete, RunnableArgs onFailed) { + getValue(gestName, sectionName, keySection, codMdep, value -> { if (value != null) { onComplete.run("S".equalsIgnoreCase(value.value)); } else onComplete.run(false); diff --git a/app/src/main/java/it/integry/integrywmsnative/core/rest/consumers/InventarioRESTConsumer.java b/app/src/main/java/it/integry/integrywmsnative/core/rest/consumers/InventarioRESTConsumer.java index 4c2daeb9..e63950eb 100644 --- a/app/src/main/java/it/integry/integrywmsnative/core/rest/consumers/InventarioRESTConsumer.java +++ b/app/src/main/java/it/integry/integrywmsnative/core/rest/consumers/InventarioRESTConsumer.java @@ -2,6 +2,8 @@ package it.integry.integrywmsnative.core.rest.consumers; import androidx.annotation.NonNull; +import java.util.List; + import javax.inject.Singleton; import it.integry.integrywmsnative.core.expansion.RunnableArgs; @@ -52,6 +54,16 @@ public class InventarioRESTConsumer extends _BaseRESTConsumer { }); } + public List makeSynchronousRetrieveRequest() throws Exception { + var inventarioRESTConsumerService = RESTBuilder.getService(InventarioRESTConsumerService.class, 120); + + var response = inventarioRESTConsumerService.retrieve() + .execute(); + + var data = analyzeAnswer(response, "retrieveInventario"); + return data.getInventories(); + } + public void makeInsertRequest(MtbInvent inventarioToInsert, final Runnable onComplete, final RunnableArgs onFailed) { var request = new InsertInventarioRequestDTO() diff --git a/app/src/main/java/it/integry/integrywmsnative/core/rest/consumers/InventarioRESTConsumerService.java b/app/src/main/java/it/integry/integrywmsnative/core/rest/consumers/InventarioRESTConsumerService.java index 5054be1a..d2d8cb23 100644 --- a/app/src/main/java/it/integry/integrywmsnative/core/rest/consumers/InventarioRESTConsumerService.java +++ b/app/src/main/java/it/integry/integrywmsnative/core/rest/consumers/InventarioRESTConsumerService.java @@ -2,6 +2,7 @@ package it.integry.integrywmsnative.core.rest.consumers; import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse; import it.integry.integrywmsnative.core.rest.model.inventario.InsertInventarioRequestDTO; +import it.integry.integrywmsnative.core.rest.model.inventario.RetrieveInventariResponseDTO; import it.integry.integrywmsnative.core.rest.model.inventario.RetrieveInventarioArtsResponseDTO; import it.integry.integrywmsnative.core.rest.model.inventario.RetrieveInventarioResponseDTO; import retrofit2.Call; @@ -12,6 +13,9 @@ import retrofit2.http.Path; public interface InventarioRESTConsumerService { + @GET("wms/inventario/") + Call> retrieve(); + @GET("wms/inventario/{inventoryId}") Call> retrieve( @Path("inventoryId") long inventoryId); diff --git a/app/src/main/java/it/integry/integrywmsnative/core/rest/consumers/_BaseRESTConsumer.java b/app/src/main/java/it/integry/integrywmsnative/core/rest/consumers/_BaseRESTConsumer.java index eace9e55..1166cc28 100644 --- a/app/src/main/java/it/integry/integrywmsnative/core/rest/consumers/_BaseRESTConsumer.java +++ b/app/src/main/java/it/integry/integrywmsnative/core/rest/consumers/_BaseRESTConsumer.java @@ -15,41 +15,48 @@ import retrofit2.Response; public abstract class _BaseRESTConsumer { - public static void analyzeAnswer(Response> response, String logTitle, RunnableArgs onComplete, RunnableArgs onFailed) { + public static T analyzeAnswer(Response> response, String logTitle) throws Exception { if (response.isSuccessful()) { if (response.body() != null) { if (response.body().getEsito() == EsitoType.OK) { if (!UtilityString.isNullOrEmpty(response.body().getErrorMessage())) { - onFailed.run(new Exception(response.body().getErrorMessage())); + throw new Exception(response.body().getErrorMessage()); } else { T dataObj = response.body().getDto() != null ? response.body().getDto() : response.body().getEntity(); - onComplete.run(dataObj); + return dataObj; } } else { String errorMessage = UtilityString.isNull(response.body().getErrorMessage(), "Empty message"); Log.e(logTitle, errorMessage); - onFailed.run(CommonRESTException.tryRecognizeException(errorMessage)); + throw CommonRESTException.tryRecognizeException(errorMessage); } } else { Log.e(logTitle, response.message()); - onFailed.run(new Exception(response.message())); + throw new Exception(response.message()); } } else { if (response.code() == 404) { - Log.e(logTitle, "Errore " + response.code() + ": risorsa non trovata (" + response.raw().request().url().toString() + ")"); - onFailed.run(new Exception("Errore " + response.code() + ": risorsa non trovata (" + logTitle + ")")); + Log.e(logTitle, "Errore " + response.code() + ": risorsa non trovata (" + response.raw().request().url() + ")"); + throw new Exception("Errore " + response.code() + ": risorsa non trovata (" + logTitle + ")"); } else if (response.code() == 550) - onFailed.run(new InvalidLicenseException()); + throw new InvalidLicenseException(); else { Log.e(logTitle, "Status " + response.code() + ": " + response.message()); - onFailed.run(new Exception("Status " + response.code() + ": " + response.message())); + throw new Exception("Status " + response.code() + ": " + response.message()); } + } + } - + public static void analyzeAnswer(Response> response, String logTitle, RunnableArgs onComplete, RunnableArgs onFailed) { + try { + var data = analyzeAnswer(response, logTitle); + onComplete.run(data); + } catch (Exception e) { + onFailed.run(e); } } diff --git a/app/src/main/java/it/integry/integrywmsnative/core/rest/model/DistribuzioneColloDTO.java b/app/src/main/java/it/integry/integrywmsnative/core/rest/model/DistribuzioneColloDTO.java deleted file mode 100644 index 2166bc46..00000000 --- a/app/src/main/java/it/integry/integrywmsnative/core/rest/model/DistribuzioneColloDTO.java +++ /dev/null @@ -1,84 +0,0 @@ -package it.integry.integrywmsnative.core.rest.model; - -public class DistribuzioneColloDTO { - - private String gestione; - private String dataCollo; - private Integer numCollo; - private String serCollo; - private String criterioDistribuzione; - - public String getGestione() { - return gestione; - } - - public DistribuzioneColloDTO setGestione(String gestione) { - this.gestione = gestione; - return this; - } - - public String getDataCollo() { - return dataCollo; - } - - public DistribuzioneColloDTO setDataCollo(String dataCollo) { - this.dataCollo = dataCollo; - return this; - } - - public Integer getNumCollo() { - return numCollo; - } - - public DistribuzioneColloDTO setNumCollo(Integer numCollo) { - this.numCollo = numCollo; - return this; - } - - public String getSerCollo() { - return serCollo; - } - - public DistribuzioneColloDTO setSerCollo(String serCollo) { - this.serCollo = serCollo; - return this; - } - - public String getCriterioDistribuzione() { - return criterioDistribuzione; - } - - public CriterioDistribuzione getCriterioDistribuzioneEnum() { - return CriterioDistribuzione.fromString(criterioDistribuzione); - } - - public DistribuzioneColloDTO setCriterioDistribuzione(String criterioDistribuzione) { - this.criterioDistribuzione = criterioDistribuzione; - return this; - } - - public DistribuzioneColloDTO setCriterioDistribuzione(CriterioDistribuzione criterioDistribuzione) { - this.criterioDistribuzione = criterioDistribuzione != null ? criterioDistribuzione.getText() : null; - return this; - } - - public enum CriterioDistribuzione { - UPDATE("U"), //UPDATE COLLO GIA' ESISTENTE - SPLIT_ORDINE("O"); //UPDATE COLLO GIA' ESISTENTE - - private String text; - CriterioDistribuzione(String text) { - this.text = text; - } - public String getText() { - return this.text; - } - - public static CriterioDistribuzione fromString(String text) { - for (CriterioDistribuzione b : CriterioDistribuzione.values()) { - if (b.text.equalsIgnoreCase(text)) return b; - } - return null; - } - } -} diff --git a/app/src/main/java/it/integry/integrywmsnative/core/rest/model/inventario/RetrieveInventariResponseDTO.java b/app/src/main/java/it/integry/integrywmsnative/core/rest/model/inventario/RetrieveInventariResponseDTO.java new file mode 100644 index 00000000..2beab604 --- /dev/null +++ b/app/src/main/java/it/integry/integrywmsnative/core/rest/model/inventario/RetrieveInventariResponseDTO.java @@ -0,0 +1,14 @@ +package it.integry.integrywmsnative.core.rest.model.inventario; + +import java.util.List; + +import it.integry.integrywmsnative.core.model.MtbInvent; + +public class RetrieveInventariResponseDTO { + + private List inventories; + + public List getInventories() { + return inventories; + } +} diff --git a/app/src/main/java/it/integry/integrywmsnative/core/settings/DBSettingsModel.java b/app/src/main/java/it/integry/integrywmsnative/core/settings/DBSettingsModel.java index b0ab4e88..a978779a 100644 --- a/app/src/main/java/it/integry/integrywmsnative/core/settings/DBSettingsModel.java +++ b/app/src/main/java/it/integry/integrywmsnative/core/settings/DBSettingsModel.java @@ -7,7 +7,6 @@ import it.integry.integrywmsnative.core.model.Azienda; import it.integry.integrywmsnative.core.model.MtbDepoPosizione; import it.integry.integrywmsnative.core.model.dto.InternalCodAnagsDTO; import it.integry.integrywmsnative.core.rest.model.AvailableCodMdepsDTO; -import it.integry.integrywmsnative.core.rest.model.DistribuzioneColloDTO; public class DBSettingsModel { @@ -22,7 +21,6 @@ public class DBSettingsModel { private boolean flagMultiClienteOrdV; private boolean flagUseCodAnagAziendale; private String defaultCausaleRettificaGiacenze; - private DistribuzioneColloDTO.CriterioDistribuzione defaultCriterioDistribuzione; private boolean flagAskClienteInPickingLibero; private boolean flagPickLiberoAllowEmptyCliente; @@ -136,15 +134,6 @@ public class DBSettingsModel { return this; } - public DistribuzioneColloDTO.CriterioDistribuzione getDefaultCriterioDistribuzione() { - return defaultCriterioDistribuzione; - } - - public DBSettingsModel setDefaultCriterioDistribuzione(String defaultCriterioDistribuzione) { - this.defaultCriterioDistribuzione = DistribuzioneColloDTO.CriterioDistribuzione.fromString(defaultCriterioDistribuzione); - return this; - } - public boolean isFlagAskClienteInPickingLibero() { return flagAskClienteInPickingLibero; } diff --git a/app/src/main/java/it/integry/integrywmsnative/core/settings/SettingsManager.java b/app/src/main/java/it/integry/integrywmsnative/core/settings/SettingsManager.java index 86b234a4..8d598288 100644 --- a/app/src/main/java/it/integry/integrywmsnative/core/settings/SettingsManager.java +++ b/app/src/main/java/it/integry/integrywmsnative/core/settings/SettingsManager.java @@ -355,7 +355,6 @@ public class SettingsManager { dbSettingsModelIstance.setEnableCheckPartitaMagCheckPickingV(getValueFromList(list, "SETUP", "ENABLE_CHECK_PARTITA_MAG_PICKING_V", Boolean.class)); dbSettingsModelIstance.setFlagMultiClienteOrdV(getValueFromList(list, "SETUP", "FLAG_MULTI_CLIENTE_ORD_VENDITA", Boolean.class)); dbSettingsModelIstance.setFlagUseCodAnagAziendale(getValueFromList(list, "SETUP", "FLAG_USE_COD_ANAG_AZIENDALE", Boolean.class)); - dbSettingsModelIstance.setDefaultCriterioDistribuzione(getValueFromList(list, "SETUP", "DEFAULT_CRITERIO_DISTRIBUZIONE", String.class)); dbSettingsModelIstance.setFlagAskClienteInPickingLibero(getValueFromList(list, "PICKING_LIBERO", "FLAG_ASK_CLIENTE", Boolean.class)); dbSettingsModelIstance.setFlagPickLiberoAllowEmptyCliente(getValueFromList(list, "PICKING_LIBERO", "FLAG_ALLOW_EMPTY_CLIENTE", Boolean.class)); dbSettingsModelIstance.setFlagCanAddExtraItemSpedizione(getValueFromList(list, "SPEDIZIONE", "FLAG_CAN_ADD_EXTRA_ITEMS", Boolean.class)); diff --git a/app/src/main/java/it/integry/integrywmsnative/gest/inventario/ElencoInventariFragment.java b/app/src/main/java/it/integry/integrywmsnative/gest/inventario/ElencoInventariFragment.java index c73848f1..77a0306a 100644 --- a/app/src/main/java/it/integry/integrywmsnative/gest/inventario/ElencoInventariFragment.java +++ b/app/src/main/java/it/integry/integrywmsnative/gest/inventario/ElencoInventariFragment.java @@ -70,6 +70,11 @@ public class ElencoInventariFragment extends BaseFragment implements ITitledFrag mBinding.setLifecycleOwner(this); mBinding.setViewmodel(mViewModel); + mBinding.swiperefresh.setRefreshing(true); + mBinding.swiperefresh.setOnRefreshListener(() -> { + mViewModel.loadData(); + }); + mViewModel.loadData(); this.initRecyclerView(); @@ -143,6 +148,22 @@ public class ElencoInventariFragment extends BaseFragment implements ITitledFrag startPicking(inventarioRoomDTO, listaArts); } + @Override + public void onInventoriesLoadingStarted() { + mBinding.swiperefresh.setRefreshing(true); + } + + @Override + public void onInventoriesLoadingEnded() { + mBinding.swiperefresh.setRefreshing(false); + } + + @Override + public void onInventoriesLoadingError(Exception ex) { + mBinding.swiperefresh.setRefreshing(false); + this.onError(ex); + } + private void startPicking(InventarioRoomDTO inventarioRoomDTO, List listArts) { PickingInventarioActivity.startActivity(requireContext(), inventarioRoomDTO, listArts); diff --git a/app/src/main/java/it/integry/integrywmsnative/gest/inventario/ElencoInventariViewModel.java b/app/src/main/java/it/integry/integrywmsnative/gest/inventario/ElencoInventariViewModel.java index 70c36d60..9d0463d1 100644 --- a/app/src/main/java/it/integry/integrywmsnative/gest/inventario/ElencoInventariViewModel.java +++ b/app/src/main/java/it/integry/integrywmsnative/gest/inventario/ElencoInventariViewModel.java @@ -40,7 +40,10 @@ public class ElencoInventariViewModel { } public void loadData() { - inventarioList = inventarioRepository.retrieve(); + inventarioList = inventarioRepository.retrieve( + this::sendOnInventoriesLoadingEnded, + this::sendOnInventoriesLoadingError + ); } public void destroyData() { @@ -146,16 +149,34 @@ public class ElencoInventariViewModel { if (this.listener != null) listener.onLoadingEnded(); } + private void sendOnInventoriesLoadingStarted() { + if (this.listener != null) listener.onInventoriesLoadingStarted(); + } + + private void sendOnInventoriesLoadingEnded() { + if (this.listener != null) listener.onInventoriesLoadingEnded(); + } + private void sendOnError(Exception ex) { if (this.listener != null) listener.onError(ex); } + private void sendOnInventoriesLoadingError(Exception ex) { + if (this.listener != null) listener.onInventoriesLoadingError(ex); + } + public interface Listener extends ILoadingListener { void onInventarioInfoRequest(RunnableArgss onComplete); void onInventarioLoaded(InventarioRoomDTO inventarioRoomDTO, List listaArts); + void onInventoriesLoadingStarted(); + + void onInventoriesLoadingEnded(); + + void onInventoriesLoadingError(Exception ex); + void onCreateInventarioRequest(long inventoryId, String zone); void onError(Exception ex); diff --git a/app/src/main/java/it/integry/integrywmsnative/gest/spedizione/SpedizioneViewModel.java b/app/src/main/java/it/integry/integrywmsnative/gest/spedizione/SpedizioneViewModel.java index 134b28ef..97c01ac9 100644 --- a/app/src/main/java/it/integry/integrywmsnative/gest/spedizione/SpedizioneViewModel.java +++ b/app/src/main/java/it/integry/integrywmsnative/gest/spedizione/SpedizioneViewModel.java @@ -587,7 +587,7 @@ public class SpedizioneViewModel { private void executeMagazzinoAutomatico(MtbDepoPosizione mtbDepoPosizione, Runnable onComplete) { var magazzinoAutomaticoPickableArts = Stream.of(Objects.requireNonNull(this.mPickingList.getValue())) - .filter(x -> Stream.of(x.getMtbColts()).anyMatch(y -> y.getPosizione().equalsIgnoreCase(mtbDepoPosizione.getPosizione()))) + .filter(x -> Stream.of(x.getMtbColts()).anyMatch(y -> y.getPosizione() != null && y.getPosizione().equalsIgnoreCase(mtbDepoPosizione.getPosizione()))) .toList(); var mtbAarts = Stream.of(magazzinoAutomaticoPickableArts) diff --git a/app/src/main/res/layout/fragment_elenco_inventario.xml b/app/src/main/res/layout/fragment_elenco_inventario.xml index 730607a2..71f2b237 100644 --- a/app/src/main/res/layout/fragment_elenco_inventario.xml +++ b/app/src/main/res/layout/fragment_elenco_inventario.xml @@ -70,28 +70,34 @@ - - + app:layout_behavior="@string/appbar_scrolling_view_behavior"> + + + + app:srcCompat="@drawable/ic_add_24dp" /> diff --git a/app/src/main/res/layout/fragment_elenco_inventario_list_single_item.xml b/app/src/main/res/layout/fragment_elenco_inventario_list_single_item.xml index 66c0e900..166fc407 100644 --- a/app/src/main/res/layout/fragment_elenco_inventario_list_single_item.xml +++ b/app/src/main/res/layout/fragment_elenco_inventario_list_single_item.xml @@ -53,7 +53,7 @@ android:layout_toEndOf="@+id/badge1" android:text="@string/new_item" android:textColor="@android:color/white" - android:visibility="gone" + android:visibility="@{item.isNew() ? View.VISIBLE : View.GONE}" android:textStyle="bold" /> diff --git a/build.gradle b/build.gradle index c28a7b76..f5506849 100644 --- a/build.gradle +++ b/build.gradle @@ -3,7 +3,7 @@ buildscript { ext { kotlin_version = '1.8.0' - agp_version = '8.1.0-alpha04' + agp_version = '8.1.0-alpha05' } repositories {