504 lines
22 KiB
Java
504 lines
22 KiB
Java
package it.acxent.art.servlet;
|
|
|
|
import it.acxent.anag.Listino;
|
|
import it.acxent.anag.ListinoArticolo;
|
|
import it.acxent.art.Accessorio;
|
|
import it.acxent.art.Articolo;
|
|
import it.acxent.art.ArticoloCR;
|
|
import it.acxent.art.ArticoloTaglia;
|
|
import it.acxent.art.ArticoloVariante;
|
|
import it.acxent.art.ArticoloVarianteCR;
|
|
import it.acxent.art.Colore;
|
|
import it.acxent.art.ColoreCR;
|
|
import it.acxent.art.TabellaTaglia;
|
|
import it.acxent.art.Taglia;
|
|
import it.acxent.art.TipoAccessorio;
|
|
import it.acxent.art.Vetrina;
|
|
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.ArticoloArticoloTessuto;
|
|
import it.acxent.util.AbMessages;
|
|
import it.acxent.util.Vectumerator;
|
|
import java.io.File;
|
|
import javax.servlet.RequestDispatcher;
|
|
import javax.servlet.ServletRequest;
|
|
import javax.servlet.ServletResponse;
|
|
import javax.servlet.annotation.WebServlet;
|
|
import javax.servlet.http.HttpServletRequest;
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
@WebServlet(urlPatterns = {"/admin/art/ArticoloVariante.abl"})
|
|
public class ArticoloVarianteSvlt extends _MagSvlt {
|
|
protected void fillComboAfterDetail(DBAdapter beanA, HttpServletRequest req, HttpServletResponse res) {
|
|
ApplParmFull apFull = getApFull(req);
|
|
ArticoloVariante bean = (ArticoloVariante)beanA;
|
|
if (bean.getTipo().isUsaMagazzino())
|
|
req.setAttribute("listaDisponibilita", bean.getDisponibilitaMovimento());
|
|
req.setAttribute("listaVetrine", new Vetrina(apFull).findAll());
|
|
if (bean.getTipo().getFlgUsaTaglia() == 2L) {
|
|
req.setAttribute("listaTagliePerTipo", new Taglia(apFull)
|
|
.findTaglieByTipoTaglia(bean.getArticolo().getTipo().getTipoTaglia().getId_tipoTaglia()));
|
|
req.setAttribute("listaTaglieArticolo", new ArticoloTaglia(apFull).findByArticoloVariante(bean.getId_articoloVariante()));
|
|
req.setAttribute("listaTabellaTaglie", new TabellaTaglia(apFull).findAll());
|
|
if (bean.getArticolo().getId_tipoTaglia() > 0L)
|
|
req.setAttribute("listaMisure", bean.getArticolo().getTabellaTaglia().getTagliaMisure());
|
|
}
|
|
req.setAttribute("listaListini", new Listino(apFull).findAll());
|
|
req.setAttribute("listaListiniArticolo", new ListinoArticolo(apFull).findPrezziByArticoloVariante(bean.getId_articoloVariante()));
|
|
if (bean.getTipo().getFlgAFT() == 3L)
|
|
req.setAttribute("listaArticoliTessuto", bean.findArticoliTessuto());
|
|
if (bean.getTipo().getFlgUsaVarianteColori() == 1L)
|
|
req.setAttribute("listaColori", new Colore(apFull).findByCR(new ColoreCR(), 0, 0));
|
|
if (bean.getArticolo().getFlgKit() == 1L)
|
|
req.setAttribute("listaVariantiKit", bean.getArticolo().getKitVariantiAssociati());
|
|
req.setAttribute("listListino", new Listino(apFull).findNoListinoBase());
|
|
}
|
|
|
|
protected void fillComboAfterSearch(CRAdapter CRA, HttpServletRequest req, HttpServletResponse res) {}
|
|
|
|
protected DBAdapter getBean(HttpServletRequest req) {
|
|
return new ArticoloVariante(getApFull(req));
|
|
}
|
|
|
|
protected CRAdapter getBeanCR(HttpServletRequest req) {
|
|
return new ArticoloVarianteCR(getApFull(req));
|
|
}
|
|
|
|
protected void prepareNewRecord(HttpServletRequest req, HttpServletResponse res) {
|
|
ApplParmFull apFull = getApFull(req);
|
|
long l_id_articolo = getRequestLongParameter(req, "id_articolo");
|
|
Articolo bean2 = new Articolo(apFull);
|
|
bean2.findByPrimaryKey(l_id_articolo);
|
|
ResParm rp = new ResParm(true, "");
|
|
fillObject(req, bean2);
|
|
rp = bean2.save();
|
|
if (!rp.getStatus())
|
|
sendMessage(req, rp.getMsg());
|
|
ArticoloVariante bean = new ArticoloVariante(apFull);
|
|
bean.setId_articolo(bean2.getId_articolo());
|
|
req.setAttribute("bean", bean);
|
|
req.setAttribute("listaTipiAccessorio", new TipoAccessorio(apFull).findAll());
|
|
req.setAttribute("listaVetrine", new Vetrina(apFull).findAll());
|
|
req.setAttribute("listaTagliePerTipo", new Taglia(apFull)
|
|
.findTaglieByTipoTaglia(bean.getArticolo().getTipo().getTipoTaglia().getId_tipoTaglia()));
|
|
req.setAttribute("listaListiniArticolo", new ListinoArticolo(apFull).findPrezziByArticoloVariante(bean.getId_articoloVariante()));
|
|
if (bean.getTipo().getFlgUsaVarianteColori() == 1L)
|
|
req.setAttribute("listaColori", new Colore(apFull).findByCR(new ColoreCR(), 0, 0));
|
|
}
|
|
|
|
protected void manageMultipartRequestxxx(HttpServletRequest req, HttpServletResponse res) {
|
|
long l_id = 0L;
|
|
ArticoloVariante bean = null;
|
|
bean = new ArticoloVariante(getApFull(req));
|
|
String[] fileNameTypes = { "jpg" };
|
|
String targetDir = getDocBase() + getDocBase();
|
|
String fntImg1 = "varImg_" + getLoginUserId(req) + "_1";
|
|
String fntImg2 = "varImg_" + getLoginUserId(req) + "_2";
|
|
String fntImg3 = "varImg_" + getLoginUserId(req) + "_3";
|
|
String fntImg4 = "varImg_" + getLoginUserId(req) + "_4";
|
|
String fntImg5 = "varImg_" + getLoginUserId(req) + "_5";
|
|
String fntImg6 = "varImg_" + getLoginUserId(req) + "_6";
|
|
String[] fileNameTarget = { fntImg1, fntImg2, fntImg3, fntImg4, fntImg5, fntImg6 };
|
|
String[] fileNameParameters = { "imgVar1", "imgVar2", "imgVar3", "imgVar4", "imgVar5", "imgVar6" };
|
|
try {
|
|
if (getLoginUserGrant(req, new ArticoloVariante().getTableBeanName()) >= 3L) {
|
|
if (manageMultipartRequestParameters(req, 2000, fileNameParameters, fileNameTarget, fileNameTypes, targetDir)) {
|
|
processNoEncTypeRequest(req, res);
|
|
} else {
|
|
sendGrantMessage(req, AbMessages.getMessage(getLocale(req), "MR_FILE_ERROR"));
|
|
showBean(req, res);
|
|
}
|
|
} else {
|
|
sendGrantMessage(req, AbMessages.getMessage(getLocale(req), "GRANT_NO_RW"));
|
|
showBean(req, res);
|
|
}
|
|
} catch (Exception e) {
|
|
handleDebug(e);
|
|
}
|
|
}
|
|
|
|
protected ResParm afterSave(DBAdapter beanA, HttpServletRequest req, HttpServletResponse res) {
|
|
ApplParmFull apFull = getApFull(req);
|
|
ArticoloVariante bean = (ArticoloVariante)beanA;
|
|
ResParm rp = new ResParm(true);
|
|
if (bean.getId_articolo() > 0L) {
|
|
ListinoArticolo labWWW = new ListinoArticolo(apFull);
|
|
fillObject(req, labWWW);
|
|
labWWW.setId_articoloVariante(bean.getId_articoloVariante());
|
|
ListinoArticolo listinoArticoloBaseArticolo = bean.getArticolo().getListinoArticoloBase();
|
|
ListinoArticolo listinoArticoloVarianteBase = new ListinoArticolo(apFull);
|
|
listinoArticoloVarianteBase.findByArticoloVarianteListino(labWWW.getId_articoloVariante(),
|
|
bean.getListinoBase().getId_listino());
|
|
if (labWWW.getPrezzoLA() != 0.0D && !labWWW.hasStessiValori(listinoArticoloBaseArticolo)) {
|
|
listinoArticoloVarianteBase.setId_listino(bean.getListinoBase().getId_listino());
|
|
listinoArticoloVarianteBase.setId_articolo(labWWW.getId_articolo());
|
|
listinoArticoloVarianteBase.setId_articoloVariante(labWWW.getId_articoloVariante());
|
|
listinoArticoloVarianteBase.setAbbuonoPrezzoPubblicoLA(labWWW.getAbbuonoPrezzoPubblicoLA());
|
|
listinoArticoloVarianteBase.setDataScadenzaOffertaLA(labWWW.getDataScadenzaOffertaLA());
|
|
listinoArticoloVarianteBase.setPercLA(labWWW.getPercLA());
|
|
listinoArticoloVarianteBase.setPercLA1(labWWW.getPercLA1());
|
|
listinoArticoloVarianteBase.setPercLA2(labWWW.getPercLA2());
|
|
listinoArticoloVarianteBase.setPercLA3(labWWW.getPercLA3());
|
|
listinoArticoloVarianteBase.setPrezzoLA(labWWW.getPrezzoLA());
|
|
listinoArticoloVarianteBase.setPrezzoOffertaLA(labWWW.getPrezzoOffertaLA());
|
|
listinoArticoloVarianteBase.setPrezzoConIvaLA(labWWW.getPrezzoConIvaLA());
|
|
rp = listinoArticoloVarianteBase.save();
|
|
} else if (listinoArticoloVarianteBase.getId_listinoArticolo() > 0L) {
|
|
listinoArticoloVarianteBase.delete();
|
|
}
|
|
}
|
|
return rp;
|
|
}
|
|
|
|
protected void otherCommands(HttpServletRequest req, HttpServletResponse res) {
|
|
String cmd = getCmd(req);
|
|
if (cmd.equals("clearScaled")) {
|
|
ArticoloVariante bean = new ArticoloVariante(getApFull(req));
|
|
long l_id = getRequestLongParameter(req, "id_articoloVariante");
|
|
bean.findByPrimaryKey(l_id);
|
|
bean.clearScaledImg("TH");
|
|
bean.clearScaledImg("AV");
|
|
bean.clearScaledImg("CART");
|
|
sendMessage(req, "Scaled image TH AV e CART eliminate. Procedere con la nuova creazione.");
|
|
showBean(req, res);
|
|
} else if (cmd.equals("createScaled")) {
|
|
ArticoloVariante bean = new ArticoloVariante(getApFull(req));
|
|
long l_id = getRequestLongParameter(req, "id_articoloVariante");
|
|
bean.findByPrimaryKey(l_id);
|
|
req.setAttribute("bean", bean);
|
|
setJspPageRelative("articoloVarianteImg.jsp", req);
|
|
callJsp(req, res);
|
|
} else if (getCmd(req).equals("addTaglie")) {
|
|
ArticoloVariante bean = new ArticoloVariante(getApFull(req));
|
|
long l_id = getRequestLongParameter(req, "id_articoloVariante");
|
|
bean.findByPrimaryKey(l_id);
|
|
fillObject(req, bean);
|
|
ResParm rp = bean.save();
|
|
if (rp.getStatus()) {
|
|
Vectumerator vec = new Taglia(getApFull(req))
|
|
.findTaglieByTipoTaglia(bean.getArticolo().getTipo().getTipoTaglia().getId_tipoTaglia());
|
|
while (vec.hasMoreElements()) {
|
|
Taglia at = (Taglia)vec.nextElement();
|
|
ArticoloTaglia row = new ArticoloTaglia(getApFull(req));
|
|
row.setId_articolo(bean.getId_articolo());
|
|
row.setId_articoloVariante(bean.getId_articoloVariante());
|
|
row.setId_taglia(at.getId_taglia());
|
|
bean.addArticoloTaglia(row);
|
|
}
|
|
req.setAttribute("bean", bean);
|
|
} else {
|
|
sendMessage(req, rp.getErrMsg());
|
|
if (l_id == 0L)
|
|
req.setAttribute("bean", bean);
|
|
}
|
|
showBean(req, res);
|
|
} else {
|
|
showBean(req, res);
|
|
}
|
|
}
|
|
|
|
protected void addRows(HttpServletRequest req, HttpServletResponse res) {
|
|
ApplParmFull apFull = getApFull(req);
|
|
ArticoloVariante bean = null;
|
|
ResParm rp = new ResParm(true, "");
|
|
long l_id = getRequestLongParameter(req, "id_articoloVariante");
|
|
bean = new ArticoloVariante(apFull);
|
|
bean.findByPrimaryKey(l_id);
|
|
fillObject(req, bean);
|
|
rp = bean.save();
|
|
if (rp.getStatus()) {
|
|
try {
|
|
bean.findByPrimaryKey(l_id);
|
|
fillObject(req, bean);
|
|
rp = bean.save();
|
|
req.setAttribute("id_articolo", String.valueOf(bean.getId_articolo()));
|
|
if (rp.getStatus() == true) {
|
|
if (getAct(req).equals("addAcce")) {
|
|
Accessorio accessorio = new Accessorio(apFull);
|
|
if (!getRequestParameter(req, "id_articolo").equals("")) {
|
|
fillObject(req, accessorio);
|
|
rp = bean.addAccessorio(accessorio);
|
|
sendMessage(req, rp.getMsg());
|
|
} else {
|
|
sendMessage(req, AbMessages.getMessage(getLocale(req), "READ_FAIL"));
|
|
}
|
|
showBean(req, res);
|
|
} else if (getAct(req).equals("delAcce")) {
|
|
Accessorio accessorio = new Accessorio(apFull);
|
|
if (getRequestLongParameter(req, "id_accessorio") != 0L) {
|
|
fillObject(req, accessorio);
|
|
bean.delAccessorio(accessorio);
|
|
sendMessage(req, AbMessages.getMessage(getLocale(req), "DELETE_OK"));
|
|
} else {
|
|
sendMessage(req, AbMessages.getMessage(getLocale(req), "READ_FAIL"));
|
|
}
|
|
showBean(req, res);
|
|
} else if (getAct(req).equals("addArticoloTaglia")) {
|
|
ArticoloTaglia row = new ArticoloTaglia(apFull);
|
|
fillObject(req, row);
|
|
rp = bean.addArticoloTaglia(row);
|
|
sendMessage(req, rp.getMsg());
|
|
showBean(req, res);
|
|
} else if (getAct(req).equals("delArticoloTaglia")) {
|
|
ArticoloTaglia row = new ArticoloTaglia(apFull);
|
|
if (getRequestLongParameter(req, "id_articoloTaglia") != 0L) {
|
|
fillObject(req, row);
|
|
bean.delTaglia(row);
|
|
sendMessage(req, AbMessages.getMessage(getLocale(req), "DELETE_OK"));
|
|
}
|
|
showBean(req, res);
|
|
} else if (getAct(req).equals("addListinoArticolo")) {
|
|
ListinoArticolo row = new ListinoArticolo(apFull);
|
|
fillObject(req, row);
|
|
rp = bean.addListinoArticolo(row);
|
|
sendMessage(req, rp.getMsg());
|
|
showBean(req, res);
|
|
} else if (getAct(req).equals("delListinoArticolo")) {
|
|
ListinoArticolo row = new ListinoArticolo(apFull);
|
|
if (getRequestLongParameter(req, "id_listinoArticolo") != 0L) {
|
|
fillObject(req, row);
|
|
bean.delListinoArticolo(row);
|
|
sendMessage(req, AbMessages.getMessage(getLocale(req), "DELETE_OK"));
|
|
} else {
|
|
sendMessage(req, AbMessages.getMessage(getLocale(req), "READ_FAIL"));
|
|
}
|
|
showBean(req, res);
|
|
}
|
|
} else {
|
|
req.setAttribute("bean", bean);
|
|
sendMessage(req, rp.getMsg());
|
|
showBean(req, res);
|
|
}
|
|
} catch (Exception e) {
|
|
forceMessage(req, AbMessages.getMessage(getLocale(req), "SAVE_FAIL"));
|
|
showBean(req, res);
|
|
}
|
|
} else {
|
|
sendMessage(req, rp.getErrMsg());
|
|
showBean(req, res);
|
|
}
|
|
}
|
|
|
|
protected boolean isLoadImageServlet() {
|
|
return true;
|
|
}
|
|
|
|
protected ResParm afterSaveImmagini(DBAdapter beanA, HttpServletRequest req, HttpServletResponse res) {
|
|
synchronized (this) {
|
|
ResParm rp = new ResParm(true, "");
|
|
ArticoloVariante bean = (ArticoloVariante)beanA;
|
|
String targetDir = getDocBase() + getDocBase();
|
|
long l_id = bean.getId_articolo();
|
|
Vectumerator fileNames = (Vectumerator)req.getAttribute("completeAttachName");
|
|
String imgTmst = getTimeNameForFileUpload();
|
|
boolean l_newImg = false;
|
|
if (fileNames != null) {
|
|
while (fileNames.hasMoreElements()) {
|
|
String currentFileName = (String)fileNames.nextElement();
|
|
if (currentFileName.indexOf("/varImg") >= 0) {
|
|
l_newImg = true;
|
|
int idx = Integer.parseInt(
|
|
currentFileName.substring(currentFileName.lastIndexOf("_") + 1, currentFileName.lastIndexOf(".")));
|
|
if (isFileExist(currentFileName)) {
|
|
new File(targetDir + targetDir).delete();
|
|
new File(currentFileName).renameTo(new File(targetDir + targetDir));
|
|
}
|
|
}
|
|
}
|
|
if (l_newImg)
|
|
for (int j = 1; j <= 6; j++) {
|
|
String currentFileName = targetDir + targetDir;
|
|
if (isFileExist(currentFileName))
|
|
new File(currentFileName).renameTo(new File(targetDir + targetDir));
|
|
}
|
|
}
|
|
for (int i = 1; i <= 5; i++) {
|
|
if (getRequestLongParameter(req, "cmdCancellaImmagine" + i) == 1L) {
|
|
String fileName = targetDir + targetDir;
|
|
new File(fileName).delete();
|
|
}
|
|
}
|
|
if (l_newImg) {
|
|
bean.setImgTmst(imgTmst);
|
|
rp = bean.save();
|
|
req.setAttribute("bean", bean);
|
|
}
|
|
return rp;
|
|
}
|
|
}
|
|
|
|
public void _allineaPrezziConArticolo(HttpServletRequest req, HttpServletResponse res) {
|
|
ApplParmFull apFull = getApFull(req);
|
|
ArticoloVariante bean = new ArticoloVariante(apFull);
|
|
long l_id_articolo = getRequestLongParameter(req, "id_articoloVariante");
|
|
bean.findByPrimaryKey(l_id_articolo);
|
|
if (bean.getId_articolo() > 0L) {
|
|
ListinoArticolo listinoArticoloVarianteBase = new ListinoArticolo(apFull);
|
|
listinoArticoloVarianteBase.findByArticoloVarianteListino(bean.getId_articoloVariante(), bean.getListinoBase().getId_listino());
|
|
if (listinoArticoloVarianteBase.getId_articolo() > 0L)
|
|
listinoArticoloVarianteBase.delete();
|
|
bean.setCurrentTab(getRequestParameter(req, "currentTab"));
|
|
req.setAttribute("bean", bean);
|
|
showBean(req, res);
|
|
} else {
|
|
search(req, res);
|
|
}
|
|
}
|
|
|
|
protected void actionsAfterDelete(HttpServletRequest req, HttpServletResponse res) {
|
|
try {
|
|
req.setAttribute("cmd", "md");
|
|
req.setAttribute("act", "");
|
|
req.setAttribute("currentTab", "#VAR");
|
|
RequestDispatcher rd = getServletContext().getRequestDispatcher("/admin/art/Articolo.abl");
|
|
rd.forward((ServletRequest)req, (ServletResponse)res);
|
|
} catch (Exception e) {
|
|
StringBuilder msg = new StringBuilder();
|
|
if (e.getCause() != null) {
|
|
msg.append("Causa:\n");
|
|
msg.append(e.getCause().getMessage());
|
|
msg.append("\n");
|
|
}
|
|
msg.append(e.getMessage());
|
|
handleDebug(e, 2);
|
|
forceMessage(req, getJspPage(req));
|
|
req.setAttribute("errorMsg", msg.toString());
|
|
RequestDispatcher rd = getServletContext().getRequestDispatcher("/admin/config/error.jsp");
|
|
try {
|
|
rd.forward((ServletRequest)req, (ServletResponse)res);
|
|
} catch (Exception exception) {}
|
|
}
|
|
}
|
|
|
|
protected void print(HttpServletRequest req, HttpServletResponse res) {
|
|
ApplParmFull apFull = getApFull(req);
|
|
try {
|
|
if (getAct(req).equals("lblArt")) {
|
|
long l_id = 0L;
|
|
Articolo bean = null;
|
|
bean = new Articolo(apFull);
|
|
bean.findByPrimaryKey(new Long(l_id));
|
|
ArticoloCR CR = new ArticoloCR();
|
|
fillObject(req, CR);
|
|
CR.setId_articolo(l_id);
|
|
if (getParm("LABEL_ART_A4_ZEBRA").getNumeroInt() == 0) {
|
|
sendPdf(res, bean.creaLabelArticoloA4Pdf(CR), "LabelA4ZebraArt " + DBAdapter.getDayTimeTimestamp());
|
|
} else {
|
|
sendPdf(res, bean.creaLabelArticoloZebraPdf(CR), "LabelZebraArt " + DBAdapter.getDayTimeTimestamp());
|
|
}
|
|
} else if (getAct(req).equals("lblArtAcc")) {
|
|
long l_id = 0L;
|
|
Articolo bean = null;
|
|
l_id = getRequestLongParameter(req, "id_articolo");
|
|
bean = new Articolo(apFull);
|
|
ArticoloCR CR = new ArticoloCR();
|
|
fillObject(req, CR);
|
|
CR.setId_articolo(l_id);
|
|
if (getParm("LABEL_ART_A4_ZEBRA").getNumeroInt() == 0) {
|
|
sendPdf(res, bean.creaLabelArticoloAccA4Pdf(CR), "LabelA4ZebraAcc " + DBAdapter.getDayTimeTimestamp());
|
|
} else {
|
|
sendPdf(res, bean.creaLabelArticoloAccZebraPdf(CR), "LabelA4ZebraAcc " + DBAdapter.getDayTimeTimestamp());
|
|
}
|
|
} else {
|
|
search(req, res);
|
|
}
|
|
} catch (Exception e) {
|
|
e.printStackTrace();
|
|
}
|
|
}
|
|
|
|
public void _addTessutoConfezioneVariante(HttpServletRequest req, HttpServletResponse res) {
|
|
ResParm rp;
|
|
ApplParmFull apFull = getApFull(req);
|
|
ArticoloArticoloTessuto bean2 = new ArticoloArticoloTessuto(apFull);
|
|
fillObject(req, bean2);
|
|
if (bean2.getId_articoloArticoloTessuto() > 0L)
|
|
bean2.findByPrimaryKey(bean2.getId_articoloArticoloTessuto());
|
|
if (bean2.getId_articoloTessuto() > 0L && bean2.getId_articoloVariante() > 0L) {
|
|
rp = bean2.save();
|
|
} else {
|
|
rp = new ResParm(false, "Errore! Tessuto o articolo non selezionato correttamente");
|
|
}
|
|
sendMessage(req, rp.getMsg());
|
|
showBean(req, res);
|
|
}
|
|
|
|
public void _delTessutoConfezioneVariante(HttpServletRequest req, HttpServletResponse res) {
|
|
ResParm rp;
|
|
ApplParmFull apFull = getApFull(req);
|
|
ArticoloArticoloTessuto bean2 = new ArticoloArticoloTessuto(apFull);
|
|
fillObject(req, bean2);
|
|
if (bean2.getId_articoloArticoloTessuto() > 0L) {
|
|
bean2.findByPrimaryKey(bean2.getId_articoloArticoloTessuto());
|
|
rp = bean2.delete();
|
|
} else {
|
|
rp = new ResParm(false, "Errore! Impossibile cancellare tessuto associato a confezione ");
|
|
}
|
|
sendMessage(req, rp.getMsg());
|
|
showBean(req, res);
|
|
}
|
|
|
|
public void _impostaTessutoPrincipale(HttpServletRequest req, HttpServletResponse res) {
|
|
ResParm rp;
|
|
ApplParmFull apFull = getApFull(req);
|
|
ArticoloArticoloTessuto bean2 = new ArticoloArticoloTessuto(apFull);
|
|
fillObject(req, bean2);
|
|
if (bean2.getId_articoloArticoloTessuto() > 0L) {
|
|
bean2.findByPrimaryKey(bean2.getId_articoloArticoloTessuto());
|
|
bean2.setFlgPrincipale(1L);
|
|
rp = bean2.save();
|
|
} else {
|
|
rp = new ResParm(false, "Errore! Impossibile cancellare tessuto associato a confezione ");
|
|
}
|
|
sendMessage(req, rp.getMsg());
|
|
showBean(req, res);
|
|
}
|
|
|
|
public void _listinoArticoloVarianteCancella(HttpServletRequest req, HttpServletResponse res) {
|
|
ApplParmFull apFull = getApFull(req);
|
|
long l_id_articoloVariante = getRequestLongParameter(req, "id_articoloVariante");
|
|
long l_id_listino = getRequestLongParameter(req, "id_listino");
|
|
ListinoArticolo beanRow = new ListinoArticolo(apFull);
|
|
beanRow.findByArticoloVarianteListino(l_id_articoloVariante, l_id_listino);
|
|
ResParm rp = beanRow.delete();
|
|
sendMessage(req, rp.getMsg());
|
|
showBean(req, res);
|
|
}
|
|
|
|
public void _listinoArticoloVarianteMostra(HttpServletRequest req, HttpServletResponse res) {
|
|
ApplParmFull apFull = getApFull(req);
|
|
long l_id_articoloVariante = getRequestLongParameter(req, "id_articoloVariante");
|
|
long l_id_listino = getRequestLongParameter(req, "id_listino");
|
|
ListinoArticolo la = new ListinoArticolo(apFull);
|
|
la.findByArticoloVarianteListino(l_id_articoloVariante, l_id_listino);
|
|
la.setId_listino(l_id_listino);
|
|
la.setId_articoloVariante(l_id_articoloVariante);
|
|
req.setAttribute("bean", la);
|
|
setJspPageRelative("listinoArticolo.jsp", req);
|
|
callJsp(req, res);
|
|
}
|
|
|
|
public void _listinoSalvaPrezzoAV(HttpServletRequest req, HttpServletResponse res) {
|
|
ApplParmFull apFull = getApFull(req);
|
|
long l_id_articolo = getRequestLongParameter(req, "id_articolo");
|
|
long l_id_articoloVariante = getRequestLongParameter(req, "id_articoloVariante");
|
|
long l_id_listino = getRequestLongParameter(req, "id_listino");
|
|
ListinoArticolo beanRow = new ListinoArticolo(apFull);
|
|
beanRow.findByArticoloVarianteListino(l_id_articoloVariante, l_id_listino);
|
|
beanRow.setId_listino(l_id_listino);
|
|
beanRow.setId_articoloVariante(l_id_articoloVariante);
|
|
beanRow.setId_articolo(l_id_articolo);
|
|
beanRow.setPrezzoLA(getRequestDoubleParameter(req, "_prezzoLA"));
|
|
beanRow.setPercLA(getRequestDoubleParameter(req, "_percLA"));
|
|
beanRow.setPercLA1(getRequestDoubleParameter(req, "_percLA1"));
|
|
beanRow.setPercLA2(getRequestDoubleParameter(req, "_percLA2"));
|
|
beanRow.setPercLA3(getRequestDoubleParameter(req, "_percLA3"));
|
|
beanRow.setDataScadenzaOffertaLA(getRequestDateParameter(req, "_dataScadenzaOffertaLA"));
|
|
beanRow.setPrezzoOffertaLA(getRequestDoubleParameter(req, "_prezzoOffertaLA"));
|
|
ResParm rp = beanRow.save();
|
|
sendMessage(req, rp.getMsg());
|
|
showBean(req, res);
|
|
}
|
|
}
|