QuickBooks更新项目数量不起作用
我正在尝试通过QuickBooks v3.0的IPP.NET SDK手动更新Item.qty。 我选择了 我跟踪此产品的现有数量 复选框,用于我要更新的产品。但我总是会出错: 详细信息=业务验证错误:已售出商品的库存成本 如果您要跟踪此项目的库存数量,则需要帐户 产品 如何更新现有数量? 我的代码:QuickBooks更新项目数量不起作用,quickbooks,updating,quickbooks-online,inventory,Quickbooks,Updating,Quickbooks Online,Inventory,我正在尝试通过QuickBooks v3.0的IPP.NET SDK手动更新Item.qty。 我选择了 我跟踪此产品的现有数量 复选框,用于我要更新的产品。但我总是会出错: 详细信息=业务验证错误:已售出商品的库存成本 如果您要跟踪此项目的库存数量,则需要帐户 产品 如何更新现有数量? 我的代码: 这个问题要求不高。为了避免此类错误,我在请求中添加了AccountRef。例如: var accReference = accounts["Cost of Goods Sold"];
这个问题要求不高。为了避免此类错误,我在请求中添加了AccountRef。例如:
var accReference = accounts["Cost of Goods Sold"];
var expenseAccountRef = new ReferenceType { type = accReference.AccountType.ToString(), name = accReference.Name, Value = accReference.Id };
foreach( var item in items )
{
batch.Add( new Item()
{
Name = item.Name,
Id = item.Id,
SyncToken = item.SyncToken,
QtyOnHand = item.QtyOnHand + 1,
QtyOnHandSpecified = true,
ExpenseAccountRef = expenseAccountRef,
}, item.Id, OperationEnum.update );
}
{
"BatchItemResponse" : [{
"Fault" : {
"Error" : [{
"Message" : "A business validation error has occurred while processing your request",
"Detail" : "Business Validation Error: An inventory cost-of-goods-sold account is required if you are tracking inventory quantities for this product.",
"code" : "6000",
"element" : ""
}
],
"type" : "ValidationFault"
},
"bId" : "20"
}, {
"Fault" : {
"Error" : [{
"Message" : "A business validation error has occurred while processing your request",
"Detail" : "Business Validation Error: An inventory cost-of-goods-sold account is required if you are tracking inventory quantities for this product.",
"code" : "6000",
"element" : ""
}
],
"type" : "ValidationFault"
},
"bId" : "23"
}, {
"Fault" : {
"Error" : [{
"Message" : "A business validation error has occurred while processing your request",
"Detail" : "Business Validation Error: An inventory cost-of-goods-sold account is required if you are tracking inventory quantities for this product.",
"code" : "6000",
"element" : ""
}
],
"type" : "ValidationFault"
},
"bId" : "21"
}, {
"Fault" : {
"Error" : [{
"Message" : "A business validation error has occurred while processing your request",
"Detail" : "Business Validation Error: An inventory cost-of-goods-sold account is required if you are tracking inventory quantities for this product.",
"code" : "6000",
"element" : ""
}
],
"type" : "ValidationFault"
},
"bId" : "22"
}
],
"time" : "2014-10-09T12:42:48.715-07:00"
}
var accReference = accounts["Cost of Goods Sold"];
var expenseAccountRef = new ReferenceType { type = accReference.AccountType.ToString(), name = accReference.Name, Value = accReference.Id };
foreach( var item in items )
{
batch.Add( new Item()
{
Name = item.Name,
Id = item.Id,
SyncToken = item.SyncToken,
QtyOnHand = item.QtyOnHand + 1,
QtyOnHandSpecified = true,
ExpenseAccountRef = expenseAccountRef,
}, item.Id, OperationEnum.update );
}