package nc.bs.arap.util;

import nc.util.mmf.framework.base.MMValueConvert;
import nc.vo.arap.receivable.AggReceivableBillVO;
import nc.vo.arap.receivable.ReceivableBillVO;
import nc.vo.pub.BusinessException;
import nc.vo.pubapp.pattern.exception.ExceptionUtils;

public class RecSAPBillOperCheck{
	public static void checkBill(String eventtype,AggReceivableBillVO billVO) throws BusinessException{
		/**
		 * eventype:
		 * 1019审核前
		 * 1005删除前
		 * 1003修改前
		 * 1021反审核前
		 */
		ReceivableBillVO headVo=billVO.getHeadVO();
		boolean issendsap=MMValueConvert.toUFBoolean(headVo.getDef7()).booleanValue();
		boolean issapconfirm=MMValueConvert.toUFBoolean(headVo.getDef8()).booleanValue();
		if("1019".equals(eventtype) && issendsap) {
			ExceptionUtils.wrappBusinessException("你好，单据点击【保存】后则会成功传SAP应付单，则不允许审核，待应付财务提交单据后则自动审批通过，不需人工点击【审批】 ！");
		}
		if("1005".equals(eventtype) && issendsap) {
			ExceptionUtils.wrappBusinessException("你好，单据点击【保存】后则成功传SAP应付单，不允许删除，若仅需暂存，请制单后点击【暂存】！");
		}
		if("1003".equals(eventtype) && issendsap) {
			ExceptionUtils.wrappBusinessException("你好，单据点击【保存】后则成功传SAP应付单，不允许修改，若仅需暂存，请制单后点击【暂存】！");
		}
		if("1021".equals(eventtype) && issapconfirm) {
			ExceptionUtils.wrappBusinessException("SAP系统已协同确认，不允许取消审批。");
		}
	}
}
