更新QBO项目单价

时间:2014-07-08 03:45:04

标签: c# quickbooks intuit-partner-platform quickbooks-online

我试图通过Intuit提供的c#SDK更新QBO上的Item。单位价格没有得到更新,即使我在请求中指定它。请求JSON是:

{
  "SalesTaxCodeRef": {
    "name": "Sales Tax",
    "value": "2"
  },
  "Id": "37",
  "Name": "Item XALEIVJSLZ",
  "Description": "Sales Description",
  "Active": true,
  "Taxable": true,
  "UnitPrice": 11,
  "RatePercent": 5,
  "Type": "Inventory",
  "IncomeAccountRef": {
    "name": "Sales",
    "value": "1"
  },
  "PurchaseDesc": "Purchase Description",
  "PurchaseCost": 17.8,
  "ExpenseAccountRef": {
    "name": "Purchases",
    "value": "55"
  },
  "AssetAccountRef": {
    "name": "Inventory Asset",
    "value": "58"
  },
  "SyncToken": "0",
  "sparse": true
}

并且响应JSON是

{
  "Item": {
    "Name": "Item XALEIVJSLZ",
    "Description": "Sales Description",
    "Active": true,
    "FullyQualifiedName": "Item XALEIVJSLZ",
    "Taxable": true,
    "UnitPrice": 5,
    "Type": "Service",
    "IncomeAccountRef": {
      "value": "1",
      "name": "Sales"
    },
    "PurchaseDesc": "Purchase Description",
    "PurchaseCost": 17.8,
    "ExpenseAccountRef": {
      "value": "55",
      "name": "Purchases"
    },
    "TrackQtyOnHand": false,
    "domain": "QBO",
    "sparse": false,
    "Id": "37",
    "SyncToken": "1",
    "MetaData": {
      "CreateTime": "2014-07-07T20:26:25-07:00",
      "LastUpdatedTime": "2014-07-07T20:26:35-07:00"
    }
  },
  "time": "2014-07-07T20:26:35.804-07:00"
}

1 个答案:

答案 0 :(得分:0)

不确定是什么问题。 我可以轻松更新单价 -

<Item xmlns="http://schema.intuit.com/finance/v3" sparse="false">
 <Id>6</Id>
  <SyncToken>0</SyncToken>
  <MetaData>
    <CreateTime>2014-07-07T23:52:51-07:00</CreateTime>
    <LastUpdatedTime>2014-07-07T23:52:52-07:00</LastUpdatedTime>
  </MetaData>
  <Name>invento1</Name>
  <Active>true</Active>
  <FullyQualifiedName>invento1</FullyQualifiedName>
  <Taxable>false</Taxable>
  <SalesTaxIncluded>false</SalesTaxIncluded>
  <UnitPrice>35</UnitPrice>
  <Type>Inventory</Type>
  <IncomeAccountRef name="Sales of Product Income">20</IncomeAccountRef>
  <PurchaseTaxIncluded>false</PurchaseTaxIncluded>
  <PurchaseCost>0</PurchaseCost>
  <ExpenseAccountRef name="Cost of Goods Sold">21</ExpenseAccountRef>
  <AssetAccountRef name="Inventory Asset">22</AssetAccountRef>
  <TrackQtyOnHand>true</TrackQtyOnHand>
  <QtyOnHand>44</QtyOnHand>
  <InvStartDate>2014-07-08</InvStartDate>
</Item>

响应 -

<IntuitResponse xmlns="http://schema.intuit.com/finance/v3" time="2014-07-07T23:55:11.473-07:00">
  <Item domain="QBO" sparse="false">
<Id>6</Id>
<SyncToken>1</SyncToken>
<MetaData>
  <CreateTime>2014-07-07T23:52:51-07:00</CreateTime>
  <LastUpdatedTime>2014-07-07T23:55:11-07:00</LastUpdatedTime>
</MetaData>
<Name>invento1</Name>
<Active>true</Active>
<FullyQualifiedName>invento1</FullyQualifiedName>
<Taxable>false</Taxable>
<SalesTaxIncluded>false</SalesTaxIncluded>
<UnitPrice>35</UnitPrice>
<Type>Inventory</Type>
<IncomeAccountRef name="Sales of Product Income">20</IncomeAccountRef>
<PurchaseTaxIncluded>false</PurchaseTaxIncluded>
<PurchaseCost>0</PurchaseCost>
<ExpenseAccountRef name="Cost of Goods Sold">21</ExpenseAccountRef>
<AssetAccountRef name="Inventory Asset">22</AssetAccountRef>
<TrackQtyOnHand>true</TrackQtyOnHand>
<QtyOnHand>44</QtyOnHand>
<InvStartDate>2014-07-08</InvStartDate>

我在您的请求中看到了很多问题。当没有指定TrackQtyOnHand,InvStartDate,QtyOnHand时,如何将类型设置为库存?

以下是创建库存商品的正确方法。  Item item1 = new Item();

                        item1.Name = "InventoryTest3" ;
                        item1.FullyQualifiedName = "InventoryTest3";
                        item1.Description = "Description";
                        item1.Active = true;
                        item1.ActiveSpecified = true;
                        item1.Taxable = true;
                        item1.TaxableSpecified = true;
                        item1.UnitPrice = 10.00m;
                        item1.Type = ItemTypeEnum.Inventory;
                        item1.IncomeAccountRef = new ReferenceType() { Value="63" };
                        item1.PurchaseCost = 24.00m;
                        item1.PurchaseCostSpecified = true;
                        item1.ExpenseAccountRef = new ReferenceType() { Value = "64" };
                        item1.AssetAccountRef = new ReferenceType() { Value = "65" };
                        item1.TrackQtyOnHand = true;
                        item1.TrackQtyOnHandSpecified = true;
                        item1.QtyOnHand = 90;
                        item1.QtyOnHandSpecified = true;
                        item1.InvStartDate = DateTime.Now.Date;
                        item1.InvStartDateSpecified = true;
                        Item itemAdded = commonServiceQBO.Add<Item>(item1);

创建正确的项目后,尝试对项目进行完整更新。 不支持稀疏更新 https://developer.intuit.com/docs/0025_quickbooksapi/0050_data_services/030_entity_services_reference/item