package nc.bs.pub.action;

import java.util.Hashtable;
import nc.bs.framework.common.NCLocator;
import nc.pubitf.para.ISysInitDAO;
import nc.vo.arap.pub.ArapConstant;
import nc.vo.arap.receivable.AggReceivableBillVO;
import nc.vo.fipub.exception.ExceptionHandler;
import nc.vo.pub.AggregatedValueObject;
import nc.vo.pub.BusinessException;
import nc.vo.pub.compiler.PfParameterVO;
import nccloud.pubitf.arap.arappub.IArapBillPubUtilService;

public class N_F0_DELETE extends N_F0_ACTION {
	private Hashtable<String, Object> m_keyHas = null;

	public Object runComClass(PfParameterVO paraVo) throws BusinessException {
		try {
			if (paraVo.m_preValueVos == null) {
				return null;
			} else {
				Object obj = null;
				super.m_tmpVo = paraVo;
				
				//add by djy 20220104对于碧优资同步过来的单不能直接删除
				ISysInitDAO InitDAO = NCLocator.getInstance().lookup(ISysInitDAO.class);
				String src_byz = InitDAO.getSysInitTempVO("src_byz").getDefaultvalue();
				AggregatedValueObject aggvo=this.getVo();
				if((aggvo instanceof AggReceivableBillVO) && src_byz.equals(aggvo.getParentVO().getAttributeValue("def56")))
					throw new BusinessException("ARC同步过来的单据不能删除！");
				
				String actionCode = ArapConstant.DELETE;
				((IArapBillPubUtilService) NCLocator.getInstance().lookup(IArapBillPubUtilService.class))
						.interceptorVaildator(paraVo.m_preValueVos, actionCode);
				this.setParameter("context", paraVo.m_preValueVos);
				obj = this.runClass("nc.bs.arap.actions.ReceivableDeleteBatchBSAction", "deleteVOs",
						"&context:nc.vo.pub.AggregatedValueObject[]", paraVo, this.m_keyHas);
				this.doCreditCheck();
				return obj;
			}
		} catch (Exception var4) {
			throw ExceptionHandler.handleException(this.getClass(), var4);
		}
	}

	public String getCodeRemark() {
		return " arap action script not allowed to modify ,all rights reserved!";
	}

	protected void setParameter(String key, Object val) {
		if (this.m_keyHas == null) {
			this.m_keyHas = new Hashtable();
		}

		if (val != null) {
			this.m_keyHas.put(key, val);
		}

	}
}