我试图使用php netsuite api将salesorder设置为completed,但始终收到以下错误:
有效的行项目-您必须至少有一个有效的行项目
这次交易。
我用的是
https://github.com/ryanwinchester/netsuite-php
图书馆。
到目前为止,我有以下几点。我也试过使用初始化方法,我在一些例子中也看到过,但它们似乎都给出了相同的错误。如果有帮助的话,我们将使用先进的库存管理。
$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);
任何帮助都很好。:)