Netsuite 项目履行无效行项目

问题描述 投票:0回答:3

我正在尝试使用 PHP Netsuite Api 设置要履行的 SalesOrder,但我不断收到以下错误:

VALID_LINE_ITEM_REQD - 您必须至少有一个有效的订单项 这笔交易。

我正在使用 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);

任何帮助都会很棒。 :)

php netsuite suitetalk
3个回答
1
投票

将销售订单转换为

跨子公司物料履行记录将返回 “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;
    }


0
投票
  • 确保该商品在库存中
  • 确保该项目可供您的子公司使用
  • 确保您正确提交子列表(如果适用)
  • 转储 $saleItem 以查看其中的内容,以确保注释为空

0
投票

我今天也遇到同样的问题。

我也尝试使用 IntializeRecord,具有相同的返回...

<Body>
<add>
    <record xsi:type="ItemFulfillment">
        <createdFrom internalId="4069408" type="salesOrder"/>
        <shipStatus>_picked</shipStatus>
        <itemList replaceAll="true">
            <item>
                <location internalId="124"/>
                <quantity>1</quantity>
                <item internalId="48887" type="inventoryItem"/>
                <orderLine>1</orderLine>
                <itemIsFulfilled>true</itemIsFulfilled>
            </item>
        </itemList>
    </record>
</add>

你知道怎么做了吗?

谢谢

© www.soinside.com 2019 - 2024. All rights reserved.