|
发表于 2011-2-21 11:21:12
|
显示全部楼层
感谢feng_941的热情回答,请看以下详细代码!
Set o_api = o_adaptersvr.GetBizAPI("SCMPU/PU/Load", "860") ''"870") '为什么这个就不行呢?出现下面错误“对象变量或with块变量未设置”,但Set o_api = o_adaptersvr.GetBizAPI("SCMST/ST/Load", "860") ''"870")完全没有问题,请朋友们帮助!
'获取单据
Private Sub cmd_LoadVoucher_Click()
Dim o_header As DOMDocument, o_body As DOMDocument, str_error As String
Dim o_api As BizAPI
Dim o_adaptersvr As BizAdapterService
Dim bl_Success As Boolean
txt_Header.Text = ""
txt_Body.Text = ""
Call StartProcessLog("New BizAdapterService")
Set o_adaptersvr = New BizAdapterService
Call EndProcessLog("New BizAdapterService")
Call StartProcessLog("GetBizAPI")
'***使用这段库存调用API的代码,可以通过!***
Set o_api = o_adaptersvr.GetBizAPI("SCMST/ST/Load", "860") ''"870")
txt_VoucherId.Text = "8005" '采购入库单CGRK11010035
txt_TimeStamp.Text = "0x00000000003A62D2"
'***使用这段库存调用API的代码,可以通过!***
'***使用这段采购调用API的代码,无法通过!***
'txt_VoucherId.Text = "89" '采购订单CGDD11010017
'txt_TimeStamp.Text = "0x00000000005353DF"
'Set o_api = o_adaptersvr.GetBizAPI("SCMPU/PU/Load", "860") ''"870") '为什么这个就不行呢?出现下面错误“对象变量或with块变量未设置”
'***使用这段采购调用API的代码,无法通过!***
Call EndProcessLog("GetBizAPI")
If o_api Is Nothing Then
MsgBox "Get API SCMST/ST/Load not Success!"
Exit Sub
End If
Call o_api.Parameters("VoucherType").setValue("01") 'select * from VouchType, cVouchType=01,采购入库单 | 不是取自该表,查API资源管理器服务接口定义,无法查到库存的相关参数,但采购、销售有!
If txt_VoucherId.Text <> "" Then
Call o_api.Parameters("Condition").setValue("id = " & txt_VoucherId.Text) '对象变量或with块变量未设置
Else
Call o_api.Parameters("GetBlank").setValue(True)
End If
Call StartProcessLog("Execute")
bl_Success = o_api.Execute(g_oLogin, g_oConnection, True)
Call EndProcessLog("Execute")
If bl_Success Then
Set o_header = o_api.Parameters("Header").getValue()
Set o_body = o_api.Parameters("Body").getValue()
txt_Header.Text = o_header.xml
txt_Body.Text = o_body.xml
Else
MsgBox o_api.Parameters("ErrMsg").getValue()
End If
End Sub |
|