//B2rVuVju8JK/ylc+9sBV/OrDCj3zdEkZ6mQ5Wb+Qv25sz227Nq9pUNOGP0DoBpdy
package nc.bs.pub.action;

import java.util.Hashtable;

import nc.bs.framework.common.NCLocator;
import nc.bs.ic.m45.wgpt.rule.WuYeWgptWriteBackBS;
import nc.bs.pub.compiler.AbstractCompiler2;
import nc.vo.pub.BusinessException;
import nc.vo.pub.compiler.PfParameterVO;
import nc.vo.pub.lang.UFBoolean;
import nc.vo.pubapp.pattern.exception.ExceptionUtils;
import nccloud.pubitf.ic.inbound.service.IPurchaseInPushGenerateService;

/**
 * 备注：库存采购入库单的签字 单据动作执行中的动态执行类的动态执行类。 创建日期：(2010-3-31)
 *
 * @author 平台脚本生成
 */
public class N_45_SIGN extends AbstractCompiler2 {
  private java.util.Hashtable m_methodReturnHas = new java.util.Hashtable();

  private Hashtable m_keyHas = null;

  /**
   * N_45_SIGN 构造子注解。
   */
  public N_45_SIGN() {
    super();
  }

  /*
   * 备注：平台编写规则类 接口执行类
   */
  public Object runComClass(PfParameterVO vo) throws BusinessException {
    try {
      super.m_tmpVo = vo;
      nc.vo.ic.m45.entity.PurchaseInVO[] inVOs =
          (nc.vo.ic.m45.entity.PurchaseInVO[]) getVos();
      inVOs =
          nc.bs.framework.common.NCLocator.getInstance()
              .lookup(nc.itf.ic.m45.self.IPurchaseInMaintain.class).sign(inVOs);

    //add by 钟科阳 退库单签字后自动将正负数结算单进行结算 2020-11-3 begin
//	  M45AfterSignRule m45AfterSignRule = new M45AfterSignRule();
//	  m45AfterSignRule.process(inVOs);
	  //add by 钟科阳 退库单签字后自动将正负数结算单进行结算 2020-11-3 begin
	    
      //add by 周蓝萍 回写入库信息给网购平台 2020-10-21 begin
      WuYeWgptWriteBackBS wuYeWgptWriteBackBS = new WuYeWgptWriteBackBS();
		wuYeWgptWriteBackBS.process(inVOs);// 生成转固单后返回的VO里面的信息是空的，改成传原始VO
	  //add by 周蓝萍 回写入库信息给网购平台 2020-10-21 begin
	 //45-Cxx-001 固定资产采购交易类型
		String vtrantypecode = (String) inVOs[0].getParentVO().getAttributeValue("vtrantypecode");
		UFBoolean  freplenishflag =  (UFBoolean) inVOs[0].getParentVO().getAttributeValue("freplenishflag");
		//是否采购退库，为“是”则不能自动生成转固单
		if(null != vtrantypecode && "45-Cxx-001".equals(vtrantypecode)) {
//			NCLocator.getInstance().lookup(IPurchaseInMaintain.class).generateFixedAsset(inVOs);
			if(null != freplenishflag && !"Y".equals(freplenishflag+"")) {
			   NCLocator.getInstance().lookup(IPurchaseInPushGenerateService.class).generateHJ(inVOs[0]);
			}
		}
		 return inVOs;
		 
    }
    catch (Exception ex) {
      ExceptionUtils.marsh(ex);
    }
    return null;
  }

  /*
  * 备注：平台编写原始脚本
  */
  @Override
  public String getCodeRemark() {
    return nc.vo.ml.NCLangRes4VoTransl.getNCLangRes().getStrByID("4008002_0","04008002-0076")/*@res "不支持修改脚本"*/;
  }

  /*
   * 备注：设置脚本变量的HAS
   */
  private void setParameter(String key, Object val) {
    if (m_keyHas == null) {
      m_keyHas = new Hashtable();
    }
    if (val != null) {
      m_keyHas.put(key, val);
    }
  }
}
//B2rVuVju8JK/ylc+9sBV/OrDCj3zdEkZ6mQ5Wb+Qv25sz227Nq9pUNOGP0DoBpdy