nc65 参照删除校验:该参照被引用就不能被删除

1.找到对应节点的xml文件,找到配置文件中删除action的配置

<!--======= 动作:[newActions] [删除] ===========-->
	<bean id="batchDelLineAction" class="nc.ui.pubapp.uif2app.actions.batch.BatchDelLineAction">
		<property name="model"><ref bean="batchModel"/></property>
		<property name="batchBillTable"><ref bean="batchBillTable"/></property>
		<property name="exceptionHandler"><ref bean="exceptionHandler" /></property>
	</bean>

2.在对应的action包下新建类,继承nc.ui.pubapp.uif2app.actions.batch.BatchDelLineAction,重写doAction方法

public void doAction(ActionEvent e) throws Exception {
		BatchBillTableModel model = super.getModel();
		Object[] objs = model.getSelectedOperaDatas();
		try{
			String codes = "";
			for(int i = 0;i<objs.length;i++){
				SFparaSetVO vo = (SFparaSetVO)objs[i];
				List<StressTestPlanBVO> list = NCLocator.getInstance().lookup(IAlm_sfpara_setMaintain.class).queryStressTestPlanB(vo.getPk_sfpara_set());
				if(list.size() > 0){
					codes += (vo.getStressfac_code()+"、"); 
				}
			}
			if(codes.length() > 0){
				throw new BusinessException(codes.substring(0, codes.length()-1)+"被引用不能删除!");
			}else{
				super.doAction(e);
			}
		}catch(BusinessException e1){
			ExceptionUtils.wrappException(e1);
		}
		
	} 

3.其中接口IAlm_sfpara_setMaintain要新增queryStressTestPlanB方法,并在对应的实现类中实现该方法

@Override
	public List<StressTestPlanBVO> queryStressTestPlanB(String pk)
			throws BusinessException, Exception {
		BaseDAO dao = new BaseDAO();
		return (List<StressTestPlanBVO>) dao.retrieveByClause(StressTestPlanBVO.class, "pk_sfpara_set = '"+pk+"'");
	}
4.将第一步中的配置修改成新增的类即可。

猜你喜欢

转载自blog.csdn.net/u014714841/article/details/80355278