package nc.bs.th.th_bonus.ace.bp;

import nc.bs.th.th_bonus.plugin.bpplugin.Th_bonusPluginPoint;
import nc.impl.pubapp.pattern.data.bill.template.InsertBPTemplate;
import nc.impl.pubapp.pattern.rule.IRule;
import nc.impl.pubapp.pattern.rule.processer.AroundProcesser;
import nc.vo.th.bonus.AggbonusVO;

/**
 * 标准单据新增BP
 */
public class AceTh_bonusInsertBP {

  public AggbonusVO[] insert(AggbonusVO[] bills) {

    InsertBPTemplate<AggbonusVO> bp =
        new InsertBPTemplate<AggbonusVO>(Th_bonusPluginPoint.INSERT);
    this.addBeforeRule(bp.getAroundProcesser());
    return bp.insert(bills);
  }
  /**
   * 新增前规则
   * 
   * @param processor
   */
  private void addBeforeRule(AroundProcesser<AggbonusVO> processer) {
   IRule<AggbonusVO> rule=null;
				  				   				     rule = new nc.bs.pubapp.pub.rule.FillInsertDataRule();
				   				   				    				   				   
				   				     processer.addBeforeRule(rule);
				   				   
  				   				     rule = new nc.bs.pubapp.pub.rule.CreateBillCodeRule();
				   				   				    				     ((nc.bs.pubapp.pub.rule.CreateBillCodeRule)rule).setCbilltype("THDJ");
				    				   				    				     ((nc.bs.pubapp.pub.rule.CreateBillCodeRule)rule).setCodeItem("code");
				    				   				    				     ((nc.bs.pubapp.pub.rule.CreateBillCodeRule)rule).setGroupItem("pk_group");
				    				   				    				     ((nc.bs.pubapp.pub.rule.CreateBillCodeRule)rule).setOrgItem("pk_org");
				    				   				   
				   				     processer.addBeforeRule(rule);
				   				   
  				   				     rule = new nc.bs.pubapp.pub.rule.FieldLengthCheckRule();
				   				   				    				   				   
				   				     processer.addBeforeRule(rule);
				   				   
    }
}
