[ESSEGRANDE] Modifiche per data_scad e inventari con righe a 0

This commit is contained in:
Giuseppe Scorrano 2023-03-24 19:12:59 +01:00
parent dc46b36624
commit ac6cca1eda
11 changed files with 78 additions and 35 deletions

View File

@ -2,7 +2,7 @@
"formatVersion": 1,
"database": {
"version": 15,
"identityHash": "a7eb741d99ba4b54e55ac41684d3207a",
"identityHash": "0609508b3a8434bb8d3e3cc99e766d67",
"entities": [
{
"tableName": "articoli_griglia",
@ -192,7 +192,7 @@
},
{
"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)",
"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, `cod_alis` TEXT)",
"fields": [
{
"fieldPath": "ordineId",
@ -252,7 +252,7 @@
"fieldPath": "idGriglia",
"columnName": "id_griglia",
"affinity": "INTEGER",
"notNull": true
"notNull": false
},
{
"fieldPath": "codAlis",
@ -1162,7 +1162,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, 'a7eb741d99ba4b54e55ac41684d3207a')"
"INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, '0609508b3a8434bb8d3e3cc99e766d67')"
]
}
}

View File

@ -53,9 +53,9 @@ public class DocumentRESTConsumer extends _BaseRESTConsumer {
public void loadDocumentoAvailableArts(String codDtip, String codMgrp, RunnableArgs<RetrieveDocumentoArtsResponseDTO> onComplete, RunnableArgs<Exception> onFailed) {
public void loadDocumentoAvailableArts(String codDtip, String codMgrp, String codAnagForn, RunnableArgs<RetrieveDocumentoArtsResponseDTO> onComplete, RunnableArgs<Exception> onFailed) {
var inventarioRESTConsumerService = RESTBuilder.getService(DocumentiRESTConsumerService.class);
inventarioRESTConsumerService.retrieveArts(codDtip, codMgrp)
inventarioRESTConsumerService.retrieveArts(codDtip, codMgrp, codAnagForn)
.enqueue(new Callback<>() {
@Override
public void onResponse(@NonNull Call<ServiceRESTResponse<RetrieveDocumentoArtsResponseDTO>> call, @NonNull Response<ServiceRESTResponse<RetrieveDocumentoArtsResponseDTO>> response) {

View File

@ -26,6 +26,7 @@ public interface DocumentiRESTConsumerService {
@GET("wms/documento/arts")
Call<ServiceRESTResponse<RetrieveDocumentoArtsResponseDTO>> retrieveArts(
@Query("codDtip") String codDtip,
@Query("codMgrp") String codMgrp);
@Query("codMgrp") String codMgrp,
@Query("codAnagForn") String codAnagForn);
}

View File

@ -102,15 +102,19 @@ public class DocInterniViewModel {
this.productsFetched = false;
this.sendOnLoadingStarted();
documentRESTConsumer.loadDocumentoAvailableArts(this.getCodDtip(), this.getCodMgrp(), data -> {
this.productsFetched = true;
this.availableArts = data.getArts();
this.artsSize.set(this.availableArts.size());
documentRESTConsumer.loadDocumentoAvailableArts(
this.getCodDtip(),
this.getCodMgrp(),
this.getCodAnagForn(),
data -> {
this.productsFetched = true;
this.availableArts = data.getArts();
this.artsSize.set(this.availableArts.size());
if (this.docsFetched)
this.sendOnLoadingEnded();
if (this.docsFetched)
this.sendOnLoadingEnded();
}, this::sendError);
}, this::sendError);
}
public void fetchDocuments() {
@ -159,6 +163,13 @@ public class DocInterniViewModel {
return this.mtbGrup.getValue().getCodMgrp();
}
private String getCodAnagForn() {
if (this.fornitore.getValue() == null) {
return null;
}
return this.fornitore.getValue().getCodAnag();
}
public void editDocument(SqlMtbColt document) {
this.mListener.onDocumentEditRequest(document, availableArts);
}

View File

@ -256,6 +256,7 @@ public class DocInterniEditFormActivity extends BaseActivity implements DocInter
.setSaveOnImeDone(true)
.setPartitaMag(row.getPartitaMag())
.setDataScad(row.getDataScad())
.setCanInputZeroQuantity(true)
.setCanOverflowOrderQuantity(false)
.setCanLUBeClosed(false)
.setNotesAllowed(true)

View File

@ -245,20 +245,32 @@ public class DocInterniEditFormViewModel {
private void initCheckFornitore() {
SqlMtbColt doc = this.document.getValue();
if (doc == null)
return;
boolean isCheckPartitaMag = false;
if (doc != null && this.checkFornitoreRules != null) {
String key = doc.getCodAnag();
if (doc.getCodVdes() != null && !doc.getCodVdes().isEmpty()) {
key += "-" + doc.getCodVdes();
}
try {
if (this.checkFornitoreRules.has(key) && ((String) ((JSONObject) this.checkFornitoreRules.get(key)).get(doc.getCodDtipProvv())).equalsIgnoreCase("check-partitaMag")) {
try {
if (this.checkFornitoreRules != null && this.checkFornitoreRules.has("value")) {
isCheckPartitaMag = this.checkFornitoreRules.getBoolean("value");
} else if (this.checkFornitoreRules != null) {
String key = doc.getCodAnag();
if (doc.getCodVdes() != null && !doc.getCodVdes().isEmpty()) {
key += "-" + doc.getCodVdes();
}
if (this.checkFornitoreRules.has(key) &&
((String) ((JSONObject) this.checkFornitoreRules.get(key))
.get(doc.getCodDtipProvv()))
.equalsIgnoreCase("check-partitaMag")) {
isCheckPartitaMag = true;
}
} catch (Exception ignored) {
}
} catch (JSONException e) {
this.sendError(e);
}
this.isCheckPartitaMag = isCheckPartitaMag;
}

View File

@ -214,6 +214,7 @@ public class PickingInventarioActivity extends BaseActivity implements PickingIn
.setTotalQtaToBeTaken(totalQtaToBeTaken)
.setTotalNumCnfToBeTaken(totalNumCnfToBeTaken)
.setQtaCnfToBeTaken(qtaCnfToBeTaken)
.setCanInputZeroQuantity(true)
.setCanOverflowOrderQuantity(canOverflowOrderQuantity)
.setCanPartitaMagBeChanged(canPartitaMagBeChanged)
.setCanLUBeClosed(canLUBeClosed)

View File

@ -33,6 +33,7 @@ public class DialogInputQuantityV2DTO {
private BigDecimal totalNumCnfAvailable;
private BigDecimal qtaCnfAvailable;
private boolean canInputZeroQuantity = false;
private boolean canPartitaMagBeChanged = true;
private boolean isDataScadMandatory = false;
private boolean isNotesAllowed = false;
@ -214,6 +215,15 @@ public class DialogInputQuantityV2DTO {
return this;
}
public boolean isCanInputZeroQuantity() {
return canInputZeroQuantity;
}
public DialogInputQuantityV2DTO setCanInputZeroQuantity(boolean canInputZeroQuantity) {
this.canInputZeroQuantity = canInputZeroQuantity;
return this;
}
public boolean isCanPartitaMagBeChanged() {
return canPartitaMagBeChanged;
}

View File

@ -165,6 +165,7 @@ public class DialogInputQuantityV2View extends BaseDialogFragment implements Dia
.setQtaCnfToBeTaken(mDialogInputQuantityV2DTO.getQtaCnfToBeTaken())
.setTotalNumCnfAvailable(mDialogInputQuantityV2DTO.getTotalNumCnfAvailable())
.setTotalQtaAvailable(mDialogInputQuantityV2DTO.getTotalQtaAvailable())
.setCanInputZeroQuantity(mDialogInputQuantityV2DTO.isCanInputZeroQuantity())
.setCanOverflowOrderQuantity(mDialogInputQuantityV2DTO.isCanOverflowOrderQuantity())
.setQtaCnfAvailable(mDialogInputQuantityV2DTO.getQtaCnfAvailable())
.setPartitaMag(mDialogInputQuantityV2DTO.getPartitaMag())

View File

@ -72,6 +72,7 @@ public class DialogInputQuantityV2ViewModel {
private RunnableArgsWithReturn<DialogInputQuantityV2ViewModel, String> suggestPartitaMagRunnable;
private boolean canInputZeroQuantity;
private boolean canOverflowOrderQuantity;
private boolean canPartitaMagBeChanged;
private int onNumCnfInputChanged;
@ -314,6 +315,11 @@ public class DialogInputQuantityV2ViewModel {
return this;
}
public DialogInputQuantityV2ViewModel setCanInputZeroQuantity(boolean canInputZeroQuantity) {
this.canInputZeroQuantity = canInputZeroQuantity;
return this;
}
public DialogInputQuantityV2ViewModel setCanOverflowOrderQuantity(boolean canOverflowOrderQuantity) {
this.canOverflowOrderQuantity = canOverflowOrderQuantity;
return this;
@ -443,8 +449,8 @@ public class DialogInputQuantityV2ViewModel {
this.mListener.onError(new InvalidQtaCnfQuantityException());
return false;
}
if (mtbAart.get().isFlagTracciabilitaBoolean() && UtilityString.isNullOrEmpty(internalPartitaMag)) {
if (suggestPartitaMagRunnable != null) {
internalPartitaMag = suggestPartitaMagRunnable.run(this);
@ -456,54 +462,54 @@ public class DialogInputQuantityV2ViewModel {
this.mListener.onError(new InvalidBatchLotException());
return false;
}
}
if (this.shouldAskDataScad && UtilityString.isNullOrEmpty(internalPartitaMag)) {
this.mListener.onError(new InvalidBatchLotException());
return false;
}
if (this.shouldAskDataScad && this.internalDataScad == null) {
this.mListener.onError(new InvalidExpireDateException());
return false;
}
if (!this.canOverflowOrderQuantity && UtilityBigDecimal.greaterThan(this.internalQtaTot, this.totalQtaOrd) &&
this.mtbAart.get().isFlagQtaCnfFissaBoolean()) {
this.mListener.onError(new OverflowQtaTotOrderedQuantityException());
return false;
}
if (!this.canOverflowOrderQuantity && UtilityBigDecimal.greaterThan(this.internalNumCnf, this.totalNumCnfOrd)) {
this.mListener.onError(new OverflowNumCnfOrderedQuantityException());
return false;
}
if (UtilityBigDecimal.greaterThan(this.internalQtaTot, this.totalQtaAvailable)) {
this.mListener.onError(new OverflowQtaTotAvailableQuantityException());
return false;
}
if (UtilityBigDecimal.greaterThan(this.internalNumCnf, this.totalNumCnfAvailable)) {
this.mListener.onError(new OverflowNumCnfAvailableQuantityException());
return false;
}
if (this.internalNumCnf == null || this.internalQtaCnf == null || this.internalQtaTot == null ||
if (!this.canInputZeroQuantity && (this.internalNumCnf == null || this.internalQtaCnf == null || this.internalQtaTot == null ||
UtilityBigDecimal.equalsOrLowerThan(this.internalNumCnf, BigDecimal.ZERO) ||
UtilityBigDecimal.equalsOrLowerThan(this.internalQtaCnf, BigDecimal.ZERO) ||
UtilityBigDecimal.equalsOrLowerThan(this.internalQtaTot, BigDecimal.ZERO)) {
UtilityBigDecimal.equalsOrLowerThan(this.internalQtaTot, BigDecimal.ZERO))) {
this.mListener.onError(new InvalidQuantityException());
return false;
}
if (this.isNoteMandatory() && (this.internalNote == null || this.internalNote.length() <= 0)) {
this.mListener.onError(new InvalidNotesException());
return false;

View File

@ -3,7 +3,7 @@
buildscript {
ext {
kotlin_version = '1.8.0'
agp_version = '8.1.0-alpha09'
agp_version = '8.1.0-alpha10'
}
repositories {