1907 lines
60 KiB
Java
1907 lines
60 KiB
Java
package it.acxent.art;
|
|
|
|
import it.acxent.anag.Clifor;
|
|
import it.acxent.anag.Listino;
|
|
import it.acxent.anag.ListinoArticolo;
|
|
import it.acxent.anag.MagFisico;
|
|
import it.acxent.anag.PrezzoArticolo;
|
|
import it.acxent.anag.Users;
|
|
import it.acxent.cart.CartItemId;
|
|
import it.acxent.cart.CartItemIterface;
|
|
import it.acxent.contab.Movimento;
|
|
import it.acxent.contab.MovimentoCR;
|
|
import it.acxent.contab.RigaDocumento;
|
|
import it.acxent.contab.RigaDocumentoCR;
|
|
import it.acxent.db.AddImgInterface;
|
|
import it.acxent.db.ApplParmFull;
|
|
import it.acxent.db.DBAdapter;
|
|
import it.acxent.db.ResParm;
|
|
import it.acxent.db.WcString;
|
|
import it.acxent.gtm.GoogleDataLayerBuilder;
|
|
import it.acxent.tex.anag.ArticoloArticoloTessuto;
|
|
import it.acxent.tex.anag.ArticoloTessutoColore;
|
|
import it.acxent.util.DoubleOperator;
|
|
import it.acxent.util.StringTokenizer;
|
|
import it.acxent.util.Vectumerator;
|
|
import java.io.File;
|
|
import java.io.Serializable;
|
|
import java.sql.Date;
|
|
import java.sql.PreparedStatement;
|
|
import java.sql.SQLException;
|
|
import java.sql.Timestamp;
|
|
|
|
public class ArticoloVariante extends _ArtAdapter implements Serializable, CartItemIterface, AddImgInterface, ArticoloInterface {
|
|
protected static final String _PATH_VAR = "_var/";
|
|
|
|
private static final long serialVersionUID = -4258127388426340159L;
|
|
|
|
private ListinoArticolo listinoArticoloVarianteBase;
|
|
|
|
private Listino listinoBase;
|
|
|
|
private long id_articolo;
|
|
|
|
private String codiceVariante;
|
|
|
|
private String nomeV;
|
|
|
|
private String coloreVHex;
|
|
|
|
private Articolo articolo;
|
|
|
|
private String descrizioneV_it;
|
|
|
|
private long flgWebNoVenditaAv;
|
|
|
|
private long flgUdmAv;
|
|
|
|
private double quantitaAv;
|
|
|
|
private String descrizioneVetrinaV_it;
|
|
|
|
private String codiciAlternativiV;
|
|
|
|
private boolean quantitaCalcolateAv;
|
|
|
|
private double quantitaEffettivaAv;
|
|
|
|
private double quantitaImpegnataAv;
|
|
|
|
private double quantitaInArrivoAv;
|
|
|
|
private long id_vetrina;
|
|
|
|
private Vetrina vetrina;
|
|
|
|
private long flgInAggiornamento;
|
|
|
|
private String quantitaMagazzinoMovimentoHtml;
|
|
|
|
private String descrizioneSearchAv;
|
|
|
|
private String keywordsAv;
|
|
|
|
private String ebayItemIdAv;
|
|
|
|
private long flgSubitoAv;
|
|
|
|
private long flgGoogleAv;
|
|
|
|
private long flgEbayAv;
|
|
|
|
private String readyForWebAv;
|
|
|
|
private long qtaSuEbayAv;
|
|
|
|
private long impressionAv;
|
|
|
|
private Timestamp tmstLastImpressionAv;
|
|
|
|
private double qtaAttribuitaV;
|
|
|
|
private double qtaInProduzioneV;
|
|
|
|
private String codiceSerieV;
|
|
|
|
private long flgStockV;
|
|
|
|
private String descrizioneVarianteSerie;
|
|
|
|
private long flgNonOrdinabile;
|
|
|
|
private long flgDispo;
|
|
|
|
private PrezzoArticolo prezzoArticoloVariante;
|
|
|
|
private PrezzoArticolo prezzoArticoloVarianteIva;
|
|
|
|
private String metaDesc;
|
|
|
|
private String metaTag;
|
|
|
|
private long flgNascondi;
|
|
|
|
private long flgEscludiWebAv;
|
|
|
|
private double quantitaAvW;
|
|
|
|
private String codiciMagazzino;
|
|
|
|
private Colore colore;
|
|
|
|
private long id_colore;
|
|
|
|
private String codicePromozioneAV;
|
|
|
|
private long id_articoloVariante;
|
|
|
|
private String ebayOfferIdAv;
|
|
|
|
public String getColoreVHex() {
|
|
return (this.coloreVHex == null) ? "" : this.coloreVHex.trim();
|
|
}
|
|
|
|
public String getFontColoreVHex() {
|
|
return getFontColoreHex(getColoreVHex());
|
|
}
|
|
|
|
public void setColoreVHex(String coloreHex) {
|
|
this.coloreVHex = coloreHex;
|
|
}
|
|
|
|
public ArticoloVariante(ApplParmFull newApplParmFull) {
|
|
super(newApplParmFull);
|
|
}
|
|
|
|
public ArticoloVariante() {}
|
|
|
|
public void setId_articoloVariante(long newId_articoloVariante) {
|
|
this.id_articoloVariante = newId_articoloVariante;
|
|
}
|
|
|
|
public void setId_articolo(long newId_articolo) {
|
|
this.id_articolo = newId_articolo;
|
|
setArticolo(null);
|
|
}
|
|
|
|
public long getId_articoloVariante() {
|
|
return this.id_articoloVariante;
|
|
}
|
|
|
|
public long getId_articolo() {
|
|
return this.id_articolo;
|
|
}
|
|
|
|
public void setArticolo(Articolo newArticolo) {
|
|
this.articolo = newArticolo;
|
|
}
|
|
|
|
public Articolo getArticolo() {
|
|
this.articolo = (Articolo)getSecondaryObject(this.articolo, Articolo.class, getId_articolo());
|
|
return this.articolo;
|
|
}
|
|
|
|
public Vectumerator<ArticoloVariante> findByCR(ArticoloVarianteCR CR, int pageNumber, int pageRows) {
|
|
String s_Sql_Find = "select A.* from ARTICOLO_VARIANTE AS A, ARTICOLO AS B, TIPO AS C";
|
|
String s_Sql_Order = " order by C.ordine, A.id_articolo";
|
|
if (CR.getFlgOrdinaArticolo() > 0L)
|
|
s_Sql_Order = " order by C.ordine,B.ordine, A.id_articolo";
|
|
WcString wc = new WcString();
|
|
wc.addWc("A.id_articolo=B.id_articolo");
|
|
wc.addWc("B.id_tipo=C.id_tipo");
|
|
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("(B.nome like '%" + token + "%' or A.nomeV like '%" + token + "%' or A.codiceVariante like '%" + token + "%')");
|
|
if (st.hasMoreTokens())
|
|
txt.append(" and ");
|
|
}
|
|
txt.append(")");
|
|
wc.addWc(txt.toString());
|
|
}
|
|
if (!CR.getSearchTxtWeb().isEmpty()) {
|
|
StringTokenizer st = new StringTokenizer(CR.getSearchTxtWeb(), " ");
|
|
StringBuffer txt = new StringBuffer("(");
|
|
while (st.hasMoreTokens()) {
|
|
String token = st.nextToken();
|
|
txt.append("(B.nome like '%" + token + "%' or A.nomeV like '%" + token + "%' or A.codiceVariante like '%" + token + "%')");
|
|
if (st.hasMoreTokens())
|
|
txt.append(" and ");
|
|
}
|
|
txt.append(")");
|
|
wc.addWc(txt.toString());
|
|
}
|
|
if (CR.getId_articolo() > 0L)
|
|
wc.addWc("A.id_articolo=" + CR.getId_articolo());
|
|
if (CR.getFlgEscludiWeb() == 0L)
|
|
wc.addWc("(B.flgEscludiWeb=0 or B.flgEscludiWeb is null)");
|
|
if (CR.getFlgNascondi() == 0L) {
|
|
wc.addWc("(A.flgNascondi=0 or A.flgNascondi is null)");
|
|
wc.addWc("(B.flgNascondi=0 or B.flgNascondi is null)");
|
|
wc.addWc("(C.flgNascondi=0 or C.flgNascondi is null)");
|
|
} else if (CR.getFlgNascondi() > 0L) {
|
|
wc.addWc("A.flgNascondi=" + CR.getFlgNascondi());
|
|
wc.addWc("B.flgNascondi=" + CR.getFlgNascondi());
|
|
wc.addWc("C.flgNascondi=" + CR.getFlgNascondi());
|
|
}
|
|
if (!CR.getCodiceVariante().isEmpty())
|
|
wc.addWc("A.codiceVariante='" + CR.getCodiceVariante() + "'");
|
|
if (CR.getId_tipoSel() != 0L)
|
|
wc.addWc("(B.id_tipo=" + CR.getId_tipoSel() + " or C.indici like'%:" + CR.getId_tipoSel() + ":%')");
|
|
if (CR.getFlgQta() == 1L)
|
|
if (CR.getQtaDa() == 0L) {
|
|
wc.addWc("A.quantitaAv<=" + CR.getQtaA());
|
|
} else {
|
|
wc.addWc("A.quantitaAv>=" + CR.getQtaDa());
|
|
wc.addWc("A.quantitaAv<=" + CR.getQtaA());
|
|
}
|
|
try {
|
|
PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString());
|
|
return findRows(stmt, pageNumber, pageRows);
|
|
} catch (SQLException e) {
|
|
handleDebug(e);
|
|
return AB_EMPTY_VECTUMERATOR;
|
|
}
|
|
}
|
|
|
|
public String getImgFileName(int imgNumber) {
|
|
return getImgFileName(imgNumber, getImgTmst());
|
|
}
|
|
|
|
public String getImgFileName(int imgNumber, String oldTmst) {
|
|
return "" + getId_articoloVariante() + "_" + getId_articoloVariante() + "_" + getId_articolo() + "_" + oldTmst + ".jpg";
|
|
}
|
|
|
|
public Vectumerator findById_articolo(long l_id_articolo, int pageNumber, int pageRows, long flgDisponibile, long flgNascondi) {
|
|
String s_Sql_Find = "select A.* from ARTICOLO_VARIANTE AS A";
|
|
String s_Sql_Order = " order by nomeV";
|
|
WcString wc = new WcString();
|
|
wc.addWc("A.id_articolo=" + l_id_articolo);
|
|
if (flgDisponibile > 0L)
|
|
wc.addWc("A.flgDispo=1");
|
|
if (flgNascondi == 0L) {
|
|
wc.addWc("(A.flgNascondi is null or A.flgNascondi =0)");
|
|
} else if (flgNascondi > 0L) {
|
|
wc.addWc("A.flgNascondi=" + flgNascondi);
|
|
}
|
|
try {
|
|
PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString());
|
|
return findRows(stmt, pageNumber, pageRows);
|
|
} catch (SQLException e) {
|
|
handleDebug(e);
|
|
return AB_EMPTY_VECTUMERATOR;
|
|
}
|
|
}
|
|
|
|
public void findById_articoloCodiceVariante(long l_id_articolo, String l_codiceVariante) {
|
|
String s_Sql_Find = "select A.* from ARTICOLO_VARIANTE AS A";
|
|
String s_Sql_Order = "";
|
|
WcString wc = new WcString();
|
|
wc.addWc("id_articolo=" + l_id_articolo);
|
|
wc.addWc("codiceVariante='" + prepareInputMySqlString(l_codiceVariante, false) + "'");
|
|
try {
|
|
PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString());
|
|
findFirstRecord(stmt);
|
|
} catch (SQLException e) {
|
|
handleDebug(e);
|
|
}
|
|
}
|
|
|
|
public String getDescrizione() {
|
|
if (getTipo().getFlgUsaVarianteColori() == 1L) {
|
|
String str = getArticolo().getNome() + " " + getArticolo().getNome();
|
|
return str.trim();
|
|
}
|
|
String temp = getArticolo().getNome() + " " + getArticolo().getNome();
|
|
return temp.trim();
|
|
}
|
|
|
|
public void clearScaledImg(String l_pathPrefix) {
|
|
if (getDBState() == 1) {
|
|
String targetDir = getDocBase() + getDocBase() + "var/" + getArticolo().getPathImg();
|
|
String l_imgCode = "" + getId_articoloVariante() + "_" + getId_articoloVariante() + "_" + getId_articolo() + "_";
|
|
File dir = new File(targetDir);
|
|
File[] imgs = dir.listFiles();
|
|
File tehImage = null;
|
|
for (int i = 0; i < imgs.length; i++) {
|
|
tehImage = imgs[i];
|
|
if (tehImage.getName().indexOf(l_imgCode) != -1)
|
|
tehImage.delete();
|
|
}
|
|
}
|
|
}
|
|
|
|
public Vectumerator getDisponibilitaMovimento() {
|
|
RigaDocumentoCR CR = new RigaDocumentoCR();
|
|
CR.setId_articolo(getId_articolo());
|
|
CR.setId_articoloVariante(getId_articoloVariante());
|
|
CR.setFlgInMagazzino(3L);
|
|
return new RigaDocumento(getApFull()).findMagSaldiArticoloByCR(CR, 0, 0);
|
|
}
|
|
|
|
public Vectumerator getDisponibilitaMovimentoM() {
|
|
MovimentoCR CR = new MovimentoCR();
|
|
CR.setId_articolo(getId_articolo());
|
|
CR.setId_articoloVariante(getId_articoloVariante());
|
|
CR.setFlgInMagazzino(3L);
|
|
return new Movimento(getApFull()).findSaldiArticoloByCR(CR, 0, 0);
|
|
}
|
|
|
|
protected void deleteCascade() {
|
|
String targetDir = getDocBase() + getDocBase();
|
|
for (int i = 0; i < 5; i++)
|
|
new File(targetDir + targetDir).delete();
|
|
}
|
|
|
|
public String getCodiceVariante() {
|
|
return (this.codiceVariante == null) ? "" : this.codiceVariante;
|
|
}
|
|
|
|
public void setCodiceVariante(String codiceVariante) {
|
|
this.codiceVariante = codiceVariante;
|
|
}
|
|
|
|
public void setDescrizioneV_it(String descrizioneV_it) {
|
|
this.descrizioneV_it = descrizioneV_it;
|
|
}
|
|
|
|
public String getNome(String lang) {
|
|
String temp = getArticolo().getNome(lang) + " " + getArticolo().getNome(lang);
|
|
return temp;
|
|
}
|
|
|
|
public String getDescrizioneV(String lang) {
|
|
return getDescTxtLang("descrizioneV", lang);
|
|
}
|
|
|
|
public String getDescrizioneVetrinaV(String lang) {
|
|
return getDescTxtLang("descrizioneVetrinaV", lang);
|
|
}
|
|
|
|
public String getDescrizioneVetrinaV_it() {
|
|
return (this.descrizioneVetrinaV_it == null) ? "" : this.descrizioneVetrinaV_it;
|
|
}
|
|
|
|
public void setDescrizioneVetrinaV_it(String descrizioneCommV_it) {
|
|
this.descrizioneVetrinaV_it = descrizioneCommV_it;
|
|
}
|
|
|
|
public boolean isImgExist(int imgNumber) {
|
|
String targetDir = getDocBase() + getDocBase();
|
|
return isFileExist(targetDir + targetDir);
|
|
}
|
|
|
|
public long getFlgNascondi() {
|
|
return this.flgNascondi;
|
|
}
|
|
|
|
public boolean isVisibileWww() {
|
|
if (getFlgNascondi() == 0L && getArticolo().getFlgNascondi() == 0L && getArticolo().getFlgEscludiWeb() == 0L &&
|
|
getFlgEscludiWebAv() == 0L)
|
|
return true;
|
|
return false;
|
|
}
|
|
|
|
public void setFlgNascondi(long flgNascondi) {
|
|
this.flgNascondi = flgNascondi;
|
|
}
|
|
|
|
public String getNascondi() {
|
|
return Articolo.getNascondi(getFlgNascondi());
|
|
}
|
|
|
|
public String getLinkPreview() {
|
|
if (getApFull() != null) {
|
|
String temp = getParm("SERVERNAME").getTesto();
|
|
return temp + "Catalogo.abl?cmd=md&id_articolo=&id_articoloVariante=" + temp + "&id_tipoMenu=" + getId_articoloVariante() + "&id_tipoSel=" +
|
|
getArticolo().getId_tipo();
|
|
}
|
|
return "";
|
|
}
|
|
|
|
public ResParm addAccessorio(Accessorio row) {
|
|
ArticoloVariante bean = new ArticoloVariante(getApFull());
|
|
if (row.getId_accessorio() != 0L)
|
|
bean.findByPrimaryKey(row.getId_accessorio());
|
|
row.setDBState(bean.getDBState());
|
|
ResParm rp = row.save();
|
|
return rp;
|
|
}
|
|
|
|
public ResParm delAccessorio(Accessorio row) {
|
|
Accessorio bean = new Accessorio(getApFull());
|
|
bean.findByPrimaryKey(row.getId_accessorio());
|
|
return bean.delete();
|
|
}
|
|
|
|
public Vectumerator<Accessorio> getAccessori() {
|
|
return new Accessorio(getApFull()).findById_articoloVariante(getId_articoloVariante(), 0, 0);
|
|
}
|
|
|
|
public Vectumerator<Accessorio> getAccessoriDisponibili() {
|
|
return new Accessorio(getApFull()).findById_articoloVarianteDisponibile(getId_articoloVariante(), 0, 0);
|
|
}
|
|
|
|
public boolean hasAccessori() {
|
|
return getAccessori().hasMoreElements();
|
|
}
|
|
|
|
public ResParm aggiornaQuantitaAv(long l_flgUdm, double l_qta) {
|
|
setFlgUdmAv(l_flgUdm);
|
|
setQuantitaAv(l_qta);
|
|
return save();
|
|
}
|
|
|
|
public long getFlgUdmAv() {
|
|
return this.flgUdmAv;
|
|
}
|
|
|
|
public void setFlgUdmAv(long flgUdmAv) {
|
|
this.flgUdmAv = flgUdmAv;
|
|
}
|
|
|
|
public double getQuantitaAv(Date dataA) {
|
|
if (getParm("USA_MAGAZZINO").isFalse()) {
|
|
RigaDocumento mov = new RigaDocumento(getApFull());
|
|
mov.findMagDisponibilita(getId_articolo(), getId_articoloVariante(), 0L, null, 1L, 0L, dataA);
|
|
return mov.getQuantita();
|
|
}
|
|
return this.quantitaAv;
|
|
}
|
|
|
|
public double getQuantitaAvM(Date dataA) {
|
|
if (getParm("USA_MAGAZZINO").isFalse()) {
|
|
Movimento mov = new Movimento(getApFull());
|
|
mov.findDisponibilita(getId_articolo(), getId_articoloVariante(), 0L, null, 1L, 0L, dataA);
|
|
return mov.getQuantita();
|
|
}
|
|
return this.quantitaAv;
|
|
}
|
|
|
|
public void setQuantitaAv(double quantitaAv) {
|
|
this.quantitaAv = quantitaAv;
|
|
}
|
|
|
|
public String getUdmAv() {
|
|
return TipologiaArticolo.getUdm(getFlgUdmAv());
|
|
}
|
|
|
|
public String getNomeV() {
|
|
return (this.nomeV == null) ? "" : this.nomeV.trim();
|
|
}
|
|
|
|
public void setNomeV(String nomeV) {
|
|
this.nomeV = nomeV;
|
|
}
|
|
|
|
public String getDescrizioneCompleta(String lang) {
|
|
if (lang == null || lang.isEmpty())
|
|
lang = "it";
|
|
StringBuilder sb = new StringBuilder();
|
|
if (getParm("DOC_ARTICOLI_CON_CODICE").isTrue()) {
|
|
sb.append(getCodiceVariante() + " " + getCodiceVariante());
|
|
} else {
|
|
sb.append(getDescrizioneCompletaSenzaCodice(lang));
|
|
}
|
|
if (getParm("DOC_ARTICOLI_CON_TIPO").isTrue() && getTipo() != null) {
|
|
sb.append(" ");
|
|
sb.append(getTipo().getDescrizione(lang));
|
|
}
|
|
return sb.toString();
|
|
}
|
|
|
|
public String getDescrizioneCompletaSenzaCodice(String lang) {
|
|
StringBuilder sb = new StringBuilder();
|
|
if (getTipo().getFlgUsaVarianteColori() == 1L) {
|
|
String l_colore = getColore().getDescrizioneCompleta();
|
|
if (lang != null)
|
|
l_colore = getColore().getDescrizione(lang);
|
|
sb.append(getArticolo().getDescrizioneCompletaSenzaCodice(lang) + " " + getArticolo().getDescrizioneCompletaSenzaCodice(lang));
|
|
} else {
|
|
String l_nome = getNomeV();
|
|
if (lang != null)
|
|
l_nome = getNomeV(lang);
|
|
sb.append(getArticolo().getDescrizioneCompletaSenzaCodice(lang) + " " + getArticolo().getDescrizioneCompletaSenzaCodice(lang));
|
|
}
|
|
return sb.toString();
|
|
}
|
|
|
|
public String getCodiciAlternativiV() {
|
|
return (this.codiciAlternativiV == null) ? "" : this.codiciAlternativiV;
|
|
}
|
|
|
|
public void setCodiciAlternativiV(String codiciAlternativiV) {
|
|
this.codiciAlternativiV = codiciAlternativiV;
|
|
}
|
|
|
|
protected void prepareSave(PreparedStatement ps) throws SQLException {
|
|
String temp = getCodiciAlternativiV();
|
|
if (!temp.isEmpty()) {
|
|
if (!temp.startsWith(","))
|
|
temp = "," + temp;
|
|
if (!temp.endsWith(","))
|
|
temp = temp + ",";
|
|
}
|
|
setCodiciAlternativiV(temp);
|
|
temp = getReadyForWebAv();
|
|
if (isReadyForWeb(getCurrentLang())) {
|
|
if (temp.indexOf(getCurrentLang()) < 0)
|
|
temp = temp + "," + temp;
|
|
} else if (temp.indexOf(getCurrentLang()) >= 0) {
|
|
temp = temp.replace("," + getCurrentLang(), "");
|
|
}
|
|
if (!temp.isEmpty()) {
|
|
if (!temp.startsWith(","))
|
|
temp = "," + temp;
|
|
if (!temp.endsWith(","))
|
|
temp = temp + ",";
|
|
}
|
|
setReadyForWebAv(temp.replace(", ", ","));
|
|
super.prepareSave(ps);
|
|
}
|
|
|
|
public Object getItemId() {
|
|
return new Long(getId_articoloVariante());
|
|
}
|
|
|
|
public double getPrice() {
|
|
return getPrezzoPubblico();
|
|
}
|
|
|
|
public boolean isSale() {
|
|
return getArticolo().isSale();
|
|
}
|
|
|
|
public boolean isRM() {
|
|
return getArticolo().isRM();
|
|
}
|
|
|
|
public double getDiscount() {
|
|
return getArticolo().getPercSconto();
|
|
}
|
|
|
|
public double getCost() {
|
|
return getArticolo().getCostoMinimo();
|
|
}
|
|
|
|
public String getCartItemDescription(String lang) {
|
|
return getNome(lang).replace("/", "/ ");
|
|
}
|
|
|
|
public String getCartItemDescription2(String lang) {
|
|
return getArticolo().getDescrizione(lang);
|
|
}
|
|
|
|
public String getCartItemDescription3(String lang) {
|
|
return getCodiceVariante();
|
|
}
|
|
|
|
public long getCartItemUdm() {
|
|
return getArticolo().getFlgUdm();
|
|
}
|
|
|
|
public double getAvail() {
|
|
return getQuantitaAvByMagFisico(1L);
|
|
}
|
|
|
|
public double getIvaAliquota(long l_id_users) {
|
|
return getArticolo().getIvaAliquota(l_id_users);
|
|
}
|
|
|
|
public long getIvaItemId(long l_id_users) {
|
|
return getArticolo().getIvaItemId(l_id_users);
|
|
}
|
|
|
|
public String getCartItemImage() {
|
|
if (new File(getDocBase() + getDocBase() + getPathImg()).exists())
|
|
return getImgFileName(1);
|
|
return getArticolo().getImgFileName(1);
|
|
}
|
|
|
|
public double getPrice(long l_id_users) {
|
|
if (l_id_users == 0L)
|
|
return getPrice();
|
|
Users user = new Users(getApFull());
|
|
user.findByPrimaryKey(l_id_users);
|
|
if (user.getId_clifor() >= 0L)
|
|
return getPrezzoPubblico(user.getClifor());
|
|
return getPrice();
|
|
}
|
|
|
|
public String getCartItemDescriptionUrl() {
|
|
return getArticolo().getDescrizioneUrl();
|
|
}
|
|
|
|
public String getPathImg() {
|
|
return getArticolo().getPathImg() + "_var/";
|
|
}
|
|
|
|
public double getPrezzoPubblicoIva() {
|
|
return getPrezzoArticoloVarianteIva(null).getPrezzoFinale();
|
|
}
|
|
|
|
public double getPercSconto() {
|
|
return getListinoArticoloVarianteBase().getPercEffettiva();
|
|
}
|
|
|
|
public long getId_tipo() {
|
|
return 0L;
|
|
}
|
|
|
|
public long getId_tipoPadre() {
|
|
return 0L;
|
|
}
|
|
|
|
public String getDescrizioneVetrina() {
|
|
return getDescrizioneVetrinaV_it();
|
|
}
|
|
|
|
public String getDescrizioneVetrina(String lang) {
|
|
return getDescrizioneVetrinaV(lang);
|
|
}
|
|
|
|
public long getId() {
|
|
return getId_articoloVariante();
|
|
}
|
|
|
|
public double getPrezzoPubblicoIva(Clifor l_clifor) {
|
|
return getPrezzoArticoloVarianteIva(l_clifor).getPrezzoFinale();
|
|
}
|
|
|
|
public String getDescrizioneUrl() {
|
|
return getDescrizioneNomeUrl();
|
|
}
|
|
|
|
public int getDispoLevel() {
|
|
double qt = getQuantitaEffettivaAv();
|
|
double dispoLevelScarsa = getParm("CC_QTA_LOW").getNumero();
|
|
if (qt <= 0.0D)
|
|
return 0;
|
|
if (qt > 0.0D && qt < dispoLevelScarsa)
|
|
return 1;
|
|
if (qt >= dispoLevelScarsa)
|
|
return 2;
|
|
return 0;
|
|
}
|
|
|
|
private synchronized void calcolaQuantita() {
|
|
if ((!isQuantitaCalcolateAv() ? true : false) & ((this.id_articoloVariante != 0L) ? true : false)) {
|
|
long l_flgDispo;
|
|
RigaDocumento rd = new RigaDocumento(getApFull());
|
|
rd.findMagDisponibilita(getId_articolo(), getId_articoloVariante(), 0L, null, 1L, 0L, null);
|
|
double q = rd.getQuantita();
|
|
double nr = rd.getNr();
|
|
double kg = rd.getKg();
|
|
double mt = rd.getMt();
|
|
setQuantitaAvW(q);
|
|
setQuantitaAv(q);
|
|
setQuantitaImpegnataAv(new RigaDocumento(getApFull()).getQuantitaImpegnataByArticoloVariante(getId_articoloVariante()));
|
|
double q1 = new RigaDocumento(getApFull()).getQuantitaInArrivoByArticoloVariante(this);
|
|
setQuantitaInArrivoAv(q1);
|
|
if (!getArticolo().usaMagazzino()) {
|
|
setQuantitaEffettivaAv(0.0D);
|
|
} else {
|
|
DoubleOperator dop = new DoubleOperator(getQuantitaAv());
|
|
dop.add(this.quantitaInArrivoAv);
|
|
dop.subtract(this.quantitaImpegnataAv);
|
|
setQuantitaEffettivaAv(dop.getResult());
|
|
}
|
|
this.quantitaMagazzinoMovimentoHtml = Articolo.getMovimentoHtmlDesc(getArticolo().getTipologiaArticolo(), q, nr, kg, mt, this.quantitaInArrivoAv, this.quantitaImpegnataAv, this.quantitaEffettivaAv,
|
|
getArticolo().usaMagazzino(),
|
|
getParm("USA_MAGAZZINO").isTrue(), getNf());
|
|
if (!getArticolo().usaMagazzino()) {
|
|
l_flgDispo = 1L;
|
|
} else {
|
|
l_flgDispo = (q > 0.0D) ? 1L : 0L;
|
|
}
|
|
String SEP = ",";
|
|
MagFisico mf = new MagFisico(getApFull());
|
|
rd = new RigaDocumento(getApFull());
|
|
Vectumerator<MagFisico> vec = mf.findByTipo(0L);
|
|
StringBuilder sb = new StringBuilder();
|
|
while (vec.hasMoreElements()) {
|
|
MagFisico row = (MagFisico)vec.nextElement();
|
|
rd.findMagDisponibilitaPuntuale(getId_articolo(), getId_articoloVariante(), 0L, null, row.getId_magFisico(), 0L, 0L);
|
|
if (rd.getQuantita() > 0.0D) {
|
|
sb.append(row.getId_magFisico());
|
|
sb.append(",");
|
|
}
|
|
}
|
|
if (sb.length() > 0)
|
|
sb.insert(0, ",");
|
|
String temp = "update ARTICOLO_VARIANTE set quantitaMagazzinoMovimentoHtml='" + this.quantitaMagazzinoMovimentoHtml + "', quantitaInArrivoAv=" + this.quantitaInArrivoAv + ", quantitaImpegnataAv=" + this.quantitaImpegnataAv + ", quantitaAv=" + this.quantitaAv + ", quantitaEffettivaAv=" + this.quantitaEffettivaAv + ",quantitaCalcolateAv=true, flgDispo=" + l_flgDispo + ", codiciMagazzino='" +
|
|
|
|
|
|
sb.toString() + "' where id_articoloVariante=" + getId_articoloVariante();
|
|
update(temp);
|
|
setQuantitaCalcolateAv(true);
|
|
}
|
|
}
|
|
|
|
public double getQuantitaEffettivaAv() {
|
|
if (!isQuantitaCalcolateAv())
|
|
calcolaQuantita();
|
|
return this.quantitaEffettivaAv;
|
|
}
|
|
|
|
public double getQuantitaImpegnataAv() {
|
|
if (!isQuantitaCalcolateAv())
|
|
calcolaQuantita();
|
|
return this.quantitaImpegnataAv;
|
|
}
|
|
|
|
public double getQuantitaInArrivoAv() {
|
|
if (!isQuantitaCalcolateAv())
|
|
calcolaQuantita();
|
|
return this.quantitaInArrivoAv;
|
|
}
|
|
|
|
public boolean isQuantitaCalcolateAv() {
|
|
return this.quantitaCalcolateAv;
|
|
}
|
|
|
|
public void setQuantitaEffettivaAv(double quantitaEffettiva) {
|
|
this.quantitaEffettivaAv = quantitaEffettiva;
|
|
}
|
|
|
|
public void setQuantitaImpegnataAv(double quantitaImpeggnata) {
|
|
this.quantitaImpegnataAv = quantitaImpeggnata;
|
|
}
|
|
|
|
public void setQuantitaInArrivoAv(double quantitaInArrivo) {
|
|
this.quantitaInArrivoAv = quantitaInArrivo;
|
|
}
|
|
|
|
public void setQuantitaCalcolateAv(boolean quantitaCalcolateAv) {
|
|
this.quantitaCalcolateAv = quantitaCalcolateAv;
|
|
}
|
|
|
|
public String getDispoLevelDesc() {
|
|
return Articolo.getDispoLevelDesc(getDispoLevel());
|
|
}
|
|
|
|
public boolean isFlgVetrinaByArticolo(long l_id_articolo) {
|
|
String s_Sql_Find = "select A.* from ARTICOLO_VARIANTE AS A";
|
|
String s_Sql_Order = "";
|
|
WcString wc = new WcString();
|
|
wc.addWc("id_articolo=" + l_id_articolo);
|
|
wc.addWc("id_vetrina>0");
|
|
try {
|
|
PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString());
|
|
findFirstRecord(stmt);
|
|
if (getDBState() == 1)
|
|
return true;
|
|
return false;
|
|
} catch (SQLException e) {
|
|
handleDebug(e);
|
|
return false;
|
|
}
|
|
}
|
|
|
|
public String getDescrizioneVetrinaV_itScript() {
|
|
return DBAdapter.prepareScriptString(getDescrizioneVetrinaV_it(), true, false);
|
|
}
|
|
|
|
public boolean useDescLangTables() {
|
|
return true;
|
|
}
|
|
|
|
public String getCartItemTag() {
|
|
return "av_";
|
|
}
|
|
|
|
public String getDescrizioneVetrinaVScript(String lang) {
|
|
return DBAdapter.prepareScriptString(getDescrizioneVetrinaV(lang), true, false);
|
|
}
|
|
|
|
public String getDescrizioneV_it() {
|
|
return this.descrizioneV_it;
|
|
}
|
|
|
|
public Vetrina getVetrina() {
|
|
this.vetrina = (Vetrina)getSecondaryObject(this.vetrina, Vetrina.class, getId_vetrina());
|
|
return this.vetrina;
|
|
}
|
|
|
|
public void setId_vetrina(long id_vetrina) {
|
|
this.id_vetrina = id_vetrina;
|
|
setVetrina(null);
|
|
}
|
|
|
|
public long getId_vetrina() {
|
|
return this.id_vetrina;
|
|
}
|
|
|
|
public void setVetrina(Vetrina vetrina) {
|
|
this.vetrina = vetrina;
|
|
}
|
|
|
|
public ResParm addArticoloTaglia(ArticoloTaglia row) {
|
|
ResParm rp = new ResParm(true);
|
|
ArticoloTaglia bean = new ArticoloTaglia(getApFull());
|
|
bean.findByArticoloTaglia(row.getId_articolo(), row.getId_articoloVariante(), row.getId_taglia());
|
|
if (bean.getDBState() == 1) {
|
|
bean.setCodiceAT(row.getCodiceAT());
|
|
rp = bean.save();
|
|
} else {
|
|
row.setDBState(0);
|
|
rp = row.save();
|
|
}
|
|
return rp;
|
|
}
|
|
|
|
public ResParm delTaglia(ArticoloTaglia row) {
|
|
ArticoloTaglia bean = new ArticoloTaglia(getApFull());
|
|
bean.findByPrimaryKey(row.getId_articoloTaglia());
|
|
return bean.delete();
|
|
}
|
|
|
|
@Deprecated
|
|
public String getQuantitaMagazzinoHtml() {
|
|
StringBuilder sb = new StringBuilder();
|
|
if (getQuantitaAv() < 0.0D) {
|
|
sb.append(" <span class=\"alert\">");
|
|
sb.append(getNf().format(getQuantitaAv()));
|
|
sb.append("</span>");
|
|
} else {
|
|
sb.append(getNf().format(getQuantitaAv()));
|
|
}
|
|
sb.append(" + ");
|
|
sb.append(" <span style=\"color:#00CC00\">");
|
|
sb.append(getNf().format(getQuantitaInArrivoAv()));
|
|
sb.append("</span>");
|
|
sb.append(" - ");
|
|
sb.append(" <span style=\"color:#FF6600\">");
|
|
sb.append(getNf().format(getQuantitaImpegnataAv()));
|
|
sb.append("</span>");
|
|
sb.append(" = ");
|
|
sb.append(" <span style=\"font-weight:bold\">");
|
|
sb.append(getNf().format(getQuantitaEffettivaAv()));
|
|
sb.append("</span>");
|
|
return sb.toString();
|
|
}
|
|
|
|
public double getQtaDaRiordinare() {
|
|
DoubleOperator qrow = new DoubleOperator();
|
|
qrow.subtract(getQuantitaEffettivaAv());
|
|
if (qrow.getResult() <= 0.0D)
|
|
return 0.0D;
|
|
return qrow.getResult();
|
|
}
|
|
|
|
public long getTipoArticoloVetrina() {
|
|
return 1L;
|
|
}
|
|
|
|
private long qtaEbayAv = 0L;
|
|
|
|
private String codiceEanAv;
|
|
|
|
private long id_statoUsato;
|
|
|
|
private StatoUsato statoUsato;
|
|
|
|
private long id_magFisico;
|
|
|
|
private MagFisico magFisico;
|
|
|
|
public double getQtaAttribuitaV() {
|
|
return this.qtaAttribuitaV;
|
|
}
|
|
|
|
public void setQtaAttribuitaV(double qtaAttribuitaV) {
|
|
this.qtaAttribuitaV = qtaAttribuitaV;
|
|
}
|
|
|
|
public double getQtaInProduzioneV() {
|
|
return this.qtaInProduzioneV;
|
|
}
|
|
|
|
public void setQtaInProduzioneV(double qtaInProduzioneV) {
|
|
this.qtaInProduzioneV = qtaInProduzioneV;
|
|
}
|
|
|
|
public String getCodiceSerieV() {
|
|
return (this.codiceSerieV == null) ? "" : this.codiceSerieV;
|
|
}
|
|
|
|
public void setCodiceSerieV(String codiceSerieV) {
|
|
this.codiceSerieV = codiceSerieV;
|
|
}
|
|
|
|
public double getDisponibile() {
|
|
DoubleOperator dp = new DoubleOperator(getQuantitaAv());
|
|
dp.add(getQtaInProduzioneV());
|
|
dp.subtract(getQtaAttribuitaV());
|
|
return dp.getResult();
|
|
}
|
|
|
|
public ResParm addListinoArticolo(ListinoArticolo row) {
|
|
ResParm rp = new ResParm(true);
|
|
ListinoArticolo bean = new ListinoArticolo(getApFull());
|
|
bean.findByArticoloVarianteListino(row.getId_articoloVariante(), row.getId_listino());
|
|
if (bean.getDBState() == 1) {
|
|
bean.setPrezzoLA(row.getPrezzoLA());
|
|
bean.setPercLA(row.getPercLA());
|
|
bean.setPercLA1(row.getPercLA1());
|
|
bean.setPercLA2(row.getPercLA2());
|
|
bean.setPercLA3(row.getPercLA3());
|
|
rp = bean.save();
|
|
} else {
|
|
row.setDBState(0);
|
|
rp = row.save();
|
|
}
|
|
return rp;
|
|
}
|
|
|
|
public ResParm delListinoArticolo(ListinoArticolo row) {
|
|
ListinoArticolo bean = new ListinoArticolo(getApFull());
|
|
bean.findByPrimaryKey(row.getId_listinoArticolo());
|
|
return bean.delete();
|
|
}
|
|
|
|
public Vectumerator findByArticoloTessuti(long l_id_articolo, int pageNumber, int pageRows) {
|
|
String s_Sql_Find = "select A.* from ARTICOLO_VARIANTE AS A";
|
|
String s_Sql_Order = "";
|
|
WcString wc = new WcString();
|
|
wc.addWc("A.id_articolo=" + l_id_articolo);
|
|
try {
|
|
PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString());
|
|
return findRows(stmt, pageNumber, pageRows);
|
|
} catch (SQLException e) {
|
|
handleDebug(e);
|
|
return AB_EMPTY_VECTUMERATOR;
|
|
}
|
|
}
|
|
|
|
public void findByArticoloColoreSerieStock(long l_id_articolo, long l_id_colore, long l_id_serie, long l_flgStock) {
|
|
String s_Sql_Find = "select A.* from ARTICOLO_VARIANTE AS A";
|
|
String s_Sql_Order = "";
|
|
WcString wc = new WcString();
|
|
wc.addWc("A.id_articolo=" + l_id_articolo);
|
|
wc.addWc("A.nomeV=" + l_id_colore);
|
|
wc.addWc("A.flgStockV=" + l_flgStock);
|
|
try {
|
|
PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString());
|
|
findFirstRecord(stmt);
|
|
} catch (SQLException e) {
|
|
handleDebug(e);
|
|
}
|
|
}
|
|
|
|
public void findByArticoloColore(long l_id_articolo, long l_id_colore) {
|
|
String s_Sql_Find = "select A.* from ARTICOLO_VARIANTE AS A";
|
|
String s_Sql_Order = "";
|
|
WcString wc = new WcString();
|
|
wc.addWc("A.id_articolo=" + l_id_articolo);
|
|
wc.addWc("A.id_colore=" + l_id_colore);
|
|
try {
|
|
PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString());
|
|
findFirstRecord(stmt);
|
|
} catch (SQLException e) {
|
|
handleDebug(e);
|
|
}
|
|
}
|
|
|
|
public long getFlgStockV() {
|
|
return this.flgStockV;
|
|
}
|
|
|
|
public void setFlgStockV(long flgStockV) {
|
|
this.flgStockV = flgStockV;
|
|
}
|
|
|
|
public String getDescrizioneVarianteSerie() {
|
|
return getNomeV() + " " + getNomeV();
|
|
}
|
|
|
|
public void setDescrizioneVarianteSerie(String descrizioneVarianteSerie) {
|
|
this.descrizioneVarianteSerie = descrizioneVarianteSerie;
|
|
}
|
|
|
|
public long getId_fornitoreAbituale() {
|
|
ArticoloFornitore af = new ArticoloFornitore(getApFull());
|
|
af.findByArticoloFornitoreAbituale(getId_articolo());
|
|
return af.getId_clifor();
|
|
}
|
|
|
|
public String getQuantitaMagazzinoMovimentoHtml() {
|
|
if (getParm("USA_MAGAZZINO").isTrue())
|
|
return getNf().format(getQuantitaAv());
|
|
if (!isQuantitaCalcolateAv() && this.id_articoloVariante != 0L)
|
|
calcolaQuantita();
|
|
return (this.quantitaMagazzinoMovimentoHtml == null) ? "" : this.quantitaMagazzinoMovimentoHtml;
|
|
}
|
|
|
|
public long getFlgNonOrdinabile() {
|
|
return this.flgNonOrdinabile;
|
|
}
|
|
|
|
public void setFlgNonOrdinabile(long flgNonOrdinabile) {
|
|
this.flgNonOrdinabile = flgNonOrdinabile;
|
|
}
|
|
|
|
public long getFlgDispo() {
|
|
return this.flgDispo;
|
|
}
|
|
|
|
public void setFlgDispo(long flgDispo) {
|
|
this.flgDispo = flgDispo;
|
|
}
|
|
|
|
public long getFlgInAggiornamento() {
|
|
return this.flgInAggiornamento;
|
|
}
|
|
|
|
public void setFlgInAggiornamento(long flgInAggiornamento) {
|
|
this.flgInAggiornamento = flgInAggiornamento;
|
|
}
|
|
|
|
public void setQuantitaMagazzinoMovimentoHtml(String quantitaMagazzinoMovimentoHtml) {
|
|
this.quantitaMagazzinoMovimentoHtml = quantitaMagazzinoMovimentoHtml;
|
|
}
|
|
|
|
public ResParm save() {
|
|
if (getCodiceVariante().isEmpty())
|
|
aggiornaCodiceVariante(String.valueOf(DBAdapter.getTimestamp().getTime()));
|
|
ResParm rp = super.save();
|
|
if (rp.getStatus()) {
|
|
StringBuilder sb = new StringBuilder();
|
|
String lingue = getParm("LANG_AVAILABLE").getTesto();
|
|
if (lingue.isEmpty())
|
|
lingue = "it";
|
|
StringTokenizer st = new StringTokenizer(lingue, ",");
|
|
while (st.hasMoreTokens()) {
|
|
String currentLang = st.nextToken();
|
|
sb.append(getTipo().getDescrizioneCompletaSpaces(currentLang));
|
|
sb.append(" ");
|
|
sb.append(getNomeV(currentLang));
|
|
sb.append(" ");
|
|
sb.append(getArticolo().getNome(currentLang));
|
|
sb.append(" ");
|
|
}
|
|
sb.append(getMarca().getDescrizione());
|
|
sb.append(" ");
|
|
sb.append(getNomeV());
|
|
sb.append(" ");
|
|
sb.append(getCodiceVariante());
|
|
sb.append(" ");
|
|
if (!getKeywordsAv().isEmpty())
|
|
sb.append(getKeywordsAv());
|
|
String descSearch = eliminaDoppioniInStringa(sb.toString().toLowerCase().replace('/', ' ').replace('\\', ' '), 2, true);
|
|
if (descSearch.length() > 1000) {
|
|
setDescrizioneSearchAv(descSearch.substring(0, 990));
|
|
} else {
|
|
setDescrizioneSearchAv(descSearch);
|
|
}
|
|
ListinoArticolo listinoArticoloVarianteBase = new ListinoArticolo(getApFull());
|
|
listinoArticoloVarianteBase.findByArticoloVarianteListino(getId_articoloVariante(), getListinoBase().getId_listino());
|
|
if (listinoArticoloVarianteBase.getId_listinoArticolo() > 0L &&
|
|
listinoArticoloVarianteBase.hasStessiValori(getArticolo().getListinoArticoloBase()))
|
|
listinoArticoloVarianteBase.delete();
|
|
rp = super.save();
|
|
}
|
|
return rp;
|
|
}
|
|
|
|
public ResParm aggiornaCodiceVariante(String l_codice) {
|
|
setCodiceVariante(l_codice);
|
|
return super.save();
|
|
}
|
|
|
|
public void resetCalcoloQuantita() {
|
|
if (getId_articoloVariante() > 0L) {
|
|
update("update ARTICOLO_VARIANTE set quantitaCalcolateAv=false where id_articoloVariante=" + getId_articoloVariante());
|
|
setQuantitaCalcolateAv(false);
|
|
}
|
|
}
|
|
|
|
public Vectumerator findWebByArticoloCR(ArticoloCR CR, int pageNumber, int pageRows) {
|
|
StringBuffer s_Sql_Find = new StringBuffer("select A.* from ARTICOLO_VARIANTE AS A, ARTICOLO AS B LEFT JOIN TIPO AS C2 ON B.id_tipo2=C2.id_tipo, TIPO AS C ");
|
|
if (!CR.getSearchTxtWeb().isEmpty() && !CR.getSearchTxtWeb().equals("*"))
|
|
s_Sql_Find = new StringBuffer("select A.* from ARTICOLO_VARIANTE AS A inner join DESC_TXT_LANG AS X ON A.id_articoloVariante=X.idTabella, ARTICOLO AS B LEFT JOIN TIPO AS C2 ON B.id_tipo2=C2.id_tipo, TIPO AS C ");
|
|
String s_Sql_Order = " order by B.ordine desc, C.ordine, A.id_articolo";
|
|
s_Sql_Order = " order by B.ordine desc,C.ordine,B.nome, A.nomeV, A.id_articolo";
|
|
WcString wc = new WcString();
|
|
wc.addWc("A.id_articolo=B.id_articolo");
|
|
wc.addWc("B.id_tipo=C.id_tipo");
|
|
if (CR.getId_lista1() > 0L) {
|
|
s_Sql_Find.append(" , CARATTERISTICA_ARTICOLO AS CA1");
|
|
wc.addWc("B.id_articolo=CA1.id_articolo");
|
|
}
|
|
if (!CR.getSearchTxtWeb().isEmpty() && !CR.getSearchTxtWeb().equals("*")) {
|
|
StringTokenizer st = new StringTokenizer(CR.getSearchTxtWeb(), " ");
|
|
StringBuffer txt = new StringBuffer("(");
|
|
while (st.hasMoreTokens()) {
|
|
String token = st.nextToken();
|
|
txt.append("(B.nome like '%" + token + "%' or A.nomeV like '%" + token + "%' or X.descrizione254 like '%" + token + "%')");
|
|
if (st.hasMoreTokens())
|
|
txt.append(" and ");
|
|
}
|
|
txt.append(")");
|
|
wc.addWc(txt.toString());
|
|
}
|
|
if (CR.getFlgEscludiWeb() == 0L) {
|
|
wc.addWc("(B.flgEscludiWeb=0 or B.flgEscludiWeb is null)");
|
|
wc.addWc("(A.flgEscludiWebAv=0 or A.flgEscludiWebAv is null)");
|
|
}
|
|
if (CR.getFlgNascondi() == 0L) {
|
|
wc.addWc("(A.flgNascondi=0 or A.flgNascondi is null)");
|
|
wc.addWc("(B.flgNascondi=0 or B.flgNascondi is null)");
|
|
wc.addWc("(C.flgNascondi=0 or C.flgNascondi is null)");
|
|
} else if (CR.getFlgNascondi() > 0L) {
|
|
wc.addWc("A.flgNascondi=" + CR.getFlgNascondi());
|
|
wc.addWc("B.flgNascondi=" + CR.getFlgNascondi());
|
|
wc.addWc("C.flgNascondi=" + CR.getFlgNascondi());
|
|
}
|
|
if (CR.getId_lista1() != 0L)
|
|
wc.addWc("CA1.id_lista=" + CR.getId_lista1());
|
|
if (CR.getId_tipoSel() != 0L)
|
|
wc.addWc("(B.id_tipo=" + CR.getId_tipoSel() + " or C.indici like'%:" + CR.getId_tipoSel() + ":%'or B.id_tipo2=" +
|
|
CR.getId_tipoSel() + " or C2.indici like'%:" + CR.getId_tipoSel() + ":%')");
|
|
try {
|
|
PreparedStatement stmt = getConn().prepareStatement(String.valueOf(s_Sql_Find) + String.valueOf(s_Sql_Find) + wc.toString());
|
|
return findRows(stmt, pageNumber, pageRows);
|
|
} catch (SQLException e) {
|
|
handleDebug(e);
|
|
return AB_EMPTY_VECTUMERATOR;
|
|
}
|
|
}
|
|
|
|
public Date getDataCambiamentoPrezzo() {
|
|
return getListinoArticoloVarianteBase().getDataCambiamentoPrezzoLA();
|
|
}
|
|
|
|
public Date getDataScadenzaOffertaWeb() {
|
|
return getListinoArticoloVarianteBase().getDataScadenzaOffertaLA();
|
|
}
|
|
|
|
public ListinoArticolo getListinoArticoloVarianteBase() {
|
|
if (this.listinoArticoloVarianteBase == null && getApFull() != null && getId_articoloVariante() != 0L) {
|
|
this.listinoArticoloVarianteBase = new ListinoArticolo(getApFull());
|
|
this.listinoArticoloVarianteBase.findByArticoloVarianteListino(getId_articoloVariante(), getListinoBase().getId_listino());
|
|
if (this.listinoArticoloVarianteBase.getId_listinoArticolo() == 0L)
|
|
this.listinoArticoloVarianteBase = getArticolo().getListinoArticoloBase();
|
|
}
|
|
return (this.listinoArticoloVarianteBase == null) ? new ListinoArticolo(getApFull()) : this.listinoArticoloVarianteBase;
|
|
}
|
|
|
|
public Listino getListinoBase() {
|
|
if (this.listinoBase == null && getApFull() != null)
|
|
this.listinoBase = Listino.dammiListinoBase(getApFull());
|
|
return this.listinoBase;
|
|
}
|
|
|
|
public double getAbbuonoPrezzoPubblico() {
|
|
return getListinoArticoloVarianteBase().getAbbuonoPrezzoPubblicoLA();
|
|
}
|
|
|
|
public double getPrezzoPubblico() {
|
|
return getPrezzoArticoloVariante(null).getPrezzoFinale();
|
|
}
|
|
|
|
public double getPrezzoPubblico(Clifor l_clifor) {
|
|
return getPrezzoArticoloVariante(l_clifor).getPrezzoFinale();
|
|
}
|
|
|
|
public double getPrezzoBase() {
|
|
return getListinoArticoloVarianteBase().getPrezzoLA();
|
|
}
|
|
|
|
public double getPrezzoBaseIva() {
|
|
return DBAdapter.conIva(getListinoArticoloVarianteBase().getPrezzoLA(), (double)getArticolo().getIva().getAliquota());
|
|
}
|
|
|
|
public double getPrezzoBaseIva(Users user) {
|
|
if (user.getId_clifor() == 0L)
|
|
return DBAdapter.conIva(getListinoArticoloVarianteBase().getPrezzoLA(), (double)getArticolo().getIva().getAliquota());
|
|
if (user.getClifor().isPrezzoWebEsente())
|
|
return DBAdapter.conIva(getListinoArticoloVarianteBase().getPrezzoLA(), getArticolo().getIvaAliquota(user.getClifor()));
|
|
return DBAdapter.conIva(getListinoArticoloVarianteBase().getPrezzoLA(), (double)getArticolo().getIva().getAliquota());
|
|
}
|
|
|
|
public double getPrezzoBaseIvaConAbbuono() {
|
|
return getListinoArticoloVarianteBase().getPrezzoIvaAbbuonoLA();
|
|
}
|
|
|
|
public double getPriceWVat() {
|
|
return getPrezzoPubblicoIva(null);
|
|
}
|
|
|
|
public double getPriceWVat(long l_id_users) {
|
|
if (l_id_users == 0L)
|
|
return getPriceWVat();
|
|
Users user = new Users(getApFull());
|
|
user.findByPrimaryKey(l_id_users);
|
|
if (user.getId_clifor() >= 0L)
|
|
return getPrezzoPubblicoIva(user.getClifor());
|
|
return getPriceWVat();
|
|
}
|
|
|
|
public double getPrezzoOfferta() {
|
|
return getListinoArticoloVarianteBase().getPrezzoOffertaLA();
|
|
}
|
|
|
|
public double getPercScontoOfferta() {
|
|
return getListinoArticoloVarianteBase().getPercScontoOffertaLA();
|
|
}
|
|
|
|
public double getPrezzoOffertaIva() {
|
|
return getListinoArticoloVarianteBase().getPrezzoOffertaIvaLA();
|
|
}
|
|
|
|
public boolean hasListinoArticoloVarianteBase() {
|
|
if (getId_articoloVariante() > 0L) {
|
|
ListinoArticolo listinoArticoloVarianteBase = new ListinoArticolo(getApFull());
|
|
listinoArticoloVarianteBase.findByArticoloVarianteListino(getId_articoloVariante(), getListinoBase().getId_listino());
|
|
if (listinoArticoloVarianteBase.getId_articolo() > 0L)
|
|
return true;
|
|
return false;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
protected void initFields() {
|
|
super.initFields();
|
|
setPrezzoArticoloVariante(null);
|
|
setPrezzoArticoloVarianteIva(null);
|
|
}
|
|
|
|
public void setPrezzoArticoloVariante(PrezzoArticolo prezzoArticoloVariante) {
|
|
this.prezzoArticoloVariante = prezzoArticoloVariante;
|
|
}
|
|
|
|
public void setPrezzoArticoloVarianteIva(PrezzoArticolo prezzoArticoloVarianteIva) {
|
|
this.prezzoArticoloVarianteIva = prezzoArticoloVarianteIva;
|
|
}
|
|
|
|
public PrezzoArticolo getPrezzoArticoloVariante(Clifor clifor) {
|
|
if (this.prezzoArticoloVariante != null && clifor != null && this.prezzoArticoloVariante.getId_clifor() != clifor.getId_clifor()) {
|
|
this.prezzoArticoloVariante = null;
|
|
this.prezzoArticoloVarianteIva = null;
|
|
}
|
|
if (this.prezzoArticoloVariante == null && getId_articolo() > 0L)
|
|
if (clifor != null && clifor.getListino().getId_listino() > 0L) {
|
|
this.prezzoArticoloVariante = clifor.getListino().getPrezzo(this);
|
|
this.prezzoArticoloVariante.setId_clifor(clifor.getId_clifor());
|
|
} else {
|
|
this.prezzoArticoloVariante = getListinoBase().getPrezzo(this);
|
|
}
|
|
return (this.prezzoArticoloVariante == null) ? new PrezzoArticolo() : this.prezzoArticoloVariante;
|
|
}
|
|
|
|
public PrezzoArticolo getPrezzoArticoloVarianteIva(Clifor clifor) {
|
|
if (this.prezzoArticoloVarianteIva != null && clifor != null && this.prezzoArticoloVarianteIva.getId_clifor() != clifor.getId_clifor()) {
|
|
this.prezzoArticoloVariante = null;
|
|
this.prezzoArticoloVarianteIva = null;
|
|
}
|
|
if (this.prezzoArticoloVarianteIva == null && getId_articolo() > 0L)
|
|
this.prezzoArticoloVarianteIva = getPrezzoArticoloVariante(clifor).conIva((double)getArticolo().getIva().getAliquota());
|
|
return (this.prezzoArticoloVarianteIva == null) ? new PrezzoArticolo() : this.prezzoArticoloVarianteIva;
|
|
}
|
|
|
|
public boolean isOffertaValida() {
|
|
return getListinoArticoloVarianteBase().isOffertaValida();
|
|
}
|
|
|
|
public boolean isPrezzoBarratoValido() {
|
|
if (isOffertaValida())
|
|
return false;
|
|
if (getArticolo().getPrezzoIvatoBarrato() > 0.0D && getArticolo().getPrezzoIvatoBarrato() > getPrezzoPubblicoIva(null))
|
|
return true;
|
|
return false;
|
|
}
|
|
|
|
public PrezzoArticolo getPrezzoArticolo(Clifor l_clifor) {
|
|
return getPrezzoArticoloVariante(l_clifor);
|
|
}
|
|
|
|
public PrezzoArticolo getPrezzoArticoloIva(Clifor l_clifor) {
|
|
return getPrezzoArticoloVarianteIva(l_clifor);
|
|
}
|
|
|
|
public double getQuantitaAv() {
|
|
return getQuantitaAv(null);
|
|
}
|
|
|
|
public String getMetaDesc() {
|
|
return (this.metaDesc == null) ? "" : this.metaDesc.trim();
|
|
}
|
|
|
|
public String getMetaTag() {
|
|
return (this.metaTag == null) ? "" : this.metaTag;
|
|
}
|
|
|
|
public void setMetaDesc(String metaDesc) {
|
|
this.metaDesc = metaDesc;
|
|
}
|
|
|
|
public void setMetaTag(String metaTag) {
|
|
this.metaTag = metaTag;
|
|
}
|
|
|
|
public void findArticoloVarianteByCodiceVariante(String l_codiceVariante) {
|
|
String s_Sql_Find = "select A.* from ARTICOLO_VARIANTE AS A";
|
|
String s_Sql_Order = "";
|
|
WcString wc = new WcString();
|
|
wc.addWc("A.codiceVARIANTE='" + prepareInputMySqlString(l_codiceVariante, false) + "'");
|
|
try {
|
|
PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString());
|
|
findFirstRecord(stmt);
|
|
} catch (SQLException e) {
|
|
handleDebug(e);
|
|
}
|
|
}
|
|
|
|
public String getDescrizioneNomeUrl() {
|
|
return (getArticolo().getNome() + "-" + getArticolo().getNome()).trim();
|
|
}
|
|
|
|
public double getQuantitaAvByMagFisico(long l_id_magFisico) {
|
|
if (getParm("USA_MAGAZZINO").isFalse()) {
|
|
RigaDocumento mov = new RigaDocumento(getApFull());
|
|
mov.findMagFisicoDisponibilita(getId_articolo(), getId_articoloVariante(), 0L, null, l_id_magFisico, 0L, null);
|
|
return mov.getQuantita();
|
|
}
|
|
return this.quantitaAv;
|
|
}
|
|
|
|
public long getFlgWebNoVenditaAv() {
|
|
return this.flgWebNoVenditaAv;
|
|
}
|
|
|
|
public void setFlgWebNoVenditaAv(long flgWebNoVenditaAv) {
|
|
this.flgWebNoVenditaAv = flgWebNoVenditaAv;
|
|
}
|
|
|
|
public long getFlgEscludiWebAv() {
|
|
return this.flgEscludiWebAv;
|
|
}
|
|
|
|
public void setFlgEscludiWebAv(long flgEscludiWebAv) {
|
|
this.flgEscludiWebAv = flgEscludiWebAv;
|
|
}
|
|
|
|
public long getFlgWebNoVendita() {
|
|
if (getArticolo().getFlgWebNoVendita() == 1L)
|
|
return 1L;
|
|
return getFlgWebNoVenditaAv();
|
|
}
|
|
|
|
public boolean isInVendita() {
|
|
if (getArticolo().getFlgWebNoVendita() == 0L && getFlgWebNoVenditaAv() == 0L)
|
|
return true;
|
|
return false;
|
|
}
|
|
|
|
public boolean isArticoloAcquistabile() {
|
|
if (getFlgNascondi() == 0L && getFlgWebNoVenditaAv() == 0L && getArticolo().isArticoloAcquistabile())
|
|
return true;
|
|
return false;
|
|
}
|
|
|
|
public double getQuantitaAvW() {
|
|
if (!isQuantitaCalcolateAv() && this.id_articolo != 0L)
|
|
calcolaQuantita();
|
|
return this.quantitaAvW;
|
|
}
|
|
|
|
public void setQuantitaAvW(double quantitaAvW) {
|
|
this.quantitaAvW = quantitaAvW;
|
|
}
|
|
|
|
public String getNomeV(String lang) {
|
|
if (lang == null || lang.isEmpty())
|
|
lang = "it";
|
|
String temp = getDescTxtLang("nomeVL", lang);
|
|
if (temp.isEmpty())
|
|
return getNomeV();
|
|
return temp;
|
|
}
|
|
|
|
public String getDescrizione(String lang) {
|
|
if (getTipo().getFlgUsaVarianteColori() == 1L) {
|
|
String str = getArticolo().getDescrizione(lang) + " " + getArticolo().getDescrizione(lang);
|
|
return str.trim();
|
|
}
|
|
String temp = getArticolo().getNome() + " " + getArticolo().getNome();
|
|
return temp.trim();
|
|
}
|
|
|
|
public String getDescrizioneCompleta() {
|
|
return getDescrizioneCompleta(null);
|
|
}
|
|
|
|
public String getDescrizioneCompletaSenzaCodice() {
|
|
return getDescrizioneCompletaSenzaCodice(null);
|
|
}
|
|
|
|
public Tipo getTipo() {
|
|
return getArticolo().getTipo();
|
|
}
|
|
|
|
public String getHtmlTableDispoMagInterni() {
|
|
MagFisico mf = new MagFisico(getApFull());
|
|
RigaDocumento rd = new RigaDocumento(getApFull());
|
|
Vectumerator<MagFisico> vec = mf.findByTipo(1L);
|
|
StringBuilder sb = new StringBuilder();
|
|
while (vec.hasMoreElements()) {
|
|
MagFisico row = (MagFisico)vec.nextElement();
|
|
sb.append("<td>");
|
|
rd.findMagDisponibilitaPuntuale(getId_articolo(), getId_articoloVariante(), 0L, null, row.getId_magFisico(), 0L, 0L);
|
|
sb.append(getNf().format(rd.getQuantita()));
|
|
sb.append("</td>");
|
|
}
|
|
return sb.toString();
|
|
}
|
|
|
|
public String getCodiciMagazzino() {
|
|
return (this.codiciMagazzino == null) ? "" : this.codiciMagazzino.trim();
|
|
}
|
|
|
|
public void setCodiciMagazzino(String codiciMagazzino) {
|
|
this.codiciMagazzino = codiciMagazzino;
|
|
}
|
|
|
|
public Vectumerator<ArticoloArticoloTessuto> findArticoliTessuto() {
|
|
ArticoloArticoloTessuto atf = new ArticoloArticoloTessuto(getApFull());
|
|
return atf.findByArticoloVariante(getId_articoloVariante());
|
|
}
|
|
|
|
public Colore getColore() {
|
|
this.colore = (Colore)getSecondaryObject(this.colore, Colore.class, getId_colore());
|
|
return this.colore;
|
|
}
|
|
|
|
public long getId_colore() {
|
|
return this.id_colore;
|
|
}
|
|
|
|
public void setColore(Colore newColore) {
|
|
this.colore = newColore;
|
|
}
|
|
|
|
public void setId_colore(long newId_colore) {
|
|
this.id_colore = newId_colore;
|
|
setColore(null);
|
|
}
|
|
|
|
public ResParm creaComposizioneDaArticoloBase() {
|
|
ResParm rp = new ResParm(true);
|
|
if (getTipo().getFlgUsaVarianteColori() == 1L) {
|
|
Vectumerator<ArticoloArticoloTessuto> vecAat = findArticoliTessuto();
|
|
if (vecAat.getTotNumberOfRecords() == 0) {
|
|
Vectumerator<ArticoloArticoloTessuto> vecCB = getArticolo().findArticoliTessuto();
|
|
while (vecCB.hasMoreElements()) {
|
|
ArticoloArticoloTessuto row = (ArticoloArticoloTessuto)vecCB.nextElement();
|
|
ArticoloTessutoColore atc = new ArticoloTessutoColore(getApFull());
|
|
if (row.getId_articoloTessutoColore() > 0L) {
|
|
atc = row.getArticoloTessutoColore();
|
|
} else {
|
|
System.out.println("atc: at=" + row.getId_articoloTessuto() + " col=" + getId_colore());
|
|
atc.findByArticoloTessutoColore(row.getId_articoloTessuto(), getId_colore());
|
|
if (atc.getId_articoloTessutoColore() == 0L) {
|
|
atc.setId_articoloTessuto(row.getId_articoloTessuto());
|
|
atc.setId_colore(getId_colore());
|
|
rp = atc.save();
|
|
}
|
|
}
|
|
if (rp.getStatus()) {
|
|
ArticoloArticoloTessuto avAt = new ArticoloArticoloTessuto(getApFull());
|
|
avAt.setId_articoloVariante(getId_articoloVariante());
|
|
avAt.setId_articolo(getId_articolo());
|
|
avAt.setId_articoloTessuto(atc.getId_articoloTessuto());
|
|
avAt.setId_articoloTessutoColore(atc.getId_articoloTessutoColore());
|
|
avAt.setMmATT(row.getMmATT());
|
|
avAt.setBordaturaMm(row.getBordaturaMm());
|
|
avAt.setFlgPrincipale(row.getFlgPrincipale());
|
|
rp = avAt.save();
|
|
if (!rp.getStatus())
|
|
break;
|
|
System.out.println(" creaComposizioneDaArticoloBase");
|
|
continue;
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
return rp;
|
|
}
|
|
|
|
public boolean isTessutoPrincipale(long l_id_articoloTessuto, long l_id_articoloTessutoColore) {
|
|
ArticoloArticoloTessuto aat = new ArticoloArticoloTessuto(getApFull());
|
|
aat.findByArticoloVarianteArticoloTessutoColore(getId_articoloVariante(), l_id_articoloTessuto, l_id_articoloTessutoColore);
|
|
if (aat.getFlgPrincipale() == 1L)
|
|
return true;
|
|
return false;
|
|
}
|
|
|
|
public double getCostoTessutoCalc() {
|
|
return -1.0D;
|
|
}
|
|
|
|
public Marca getMarca() {
|
|
return getArticolo().getMarca();
|
|
}
|
|
|
|
public double getPrezzoIvatoBarrato() {
|
|
return getArticolo().getPrezzoIvatoBarrato();
|
|
}
|
|
|
|
public long getFlgNoleggio() {
|
|
return getArticolo().getFlgNoleggio();
|
|
}
|
|
|
|
public double getPrezzoNoleggioIva() {
|
|
return getArticolo().getPrezzoNoleggioIva();
|
|
}
|
|
|
|
public double getPercScontoRispettoAlPrezzoBarrato() {
|
|
if (getPrezzoIvatoBarrato() == 0.0D)
|
|
return 0.0D;
|
|
DoubleOperator dop = new DoubleOperator(getPriceWVat());
|
|
dop.setScale(2, 5);
|
|
dop.divide(getPrezzoIvatoBarrato());
|
|
dop.multiply(100);
|
|
dop.subtract(100);
|
|
return dop.getResult();
|
|
}
|
|
|
|
public double getPercScontoRispettoAOfferta() {
|
|
if (getPrezzoIvatoBarrato() == 0.0D)
|
|
return 0.0D;
|
|
DoubleOperator dop = new DoubleOperator(getPriceWVat());
|
|
dop.setScale(2, 5);
|
|
dop.divide(getPrezzoIvatoBarrato());
|
|
dop.multiply(100);
|
|
dop.subtract(100);
|
|
return dop.getResult();
|
|
}
|
|
|
|
public String getCodicePromozioneAV() {
|
|
return (this.codicePromozioneAV == null) ? "" : this.codicePromozioneAV.trim();
|
|
}
|
|
|
|
public void setCodicePromozioneAV(String codicePromozioneAV) {
|
|
this.codicePromozioneAV = codicePromozioneAV;
|
|
}
|
|
|
|
public String getCodicePromozione() {
|
|
if (getCodicePromozioneAV().isEmpty())
|
|
return getArticolo().getCodicePromozioneA();
|
|
return getCodicePromozioneAV();
|
|
}
|
|
|
|
public String getCCLinkDettaglio(ArticoloCR CR) {
|
|
getArticolo().setId_articoloVariante(getId_articoloVariante());
|
|
return getArticolo().getCCLinkDettaglio(CR);
|
|
}
|
|
|
|
public String getCCDataLayerDetail() {
|
|
return GoogleDataLayerBuilder.getDettaglioProdotto("eec.detail", this);
|
|
}
|
|
|
|
public String getCCLinkDettaglioA(ArticoloCR CR) {
|
|
getArticolo().setId_articoloVariante(getId_articoloVariante());
|
|
return getArticolo().getCCLinkDettaglioA(CR);
|
|
}
|
|
|
|
public String getCCLinkDettaglioTK(ArticoloCR CR) {
|
|
getArticolo().setId_articoloVariante(getId_articoloVariante());
|
|
getArticolo().setId_articoloTaglia(CR.getId_articoloTaglia());
|
|
getArticolo().setId_articoloVarianteKit(CR.getId_articoloVarianteKit());
|
|
return getArticolo().getCCLinkDettaglioTK(CR);
|
|
}
|
|
|
|
public String getCCLinkDettaglioKitTK(ArticoloCR CR) {
|
|
CR.getArticolo().setId_articoloVariante(CR.getId_articoloVariante());
|
|
CR.getArticolo().setId_articoloTaglia(CR.getId_articoloTaglia());
|
|
CR.getArticolo().setId_articoloVarianteKit(getId_articoloVariante());
|
|
return CR.getArticolo().getCCLinkDettaglioTK(CR);
|
|
}
|
|
|
|
public String getCCLinkDettaglioT(ArticoloCR CR) {
|
|
getArticolo().setId_articoloVariante(getId_articoloVariante());
|
|
getArticolo().setId_articoloTaglia(CR.getId_articoloTaglia());
|
|
return getArticolo().getCCLinkDettaglioT(CR);
|
|
}
|
|
|
|
public String getDatoStrutturato(String lang) {
|
|
return null;
|
|
}
|
|
|
|
public Vectumerator<ArticoloVariante> findByArticoloKit(long l_id_articolo) {
|
|
String s_Sql_Find = "SELECT A.* from ARTICOLO_VARIANTE as A inner join KIT as B on B.id_articoloSecondario =A.id_articolo";
|
|
String s_Sql_Order = "";
|
|
WcString wc = new WcString();
|
|
wc.addWc("B.id_articolo=" + l_id_articolo);
|
|
try {
|
|
PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString());
|
|
return findRows(stmt);
|
|
} catch (SQLException e) {
|
|
handleDebug(e);
|
|
return AB_EMPTY_VECTUMERATOR;
|
|
}
|
|
}
|
|
|
|
public String getCCKeyword(String lang) {
|
|
getArticolo().setId_articoloVariante(getId_articoloVariante());
|
|
return getArticolo().getCCKeyword(lang);
|
|
}
|
|
|
|
public String getDescrizioneSearchAv() {
|
|
return (this.descrizioneSearchAv == null) ? "" : this.descrizioneSearchAv.trim();
|
|
}
|
|
|
|
public void setDescrizioneSearchAv(String descrizioneSearchAv) {
|
|
this.descrizioneSearchAv = descrizioneSearchAv;
|
|
}
|
|
|
|
public String getKeywordsAv() {
|
|
return (this.keywordsAv == null) ? "" : this.keywordsAv.trim();
|
|
}
|
|
|
|
public void setKeywordsAv(String keywordAv) {
|
|
this.keywordsAv = keywordAv;
|
|
}
|
|
|
|
public String getEbayItemIdAv() {
|
|
return (this.ebayItemIdAv == null) ? "" : this.ebayItemIdAv.trim();
|
|
}
|
|
|
|
public void setEbayItemIdAv(String ebayItemIdAv) {
|
|
this.ebayItemIdAv = ebayItemIdAv;
|
|
}
|
|
|
|
public long getFlgSubitoAv() {
|
|
return this.flgSubitoAv;
|
|
}
|
|
|
|
public void setFlgSubitoAv(long flgSubitoAv) {
|
|
this.flgSubitoAv = flgSubitoAv;
|
|
}
|
|
|
|
public long getFlgGoogleAv() {
|
|
return this.flgGoogleAv;
|
|
}
|
|
|
|
public void setFlgGoogleAv(long flgGoogleAv) {
|
|
this.flgGoogleAv = flgGoogleAv;
|
|
}
|
|
|
|
public long getFlgEbayAv() {
|
|
return this.flgEbayAv;
|
|
}
|
|
|
|
public void setFlgEbayAv(long flgEbayAv) {
|
|
this.flgEbayAv = flgEbayAv;
|
|
}
|
|
|
|
public String getReadyForWebAv() {
|
|
return (this.readyForWebAv == null) ? "" : this.readyForWebAv.trim();
|
|
}
|
|
|
|
public void setReadyForWebAv(String readyForWebAv) {
|
|
this.readyForWebAv = readyForWebAv;
|
|
}
|
|
|
|
public boolean isReadyForWeb(String lang) {
|
|
if (getId_articolo() == 0L)
|
|
return false;
|
|
if (getNomeV().isEmpty())
|
|
return false;
|
|
if (getDescrizioneV(lang).isEmpty())
|
|
return false;
|
|
if (!isImgExist(1))
|
|
return false;
|
|
if (getFlgSubitoAv() == 1L || getFlgEbayAv() == 1L) {
|
|
String temp = getDescTxtLang("nomeMarketplaceV", lang);
|
|
if (temp.isEmpty() || temp.length() > 50)
|
|
return false;
|
|
temp = getDescTxtLang("descrizioneMarketplaceV", lang);
|
|
if (temp.isEmpty() || temp.length() > 1999)
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
public String getEbayOfferIdAv() {
|
|
return (this.ebayOfferIdAv == null) ? "" : this.ebayOfferIdAv.trim();
|
|
}
|
|
|
|
public void setEbayOfferIdAv(String ebayOfferIdAv) {
|
|
this.ebayOfferIdAv = ebayOfferIdAv;
|
|
}
|
|
|
|
public long getQtaEbayAv() {
|
|
return this.qtaEbayAv;
|
|
}
|
|
|
|
public long getQtaEbayAvDaInviare() {
|
|
if (getQtaEbayAv() == 0L)
|
|
return (long)getQuantitaAv();
|
|
return (long)Math.min((double)getQtaEbayAv(), getQuantitaAv());
|
|
}
|
|
|
|
public void setQtaEbayAv(long flgQtaEbay1Av) {
|
|
this.qtaEbayAv = flgQtaEbay1Av;
|
|
}
|
|
|
|
public long getQtaSuEbayAv() {
|
|
return this.qtaSuEbayAv;
|
|
}
|
|
|
|
public void setQtaSuEbayAv(long qtaSuEbayAv) {
|
|
this.qtaSuEbayAv = qtaSuEbayAv;
|
|
}
|
|
|
|
public long getImpressionAv() {
|
|
return this.impressionAv;
|
|
}
|
|
|
|
public void setImpressionAv(long impressionAv) {
|
|
this.impressionAv = impressionAv;
|
|
}
|
|
|
|
public Timestamp getTmstLastImpressionAv() {
|
|
return this.tmstLastImpressionAv;
|
|
}
|
|
|
|
public void setTmstLastImpressionAv(Timestamp tmstLastImpressionAv) {
|
|
this.tmstLastImpressionAv = tmstLastImpressionAv;
|
|
}
|
|
|
|
public String getCartItemDescriptionCC(String lang) {
|
|
return getCCNome(lang);
|
|
}
|
|
|
|
public String getCCNome(String lang) {
|
|
return getNome(lang).replace("/", "/ ");
|
|
}
|
|
|
|
public void findByCartitemId(CartItemId cii) {
|
|
getArticolo().findByCartitemId(cii);
|
|
}
|
|
|
|
public String getCCLinkDettaglio() {
|
|
getArticolo().setId_articoloVariante(getId_articoloVariante());
|
|
return getArticolo().getCCLinkDettaglio();
|
|
}
|
|
|
|
public String getCCLinkDettaglioCanonical(String lang) {
|
|
ArticoloCR CR = new ArticoloCR();
|
|
CR.setLang(lang);
|
|
return getWwwAddressParm() + getWwwAddressParm();
|
|
}
|
|
|
|
public String getCodiceEanAv() {
|
|
return (this.codiceEanAv == null) ? "" : this.codiceEanAv.trim();
|
|
}
|
|
|
|
public void setCodiceEanAv(String codiceEanAv) {
|
|
this.codiceEanAv = codiceEanAv;
|
|
}
|
|
|
|
public String getDescrizioneMarketplaceV(String lang) {
|
|
if (lang.isEmpty())
|
|
lang = "it";
|
|
return getDescTxtLang("descrizioneMarketplaceV", lang);
|
|
}
|
|
|
|
public long getId_statoUsato() {
|
|
return this.id_statoUsato;
|
|
}
|
|
|
|
public StatoUsato getStatoUsato() {
|
|
this.statoUsato = (StatoUsato)getSecondaryObject(this.statoUsato, StatoUsato.class, new Long(getId_statoUsato()));
|
|
return this.statoUsato;
|
|
}
|
|
|
|
public void setId_statoUsato(long id_statoUsato) {
|
|
this.id_statoUsato = id_statoUsato;
|
|
setStatoUsato(null);
|
|
}
|
|
|
|
public void setStatoUsato(StatoUsato statoUsato) {
|
|
this.statoUsato = statoUsato;
|
|
}
|
|
|
|
public boolean isNuovo() {
|
|
return false;
|
|
}
|
|
|
|
public boolean isUsato() {
|
|
return false;
|
|
}
|
|
|
|
public void findPrimoVisibileByArticolo(long l_id_articolo) {
|
|
String s_Sql_Find = "select A.* from ARTICOLO_VARIANTE AS A, ARTICOLO AS B, TIPO AS C";
|
|
String s_Sql_Order = " order by A.id_articolo";
|
|
WcString wc = new WcString();
|
|
wc.addWc("A.id_articolo=B.id_articolo");
|
|
wc.addWc("B.id_tipo=C.id_tipo");
|
|
wc.addWc("A.id_articolo=" + l_id_articolo);
|
|
wc.addWc("(B.flgEscludiWeb=0 or B.flgEscludiWeb is null)");
|
|
wc.addWc("(A.flgNascondi=0 or A.flgNascondi is null)");
|
|
wc.addWc("(B.flgNascondi=0 or B.flgNascondi is null)");
|
|
wc.addWc("(C.flgNascondi=0 or C.flgNascondi is null)");
|
|
try {
|
|
PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString());
|
|
findFirstRecord(stmt);
|
|
} catch (SQLException e) {
|
|
handleDebug(e);
|
|
}
|
|
}
|
|
|
|
public boolean isCostoSpedizionePreventivo(String l_id_nazione) {
|
|
return getArticolo().isCostoSpedizionePreventivo(l_id_nazione);
|
|
}
|
|
|
|
public double getDeliveryCost(String l_id_nazione) {
|
|
return getArticolo().getDeliveryCost(l_id_nazione);
|
|
}
|
|
|
|
public long getPercentileSpedizione() {
|
|
return getArticolo().getPercentileSpedizione();
|
|
}
|
|
|
|
public void resetImpression() {
|
|
if (getApFull() != null) {
|
|
update("update ARTICOLO_VARIANTE SET impressionAv=0");
|
|
update("update ARTICOLO_VARIANTE SET tmstLastImpressionAv=null");
|
|
getArticolo().resetImpression();
|
|
}
|
|
}
|
|
|
|
public String getCCLinkInfo(ArticoloCR CR) {
|
|
getArticolo().setId_articoloVariante(getId_articoloVariante());
|
|
return getArticolo().getCCLinkInfo(CR);
|
|
}
|
|
|
|
public boolean isScontoTroppoAlto() {
|
|
return getArticolo().isScontoTroppoAlto();
|
|
}
|
|
|
|
public String getCCMetaDescriptionWeb(String lang) {
|
|
getArticolo().setId_articoloVariante(getId_articoloVariante());
|
|
return getArticolo().getCCMetaDescriptionWeb(lang);
|
|
}
|
|
|
|
public String getCCTagH1(String lang) {
|
|
getArticolo().setId_articoloVariante(getId_articoloVariante());
|
|
return getArticolo().getCCTagH1(lang);
|
|
}
|
|
|
|
public String getCCTagH2Web(String lang) {
|
|
getArticolo().setId_articoloVariante(getId_articoloVariante());
|
|
return getArticolo().getCCTagH2Web(lang);
|
|
}
|
|
|
|
public String getCCTagH1Web(String lang) {
|
|
return null;
|
|
}
|
|
|
|
public String getPathIdStepDir() {
|
|
return getArticolo().getPathIdStepDir();
|
|
}
|
|
|
|
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;
|
|
}
|
|
}
|