2016-02-10 39 views
2

增加銷售訂單NetSuite的我越來越想通過PHP工具包銷售訂單添加到NetSuite的時候會出現錯誤使用PHP工具包量誤差

我的代碼:

<?php 

require_once '../PHPToolkit/NetSuiteService.php'; 

$service = new NetSuiteService(); 



$so->itemList = new SalesOrderItemList(); 
$item = new SalesOrderItem(); 
$so = new SalesOrder(); 

$entityRR = new RecordRef(); 
$entityRR->internalId = 10731; 
$entityRR->recordType = "customer"; 
$so->entity = $entityRR ; 
$so->currency->internalId = 1; 
$so->itemList = new SalesOrderItemList(); 
$soi = new SalesOrderItem(); 
$soi->item = new RecordRef(); 
$soi->item->internalId = 2551; 
$soi->quantity = 1; 

$pricelevelRR = new RecordRef(); 
$pricelevelRR->internalId = -1; 
$pricelevelRR->recordType = "priceLevel"; 

$soi->price = $pricelevelRR; 
$soi->rate = 55.3; 

$so->itemList->item = $soi; 

$so->subsidiary->internalId = 5; 
$so->location->internalId = 9; 


    $shipAddress = "123 the street Hampton NY 11937 United States"; 
    $billAddress = "123 The street Hampton NY 11937 United States"; 
$so->shippingAddress1 = $shipAddress; 
$so->billingAddress = $billAddress; 


$arr = get_defined_vars(); 
print_r($arr["so"]); 
$request = new AddRequest(); 
$request->record = $so; 

$addResponse = $service->add($request); 

if (!$addResponse->writeResponse->status->isSuccess) { 
echo "ADD ERROR"; 
exit(); 
} else { 
echo "ADD SUCCESS, id " . $addResponse->writeResponse->baseRef->internalId; 
} 

?> 

我得到的附加響應這

<platformCore:code>USER_ERROR</platformCore:code> 
<platformCore:message>Could not calculate cost for the selected Realtime rate. Missing/Illegal 
ShipTo/Address/StateProvinceCode</platformCore:message> 
</platformCore:statusDetail></platformCore:status></writeResponse> 
</addResponse></soapenv:Body></soapenv:Envelope> 

我不明白爲什麼它不會是能夠計算成本,也稱發貨地址丟失

回答

0

我注意到您輸入的送貨地址是一個整體文本。您是否嘗試過按地址欄輸入? NetSuite具有地址各個部分的字段:地址1,地址2,城市,州和郵政編碼。

它可能看起來這些字段是它返回錯誤的原因。