package nc.bs.arap.busireg;

import com.yonyou.cloud.iuap.iris.IrisNCLocator;

import nc.bs.businessevent.BdUpdateEvent;
import nc.bs.businessevent.BusinessEvent;
import nc.bs.businessevent.IBusinessEvent;
import nc.bs.businessevent.IBusinessListener;
import nc.bs.framework.common.NCLocator;
import nc.itf.uif.pub.IUifService;
import nc.pubitf.pu.m27.IInvoiceAutoMatch;
import nc.vo.arap.payable.AggPayableBillVO;
import nc.vo.arap.payable.PayableBillItemVO;
import nc.vo.ml.NCLangRes4VoTransl;
import nc.vo.pu.m25.entity.InvoiceHeaderVO;
import nc.vo.pu.m25.entity.InvoiceItemVO;
import nc.vo.pu.m25.entity.InvoiceSettleItemVO;
import nc.vo.pu.m25.entity.InvoiceVO;
import nc.vo.pub.AggregatedValueObject;
import nc.vo.pub.BusinessException;
import nc.vo.pub.BusinessRuntimeException;

/**
 * 采购应付单推式生成采购结算单
 * 
 * @author Administrator
 *
 */
public class PushToSettleBillListener implements IBusinessListener {

	@Override
	public void doAction(IBusinessEvent event) throws BusinessException {
		AggregatedValueObject[] obills = getBills(event);
		if (nccloud.commons.lang.ArrayUtils.isEmpty(obills)) {
			return;
		}
		
	}

	protected AggregatedValueObject[] getBills(IBusinessEvent event) {
		AggregatedValueObject[] bills = null;
		Object object = null;
		if ((event instanceof BusinessEvent)) {
			object = ((BusinessEvent) event).getObject();
		} else if ((event instanceof BdUpdateEvent)) {
			object = ((BdUpdateEvent) event).getNewObject();
		} else {
			throw new BusinessRuntimeException(
					NCLangRes4VoTransl.getNCLangRes().getStrByID("2006pub_0", "02006pub-0298") + event);
		}
		if (null != object) {

			if (object.getClass().isArray()) {
				bills = (AggregatedValueObject[]) object;
			} else {
				bills = new AggregatedValueObject[1];
				bills[0] = ((AggregatedValueObject) object);
			}
		}
		return bills;
	}
}
