use of org.compiere.process.ProcessInfo in project adempiere by adempiere.
the class Viewer method launchProcessPara.
// cmd_find
/**
* FR [ 295 ]
* Launch Parameters for re-query
* @return isOk
*/
private boolean launchProcessPara() {
if (m_reportEngine.getProcessInfo() == null)
return false;
// Create new Instance
ProcessInfo pi = new ProcessInfo(m_reportEngine.getProcessInfo().getTitle(), m_reportEngine.getProcessInfo().getAD_Process_ID(), m_reportEngine.getProcessInfo().getTable_ID(), m_reportEngine.getProcessInfo().getRecord_ID());
// Launch dialog
ProcessModalDialog para = new ProcessModalDialog(Env.getFrame((Container) this), m_WindowNo, pi);
if (para.isValidDialog()) {
para.validate();
para.pack();
AEnv.showCenterWindow(Env.getWindow(m_WindowNo), para);
if (para.isOK()) {
// execute
ProcessCtl worker = new ProcessCtl(null, m_WindowNo, pi, true, null);
//synchrous
worker.run();
//
ReportEngine re = ReportEngine.get(Env.getCtx(), pi);
//
m_reportEngine.setQuery(re.getQuery());
//
return true;
}
}
// Default
return false;
}
use of org.compiere.process.ProcessInfo in project adempiere by adempiere.
the class MDDOrder method createDropShip.
// completeIt
private void createDropShip() {
//Create movement delivery
Date date = Date.from(LocalDate.now().atStartOfDay().atZone(ZoneId.systemDefault()).toInstant());
Timestamp today = new Timestamp(date.getTime());
List<Integer> recordIds = new ArrayList<>();
recordIds.add(getDD_Order_ID());
ProcessInfo processInfo = ProcessBuilder.create(getCtx()).process(GenerateMovement.getProcessId()).withTitle(GenerateMovement.getProcessName()).withRecordId(MDDOrder.Table_ID, 0).withSelectedRecordsIds(recordIds).withParameter(MMovement.COLUMNNAME_MovementDate, today).withParameter(MMovement.COLUMNNAME_DocAction, DocAction.ACTION_Complete).withoutTransactionClose().execute(get_TrxName());
if (processInfo.isError())
throw new AdempiereException(processInfo.getSummary());
List<Integer> orderLinesIds = new ArrayList<>();
LinkedHashMap<Integer, LinkedHashMap<String, Object>> selection = new LinkedHashMap<Integer, LinkedHashMap<String, Object>>();
getLines().stream().filter(orderLine -> orderLine != null).forEach(orderLine -> {
orderLinesIds.add(orderLine.get_ID());
LinkedHashMap<String, Object> values = new LinkedHashMap<String, Object>();
values.put("LINE_" + MDDOrderLine.COLUMNNAME_QtyInTransit, orderLine.getQtyInTransit());
selection.put(orderLine.get_ID(), values);
});
processInfo = ProcessBuilder.create(getCtx()).process(GenerateMovementMaterial.getProcessId()).withTitle(GenerateMovementMaterial.getProcessName()).withRecordId(MDDOrderLine.Table_ID, 0).withSelectedRecordsIds(orderLinesIds, selection).withParameter(MMovement.COLUMNNAME_MovementDate, today).withoutTransactionClose().execute(get_TrxName());
if (processInfo.isError())
throw new AdempiereException(processInfo.getSummary());
}
use of org.compiere.process.ProcessInfo in project adempiere by adempiere.
the class GenerateMovement method doIt.
// prepare
/**
* Generate Movements
* @return info
* @throws Exception
*/
protected String doIt() throws Exception {
ProcessInfo processInfo = ProcessBuilder.create(getCtx()).process(MovementGenerate.getProcessId()).withTitle(GenerateMovement.getProcessName()).withRecordId(MDDOrder.Table_ID, 0).withSelectedRecordsIds(getSelectionKeys()).withParameter(MMovement.COLUMNNAME_MovementDate, getMovementDate()).withParameter(MMovement.COLUMNNAME_DocAction, DocAction.ACTION_Complete).execute();
if (processInfo.isError())
throw new AdempiereException(processInfo.getSummary());
result = processInfo.getSummary();
int[] movementProcessedIds = processInfo.getIDs();
if (movementProcessedIds != null && movementProcessedIds.length > 0) {
Arrays.stream(movementProcessedIds).filter(movementId -> movementId > 0).forEach(movementId -> {
MMovement movement = new MMovement(getCtx(), movementId, null);
StringBuffer resultText = new StringBuffer(Msg.translate(Env.getCtx(), "DocumentNo") + " : " + movement.getDocumentNo());
result = result == null ? " " + resultText.toString() : result + " " + resultText.toString();
printDocument(movement, "Inventory Move Hdr (Example)", processInfo.getWindowNo());
});
}
return result;
}
use of org.compiere.process.ProcessInfo in project adempiere by adempiere.
the class WReport method launchReport.
// launchReport
/**
* Launch Report
* @param pf print format
*/
private File launchReport(MPrintFormat pf, HttpServletRequest request, GridTab m_curTab, MQuery m_query) {
int Record_ID = 0;
WebSessionCtx wsc = WebSessionCtx.get(request);
WWindowStatus ws = WWindowStatus.get(request);
//Instance pInstance = new MPInstance (wsc.ctx, 0, 0);
File fileName = null;
if (m_query.getRestrictionCount() == 1 && m_query.getCode(0) instanceof Integer) {
Record_ID = ((Integer) m_query.getCode(0)).intValue();
}
PrintInfo info = new PrintInfo(pf.getName(), pf.getAD_Table_ID(), Record_ID);
info.setDescription(m_query.getInfo());
if (pf != null && pf.getJasperProcess_ID() > 0) {
// It's a report using the JasperReports engine
ProcessInfo pi = new ProcessInfo("", pf.getJasperProcess_ID());
Trx trx = Trx.get(Trx.createTrxName("WebPrc"), true);
// Execute Process
WProcessCtl.process(this, m_curTab.getAD_Window_ID(), pi, trx, request);
} else {
// It's a default report using the standard printing engine
ReportEngine re = new ReportEngine(wsc.ctx, pf, m_query, info);
if (re == null) {
log.info("Could not start ReportEngine");
} else {
try {
File file = File.createTempFile("WProcess", ".pdf");
boolean ok = re.createPDF(file);
if (ok) {
fileName = file;
} else {
log.info("Could not create Report");
}
} catch (Exception e) {
log.info(e.toString());
}
}
}
return fileName;
}
use of org.compiere.process.ProcessInfo in project adempiere by adempiere.
the class WReport method launchReport.
// launchReport
/**
* Launch Report
* @param pf print format
*/
private void launchReport(MPrintFormat pf) {
int Record_ID = 0;
// The query is passed into A/WReport.java with only the key or link column included.
if (m_query.getRestrictionCount() == 1 && m_query.getCode(0) instanceof Integer)
Record_ID = ((Integer) m_query.getCode(0)).intValue();
// Add the extended query after the record ID has been identified.
if (m_whereExtended != null && m_whereExtended.length() > 0 && m_query != null)
m_query.addRestriction(Env.parseContext(Env.getCtx(), WindowNo, m_whereExtended, false));
PrintInfo info = new PrintInfo(pf.getName(), pf.getAD_Table_ID(), Record_ID);
info.setDescription(m_query.getInfo());
if (pf != null && pf.getJasperProcess_ID() > 0) {
// It's a report using the JasperReports engine
ProcessInfo pi = new ProcessInfo("", pf.getJasperProcess_ID(), pf.getAD_Table_ID(), Record_ID);
// Execute Process
WProcessCtl.process(null, WindowNo, pi, null);
} else {
// It's a default report using the standard printing engine
ReportEngine re = new ReportEngine(Env.getCtx(), pf, m_query, info);
// TODO: Is this required? The extended query, if any, is included in the query.
re.setWhereExtended(m_whereExtended);
ReportCtl.preview(re);
}
}
Aggregations