K3wise老单二次开发方法 下载本文

内容发布更新时间 : 2024/11/18 14:45:04星期一 下面是文章的全部内容请认真阅读。

'配置路径:供应链-外购入库单'函数功能:插件工具--根据“长、宽、厚”自动计算批号'定义插件对象接口. 必须具有的声明, 以此来获得事件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.AddUserMenuItem \自动批号\插件工具\结束设置菜单 *************** 'TODO: 请在此处添加代码响应事件 BillInitialize F55 = GetCtlIndexByFld(\True) F56 = GetCtlIndexByFld(\GetCtlIndexByFld(\

GetCtlIndexByFld(\False) FItemID = GetCtlIndexByFld(\

End SubPrivate Sub m_BillTransfer_UserMenuClick(ByVal Index As Long, ByVal Caption As String) 'TODO: 请在此处添加代码响应事件 UserMenuClick Select Case Caption Case \自动批号\此处添加处理 批号生成 菜单对象的 Click 事件 With m_BillTransfer For i = 1 To

1000 If .GetGridText(i, FItemID) = \

For End If '从物料表检测 是否采用业务批次管理 Dim strSQL As String '用于执行SQL Dim rs As

ADODB.Recordset FNumber = \FItemID) strSQL = \FROM t_ICItem WHERE FNumber='\SQLHelper.ExecuteSQL(strSQL, \

Then FBatchManager = rs.Fields(\If Set rs = Nothing F55Text = .GetGridText(i, F55) F56Text = .GetGridText(i, F56) F57Text

= .GetGridText(i, F57) If F55Text = \F56Text = \\(FBatchManager = True) Then .SetGridText i, FBatchNo, F55Text & \& F56Text & \

If Next End With Case Else 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

UCase(m_BillTransfer.EntryCtl(k).FieldName) = UCase(\物料代码所在列 iFItemID = k Exit For End IfNext koEntryCtl =

m_BillTransfer.EntryCtlmaxrow = UBound(oEntryCtl(iFItemID).DInterID) '获取表体

最大行GetEntryMax = maxrowEnd

Function'**********************************'返回单据字段顺序(isEntry True是表体)'**********************************Public Function

GetCtlIndexByFld(ByVal fldName As String, Optional ByVal isEntry As Boolean = False) As LongDim ctlIdx As LongDim i As IntegerDim isFind As BooleanDim

vValue As VariantfldName = UCase(fldName)isFind = FalseWith m_BillTransferIf isEntry Then For i = LBound(.EntryCtl) To UBound(.EntryCtl) If UCase(.EntryCtl(i).FieldName) = fldName Then ctlIdx

= .EntryCtl(i).FCtlOrder isFind = True Exit For End If Next iElse For i = LBound(.HeadCtl) To UBound(.HeadCtl) If UCase(.HeadCtl(i).FieldName) = fldName Then ctlIdx = .HeadCtl(i).FCtlIndex isFind = True Exit For End If Next iEnd IfEnd WithIf isFind = True ThenGetCtlIndexByFld = ctlIdxElseGetCtlIndexByFld = 0End IfEnd Function[url=]

[/url] 三、配置插件

在Visual Basic 6.0生成DLL:

启动K/3 Wise BOS开发平台,打开外购入库单,并进行插件配置:

点击“插件配置管理”,配置客户端插件:

点击“浏览”,找到插件并勾选: