@河南-凡尘 根据编码规则获取编码 ICodingRuleManager iCodingRuleManager = CodingRuleManagerFactory.getRemoteInstance();
String orgUnitID = SysContext.getSysContext().getCurrentCtrlUnit().getId().toString();
if (iCodingRuleManager.isExist(objectValue, orgUnitID)) {
if (iCodingRuleManager.isUseIntermitNumber(objectValue, orgUnitID)) {
//编码规则不允许断号 --> 获取断号编码
objectValue.setNumber(iCodingRuleManager.getNonbreakNumber(objectValue, orgUnitID));
} else {
objectValue.setNumber(iCodingRuleManager.getNumber(objectValue, orgUnitID));
}
}
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
单据编码字段不要设置成必录入。 规则勾选了不断号
删除的时候调用编码回收接口
@Override
protected void setAutoNumberByOrg(String orgType) {
if (editData == null) return;
editData.setCu1(SysContext.getSysContext().getCurrentCtrlUnit());
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));
}
txtNumber.setEnabled(false);
}
}
catch (Exception e) {
handUIException(e);
this.oldData = editData;
com.kingdee.eas.util.SysUtil.abort();
}
}
else {
if (editData.getNumber().trim().length() > 0) {
txtNumber.setText(editData.getNumber());
}
}
}