我正在尝试使用 PHP Netsuite Api 将 SalesOrder 设置为已完成,但我不断收到以下错误:
VALID_LINE_ITEM_REQD - 此交易您必须至少有一个有效的行项目。
我正在使用https://github.com/ryanwinchester/netsuite-php库。
到目前为止,我有以下内容。我也尝试过使用在一些示例中看到的 Initialise 方法,但它们似乎都给出了相同的错误。如果有帮助,我们将使用高级库存管理。
$itemFulfillment = new ItemFulfillment();
// Sales Order
$itemFulfillment->createdFrom = new RecordRef();
$itemFulfillment->createdFrom->internalId = <SALES_ORDER_ID>;
$itemFulfillment->shipStatus = ItemFulfillmentShipStatus::_shipped;
// Customer
$itemFulfillment->entity = new RecordRef();
$itemFulfillment->entity->internalId = <CUSTOMER_ID>;
// List
$fullfillmentList = new ItemFulfillmentItemList();
$fullfillmentList->replaceAll = true;
foreach($salesOrder->itemList->item as $saleItem) {
$item = new ItemFulfillmentItem();
$item->location = new RecordRef();
$item->location->internalId = 4;
$item->item = new RecordRef();
$item->item->internalId = $saleItem->item->internalId;
$item->itemIsFulfilled = true;
$item->itemReceive = true;
$item->quantity = $saleItem->quantity;
$item->orderLine = $saleItem->line;
// Department Reference
$departmentRec = new RecordRef();
$departmentRec->internalId = 5;
$item->department = $departmentRec;
$fullfillmentList->item[] = $item;
}
$itemFulfillment->itemList = $fullfillmentList;
$request = new AddRequest();
$request->record = $itemFulfillment;
$client->add($request);
任何帮助都会很棒。:)