分录新增单据编号 点击单据编号打开单据原创
金蝶云社区-赞颂的选手H
赞颂的选手H
6人赞赏了该文章 1512次浏览 未经作者许可,禁止转载编辑于2022年11月11日 11:45:09

实现步骤

  1. 分录中新增文本字段 开启显示为超链

  2. 编写表单插件实现HyperLinkClickListener接口 重写hyperLinkClick方法

  3. 监听分录

  4. 在hyperLinkClick打开单据

代码

 

public class AdjustBillEditPlugin extends AbstractFormPlugin implements HyperLinkClickListener {

    public static final String BILL_ENTRY = "billentry";
    
    public static final String FHGK_CUSTOMER_ASK_RECORD = "fhgk_customeraskrecord";
    
    @Override
    public void registerListener(EventObject e) {
        super.registerListener(e);
        // 监听分录行
        EntryGrid entryGrid = this.getView().getControl(BILL_ENTRY);
        entryGrid.addHyperClickListener(this);
    }


    @Override
    public void hyperLinkClick(HyperLinkClickEvent hyperLinkClickEvent) {
        //  获取超链接点击的属性名
        String fieldName = hyperLinkClickEvent.getFieldName();
        //  获取点击分录行的下标
        int rowIndex = hyperLinkClickEvent.getRowIndex();
        if (StringUtils.containsIgnoreCase(fieldName,"fhgk_checkno")){
        
            // 获取超链接信息  单据编号
            Object checkNo = this.getModel().getValue(fieldName, rowIndex);
            // 查询单据详情 
            DynamicObject customerAskRecord = QueryUtil.loadSingle(FHGK_CUSTOMER_ASK_RECORD , 
            new QFilter("billno", QCP.equals, checkNo).toArray());
          
            BillShowParameter billShowParameter = new BillShowParameter();
            // 设置打开单据的标识
            billShowParameter.setFormId("fhgk_customeraskrecord");
            // 设置打开单据的id
            billShowParameter.setPkId(customerAskRecord.getPkValue());
            // 设置打开的样式
            billShowParameter.getOpenStyle().setShowType(ShowType.Modal);

            this.getView().showForm(billShowParameter);
        }
    }
}


 如文章对你有帮助,那么请点赞收藏吧!

赞 6