简体   繁体   English

在eConnect上创建商品时单价未更新

[英]Unit price is not updating while create items on eConnect

I was using eConnect to connect my .NET application to the Dynamics GP. 我使用eConnect将.NET应用程序连接到Dynamics GP。 This is my C# eConnect code to create/update an item on Dynamics GP. 这是我的C#eConnect代码,用于在Dynamics GP上创建/更新项目。

taUpdateCreateItemRcd GpLineItem = new taUpdateCreateItemRcd();
GpLineItem.ITEMNMBR = "iPartNumber";
GpLineItem.ITEMDESC = "iDescription";
GpLineItem.CURRCOST = 50.65;
GpLineItem.ITMCLSCD = "classID";
GpLineItem.ITEMTYPE = 1;
GpLineItem.Purchase_Tax_Options = 2;
GpLineItem.UOMSCHDL = "EACH";
GpLineItem.UpdateIfExists = 1;

IVItemMasterType ivMasterType = new IVItemMasterType();
ivMasterType.taUpdateCreateItemRcd = GpLineItem;

IVItemMasterType[] ivMasterTypeArray = { ivMasterType };
eConnectType eConnect = new eConnectType();
eConnect.IVItemMasterType = ivMasterTypeArray;

// Serialize the master vendor type in memory.
MemoryStream memoryStream = new MemoryStream();
XmlSerializer xmlSerializer = new XmlSerializer(eConnect.GetType());


// Serialize the eConnectType.
xmlSerializer.Serialize(memoryStream, eConnect);

// Reset the position of the memory stream to the start.              
memoryStream.Position = 0;

// Create an XmlDocument from the serialized eConnectType in memory.
XmlDocument xmlDocument = new XmlDocument();
xmlDocument.Load(memoryStream);
memoryStream.Close();

// Call eConnect to process the XmlDocument.
eConnectMethods.CreateEntity(connectionString, xmlDocument.OuterXml);

When I checked the xmlDocument, I have only these below fields. 当我检查xmlDocument时,只有以下这些字段。

<?xml version="1.0"?><eConnect xmlns:xsi="www.w3.org/.../XMLSchema-instance" xmlns:xsd="www.w3.org/.../XMLSchema">
<IVItemMasterType>
    <eConnectProcessInfo xsi:nil="true" />
    <taRequesterTrxDisabler_Items xsi:nil="true" />
    <taUpdateCreateItemRcd>
        <ITEMNMBR>iPartNumber</ITEMNMBR>
        <ITEMDESC>iDescription</ITEMDESC>
        <ITMCLSCD>RETAIL</ITMCLSCD>
        <UOMSCHDL>EACH</UOMSCHDL>
    </taUpdateCreateItemRcd>
    <taUpdateCreateItemCurrencyRcd_Items xsi:nil="true" />
    <taIVCreateItemPriceListLine_Items xsi:nil="true" />
    <taIVCreateItemPriceListHeader xsi:nil="true" />
    <taItemSite_Items xsi:nil="true" />
    <taCreateItemVendors_Items xsi:nil="true" />
    <taCreateKitItemRcd_Items xsi:nil="true" />
    <taCreateInternetAddresses_Items xsi:nil="true" />
</IVItemMasterType>
</eConnect>

I have no idea, what's wrong in my code. 我不知道,我的代码有什么问题。 Please help me in this. 请帮助我。 All your help is much appreciated. 非常感谢您的帮助。 Thanks. 谢谢。

I believe you have to add this line: GpLineItem.CURRCOSTSpecified = true; 我相信您必须添加以下行:GpLineItem.CURRCOSTSpecified = true;

With eConnect, you have to do this with a lot of values. 使用eConnect,您必须使用很多值来做到这一点。

Answered by Tim Wappat 蒂姆·瓦帕特(Tim Wappat)回答

You must "specify" that you are supplying some fields, current cost is one of those. 您必须“指定”您正在提供某些字段,当前成本就是其中之一。

See the class description in the eConnect Programmers Guide (search for CURRCOSTSpecified). 请参阅《 eConnect程序员指南》中的类描述(搜索CURRCOSTSpecified)。

I think it would be something like: 我认为应该是这样的:

GpLineItem.CURRCostSpecified = true;

as another line in your code where you are setting the class members of the taUpdateCreateItemRcd. 作为代码中设置taUpdateCreateItemRcd的类成员的另一行。

We've all done it at some time... 我们都已经完成了一段时间...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM