K3 BOS应用开发百问百答(V1.0) 下载本文

K/3 BOS应用开发百问百答

Private Sub ShowBill(ByVal lClassTypeID As Long)

Dim oDataSrv As Object Dim oBill As Object

On Error GoTo err_ctr

Set oDataSrv = m_BillInterface.K3Lib.CreateK/3Object(\oDataSrv.ClassTypeID = lClassTypeID

Set oBill = CreateObject(\With oBill

.DataSrv = oDataSrv .ISNetControl = True .ISCheckRight = True .Show

'********************** '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

Exit Sub err_ctr:

Set oDataSrv = Nothing Set oBill = Nothing End Sub

【摘要】显示BOS序时簿并返回选中的值

版本:K/3BOS所有版本

问题描述:请问在插件中怎样显示BOS序时簿并返回选中的值?

【解答】

'********************************************

第12页

K/3 BOS应用开发百问百答

'功能:显示BOS序时簿并返回选中的值 '参数:lClassTypeID—显示BOS单据的ID '

'********************************************

Private Function ShowListByReturn(ByVal lClassTypeID As Long) As Object

Dim oDataSrv As Object Dim objLookup As Object

On Error GoTo err_ctr

Set oDataSrv = m_BillInterface.K3Lib.CreateK3Object(\oDataSrv.ClassTypeID = lClassTypeID If oDataSrv.showfilter Then

Set objLookup = CreateObject(\ objLookup.ClassTypeID = lClassTypeID Set objLookup.DataSrv = oDataSrv

objLookup.Lookup

Set ShowListByReturn = objLookup.VectReturn End If

Set oDataSrv = Nothing Set objLookup = Nothing

Exit Function err_ctr:

Set oDataSrv = Nothing Set objLookup = Nothing End Function

【摘要】将当前单据转化为另一单据,并无界面保存数据 版本:K/3BOS所有版本

问题描述:将当前单据转化为另一单据,并无界面保存数据

【解答】

'******************************************** '功能:将当前单据转化为另一单据,并无界面保存数据 '参数:lClassTypeID—显示BOS单据的ID

'********************************************

第13页

K/3 BOS应用开发百问百答

Private Sub NoUISaveBill(ByVal lClassTypeID As Long)

Dim oDataSrv As Object Dim oTableInfo As Object Dim oBill As Object Dim oData As Object Dim oSrv As Object Dim oPage2 As Object Dim i As Long

On Error GoTo err_ctr

Set oDataSrv = m_BillInterface.K3Lib.CreateK3Object(\oDataSrv.ClassTypeID = lClassTypeID Set oTableInfo = oDataSrv.TableInfo Set oData = oDataSrv.GetEmptyBill

For i = 1 To m_BillInterface.Data(\ Set oPage2 = oData(\

oData(\添加到 dcData

oData(\更改分录号 Next

For i = 1 To m_BillInterface.Data(\

oData(\

m_BillInterface.GetFieldValue(\

oData(\

m_BillInterface.GetFieldValue(\

oData(\

m_BillInterface.GetFieldValue(\

Next

Set oSrv = CreateObject(\

i = oSrv.Save(MMTS.PropsString, oDataSrv.ClassType, oDataSrv.ClassTypeEntry,

oDataSrv.TableInfo, oData, oDataSrv.dctLink) Set oDataSrv = Nothing Set oBill = Nothing

Exit Sub err_ctr:

MsgBox Err.Description

Set oDataSrv = Nothing Set oBill = Nothing End Sub 【备注】

第14页

K/3 BOS应用开发百问百答

1、K/3 BOS保存方法Save的参数描述:

'Public Function Save(ByVal sDsn As String, _

' ByVal dctClassType As KFO.Dictionary, _ ' ByVal vctClassTypeEntry As KFO.Vector, _ ' ByVal dctTableinfo As KFO.Dictionary, _ ' ByRef dctData As KFO.Dictionary, _ ' ByVal dctLinks As KFO.Dictionary) As Long '/********************************************************************/ '/*描述:单据保存 '/*参数:

'/*@ dctClassType KFO.Dictionary 单据整体信息模板 '/*@ dctData KFO.Dictionary 单据数据包

'/*@ dctLink KFO.Dictionary 选单关系模板,无选单为Nothing '/*@ dctTableInfo KFO.Dictionary 单据字段模板信息 '/*@ sDsn String K/3标准数据库连接串

'/*@ vctClassTypeEntry KFO.Vector 单据体模板信息 '/*备注:

'/********************************************************************/ 2、使用此方法时插件要添加MMTS。

【摘要】隐藏选单时序时簿不需的菜单和工具栏 版本:K/3BOS所有版本

问题描述:隐藏选单时序时簿不需的菜单和工具栏

【解答】

在MenuBarInitialize事件中使用m_ListInterface.List.ShowMode判断(查看和选单)1—查看;2—选单。

语法:If m_ListInterface.List.ShowMode = 1 Then ??end. 例:在选单时隐藏“编辑”菜单和工具栏 If m_ListInterface.List.ShowMode = 2 Then

Dim oTool As K/3ClassEvents.BOSTool Dim oBand As K/3ClassEvents.BOSBand

'*************** 开始设置 BOS 原有菜单 *************** '获得 mnuEdit 菜单对象,并设置属性 Set oBand = oMenuBar.BOSBands(\ Set oTool = oBand.BOSTools(\ With oTool

.Visible = False .Enabled = False End With End if

第15页