码迷,mamicode.com
首页 > 其他好文 > 详细

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

时间:2020-02-13 13:07:30      阅读:221      评论:0      收藏:0      [点我收藏+]

标签:clear   收藏   nothing   任务   pad   val   sch   一个   lib   

可以参考以下脚本将按钮加外购入库单的序事簿上: 
/*------------------------------------- 
按钮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 老单序时簿增加按钮的方法以及老单序时簿插件开发

标签:clear   收藏   nothing   任务   pad   val   sch   一个   lib   

原文地址:https://www.cnblogs.com/liangyuwen/p/12302984.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!