use of org.adempiere.webui.apps.BusyDialog in project adempiere by adempiere.
the class WPOSActionMenu method executeCommand.
private void executeCommand(Command command) {
BusyDialog waiting = new BusyDialog();
try {
CommandReceiver receiver = commandManager.getCommandReceivers(command.getEvent());
if (command.getCommand() == CommandManager.GENERATE_IMMEDIATE_INVOICE && pos.getC_Order_ID() > 0 && pos.isCompleted() && !pos.isVoided()) {
receiver.setCtx(pos.getCtx());
receiver.setPartnerId(queryPartner.getRecord_ID());
receiver.setOrderId(pos.getC_Order_ID());
receiver.setPOSId(pos.getC_POS_ID());
receiver.setBankAccountId(pos.getC_BankAccount_ID());
MBPartner partner = MBPartner.get(pos.getCtx(), receiver.getPartnerId());
Optional<String> taxId = Optional.ofNullable(partner.getTaxID());
String processMessage = receiver.getName() + " @DisplayDocumentInfo@ : " + pos.getDocumentNo() + " @To@ @C_BPartner_ID@ : " + partner.getName() + " @TaxID@ : " + taxId.orElse("");
if (FDialog.ask(pos.getWindowNo(), popupMenu, "StartProcess?", Msg.parseTranslation(pos.getCtx(), processMessage))) {
waiting.setPage(pos.v_Panel.getPage());
waiting.doHighlighted();
command.execute(receiver);
ProcessInfo processInfo = receiver.getProcessInfo();
waiting.dispose();
if (processInfo != null && processInfo.isError()) {
showError(processInfo);
} else {
afterExecutionCommand(command);
showOkMessage(processInfo);
if (processInfo != null)
pos.setOrder(processInfo.getRecord_ID());
pos.refreshHeader();
// Print Ticket
pos.printTicket();
}
}
} else //Reverse The Sales Transaction
if (command.getCommand() == CommandManager.GENERATE_REVERSE_SALES && pos.getC_Order_ID() > 0 && !pos.isReturnMaterial() && !pos.isVoided() && !pos.isClosed()) {
receiver.setCtx(pos.getCtx());
receiver.setOrderId(pos.getC_Order_ID());
receiver.setPOSId(pos.getC_POS_ID());
receiver.setPartnerId(pos.getC_BPartner_ID());
receiver.setBankAccountId(pos.getC_BankAccount_ID());
String processMessage = receiver.getName() + " @order.no@ : " + pos.getDocumentNo() + " @To@ @C_BPartner_ID@ : " + pos.getBPName();
if (FDialog.ask(pos.getWindowNo(), popupMenu, "StartProcess?", Msg.parseTranslation(pos.getCtx(), processMessage))) {
waiting.setPage(pos.v_Panel.getPage());
waiting.doHighlighted();
command.execute(receiver);
ProcessInfo processInfo = receiver.getProcessInfo();
waiting.dispose();
if (processInfo != null && processInfo.isError()) {
showError(processInfo);
} else {
afterExecutionCommand(command);
showOkMessage(processInfo);
}
pos.printTicket();
}
} else //Return product
if (command.getCommand() == CommandManager.GENERATE_RETURN && pos.getC_Order_ID() > 0 && !pos.isReturnMaterial() && pos.isCompleted()) {
receiver.setCtx(pos.getCtx());
receiver.setOrderId(pos.getC_Order_ID());
receiver.setPOSId(pos.getC_POS_ID());
receiver.setPartnerId(pos.getC_BPartner_ID());
receiver.setBankAccountId(pos.getC_BankAccount_ID());
String processMessage = receiver.getName() + " @DisplayDocumentInfo@ : " + pos.getDocumentNo() + " @To@ @C_BPartner_ID@ : " + pos.getBPName();
if (FDialog.ask(pos.getWindowNo(), popupMenu, "StartProcess?", Msg.parseTranslation(pos.getCtx(), processMessage))) {
waiting.setPage(pos.v_Panel.getPage());
waiting.doHighlighted();
command.execute(receiver);
ProcessInfo processInfo = receiver.getProcessInfo();
waiting.dispose();
if (processInfo != null && processInfo.isError()) {
showError(processInfo);
} else {
afterExecutionCommand(command);
showOkMessage(processInfo);
//execute out transaction
if (processInfo != null && processInfo.getRecord_ID() > 0) {
pos.setOrder(processInfo.getRecord_ID());
pos.refreshHeader();
}
}
}
} else if (command.getCommand() == CommandManager.GENERATE_WITHDRAWAL) {
Env.setContext(pos.getCtx(), pos.getWindowNo(), "C_POS_ID", pos.getC_POS_ID());
MBrowse browse = new MBrowse(Env.getCtx(), 50056, null);
WBrowser browser = new WBrowser(true, pos.getWindowNo(), "", browse, "", true, "", true);
CustomForm ff = browser.getForm();
ff.setAttribute(org.adempiere.webui.component.Window.MODE_KEY, org.adempiere.webui.component.Window.MODE_EMBEDDED);
ff.setAttribute(org.adempiere.webui.component.Window.INSERT_POSITION_KEY, org.adempiere.webui.component.Window.INSERT_NEXT);
ff.setTitle(browse.getTitle());
SessionManager.getAppDesktop().showWindow(ff);
} else if (command.getCommand() == CommandManager.CLOSE_STATEMENT) {
Env.setContext(pos.getCtx(), pos.getWindowNo(), "C_POS_ID", pos.getC_POS_ID());
MBrowse browse = new MBrowse(Env.getCtx(), 50057, null);
WBrowser browser = new WBrowser(true, pos.getWindowNo(), "", browse, "", true, "", true);
CustomForm ff = browser.getForm();
ff.setAttribute(org.adempiere.webui.component.Window.MODE_KEY, org.adempiere.webui.component.Window.MODE_EMBEDDED);
ff.setAttribute(org.adempiere.webui.component.Window.INSERT_POSITION_KEY, org.adempiere.webui.component.Window.INSERT_NEXT);
ff.setTitle(browse.getTitle());
SessionManager.getAppDesktop().showWindow(ff);
}
} catch (Exception exception) {
waiting.dispose();
FDialog.error(pos.getWindowNo(), pos.getForm(), exception.getLocalizedMessage());
} finally {
waiting.dispose();
waiting = null;
}
}
use of org.adempiere.webui.apps.BusyDialog in project adempiere by adempiere.
the class WPayment method showBusyDialog.
private void showBusyDialog() {
progressWindow = new BusyDialog();
progressWindow.setPage(this.getPage());
progressWindow.doHighlighted();
}
Aggregations