package nccloud.web.hrwa.waruleex.action;

import nc.itf.hr.wa.IWaRuleExService;
import nc.vo.hrwa.waruleex.AggWageformExVO;
import nc.vo.hrwa.waruleex.WageformExVO;
import nc.vo.pub.BusinessException;
import nc.vo.pub.lang.UFBoolean;
import nc.vo.uif2.LoginContext;
import nccloud.framework.web.container.IRequest;
import nccloud.web.hr.pub.HRCommonAction;
import nccloud.web.hr.pub.HRNccUtils;
import nccloud.web.uapbd.commons.web.ParamUtils;
import nccloud.framework.service.ServiceLocator;
/**
 * 
 * 下午4:20:50
 * msw：
 * 薪资规则点增加按钮时进行校验,若校验通过，返回true,不通过，直接抛错
 *
 */
public class WaRuleExDeleteAction extends HRCommonAction {

	@Override
	public <T> Object execute(IRequest request, T para) throws Exception {
		ParamUtils param = new ParamUtils(request);
		LoginContext context = HRNccUtils.getLoginContext(param);
		String pkWaWageform = param.getString("pk_wa_wageformex", null);
		WaRuleExCommon common = new WaRuleExCommon();
		AggWageformExVO aggWageformVO = common.listHandleData(context, pkWaWageform);
		UFBoolean isenable = ((WageformExVO)aggWageformVO.getParentVO()).getIsenable();
		if(isenable != null && isenable.booleanValue()) {
			throw new BusinessException("该数据为启用状态，不允许删除！");
		}
		ServiceLocator.find(IWaRuleExService.class).deleteVO(aggWageformVO);
		return true;
	}
}
