K3 老单序时簿增加按钮的方法以及老单序时簿插件开发

Posted liangyuwen

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了K3 老单序时簿增加按钮的方法以及老单序时簿插件开发相关的知识,希望对你有一定的参考价值。

可以参考以下脚本将按钮加外购入库单的序事簿上: 
/*------------------------------------- 
按钮NAME:外购入库单 
按钮ID:10002 
生产任务单ID:36 FmenuID=90 

--如在外购入库序时簿增加按钮,则找到外购入库的menuID 
select FID,FmenuID,* from iclisttemplate where Fname LIKE ‘%外购入库%‘ 
--(FID=1,FmenuID=82) 

*/------------------------------------- 

select * from t_MenuToolBar 

select * from ictransactiontype 

--增加元数据按钮 
Delete From t_MenuToolBar Where FToolID = 10002 
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 (10002,‘FMenuPC1‘,‘任务单ID‘,‘任务单ID‘,‘任务单ID‘,‘39‘,‘任务单ID‘,‘任务单ID‘,‘任务单ID‘,0,0,1,0,0,‘‘,‘‘,‘‘,0,0,0,‘任务单ID‘,‘任务单ID‘,‘任务单ID‘) 

--将上面的按钮插入到工具栏和菜单栏 
select * from t_BandToolMapping where fid=90 
Delete From t_BandToolMapping where FBandID=18 and FToolID = 10002 and FID = 82 
insert into t_BandToolMapping (FID,FBandID,FToolID,FSubBandID,FIndex,FComName,FBeginGroup) 
values (82,18,10002,0,65,‘|ICMOListBill.ListBill‘,0) 

Delete From t_BandToolMapping where FBandID=52 and FToolID = 10002 and FID = 82 
insert into t_BandToolMapping (FID,FBandID,FToolID,FSubBandID,FIndex,FComName,FBeginGroup) 
values (82,52,10002,0,65,‘|ICMOListBill.ListBill‘,0) 

--在外购入库序时薄显示按钮(如果里面有"|V",则只能在后面加菜单项) 
Update IclistTemplate 
set FLogicStr=FLogicStr+ Case When Right(FLogicStr,1)=‘|‘ then ‘V:FMenuPC1‘ else ‘|V:FMenuPC1‘ end 
where FID =1 and not FLogicStr like ‘%FMenuPC1%‘ 
然后创建DLL工程,工程名为ICMOListBill,类名为ListBill,在类ListBill添加如下代码: 
Private Declare Function GetCurrentProcessId Lib "kernel32" () As Long 

Public Sub MainFunction(ByVal sKey As String, oList As Object, ByRef bCancel As Boolean) 
Dim cnn As String 
Dim strSql As String 
Dim cn As ADODB.Connection 
Dim rs As ADODB.Recordset 

Dim oDataSrv As Object 
Dim oBill As Object 

If sKey = "FMenuPC1" Then 
‘得到连接串 
cnn = Left(GetConn, InStr(1, GetConn, "}") - 1) 
cnn = Mid(cnn, 16) 

Set cn = New ADODB.Connection 
With cn 
.ConnectionString = cnn 
.Open 
End With 


strSql = "select FSourceInterid from icstockbillentry where finterid=" & oList.ListSelectBillinfo(1)("FInterID") & " and fentryid=" & oList.ListSelectBillinfo(1)("FEntryid") 
Set rs = cn.Execute(strSql) 

If Not rs.EOF Then 
Set oDataSrv = CreateObject("K3ClassTpl.DataSrv") 
oDataSrv.ClassTypeID = 288888808 

Set oBill = CreateObject("K3SingleClassBill.ClassInfoManager") 
With oBill 
.DataSrv = oDataSrv 
.ISNetControl = True 
.ISCheckRight = True 
.Show rs("FSourceInterid"), , 0 
‘********************** 
‘Show 参数类型 
‘第一个参数 Optional ByVal lID As Long = 0 ;描述修改或查看的单据ID 
‘第二个参数 Optional ByVal bShowGroup As Boolean = False ;如是基础资料时,是否显示分组 
‘第三个参数 Optional ByVal BillStatus As Long = Enu_BillStatus_New ;显示方式 0-查看;1-新增;2-修改 
‘第四个参数 Optional ByVal dctData As KFO.Dictionary ‘单据初始值 
‘********************** 
End With 

Set oDataSrv = Nothing 
Set oBill = Nothing 

End If 

Set rs = Nothing 
Set cn = Nothing 


End If 
End Sub 

Private Function GetConn() As String 
Dim lProc As Long 
lProc = GetCurrentProcessId() 
Set spmMgr = CreateObject("PropsMgr.ShareProps") 

If IsObject(spmMgr.GetProperty(lProc, "PropsString")) Then 
GetConn = spmMgr.GetProperty(lProc, "PropsString") 
Else 
GetConn = spmMgr.GetProperty(lProc, "PropsString") 
End If 

Set spmMgr = Nothing 
Exit Function 
End Function 
 
 
收藏 打赏

以上是关于K3 老单序时簿增加按钮的方法以及老单序时簿插件开发的主要内容,如果未能解决你的问题,请参考以下文章

请教K3工业单据序时簿添加按钮时的问题

k3 wise 序时簿二次开发2

销售单怎么快速入金蝶软件里

k3BOS开发知识点

金蝶K3老单开发,如果获得当前登录人?

关于金蝶K3老单的二次开发