Completata procedura di recupero materiale da produzione.
This commit is contained in:
parent
eb3f19cb2e
commit
baf23c37e4
@ -310,8 +310,8 @@ public class PickingResiActivity extends BaseActivity implements IOnColloClosedC
|
||||
.setSerDoc(item.getSerDoc())
|
||||
.setNumDoc(item.getNumDoc())
|
||||
.setDataDoc(item.getDataDocS())
|
||||
.setIdRigaDoc(item.getIdRiga())
|
||||
.setCodJcom(item.getCodJcom());
|
||||
.setIdRigaDoc(item.getIdRiga());
|
||||
// .setCodJcom(item.getCodJcom());
|
||||
|
||||
|
||||
|
||||
|
||||
@ -18,7 +18,8 @@ import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityString;
|
||||
import it.integry.integrywmsnative.databinding.ProdRecuperoMaterialeListHeaderBinding;
|
||||
import it.integry.integrywmsnative.databinding.ProdRecuperoMaterialeListItemBinding;
|
||||
import it.integry.integrywmsnative.gest.prod_recupero_materiale.dto.HistoryVersamentoProdUL;
|
||||
import it.integry.integrywmsnative.gest.prod_recupero_materiale.dto.HistoryVersamentoProdULDTO;
|
||||
import it.integry.integrywmsnative.gest.prod_recupero_materiale.dto.HistoryVersamentoProdULDTO;
|
||||
import it.integry.integrywmsnative.ui.fastscroll.SectionTitleProvider;
|
||||
|
||||
public class HistoryULsListAdapter extends SectionedRecyclerViewAdapter<HistoryULsListAdapter.SubheaderHolder,HistoryULsListAdapter.SingleItemViewHolder> implements SectionTitleProvider {
|
||||
@ -26,12 +27,12 @@ public class HistoryULsListAdapter extends SectionedRecyclerViewAdapter<HistoryU
|
||||
|
||||
private Context mContext;
|
||||
|
||||
private List<HistoryVersamentoProdUL> mOriginalDataset;
|
||||
private List<HistoryVersamentoProdUL> mDataset;
|
||||
private List<HistoryVersamentoProdULDTO> mOriginalDataset;
|
||||
private List<HistoryVersamentoProdULDTO> mDataset;
|
||||
private View mEmptyView;
|
||||
|
||||
|
||||
private RunnableArgs<HistoryVersamentoProdUL> mOnItemClicked;
|
||||
private RunnableArgs<HistoryVersamentoProdULDTO> mOnItemClicked;
|
||||
|
||||
static class SubheaderHolder extends RecyclerView.ViewHolder {
|
||||
|
||||
@ -56,18 +57,18 @@ public class HistoryULsListAdapter extends SectionedRecyclerViewAdapter<HistoryU
|
||||
|
||||
|
||||
|
||||
public HistoryULsListAdapter(Context context, List<HistoryVersamentoProdUL> myDataset, View emptyView) {
|
||||
public HistoryULsListAdapter(Context context, List<HistoryVersamentoProdULDTO> myDataset, View emptyView) {
|
||||
mContext = context;
|
||||
mOriginalDataset = myDataset;
|
||||
mEmptyView = emptyView;
|
||||
mDataset = orderItems(myDataset);
|
||||
}
|
||||
|
||||
public void setOnItemClicked(RunnableArgs<HistoryVersamentoProdUL> onItemClicked) {
|
||||
public void setOnItemClicked(RunnableArgs<HistoryVersamentoProdULDTO> onItemClicked) {
|
||||
this.mOnItemClicked = onItemClicked;
|
||||
}
|
||||
|
||||
public void updateItems(List<HistoryVersamentoProdUL> updatedDataset) {
|
||||
public void updateItems(List<HistoryVersamentoProdULDTO> updatedDataset) {
|
||||
mDataset.clear();
|
||||
mDataset.addAll(orderItems(updatedDataset));
|
||||
notifyDataChanged();
|
||||
@ -76,9 +77,9 @@ public class HistoryULsListAdapter extends SectionedRecyclerViewAdapter<HistoryU
|
||||
}
|
||||
|
||||
|
||||
private List<HistoryVersamentoProdUL> orderItems(List<HistoryVersamentoProdUL> dataset) {
|
||||
private List<HistoryVersamentoProdULDTO> orderItems(List<HistoryVersamentoProdULDTO> dataset) {
|
||||
return Stream.of(dataset)
|
||||
.sortBy(HistoryVersamentoProdUL::getCodJfas)
|
||||
.sortBy(HistoryVersamentoProdULDTO::getCodJfas)
|
||||
.toList();
|
||||
|
||||
}
|
||||
@ -109,7 +110,7 @@ public class HistoryULsListAdapter extends SectionedRecyclerViewAdapter<HistoryU
|
||||
|
||||
@Override
|
||||
public void onBindItemViewHolder(SingleItemViewHolder h, int itemPosition) {
|
||||
final HistoryVersamentoProdUL ul = mDataset.get(itemPosition);
|
||||
final HistoryVersamentoProdULDTO ul = mDataset.get(itemPosition);
|
||||
final SingleItemViewHolder holder = h;
|
||||
|
||||
|
||||
|
||||
@ -6,7 +6,9 @@ import com.annimon.stream.Stream;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
|
||||
import java.lang.reflect.Type;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import it.integry.integrywmsnative.core.model.MtbAart;
|
||||
@ -14,7 +16,8 @@ import it.integry.integrywmsnative.core.rest.consumers.ArticoloRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.ISimpleOperationCallback;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.SystemRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
import it.integry.integrywmsnative.gest.prod_recupero_materiale.dto.HistoryVersamentoProdUL;
|
||||
import it.integry.integrywmsnative.gest.prod_recupero_materiale.dto.HistoryVersamentoProdULDTO;
|
||||
import it.integry.integrywmsnative.gest.prod_recupero_materiale.dto.HistoryVersamentoProdULRestDTO;
|
||||
|
||||
public class ProdRecuperoMaterialeHelper {
|
||||
|
||||
@ -26,7 +29,7 @@ public class ProdRecuperoMaterialeHelper {
|
||||
}
|
||||
|
||||
|
||||
public void loadLastULVersate(RunnableArgs<List<HistoryVersamentoProdUL>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
public void loadLastULVersate(RunnableArgs<List<HistoryVersamentoProdULDTO>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
|
||||
String sql = "SELECT jtb_fasi.cod_jfas, " +
|
||||
" jtb_fasi.descrizione AS descrizione_fase, " +
|
||||
@ -49,15 +52,25 @@ public class ProdRecuperoMaterialeHelper {
|
||||
" mtb_colt.segno, " +
|
||||
" ISNULL(mtb_aart.descrizione_estesa, mtb_aart.descrizione) AS descrizione_art, " +
|
||||
" mtb_aart.unt_mis, " +
|
||||
"MAX(datetime_row) AS datetime_row " +
|
||||
" MAX(datetime_row) AS datetime_row, " +
|
||||
" dtb_ord_steps.num_ord, " +
|
||||
" dtb_ord_steps.data_ord, " +
|
||||
" dtb_ord_steps.gestione as gestione_ord, " +
|
||||
" dtb_ord_steps.hr_num as hr, " +
|
||||
" mtb_colr.riga_ord, " +
|
||||
" CONVERT(INTEGER, ROUND((CAST(dtb_ord_steps.hr_num AS DECIMAL(20, 5)) / SUM(dtb_ord_steps.hr_num) OVER (PARTITION BY mtb_colr.num_collo)) * 100, 0)) as percentage_hr " +
|
||||
"FROM mtb_colr " +
|
||||
"INNER JOIN mtb_colt " +
|
||||
"ON mtb_colr.num_collo = mtb_colt.num_collo " +
|
||||
"INNER JOIN mtb_colt ON mtb_colr.num_collo = mtb_colt.num_collo " +
|
||||
"AND mtb_colr.data_collo = mtb_colt.data_collo " +
|
||||
"AND mtb_colr.ser_collo = mtb_colt.ser_collo " +
|
||||
"AND mtb_colr.gestione = mtb_colt.gestione " +
|
||||
"INNER JOIN mtb_aart " +
|
||||
"ON mtb_colr.cod_mart = mtb_aart.cod_mart " +
|
||||
" " +
|
||||
"INNER JOIN dtb_ord_steps ON dtb_ord_steps.data_ord = mtb_colr.data_ord " +
|
||||
" AND dtb_ord_steps.gestione = mtb_colr.gestione " +
|
||||
" AND dtb_ord_steps.num_ord = mtb_colr.num_ord " +
|
||||
" AND dtb_ord_steps.data_iniz is not null " +
|
||||
" AND dtb_ord_steps.data_fine is null " +
|
||||
"INNER JOIN mtb_aart ON mtb_colr.cod_mart = mtb_aart.cod_mart " +
|
||||
"LEFT OUTER JOIN jtb_fasi ON mtb_colt.cod_jfas = jtb_fasi.cod_jfas " +
|
||||
"WHERE jtb_fasi.cod_jfas IS NOT NULL " +
|
||||
" AND segno = -1 " +
|
||||
@ -81,18 +94,98 @@ public class ProdRecuperoMaterialeHelper {
|
||||
" mtb_colr.data_collo_rif, " +
|
||||
" mtb_colr.ser_collo_rif, " +
|
||||
" mtb_colr.gestione_rif, " +
|
||||
"mtb_colt.segno " +
|
||||
" mtb_colt.segno, " +
|
||||
" dtb_ord_steps.num_ord, " +
|
||||
" dtb_ord_steps.data_ord, " +
|
||||
" dtb_ord_steps.gestione, " +
|
||||
" mtb_colr.riga_ord, " +
|
||||
" dtb_ord_steps.hr_num " +
|
||||
"HAVING SUM(mtb_colr.qta_col) > 0 " +
|
||||
"ORDER BY data_collo DESC";
|
||||
|
||||
Type typeOfObjectsList = new TypeToken<ArrayList<HistoryVersamentoProdUL>>() {}.getType();
|
||||
SystemRESTConsumer.processSql(sql, typeOfObjectsList, new ISimpleOperationCallback<List<HistoryVersamentoProdUL>>() {
|
||||
Type typeOfObjectsList = new TypeToken<ArrayList<HistoryVersamentoProdULRestDTO>>() {}.getType();
|
||||
SystemRESTConsumer.processSql(sql, typeOfObjectsList, new ISimpleOperationCallback<List<HistoryVersamentoProdULRestDTO>>() {
|
||||
@Override
|
||||
public void onSuccess(List<HistoryVersamentoProdUL> ulList) {
|
||||
public void onSuccess(List<HistoryVersamentoProdULRestDTO> ulList) {
|
||||
|
||||
if(ulList != null && ulList.size() > 0){
|
||||
List<String> codMarts = Stream.of(ulList)
|
||||
.map(HistoryVersamentoProdUL::getCodMart)
|
||||
if(ulList == null) {
|
||||
onComplete.run(null);
|
||||
return;
|
||||
}
|
||||
|
||||
List<HistoryVersamentoProdULDTO> newUlList = new ArrayList<>();
|
||||
|
||||
Stream.of(ulList)
|
||||
.distinctBy(x -> {
|
||||
HashMap<String, Object> hashMap = new HashMap<>();
|
||||
hashMap.put("gestione", x.getGestione());
|
||||
hashMap.put("data_collo", x.getDataCollo());
|
||||
hashMap.put("ser_collo", x.getSerCollo());
|
||||
hashMap.put("num_collo", x.getNumCollo());
|
||||
hashMap.put("cod_mart", x.getCodMart());
|
||||
hashMap.put("gestione_rif", x.getGestioneRif());
|
||||
hashMap.put("data_collo_rif", x.getDataColloRif());
|
||||
hashMap.put("ser_collo_rif", x.getSerColloRif());
|
||||
hashMap.put("num_collo_rif", x.getNumColloRif());
|
||||
|
||||
return hashMap;
|
||||
})
|
||||
.forEach(restDTO -> {
|
||||
|
||||
List<HistoryVersamentoProdULDTO.OrdineDto> ordineList = Stream.of(ulList)
|
||||
.filter(x -> x.getNumCollo().equals(restDTO.getNumCollo()) &&
|
||||
x.getDataCollo().equals(restDTO.getDataCollo()) &&
|
||||
x.getSerCollo().equals(restDTO.getSerCollo()) &&
|
||||
x.getGestione().equals(restDTO.getGestione()))
|
||||
.map(x -> new HistoryVersamentoProdULDTO.OrdineDto()
|
||||
.setData(x.getDataOrdD())
|
||||
.setNumero(x.getNumOrd())
|
||||
.setGestione(x.getGestioneOrd())
|
||||
.setRigaOrd(x.getRigaOrd())
|
||||
.setQtaCol(x.getQtaCol())
|
||||
.setNumCnf(x.getNumCnf())
|
||||
.setPercentageHr(x.getPercentageHr()))
|
||||
.toList();
|
||||
|
||||
BigDecimal qtaColTot = BigDecimal.ZERO;
|
||||
BigDecimal numCnfColTot = BigDecimal.ZERO;
|
||||
|
||||
for (HistoryVersamentoProdULDTO.OrdineDto ordine :
|
||||
ordineList) {
|
||||
qtaColTot = qtaColTot.add(ordine.getQtaCol());
|
||||
numCnfColTot = numCnfColTot.add(ordine.getNumCnf());
|
||||
}
|
||||
|
||||
newUlList.add(new HistoryVersamentoProdULDTO()
|
||||
.setGestione(restDTO.getGestione())
|
||||
.setDataCollo(restDTO.getDataCollo())
|
||||
.setSerCollo(restDTO.getSerCollo())
|
||||
.setNumCollo(restDTO.getNumCollo())
|
||||
.setSegno(restDTO.getSegno())
|
||||
.setCodMart(restDTO.getCodMart())
|
||||
.setCodCol(restDTO.getCodCol())
|
||||
.setCodTagl(restDTO.getCodTagl())
|
||||
.setCodJfas(restDTO.getCodJfas())
|
||||
.setDescrizioneFase(restDTO.getDescrizioneFase())
|
||||
.setQtaCol(qtaColTot)
|
||||
.setNumCnf(numCnfColTot)
|
||||
.setPartitaMag(restDTO.getPartitaMag())
|
||||
.setCodJcom(restDTO.getCodJcom())
|
||||
.setDatetimeRow(restDTO.getDatetimeRow())
|
||||
.setUntMis(restDTO.getUntMis())
|
||||
.setGestioneRif(restDTO.getGestioneRif())
|
||||
.setDataColloRif(restDTO.getDataColloRif())
|
||||
.setSerColloRif(restDTO.getSerColloRif())
|
||||
.setNumColloRif(restDTO.getNumColloRif())
|
||||
.setOrdini(ordineList));
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
if(newUlList.size() > 0){
|
||||
List<String> codMarts = Stream.of(newUlList)
|
||||
.map(HistoryVersamentoProdULDTO::getCodMart)
|
||||
.withoutNulls()
|
||||
.distinct()
|
||||
.toList();
|
||||
@ -100,7 +193,7 @@ public class ProdRecuperoMaterialeHelper {
|
||||
ArticoloRESTConsumer.getByCodMart(codMarts, arts -> {
|
||||
|
||||
if(arts != null && arts.size() > 0) {
|
||||
for (HistoryVersamentoProdUL value : ulList) {
|
||||
for (HistoryVersamentoProdULDTO value : newUlList) {
|
||||
|
||||
MtbAart foundMtbAart = null;
|
||||
|
||||
@ -113,15 +206,14 @@ public class ProdRecuperoMaterialeHelper {
|
||||
|
||||
value.setMtbAart(foundMtbAart);
|
||||
}
|
||||
|
||||
|
||||
onComplete.run(ulList);
|
||||
}
|
||||
|
||||
onComplete.run(newUlList);
|
||||
|
||||
}, onFailed);
|
||||
|
||||
} else {
|
||||
onComplete.run(ulList);
|
||||
onComplete.run(newUlList);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,325 @@
|
||||
package it.integry.integrywmsnative.gest.prod_recupero_materiale.dto;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import it.integry.integrywmsnative.core.model.MtbAart;
|
||||
|
||||
public class HistoryVersamentoProdULDTO {
|
||||
|
||||
private String gestione;
|
||||
private String dataCollo;
|
||||
private String serCollo;
|
||||
private Integer numCollo;
|
||||
private String segno;
|
||||
private String codMart;
|
||||
private String codCol;
|
||||
private String codTagl;
|
||||
private String codJfas;
|
||||
private String descrizioneFase;
|
||||
private BigDecimal qtaCol;
|
||||
private BigDecimal numCnf;
|
||||
private String partitaMag;
|
||||
private String codJcom;
|
||||
private String datetimeRow;
|
||||
private String descrizioneArt;
|
||||
private String untMis;
|
||||
private String gestioneRif;
|
||||
private String dataColloRif;
|
||||
private String serColloRif;
|
||||
private Integer numColloRif;
|
||||
|
||||
private List<HistoryVersamentoProdULDTO.OrdineDto> ordini;
|
||||
|
||||
private MtbAart mtbAart;
|
||||
|
||||
public BigDecimal getQtaCnf() {
|
||||
return qtaCol.divide(numCnf, 3, RoundingMode.HALF_EVEN);
|
||||
}
|
||||
|
||||
public String getGestione() {
|
||||
return gestione;
|
||||
}
|
||||
|
||||
public HistoryVersamentoProdULDTO setGestione(String gestione) {
|
||||
this.gestione = gestione;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getDataCollo() {
|
||||
return dataCollo;
|
||||
}
|
||||
|
||||
public HistoryVersamentoProdULDTO setDataCollo(String dataCollo) {
|
||||
this.dataCollo = dataCollo;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getSerCollo() {
|
||||
return serCollo;
|
||||
}
|
||||
|
||||
public HistoryVersamentoProdULDTO setSerCollo(String serCollo) {
|
||||
this.serCollo = serCollo;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Integer getNumCollo() {
|
||||
return numCollo;
|
||||
}
|
||||
|
||||
public HistoryVersamentoProdULDTO setNumCollo(Integer numCollo) {
|
||||
this.numCollo = numCollo;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getSegno() {
|
||||
return segno;
|
||||
}
|
||||
|
||||
public HistoryVersamentoProdULDTO setSegno(String segno) {
|
||||
this.segno = segno;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getCodMart() {
|
||||
return codMart;
|
||||
}
|
||||
|
||||
public HistoryVersamentoProdULDTO setCodMart(String codMart) {
|
||||
this.codMart = codMart;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getCodCol() {
|
||||
return codCol;
|
||||
}
|
||||
|
||||
public HistoryVersamentoProdULDTO setCodCol(String codCol) {
|
||||
this.codCol = codCol;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getCodTagl() {
|
||||
return codTagl;
|
||||
}
|
||||
|
||||
public HistoryVersamentoProdULDTO setCodTagl(String codTagl) {
|
||||
this.codTagl = codTagl;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getCodJfas() {
|
||||
return codJfas;
|
||||
}
|
||||
|
||||
public HistoryVersamentoProdULDTO setCodJfas(String codJfas) {
|
||||
this.codJfas = codJfas;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getDescrizioneFase() {
|
||||
return descrizioneFase;
|
||||
}
|
||||
|
||||
public HistoryVersamentoProdULDTO setDescrizioneFase(String descrizioneFase) {
|
||||
this.descrizioneFase = descrizioneFase;
|
||||
return this;
|
||||
}
|
||||
|
||||
public BigDecimal getQtaCol() {
|
||||
return qtaCol;
|
||||
}
|
||||
|
||||
public HistoryVersamentoProdULDTO setQtaCol(BigDecimal qtaCol) {
|
||||
this.qtaCol = qtaCol;
|
||||
return this;
|
||||
}
|
||||
|
||||
public BigDecimal getNumCnf() {
|
||||
return numCnf;
|
||||
}
|
||||
|
||||
public HistoryVersamentoProdULDTO setNumCnf(BigDecimal numCnf) {
|
||||
this.numCnf = numCnf;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getPartitaMag() {
|
||||
return partitaMag;
|
||||
}
|
||||
|
||||
public HistoryVersamentoProdULDTO setPartitaMag(String partitaMag) {
|
||||
this.partitaMag = partitaMag;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getCodJcom() {
|
||||
return codJcom;
|
||||
}
|
||||
|
||||
public HistoryVersamentoProdULDTO setCodJcom(String codJcom) {
|
||||
this.codJcom = codJcom;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getDatetimeRow() {
|
||||
return datetimeRow;
|
||||
}
|
||||
|
||||
public HistoryVersamentoProdULDTO setDatetimeRow(String datetimeRow) {
|
||||
this.datetimeRow = datetimeRow;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getDescrizioneArt() {
|
||||
return descrizioneArt;
|
||||
}
|
||||
|
||||
public HistoryVersamentoProdULDTO setDescrizioneArt(String descrizioneArt) {
|
||||
this.descrizioneArt = descrizioneArt;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getUntMis() {
|
||||
return untMis;
|
||||
}
|
||||
|
||||
public HistoryVersamentoProdULDTO setUntMis(String untMis) {
|
||||
this.untMis = untMis;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getGestioneRif() {
|
||||
return gestioneRif;
|
||||
}
|
||||
|
||||
public HistoryVersamentoProdULDTO setGestioneRif(String gestioneRif) {
|
||||
this.gestioneRif = gestioneRif;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getDataColloRif() {
|
||||
return dataColloRif;
|
||||
}
|
||||
|
||||
public HistoryVersamentoProdULDTO setDataColloRif(String dataColloRif) {
|
||||
this.dataColloRif = dataColloRif;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getSerColloRif() {
|
||||
return serColloRif;
|
||||
}
|
||||
|
||||
public HistoryVersamentoProdULDTO setSerColloRif(String serColloRif) {
|
||||
this.serColloRif = serColloRif;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Integer getNumColloRif() {
|
||||
return numColloRif;
|
||||
}
|
||||
|
||||
public HistoryVersamentoProdULDTO setNumColloRif(Integer numColloRif) {
|
||||
this.numColloRif = numColloRif;
|
||||
return this;
|
||||
}
|
||||
|
||||
public List<OrdineDto> getOrdini() {
|
||||
return ordini;
|
||||
}
|
||||
|
||||
public HistoryVersamentoProdULDTO setOrdini(List<OrdineDto> ordini) {
|
||||
this.ordini = ordini;
|
||||
return this;
|
||||
}
|
||||
|
||||
public MtbAart getMtbAart() {
|
||||
return mtbAart;
|
||||
}
|
||||
|
||||
public HistoryVersamentoProdULDTO setMtbAart(MtbAart mtbAart) {
|
||||
this.mtbAart = mtbAart;
|
||||
return this;
|
||||
}
|
||||
|
||||
public static class OrdineDto {
|
||||
private Integer numero;
|
||||
private Date data;
|
||||
private String gestione;
|
||||
private Integer rigaOrd;
|
||||
private BigDecimal qtaCol;
|
||||
private BigDecimal numCnf;
|
||||
private Integer percentageHr;
|
||||
|
||||
public BigDecimal getQtaCnf() {
|
||||
return qtaCol.divide(numCnf, 3, RoundingMode.HALF_EVEN);
|
||||
}
|
||||
|
||||
public Integer getNumero() {
|
||||
return numero;
|
||||
}
|
||||
|
||||
public HistoryVersamentoProdULDTO.OrdineDto setNumero(Integer numero) {
|
||||
this.numero = numero;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Date getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
public HistoryVersamentoProdULDTO.OrdineDto setData(Date data) {
|
||||
this.data = data;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getGestione() {
|
||||
return gestione;
|
||||
}
|
||||
|
||||
public HistoryVersamentoProdULDTO.OrdineDto setGestione(String gestione) {
|
||||
this.gestione = gestione;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Integer getRigaOrd() {
|
||||
return rigaOrd;
|
||||
}
|
||||
|
||||
public OrdineDto setRigaOrd(Integer rigaOrd) {
|
||||
this.rigaOrd = rigaOrd;
|
||||
return this;
|
||||
}
|
||||
|
||||
public BigDecimal getQtaCol() {
|
||||
return qtaCol;
|
||||
}
|
||||
|
||||
public HistoryVersamentoProdULDTO.OrdineDto setQtaCol(BigDecimal qtaCol) {
|
||||
this.qtaCol = qtaCol;
|
||||
return this;
|
||||
}
|
||||
|
||||
public BigDecimal getNumCnf() {
|
||||
return numCnf;
|
||||
}
|
||||
|
||||
public HistoryVersamentoProdULDTO.OrdineDto setNumCnf(BigDecimal numCnf) {
|
||||
this.numCnf = numCnf;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Integer getPercentageHr() {
|
||||
return percentageHr;
|
||||
}
|
||||
|
||||
public OrdineDto setPercentageHr(Integer percentageHr) {
|
||||
this.percentageHr = percentageHr;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,10 +1,12 @@
|
||||
package it.integry.integrywmsnative.gest.prod_recupero_materiale.dto;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
import it.integry.integrywmsnative.core.model.MtbAart;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityDate;
|
||||
|
||||
public class HistoryVersamentoProdUL {
|
||||
public class HistoryVersamentoProdULRestDTO {
|
||||
|
||||
|
||||
private String gestione;
|
||||
@ -29,13 +31,26 @@ public class HistoryVersamentoProdUL {
|
||||
private String serColloRif;
|
||||
private Integer numColloRif;
|
||||
|
||||
private MtbAart mtbAart;
|
||||
private Integer numOrd;
|
||||
private String dataOrd;
|
||||
private String gestioneOrd;
|
||||
private Integer rigaOrd;
|
||||
private Integer percentageHr;
|
||||
|
||||
public Integer getPercentageHr() {
|
||||
return percentageHr;
|
||||
}
|
||||
|
||||
public HistoryVersamentoProdULRestDTO setPercentageHr(Integer percentageHr) {
|
||||
this.percentageHr = percentageHr;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getGestione() {
|
||||
return gestione;
|
||||
}
|
||||
|
||||
public HistoryVersamentoProdUL setGestione(String gestione) {
|
||||
public HistoryVersamentoProdULRestDTO setGestione(String gestione) {
|
||||
this.gestione = gestione;
|
||||
return this;
|
||||
}
|
||||
@ -44,7 +59,7 @@ public class HistoryVersamentoProdUL {
|
||||
return dataCollo;
|
||||
}
|
||||
|
||||
public HistoryVersamentoProdUL setDataCollo(String dataCollo) {
|
||||
public HistoryVersamentoProdULRestDTO setDataCollo(String dataCollo) {
|
||||
this.dataCollo = dataCollo;
|
||||
return this;
|
||||
}
|
||||
@ -53,7 +68,7 @@ public class HistoryVersamentoProdUL {
|
||||
return serCollo;
|
||||
}
|
||||
|
||||
public HistoryVersamentoProdUL setSerCollo(String serCollo) {
|
||||
public HistoryVersamentoProdULRestDTO setSerCollo(String serCollo) {
|
||||
this.serCollo = serCollo;
|
||||
return this;
|
||||
}
|
||||
@ -62,7 +77,7 @@ public class HistoryVersamentoProdUL {
|
||||
return numCollo;
|
||||
}
|
||||
|
||||
public HistoryVersamentoProdUL setNumCollo(Integer numCollo) {
|
||||
public HistoryVersamentoProdULRestDTO setNumCollo(Integer numCollo) {
|
||||
this.numCollo = numCollo;
|
||||
return this;
|
||||
}
|
||||
@ -71,7 +86,7 @@ public class HistoryVersamentoProdUL {
|
||||
return segno;
|
||||
}
|
||||
|
||||
public HistoryVersamentoProdUL setSegno(String segno) {
|
||||
public HistoryVersamentoProdULRestDTO setSegno(String segno) {
|
||||
this.segno = segno;
|
||||
return this;
|
||||
}
|
||||
@ -80,7 +95,7 @@ public class HistoryVersamentoProdUL {
|
||||
return codMart;
|
||||
}
|
||||
|
||||
public HistoryVersamentoProdUL setCodMart(String codMart) {
|
||||
public HistoryVersamentoProdULRestDTO setCodMart(String codMart) {
|
||||
this.codMart = codMart;
|
||||
return this;
|
||||
}
|
||||
@ -89,7 +104,7 @@ public class HistoryVersamentoProdUL {
|
||||
return codCol;
|
||||
}
|
||||
|
||||
public HistoryVersamentoProdUL setCodCol(String codCol) {
|
||||
public HistoryVersamentoProdULRestDTO setCodCol(String codCol) {
|
||||
this.codCol = codCol;
|
||||
return this;
|
||||
}
|
||||
@ -98,7 +113,7 @@ public class HistoryVersamentoProdUL {
|
||||
return codTagl;
|
||||
}
|
||||
|
||||
public HistoryVersamentoProdUL setCodTagl(String codTagl) {
|
||||
public HistoryVersamentoProdULRestDTO setCodTagl(String codTagl) {
|
||||
this.codTagl = codTagl;
|
||||
return this;
|
||||
}
|
||||
@ -107,7 +122,7 @@ public class HistoryVersamentoProdUL {
|
||||
return codJfas;
|
||||
}
|
||||
|
||||
public HistoryVersamentoProdUL setCodJfas(String codJfas) {
|
||||
public HistoryVersamentoProdULRestDTO setCodJfas(String codJfas) {
|
||||
this.codJfas = codJfas;
|
||||
return this;
|
||||
}
|
||||
@ -116,7 +131,7 @@ public class HistoryVersamentoProdUL {
|
||||
return descrizioneFase;
|
||||
}
|
||||
|
||||
public HistoryVersamentoProdUL setDescrizioneFase(String descrizioneFase) {
|
||||
public HistoryVersamentoProdULRestDTO setDescrizioneFase(String descrizioneFase) {
|
||||
this.descrizioneFase = descrizioneFase;
|
||||
return this;
|
||||
}
|
||||
@ -125,7 +140,7 @@ public class HistoryVersamentoProdUL {
|
||||
return qtaCol;
|
||||
}
|
||||
|
||||
public HistoryVersamentoProdUL setQtaCol(BigDecimal qtaCol) {
|
||||
public HistoryVersamentoProdULRestDTO setQtaCol(BigDecimal qtaCol) {
|
||||
this.qtaCol = qtaCol;
|
||||
return this;
|
||||
}
|
||||
@ -134,7 +149,7 @@ public class HistoryVersamentoProdUL {
|
||||
return numCnf;
|
||||
}
|
||||
|
||||
public HistoryVersamentoProdUL setNumCnf(BigDecimal numCnf) {
|
||||
public HistoryVersamentoProdULRestDTO setNumCnf(BigDecimal numCnf) {
|
||||
this.numCnf = numCnf;
|
||||
return this;
|
||||
}
|
||||
@ -143,7 +158,7 @@ public class HistoryVersamentoProdUL {
|
||||
return partitaMag;
|
||||
}
|
||||
|
||||
public HistoryVersamentoProdUL setPartitaMag(String partitaMag) {
|
||||
public HistoryVersamentoProdULRestDTO setPartitaMag(String partitaMag) {
|
||||
this.partitaMag = partitaMag;
|
||||
return this;
|
||||
}
|
||||
@ -152,7 +167,7 @@ public class HistoryVersamentoProdUL {
|
||||
return codJcom;
|
||||
}
|
||||
|
||||
public HistoryVersamentoProdUL setCodJcom(String codJcom) {
|
||||
public HistoryVersamentoProdULRestDTO setCodJcom(String codJcom) {
|
||||
this.codJcom = codJcom;
|
||||
return this;
|
||||
}
|
||||
@ -161,7 +176,7 @@ public class HistoryVersamentoProdUL {
|
||||
return datetimeRow;
|
||||
}
|
||||
|
||||
public HistoryVersamentoProdUL setDatetimeRow(String datetimeRow) {
|
||||
public HistoryVersamentoProdULRestDTO setDatetimeRow(String datetimeRow) {
|
||||
this.datetimeRow = datetimeRow;
|
||||
return this;
|
||||
}
|
||||
@ -170,7 +185,7 @@ public class HistoryVersamentoProdUL {
|
||||
return descrizioneArt;
|
||||
}
|
||||
|
||||
public HistoryVersamentoProdUL setDescrizioneArt(String descrizioneArt) {
|
||||
public HistoryVersamentoProdULRestDTO setDescrizioneArt(String descrizioneArt) {
|
||||
this.descrizioneArt = descrizioneArt;
|
||||
return this;
|
||||
}
|
||||
@ -179,7 +194,7 @@ public class HistoryVersamentoProdUL {
|
||||
return untMis;
|
||||
}
|
||||
|
||||
public HistoryVersamentoProdUL setUntMis(String untMis) {
|
||||
public HistoryVersamentoProdULRestDTO setUntMis(String untMis) {
|
||||
this.untMis = untMis;
|
||||
return this;
|
||||
}
|
||||
@ -188,7 +203,7 @@ public class HistoryVersamentoProdUL {
|
||||
return gestioneRif;
|
||||
}
|
||||
|
||||
public HistoryVersamentoProdUL setGestioneRif(String gestioneRif) {
|
||||
public HistoryVersamentoProdULRestDTO setGestioneRif(String gestioneRif) {
|
||||
this.gestioneRif = gestioneRif;
|
||||
return this;
|
||||
}
|
||||
@ -197,7 +212,7 @@ public class HistoryVersamentoProdUL {
|
||||
return dataColloRif;
|
||||
}
|
||||
|
||||
public HistoryVersamentoProdUL setDataColloRif(String dataColloRif) {
|
||||
public HistoryVersamentoProdULRestDTO setDataColloRif(String dataColloRif) {
|
||||
this.dataColloRif = dataColloRif;
|
||||
return this;
|
||||
}
|
||||
@ -206,7 +221,7 @@ public class HistoryVersamentoProdUL {
|
||||
return serColloRif;
|
||||
}
|
||||
|
||||
public HistoryVersamentoProdUL setSerColloRif(String serColloRif) {
|
||||
public HistoryVersamentoProdULRestDTO setSerColloRif(String serColloRif) {
|
||||
this.serColloRif = serColloRif;
|
||||
return this;
|
||||
}
|
||||
@ -215,17 +230,48 @@ public class HistoryVersamentoProdUL {
|
||||
return numColloRif;
|
||||
}
|
||||
|
||||
public HistoryVersamentoProdUL setNumColloRif(Integer numColloRif) {
|
||||
public HistoryVersamentoProdULRestDTO setNumColloRif(Integer numColloRif) {
|
||||
this.numColloRif = numColloRif;
|
||||
return this;
|
||||
}
|
||||
|
||||
public MtbAart getMtbAart() {
|
||||
return mtbAart;
|
||||
public Integer getNumOrd() {
|
||||
return numOrd;
|
||||
}
|
||||
|
||||
public HistoryVersamentoProdUL setMtbAart(MtbAart mtbAart) {
|
||||
this.mtbAart = mtbAart;
|
||||
public HistoryVersamentoProdULRestDTO setNumOrd(Integer numOrd) {
|
||||
this.numOrd = numOrd;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Date getDataOrdD() {
|
||||
return UtilityDate.recognizeDateWithExceptionHandler(getDataOrdS());
|
||||
}
|
||||
|
||||
public String getDataOrdS() {
|
||||
return dataOrd;
|
||||
}
|
||||
|
||||
public HistoryVersamentoProdULRestDTO setDataOrd(String dataOrd) {
|
||||
this.dataOrd = dataOrd;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Integer getRigaOrd() {
|
||||
return rigaOrd;
|
||||
}
|
||||
|
||||
public HistoryVersamentoProdULRestDTO setRigaOrd(Integer rigaOrd) {
|
||||
this.rigaOrd = rigaOrd;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getGestioneOrd() {
|
||||
return gestioneOrd;
|
||||
}
|
||||
|
||||
public HistoryVersamentoProdULRestDTO setGestioneOrd(String gestioneOrd) {
|
||||
this.gestioneOrd = gestioneOrd;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@ -13,6 +13,7 @@ import com.annimon.stream.Stream;
|
||||
import com.tfb.fbtoast.FBToast;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
@ -36,7 +37,8 @@ import it.integry.integrywmsnative.core.utility.UtilityString;
|
||||
import it.integry.integrywmsnative.databinding.FragmentProdRecuperoMaterialeBinding;
|
||||
import it.integry.integrywmsnative.gest.prod_recupero_materiale.core.HistoryULsListAdapter;
|
||||
import it.integry.integrywmsnative.gest.prod_recupero_materiale.core.ProdRecuperoMaterialeHelper;
|
||||
import it.integry.integrywmsnative.gest.prod_recupero_materiale.dto.HistoryVersamentoProdUL;
|
||||
import it.integry.integrywmsnative.gest.prod_recupero_materiale.dto.HistoryVersamentoProdULDTO;
|
||||
import it.integry.integrywmsnative.gest.prod_recupero_materiale.dto.HistoryVersamentoProdULRestDTO;
|
||||
import it.integry.integrywmsnative.view.dialogs.DialogCommon;
|
||||
import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleMessageHelper;
|
||||
import it.integry.integrywmsnative.view.dialogs.input_quantity.DialogInputQuantity;
|
||||
@ -53,7 +55,7 @@ public class ProdRecuperoMaterialeViewModel {
|
||||
|
||||
|
||||
private HistoryULsListAdapter mAdapter;
|
||||
private List<HistoryVersamentoProdUL> mDataset;
|
||||
private List<HistoryVersamentoProdULDTO> mDataset;
|
||||
|
||||
public ObservableField<MtbColt> mtbColt = new ObservableField<>();
|
||||
|
||||
@ -112,9 +114,9 @@ public class ProdRecuperoMaterialeViewModel {
|
||||
|
||||
if(mtbColt != null) {
|
||||
|
||||
HistoryVersamentoProdUL historyVersamentoProdUL = this.getHistoryElementFromMtbColt(mtbColt);
|
||||
if(historyVersamentoProdUL != null) {
|
||||
this.dispatchItem(historyVersamentoProdUL, mtbColt, progressDialog);
|
||||
HistoryVersamentoProdULDTO historyVersamentoProdULRestDTO = this.getHistoryElementFromMtbColt(mtbColt);
|
||||
if(historyVersamentoProdULRestDTO != null) {
|
||||
this.dispatchItem(historyVersamentoProdULRestDTO, mtbColt, progressDialog);
|
||||
} else {
|
||||
DialogCommon.showNoULFound(mContext, () -> {
|
||||
BarcodeManager.enable();
|
||||
@ -136,8 +138,8 @@ public class ProdRecuperoMaterialeViewModel {
|
||||
}
|
||||
|
||||
|
||||
private HistoryVersamentoProdUL getHistoryElementFromMtbColt(MtbColt mtbColt) {
|
||||
List<HistoryVersamentoProdUL> filteredItems = Stream.of(mDataset)
|
||||
private HistoryVersamentoProdULDTO getHistoryElementFromMtbColt(MtbColt mtbColt) {
|
||||
List<HistoryVersamentoProdULDTO> filteredItems = Stream.of(mDataset)
|
||||
.filter(x -> Objects.equals(x.getNumColloRif(), mtbColt.getNumCollo()) &&
|
||||
x.getDataColloRif().equals(mtbColt.getDataColloS()) &&
|
||||
x.getSerColloRif().equalsIgnoreCase(mtbColt.getSerCollo()) &&
|
||||
@ -152,7 +154,7 @@ public class ProdRecuperoMaterialeViewModel {
|
||||
}
|
||||
|
||||
|
||||
private void dispatchItem(HistoryVersamentoProdUL item, MtbColt sourceMtbColt, Dialog dialogProgress) {
|
||||
private void dispatchItem(HistoryVersamentoProdULDTO item, MtbColt sourceMtbColt, Dialog dialogProgress) {
|
||||
BigDecimal qtaDaEvadere = BigDecimal.ZERO;
|
||||
|
||||
qtaDaEvadere = qtaDaEvadere.add(item.getQtaCol());
|
||||
@ -164,7 +166,9 @@ public class ProdRecuperoMaterialeViewModel {
|
||||
.setQtaOrd(null)
|
||||
.setMtbAart(item.getMtbAart())
|
||||
.setCanPartitaMagBeChanged(false)
|
||||
.setQtaTot(BigDecimal.ONE)
|
||||
.setNumCnf(1)
|
||||
.setQtaCnf(item.getQtaCnf())
|
||||
.setQtaTot(item.getQtaCnf())
|
||||
.setMaxQta(qtaDaEvadere)
|
||||
.setQtaDisponibile(qtaDaEvadere);
|
||||
|
||||
@ -179,7 +183,7 @@ public class ProdRecuperoMaterialeViewModel {
|
||||
|
||||
|
||||
|
||||
private void onItemDispatched(HistoryVersamentoProdUL item, BigDecimal quantity, MtbColt sourceMtbColt, Dialog progress) {
|
||||
private void onItemDispatched(HistoryVersamentoProdULDTO item, BigDecimal quantity, MtbColt sourceMtbColt, Dialog progress) {
|
||||
|
||||
if(progress == null) {
|
||||
progress = UtilityProgress.createDefaultProgressDialog(mContext);
|
||||
@ -193,20 +197,31 @@ public class ProdRecuperoMaterialeViewModel {
|
||||
.setGestione(item.getGestione())
|
||||
.setMtbColr(new ObservableArrayList<>());
|
||||
|
||||
for(HistoryVersamentoProdULDTO.OrdineDto ordine : item.getOrdini()) {
|
||||
BigDecimal qtaCol = quantity.multiply(new BigDecimal(-1).multiply(new BigDecimal(ordine.getPercentageHr()))).divide(new BigDecimal(100), 3, RoundingMode.HALF_EVEN);
|
||||
|
||||
final MtbColr mtbColrScarico = new MtbColr()
|
||||
.setCodMart(item.getCodMart())
|
||||
.setPartitaMag(UtilityString.empty2null(item.getPartitaMag()))
|
||||
.setQtaCol(quantity.multiply(new BigDecimal(-1)))
|
||||
.setQtaCol(qtaCol)
|
||||
.setQtaCnf(ordine.getQtaCnf())
|
||||
.setDescrizione(UtilityString.isNullOrEmpty(item.getMtbAart().getDescrizioneEstesa()) ? item.getMtbAart().getDescrizione() : item.getMtbAart().getDescrizioneEstesa())
|
||||
.setDatetimeRow(UtilityDate.getDateInstance())
|
||||
.setNumColloRif(item.getNumColloRif())
|
||||
.setDataColloRif(item.getDataColloRif())
|
||||
.setGestioneRif(item.getGestioneRif())
|
||||
.setSerColloRif(item.getSerColloRif());
|
||||
.setSerColloRif(item.getSerColloRif())
|
||||
.setDataOrd(ordine.getData())
|
||||
.setNumOrd(ordine.getNumero())
|
||||
.setRigaOrd(ordine.getRigaOrd());
|
||||
|
||||
mtbColrScarico.setOperation(CommonModelConsts.OPERATION.INSERT);
|
||||
mtbColtScarico.setOperation(CommonModelConsts.OPERATION.INSERT_OR_UPDATE);
|
||||
mtbColtScarico.getMtbColr().add(mtbColrScarico);
|
||||
}
|
||||
|
||||
|
||||
|
||||
mtbColtScarico.setOperation(CommonModelConsts.OPERATION.INSERT_OR_UPDATE);
|
||||
|
||||
|
||||
RunnableArgs<MtbColt> saveRunnable = mtbColt -> {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user