我有以下 NetSuite PHP Web 服务 API 代码,但它不允许我在库存详细信息上设置序列号/批号以进行库存调整。
// Create new Inventory Adjustment.
$conv = new InventoryAdjustment();
// Set Inventory Adjustment values. YYYY-MM-DDTHH:MM:SS.mmm-HH:MM. For example: 2014-03-26T12:32:56.156-04:00
$conv->tranDate = date('Y-m-d\TH:i:s\.\0\0\0\+\0\2:\0\0'); // Set the Transaction Date to current date.
$conv->account = new RecordRef(); // Adjustment Account
$conv->account->internalId = '490'; // Consumables: Packing Materials
// Creat an Inventory Adjustment item line Inventory Details Assignment List's Assignment.
$ass = new InventoryAssignment();
$ass->issueInventoryNumber = new RecordRef(); // Lot Number. See SYN Inventory Numbers Saved Search.
$ass->issueInventoryNumber->internalId = '2'; // 456.
$ass->quantity = 3; // Quantity.
// Create an Inventory Adjustment item line Inventory Detail's Assignment List.
$detass = new InventoryAssignmentList();
$detass->inventoryAssignment = array($ass);
// Create an Inventory Adjustment item line's Inventory Detail.
$det = new InventoryDetail();
$det->inventoryAssignmentList = $detass;
// Create an Inventory Adjustment item line.
$line = new InventoryAdjustmentInventory();
$line->line = 0; // Line number.
$line->item = new RecordRef(); // Item.
$line->item->internalId = '1083'; // Internal id of item
$line->location = new RecordRef(); // Location.
$line->location->internalId = '5'; // My location
$line->adjustQtyBy = 3; // Adjust Quantity By.
$line->inventoryDetail = $det; // Inventory Detail.
// Set the Inventory Adjustment Items.
$conv->inventoryList = new InventoryAdjustmentInventoryList();
$conv->inventoryList->inventory = array($line);
// Setup the creation request.
$request = new AddRequest();
$request->record = $conv;
// Execute the creation request and get the response.
$addResponse = $service->add($request);
if ($addResponse->writeResponse->status->isSuccess)
{
echo 'Add Inventory Adjustment Successful' . $addResponse->writeResponse->baseRef->internalId;
}
else
{
echo '<br><br>Add Inventory Adjustment NOT Successful<br><br>';
var_dump($addResponse);
}
我收到以下错误:
Add Inventory Adjustment NOT Successful
object(AddResponse)#6 (1) { ["writeResponse"]=> object(WriteResponse)#22 (2) { ["status"]=> object(Status)#23 (2) { ["statusDetail"]=> array(1) { [0]=> object(StatusDetail)#24 (4) { ["code"]=> string(23) "INSUFFICIENT_PERMISSION" ["message"]=> string(290) "You do not have permissions to set a value for element inventoryassignment.issueinventorynumber due to one of the following reasons: 1) The field is read-only; 2) An associated feature is disabled; 3) The field is available either when a record is created or updated, but not in both cases." ["afterSubmitFailed"]=> NULL ["type"]=> string(5) "ERROR" } } ["isSuccess"]=> bool(false) } ["baseRef"]=> NULL } }
我们正在使用批号库存项目。有谁知道我做错了什么?