BOS中获取编码规则
大家可以参考一下下面这段代码:
protected void setAutoNumberByOrg(String orgType) { if (editData == null ||getNumberCom()==null) return; if (editData.getNumber() == null) { try { String companyID = null; if(!com.kingdee.util.StringUtils.isEmpty(orgType) && !"NONE".equalsIgnoreCase(orgType) && com.kingdee.eas.common.client.SysContext.getSysContext().getCurrentOrgUnit(com.kingdee.eas.basedata.org.OrgType.getEnum(orgType))!=null) { companyID = com.kingdee.eas.common.client.SysContext.getSysContext().getCurrentOrgUnit(com.kingdee.eas.basedata.org.OrgType.getEnum(orgType)).getString("id"); } else if (com.kingdee.eas.common.client.SysContext.getSysContext().getCurrentOrgUnit() != null) { companyID = ((com.kingdee.eas.basedata.org.OrgUnitInfo)com.kingdee.eas.common.client.SysContext.getSysContext().getCurrentOrgUnit()).getString("id"); } com.kingdee.eas.base.codingrule.ICodingRuleManager iCodingRuleManager = com.kingdee.eas.base.codingrule.CodingRuleManagerFactory.getRemoteInstance(); if (iCodingRuleManager.isExist(editData, companyID)) { if (iCodingRuleManager.isAddView(editData, companyID)) { editData.setNumber(iCodingRuleManager.getNumber(editData,companyID)); } getNumberCom().setEnabled(false); } } catch (Exception e) { handUIException(e); this.oldData = editData; com.kingdee.eas.util.SysUtil.abort(); } } else { if (editData.getNumber().trim().length() > 0) { getNumberCom().setText(editData.getNumber()); } } }