Small improve in the code
This commit is contained in:
parent
4021628925
commit
274d3df9f7
|
@ -15,12 +15,12 @@
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
package org.eevolution.process;
|
package org.eevolution.process;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
import java.util.logging.Level;
|
|
||||||
|
|
||||||
|
import java.util.logging.Level;
|
||||||
import org.compiere.model.MQuery;
|
import org.compiere.model.MQuery;
|
||||||
import org.compiere.model.PrintInfo;
|
import org.compiere.model.PrintInfo;
|
||||||
import org.compiere.print.MPrintFormat;
|
import org.compiere.print.MPrintFormat;
|
||||||
|
import org.compiere.print.ReportCtl;
|
||||||
import org.compiere.print.ReportEngine;
|
import org.compiere.print.ReportEngine;
|
||||||
import org.compiere.process.ProcessInfoParameter;
|
import org.compiere.process.ProcessInfoParameter;
|
||||||
import org.compiere.process.SvrProcess;
|
import org.compiere.process.SvrProcess;
|
||||||
|
@ -32,7 +32,7 @@ import org.eevolution.model.MPPOrder;
|
||||||
/**
|
/**
|
||||||
* CompletePrintOrder
|
* CompletePrintOrder
|
||||||
*
|
*
|
||||||
* @author Victor Pèrez
|
* @author victor.perez@e-evolution.com
|
||||||
* @version $Id: CompletePrintOrder.java,v 1.4 2004/05/07 05:52:14 vpj-cd Exp $
|
* @version $Id: CompletePrintOrder.java,v 1.4 2004/05/07 05:52:14 vpj-cd Exp $
|
||||||
*/
|
*/
|
||||||
public class CompletePrintOrder extends SvrProcess {
|
public class CompletePrintOrder extends SvrProcess {
|
||||||
|
@ -43,9 +43,6 @@ public class CompletePrintOrder extends SvrProcess {
|
||||||
private boolean p_IsPrintPackList = false; // for future use
|
private boolean p_IsPrintPackList = false; // for future use
|
||||||
private boolean p_IsComplete = false;
|
private boolean p_IsComplete = false;
|
||||||
|
|
||||||
boolean IsDirectPrint = true; // TODO - Trifon we must check(ask Victor)
|
|
||||||
// why it is false by default?
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Prepare - e.g., get Parameters.
|
* Prepare - e.g., get Parameters.
|
||||||
*/
|
*/
|
||||||
|
@ -56,8 +53,7 @@ public class CompletePrintOrder extends SvrProcess {
|
||||||
if (para[i].getParameter() == null)
|
if (para[i].getParameter() == null)
|
||||||
;
|
;
|
||||||
else if (name.equals("PP_Order_ID"))
|
else if (name.equals("PP_Order_ID"))
|
||||||
p_PP_Order_ID = ((BigDecimal) para[i].getParameter())
|
p_PP_Order_ID = para[i].getParameterAsInt();
|
||||||
.intValue();
|
|
||||||
else if (name.equals("IsPrintPickList"))
|
else if (name.equals("IsPrintPickList"))
|
||||||
p_IsPrintPickList = "Y".equals(para[i].getParameter());
|
p_IsPrintPickList = "Y".equals(para[i].getParameter());
|
||||||
else if (name.equals("IsPrintWorkflow"))
|
else if (name.equals("IsPrintWorkflow"))
|
||||||
|
@ -84,16 +80,16 @@ public class CompletePrintOrder extends SvrProcess {
|
||||||
Language language = Language.getLoginLanguage(); // Base Language
|
Language language = Language.getLoginLanguage(); // Base Language
|
||||||
|
|
||||||
if (p_PP_Order_ID == 0)
|
if (p_PP_Order_ID == 0)
|
||||||
throw new IllegalArgumentException("Manufacturing Order == 0");
|
throw new IllegalArgumentException(Msg.translate(getCtx(),MPPOrder.COLUMNNAME_PP_Order_ID) + " == 0");
|
||||||
|
|
||||||
if (p_IsComplete) {
|
if (p_IsComplete) {
|
||||||
MPPOrder order = new MPPOrder(getCtx(), p_PP_Order_ID, null);
|
MPPOrder order = new MPPOrder(getCtx(), p_PP_Order_ID, get_TrxName());
|
||||||
|
|
||||||
if (order.isAvailable()) {
|
if (order.isAvailable()) {
|
||||||
order.completeIt();
|
order.completeIt();
|
||||||
order.setDocStatus(MPPOrder.DOCACTION_Complete);
|
order.setDocStatus(MPPOrder.DOCACTION_Complete);
|
||||||
order.setDocAction(MPPOrder.ACTION_Close);
|
order.setDocAction(MPPOrder.ACTION_Close);
|
||||||
order.save(get_TrxName());
|
order.saveEx();
|
||||||
} else {
|
} else {
|
||||||
return Msg.translate(Env.getCtx(), "NoQtyAvailable");
|
return Msg.translate(Env.getCtx(), "NoQtyAvailable");
|
||||||
}
|
}
|
||||||
|
@ -102,29 +98,9 @@ public class CompletePrintOrder extends SvrProcess {
|
||||||
|
|
||||||
if (p_IsPrintPickList) {
|
if (p_IsPrintPickList) {
|
||||||
// Get Format & Data
|
// Get Format & Data
|
||||||
|
ReportEngine re = ReportEngine.get(getCtx(), ReportEngine.MANUFACTURING_ORDER,getRecord_ID());
|
||||||
format = MPrintFormat.get(getCtx(), MPrintFormat.getPrintFormat_ID(
|
ReportCtl.preview(re);
|
||||||
"Manufacturing Order", MPPOrder.Table_ID, getAD_Client_ID()), false);
|
re.print();
|
||||||
format.setLanguage(language);
|
|
||||||
format.setTranslationLanguage(language);
|
|
||||||
// query
|
|
||||||
MQuery query = new MQuery("PP_Order");
|
|
||||||
query.addRestriction("PP_Order_ID", MQuery.EQUAL, new Integer(
|
|
||||||
p_PP_Order_ID));
|
|
||||||
|
|
||||||
// Engine
|
|
||||||
PrintInfo info = new PrintInfo("PP_Order", MPPOrder.Table_ID,
|
|
||||||
getRecord_ID());
|
|
||||||
ReportEngine re = new ReportEngine(getCtx(), format, query, info);
|
|
||||||
// new Viewer(re);
|
|
||||||
|
|
||||||
if (IsDirectPrint) {
|
|
||||||
re.print();
|
|
||||||
// ReportEngine.printConfirm ( 1000282 , getRecord_ID() );
|
|
||||||
}
|
|
||||||
// else
|
|
||||||
// new Viewer(re);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
if (p_IsPrintWorkflow) {
|
if (p_IsPrintWorkflow) {
|
||||||
// Get Format & Data
|
// Get Format & Data
|
||||||
|
@ -137,23 +113,15 @@ public class CompletePrintOrder extends SvrProcess {
|
||||||
format.setTranslationLanguage(language);
|
format.setTranslationLanguage(language);
|
||||||
// query
|
// query
|
||||||
MQuery query = new MQuery("PP_Order");
|
MQuery query = new MQuery("PP_Order");
|
||||||
query.addRestriction("PP_Order_ID", MQuery.EQUAL, new Integer(
|
query.addRestriction("PP_Order_ID", MQuery.EQUAL, p_PP_Order_ID);
|
||||||
p_PP_Order_ID));
|
|
||||||
|
|
||||||
// Engine
|
// Engine
|
||||||
PrintInfo info = new PrintInfo("PP_Order", MPPOrder.Table_ID,
|
PrintInfo info = new PrintInfo("PP_Order", MPPOrder.Table_ID,getRecord_ID());
|
||||||
getRecord_ID());
|
|
||||||
ReportEngine re = new ReportEngine(getCtx(), format, query, info);
|
ReportEngine re = new ReportEngine(getCtx(), format, query, info);
|
||||||
// new Viewer(re);
|
ReportCtl.preview(re);
|
||||||
|
re.print(); // prints only original
|
||||||
if (IsDirectPrint) {
|
|
||||||
re.print(); // prints only original
|
|
||||||
}
|
|
||||||
// else
|
|
||||||
// new Viewer(re);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return Msg.translate(Env.getCtx(), "Ok");
|
return "@OK@";
|
||||||
|
|
||||||
} // doIt
|
} // doIt
|
||||||
|
|
Loading…
Reference in New Issue