我正在通过网络服务创建一个新的销售订单。我将 ShipToAddress 属性设置为 BusinessAddress 类,其国家代码与账单地址所在的国家/地区不同。当我创建订单并将其发送给 GP 时,没有错误,GP 收到订单;但是,当我查看订单并查看船舶地址时,国家代码不是我设置的,而是似乎使用账单地址或主要地址国家代码。
SalesOrder salesOrder = new SalesOrder();
salesOrder.ShipToAddress = ConfigureDropShipAdress(shipToCustomer);
private BusinessAddress ConfigureDropShipAdress(Customer dropShipCustomer)
{
var dropShipAddr = dropShipCustomer.Addresses.Where(a => a.Key.Id == "SHIP").FirstOrDefault();
BusinessAddress busAddr = new BusinessAddress
{
ContactPerson = dropShipAddr.ContactPerson,
Name = dropShipAddr.Name,
Line1 = dropShipAddr.Line1,
Line2 = dropShipAddr.Line2,
Line3 = dropShipAddr.Line3,
City = dropShipAddr.City,
State = dropShipAddr.State,
PostalCode = dropShipAddr.PostalCode,
CountryRegion = dropShipAddr.CountryRegion, //This puts Unites States for our dropship customer
CountryRegionCodeKey = dropShipAddr.CountryRegionCodeKey, // the code is correct at this point, but the country code is wrong in GP client... It is the original address's Ccode
Phone1 = dropShipAddr.Phone1,
Phone2 = dropShipAddr.Phone2,
Phone3 = dropShipAddr.Phone3,
Fax = dropShipAddr.Fax,
ExtensionData = code.ExtensionData,
Extensions = code.Extensions
};
return busAddr;
}
我究竟做错了什么?如何让销售订单使用我设置的国家代码?