// Decompiled by DJ v2.9.9.60 Copyright 2000 Atanas Neshkov  Date: 2004-08-10 09:02:57
// Home Page : http://members.fortunecity.com/neshkov/dj.html  - Check often for new version!
// Decompiler options: packimports(3) ansi 
// Source File Name:   N_F2_SAVE.java

package nc.bs.pub.action;

import java.util.Hashtable;

import nc.bs.arap.actions.N_BASE_ACTION;
import nc.bs.framework.common.InvocationInfoProxy;
import nc.bs.framework.common.NCLocator;
import nc.itf.arap.wyrecbill.IWYRecbillBalanceCheck;
import nc.itf.imag.lightbus.IImagPubService;
import nc.vo.arap.gathering.AggGatheringBillVO;
import nc.vo.arap.gathering.GatheringBillVO;
import nc.vo.arap.utils.ARAPModuleEnableUtil;
import nc.vo.fipub.exception.ExceptionHandler;
import nc.vo.pub.AggregatedValueObject;
import nc.vo.pub.compiler.PfParameterVO;
import nccloud.commons.lang.StringUtils;

/**
 * @author zhoushuo 修改类 提交
 */
public class N_F2_COMMIT extends N_BASE_ACTION {

	private Hashtable<String, Object> m_keyHas;

	public N_F2_COMMIT() {
		super();
		m_keyHas = null;
	}

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

	public Object runComClass(PfParameterVO pfparametervo) throws nc.vo.pub.BusinessException {
		try {
			super.m_tmpVo = pfparametervo;
			setParameter("context", pfparametervo.m_preValueVos);
			AggregatedValueObject aggVO = pfparametervo.m_preValueVo;
			GatheringBillVO parentVO = (GatheringBillVO) aggVO.getParentVO();
			if (ARAPModuleEnableUtil.isImagEnabled(InvocationInfoProxy.getInstance().getGroupId()))
				NCLocator.getInstance().lookup(IImagPubService.class).commitCheckWithImage(parentVO.getPk_tradetype(), parentVO.getPrimaryKey(), parentVO.getPk_org());
			Object obj = runClass("nc.bs.arap.actions.BillCommitBatchBSAction", "updateVOs", "&context:nc.vo.pub.AggregatedValueObject[]", pfparametervo, m_keyHas);
			//add by longht 2021-10-27 收款单内转提交时预占额度 start
			String tradetype = parentVO.getPk_tradetype();
			if("F2-Cxx-01".equals(tradetype)) {
				//wby 2021202 从63生成的收款单提交不预占额度
				String _63Billno = parentVO.getDef3();
				if(StringUtils.isEmpty(_63Billno) || _63Billno.indexOf("F4") < 0) {
					NCLocator.getInstance().lookup(IWYRecbillBalanceCheck.class).writeInnerAcc((AggGatheringBillVO) aggVO);
				}
			}
			//add by longht 2021-10-27 收款单内转提交时预占额度 end
			
			return obj;
		} catch (Exception exception) {
			throw ExceptionHandler.handleException(this.getClass(), exception);
		}
	}

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