K3老单序时簿开发示例

K3需要对老单进行二次开发,老单的二次开发比较麻烦,这里整理一下老单序时簿上添加按钮的二次开发示例。

--以下SQL脚本
--获取 MENU ID
select FID,FmenuID,FName from iclisttemplate where Fname LIKE '%生产领料%' --(FID=11,FmenuID=82)
--增加元数据按钮
select * from t_MenuToolBar order by FToolID
Delete From t_MenuToolBar Where FToolID = '10005'
insert into t_MenuToolBar (FToolID,FName,FCaption,FCaption_CHT,FCaption_EN,FImageName,FToolTip,FToolTip_CHT,FToolTip_EN,FControlType,FVisible,FEnable,FChecked,FShortCut,FCBList,FCBList_CHT,FCBList_EN,FCBStyle,FCBWidth,FIndex,FToolCaption,FToolCaption_CHT,FToolCaption_EN)
values (10005,'HMPrint','汇总打印','汇总打印','Print(HM)','6','汇总打印','汇总打印','Print(HM)',0,0,1,0,0,'','','',0,0,0,'汇总打印','汇总打印','Print(HM)')

--将上面的按钮插入到工具栏
select * from t_BandToolMapping where fid=82 and fbandid=53 order by findex
Delete From t_BandToolMapping where FToolID = 10005 and FID = 82
insert into t_BandToolMapping (FID,FBandID,FToolID,FSubBandID,FIndex,FComName,FBeginGroup)
values (82,53,10005,0,77,'|zh_ActiveX_XYL.List_iTool',1) --插件名称.类模块名称

--在[生产领料单]序时薄显示按钮(如果里面有"|V",则只能在后面加菜单项)
select * from IclistTemplate where FID =11
Update IclistTemplate
set FLogicStr=FLogicStr+ Case When Right(FLogicStr,1)='|' then 'V:HMPrint' else '|V:HMPrint' end
where FID =11 and FLogicStr not like '%HMPrint%'

--以下插件代码:
Public Sub MainFunction(ByVal sKey As String, oList As Object, ByRef bCancel As Boolean)
    Dim i As Long
    Dim FInterID As Long
    Dim FEntryID As Long

    If sKey = "HMPrint" Then
    oList.MultiSelect = 2
        For i = 1 To oList.ListSelectBillinfo.Size
        FInterID = oList.ListSelectBillinfo(i)("FInterID")
        FEntryID = oList.ListSelectBillinfo(i)("FEntryID")
    Next
    End If
end sub

猜你喜欢

转载自www.cnblogs.com/zfangfang/p/9982396.html