我正在尝试从 Netsuite 的某个仓库退回所有库存。我遇到了一些问题,想知道是否有人能指出我正确的方向。我要查询的仓库的 internalId 是 16。当我进行搜索时,它返回 0 个项目 - 但不会失败。
这是我正在使用的 PHP 代码。
<?php
require_once 'PHPtoolkit.php';
require_once 'login_info.php';
global $myNSclient;
$internalID = '16'; //Internal ID of the warehouse I want to query to see what inventory it has
$inventorySearch = new nsComplexObject("ItemSearchBasic");
$searchValue = new nsRecordRef(array('type' => 'location', 'internalId' => $internalID ));
$multiSelect = new nsComplexObject('SearchMultiSelectField');
$multiSelect->setFields(array('operator'=>'anyOf','searchValue'=>$searchValue,"operatorSpecified" => true));
$inventorySearch->setFields(array('location'=>$multiSelect));
try
{
$searchResponse = $myNSclient->search($inventorySearch);
$totalRecords = $searchResponse->totalRecords;
if ($totalRecords > 0)
{
echo "records found";
foreach ($searchResponse->recordList as $record)
{
echo "<pre>";
print_r($record);
echo "</pre>";
}
}
else
{
echo "No result found.";
}
}
catch (Exception $e)
{
echo $e;
echo "Item is not found. Please try again.";
exit();
}
这是 SOAP 请求
<?xml version="1.0" encoding="UTF-8" ?>
- <Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="urn:core_2011_2.platform.webservices.netsuite.com" xmlns:ns2="urn:common_2011_2.platform.webservices.netsuite.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ns3="urn:messages_2011_2.platform.webservices.netsuite.com">
- <Header>
- <passport actor="http://schemas.xmlsoap.org/soap/actor/next">
<email>xxxxx</email>
<password>[Content Removed for Security Reasons]</password>
<account>xxxxxx</account>
<role internalId="3" xsi:type="RecordRef" />
</passport>
</Header>
- <Bod
y>
- <search>
- <searchRecord xsi:type="ItemSearchBasic">
- <location operator="anyOf">
<searchValue internalId="16" type="location" />
</location>
</searchRecord>
</search>
</Body>
</Envelope>