|
发表于 2011-2-21 16:28:01
|
显示全部楼层
同上,调用销售单据也无法通过,为什么只有库存单据可以通过啊?请帮助回答,万分感谢!!!
完整代码如下:
'****************************************************************************************************************************************************************************
'*配置二次开发框架服务:
'* 必须安装并配置二次开发框架服务UFSoft.U8.Business.Interface.dll,Interop.MSXML2.dll,将UFSoft.U8.Business.Interface.config放置于以上两个文件的同一个文件夹;
'*注册销售二次开发动态库文件SAAPIConcrete.dll;
'*修改配置文件:
'* 将SAAPI.Config.860.xml文件拷贝到合适的位置(可以任意设置);
'* 修改配置文件UFSoft.U8.Business.Interface.config中Configuration\ APIRepository\ Product节点属性name的值为SCMSA对应节点的file属性的值与SAAPI.Config.860.xml存放路径对应。
'****************************************************************************************************************************************************************************
Private Sub Form_Load()
If Not g_oLogin Is Nothing Then Set g_oLogin = Nothing
If Not g_oConnection Is Nothing Then Set g_oConnection = Nothing
''++by mjh
txt_VoucherId.Text = "89"
txt_TimeStamp.Text = "0x00000000005353DF"
''++by mjh
End Sub
Private Sub cmd_Login_Click()
Dim loc_oNetLogin As Object
Dim bl_Success As Boolean
On Error GoTo ErrHandler
bl_Success = False
Set loc_oNetLogin = CreateObject("UFSoft.U8.Framework.Login.UI.clsLogin")
If loc_oNetLogin.login_2("DP") Then
loc_oNetLogin.SubLogin ("SA")
g_sUserToken = loc_oNetLogin.userToken
'创建旧Login
Set g_oLogin = New U8Login.clsLogin
Call g_oLogin.ConstructLogin(g_sUserToken)
g_oLogin.TaskId = loc_oNetLogin.gettaskid("SA")
g_sConnStr = g_oLogin.UfDbName
Set g_oConnection = New ADODB.Connection
g_oConnection.Open g_sConnStr
bl_Success = True
Else
MsgBox "登陆失败:" & g_oLogin.ShareString
End If
Me.cmd_LoadVoucher.Enabled = bl_Success
Exit Sub
ErrHandler:
MsgBox VBA.Err.Description
End Sub
'获取单据
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 = ""
Set o_adaptersvr = New BizAdapterService
Set o_api = o_adaptersvr.GetBizAPI("SCMSA/SA/Load", "860") ''"870") '为什么这个就不行呢?出现下面错误“对象变量或with块变量未设置”
If o_api Is Nothing Then
MsgBox "Get API SCMSA/SA/Load not Success!"
Exit Sub
End If
Call o_api.Parameters("VoucherType").setValue("01")
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
bl_Success = o_api.Execute(g_oLogin, g_oConnection, True)
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 |
|