我试图使用PHP Netsuite Api将SalesOrder设置为完成,但我一直收到以下错误:
VALID_LINE_ITEM_REQD-必须至少有一个有效的行项目这笔交易。
我正在使用https://github.com/ryanwinchester/netsuite-php图书馆
到目前为止,我有以下内容。我也尝试过使用Initialize方法,就像我在一些例子中看到的那样,但它们似乎都给出了相同的错误。如果有帮助的话,我们将使用高级库存管理。
$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);
任何帮助都会很棒。:(
将销售订单转换为
跨子公司项目履行记录将返回"VALID_LINE_ITEM_REQD>
如果我们没有在defaultValue参数中指定inventoryLocation,则此交易"错误"必须至少有一个有效的行项目。
function createIF(soId, invLocation) {
var itemFulfillment = record.transform({
fromType: record.Type.SALES_ORDER,
fromId: soId,
toType: record.Type.ITEM_FULFILLMENT,
defaultValues: {
inventorylocation: invLocation
}
});
/**
* You can insert other script logic here
*/
var ifID = itemFulfillment.save();
return ifID;
}
- 确保物品在库存中
- 确保您的子公司可以获得该商品
- 确保正确提交子列表(如果适用(
- 转储$saleItem以查看其中的内容,以确保注释为空