NetSuite PHP 网络服务 API 不允许我设置 Serial/Lot 库存详细信息的数量以进行库存调整

NetSuite PHP web services API not allowing me to set Serial/Lot Number on Inventory Detail for Inventory Adjustment

我有以下用于 NetSuite PHP 网络服务的代码 API 但它不允许我在库存明细中设置 Serial/Lot 编号以进行库存调整。

// 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\.[=13=][=13=][=13=]\+[=13=]:[=13=][=13=]');   // 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 } } 

我们正在使用批号库存项目。 有谁知道我做错了什么?

原来正确的代码是这样的:

// Create new Inventory Adjustment.
$InventoryAdjustment = new InventoryAdjustment();
$InventoryAdjustment->externalId = 1000;
// Set Inventory Adjustment values. YYYY-MM-DDTHH:MM:SS.mmm-HH:MM.  For example: 2014-03-26T12:32:56.156-04:00
$InventoryAdjustment->tranDate = date('Y-m-d\TH:i:s\.[=10=][=10=][=10=]\+[=10=]:[=10=][=10=]');   // Set the Transaction Date to current date.
$InventoryAdjustment->account = new RecordRef();   // Adjustment Account
$InventoryAdjustment->account->internalId = '490';
// Create an Inventory Adjustment item line Inventory Details Assignment List's Assignment.
$inventoryAssignment = new InventoryAssignment();
$inventoryAssignment->receiptInventoryNumber = "SERIAL123";
//$inventoryAssignment->issueInventoryNumber = new RecordRef();
//$inventoryAssignment->issueInventoryNumber->internalId = 2;   // 456.
$inventoryAssignment->quantity = 3;   // Quantity.
// Create an Inventory Adjustment item line Inventory Detail's Assignment List.
$inventoryAssignmentList = new InventoryAssignmentList();
$inventoryAssignmentList->inventoryAssignment = $inventoryAssignment;                       // array($inventoryAssignment);
// Create an Inventory Adjustment item line's Inventory Detail.
$inventoryDetail = new InventoryDetail();
$inventoryDetail->inventoryAssignmentList = $inventoryAssignmentList;
// Create an Inventory Adjustment item line.
$InventoryAdjustmentInventory = new InventoryAdjustmentInventory();
             // $InventoryAdjustmentInventory->line = 0;                     // Line number.
$InventoryAdjustmentInventory->item = new RecordRef();       // Item.
$InventoryAdjustmentInventory->item->internalId = 1083;
$InventoryAdjustmentInventory->location = new RecordRef();   // Location.
$InventoryAdjustmentInventory->location->internalId = 5;
$InventoryAdjustmentInventory->adjustQtyBy = 3;              // Adjust Quantity By.
$InventoryAdjustmentInventory->inventoryDetail = $inventoryDetail;       // Inventory Detail.
// Set the Inventory Adjustment Items.
$InventoryAdjustmentInventoryList = new InventoryAdjustmentInventoryList();
$InventoryAdjustmentInventoryList->inventory = $InventoryAdjustmentInventory;

$InventoryAdjustment->inventoryList = $InventoryAdjustmentInventoryList;

// Setup the Insert/Update request.
$request = new UpsertRequest();
$request->record = $InventoryAdjustment;
// Execute the creation request and get the response.
$addResponse = $service->upsert($request);