nc65单据穿透

nc65单据穿透

jych项目

1.支出合同台账合同号字段可以穿透到对应的单据上

一个合同号穿透到一个物质设备采购合同上

1.支出合同台账单据模板合同号字段卡片下和列表下高级属性勾选是否超链接
nc65单据穿透_第1张图片

2.支出合同台账中增加监听类
HeadItemLinkListener.java

package nc.ui.jych.zchttz.ace.view;

import nc.desktop.ui.WorkbenchEnvironment;
import nc.funcnode.ui.FuncletInitData;
import nc.funcnode.ui.FuncletWindowLauncher;
import nc.ui.pub.bill.BillItemHyperlinkEvent;
import nc.ui.pub.bill.BillItemHyperlinkListener;
import nc.vo.jych.paymentorder.AggPaymentOrderVO;
import nc.vo.jych.utils.PenetrateQuery;
import nc.vo.jych.wzsbcght.AggWzsbcghtVO;
import nc.vo.jych.zchttz.ZchttzVO;
import nc.vo.pub.BusinessException;
import nc.vo.pubapp.pattern.exception.ExceptionUtils;
import nc.vo.sm.funcreg.FuncRegisterVO;
import nc.vo.zkch.utils.NullValueUtils;

public class HeadItemLinkListener implements BillItemHyperlinkListener{
	public ListView list;
	@Override
	public void hyperlink(BillItemHyperlinkEvent event) {
		//获取超链接的字段
		String key = NullValueUtils.getNullStringValue(event.getItem().getKey());
		//获取行号
		int row  = event.getRow();
		//获取到这一行对应的 
		ZchttzVO vo = (ZchttzVO) getList().getBillCardPanel().getBillModel().getBodyValueRowVOByVisualValue(row, ZchttzVO.class.getName());
		String htbh = vo.getHtbh();
		try {
			FuncletInitData data = new FuncletInitData();
			data.setInitType(100);
			FuncRegisterVO funvo = null;
			if (key.equals("nyfkmny")) {
				AggPaymentOrderVO[] queryData = PenetrateQuery.getInstances().getZchttzPaymentData(htbh);
				data.setInitData(queryData);
				funvo = WorkbenchEnvironment.getInstance().getFuncRegisterVO("H7H1H136");
			} else if(key.equals("htbh")){//add by hanh
				AggWzsbcghtVO[] queryData = PenetrateQuery.getInstances().getQueryWzsbcghtVOByHt(htbh);
				data.setInitData(queryData);
				funvo = WorkbenchEnvironment.getInstance().getFuncRegisterVO("H7H1H162");
			}
			//需要进入节点
			FuncletWindowLauncher.openFuncNodeInTabbedPane(getList().getBillCardPanel(), funvo, data, null, true);
		} catch (BusinessException e) {
			// TODO 自动生成的 catch 块
			ExceptionUtils.wrappBusinessException(e.getMessage());
		}
	}
	public ListView getList() {
		return list;
	}

	public void setList(ListView list) {
		this.list = list;
	}

}

3.给监听类注入到对应字段
ListView.java

package nc.ui.jych.zchttz.ace.view;


public class ListView extends nc.ui.pubapp.uif2app.view.ShowUpableBatchBillTable{
	private static final long serialVersionUID = 1L;
	
	@Override
	public void initUI() {
		
		super.initUI();		
		getBillCardPanel().setTatolRowShow(true);
		HeadItemLinkListener listener = new HeadItemLinkListener();
		listener.setList(this);
		getBillCardPanel().getBodyItem("nyfkmny").addBillItemHyperlinkListener(listener);
		getBillCardPanel().getBodyItem("htbh").addBillItemHyperlinkListener(listener);
	}

}

4.在public端的工具类util包下的PenetrateQuery.java类中增加根据合同编号查询物质设备采购合同的方法

	/**
	 * 根据合同编号查询物质设备采购合同对应的物质设备采购合同登记
	 * add by hanh
	 */
	public AggWzsbcghtVO[] getQueryWzsbcghtVOByHt(String htbh) throws BusinessException {
		// TODO 自动生成的方法存根
		SqlBuilder sql = new SqlBuilder();
		sql.append(" select pk_wzsbcght ");
		sql.append(" from jych_wzsbcght ");
		sql.append(" where nvl(dr, 0) = 0	");
		sql.append(" and htbh = '"+htbh+"'");
		List<String> list = (List<String>) getBs().executeQuery(sql.toString(), new ColumnListProcessor());
		if (list != null  && list.size() >0) {
			AbstractBill[] bills = getQueryService().queryAbstractBillsByPks(AggWzsbcghtVO.class, list.toArray(new String[0]));
			List<AggWzsbcghtVO> aggvolist = new ArrayList<AggWzsbcghtVO>();
			for (AbstractBill bill : bills) {
				AggWzsbcghtVO aggvo = (AggWzsbcghtVO) bill;
				aggvolist.add(aggvo);
			}
			return aggvolist.toArray(new AggWzsbcghtVO[0]);
		}
		return null;
	}

5.在要穿透的物质设备采购合同单据中增加监听类
WzsbcghtListener.java

package nc.ui.jych.wzsbcght.ace.listener;

import nc.funcnode.ui.FuncletInitData;
import nc.vo.jych.wzsbcght.AggWzsbcghtVO;

public class WzsbcghtListener extends nc.ui.pubapp.uif2app.model.DefaultFuncNodeInitDataListener {

	@Override
	public void initData(FuncletInitData data) {
		// TODO 自动生成的方法存根
		if (data != null && data.getInitType() == 100) {
			AggWzsbcghtVO[] aggvos =  (AggWzsbcghtVO[])data.getInitData();
			getModel().initModel(aggvos);

		} else {
			super.initData(data);
		}
	}
}

6.在要穿透的物质设备采购合同单据的xml中注入新增加的监听类

	
	<bean id="InitDataListener" class="nc.ui.jych.wzsbcght.ace.listener.WzsbcghtListener">
		<property name="model" ref="bmModel"/>
		<property name="context" ref="context">property>
		<property name="voClassName" value="nc.vo.jych.wzsbcght.AggWzsbcghtVO"/>
	bean>

2.销售合同台账合同号字段可以穿透到对应的单据上

一个合同号穿透到一个销售合同登记上(但考虑到这张单子有被金额穿透的情况,这种情况下点击该金额会有多个单子穿透到销售合同登记上,所以要和被按钮穿透的情况公用一个监听类,查到的数据就得用List去接收)

1.HeadItemlinkListener.java

package nc.ui.jych.xshttz.view;

import java.util.ArrayList;
import java.util.List;

import nc.bs.framework.common.NCLocator;
import nc.desktop.ui.WorkbenchEnvironment;
import nc.funcnode.ui.FuncletInitData;
import nc.funcnode.ui.FuncletWindowLauncher;
import nc.itf.jych.IXshttzMaintain;
import nc.ui.pub.bill.BillItemHyperlinkEvent;
import nc.ui.pub.bill.BillItemHyperlinkListener;
import nc.vo.jych.kpsq.AggKpsqVO;
import nc.vo.jych.receiptvoucher.AggReceiptVoucherVO;
import nc.vo.jych.utils.PenetrateQuery;
import nc.vo.jych.xshtdj.AggXshtdjVO;
import nc.vo.jych.xshttz.XshttzVO;
import nc.vo.pub.BusinessException;
import nc.vo.pubapp.pattern.exception.ExceptionUtils;
import nc.vo.sm.funcreg.FuncRegisterVO;
import nc.vo.zkch.utils.NullValueUtils;

/**
 * 字段超链接监听
 * @author zhangjk
 * @ddate 20023-09-11
 */
public class HeadItemlinkListener implements BillItemHyperlinkListener{

	public ListView list;
	
	@Override
	public void hyperlink(BillItemHyperlinkEvent event) {
		//获取超链接的字段
		String key = NullValueUtils.getNullStringValue(event.getItem().getKey());
		//获取行号
		int row  = event.getRow();
		//获取到这一行对应的 
		XshttzVO vo = (XshttzVO) getList().getBillCardPanel().getBillModel().getBodyValueRowVOByVisualValue(row, XshttzVO.class.getName());
		String pk_xshtdj = vo.getPk_xshtdj();
		String htbh = vo.getHtbh();
		try {
			FuncletInitData data = new FuncletInitData();
			data.setInitType(100);
			FuncRegisterVO funvo = null;
			if (key.equals("ykpje")) {
				AggKpsqVO[] queryData = PenetrateQuery.getInstances().getQueryKpsqVOByHt(pk_xshtdj);

				data.setInitData(queryData);
				funvo = WorkbenchEnvironment.getInstance().getFuncRegisterVO("H7H1H181");
			} else if (key.equals("yskje")) {
				AggReceiptVoucherVO[] queryData = PenetrateQuery.getInstances().getQueryReceiptByHt(pk_xshtdj);

				data.setInitData(queryData);
				funvo = WorkbenchEnvironment.getInstance().getFuncRegisterVO("H7H1H135");
			} else if(key.equals("htbh")){//add by hanh
				AggXshtdjVO[] queryData = PenetrateQuery.getInstances().getQueryXshtdjVOByHt(htbh);
				List<AggXshtdjVO> list = new ArrayList<AggXshtdjVO>();
				list.add(queryData[0]);
				data.setInitData(list);
				funvo = WorkbenchEnvironment.getInstance().getFuncRegisterVO("H7H1H168");
			}
			//需要进入节点
			FuncletWindowLauncher.openFuncNodeInTabbedPane(getList().getBillCardPanel(), funvo, data, null, true);
		} catch (BusinessException e) {
			ExceptionUtils.wrappBusinessException(e.getMessage());
		}
	}

	public ListView getList() {
		return list;
	}

	public void setList(ListView list) {
		this.list = list;
	}
	
	private IXshttzMaintain service;

	private IXshttzMaintain getService(){
		if(service == null){
			service = NCLocator.getInstance().lookup(IXshttzMaintain.class);
		}
		return service;
	}

}

2.XshtdjListener.java

package nc.ui.jych.xshtdj.ace.listener;

import java.util.List;

import nc.funcnode.ui.FuncletInitData;
import nc.vo.jych.xshtdj.AggXshtdjVO;

public class XshtdjListener extends nc.ui.pubapp.uif2app.model.DefaultFuncNodeInitDataListener {

	@Override
	public void initData(FuncletInitData data) {
		// TODO 自动生成的方法存根
		if (data != null && data.getInitType() == 100) {
			List<AggXshtdjVO> aggvolist =  (List<AggXshtdjVO>)data.getInitData();
			getModel().initModel(aggvolist.toArray(new AggXshtdjVO[0]));

		} else {
			super.initData(data);
		}
	}
}

你可能感兴趣的:(nc积累,java)