Kingdee Cloud Sky Click the button to display the F7 list pop-up window, and get the data of the selected Bank of China

Clicking on the button needs to override the itemClick event, the ShowFormHelper.createShowListForm() method is required to pop up the F7 list, and the closedCallBack method is required to obtain the selected data

public class ShowListForm extends AbstractBillPlugIn {
    
    
    //工具栏
    private static final String KEY_TOOLBAR = "tbmain";
    //按钮
    private static final String KEY_GENERATE_REPORT = "Weighted";
    //单据标识
    private static final String KEY_FORMID = "formid";
    //单据体标识
    private static final String KEY_ENTRY_ID = "entryentity";
   
    @Override
    public void registerListener(EventObject e) {
    
    
    //注册监听
        this.addItemClickListeners(KEY_TOOLBAR);
        super.registerListener(e);
    }

    @Override
    public void itemClick(ItemClickEvent evt) {
    
    
        super.itemClick(evt);
        String itemKey = evt.getItemKey();
        if (KEY_GENERATE_REPORT.equals(itemKey)) {
    
    
            //第一个参数为列表的单据标识,第二个参数为是否支持多选
            //创建弹窗
            ListShowParameter showParameter = ShowFormHelper.createShowListForm(KEY_FORMID, true);
            DynamicObject dataModel = this.getModel().getDataEntity();
            String xcno = dataModel.getString("xcno");
            QFilter qFilter = new QFilter("xcno", QCP.like, xcno);
            qFilter.and(new QFilter("billstatus",QCP.equals,"C"));
            qFilter.and(new QFilter("billtypefield",QCP.equals,BILL_TYPE_COAL));
//设置列表的过滤条件
            showParameter.getListFilterParameter().setFilter(qFilter);
            showParameter.setCloseCallBack(new CloseCallBack(this, KEY_GENERATE_REPORT));
            //展示弹窗列表
            this.getView().showForm(showParameter);
        }
    }
    //获取选择的数据
    @Override
    public void closedCallBack(ClosedCallBackEvent e) {
    
    
        super.closedCallBack(e);
        //e.getReturnData 可以获取到所选数据
        if (e.getReturnData() != null && StringUtils.equals(KEY_GENERATE_REPORT, e.getActionId())) {
    
    
            ListSelectedRowCollection returnData = (ListSelectedRowCollection) e.getReturnData();
            //获取到所选数据的主键id集合
            Object[] primaryKeyValues = returnData.getPrimaryKeyValues();
            boolean isRegular = isRegularReport(primaryKeyValues);
            if(!isRegular){
    
    
                return;
            }
            //跟据主键id去查询对应的单据,然后进一步操作
            generateWeightedReport(primaryKeyValues);
        }
    }

Guess you like

Origin blog.csdn.net/Evain_Wang/article/details/112847175