packagenc.ui.jych.ref;importnc.ui.bd.ref.AbstractRefModel;/*** @desc 凭证号参照* @author hanh**/publicclassVoucherRefModelextendsAbstractRefModel{@OverridepublicString[]getFieldCode(){// 参照数据的字段编码returnnewString[]{"num","pk_voucher"};}@OverridepublicString[]getFieldName(){// 参照数据的字段名称returnnewString[]{"凭证号","主键"};}@OverridepublicStringgetRefCodeField(){// TODO 自动生成的方法存根return"num";}@OverridepublicStringgetRefNameField(){// TODO 自动生成的方法存根return"num";}@OverridepublicStringgetOrderPart(){// TODO 自动生成的方法存根returnnull;}/*** 隐藏字段* * @return*/@OverridepublicString[]getHiddenFieldCode(){// TODO 自动生成方法存根returnnewString[]{"pk_voucher"};}@OverridepublicStringgetTableName(){// 参照数据的表名return"voucherref_view";}@OverridepublicStringgetPkFieldCode(){// 参照数据对应表的主键return"pk_voucher";}@OverridepublicStringgetRefTitle(){// TODO 自动生成的方法存根return"凭证号参照";}@OverridepublicintgetDefaultFieldCount(){// TODO 自动生成的方法存根returngetFieldCode().length -1;}@OverridepublicStringgetWherePart(){String wherePart =super.getWherePart();return wherePart;}@OverridepublicvoidsetWherePart(String newWherePart){super.setWherePart(newWherePart);}}
根据自定义参照的字段新建一个视图
CREATEVIEW voucherref_view AS(select vou.year||'-'||vou.period as period,
typ.name as name,
typ.shortname ||'-'|| vou.num as num,
vou.pk_voucher as pk_voucher,
vou.pk_accountingbook as pk_accountingbook
from gl_voucher vou
leftjoin bd_vouchertype typ
on typ.pk_vouchertype = vou.pk_vouchertype
where nvl(vou.discardflag,'N')!='Y'and nvl(vou.tempsaveflag,'N')!='Y')