147 lines
3.9 KiB
Java
147 lines
3.9 KiB
Java
|
|
package it.acxent.tex.anag;
|
||
|
|
|
||
|
|
import it.acxent.contab.RigaDocumento;
|
||
|
|
import it.acxent.db.ApplParmFull;
|
||
|
|
import it.acxent.db.DBAdapter;
|
||
|
|
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 Telaio extends DBAdapter implements Serializable {
|
||
|
|
private static final long serialVersionUID = 1550483866536L;
|
||
|
|
|
||
|
|
public static final long TIPO_TELAIO_STD = 0L;
|
||
|
|
|
||
|
|
public static final long TIPO_TELAIO_JACQUARD = 1L;
|
||
|
|
|
||
|
|
private long id_telaio;
|
||
|
|
|
||
|
|
private String descrizione;
|
||
|
|
|
||
|
|
private String codiceTelaio;
|
||
|
|
|
||
|
|
private long flgTipoTelaio;
|
||
|
|
|
||
|
|
private long colpiMinuto;
|
||
|
|
|
||
|
|
private RigaDocumento rigaDocumento;
|
||
|
|
|
||
|
|
public Telaio(ApplParmFull newApplParmFull) {
|
||
|
|
super(newApplParmFull);
|
||
|
|
}
|
||
|
|
|
||
|
|
public Telaio() {}
|
||
|
|
|
||
|
|
public void setId_telaio(long newId_telaio) {
|
||
|
|
this.id_telaio = newId_telaio;
|
||
|
|
}
|
||
|
|
|
||
|
|
public void setDescrizione(String newDescrizione) {
|
||
|
|
this.descrizione = newDescrizione;
|
||
|
|
}
|
||
|
|
|
||
|
|
public void setCodiceTelaio(String newCodiceTelaio) {
|
||
|
|
this.codiceTelaio = newCodiceTelaio;
|
||
|
|
}
|
||
|
|
|
||
|
|
public void setFlgTipoTelaio(long newFlgTipoTelaio) {
|
||
|
|
this.flgTipoTelaio = newFlgTipoTelaio;
|
||
|
|
}
|
||
|
|
|
||
|
|
public void setColpiMinuto(long newColpiMinuto) {
|
||
|
|
this.colpiMinuto = newColpiMinuto;
|
||
|
|
}
|
||
|
|
|
||
|
|
public long getId_telaio() {
|
||
|
|
return this.id_telaio;
|
||
|
|
}
|
||
|
|
|
||
|
|
public String getDescrizione() {
|
||
|
|
return (this.descrizione == null) ? "" : this.descrizione.trim();
|
||
|
|
}
|
||
|
|
|
||
|
|
public String getCodiceTelaio() {
|
||
|
|
return (this.codiceTelaio == null) ? "" : this.codiceTelaio.trim();
|
||
|
|
}
|
||
|
|
|
||
|
|
public String getTipoTelaio() {
|
||
|
|
return getTipoTelaio(getFlgTipoTelaio());
|
||
|
|
}
|
||
|
|
|
||
|
|
public long getColpiMinuto() {
|
||
|
|
return this.colpiMinuto;
|
||
|
|
}
|
||
|
|
|
||
|
|
protected ResParm checkDeleteCascade() {
|
||
|
|
return new ResParm(true);
|
||
|
|
}
|
||
|
|
|
||
|
|
protected void deleteCascade() {}
|
||
|
|
|
||
|
|
public Vectumerator<Telaio> findByCR(TelaioCR CR, int pageNumber, int pageRows) {
|
||
|
|
String s_Sql_Find = "select A.* from TELAIO AS A";
|
||
|
|
String s_Sql_Order = " order by 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.Cognome like '%" + token + "%' or A.Nome 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) {
|
||
|
|
removeCPConnection();
|
||
|
|
handleDebug(e);
|
||
|
|
return AB_EMPTY_VECTUMERATOR;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
public long getFlgTipoTelaio() {
|
||
|
|
return this.flgTipoTelaio;
|
||
|
|
}
|
||
|
|
|
||
|
|
public long findColpiIniziali() {
|
||
|
|
if (getId_telaio() <= 0L)
|
||
|
|
return 0L;
|
||
|
|
RigaDocumento doc = new RigaDocumento(getApFull());
|
||
|
|
doc.findByTelaioUltimo(getId_telaio());
|
||
|
|
if (doc.getId_rigaDocumento() == 0L)
|
||
|
|
return 0L;
|
||
|
|
return doc.getColpoFinaleRiga();
|
||
|
|
}
|
||
|
|
|
||
|
|
public String getDescrizioneCompleta() {
|
||
|
|
StringBuilder sb = new StringBuilder(getDescrizione());
|
||
|
|
sb.append(" mt. lav. ");
|
||
|
|
sb.append(getNf().format(getRigaDocumento().getDatiTelaioInLavorazione(getId_telaio())));
|
||
|
|
return sb.toString();
|
||
|
|
}
|
||
|
|
|
||
|
|
public static final String getTipoTelaio(long l_flgTipoTelaio) {
|
||
|
|
switch ((int)l_flgTipoTelaio) {
|
||
|
|
case 1:
|
||
|
|
return "Jacquard";
|
||
|
|
case 0:
|
||
|
|
return "Standard";
|
||
|
|
}
|
||
|
|
return "";
|
||
|
|
}
|
||
|
|
|
||
|
|
public RigaDocumento getRigaDocumento() {
|
||
|
|
if (this.rigaDocumento == null)
|
||
|
|
this.rigaDocumento = new RigaDocumento(getApFull());
|
||
|
|
return this.rigaDocumento;
|
||
|
|
}
|
||
|
|
}
|