通过K3BOS新单插件调用老单单据的插件代码能正确新增工业单据_第1页
通过K3BOS新单插件调用老单单据的插件代码能正确新增工业单据_第2页
通过K3BOS新单插件调用老单单据的插件代码能正确新增工业单据_第3页
免费预览已结束,剩余3页可下载查看

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、通过 K3 BOS 新单插件调用老单单据的插件代码能正确新增工业单据通过 K3 BOS 新单插件调用老单单据的插件代码能正 确新增工业单据,但如何在调用的时候往单据中符值呢?下面是新单插件调用老单单据的插件,你可以参照此方法, 在老单插件中调用。 Call mdlCallIndustryBill.CallBills(5, 1804, 1, 1)/ 单据调用 / 参数说明 nTranType :事务类型nInterID : 单据 ID nShowType :查看模式 (0:新建; 1:EDIT; 2:View) nBillType :单据调用模式 (0: 普通; 1:单据调单据 ) StateP

2、arm :其他参数,目前主要为 BOM 使用sNewBillType : nSaleMode :内销 or 外销Private m_BillInterface As BillEvent Public DeclareFunction 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, _O

3、ptional 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 BooleanDim objBill As ObjectDim nBillCls As Long 事务类别 ( ICTransactiontype.FType )On Error GoTo lError 得到单据事务

4、类型的 TypeIDIf nBillCls = 0 Then nBillCls = GetBillClsID(nTranType)If nBillCls = 0 ThenMsgBox 单据系统模板错误 GoTo lErrorEnd If 注意:此处参数有改动 If nBillType = 0 ThenSet objBill = CreateObject(K3Bills.Bills)ElseSet objBill = CreateObject(K3BillsEx.Bills)End If Dim dlg As ObjectSet dlg = CreateObject(CSystemDlg.Sys

5、)Dim LocalCnStr As StringDim sSubID As StringDim sSubName As StringDim lModel As LongDim 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) = Get

6、Conn End If If nInterID <> 0 Then .ListRecordset = SetBillRec(nInterID, nTranType) .ListRSFieldVect = SetBillVectEnd If If Len(sNewBillType) > 0 Then .NewBillTransType = sNewBillType Else.NewBillTransType = VBA.CStr(nTranType) End If .Show nBillCls, nShowType Add By ChenLianli 用

7、于判断是否单据改变了 bBillValueChaged = .BillValueChangedEnd With Set objReturn = objBill.BillReturnSet objBill = NothingCallBills = TrueExit FunctionlError: If Err.Number <> 0 Then MsgBox 据调用出现异常错误。 CallBills = FalseSet objBill = NothingEnd Function取工业单据类型 IDPrivate Function GetBillClsID(ByVal

8、lTranType As Long)As LongDim rs As ADODB.RecordsetDim objTemp As ObjectDim strSql As StringOn Error GoTo lErrorstrSql = select FType From ICTransactiontype where fid = & VBA.CStr(lTranType)Set rs = GetBillClsID = rs.Fields(FType).ValueSet rs = NothingSet objTemp = NothingExit FunctionlError:

9、Set rs = NothingSet objTemp = NothingGetBillClsID = 0End Function Private Function SetBillVect() As KFO.Vector Dim tVect As KFO.VectorSet tVect = New KFO.VectorDim tDict As KFO.Dictionary Set tDict = New KFO.Dictionary tDict(FColName) = FInterID tDict(FISPrimary) = 1 tVect.Add tDictSet tDict = New K

10、FO.Dictionary tDict(FColName) = FTranType tDict(FISPrimary) = 3 tVect.Add tDictSet tDict = NothingSet SetBillVect = tVectEnd Function 取当前数据库连接Public Function GetConn() As StringDim lProc As LonglProc = GetCurrentProcessId()Set spmMgr = CreateObject(PropsMgr.ShareProps) If IsObject(spmMgr.GetProperty

11、(lProc, PropsString) Then GetConn = spmMgr.GetProperty(lProc, PropsString) ElseGetConn = spmMgr.GetProperty(lProc, PropsString) End If Set spmMgr = NothingExit FunctionEnd Function / 设置选择单据信息 /Private Function SetBillRec(ByVal aInterID As Long, _ ByVal aTranType As Long) As ADODB.Recordset Dim tRec As ADODB.Recordset Set tRec = = aInterID tRec!FTran

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论