冬瓜茶饮料

nc6 用业务插件注册来跑按钮事件

在实际开发中,有些需求是要求系统单据,编辑或者触发其他按钮来回写其他模块单据

这时候就能用业务插件方式来触发其他模块的按钮事件,而不用去模块找对应的按钮编辑事件类

package hz.bs.hzctr.recbill.listener;

import nc.bs.businessevent.BusinessEvent;
import nc.bs.businessevent.IBusinessEvent;
import nc.bs.businessevent.IBusinessListener;
import nc.bs.dao.BaseDAO;
import nc.vo.arap.gathering.AggGatheringBillVO;
import nc.vo.arap.gathering.GatheringBillItemVO;
import nc.vo.arap.gathering.GatheringBillVO;
import nc.vo.pub.AggregatedValueObject;
import nc.vo.pub.BusinessException;
/**
 * 收款单为退款单时,审批后,按表体对应的合同编码回写销售合同对应单据
 * @author Yaolz
 */
public class RecAbleUnApproveRewSellctrListener implements IBusinessListener {
	
	private BaseDAO baseDao;
	public BaseDAO getBaseDao(){
		if(baseDao==null){
			baseDao=new BaseDAO();
		}
		return baseDao;
	}

	@Override
	public void doAction(IBusinessEvent businessEvent) throws BusinessException  {
		BusinessEvent e = (BusinessEvent) businessEvent;
		AggregatedValueObject[] values = (AggregatedValueObject[]) e
				.getObject();
		for (int i = 0; i < values.length; i++) {
			AggGatheringBillVO gatherBillAggVO = (AggGatheringBillVO) values[i];
			// 收款单表头
			GatheringBillVO billHVo = (GatheringBillVO) gatherBillAggVO
					.getParentVO();
			// 收款单表体
			GatheringBillItemVO[] gatherBillTtemVos = (GatheringBillItemVO[]) gatherBillAggVO
					.getChildren(GatheringBillItemVO.class);
			// 开票日期(业务日期)
			String billdate = billHVo.getBilldate().toString();
			// 交易类型为退款
			if ("F2-Cxx-D2".equals(billHVo.getPk_tradetype())) {
				for (GatheringBillItemVO bodyVO : gatherBillTtemVos) {
					String def14 = bodyVO.getDef14();
					if(def14 != null){
						String sql = " UPDATE hzctr_sellctr_h SET checkoutdate = '"+billdate+"' WHERE pk_sellctr_h='"+def14+"' ";
						BaseDAO dao = new BaseDAO();
						dao.executeUpdate(sql);
					}
				}
			}
		}
	}

}

  

posted on 2017-07-10 15:11  冬瓜茶饮料  阅读(695)  评论(0编辑  收藏  举报

导航