码迷,mamicode.com
首页 > 其他好文 > 详细

InvoiceCancelSendApAction

时间:2015-12-26 19:32:50      阅读:281      评论:0      收藏:0      [点我收藏+]

标签:

package nc.ui.pu.m25.action;

import java.awt.event.ActionEvent;

import nc.bs.framework.common.NCLocator;
import nc.itf.arap.payablebill.IPayablebillItf;
import nc.itf.scmpub.reference.uap.group.SysInitGroupQuery;
import nc.ui.pubapp.pub.common.context.PFlowContext;
import nc.ui.pubapp.uif2app.actions.pflow.ScriptPFlowAction;
import nc.ui.scmpub.action.SCMActionInitializer;
import nc.ui.uif2.UIState;
import nc.vo.ml.NCLangRes4VoTransl;
import nc.vo.pu.m25.entity.InvoiceVO;
import nc.vo.pu.m25.enumeration.InvoiceBillAction;
import nc.vo.pu.m25.env.InvoiceUIToBSEnv;
import nc.vo.pub.AggregatedValueObject;
import nc.vo.pub.lang.UFBoolean;
import nc.vo.pubapp.pattern.exception.ExceptionUtils;
import nc.vo.pubapp.pflow.PfUserObject;

import org.apache.commons.lang.ArrayUtils;

public class InvoiceCancelSendApAction
  extends ScriptPFlowAction
{
  private static final long serialVersionUID = 4553662148501234750L;
  
  public InvoiceCancelSendApAction()
  {
    SCMActionInitializer.initializeAction(this, "CancelToAP");
  }
  
  public void doAction(ActionEvent e)
    throws Exception
  {
    if (!SysInitGroupQuery.isAPEnabled()) {
      ExceptionUtils.wrappBusinessException(NCLangRes4VoTransl.getNCLangRes().getStrByID("4004050_0", "04004050-0001"));
    }
    super.doAction(e);
    
    //add by@陈志锋 2015-12-26 取消应付单时更新中间表状态字段   begin
    InvoiceVO vo = (InvoiceVO)getModel().getSelectedData();
    Object[] vos = getModel().getSelectedOperaDatas();
    IPayablebillItf itf = NCLocator.getInstance().lookup(IPayablebillItf.class);
    for (int i = 0; i < vos.length; i++) {
		InvoiceVO objVO = (InvoiceVO) vos[i];
		if(objVO != null){
			String pk = objVO.getParent().getPrimaryKey();
			itf.deteleInfoMiddle(pk);
		}
	}
    //add by@陈志锋  2015-12-26 取消应付单时更新中间表状态字段   end

  }
  
  protected void beforeCheck(Object vo)
  {
    super.beforeCheck(vo);
  }
  
  protected void fillUpContext(PFlowContext context)
  {
    super.fillUpContext(context);
    AggregatedValueObject[] vos = context.getBillVos();
    if (ArrayUtils.isEmpty(vos)) {
      return;
    }
    PfUserObject[] usrObjs = new PfUserObject[vos.length];
    PfUserObject usrObj = new PfUserObject();
    InvoiceUIToBSEnv env = new InvoiceUIToBSEnv();
    env.setTrigger(InvoiceBillAction.CANCELSENDAP);
    env.setBManual(UFBoolean.TRUE);
    usrObj.setUserObject(env);
    for (int i = 0; i < usrObjs.length; i++) {
      usrObjs[i] = usrObj;
    }
    context.setUserObjs(usrObjs);
  }
  
  protected boolean isActionEnable()
  {
    boolean isEnable = true;
    isEnable &= ((UIState.NOT_EDIT == getModel().getUiState()) && (null != getModel().getSelectedData()));
    if (isEnable)
    {
      InvoiceVO vo = (InvoiceVO)getModel().getSelectedData();
      Object[] vos = getModel().getSelectedOperaDatas();
      
      isEnable &= ((vo.getParentVO().getBapflag().booleanValue()) || ((null != vos) && (1 < vos.length)));
    }
    return isEnable;
  }
}

  

InvoiceCancelSendApAction

标签:

原文地址:http://www.cnblogs.com/zzzzw/p/5078685.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!