У меня есть требование получить информацию ДОСТАВКИ из заказа на продажу.
Ниже мой код для получения информации о заказе на продажу
SearchPreferences searchPreferences = new SearchPreferences();
searchPreferences.bodyFieldsOnly = false;
Service.searchPreferences = searchPreferences;
SearchResult result = Service.search(new TransactionSearch()
{
basic = new TransactionSearchBasic()
{
type = new SearchEnumMultiSelectField()
{
@operator = SearchEnumMultiSelectFieldOperator.anyOf,
operatorSpecified = true,
searchValue = new string[] { "_salesOrder" }
},
tranId = new SearchStringField()
{
@operator = SearchStringFieldOperator.@is,
operatorSpecified = true,
searchValue = "SO-421832"
}
}
});
if (result.status.isSuccess && result.totalRecords == 1)
{
SalesOrder salesOrder = (SalesOrder)result.recordList[0];
Console.WriteLine("Contact - " + salesOrder.shippingAddress.addressee);
Console.WriteLine("Address 1 - " + salesOrder.shippingAddress.addr1);
Console.WriteLine("Address 2 - " + salesOrder.shippingAddress.addr2);
Console.WriteLine("Address 3 - " + salesOrder.shippingAddress.addr3);
Console.WriteLine("City - " + salesOrder.shippingAddress.city);
Console.WriteLine("State - " + salesOrder.shippingAddress.state);
Console.WriteLine("Zip - " + salesOrder.shippingAddress.zip);
Console.WriteLine("Country - " + salesOrder.shippingAddress.country);
Console.WriteLine("Shipping Method - " + salesOrder.shipMethod.name);
SalesOrderItemList salesOrderItemList = salesOrder.itemList;
SalesOrderItem[] soItems = salesOrderItemList.item;
if (soItems != null && soItems.Length > 0)
{
for (var i = 0; i < soItems.Length; i++)
{
Console.WriteLine("Item Line On SO = " + soItems[i].line);
Console.WriteLine("Item Code = " + soItems[i].item.name);
Console.WriteLine("Item Descrition = " + soItems[i].description);
Console.WriteLine("Item Quantity = " + soItems[i].quantity);
Console.WriteLine("PO Vendor = " + soItems[i].poVendor.name);
Console.WriteLine("Price Internal = " + soItems[i].price.internalId);
Console.WriteLine("Item Internal Id = " + soItems[i].item.internalId);
}
}
string customerSearchValue = string.Empty;
if (salesOrder.shippingAddress.addressee.Contains(' '))
{
customerSearchValue = salesOrder.shippingAddress.addressee.Split(' ')[1] + ", " + salesOrder.shippingAddress.addressee.Split(' ')[0];
}
else
{
customerSearchValue = salesOrder.shippingAddress.addressee;
}
CustomerSearch customerSearch = new CustomerSearch();
SearchStringField customerEntityID = new SearchStringField();
customerEntityID.@operator = SearchStringFieldOperator.@is;
customerEntityID.operatorSpecified = true;
customerEntityID.searchValue = customerSearchValue;
CustomerSearchBasic customersearchBasic = new CustomerSearchBasic();
customersearchBasic.entityId = customerEntityID;
customerSearch.basic = customersearchBasic;
SearchResult searchResult = Service.search(customerSearch);
if (searchResult.status.isSuccess)
{
if (searchResult.recordList != null && searchResult.recordList.Length == 1)
{
//string entityID = ((Customer)searchResult.recordList[0]).entityId;
Console.WriteLine("Customer Id = " + ((Customer)searchResult.recordList[0]).entityId);
Console.WriteLine("Customer Internal Id = " + ((Customer)searchResult.recordList[0]).internalId);
}
}
}
Мне не удалось найти способ получить информацию ДОСТАВКА ПЕРЕВОЗЧИКА из объекта ЗАКАЗ НА ПРОДАЖУ. Нужен ваш совет по получению информации ДОСТАВКА.
Заранее спасибо.