二开-给老单序时簿添加按钮
在【编辑】菜单的“复制全部单据(Y)”之下一次增加菜单【寄售对账】、【寄售反对账】和【寄售对账设置…】 在右键菜单中,在“复制全部单据(Y)”菜单之下一次增加右键菜单【寄售对账】和【寄售反对账】
首先添加2个按钮到t_MenuToolBar 中,自定义的FToolID 是10000(非必须),并且不能重复(必须)
Delete From t_MenuToolBar Where FToolID in( 11000,10009)
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 (11000,'FMenuCheckQP','寄售对账','寄售对账','寄售对账','','寄售对账','寄售对账','寄售对账',0,0,1,0,0,'','','',0,0,0,'寄售对账','寄售对账','寄售对账')
go
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 (10009,'FMenuUnCheckQP','寄售反对账','寄售反对账','寄售反对账','','寄售反对账','寄售反对账','寄售反对账',0,0,1,0,0,'','','',0,0,0,'寄售反对账','寄售反对账','寄售反对账')
go
FMenuCheckQP,FMenuUnCheckQP是2个按钮的Key;
再把按钮指定到的对应的序时簿上
--只在销售出库单序时薄显示按钮(如果里面有"|V",则只能在后面加菜单项)
Update IclistTemplate
set FLogicStr=FLogicStr+
Case When Right(FLogicStr,1)='|' then 'V:FMenuCheckQP,FMenuUnCheckQP'
else '|V:FMenuCheckQP,FMenuUnCheckQP'
end
where FID =8 and not FLogicStr like '%FMenuCheckQP,FMenuUnCheckQP%'
让FLogicStr包含|V:FMenuCheckQP,FMenuUnCheckQP的串;如果已经存在|V:xxxx,xx.就把
FMenuCheckQP,FMenuUnCheckQP放在xxxx,xx后面。要保证这个字符串里面最多只有一个|V:
select FMenuID,* from IclistTemplate where fname = '销售出库'
--FMenuID=82
--将上面的按钮插入到工具栏和菜单栏
--菜单栏,FID对应iclisttemplate里的FMenuID, FBandID表示放在哪个菜单下,可以通
过以下语句关联得到是哪个菜单
select a.*,b.fname,b.FCaption From
t_BandToolMapping a, t_MenuToolBar b where a.FID = 82 and a.ftoolid=b.ftoolid
order by a.FBandID,a.FIndex
Delete From t_BandToolMapping where FBandID=3 and FToolID in( 11000,10009) and FID = 82
insert into t_BandToolMapping (FID,FBandID,FToolID,FSubBandID,FIndex,FComName,FBeginGroup) values (82,3,11000,0,88,'|Project1.ListBill',0)
insert into t_BandToolMapping (FID,FBandID,FToolID,FSubBandID,FIndex,FComName,FBeginGroup) values (82,3,10009,0,89,'|Project1.ListBill',0)
--工具栏(根据需求看需不需要增加)
--Delete From t_BandToolMapping where FBandID=53 and FToolID in( 10009,10002) and FID = 82
--insert into t_BandToolMapping (FID,FBandID,FToolID,FSubBandID,FIndex,FComName,FBeginGroup) --values (82,53,11000,0,196,'|Project1.ListBill',0)
--insert into t_BandToolMapping (FID,FBandID,FToolID,FSubBandID,FIndex,FComName,FBeginGroup) --values (82,53,10009,0,197,'|Project1.ListBill',0)
Project1.ListBill就是点击这个按钮要调用的插件组件名和类名;开发可以自己定义名称;
创建
Project1
项目,
在
ListBill类
中添加代码
Public Sub MainFunction(ByVal sKey As String, oList As Object, ByRef bCancel As Boolean)
‘这个函数名、传参必须是这个,不要改;
Dim str As String
Dim o As KFO.Vector
Dim i As Long
Dim Dict As KFO.Dictionary
If sKey = "FMenuCheckQP" Then
oList.MultiSelect = 2
Set o = oList.GetSelected
For i = 1 To o.UBound
Set Dict = o(i) str = str & "," & Dict("FBillNo") & "FMenuCheckQP"
Next MsgBox str
End
If If sKey = "FMenuUnCheckQP" Then
oList.MultiSelect = 2
Set o = oList.GetSelected
For i = 1 To o.UBound
Set Dict = o(i) str = str & "," & Dict("FBillNo") & "FMenuUnCheckQP"
Next
MsgBox str
End If
Set o = Nothing
Set Dict = Nothing
End Sub
再序时簿插件中与数据库交互,用K3Connection.AppConnection类(调试时这个函数会报错,正式运行时不会,因为2开调试没有加载kdmain.exe主程序的代码,没有mmts.propstring这个东西)
Public Function ExecuteSqlWithRecordset(ByVal strSql As String) As Recordset Dim cn As Object
Dim Rs As ADODB.Recordset
On Error GoTo HErr
Set cn = CreateObject("K3Connection.AppConnection")
Set Rs = cn.Execute(strSql)
Set ExecuteSqlWithRecordset = Rs
Set cn = Nothing
Set Rs = Nothing
Exit Function
HErr:
Set cn = Nothing
Set Rs = Nothing
Err.Raise Err.Number, " K3QPConsOrderCheck.clsDataBase.ExecuteUpdateSql", Err.Description
End Function
完
二开-给老单序时簿添加按钮
本文2024-09-16 16:25:13发表“k3wise知识”栏目。
本文链接:https://wenku.my7c.com/article/kingdee-k3wise-9110.html