EAS BOSコード取得符号化規則自動生成文書符号化

1144 ワード

// 
import com.kingdee.eas.basedata.org.OrgUnitInfo;
import com.kingdee.eas.common.EASBizException;
import com.kingdee.bos.BOSException;
import com.kingdee.eas.util.app.ContextUtil;
import com.kingdee.eas.framework.CoreBillBaseInfo;
import com.kingdee.bos.Context;
import com.kingdee.eas.base.codingrule.CodingRuleManagerFactory;
import com.kingdee.eas.base.codingrule.ICodingRuleManager;

 
// info
public static String getNewNumber(Context ctx,CoreBillBaseInfo info){
    String number = "";
    ICodingRuleManager iCodingRuleManager = null;
    OrgUnitInfo orgUnit = ContextUtil.getCurrentOrgUnit(ctx);
    if(orgUnit == null) return null;
    try {
        iCodingRuleManager = CodingRuleManagerFactory.getLocalInstance(ctx);
        if(iCodingRuleManager.isExist(info, orgUnit.getId().toString()))
            number = iCodingRuleManager.getNumber(info, orgUnit.getId().toString());
        else
            return null;
    } catch (EASBizException e) {
        e.printStackTrace();
    } catch (BOSException e) {
        e.printStackTrace();
    }

    return number;
}