BOS中工作流BOTP调用方法

下面是一段代码,主要是BOTP调用方法的使用,希望读者能看明白。

  public void actionCreateTo_actionPerformed(ActionEvent e)
    throws Exception
  {
    setCanVoucher(false);

    checkSelected();
    ArrayList idList = new ArrayList();
    List entriesKey = new ArrayList();
    getBillIdList(idList, entriesKey);
    String[] idArray = new String[idList.size()];
    idList.toArray(idArray);
    if (this.isDAPTrans)
    {
      entriesKey.clear();
    }
    this.billList.createTo(idArray, new String[] { getEntriesName() }, entriesKey, getBizType().toString(), getBOTPSelectors());
  }

public void getBillIdList(List idList, List entriesList)
   {
     int mode = 0;
     List blockList = this.tblMain.getSelectManager().getBlocks();
 
     if ((blockList != null) && (blockList.size() == 1))
     {
       mode = ((IBlock)this.tblMain.getSelectManager().getBlocks().get(0)).getMode();
     }
     if (mode == 8) {
       List selectIdList = getQueryPkList();
       if (selectIdList != null) {
         Iterator lt = selectIdList.iterator();
         while (lt.hasNext())
         {
           Object[] idObj = (Object[])lt.next();
           if (idObj == null)
             continue;
           if (!(idList.contains(idObj[0].toString()))) {
             idList.add(idObj[0].toString());
           }
 
           if ((idObj.length == 2) && (idObj[1] != null))
             entriesList.add(idObj[1]);
         }
       }
     }
     else
     {
       ArrayList blocks = this.tblMain.getSelectManager().getBlocks();
       Iterator iter = blocks.iterator();
 
       while (iter.hasNext())
       {
         KDTSelectBlock block = (KDTSelectBlock)iter.next();
         int top = block.getTop();
         int bottom = block.getBottom();
 
         for (int rowIndex = top; rowIndex <= bottom; ++rowIndex)
         {
           ICell cell = this.tblMain.getRow(rowIndex).getCell(getKeyFieldName());
 
           if ((this.tblMain.getRow(rowIndex).getCell(getEntriesPKName()) != null) && (this.tblMain.getRow(rowIndex).getCell(getEntriesPKName()).getValue() != null))
           {
             entriesList.add(this.tblMain.getRow(rowIndex).getCell(getEntriesPKName()).getValue().toString());
           }
 
           if (!(idList.contains(cell.getValue())))
             idList.add(cell.getValue());
         }
       }
     }
   }

public void createTo(String[] idList, String[] entryNames, List entriesKey, String srcBillType, SelectorItemCollection botpSelectors)
    throws Exception
  {
    if ((idList == null) || (idList.length == 0))
    {
      MsgBox.showWarning(this.billListUI, EASResource.getString("com.kingdee.eas.framework.FrameWorkResource.Msg_NoneSelect_Bill"));

      return;
    }

    Map uiContext = new HashMap();
    uiContext.put("Owner", this.billListUI);

    uiContext.put("idList", idList);
    uiContext.put("entryNames", entryNames);
    uiContext.put("entriesKey", entriesKey);
    uiContext.put("srcBillType", srcBillType);
    uiContext.put("botpSelectors", null);

    uiContext.put("SRCBILLLIST", this.billListUI);

    IUIFactory uiFactory = UIFactory.createUIFactory(UIFactoryName.MODEL);

    IUIWindow window = uiFactory.create("com.kingdee.eas.base.btp.client.BTPMakeBillUIWithoutGrp", uiContext, null);

    CtrlSwingUtilities.centerWindow((UIModelDialog)window);

    BTPMakeBillUIWithoutGrp uiWindow = (BTPMakeBillUIWithoutGrp)window.getUIObject();
    uiWindow.setBTPImplCaller(this);

    window.show();
    Logger.info("createTo finished!");
  }



posted @ 2012-05-01 21:48  范永强  阅读(495)  评论(0编辑  收藏  举报