1. 程式人生 > >K3老單序時簿開發示例

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