对分录F7字段进行监听-GUI端代码

需求1:对单据中的分录中一个字段进行监听,当点击这个字段时进行校验判断其他字段是否为空。

需求2:对业务类别字段进行过滤。

需求3:  选择某个业务类别字段后,带出这个字段下所属的费用类型

需求2代码:

public void onLoad() throws Exception {

        super.onLoad();

        final KDTable shareEntry = (KDTable)DEPUtils.findComponetByName((Container)this, "shareEntry");

        final KDBizPromptBox operationType = (KDBizPromptBox)shareEntry.getColumn("operationType").getEditor().getComponent();

        final EntityViewInfo view = new EntityViewInfo();

        final FilterInfo filterInfo = new FilterInfo();

        filterInfo.getFilterItems().add(new FilterItemInfo("operationType.id", (Object)"select fid from T_BC_OperationType where fisenable ='1' and fcompanyid ='00000000-0000-0000-0000-000000000000CCE7AED4'", CompareType.INNER));

        view.setFilter(filterInfo);

        operationType.setEntityViewInfo(view);

        this.setEntryOrgPromptBox();

    }

需求3代码与需求1代码:

一、将事件写在initListener()方法里去调用,因为我这个是在点击字段的时候就要去判断,所以写在了editStarted方法里,如果是操作完字段后再执行逻辑,那就写在editStopped方法里

   protected void initListener() {

        super.initListener();

        final KDTable shareEntry = (KDTable)DEPUtils.findComponetByName((Container)this, "shareEntry");

        shareEntry.addKDTEditListener((KDTEditListener)new KDTEditAdapter() {

        

        public void editStarted(final KDTEditEvent e) {

                try {

                    PayRequestBillEditUICTEx.this.f7_editStarted(e, e.getRowIndex(), e.getColIndex());

                }

                catch (Exception exc) {

                    PayRequestBillEditUICTEx.this.handUIException((Throwable)exc);

                }

            }

        

            public void editStopped(final KDTEditEvent e) {

                try {

                    PayRequestBillEditUICTEx.this.f7_editStopped(e, e.getRowIndex(), e.getColIndex());

                }

                catch (Exception exc) {

                    PayRequestBillEditUICTEx.this.handUIException((Throwable)exc);

                }

            }

        });

        this.prmtPayment.addDataChangeListener((DataChangeListener)new DataChangeListener() {

            public void dataChanged(final DataChangeEvent paramDataChangeEvent) {

                PayRequestBillEditUICTEx.this.prmtPayment_daChanged(paramDataChangeEvent);

            }

        });

    }

二、逻辑内容写在f7_editStarted方法里

    protected void f7_editStarted(final KDTEditEvent e, final int rowIndex, final int colIndex) throws EASBizException, BOSException {

        final KDTable shareEntry = (KDTable)DEPUtils.findComponetByName((Container)this, "shareEntry");

        final KDBizPromptBox KDexpenseType = (KDBizPromptBox)shareEntry.getColumn("expenseType").getEditor().getComponent();

        if (colIndex == shareEntry.getColumnIndex("expenseType")) {

        try {

            Object operationType = shareEntry.getCell(rowIndex, "operationType").getValue();

            if(operationType == null || "".equals(operationType)){

               MsgBox.showInfo("请先选择业务类别!");

               e.setCancel(true);

              }else{

//filterInfo对expenseType费用类型进行过滤,过滤条件是根据业务类别

                  final OperationTypeInfo operationTypeInfo = (OperationTypeInfo)operationType;

              BOSUuid id = operationTypeInfo.getId();

              final EntityViewInfo view = new EntityViewInfo();

                  final FilterInfo filterInfo = new FilterInfo();

                  filterInfo.getFilterItems().add(new FilterItemInfo("operationType.id", "select fid from T_BC_OperationType where fid = '"+new ObjectUuidPK(id)+"'", CompareType.INNER));

                  view.setFilter(filterInfo);

                  KDexpenseType.setEntityViewInfo(view);

              }

    }

    catch (Exception exc) {

        PayRequestBillEditUICTEx.this.handUIException((Throwable)exc);

    }

        }

    }

 

 

 

 

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值