U8客开插件-一、标准单据标准按钮执行前验证操作

 

今天要做的就是在标准的单据的标准按钮之前进行验证操作,如果验证通过执行保存,如果不通过给予提示不进行保存。

下面拿销售出库单的保存按钮进行举例:

第一步:在程序中 ctrl+Shift  点击保存之后用写字板,粘贴  key

  取到 : 单据Key=0303、保存,按钮Tooltip:保存     F6,按钮Key:tlbSave;

第二步:VB工程及保存按钮前操作类

Public Function BeforeRunSysCommand(ByVal objLogin As Object, _
                                    ByVal objForm As Object, _
                                    ByVal objVoucher As Object, _
                                    ByVal sKey As String, _
                                    ByVal VarentValue As Variant, _
                                    ByRef Cancel As Boolean, _
                                    ByVal other As String)

这里可以写自己的判断逻辑,取值方法在最下面

End Function


'初始化
Public Function init(ByVal objLogin As Object, ByVal objForm As Object, ByVal objVoucher As Object, msbar As Object)


End Function

  注意:在方法中Cancel = true为取消当前操作,并不往后执行

第三步:注册插件C:\U8SOFT\KK\EFBASE\UI_UserConfig.xml

<dll>
<userdll>U8SO_SOMainSaveButton.BeforeSaveClass</userdll>
<function>
    <userfunction>BeforeRunSysCommand</userfunction>
</function>
</dll>

第四步:注册脚步:数据库UFMeta_999

delete from aa_customerbutton where cButtonID = '088EC6DB-2380-4457-93BF-C618BE4767EA'
go
insert into aa_customerbutton ([cButtonID],[cButtonKey],[cButtonType],[cProjectNO],[cFormKey],
[cVoucherKey],[cKeyBefore],[iOrder],[cGroup],[cCustomerObjectName],[cCaption],[cLocaleID],[cImage],
[cToolTip],[cHotKey],[bInneralCommand],[cVariant],[cVisibleAsKey],[cEnableAsKey])
values('{088EC6DB-2380-4457-93BF-C618BE4767EA}','btntest','system','U8SO_SOMainSaveButton','0303',
'0303','tlbSave','0','IEDIT','U8SO_SOMainSaveButton.BeforeSaveClass','销售出库单保存校验','zh-cn','','销售出库单保存校验',
'Ctrl+S',1,'销售出库单保存校验','tlbSave','tlbSave')
go

脚本说明:

cButtonID:可以是 newid()

cButtonKey:要唯一,有意义的名字

cButtonType:按钮类型 default\menu\system

cFormKey: 窗体名字,单据Key

cVoucherKey:单据Key

cKeyBefore: 要处理的按钮key

cGroup : 按钮所在组

cCustomerObjectName:工程名.类名EFInterface_demo.cls_aa_customerbutton。如果这个不对不会进入VB

cToolTip:提示

cVisibleAsKey:当前按钮与哪个按钮是否可见状态一样

cEnableAsKey:当前按钮与哪个按钮是否可用状态一样

cImage:按钮图标 credit   在 icons图片名

第五步:vb工程启动项选择 EnterprisePortal.exe

 

第六步:在VB一程打上断点,并生成dll文件到C:\U8SOFT\UAP下,运行VB工程进行调试,效果如下:

 

 

备注:记录一下相关脚本

  一、记录一下取值方式等

ls_dDate = objVoucher.headerText("dDate") 获取结算日期 //  dDate U8字段名

ls_iExchRate = objVoucher.headerText("iExchRate")’获取汇率
ls_iQuantity = objVoucher.bodyText(i,"iQuantity")'获取数量

  二、销售订单脚本注册如下:

delete from aa_customerbutton where cButtonID = '088EC6DB-2380-4457-93BF-C618BE4767EA'
go
insert into aa_customerbutton ([cButtonID],[cButtonKey],[cButtonType],[cProjectNO],[cFormKey],
[cVoucherKey],[cKeyBefore],[iOrder],[cGroup],[cCustomerObjectName],[cCaption],[cLocaleID],[cImage],
[cToolTip],[cHotKey],[bInneralCommand],[cVariant],[cVisibleAsKey],[cEnableAsKey])
values('{088EC6DB-2380-4457-93BF-C618BE4767EA}','btntest','system','U8SO_SOMainSaveButton','17',
'17','save','0','IEDIT','U8SO_SOMainSaveButton.BeforeSaveClass','销售订单保存校验','zh-cn','','销售订单保存校验',
'Ctrl+S',1,'销售订单保存校验','save','save')
go

 作者:王春天 地址:http://www.cnblogs.com/spring_wang/p/4017877.html

posted @ 2014-10-10 21:41  王春天  阅读(5576)  评论(9编辑  收藏  举报
云推荐