Aggiunte qta_proposta e giacenza in system note degli ordini di acquisto pv
This commit is contained in:
parent
d6979289e2
commit
66f58ea20d
@ -19,7 +19,7 @@ import it.integry.integrywmsnative.core.data_store.db.entity.Ordine;
|
||||
import it.integry.integrywmsnative.core.data_store.db.entity.SqlMtbColr;
|
||||
import it.integry.integrywmsnative.core.data_store.db.entity.SqlMtbColt;
|
||||
|
||||
@Database(entities = {ArticoloGriglia.class, Griglia.class, Ordine.class, ArticoloOrdine.class, SqlMtbColt.class, SqlMtbColr.class}, version = 8, exportSchema = false)
|
||||
@Database(entities = {ArticoloGriglia.class, Griglia.class, Ordine.class, ArticoloOrdine.class, SqlMtbColt.class, SqlMtbColr.class}, version = 9, exportSchema = false)
|
||||
@TypeConverters({
|
||||
DateConverter.class,
|
||||
BigDecimalConverter.class
|
||||
|
||||
@ -6,7 +6,10 @@ import androidx.room.ForeignKey;
|
||||
import androidx.room.Index;
|
||||
import androidx.room.PrimaryKey;
|
||||
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.HashMap;
|
||||
|
||||
import it.integry.integrywmsnative.core.utility.UtilityDate;
|
||||
|
||||
@ -202,6 +205,14 @@ public class ArticoloGriglia {
|
||||
this.newNoPromo = newNoPromo;
|
||||
}
|
||||
|
||||
public String generateSystemNote() {
|
||||
HashMap<String, String> pairs = new HashMap<>();
|
||||
pairs.put("qta_proposta", String.valueOf(qtaProposta));
|
||||
pairs.put("giacenza", String.valueOf(giacenza));
|
||||
|
||||
return new JSONObject(pairs).toString();
|
||||
}
|
||||
|
||||
public ArticoloOrdine convertToArticoloOrdine(Ordine ordine) {
|
||||
ArticoloOrdine articolo = new ArticoloOrdine();
|
||||
|
||||
@ -222,6 +233,7 @@ public class ArticoloGriglia {
|
||||
articolo.setQtaPrevistaVendita(BigDecimal.valueOf(this.getQtaPrevistaVendita()));
|
||||
articolo.setQtaProposta(BigDecimal.valueOf(this.getQtaProposta()));
|
||||
articolo.setNewNoPromo(this.isNewNoPromo());
|
||||
articolo.setSystemNote(generateSystemNote());
|
||||
|
||||
articolo.setQtaOrd(0);
|
||||
|
||||
|
||||
@ -70,6 +70,9 @@ public class ArticoloOrdine {
|
||||
@ColumnInfo(name = "new_no_promo")
|
||||
private boolean newNoPromo;
|
||||
|
||||
@ColumnInfo(name = "system_note")
|
||||
private String systemNote;
|
||||
|
||||
@Ignore
|
||||
private int ggScadenza = 0;
|
||||
|
||||
@ -266,4 +269,12 @@ public class ArticoloOrdine {
|
||||
this.bgTint = bgTint;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getSystemNote() {
|
||||
return systemNote;
|
||||
}
|
||||
|
||||
public void setSystemNote(String systemNote) {
|
||||
this.systemNote = systemNote;
|
||||
}
|
||||
}
|
||||
|
||||
@ -56,7 +56,7 @@ public class PVOrdiniAcquistoRESTConsumer extends _BaseRESTConsumer {
|
||||
.groupBy(ArticoloDTO::getCodMart)
|
||||
.forEach(entry -> {
|
||||
|
||||
if(entry.getValue().size() == 1) {
|
||||
if (entry.getValue().size() == 1) {
|
||||
listaArticoli.add(entry.getValue().get(0));
|
||||
} else {
|
||||
for (ArticoloDTO articolo : entry.getValue()) {
|
||||
@ -93,7 +93,7 @@ public class PVOrdiniAcquistoRESTConsumer extends _BaseRESTConsumer {
|
||||
int i = 0;
|
||||
for (ArticoloOrdine art : articoli) {
|
||||
i++;
|
||||
artRows.add(convertArtToDTO(art,i));
|
||||
artRows.add(convertArtToDTO(art, i));
|
||||
}
|
||||
|
||||
ordineDTO.setChiaveGriglia(griglia.getCodAlis());
|
||||
@ -109,9 +109,9 @@ public class PVOrdiniAcquistoRESTConsumer extends _BaseRESTConsumer {
|
||||
.enqueue(new Callback<List<ServiceRESTResponse<DtbOrdt>>>() {
|
||||
@Override
|
||||
public void onResponse(Call<List<ServiceRESTResponse<DtbOrdt>>> call, Response<List<ServiceRESTResponse<DtbOrdt>>> response) {
|
||||
if (response.body() != null && response.body().size() > 0){
|
||||
analyzeListOfAnswers(response, "getArticoliListino", dtoList-> {
|
||||
if (dtoList.size() > 0){
|
||||
if (response.body() != null && response.body().size() > 0) {
|
||||
analyzeListOfAnswers(response, "getArticoliListino", dtoList -> {
|
||||
if (dtoList.size() > 0) {
|
||||
DtbOrdt dto = dtoList.get(0);
|
||||
ordine.setTransmitted(true);
|
||||
ordine.setTransmissionDate(UtilityDate.getDateInstance());
|
||||
@ -120,7 +120,7 @@ public class PVOrdiniAcquistoRESTConsumer extends _BaseRESTConsumer {
|
||||
ordine.setCodMdep(dto.getCodMdep());
|
||||
ordine.setNumOrd(dto.getNumOrd());
|
||||
onSuccess.run(ordine);
|
||||
}else{
|
||||
} else {
|
||||
onFailed.run(new Exception("Nessun ordine generato"));
|
||||
}
|
||||
}, onFailed);
|
||||
@ -128,7 +128,7 @@ public class PVOrdiniAcquistoRESTConsumer extends _BaseRESTConsumer {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<List<ServiceRESTResponse<DtbOrdt>>>call, Throwable t) {
|
||||
public void onFailure(Call<List<ServiceRESTResponse<DtbOrdt>>> call, Throwable t) {
|
||||
Log.e("saveOrdineTerminale_pv", t.toString());
|
||||
UtilityLogger.errorMe(new Exception(t));
|
||||
onFailed.run(new Exception(t));
|
||||
@ -136,7 +136,6 @@ public class PVOrdiniAcquistoRESTConsumer extends _BaseRESTConsumer {
|
||||
});
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
private ArtDTO convertArtToDTO(ArticoloOrdine art, int rigaOrd) {
|
||||
@ -147,6 +146,7 @@ public class PVOrdiniAcquistoRESTConsumer extends _BaseRESTConsumer {
|
||||
dto.setDescrizione(art.getDescrizione());
|
||||
dto.setDataInsD(art.getDataIns());
|
||||
dto.setUntMis(art.getUntMis());
|
||||
dto.setSystemNote(art.getSystemNote());
|
||||
dto.setQta(BigDecimal.valueOf(art.getQtaOrd()));
|
||||
dto.setQtaCnf(BigDecimal.valueOf(art.getQtaCnf()));
|
||||
dto.setColli(BigDecimal.ZERO);
|
||||
|
||||
@ -163,6 +163,7 @@ public class PVOrdineAcquistoEditViewModel {
|
||||
articolo.setMerceDaRic(artGrid.getMerceDaRic());
|
||||
articolo.setNewNoPromo(artGrid.isNewNoPromo());
|
||||
articolo.setFlagQtaMultipla(artGrid.getFlagQtaMultipla());
|
||||
articolo.setSystemNote(artGrid.generateSystemNote());
|
||||
|
||||
onSuccess.run(articolo);
|
||||
} else {
|
||||
|
||||
@ -28,6 +28,8 @@ public class ArtDTO {
|
||||
|
||||
private String dataScad;
|
||||
|
||||
private String systemNote;
|
||||
|
||||
public Integer getRigaOrd() {
|
||||
return rigaOrd;
|
||||
}
|
||||
@ -63,6 +65,7 @@ public class ArtDTO {
|
||||
public String getDataIns() {
|
||||
return dataIns;
|
||||
}
|
||||
|
||||
public Date getDataInsD() {
|
||||
return UtilityDate.recognizeDateWithExceptionHandler(getDataIns());
|
||||
}
|
||||
@ -70,6 +73,7 @@ public class ArtDTO {
|
||||
public void setDataIns(String dataIns) {
|
||||
this.dataIns = dataIns;
|
||||
}
|
||||
|
||||
public void setDataInsD(Date dataIns) {
|
||||
setDataIns(UtilityDate.formatDate(dataIns, UtilityDate.COMMONS_DATE_FORMATS.DMY_TIME_SLASH));
|
||||
}
|
||||
@ -122,6 +126,7 @@ public class ArtDTO {
|
||||
public void setDataScad(String dataScad) {
|
||||
this.dataScad = dataScad;
|
||||
}
|
||||
|
||||
public Date getDataScadD() {
|
||||
return UtilityDate.recognizeDateWithExceptionHandler(getDataScad());
|
||||
}
|
||||
@ -130,5 +135,12 @@ public class ArtDTO {
|
||||
setDataScad(UtilityDate.formatDate(dataScad, UtilityDate.COMMONS_DATE_FORMATS.DMY_TIME_SLASH));
|
||||
}
|
||||
|
||||
public String getSystemNote() {
|
||||
return systemNote;
|
||||
}
|
||||
|
||||
public ArtDTO setSystemNote(String systemNote) {
|
||||
this.systemNote = systemNote;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user