www in docker support
This commit is contained in:
parent
539a848e95
commit
c227fce036
2145 changed files with 399596 additions and 58 deletions
|
|
@ -0,0 +1,702 @@
|
|||
package it.acxent.tex.lav;
|
||||
|
||||
import it.acxent.anag.Clifor;
|
||||
import it.acxent.contab.Documento;
|
||||
import it.acxent.contab.RigaDocumento;
|
||||
import it.acxent.db.ApplParmFull;
|
||||
import it.acxent.db.DBAdapter;
|
||||
import it.acxent.db.OrString;
|
||||
import it.acxent.db.ResParm;
|
||||
import it.acxent.db.WcString;
|
||||
import it.acxent.util.DoubleOperator;
|
||||
import it.acxent.util.SimpleDateFormat;
|
||||
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.sql.Timestamp;
|
||||
import java.util.Calendar;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
public class LavPezza extends DBAdapter implements Serializable {
|
||||
private static final long serialVersionUID = 1551182243537L;
|
||||
|
||||
private long id_rigaDocumento;
|
||||
|
||||
private Timestamp tsInserimento;
|
||||
|
||||
private String codicePezza;
|
||||
|
||||
private RigaDocumento rigaDocumento;
|
||||
|
||||
private Clifor clifor;
|
||||
|
||||
private long id_clifor;
|
||||
|
||||
private double mtPezza;
|
||||
|
||||
private RigaDocumento rigaDocumentoBolla;
|
||||
|
||||
private long id_rigaDocumentoBolla;
|
||||
|
||||
private long id_lavPezza;
|
||||
|
||||
private String codicePancale;
|
||||
|
||||
private long numColpi;
|
||||
|
||||
private long count;
|
||||
|
||||
public LavPezza(ApplParmFull newApplParmFull) {
|
||||
super(newApplParmFull);
|
||||
}
|
||||
|
||||
public LavPezza() {}
|
||||
|
||||
public void setId_lavPezza(long newId_lavPezza) {
|
||||
this.id_lavPezza = newId_lavPezza;
|
||||
}
|
||||
|
||||
public void setId_rigaDocumento(long newId_rigaDocumento) {
|
||||
this.id_rigaDocumento = newId_rigaDocumento;
|
||||
setRigaDocumento(null);
|
||||
}
|
||||
|
||||
public void setTsInserimento(Timestamp newTsInserimento) {
|
||||
this.tsInserimento = newTsInserimento;
|
||||
}
|
||||
|
||||
public void setCodicePezza(String newCodicePezza) {
|
||||
this.codicePezza = newCodicePezza;
|
||||
}
|
||||
|
||||
public long getId_lavPezza() {
|
||||
return this.id_lavPezza;
|
||||
}
|
||||
|
||||
public long getId_rigaDocumento() {
|
||||
return this.id_rigaDocumento;
|
||||
}
|
||||
|
||||
public Timestamp getTsInserimento() {
|
||||
return this.tsInserimento;
|
||||
}
|
||||
|
||||
public String getCodicePezza() {
|
||||
return (this.codicePezza == null) ? "" : this.codicePezza.trim();
|
||||
}
|
||||
|
||||
public void setRigaDocumento(RigaDocumento newRigaDocumento) {
|
||||
this.rigaDocumento = newRigaDocumento;
|
||||
}
|
||||
|
||||
public RigaDocumento getRigaDocumento() {
|
||||
this.rigaDocumento = (RigaDocumento)getSecondaryObject(this.rigaDocumento, RigaDocumento.class, getId_rigaDocumento());
|
||||
return this.rigaDocumento;
|
||||
}
|
||||
|
||||
protected ResParm checkDeleteCascade() {
|
||||
return new ResParm(true);
|
||||
}
|
||||
|
||||
protected void deleteCascade() {}
|
||||
|
||||
public long getTotPezzeByDocumentoDTESS(long l_id_documento) {
|
||||
String s_Sql_Find = "select count(*) as tot from LAV_PEZZA AS A inner join RIGA_DOCUMENTO AS B ON A.id_rigaDocumento=B.id_rigaDocumento";
|
||||
WcString wc = new WcString();
|
||||
wc.addWc("B.id_documento=" + l_id_documento);
|
||||
try {
|
||||
PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find);
|
||||
return (long)getTots(stmt);
|
||||
} catch (SQLException e) {
|
||||
handleDebug(e);
|
||||
return 0L;
|
||||
}
|
||||
}
|
||||
|
||||
public long getTotPezzeInviateDaFatturareByDocumentoDTESS(long l_id_documento) {
|
||||
String s_Sql_Find = "select count(*) as tot from LAV_PEZZA AS A inner join RIGA_DOCUMENTO AS RDDISPO ON A.id_rigaDocumento=RDDISPO.id_rigadocumento inner join RIGA_DOCUMENTO AS RDBOLLA ON RDBOLLA.id_rigaDocumento=A.id_rigaDocumentoBolla left join RIGA_DOCUMENTO AS RDFT ON RDFT.id_documento=RDBOLLA.id_documentoPadre";
|
||||
WcString wc = new WcString();
|
||||
wc.addWc("RDDISPO.id_documento=" + l_id_documento);
|
||||
wc.addWc("RDFT.id_rigaDocumento is null");
|
||||
try {
|
||||
PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find);
|
||||
return (long)getTots(stmt);
|
||||
} catch (SQLException e) {
|
||||
handleDebug(e);
|
||||
return 0L;
|
||||
}
|
||||
}
|
||||
|
||||
public long getTotPezzeInviateDaFatturareByRigaDocumentoDTESS(long l_id_rigaDocumento, HashMap<Long, Documento> hsDdtDaFatturare) {
|
||||
String s_Sql_Find = "select count(*) as tot from LAV_PEZZA AS A inner join RIGA_DOCUMENTO AS RDDISPO ON A.id_rigaDocumento=RDDISPO.id_rigadocumento inner join RIGA_DOCUMENTO AS RDBOLLA ON RDBOLLA.id_rigaDocumento=A.id_rigaDocumentoBolla left join RIGA_DOCUMENTO AS RDFT ON RDFT.id_documento=RDBOLLA.id_documentoPadre";
|
||||
WcString wc = new WcString();
|
||||
wc.addWc("RDDISPO.id_rigaDocumento=" + l_id_rigaDocumento);
|
||||
wc.addWc("RDFT.id_rigaDocumento is null");
|
||||
if (hsDdtDaFatturare != null) {
|
||||
OrString orBolle = new OrString();
|
||||
for (Map.Entry<Long, Documento> me : hsDdtDaFatturare.entrySet())
|
||||
orBolle.addOr("RDBOLLA.id_documento=" + me.getValue().getId_documento());
|
||||
wc.addWc(orBolle.toString());
|
||||
}
|
||||
try {
|
||||
PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find);
|
||||
return (long)getTots(stmt);
|
||||
} catch (SQLException e) {
|
||||
handleDebug(e);
|
||||
return 0L;
|
||||
}
|
||||
}
|
||||
|
||||
public long getTotPezzeFatturateByDocumentoDTESS(long l_id_documento) {
|
||||
String s_Sql_Find = "select count(*) as tot from LAV_PEZZA AS A inner join RIGA_DOCUMENTO AS B ON A.id_rigaDocumento=B.id_rigaDocumento inner join RIGA_DOCUMENTO AS BF ON A.id_rigaDocumentoBolla=BF.id_rigaDocumento inner join RIGA_DOCUMENTO AS RDFT ON BF.id_rigaDocumentoPadre=RDFT.id_rigaDocumento";
|
||||
WcString wc = new WcString();
|
||||
wc.addWc("B.id_documento=" + l_id_documento);
|
||||
try {
|
||||
PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find);
|
||||
return (long)getTots(stmt);
|
||||
} catch (SQLException e) {
|
||||
handleDebug(e);
|
||||
return 0L;
|
||||
}
|
||||
}
|
||||
|
||||
public double getTotMetriByDocumentoDTESS(long l_id_documento, boolean soloInviate) {
|
||||
String s_Sql_Find = "select sum(mtPezza) as _sum from LAV_PEZZA AS A inner join RIGA_DOCUMENTO AS B ON A.id_rigaDocumento=B.id_rigaDocumento";
|
||||
WcString wc = new WcString();
|
||||
wc.addWc("B.id_documento=" + l_id_documento);
|
||||
if (soloInviate)
|
||||
wc.addWc("A.id_rigaDocumentoBolla>0");
|
||||
try {
|
||||
PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find);
|
||||
return getSum(stmt);
|
||||
} catch (SQLException e) {
|
||||
handleDebug(e);
|
||||
return 0.0D;
|
||||
}
|
||||
}
|
||||
|
||||
public double getTotMetriDaFatturareByDocumentoDTESS(long l_id_documento) {
|
||||
String s_Sql_Find = "select sum(mtPezza) as _sum from LAV_PEZZA AS A inner join RIGA_DOCUMENTO AS RDDISPO ON A.id_rigaDocumento=RDDISPO.id_rigadocumento inner join RIGA_DOCUMENTO AS RDBOLLA ON RDBOLLA.id_rigaDocumento=A.id_rigaDocumentoBolla left join RIGA_DOCUMENTO AS RDFT ON RDFT.id_documento=RDBOLLA.id_documentoPadre";
|
||||
WcString wc = new WcString();
|
||||
wc.addWc("RDDISPO.id_documento=" + l_id_documento);
|
||||
wc.addWc("RDFT.id_rigaDocumento is null");
|
||||
try {
|
||||
PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find);
|
||||
return getSum(stmt);
|
||||
} catch (SQLException e) {
|
||||
handleDebug(e);
|
||||
return 0.0D;
|
||||
}
|
||||
}
|
||||
|
||||
public double getTotMetriDaFatturareByRigaDocumentoDTESS(long l_id_rigaDocumento, HashMap<Long, Documento> hsDdtDaFatturare) {
|
||||
String s_Sql_Find = "select sum(mtPezza) as _sum from LAV_PEZZA AS A inner join RIGA_DOCUMENTO AS RDDISPO ON A.id_rigaDocumento=RDDISPO.id_rigadocumento inner join RIGA_DOCUMENTO AS RDBOLLA ON RDBOLLA.id_rigaDocumento=A.id_rigaDocumentoBolla left join RIGA_DOCUMENTO AS RDFT ON RDFT.id_documento=RDBOLLA.id_documentoPadre";
|
||||
WcString wc = new WcString();
|
||||
wc.addWc("RDDISPO.id_rigaDocumento=" + l_id_rigaDocumento);
|
||||
wc.addWc("RDFT.id_rigaDocumento is null");
|
||||
if (hsDdtDaFatturare != null) {
|
||||
OrString orBolle = new OrString();
|
||||
for (Map.Entry<Long, Documento> me : hsDdtDaFatturare.entrySet())
|
||||
orBolle.addOr("RDBOLLA.id_documento=" + me.getValue().getId_documento());
|
||||
wc.addWc(orBolle.toString());
|
||||
}
|
||||
try {
|
||||
PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find);
|
||||
return getSum(stmt);
|
||||
} catch (SQLException e) {
|
||||
handleDebug(e);
|
||||
return 0.0D;
|
||||
}
|
||||
}
|
||||
|
||||
public void findByCodicePezzaClifor(String l_codicePezza, long l_id_clifor) {
|
||||
String s_Sql_Find = "select A.* from LAV_PEZZA AS A";
|
||||
String s_Sql_Order = "";
|
||||
WcString wc = new WcString();
|
||||
wc.addWc("A.codicePezza='" + l_codicePezza + "'");
|
||||
wc.addWc("A.id_clifor=" + l_id_clifor);
|
||||
try {
|
||||
PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString());
|
||||
findFirstRecord(stmt);
|
||||
} catch (SQLException e) {
|
||||
removeCPConnection();
|
||||
handleDebug(e);
|
||||
}
|
||||
}
|
||||
|
||||
public ResParm save() {
|
||||
LavPezza bean = new LavPezza(getApFull());
|
||||
long l_id_cliforPancale = bean.findClientePancaleNonInviato(getCodicePancale());
|
||||
if (l_id_cliforPancale > 0L && l_id_cliforPancale != getId_clifor()) {
|
||||
Clifor clifor = new Clifor(getApFull());
|
||||
clifor.findByPrimaryKey(l_id_cliforPancale);
|
||||
return new ResParm(false, "Errore! pezza " + getCodicePezza() + ": Pancale " + getCodicePancale() + " con pezze di " +
|
||||
clifor.getDescrizioneCliente());
|
||||
}
|
||||
if (getTsInserimento() == null)
|
||||
setTsInserimento(getTimestamp());
|
||||
if (getNumColpi() > 0L) {
|
||||
if (getRigaDocumento().getNumColpiDM() > 0L) {
|
||||
DoubleOperator dop = new DoubleOperator((float)getNumColpi());
|
||||
dop.setScale(2, 5);
|
||||
dop.divide((float)getRigaDocumento().getNumColpiDM());
|
||||
setMtPezza(dop.getResult());
|
||||
} else {
|
||||
return new ResParm(false, "Errore! Non è impostato Numero colpi metro sulla disposizione!");
|
||||
}
|
||||
} else if (getMtPezza() <= 0.0D) {
|
||||
return new ResParm(false, "Errore! non hai impostato numero colpi o metri!");
|
||||
}
|
||||
return super.save();
|
||||
}
|
||||
|
||||
public ResParm superSave() {
|
||||
return super.save();
|
||||
}
|
||||
|
||||
public Clifor getClifor() {
|
||||
this.clifor = (Clifor)getSecondaryObject(this.clifor, Clifor.class, getId_clifor());
|
||||
return this.clifor;
|
||||
}
|
||||
|
||||
public long getId_clifor() {
|
||||
return this.id_clifor;
|
||||
}
|
||||
|
||||
public void setClifor(Clifor newClifor) {
|
||||
this.clifor = newClifor;
|
||||
}
|
||||
|
||||
public void setId_clifor(long newId_clifor) {
|
||||
this.id_clifor = newId_clifor;
|
||||
setClifor(null);
|
||||
}
|
||||
|
||||
public Vectumerator<LavPezza> findByCR(LavPezzaCR CR, int pageNumber, int pageRows) {
|
||||
String s_Sql_Find = "select A.* from LAV_PEZZA AS A";
|
||||
String s_Sql_Order = " order by C.riferimento, B.descrizioneRiga, A.codicePezza, tsInserimento asc";
|
||||
WcString wc = new WcString();
|
||||
s_Sql_Find = s_Sql_Find + " inner join RIGA_DOCUMENTO AS B on A.id_rigaDocumento=B.id_rigaDocumento inner join DOCUMENTO as C on C.id_documento=B.id_documento";
|
||||
if (CR.getId_documentoBolla() > 0L)
|
||||
s_Sql_Find = s_Sql_Find + " inner join RIGA_DOCUMENTO AS BBOLLA on A.id_rigaDocumentoBolla=BBOLLA.id_rigaDocumento";
|
||||
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());
|
||||
}
|
||||
if (CR.getId_rigaDocumento() > 0L)
|
||||
wc.addWc("A.id_rigaDocumento=" + CR.getId_rigaDocumento());
|
||||
if (CR.getId_rigaDocumentoBolla() > 0L)
|
||||
wc.addWc("A.id_rigaDocumentoBolla=" + CR.getId_rigaDocumentoBolla());
|
||||
if (CR.getId_documento() > 0L)
|
||||
wc.addWc("B.id_documento=" + CR.getId_documento());
|
||||
if (CR.getId_documentoBolla() > 0L)
|
||||
wc.addWc("BBOLLA.id_documento=" + CR.getId_documentoBolla());
|
||||
if (!CR.getRiferimento().isEmpty())
|
||||
wc.addWc("C.riferimento like '%" + CR.getRiferimento() + "%'");
|
||||
if (!CR.getCodicePezza().isEmpty())
|
||||
wc.addWc("A.codicePezza like '%" + CR.getCodicePezza() + "%'");
|
||||
if (CR.getProgDocumento() != 0L && CR.getProgDocumentoA() == 0L) {
|
||||
wc.addWc("C.progDocumento =" + CR.getProgDocumento());
|
||||
} else if (CR.getProgDocumento() != 0L && CR.getProgDocumentoA() != 0L) {
|
||||
wc.addWc("C.progDocumento >=" + CR.getProgDocumento());
|
||||
wc.addWc("C.progDocumento <=" + CR.getProgDocumentoA());
|
||||
}
|
||||
if (CR.getId_clifor() > 0L)
|
||||
wc.addWc("C.id_clifor=" + CR.getId_clifor());
|
||||
if (!CR.getCodicePancale().isEmpty())
|
||||
wc.addWc("A.codicePancale='" + CR.getCodicePancale() + "'");
|
||||
if (CR.getFlgConBolla() == 0L) {
|
||||
wc.addWc("(A.id_rigaDocumentoBolla is null or A.id_rigaDocumentoBolla=0)");
|
||||
} else if (CR.getFlgConBolla() > 0L) {
|
||||
wc.addWc("A.id_rigaDocumentoBolla>0");
|
||||
}
|
||||
if (CR.getDataDocumentoDa() != null)
|
||||
wc.addWc("C.dataDocumento>=?");
|
||||
if (CR.getDataDocumentoA() != null)
|
||||
wc.addWc("C.dataDocumento<=?");
|
||||
try {
|
||||
PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString());
|
||||
int dataCount = 0;
|
||||
if (CR.getDataDocumentoDa() != null) {
|
||||
dataCount++;
|
||||
stmt.setDate(dataCount, CR.getDataDocumentoDa());
|
||||
}
|
||||
if (CR.getDataDocumentoA() != null) {
|
||||
dataCount++;
|
||||
stmt.setDate(dataCount, CR.getDataDocumentoA());
|
||||
}
|
||||
return findRows(stmt, pageNumber, pageRows);
|
||||
} catch (SQLException e) {
|
||||
removeCPConnection();
|
||||
handleDebug(e);
|
||||
return AB_EMPTY_VECTUMERATOR;
|
||||
}
|
||||
}
|
||||
|
||||
public void findLastInserimentoByRigaDocumento(long l_id_rigaDocumento, long l_id_lavPezzaSave) {
|
||||
String s_Sql_Find = "select A.* from LAV_PEZZA AS A";
|
||||
String s_Sql_Order = " order by tsInserimento desc";
|
||||
WcString wc = new WcString();
|
||||
wc.addWc("A.id_rigaDocumento=" + l_id_rigaDocumento);
|
||||
wc.addWc("A.id_lavPezza!=" + l_id_lavPezzaSave);
|
||||
try {
|
||||
PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString());
|
||||
findFirstRecord(stmt);
|
||||
} catch (SQLException e) {
|
||||
removeCPConnection();
|
||||
handleDebug(e);
|
||||
}
|
||||
}
|
||||
|
||||
public String getTsInserimentoS() {
|
||||
return (getTsInserimento() == null) ? "" : getTimestampFormat().format(getTsInserimento());
|
||||
}
|
||||
|
||||
public double getMtPezza() {
|
||||
return this.mtPezza;
|
||||
}
|
||||
|
||||
public void setMtPezza(double mtPezza) {
|
||||
this.mtPezza = mtPezza;
|
||||
}
|
||||
|
||||
public Vectumerator<LavPezza> findByRigaDocumento(long l_id_rigaDocumento) {
|
||||
LavPezzaCR CR = new LavPezzaCR(getApFull());
|
||||
CR.setId_rigaDocumento(l_id_rigaDocumento);
|
||||
return findByCR(CR, 0, 0);
|
||||
}
|
||||
|
||||
public Vectumerator<LavPezza> findByDocumentoBolla(long l_id_documentoBolla) {
|
||||
LavPezzaCR CR = new LavPezzaCR(getApFull());
|
||||
CR.setId_documentoBolla(l_id_documentoBolla);
|
||||
CR.setFlgConBolla(1L);
|
||||
return findByCR(CR, 0, 0);
|
||||
}
|
||||
|
||||
public Vectumerator<LavPezza> findByRigaDocumentoBolla(long l_id_rigaDocumento) {
|
||||
LavPezzaCR CR = new LavPezzaCR(getApFull());
|
||||
CR.setId_rigaDocumentoBolla(l_id_rigaDocumento);
|
||||
return findByCR(CR, 0, 0);
|
||||
}
|
||||
|
||||
public Vectumerator<LavPezza> findByDocumento(long l_id_documento) {
|
||||
LavPezzaCR CR = new LavPezzaCR(getApFull());
|
||||
CR.setId_documento(l_id_documento);
|
||||
CR.setFlgConBolla(-1L);
|
||||
return findByCR(CR, 0, 0);
|
||||
}
|
||||
|
||||
public ResParm creaBollaDaLista(LavPezzaCR CR, String[] id_lavPezze) {
|
||||
ResParm rp = new ResParm(true);
|
||||
HashMap<Long, Documento> lst = new HashMap<>();
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
|
||||
boolean testRiferimenti = true;
|
||||
if (testRiferimenti) {
|
||||
for (int i = 0; i < id_lavPezze.length; i++) {
|
||||
if (!id_lavPezze[i].isEmpty()) {
|
||||
String riferimento;
|
||||
LavPezza row = new LavPezza(getApFull());
|
||||
row.findByPrimaryKey(Long.valueOf(id_lavPezze[i]));
|
||||
if (CR.getSearchTxt().isEmpty()) {
|
||||
riferimento = "";
|
||||
} else {
|
||||
riferimento = CR.getSearchTxt();
|
||||
}
|
||||
rp = row.creaBolla(CR.getId_users(), false, CR.getId_tipoDocumento(), CR.getDataEmissioneDocumento(), riferimento);
|
||||
if (rp.getStatus()) {
|
||||
Documento l_documento = (Documento)rp.getReturnObj();
|
||||
if (!lst.containsKey(Long.valueOf(l_documento.getId_documento())))
|
||||
lst.put(Long.valueOf(l_documento.getId_documento()), l_documento);
|
||||
}
|
||||
}
|
||||
}
|
||||
Vectumerator<Documento> vecDoc = new Vectumerator();
|
||||
if (rp.getStatus()) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (Documento doc : lst.values()) {
|
||||
if (CR.getFlgStato() > 0L) {
|
||||
doc.setFlgStato(CR.getFlgStato());
|
||||
} else {
|
||||
doc.setFlgStato(1L);
|
||||
}
|
||||
doc.save();
|
||||
vecDoc.add(doc);
|
||||
}
|
||||
rp.setMsg(sb.toString());
|
||||
rp.setReturnObj(vecDoc);
|
||||
}
|
||||
} else {
|
||||
rp.setStatus(false);
|
||||
rp.setMsg("ERRORE! Non puoi creare fatture con riferimenti diversi tra loro.");
|
||||
}
|
||||
return rp;
|
||||
}
|
||||
|
||||
public ResParm creaBolla(long l_id_users, boolean emetti, long l_id_tipoFattura, Date l_dataEmissioneDocumento, String riferimento) {
|
||||
ResParm rp = new ResParm(true);
|
||||
if (l_dataEmissioneDocumento == null)
|
||||
l_dataEmissioneDocumento = getToday();
|
||||
Documento documento = new Documento(getApFull());
|
||||
documento.findDocumentoBozza(l_id_tipoFattura, getId_clifor());
|
||||
if (documento.getDBState() == 0) {
|
||||
documento.setId_users(l_id_users);
|
||||
documento.setId_clifor(getId_clifor());
|
||||
documento.setId_tipoPagamento(getClifor().getId_tipoPagamento());
|
||||
documento.setId_tipoDocumento(l_id_tipoFattura);
|
||||
documento.setDataDocumento(l_dataEmissioneDocumento);
|
||||
Calendar cal = Calendar.getInstance();
|
||||
cal.setTime(documento.getDataDocumento());
|
||||
documento.setId_esercizio((long)cal.get(1));
|
||||
documento.setId_documentoFiglio(0L);
|
||||
rp = documento.superSave();
|
||||
}
|
||||
if (rp.getStatus()) {
|
||||
creaRigheDocumento(documento);
|
||||
setRigaDocumento(null);
|
||||
save();
|
||||
}
|
||||
Vectumerator<RigaDocumento> vecrd = documento.findRigheDocumento(0, 0, 0);
|
||||
documento.setNColli((long)vecrd.getTotNumberOfRecords());
|
||||
documento.superSave();
|
||||
rp.setMsg(String.valueOf(documento.getId_documento()));
|
||||
rp.setReturnObj(documento);
|
||||
return rp;
|
||||
}
|
||||
|
||||
public ResParm creaRigheDocumento(Documento fatt) {
|
||||
ResParm rp = new ResParm(true);
|
||||
RigaDocumento rd = new RigaDocumento(getApFull());
|
||||
StringBuilder sbDettaglio = new StringBuilder();
|
||||
sbDettaglio.append(" N.: ");
|
||||
if (getCodicePezza().length() > 2) {
|
||||
String l_codicepezza = StringUtils.stripStart(getCodicePezza(), "0");
|
||||
if (getRigaDocumento().getDocumento().getFlgBarcodeType() == 1L) {
|
||||
sbDettaglio.append(l_codicepezza.substring(0, l_codicepezza.length() - 1));
|
||||
} else {
|
||||
sbDettaglio.append(l_codicepezza);
|
||||
}
|
||||
}
|
||||
sbDettaglio.append(" ");
|
||||
StringBuilder sbRaggruppamento = new StringBuilder();
|
||||
sbRaggruppamento.append("Tela: ");
|
||||
sbRaggruppamento.append(getRigaDocumento().getDocumento().getRiferimento());
|
||||
sbRaggruppamento.append(" Articolo: ");
|
||||
sbRaggruppamento.append(getRigaDocumento().getDescrizioneRiga());
|
||||
rd.setDescrizioneRiga(sbDettaglio.toString() + sbDettaglio.toString());
|
||||
rd.setDescrizioneRigaDettaglio(sbDettaglio.toString());
|
||||
rd.setDescrizioneRigaRaggruppamento(sbRaggruppamento.toString());
|
||||
rd.setMt(getMtPezza());
|
||||
rd.setNr(getMtPezza());
|
||||
rd.setId_documento(fatt.getId_documento());
|
||||
rp = rd.superSave();
|
||||
if (rp.getStatus()) {
|
||||
setId_rigaDocumentoBolla(rd.getId_rigaDocumento());
|
||||
rp = save();
|
||||
}
|
||||
return rp;
|
||||
}
|
||||
|
||||
public Documento getDocumento() {
|
||||
return getRigaDocumento().getDocumento();
|
||||
}
|
||||
|
||||
public RigaDocumento getRigaDocumentoBolla() {
|
||||
this.rigaDocumentoBolla = (RigaDocumento)getSecondaryObject(this.rigaDocumentoBolla, RigaDocumento.class, getId_rigaDocumentoBolla());
|
||||
return this.rigaDocumentoBolla;
|
||||
}
|
||||
|
||||
public void setRigaDocumentoBolla(RigaDocumento rigaDocumentoBolla) {
|
||||
this.rigaDocumentoBolla = rigaDocumentoBolla;
|
||||
}
|
||||
|
||||
public long getId_rigaDocumentoBolla() {
|
||||
return this.id_rigaDocumentoBolla;
|
||||
}
|
||||
|
||||
public void setId_rigaDocumentoBolla(long id_rigaDocumentoBolla) {
|
||||
this.id_rigaDocumentoBolla = id_rigaDocumentoBolla;
|
||||
}
|
||||
|
||||
public String getCodicePancale() {
|
||||
return (this.codicePancale == null) ? "" : this.codicePancale.trim();
|
||||
}
|
||||
|
||||
public void setCodicePancale(String codicePancale) {
|
||||
this.codicePancale = codicePancale;
|
||||
}
|
||||
|
||||
public long getNumColpi() {
|
||||
return this.numColpi;
|
||||
}
|
||||
|
||||
public void setNumColpi(long numColpi) {
|
||||
this.numColpi = numColpi;
|
||||
}
|
||||
|
||||
public long findClientePancaleNonInviato(String l_codicePancale) {
|
||||
String s_Sql_Find = "select A.id_clifor from LAV_PEZZA AS A";
|
||||
String s_Sql_Order = "";
|
||||
WcString wc = new WcString();
|
||||
wc.addWc("A.codicePancale='" + l_codicePancale + "'");
|
||||
wc.addWc("(A.id_rigaDocumentoBolla is null or A.id_rigaDocumentoBolla=0)");
|
||||
try {
|
||||
PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString());
|
||||
Vectumerator<LavPezza> vec = findRows(stmt);
|
||||
if (vec.hasMoreElements()) {
|
||||
LavPezza row = (LavPezza)vec.nextElement();
|
||||
return row.getId_clifor();
|
||||
}
|
||||
return 0L;
|
||||
} catch (SQLException e) {
|
||||
removeCPConnection();
|
||||
handleDebug(e);
|
||||
return 0L;
|
||||
}
|
||||
}
|
||||
|
||||
public long getTotPezzeInviateByDocumentoDTESS(long l_id_documento) {
|
||||
String s_Sql_Find = "select count(*) as tot from LAV_PEZZA AS A inner join RIGA_DOCUMENTO AS B ON A.id_rigaDocumento=B.id_rigaDocumento";
|
||||
WcString wc = new WcString();
|
||||
wc.addWc("B.id_documento=" + l_id_documento);
|
||||
wc.addWc("A.id_rigaDocumentoBolla>0");
|
||||
try {
|
||||
PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find);
|
||||
return (long)getTots(stmt);
|
||||
} catch (SQLException e) {
|
||||
handleDebug(e);
|
||||
return 0L;
|
||||
}
|
||||
}
|
||||
|
||||
public Vectumerator<LavPezza> findPezzeInviateDaFatturareByDocumento(long l_id_documento) {
|
||||
String s_Sql_Find = "select A.* from LAV_PEZZA AS A inner join RIGA_DOCUMENTO AS RDDISPO ON A.id_rigaDocumento=RDDISPO.id_rigadocumento inner join RIGA_DOCUMENTO AS RDBOLLA ON RDBOLLA.id_rigaDocumento=A.id_rigaDocumentoBolla left join RIGA_DOCUMENTO AS RDFT ON RDFT.id_documento=RDBOLLA.id_documentoPadre";
|
||||
WcString wc = new WcString();
|
||||
wc.addWc("RDDISPO.id_documento=" + l_id_documento);
|
||||
wc.addWc("RDFT.id_rigaDocumento is null");
|
||||
try {
|
||||
PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find);
|
||||
return findRows(stmt);
|
||||
} catch (SQLException e) {
|
||||
removeCPConnection();
|
||||
handleDebug(e);
|
||||
return AB_EMPTY_VECTUMERATOR;
|
||||
}
|
||||
}
|
||||
|
||||
public Vectumerator<LavPezza> findPezzeInviateDaFatturareByRIGADocumento(long l_id_rigaDocumento, HashMap<Long, Documento> hsDdtDaFatturare) {
|
||||
String s_Sql_Find = "select A.* from LAV_PEZZA AS A inner join RIGA_DOCUMENTO AS RDDISPO ON A.id_rigaDocumento=RDDISPO.id_rigadocumento inner join RIGA_DOCUMENTO AS RDBOLLA ON RDBOLLA.id_rigaDocumento=A.id_rigaDocumentoBolla left join RIGA_DOCUMENTO AS RDFT ON RDFT.id_documento=RDBOLLA.id_documentoPadre";
|
||||
WcString wc = new WcString();
|
||||
wc.addWc("RDDISPO.id_rigaDocumento=" + l_id_rigaDocumento);
|
||||
wc.addWc("RDFT.id_rigaDocumento is null");
|
||||
if (hsDdtDaFatturare != null) {
|
||||
OrString orBolle = new OrString();
|
||||
for (Map.Entry<Long, Documento> me : hsDdtDaFatturare.entrySet())
|
||||
orBolle.addOr("RDBOLLA.id_documento=" + me.getValue().getId_documento());
|
||||
wc.addWc(orBolle.toString());
|
||||
}
|
||||
try {
|
||||
PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find);
|
||||
return findRows(stmt);
|
||||
} catch (SQLException e) {
|
||||
removeCPConnection();
|
||||
handleDebug(e);
|
||||
return AB_EMPTY_VECTUMERATOR;
|
||||
}
|
||||
}
|
||||
|
||||
public String getError() {
|
||||
if (getId_lavPezza() == 0L)
|
||||
return "";
|
||||
StringBuilder errmsg = new StringBuilder();
|
||||
if (getRigaDocumento().getId_documento() == 0L) {
|
||||
errmsg.append("Pezza relativa ad un documento cancellato!!!");
|
||||
} else if (getId_clifor() != getRigaDocumento().getDocumento().getId_clifor()) {
|
||||
errmsg.append("Cliente pezza diverso da cliente documento: pezza: " + getClifor().getDescrizioneCliente() + " doc: " +
|
||||
getRigaDocumento().getDocumento().getId_clifor() + " - " +
|
||||
getRigaDocumento().getDocumento().getClifor().getDescrizioneCliente());
|
||||
}
|
||||
return errmsg.toString();
|
||||
}
|
||||
|
||||
public boolean isError() {
|
||||
if (getError().isEmpty())
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean isFatturata() {
|
||||
if (getRigaDocumentoBolla().getId_documentoPadre() > 0L)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
public String getDocumentoFatturaNumero() {
|
||||
if (isFatturata())
|
||||
return getRigaDocumentoBolla().getDocumentoPadre().getNumeroDocumentoCompleto();
|
||||
return "";
|
||||
}
|
||||
|
||||
public boolean isInviata() {
|
||||
if (getId_rigaDocumentoBolla() > 0L)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
public String getDocumentoBollaNumero() {
|
||||
if (isInviata())
|
||||
return getRigaDocumentoBolla().getDocumento().getNumeroDocumentoCompleto();
|
||||
return "";
|
||||
}
|
||||
|
||||
public Vectumerator<LavPezza> findDdtByRigaDocumento(long l_id_rigaDocumento) {
|
||||
String s_Sql_Find = "select MAX(A.id_rigaDocumentoBolla) as id_rigaDocumentoBolla, count(1) as count, B.id_documento from LAV_PEZZA AS A inner join RIGA_DOCUMENTO AS B ON A.id_rigaDocumentoBolla=B.id_rigaDocumento";
|
||||
String s_Sql_Order = " GROUP BY B.id_documento;";
|
||||
WcString wc = new WcString();
|
||||
wc.addWc("A.id_rigaDocumento=" + l_id_rigaDocumento);
|
||||
try {
|
||||
PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString());
|
||||
return findRows(stmt);
|
||||
} catch (SQLException e) {
|
||||
removeCPConnection();
|
||||
handleDebug(e);
|
||||
return AB_EMPTY_VECTUMERATOR;
|
||||
}
|
||||
}
|
||||
|
||||
public long getCount() {
|
||||
return this.count;
|
||||
}
|
||||
|
||||
public void setCount(long count) {
|
||||
this.count = count;
|
||||
}
|
||||
|
||||
protected void initFields() {
|
||||
super.initFields();
|
||||
setCount(0L);
|
||||
}
|
||||
|
||||
protected void fillFields(ResultSet rst) {
|
||||
super.fillFields(rst);
|
||||
try {
|
||||
if (isColumnInResultSet(rst, "count"))
|
||||
setCount(rst.getLong("count"));
|
||||
} catch (SQLException e) {
|
||||
handleDebug(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,242 @@
|
|||
package it.acxent.tex.lav;
|
||||
|
||||
import it.acxent.anag.Clifor;
|
||||
import it.acxent.contab.Documento;
|
||||
import it.acxent.contab.RigaDocumento;
|
||||
import it.acxent.contab.TipoDocumento;
|
||||
import it.acxent.db.ApplParmFull;
|
||||
import it.acxent.db.CRAdapter;
|
||||
import java.sql.Date;
|
||||
import java.sql.Timestamp;
|
||||
|
||||
public class LavPezzaCR extends CRAdapter {
|
||||
private long id_lavPezza;
|
||||
|
||||
private long id_rigaDocumento;
|
||||
|
||||
private Timestamp tsInserimento;
|
||||
|
||||
private String codicePezza;
|
||||
|
||||
private RigaDocumento rigaDocumento;
|
||||
|
||||
private Clifor clifor;
|
||||
|
||||
private long id_clifor;
|
||||
|
||||
private long id_documento;
|
||||
|
||||
private String riferimento;
|
||||
|
||||
private Date dataEmissioneDocumento;
|
||||
|
||||
private long id_tipoDocumento;
|
||||
|
||||
private long flgStato = -1L;
|
||||
|
||||
private long flgConBolla = 0L;
|
||||
|
||||
private TipoDocumento tipoDocumento;
|
||||
|
||||
private long id_rigaDocumentoBolla;
|
||||
|
||||
private String codicePancale;
|
||||
|
||||
private Date dataDocumentoA;
|
||||
|
||||
private Date dataDocumentoDa;
|
||||
|
||||
private long progDocumento;
|
||||
|
||||
private long progDocumentoA;
|
||||
|
||||
private long id_documentoBolla;
|
||||
|
||||
public LavPezzaCR(ApplParmFull newApplParmFull) {
|
||||
super(newApplParmFull);
|
||||
}
|
||||
|
||||
public LavPezzaCR() {}
|
||||
|
||||
public void setId_lavPezza(long newId_lavPezza) {
|
||||
this.id_lavPezza = newId_lavPezza;
|
||||
}
|
||||
|
||||
public void setId_rigaDocumento(long newId_rigaDocumento) {
|
||||
this.id_rigaDocumento = newId_rigaDocumento;
|
||||
setRigaDocumento(null);
|
||||
}
|
||||
|
||||
public void setTsInserimento(Timestamp newTsInserimento) {
|
||||
this.tsInserimento = newTsInserimento;
|
||||
}
|
||||
|
||||
public void setCodicePezza(String newCodicePezza) {
|
||||
this.codicePezza = newCodicePezza;
|
||||
}
|
||||
|
||||
public long getId_lavPezza() {
|
||||
return this.id_lavPezza;
|
||||
}
|
||||
|
||||
public long getId_rigaDocumento() {
|
||||
return this.id_rigaDocumento;
|
||||
}
|
||||
|
||||
public Timestamp getTsInserimento() {
|
||||
return this.tsInserimento;
|
||||
}
|
||||
|
||||
public String getCodicePezza() {
|
||||
return (this.codicePezza == null) ? "" : this.codicePezza.trim();
|
||||
}
|
||||
|
||||
public void setRigaDocumento(RigaDocumento newRigaDocumento) {
|
||||
this.rigaDocumento = newRigaDocumento;
|
||||
}
|
||||
|
||||
public RigaDocumento getRigaDocumento() {
|
||||
this.rigaDocumento = (RigaDocumento)getSecondaryObject(this.rigaDocumento, RigaDocumento.class, getId_rigaDocumento());
|
||||
return this.rigaDocumento;
|
||||
}
|
||||
|
||||
public Clifor getClifor() {
|
||||
this.clifor = (Clifor)getSecondaryObject(this.clifor, Clifor.class, getId_clifor());
|
||||
return this.clifor;
|
||||
}
|
||||
|
||||
public long getId_clifor() {
|
||||
return this.id_clifor;
|
||||
}
|
||||
|
||||
public void setClifor(Clifor newClifor) {
|
||||
this.clifor = newClifor;
|
||||
}
|
||||
|
||||
public void setId_clifor(long newId_clifor) {
|
||||
this.id_clifor = newId_clifor;
|
||||
setClifor(null);
|
||||
}
|
||||
|
||||
public long getId_documento() {
|
||||
return this.id_documento;
|
||||
}
|
||||
|
||||
public void setId_documento(long id_documento) {
|
||||
this.id_documento = id_documento;
|
||||
}
|
||||
|
||||
public String getRiferimento() {
|
||||
return (this.riferimento == null) ? AB_EMPTY_STRING : this.riferimento.trim();
|
||||
}
|
||||
|
||||
public void setRiferimento(String riferimento) {
|
||||
this.riferimento = riferimento;
|
||||
}
|
||||
|
||||
public Date getDataEmissioneDocumento() {
|
||||
return this.dataEmissioneDocumento;
|
||||
}
|
||||
|
||||
public void setDataEmissioneDocumento(Date dataEmissioneDocumento) {
|
||||
this.dataEmissioneDocumento = dataEmissioneDocumento;
|
||||
}
|
||||
|
||||
public long getId_tipoDocumento() {
|
||||
return this.id_tipoDocumento;
|
||||
}
|
||||
|
||||
public void setId_tipoDocumento(long id_tipoDocumento) {
|
||||
this.id_tipoDocumento = id_tipoDocumento;
|
||||
setTipoDocumento(null);
|
||||
}
|
||||
|
||||
public long getFlgStato() {
|
||||
return this.flgStato;
|
||||
}
|
||||
|
||||
public void setFlgStato(long flgStato) {
|
||||
this.flgStato = flgStato;
|
||||
}
|
||||
|
||||
public static final String getStato(long l_flgStato) {
|
||||
return Documento.getStato(l_flgStato);
|
||||
}
|
||||
|
||||
public String getStato() {
|
||||
return getStato(getFlgStato());
|
||||
}
|
||||
|
||||
public long getFlgConBolla() {
|
||||
return this.flgConBolla;
|
||||
}
|
||||
|
||||
public void setFlgConBolla(long flgSenzaBolla) {
|
||||
this.flgConBolla = flgSenzaBolla;
|
||||
}
|
||||
|
||||
public TipoDocumento getTipoDocumento() {
|
||||
this.tipoDocumento = (TipoDocumento)getSecondaryObject(this.tipoDocumento, TipoDocumento.class, getId_tipoDocumento());
|
||||
return this.tipoDocumento;
|
||||
}
|
||||
|
||||
public void setTipoDocumento(TipoDocumento tipoDocumento) {
|
||||
this.tipoDocumento = tipoDocumento;
|
||||
}
|
||||
|
||||
public long getId_rigaDocumentoBolla() {
|
||||
return this.id_rigaDocumentoBolla;
|
||||
}
|
||||
|
||||
public void setId_rigaDocumentoBolla(long id_rigaDocumentoBolla) {
|
||||
this.id_rigaDocumentoBolla = id_rigaDocumentoBolla;
|
||||
}
|
||||
|
||||
public String getCodicePancale() {
|
||||
return (this.codicePancale == null) ? AB_EMPTY_STRING : this.codicePancale.trim();
|
||||
}
|
||||
|
||||
public void setCodicePancale(String codicePancale) {
|
||||
this.codicePancale = codicePancale;
|
||||
}
|
||||
|
||||
public Date getDataDocumentoA() {
|
||||
return this.dataDocumentoA;
|
||||
}
|
||||
|
||||
public void setDataDocumentoA(Date dataDocumentoA) {
|
||||
this.dataDocumentoA = dataDocumentoA;
|
||||
}
|
||||
|
||||
public Date getDataDocumentoDa() {
|
||||
return this.dataDocumentoDa;
|
||||
}
|
||||
|
||||
public void setDataDocumentoDa(Date dataDocumentoDa) {
|
||||
this.dataDocumentoDa = dataDocumentoDa;
|
||||
}
|
||||
|
||||
public long getProgDocumento() {
|
||||
return this.progDocumento;
|
||||
}
|
||||
|
||||
public void setProgDocumento(long progDocumento) {
|
||||
this.progDocumento = progDocumento;
|
||||
}
|
||||
|
||||
public long getProgDocumentoA() {
|
||||
return this.progDocumentoA;
|
||||
}
|
||||
|
||||
public void setProgDocumentoA(long progDocumentoA) {
|
||||
this.progDocumentoA = progDocumentoA;
|
||||
}
|
||||
|
||||
public long getId_documentoBolla() {
|
||||
return this.id_documentoBolla;
|
||||
}
|
||||
|
||||
public void setId_documentoBolla(long id_documentoBolla) {
|
||||
this.id_documentoBolla = id_documentoBolla;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,121 @@
|
|||
package it.acxent.tex.lav.servlet;
|
||||
|
||||
import it.acxent.contab.RigaDocumento;
|
||||
import it.acxent.contab.TipoDocumento;
|
||||
import it.acxent.db.ApplParmFull;
|
||||
import it.acxent.db.CRAdapter;
|
||||
import it.acxent.db.DBAdapter;
|
||||
import it.acxent.db.ResParm;
|
||||
import it.acxent.tex.anag.servlet._AnagTexAdapterSvlt;
|
||||
import it.acxent.tex.lav.LavPezza;
|
||||
import it.acxent.tex.lav.LavPezzaCR;
|
||||
import javax.servlet.annotation.WebServlet;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
@WebServlet(urlPatterns = {"/admin/lav/BollaPezza.abl"})
|
||||
public class BollaPezzaSvlt extends _AnagTexAdapterSvlt {
|
||||
private static final long serialVersionUID = -3363295810121263153L;
|
||||
|
||||
protected void fillComboAfterDetail(DBAdapter beanA, HttpServletRequest req, HttpServletResponse res) {}
|
||||
|
||||
protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) {
|
||||
ApplParmFull apFull = getApFull(req);
|
||||
req.setAttribute("listaTipiDocumento", new TipoDocumento(apFull).findByTipologiaClienteFornitoreAFT(0L, "C", 0L, -1L));
|
||||
}
|
||||
|
||||
protected DBAdapter getBean(HttpServletRequest req) {
|
||||
return new LavPezza(getApFull(req));
|
||||
}
|
||||
|
||||
protected CRAdapter getBeanCR(HttpServletRequest req) {
|
||||
return new LavPezzaCR(getApFull(req));
|
||||
}
|
||||
|
||||
protected String getBeanPageName(HttpServletRequest req) {
|
||||
return "bollaPezza";
|
||||
}
|
||||
|
||||
protected void search(HttpServletRequest req, HttpServletResponse res) {
|
||||
ApplParmFull apFull = getApFull(req);
|
||||
super.search(req, res);
|
||||
}
|
||||
|
||||
public void _dettaglioDisposizione(HttpServletRequest req, HttpServletResponse res) {
|
||||
ApplParmFull apFull = getApFull(req);
|
||||
RigaDocumento bean = null;
|
||||
String l_codicePezza = getRequestParameter(req, "codicePezza");
|
||||
LavPezza pezza = new LavPezza(apFull);
|
||||
ResParm rp = new ResParm(true);
|
||||
bean = new RigaDocumento(apFull);
|
||||
bean.findByCodicePezza(l_codicePezza);
|
||||
if (bean.getDBState() == 1) {
|
||||
sendHtmlMsgResponse(req, res, bean.getDocumento().getClifor().getCognomeNome() + " " + bean.getDocumento().getClifor().getCognomeNome() + " " + bean.getDocumento().getRiferimento());
|
||||
} else {
|
||||
sendHtmlMsgResponse(req, res, "Pezza NON Trovata");
|
||||
}
|
||||
}
|
||||
|
||||
public void _generaDocumento(HttpServletRequest req, HttpServletResponse res) {
|
||||
ApplParmFull apFull = getApFull(req);
|
||||
ResParm rp = new ResParm(true);
|
||||
String lavPezze = getRequestParameter(req, "id_lavPezze");
|
||||
String[] id_lavPezze = lavPezze.split(",");
|
||||
LavPezzaCR CR = new LavPezzaCR(apFull);
|
||||
fillObject(req, CR);
|
||||
CR.setId_users(getLoginUser(req).getId_users());
|
||||
LavPezza bean = new LavPezza(apFull);
|
||||
rp.append(bean.creaBollaDaLista(CR, id_lavPezze));
|
||||
if (rp.getStatus()) {
|
||||
req.setAttribute("listaDocumenti", rp.getReturnObj());
|
||||
} else {
|
||||
sendMessage(req, rp.getMsg());
|
||||
}
|
||||
search(req, res);
|
||||
}
|
||||
|
||||
public void _mostraPezza(HttpServletRequest req, HttpServletResponse res) {
|
||||
ApplParmFull apFull = getApFull(req);
|
||||
long l_id = getRequestLongParameter(req, "id_lavPezza");
|
||||
LavPezza bean = new LavPezza(apFull);
|
||||
ResParm rp = new ResParm(true);
|
||||
bean.findByPrimaryKey(l_id);
|
||||
if (bean.getDBState() == 1) {
|
||||
req.setAttribute("bean", bean);
|
||||
} else {
|
||||
sendMessage(req, "ERRORE! pezza non trovata");
|
||||
}
|
||||
forceJspPageRelative("lavPezzaE.jsp", req);
|
||||
callJsp(req, res);
|
||||
}
|
||||
|
||||
public void _aggiungiPezza(HttpServletRequest req, HttpServletResponse res) {
|
||||
ApplParmFull apFull = getApFull(req);
|
||||
LavPezza bean = new LavPezza(apFull);
|
||||
long l_id = getRequestLongParameter(req, "id_lavPezzaE");
|
||||
long l_numColpi = getRequestLongParameter(req, "numColpiE");
|
||||
double l_mtPezza = getRequestDoubleParameter(req, "mtPezzaE");
|
||||
String l_codicePancale = getRequestParameter(req, "codicePancaleE");
|
||||
ResParm rp = new ResParm(true);
|
||||
bean.findByPrimaryKey(l_id);
|
||||
if (bean.getDBState() == 1) {
|
||||
bean.setMtPezza(l_mtPezza);
|
||||
bean.setNumColpi(l_numColpi);
|
||||
bean.setCodicePancale(l_codicePancale);
|
||||
rp = bean.save();
|
||||
if (rp.getStatus()) {
|
||||
sendMessage(req, "Pezza " + bean.getCodicePezza() + " aggiornata per Mt. " + l_mtPezza + " su Tela " +
|
||||
bean.getDocumento().getRiferimento() + " di " + bean.getDocumento().getClifor().getCognomeNome());
|
||||
} else {
|
||||
sendMessage(req, rp.getMsg());
|
||||
}
|
||||
} else {
|
||||
sendMessage(req, "ERRORE! pezza non trovata");
|
||||
}
|
||||
search(req, res);
|
||||
}
|
||||
|
||||
protected int getPageRow(HttpServletRequest req) {
|
||||
return 100;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,96 @@
|
|||
package it.acxent.tex.lav.servlet;
|
||||
|
||||
import it.acxent.anag.Users;
|
||||
import it.acxent.contab.Documento;
|
||||
import it.acxent.contab.DocumentoCR;
|
||||
import it.acxent.contab.RigaDocumento;
|
||||
import it.acxent.contab.TipoDocumento;
|
||||
import it.acxent.db.ApplParmFull;
|
||||
import it.acxent.db.CRAdapter;
|
||||
import it.acxent.db.DBAdapter;
|
||||
import it.acxent.db.ResParm;
|
||||
import it.acxent.tex.anag.servlet._AnagTexAdapterSvlt;
|
||||
import it.acxent.tex.lav.LavPezza;
|
||||
import it.acxent.tex.lav.LavPezzaCR;
|
||||
import javax.servlet.annotation.WebServlet;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
@WebServlet(urlPatterns = {"/admin/lav/LavPezza.abl"})
|
||||
public class LavPezzaSvlt extends _AnagTexAdapterSvlt {
|
||||
private static final long serialVersionUID = -3363295810121263153L;
|
||||
|
||||
protected void fillComboAfterDetail(DBAdapter beanA, HttpServletRequest req, HttpServletResponse res) {}
|
||||
|
||||
protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) {
|
||||
ApplParmFull apFull = getApFull(req);
|
||||
req.setAttribute("listaTipiDocumento", new TipoDocumento(apFull).findByTipologiaClienteFornitoreAFT(0L, "C", 0L, -1L));
|
||||
}
|
||||
|
||||
protected DBAdapter getBean(HttpServletRequest req) {
|
||||
return new LavPezza(getApFull(req));
|
||||
}
|
||||
|
||||
protected CRAdapter getBeanCR(HttpServletRequest req) {
|
||||
return new LavPezzaCR(getApFull(req));
|
||||
}
|
||||
|
||||
protected String getBeanPageName(HttpServletRequest req) {
|
||||
return "lavPezzaCli";
|
||||
}
|
||||
|
||||
protected void search(HttpServletRequest req, HttpServletResponse res) {
|
||||
ApplParmFull apFull = getApFull(req);
|
||||
Users theUser = (Users)getLoginUser(req);
|
||||
if (theUser.getId_userProfile() != 10L) {
|
||||
super.search(req, res);
|
||||
} else if (theUser.getId_clifor() > 0L) {
|
||||
req.setAttribute("id_clifor", String.valueOf(theUser.getId_clifor()));
|
||||
super.search(req, res);
|
||||
} else {
|
||||
sendGrantMessage(req, "Attenzione!! Non è stato impostato il cliente all'utente " + theUser.getLogin());
|
||||
callJsp(req, res);
|
||||
}
|
||||
}
|
||||
|
||||
public void _dettaglioDisposizione(HttpServletRequest req, HttpServletResponse res) {
|
||||
ApplParmFull apFull = getApFull(req);
|
||||
RigaDocumento bean = null;
|
||||
String l_codicePezza = getRequestParameter(req, "codicePezza");
|
||||
LavPezza pezza = new LavPezza(apFull);
|
||||
ResParm rp = new ResParm(true);
|
||||
bean = new RigaDocumento(apFull);
|
||||
bean.findByCodicePezza(l_codicePezza);
|
||||
if (bean.getDBState() == 1) {
|
||||
sendHtmlMsgResponse(req, res, bean.getDocumento().getClifor().getCognomeNome() + " " + bean.getDocumento().getClifor().getCognomeNome() + " " + bean.getDocumento().getRiferimento());
|
||||
} else {
|
||||
sendHtmlMsgResponse(req, res, "Pezza NON Trovata");
|
||||
}
|
||||
}
|
||||
|
||||
protected int getPageRow(HttpServletRequest req) {
|
||||
return 100;
|
||||
}
|
||||
|
||||
public void _printDoc(HttpServletRequest req, HttpServletResponse res) {
|
||||
ApplParmFull apFull = getApFull(req);
|
||||
Users theUser = (Users)getLoginUser(req);
|
||||
long l_id = 0L;
|
||||
Documento bean = null;
|
||||
l_id = getRequestLongParameter(req, "id_documento");
|
||||
bean = new Documento(apFull);
|
||||
bean.findByPrimaryKey(l_id);
|
||||
if (bean.getId_documento() > 0L) {
|
||||
if (theUser.getId_userProfile() != 10L || (theUser.getId_userProfile() == 10L && theUser.getId_clifor() == bean.getId_clifor())) {
|
||||
DocumentoCR CR = new DocumentoCR();
|
||||
fillObject(req, CR);
|
||||
CR.setId_documentoS(l_id);
|
||||
sendPdf(res, bean.creaDocumentoPdf(CR, false), "Doc " + bean.getNumeroDocumentoPdf() + DBAdapter.getDayTimeTimestamp());
|
||||
} else {
|
||||
sendHtmlMsgResponse(req, res, "Attenzione!! Non hai i permessi per visualizzare questo documento!!");
|
||||
}
|
||||
} else {
|
||||
sendHtmlMsgResponse(req, res, "Attenzione!! Documento non trovato!!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,181 @@
|
|||
package it.acxent.tex.lav.servlet;
|
||||
|
||||
import it.acxent.contab.Documento;
|
||||
import it.acxent.contab.DocumentoCR;
|
||||
import it.acxent.contab.RigaDocumento;
|
||||
import it.acxent.contab.RigaDocumentoCR;
|
||||
import it.acxent.db.ApplParmFull;
|
||||
import it.acxent.db.CRAdapter;
|
||||
import it.acxent.db.DBAdapter;
|
||||
import it.acxent.db.ResParm;
|
||||
import it.acxent.tex.anag.Telaio;
|
||||
import it.acxent.tex.anag.servlet._AnagTexAdapterSvlt;
|
||||
import it.acxent.tex.lav.LavPezza;
|
||||
import javax.servlet.annotation.WebServlet;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
@WebServlet(urlPatterns = {"/admin/lav/LavTessitura.abl"})
|
||||
public class LavTessituraSvlt extends _AnagTexAdapterSvlt {
|
||||
private static final long serialVersionUID = -3363295810121263153L;
|
||||
|
||||
protected void fillComboAfterDetail(DBAdapter beanA, HttpServletRequest req, HttpServletResponse res) {
|
||||
ApplParmFull apFull = getApFull(req);
|
||||
Documento bean = (Documento)beanA;
|
||||
RigaDocumentoCR CRRD = new RigaDocumentoCR(apFull);
|
||||
fillObject(req, CRRD);
|
||||
req.setAttribute("CRRD", CRRD);
|
||||
req.setAttribute("listaRigheDocumento", bean.findRigheDocumento(CRRD, 0, 0, false));
|
||||
req.setAttribute("listaTelaio", new Telaio(apFull).findAll());
|
||||
}
|
||||
|
||||
protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) {
|
||||
ApplParmFull apFull = getApFull(req);
|
||||
req.setAttribute("listaTelaio", new Telaio(apFull).findAll());
|
||||
}
|
||||
|
||||
protected DBAdapter getBean(HttpServletRequest req) {
|
||||
return new Documento(getApFull(req));
|
||||
}
|
||||
|
||||
protected CRAdapter getBeanCR(HttpServletRequest req) {
|
||||
return new DocumentoCR(getApFull(req));
|
||||
}
|
||||
|
||||
protected String getBeanPageName(HttpServletRequest req) {
|
||||
return "lavTessituraStart";
|
||||
}
|
||||
|
||||
protected void search(HttpServletRequest req, HttpServletResponse res) {
|
||||
ApplParmFull apFull = getApFull(req);
|
||||
DocumentoCR CR = new DocumentoCR(getApFull(req));
|
||||
req.setAttribute("flgTipologia", Integer.valueOf(200));
|
||||
super.search(req, res);
|
||||
}
|
||||
|
||||
public void _annullaStatoLavorazione(HttpServletRequest req, HttpServletResponse res) {
|
||||
ApplParmFull apFull = getApFull(req);
|
||||
long l_id = 0L;
|
||||
RigaDocumento bean = null;
|
||||
l_id = getRequestLongParameter(req, "id_rigaDocumento");
|
||||
ResParm rp = new ResParm(true);
|
||||
bean = new RigaDocumento(apFull);
|
||||
bean.findByPrimaryKey(l_id);
|
||||
if (bean.getId_rigaDocumento() > 0L && (
|
||||
bean.getFlgStatoLavorazioneRiga() == 20L ||
|
||||
bean.getFlgStatoLavorazioneRiga() == 10L)) {
|
||||
bean.setFlgStatoLavorazioneRiga(0L);
|
||||
bean.setId_telaio(0L);
|
||||
bean.save();
|
||||
}
|
||||
showBean(req, res);
|
||||
}
|
||||
|
||||
public void _impostaTelaio(HttpServletRequest req, HttpServletResponse res) {
|
||||
ApplParmFull apFull = getApFull(req);
|
||||
long l_id = 0L;
|
||||
Documento bean = null;
|
||||
l_id = getRequestLongParameter(req, "id_documento");
|
||||
long id_telaioR = getRequestLongParameter(req, "id_telaioR");
|
||||
long colpoInizialeR = getRequestLongParameter(req, "colpoInizialeR");
|
||||
bean = new Documento(apFull);
|
||||
try {
|
||||
bean.findByPrimaryKey(l_id);
|
||||
if (bean.getId_documento() > 0L) {
|
||||
ResParm rp = new ResParm();
|
||||
if (rp.getStatus()) {
|
||||
sendMessage(req, "Telaio impostato correttamente");
|
||||
} else {
|
||||
sendMessage(req, rp.getMsg());
|
||||
}
|
||||
} else {
|
||||
sendMessage(req, "Errore! Documento non valido");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
handleDebug("Impossibile Salvare");
|
||||
handleDebug(e);
|
||||
}
|
||||
search(req, res);
|
||||
}
|
||||
|
||||
public void _impostaColpiFinali(HttpServletRequest req, HttpServletResponse res) {
|
||||
ApplParmFull apFull = getApFull(req);
|
||||
long l_id = 0L;
|
||||
Documento bean = null;
|
||||
l_id = getRequestLongParameter(req, "id_documento");
|
||||
long colpiFinaliR = getRequestLongParameter(req, "colpoFinaleR");
|
||||
bean = new Documento(apFull);
|
||||
try {
|
||||
bean.findByPrimaryKey(l_id);
|
||||
ResParm rp = new ResParm();
|
||||
if (!rp.getStatus())
|
||||
sendMessage(req, rp.getMsg());
|
||||
} catch (Exception e) {
|
||||
handleDebug("Impossibile Salvare");
|
||||
handleDebug(e);
|
||||
}
|
||||
search(req, res);
|
||||
}
|
||||
|
||||
public void _trovaColpiIniziali(HttpServletRequest req, HttpServletResponse res) {
|
||||
ApplParmFull apFull = getApFull(req);
|
||||
long l_id = 0L;
|
||||
Telaio bean = null;
|
||||
l_id = getRequestLongParameter(req, "id_telaio");
|
||||
bean = new Telaio(apFull);
|
||||
try {
|
||||
bean.findByPrimaryKey(l_id);
|
||||
sendHtmlMsgResponse(req, res, String.valueOf(bean.findColpiIniziali()));
|
||||
} catch (Exception e) {
|
||||
sendHtmlMsgResponse(req, res, " ");
|
||||
}
|
||||
}
|
||||
|
||||
public void _updateLTSField(HttpServletRequest req, HttpServletResponse res) {
|
||||
ApplParmFull apFull = getApFull(req);
|
||||
long l_id_rigaDocumento = getRequestLongParameter(req, "id_rigaDocumento");
|
||||
RigaDocumento bean = new RigaDocumento(apFull);
|
||||
bean.findByPrimaryKey(l_id_rigaDocumento);
|
||||
ResParm rp = new ResParm();
|
||||
if (bean.getId_rigaDocumento() > 0L) {
|
||||
String fieldName = getRequestParameter(req, "fieldName");
|
||||
String value = getRequestParameter(req, "value");
|
||||
rp = bean.updateFields(fieldName, value);
|
||||
} else {
|
||||
rp.setStatus(false);
|
||||
rp.setMsg("Table desc non trovata!!!");
|
||||
}
|
||||
if (getAct(req).endsWith("refresh")) {
|
||||
if (rp.getStatus()) {
|
||||
sendMessage(req, "Campo aggiornato correttamente. " + rp.getMsg());
|
||||
} else {
|
||||
sendMessage(req, "Errore!! " + rp.getMsg());
|
||||
}
|
||||
req.setAttribute("id_documento", Long.valueOf(bean.getId_documento()));
|
||||
showBean(req, res);
|
||||
} else if (rp.getStatus()) {
|
||||
sendHtmlMsgResponse(req, res, "Campo aggiornato correttamente.");
|
||||
} else {
|
||||
sendHtmlMsgResponse(req, res, "Errore!! " + rp.getMsg());
|
||||
}
|
||||
}
|
||||
|
||||
public void _dettaglioPezze(HttpServletRequest req, HttpServletResponse res) {
|
||||
ApplParmFull apFull = getApFull(req);
|
||||
long l_id = 0L;
|
||||
Documento bean = null;
|
||||
l_id = getRequestLongParameter(req, "id_documento");
|
||||
LavPezza pezza = new LavPezza(apFull);
|
||||
ResParm rp = new ResParm(true);
|
||||
bean = new Documento(apFull);
|
||||
if (getLoginUser(req).getId_userProfile() == 10L) {
|
||||
setJspPageRelative("lavPezzeViewCli.jsp", req);
|
||||
} else {
|
||||
setJspPageRelative("lavPezzeView.jsp", req);
|
||||
}
|
||||
bean.findByPrimaryKey(l_id);
|
||||
req.setAttribute("bean", bean);
|
||||
req.setAttribute("listaPezze", pezza.findByDocumento(l_id));
|
||||
callJsp(req, res);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,181 @@
|
|||
package it.acxent.tex.lav.servlet;
|
||||
|
||||
import it.acxent.contab.RigaDocumento;
|
||||
import it.acxent.db.ApplParmFull;
|
||||
import it.acxent.db.CRAdapter;
|
||||
import it.acxent.db.DBAdapter;
|
||||
import it.acxent.db.ResParm;
|
||||
import it.acxent.tex.anag.Telaio;
|
||||
import it.acxent.tex.anag.servlet._AnagTexAdapterSvlt;
|
||||
import it.acxent.tex.lav.LavPezza;
|
||||
import it.acxent.tex.lav.LavPezzaCR;
|
||||
import javax.servlet.annotation.WebServlet;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
@WebServlet(urlPatterns = {"/admin/lav/RecordPezza.abl"})
|
||||
public class RecordPezzaSvlt extends _AnagTexAdapterSvlt {
|
||||
private static final long serialVersionUID = -3363295810121263153L;
|
||||
|
||||
protected void fillComboAfterDetail(DBAdapter beanA, HttpServletRequest req, HttpServletResponse res) {}
|
||||
|
||||
protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) {
|
||||
ApplParmFull apFull = getApFull(req);
|
||||
req.setAttribute("listaTelaio", new Telaio(apFull).findAll());
|
||||
}
|
||||
|
||||
protected DBAdapter getBean(HttpServletRequest req) {
|
||||
return new LavPezza(getApFull(req));
|
||||
}
|
||||
|
||||
protected CRAdapter getBeanCR(HttpServletRequest req) {
|
||||
return new LavPezzaCR(getApFull(req));
|
||||
}
|
||||
|
||||
protected String getBeanPageName(HttpServletRequest req) {
|
||||
return "lavPezza";
|
||||
}
|
||||
|
||||
protected void search(HttpServletRequest req, HttpServletResponse res) {
|
||||
ApplParmFull apFull = getApFull(req);
|
||||
LavPezza bean = new LavPezza(getApFull(req));
|
||||
fillObject(req, bean);
|
||||
System.out.println(getRequestDoubleParameter(req, "mtPezza"));
|
||||
req.setAttribute("bean", bean);
|
||||
callJsp(req, res);
|
||||
}
|
||||
|
||||
public void _step1(HttpServletRequest req, HttpServletResponse res) {
|
||||
ApplParmFull apFull = getApFull(req);
|
||||
RigaDocumento bean = null;
|
||||
String l_codicePezza = getRequestParameter(req, "codicePezza");
|
||||
LavPezza pezza = new LavPezza(apFull);
|
||||
ResParm rp = new ResParm(true);
|
||||
bean = new RigaDocumento(apFull);
|
||||
bean.findByCodicePezza(l_codicePezza);
|
||||
if (bean.getDBState() == 1) {
|
||||
req.setAttribute("step", "2");
|
||||
req.setAttribute("mtPezza", getNf().format(bean.getMetriStacchi()));
|
||||
req.setAttribute("currentFocus", "mtPezza");
|
||||
} else {
|
||||
req.setAttribute("step", "1");
|
||||
req.setAttribute("codicePezza", "");
|
||||
sendMessage(req, "ERRORE! pezza " + l_codicePezza + " non trovata");
|
||||
}
|
||||
search(req, res);
|
||||
}
|
||||
|
||||
public void _dettaglioDisposizione(HttpServletRequest req, HttpServletResponse res) {
|
||||
ApplParmFull apFull = getApFull(req);
|
||||
RigaDocumento bean = null;
|
||||
String l_codicePezza = getRequestParameter(req, "codicePezza");
|
||||
LavPezza pezza = new LavPezza(apFull);
|
||||
ResParm rp = new ResParm(true);
|
||||
bean = new RigaDocumento(apFull);
|
||||
bean.findByCodicePezza(l_codicePezza);
|
||||
if (bean.getDBState() == 1) {
|
||||
sendHtmlMsgResponse(req, res, bean.getDocumento().getClifor().getCognomeNome() + " " + bean.getDocumento().getClifor().getCognomeNome() + " " + bean.getDocumento().getRiferimento());
|
||||
} else {
|
||||
sendHtmlMsgResponse(req, res, "Pezza NON Trovata");
|
||||
}
|
||||
}
|
||||
|
||||
protected void callJsp(HttpServletRequest req, HttpServletResponse res) {
|
||||
super.callJsp(req, res);
|
||||
}
|
||||
|
||||
public void _aggiungiPezza(HttpServletRequest req, HttpServletResponse res) {
|
||||
ApplParmFull apFull = getApFull(req);
|
||||
RigaDocumento bean = null;
|
||||
String l_codicePezza = getRequestParameter(req, "codicePezza");
|
||||
long l_numColpi = getRequestLongParameter(req, "numColpi");
|
||||
double l_mtPezza = getRequestDoubleParameter(req, "mtPezza");
|
||||
String l_codicePancale = getRequestParameter(req, "codicePancale");
|
||||
LavPezza pezza = new LavPezza(apFull);
|
||||
ResParm rp = new ResParm(true);
|
||||
bean = new RigaDocumento(apFull);
|
||||
bean.findByCodicePezza(l_codicePezza);
|
||||
if (bean.getDBState() == 1) {
|
||||
pezza = new LavPezza(apFull);
|
||||
pezza.setId_rigaDocumento(bean.getId_rigaDocumento());
|
||||
pezza.setCodicePezza(l_codicePezza);
|
||||
pezza.setMtPezza(l_mtPezza);
|
||||
pezza.setNumColpi(l_numColpi);
|
||||
pezza.setCodicePancale(l_codicePancale);
|
||||
pezza.setId_clifor(bean.getDocumento().getId_clifor());
|
||||
rp = pezza.save();
|
||||
if (rp.getStatus()) {
|
||||
sendMessage(req, "Pezza " + l_codicePezza + " inserita per Mt. " + pezza.getMtPezza() + " su Tela " +
|
||||
bean.getDocumento().getRiferimento() + " di " + bean.getDocumento().getClifor().getCognomeNome());
|
||||
} else {
|
||||
sendMessage(req, "ERRORE! pezza " + l_codicePezza + rp.getMsg());
|
||||
req.setAttribute("bean", pezza);
|
||||
}
|
||||
} else {
|
||||
sendMessage(req, "ERRORE! pezza " + l_codicePezza + " non trovata");
|
||||
}
|
||||
search(req, res);
|
||||
}
|
||||
|
||||
public void _step2(HttpServletRequest req, HttpServletResponse res) {
|
||||
ApplParmFull apFull = getApFull(req);
|
||||
RigaDocumento bean = null;
|
||||
String l_codicePezza = getRequestParameter(req, "codicePezza");
|
||||
long l_numColpi = getRequestLongParameter(req, "numColpi");
|
||||
double l_mtPezza = getRequestDoubleParameter(req, "mtPezza");
|
||||
LavPezza pezza = new LavPezza(apFull);
|
||||
ResParm rp = new ResParm(true);
|
||||
bean = new RigaDocumento(apFull);
|
||||
bean.findByCodicePezza(l_codicePezza);
|
||||
if (bean.getDBState() == 1) {
|
||||
req.setAttribute("step", "3");
|
||||
} else {
|
||||
req.setAttribute("step", "1");
|
||||
req.setAttribute("codicePezza", "");
|
||||
sendMessage(req, "ERRORE! pezza " + l_codicePezza + " non trovata");
|
||||
}
|
||||
search(req, res);
|
||||
}
|
||||
|
||||
public void _step3(HttpServletRequest req, HttpServletResponse res) {
|
||||
ApplParmFull apFull = getApFull(req);
|
||||
RigaDocumento bean = null;
|
||||
String l_codicePezza = getRequestParameter(req, "codicePezza");
|
||||
long l_numColpi = getRequestLongParameter(req, "numColpi");
|
||||
double l_mtPezza = getRequestDoubleParameter(req, "mtPezza");
|
||||
String l_codicePancale = getRequestParameter(req, "codicePancale");
|
||||
LavPezza pezza = new LavPezza(apFull);
|
||||
ResParm rp = new ResParm(true);
|
||||
bean = new RigaDocumento(apFull);
|
||||
bean.findByCodicePezza(l_codicePezza);
|
||||
if (bean.getDBState() == 1) {
|
||||
pezza = new LavPezza(apFull);
|
||||
pezza.setId_rigaDocumento(bean.getId_rigaDocumento());
|
||||
pezza.setCodicePezza(l_codicePezza);
|
||||
pezza.setMtPezza(l_mtPezza);
|
||||
pezza.setNumColpi(l_numColpi);
|
||||
pezza.setCodicePancale(DBAdapter.zeroLeft(l_codicePancale, 2));
|
||||
pezza.setId_clifor(bean.getDocumento().getId_clifor());
|
||||
rp = pezza.save();
|
||||
if (rp.getStatus()) {
|
||||
sendMessage(req, "Pezza " + l_codicePezza + " inserita per Mt. " + pezza.getMtPezza() + " su Tela " +
|
||||
bean.getDocumento().getRiferimento() + " di " + bean.getDocumento().getClifor().getCognomeNome());
|
||||
req.setAttribute("step", "1");
|
||||
req.setAttribute("codicePezza", "");
|
||||
} else if (rp.getMsg().indexOf("IDX_LAV_PEZZA_1") > 0) {
|
||||
req.setAttribute("step", "1");
|
||||
req.setAttribute("codicePezza", "");
|
||||
sendMessage(req, "ERRORE! pezza " + l_codicePezza + " gia' registrata");
|
||||
} else {
|
||||
req.setAttribute("step", "1");
|
||||
req.setAttribute("codicePezza", "");
|
||||
sendMessage(req, "ERRORE! pezza " + l_codicePezza + rp.getMsg());
|
||||
}
|
||||
} else {
|
||||
req.setAttribute("step", "1");
|
||||
req.setAttribute("codicePezza", "");
|
||||
sendMessage(req, "ERRORE! pezza " + l_codicePezza + " non trovata");
|
||||
}
|
||||
search(req, res);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue