Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/xml/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
.net QuickBooks目录调整模块_.net_Xml_Vb.net_Quickbooks - Fatal编程技术网

.net QuickBooks目录调整模块

.net QuickBooks目录调整模块,.net,xml,vb.net,quickbooks,.net,Xml,Vb.net,Quickbooks,在QuickBooks QBFC SDK中,我需要向库存调整添加一行。但出于某种原因,它告诉我需要序列/批次参考 这是调整线的QBFC参考。它说ORTypeAdjustmentMod是必填字段,但我不使用序列号或批号。右边的“Y”表示必填字段 下面是同一请求的XML版本。在本例中,ORTypeAdjustmentMod是可选的 我不太清楚这些评论的意思,但这可能与ORTypeAdjustmentMod有关 有人在QuickBooks SDK中遇到过类似的情况吗 编辑 下面是与quickboo

在QuickBooks QBFC SDK中,我需要向库存调整添加一行。但出于某种原因,它告诉我需要序列/批次参考

这是调整线的QBFC参考。它说ORTypeAdjustmentMod是必填字段,但我不使用序列号或批号。右边的“Y”表示必填字段

下面是同一请求的XML版本。在本例中,ORTypeAdjustmentMod是可选的

我不太清楚这些评论的意思,但这可能与ORTypeAdjustmentMod有关

有人在QuickBooks SDK中遇到过类似的情况吗

编辑

下面是与quickbooks对话的代码调用。 整个类都有一个全局会话管理器,然后在SendMessage函数中发送消息。当批次/序列号未包含时,quickbooks的错误为“InventoryAdjustmentLineModList: 元素(0)-或类型调整Mod:缺少必填字段 库存调整LineModList结束 库存调整模块结束“

我注意到的另一个问题可能与序列号/批号有关,当您通过将TxnLineID设置为“-1”向现有库存调整中添加新行时,它会删除事务中的所有现有行,并添加新行。发生这种情况时,它会给出一条“OK”状态消息

Function AdjustInventory(itemid As String, adjustment As Single, account As String, _class As String, jobnumber As String, reference As String) As String
    Dim requestMsgSet As IMsgSetRequest
'Checks if previous inventory adjust exists and returns JArray of each line 
'of the transaction. No issue here.
    Dim lines As JArray = GetPreviousQuery(reference)

    requestMsgSet = sessionManager.CreateMsgSetRequest("US", 13, 0)
    requestMsgSet.Attributes.OnError = ENRqOnError.roeContinue
    Dim responseMsgSet As IMsgSetResponse
    Dim exists As Boolean = lines(0)("exists")

'if a previoius adjustment doesnt exist, make a new one.
    If Not exists Then
        Dim InventoryAdjustmentAddRq As IInventoryAdjustmentAdd
        InventoryAdjustmentAddRq = requestMsgSet.AppendInventoryAdjustmentAddRq()
        InventoryAdjustmentAddRq.AccountRef.FullName.SetValue(account)
        InventoryAdjustmentAddRq.ClassRef.FullName.SetValue(_class)
        InventoryAdjustmentAddRq.RefNumber.SetValue(reference)
        If jobnumber IsNot Nothing Then
            InventoryAdjustmentAddRq.CustomerRef.FullName.SetValue(jobnumber)
        End If
        Dim InventoryAdjustmentLineAdd91 As IInventoryAdjustmentLineAdd
            InventoryAdjustmentLineAdd91 = InventoryAdjustmentAddRq.InventoryAdjustmentLineAddList.Append()
            InventoryAdjustmentLineAdd91.ItemRef.ListID.SetValue(itemid)
            InventoryAdjustmentLineAdd91.ORTypeAdjustment.QuantityAdjustment.ORQuantityAdjustment.QuantityDifference.SetValue(adjustment)

            responseMsgSet = Me.SendMessage(requestMsgSet)
        Else
            Dim InventoryAdjustmentModRq As IInventoryAdjustmentMod
        InventoryAdjustmentModRq = requestMsgSet.AppendInventoryAdjustmentModRq()
        'InventoryAdjustmentModRq.RefNumber.SetValue(reference)
        InventoryAdjustmentModRq.TxnID.SetValue(lines(0)("transactionid"))
        InventoryAdjustmentModRq.EditSequence.SetValue(lines(0)("editsequence"))

        Dim isitemnew As Boolean = True

'loops through all items in adjustment to see if the current item matches.
        For Each line As JObject In lines
            If line("listid") = itemid Then
                Dim prevquan As Single
                prevquan = line("quantitydifference")
                Dim newval As Single = prevquan + adjustment

                Dim InventoryAdjustmentLineMod116 As IInventoryAdjustmentLineMod
                InventoryAdjustmentLineMod116 = InventoryAdjustmentModRq.InventoryAdjustmentLineModList.Append()
                InventoryAdjustmentLineMod116.ItemRef.ListID.SetValue(itemid)

                InventoryAdjustmentLineMod116.QuantityDifference.SetValue(newval)
                InventoryAdjustmentLineMod116.TxnLineID.SetValue(lines(0)("linetxnid"))
                InventoryAdjustmentLineMod116.ORTypeAdjustmentMod.LotAdjustment.CountAdjustment.SetValue(newval)
                isitemnew = False
            End If

        Next

'If item is new, append it to the inventory adjustment.
        If isitemnew Then
            Dim invadjustlineadd As IInventoryAdjustmentLineMod
            invadjustlineadd = InventoryAdjustmentModRq.InventoryAdjustmentLineModList.Append()
'Heres where the erasing issue arises'
'the transaction doesnt get replaced when the TxnLineID is actually matches 
'an existing TxnLineID, it only happens when trying to add a new one.
            invadjustlineadd.TxnLineID.SetValue("-1")
            invadjustlineadd.ItemRef.ListID.SetValue(itemid)

            invadjustlineadd.QuantityDifference.SetValue(adjustment)

            invadjustlineadd.ORTypeAdjustmentMod.LotAdjustment.CountAdjustment.SetValue(adjustment)
            Debug.WriteLine(invadjustlineadd.TxnLineID.GetValue.ToString)
        End If
        responseMsgSet = Me.SendMessage(requestMsgSet)
    End If








    Dim res As Object = responseMsgSet.ResponseList.GetAt(0)
    Dim code As String = res.StatusCode
    Dim mes As String = res.StatusMessage
    Dim sev As String = res.StatusSeverity
    Dim jres As Object
    jres = New With {Key .status = sev, Key .code = code, Key .detail = mes}
    Dim output As String = JsonConvert.SerializeObject(jres)
    Return output



End Function

Function SendMessage(requestMsgSet As IMsgSetRequest) As IMsgSetResponse

    Dim responseMsgSet As IMsgSetResponse

    'Send the request and get the response from QuickBooks

    responseMsgSet = sessionManager.DoRequests(requestMsgSet)

    'End the session and close the connection to QuickBooks

    Return responseMsgSet
End Function

您确定QuickBooks文件没有打开序列号/批号吗?我在示例QuickBooks文件中进行了测试,能够在不指定序列号/批号的情况下创建库存数量调整。我的代码是C#(我硬编码了值):`QBSessionManager SessionManager=newQBSessionManager(); OpenConnection2(“StackOverflow”,“StackOverflow”,ENConnectionType.ctLocalQBD); SessionManager.BeginSession(“,ENOpenMode.omDontCare)


根据QBSDK程序员指南,对于修改事务时缺少的行,即使您没有进行更改,也需要包含这些行。但是,不需要为未更改的行指定所有字段。只需包含一个LineMod,其中包含该行的TxnLineID,它将被保留。您可以在第127-131页的QBSDK程序员指南中获得更多详细信息和代码示例。

您的代码看起来像什么?您发送的XML请求是什么样子的?没有这些信息,我们无法帮助你。@KeithPalmerJr。我的问题是SDK,不一定是我的代码。XMLSDK说它们是可选的,而.NETSDK说它们是必需的。您得到的实际错误消息是什么?你的代码是什么样子的?@KeithPalmerJr。我更新了我的问题以包括所有这些。如果你不介意看一下的话。谢谢。问题不是将以前的行添加回新的事务模块。我在午餐时想到了这个问题,却忘了我已经把问题发出去了。谢谢
        IMsgSetRequest MsgRequest = SessionManager.CreateMsgSetRequest("US", 13, 0);
        IInventoryAdjustmentAdd iAdd = MsgRequest.AppendInventoryAdjustmentAddRq();
        iAdd.AccountRef.FullName.SetValue("Advertising Expense");
        iAdd.RefNumber.SetValue("12345");
        iAdd.TxnDate.SetValue(DateTime.Today);

        IInventoryAdjustmentLineAdd iLine = iAdd.InventoryAdjustmentLineAddList.Append();
        iLine.ItemRef.FullName.SetValue("Indoor Electrical Wire");
        iLine.ORTypeAdjustment.QuantityAdjustment.ORQuantityAdjustment.QuantityDifference.SetValue(10);

        IResponse Response = SessionManager.DoRequests(MsgRequest).ResponseList.GetAt(0); `