package it.integry.integrywmsnative.gest.prod_versamento_materiale.dto;

import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.Date;

import it.integry.integrywmsnative.core.di.BindableFloat;
import it.integry.integrywmsnative.core.utility.UtilityDate;

public class OrdineLavorazioneDTO {

    private String dataOrdProd;

    private Integer numOrdProd;

    private Integer rigaOrdProd;

    private String flagAvviabile;

    private String untOrd;

    private BigDecimal rapConv;

    private Integer posRiga;

    private BigDecimal numPezzi;

    private BigDecimal numCnf;

    private BigDecimal qtaCnf;

    private Integer ggScadPartita;

    private BigDecimal colliPedana;

    private BigDecimal numPedane;

    private String dataOrd;

    private String flagEvasoProd;

    private String gestione;

    private Integer numOrd;

    private String descrizioneProd;

    private String codJfas;

    private String partitaMag;

    private String dataScad;


    private String partitaMagSuggested;

    private String dataScadSuggested;

    private String codProd;

    private Integer maxStep;

    private String dataInizProd;

    private String dataIniz;

    private String dataFine;

    private BigDecimal qtaProd;

    private BigDecimal qtaTrasferite;

    private String stato;

    private String codTcolUl;

    private String codAnag;

    private String ragSocAnag;

    private String rifOrd;

    private String codVdes;

    private String codMdep;

    private String codJcom;

    private String noteLav;

    private BigDecimal tempoTrascorso;

    private String descCommessa;

    private String dataConsCommessa;

    private BigDecimal prodStd;

    private Object mtbColtToEdit;

    private int hrNum;


    private BindableFloat qtaColVersamento = new BindableFloat();
    private BindableFloat numCnfVersamento = new BindableFloat();

    public String getDataOrdProd() {
        return dataOrdProd;
    }

    public void setDataOrdProd(String dataOrdProd) {
        this.dataOrdProd = dataOrdProd;
    }

    public Integer getNumOrdProd() {
        return numOrdProd;
    }

    public void setNumOrdProd(Integer numOrdProd) {
        this.numOrdProd = numOrdProd;
    }

    public Integer getRigaOrdProd() {
        return rigaOrdProd;
    }

    public void setRigaOrdProd(Integer rigaOrdProd) {
        this.rigaOrdProd = rigaOrdProd;
    }

    public Integer getPosRiga() {
        return posRiga;
    }

    public void setPosRiga(Integer posRiga) {
        this.posRiga = posRiga;
    }

    public String getDataOrd() {
        return dataOrd;
    }

    public Date getDataOrdD() {
        return UtilityDate.recognizeDateWithExceptionHandler(dataOrd);
    }

    public void setDataOrd(String dataOrd) {
        this.dataOrd = dataOrd;
    }

    public String getFlagEvasoProd() {
        return flagEvasoProd;
    }

    public void setFlagEvasoProd(String flagEvasoProd) {
        this.flagEvasoProd = flagEvasoProd;
    }

    public String getGestione() {
        return gestione;
    }

    public void setGestione(String gestione) {
        this.gestione = gestione;
    }

    public Integer getNumOrd() {
        return numOrd;
    }

    public void setNumOrd(Integer numOrd) {
        this.numOrd = numOrd;
    }

    public String getDescrizioneProd() {
        return descrizioneProd;
    }

    public void setDescrizioneProd(String descrizioneProd) {
        this.descrizioneProd = descrizioneProd;
    }

    public String getCodJfas() {
        return codJfas;
    }

    public void setCodJfas(String codJfas) {
        this.codJfas = codJfas;
    }

    public Integer getMaxStep() {
        return maxStep;
    }

    public void setMaxStep(Integer maxStep) {
        this.maxStep = maxStep;
    }

    public String getDataIniz() {
        return dataIniz;
    }

    public Date getDataInizD() {
        return UtilityDate.recognizeDateWithExceptionHandler(getDataIniz());
    }

    public void setDataIniz(String dataIniz) {
        this.dataIniz = dataIniz;
    }

    public String getDataFine() {
        return dataFine;
    }

    public Date getDataFineD() {
        return UtilityDate.recognizeDateWithExceptionHandler(getDataFine());
    }

    public void setDataFine(String dataFine) {
        this.dataFine = dataFine;
    }

    public BigDecimal getQtaProd() {
        return qtaProd;
    }

    public void setQtaProd(BigDecimal qtaProd) {
        this.qtaProd = qtaProd;
    }

    public BigDecimal getQtaTrasferite() {
        return qtaTrasferite;
    }

    public void setQtaTrasferite(BigDecimal qtaTrasferite) {
        this.qtaTrasferite = qtaTrasferite;
    }

    public String getStato() {
        return stato;
    }

    public void setStato(String stato) {
        this.stato = stato;
    }

    public String getUntOrd() {
        return untOrd;
    }

    public void setUntOrd(String untOrd) {
        this.untOrd = untOrd;
    }

    public BigDecimal getRapConv() {
        return rapConv;
    }

    public void setRapConv(BigDecimal rapConv) {
        this.rapConv = rapConv;
    }

    public BigDecimal getNumCnf() {
        return numCnf;
    }

    public void setNumCnf(BigDecimal numCnf) {
        this.numCnf = numCnf;
    }

    public BigDecimal getQtaCnf() {
        return qtaCnf;
    }

    public void setQtaCnf(BigDecimal qtaCnf) {
        this.qtaCnf = qtaCnf;
    }

    public String getPartitaMag() {
        return partitaMag;
    }

    public void setPartitaMag(String partitaMag) {
        this.partitaMag = partitaMag;
    }

    public String getDataScad() {
        return dataScad;
    }

    public Date getDataScadD() {
        return UtilityDate.recognizeDateWithExceptionHandler(getDataScad());
    }

    public void setDataScad(String dataScad) {
        this.dataScad = dataScad;
    }

    public String getPartitaMagSuggested() {
        return partitaMagSuggested;
    }

    public void setPartitaMagSuggested(String partitaMagSuggested) {
        this.partitaMagSuggested = partitaMagSuggested;
    }

    public String getDataScadSuggested() {
        return dataScadSuggested;
    }

    public void setDataScadSuggested(String dataScadSuggested) {
        this.dataScadSuggested = dataScadSuggested;
    }

    public String getCodProd() {
        return codProd;
    }

    public void setCodProd(String codProd) {
        this.codProd = codProd;
    }

    public String getDataInizProd() {
        return dataInizProd;
    }

    public Date getDataInizProdD() {
        return UtilityDate.recognizeDateWithExceptionHandler(getDataInizProd());
    }

    public void setDataInizProd(String dataInizProd) {
        this.dataInizProd = dataInizProd;
    }

    public String getCodTcolUl() {
        return codTcolUl;
    }

    public void setCodTcolUl(String codTcolUl) {
        this.codTcolUl = codTcolUl;
    }

    public String getCodAnag() {
        return codAnag;
    }

    public void setCodAnag(String codAnag) {
        this.codAnag = codAnag;
    }

    public String getRagSocAnag() {
        return ragSocAnag;
    }

    public void setRagSocAnag(String ragSocAnag) {
        this.ragSocAnag = ragSocAnag;
    }

    public String getRifOrd() {
        return rifOrd;
    }

    public void setRifOrd(String rifOrd) {
        this.rifOrd = rifOrd;
    }

    public String getCodVdes() {
        return codVdes;
    }

    public void setCodVdes(String codVdes) {
        this.codVdes = codVdes;
    }

    public String getCodMdep() {
        return codMdep;
    }

    public void setCodMdep(String codMdep) {
        this.codMdep = codMdep;
    }

    public String getCodJcom() {
        return codJcom;
    }

    public void setCodJcom(String codJcom) {
        this.codJcom = codJcom;
    }

    public BigDecimal getColliPedana() {
        return colliPedana;
    }

    public void setColliPedana(BigDecimal colliPedana) {
        this.colliPedana = colliPedana;
    }

    public BigDecimal getTempoTrascorso() {
        return tempoTrascorso;
    }

    public void setTempoTrascorso(BigDecimal tempoTrascorso) {
        this.tempoTrascorso = tempoTrascorso;
    }

    public String getDescCommessa() {
        return descCommessa;
    }

    public void setDescCommessa(String descCommessa) {
        this.descCommessa = descCommessa;
    }

    public BigDecimal getProdStd() {
        return prodStd;
    }

    public void setProdStd(BigDecimal prodStd) {
        this.prodStd = prodStd;
    }

    public String getFlagAvviabile() {
        return flagAvviabile;
    }

    public void setFlagAvviabile(String flagAvviabile) {
        this.flagAvviabile = flagAvviabile;
    }

    public BigDecimal getNumPezzi() {
        return numPezzi;
    }

    public void setNumPezzi(BigDecimal numPezzi) {
        this.numPezzi = numPezzi;
    }

    public BigDecimal getNumPedane() {
        return numPedane;
    }

    public void setNumPedane(BigDecimal numPedane) {
        this.numPedane = numPedane;
    }

    public Object getMtbColtToEdit() {
        return mtbColtToEdit;
    }

    public void setMtbColtToEdit(Object mtbColtToEdit) {
        this.mtbColtToEdit = mtbColtToEdit;
    }

    public Integer getGgScadPartita() {
        return ggScadPartita;
    }

    public void setGgScadPartita(Integer ggScadPartita) {
        this.ggScadPartita = ggScadPartita;
    }

    public String getNoteLav() {
        return noteLav;
    }

    public void setNoteLav(String noteLav) {
        this.noteLav = noteLav;
    }

    public int getHrNum() {
        return hrNum;
    }

    public void setHrNum(int hrNum) {
        this.hrNum = hrNum;
    }

    public BindableFloat getQtaColVersamento() {
        return qtaColVersamento;
    }

    public void setQtaColVersamento(float qtaColVersamento) {
        this.qtaColVersamento.set(qtaColVersamento);
    }

    public BindableFloat getNumCnfVersamento() {
        return numCnfVersamento;
    }

    public void setNumCnfVersamento(float numCnfVersamento) {
        this.numCnfVersamento.set(numCnfVersamento);
    }

    public OrdineLavorazioneStatoEnum getStatoEnum() {
        return OrdineLavorazioneStatoEnum.fromString(getStato());
    }

    public String getDataConsCommessa() {
        return dataConsCommessa;
    }

    public Date getDataConsCommessaD() {
        return UtilityDate.recognizeDateWithExceptionHandler(getDataConsCommessa());
    }

    public void setDataConsCommessa(String dataConsCommessa) {
        this.dataConsCommessa = dataConsCommessa;
    }


    public int getProgress() {

        int progress = 0;
        if (this.getQtaProd().compareTo(BigDecimal.ZERO) > 0) {
            if (this.getQtaTrasferite().compareTo(this.getQtaProd()) > 0) {
                progress = 100;
            } else {
                progress = this.getQtaTrasferite().multiply(BigDecimal.valueOf(100)).divide(this.getQtaProd(), 0, RoundingMode.UP).intValue();
            }
        }

        return progress;
    }

}
