和平时代的特种兵:通过K3 BOS 新单插件调用老单单据的插件代码能正确新增工业单据

来源:百度文库 编辑:偶看新闻 时间:2024/05/04 15:42:54

通过K3 BOS 新单插件调用老单单据的插件代码能正确新增工业单据,但如何在调用的时候往单据中符值呢?

 

下面是新单插件调用老单单据的插件,你可以参照此方法,在老单插件中调用。

'Call mdlCallIndustryBill.CallBills(5, 1804, 1, 1)
'////////////////////////////单据调用///////////////////////////////////////
'参数说明
' nTranType : 事务类型
' nInterID : 单据ID
' nShowType : 查看模式 (0:新建; 1:EDIT; 2:View)
' nBillType : 单据调用模式(0:普通; 1:单据调单据)
' StateParm : 其他参数,目前主要为BOM使用
' sNewBillType :
' nSaleMode : 内销 or 外销
Private m_BillInterface As BillEvent

Public Declare Function GetCurrentProcessId _
Lib "kernel32" () As Long

Public UserName As String

Public UserId As Long

Public Function CallBills(ByVal nTranType As Long, _
Optional ByVal nInterID As Long = 0, _
Optional ByVal nShowType As Long = 2, _
Optional ByVal nBillType As Long = 0, _
Optional StateParm As Object, _
Optional ByVal sNewBillType As String = "", _
Optional ByVal nSaleMode As Long = 0) As Boolean
Dim objBill As Object
Dim nBillCls As Long '事务类别 (ICTransactiontype.FType)
On Error GoTo lError

'得到单据事务类型的TypeID
If nBillCls = 0 Then nBillCls = GetBillClsID(nTranType)
If nBillCls = 0 Then
MsgBox "单据系统模板错误"
GoTo lError
End If

'-----------------注意:此处参数有改动--------------------'
If nBillType = 0 Then
Set objBill = CreateObject("K3Bills.Bills")
Else
Set objBill = CreateObject("K3BillsEx.Bills")
End If

'-------------------------------------------------------'
Dim dlg As Object
Set dlg = CreateObject("CSystemDlg.Sys")
Dim LocalCnStr As String
Dim sSubID As String
Dim sSubName As String
Dim lModel As Long
Dim lModelDetail As Long
LocalCnStr = dlg.LocalCnn
Set dlg = Nothing

With objBill
.LocalCnn = LocalCnStr
.SystemName = sSubName
.SetOpt UserId, UserName

If Not .SaveVect(1).Lookup("sDsn") Then
.SaveVect(1)("sDsn") = GetConn
End If

If nInterID <> 0 Then
.ListRecordset = SetBillRec(nInterID, nTranType)
.ListRSFieldVect = SetBillVect
End If

If Len(sNewBillType) > 0 Then
.NewBillTransType = sNewBillType
Else
.NewBillTransType = VBA.CStr(nTranType)
End If

.Show nBillCls, nShowType
' 'Add By ChenLianli 用于判断是否单据改变了
' bBillValueChaged = .BillValueChanged
End With

' Set objReturn = objBill.BillReturn
Set objBill = Nothing
CallBills = True
Exit Function
lError:

If Err.Number <> 0 Then MsgBox "单据调用出现异常错误。"
CallBills = False
Set objBill = Nothing
End Function
'取工业单据类型ID
Private Function GetBillClsID(ByVal lTranType As Long) As Long
Dim rs As ADODB.Recordset
Dim objTemp As Object
Dim strSql As String
On Error GoTo lError
strSql = "select FType From ICTransactiontype where fid = " & VBA.CStr(lTranType)
Set rs = m_BillInterface.K3Lib.GetData(strSql)
GetBillClsID = rs.Fields("FType").Value
Set rs = Nothing
Set objTemp = Nothing
Exit Function
lError:
Set rs = Nothing
Set objTemp = Nothing
GetBillClsID = 0
End Function

Private Function SetBillVect() As KFO.Vector
Dim tVect As KFO.Vector
Set tVect = New KFO.Vector
Dim tDict As KFO.Dictionary
Set tDict = New KFO.Dictionary
tDict("FColName") = "FInterID"
tDict("FISPrimary") = 1
tVect.Add tDict
Set tDict = New KFO.Dictionary
tDict("FColName") = "FTranType"
tDict("FISPrimary") = 3
tVect.Add tDict
Set tDict = Nothing
Set SetBillVect = tVect
End Function

'取当前数据库连接
Public 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

'//////////////////////////////设置选择单据信息//////////////////////////////////'
Private Function SetBillRec(ByVal aInterID As Long, _
ByVal aTranType As Long) As ADODB.Recordset
Dim tRec As ADODB.Recordset
Set tRec = New ADODB.Recordset
tRec.Fields.Append "FInterID", adInteger
tRec.Fields.Append "FTranType", adInteger
tRec.Open
tRec.AddNew
tRec!Finterid = aInterID
tRec!FTranType = aTranType
tRec.Update
Set SetBillRec = tRec
End Function

Public Property Set BillInterface(ByVal vNewValue As Variant)
Set m_BillInterface = vNewValue
End Property
 

 

出库单上的单据号是什么 跟单信用证项下单据的国际标准银行实务 请问单证的单据怎么才能学好? 单证和单据是什么啊 差旅费报销单记帐时凭证上的附单据张数是指报销单张数还是报销单后附的单据数 水单到底是证明我方已付款的证明,还是要求对方付款的单据?? 记账凭证的附单据张数包不包括填写的报销单? 求与跟单有关的英文单据样式,采纳后再追加奖赏分 谁知道新赛季国际米兰的大名单? 新业务员拉单? 外贸跟单员主要接触哪些单据? 做外贸单证 一些单据格式从哪下载? 什么是买断,押汇?交单一般要提供哪些单据? 单据的签发日期应符合逻辑性合国际惯例,通常发票提单保险单汇票报关单中哪些议付单据出单时间最早哪些最晚 在外贸单据方面,交单文件给客户吗?哪清关单据给海关吗? 进出口贸易中海运提单是物权凭证,那陆运,空运的的货运单据中的物权凭证叫什么单? 从拿着核销单等单据去退税到税款打到你自己公司的帐户一般需要多长时间?谢谢 求知 GA-6WFZL7 的说明书 和新的BOS 在插件过程中,单面板电阻的插件时间为多少,双面板又为多少 个人通过什么方法可以做国外的单? 有谁知道跟单员的考试通过率吗? 在哪儿下载老单的《续三侠剑》和《后续三侠剑》?? 新的英语四级考试是不是没有单选了? 哪里可以免费下载到人教版的新高中英语单词表?