Merge branch 'release/v1.30.02__320'

This commit is contained in:
Giuseppe Scorrano 2022-12-13 15:41:59 +01:00
commit 882c95bd85
9 changed files with 1302 additions and 95 deletions

View File

@ -10,8 +10,8 @@ apply plugin: 'com.google.gms.google-services'
android {
def appVersionCode = 319
def appVersionName = '1.30.01'
def appVersionCode = 320
def appVersionName = '1.30.02'
signingConfigs {
release {

File diff suppressed because it is too large Load Diff

View File

@ -2,6 +2,7 @@ package it.integry.integrywmsnative.core.data_store.db;
import android.content.Context;
import androidx.annotation.NonNull;
import androidx.room.Database;
import androidx.room.Room;
import androidx.room.RoomDatabase;
@ -39,7 +40,7 @@ import it.integry.integrywmsnative.core.data_store.db.entity.SqlMtbColt;
InventarioRoomDTO.class,
InventarioRowRoomDTO.class
},
version = 12,
version = 13,
exportSchema = true)
@TypeConverters({
DateConverter.class,
@ -64,7 +65,8 @@ public abstract class AppDatabase extends RoomDatabase {
var builder = Room.databaseBuilder(applicationContext,
AppDatabase.class, "integry_wms")
.addMigrations(MIGRATION_10_11)
.addMigrations(MIGRATION_11_12);
.addMigrations(MIGRATION_11_12)
.addMigrations(MIGRATION_12_13);
sInstance = builder.build();
}
@ -101,6 +103,7 @@ 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_11_12 = new Migration(11, 12) {
@Override
public void migrate(SupportSQLiteDatabase database) {
@ -111,4 +114,16 @@ public abstract class AppDatabase extends RoomDatabase {
database.execSQL("ALTER TABLE ordini_tmp RENAME TO ordini;");
}
};
static final Migration MIGRATION_12_13 = new Migration(12, 13) {
@Override
public void migrate(@NonNull SupportSQLiteDatabase database) {
database.execSQL("CREATE TABLE IF NOT EXISTS inventario_rows_tmp (_id INTEGER PRIMARY KEY AUTOINCREMENT, parent_id INTEGER, cod_mart TEXT, descrizione TEXT, partita_mag 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 )");
database.execSQL("INSERT INTO inventario_rows_tmp SELECT * FROM inventario_rows");
database.execSQL("DROP TABLE inventario_rows;");
database.execSQL("ALTER TABLE inventario_rows_tmp RENAME TO inventario_rows;");
database.execSQL("CREATE INDEX IF NOT EXISTS index_inventario_rows__id ON inventario_rows (_id)");
database.execSQL("CREATE INDEX IF NOT EXISTS index_inventario_rows__parent_id ON inventario_rows (parent_id)");
}
};
}

View File

@ -49,7 +49,6 @@ public class InventarioRowRoomDTO extends BaseSyncDTO implements EntityModelInte
@ColumnInfo(index = true, name = Columns.PARENT_ID)
private Long parentId;
@NonNull
@ColumnInfo(name = Columns.COD_MART)
private String codMart;
@ -93,7 +92,6 @@ public class InventarioRowRoomDTO extends BaseSyncDTO implements EntityModelInte
this.parentId = parentId;
}
@NonNull
public String getCodMart() {
return codMart;
}
@ -177,4 +175,48 @@ public class InventarioRowRoomDTO extends BaseSyncDTO implements EntityModelInte
public void setZona(String zona) {
this.zona = zona;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
InventarioRowRoomDTO that = (InventarioRowRoomDTO) o;
if (getId() != null ? !getId().equals(that.getId()) : that.getId() != null) return false;
if (getParentId() != null ? !getParentId().equals(that.getParentId()) : that.getParentId() != null)
return false;
if (getCodMart() != null ? !getCodMart().equals(that.getCodMart()) : that.getCodMart() != null)
return false;
if (getPartitaMag() != null ? !getPartitaMag().equals(that.getPartitaMag()) : that.getPartitaMag() != null)
return false;
if (getDescrizione() != null ? !getDescrizione().equals(that.getDescrizione()) : that.getDescrizione() != null)
return false;
if (!getQta().equals(that.getQta())) return false;
if (!getNumConf().equals(that.getNumConf())) return false;
if (!getQtaConf().equals(that.getQtaConf())) return false;
if (!getUntMis().equals(that.getUntMis())) return false;
if (getDataOraInv() != null ? !getDataOraInv().equals(that.getDataOraInv()) : that.getDataOraInv() != null)
return false;
if (getScanCodBarre() != null ? !getScanCodBarre().equals(that.getScanCodBarre()) : that.getScanCodBarre() != null)
return false;
return getZona() != null ? getZona().equals(that.getZona()) : that.getZona() == null;
}
@Override
public int hashCode() {
int result = getId() != null ? getId().hashCode() : 0;
result = 31 * result + (getParentId() != null ? getParentId().hashCode() : 0);
result = 31 * result + (getCodMart() != null ? getCodMart().hashCode() : 0);
result = 31 * result + (getPartitaMag() != null ? getPartitaMag().hashCode() : 0);
result = 31 * result + (getDescrizione() != null ? getDescrizione().hashCode() : 0);
result = 31 * result + getQta().hashCode();
result = 31 * result + getNumConf().hashCode();
result = 31 * result + getQtaConf().hashCode();
result = 31 * result + getUntMis().hashCode();
result = 31 * result + (getDataOraInv() != null ? getDataOraInv().hashCode() : 0);
result = 31 * result + (getScanCodBarre() != null ? getScanCodBarre().hashCode() : 0);
result = 31 * result + (getZona() != null ? getZona().hashCode() : 0);
return result;
}
}

View File

@ -1,6 +1,7 @@
package it.integry.integrywmsnative.core.rest.model.inventario;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import it.integry.integrywmsnative.core.model.MtbAart;
@ -11,7 +12,7 @@ public class InventarioArtDTO {
private String descrizione;
private String untMis;
private BigDecimal qtaCnf;
private List<String> barcode;
private ArrayList<String> barcode;
private boolean flagTracciabilita;
private boolean flagQtaCnfFissa;
private BigDecimal giacenza;
@ -58,7 +59,7 @@ public class InventarioArtDTO {
return barcode;
}
public InventarioArtDTO setBarcode(List<String> barcode) {
public InventarioArtDTO setBarcode(ArrayList<String> barcode) {
this.barcode = barcode;
return this;
}

View File

@ -12,7 +12,6 @@ import com.ravikoradiya.liveadapter.LiveAdapter;
import com.ravikoradiya.liveadapter.Type;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import java.util.Objects;
@ -133,7 +132,7 @@ public class PickingInventarioActivity extends BaseActivity implements PickingIn
var itemType = new Type<InventarioRowRoomDTO, ActivityPickingInventarioListItemBinding>(R.layout.activity_picking_inventario__list_item, BR.item);
itemType.areItemSame((oldItem, newItem) -> Objects.equals(oldItem.getId(), newItem.getId()));
itemType.areContentsTheSame((oldItem, newItem) -> Objects.equals(oldItem.getId(), newItem.getId()));
itemType.areContentsTheSame(InventarioRowRoomDTO::equals);
itemType.onClick(x -> {
new BottomSheetInventarioRowActionsView(x.getBinding().getItem())
.setListener(new BottomSheetInventarioRowActionsView.Listener() {
@ -190,7 +189,7 @@ public class PickingInventarioActivity extends BaseActivity implements PickingIn
}
@Override
public void onItemDispatched(PickingObjectDTO pickingObjectDTO, MtbAart mtbAart, BigDecimal initialNumCnf, BigDecimal initialQtaCnf, BigDecimal initialQtaTot, BigDecimal totalQtaAvailable, BigDecimal totalNumCnfAvailable, BigDecimal qtaCnfAvailable, BigDecimal totalQtaToBeTaken, BigDecimal totalNumCnfToBeTaken, BigDecimal qtaCnfToBeTaken, String partitaMag, Date dataScad, boolean canOverflowOrderQuantity, boolean canPartitaMagBeChanged, boolean canLUBeClosed, RunnableArgss<PickedQuantityDTO, Boolean> onComplete) {
public void onItemDispatched(PickingObjectDTO pickingObjectDTO, MtbAart mtbAart, BigDecimal initialNumCnf, BigDecimal initialQtaCnf, BigDecimal initialQtaTot, BigDecimal totalQtaAvailable, BigDecimal totalNumCnfAvailable, BigDecimal qtaCnfAvailable, BigDecimal totalQtaToBeTaken, BigDecimal totalNumCnfToBeTaken, BigDecimal qtaCnfToBeTaken, boolean canOverflowOrderQuantity, boolean canPartitaMagBeChanged, boolean canLUBeClosed, RunnableArgss<PickedQuantityDTO, Boolean> onComplete) {
DialogInputQuantityV2DTO dialogInputQuantityV2DTO = new DialogInputQuantityV2DTO()
.setMtbAart(mtbAart)
.setInitialNumCnf(initialNumCnf)
@ -202,8 +201,6 @@ public class PickingInventarioActivity extends BaseActivity implements PickingIn
.setTotalQtaToBeTaken(totalQtaToBeTaken)
.setTotalNumCnfToBeTaken(totalNumCnfToBeTaken)
.setQtaCnfToBeTaken(qtaCnfToBeTaken)
.setPartitaMag(partitaMag)
.setDataScad(dataScad)
.setCanOverflowOrderQuantity(canOverflowOrderQuantity)
.setCanPartitaMagBeChanged(canPartitaMagBeChanged)
.setCanLUBeClosed(canLUBeClosed)

View File

@ -7,10 +7,7 @@ import androidx.lifecycle.ViewModel;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Random;
import java.util.stream.Collectors;
import it.integry.barcode_base_android_library.model.BarcodeScanDTO;
import it.integry.integrywmsnative.core.data_store.db.entity.InventarioRoomDTO;
@ -66,27 +63,6 @@ public class PickingInventarioViewModel extends ViewModel {
this.sendOnLoadingEnded();
}
private void generateRandomItems() {
for (int i = 0; i < 500; i++) {
Random r = new Random();
int randomIndex = r.nextInt(availableInventarioArts.size());
var item = getAvailableArts().get(randomIndex);
var itemMtbAart = item.toMtbAart();
var fakePickingObjectDto = new PickingObjectDTO()
.setMtbAart(itemMtbAart);
var qta = BigDecimal.valueOf(r.nextInt(50));
var numCnf = UtilityBigDecimal.multiply(qta, itemMtbAart.getQtaCnf());
saveNewRow(fakePickingObjectDto, qta, itemMtbAart.getQtaCnf(), numCnf, null, null);
}
}
public LiveData<InventarioRoomDTO> getCurrentInventario() {
return currentInventario;
}
@ -110,10 +86,18 @@ public class PickingInventarioViewModel extends ViewModel {
}
public void updateRow(InventarioRowRoomDTO itemToUpdate) {
var barcodeList = new ArrayList<String>();
barcodeList.add(itemToUpdate.getScanCodBarre());
var matchedArt = availableInventarioArts.stream()
.filter(x -> x.getCodMart().contains(itemToUpdate.getCodMart()))
.filter(x -> itemToUpdate.getCodMart() != null && x.getCodMart().contains(itemToUpdate.getCodMart()))
.findFirst()
.orElse(null);
.orElse(new InventarioArtDTO()
.setBarcode(barcodeList)
.setFlagQtaCnfFissa(true)
.setPlu(false)
.setUntMis(itemToUpdate.getUntMis())
.setQtaCnf(itemToUpdate.getQtaConf()));
var articolo = matchedArt.toMtbAart();
articolo.setFlagTracciabilita("N");
@ -147,21 +131,29 @@ public class PickingInventarioViewModel extends ViewModel {
}
private void loadArticolo(String barcodeProd, Ean128Model ean128Model, Runnable onComplete) {
var matchedArts = availableInventarioArts.stream()
var barcodeList = new ArrayList<String>();
barcodeList.add(barcodeProd);
var matchedArt = availableInventarioArts.stream()
.filter(x -> x.getBarcode().contains(barcodeProd))
.collect(Collectors.toList());
.findFirst()
.orElse(new InventarioArtDTO()
.setBarcode(barcodeList)
.setFlagQtaCnfFissa(true)
.setPlu(false)
.setUntMis("PZ")
.setQtaCnf(BigDecimal.ONE));
if (matchedArts.size() > 0) {
this.dispatchRowInsert(matchedArts.get(0), ean128Model);
if (matchedArt != null) {
this.dispatchRowInsert(barcodeProd, matchedArt, ean128Model);
onComplete.run();
} else {
} else
this.sendError(new NoResultFromBarcodeException(barcodeProd));
}
}
private void dispatchRowInsert(InventarioArtDTO inventarioArtDTO, Ean128Model ean128Model) {
private void dispatchRowInsert(String barcode, InventarioArtDTO inventarioArtDTO, Ean128Model ean128Model) {
var mtbAart = inventarioArtDTO.toMtbAart();
mtbAart.setFlagTracciabilita("N");
@ -177,9 +169,6 @@ public class PickingInventarioViewModel extends ViewModel {
BigDecimal initialQtaCnf;
BigDecimal initialQtaTot;
String partitaMag = null;
Date dataScad = null;
if (pickingObjectDTO.getTempPickData() != null && pickingObjectDTO.getTempPickData().getManualPickDTO() != null) {
//Oppure le info del barcode scansionato
PickDataDTO.ManualPickDTO manualPickDTO = pickingObjectDTO.getTempPickData().getManualPickDTO();
@ -228,11 +217,6 @@ public class PickingInventarioViewModel extends ViewModel {
qtaColDaPrelevare = UtilityBigDecimal.multiply(numCnfDaPrelevare, qtaCnfDaPrelevare);
}
if (manualPickDTO.getMtbPartitaMag() != null) {
partitaMag = manualPickDTO.getMtbPartitaMag().getPartitaMag();
dataScad = manualPickDTO.getMtbPartitaMag().getDataScadD();
}
initialNumCnf = numCnfDaPrelevare;
initialQtaCnf = qtaCnfDaPrelevare;
initialQtaTot = qtaColDaPrelevare;
@ -248,32 +232,39 @@ public class PickingInventarioViewModel extends ViewModel {
initialQtaTot = UtilityBigDecimal.multiply(initialNumCnf, initialQtaCnf);
}
if (inventarioArtDTO.isPlu()) {
this.saveNewRow(pickingObjectDTO,
initialNumCnf,
initialQtaCnf,
initialQtaTot,
null,
barcode);
} else {
this.sendOnItemDispatched(
pickingObjectDTO,
pickingObjectDTO.getMtbAart(),
null, //initialNumCnf,
initialQtaCnf,
null, //initialQtaTot,
null,
null,
null,
null,
null,
null,
partitaMag,
dataScad,
false,
true,
false,
(pickedQuantityDTO, shouldCloseLU) -> {
this.saveNewRow(pickingObjectDTO,
pickedQuantityDTO.getNumCnf(),
pickedQuantityDTO.getQtaCnf(),
pickedQuantityDTO.getQtaTot(),
pickedQuantityDTO.getPartitaMag(),
pickedQuantityDTO.getDataScad());
});
this.sendOnItemDispatched(
pickingObjectDTO,
pickingObjectDTO.getMtbAart(),
null, //initialNumCnf,
initialQtaCnf,
null, //initialQtaTot,
null,
null,
null,
null,
null,
null,
false,
true,
false,
(pickedQuantityDTO, shouldCloseLU) -> {
this.saveNewRow(pickingObjectDTO,
pickedQuantityDTO.getNumCnf(),
pickedQuantityDTO.getQtaCnf(),
pickedQuantityDTO.getQtaTot(),
pickedQuantityDTO.getPartitaMag(),
barcode);
});
}
}
private void dispatchRowEdit(MtbAart mtbAart, InventarioRowRoomDTO inventarioRowRoomDTO) {
@ -290,8 +281,6 @@ public class PickingInventarioViewModel extends ViewModel {
inventarioRowRoomDTO.getQta(),
null, null, null,
null, null, null,
inventarioRowRoomDTO.getPartitaMag(),
null,
false,
false,
false,
@ -301,14 +290,13 @@ public class PickingInventarioViewModel extends ViewModel {
pickedQuantityDTO.getNumCnf(),
pickedQuantityDTO.getQtaCnf(),
pickedQuantityDTO.getQtaTot(),
pickedQuantityDTO.getPartitaMag(),
pickedQuantityDTO.getDataScad());
pickedQuantityDTO.getPartitaMag());
});
}
private void saveNewRow(PickingObjectDTO pickingObjectDTO, BigDecimal numCnf, BigDecimal qtaCnf, BigDecimal qtaTot, String partitaMag, Date dataScad) {
private void saveNewRow(PickingObjectDTO pickingObjectDTO, BigDecimal numCnf, BigDecimal qtaCnf, BigDecimal qtaTot, String partitaMag, String scanCodBarre) {
final InventarioRowRoomDTO inventarioRow = new InventarioRowRoomDTO();
inventarioRow.setCodMart(pickingObjectDTO.getMtbAart().getCodMart());
inventarioRow.setDescrizione(pickingObjectDTO.getMtbAart().getDescrizioneEstesa());
@ -320,12 +308,13 @@ public class PickingInventarioViewModel extends ViewModel {
inventarioRow.setDataOraInv(UtilityDate.getNowTime());
inventarioRow.setZona(currentInventario.getValue().getZona());
inventarioRow.setParentId(currentInventario.getValue().getId());
inventarioRow.setScanCodBarre(scanCodBarre);
inventarioRowRepository.insert(inventarioRow, () -> {
}, this::sendError);
}
private void saveEditedRow(InventarioRowRoomDTO inventarioRowRoomDTO, BigDecimal numCnf, BigDecimal qtaCnf, BigDecimal qtaTot, String partitaMag, Date dataScad) {
private void saveEditedRow(InventarioRowRoomDTO inventarioRowRoomDTO, BigDecimal numCnf, BigDecimal qtaCnf, BigDecimal qtaTot, String partitaMag) {
inventarioRowRoomDTO.setPartitaMag(partitaMag);
inventarioRowRoomDTO.setQta(qtaTot);
inventarioRowRoomDTO.setNumConf(numCnf);
@ -360,8 +349,6 @@ public class PickingInventarioViewModel extends ViewModel {
BigDecimal totalQtaToBeTaken,
BigDecimal totalNumCnfToBeTaken,
BigDecimal qtaCnfToBeTaken,
String partitaMag,
Date dataScad,
boolean canOverflowOrderQuantity,
boolean canPartitaMagBeChanged,
boolean canLUBeClosed,
@ -377,8 +364,6 @@ public class PickingInventarioViewModel extends ViewModel {
totalQtaToBeTaken,
totalNumCnfToBeTaken,
qtaCnfToBeTaken,
partitaMag,
dataScad,
canOverflowOrderQuantity,
canPartitaMagBeChanged,
canLUBeClosed,
@ -405,8 +390,6 @@ public class PickingInventarioViewModel extends ViewModel {
BigDecimal totalQtaToBeTaken,
BigDecimal totalNumCnfToBeTaken,
BigDecimal qtaCnfToBeTaken,
String partitaMag,
Date dataScad,
boolean canOverflowOrderQuantity,
boolean canPartitaMagBeChanged,
boolean canLUBeClosed,

View File

@ -107,7 +107,7 @@ public class DialogInputQuantityV2ViewModel {
} else {
this.internalNumCnf = totalNumCnfOrd;
this.internalQtaCnf = qtaCnfOrd;
this.internalQtaCnf = qtaCnfOrd != null ? qtaCnfOrd : initialQtaCnf;
this.internalQtaTot = totalQtaOrd;
}

View File

@ -72,16 +72,29 @@
android:ellipsize="end"
android:maxLines="2"
android:text="@{item.descrizione}"
android:visibility="@{UtilityString.isNullOrEmpty(item.descrizione) ? View.GONE : View.VISIBLE}"
tools:text="Descrizione lunga articolo" />
<androidx.appcompat.widget.AppCompatTextView
style="@style/AppTheme.NewMaterial.Text.Medium"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ellipsize="end"
android:maxLines="2"
android:enabled="false"
android:text="@{`Barcode: ` + item.scanCodBarre}"
android:visibility="@{UtilityString.isNullOrEmpty(item.descrizione) ? View.VISIBLE : View.GONE}" />
<androidx.appcompat.widget.AppCompatTextView
style="@style/AppTheme.NewMaterial.Text.Small"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@{`Lotto: ` + item.getPartitaMag()}"
android:text="@{`Lotto: ` + item.partitaMag}"
android:enabled="false"
android:visibility="@{UtilityString.isNullOrEmpty(item.getPartitaMag()) ? View.GONE : View.VISIBLE}"
android:visibility="@{UtilityString.isNullOrEmpty(item.partitaMag) ? View.GONE : View.VISIBLE}"
tools:text="Lotto: ABCDE" />
</androidx.appcompat.widget.LinearLayoutCompat>