InventoryAdd不会添加到QB库存中

本文关键字:QB 添加 InventoryAdd | 更新日期: 2023-09-27 18:21:39

以前,我有这个程序在运行。然而,我不确定我是删除了什么,还是忘记添加了什么,但我越看越不对劲。

也许我只需要一双新的眼睛来看待它,但据我所知,这是100%正确的,断点告诉我一切都是正确的。

这并没有增加快速书籍的库存,我不知道为什么,这没有意义。

        public void ProductAdd(IMsgSetRequest requestMsgSet)
    {
        IItemInventoryAdd itemInventoryAddRq = requestMsgSet.AppendItemInventoryAddRq();
        #region ADD PRODUCT INFORMATION
        for (int i = 0; i <= this.Form.productsList.Items.Count - 1; i++)
        {
            itemInventoryAddRq.Name.SetValue(Form.productID[i].ToString());
            itemInventoryAddRq.SalesDesc.SetValue(Form.productsList.Items[i].ToString().ToUpper());
            itemInventoryAddRq.PurchaseDesc.SetValue(Form.productsList.Items[i].ToString().ToUpper());
            itemInventoryAddRq.SalesPrice.SetValue(Form.QBprice[i]);
            itemInventoryAddRq.AssetAccountRef.FullName.SetValue("Inventory Asset");
            itemInventoryAddRq.COGSAccountRef.FullName.SetValue("Cost of Goods Sold");
            itemInventoryAddRq.ManufacturerPartNumber.SetValue(Form.QBsku[i].ToString().ToUpper());
            IMsgSetResponse responseMsgSet = sessionManager.DoRequests(requestMsgSet);
        }
        #endregion
    }

InventoryAdd不会添加到QB库存中

当我的Append请求在循环之外时,我往往会得到奇怪的行为。尽管它每次都应该创建一个项目,但SessionManager.DoRequest似乎并不总是像现在这样工作

public void ProductAdd(IMsgSetRequest requestMsgSet)
{
    #region ADD PRODUCT INFORMATION
    for (int i = 0; i <= this.Form.productsList.Items.Count - 1; i++)
    {
        IItemInventoryAdd itemInventoryAddRq = requestMsgSet.AppendItemInventoryAddRq();
        itemInventoryAddRq.Name.SetValue(Form.productID[i].ToString());
        itemInventoryAddRq.SalesDesc.SetValue(Form.productsList.Items[i].ToString().ToUpper());
        itemInventoryAddRq.PurchaseDesc.SetValue(Form.productsList.Items[i].ToString().ToUpper());
        itemInventoryAddRq.SalesPrice.SetValue(Form.QBprice[i]);
        itemInventoryAddRq.AssetAccountRef.FullName.SetValue("Inventory Asset");
        itemInventoryAddRq.COGSAccountRef.FullName.SetValue("Cost of Goods Sold");
        itemInventoryAddRq.ManufacturerPartNumber.SetValue(Form.QBsku[i].ToString().ToUpper());
    }
    IMsgSetResponse responseMsgSet = sessionManager.DoRequests(requestMsgSet);
    #endregion
}