/**
* 获取编码规则
* IObjectValue 要获取编码规则的对象
* String
* */
public static String getAutoCode(IObjectValue objValue,String number) {
String NumberCode = "";
try {
CompanyOrgUnitInfo company = ContextHelperFactory.getRemoteInstance().getCurrentCompany();
if(company!=null){
String companyId = company.getId().toString();
ICodingRuleManager codeRuleMgr = null;
codeRuleMgr = CodingRuleManagerFactory.getRemoteInstance();
if (codeRuleMgr.isUseIntermitNumber(objValue, companyId)) {
NumberCode = codeRuleMgr.readNumber(objValue, companyId);
}else {
//根据对应单据的编码规则
NumberCode = codeRuleMgr.getNumber(objValue, codeRuleMgr.getCodingRuleByNumber(number));
}
}
} catch (EASBizException e) {
e.printStackTrace();
} catch (BOSException e) {
e.printStackTrace();
} catch (UuidException e) {
e.printStackTrace();
}
return NumberCode;
}