use of org.compiere.process.ProcessInfo in project adempiere by adempiere.
the class ProcessDialog method init.
// dispose
/**
* Dynamic Init
* @return true, if there is something to process (start from menu)
*/
public boolean init() {
log.config("");
// Similar to APanel.actionButton
ProcessInfo pi = new ProcessInfo(null, processId);
pi.setAD_User_ID(Env.getAD_User_ID(Env.getCtx()));
pi.setAD_Client_ID(Env.getAD_Client_ID(Env.getCtx()));
parameterPanel = new ProcessPanel(this, windowNo, pi, ProcessPanel.COLUMNS_1);
// Set Default
parameterPanel.createFieldsAndEditors();
getContentPane().add(parameterPanel.getPanel());
setTitle(parameterPanel.getName());
// Revalidate
validateScreen();
return true;
}
use of org.compiere.process.ProcessInfo in project adempiere by adempiere.
the class MAssetAddition method updateSourceDocument.
// afterSave
/**
* Update Source Document (Invoice, Project etc) Status
* @param isReversal is called from a reversal action (like Void, Reverse-Correct).
* We need this flag because that when we call the method from voidIt()
* the document is not marked as voided yet. Same thing applies for reverseCorrectIt too.
*/
private void updateSourceDocument(final boolean isReversalParam) {
boolean isReversal = isReversalParam;
// Check if this document is reversed/voided
String docStatus = getDocStatus();
if (!isReversal && (DOCSTATUS_Reversed.equals(docStatus) || DOCSTATUS_Voided.equals(docStatus))) {
isReversal = true;
}
final String sourceType = getA_SourceType();
// Invoice: mark C_InvoiceLine.A_Processed='Y' and set C_InvoiceLine.A_Asset_ID
if (A_SOURCETYPE_Invoice.equals(sourceType) && isProcessed()) {
int C_InvoiceLine_ID = getC_InvoiceLine_ID();
MInvoiceLine invoiceLine = new MInvoiceLine(getCtx(), C_InvoiceLine_ID, get_TrxName());
invoiceLine.setA_Processed(!isReversal);
invoiceLine.setA_Asset_ID(isReversal ? 0 : getA_Asset_ID());
invoiceLine.saveEx();
} else // Project
if (A_SOURCETYPE_Project.equals(sourceType) && isProcessed()) {
if (isReversal) {
// Project remains closed. We just void/reverse/reactivate the Addition
} else {
//TODO decide whether to close project first or later
int project_id = getC_Project_ID();
ProcessInfo pi = new ProcessInfo("", 0, MProject.Table_ID, project_id);
pi.setAD_Client_ID(getAD_Client_ID());
pi.setAD_User_ID(Env.getAD_User_ID(getCtx()));
//
ProjectClose proc = new ProjectClose();
proc.startProcess(getCtx(), pi, Trx.get(get_TrxName(), false));
if (pi.isError()) {
throw new AssetException(pi.getSummary());
}
}
} else // Import
if (A_SOURCETYPE_Imported.equals(sourceType) && !isProcessed()) {
if (is_new() && getI_FixedAsset_ID() > 0) {
MIFixedAsset ifa = getI_FixedAsset(false);
if (ifa != null) {
ifa.setI_IsImported(true);
ifa.setA_Asset_ID(getA_Asset_ID());
ifa.saveEx(get_TrxName());
}
}
} else // Manual
if (A_SOURCETYPE_Manual.equals(sourceType) && isProcessed()) {
// nothing to do
log.fine("Nothing to do");
}
}
use of org.compiere.process.ProcessInfo in project adempiere by adempiere.
the class OrderDistribution method generate.
// saveSelection
public String generate(IStatusBar statusBar, String docActionSelected) {
String info = "";
log.info("M_Locator_ID=" + m_M_Locator_ID);
String trxName = Trx.createTrxName("IMG");
Trx trx = Trx.get(trxName, true);
// prevents from being called twice
setSelectionActive(false);
statusBar.setStatusLine(Msg.translate(Env.getCtx(), "M_Movement_ID"));
statusBar.setStatusDB(String.valueOf(getSelection().size()));
// Prepare Process
int AD_Process_ID = MProcess.getProcess_ID("M_Generate Movement", trxName);
MPInstance instance = new MPInstance(Env.getCtx(), AD_Process_ID, 0);
if (!instance.save()) {
info = Msg.getMsg(Env.getCtx(), "ProcessNoInstance");
return info;
}
DB.createT_Selection(instance.getAD_PInstance_ID(), getSelection(), null);
//call process
ProcessInfo pi = new ProcessInfo("VOrderDistribution", AD_Process_ID);
pi.setAD_PInstance_ID(instance.getAD_PInstance_ID());
// Add Parameter - Selection=Y
MPInstancePara ip = new MPInstancePara(instance, 10);
ip.setParameter("Selection", "Y");
ip.saveEx();
MLocator locator = MLocator.get(Env.getCtx(), Integer.parseInt(m_M_Locator_ID.toString()));
// Add Parameter - M_Warehouse_ID=x
ip = new MPInstancePara(instance, 20);
ip.setParameter("M_Warehouse_ID", locator.getM_Warehouse_ID());
ip.saveEx();
setTrx(trx);
setProcessInfo(pi);
return info;
}
use of org.compiere.process.ProcessInfo in project adempiere by adempiere.
the class ZkReportViewerProvider method openViewer.
public void openViewer(ReportEngine report) {
if (report.getPrintInfo().getAD_Process_ID() == 202 && MSysConfig.getBooleanValue("SMART_REPORT", Boolean.FALSE)) {
ProcessInfo processInfo = report.getProcessInfo();
MReport m_report = new MReport(report.getCtx(), processInfo.getRecord_ID(), processInfo.getTransactionName());
ProcessInfoParameter[] pi = processInfo.getParameter();
// Goodwill BF: report title is taken wrongly from other report if report line set is shared
// - passing PA_Report_ID instead of PA_ReportLineSet_ID
Window smjviewer = new SMJReportViewer(processInfo.getAD_PInstance_ID(), processInfo.getTransactionName(), m_report.getPA_Report_ID(), pi[0].getParameterAsInt(), report.getPrintFormat().getAD_PrintFont_ID(), m_report.getColumnSet().getColumns());
smjviewer.setAttribute(Window.MODE_KEY, Window.MODE_EMBEDDED);
smjviewer.setAttribute(Window.INSERT_POSITION_KEY, Window.INSERT_NEXT);
SessionManager.getAppDesktop().showWindow(smjviewer);
} else {
Window viewer = new ZkReportViewer(report, report.getName());
viewer.setAttribute(Window.MODE_KEY, Window.MODE_EMBEDDED);
viewer.setAttribute(Window.INSERT_POSITION_KEY, Window.INSERT_NEXT);
SessionManager.getAppDesktop().showWindow(viewer);
}
}
use of org.compiere.process.ProcessInfo in project adempiere by adempiere.
the class WBrowser method cmd_Ok.
/**
* Ok Action
*/
private void cmd_Ok() {
log.config("OK=" + true);
m_ok = true;
saveResultSelection(detail);
saveSelection(detail);
// Is Process ok
boolean isOk = false;
// Valid Process, Selected Keys and process parameters
if (getAD_Process_ID() > 0 && getSelectedKeys() != null) {
parameterPanel.getProcessInfo().setAD_PInstance_ID(-1);
// FR [ 265 ]
if (parameterPanel.validateParameters() == null) {
// Save Parameters
if (parameterPanel.saveParameters() == null) {
// Get Process Info
ProcessInfo pi = parameterPanel.getProcessInfo();
if (getFieldKey() != null && getFieldKey().get_ID() > 0) {
MViewDefinition viewDefinition = (MViewDefinition) getFieldKey().getAD_View_Column().getAD_View_Definition();
pi.setAliasForTableSelection(viewDefinition.getTableAlias());
pi.setTableSelectionId(viewDefinition.getAD_Table_ID());
}
// Set Selected Values
pi.setSelectionValues(getSelectedValues());
//
setBrowseProcessInfo(pi);
// Execute Process
ProcessCtl worker = new ProcessCtl(this, pi.getWindowNo(), pi, null);
showBusyDialog();
worker.run();
hideBusyDialog();
setStatusLine(pi.getSummary(), pi.isError());
// For Valid Ok
isOk = !pi.isError();
}
}
}
// For when is ok the process
if (isOk) {
// Close
if (getParentWindowNo() > 0) {
// BR [ 394 ]
Env.clearWinContext(getWindowNo());
SessionManager.getAppDesktop().closeActiveWindow();
return;
}
// Else Reset
p_loadedOK = initBrowser();
collapsibleSeach.setOpen(true);
}
}
Aggregations