我正在尝试将SalesOrder设置为使用PHP Netsuite Api来实现,但我不断收到以下错误:
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);
任何帮助都会很棒。 :)
答案 0 :(得分:0)
将销售订单转换为
跨子公司项目履行记录将返回 “ VALID_LINE_ITEM_REQD>
如果我们未在defaultValue参数中指定ventoryLocation,则必须为此交易至少拥有一个有效的订单项。
# Configuration Variables for slack and free disk space capacity threshold to send slack messsage
$slackUrl = "SOME SLACK CHANNEL URL"
$slackBotName = "*Diskspace Bot*"
$slackWarningMsg = "*Critical* :fire:"
$WarningThresholdGB = 80
# Get disk information.
$driveLetter = "C:"
$diskInfo = Get-WmiObject win32_logicaldisk -Filter "DeviceID = '$driveLetter'" |Select-Object DeviceID, FreeSpace, Size
$diskName = $diskInfo.DeviceID
$diskGBFree = $diskInfo.FreeSpace
$diskCapacity = $diskInfo.Size
# Convert to GiB
$diskGBFree = [math]::Round($diskGBFree / 1GB)
$diskGBCapacity = [math]::Round($diskCapacity / 1GB)
$diskGBUsed = [math]::Round($diskGBCapacity - $diskGBFree)
# Checks to see if free diskspace threshold has been reached, if so, send a message to slack
If ($diskGBFree -lt $WarningThresholdGB) {
$slackMessage = @{
text = "
$slackBotName
$slackWarningMsg
*Location:* $env:computername
*Drive Name:* $diskName Drive
*Low disk space Alert:* $diskGBUsed GB / $diskGBCapacity GB
"
}
Invoke-Webrequest `
-Uri $slackUrl `
-Method Post `
-Body (ConvertTo-Json -InputObject $slackMessage)
}
答案 1 :(得分:-1)