1422 lines
40 KiB
Java
1422 lines
40 KiB
Java
package it.acxent.tex.anag;
|
|
|
|
import it.acxent.anag.Iva;
|
|
import it.acxent.anag.MagFisico;
|
|
import it.acxent.anag._AnagAdapter;
|
|
import it.acxent.art.Articolo;
|
|
import it.acxent.art.ArticoloFornitore;
|
|
import it.acxent.art.ArticoloVariante;
|
|
import it.acxent.art.Tipo;
|
|
import it.acxent.art.TipologiaArticolo;
|
|
import it.acxent.common.SimboliLavaggio;
|
|
import it.acxent.contab.RigaDocumento;
|
|
import it.acxent.db.ApplParmFull;
|
|
import it.acxent.db.ResParm;
|
|
import it.acxent.db.WcString;
|
|
import it.acxent.util.DoubleOperator;
|
|
import it.acxent.util.StringTokenizer;
|
|
import it.acxent.util.Vectumerator;
|
|
import java.io.Serializable;
|
|
import java.sql.Date;
|
|
import java.sql.PreparedStatement;
|
|
import java.sql.ResultSet;
|
|
import java.sql.SQLException;
|
|
import java.text.NumberFormat;
|
|
import java.util.HashMap;
|
|
import java.util.Locale;
|
|
import java.util.Set;
|
|
|
|
public class ArticoloTessuto extends _AnagAdapter implements Serializable {
|
|
private static final long serialVersionUID = 1468228166614L;
|
|
|
|
public static final long TINTO_FILO = 0L;
|
|
|
|
public static final long TINTO_PEZZA = 1L;
|
|
|
|
public static final long TIPO_TESSUTO_MAGLIERIA = 0L;
|
|
|
|
public static final long TIPO_TESSUTO_NAVETTA = 1L;
|
|
|
|
public static final long TIPO_TESSUTO_M_GREGGIO_O_TINTO = 0L;
|
|
|
|
public static final long TIPO_TESSUTO_M_FINITO = 1L;
|
|
|
|
public static final long TIPO_TESSUTO_M_ACCOPPIATO = 2L;
|
|
|
|
public static final long TIPO_TESSUTO_M_LASERATO = 3L;
|
|
|
|
public static final long TIPO_TESSUTO_M_NON_ACCOPPIATO = -2L;
|
|
|
|
private ComposizioneResult composizioneATF;
|
|
|
|
private long id_iva;
|
|
|
|
private long id_stagione;
|
|
|
|
private String descrizione;
|
|
|
|
private long flgStato;
|
|
|
|
private long altezzaMin;
|
|
|
|
private long altezzaMax;
|
|
|
|
private long lunghezzaFinita;
|
|
|
|
private double pesoMin;
|
|
|
|
private double pesoMax;
|
|
|
|
private double pesoMq;
|
|
|
|
private long lavaggio;
|
|
|
|
private long candeggio;
|
|
|
|
private long stiratura;
|
|
|
|
private long asciugatura;
|
|
|
|
private long pulituraSecco;
|
|
|
|
private String codiceDoganale;
|
|
|
|
private long flgUdm;
|
|
|
|
private double prezzoBase;
|
|
|
|
private Iva iva;
|
|
|
|
private Stagione stagione;
|
|
|
|
private SimboliLavaggio simboliLavaggio;
|
|
|
|
private long altezzaGreggia;
|
|
|
|
private double altezzaPettine;
|
|
|
|
private Armatura armatura;
|
|
|
|
private double caloOrdito;
|
|
|
|
private double caloTrama;
|
|
|
|
private Date dataUltimoPrezzoAcquisto;
|
|
|
|
private long colpiFiniti;
|
|
|
|
private long colpiSpecchio;
|
|
|
|
private long colpiTelaio;
|
|
|
|
private long filiCimosse;
|
|
|
|
private long filiOrdito;
|
|
|
|
private long flgAccoppiato;
|
|
|
|
private long flgAcquistato;
|
|
|
|
private long flgJaquard;
|
|
|
|
private long flgTintoFiloPezza;
|
|
|
|
private long id_armatura;
|
|
|
|
private long id_articoloTessuto;
|
|
|
|
private long id_rincorso;
|
|
|
|
private long impettinatura;
|
|
|
|
private long licci1;
|
|
|
|
private long licci2;
|
|
|
|
private long lunghezzaGreggia;
|
|
|
|
private long mtOrdito;
|
|
|
|
private double pesoGreggio;
|
|
|
|
private long pettine;
|
|
|
|
private long pezzaPerTela;
|
|
|
|
private Rincorso rincorso;
|
|
|
|
private String serie;
|
|
|
|
private long tipoPettine;
|
|
|
|
private long flgTipoAT;
|
|
|
|
private long flgTipoTessutoM;
|
|
|
|
private long id_articoloTessutoPadre;
|
|
|
|
private ArticoloTessuto articoloTessutoPadre;
|
|
|
|
private ArticoloTessutoColore articoloTessutoColore;
|
|
|
|
private long id_tipo;
|
|
|
|
private Tipo tipo;
|
|
|
|
private double quantita;
|
|
|
|
private boolean quantitaCalcolate;
|
|
|
|
private double quantitaData;
|
|
|
|
private boolean quantitaDataCalcolate = false;
|
|
|
|
private double quantitaEffettiva;
|
|
|
|
private double quantitaImpegnata;
|
|
|
|
private double quantitaInArrivo;
|
|
|
|
private double quantitaLavorazione;
|
|
|
|
private String quantitaMagazzinoMovimentoHtml;
|
|
|
|
private String codiceAT;
|
|
|
|
private String descLavorazione;
|
|
|
|
private long flgDispo;
|
|
|
|
private long capiPerTelo;
|
|
|
|
private long numTeliMax;
|
|
|
|
private long id_articoloTessutoColore;
|
|
|
|
private double mtLavorazioneTaglio;
|
|
|
|
private String codiciAlternativiAt;
|
|
|
|
private String notaTessuto;
|
|
|
|
private double ultimoPrezzoAcquisto;
|
|
|
|
private double quantitaW;
|
|
|
|
private long id_magFisico;
|
|
|
|
private MagFisico magFisico;
|
|
|
|
private String seriale;
|
|
|
|
public ArticoloTessuto(ApplParmFull newApplParmFull) {
|
|
super(newApplParmFull);
|
|
}
|
|
|
|
public ArticoloTessuto() {}
|
|
|
|
public void setId_articoloTessuto(long newId_articoloTessuto) {
|
|
this.id_articoloTessuto = newId_articoloTessuto;
|
|
}
|
|
|
|
public void setId_iva(long newId_iva) {
|
|
this.id_iva = newId_iva;
|
|
setIva(null);
|
|
}
|
|
|
|
public void setId_stagione(long newId_stagione) {
|
|
this.id_stagione = newId_stagione;
|
|
setStagione(null);
|
|
}
|
|
|
|
public void setFlgStato(long newFlgStato) {
|
|
this.flgStato = newFlgStato;
|
|
}
|
|
|
|
public void setAltezzaMin(long newAltezzaMin) {
|
|
this.altezzaMin = newAltezzaMin;
|
|
}
|
|
|
|
public void setAltezzaMax(long newAltezzaMax) {
|
|
this.altezzaMax = newAltezzaMax;
|
|
}
|
|
|
|
public void setLunghezzaFinita(long newLunghezzaFinita) {
|
|
this.lunghezzaFinita = newLunghezzaFinita;
|
|
}
|
|
|
|
public void setPesoMin(double newPesoMin) {
|
|
this.pesoMin = newPesoMin;
|
|
}
|
|
|
|
public void setPesoMax(double newPesoMax) {
|
|
this.pesoMax = newPesoMax;
|
|
}
|
|
|
|
public void setPesoMq(double newPesoMq) {
|
|
this.pesoMq = newPesoMq;
|
|
}
|
|
|
|
public void setLavaggio(long newLavaggio) {
|
|
this.lavaggio = newLavaggio;
|
|
}
|
|
|
|
public void setCandeggio(long newCandeggio) {
|
|
this.candeggio = newCandeggio;
|
|
}
|
|
|
|
public void setStiratura(long newStiratura) {
|
|
this.stiratura = newStiratura;
|
|
}
|
|
|
|
public void setAsciugatura(long newAsciugatura) {
|
|
this.asciugatura = newAsciugatura;
|
|
}
|
|
|
|
public void setPulituraSecco(long newPulituraSecco) {
|
|
this.pulituraSecco = newPulituraSecco;
|
|
}
|
|
|
|
public void setCodiceDoganale(String newCodiceDoganale) {
|
|
this.codiceDoganale = newCodiceDoganale;
|
|
}
|
|
|
|
public void setFlgUdm(long newFlgUdm) {
|
|
this.flgUdm = newFlgUdm;
|
|
}
|
|
|
|
public void setPrezzoBase(double newPrezzoBase) {
|
|
this.prezzoBase = newPrezzoBase;
|
|
}
|
|
|
|
public long getId_articoloTessuto() {
|
|
return this.id_articoloTessuto;
|
|
}
|
|
|
|
public long getId_iva() {
|
|
return this.id_iva;
|
|
}
|
|
|
|
public long getId_stagione() {
|
|
return this.id_stagione;
|
|
}
|
|
|
|
public long getFlgStato() {
|
|
return this.flgStato;
|
|
}
|
|
|
|
public long getAltezzaMin() {
|
|
return this.altezzaMin;
|
|
}
|
|
|
|
public long getAltezzaMax() {
|
|
return this.altezzaMax;
|
|
}
|
|
|
|
public long getLunghezzaFinita() {
|
|
return this.lunghezzaFinita;
|
|
}
|
|
|
|
public double getPesoMin() {
|
|
return this.pesoMin;
|
|
}
|
|
|
|
public double getPesoMax() {
|
|
return this.pesoMax;
|
|
}
|
|
|
|
public double getPesoMq() {
|
|
return this.pesoMq;
|
|
}
|
|
|
|
public long getLavaggio() {
|
|
return this.lavaggio;
|
|
}
|
|
|
|
public long getCandeggio() {
|
|
return this.candeggio;
|
|
}
|
|
|
|
public long getStiratura() {
|
|
return this.stiratura;
|
|
}
|
|
|
|
public long getAsciugatura() {
|
|
return this.asciugatura;
|
|
}
|
|
|
|
public long getPulituraSecco() {
|
|
return this.pulituraSecco;
|
|
}
|
|
|
|
public String getCodiceDoganale() {
|
|
return (this.codiceDoganale == null) ? "" : this.codiceDoganale.trim();
|
|
}
|
|
|
|
public long getFlgUdm() {
|
|
return this.flgUdm;
|
|
}
|
|
|
|
public double getPrezzoBase() {
|
|
return this.prezzoBase;
|
|
}
|
|
|
|
public void setIva(Iva newIva) {
|
|
this.iva = newIva;
|
|
}
|
|
|
|
public Iva getIva() {
|
|
this.iva = (Iva)getSecondaryObject(this.iva, Iva.class, getId_iva());
|
|
return this.iva;
|
|
}
|
|
|
|
public void setStagione(Stagione newStagione) {
|
|
this.stagione = newStagione;
|
|
}
|
|
|
|
public Stagione getStagione() {
|
|
this.stagione = (Stagione)getSecondaryObject(this.stagione, Stagione.class, getId_stagione());
|
|
return this.stagione;
|
|
}
|
|
|
|
protected ResParm checkDeleteCascade() {
|
|
return new ResParm(true);
|
|
}
|
|
|
|
protected void deleteCascade() {}
|
|
|
|
public Vectumerator<ArticoloTessuto> findByCR(ArticoloTessutoCR CR, int pageNumber, int pageRows) {
|
|
if (CR.getFlgTipoRicerca() == 1L)
|
|
return findByCRSerMagazzino(CR, pageNumber, pageRows);
|
|
if (CR.getFlgTipoRicerca() == 2L)
|
|
return findByCRAv(CR, pageNumber, pageRows);
|
|
String s_Sql_Find = "select A.* from ARTICOLO_TESSUTO AS A";
|
|
String s_Sql_Order = " order by A.codiceAT, A.descrizione";
|
|
WcString wc = new WcString();
|
|
if (!CR.getSearchTxt().trim().isEmpty()) {
|
|
StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(), " ");
|
|
StringBuffer txt = new StringBuffer("(");
|
|
while (st.hasMoreTokens()) {
|
|
String token = st.nextToken();
|
|
txt.append("(A.descrizione like '%" + token + "%' or A.codiceAt like '%" + token + "%' or A.codiciAlternativiAt like '%," + token + ",%')");
|
|
if (st.hasMoreTokens())
|
|
txt.append(" and ");
|
|
}
|
|
txt.append(")");
|
|
wc.addWc(txt.toString());
|
|
}
|
|
if (CR.getFlgTipoTessutoM() < 0L) {
|
|
if (CR.getFlgTipoTessutoM() == -2L)
|
|
wc.addWc("A.flgTipoTessutoM <>2");
|
|
} else if (CR.getFlgTipoTessutoM() == 0L) {
|
|
wc.addWc("(A.flgTipoTessutoM is null or A.flgTipoTessutoM=0)");
|
|
} else if (CR.getFlgTipoTessutoM() > 0L) {
|
|
wc.addWc("A.flgTipoTessutoM =" + CR.getFlgTipoTessutoM());
|
|
}
|
|
if (CR.getId_tipo() > 0L)
|
|
wc.addWc("A.id_tipo=" + CR.getId_tipo());
|
|
try {
|
|
PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString());
|
|
return findRows(stmt, pageNumber, pageRows);
|
|
} catch (SQLException e) {
|
|
removeCPConnection();
|
|
handleDebug(e);
|
|
return AB_EMPTY_VECTUMERATOR;
|
|
}
|
|
}
|
|
|
|
public String getDescrizione() {
|
|
return (this.descrizione == null) ? "" : this.descrizione;
|
|
}
|
|
|
|
public void setDescrizione(String descrizione) {
|
|
this.descrizione = descrizione;
|
|
}
|
|
|
|
public SimboliLavaggio getSimboliLavaggio() {
|
|
if (this.simboliLavaggio == null) {
|
|
this.simboliLavaggio = new SimboliLavaggio();
|
|
this.simboliLavaggio.setAsciugatura(getAsciugatura());
|
|
this.simboliLavaggio.setCandeggio(getCandeggio());
|
|
this.simboliLavaggio.setLavaggio(getLavaggio());
|
|
this.simboliLavaggio.setPulituraSecco(getPulituraSecco());
|
|
this.simboliLavaggio.setStiratura(getStiratura());
|
|
}
|
|
return (this.simboliLavaggio == null) ? new SimboliLavaggio() : this.simboliLavaggio;
|
|
}
|
|
|
|
public void setSimboliLavaggio(SimboliLavaggio simboliLavaggio) {
|
|
this.simboliLavaggio = simboliLavaggio;
|
|
}
|
|
|
|
public String getDescrizioneAltezze() {
|
|
return "" + getAltezzaMin() + "/" + getAltezzaMin();
|
|
}
|
|
|
|
public String getDescrizionePesi() {
|
|
NumberFormat nf = NumberFormat.getInstance();
|
|
nf.setMinimumFractionDigits(2);
|
|
nf.setMaximumFractionDigits(2);
|
|
return nf.format(getPesoMin()) + "/" + nf.format(getPesoMin());
|
|
}
|
|
|
|
public long getAltezzaGreggia() {
|
|
return this.altezzaGreggia;
|
|
}
|
|
|
|
public void setAltezzaGreggia(long altezzaGreggia) {
|
|
this.altezzaGreggia = altezzaGreggia;
|
|
}
|
|
|
|
public double getAltezzaPettine() {
|
|
return this.altezzaPettine;
|
|
}
|
|
|
|
public void setAltezzaPettine(double altezzaPettine) {
|
|
this.altezzaPettine = altezzaPettine;
|
|
}
|
|
|
|
public Armatura getArmatura() {
|
|
return this.armatura;
|
|
}
|
|
|
|
public void setArmatura(Armatura armatura) {
|
|
this.armatura = armatura;
|
|
}
|
|
|
|
public double getCaloOrdito() {
|
|
return this.caloOrdito;
|
|
}
|
|
|
|
public void setCaloOrdito(double caloOrdito) {
|
|
this.caloOrdito = caloOrdito;
|
|
}
|
|
|
|
public double getCaloTrama() {
|
|
return this.caloTrama;
|
|
}
|
|
|
|
public void setCaloTrama(double caloTrama) {
|
|
this.caloTrama = caloTrama;
|
|
}
|
|
|
|
public long getColpiFiniti() {
|
|
return this.colpiFiniti;
|
|
}
|
|
|
|
public void setColpiFiniti(long colpiFiniti) {
|
|
this.colpiFiniti = colpiFiniti;
|
|
}
|
|
|
|
public long getColpiSpecchio() {
|
|
return this.colpiSpecchio;
|
|
}
|
|
|
|
public void setColpiSpecchio(long colpiSpecchio) {
|
|
this.colpiSpecchio = colpiSpecchio;
|
|
}
|
|
|
|
public long getColpiTelaio() {
|
|
return this.colpiTelaio;
|
|
}
|
|
|
|
public void setColpiTelaio(long colpiTelaio) {
|
|
this.colpiTelaio = colpiTelaio;
|
|
}
|
|
|
|
public long getFiliCimosse() {
|
|
return this.filiCimosse;
|
|
}
|
|
|
|
public void setFiliCimosse(long filiCimosse) {
|
|
this.filiCimosse = filiCimosse;
|
|
}
|
|
|
|
public long getFiliOrdito() {
|
|
return this.filiOrdito;
|
|
}
|
|
|
|
public void setFiliOrdito(long filiOrdito) {
|
|
this.filiOrdito = filiOrdito;
|
|
}
|
|
|
|
public long getFlgAccoppiato() {
|
|
return this.flgAccoppiato;
|
|
}
|
|
|
|
public void setFlgAccoppiato(long flgAccoppiato) {
|
|
this.flgAccoppiato = flgAccoppiato;
|
|
}
|
|
|
|
public long getFlgAcquistato() {
|
|
return this.flgAcquistato;
|
|
}
|
|
|
|
public void setFlgAcquistato(long flgAcquistato) {
|
|
this.flgAcquistato = flgAcquistato;
|
|
}
|
|
|
|
public long getFlgJaquard() {
|
|
return this.flgJaquard;
|
|
}
|
|
|
|
public void setFlgJaquard(long flgJaquard) {
|
|
this.flgJaquard = flgJaquard;
|
|
}
|
|
|
|
public long getFlgTintoFiloPezza() {
|
|
return this.flgTintoFiloPezza;
|
|
}
|
|
|
|
public void setFlgTintoFiloPezza(long flgTintoFiloPezza) {
|
|
this.flgTintoFiloPezza = flgTintoFiloPezza;
|
|
}
|
|
|
|
public long getId_armatura() {
|
|
return this.id_armatura;
|
|
}
|
|
|
|
public void setId_armatura(long id_armatura) {
|
|
this.id_armatura = id_armatura;
|
|
}
|
|
|
|
public long getId_rincorso() {
|
|
return this.id_rincorso;
|
|
}
|
|
|
|
public void setId_rincorso(long id_rincorso) {
|
|
this.id_rincorso = id_rincorso;
|
|
}
|
|
|
|
public long getImpettinatura() {
|
|
return this.impettinatura;
|
|
}
|
|
|
|
public void setImpettinatura(long impettinatura) {
|
|
this.impettinatura = impettinatura;
|
|
}
|
|
|
|
public long getLicci1() {
|
|
return this.licci1;
|
|
}
|
|
|
|
public void setLicci1(long licci1) {
|
|
this.licci1 = licci1;
|
|
}
|
|
|
|
public long getLicci2() {
|
|
return this.licci2;
|
|
}
|
|
|
|
public void setLicci2(long licci2) {
|
|
this.licci2 = licci2;
|
|
}
|
|
|
|
public long getLunghezzaGreggia() {
|
|
return this.lunghezzaGreggia;
|
|
}
|
|
|
|
public void setLunghezzaGreggia(long lunghezzaGreggia) {
|
|
this.lunghezzaGreggia = lunghezzaGreggia;
|
|
}
|
|
|
|
public long getMtOrdito() {
|
|
return this.mtOrdito;
|
|
}
|
|
|
|
public void setMtOrdito(long mtOrdito) {
|
|
this.mtOrdito = mtOrdito;
|
|
}
|
|
|
|
public double getPesoGreggio() {
|
|
return this.pesoGreggio;
|
|
}
|
|
|
|
public void setPesoGreggio(double pesoGreggio) {
|
|
this.pesoGreggio = pesoGreggio;
|
|
}
|
|
|
|
public long getPettine() {
|
|
return this.pettine;
|
|
}
|
|
|
|
public void setPettine(long pettine) {
|
|
this.pettine = pettine;
|
|
}
|
|
|
|
public long getPezzaPerTela() {
|
|
return this.pezzaPerTela;
|
|
}
|
|
|
|
public void setPezzaPerTela(long pezzaPerTela) {
|
|
this.pezzaPerTela = pezzaPerTela;
|
|
}
|
|
|
|
public Rincorso getRincorso() {
|
|
return this.rincorso;
|
|
}
|
|
|
|
public void setRincorso(Rincorso rincorso) {
|
|
this.rincorso = rincorso;
|
|
}
|
|
|
|
public String getSerie() {
|
|
return this.serie;
|
|
}
|
|
|
|
public void setSerie(String serie) {
|
|
this.serie = serie;
|
|
}
|
|
|
|
public long getTipoPettine() {
|
|
return this.tipoPettine;
|
|
}
|
|
|
|
public void setTipoPettine(long tipoPettine) {
|
|
this.tipoPettine = tipoPettine;
|
|
}
|
|
|
|
public static final String getTipoAT(long l_flgTipoAT) {
|
|
switch ((int)l_flgTipoAT) {
|
|
case 0:
|
|
return "Maglieria";
|
|
case 1:
|
|
return "Navetta";
|
|
}
|
|
return "??";
|
|
}
|
|
|
|
public String getTipoAT() {
|
|
return getTipoAT(getFlgTipoAT());
|
|
}
|
|
|
|
public static final String getTipoTessutoM(long l_flgTipoTessutoM) {
|
|
switch ((int)l_flgTipoTessutoM) {
|
|
case 2:
|
|
return "Accoppiato";
|
|
case 1:
|
|
return "Finito";
|
|
case 0:
|
|
return "Greggio o tinto";
|
|
case 3:
|
|
return "Laserato";
|
|
case -1:
|
|
return " ";
|
|
}
|
|
return "??";
|
|
}
|
|
|
|
public String getTipoTessutoM() {
|
|
return getTipoTessutoM(getFlgTipoTessutoM());
|
|
}
|
|
|
|
public void setFlgTipoAT(long flgTipo) {
|
|
this.flgTipoAT = flgTipo;
|
|
}
|
|
|
|
public long getFlgTipoTessutoM() {
|
|
return this.flgTipoTessutoM;
|
|
}
|
|
|
|
public void setFlgTipoTessutoM(long flgTipoTessutoM) {
|
|
this.flgTipoTessutoM = flgTipoTessutoM;
|
|
}
|
|
|
|
public long getFlgTipoAT() {
|
|
return this.flgTipoAT;
|
|
}
|
|
|
|
public Vectumerator<ArticoloTessutoAccoppiato> findArticoliTessutoAccoppiati() {
|
|
ArticoloTessutoAccoppiato atf = new ArticoloTessutoAccoppiato(getApFull());
|
|
return atf.findByArticoloTessuto(getId_articoloTessuto());
|
|
}
|
|
|
|
public long getId_articoloTessutoPadre() {
|
|
return this.id_articoloTessutoPadre;
|
|
}
|
|
|
|
public void setId_articoloTessutoPadre(long id_articoloTessutoPadre) {
|
|
this.id_articoloTessutoPadre = id_articoloTessutoPadre;
|
|
setArticoloTessutoPadre(null);
|
|
}
|
|
|
|
public ArticoloTessuto getArticoloTessutoPadre() {
|
|
this.articoloTessutoPadre = (ArticoloTessuto)getSecondaryObject(this.articoloTessutoPadre, ArticoloTessuto.class,
|
|
getId_articoloTessutoPadre());
|
|
return this.articoloTessutoPadre;
|
|
}
|
|
|
|
public void setArticoloTessutoPadre(ArticoloTessuto articoloTessutoPadre) {
|
|
this.articoloTessutoPadre = articoloTessutoPadre;
|
|
}
|
|
|
|
public Vectumerator<ArticoloTessuto> findArticoliTessutoGreggi(int pageNumber, int pageRows) {
|
|
ArticoloTessutoCR CR = new ArticoloTessutoCR();
|
|
CR.setFlgTipoTessutoM(0L);
|
|
return findByCR(CR, pageNumber, pageRows);
|
|
}
|
|
|
|
public String getDescrizioneCompleta() {
|
|
if (getFlgTipoAT() == 0L) {
|
|
StringBuilder stringBuilder = new StringBuilder();
|
|
stringBuilder.append(getCodiceAT());
|
|
stringBuilder.append(" ");
|
|
stringBuilder.append(getDescrizione());
|
|
return stringBuilder.toString();
|
|
}
|
|
StringBuilder sb = new StringBuilder();
|
|
sb.append(getCodiceAT());
|
|
sb.append(" to do ");
|
|
sb.append(getDescrizione());
|
|
return sb.toString();
|
|
}
|
|
|
|
public long getId_tipo() {
|
|
return this.id_tipo;
|
|
}
|
|
|
|
public Tipo getTipo() {
|
|
this.tipo = (Tipo)getSecondaryObject(this.tipo, Tipo.class, getId_tipo());
|
|
return this.tipo;
|
|
}
|
|
|
|
public void setId_tipo(long id_tipo) {
|
|
this.id_tipo = id_tipo;
|
|
setTipo(null);
|
|
}
|
|
|
|
public void setTipo(Tipo tipo) {
|
|
this.tipo = tipo;
|
|
}
|
|
|
|
public double getQuantita() {
|
|
return getQuantita(null);
|
|
}
|
|
|
|
public double getQuantita(Date data) {
|
|
if (!usaMagazzino())
|
|
return 0.0D;
|
|
if (getParm("USA_MAGAZZINO").isFalse()) {
|
|
RigaDocumento rd = new RigaDocumento(getApFull());
|
|
rd.findMagTessutoDisponibilita(getId_articoloTessuto(), 0L, Articolo.SERIALE_NULL, 0L, 0L, -1L, 0L, "", data);
|
|
return rd.getQuantita();
|
|
}
|
|
return this.quantita;
|
|
}
|
|
|
|
public double getQuantitaData() {
|
|
return this.quantitaData;
|
|
}
|
|
|
|
public double getQuantitaData(Date data) {
|
|
if (!isQuantitaDataCalcolate()) {
|
|
this.quantitaData = getQuantita(data);
|
|
setQuantitaDataCalcolate(true);
|
|
}
|
|
return this.quantitaData;
|
|
}
|
|
|
|
public double getQuantitaEffettiva() {
|
|
if (!isQuantitaCalcolate() && getId_articoloTessuto() != 0L)
|
|
calcolaQuantita();
|
|
return this.quantitaEffettiva;
|
|
}
|
|
|
|
public double getQuantitaImpegnata() {
|
|
if (!isQuantitaCalcolate() && getId_articoloTessuto() != 0L)
|
|
calcolaQuantita();
|
|
return this.quantitaImpegnata;
|
|
}
|
|
|
|
public double getQuantitaInArrivo() {
|
|
if (!isQuantitaCalcolate() && getId_articoloTessuto() != 0L)
|
|
calcolaQuantita();
|
|
return this.quantitaInArrivo;
|
|
}
|
|
|
|
public String getQuantitaMagazzinoMovimentoHtml() {
|
|
if (getParm("USA_MAGAZZINO").isTrue())
|
|
return "--";
|
|
if (!isQuantitaCalcolate() && getId_articoloTessuto() != 0L)
|
|
calcolaQuantita();
|
|
return (this.quantitaMagazzinoMovimentoHtml == null) ? "" : this.quantitaMagazzinoMovimentoHtml;
|
|
}
|
|
|
|
public double getQuantitaV() {
|
|
return this.quantita;
|
|
}
|
|
|
|
public double getRealTimeQuantitaImpegnata() {
|
|
return 0.0D;
|
|
}
|
|
|
|
public double getRealTimeQuantitaInArrivo() {
|
|
double q1 = 0.0D;
|
|
return q1;
|
|
}
|
|
|
|
public boolean isQuantitaCalcolate() {
|
|
return this.quantitaCalcolate;
|
|
}
|
|
|
|
public void setQuantitaCalcolate(boolean quantitaCalcolate) {
|
|
this.quantitaCalcolate = quantitaCalcolate;
|
|
}
|
|
|
|
public boolean isQuantitaDataCalcolate() {
|
|
return this.quantitaDataCalcolate;
|
|
}
|
|
|
|
public void setQuantitaDataCalcolate(boolean quantitaDataCalcolate) {
|
|
this.quantitaDataCalcolate = quantitaDataCalcolate;
|
|
}
|
|
|
|
public void setQuantitaData(double quantitaData) {
|
|
this.quantitaData = quantitaData;
|
|
}
|
|
|
|
public void setQuantitaEffettiva(double quantitaEffettiva) {
|
|
this.quantitaEffettiva = quantitaEffettiva;
|
|
}
|
|
|
|
public void setQuantitaImpegnata(double quantitaImpegnata) {
|
|
this.quantitaImpegnata = quantitaImpegnata;
|
|
}
|
|
|
|
public void setQuantitaInArrivo(double quantitaInArrivo) {
|
|
this.quantitaInArrivo = quantitaInArrivo;
|
|
}
|
|
|
|
public void setQuantitaMagazzinoMovimentoHtml(String quantitaMagazzinoMovimentoHtml) {
|
|
this.quantitaMagazzinoMovimentoHtml = quantitaMagazzinoMovimentoHtml;
|
|
}
|
|
|
|
private synchronized void calcolaQuantita() {
|
|
if ((!isQuantitaCalcolate() ? true : false) & ((getId_articoloTessuto() != 0L) ? true : false)) {
|
|
long l_flgDispo;
|
|
RigaDocumento rd = new RigaDocumento(getApFull());
|
|
rd.findMagTessutoDisponibilita(getId_articoloTessuto(), 0L, Articolo.SERIALE_NULL, 0L, 0L, -1L, 0L, "", DATA_NULL);
|
|
double q = rd.getQuantita();
|
|
double nr = rd.getNr();
|
|
double kg = rd.getKg();
|
|
double mt = rd.getMt();
|
|
setQuantitaW(q);
|
|
setQuantita(q);
|
|
setQuantitaLavorazione(new RigaDocumento(getApFull()).getQuantitaTessutoLavorazioneByArticoloTessutoColoreSeriale(0L,
|
|
getId_articoloTessuto(), 0L, Articolo.SERIALE_NULL));
|
|
if (usaMagazzino()) {
|
|
DoubleOperator dop = new DoubleOperator(q);
|
|
dop.add(this.quantitaInArrivo);
|
|
dop.add(this.quantitaLavorazione);
|
|
dop.subtract(this.quantitaImpegnata);
|
|
setQuantitaEffettiva(dop.getResult());
|
|
}
|
|
this.quantitaMagazzinoMovimentoHtml = ArticoloTessutoColore.getMovimentoHtmlDesc(getTipologiaArticolo(), q, nr, kg, mt, this.quantitaInArrivo, this.quantitaImpegnata, this.quantitaEffettiva, this.quantitaLavorazione,
|
|
usaMagazzino(),
|
|
getParm("USA_MAGAZZINO").isTrue(), getNf());
|
|
if (!usaMagazzino()) {
|
|
l_flgDispo = 1L;
|
|
} else {
|
|
l_flgDispo = (this.quantita > 0.0D) ? 1L : 0L;
|
|
}
|
|
String temp = "update ARTICOLO_TESSUTO set quantitaMagazzinoMovimentoHtml='" + this.quantitaMagazzinoMovimentoHtml + "', quantita=" + this.quantita + ", quantitaEffettiva=" + this.quantitaEffettiva + ", quantitaImpegnata=" + this.quantitaImpegnata + ", quantitaLavorazione=" + this.quantitaLavorazione + ", quantitaCalcolate=true, flgDispo=" + l_flgDispo + " where id_articoloTessuto=" +
|
|
|
|
|
|
getId_articoloTessuto();
|
|
update(temp);
|
|
setQuantitaCalcolate(true);
|
|
}
|
|
}
|
|
|
|
public boolean usaMagazzino() {
|
|
if (getTipo().getFlgTipoMagazzino() == 9L || getTipo().getFlgTipoMagazzino() == 0L)
|
|
return false;
|
|
return true;
|
|
}
|
|
|
|
public void setQuantita(double quantita) {
|
|
this.quantita = quantita;
|
|
}
|
|
|
|
public TipologiaArticolo getTipologiaArticolo() {
|
|
return getTipo().getTipologiaArticolo();
|
|
}
|
|
|
|
public String getCodiceAT() {
|
|
return (this.codiceAT == null) ? "" : this.codiceAT;
|
|
}
|
|
|
|
public void setCodiceAT(String codiceAT) {
|
|
this.codiceAT = codiceAT;
|
|
}
|
|
|
|
public String getDescLavorazione() {
|
|
return (this.descLavorazione == null) ? "" : this.descLavorazione.trim();
|
|
}
|
|
|
|
public void setDescLavorazione(String descLavorazione) {
|
|
this.descLavorazione = descLavorazione;
|
|
}
|
|
|
|
public void findByCodice(String l_codiceAT) {
|
|
String s_Sql_Find = "select A.* from ARTICOLO_TESSUTO AS A";
|
|
String s_Sql_Order = "";
|
|
WcString wc = new WcString();
|
|
wc.addWc("A.codiceAT='" + prepareInputMySqlString(l_codiceAT, false) + "'");
|
|
try {
|
|
PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString());
|
|
findFirstRecord(stmt);
|
|
} catch (SQLException e) {
|
|
removeCPConnection();
|
|
handleDebug(e);
|
|
}
|
|
}
|
|
|
|
public Vectumerator<ArticoloTessutoFilato> findArticoliTessutoFilati(int pageNumber, int pageRows) {
|
|
ArticoloTessutoFilato atf = new ArticoloTessutoFilato(getApFull());
|
|
return atf.findByArticoloTessuto(getId_articoloTessuto(), pageNumber, pageRows);
|
|
}
|
|
|
|
public String getDescrizioneCompletaLista() {
|
|
if (getFlgTipoAT() == 0L) {
|
|
StringBuilder stringBuilder = new StringBuilder();
|
|
stringBuilder.append(getDescrizione());
|
|
if (getFlgTipoTessutoM() == 1L) {
|
|
if (getId_articoloTessutoPadre() != 0L) {
|
|
stringBuilder.append("( Gr.: ");
|
|
stringBuilder.append(getArticoloTessutoPadre().getDescrizioneCompleta());
|
|
stringBuilder.append(") ");
|
|
}
|
|
} else if (getFlgTipoTessutoM() == 2L) {
|
|
stringBuilder.append("( ");
|
|
Vectumerator<ArticoloTessutoAccoppiato> vecAta = findArticoliTessutoAccoppiati();
|
|
while (vecAta.hasMoreElements()) {
|
|
ArticoloTessutoAccoppiato row = (ArticoloTessutoAccoppiato)vecAta.nextElement();
|
|
stringBuilder.append(row.getArticoloTessutoComponente().getDescrizioneCompleta());
|
|
if (vecAta.hasMoreElements())
|
|
stringBuilder.append(" + ");
|
|
}
|
|
stringBuilder.append(") ");
|
|
}
|
|
return stringBuilder.toString().trim();
|
|
}
|
|
StringBuilder sb = new StringBuilder();
|
|
sb.append(getDescrizione());
|
|
return "todo";
|
|
}
|
|
|
|
public boolean isUsaLotti() {
|
|
return (getTipo().getFlgTipoMagazzino() == 3L);
|
|
}
|
|
|
|
public void resetCalcoloQuantita() {
|
|
if (getId_articoloTessuto() > 0L) {
|
|
update("update ARTICOLO_TESSUTO set quantitaCalcolate=false where id_articoloTessuto=" + getId_articoloTessuto());
|
|
setQuantitaCalcolate(false);
|
|
}
|
|
}
|
|
|
|
public long getFlgDispo() {
|
|
return this.flgDispo;
|
|
}
|
|
|
|
public void setFlgDispo(long flgDispo) {
|
|
this.flgDispo = flgDispo;
|
|
}
|
|
|
|
public boolean isUsaMagazzino() {
|
|
return (isUsaLotti() || isUsaSeriale());
|
|
}
|
|
|
|
public boolean isUsaSeriale() {
|
|
return (getTipo().getFlgTipoMagazzino() == 2L);
|
|
}
|
|
|
|
public ResParm superSave() {
|
|
return super.save();
|
|
}
|
|
|
|
public boolean isPercArticoloTessutoFilatoOk() {
|
|
if (getComposizioneATF().getPerc() == 100.0D)
|
|
return true;
|
|
return false;
|
|
}
|
|
|
|
public String getPercArticoloTessutoFilato() {
|
|
if (getComposizioneATF() != null && getComposizioneATF().getPerc() == 100.0D)
|
|
return "";
|
|
return getNf().format(getComposizioneATF().getPerc()) + "%";
|
|
}
|
|
|
|
public ComposizioneResult getComposizioneATF() {
|
|
if (this.composizioneATF == null &&
|
|
getId_articoloTessuto() > 0L) {
|
|
StringBuilder comp = new StringBuilder();
|
|
StringBuilder desc = new StringBuilder();
|
|
DoubleOperator perc = new DoubleOperator();
|
|
Vectumerator<ArticoloTessutoFilato> vec = findArticoliTessutoFilati(0, 0);
|
|
while (vec.hasMoreElements()) {
|
|
ArticoloTessutoFilato row = (ArticoloTessutoFilato)vec.nextElement();
|
|
perc.add(row.getPercentuale());
|
|
desc.append(row.getDescrizioneCompleta());
|
|
if (vec.hasMoreElements())
|
|
desc.append(" - ");
|
|
}
|
|
this.composizioneATF = new ComposizioneResult(perc.getResult(), "", desc.toString());
|
|
}
|
|
return (this.composizioneATF == null) ? new ComposizioneResult(0.0D, "", "") : this.composizioneATF;
|
|
}
|
|
|
|
public void setComposizioneATF(ComposizioneResult composizioneATF) {
|
|
this.composizioneATF = composizioneATF;
|
|
}
|
|
|
|
protected void initFields() {
|
|
super.initFields();
|
|
setComposizioneATF(null);
|
|
setId_articoloTessutoColore(0L);
|
|
}
|
|
|
|
public Vectumerator<ArticoloTessuto> findTessutiPerTaglioByArticolo(long l_id_articolo) {
|
|
HashMap<Long, ArticoloTessuto> hmTess = new HashMap<>();
|
|
Articolo articolo = new Articolo(this.apFull);
|
|
articolo.findByPrimaryKey(l_id_articolo);
|
|
if (articolo.getId_articolo() > 0L) {
|
|
Vectumerator<ArticoloArticoloTessuto> vecAAT = new Vectumerator();
|
|
if (articolo.getFlgUsaVarianti() == 1L) {
|
|
Vectumerator<ArticoloVariante> vecVar = articolo.findArticoliVarianti(-1L, -1L);
|
|
while (vecVar.hasMoreElements()) {
|
|
ArticoloVariante rowAV = (ArticoloVariante)vecVar.nextElement();
|
|
vecAAT = rowAV.findArticoliTessuto();
|
|
while (vecAAT.hasMoreElements()) {
|
|
ArticoloArticoloTessuto rowAAT = (ArticoloArticoloTessuto)vecAAT.nextElement();
|
|
if (!hmTess.containsKey(Long.valueOf(rowAAT.getId_articoloTessuto())))
|
|
hmTess.put(Long.valueOf(rowAAT.getId_articoloTessuto()), rowAAT.getArticoloTessuto());
|
|
}
|
|
}
|
|
} else {
|
|
vecAAT = articolo.findArticoliTessuto();
|
|
while (vecAAT.hasMoreElements()) {
|
|
ArticoloArticoloTessuto rowAAT = (ArticoloArticoloTessuto)vecAAT.nextElement();
|
|
if (!hmTess.containsKey(Long.valueOf(rowAAT.getId_articoloTessuto())))
|
|
hmTess.put(Long.valueOf(rowAAT.getId_articoloTessuto()), rowAAT.getArticoloTessuto());
|
|
}
|
|
}
|
|
}
|
|
Vectumerator<ArticoloTessuto> vecRes = new Vectumerator();
|
|
Set<Long> keySet = hmTess.keySet();
|
|
for (Long key : keySet)
|
|
vecRes.add(hmTess.get(key));
|
|
return vecRes;
|
|
}
|
|
|
|
public long getCapiPerTelo() {
|
|
return this.capiPerTelo;
|
|
}
|
|
|
|
public void setCapiPerTelo(long capiPerTelo) {
|
|
this.capiPerTelo = capiPerTelo;
|
|
}
|
|
|
|
public long getNumTeliMax() {
|
|
return this.numTeliMax;
|
|
}
|
|
|
|
public void setNumTeliMax(long numTeliMax) {
|
|
this.numTeliMax = numTeliMax;
|
|
}
|
|
|
|
public Vectumerator<ArticoloTessuto> findByCRAv(ArticoloTessutoCR CR, int pageNumber, int pageRows) {
|
|
if (CR.getFlgTipoRicerca() == 1L)
|
|
return AB_EMPTY_VECTUMERATOR;
|
|
String s_Sql_FindArtVar = "select B.id_articoloTessutoColore as id_articoloTessutoColore, A.* from ARTICOLO_TESSUTO AS A JOIN ARTICOLO_TESSUTO_COLORE AS B ON A.id_articoloTessuto=B.id_articoloTessuto inner join COLORE AS C ON B.id_colore=C.id_colore INNER JOIN TIPO AS T ON A.id_tipo=T.id_tipo";
|
|
String s_Sql_FindArt = "select 0 as id_articoloTessutoColore, A.* from ARTICOLO_TESSUTO AS A INNER JOIN TIPO AS T ON A.id_tipo=T.id_tipo";
|
|
String s_Sql_Order = " order by A.descrizione";
|
|
WcString wc = new WcString();
|
|
StringBuffer wcArt = new StringBuffer("");
|
|
StringBuffer wcArtVar = new StringBuffer("");
|
|
if (!CR.getSearchTxt().trim().isEmpty()) {
|
|
String star = "";
|
|
String temp = CR.getSearchTxt().trim();
|
|
temp = prepareInputMySqlString(temp, true);
|
|
temp = temp.replace("*", "%");
|
|
StringTokenizer st = new StringTokenizer(temp.trim(), " ");
|
|
while (st.hasMoreTokens()) {
|
|
String token = star + star;
|
|
wcArt.append("(A.codiceAT like '%" + token + "%' or A.descrizione like '%" + token + ",%')");
|
|
wcArtVar.append("(A.codiceAT like '%" + token + "%' or A.descrizione like '%" + token + "%' or C.descrizione like '%" + token + "%' or A.codiciAlternativiAt like '%," + token + "%')");
|
|
if (st.hasMoreTokens()) {
|
|
wcArt.append(" and ");
|
|
wcArtVar.append(" and ");
|
|
star = "%";
|
|
}
|
|
}
|
|
}
|
|
if (wcArtVar.length() > 0) {
|
|
wcArtVar.append(" and ");
|
|
wcArt.append(" and ");
|
|
}
|
|
wcArtVar.insert(0, " where ");
|
|
wcArtVar.append(" B.id_articoloTessutoColore Is Not Null AND T.flgUsaVarianti=1 and (T.flgNascondi=0 or T.flgNascondi is null) and A.dataFineVld is null");
|
|
wcArt.insert(0, " where ");
|
|
wcArt.append(" (T.flgUsaVarianti=0 or T.flgUsaVarianti is null) and (T.flgNascondi=0 or T.flgNascondi is null) and A.dataFineVld is null");
|
|
try {
|
|
PreparedStatement stmt = getConn().prepareStatement("(" + s_Sql_FindArtVar + wcArtVar.toString() + s_Sql_Order + ") union (" + s_Sql_FindArt +
|
|
wcArt.toString() + s_Sql_Order + ")");
|
|
return findRows(stmt, pageNumber, pageRows);
|
|
} catch (SQLException e) {
|
|
handleDebug(e);
|
|
return AB_EMPTY_VECTUMERATOR;
|
|
}
|
|
}
|
|
|
|
public ArticoloTessutoColore getArticoloTessutoColore() {
|
|
this.articoloTessutoColore = (ArticoloTessutoColore)getSecondaryObject(this.articoloTessutoColore, ArticoloTessutoColore.class,
|
|
getId_articoloTessutoColore());
|
|
return this.articoloTessutoColore;
|
|
}
|
|
|
|
public void setArticoloTessutoColore(ArticoloTessutoColore articoloTessutoColore) {
|
|
this.articoloTessutoColore = articoloTessutoColore;
|
|
}
|
|
|
|
public long getId_articoloTessutoColore() {
|
|
return this.id_articoloTessutoColore;
|
|
}
|
|
|
|
public void setId_articoloTessutoColore(long id_articoloTessutoColore) {
|
|
this.id_articoloTessutoColore = id_articoloTessutoColore;
|
|
setArticoloTessutoColore(null);
|
|
}
|
|
|
|
protected void fillFields(ResultSet rst) {
|
|
super.fillFields(rst);
|
|
try {
|
|
if (isColumnInResultSet(rst, "id_articoloTessutoColore"))
|
|
setId_articoloTessutoColore(rst.getLong("id_articoloTessutoColore"));
|
|
if (isColumnInResultSet(rst, "seriale"))
|
|
setSeriale(rst.getString("seriale"));
|
|
if (isColumnInResultSet(rst, "id_magFisico"))
|
|
setId_magFisico(rst.getLong("id_magFisico"));
|
|
if (isColumnInResultSet(rst, "quantita"))
|
|
setQuantita(rst.getDouble("quantita"));
|
|
} catch (Exception e) {
|
|
e.printStackTrace();
|
|
}
|
|
}
|
|
|
|
public String getDescrizioneCompleta(String lang) {
|
|
if (getFlgTipoAT() == 0L) {
|
|
StringBuilder stringBuilder = new StringBuilder();
|
|
stringBuilder.append(getCodiceAT());
|
|
stringBuilder.append(" ");
|
|
stringBuilder.append(getDescrizione(lang));
|
|
if (getId_articoloTessutoColore() > 0L) {
|
|
stringBuilder.append(" ");
|
|
stringBuilder.append(getArticoloTessutoColore().getColore().getDescrizione(lang));
|
|
}
|
|
stringBuilder.append(" (");
|
|
stringBuilder.append(getTipo().getDescrizioneCompletaSpaces(lang));
|
|
stringBuilder.append(")");
|
|
return stringBuilder.toString();
|
|
}
|
|
StringBuilder sb = new StringBuilder();
|
|
sb.append(getCodiceAT());
|
|
sb.append(" ");
|
|
sb.append(getDescrizione(lang));
|
|
return "todo";
|
|
}
|
|
|
|
public double getMtLavorazioneTaglio() {
|
|
return this.mtLavorazioneTaglio;
|
|
}
|
|
|
|
public void setMtLavorazioneTaglio(double mtLavorazioneTaglio) {
|
|
this.mtLavorazioneTaglio = mtLavorazioneTaglio;
|
|
}
|
|
|
|
public String getCodiciAlternativiAt() {
|
|
return (this.codiciAlternativiAt == null) ? "" : this.codiciAlternativiAt.trim();
|
|
}
|
|
|
|
public void setCodiciAlternativiAt(String codiciAlternativi) {
|
|
this.codiciAlternativiAt = codiciAlternativi;
|
|
}
|
|
|
|
protected void prepareSave(PreparedStatement ps) throws SQLException {
|
|
String temp = getCodiciAlternativiAt();
|
|
if (!temp.isEmpty()) {
|
|
if (!temp.startsWith(","))
|
|
temp = "," + temp;
|
|
if (!temp.endsWith(","))
|
|
temp = temp + ",";
|
|
}
|
|
setCodiciAlternativiAt(temp);
|
|
super.prepareSave(ps);
|
|
}
|
|
|
|
public String getNotaTessuto() {
|
|
return (this.notaTessuto == null) ? "" : this.notaTessuto.trim();
|
|
}
|
|
|
|
public void setNotaTessuto(String notaTessuto) {
|
|
this.notaTessuto = notaTessuto;
|
|
}
|
|
|
|
private String calcolaProgCodice() {
|
|
try {
|
|
String s_sql = "select *, CONVERT(codiceAT,UNSIGNED INTEGER) as codice from ARTICOLO_TESSUTO as A";
|
|
WcString wc = new WcString();
|
|
wc.addWc("id_articoloTessuto !=" + getId_articoloTessuto());
|
|
s_sql = " select B.codice as codiceAT from (" + s_sql + wc.toString() + ") as B order by codiceAT desc limit 1";
|
|
PreparedStatement ps = getConn().prepareStatement(s_sql);
|
|
Vectumerator<ArticoloTessuto> vec = findRows(ps);
|
|
if (!vec.hasMoreElements())
|
|
return "1";
|
|
ArticoloTessuto articoloTessuto = (ArticoloTessuto)vec.nextElement();
|
|
return String.valueOf(Long.valueOf(articoloTessuto.getCodiceAT()) + 1L);
|
|
} catch (Exception e) {
|
|
return "";
|
|
}
|
|
}
|
|
|
|
public ResParm save() {
|
|
setDescrizione(getDescrizione(Locale.ITALIAN.getLanguage()));
|
|
if (getCodiceAT().isEmpty())
|
|
setCodiceAT(zeroLeft(calcolaProgCodice(), 4));
|
|
if (getId_tipo() == 0L)
|
|
setId_tipo(getCodiceTipoTessutoStandard());
|
|
if (getId_iva() == 0L)
|
|
setId_iva(getCodiceIvaVendStd());
|
|
return super.save();
|
|
}
|
|
|
|
public double getTotPercentualeComponenti() {
|
|
if (getId_articoloTessuto() == 0L)
|
|
return 0.0D;
|
|
return new ArticoloTessutoComponente(getApFull()).getTotPercentualeByArticoloTessuto(getId_articoloTessuto());
|
|
}
|
|
|
|
public double getUltimoPrezzoAcquisto() {
|
|
return this.ultimoPrezzoAcquisto;
|
|
}
|
|
|
|
public void setUltimoPrezzoAcquisto(double ultimoPrezzoAcquisto) {
|
|
this.ultimoPrezzoAcquisto = ultimoPrezzoAcquisto;
|
|
}
|
|
|
|
public it.acxent.anag.Clifor getFornitoreAbituale() {
|
|
ArticoloFornitore af = new ArticoloFornitore(getApFull());
|
|
af.findByArticoloTessutoFornitoreAbituale(getId_articoloTessuto());
|
|
return af.getFornitore();
|
|
}
|
|
|
|
public Vectumerator getFornitori() {
|
|
return new ArticoloFornitore(getApFull()).findById_articoloTessuto(getId_articoloTessuto(), 0, 0);
|
|
}
|
|
|
|
public ResParm addFornitore(ArticoloFornitore ab) {
|
|
ResParm rp = new ResParm(true);
|
|
ArticoloFornitore bean = new ArticoloFornitore(getApFull());
|
|
bean.findByPrimaryKey(ab.getId_articoloFornitore());
|
|
ab.setDBState(bean.getDBState());
|
|
if (ab.getFlgAbituale() == 1L)
|
|
rp = ab.deleteFlgAbitualeArticoloTessuto(ab.getId_articoloTessuto());
|
|
rp.append(ab.save());
|
|
return rp;
|
|
}
|
|
|
|
public ResParm delFornitore(ArticoloFornitore ca) {
|
|
ArticoloFornitore bean = new ArticoloFornitore(getApFull());
|
|
bean.findByPrimaryKey(ca.getId_articoloFornitore());
|
|
return bean.delete();
|
|
}
|
|
|
|
public synchronized ResParm aggiornaUltimoCosto(double l_costoNuovo, Date l_dataCarico) {
|
|
ResParm rp = new ResParm(true);
|
|
if ((getDataUltimoPrezzoAcquisto() == null || getDateDiff(getDataUltimoPrezzoAcquisto(), l_dataCarico) >= 0L) && l_costoNuovo !=
|
|
getUltimoPrezzoAcquisto()) {
|
|
setDataUltimoPrezzoAcquisto(l_dataCarico);
|
|
setUltimoPrezzoAcquisto(l_costoNuovo);
|
|
rp = super.save();
|
|
}
|
|
return rp;
|
|
}
|
|
|
|
public Date getDataUltimoPrezzoAcquisto() {
|
|
return this.dataUltimoPrezzoAcquisto;
|
|
}
|
|
|
|
public void setDataUltimoPrezzoAcquisto(Date dataUltimoPrezzoAcquisto) {
|
|
this.dataUltimoPrezzoAcquisto = dataUltimoPrezzoAcquisto;
|
|
}
|
|
|
|
public double getQuantitaW() {
|
|
if (!isQuantitaCalcolate() && this.id_articoloTessuto != 0L)
|
|
calcolaQuantita();
|
|
return this.quantitaW;
|
|
}
|
|
|
|
public void setQuantitaW(double quantitaW) {
|
|
this.quantitaW = quantitaW;
|
|
}
|
|
|
|
public long getId_magFisico() {
|
|
return this.id_magFisico;
|
|
}
|
|
|
|
public MagFisico getMagFisico() {
|
|
this.magFisico = (MagFisico)getSecondaryObject(this.magFisico, MagFisico.class, getId_magFisico());
|
|
return this.magFisico;
|
|
}
|
|
|
|
public void setId_magFisico(long id_magFisico) {
|
|
this.id_magFisico = id_magFisico;
|
|
setMagFisico(null);
|
|
}
|
|
|
|
public void setMagFisico(MagFisico magFisico) {
|
|
this.magFisico = magFisico;
|
|
}
|
|
|
|
public String getSeriale() {
|
|
return (this.seriale == null) ? "" : this.seriale.trim();
|
|
}
|
|
|
|
public void setSeriale(String seriale) {
|
|
this.seriale = seriale;
|
|
}
|
|
|
|
public double getQuantitaLavorazione() {
|
|
return this.quantitaLavorazione;
|
|
}
|
|
|
|
public void setQuantitaLavorazione(double quantitaLavorazione) {
|
|
this.quantitaLavorazione = quantitaLavorazione;
|
|
}
|
|
|
|
@Deprecated
|
|
public Vectumerator<ArticoloTessuto> findByCRSerMagazzino(ArticoloTessutoCR CR, int pageNumber, int pageRows) {
|
|
return AB_EMPTY_VECTUMERATOR;
|
|
}
|
|
|
|
public Iva getIva(it.acxent.anag.Clifor l_clifor) {
|
|
this.iva = null;
|
|
if (l_clifor == null || l_clifor.getId_clifor() == 0L) {
|
|
this.iva = (Iva)getSecondaryObject(this.iva, Iva.class, new Long(getId_iva()));
|
|
} else {
|
|
this.iva = new Iva(getApFull());
|
|
this.iva.findByPrimaryKey(getId_iva(l_clifor));
|
|
}
|
|
return this.iva;
|
|
}
|
|
|
|
public long getId_iva(it.acxent.anag.Clifor l_clifor) {
|
|
if (l_clifor != null && l_clifor.getId_clifor() != 0L) {
|
|
if (l_clifor.getFlgArt8() == 1L)
|
|
return getCodiceIvaArt8_A();
|
|
return this.id_iva;
|
|
}
|
|
return this.id_iva;
|
|
}
|
|
}
|