我一直在为朋友制作应用程序,但最近被卡住了。出于某种原因,当我尝试测试“itemSubtotalAddRq”时,我收到以下错误:
请求[3]:ItemSubtotalAddRq ItemSubtotalAdd 姓名:缺少所需的fiels ItemSubtotalAdd结束
我不确定它是什么,但我知道它是ItemSubtotalAddRq行之一,或者我使用iItemSubtotalAdd错误。
public void SalesInfoAdd(IMsgSetRequest requestMsgSet)
{
ISalesReceiptAdd salesReceiptAddRq = requestMsgSet.AppendSalesReceiptAddRq();
//IItemSubtotalAdd itemSubtotalAddRq = requestMsgSet.AppendItemSubtotalAddRq();
salesReceiptAddNew = new List<ISalesReceiptLineAdd>();
salesReceiptAddRq.CustomerRef.FullName.SetValue(Form.phoneNumber.Text);
salesReceiptAddRq.IsPending.SetValue(true);
salesReceiptAddRq.IsTaxIncluded.SetValue(false);
salesReceiptAddRq.FOB.SetValue(Form.orderID.Text);
salesReceiptAddNew.Clear();
int cnt = 0;
//while (i < Form.productID.Count)
for (int j = 0; j < Form.productID.Count; j++)
{
salesReceiptAddNew.Add(salesReceiptAddRq.ORSalesReceiptLineAddList.Append().SalesReceiptLineAdd);
salesReceiptAddNew[j].ItemRef.FullName.SetValue(Form.productID[j].ToString());
salesReceiptAddNew[j].ORRatePriceLevel.Rate.SetValue(Convert.ToDouble(Form.pricesList.Items[j]));
salesReceiptAddNew[j].Quantity.SetValue(Form.QBqt[j]);
salesReceiptAddNew[j].Desc.SetValue(Form.productsList.Items[j].ToString().ToUpper() + " -" + " " +
Form.QBsku[j].ToString().ToUpper());
cnt = j;
}
if (Form.DiscountType.Text != "None" || Form.DiscountType.Text != " ")
{
if (Form.productID.Count >= 2)
{
cnt++;
salesReceiptAddNew.Add(salesReceiptAddRq.ORSalesReceiptLineAddList.Append().SalesReceiptLineAdd);
salesReceiptAddNew[cnt].ItemRef.FullName.SetValue("SUBTOTAL");
salesReceiptAddNew[cnt].ORRatePriceLevel.Rate.SetValue(Form.totalOfAllItems);
//itemSubtotalAddRq.Name.SetValue("SUBTOTAL");
//itemSubtotalAddRq.IsActive.SetValue(true);
}
else
itemSubtotalAddRq.IsActive.SetValue(false);
cnt++;
salesReceiptAddNew.Add(salesReceiptAddRq.ORSalesReceiptLineAddList.Append().SalesReceiptLineAdd);
salesReceiptAddNew[cnt].ItemRef.FullName.SetValue(Form.DiscountType.Text);
}
if(Form.freeShipping.Checked == false)
{
cnt++;
salesReceiptAddNew.Add(salesReceiptAddRq.ORSalesReceiptLineAddList.Append().SalesReceiptLineAdd);
salesReceiptAddNew[cnt].ItemRef.FullName.SetValue("SHIPPING");
salesReceiptAddNew[cnt].ORRatePriceLevel.Rate.SetValue(Convert.ToDouble(Form.shipping.Text));
}
IMsgSetResponse responseMsgSet = sessionManager.DoRequests(requestMsgSet);
}
这是我能想到的唯一解决方案,但它仍然不起作用。有什么想法吗?
答案 0 :(得分:-1)
我认为你指的是'Line'标签下的'ItemType'
<强> XML 强>
<Add RequestId="ca435123492c41b891f7841cf4d0e81d" xmlns="http://www.intuit.com/sb/cdm/v2">
<OfferingId>ipp</OfferingId>
<ExternalRealmId>65123456</ExternalRealmId>
<SalesReceipt>
<Header>
---
</Header>
<Line>
<Id idDomain="QB">66</Id>
<Desc>Description</Desc>
<ItemId idDomain="QB">4</ItemId>
<ItemName>Dusting</ItemName>
<ItemType>Subtotal</ItemType>
<UnitPrice>1231</UnitPrice>
</Line>
</SalesReceipt>
</Add>
使用Java,我编码是这样的。我想,.Net中也应该有类似的枚举/类。你能看看.Net docs
吗?链接 - http://developer-static.intuit.com/SDKDocs/QBV2Doc/IntuitDataServicesSDK/
您应使用“小计”代替“ SUBTOTAL ”。在服务背景中,允许的值为[装配,固定资产,组,库存,其他费用,付款,产品,服务,小计]。
您可以在ApiExplorer中尝试此用例。
链接 - https://developer.intuit.com/apiexplorer?apiname=V2QBD#SalesReceipt
Java代码
QBSalesReceipt entityPojo = QBObjectFactory.getQBObject(context, QBSalesReceipt.class);
SalesReceiptLine receiptLine = QBObjectFactory.getQBObject(context, SalesReceiptLine.class);
receiptLine.setItemType(ItemTypeEnum.SUBTOTAL);
ArrayList receiptLines = new ArrayList();
receiptLines.add(receiptLine);
entityPojo.setLine(receiptLines);
QBSalesReceiptService service = QBServiceFactory.getService(context, QBSalesReceiptService.class);
service.addSalesReceipt(context, entityPojo);
Plz让我知道它是怎么回事。
谢谢