规则定义设置了适用条件,获取不到编码,如何处理原创
5人赞赏了该文章
872次浏览
编辑于2020年12月10日 19:54:55
使用适用条件,需要二次开发,调用带有适用属性参数的方法,如下所示:
/**output actionSave_actionPerformed*/ public void actionSave_actionPerformed(ActionEvent e) throws Exception { if (editData.getNumber() == null) { /**获取单据编码*/ String number = getAutoCode(null, editData,"isPay"); /**给控件设置编码*/ txtNumber.setText(number); } super.actionSave_actionPerformed(e); }
/** 获取编码规则(有适用条件)*/ public static String getAutoCode(Context ctx, IObjectValue objValue,String bindingproperty) throws EASBizException, BOSException { ICodingRuleManager codeRuleMgr = null; String companyId = null; if (ctx == null) { companyId = SysContext.getSysContext().getCurrentOrgUnit().getId().toString(); codeRuleMgr = CodingRuleManagerFactory.getRemoteInstance(); } else { companyId = com.kingdee.eas.base.permission.ContextUtils .getCurrentCompanyOrg(ctx); codeRuleMgr = CodingRuleManagerFactory.getLocalInstance(ctx); } CodingRuleInfo ruleInfo = codeRuleMgr.getCodingRule(objValue,companyId, bindingproperty); return codeRuleMgr.getNumber(objValue, ruleInfo); }
获取编码规则方法CodeUtil.zip(0.81KB)
推荐阅读