0

我正在尝试创建从 PurchaseOrder 创建的 ItemReceipt。我在创建过程中在采购订单中手动添加我的库存项目。当我收到此订单时,NetSuite Web 服务抛出以下错误:

不允许向子列表项添加新行。

虽然我也尝试过 ItemReceiptItemList 的 replaceAll 属性。

这是我的代码:

$tranDate = new \DateTime();
$tranDate = $tranDate->format('Y-m-d\TH:i:s');

$nsInventoryDetail = new InventoryDetail();

$nsInventoryAssignmentList = new InventoryAssignmentList();

$nsInventoryAssignmentList->replaceAll = true;

$nsInventoryAssignment[0] = new InventoryAssignment();

$nsInventoryAssignment[0]->receiptInventoryNumber = 3310; //NS inventory item id

$nsInventoryAssignment[0]->quantity = 1;

$nsInventoryAssignmentList->inventoryAssignment = $nsInventoryAssignment;

$nsInventoryDetail->inventoryAssignmentList = $nsInventoryAssignmentList;

$nsItemReceiptItem = new ItemReceiptItem();

$nsItemReceiptItem->item = new RecordRef();

$nsItemReceiptItem->item->internalId = 3310;

$nsItemReceiptItem->location = new RecordRef();

$nsItemReceiptItem->location->internalId = 1; // NS inventory location id

$nsItemReceiptItem->itemReceive = true;

$nsItemReceiptItem->rate = $purchasePrice->getAmount();

$nsItemReceiptItem->currency = $purchasePrice->getCurrency();

$nsItemReceiptItem->inventoryDetail = $nsInventoryDetail;

$itemList = new ItemReceiptItemList();

$itemList->item = [$nsItemReceiptItem];

$itemList->replaceAll = true;

$nsItemReceipt = new ItemReceipt();

$nsItemReceipt->createdFrom = new RecordRef();

$nsItemReceipt->createdFrom->internalId = 1223; // NS purchase order id 

$nsItemReceipt->tranDate = $tranDate;

$nsItemReceipt->itemList = $itemList;

print_r($nsItemReceipt);


$nsItemReceipt = $this->itemReceiptService->create($nsItemReceipt);

抛出以下内容:不允许向子列表项添加新行。

以下是我正在发送的 ItemReceipt 对象:

NetSuite\Sdk\ItemReceipt Object
(
    [createdDate] => 
    [lastModifiedDate] => 
    [customForm] => 
    [exchangeRate] => 
    [entity] => 
    [currencyName] => 
    [subsidiary] => 
    [createdFrom] => NetSuite\Sdk\RecordRef Object
        (
            [internalId] => 1223
            [externalId] => 
            [type] => purchaseOrder
            [name] => 
        )

    [tranDate] => 2020-01-02T13:45:36
    [partner] => 
    [postingPeriod] => 
    [tranId] => 
    [inboundShipment] => 
    [memo] => 
    [itemFulfillment] => 
    [currency] => 
    [landedCostMethod] => 
    [landedCostPerLine] => 
    [itemList] => NetSuite\Sdk\ItemReceiptItemList Object
        (
            [item] => Array
                (
                    [0] => NetSuite\Sdk\ItemReceiptItem Object
                        (
                            [itemReceive] => 1
                            [jobName] => 
                            [item] => NetSuite\Sdk\RecordRef Object
                                (
                                    [internalId] => 3310
                                    [externalId] => 
                                    [type] => inventoryItem
                                    [name] => 
                                )

                            [orderLine] => 
                            [line] => 
                            [itemName] => 
                            [description] => 
                            [location] => NetSuite\Sdk\RecordRef Object
                                (
                                    [internalId] => 3
                                    [externalId] => 
                                    [type] => location
                                    [name] => 
                                )

                            [onHand] => 
                            [quantityRemaining] => 
                            [quantity] => 
                            [unitsDisplay] => 
                            [unitCostOverride] => 
                            [inventoryDetail] => NetSuite\Sdk\InventoryDetail Object
                                (
                                    [inventoryAssignmentList] => NetSuite\Sdk\InventoryAssignmentList Object
                                        (
                                            [inventoryAssignment] => Array
                                                (
                                                    [0] => NetSuite\Sdk\InventoryAssignment Object
                                                        (
                                                            [internalId] => 
                                                            [issueInventoryNumber] => 
                                                            [receiptInventoryNumber] => 
                                                            [binNumber] => 
                                                            [toBinNumber] => 
                                                            [quantity] => 1
                                                            [expirationDate] => 
                                                            [quantityAvailable] => 
                                                        )

                                                )

                                            [replaceAll] => 1
                                        )

                                    [customForm] => 
                                    [nullFieldList] => 
                                )

                            [serialNumbers] => 
                            [binNumbers] => 
                            [expirationDate] => 
                            [rate] => 7900
                            [currency] => AED
                            [restock] => 
                            [billVarianceStatus] => 
                            [isDropShipment] => 
                            [options] => 
                            [landedCost] => 
                            [customFieldList] => 
                        )

                )

            [replaceAll] => 1
        )

    [expenseList] => 
    [landedCostsList] => 
    [accountingBookDetailList] => 
    [customFieldList] => 
    [internalId] => 
    [externalId] => 
    [nullFieldList] => 
)

任何帮助都感激不尽。

4

1 回答 1

0

我在这里找到了这个工作示例

https://www.reddit.com/r/Netsuite/comments/ewlen8/suitetalk_issue_creating_itemreceipt/

-肥皂:身体

-

-

<q1:createdFrom internalId="35023" type="purchaseOrder"/>

-<q1:itemList>

-<q1:项目>

<q1:itemReceive>真</q1:itemReceive>

<q1:item internalId="1528"/>

<q1:orderLine>1</q1:orderLine>

<q1:数量>100</q1:数量>

</q1:item>

</q1:itemList>

</肥皂:身体>

我所要做的就是将 $item->line 更改为 $item->orderLine 并解决了问题 - 看起来您需要参考原始采购订单行号

于 2020-07-10T08:14:39.727 回答