278 lines
7.7 KiB
Java
278 lines
7.7 KiB
Java
package it.acxent.contab;
|
|
|
|
import it.acxent.anag.MagFisico;
|
|
import it.acxent.db.ApplParmFull;
|
|
import it.acxent.db.ResParm;
|
|
import it.acxent.db.WcString;
|
|
import it.acxent.util.StringTokenizer;
|
|
import it.acxent.util.Vectumerator;
|
|
import java.io.Serializable;
|
|
import java.sql.PreparedStatement;
|
|
import java.sql.SQLException;
|
|
|
|
public class CausaleMagazzino extends _ContabAdapter implements Serializable {
|
|
private static final long serialVersionUID = 1393916760598955841L;
|
|
|
|
private long id_causaleMagazzino;
|
|
|
|
private String descrizione;
|
|
|
|
private long id_magFisicoPartenza;
|
|
|
|
private long id_magFisicoArrivo;
|
|
|
|
private long flgVisualizzazioneArrivo;
|
|
|
|
private long flgVisualizzazionePartenza;
|
|
|
|
private long flgScaricoPartenza;
|
|
|
|
private long flgScaricoArrivo;
|
|
|
|
private MagFisico magFisicoPartenza;
|
|
|
|
private MagFisico magFisicoArrivo;
|
|
|
|
private long flgCaricoArrivo;
|
|
|
|
private long flgCaricoPartenza;
|
|
|
|
private long flgPartenzaInterno;
|
|
|
|
private long flgArrivoInterno;
|
|
|
|
private long flgArrivoLavorazione;
|
|
|
|
private long flgPartenzaLavorazione;
|
|
|
|
private String nota;
|
|
|
|
public CausaleMagazzino(ApplParmFull newApplParmFull) {
|
|
super(newApplParmFull);
|
|
}
|
|
|
|
public CausaleMagazzino() {}
|
|
|
|
public void setId_causaleMagazzino(long newId_causaleMagazzino) {
|
|
this.id_causaleMagazzino = newId_causaleMagazzino;
|
|
}
|
|
|
|
public void setDescrizione(String newDescrizione) {
|
|
this.descrizione = newDescrizione;
|
|
}
|
|
|
|
public void setId_magFisicoPartenza(long newId_magFisicoPartenza) {
|
|
this.id_magFisicoPartenza = newId_magFisicoPartenza;
|
|
setMagFisicoPartenza(null);
|
|
}
|
|
|
|
public void setId_magFisicoArrivo(long newId_magFisicoArrivo) {
|
|
this.id_magFisicoArrivo = newId_magFisicoArrivo;
|
|
setMagFisicoArrivo(null);
|
|
}
|
|
|
|
public void setFlgVisualizzazioneArrivo(long newFlgVisualizzazioneArrivo) {
|
|
this.flgVisualizzazioneArrivo = newFlgVisualizzazioneArrivo;
|
|
}
|
|
|
|
public void setFlgVisualizzazionePartenza(long newFlgVisualizzazionePartenza) {
|
|
this.flgVisualizzazionePartenza = newFlgVisualizzazionePartenza;
|
|
}
|
|
|
|
public void setFlgCaricoPartenza(long newFlgCaricoPartenza) {
|
|
this.flgCaricoPartenza = newFlgCaricoPartenza;
|
|
}
|
|
|
|
public void setFlgScaricoPartenza(long newFlgScaricoPartenza) {
|
|
this.flgScaricoPartenza = newFlgScaricoPartenza;
|
|
}
|
|
|
|
public void setFlgCaricoArrivo(long newFlgCaricoArrivo) {
|
|
this.flgCaricoArrivo = newFlgCaricoArrivo;
|
|
}
|
|
|
|
public void setFlgScaricoArrivo(long newFlgScaricoArrivo) {
|
|
this.flgScaricoArrivo = newFlgScaricoArrivo;
|
|
}
|
|
|
|
public long getId_causaleMagazzino() {
|
|
return this.id_causaleMagazzino;
|
|
}
|
|
|
|
public String getDescrizione() {
|
|
return (this.descrizione == null) ? "" : this.descrizione.trim();
|
|
}
|
|
|
|
public String getDescrizionePartenza() {
|
|
if (getId_magFisicoPartenza() == 0L) {
|
|
StringBuilder sb = new StringBuilder();
|
|
if (getFlgPartenzaInterno() == 1L)
|
|
sb.append("Qualsiasi magazzino interno - ");
|
|
if (getFlgPartenzaLavorazione() == 1L)
|
|
sb.append("Qualsiasi magazzino Lav. ");
|
|
return sb.toString();
|
|
}
|
|
return getMagFisicoPartenza().getDescrizione();
|
|
}
|
|
|
|
public String getDescrizioneArrivo() {
|
|
if (getId_magFisicoArrivo() == 0L) {
|
|
StringBuilder sb = new StringBuilder();
|
|
if (getFlgArrivoInterno() == 1L)
|
|
sb.append("Qualsiasi magazzino interno - ");
|
|
if (getFlgArrivoLavorazione() == 1L)
|
|
sb.append("Qualsiasi magazzino Lav. ");
|
|
return sb.toString();
|
|
}
|
|
return getMagFisicoArrivo().getDescrizione();
|
|
}
|
|
|
|
public long getId_magFisicoPartenza() {
|
|
return this.id_magFisicoPartenza;
|
|
}
|
|
|
|
public long getId_magFisicoArrivo() {
|
|
return this.id_magFisicoArrivo;
|
|
}
|
|
|
|
public long getFlgVisualizzazioneArrivo() {
|
|
return this.flgVisualizzazioneArrivo;
|
|
}
|
|
|
|
public long getFlgVisualizzazionePartenza() {
|
|
return this.flgVisualizzazionePartenza;
|
|
}
|
|
|
|
public long getFlgCaricoPartenza() {
|
|
return this.flgCaricoPartenza;
|
|
}
|
|
|
|
public long getFlgScaricoPartenza() {
|
|
return this.flgScaricoPartenza;
|
|
}
|
|
|
|
public long getFlgCaricoArrivo() {
|
|
return this.flgCaricoArrivo;
|
|
}
|
|
|
|
public long getFlgScaricoArrivo() {
|
|
return this.flgScaricoArrivo;
|
|
}
|
|
|
|
public void setMagFisicoPartenza(MagFisico newMagFisicoPartenza) {
|
|
this.magFisicoPartenza = newMagFisicoPartenza;
|
|
}
|
|
|
|
public MagFisico getMagFisicoPartenza() {
|
|
this.magFisicoPartenza = (MagFisico)getSecondaryObject(this.magFisicoPartenza, MagFisico.class, getId_magFisicoPartenza());
|
|
return this.magFisicoPartenza;
|
|
}
|
|
|
|
public void setMagFisicoArrivo(MagFisico newMagFisicoArrivo) {
|
|
this.magFisicoArrivo = newMagFisicoArrivo;
|
|
}
|
|
|
|
public MagFisico getMagFisicoArrivo() {
|
|
this.magFisicoArrivo = (MagFisico)getSecondaryObject(this.magFisicoArrivo, MagFisico.class, getId_magFisicoArrivo());
|
|
return this.magFisicoArrivo;
|
|
}
|
|
|
|
protected void deleteCascade() {}
|
|
|
|
public Vectumerator<CausaleMagazzino> findByCR(CausaleMagazzinoCR CR, int pageNumber, int pageRows) {
|
|
String s_Sql_Find = "select A.* from CAUSALE_MAGAZZINO AS A";
|
|
String s_Sql_Order = " order by 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 + "%')");
|
|
if (st.hasMoreTokens())
|
|
txt.append(" and ");
|
|
}
|
|
txt.append(")");
|
|
wc.addWc(txt.toString());
|
|
}
|
|
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 long getFlgPartenzaInterno() {
|
|
return this.flgPartenzaInterno;
|
|
}
|
|
|
|
public void setFlgPartenzaInterno(long flgPartenzaInterno) {
|
|
this.flgPartenzaInterno = flgPartenzaInterno;
|
|
}
|
|
|
|
public long getFlgArrivoInterno() {
|
|
return this.flgArrivoInterno;
|
|
}
|
|
|
|
public void setFlgArrivoInterno(long flgArrivoInterno) {
|
|
this.flgArrivoInterno = flgArrivoInterno;
|
|
}
|
|
|
|
public long getFlgArrivoLavorazione() {
|
|
return this.flgArrivoLavorazione;
|
|
}
|
|
|
|
public void setFlgArrivoLavorazione(long flgArrivoLavorazione) {
|
|
this.flgArrivoLavorazione = flgArrivoLavorazione;
|
|
}
|
|
|
|
public long getFlgPartenzaLavorazione() {
|
|
return this.flgPartenzaLavorazione;
|
|
}
|
|
|
|
public void setFlgPartenzaLavorazione(long flgPartenzaLavorazione) {
|
|
this.flgPartenzaLavorazione = flgPartenzaLavorazione;
|
|
}
|
|
|
|
public String getNota() {
|
|
return (this.nota == null) ? "" : this.nota.trim();
|
|
}
|
|
|
|
public void setNota(String nota) {
|
|
this.nota = nota;
|
|
}
|
|
|
|
public ResParm save() {
|
|
if (getFlgArrivoInterno() == 1L || getFlgArrivoLavorazione() == 1L)
|
|
setId_magFisicoArrivo(0L);
|
|
if (getFlgPartenzaInterno() == 1L || getFlgPartenzaLavorazione() == 1L)
|
|
setId_magFisicoPartenza(0L);
|
|
return super.save();
|
|
}
|
|
|
|
public boolean isMagArrivo() {
|
|
if (getId_magFisicoArrivo() > 0L || isMagArrivoDaScegliere())
|
|
return true;
|
|
return false;
|
|
}
|
|
|
|
public boolean isMagPartenza() {
|
|
if (getId_magFisicoPartenza() > 0L || isMagPartenzaDaScegliere())
|
|
return true;
|
|
return false;
|
|
}
|
|
|
|
public boolean isMagArrivoDaScegliere() {
|
|
if (getFlgArrivoInterno() == 1L || getFlgArrivoLavorazione() == 1L)
|
|
return true;
|
|
return false;
|
|
}
|
|
|
|
public boolean isMagPartenzaDaScegliere() {
|
|
if (getFlgPartenzaInterno() == 1L || getFlgPartenzaLavorazione() == 1L)
|
|
return true;
|
|
return false;
|
|
}
|
|
}
|