K/3 Wi 插件开发和配置
919 7
dldl
发表于 2016-12-20 10:57:17 BOS开发复制链接只看楼主查看全部
劳特夫开发环境:K/3 Wi 13.0、K/3 Bos开发平台、Visual Basic 6.0目录
一、二次开发插件编程
the carpenters>武汉少儿英语教育
byte二、代码演示人力资源资格证
三、配置插件
四、测试插件
五、插件事件附录
一、二次开发插件编程
打开Visual Basic 6.0,新建工程ActiveX DLL:
命名为FirstPlugin.class:
引用类库如下:
已安装K/3 Wi,在VB 6.0菜单栏上会多出一个金蝶开发插件:
打开金蝶开发向导,创建工业单据客户端插件(工业单据俗称“老单”):
点击“确定”,选择类“FirstPlugin”:
点击“下一步”,这里我们自定义一个菜单项“插件工具”:
点击“下一步”,选择事件“UrMenuClick”:
塞翁失马翻译
完成向导。
二、代码演示
代码编写如下:
on the way
'配置路径:供应链-外购入库单'函数功能:插件工具--根据“长、宽、厚”自动计算批号'定义插件对象接口. 必须具有的声明, 以此来获得事件Private WithEvents m_BillTransfer As K3BillTransfer.BillDim F55 As Long, F55Text As String '长Dim F56 As Long,
F56Text As String '宽Dim F57 As Long, F57Text As String '高Dim FDate As Long, FDateText As String '日期Dim FBatchNo As String '批号Dim FItemID As Long, FNumber As String '物料编码Dim FBatchManager As Boolean '是否采用业务批号管理Dim str As StringPublic Sub Show(ByVal oBillTransfer As Object) '接口实现 '注意: 此方法必须存在, 请勿修改 Set m_BillTransfer = oBillTransfer End SubPrivate Sub Class_Terminate() '释放接口对象 '注意: 此方法必须存在, 请勿修改 Set m_BillTransfer = NothingEnd SubPrivate Sub
m_BillTransfer_BillInitialize() '*************** 开始设置菜单
*************** m_BillTransfer.AddUrMenuItem "自动批号", "插件工具
" '*************** 结束设置菜单 *************** 'TODO: 请在此处添加代码响应事件 BillInitialize F55 = GetCtlIndexByFld("FEntrySelfA0155",
True) F56 = GetCtlIndexByFld("FEntrySelfA0156", True) F57 = GetCtlIndexByFld("FEntrySelfA0157", True) FBatchNo =
GetCtlIndexByFld("FBatchNo", True) FDate = GetCtlIndexByFld("FDate", Fal) FItemID = GetCtlIndexByFld("FItemID", True)
End SubPrivate Sub m_BillTransfer_UrMenuClick(ByVal Index As Long, ByVal Caption As String) 'TODO: 请在此处添加代码响应事件 UrMenuClick Select Ca Caption Ca "自动批号" '此处添加处理批号生成菜单对象的 Click 事
件 With m_BillTransfer For i = 1 To
teachers1000 If .GetGridText(i, FItemID) = "" Then Exit
For End If '从物料表检测是否采用业务批次管理 Dim strSQL As String '用于执行SQL Dim rs As
ADODB.Recordt FNumber = "" FNumber = .GetGridText(i, FItemID) strSQL = "" strSQL = "SELECT FBatchManager FROM t_ICItem WHERE FNumber='" & FNumber & "'" Set rs = SQLHelper.ExecuteSQL(strSQL, "") If rs.EOF = Fal
Then FBatchManager = rs.Fields("FBatchManager") End
If Set rs = Nothing F55Text = .GetGridText(i,
F55) F56Text = .GetGridText(i, F56) F57Text
= .GetGridText(i, F57) If F55Text = "" Then F55Text = "0" If F56Text = "" Then F56Text = "0" If F57Text = "" Then F57Text = "0" FDateText = Replace(.GetHeadText(FDate), "-", "") If (FBatchManager = True) Then .SetGridText i, FBatchNo, F55Text & "-" & F56Text & "-" & F57Text & "-" & FDateText End
If Next End With Ca El End SelectEnd
Sub'*****************************************'获取分录行数
'*****************************************Public Function GetEntryMax() As LongDim k As LongDim iFItemID As LongDim oEntryCtl As VariantDim maxrow As Long '最大行'For k = LBound(m_BillTransfer.EntryCtl) To UBound(m_BillTransfer.EntryCtl) If
UCa(m_BillTransfer.EntryCtl(k).FieldName) = UCa("FItemID") Then '物料代码所在列 iFItemID = k Exit For End IfNext koEntryCtl =
suppod
m_BillTransfer.EntryCtlmaxrow = UBound(oEntryCtl(iFItemID).DInterID) '获取表体