nc65卡片刷新不跳转

效果如下图:卡片点击刷新后 不跳转 且提示当前单据刷新成功!数据也刷新成功!

思路是:重写卡片刷新按钮方法.....


步骤1:添加一个类 RefreshSingleAction.java

内容如下:

package nc.ui.fdgyl.qcmanage.action;

import java.awt.event.ActionEvent;
import java.util.ArrayList;

import nc.bs.framework.common.NCLocator;
import nc.bs.logging.Logger;
import nc.itf.pubapp.pub.smart.IBillQueryService;
import nc.itf.uap.IUAPQueryBS;
import nc.jdbc.framework.processor.BeanListProcessor;
import nc.md.persist.framework.IMDPersistenceQueryService;
import nc.md.persist.framework.MDPersistenceService;
import nc.ui.ml.NCLangRes;
import nc.ui.uif2.ShowStatusBarMsgUtil;
import nc.vo.fdgyl.qcmanage.QcmanageBVO;
import nc.vo.pub.AggregatedValueObject;
import nc.vo.pub.BusinessException;
import nc.vo.pub.SuperVO;
import nc.vo.pubapp.pattern.model.entity.bill.AbstractBill;

/**
 * 
 * @author  卡片下刷新
 * 
 */
public class RefreshSingleAction extends nc.ui.uif2.actions.RefreshSingleAction {


    private static final long serialVersionUID = 1L;

    @Override
    public void doAction(ActionEvent e) throws Exception {

        IUAPQueryBS iuap = NCLocator.getInstance().lookup(IUAPQueryBS.class);

        Object obj = this.model.getSelectedData();
        if (obj != null) {
            if (obj instanceof SuperVO) {
                SuperVO oldVO = (SuperVO) obj;
                SuperVO newVO = this.getMDQueryService().queryBillOfVOByPK(
                        oldVO.getClass(), oldVO.getPrimaryKey(), false);
                // 单据被删除之后应该回到列表界面再刷新
                if (newVO == null) {
                    // 数据已经被删除
                    throw new BusinessException(NCLangRes.getInstance()
                            .getStrByID("uif2", "RefreshSingleAction-000000")/*
                                                                             * 数据已经被删除
                                                                             * ,
                                                                             * 请返回列表界面
                                                                             * !
                                                                             */);
                }
                this.model.directlyUpdate(newVO);
            } else if (obj instanceof AbstractBill) {

                AbstractBill oldVO = (AbstractBill) obj;
                String pk = oldVO.getParentVO().getPrimaryKey();
                IBillQueryService billQuery = NCLocator.getInstance().lookup(
                        IBillQueryService.class);
                AggregatedValueObject newVO = billQuery.querySingleBillByPk(
                        oldVO.getClass(), pk);
                // 单据被删除之后应该回到列表界面再刷新
                if (newVO == null) {
                    // 数据已经被删除
                    throw new BusinessException(NCLangRes.getInstance()
                            .getStrByID("uif2", "RefreshSingleAction-000000")/*
                                                                             * 数据已经被删除
                                                                             * ,
                                                                             * 请返回列表界面
                                                                             * !
                                                                             */);
                }
                // modify by mml 2017-4-5 14:39:08 目的根据行号排序
                String sql = "select * from fdgyl_qcmanage_b where nvl(dr,0)=0 and pk_qcmanage='"
                        + pk + "' ORDER BY to_number(crowno) asc";
                @SuppressWarnings("unchecked")
                ArrayList<QcmanageBVO[]> bodyList = (ArrayList<QcmanageBVO[]>) iuap
                        .executeQuery(sql, new BeanListProcessor(
                                QcmanageBVO.class));
                newVO.setChildrenVO(bodyList.toArray(new QcmanageBVO[0]));
                // end
                this.model.directlyUpdate(newVO);

            } else {
                Logger.debug("目前只支持SuperVO结构的数据");/* -=notranslate=- */
            }
        }
        this.showQueryInfo();
    }

    protected void showQueryInfo() {
        ShowStatusBarMsgUtil.showStatusBarMsg(nc.vo.ml.NCLangRes4VoTransl
                .getNCLangRes().getStrByID("pubapp_0", "0pubapp-0267")/*
                                                                     * @res
                                                                     * "当前单据刷新成功。"
                                                                     */, this
                .getModel().getContext());
    }

    private IMDPersistenceQueryService getMDQueryService() {
        return MDPersistenceService.lookupPersistenceQueryService();
    }

}

需要注意:1、nc.vo.fdgyl.qcmanage.QcmanageBVO需要改成你们自己对应的子表bvo

                  (注:bvo的字段需要get set方法)

                 2、  String sql 下面的表名改成你们对于bvo的数据库表名


步骤2:配置文件添加 

1、 添加按钮 

   <bean id="cardRefreshAction" class="nc.ui.fdgyl.qcmanage.action.RefreshSingleAction">
        <property name="model" ref="bmModel" />
     </bean>

2、把按钮放到按钮组

注:UAP studio 向导生成65开发单据->卡片列表按钮是一起的 需要分开写

<!-- 卡片显示下的按钮 -->
	<bean id="actionsOfCard" class="nc.ui.uif2.actions.StandAloneToftPanelActionContainer">
		<constructor-arg ref="billForm" />
		<property name="model" ref="bmModel" />
				<property name="actions">
			<list>
			    <ref bean="addMenuGroup" />
				<ref bean="editAction" />
				<ref bean="deleteScriptAction" />
				<ref bean="defaultQueryAction" />
				<ref bean="separatorAction" />
				<ref bean="cardRefreshAction" />
				<ref bean="separatorAction" />
				<ref bean="commitMenuAction" />
				<ref bean="approveMenuAction" />
				<ref bean="separatorAction" />
				<ref bean="linkQueryAction" />
				<ref bean="separatorAction" />
				<ref bean="printMenuAction" />
				<ref bean="separatorAction" />
				<ref bean="scorderMenuAction" />
				<ref bean="dataMenuAction" />
			</list>
		</property>
			<property name="editActions">
			<list>
				<ref bean="saveScriptAction" />
				<ref bean="cancelAction" />				
			</list>
		</property>
			</bean>	

步骤3:清理缓存 重新进 如果报错 那么重启中间件 

猜你喜欢

转载自blog.csdn.net/qq_19004705/article/details/81200747